@ftptech/canton-agent-wallet 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -2
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +11 -0
- package/dist/cli-args.js.map +1 -1
- package/dist/cli.js +122 -3
- package/dist/cli.js.map +1 -1
- package/dist/hosted-onboard.d.ts +88 -0
- package/dist/hosted-onboard.d.ts.map +1 -0
- package/dist/hosted-onboard.js +207 -0
- package/dist/hosted-onboard.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/onboard.d.ts +8 -0
- package/dist/onboard.d.ts.map +1 -1
- package/dist/onboard.js +13 -4
- package/dist/onboard.js.map +1 -1
- package/dist/pay.d.ts +27 -0
- package/dist/pay.d.ts.map +1 -1
- package/dist/pay.js +33 -12
- package/dist/pay.js.map +1 -1
- package/dist/relay-client.d.ts +96 -0
- package/dist/relay-client.d.ts.map +1 -1
- package/dist/relay-client.js +36 -0
- package/dist/relay-client.js.map +1 -1
- package/dist/relay-signer.d.ts +15 -0
- package/dist/relay-signer.d.ts.map +1 -1
- package/dist/relay-signer.js +127 -1
- package/dist/relay-signer.js.map +1 -1
- package/dist/tx.d.ts +228 -0
- package/dist/tx.d.ts.map +1 -1
- package/dist/tx.js +416 -1
- package/dist/tx.js.map +1 -1
- package/dist/verify-prepared.d.ts +231 -0
- package/dist/verify-prepared.d.ts.map +1 -1
- package/dist/verify-prepared.js +1046 -13
- package/dist/verify-prepared.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -26,8 +26,11 @@ canton-agent-wallet create --relay-url <url> # generate + onboard a self-
|
|
|
26
26
|
canton-agent-wallet address # print the party id (fund this)
|
|
27
27
|
canton-agent-wallet balance # print CC balance
|
|
28
28
|
canton-agent-wallet claim # accept incoming transfers (e.g. the initial funding)
|
|
29
|
+
canton-agent-wallet merchant-onboard --facilitator <party> --synchronizer <id> # EXTERNAL-PARTY merchant: sign this wallet's once-total MerchantConsent (allocation-direct)
|
|
30
|
+
canton-agent-wallet merchant-onboard-hosted --party <merchantParty> --facilitator <party> --participant-url <url> --synchronizer <id> --user-id <id> # HOSTED-PARTY merchant: create its once-total MerchantConsent via its own node's Ledger API
|
|
29
31
|
canton-agent-wallet pay --relay-url <url> <url> # fetch a URL, auto-paying any x402 402 challenge
|
|
30
32
|
canton-agent-wallet withdraw --to <party> [--amount <cc>] # send CC back out (default: full balance)
|
|
33
|
+
canton-agent-wallet reclaim --allocation-cid <cid> [--receiver <merchantParty>] # recover funds from an unsettled DIRECT allocation after settleBefore (Allocation_Withdraw)
|
|
31
34
|
canton-agent-wallet export # print the private key (backup; guard it)
|
|
32
35
|
```
|
|
33
36
|
|
|
@@ -36,11 +39,36 @@ canton-agent-wallet export # print the private key (ba
|
|
|
36
39
|
default would silently send payments to a dead host, so the CLI fails fast when
|
|
37
40
|
none is given. `address`, `balance`, `claim`, `withdraw` and `export` reuse the
|
|
38
41
|
relay stored in the wallet at `create` time. The current FTP facilitator is
|
|
39
|
-
`
|
|
42
|
+
`https://facilitator.ftptech.xyz`.
|
|
43
|
+
|
|
44
|
+
### Merchant onboarding: external-party vs hosted-party
|
|
45
|
+
|
|
46
|
+
To be paid via the allocation-direct (Design B) path, a merchant signs a
|
|
47
|
+
once-total `MerchantConsent` naming the facilitator. There are two onboarding
|
|
48
|
+
commands depending on where the merchant party lives:
|
|
49
|
+
|
|
50
|
+
- **`merchant-onboard`** — the merchant is an **external party** held in *this*
|
|
51
|
+
agent-wallet (an Ed25519 self-custody key). It onboards through the relay's
|
|
52
|
+
interactive prepare → sign-the-hash-locally → execute flow, gated by
|
|
53
|
+
verify-before-sign. Needs a wallet (and a relay).
|
|
54
|
+
- **`merchant-onboard-hosted`** — the merchant is a **hosted party** that lives
|
|
55
|
+
on its **own Canton node** (a validator it operates), with no Ed25519 key. It
|
|
56
|
+
authorizes the consent directly on its own participant's JSON Ledger API
|
|
57
|
+
(`actAs: [merchant]`); there is **no wallet, no relay, and no Ed25519 key**, so
|
|
58
|
+
this command loads none. The create shape is fixed
|
|
59
|
+
(`MerchantConsent {merchant, facilitator}`) and moves no funds — there is no
|
|
60
|
+
untrusted relay in the loop, so no verify-before-sign is required. Node
|
|
61
|
+
connection comes from `--participant-url` / `--synchronizer` / `--user-id`
|
|
62
|
+
(falling back to `CANTON_PARTICIPANT_URL` / `CANTON_SYNCHRONIZER_ID` /
|
|
63
|
+
`CANTON_USER_ID`); flags override env. **OIDC credentials are read from env
|
|
64
|
+
ONLY** (never accepted as flags): `OIDC_TOKEN_ENDPOINT`, `OIDC_CLIENT_ID`,
|
|
65
|
+
`OIDC_CLIENT_SECRET`, `LEDGER_API_AUDIENCE`, and optional `OIDC_SCOPE`. The
|
|
66
|
+
command is idempotent — if the consent already exists it prints "already
|
|
67
|
+
onboarded" and submits nothing.
|
|
40
68
|
|
|
41
69
|
On Canton, incoming CC arrives as a **pending transfer** the agent must accept,
|
|
42
70
|
so the first-run flow is:
|
|
43
|
-
`create --relay-url
|
|
71
|
+
`create --relay-url https://facilitator.ftptech.xyz` → tell your human to send CC to
|
|
44
72
|
the printed party id → `claim` → `balance`. Funding once is the only human step,
|
|
45
73
|
exactly like funding an EVM agent.
|
|
46
74
|
|
package/dist/cli-args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-args.d.ts","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,eAAe,mBAAmB,CAAC;AAEhD,8EAA8E;AAC9E,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"cli-args.d.ts","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,eAAe,mBAAmB,CAAC;AAEhD,8EAA8E;AAC9E,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,MAAM,CAgB1C,CAAC;AAEH,gEAAgE;AAChE,wBAAgB,IAAI,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG9E;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAW7D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,GAAG,SAAS,CAEpB;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAC5B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,CAER;AAED,iEAAiE;AACjE,eAAO,MAAM,kBAAkB,QAEkD,CAAC"}
|
package/dist/cli-args.js
CHANGED
|
@@ -12,6 +12,17 @@ export const VALUE_FLAGS = new Set([
|
|
|
12
12
|
"--network",
|
|
13
13
|
"--to",
|
|
14
14
|
"--amount",
|
|
15
|
+
"--allocation-cid",
|
|
16
|
+
"--receiver",
|
|
17
|
+
"--key-file",
|
|
18
|
+
"--facilitator",
|
|
19
|
+
"--synchronizer",
|
|
20
|
+
// merchant-onboard-hosted (hosted-party merchant onboards via its OWN node's
|
|
21
|
+
// Ledger API — no wallet, no relay): node connection flags. Secrets are NEVER
|
|
22
|
+
// accepted as flags (OIDC config comes from env only), so none appear here.
|
|
23
|
+
"--party",
|
|
24
|
+
"--participant-url",
|
|
25
|
+
"--user-id",
|
|
15
26
|
]);
|
|
16
27
|
/** First value following `--<name>` in `args`, or undefined. */
|
|
17
28
|
export function flag(args, name) {
|
package/dist/cli-args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAEhD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC;IACtD,aAAa;IACb,WAAW;IACX,MAAM;IACN,UAAU;
|
|
1
|
+
{"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAEhD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC;IACtD,aAAa;IACb,WAAW;IACX,MAAM;IACN,UAAU;IACV,kBAAkB;IAClB,YAAY;IACZ,YAAY;IACZ,eAAe;IACf,gBAAgB;IAChB,6EAA6E;IAC7E,8EAA8E;IAC9E,4EAA4E;IAC5E,SAAS;IACT,mBAAmB;IACnB,WAAW;CACZ,CAAC,CAAC;AAEH,gEAAgE;AAChE,MAAM,UAAU,IAAI,CAAC,IAAuB,EAAE,IAAY;IACxD,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,IAAuB;IACjD,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAW,CAAC;QAC5B,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACvB,CAAC,IAAI,CAAC,CAAC,CAAC,yBAAyB;YACjC,SAAS;QACX,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACd,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,IAAuB,EACvB,MAAyB,OAAO,CAAC,GAAG;IAEpC,OAAO,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,GAAG,CAAC,sBAAsB,IAAI,SAAS,CAAC;AAC9E,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,cAAc,CAC5B,IAAuB,EACvB,MAAyB,OAAO,CAAC,GAAG;IAEpC,OAAO,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,GAAG,CAAC,oBAAoB,IAAI,eAAe,CAAC;AAChF,CAAC;AAED,iEAAiE;AACjE,MAAM,CAAC,MAAM,kBAAkB,GAC7B,wEAAwE;IACxE,+EAA+E,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -6,6 +6,24 @@
|
|
|
6
6
|
* address print the party id (fund this)
|
|
7
7
|
* balance print CC balance
|
|
8
8
|
* claim accept incoming transfers (e.g. the initial funding)
|
|
9
|
+
* reclaim --allocation-cid <c> [--receiver <merchantParty>]
|
|
10
|
+
* reclaim a locked allocation back to this wallet
|
|
11
|
+
* (Allocation_Withdraw; funds return to the sender).
|
|
12
|
+
* Pass --receiver for a Design B DIRECT allocation
|
|
13
|
+
* (receiver == merchant); omit it for v1/escrow.
|
|
14
|
+
* merchant-onboard --facilitator <p> --synchronizer <id>
|
|
15
|
+
* EXTERNAL-PARTY merchant (this Ed25519 wallet):
|
|
16
|
+
* sign this wallet's once-total MerchantConsent so
|
|
17
|
+
* agents can pay it via the allocation-direct path
|
|
18
|
+
* merchant-onboard-hosted --party <p> --facilitator <p> --participant-url <url>
|
|
19
|
+
* --synchronizer <id> --user-id <id>
|
|
20
|
+
* HOSTED-PARTY merchant (party on its OWN Canton
|
|
21
|
+
* node): create its once-total MerchantConsent via
|
|
22
|
+
* that node's Ledger API (OIDC + actAs:[merchant]).
|
|
23
|
+
* No wallet, no relay, no Ed25519 key. OIDC config
|
|
24
|
+
* comes from env ONLY (OIDC_TOKEN_ENDPOINT,
|
|
25
|
+
* OIDC_CLIENT_ID, OIDC_CLIENT_SECRET,
|
|
26
|
+
* LEDGER_API_AUDIENCE, [OIDC_SCOPE]).
|
|
9
27
|
* pay [--relay-url <url>] <url> fetch a URL, auto-paying any x402 402 challenge
|
|
10
28
|
* withdraw --to <p> send CC back out (--amount <cc> for a partial amount)
|
|
11
29
|
* export print the private key (backup; guard it)
|
|
@@ -33,7 +51,8 @@ import { loadWallet } from "./store.js";
|
|
|
33
51
|
import { agentKeyFromPrivatePem } from "./keys.js";
|
|
34
52
|
import { makePayingFetch } from "./pay.js";
|
|
35
53
|
import { RelayClient } from "./relay-client.js";
|
|
36
|
-
import { claimAll } from "./tx.js";
|
|
54
|
+
import { claimAll, reclaimAllocation, createMerchantConsent } from "./tx.js";
|
|
55
|
+
import { createMerchantConsentHosted } from "./hosted-onboard.js";
|
|
37
56
|
import { withdraw } from "./withdraw.js";
|
|
38
57
|
import { installProxyFromEnv } from "./proxy.js";
|
|
39
58
|
import { flag, positionals, resolveNetwork, resolveRelayUrl, MISSING_RELAY_HELP, } from "./cli-args.js";
|
|
@@ -101,6 +120,104 @@ async function main() {
|
|
|
101
120
|
console.log(r.claimed ? `claimed ${r.claimed} incoming transfer(s)` : "nothing to claim");
|
|
102
121
|
break;
|
|
103
122
|
}
|
|
123
|
+
case "reclaim": {
|
|
124
|
+
// Track B: reclaim a locked allocation back to this wallet via
|
|
125
|
+
// Allocation_Withdraw. Funds return to the sender (this agent) by
|
|
126
|
+
// construction; verify-before-sign refuses any relay-swapped choice /
|
|
127
|
+
// different contract / outbound drain.
|
|
128
|
+
const w = loadWallet();
|
|
129
|
+
if (!w)
|
|
130
|
+
return fail("no wallet yet — run: canton-agent-wallet create");
|
|
131
|
+
const allocationCid = flag(args, "--allocation-cid");
|
|
132
|
+
if (!allocationCid)
|
|
133
|
+
return fail("usage: canton-agent-wallet reclaim --allocation-cid <cid> [--receiver <merchantParty>]");
|
|
134
|
+
// --receiver is OPTIONAL: supply it for a Design B DIRECT allocation, whose
|
|
135
|
+
// receiver is the MERCHANT (not the facilitator). The legitimate
|
|
136
|
+
// Allocation_Withdraw expire-lock context then references that merchant party,
|
|
137
|
+
// so the verify-before-sign backstop must be told the caller-known receiver to
|
|
138
|
+
// permit exactly that one party. Omit it for v1 / Design A escrow reclaim
|
|
139
|
+
// (receiver == facilitator, already permitted) — behavior is unchanged.
|
|
140
|
+
const receiver = flag(args, "--receiver");
|
|
141
|
+
const updateId = await reclaimAllocation(new RelayClient({ relayUrl: w.relayUrl, apiKey: API_KEY }), w, { allocationCid, ...(receiver ? { receiver } : {}) });
|
|
142
|
+
console.log(`reclaimed allocation ${allocationCid}\n updateId: ${updateId}`);
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
case "merchant-onboard": {
|
|
146
|
+
// Design B "2-tx DIRECT" onboarding (MERCHANT side, ONCE-TOTAL): this wallet
|
|
147
|
+
// signs its standing MerchantConsent so agents can later pay it via the
|
|
148
|
+
// allocation-direct path. Creating the consent MOVES NO FUNDS — it only
|
|
149
|
+
// captures the merchant's one-time authorization; verify-before-sign refuses
|
|
150
|
+
// any relay-swapped value-moving choice / substituted facilitator.
|
|
151
|
+
const w = loadWallet();
|
|
152
|
+
if (!w)
|
|
153
|
+
return fail("no wallet yet — run: canton-agent-wallet create");
|
|
154
|
+
const facilitator = flag(args, "--facilitator") || process.env.CANTON_X402_FACILITATOR;
|
|
155
|
+
const synchronizerId = flag(args, "--synchronizer") || process.env.CANTON_SYNCHRONIZER_ID;
|
|
156
|
+
if (!facilitator || !synchronizerId)
|
|
157
|
+
return fail("usage: canton-agent-wallet merchant-onboard --facilitator <party> --synchronizer <id>\n" +
|
|
158
|
+
" (or set CANTON_X402_FACILITATOR / CANTON_SYNCHRONIZER_ID)");
|
|
159
|
+
const updateId = await createMerchantConsent(new RelayClient({ relayUrl: w.relayUrl, apiKey: API_KEY }), w, { facilitator, synchronizerId });
|
|
160
|
+
console.log(`merchant onboarded for direct settlement (facilitator ${facilitator})\n` +
|
|
161
|
+
` MerchantConsent updateId: ${updateId}`);
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
case "merchant-onboard-hosted": {
|
|
165
|
+
// HOSTED-PARTY merchant onboarding (sibling of `merchant-onboard`, but for a
|
|
166
|
+
// party that lives on its OWN Canton node — NOT an external Ed25519 wallet).
|
|
167
|
+
// It authorizes its once-total MerchantConsent directly on its node's JSON
|
|
168
|
+
// Ledger API (actAs:[merchant]); there is NO wallet, NO relay, and NO
|
|
169
|
+
// Ed25519 key, so this case loads no wallet. The create shape is fixed
|
|
170
|
+
// (MerchantConsent{merchant, facilitator}) and moves no funds, so there is
|
|
171
|
+
// no untrusted relay to guard against — no verify-before-sign is needed.
|
|
172
|
+
// See hosted-onboard.ts for the hosted-vs-external rationale.
|
|
173
|
+
const merchant = flag(args, "--party");
|
|
174
|
+
const facilitator = flag(args, "--facilitator");
|
|
175
|
+
const participantUrl = flag(args, "--participant-url") || process.env.CANTON_PARTICIPANT_URL;
|
|
176
|
+
const synchronizerId = flag(args, "--synchronizer") || process.env.CANTON_SYNCHRONIZER_ID;
|
|
177
|
+
const userId = flag(args, "--user-id") || process.env.CANTON_USER_ID;
|
|
178
|
+
const HOSTED_USAGE = "usage: canton-agent-wallet merchant-onboard-hosted --party <merchantParty> " +
|
|
179
|
+
"--facilitator <facilitatorParty> --participant-url <url> --synchronizer <id> --user-id <id>\n" +
|
|
180
|
+
" --participant-url / --synchronizer / --user-id fall back to CANTON_PARTICIPANT_URL / " +
|
|
181
|
+
"CANTON_SYNCHRONIZER_ID / CANTON_USER_ID.\n" +
|
|
182
|
+
" OIDC config is read from ENV ONLY (never flags): OIDC_TOKEN_ENDPOINT, OIDC_CLIENT_ID, " +
|
|
183
|
+
"OIDC_CLIENT_SECRET, LEDGER_API_AUDIENCE, [OIDC_SCOPE].";
|
|
184
|
+
if (!merchant || !facilitator || !participantUrl || !synchronizerId || !userId) {
|
|
185
|
+
return fail(HOSTED_USAGE);
|
|
186
|
+
}
|
|
187
|
+
// Secrets come from ENV ONLY — never accept them on the command line (argv is
|
|
188
|
+
// visible in `ps`/shell history). Fail fast with the same usage line if any
|
|
189
|
+
// required OIDC value is missing.
|
|
190
|
+
const tokenEndpoint = process.env.OIDC_TOKEN_ENDPOINT;
|
|
191
|
+
const clientId = process.env.OIDC_CLIENT_ID;
|
|
192
|
+
const clientSecret = process.env.OIDC_CLIENT_SECRET;
|
|
193
|
+
const audience = process.env.LEDGER_API_AUDIENCE;
|
|
194
|
+
if (!tokenEndpoint || !clientId || !clientSecret || !audience) {
|
|
195
|
+
return fail(HOSTED_USAGE);
|
|
196
|
+
}
|
|
197
|
+
const res = await createMerchantConsentHosted({
|
|
198
|
+
participantUrl,
|
|
199
|
+
synchronizerId,
|
|
200
|
+
userId,
|
|
201
|
+
merchant,
|
|
202
|
+
facilitator,
|
|
203
|
+
oidc: {
|
|
204
|
+
tokenEndpoint,
|
|
205
|
+
clientId,
|
|
206
|
+
clientSecret,
|
|
207
|
+
audience,
|
|
208
|
+
...(process.env.OIDC_SCOPE ? { scope: process.env.OIDC_SCOPE } : {}),
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
if (res.created) {
|
|
212
|
+
console.log(`merchant onboarded for direct settlement (hosted party, facilitator ${facilitator})\n` +
|
|
213
|
+
` MerchantConsent created${res.contractId ? ` (cid ${res.contractId})` : ""}`);
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
console.log(`merchant already onboarded for direct settlement (hosted party, facilitator ${facilitator})\n` +
|
|
217
|
+
` existing MerchantConsent${res.contractId ? ` (cid ${res.contractId})` : ""} — nothing to do`);
|
|
218
|
+
}
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
104
221
|
case "pay": {
|
|
105
222
|
const url = positionals(args)[0];
|
|
106
223
|
if (!url)
|
|
@@ -167,8 +284,10 @@ async function main() {
|
|
|
167
284
|
break;
|
|
168
285
|
}
|
|
169
286
|
default:
|
|
170
|
-
console.error("canton-agent-wallet: create | address | balance | claim | pay <url> | withdraw --to <party> | export | import\n" +
|
|
171
|
-
" relay required for create/pay/import: --relay-url <url> or CANTON_AGENT_RELAY_URL"
|
|
287
|
+
console.error("canton-agent-wallet: create | address | balance | claim | reclaim --allocation-cid <cid> [--receiver <merchantParty>] | merchant-onboard --facilitator <party> --synchronizer <id> | merchant-onboard-hosted --party <merchantParty> --facilitator <party> --participant-url <url> --synchronizer <id> --user-id <id> | pay <url> | withdraw --to <party> | export | import\n" +
|
|
288
|
+
" relay required for create/pay/import: --relay-url <url> or CANTON_AGENT_RELAY_URL\n" +
|
|
289
|
+
" merchant-onboard = EXTERNAL-PARTY merchant (this Ed25519 wallet, via the relay).\n" +
|
|
290
|
+
" merchant-onboard-hosted = HOSTED-PARTY merchant (party on its OWN Canton node, via that node's Ledger API; OIDC config from env: OIDC_TOKEN_ENDPOINT/OIDC_CLIENT_ID/OIDC_CLIENT_SECRET/LEDGER_API_AUDIENCE/[OIDC_SCOPE]).");
|
|
172
291
|
process.exit(cmd ? 1 : 0);
|
|
173
292
|
}
|
|
174
293
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,+EAA+E;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,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
+
* HOSTED-party merchant onboarding for x402-direct ("Design B").
|
|
3
|
+
*
|
|
4
|
+
* HOSTED vs EXTERNAL — why this is a separate path
|
|
5
|
+
* ================================================
|
|
6
|
+
* The agent-wallet `merchant-onboard` command (`createMerchantConsent` in tx.ts)
|
|
7
|
+
* is EXTERNAL-PARTY only: the merchant party is an Ed25519 self-custody wallet,
|
|
8
|
+
* so it onboards via the relay's interactive prepare -> sign-the-hash-locally ->
|
|
9
|
+
* execute flow, gated by verify-before-sign (the relay is untrusted, so the agent
|
|
10
|
+
* structurally re-checks the relay-prepared bytes before signing with its key).
|
|
11
|
+
*
|
|
12
|
+
* A HOSTED-party merchant is different: its party lives on its OWN Canton node
|
|
13
|
+
* (a validator it operates), NOT in an external Ed25519 wallet. It therefore has
|
|
14
|
+
* NO Ed25519 key, NO relay, NO wallet.json — and needs none of them. It authorizes
|
|
15
|
+
* the `MerchantConsent` create directly on its own participant's JSON Ledger API
|
|
16
|
+
* with a plain `CreateCommand` (`actAs: [merchant]`); the merchant's node supplies
|
|
17
|
+
* the signatory authority. The facilitator is only an `observer` of the consent,
|
|
18
|
+
* so it sees it over the synchronizer and the existing facilitator-minted path
|
|
19
|
+
* (MerchantConsent_Accept) settles unchanged. No protocol change, no Ed25519.
|
|
20
|
+
*
|
|
21
|
+
* NO verify-before-sign is needed here (and there is nothing to verify against):
|
|
22
|
+
* the merchant's OWN node builds and submits exactly what this function asks it to.
|
|
23
|
+
* The create shape is fixed and value-moving-free by construction — a single
|
|
24
|
+
* `MerchantConsent {merchant, facilitator}` create that captures the merchant's
|
|
25
|
+
* one-time authorization and MOVES NO FUNDS. There is no untrusted relay in the
|
|
26
|
+
* loop to substitute a facilitator or swap in a drain, so the structural
|
|
27
|
+
* verify-before-sign backstop the external path applies has no role.
|
|
28
|
+
*
|
|
29
|
+
* PREREQ: the `x402-direct` DAR (x402-direct-0.1.0, package-id
|
|
30
|
+
* f819db3288986a7f6c3157359ed02040e0a6080ceb6890309ecbb71eeeb93780) must be
|
|
31
|
+
* uploaded + vetted on the merchant's participant so `#x402-direct:...` resolves.
|
|
32
|
+
*
|
|
33
|
+
* Idempotent (the consent is once-total): if a `MerchantConsent` for this
|
|
34
|
+
* (merchant, facilitator) already exists, this returns `{ created: false }` and
|
|
35
|
+
* submits nothing.
|
|
36
|
+
*
|
|
37
|
+
* Uses the global `fetch` (Node 18+); imports no Canton SDK — it is the same
|
|
38
|
+
* dependency-free OIDC + JSON Ledger API v2 pattern the facilitator's funder
|
|
39
|
+
* (e2e/fund.mjs) uses.
|
|
40
|
+
*/
|
|
41
|
+
/** OIDC client-credentials config for minting the JSON Ledger API bearer token. */
|
|
42
|
+
export interface HostedOidcConfig {
|
|
43
|
+
/** OIDC token endpoint (e.g. `https://<issuer>/oauth/token`). */
|
|
44
|
+
tokenEndpoint: string;
|
|
45
|
+
/** OIDC client id (m2m client authorized for the merchant's participant). */
|
|
46
|
+
clientId: string;
|
|
47
|
+
/** OIDC client secret. */
|
|
48
|
+
clientSecret: string;
|
|
49
|
+
/** Ledger API audience the token is minted for. */
|
|
50
|
+
audience: string;
|
|
51
|
+
/** Optional OIDC scope. */
|
|
52
|
+
scope?: string;
|
|
53
|
+
}
|
|
54
|
+
/** Inputs for {@link createMerchantConsentHosted}. */
|
|
55
|
+
export interface CreateMerchantConsentHostedOptions {
|
|
56
|
+
/** The merchant's participant JSON Ledger API base URL (no trailing path). */
|
|
57
|
+
participantUrl: string;
|
|
58
|
+
/** The synchronizer the consent is created on. */
|
|
59
|
+
synchronizerId: string;
|
|
60
|
+
/** The Ledger API user id to submit as (the merchant's participant m2m user). */
|
|
61
|
+
userId: string;
|
|
62
|
+
/** The merchant party id (signatory of the consent; also the `actAs` party). */
|
|
63
|
+
merchant: string;
|
|
64
|
+
/** The facilitator party id (observer of the consent). */
|
|
65
|
+
facilitator: string;
|
|
66
|
+
/** OIDC client-credentials config (token mint). */
|
|
67
|
+
oidc: HostedOidcConfig;
|
|
68
|
+
}
|
|
69
|
+
/** Result of {@link createMerchantConsentHosted}. */
|
|
70
|
+
export interface CreateMerchantConsentHostedResult {
|
|
71
|
+
/** `true` if a new MerchantConsent was created; `false` if one already existed. */
|
|
72
|
+
created: boolean;
|
|
73
|
+
/** The MerchantConsent contract id, when resolvable (the existing one on a
|
|
74
|
+
* no-op, or the freshly created one when the transaction's created event is
|
|
75
|
+
* available). May be undefined on a fresh create if the event was not returned. */
|
|
76
|
+
contractId?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Onboard a HOSTED-party merchant for x402-direct by creating its once-total
|
|
80
|
+
* `MerchantConsent {merchant, facilitator}` on its own participant's JSON Ledger
|
|
81
|
+
* API. Idempotent: returns `{ created: false, contractId }` if the consent
|
|
82
|
+
* already exists, else creates it and returns `{ created: true, contractId? }`.
|
|
83
|
+
*
|
|
84
|
+
* See the file-level doc for the HOSTED-vs-EXTERNAL distinction and why no
|
|
85
|
+
* verify-before-sign is required.
|
|
86
|
+
*/
|
|
87
|
+
export declare function createMerchantConsentHosted(opts: CreateMerchantConsentHostedOptions): Promise<CreateMerchantConsentHostedResult>;
|
|
88
|
+
//# sourceMappingURL=hosted-onboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-onboard.d.ts","sourceRoot":"","sources":["../src/hosted-onboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAQH,mFAAmF;AACnF,MAAM,WAAW,gBAAgB;IAC/B,iEAAiE;IACjE,aAAa,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,sDAAsD;AACtD,MAAM,WAAW,kCAAkC;IACjD,8EAA8E;IAC9E,cAAc,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,cAAc,EAAE,MAAM,CAAC;IACvB,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED,qDAAqD;AACrD,MAAM,WAAW,iCAAiC;IAChD,mFAAmF;IACnF,OAAO,EAAE,OAAO,CAAC;IACjB;;wFAEoF;IACpF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA0BD;;;;;;;;GAQG;AACH,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,kCAAkC,GACvC,OAAO,CAAC,iCAAiC,CAAC,CA8E5C"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HOSTED-party merchant onboarding for x402-direct ("Design B").
|
|
3
|
+
*
|
|
4
|
+
* HOSTED vs EXTERNAL — why this is a separate path
|
|
5
|
+
* ================================================
|
|
6
|
+
* The agent-wallet `merchant-onboard` command (`createMerchantConsent` in tx.ts)
|
|
7
|
+
* is EXTERNAL-PARTY only: the merchant party is an Ed25519 self-custody wallet,
|
|
8
|
+
* so it onboards via the relay's interactive prepare -> sign-the-hash-locally ->
|
|
9
|
+
* execute flow, gated by verify-before-sign (the relay is untrusted, so the agent
|
|
10
|
+
* structurally re-checks the relay-prepared bytes before signing with its key).
|
|
11
|
+
*
|
|
12
|
+
* A HOSTED-party merchant is different: its party lives on its OWN Canton node
|
|
13
|
+
* (a validator it operates), NOT in an external Ed25519 wallet. It therefore has
|
|
14
|
+
* NO Ed25519 key, NO relay, NO wallet.json — and needs none of them. It authorizes
|
|
15
|
+
* the `MerchantConsent` create directly on its own participant's JSON Ledger API
|
|
16
|
+
* with a plain `CreateCommand` (`actAs: [merchant]`); the merchant's node supplies
|
|
17
|
+
* the signatory authority. The facilitator is only an `observer` of the consent,
|
|
18
|
+
* so it sees it over the synchronizer and the existing facilitator-minted path
|
|
19
|
+
* (MerchantConsent_Accept) settles unchanged. No protocol change, no Ed25519.
|
|
20
|
+
*
|
|
21
|
+
* NO verify-before-sign is needed here (and there is nothing to verify against):
|
|
22
|
+
* the merchant's OWN node builds and submits exactly what this function asks it to.
|
|
23
|
+
* The create shape is fixed and value-moving-free by construction — a single
|
|
24
|
+
* `MerchantConsent {merchant, facilitator}` create that captures the merchant's
|
|
25
|
+
* one-time authorization and MOVES NO FUNDS. There is no untrusted relay in the
|
|
26
|
+
* loop to substitute a facilitator or swap in a drain, so the structural
|
|
27
|
+
* verify-before-sign backstop the external path applies has no role.
|
|
28
|
+
*
|
|
29
|
+
* PREREQ: the `x402-direct` DAR (x402-direct-0.1.0, package-id
|
|
30
|
+
* f819db3288986a7f6c3157359ed02040e0a6080ceb6890309ecbb71eeeb93780) must be
|
|
31
|
+
* uploaded + vetted on the merchant's participant so `#x402-direct:...` resolves.
|
|
32
|
+
*
|
|
33
|
+
* Idempotent (the consent is once-total): if a `MerchantConsent` for this
|
|
34
|
+
* (merchant, facilitator) already exists, this returns `{ created: false }` and
|
|
35
|
+
* submits nothing.
|
|
36
|
+
*
|
|
37
|
+
* Uses the global `fetch` (Node 18+); imports no Canton SDK — it is the same
|
|
38
|
+
* dependency-free OIDC + JSON Ledger API v2 pattern the facilitator's funder
|
|
39
|
+
* (e2e/fund.mjs) uses.
|
|
40
|
+
*/
|
|
41
|
+
/** The x402-direct "Design B" standing-consent template the hosted merchant
|
|
42
|
+
* creates. The `#`-prefixed package NAME (not the hex package-id) lets the
|
|
43
|
+
* participant resolve its vetted version at create time — the same convention
|
|
44
|
+
* tx.ts's external-party path uses. */
|
|
45
|
+
const MERCHANT_CONSENT_TEMPLATE_ID = "#x402-direct:X402Direct:MerchantConsent";
|
|
46
|
+
/** Mint a JSON Ledger API bearer token via the OIDC client-credentials grant. */
|
|
47
|
+
async function mintToken(oidc) {
|
|
48
|
+
const body = new URLSearchParams({
|
|
49
|
+
grant_type: "client_credentials",
|
|
50
|
+
client_id: oidc.clientId,
|
|
51
|
+
client_secret: oidc.clientSecret,
|
|
52
|
+
audience: oidc.audience,
|
|
53
|
+
});
|
|
54
|
+
if (oidc.scope)
|
|
55
|
+
body.set("scope", oidc.scope);
|
|
56
|
+
const r = await fetch(oidc.tokenEndpoint, {
|
|
57
|
+
method: "POST",
|
|
58
|
+
headers: { "content-type": "application/x-www-form-urlencoded" },
|
|
59
|
+
body: body.toString(),
|
|
60
|
+
});
|
|
61
|
+
if (r.status !== 200) {
|
|
62
|
+
throw new Error(`OIDC token mint failed: HTTP ${r.status}`);
|
|
63
|
+
}
|
|
64
|
+
const j = (await r.json());
|
|
65
|
+
if (!j.access_token) {
|
|
66
|
+
throw new Error("OIDC token mint: no access_token in response");
|
|
67
|
+
}
|
|
68
|
+
return j.access_token;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Onboard a HOSTED-party merchant for x402-direct by creating its once-total
|
|
72
|
+
* `MerchantConsent {merchant, facilitator}` on its own participant's JSON Ledger
|
|
73
|
+
* API. Idempotent: returns `{ created: false, contractId }` if the consent
|
|
74
|
+
* already exists, else creates it and returns `{ created: true, contractId? }`.
|
|
75
|
+
*
|
|
76
|
+
* See the file-level doc for the HOSTED-vs-EXTERNAL distinction and why no
|
|
77
|
+
* verify-before-sign is required.
|
|
78
|
+
*/
|
|
79
|
+
export async function createMerchantConsentHosted(opts) {
|
|
80
|
+
const { participantUrl, synchronizerId, userId, merchant, facilitator, oidc } = opts;
|
|
81
|
+
const token = await mintToken(oidc);
|
|
82
|
+
// Authenticated POST to the merchant's JSON Ledger API v2.
|
|
83
|
+
const ledgerPost = async (path, payload) => {
|
|
84
|
+
const r = await fetch(participantUrl + path, {
|
|
85
|
+
method: "POST",
|
|
86
|
+
headers: {
|
|
87
|
+
Authorization: `Bearer ${token}`,
|
|
88
|
+
"content-type": "application/json",
|
|
89
|
+
},
|
|
90
|
+
body: JSON.stringify(payload),
|
|
91
|
+
});
|
|
92
|
+
const text = await r.text();
|
|
93
|
+
let json;
|
|
94
|
+
try {
|
|
95
|
+
json = JSON.parse(text);
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
json = undefined;
|
|
99
|
+
}
|
|
100
|
+
return { status: r.status, json, text };
|
|
101
|
+
};
|
|
102
|
+
const ledgerGet = async (path) => {
|
|
103
|
+
const r = await fetch(participantUrl + path, {
|
|
104
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
105
|
+
});
|
|
106
|
+
return r.json();
|
|
107
|
+
};
|
|
108
|
+
// Once-total guard: is there already a MerchantConsent for this merchant naming
|
|
109
|
+
// this facilitator? A TemplateFilter (not a wildcard) keeps the ACS query small
|
|
110
|
+
// — a busy validator-operator party can hold many contracts.
|
|
111
|
+
const existing = await existingConsentCid(ledgerPost, ledgerGet, merchant, facilitator);
|
|
112
|
+
if (existing) {
|
|
113
|
+
return { created: false, contractId: existing };
|
|
114
|
+
}
|
|
115
|
+
// No existing consent — create it. The merchant's node supplies the signatory
|
|
116
|
+
// authority via actAs:[merchant]; the create shape is fixed and moves no funds.
|
|
117
|
+
const commandId = `merchant-onboard-hosted-${Date.now()}`;
|
|
118
|
+
const send = await ledgerPost("/v2/commands/submit-and-wait-for-transaction", {
|
|
119
|
+
commands: {
|
|
120
|
+
commandId,
|
|
121
|
+
userId,
|
|
122
|
+
actAs: [merchant],
|
|
123
|
+
synchronizerId,
|
|
124
|
+
disclosedContracts: [],
|
|
125
|
+
commands: [
|
|
126
|
+
{
|
|
127
|
+
CreateCommand: {
|
|
128
|
+
templateId: MERCHANT_CONSENT_TEMPLATE_ID,
|
|
129
|
+
// Daml declaration order: [0] merchant, [1] facilitator.
|
|
130
|
+
createArguments: { merchant, facilitator },
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
if (send.status !== 200) {
|
|
137
|
+
throw new Error(`merchant consent create failed: HTTP ${send.status} ${send.text.slice(0, 400)}`);
|
|
138
|
+
}
|
|
139
|
+
// contractId is best-effort: spread it only when resolvable so the result
|
|
140
|
+
// conforms to exactOptionalPropertyTypes (no explicit `contractId: undefined`).
|
|
141
|
+
const contractId = createdConsentCid(send.json);
|
|
142
|
+
return { created: true, ...(contractId ? { contractId } : {}) };
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Scan the submit-and-wait-for-transaction response for the created
|
|
146
|
+
* MerchantConsent's contract id. Best-effort — the contract id is informational
|
|
147
|
+
* (the consent is once-total and the facilitator re-resolves it), so an
|
|
148
|
+
* unrecognized event shape yields `undefined` rather than an error.
|
|
149
|
+
*/
|
|
150
|
+
function createdConsentCid(transactionResponse) {
|
|
151
|
+
if (typeof transactionResponse !== "object" || transactionResponse === null) {
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
const tx = transactionResponse
|
|
155
|
+
.transaction;
|
|
156
|
+
const events = tx?.events;
|
|
157
|
+
if (!Array.isArray(events))
|
|
158
|
+
return undefined;
|
|
159
|
+
for (const ev of events) {
|
|
160
|
+
const created = ev
|
|
161
|
+
?.CreatedEvent;
|
|
162
|
+
if (created?.contractId)
|
|
163
|
+
return created.contractId;
|
|
164
|
+
}
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Query the merchant's ACS (scoped by a TemplateFilter to the MerchantConsent
|
|
169
|
+
* template, active at ledger-end) for an existing consent naming this
|
|
170
|
+
* facilitator. Returns its contract id, or `null` if none exists.
|
|
171
|
+
*/
|
|
172
|
+
async function existingConsentCid(ledgerPost, ledgerGet, merchant, facilitator) {
|
|
173
|
+
const end = (await ledgerGet("/v2/state/ledger-end"));
|
|
174
|
+
const acs = await ledgerPost("/v2/state/active-contracts", {
|
|
175
|
+
filter: {
|
|
176
|
+
filtersByParty: {
|
|
177
|
+
[merchant]: {
|
|
178
|
+
cumulative: [
|
|
179
|
+
{
|
|
180
|
+
identifierFilter: {
|
|
181
|
+
TemplateFilter: {
|
|
182
|
+
value: {
|
|
183
|
+
templateId: MERCHANT_CONSENT_TEMPLATE_ID,
|
|
184
|
+
includeCreatedEventBlob: false,
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
verbose: false,
|
|
194
|
+
activeAtOffset: end.offset,
|
|
195
|
+
});
|
|
196
|
+
const list = Array.isArray(acs.json)
|
|
197
|
+
? acs.json
|
|
198
|
+
: (acs.json?.contractEntries ?? []);
|
|
199
|
+
for (const entry of list) {
|
|
200
|
+
const created = entry?.contractEntry?.JsActiveContract?.createdEvent;
|
|
201
|
+
if (created && created.createArgument?.facilitator === facilitator) {
|
|
202
|
+
return created.contractId ?? null;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=hosted-onboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-onboard.js","sourceRoot":"","sources":["../src/hosted-onboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH;;;wCAGwC;AACxC,MAAM,4BAA4B,GAAG,yCAAyC,CAAC;AA0C/E,iFAAiF;AACjF,KAAK,UAAU,SAAS,CAAC,IAAsB;IAC7C,MAAM,IAAI,GAAG,IAAI,eAAe,CAAC;QAC/B,UAAU,EAAE,oBAAoB;QAChC,SAAS,EAAE,IAAI,CAAC,QAAQ;QACxB,aAAa,EAAE,IAAI,CAAC,YAAY;QAChC,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACxB,CAAC,CAAC;IACH,IAAI,IAAI,CAAC,KAAK;QAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAA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zD,MAAM,EAAE;YACN,cAAc,EAAE;gBACd,CAAC,QAAQ,CAAC,EAAE;oBACV,UAAU,EAAE;wBACV;4BACE,gBAAgB,EAAE;gCAChB,cAAc,EAAE;oCACd,KAAK,EAAE;wCACL,UAAU,EAAE,4BAA4B;wCACxC,uBAAuB,EAAE,KAAK;qCAC/B;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF;QACD,OAAO,EAAE,KAAK;QACd,cAAc,EAAE,GAAG,CAAC,MAAM;KAC3B,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QAClC,CAAC,CAAE,GAAG,CAAC,IAAkB;QACzB,CAAC,CAAC,CAAE,GAAG,CAAC,IAAwC,EAAE,eAAe,IAAI,EAAE,CAAC,CAAC;IAC3E,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QACzB,MAAM,OAAO,GACX,KAUD,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,CAAC;QACjD,IAAI,OAAO,IAAI,OAAO,CAAC,cAAc,EAAE,WAAW,KAAK,WAAW,EAAE,CAAC;YACnE,OAAO,OAAO,CAAC,UAAU,IAAI,IAAI,CAAC;QACpC,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,11 @@ export * from "./relay-client.js";
|
|
|
4
4
|
export * from "./onboard.js";
|
|
5
5
|
export * from "./relay-signer.js";
|
|
6
6
|
export * from "./tx.js";
|
|
7
|
+
export * from "./hosted-onboard.js";
|
|
7
8
|
export * from "./withdraw.js";
|
|
8
9
|
export * from "./pay.js";
|
|
9
10
|
export * from "./hash-binding.js";
|
|
10
11
|
export * from "./canton-hash.js";
|
|
11
12
|
export * from "./trusted-dso.js";
|
|
12
|
-
export { assertPreparedTransferMatches, assertPreparedCreateTransferCommandMatches, assertHashBinding, assertOnboardingTopologyBindsKey, decodePrepared, extractTransfer, extractCreateTransferCommand, PreparedDecodeError, PreparedTransferMismatchError, PreparedHashUnavailableError, OnboardingTopologyMismatchError, type HashBindingOptions, type PreparedTransferExpectation, type PreparedCreateTransferCommandExpectation, type OnboardingTopologyExpectation, } from "./verify-prepared.js";
|
|
13
|
+
export { assertPreparedTransferMatches, assertPreparedCreateTransferCommandMatches, assertPreparedConsentCreateMatches, assertHashBinding, assertOnboardingTopologyBindsKey, decodePrepared, extractTransfer, extractCreateTransferCommand, PreparedDecodeError, PreparedTransferMismatchError, PreparedHashUnavailableError, OnboardingTopologyMismatchError, type HashBindingOptions, type PreparedTransferExpectation, type PreparedCreateTransferCommandExpectation, type PreparedConsentCreateExpectation, type OnboardingTopologyExpectation, } from "./verify-prepared.js";
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACL,6BAA6B,EAC7B,0CAA0C,EAC1C,iBAAiB,EACjB,gCAAgC,EAChC,cAAc,EACd,eAAe,EACf,4BAA4B,EAC5B,mBAAmB,EACnB,6BAA6B,EAC7B,4BAA4B,EAC5B,+BAA+B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,wCAAwC,EAC7C,KAAK,6BAA6B,GACnC,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACL,6BAA6B,EAC7B,0CAA0C,EAC1C,kCAAkC,EAClC,iBAAiB,EACjB,gCAAgC,EAChC,cAAc,EACd,eAAe,EACf,4BAA4B,EAC5B,mBAAmB,EACnB,6BAA6B,EAC7B,4BAA4B,EAC5B,+BAA+B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,wCAAwC,EAC7C,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,GACnC,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,11 @@ export * from "./relay-client.js";
|
|
|
4
4
|
export * from "./onboard.js";
|
|
5
5
|
export * from "./relay-signer.js";
|
|
6
6
|
export * from "./tx.js";
|
|
7
|
+
export * from "./hosted-onboard.js";
|
|
7
8
|
export * from "./withdraw.js";
|
|
8
9
|
export * from "./pay.js";
|
|
9
10
|
export * from "./hash-binding.js";
|
|
10
11
|
export * from "./canton-hash.js";
|
|
11
12
|
export * from "./trusted-dso.js";
|
|
12
|
-
export { assertPreparedTransferMatches, assertPreparedCreateTransferCommandMatches, assertHashBinding, assertOnboardingTopologyBindsKey, decodePrepared, extractTransfer, extractCreateTransferCommand, PreparedDecodeError, PreparedTransferMismatchError, PreparedHashUnavailableError, OnboardingTopologyMismatchError, } from "./verify-prepared.js";
|
|
13
|
+
export { assertPreparedTransferMatches, assertPreparedCreateTransferCommandMatches, assertPreparedConsentCreateMatches, assertHashBinding, assertOnboardingTopologyBindsKey, decodePrepared, extractTransfer, extractCreateTransferCommand, PreparedDecodeError, PreparedTransferMismatchError, PreparedHashUnavailableError, OnboardingTopologyMismatchError, } from "./verify-prepared.js";
|
|
13
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACL,6BAA6B,EAC7B,0CAA0C,EAC1C,iBAAiB,EACjB,gCAAgC,EAChC,cAAc,EACd,eAAe,EACf,4BAA4B,EAC5B,mBAAmB,EACnB,6BAA6B,EAC7B,4BAA4B,EAC5B,+BAA+B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACL,6BAA6B,EAC7B,0CAA0C,EAC1C,kCAAkC,EAClC,iBAAiB,EACjB,gCAAgC,EAChC,cAAc,EACd,eAAe,EACf,4BAA4B,EAC5B,mBAAmB,EACnB,6BAA6B,EAC7B,4BAA4B,EAC5B,+BAA+B,GAMhC,MAAM,sBAAsB,CAAC"}
|