@ftptech/canton-agent-wallet 0.5.0 → 0.6.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/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +1 -10
- package/dist/cli-args.js.map +1 -1
- package/dist/cli.js +56 -147
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/pay.d.ts.map +1 -1
- package/dist/pay.js +12 -11
- package/dist/pay.js.map +1 -1
- package/dist/relay-client.d.ts +0 -79
- package/dist/relay-client.d.ts.map +1 -1
- package/dist/relay-client.js +0 -27
- package/dist/relay-client.js.map +1 -1
- package/dist/relay-signer.d.ts +10 -10
- package/dist/relay-signer.d.ts.map +1 -1
- package/dist/relay-signer.js +4 -72
- package/dist/relay-signer.js.map +1 -1
- package/dist/tx.d.ts +0 -148
- package/dist/tx.d.ts.map +1 -1
- package/dist/tx.js +9 -330
- package/dist/tx.js.map +1 -1
- package/dist/verify-prepared.d.ts +0 -153
- package/dist/verify-prepared.d.ts.map +1 -1
- package/dist/verify-prepared.js +0 -642
- package/dist/verify-prepared.js.map +1 -1
- package/package.json +2 -2
package/dist/tx.js
CHANGED
|
@@ -7,14 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { signHashB64 } from "./keys.js";
|
|
9
9
|
import { resolveHashBinding } from "./hash-binding.js";
|
|
10
|
-
import { assertHashBinding, assertPreparedTransferMatches, assertPreparedSelfPreapproval, assertPreparedAcceptMatches,
|
|
10
|
+
import { assertHashBinding, assertPreparedTransferMatches, assertPreparedSelfPreapproval, assertPreparedAcceptMatches, } from "./verify-prepared.js";
|
|
11
11
|
const TI_IFACE = "#splice-api-token-transfer-instruction-v1:Splice.Api.Token.TransferInstructionV1:TransferInstruction";
|
|
12
|
-
/** The AllocationV1 interface the reclaim (`Allocation_Withdraw`) choice is
|
|
13
|
-
* exercised THROUGH. Like TI_IFACE, the `#`-prefixed package name lets the
|
|
14
|
-
* participant resolve the interface package at prepare time (the concrete
|
|
15
|
-
* AmuletAllocation template implements it). CALLER INTENT — the verify arm
|
|
16
|
-
* pins the target contract id + the choice + own-party, never this string. */
|
|
17
|
-
const ALLOCATION_IFACE = "#splice-api-token-allocation-v1:Splice.Api.Token.AllocationV1:Allocation";
|
|
18
12
|
/**
|
|
19
13
|
* The instrument id the agent's self-custody wallet pays in: Canton Coin is the
|
|
20
14
|
* Splice "Amulet" instrument. This is CALLER INTENT — a fixed value the agent
|
|
@@ -26,22 +20,6 @@ const ALLOCATION_IFACE = "#splice-api-token-allocation-v1:Splice.Api.Token.Alloc
|
|
|
26
20
|
* the instrument id to this constant; the admin is validated only positionally.
|
|
27
21
|
*/
|
|
28
22
|
const EXPECTED_INSTRUMENT_ID = "Amulet";
|
|
29
|
-
/** AllocationFactory interface template id for `AllocationFactory_Allocate`. A
|
|
30
|
-
* PROTOCOL CONSTANT (the `#`-prefix resolves to the current Splice package), so
|
|
31
|
-
* the client uses it DIRECTLY rather than trusting the relay-supplied value —
|
|
32
|
-
* the contract cid it exercises against is pinned separately in
|
|
33
|
-
* verify-before-sign. Mirrors `ALLOCATION_FACTORY_TEMPLATE_ID` in
|
|
34
|
-
* @ftptech/x402-canton-core (kept local to avoid an agent-wallet→core dep). */
|
|
35
|
-
const ALLOCATION_FACTORY_TEMPLATE_ID = "#splice-api-token-allocation-instruction-v1:Splice.Api.Token.AllocationInstructionV1:AllocationFactory";
|
|
36
|
-
/** The x402-direct "Design B" standing-consent templates the agent creates by
|
|
37
|
-
* SIGNING ITS OWN create (signatory = the agent). The `#`-prefixed package NAME
|
|
38
|
-
* lets the participant resolve its vetted version at prepare time — the same
|
|
39
|
-
* convention the escrow offer / TI / Allocation interface refs use above. CALLER
|
|
40
|
-
* INTENT — the verify arm pins the created template's module:entity + the consent's
|
|
41
|
-
* {self, facilitator} principals, never this string. (Deployed package-id, for
|
|
42
|
-
* reference: x402-direct-0.1.0-f819db3288986a7f6c3157359ed02040e0a6080ceb6890309ecbb71eeeb93780.) */
|
|
43
|
-
const X402_DIRECT_SENDER_CONSENT_TEMPLATE_ID = "#x402-direct:X402Direct:SenderConsent";
|
|
44
|
-
const X402_DIRECT_MERCHANT_CONSENT_TEMPLATE_ID = "#x402-direct:X402Direct:MerchantConsent";
|
|
45
23
|
function rid(prefix) {
|
|
46
24
|
return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
47
25
|
}
|
|
@@ -88,35 +66,11 @@ synchronizerId) {
|
|
|
88
66
|
// Bind to the EXACT bytes we will submit (single source `prep`, no TOCTOU).
|
|
89
67
|
const preparedTransaction = prep.preparedTransaction;
|
|
90
68
|
// VERIFY-BEFORE-SIGN: never sign a relay-prepared command we didn't author.
|
|
91
|
-
// `verify` is required on EVERY path (transfer/
|
|
92
|
-
//
|
|
69
|
+
// `verify` is required on EVERY path (transfer/accept), so there is no branch
|
|
70
|
+
// that reaches signHashB64 ungated.
|
|
93
71
|
if (verify.kind === "cip56") {
|
|
94
72
|
assertPreparedTransferMatches(preparedTransaction, verify.expect);
|
|
95
73
|
}
|
|
96
|
-
else if (verify.kind === "allocation") {
|
|
97
|
-
// allocation-api path: structurally prove the prepared tx is a single
|
|
98
|
-
// AllocationFactory_Allocate locking funds with the intended
|
|
99
|
-
// sender/receiver/amount/instrument AND naming the facilitator (not an
|
|
100
|
-
// attacker) as settlement.executor, with a valid deadline window.
|
|
101
|
-
assertPreparedAllocationMatches(preparedTransaction, verify.expect);
|
|
102
|
-
}
|
|
103
|
-
else if (verify.kind === "allocation-withdraw") {
|
|
104
|
-
// reclaim path (Track B): structurally prove the prepared tx is a single
|
|
105
|
-
// Allocation_Withdraw on the caller's OWN allocation cid, submitted by the
|
|
106
|
-
// agent, with no outbound transfer leg and no foreign party — Allocation_Withdraw
|
|
107
|
-
// returns funds to the sender by construction, so anything else is a redirect.
|
|
108
|
-
assertPreparedAllocationWithdrawMatches(preparedTransaction, verify.expect);
|
|
109
|
-
}
|
|
110
|
-
else if (verify.kind === "consent-create") {
|
|
111
|
-
// x402-direct "Design B" onboarding: structurally prove the prepared tx is a
|
|
112
|
-
// single SenderConsent / MerchantConsent CREATE by the agent (the signing
|
|
113
|
-
// party), naming exactly {selfParty, facilitator} — no value-moving choice, no
|
|
114
|
-
// injected outbound leg, no relay-substituted facilitator, no foreign-party
|
|
115
|
-
// submission. Creating a standing consent moves NO funds (it only captures the
|
|
116
|
-
// party's one-time authorization), so anything else is a relay-injected drain or
|
|
117
|
-
// a substituted facilitator that could later settle the agent's allocations.
|
|
118
|
-
assertPreparedConsentCreateMatches(preparedTransaction, verify.expect);
|
|
119
|
-
}
|
|
120
74
|
else {
|
|
121
75
|
// claim path: structurally prove the prepared tx is a single inbound
|
|
122
76
|
// TransferInstruction_Accept by the agent, not an outbound drain.
|
|
@@ -282,14 +236,14 @@ export async function payViaTransferFactory(relay, wallet, opts) {
|
|
|
282
236
|
};
|
|
283
237
|
}
|
|
284
238
|
/**
|
|
285
|
-
* Per-wallet in-process reservation of input-holding cids.
|
|
286
|
-
*
|
|
287
|
-
* BUT two concurrent
|
|
239
|
+
* Per-wallet in-process reservation of input-holding cids. The token-standard
|
|
240
|
+
* transfer path has NO nonce, so concurrent pays from one wallet are allowed —
|
|
241
|
+
* BUT two concurrent transfers must not pick the SAME Amulet holding: the first
|
|
288
242
|
* to settle archives it, and the second's already-prepared tx then references an
|
|
289
243
|
* archived contract → HTTP 400 at /v2/interactive-submission/prepare (or at
|
|
290
|
-
* execute). To keep concurrent
|
|
244
|
+
* execute). To keep concurrent transfers disjoint we pick the SMALLEST single
|
|
291
245
|
* free holding that covers the amount and reserve its cid for the duration of the
|
|
292
|
-
* prepare→sign→execute dance; a sibling
|
|
246
|
+
* prepare→sign→execute dance; a sibling transfer then skips it and picks the next
|
|
293
247
|
* one. Released in `finally` (success OR throw).
|
|
294
248
|
*
|
|
295
249
|
* LIMITATION (documented): this Map is in-memory, so it only de-conflicts
|
|
@@ -297,8 +251,7 @@ export async function payViaTransferFactory(relay, wallet, opts) {
|
|
|
297
251
|
* wallet can still pick the same holding — that loser fails closed (400) and the
|
|
298
252
|
* client's bounded re-pay loop retries with a fresh balance read, by which point
|
|
299
253
|
* the winner has released. No double-spend is possible: verify-before-sign + the
|
|
300
|
-
* facilitator re-validate every settle, so a lost race only costs a retry.
|
|
301
|
-
* v1 nonce path keeps its cross-process pay-lock; see pay.ts.)
|
|
254
|
+
* facilitator re-validate every settle, so a lost race only costs a retry.
|
|
302
255
|
*/
|
|
303
256
|
const reservedHoldings = new Map();
|
|
304
257
|
/** @internal Exported for unit tests (disjoint selection + release). Not part of
|
|
@@ -386,219 +339,6 @@ export function isStaleInputHoldingError(err) {
|
|
|
386
339
|
}
|
|
387
340
|
return false;
|
|
388
341
|
}
|
|
389
|
-
/**
|
|
390
|
-
* allocation-api (CIP-56 DVP) — exercise `AllocationFactory_Allocate` to LOCK
|
|
391
|
-
* the agent's funds into an Allocation naming the facilitator as
|
|
392
|
-
* settlement.executor. The facilitator later submits Allocation_ExecuteTransfer
|
|
393
|
-
* (sponsored gas) to settle. The agent signs only the lock here (its own key;
|
|
394
|
-
* the choice's sole controller is transferLeg.sender = the agent) — no gas, no
|
|
395
|
-
* nonce, no merchant preapproval.
|
|
396
|
-
*
|
|
397
|
-
* Mirrors the cip56 `transfer` flow: resolve the allocation factory via the
|
|
398
|
-
* relay → build the allocate exercise → VERIFY-before-sign over the EXACT
|
|
399
|
-
* prepared bytes (pinning sender/receiver/amount/instrument + the executor +
|
|
400
|
-
* the deadline window) → sign locally → execute via relay → read back the
|
|
401
|
-
* created Allocation cid from THIS transaction's events.
|
|
402
|
-
*
|
|
403
|
-
* SECURITY: every money/escrow-critical field the verifier pins (sender == own
|
|
404
|
-
* party, receiver == merchant payTo, amount == required, instrument == intent,
|
|
405
|
-
* settlement.executor == extra.feePayer) is CALLER INTENT passed in `opts`,
|
|
406
|
-
* NOT taken from the relay's resolve response. The relay-resolved factory
|
|
407
|
-
* refs/admin/context are used only to BUILD the exercise; they widen nothing the
|
|
408
|
-
* agent will sign. The cid returned moves no funds on its own — the facilitator
|
|
409
|
-
* independently re-validates every field at /verify + /settle, and only the
|
|
410
|
-
* executor (+ baked-in sender/receiver auth) can ever move the locked funds.
|
|
411
|
-
*/
|
|
412
|
-
export async function allocate(relay, wallet, opts) {
|
|
413
|
-
if (!(opts.settleBeforeSeconds > opts.allocateBeforeSeconds)) {
|
|
414
|
-
throw new Error(`allocate: settleBeforeSeconds (${opts.settleBeforeSeconds}) must be > ` +
|
|
415
|
-
`allocateBeforeSeconds (${opts.allocateBeforeSeconds})`);
|
|
416
|
-
}
|
|
417
|
-
const bal = await relay.balance(wallet.party);
|
|
418
|
-
// Reserve DISJOINT input holdings so concurrent allocates from THIS wallet
|
|
419
|
-
// (allocation has no nonce → concurrency is allowed) don't collide on the same
|
|
420
|
-
// Amulet — the first to settle archives it and the loser's prepared tx then
|
|
421
|
-
// 400s on an archived contract. Held until the allocate commits (its inputs are
|
|
422
|
-
// archived on-ledger) or throws; released in the finally below either way.
|
|
423
|
-
const reservation = reserveHolding(wallet.party, bal.holdings, opts.amount);
|
|
424
|
-
const inputHoldingCids = reservation.cids;
|
|
425
|
-
let updateId;
|
|
426
|
-
try {
|
|
427
|
-
const f = await relay.resolveAllocationFactory({
|
|
428
|
-
sender: wallet.party,
|
|
429
|
-
receiver: opts.receiver,
|
|
430
|
-
amount: opts.amount,
|
|
431
|
-
executor: opts.executor,
|
|
432
|
-
allocateBeforeSeconds: opts.allocateBeforeSeconds,
|
|
433
|
-
settleBeforeSeconds: opts.settleBeforeSeconds,
|
|
434
|
-
...(opts.transferMeta ? { meta: opts.transferMeta } : {}),
|
|
435
|
-
});
|
|
436
|
-
const now = Date.now();
|
|
437
|
-
// Mirror the relay's resolve deadlines so verify-before-sign sees the same
|
|
438
|
-
// window the relay prepared against. The verify arm asserts allocateBefore <
|
|
439
|
-
// settleBefore and settleBefore in the future; we compute them here from the
|
|
440
|
-
// caller-intent relative seconds so the relay cannot widen them silently.
|
|
441
|
-
const requestedAt = new Date(now - 2000).toISOString();
|
|
442
|
-
const allocateBefore = new Date(now + opts.allocateBeforeSeconds * 1000).toISOString();
|
|
443
|
-
const settleBefore = new Date(now + opts.settleBeforeSeconds * 1000).toISOString();
|
|
444
|
-
const allocation = {
|
|
445
|
-
settlement: {
|
|
446
|
-
executor: opts.executor,
|
|
447
|
-
settlementRef: f.settlementRef,
|
|
448
|
-
requestedAt,
|
|
449
|
-
allocateBefore,
|
|
450
|
-
settleBefore,
|
|
451
|
-
meta: { values: {} },
|
|
452
|
-
},
|
|
453
|
-
transferLegId: f.transferLegId,
|
|
454
|
-
transferLeg: {
|
|
455
|
-
sender: wallet.party,
|
|
456
|
-
receiver: opts.receiver,
|
|
457
|
-
amount: opts.amount,
|
|
458
|
-
instrumentId: f.instrumentId,
|
|
459
|
-
meta: { values: opts.transferMeta ?? {} },
|
|
460
|
-
},
|
|
461
|
-
};
|
|
462
|
-
const ex = {
|
|
463
|
-
ExerciseCommand: {
|
|
464
|
-
templateId: ALLOCATION_FACTORY_TEMPLATE_ID,
|
|
465
|
-
contractId: f.factoryId,
|
|
466
|
-
choice: "AllocationFactory_Allocate",
|
|
467
|
-
choiceArgument: {
|
|
468
|
-
expectedAdmin: f.instrumentId.admin,
|
|
469
|
-
allocation,
|
|
470
|
-
requestedAt,
|
|
471
|
-
inputHoldingCids,
|
|
472
|
-
extraArgs: { context: f.choiceContextData, meta: { values: {} } },
|
|
473
|
-
},
|
|
474
|
-
},
|
|
475
|
-
};
|
|
476
|
-
updateId = await prepareSignExecute(relay, wallet, [ex], f.disclosedContracts, {
|
|
477
|
-
kind: "allocation",
|
|
478
|
-
expect: {
|
|
479
|
-
// Trust anchors are CALLER INTENT only — never the relay's resolve response:
|
|
480
|
-
sender: wallet.party,
|
|
481
|
-
// OWN-PARTY PIN: the allocate controller IS the sender, so the prepared
|
|
482
|
-
// transferLeg.sender MUST equal the agent's own party. Threaded from
|
|
483
|
-
// wallet.party (known independently of the relay). Fails closed on any
|
|
484
|
-
// sender/receiver transposition regardless of the unconfirmed field order.
|
|
485
|
-
expectedSender: wallet.party,
|
|
486
|
-
receiver: opts.receiver,
|
|
487
|
-
amount: opts.amount,
|
|
488
|
-
instrumentId: opts.expectInstrumentId ?? EXPECTED_INSTRUMENT_ID,
|
|
489
|
-
executor: opts.executor,
|
|
490
|
-
// Pin the exercise's target to the SAME factory cid we built against
|
|
491
|
-
// (resolve→prepare TOCTOU defense-in-depth).
|
|
492
|
-
expectedContractId: f.factoryId,
|
|
493
|
-
...(opts.expectInstrumentAdmin !== undefined
|
|
494
|
-
? { instrumentAdmin: opts.expectInstrumentAdmin }
|
|
495
|
-
: {}),
|
|
496
|
-
synchronizerId: opts.synchronizerId,
|
|
497
|
-
nowMs: Date.now(),
|
|
498
|
-
},
|
|
499
|
-
}, opts.hashBinding, opts.synchronizerId);
|
|
500
|
-
}
|
|
501
|
-
finally {
|
|
502
|
-
// Allocate committed (its input holdings are now archived on-ledger) or threw
|
|
503
|
-
// — either way the in-process reservation has done its job; free the cids so a
|
|
504
|
-
// sibling concurrent allocate (or a retry) can pick them.
|
|
505
|
-
reservation.release();
|
|
506
|
-
}
|
|
507
|
-
// Read THIS transaction's events (via the relay) to surface the created
|
|
508
|
-
// Allocation / AllocationInstruction cid. The relay resolves it for us (the
|
|
509
|
-
// agent is relay-only). The cid moves no funds; the facilitator re-validates
|
|
510
|
-
// and executes.
|
|
511
|
-
const alloc = await relay.allocationResult(wallet.party, updateId);
|
|
512
|
-
return {
|
|
513
|
-
payerParty: wallet.party,
|
|
514
|
-
allocationCid: alloc.allocationCid ?? null,
|
|
515
|
-
allocationInstructionCid: alloc.allocationInstructionCid ?? null,
|
|
516
|
-
updateId,
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* x402-direct "Design B" onboarding (SENDER side, ONCE-TOTAL). Create the standing
|
|
521
|
-
* `SenderConsent {sender = self, facilitator}` the facilitator later uses to MINT
|
|
522
|
-
* the both-party DirectSettlementConsent for ANY merchant it names. The choice's
|
|
523
|
-
* sole signatory is the SENDER = the agent, so the agent signs only its own create
|
|
524
|
-
* (its own key; no gas, no facilitator signature). Creating the consent MOVES NO
|
|
525
|
-
* FUNDS — it only durably captures the sender's one-time authorization.
|
|
526
|
-
*
|
|
527
|
-
* Mirrors the cip56/v1/allocate flows: build the create exercise → VERIFY-before-sign
|
|
528
|
-
* over the EXACT prepared bytes (pinning the created template + the consent's
|
|
529
|
-
* {sender == self, facilitator} principals + act_as == self, and the foreign-party
|
|
530
|
-
* backstop allowing ONLY {self, facilitator}) → sign locally → execute via the relay
|
|
531
|
-
* → return the create's updateId.
|
|
532
|
-
*
|
|
533
|
-
* SECURITY: every pinned field is CALLER INTENT passed in `opts`, never taken from
|
|
534
|
-
* the relay. A relay-substituted facilitator (which could later mint a both-party
|
|
535
|
-
* consent and settle the agent's allocations) is rejected by the [1] facilitator pin
|
|
536
|
-
* + the foreign-party backstop; a relay-injected value-moving exercise / extra leg /
|
|
537
|
-
* foreign submitter is rejected by the create-root invariant. The cid moves no funds
|
|
538
|
-
* on its own — the facilitator's later DirectSettlementConsent_Execute re-validates
|
|
539
|
-
* every term against the live allocation.
|
|
540
|
-
*/
|
|
541
|
-
export async function createSenderConsent(relay, wallet, opts) {
|
|
542
|
-
return createDirectConsent(relay, wallet, {
|
|
543
|
-
consent: "sender",
|
|
544
|
-
templateId: X402_DIRECT_SENDER_CONSENT_TEMPLATE_ID,
|
|
545
|
-
// SenderConsent create-args (Daml declaration order): [0] sender, [1] facilitator.
|
|
546
|
-
createArguments: { sender: wallet.party, facilitator: opts.facilitator },
|
|
547
|
-
facilitator: opts.facilitator,
|
|
548
|
-
synchronizerId: opts.synchronizerId,
|
|
549
|
-
...(opts.hashBinding ? { hashBinding: opts.hashBinding } : {}),
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
/**
|
|
553
|
-
* x402-direct "Design B" onboarding (MERCHANT side, ONCE-TOTAL). Symmetric to
|
|
554
|
-
* `createSenderConsent`: create the standing `MerchantConsent {merchant = self,
|
|
555
|
-
* facilitator}` the facilitator later uses to MINT the both-party
|
|
556
|
-
* DirectSettlementConsent (MerchantConsent_Accept) from ANY sender it names. The
|
|
557
|
-
* choice's sole signatory is the MERCHANT = the agent. Creating the consent MOVES NO
|
|
558
|
-
* FUNDS. Same verify-before-sign guarantees as the sender side.
|
|
559
|
-
*/
|
|
560
|
-
export async function createMerchantConsent(relay, wallet, opts) {
|
|
561
|
-
return createDirectConsent(relay, wallet, {
|
|
562
|
-
consent: "merchant",
|
|
563
|
-
templateId: X402_DIRECT_MERCHANT_CONSENT_TEMPLATE_ID,
|
|
564
|
-
// MerchantConsent create-args (Daml declaration order): [0] merchant, [1] facilitator.
|
|
565
|
-
createArguments: { merchant: wallet.party, facilitator: opts.facilitator },
|
|
566
|
-
facilitator: opts.facilitator,
|
|
567
|
-
synchronizerId: opts.synchronizerId,
|
|
568
|
-
...(opts.hashBinding ? { hashBinding: opts.hashBinding } : {}),
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
/** Shared create+verify+sign for the two standing x402-direct consents (the only
|
|
572
|
-
* difference is the template + the [0] field label). No funds move; the consent
|
|
573
|
-
* binds exactly {self, facilitator}. */
|
|
574
|
-
async function createDirectConsent(relay, wallet, args) {
|
|
575
|
-
const ex = {
|
|
576
|
-
CreateCommand: {
|
|
577
|
-
templateId: args.templateId,
|
|
578
|
-
createArguments: args.createArguments,
|
|
579
|
-
},
|
|
580
|
-
};
|
|
581
|
-
return prepareSignExecute(relay, wallet, [ex], [], // a bare consent create discloses nothing (signatory = the agent).
|
|
582
|
-
// VERIFY-before-sign: the prepared tx MUST be a single SenderConsent /
|
|
583
|
-
// MerchantConsent create by the agent naming exactly {self, facilitator} —
|
|
584
|
-
// never a relay-swapped value-moving choice, a substituted facilitator, an
|
|
585
|
-
// outbound drain, or a foreign-party submission.
|
|
586
|
-
{
|
|
587
|
-
kind: "consent-create",
|
|
588
|
-
expect: {
|
|
589
|
-
selfParty: wallet.party,
|
|
590
|
-
facilitator: args.facilitator,
|
|
591
|
-
consent: args.consent,
|
|
592
|
-
synchronizerId: args.synchronizerId,
|
|
593
|
-
nowMs: Date.now(),
|
|
594
|
-
},
|
|
595
|
-
},
|
|
596
|
-
// BUG FIX: default to resolveHashBinding() when the caller (e.g. the CLI
|
|
597
|
-
// merchant-onboard / sender-onboard) does not pass one — exactly like the
|
|
598
|
-
// reclaim/withdraw/accept paths. Without this, prepareSignExecute receives
|
|
599
|
-
// an empty binding and refuses to sign ("no hash recomputation available").
|
|
600
|
-
args.hashBinding ?? resolveHashBinding(), args.synchronizerId);
|
|
601
|
-
}
|
|
602
342
|
/**
|
|
603
343
|
* Accept every pending incoming transfer (e.g. the agent's initial funding).
|
|
604
344
|
*
|
|
@@ -636,67 +376,6 @@ export async function claimAll(relay, wallet, opts = {}) {
|
|
|
636
376
|
}
|
|
637
377
|
return { claimed: pending.length, updateIds };
|
|
638
378
|
}
|
|
639
|
-
/**
|
|
640
|
-
* Reclaim a locked allocation: exercise `Allocation_Withdraw` on the agent's own
|
|
641
|
-
* `AmuletAllocation`, returning its locked funds to the agent (Track B — "locked
|
|
642
|
-
* funds always recoverable"). The choice's sole controller is
|
|
643
|
-
* `allocation.transferLeg.sender` = the agent, and `Allocation_Withdraw` returns
|
|
644
|
-
* the funds to the sender BY CONSTRUCTION — there is no attacker-controllable
|
|
645
|
-
* destination in the choice argument.
|
|
646
|
-
*
|
|
647
|
-
* SECURITY: like every path, this is NOT exempt from verify-before-sign. A
|
|
648
|
-
* malicious relay could return a DIFFERENT choice that DOES move value to an
|
|
649
|
-
* attacker (Allocation_ExecuteTransfer / a TransferFactory_Transfer drain), a
|
|
650
|
-
* withdraw of a DIFFERENT allocation, an injected outbound transfer leg, or a
|
|
651
|
-
* foreign-party submission. We pass `kind: "allocation-withdraw"`, which
|
|
652
|
-
* structurally proves the prepared transaction is a single `Allocation_Withdraw`
|
|
653
|
-
* on EXACTLY `opts.allocationCid` (caller intent, REQUIRED contract-id pin),
|
|
654
|
-
* submitted by the agent (act_as == wallet.party), with NO foreign party
|
|
655
|
-
* anywhere — and binds the signed hash to those bytes (fail-closed by default,
|
|
656
|
-
* exactly like the accept/allocate paths). `opts.hashBinding` lets a programmatic
|
|
657
|
-
* caller supply a participant-conformant recompute; the CLI resolves it from the
|
|
658
|
-
* environment (default fail-closed).
|
|
659
|
-
*
|
|
660
|
-
* No caller-intent synchronizer is threaded (like the claim/accept path): the
|
|
661
|
-
* withdraw carries no caller-chosen domain — `prepareSignExecute` omits the
|
|
662
|
-
* synchronizerId arg.
|
|
663
|
-
*/
|
|
664
|
-
export async function reclaimAllocation(relay, wallet, opts) {
|
|
665
|
-
const hashBinding = opts.hashBinding ?? resolveHashBinding();
|
|
666
|
-
// Resolve the (possibly empty) withdraw choice-context + the disclosed
|
|
667
|
-
// AmuletAllocation contract via the relay (the agent has no Scan access).
|
|
668
|
-
const ctx = await relay.resolveWithdraw({ allocationCid: opts.allocationCid });
|
|
669
|
-
const ex = {
|
|
670
|
-
ExerciseCommand: {
|
|
671
|
-
// Exercise THROUGH the AllocationV1 interface; the concrete AmuletAllocation
|
|
672
|
-
// implements it. The choice's controller is transferLeg.sender = the agent.
|
|
673
|
-
templateId: ALLOCATION_IFACE,
|
|
674
|
-
contractId: opts.allocationCid,
|
|
675
|
-
choice: "Allocation_Withdraw",
|
|
676
|
-
choiceArgument: {
|
|
677
|
-
extraArgs: { context: ctx.choiceContextData, meta: { values: {} } },
|
|
678
|
-
},
|
|
679
|
-
},
|
|
680
|
-
};
|
|
681
|
-
return prepareSignExecute(relay, wallet, [ex], ctx.disclosedContracts,
|
|
682
|
-
// VERIFY-before-sign: the prepared tx MUST be a single Allocation_Withdraw on
|
|
683
|
-
// the caller's OWN allocation cid by the agent — never a relay-swapped choice,
|
|
684
|
-
// a different contract, an outbound drain, or a foreign-party submission.
|
|
685
|
-
{
|
|
686
|
-
kind: "allocation-withdraw",
|
|
687
|
-
expect: {
|
|
688
|
-
selfParty: wallet.party,
|
|
689
|
-
allocationCid: opts.allocationCid,
|
|
690
|
-
nowMs: Date.now(),
|
|
691
|
-
...(opts.facilitator ? { facilitator: opts.facilitator } : {}),
|
|
692
|
-
...(opts.instrumentAdmin ? { instrumentAdmin: opts.instrumentAdmin } : {}),
|
|
693
|
-
// Design B DIRECT: pin the allocation's MERCHANT receiver so the verify
|
|
694
|
-
// backstop permits exactly that one party (Design A omits it — receiver ==
|
|
695
|
-
// facilitator). Caller intent only; never the relay's value.
|
|
696
|
-
...(opts.receiver ? { receiver: opts.receiver } : {}),
|
|
697
|
-
},
|
|
698
|
-
}, hashBinding);
|
|
699
|
-
}
|
|
700
379
|
/**
|
|
701
380
|
* SELF-PROVISION a merchant TransferPreapproval so this wallet's incoming
|
|
702
381
|
* transfer-factory ("V3") payments settle DIRECT (1-tx) instead of Pending.
|
package/dist/tx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx.js","sourceRoot":"","sources":["../src/tx.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EACL,iBAAiB,EACjB,6BAA6B,EAC7B,6BAA6B,EAC7B,2BAA2B,EAC3B,+BAA+B,EAC/B,uCAAuC,EACvC,kCAAkC,GAOnC,MAAM,sBAAsB,CAAC;AAE9B,MAAM,QAAQ,GACZ,sGAAsG,CAAC;AAEzG;;;;+EAI+E;AAC/E,MAAM,gBAAgB,GACpB,0EAA0E,CAAC;AAE7E;;;;;;;;;GASG;AACH,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AAExC;;;;;gFAKgF;AAChF,MAAM,8BAA8B,GAClC,wGAAwG,CAAC;AAE3G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AAM,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC;IACtE,OAAO,KAAK,CAAC,qBAAqB,CAAC;QACjC,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;QAC7C,oBAAoB,EAAE,2BAA2B;QACjD,eAAe,EAAE;YACf,UAAU,EAAE;gBACV;oBACE,KAAK,EAAE,MAAM,CAAC,KAAK;oBACnB,UAAU,EAAE;wBACV;4BACE,MAAM,EAAE,yBAAyB;4BACjC,SAAS;4BACT,oBAAoB,EAAE,gCAAgC;4BACtD,QAAQ,EAAE,MAAM,CAAC,oBAAoB;yBACtC;qBACF;iBACF;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -206,159 +206,6 @@ export interface PreparedAcceptExpectation {
|
|
|
206
206
|
* the agent throws.
|
|
207
207
|
*/
|
|
208
208
|
export declare function assertPreparedAcceptMatches(preparedTransactionB64: string, expect: PreparedAcceptExpectation): void;
|
|
209
|
-
interface ExtractedAllocation {
|
|
210
|
-
sender: string;
|
|
211
|
-
receiver: string;
|
|
212
|
-
amount: string;
|
|
213
|
-
instrumentAdmin: string;
|
|
214
|
-
instrumentId: string;
|
|
215
|
-
executor: string;
|
|
216
|
-
/** Decimal-string of the Value.timestamp varint (µs since epoch), or
|
|
217
|
-
* undefined if not present as a timestamp leaf. */
|
|
218
|
-
allocateBefore?: string;
|
|
219
|
-
settleBefore?: string;
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Extract the allocation's money/escrow-critical leaves from the
|
|
223
|
-
* `AllocationFactory_Allocate` choice argument, BY TYPE at each Daml
|
|
224
|
-
* DECLARATION-ORDER POSITION (what the participant binds), NOT by label — with
|
|
225
|
-
* the same label/position-divergence guard the cip56/v1 arms use. Fails closed
|
|
226
|
-
* on any wrong-type / missing money-critical field.
|
|
227
|
-
*/
|
|
228
|
-
export declare function extractAllocation(chosenValue: Uint8Array): ExtractedAllocation;
|
|
229
|
-
/** Caller-intent expectation for an `AllocationFactory_Allocate`. Every field is
|
|
230
|
-
* CALLER INTENT — none is taken from the relay's resolve response. */
|
|
231
|
-
export interface PreparedAllocationExpectation {
|
|
232
|
-
/** The agent's own party — must be the transferLeg.sender. */
|
|
233
|
-
sender: string;
|
|
234
|
-
/**
|
|
235
|
-
* OWN-PARTY PIN (hardening). The agent's OWN party id, known independently of
|
|
236
|
-
* the relay (the wallet's party). The `AllocationFactory_Allocate` controller
|
|
237
|
-
* IS the sender, so the extracted `transferLeg.sender` MUST equal this value.
|
|
238
|
-
*
|
|
239
|
-
* This is asserted FIRST — before the positional `sender` pin and the foreign-
|
|
240
|
-
* party backstop — and is the load-bearing defense against a sender/receiver
|
|
241
|
-
* TRANSPOSITION: `transferLeg.sender` and `transferLeg.receiver` are BOTH Party
|
|
242
|
-
* leaves at ADJACENT declaration-order positions (field order CONFIRMED against
|
|
243
|
-
* canonical Splice source — see the field-order authority note above
|
|
244
|
-
* `extractAllocation`). If a malicious relay transposes those two leaves, it
|
|
245
|
-
* could otherwise present the agent as
|
|
246
|
-
* the RECEIVER while a position-pin alone might still line up. Pinning the
|
|
247
|
-
* extracted sender to the agent's own party fails CLOSED on ANY such transposition
|
|
248
|
-
* or wrong-position sender, REGARDLESS of field order — defense-in-depth, without
|
|
249
|
-
* needing the live vector. REQUIRED: callers thread `wallet.party` here.
|
|
250
|
-
*/
|
|
251
|
-
expectedSender: string;
|
|
252
|
-
/** The intended recipient (merchant payTo from the 402). */
|
|
253
|
-
receiver: string;
|
|
254
|
-
/** The EXACT amount string the agent asked to pay. */
|
|
255
|
-
amount: string;
|
|
256
|
-
/** The instrument id the agent expects (e.g. "Amulet"). Caller intent. */
|
|
257
|
-
instrumentId: string;
|
|
258
|
-
/** The facilitator party that MUST be settlement.executor (= extra.feePayer).
|
|
259
|
-
* Pinned by exact equality, fail-closed. This is the trust anchor: only the
|
|
260
|
-
* executor (+ baked-in sender/receiver auth) can later move the locked funds,
|
|
261
|
-
* so a relay naming an ATTACKER executor must be refused. */
|
|
262
|
-
executor: string;
|
|
263
|
-
/** Optional, independently-trusted instrument admin (DSO) to pin AND exclude
|
|
264
|
-
* from the foreign-party backstop outside its root position. */
|
|
265
|
-
instrumentAdmin?: string;
|
|
266
|
-
/** Optional, caller-intent synchronizer id. Pins SIGNED Metadata.synchronizer_id. */
|
|
267
|
-
synchronizerId?: string;
|
|
268
|
-
/** Optional, caller-intent template `module:entity` of the AllocationFactory. */
|
|
269
|
-
templateQualifiedName?: string;
|
|
270
|
-
/** Optional, caller-intent contract id of the AllocationFactory the exercise
|
|
271
|
-
* targets. Pins Exercise.contract_id (resolve→prepare TOCTOU). */
|
|
272
|
-
expectedContractId?: string;
|
|
273
|
-
/** Inject Date.now() for testability of the timing sanity checks. */
|
|
274
|
-
nowMs?: number;
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Assert the relay-returned `preparedTransaction` encodes EXACTLY the
|
|
278
|
-
* `AllocationFactory_Allocate` the agent intended. Throws
|
|
279
|
-
* `PreparedTransferMismatchError` on any mismatch and `PreparedDecodeError` if
|
|
280
|
-
* the bytes are not a decodable PreparedTransaction carrying a single allocate
|
|
281
|
-
* exercise. Call BEFORE signing the hash. Fail-closed: anything not positively
|
|
282
|
-
* proven to match the intent throws.
|
|
283
|
-
*/
|
|
284
|
-
export declare function assertPreparedAllocationMatches(preparedTransactionB64: string, expect: PreparedAllocationExpectation): void;
|
|
285
|
-
/** Caller-intent expectation for an `Allocation_Withdraw` (reclaim) prepare. */
|
|
286
|
-
export interface PreparedAllocationWithdrawExpectation {
|
|
287
|
-
/** The agent's own party — must be the authoritative submitter (act_as) AND
|
|
288
|
-
* the choice's sole controller (allocation.transferLeg.sender). The ONLY
|
|
289
|
-
* party permitted anywhere in the signed transaction. */
|
|
290
|
-
selfParty: string;
|
|
291
|
-
/** Caller intent: the AmuletAllocation cid being reclaimed. The root
|
|
292
|
-
* exercise's `Exercise.contract_id` MUST equal this — REQUIRED (not optional
|
|
293
|
-
* as in the pay arms), so the relay cannot point the withdraw at a different
|
|
294
|
-
* contract than the one the caller resolved (resolve→prepare TOCTOU). */
|
|
295
|
-
allocationCid: string;
|
|
296
|
-
/** Inject Date.now() for testability of the timing sanity checks. */
|
|
297
|
-
nowMs?: number;
|
|
298
|
-
/** CALLER-INTENT reference parties that legitimately appear in a lock-expiry
|
|
299
|
-
* withdraw but are NOT the sender: the allocation's executor / lock holder
|
|
300
|
-
* (the facilitator) and the instrument admin (DSO). When the choice-context
|
|
301
|
-
* carries `expire-lock`, the unlock + disclosed AmuletRules/round reference
|
|
302
|
-
* these two parties, so they must be permitted — but ONLY as caller-pinned
|
|
303
|
-
* values (never relay-derived), so a relay cannot smuggle a foreign recipient
|
|
304
|
-
* by aliasing it to one of these. Omit on the empty-context (no-lock) path. */
|
|
305
|
-
facilitator?: string;
|
|
306
|
-
instrumentAdmin?: string;
|
|
307
|
-
/** CALLER-INTENT allocation RECEIVER (the merchant). In a "Design B" DIRECT
|
|
308
|
-
* allocation the receiver is the MERCHANT (not the facilitator, as in the
|
|
309
|
-
* "Design A" escrow where receiver == executor == facilitator), so the
|
|
310
|
-
* legitimate on-ledger `Allocation_Withdraw` expire-lock choice-context
|
|
311
|
-
* references the merchant party. When supplied, EXACTLY this one party is
|
|
312
|
-
* added to the allowed-party set for the withdraw backstop (alongside
|
|
313
|
-
* self/facilitator/instrumentAdmin) — never a wildcard. It MUST be pinned to
|
|
314
|
-
* the allocation's known receiver by the caller (`reclaimAllocation`), never
|
|
315
|
-
* taken from the relay, so a relay cannot smuggle a foreign recipient by
|
|
316
|
-
* aliasing it to this value. Omit for Design A (receiver == facilitator) /
|
|
317
|
-
* the empty-context (no-lock) path — behavior is then exactly as before. */
|
|
318
|
-
receiver?: string;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Assert the relay-returned `preparedTransaction` for the reclaim path encodes
|
|
322
|
-
* EXACTLY a single `Allocation_Withdraw` exercise, on the caller's own
|
|
323
|
-
* allocation cid, submitted by the agent — and is NOT a different (value-moving)
|
|
324
|
-
* choice, a withdraw of a different contract, an outbound drain, or a
|
|
325
|
-
* foreign-party submission. Throws `PreparedTransferMismatchError` on any
|
|
326
|
-
* mismatch and `PreparedDecodeError` if the bytes are not a decodable
|
|
327
|
-
* PreparedTransaction. Call BEFORE signing the hash. Fail-closed: anything not
|
|
328
|
-
* positively proven to be a self-withdraw of the caller's own allocation throws.
|
|
329
|
-
*/
|
|
330
|
-
export declare function assertPreparedAllocationWithdrawMatches(preparedTransactionB64: string, expect: PreparedAllocationWithdrawExpectation): void;
|
|
331
|
-
/** Caller-intent expectation for a `SenderConsent` / `MerchantConsent` create. */
|
|
332
|
-
export interface PreparedConsentCreateExpectation {
|
|
333
|
-
/** The agent's own party — the SIGNING party (sole signatory + sole submitter).
|
|
334
|
-
* The created consent's [0] self-party (sender for SenderConsent, merchant for
|
|
335
|
-
* MerchantConsent) MUST equal this; it is also the ONLY non-facilitator party
|
|
336
|
-
* allowed anywhere. */
|
|
337
|
-
selfParty: string;
|
|
338
|
-
/** Caller intent: the facilitator party the consent names (its [1] field +
|
|
339
|
-
* observer). A relay-substituted facilitator could later mint a both-party
|
|
340
|
-
* consent and settle the agent's allocations, so it is pinned by exact equality
|
|
341
|
-
* and is the only OTHER allowed party. REQUIRED. */
|
|
342
|
-
facilitator: string;
|
|
343
|
-
/** Which standing consent this is — selects the created-template qualified-name
|
|
344
|
-
* pin and the [0] self-party field label ("sender" | "merchant"). */
|
|
345
|
-
consent: "sender" | "merchant";
|
|
346
|
-
/** Optional caller-intent synchronizer id. Pins SIGNED Metadata.synchronizer_id. */
|
|
347
|
-
synchronizerId?: string;
|
|
348
|
-
/** Inject Date.now() for testability of the timing sanity checks. */
|
|
349
|
-
nowMs?: number;
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* Assert the relay-returned `preparedTransaction` for the x402-direct consent-create
|
|
353
|
-
* path encodes EXACTLY a single `SenderConsent` / `MerchantConsent` create, signed
|
|
354
|
-
* by the agent, naming {selfParty, facilitator} — and is NOT a value-moving choice,
|
|
355
|
-
* a second leg, a relay-substituted facilitator, or a foreign-party submission.
|
|
356
|
-
* Throws `PreparedTransferMismatchError` on any mismatch and `PreparedDecodeError`
|
|
357
|
-
* if the bytes are not a decodable PreparedTransaction. Call BEFORE signing. Fail-
|
|
358
|
-
* closed: anything not positively proven to be a self-submitted consent create among
|
|
359
|
-
* exactly {selfParty, facilitator} throws.
|
|
360
|
-
*/
|
|
361
|
-
export declare function assertPreparedConsentCreateMatches(preparedTransactionB64: string, expect: PreparedConsentCreateExpectation): void;
|
|
362
209
|
/**
|
|
363
210
|
* How to bind the relay-returned `hash` to the `preparedTransaction` bytes the
|
|
364
211
|
* agent just structurally validated. Exactly one of these must hold for a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-prepared.d.ts","sourceRoot":"","sources":["../src/verify-prepared.ts"],"names":[],"mappings":"AAi1BA,UAAU,eAAe;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,UAAU,CAAC;IACxB;;;;kEAI8D;IAC9D,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC;;;;qDAIiD;IACjD,qBAAqB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5C;AAED;iFACiF;AACjF,KAAK,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,cAAc,CAAC;AAE9E;;;;;;;GAOG;AACH,UAAU,WAAW;IACnB,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf;;;qCAGiC;IACjC,iBAAiB,EAAE,OAAO,CAAC;IAC3B;0EACsE;IACtE,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IACvC;;;;;qDAKiD;IACjD,MAAM,CAAC,EACH;QAAE,qBA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