Observed since 21 Oct, 09:45 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
@0xsend/cws-client
Typed fetch client and helpers for the Canton Wallet Service API
Typed fetch client for the Canton Wallet Service (CWS) HTTP API, plus client-side helpers for verifying server-prepared submissions before signing.
cws-client is the integration surface for any TypeScript/JavaScript app that
needs to drive a Canton wallet — sending and accepting transfers, managing
preapprovals and automerge UTXO delegations, and operating multisig wallets —
without trusting the server to compose what gets signed.
npm install @0xsend/cws-client
Requires Node.js 20 or newer.
import { createClient } from '@0xsend/cws-client/client'
const wallet = createClient({
apiKey: 'sk_testnet_...',
network: 'testnet',
})
const multisigs = await wallet.multisig.listMultisigs()
createClient accepts either an apiKey + network pair (mainnet/testnet
presets, Keycloak token exchange handled internally) or a static token +
baseUrl for environments that mint their own bearer tokens.
Every mutation in CWS follows the same shape:
prepare* method on the client. The server returns a base64-encoded
PreparedTransaction and the hash it expects you to sign.verifyPreparedSubmission (or the topology variants below). If the hash
you recompute does not match what the server claims, do not sign —
the server is asking you to authorize something other than what you
requested.import {
createClient,
decodePreparedSubmission,
verifyPreparedSubmission,
} from '@0xsend/cws-client'
const prepared = await wallet.transaction.prepareTransferInstruction({
body: { to: counterparty, amount: '10.0', instrument },
})
const decoded = decodePreparedSubmission(prepared.data.preparedTransaction)
verifyPreparedSubmission({
preparedTransaction: decoded,
expectedHash: prepared.data.preparedTransactionHash,
intent: { kind: 'transfer', to: counterparty, amount: '10.0', instrument },
})
const signature = await sign(prepared.data.preparedTransactionHash) // your signer
await wallet.transaction.submit({ body: { /* prepared id, signature */ } })
For wallets where the active key is the sole signer, use the transaction.*
prepare helpers. The server submits the transaction as soon as it receives a
valid signature — no queue, no co-signers.
Available flows:
prepareTransferInstruction — send a transfer.prepareTransferInstructionAccept / Reject / Withdraw — respond to a
pending transfer instruction.prepareBulkTransfer / prepareBulkTransferSetup — batch multiple
transfers into a single signed submission.preparePreapproval / preparePreapprovalRevoke — manage transfer
preapprovals (see below).prepareAutoMerge / prepareAutoMergeRevoke — manage automerge UTXO
delegations (see below).Each prepare* returns the same prepared-transaction envelope; verify and
sign it the same way.
Multisigs in CWS are first-class wallet accounts with their own party id, threshold, and signer set. The lifecycle:
multisig.create proposes a new multisig with an initial
member set and threshold. Each prospective member signs the topology
transaction before the multisig becomes active.prepare* method (transfer,
preapproval, automerge, topology) with the multisig party id as the actor.
The caller must pass CWS membership checks and the Canton authorization
required for the generated actAs/submit path; membership alone is not a
Ledger API rights bypass. The server decomposes the prepared submission into
a queued transaction visible to every member.verifyPreparedSubmission (or verifyPreparedMultisigTopology
/ verifyPreparedTopologyUpdate for topology changes) and submit their
signatures via multisig.approveTransaction / approveTopologyUpdate.multisig.submit (or the
server's auto-submit, when configured) finalizes the transaction on the
ledger.Topology changes (add/remove member, change threshold) flow through the same prepare → verify → sign loop, with their own verifier so you can recompute the multi-hash before authorizing a change to the signer set.
A preapproval is a long-lived authorization for a counterparty to pull a specified instrument from your wallet without a per-transfer signature. CWS exposes both grant and revoke as prepared submissions:
preparePreapproval — grant. Verify that the prepared submission targets
the counterparty and instrument you intend, optionally with an expiry.preparePreapprovalRevoke — revoke a specific preapproval contract.Preapprovals are used by services that need recurring debits (subscriptions, streaming payments) and by automerge providers (below).
Canton wallets accumulate small UTXOs as they receive funds. Automerge is a delegation that authorizes a provider to consolidate those UTXOs back into a single holding on your behalf, without you signing each merge. This keeps wallets responsive when sending — fewer, larger UTXOs mean fewer inputs to gather and sign.
prepareAutoMerge — grant the delegation, scoped to a provider party and
an instrument. The verifier ensures the prepared submission matches that
scope; the provider cannot use the delegation to move value off-wallet.prepareAutoMergeRevoke — revoke an active delegation contract.For multisig wallets, automerge follows the same queue-and-approve flow as any other prepared submission.
| Subpath | Use |
|---|---|
@0xsend/cws-client | createClient, prepared-submission verifiers (verifyPreparedSubmission, verifyPreparedMultisigTopology, verifyPreparedTopologyUpdate, verifyTopologyTransactionHashes), network presets, response types |
@0xsend/cws-client/client | Client-construction surface only — createClient, CantonWallet, type-only re-exports of the generated wallet types. Use this when you only need types and want to avoid pulling in the verifier code. |
resolveNetwork and NETWORKS expose the built-in mainnet/testnet base URL
and Keycloak presets for callers that want to introspect or override them.
MIT
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
zodEnvironment{
"local_name": "zod",
"alias": false,
"peer_metadata": null
} | ^4.1.13 | runtime |
joseEnvironment{
"local_name": "jose",
"alias": false,
"peer_metadata": null
} | ^6.0.11 | runtime |
@noble/curvesEnvironment{
"local_name": "@noble/curves",
"alias": false,
"peer_metadata": null
} | ^2.0.1 | runtime |
@noble/hashesEnvironment{
"local_name": "@noble/hashes",
"alias": false,
"peer_metadata": null
} | ^2.0.1 | runtime |
@bufbuild/protobufEnvironment{
"local_name": "@bufbuild/protobuf",
"alias": false,
"peer_metadata": null
} | ^2.9.0 | runtime |
rollupEnvironment{
"local_name": "rollup",
"alias": false,
"peer_metadata": null
} | ^4.0.0 | development |
vitestEnvironment{
"local_name": "vitest",
"alias": false,
"peer_metadata": null
} | ^3.2.4 | development |
esbuildEnvironment{
"local_name": "esbuild",
"alias": false,
"peer_metadata": null
} | ^0.27.0 | development |
typescriptEnvironment{
"local_name": "typescript",
"alias": false,
"peer_metadata": null
} | ^5.8.3 | development |
rollup-plugin-dtsEnvironment{
"local_name": "rollup-plugin-dts",
"alias": false,
"peer_metadata": null
} | ^6.0.0 | development |
@0xsend/cws-sharedEnvironment{
"local_name": "@0xsend/cws-shared",
"alias": false,
"peer_metadata": null
} | workspace:* | development |
@hey-api/openapi-tsEnvironment{
"local_name": "@hey-api/openapi-ts",
"alias": false,
"peer_metadata": null
} | ^0.94.2 | development |
@0xsend/canton-clientEnvironment{
"local_name": "@0xsend/canton-client",
"alias": false,
"peer_metadata": null
} | 3.4.11-next.1776829204 | development |
@0xsend/canton-protobufEnvironment{
"local_name": "@0xsend/canton-protobuf",
"alias": false,
"peer_metadata": null
} | 3.4.11-next.1776829204 | development |
@0xsend/external-signingEnvironment{
"local_name": "@0xsend/external-signing",
"alias": false,
"peer_metadata": null
} | workspace:* | development |
Source distribution
{
"shasum": "8dfd559ef007253226c984f568337a91e68b9377",
"tarball": "https://registry.npmjs.org/@0xsend/cws-client/-/cws-client-0.1.2.tgz",
"fileCount": 8,
"integrity": "sha512-ck1ejeqDPmPyWf2Oghvm6XXmY8qn7V6yIeDTl2I50Bz1EEuxoiUKWuWShNR/N9OhyL0EbIMtRtREMObZLD1mKw==",
"signatures": [
{
"sig": "MEYCIQDlLCrhg0DCaI2UHBUAJHwkiKfeferwGpTMNXCF+ToLRQIhAJkmr/ATb4x9UMqWiMPneFqlDrXS5iyrEpNsJAq3v2ie",
"keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
}
],
"unpackedSize": 405414
}Shared repository data · GitHub
Observed since 21 Oct, 09:45 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:a1d31709d81a8a08a167c9ea2dffe75cd003220fd9dbc10e9409928c0cc77bdc