@ftptech/canton-agent-wallet 0.1.20 → 0.2.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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pay.d.ts.map +1 -1
- package/dist/pay.js +10 -10
- package/dist/pay.js.map +1 -1
- package/dist/relay-client.d.ts +0 -54
- package/dist/relay-client.d.ts.map +1 -1
- package/dist/relay-client.js +0 -25
- package/dist/relay-client.js.map +1 -1
- package/dist/relay-signer.d.ts +11 -15
- package/dist/relay-signer.d.ts.map +1 -1
- package/dist/relay-signer.js +1 -64
- package/dist/relay-signer.js.map +1 -1
- package/dist/tx.d.ts +0 -129
- package/dist/tx.d.ts.map +1 -1
- package/dist/tx.js +3 -242
- package/dist/tx.js.map +1 -1
- package/dist/verify-prepared.d.ts +0 -130
- package/dist/verify-prepared.d.ts.map +1 -1
- package/dist/verify-prepared.js +0 -488
- package/dist/verify-prepared.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -10,5 +10,5 @@ export * from "./pay.js";
|
|
|
10
10
|
export * from "./hash-binding.js";
|
|
11
11
|
export * from "./canton-hash.js";
|
|
12
12
|
export * from "./trusted-dso.js";
|
|
13
|
-
export { assertPreparedTransferMatches,
|
|
13
|
+
export { assertPreparedTransferMatches, assertPreparedConsentCreateMatches, assertHashBinding, assertOnboardingTopologyBindsKey, decodePrepared, extractTransfer, PreparedDecodeError, PreparedTransferMismatchError, PreparedHashUnavailableError, OnboardingTopologyMismatchError, type HashBindingOptions, type PreparedTransferExpectation, type PreparedConsentCreateExpectation, type OnboardingTopologyExpectation, } from "./verify-prepared.js";
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACL,6BAA6B,EAC7B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,EAClC,iBAAiB,EACjB,gCAAgC,EAChC,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,6BAA6B,EAC7B,4BAA4B,EAC5B,+BAA+B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,GACnC,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,5 +10,5 @@ export * from "./pay.js";
|
|
|
10
10
|
export * from "./hash-binding.js";
|
|
11
11
|
export * from "./canton-hash.js";
|
|
12
12
|
export * from "./trusted-dso.js";
|
|
13
|
-
export { assertPreparedTransferMatches,
|
|
13
|
+
export { assertPreparedTransferMatches, assertPreparedConsentCreateMatches, assertHashBinding, assertOnboardingTopologyBindsKey, decodePrepared, extractTransfer, PreparedDecodeError, PreparedTransferMismatchError, PreparedHashUnavailableError, OnboardingTopologyMismatchError, } from "./verify-prepared.js";
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACL,6BAA6B,EAC7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,EAClC,iBAAiB,EACjB,gCAAgC,EAChC,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,6BAA6B,EAC7B,4BAA4B,EAC5B,+BAA+B,GAKhC,MAAM,sBAAsB,CAAC"}
|
package/dist/pay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pay.d.ts","sourceRoot":"","sources":["../src/pay.ts"],"names":[],"mappings":"AAWA,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGnE,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,WAAW,OAAQ,SAAQ,gBAAgB;IAC/C,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;wCAGoC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;yEAKqE;IACrE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;8CAG0C;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,OAAO,UAAU,CAAC,KAAK,CAAC,CAMlC;AAED;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,IAAI,CACR,OAAO,EACP,QAAQ,GAAG,aAAa,GAAG,mBAAmB,GAAG,iBAAiB,GAAG,eAAe,CACrF,EACD,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,UAAU,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"pay.d.ts","sourceRoot":"","sources":["../src/pay.ts"],"names":[],"mappings":"AAWA,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGnE,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,WAAW,OAAQ,SAAQ,gBAAgB;IAC/C,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;wCAGoC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;yEAKqE;IACrE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;8CAG0C;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,OAAO,UAAU,CAAC,KAAK,CAAC,CAMlC;AAED;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,IAAI,CACR,OAAO,EACP,QAAQ,GAAG,aAAa,GAAG,mBAAmB,GAAG,iBAAiB,GAAG,eAAe,CACrF,EACD,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,UAAU,CAAC,KAAK,CAAC,CA0ClC"}
|
package/dist/pay.js
CHANGED
|
@@ -44,15 +44,13 @@ export async function makePayingFetchForWallet(wallet, opts, lockHome) {
|
|
|
44
44
|
// ephemeral wallet has no same-wallet concurrency and no home dir, so it always
|
|
45
45
|
// skips the lock.
|
|
46
46
|
//
|
|
47
|
-
// METHOD-AWARE: the
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
// for v1; `undefined` ("can't tell" — non-402-shaped/unparseable challenge)
|
|
55
|
-
// falls through to serialize so v1 never loses its protection by accident.
|
|
47
|
+
// METHOD-AWARE: the no-nonce allocation-direct path has no same-wallet
|
|
48
|
+
// serialization constraint — concurrent allocates are kept collision-free by
|
|
49
|
+
// disjoint holding reservation (tx.ts::allocate), so serializing them only
|
|
50
|
+
// throttles throughput. We therefore peek the method the pay will actually use
|
|
51
|
+
// and SKIP the lock for a recognized (allocation-direct) method; `undefined`
|
|
52
|
+
// ("can't tell" — a non-402-shaped/unparseable challenge) falls through to
|
|
53
|
+
// serialize as a fail-safe.
|
|
56
54
|
return async function payingFetch(input, init) {
|
|
57
55
|
const probe = await globalThis.fetch(input, init);
|
|
58
56
|
if (probe.status !== 402)
|
|
@@ -60,7 +58,9 @@ export async function makePayingFetchForWallet(wallet, opts, lockHome) {
|
|
|
60
58
|
if (lockHome === undefined)
|
|
61
59
|
return paying(input, init);
|
|
62
60
|
const method = peekChosenTransferMethod(probe, signer);
|
|
63
|
-
|
|
61
|
+
// Only serialize when we cannot determine the method (fail-safe). A
|
|
62
|
+
// recognized no-nonce method (allocation-direct) skips the lock.
|
|
63
|
+
const needsSerialization = method === undefined;
|
|
64
64
|
if (!needsSerialization)
|
|
65
65
|
return paying(input, init);
|
|
66
66
|
return withPayLock(lockHome, () => paying(input, init));
|
package/dist/pay.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pay.js","sourceRoot":"","sources":["../src/pay.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,YAAY,EAAyB,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAoB,MAAM,YAAY,CAAC;AAiCzD,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,IAAa;IAEb,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IACxC,6EAA6E;IAC7E,6EAA6E;IAC7E,6CAA6C;IAC7C,OAAO,wBAAwB,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAAmB,EACnB,IAGC,EACD,QAAiB;IA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MAAM,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAClD,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG;YAAE,OAAO,KAAK,CAAC;QACvC,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,wBAAwB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACvD,oEAAoE;QACpE,iEAAiE;QACjE,MAAM,kBAAkB,GAAG,MAAM,KAAK,SAAS,CAAC;QAChD,IAAI,CAAC,kBAAkB;YAAE,OAAO,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACpD,OAAO,WAAW,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAC1D,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/relay-client.d.ts
CHANGED
|
@@ -61,33 +61,6 @@ export interface PendingResult {
|
|
|
61
61
|
sender?: string;
|
|
62
62
|
}>;
|
|
63
63
|
}
|
|
64
|
-
/** v1 (external-party-amulet-rules): everything the agent needs to BUILD an
|
|
65
|
-
* `ExternalPartyAmuletRules_CreateTransferCommand` exercise. The agent pins
|
|
66
|
-
* sender/receiver/amount/delegate to its OWN intent in verify-before-sign —
|
|
67
|
-
* these refs widen nothing it will sign. */
|
|
68
|
-
export interface ResolveTransferCommandResult {
|
|
69
|
-
externalPartyAmuletRules: {
|
|
70
|
-
contractId: string;
|
|
71
|
-
/** EPAR's OWN resolved templateId (matches createdEventBlob's package). */
|
|
72
|
-
templateId: string;
|
|
73
|
-
createdEventBlob: string;
|
|
74
|
-
};
|
|
75
|
-
/** Resolved templateId for the CreateTransferCommand EXERCISE target. */
|
|
76
|
-
exerciseTemplateId: string;
|
|
77
|
-
/** The facilitator/delegate party (relay-supplied; the agent ALSO pins this
|
|
78
|
-
* to the 402's extra.facilitatorParty before signing). */
|
|
79
|
-
delegate: string;
|
|
80
|
-
/** Authoritative DSO party for the command's expectedDso field. */
|
|
81
|
-
expectedDso: string;
|
|
82
|
-
synchronizerId: string;
|
|
83
|
-
/** The agent's next-expected nonce (Daml Int as a string). */
|
|
84
|
-
nextNonce: string;
|
|
85
|
-
}
|
|
86
|
-
export interface TransferCommandCidResult {
|
|
87
|
-
party: string;
|
|
88
|
-
nonce: string;
|
|
89
|
-
transferCommandCid: string;
|
|
90
|
-
}
|
|
91
64
|
/** allocation-api: everything the agent needs to BUILD an
|
|
92
65
|
* `AllocationFactory_Allocate` exercise. None of these is a verify trust
|
|
93
66
|
* anchor — the agent pins sender/receiver/amount/executor to its OWN intent in
|
|
@@ -120,14 +93,6 @@ export interface AllocationResultResult {
|
|
|
120
93
|
allocationCid?: string | null;
|
|
121
94
|
allocationInstructionCid?: string | null;
|
|
122
95
|
}
|
|
123
|
-
/** The created `X402Escrow` cid read off the `X402EscrowOffer_Accept` transaction
|
|
124
|
-
* by the relay (x402-escrow "Design A"). `escrowCid` is null if the relay could
|
|
125
|
-
* not resolve the created `X402Escrow` within its poll budget. */
|
|
126
|
-
export interface EscrowResultResult {
|
|
127
|
-
party: string;
|
|
128
|
-
updateId: string;
|
|
129
|
-
escrowCid?: string | null;
|
|
130
|
-
}
|
|
131
96
|
/** x402-direct "Design B": the result of resolving/minting the standing both-party
|
|
132
97
|
* DirectSettlementConsent for a {sender, merchant} pair (facilitator-side
|
|
133
98
|
* MerchantConsent_Accept). `minted` is false when an existing consent was reused. */
|
|
@@ -197,10 +162,6 @@ export declare class RelayClient {
|
|
|
197
162
|
resolveWithdraw(b: {
|
|
198
163
|
allocationCid: string;
|
|
199
164
|
}): Promise<ResolveWithdrawResult>;
|
|
200
|
-
/** v1: resolve the refs needed to build a CreateTransferCommand exercise. */
|
|
201
|
-
resolveTransferCommand(b: {
|
|
202
|
-
payerParty: string;
|
|
203
|
-
}): Promise<ResolveTransferCommandResult>;
|
|
204
165
|
/** allocation-api: resolve the AllocationFactory + its disclosed contracts +
|
|
205
166
|
* choice-context (the agent has no Scan access). Mirrors
|
|
206
167
|
* resolveTransferFactory. */
|
|
@@ -216,13 +177,6 @@ export declare class RelayClient {
|
|
|
216
177
|
/** allocation-api: read the created Allocation / AllocationInstruction cid off
|
|
217
178
|
* the AllocationFactory_Allocate transaction (the agent is relay-only). */
|
|
218
179
|
allocationResult(party: string, updateId: string): Promise<AllocationResultResult>;
|
|
219
|
-
/** x402-escrow "Design A": read the created `X402Escrow` cid off the
|
|
220
|
-
* `X402EscrowOffer_Accept` transaction (the agent is relay-only). Mirrors
|
|
221
|
-
* `allocationResult`: the relay reads the tx by updateId and matches the created
|
|
222
|
-
* `X402Escrow` template. Requires a matching facilitator-side `escrow-result`
|
|
223
|
-
* endpoint (a `getTransactionById` + templateId-endsWith match, exactly like
|
|
224
|
-
* `allocation-result`). */
|
|
225
|
-
escrowResult(party: string, updateId: string): Promise<EscrowResultResult>;
|
|
226
180
|
/** x402-direct "Design B": resolve OR mint the standing both-party
|
|
227
181
|
* DirectSettlementConsent for the {sender, merchant} pair (the facilitator
|
|
228
182
|
* exercises MerchantConsent_Accept ALONE off the two standing consents). The
|
|
@@ -235,13 +189,5 @@ export declare class RelayClient {
|
|
|
235
189
|
merchant: string;
|
|
236
190
|
maxAmount?: string | null;
|
|
237
191
|
}): Promise<MintDirectConsentResult>;
|
|
238
|
-
/** v1: resolve the cid of the just-created TransferCommand via the relay.
|
|
239
|
-
* Pass the create's `updateId` (from execute) so the relay reads the cid
|
|
240
|
-
* straight off that transaction — O(1) and immune to the ACS list cap the
|
|
241
|
-
* legacy (sender, nonce) poll hits once a payer accumulates many unspent
|
|
242
|
-
* commands. The nonce stays as the relay's fallback matcher. Returns 404
|
|
243
|
-
* if nothing is found within the relay's poll budget (surfaced here as a
|
|
244
|
-
* thrown relay error). */
|
|
245
|
-
transferCommandCid(party: string, nonce: string, updateId?: string): Promise<TransferCommandCidResult>;
|
|
246
192
|
}
|
|
247
193
|
//# sourceMappingURL=relay-client.d.ts.map
|
|
@@ -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,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB,EAAE,MAAM,CAAC;IAC7B,sBAAsB,EAAE,MAAM,EAAE,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB;AACD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AACD,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,yBAAyB,EAAE,MAAM,CAAC;IAClC,YAAY,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,EAAE,CAAC;CAC/B;AACD,MAAM,WAAW,mBAAmB;IAClC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,EAAE,CAAC;CAC/B;AACD;;;mFAGmF;AACnF,MAAM,WA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AE,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;;;;;;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
|
@@ -74,10 +74,6 @@ export class RelayClient {
|
|
|
74
74
|
resolveWithdraw(b) {
|
|
75
75
|
return this.req("POST", "/v1/wallet/resolve/withdraw", b);
|
|
76
76
|
}
|
|
77
|
-
/** v1: resolve the refs needed to build a CreateTransferCommand exercise. */
|
|
78
|
-
resolveTransferCommand(b) {
|
|
79
|
-
return this.req("POST", "/v1/wallet/resolve/transfer-command", b);
|
|
80
|
-
}
|
|
81
77
|
/** allocation-api: resolve the AllocationFactory + its disclosed contracts +
|
|
82
78
|
* choice-context (the agent has no Scan access). Mirrors
|
|
83
79
|
* resolveTransferFactory. */
|
|
@@ -89,15 +85,6 @@ export class RelayClient {
|
|
|
89
85
|
allocationResult(party, updateId) {
|
|
90
86
|
return this.req("GET", `/v1/wallet/${encodeURIComponent(party)}/allocation-result?updateId=${encodeURIComponent(updateId)}`);
|
|
91
87
|
}
|
|
92
|
-
/** x402-escrow "Design A": read the created `X402Escrow` cid off the
|
|
93
|
-
* `X402EscrowOffer_Accept` transaction (the agent is relay-only). Mirrors
|
|
94
|
-
* `allocationResult`: the relay reads the tx by updateId and matches the created
|
|
95
|
-
* `X402Escrow` template. Requires a matching facilitator-side `escrow-result`
|
|
96
|
-
* endpoint (a `getTransactionById` + templateId-endsWith match, exactly like
|
|
97
|
-
* `allocation-result`). */
|
|
98
|
-
escrowResult(party, updateId) {
|
|
99
|
-
return this.req("GET", `/v1/wallet/${encodeURIComponent(party)}/escrow-result?updateId=${encodeURIComponent(updateId)}`);
|
|
100
|
-
}
|
|
101
88
|
/** x402-direct "Design B": resolve OR mint the standing both-party
|
|
102
89
|
* DirectSettlementConsent for the {sender, merchant} pair (the facilitator
|
|
103
90
|
* exercises MerchantConsent_Accept ALONE off the two standing consents). The
|
|
@@ -108,17 +95,5 @@ export class RelayClient {
|
|
|
108
95
|
mintDirectConsent(b) {
|
|
109
96
|
return this.req("POST", "/v1/wallet/direct/mint", b);
|
|
110
97
|
}
|
|
111
|
-
/** v1: resolve the cid of the just-created TransferCommand via the relay.
|
|
112
|
-
* Pass the create's `updateId` (from execute) so the relay reads the cid
|
|
113
|
-
* straight off that transaction — O(1) and immune to the ACS list cap the
|
|
114
|
-
* legacy (sender, nonce) poll hits once a payer accumulates many unspent
|
|
115
|
-
* commands. The nonce stays as the relay's fallback matcher. Returns 404
|
|
116
|
-
* if nothing is found within the relay's poll budget (surfaced here as a
|
|
117
|
-
* thrown relay error). */
|
|
118
|
-
transferCommandCid(party, nonce, updateId) {
|
|
119
|
-
const q = `nonce=${encodeURIComponent(nonce)}` +
|
|
120
|
-
(updateId ? `&updateId=${encodeURIComponent(updateId)}` : "");
|
|
121
|
-
return this.req("GET", `/v1/wallet/${encodeURIComponent(party)}/transfer-command?${q}`);
|
|
122
|
-
}
|
|
123
98
|
}
|
|
124
99
|
//# sourceMappingURL=relay-client.js.map
|
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":"AA2FA,MAAM,OAAO,WAAW;IAEH;IADnB,YACmB,IAAuD;QAAvD,SAAI,GAAJ,IAAI,CAAmD;IACvE,CAAC;IAEI,OAAO;QACb,MAAM,CAAC,GAA2B,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC;QACzE,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,CAAC,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QAC1D,OAAO,CAAC,CAAC;IACX,CAAC;IAEO,KAAK,CAAC,GAAG,CAAI,MAAc,EAAE,IAAY,EAAE,IAAc;QAC/D,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC;QACzD,MAAM,CAAC,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YACzB,MAAM;YACN,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;YACvB,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9D,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,IAAa,CAAC;QAClB,IAAI,CAAC;YACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,qBAAqB;QACvB,CAAC;QACD,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,SAAS,MAAM,IAAI,IAAI,OAAO,CAAC,CAAC,MAAM,IAAI,IA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OAAO,IAAI,CAAC,GAAG,CAAsB,MAAM,EAAE,2BAA2B,EAAE,CAAC,CAAC,CAAC;IAC/E,CAAC;IACD;;0CAEsC;IACtC,eAAe,CAAC,CAA4B;QAC1C,OAAO,IAAI,CAAC,GAAG,CACb,MAAM,EACN,6BAA6B,EAC7B,CAAC,CACF,CAAC;IACJ,CAAC;IACD;;kCAE8B;IAC9B,wBAAwB,CAAC,CAQxB;QACC,OAAO,IAAI,CAAC,GAAG,CACb,MAAM,EACN,uCAAuC,EACvC,CAAC,CACF,CAAC;IACJ,CAAC;IACD;gFAC4E;IAC5E,gBAAgB,CAAC,KAAa,EAAE,QAAgB;QAC9C,OAAO,IAAI,CAAC,GAAG,CACb,KAAK,EACL,cAAc,kBAAkB,CAAC,KAAK,CAAC,+BAA+B,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CACrG,CAAC;IACJ,CAAC;IACD;;;;;;sFAMkF;IAClF,iBAAiB,CAAC,CAIjB;QACC,OAAO,IAAI,CAAC,GAAG,CACb,MAAM,EACN,wBAAwB,EACxB,CAAC,CACF,CAAC;IACJ,CAAC;CACF"}
|
package/dist/relay-signer.d.ts
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* makeRelaySigner — a CantonSigner backed by the facilitator relay + the agent's
|
|
3
|
-
* self-custody key. It implements
|
|
4
|
-
* (`ExactCantonScheme`) can pick the right arm from the 402's advertised method:
|
|
3
|
+
* self-custody key. It implements the allocation-direct x402 transfer method:
|
|
5
4
|
*
|
|
6
|
-
* - `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* ExternalPartyAmuletRules_CreateTransferCommand, verify-before-sign, sign
|
|
12
|
-
* locally, execute, then read back the created TransferCommand cid.
|
|
5
|
+
* - `signAllocationDirect` (allocation-direct, CIP-56 DVP "2-tx DIRECT"):
|
|
6
|
+
* ensure the standing both-party DirectSettlementConsent, resolve the
|
|
7
|
+
* AllocationFactory (+ its disclosed contracts / choice context) via the
|
|
8
|
+
* relay, build AllocationFactory_Allocate, verify-before-sign, sign locally,
|
|
9
|
+
* execute.
|
|
13
10
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* the self-custody guarantee on each path.
|
|
11
|
+
* The x402 client (`ExactCantonScheme`) calls `signAllocationDirect` when the
|
|
12
|
+
* 402's `extra.transferMethod === "allocation-direct"` (see scheme.ts). The relay
|
|
13
|
+
* only prepares + forwards; it never holds the key, so it can never move the
|
|
14
|
+
* agent's funds, and verify-before-sign + hash-binding keep the self-custody
|
|
15
|
+
* guarantee.
|
|
20
16
|
*/
|
|
21
17
|
import type { CantonSigner } from "@ftptech/x402-canton-client";
|
|
22
18
|
import type { AgentWallet } from "./store.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-signer.d.ts","sourceRoot":"","sources":["../src/relay-signer.ts"],"names":[],"mappings":"AAAA
|
|
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;AAShE,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,CAiId"}
|
package/dist/relay-signer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RelayClient } from "./relay-client.js";
|
|
2
|
-
import {
|
|
2
|
+
import { allocate, createSenderConsent, isStaleInputHoldingError, } from "./tx.js";
|
|
3
3
|
import { resolveHashBinding } from "./hash-binding.js";
|
|
4
4
|
import { resolveTrustedDsoParty } from "./trusted-dso.js";
|
|
5
5
|
/** Bounded backoff (ms) for retrying an allocate the relay rejected because its
|
|
@@ -74,41 +74,6 @@ export function makeRelaySigner(wallet, opts = {}) {
|
|
|
74
74
|
};
|
|
75
75
|
return {
|
|
76
76
|
party: wallet.party,
|
|
77
|
-
async signCip56Transfer(input) {
|
|
78
|
-
enforceSpendLimits(input.receiver, input.amount);
|
|
79
|
-
const trustedDso = opts.trustedDso ?? resolveTrustedDsoParty(process.env, wallet.network);
|
|
80
|
-
const updateId = await transfer(relay, wallet, {
|
|
81
|
-
receiver: input.receiver,
|
|
82
|
-
amount: input.amount,
|
|
83
|
-
...(input.transferMeta ? { meta: input.transferMeta } : {}),
|
|
84
|
-
hashBinding,
|
|
85
|
-
...(trustedDso !== undefined ? { expectInstrumentAdmin: trustedDso } : {}),
|
|
86
|
-
});
|
|
87
|
-
return { payerParty: wallet.party, updateId, transferInstructionCid: null };
|
|
88
|
-
},
|
|
89
|
-
async signAllocation(input) {
|
|
90
|
-
// Spend breaker FIRST (fail-closed, before any relay call), exactly like
|
|
91
|
-
// the other arms.
|
|
92
|
-
enforceSpendLimits(input.receiver, input.amount);
|
|
93
|
-
const trustedDso = opts.trustedDso ?? resolveTrustedDsoParty(process.env, wallet.network);
|
|
94
|
-
const r = await withStaleInputRetry(() => allocate(relay, wallet, {
|
|
95
|
-
receiver: input.receiver,
|
|
96
|
-
amount: input.amount,
|
|
97
|
-
executor: input.executor,
|
|
98
|
-
synchronizerId: input.synchronizerId,
|
|
99
|
-
allocateBeforeSeconds: input.allocateBeforeSeconds,
|
|
100
|
-
settleBeforeSeconds: input.settleBeforeSeconds,
|
|
101
|
-
...(input.transferMeta ? { transferMeta: input.transferMeta } : {}),
|
|
102
|
-
hashBinding,
|
|
103
|
-
...(trustedDso !== undefined ? { expectInstrumentAdmin: trustedDso } : {}),
|
|
104
|
-
}));
|
|
105
|
-
return {
|
|
106
|
-
payerParty: r.payerParty,
|
|
107
|
-
allocationCid: r.allocationCid,
|
|
108
|
-
allocationInstructionCid: r.allocationInstructionCid,
|
|
109
|
-
updateId: r.updateId,
|
|
110
|
-
};
|
|
111
|
-
},
|
|
112
77
|
async signAllocationDirect(input) {
|
|
113
78
|
// Spend breaker FIRST (fail-closed, before any relay call), exactly like
|
|
114
79
|
// the other arms.
|
|
@@ -177,34 +142,6 @@ export function makeRelaySigner(wallet, opts = {}) {
|
|
|
177
142
|
directConsentCid,
|
|
178
143
|
};
|
|
179
144
|
},
|
|
180
|
-
async signTransferCommand(input) {
|
|
181
|
-
// Spend breaker FIRST — before even the balance pre-check, so a refused
|
|
182
|
-
// amount/payee never touches the relay (no network, no info leak).
|
|
183
|
-
enforceSpendLimits(input.receiver, input.amount);
|
|
184
|
-
// Fast-fail an underfunded wallet: without this, an unfunded agent's pay
|
|
185
|
-
// loops the client re-pay retries (each settle just rejects "no inputs")
|
|
186
|
-
// for ~30s and then returns an opaque "rejected" — surface a clear
|
|
187
|
-
// insufficient-funds error up front instead. The facilitator still
|
|
188
|
-
// re-validates everything; this is a UX guard, not a security check.
|
|
189
|
-
const bal = await relay.balance(wallet.party);
|
|
190
|
-
if (Number(bal.cc) < Number(input.amount)) {
|
|
191
|
-
throw new Error(`insufficient funds: wallet balance is ${bal.cc} CC but the payment ` +
|
|
192
|
-
`requires ${input.amount} CC — fund the wallet (its party id) and run claim`);
|
|
193
|
-
}
|
|
194
|
-
// Prefer the PAYMENT network from the 402; fall back to the wallet's.
|
|
195
|
-
const trustedDso = opts.trustedDso ??
|
|
196
|
-
resolveTrustedDsoParty(process.env, input.network ?? wallet.network);
|
|
197
|
-
return createTransferCommand(relay, wallet, {
|
|
198
|
-
receiver: input.receiver,
|
|
199
|
-
amount: input.amount,
|
|
200
|
-
delegate: input.delegate,
|
|
201
|
-
synchronizerId: input.synchronizerId,
|
|
202
|
-
description: input.description,
|
|
203
|
-
...(input.expiresAtMs !== undefined ? { expiresAtMs: input.expiresAtMs } : {}),
|
|
204
|
-
hashBinding,
|
|
205
|
-
...(trustedDso !== undefined ? { expectedDso: trustedDso } : {}),
|
|
206
|
-
});
|
|
207
|
-
},
|
|
208
145
|
};
|
|
209
146
|
}
|
|
210
147
|
//# sourceMappingURL=relay-signer.js.map
|
package/dist/relay-signer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-signer.js","sourceRoot":"","sources":["../src/relay-signer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"relay-signer.js","sourceRoot":"","sources":["../src/relay-signer.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAI1D;;;;;;;iCAOiC;AACjC,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,GAAqB,EACrB,QAAuC,CAAC,EAAE,EAAE,EAAE,CA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AAE,MAAM,EAAE;gBACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,cAAc,EAAE,KAAK,CAAC,cAAc;gBACpC,qBAAqB,EAAE,KAAK,CAAC,qBAAqB;gBAClD,mBAAmB,EAAE,KAAK,CAAC,mBAAmB;gBAC9C,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnE,WAAW;gBACX,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,qBAAqB,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC3E,CAAC,CACH,CAAC;YACF,OAAO;gBACL,UAAU,EAAE,CAAC,CAAC,UAAU;gBACxB,aAAa,EAAE,CAAC,CAAC,aAAa;gBAC9B,wBAAwB,EAAE,CAAC,CAAC,wBAAwB;gBACpD,QAAQ,EAAE,CAAC,CAAC,QAAQ;gBACpB,gBAAgB;aACjB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/tx.d.ts
CHANGED
|
@@ -30,55 +30,6 @@ export declare function transfer(relay: RelayClient, wallet: AgentWallet, opts:
|
|
|
30
30
|
*/
|
|
31
31
|
hashBinding?: HashBindingOptions;
|
|
32
32
|
}): Promise<string>;
|
|
33
|
-
/**
|
|
34
|
-
* v1 (external-party-amulet-rules) — create a Splice `TransferCommand` the
|
|
35
|
-
* facilitator will later settle (it pays the GS traffic fee). The agent signs
|
|
36
|
-
* only an INTENT here: no gas, no preapproval. Mirrors the cip56 `transfer`
|
|
37
|
-
* flow — resolve refs via relay → build the create exercise → VERIFY-before-sign
|
|
38
|
-
* over the EXACT prepared bytes → sign locally → execute via relay → read back
|
|
39
|
-
* the created cid (ACS-polled by the relay) — but produces the v1 payload the
|
|
40
|
-
* x402 client puts in PaymentPayload: `{transferCommandCid, payerParty, nonce}`.
|
|
41
|
-
*
|
|
42
|
-
* SECURITY: every money-critical field the verifier pins (sender == own party,
|
|
43
|
-
* receiver == merchant payTo, amount == required, delegate == facilitatorParty)
|
|
44
|
-
* is CALLER INTENT passed in `opts`, NOT taken from the relay's resolve
|
|
45
|
-
* response. The relay-resolved EPAR/exercise templateIds + expectedDso are used
|
|
46
|
-
* only to BUILD the exercise; they widen nothing the agent will sign. The cid
|
|
47
|
-
* returned by the relay moves no funds on its own — the facilitator independently
|
|
48
|
-
* re-validates sender/receiver/amount/delegate/nonce at /verify + /settle.
|
|
49
|
-
*/
|
|
50
|
-
export declare function createTransferCommand(relay: RelayClient, wallet: AgentWallet, opts: {
|
|
51
|
-
/** Merchant party id (PaymentRequirements.payTo). CALLER INTENT. */
|
|
52
|
-
receiver: string;
|
|
53
|
-
/** Atomic amount string (PaymentRequirements.amount). CALLER INTENT. */
|
|
54
|
-
amount: string;
|
|
55
|
-
/** Facilitator/delegate party (extra.facilitatorParty). CALLER INTENT —
|
|
56
|
-
* pinned by exact equality at the prepared command's delegate position. */
|
|
57
|
-
delegate: string;
|
|
58
|
-
/** Synchronizer id (extra.synchronizerId). CALLER INTENT — used to pin the
|
|
59
|
-
* prepare's synchronizer to the merchant-advertised one, never the relay's. */
|
|
60
|
-
synchronizerId: string;
|
|
61
|
-
/** JSON-encoded {paymentId, resourceUrl, merchantContractCid?, x402Version}
|
|
62
|
-
* the facilitator's /verify matches against TransferCommand.description. */
|
|
63
|
-
description: string;
|
|
64
|
-
/** Command expiry (epoch ms). Defaults to now + 60s. */
|
|
65
|
-
expiresAtMs?: number;
|
|
66
|
-
/** Optional, independently-trusted DSO party. When supplied it is pinned to
|
|
67
|
-
* the command's expectedDso AND closes the unpinned-DSO neutralization fully
|
|
68
|
-
* (the DSO can no longer be aliased to an attacker and smuggled in as a
|
|
69
|
-
* consequence recipient). Omitted by default — the agent has no out-of-band
|
|
70
|
-
* DSO; the position-aware backstop + money-role check still apply. NOTE:
|
|
71
|
-
* pinning to the relay's own `r.expectedDso` would be circular and is
|
|
72
|
-
* deliberately NOT done — only an out-of-band value is a real anchor. */
|
|
73
|
-
expectedDso?: string;
|
|
74
|
-
/** Hash-binding policy; defaults to fail-closed (see HashBindingOptions). */
|
|
75
|
-
hashBinding?: HashBindingOptions;
|
|
76
|
-
}): Promise<{
|
|
77
|
-
transferCommandCid: string;
|
|
78
|
-
payerParty: string;
|
|
79
|
-
nonce: number;
|
|
80
|
-
createUpdateId: string;
|
|
81
|
-
}>;
|
|
82
33
|
/** @internal Exported for unit tests (disjoint selection + release). Not part of
|
|
83
34
|
* the public API. */
|
|
84
35
|
export declare function reserveHolding(party: string, holdings: Array<{
|
|
@@ -267,84 +218,4 @@ export declare function reclaimAllocation(relay: RelayClient, wallet: AgentWalle
|
|
|
267
218
|
* receiver == facilitator (already permitted) — behavior is then unchanged. */
|
|
268
219
|
receiver?: string;
|
|
269
220
|
}): Promise<string>;
|
|
270
|
-
/**
|
|
271
|
-
* x402-escrow "Design A" ACCEPT: the SENDER (the agent — an external party whose
|
|
272
|
-
* key the agent-wallet holds) exercises `X402EscrowOffer_Accept` on an
|
|
273
|
-
* `X402EscrowOffer` the facilitator created, to capture its one-time
|
|
274
|
-
* authorization. ACCEPTING MOVES NO FUNDS — it only archives the offer and creates
|
|
275
|
-
* the `X402Escrow` whose signatories are {facilitator, sender}; the facilitator
|
|
276
|
-
* later settles the locked allocation ALONE off the joint authority captured here.
|
|
277
|
-
* The choice's sole controller is the offer's `sender` = the agent, so the agent
|
|
278
|
-
* signs only its own accept (its own key; no gas, no merchant signature).
|
|
279
|
-
*
|
|
280
|
-
* Mirrors the reclaim (`reclaimAllocation` / `Allocation_Withdraw`) flow: build
|
|
281
|
-
* the exercise → VERIFY-before-sign over the EXACT prepared bytes → sign locally →
|
|
282
|
-
* execute via the relay → read back the created `X402Escrow` cid from THIS
|
|
283
|
-
* transaction's events (the agent is relay-only). The sender is an OBSERVER of the
|
|
284
|
-
* offer (not a stakeholder that has it in its ACS), so the offer contract is
|
|
285
|
-
* DISCLOSED via `opts.offerDisclosedContract` (the facilitator surfaces its
|
|
286
|
-
* created_event_blob).
|
|
287
|
-
*
|
|
288
|
-
* SECURITY: like every path, this is NOT exempt from verify-before-sign. A
|
|
289
|
-
* malicious relay could return a DIFFERENT, value-MOVING choice (an
|
|
290
|
-
* Allocation_ExecuteTransfer / TransferFactory_Transfer / CreateTransferCommand /
|
|
291
|
-
* Allocation_Withdraw drain), an accept of a DIFFERENT offer, an injected outbound
|
|
292
|
-
* transfer leg as a consequence, a relay-SUBSTITUTED facilitator (who could later
|
|
293
|
-
* settle the escrow to an attacker), or a foreign-party submission. We pass
|
|
294
|
-
* `kind: "escrow-accept"`, which structurally proves the prepared transaction is a
|
|
295
|
-
* single `X402EscrowOffer_Accept` on EXACTLY `opts.offerCid` (caller intent,
|
|
296
|
-
* REQUIRED contract-id pin), submitted by the agent (act_as == wallet.party),
|
|
297
|
-
* creating an escrow only among the caller-intended {sender, facilitator
|
|
298
|
-
* (+merchant/instrumentAdmin)} parties — and binds the signed hash to those bytes
|
|
299
|
-
* (fail-closed by default, exactly like the reclaim/accept paths). `opts.hashBinding`
|
|
300
|
-
* lets a programmatic caller supply a participant-conformant recompute; the CLI
|
|
301
|
-
* resolves it from the environment (default fail-closed).
|
|
302
|
-
*
|
|
303
|
-
* Returns `{ escrowCid, updateId }`. `escrowCid` is read back via the relay from
|
|
304
|
-
* the accept transaction's events; it is `null` if the relay could not resolve it
|
|
305
|
-
* within its poll budget (the cid moves no funds — the facilitator independently
|
|
306
|
-
* re-validates the escrow + allocation terms at settle).
|
|
307
|
-
*/
|
|
308
|
-
export declare function acceptEscrowOffer(relay: RelayClient, wallet: AgentWallet, opts: {
|
|
309
|
-
/** The `X402EscrowOffer` cid to accept. CALLER INTENT — REQUIRED contract-id
|
|
310
|
-
* pin (the verify arm refuses an accept of any other contract). */
|
|
311
|
-
offerCid: string;
|
|
312
|
-
/** The offer's resolved templateId for the exercise target. The choice is
|
|
313
|
-
* exercised THROUGH `#x402-escrow:X402Escrow:X402EscrowOffer` by default; pass
|
|
314
|
-
* a concrete (package-id-qualified) templateId to override. */
|
|
315
|
-
offerTemplateId?: string;
|
|
316
|
-
/** The facilitator party (offer signatory; settles alone). CALLER INTENT —
|
|
317
|
-
* pinned + added to the allowed-escrow-party set. REQUIRED. */
|
|
318
|
-
facilitator: string;
|
|
319
|
-
/** Optional merchant party recorded on the created escrow (reference-only).
|
|
320
|
-
* Supply when the honest escrow names a distinct merchant so the backstop
|
|
321
|
-
* allows it; omit when merchant collapses onto facilitator/sender. */
|
|
322
|
-
merchant?: string;
|
|
323
|
-
/** Optional instrument admin (DSO) recorded on the created escrow. */
|
|
324
|
-
instrumentAdmin?: string;
|
|
325
|
-
/** Optional Decimal amount the sender intends the escrow to settle. CALLER
|
|
326
|
-
* INTENT — when supplied, the verify arm pins the created `X402Escrow`'s
|
|
327
|
-
* recorded `amount` (a Numeric the party-leaf backstop cannot see) to it by
|
|
328
|
-
* canonical equality, closing the amount-swap gap where a malicious/buggy
|
|
329
|
-
* facilitator authored the offer with an inflated amount. Never taken from the
|
|
330
|
-
* relay. Omit only when the caller has no intended amount to assert. */
|
|
331
|
-
amount?: string;
|
|
332
|
-
/** The sender is an OBSERVER of the offer, so disclose the offer contract.
|
|
333
|
-
* Shape mirrors the v1 EPAR / allocation disclosed-contract envelope. */
|
|
334
|
-
offerDisclosedContract?: {
|
|
335
|
-
templateId: string;
|
|
336
|
-
contractId: string;
|
|
337
|
-
createdEventBlob: string;
|
|
338
|
-
synchronizerId: string;
|
|
339
|
-
};
|
|
340
|
-
/** Caller-intent synchronizer id to PREPARE on + pin the SIGNED
|
|
341
|
-
* Metadata.synchronizer_id to. REQUIRED (the accept carries a caller-chosen
|
|
342
|
-
* domain — the offer/escrow live on a specific synchronizer). */
|
|
343
|
-
synchronizerId: string;
|
|
344
|
-
/** Hash-binding policy; defaults to fail-closed (see HashBindingOptions). */
|
|
345
|
-
hashBinding?: HashBindingOptions;
|
|
346
|
-
}): Promise<{
|
|
347
|
-
escrowCid: string | null;
|
|
348
|
-
updateId: string;
|
|
349
|
-
}>;
|
|
350
221
|
//# sourceMappingURL=tx.d.ts.map
|
package/dist/tx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../src/tx.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../src/tx.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAOL,KAAK,kBAAkB,EAMxB,MAAM,sBAAsB,CAAC;AAyK9B;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE;IACJ,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;6DAEyD;IACzD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;6EAGyE;IACzE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC,GACA,OAAO,CAAC,MAAM,CAAC,CAkEjB;AAuBD;sBACsB;AACtB,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,QAAQ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