Skip to content
This repository was archived by the owner on Sep 24, 2026. It is now read-only.
This repository was archived by the owner on Sep 24, 2026. It is now read-only.

Amulet preapproval fails because the SDK removed the fields rpc.ts reads #9

Closed

Description

@gabitoesmiapodo

Description

Turning on auto-accept fails. amulet.preapproval.create and amulet.preapproval.acceptProposal throw "Amulet service context is unavailable" before doing any work.

src/rpc.ts reads ctx.amuletService.scanProxyClient and ctx.amuletService.tokenStandard. Both are now undefined. @canton-network/core-amulet-service 1.8.0 turned AmuletService into a wrapper around a private serviceImpl. Through 1.7.0 both were public fields. getAmuletRules and getActiveOpenMiningRound left the public surface entirely.

The bump was not deliberate. wallet-sdk is pinned at 1.3.1 but asks for ^1.3.1 on sixteen core-* packages, so a reinstall walked core-amulet-service up to 1.10.1.

pnpm typecheck stayed silent because src/rpc.ts describes the SDK with its own hand-written Cip56TokenSdk type that marks these fields optional.

Steps to reproduce

  1. Start Splice LocalNet and the participant
  2. Run pnpm run build && pnpm start with the LocalNet .env
  3. Send the request below
curl -s -X POST http://localhost:3010/rpc -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"amulet.preapproval.create","params":{"receiver":"alien::1220aa"}}'

Expected vs actual behavior

Expected: a commands payload for the wallet to sign

Actual: {"code":-32000,"message":"Amulet service context is unavailable"}

Environment

Package: @bootnodedev/canton-wallet-service 0.2.0
@canton-network/wallet-sdk: 1.3.1 (pinned)
@canton-network/core-amulet-service: 1.10.1 (resolved)
Node: 24
Network: Splice LocalNet

Additional context

Affected code

  • src/rpc.ts:894 and src/rpc.ts:960 read scanProxyClient
  • src/rpc.ts:961 reads tokenStandard, used at src/rpc.ts:993
  • The guards throw at src/rpc.ts:899 and src/rpc.ts:971
  • amulet.preapproval.status and Tap Amulet still work, since they call public SDK methods

Fix

  1. Use ctx.tokenStandardService in place of ctx.amuletService.tokenStandard, same getInputHoldingsCids signature
  2. Build ScanProxyClient directly from @canton-network/core-splice-client, added as a direct dependency
  3. Adapt CantonTokenProvider.getToken() to the AccessTokenProvider interface that client wants
  4. Tighten Cip56TokenSdk so a removed SDK field fails pnpm typecheck
  5. Add a pnpm overrides block pinning every @canton-network/core-* package

Do not reach for serviceImpl.scanProxyClient; it breaks again on the next SDK refactor. Do not pin core-amulet-service back to 1.7.x.

Acceptance criteria

  • amulet.preapproval.create returns commands instead of the error
  • amulet.preapproval.acceptProposal completes
  • Both guards fail only on missing config, never on a renamed SDK field
  • Every @canton-network/core-* version is pinned
  • A removed SDK field fails pnpm typecheck
  • A unit test covers preapproval command construction
  • pnpm run lint, pnpm typecheck, pnpm test, pnpm knip and pnpm run build all pass

Prove it on LocalNet

  • The reproduction curl returns a commands payload
  • In Carpincho, turning on "Auto-accept incoming" raises no error toast
  • amulet.preapproval.status then reports active: true
  • Turning it back off returns status to active: false
  • Tap Amulet still works
  • Sending a transfer still works

Release and deploy

  • Bump the version in package.json, latest tag is v0.2.0
  • Commit as chore: release <version> and tag v<version>
  • Push the branch and the tag
  • Pull the tagged commit on the Digital Ocean droplet
  • Run docker compose up --build -d there
  • Check curl -fsS http://<host>:3010/health
  • Run the reproduction curl against the droplet and confirm it returns commands

Metadata

Metadata

Labels

bugSomething isn't workingpriority: highMust be addressed in current sprint

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions