@ftptech/canton-agent-wallet 0.4.1 → 0.5.0
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 +22 -6
- package/dist/cli-args.d.ts +1 -1
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +10 -3
- package/dist/cli-args.js.map +1 -1
- package/dist/cli.js +73 -4
- package/dist/cli.js.map +1 -1
- package/dist/merge.d.ts +51 -10
- package/dist/merge.d.ts.map +1 -1
- package/dist/merge.js +156 -33
- package/dist/merge.js.map +1 -1
- package/dist/relay-client.d.ts +114 -0
- package/dist/relay-client.d.ts.map +1 -1
- package/dist/relay-client.js +54 -2
- package/dist/relay-client.js.map +1 -1
- package/dist/relay-signer.d.ts.map +1 -1
- package/dist/relay-signer.js +27 -1
- package/dist/relay-signer.js.map +1 -1
- package/dist/tx.d.ts +58 -6
- package/dist/tx.d.ts.map +1 -1
- package/dist/tx.js +117 -8
- package/dist/tx.js.map +1 -1
- package/dist/verify-prepared.d.ts +26 -0
- package/dist/verify-prepared.d.ts.map +1 -1
- package/dist/verify-prepared.js +45 -0
- package/dist/verify-prepared.js.map +1 -1
- package/package.json +3 -3
package/dist/merge.js
CHANGED
|
@@ -15,10 +15,24 @@
|
|
|
15
15
|
* so a batch of N dust amulets collapses to ~2 amulets. Using 1 atomic sidesteps
|
|
16
16
|
* ALL fee math (the change amulet absorbs the remainder).
|
|
17
17
|
*
|
|
18
|
+
* ONE-RUN CONVERGENCE (whale wallets). The whale pass enumerates from the PUBLIC
|
|
19
|
+
* SV Scan ACS snapshot, which refreshes only ~daily (≈12:00 UTC) and so does NOT
|
|
20
|
+
* reflect the cids a PREVIOUS run consumed. A first run's batches also leave
|
|
21
|
+
* hundreds of fresh OUTPUT amulets that are neither in that snapshot (created
|
|
22
|
+
* after it) nor enumerable via /balance (a whale still exceeds the participant's
|
|
23
|
+
* element cap). To converge WITHOUT waiting for the next snapshot, merge CHAINS on
|
|
24
|
+
* a batch's OWN outputs: after every successful batch it resolves that batch's
|
|
25
|
+
* output amulet cids via the relay (`txAmulets(party, updateId)`) and feeds them
|
|
26
|
+
* into an in-run `pool` of known-live cids; a dedicated chain phase then keeps
|
|
27
|
+
* self-transferring `pool` cids until the count reaches target. So 10,960 → ~244
|
|
28
|
+
* → ~6 → 2 all happens in one run, with zero dependence on snapshot freshness or
|
|
29
|
+
* /balance. Stale batches (snapshot cids a prior run already spent) are SKIPPED,
|
|
30
|
+
* not fatal (see isStaleInputHoldingError, which also matches CONTRACT_NOT_FOUND).
|
|
31
|
+
*
|
|
18
32
|
* The transfer itself reuses the EXISTING outbound `transfer()` machinery — same
|
|
19
33
|
* relay resolve → build → verify-before-sign → local sign → relay execute — so
|
|
20
34
|
* there is no second signing path to audit. mergeHoldings only orchestrates
|
|
21
|
-
* batching
|
|
35
|
+
* batching, the whale-wallet enumeration fallback, and the output-chaining.
|
|
22
36
|
*
|
|
23
37
|
* SECURITY INVARIANT (non-negotiable): every merge transfer pins
|
|
24
38
|
* `receiver === wallet.party` BEFORE signing, and the verify-before-sign arm
|
|
@@ -37,6 +51,12 @@ import { isStaleInputHoldingError } from "./tx.js";
|
|
|
37
51
|
* never needs to cover fees, and the exact per-batch amount is irrelevant to the
|
|
38
52
|
* consolidation. Kept a named constant because the "why 1 atomic" is load-bearing. */
|
|
39
53
|
const ONE_ATOMIC = "0.0000000001";
|
|
54
|
+
/** Whale-pass cost gate: above this many PLANNED whale batches, `merge` refuses to
|
|
55
|
+
* run without `opts.yes` (CLI `--yes`). Each ~90-input batch consumes significant
|
|
56
|
+
* Global-Synchronizer traffic (~21.5 KB ≈ 1–1.5 USD per tx on MainNet), so a
|
|
57
|
+
* 122-batch pass is a ~$157 event the operator must opt into. `--dry-run` is never
|
|
58
|
+
* gated; small merges (≤ this) run without `--yes`, unchanged. */
|
|
59
|
+
const WHALE_COST_GATE_BATCHES = 20;
|
|
40
60
|
/** Split `cids` into consecutive chunks of at most `size`. */
|
|
41
61
|
function chunk(cids, size) {
|
|
42
62
|
const out = [];
|
|
@@ -65,16 +85,27 @@ async function enumerateHoldingCids(relay, party) {
|
|
|
65
85
|
*
|
|
66
86
|
* Phases:
|
|
67
87
|
* 1. ENUMERATE — `balance` if it works, else the Scan snapshot (whale).
|
|
88
|
+
* 1b. COST GATE — when the whale pass would run > WHALE_COST_GATE_BATCHES (20)
|
|
89
|
+
* batches and `opts.yes` is not set, ABORT before any submission (the pass is
|
|
90
|
+
* an expensive GS-traffic event). `--dry-run` skips the gate.
|
|
68
91
|
* 2. WHALE PASS (only when enumeration used Scan) — ONE pass over the snapshot
|
|
69
92
|
* list in batches of `batch`; each batch is one self-transfer. The snapshot
|
|
70
|
-
* lags
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* cids
|
|
93
|
+
* lags: a batch whose cids a PRIOR run already consumed fails
|
|
94
|
+
* stale/CONTRACT_NOT_FOUND and is SKIPPED (counted `skippedStale`), the pass
|
|
95
|
+
* continues; any other failure aborts. Each SUCCESSFUL batch's OWN output cids
|
|
96
|
+
* are resolved via `txAmulets` and pushed into the in-run `pool`.
|
|
97
|
+
* 3. CHAIN PHASE — while `pool.length > target` and rounds remain: self-transfer
|
|
98
|
+
* up to `batch` cids FROM THE POOL; the outputs go back into the pool. This
|
|
99
|
+
* converges a whale in ONE run using only the batches' own outputs — no
|
|
100
|
+
* dependence on the next Scan snapshot or on /balance.
|
|
101
|
+
* 4. FINAL PHASE — try LIVE `balance`: if it works and holdings > target, run
|
|
102
|
+
* bounded live rounds (catches pre-existing leftovers not in the pool); if it
|
|
103
|
+
* still 413s, END SUCCESSFULLY — the leftovers predate this run and are not yet
|
|
104
|
+
* enumerable; re-run after the next Scan snapshot (~12:00 UTC). NOT an error.
|
|
76
105
|
*
|
|
77
|
-
*
|
|
106
|
+
* `maxRounds` bounds the CHAIN + LIVE rounds together; the whale pass keeps its own
|
|
107
|
+
* accounting. Every self-transfer pins receiver = wallet.party (verify-before-sign
|
|
108
|
+
* enforced) — whale, chain, and live alike.
|
|
78
109
|
*/
|
|
79
110
|
export async function mergeHoldings(relay, wallet, opts = {}) {
|
|
80
111
|
const target = opts.target ?? 2;
|
|
@@ -95,29 +126,81 @@ export async function mergeHoldings(relay, wallet, opts = {}) {
|
|
|
95
126
|
...(instrumentAdmin !== undefined ? { expectInstrumentAdmin: instrumentAdmin } : {}),
|
|
96
127
|
});
|
|
97
128
|
const { cids: initialCids, usedScan } = await enumerateHoldingCids(relay, wallet.party);
|
|
98
|
-
// ── Dry run: report the plan, execute nothing. ──
|
|
129
|
+
// ── Dry run: report the plan, execute nothing (never gated). ──
|
|
99
130
|
if (opts.dryRun) {
|
|
100
131
|
const plannedBatches = Math.ceil(initialCids.length / batchSize);
|
|
101
132
|
log(`dry run: ${initialCids.length} holding(s)` +
|
|
102
133
|
`${usedScan ? " (via Scan snapshot — wallet too large to enumerate on-ledger)" : ""}` +
|
|
103
|
-
` → ${plannedBatches} batch(es) of up to ${batchSize} → target ${target}
|
|
104
|
-
|
|
134
|
+
` → ${plannedBatches} batch(es) of up to ${batchSize} → target ${target}.` +
|
|
135
|
+
(plannedBatches > WHALE_COST_GATE_BATCHES
|
|
136
|
+
? ` This exceeds ${WHALE_COST_GATE_BATCHES} batches — a real run needs --yes` +
|
|
137
|
+
` (large batches consume Global Synchronizer traffic, ~1–1.5 USD per` +
|
|
138
|
+
` 90-input transaction on MainNet).`
|
|
139
|
+
: "") +
|
|
140
|
+
` Nothing executed.`);
|
|
105
141
|
return {
|
|
106
142
|
rounds: 0,
|
|
107
143
|
merged: [],
|
|
108
144
|
updateIds: [],
|
|
109
145
|
finalHoldings: usedScan ? null : initialCids.length,
|
|
110
146
|
usedScan,
|
|
147
|
+
skippedStale: 0,
|
|
148
|
+
chainedRounds: 0,
|
|
111
149
|
plannedBatches,
|
|
112
150
|
};
|
|
113
151
|
}
|
|
152
|
+
// ── Cost gate: a large whale pass is an expensive GS-traffic event. Refuse to
|
|
153
|
+
// submit ANYTHING when the planned whale batches exceed the gate and --yes was
|
|
154
|
+
// not given. Only the whale (snapshot) pass is gated — a small/enumerable wallet
|
|
155
|
+
// (usedScan === false) runs unchanged. ──
|
|
156
|
+
if (usedScan) {
|
|
157
|
+
const plannedWhaleBatches = Math.ceil(initialCids.length / batchSize);
|
|
158
|
+
if (plannedWhaleBatches > WHALE_COST_GATE_BATCHES && !opts.yes) {
|
|
159
|
+
throw new Error(`merge would run ${plannedWhaleBatches} large batches (${initialCids.length} ` +
|
|
160
|
+
`holdings / ${batchSize} per batch), which exceeds the ${WHALE_COST_GATE_BATCHES}-batch ` +
|
|
161
|
+
`safety gate. Each large batch consumes significant Global Synchronizer ` +
|
|
162
|
+
`traffic (~1–1.5 USD per 90-input transaction on MainNet), so this pass ` +
|
|
163
|
+
`is a meaningful cost. Re-run with --yes to proceed, or --dry-run to preview.`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
114
166
|
const merged = [];
|
|
115
167
|
const updateIds = [];
|
|
116
168
|
let rounds = 0;
|
|
169
|
+
let skippedStale = 0;
|
|
170
|
+
let chainedRounds = 0;
|
|
171
|
+
// The in-run POOL of KNOWN-LIVE Amulet cids: a batch's own output amulets,
|
|
172
|
+
// resolved by updateId via the relay right after the batch commits. This is what
|
|
173
|
+
// lets a whale converge in ONE run — the outputs are neither in the (daily) Scan
|
|
174
|
+
// snapshot nor enumerable via /balance, so without chaining a repeat run makes no
|
|
175
|
+
// progress until the next snapshot. Deduped (a cid must enter the pool once).
|
|
176
|
+
const pool = [];
|
|
177
|
+
const poolSeen = new Set();
|
|
178
|
+
const addToPool = (cids) => {
|
|
179
|
+
for (const c of cids) {
|
|
180
|
+
if (!poolSeen.has(c)) {
|
|
181
|
+
poolSeen.add(c);
|
|
182
|
+
pool.push(c);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
// Resolve a committed batch's OWN output amulet cids (relay.txAmulets by
|
|
187
|
+
// updateId) and feed them into the pool. A transient txAmulets failure is NOT
|
|
188
|
+
// fatal: warn and continue — the final balance() phase still catches leftovers.
|
|
189
|
+
const absorbOutputs = async (updateId) => {
|
|
190
|
+
try {
|
|
191
|
+
const out = await relay.txAmulets(wallet.party, updateId);
|
|
192
|
+
addToPool(out.amulets.map((a) => a.cid));
|
|
193
|
+
}
|
|
194
|
+
catch (err) {
|
|
195
|
+
log(` (could not resolve outputs of ${updateId}: ` +
|
|
196
|
+
`${err instanceof Error ? err.message : String(err)} — continuing)`);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
117
199
|
// ── Phase 2: whale pass over the snapshot list (only when Scan was needed). ──
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
//
|
|
200
|
+
// Each batch collapses ~batch dust amulets to ~2; a batch whose snapshot cids a
|
|
201
|
+
// prior run already consumed is SKIPPED (stale/CONTRACT_NOT_FOUND) — expected on
|
|
202
|
+
// a repeat run over the same daily snapshot. Every SUCCESSFUL batch's outputs go
|
|
203
|
+
// into the pool for the chain phase to finish the job.
|
|
121
204
|
if (usedScan) {
|
|
122
205
|
const batches = chunk(initialCids, batchSize);
|
|
123
206
|
log(`whale pass: ${initialCids.length} holdings (Scan snapshot) → ${batches.length} batch(es) of up to ${batchSize}.`);
|
|
@@ -129,13 +212,15 @@ export async function mergeHoldings(relay, wallet, opts = {}) {
|
|
|
129
212
|
merged.push(...b);
|
|
130
213
|
updateIds.push(updateId);
|
|
131
214
|
log(` whale batch ${i + 1}/${batches.length}: merged ${b.length} → updateId ${updateId}`);
|
|
215
|
+
await absorbOutputs(updateId);
|
|
132
216
|
}
|
|
133
217
|
catch (err) {
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
// failure is real: abort with a clear message.
|
|
218
|
+
// Snapshot cids a PRIOR run already consumed resolve to nothing at prepare
|
|
219
|
+
// (stale/archived/CONTRACT_NOT_FOUND) — SKIP that batch and keep going. Any
|
|
220
|
+
// other failure is real: abort with a clear message.
|
|
137
221
|
if (isStaleInputHoldingError(err)) {
|
|
138
|
-
|
|
222
|
+
skippedStale++;
|
|
223
|
+
log(` whale batch ${i + 1}/${batches.length}: stale (already consumed) — skipped`);
|
|
139
224
|
continue;
|
|
140
225
|
}
|
|
141
226
|
throw new Error(`merge aborted during whale batch ${i + 1}/${batches.length}: ` +
|
|
@@ -143,45 +228,74 @@ export async function mergeHoldings(relay, wallet, opts = {}) {
|
|
|
143
228
|
}
|
|
144
229
|
}
|
|
145
230
|
}
|
|
146
|
-
//
|
|
147
|
-
//
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
//
|
|
151
|
-
//
|
|
152
|
-
//
|
|
153
|
-
|
|
231
|
+
// `maxRounds` bounds the CHAIN + LIVE rounds together (whale batches have their
|
|
232
|
+
// own accounting above), so a pathological wallet can never loop unbounded.
|
|
233
|
+
let boundedRounds = 0;
|
|
234
|
+
const budgetLeft = () => boundedRounds < maxRounds;
|
|
235
|
+
// ── Phase 3: chain phase — self-transfer the pool's own output cids until the
|
|
236
|
+
// pool reaches target. This is the snapshot-independent convergence: the whale
|
|
237
|
+
// pass left ~2 outputs per successful batch in the pool (e.g. 244), and each
|
|
238
|
+
// chain round collapses up to `batch` of them back to ~2, so 244 → ~6 → 2 in a
|
|
239
|
+
// few rounds. Each round removes its inputs from the pool and adds its outputs. ──
|
|
240
|
+
while (pool.length > target && budgetLeft()) {
|
|
241
|
+
const b = pool.splice(0, batchSize); // take up to `batch` cids OUT of the pool
|
|
242
|
+
for (const c of b)
|
|
243
|
+
poolSeen.delete(c); // consumed on-ledger — no longer live
|
|
244
|
+
const updateId = await mergeBatch(b);
|
|
245
|
+
rounds++;
|
|
246
|
+
chainedRounds++;
|
|
247
|
+
boundedRounds++;
|
|
248
|
+
merged.push(...b);
|
|
249
|
+
updateIds.push(updateId);
|
|
250
|
+
log(` chain round ${chainedRounds}: merged ${b.length} → updateId ${updateId}`);
|
|
251
|
+
await absorbOutputs(updateId); // outputs re-enter the pool for the next round
|
|
252
|
+
}
|
|
253
|
+
// ── Phase 4: final phase — reconcile against the LIVE balance. This catches
|
|
254
|
+
// pre-existing leftovers NOT produced by this run (so not in the pool), and is
|
|
255
|
+
// the authoritative stop condition. If the wallet STILL exceeds the participant's
|
|
256
|
+
// element cap, those leftovers predate this run and are not yet enumerable — end
|
|
257
|
+
// SUCCESSFULLY and tell the user to re-run after the next Scan snapshot. ──
|
|
258
|
+
let finalHoldings = pool.length;
|
|
154
259
|
let liveRoundCount = 0;
|
|
260
|
+
// NON-whale wallets never populated the pool (usedScan false) and already have a
|
|
261
|
+
// live enumeration in hand — reuse it for the FIRST iteration instead of reading
|
|
262
|
+
// /balance twice. The whale path leaves this undefined so the loop reads the true
|
|
263
|
+
// post-pass state. A `null` from a read means the wallet still 413s (un-
|
|
264
|
+
// enumerable) — the terminal "predates this run" success case.
|
|
155
265
|
let prefetched = usedScan ? undefined : initialCids;
|
|
156
266
|
for (;;) {
|
|
157
267
|
let liveCids;
|
|
158
268
|
if (prefetched !== undefined) {
|
|
159
269
|
liveCids = prefetched;
|
|
160
270
|
prefetched = undefined;
|
|
161
|
-
finalHoldings = liveCids.length;
|
|
162
271
|
}
|
|
163
272
|
else {
|
|
164
273
|
try {
|
|
165
274
|
const bal = await relay.balance(wallet.party);
|
|
166
275
|
liveCids = bal.holdings.map((h) => h.cid);
|
|
167
|
-
finalHoldings = liveCids.length;
|
|
168
276
|
}
|
|
169
277
|
catch (err) {
|
|
170
278
|
if (isHoldingsExceedNodeLimitError(err)) {
|
|
171
|
-
// Still a whale
|
|
172
|
-
//
|
|
279
|
+
// Still a whale on /balance. Any pool cids are already consolidated; the
|
|
280
|
+
// remaining un-enumerable holdings predate this run (not in this run's
|
|
281
|
+
// snapshot, not produced by it) — the reporter's stuck state. NOT an
|
|
282
|
+
// error: converge further after the next snapshot. finalHoldings = null.
|
|
173
283
|
finalHoldings = null;
|
|
174
|
-
log("
|
|
284
|
+
log("remaining holdings predate this run and are not yet enumerable on-ledger " +
|
|
285
|
+
"(a whale still exceeds the participant's element cap). They will appear " +
|
|
286
|
+
"in the next Scan snapshot (~12:00 UTC daily) — re-run `merge` then to " +
|
|
287
|
+
"continue consolidating. This run made all the progress it can; not an error.");
|
|
175
288
|
break;
|
|
176
289
|
}
|
|
177
290
|
throw err;
|
|
178
291
|
}
|
|
179
292
|
}
|
|
293
|
+
finalHoldings = liveCids.length;
|
|
180
294
|
if (liveCids.length <= target) {
|
|
181
295
|
log(`done: ${liveCids.length} holding(s) ≤ target ${target}.`);
|
|
182
296
|
break;
|
|
183
297
|
}
|
|
184
|
-
if (
|
|
298
|
+
if (!budgetLeft()) {
|
|
185
299
|
log(`reached maxRounds (${maxRounds}); ${liveCids.length} holding(s) remain.`);
|
|
186
300
|
break;
|
|
187
301
|
}
|
|
@@ -189,10 +303,19 @@ export async function mergeHoldings(relay, wallet, opts = {}) {
|
|
|
189
303
|
const updateId = await mergeBatch(b);
|
|
190
304
|
rounds++;
|
|
191
305
|
liveRoundCount++;
|
|
306
|
+
boundedRounds++;
|
|
192
307
|
merged.push(...b);
|
|
193
308
|
updateIds.push(updateId);
|
|
194
309
|
log(` live round ${liveRoundCount}: merged ${b.length} → updateId ${updateId}`);
|
|
195
310
|
}
|
|
196
|
-
return {
|
|
311
|
+
return {
|
|
312
|
+
rounds,
|
|
313
|
+
merged,
|
|
314
|
+
updateIds,
|
|
315
|
+
finalHoldings,
|
|
316
|
+
usedScan,
|
|
317
|
+
skippedStale,
|
|
318
|
+
chainedRounds,
|
|
319
|
+
};
|
|
197
320
|
}
|
|
198
321
|
//# sourceMappingURL=merge.js.map
|
package/dist/merge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0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AG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,EAAE,CAAC;QACT,cAAc,EAAE,CAAC;QACjB,aAAa,EAAE,CAAC;QAChB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAClB,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzB,GAAG,CAAC,gBAAgB,cAAc,YAAY,CAAC,CAAC,MAAM,eAAe,QAAQ,EAAE,CAAC,CAAC;IACnF,CAAC;IAED,OAAO;QACL,MAAM;QACN,MAAM;QACN,SAAS;QACT,aAAa;QACb,QAAQ;QACR,YAAY;QACZ,aAAa;KACd,CAAC;AACJ,CAAC"}
|
package/dist/relay-client.d.ts
CHANGED
|
@@ -107,6 +107,19 @@ export interface AllocationResultResult {
|
|
|
107
107
|
allocationCid?: string | null;
|
|
108
108
|
allocationInstructionCid?: string | null;
|
|
109
109
|
}
|
|
110
|
+
/** The Amulet OUTPUT holdings a transfer transaction created for the party, read
|
|
111
|
+
* off that transaction by updateId (whale-merge output discovery). Each entry is
|
|
112
|
+
* an Amulet contract OWNED BY the party the tx produced (the self-transfer's
|
|
113
|
+
* change/output amulets). The merge chain phase feeds these back in as the next
|
|
114
|
+
* round's inputs, so convergence never waits on the daily Scan snapshot. */
|
|
115
|
+
export interface TxAmuletsResult {
|
|
116
|
+
party: string;
|
|
117
|
+
updateId: string;
|
|
118
|
+
amulets: Array<{
|
|
119
|
+
cid: string;
|
|
120
|
+
amount: string;
|
|
121
|
+
}>;
|
|
122
|
+
}
|
|
110
123
|
/** x402-direct "Design B": the result of resolving/minting the standing both-party
|
|
111
124
|
* DirectSettlementConsent for a {sender, merchant} pair (facilitator-side
|
|
112
125
|
* MerchantConsent_Accept). `minted` is false when an existing consent was reused. */
|
|
@@ -164,7 +177,101 @@ export declare class RelayClient {
|
|
|
164
177
|
submitExecute(b: unknown): Promise<{
|
|
165
178
|
updateId: string;
|
|
166
179
|
}>;
|
|
180
|
+
/** transfer-factory ("V3") pay step 1: the relay BUILDS + interactive-prepares
|
|
181
|
+
* the TransferFactory_Transfer and stashes it, returning the prepared bytes +
|
|
182
|
+
* hash for the client's verify-before-sign and the small `submissionRef` the
|
|
183
|
+
* x402 payload carries. */
|
|
184
|
+
payPrepare(b: {
|
|
185
|
+
party: string;
|
|
186
|
+
receiver: string;
|
|
187
|
+
amount: string;
|
|
188
|
+
executeBeforeSeconds?: number;
|
|
189
|
+
}): Promise<{
|
|
190
|
+
submissionRef: string;
|
|
191
|
+
preparedTransaction: string;
|
|
192
|
+
txHash: string;
|
|
193
|
+
executeBefore: string;
|
|
194
|
+
sender: string;
|
|
195
|
+
receiver: string;
|
|
196
|
+
amount: string;
|
|
197
|
+
instrumentId: {
|
|
198
|
+
admin: string;
|
|
199
|
+
id: string;
|
|
200
|
+
};
|
|
201
|
+
}>;
|
|
202
|
+
/** transfer-factory pay step 2: attach the payer's signing bundle to the
|
|
203
|
+
* stashed submission (NO execution — /settle relays it later). */
|
|
204
|
+
payCommit(b: {
|
|
205
|
+
party: string;
|
|
206
|
+
submissionRef: string;
|
|
207
|
+
hashingSchemeVersion: "HASHING_SCHEME_VERSION_V1" | "HASHING_SCHEME_VERSION_V2";
|
|
208
|
+
partySignatures: {
|
|
209
|
+
signatures: Array<{
|
|
210
|
+
party: string;
|
|
211
|
+
signatures: Array<Record<string, unknown>>;
|
|
212
|
+
}>;
|
|
213
|
+
};
|
|
214
|
+
}): Promise<{
|
|
215
|
+
committed: boolean;
|
|
216
|
+
submissionRef: string;
|
|
217
|
+
executeBefore: string;
|
|
218
|
+
}>;
|
|
167
219
|
balance(party: string): Promise<BalanceResult>;
|
|
220
|
+
/** Merchant TransferPreapproval status (public read). `hasPreapproval:true`
|
|
221
|
+
* means CC transfers to this merchant complete in ONE tx (the transfer-factory
|
|
222
|
+
* "V3" precondition); `false` → 2-step Pending; `null` → could not resolve
|
|
223
|
+
* (validator Scan flavor / transient). */
|
|
224
|
+
preapprovalStatus(party: string, admin: string, id?: string): Promise<{
|
|
225
|
+
merchant: string;
|
|
226
|
+
instrumentId: {
|
|
227
|
+
admin: string;
|
|
228
|
+
id: string;
|
|
229
|
+
};
|
|
230
|
+
transferKind: string;
|
|
231
|
+
hasPreapproval: boolean | null;
|
|
232
|
+
guidance?: string;
|
|
233
|
+
note?: string;
|
|
234
|
+
}>;
|
|
235
|
+
/** Facilitator-as-provider creation of a merchant TransferPreapproval
|
|
236
|
+
* (operator action — the facilitator pays the preapproval fee). Requires the
|
|
237
|
+
* facilitator OPERATOR token (Authorization: Bearer) AND the merchant to have
|
|
238
|
+
* delegated CanActAs to the facilitator's ledger user. Returns the created
|
|
239
|
+
* preapproval's updateId + expiry. */
|
|
240
|
+
createPreapproval(party: string, opts: {
|
|
241
|
+
operatorToken: string;
|
|
242
|
+
expiresAt?: string;
|
|
243
|
+
}): Promise<{
|
|
244
|
+
updateId: string;
|
|
245
|
+
receiver: string;
|
|
246
|
+
provider: string;
|
|
247
|
+
expiresAt: string;
|
|
248
|
+
}>;
|
|
249
|
+
/** SELF-PROVIDER preapproval, step 1 — the relay builds + interactive-prepares
|
|
250
|
+
* an `AmuletRules_CreateTransferPreapproval` for `party` (provider==receiver==
|
|
251
|
+
* party). Returns the prepared transaction + hash the merchant signs with its
|
|
252
|
+
* OWN key (no operator token, no CanActAs delegation needed). */
|
|
253
|
+
preapprovalSelfPrepare(party: string, expiresAt?: string): Promise<{
|
|
254
|
+
preparedTransaction: string;
|
|
255
|
+
txHash: string;
|
|
256
|
+
synchronizerId: string;
|
|
257
|
+
party: string;
|
|
258
|
+
expiresAt: string;
|
|
259
|
+
}>;
|
|
260
|
+
/** SELF-PROVIDER preapproval, step 2 — submit the merchant-signed prepared
|
|
261
|
+
* transaction; returns the created preapproval's updateId. */
|
|
262
|
+
preapprovalSelfCommit(body: {
|
|
263
|
+
party: string;
|
|
264
|
+
preparedTransaction: string;
|
|
265
|
+
hashingSchemeVersion: string;
|
|
266
|
+
partySignatures: {
|
|
267
|
+
signatures: Array<{
|
|
268
|
+
party: string;
|
|
269
|
+
signatures: Array<Record<string, unknown>>;
|
|
270
|
+
}>;
|
|
271
|
+
};
|
|
272
|
+
}): Promise<{
|
|
273
|
+
updateId: string;
|
|
274
|
+
}>;
|
|
168
275
|
/** Enumerate `party`'s Amulet holdings from the PUBLIC SV Scan ACS snapshot
|
|
169
276
|
* (paginated, no participant node cap). The WHALE fallback for `merge` when
|
|
170
277
|
* `balance()` throws the 413 holdings_exceed_node_limit case
|
|
@@ -220,6 +327,13 @@ export declare class RelayClient {
|
|
|
220
327
|
/** allocation-api: read the created Allocation / AllocationInstruction cid off
|
|
221
328
|
* the AllocationFactory_Allocate transaction (the agent is relay-only). */
|
|
222
329
|
allocationResult(party: string, updateId: string): Promise<AllocationResultResult>;
|
|
330
|
+
/** Read the Amulet OUTPUT cids a transfer transaction created for `party`, by
|
|
331
|
+
* updateId (whale-merge output discovery — the agent is relay-only). The relay
|
|
332
|
+
* reads the tx (getTransactionById, bounded per-tx, immune to the ACS element
|
|
333
|
+
* cap) and returns the Amulet contracts OWNED BY `party` that it created. The
|
|
334
|
+
* `merge` chain phase uses this to feed a batch's own outputs into the next
|
|
335
|
+
* round, so consolidation converges in ONE run without the daily Scan snapshot. */
|
|
336
|
+
txAmulets(party: string, updateId: string): Promise<TxAmuletsResult>;
|
|
223
337
|
/** x402-direct "Design B": resolve OR mint the standing both-party
|
|
224
338
|
* DirectSettlementConsent for the {sender, merchant} pair (the facilitator
|
|
225
339
|
* exercises MerchantConsent_Accept ALONE off the two standing consents). The
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-client.d.ts","sourceRoot":"","sources":["../src/relay-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,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/B;IAOD,aAAa,CAAC,CAAC,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE;IAG3C;;0CAEsC;IACtC,eAAe,CAAC,CAAC,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE;IAO5C;;kCAE8B;IAC9B,wBAAwB,CAAC,CAAC,EAAE;QAC1B,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,mBAAmB,EAAE,MAAM,CAAC;QAC5B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/B;IAOD;gFAC4E;IAC5E,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAMhD;;;;;wFAKoF;IACpF,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAMzC;;;;;;sFAMkF;IAClF,iBAAiB,CAAC,CAAC,EAAE;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC3B;CAOF"}
|
package/dist/relay-client.js
CHANGED
|
@@ -47,11 +47,11 @@ export class RelayClient {
|
|
|
47
47
|
h["x-agent-key"] = this.opts.apiKey;
|
|
48
48
|
return h;
|
|
49
49
|
}
|
|
50
|
-
async req(method, path, body) {
|
|
50
|
+
async req(method, path, body, extraHeaders) {
|
|
51
51
|
const url = this.opts.relayUrl.replace(/\/$/, "") + path;
|
|
52
52
|
const r = await fetch(url, {
|
|
53
53
|
method,
|
|
54
|
-
headers: this.headers(),
|
|
54
|
+
headers: { ...this.headers(), ...(extraHeaders ?? {}) },
|
|
55
55
|
...(body !== undefined ? { body: JSON.stringify(body) } : {}),
|
|
56
56
|
});
|
|
57
57
|
const text = await r.text();
|
|
@@ -81,9 +81,52 @@ export class RelayClient {
|
|
|
81
81
|
submitExecute(b) {
|
|
82
82
|
return this.req("POST", "/v1/wallet/submit/execute", b);
|
|
83
83
|
}
|
|
84
|
+
/** transfer-factory ("V3") pay step 1: the relay BUILDS + interactive-prepares
|
|
85
|
+
* the TransferFactory_Transfer and stashes it, returning the prepared bytes +
|
|
86
|
+
* hash for the client's verify-before-sign and the small `submissionRef` the
|
|
87
|
+
* x402 payload carries. */
|
|
88
|
+
payPrepare(b) {
|
|
89
|
+
return this.req("POST", "/v1/wallet/pay/prepare", b);
|
|
90
|
+
}
|
|
91
|
+
/** transfer-factory pay step 2: attach the payer's signing bundle to the
|
|
92
|
+
* stashed submission (NO execution — /settle relays it later). */
|
|
93
|
+
payCommit(b) {
|
|
94
|
+
return this.req("POST", "/v1/wallet/pay/commit", b);
|
|
95
|
+
}
|
|
84
96
|
balance(party) {
|
|
85
97
|
return this.req("GET", `/v1/wallet/${encodeURIComponent(party)}/balance`);
|
|
86
98
|
}
|
|
99
|
+
/** Merchant TransferPreapproval status (public read). `hasPreapproval:true`
|
|
100
|
+
* means CC transfers to this merchant complete in ONE tx (the transfer-factory
|
|
101
|
+
* "V3" precondition); `false` → 2-step Pending; `null` → could not resolve
|
|
102
|
+
* (validator Scan flavor / transient). */
|
|
103
|
+
preapprovalStatus(party, admin, id = "Amulet") {
|
|
104
|
+
const q = `admin=${encodeURIComponent(admin)}&id=${encodeURIComponent(id)}`;
|
|
105
|
+
return this.req("GET", `/v1/merchants/${encodeURIComponent(party)}/preapproval-status?${q}`);
|
|
106
|
+
}
|
|
107
|
+
/** Facilitator-as-provider creation of a merchant TransferPreapproval
|
|
108
|
+
* (operator action — the facilitator pays the preapproval fee). Requires the
|
|
109
|
+
* facilitator OPERATOR token (Authorization: Bearer) AND the merchant to have
|
|
110
|
+
* delegated CanActAs to the facilitator's ledger user. Returns the created
|
|
111
|
+
* preapproval's updateId + expiry. */
|
|
112
|
+
createPreapproval(party, opts) {
|
|
113
|
+
return this.req("POST", `/v1/merchants/${encodeURIComponent(party)}/preapproval`, opts.expiresAt ? { expiresAt: opts.expiresAt } : {}, { authorization: `Bearer ${opts.operatorToken}` });
|
|
114
|
+
}
|
|
115
|
+
/** SELF-PROVIDER preapproval, step 1 — the relay builds + interactive-prepares
|
|
116
|
+
* an `AmuletRules_CreateTransferPreapproval` for `party` (provider==receiver==
|
|
117
|
+
* party). Returns the prepared transaction + hash the merchant signs with its
|
|
118
|
+
* OWN key (no operator token, no CanActAs delegation needed). */
|
|
119
|
+
preapprovalSelfPrepare(party, expiresAt) {
|
|
120
|
+
return this.req("POST", "/v1/wallet/preapproval/self/prepare", {
|
|
121
|
+
party,
|
|
122
|
+
...(expiresAt ? { expiresAt } : {}),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/** SELF-PROVIDER preapproval, step 2 — submit the merchant-signed prepared
|
|
126
|
+
* transaction; returns the created preapproval's updateId. */
|
|
127
|
+
preapprovalSelfCommit(body) {
|
|
128
|
+
return this.req("POST", "/v1/wallet/preapproval/self/commit", body);
|
|
129
|
+
}
|
|
87
130
|
/** Enumerate `party`'s Amulet holdings from the PUBLIC SV Scan ACS snapshot
|
|
88
131
|
* (paginated, no participant node cap). The WHALE fallback for `merge` when
|
|
89
132
|
* `balance()` throws the 413 holdings_exceed_node_limit case
|
|
@@ -132,6 +175,15 @@ export class RelayClient {
|
|
|
132
175
|
allocationResult(party, updateId) {
|
|
133
176
|
return this.req("GET", `/v1/wallet/${encodeURIComponent(party)}/allocation-result?updateId=${encodeURIComponent(updateId)}`);
|
|
134
177
|
}
|
|
178
|
+
/** Read the Amulet OUTPUT cids a transfer transaction created for `party`, by
|
|
179
|
+
* updateId (whale-merge output discovery — the agent is relay-only). The relay
|
|
180
|
+
* reads the tx (getTransactionById, bounded per-tx, immune to the ACS element
|
|
181
|
+
* cap) and returns the Amulet contracts OWNED BY `party` that it created. The
|
|
182
|
+
* `merge` chain phase uses this to feed a batch's own outputs into the next
|
|
183
|
+
* round, so consolidation converges in ONE run without the daily Scan snapshot. */
|
|
184
|
+
txAmulets(party, updateId) {
|
|
185
|
+
return this.req("GET", `/v1/wallet/${encodeURIComponent(party)}/tx-amulets?updateId=${encodeURIComponent(updateId)}`);
|
|
186
|
+
}
|
|
135
187
|
/** x402-direct "Design B": resolve OR mint the standing both-party
|
|
136
188
|
* DirectSettlementConsent for the {sender, merchant} pair (the facilitator
|
|
137
189
|
* exercises MerchantConsent_Accept ALONE off the two standing consents). The
|
package/dist/relay-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-client.js","sourceRoot":"","sources":["../src/relay-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"relay-client.js","sourceRoot":"","sources":["../src/relay-client.ts"],"names":[],"mappings":"AAgHA;;;;;;;;;GASG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAG5B;IAEA;IAJX,YACE,OAAe,EACN,MAAc;IACvB,wEAAwE;IAC/D,IAAa;QAEtB,KAAK,CAAC,OAAO,CAAC,CAAC;QAJN,WAAM,GAAN,MAAM,CAAQ;QAEd,SAAI,GAAJ,IAAI,CAAS;QAGtB,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED;;;;wCAIwC;AACxC,MAAM,UAAU,8BAA8B,CAAC,GAAY;IACzD,IAAI,GAAG,YAAY,cAAc,EAAE,CAAC;QAClC,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;YAAE,OAAO,IAAI,CAAC;QACpC,MAAM,IAAI,GAAI,GAAG,CAAC,IAAuC,EAAE,IAAI,CAAC;QAChE,IAAI,IAAI,KAAK,4BAA4B;YAAE,OAAO,IAAI,CAAC;IACzD,CAAC;IACD,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7D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1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-signer.d.ts","sourceRoot":"","sources":["../src/relay-signer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"relay-signer.d.ts","sourceRoot":"","sources":["../src/relay-signer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAUhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAY/D,wBAAsB,mBAAmB,CAAC,CAAC,EACzC,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACrB,KAAK,GAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CACI,GACtC,OAAO,CAAC,CAAC,CAAC,CAeZ;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,WAAW,EACnB,IAAI,GAAE;IACJ,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;yEAGqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;kCAO8B;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;6EAIyE;IACzE,aAAa,CAAC,EAAE,MAAM,CAAC;CACnB,GACL,YAAY,CA8Jd"}
|