@ftptech/x402-canton-ledger
v0.1.1
Published
Shared Canton ledger primitives — JSON Ledger API v2 client, Ed25519 external-party signing, Scan API client. Used by @ftptech/x402-canton-facilitator and @ftptech/x402-canton-client.
Maintainers
Readme
@ftptech/x402-canton-ledger
Shared Canton ledger primitives used by both
@ftptech/x402-canton-facilitator (server side) and
@ftptech/x402-canton-client (payer side).
Install
npm i @ftptech/x402-canton-ledgerNote: the
@ftpnpm scope is not final — it may change before the first public release (seedocs/PUBLISHING.md). Pin the version you install and check the README for the current package name.
What's in here
CantonClient— JSON Ledger API v2 wrapper. Encodes the documented gotchas (template id#package:Module:Entity, wrapped vs flat body shapes per endpoint,disclosedContracts, DamlIntas JSON string). IncludessubmitAndWaitForTransaction,submitAndWait,queryActiveContracts,getLedgerEnd, and theinteractiveSubmissionPrepare+interactiveSubmissionExecutepair used for external-party signing.CantonExternalPartySigner+ed25519KeyFromNodeKeyPairsignPreparedTransactionHash— Ed25519 signing primitives over/v2/interactive-submission/prepare+/execute. Lets an agent hold its own key and authorize commands without surrendering it to a participant.
ScanClient— Scan API reader for AmuletRules, open-and-issuing mining rounds, completed transfers viagetUpdateById, transfer-kind resolution (resolveTransferKind), and traffic-status. Validator-proxy + SV-direct flavors.
Why a separate package
Facilitator-side domain wrappers (Cip56InstructionService,
MerchantContractService, PreapprovalService) live in
@ftptech/x402-canton-facilitator because they encode the facilitator's
role (Scan-read verify, MerchantContract template, preapproval
provider). The lower-level Canton plumbing in this package is reusable
by anyone — including the client SDK's Cip56KeyfileSigner, which uses
CantonExternalPartySigner to submit a TransferFactory_Transfer from
the agent's own participant.
