@ftptech/canton-agent-wallet 0.5.1 → 0.6.1

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/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, assertPreparedAllocationMatches, assertPreparedAllocationWithdrawMatches, assertPreparedConsentCreateMatches, } from "./verify-prepared.js";
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/allocation/accept/withdraw/
92
- // consent-create), so there is no branch that reaches signHashB64 ungated.
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. allocation-direct /
286
- * allocation-api have NO nonce, so concurrent pays from one wallet are allowed —
287
- * BUT two concurrent allocates must not pick the SAME Amulet holding: the first
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 allocates disjoint we pick the SMALLEST single
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 allocate then skips it and picks the next
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. (The
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
@@ -380,225 +333,12 @@ export function isStaleInputHoldingError(err) {
380
333
  for (let depth = 0; cur && depth < 6; depth++) {
381
334
  const e = cur;
382
335
  const hay = `${typeof e.message === "string" ? e.message : ""} ${typeof e.detail === "string" ? e.detail : ""}`;
383
- if (/UNKNOWN_CONTRACT_SYNCHRONIZERS|have been archived|CONTRACT_NOT_FOUND|Contract could not be found/i.test(hay))
336
+ if (/UNKNOWN_CONTRACT_SYNCHRONIZERS|have been archived|CONTRACT_NOT_FOUND|Contract could not be found|INACTIVE_CONTRACTS|inactive contract/i.test(hay))
384
337
  return true;
385
338
  cur = e.cause;
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.
@@ -708,30 +387,56 @@ export async function reclaimAllocation(relay, wallet, opts) {
708
387
  * is refused unless it is exactly a single-root self-preapproval (see
709
388
  * assertPreparedSelfPreapproval).
710
389
  */
711
- export async function selfProvisionPreapproval(relay, wallet, opts) {
712
- const prep = await relay.preapprovalSelfPrepare(wallet.party, opts?.expiresAt);
713
- // Never sign a relay tx that does anything other than create OUR preapproval.
714
- assertPreparedSelfPreapproval(prep.preparedTransaction, wallet.party);
715
- const signature = signHashB64(prep.txHash, wallet.privateKeyPkcs8Pem);
716
- return relay.preapprovalSelfCommit({
717
- party: wallet.party,
718
- preparedTransaction: prep.preparedTransaction,
719
- hashingSchemeVersion: "HASHING_SCHEME_VERSION_V2",
720
- partySignatures: {
721
- signatures: [
722
- {
723
- party: wallet.party,
724
- signatures: [
725
- {
726
- format: "SIGNATURE_FORMAT_CONCAT",
727
- signature,
728
- signingAlgorithmSpec: "SIGNING_ALGORITHM_SPEC_ED25519",
729
- signedBy: wallet.publicKeyFingerprint,
730
- },
731
- ],
732
- },
733
- ],
734
- },
735
- });
390
+ /** Backoff for the self-provision stale-input retry (same shape as the pay
391
+ * path's withStaleInputRetry). Bounded — bubbles up after the last attempt. */
392
+ const SELF_PREAPPROVAL_STALE_BACKOFF_MS = [1000, 2000, 4000, 8000, 12000];
393
+ export async function selfProvisionPreapproval(relay, wallet, opts, sleep = (ms) => new Promise((r) => setTimeout(r, ms))) {
394
+ // ONE attempt: relay builds the CreateTransferPreapproval over the merchant's
395
+ // CURRENT fee-input Amulet cids (prepare), the merchant signs, the relay
396
+ // executes (commit).
397
+ const attempt = async () => {
398
+ const prep = await relay.preapprovalSelfPrepare(wallet.party, opts?.expiresAt);
399
+ // Never sign a relay tx that does anything other than create OUR preapproval.
400
+ assertPreparedSelfPreapproval(prep.preparedTransaction, wallet.party);
401
+ const signature = signHashB64(prep.txHash, wallet.privateKeyPkcs8Pem);
402
+ return relay.preapprovalSelfCommit({
403
+ party: wallet.party,
404
+ preparedTransaction: prep.preparedTransaction,
405
+ hashingSchemeVersion: "HASHING_SCHEME_VERSION_V2",
406
+ partySignatures: {
407
+ signatures: [
408
+ {
409
+ party: wallet.party,
410
+ signatures: [
411
+ {
412
+ format: "SIGNATURE_FORMAT_CONCAT",
413
+ signature,
414
+ signingAlgorithmSpec: "SIGNING_ALGORITHM_SPEC_ED25519",
415
+ signedBy: wallet.publicKeyFingerprint,
416
+ },
417
+ ],
418
+ },
419
+ ],
420
+ },
421
+ });
422
+ };
423
+ // Re-prepare + re-sign + re-commit on a stale-input rejection: the relay pins
424
+ // the fee-input Amulet cids at PREPARE time, and a mining-round roll (or a
425
+ // concurrent claim) in the prepare→commit window archives them, giving
426
+ // LOCAL_VERDICT_INACTIVE_CONTRACTS at execute. Each retry re-reads fresh
427
+ // holdings. Mirrors the pay path's withStaleInputRetry.
428
+ for (let i = 0;; i++) {
429
+ try {
430
+ return await attempt();
431
+ }
432
+ catch (err) {
433
+ if (i < SELF_PREAPPROVAL_STALE_BACKOFF_MS.length &&
434
+ isStaleInputHoldingError(err)) {
435
+ await sleep(SELF_PREAPPROVAL_STALE_BACKOFF_MS[i]);
436
+ continue;
437
+ }
438
+ throw err;
439
+ }
440
+ }
736
441
  }
737
442
  //# sourceMappingURL=tx.js.map
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;;;;;;sGAMsG;AACtG,MAAM,sCAAsC,GAAG,uCAAuC,CAAC;AACvF,MAAM,wCAAwC,GA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