@atumlabs/mppx-atum-escrow 0.1.1 → 0.2.2
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/CHANGELOG.md +32 -0
- package/README.md +1 -1
- package/dist/chunk-4P34CLTO.js +2587 -0
- package/dist/{chunk-2MWWLU75.js → chunk-IPZJXELQ.js} +1396 -1528
- package/dist/chunk-NEM3HEZW.js +253 -0
- package/dist/client.d.ts +9 -6
- package/dist/client.js +2 -2
- package/dist/index.d.ts +18 -17
- package/dist/index.js +3 -3
- package/dist/internal-DzEGXm14.d.ts +347 -0
- package/dist/server.d.ts +16 -8
- package/dist/server.js +2 -2
- package/package.json +7 -4
- package/dist/chunk-L62WG2VU.js +0 -131
- package/dist/chunk-W6D2D767.js +0 -1410
- package/dist/internal-CjcEyEsm.d.ts +0 -842
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { createRequire as __atumCreateRequire } from 'module'; const require = __atumCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
METHOD_NAME,
|
|
4
|
+
__toESM,
|
|
5
|
+
assetIdentifier,
|
|
6
|
+
atumEscrowChargeMethod,
|
|
7
|
+
contractOverridesFromExtra,
|
|
8
|
+
import_payment_request_sender_auth,
|
|
9
|
+
namespaceOf,
|
|
10
|
+
require_dist2 as require_dist,
|
|
11
|
+
sameAddress
|
|
12
|
+
} from "./chunk-4P34CLTO.js";
|
|
13
|
+
|
|
14
|
+
// src/server.ts
|
|
15
|
+
var import_payment_request_sender_auth2 = __toESM(require_dist(), 1);
|
|
16
|
+
import { Method } from "mppx";
|
|
17
|
+
var DEADLINE_SKEW_TOLERANCE_MS = 6e4;
|
|
18
|
+
var SOLANA_MAX_FULFILLMENT_DEADLINE_SECONDS = import_payment_request_sender_auth2.REPLAY_HORIZON_SECS - 10;
|
|
19
|
+
function registerServer(config) {
|
|
20
|
+
const now = config.now ?? (() => Date.now());
|
|
21
|
+
return Method.toServer(atumEscrowChargeMethod, {
|
|
22
|
+
async verify({ credential, request }) {
|
|
23
|
+
const pr = credential.payload.paymentRequest;
|
|
24
|
+
const { source, extra } = request;
|
|
25
|
+
const namespace = namespaceOf(source.network);
|
|
26
|
+
const senderAuth = pr.sender_auth;
|
|
27
|
+
if (!senderAuth || senderAuth.signed_messages.length === 0) {
|
|
28
|
+
throw new Error("atum-escrow: credential is missing sender_auth");
|
|
29
|
+
}
|
|
30
|
+
const signed = senderAuth.signed_messages[0];
|
|
31
|
+
if (!signed.message_prehash) {
|
|
32
|
+
throw new Error("atum-escrow: sender_auth is missing message_prehash");
|
|
33
|
+
}
|
|
34
|
+
if (!pr.source) {
|
|
35
|
+
throw new Error("atum-escrow: credential is missing a source");
|
|
36
|
+
}
|
|
37
|
+
const maxSourceStr = pr.max_source_amount ?? "0";
|
|
38
|
+
const cap = BigInt(source.amount);
|
|
39
|
+
if (BigInt(maxSourceStr) > cap) {
|
|
40
|
+
throw new Error("atum-escrow: max_source_amount exceeds the source cap");
|
|
41
|
+
}
|
|
42
|
+
const authTerms = (0, import_payment_request_sender_auth2.getChainAdapter)(source.network).recoverAndVerify(
|
|
43
|
+
signed,
|
|
44
|
+
{ network: source.network, asset: source.asset, account: pr.source.account },
|
|
45
|
+
{
|
|
46
|
+
maxSourceAmount: maxSourceStr,
|
|
47
|
+
escrowContract: extra.escrow,
|
|
48
|
+
reserver: extra.reserver,
|
|
49
|
+
releaser: extra.releaser,
|
|
50
|
+
svmSignatureClusterId: extra.svmSignatureClusterId,
|
|
51
|
+
svmSignatureDomainVersion: extra.svmSignatureDomainVersion,
|
|
52
|
+
// Check permit freshness against the merchant's own clock (the same `now` used for
|
|
53
|
+
// deadline ordering/budgets), not the SDK's wall clock — so freshness is consistent
|
|
54
|
+
// with the rest of verify and deterministic under an injected clock.
|
|
55
|
+
nowSec: Math.floor(now() / 1e3)
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
const dest = pr.destination?.[0];
|
|
59
|
+
if (!dest) {
|
|
60
|
+
throw new Error("atum-escrow: credential is missing a destination");
|
|
61
|
+
}
|
|
62
|
+
if (!sameAddress(dest.account, extra.destination.address)) {
|
|
63
|
+
throw new Error("atum-escrow: destination account does not match the challenge");
|
|
64
|
+
}
|
|
65
|
+
const expectedDestAsset = assetIdentifier(extra.destination.network, extra.destination.asset);
|
|
66
|
+
const destAssetMatches = namespaceOf(extra.destination.network) === "solana" ? dest.asset_identifier === expectedDestAsset : dest.asset_identifier.toLowerCase() === expectedDestAsset.toLowerCase();
|
|
67
|
+
if (!destAssetMatches) {
|
|
68
|
+
throw new Error("atum-escrow: destination asset does not match the challenge");
|
|
69
|
+
}
|
|
70
|
+
if (pr.fulfillment_amount !== extra.fulfillmentAmount) {
|
|
71
|
+
throw new Error("atum-escrow: fulfillment_amount does not match the challenge");
|
|
72
|
+
}
|
|
73
|
+
const overrides = contractOverridesFromExtra(source.network, extra);
|
|
74
|
+
const expectedQuoteSelector = overrides?.quote_selector ?? extra.reserver;
|
|
75
|
+
const expectedVerifier = overrides?.fulfillment_verifier ?? {
|
|
76
|
+
account: extra.releaser,
|
|
77
|
+
endpoint: extra.fulfillmentVerifierEndpoint
|
|
78
|
+
};
|
|
79
|
+
if (!sameAddress(pr.escrow_contract_address ?? "", extra.escrow)) {
|
|
80
|
+
throw new Error("atum-escrow: escrow_contract_address does not match the challenge");
|
|
81
|
+
}
|
|
82
|
+
if (!sameAddress(pr.quote_selector ?? "", expectedQuoteSelector)) {
|
|
83
|
+
throw new Error("atum-escrow: quote_selector does not match the challenge reserver");
|
|
84
|
+
}
|
|
85
|
+
if (!sameAddress(pr.fulfillment_proxy ?? "", extra.fulfillmentProxy)) {
|
|
86
|
+
throw new Error("atum-escrow: fulfillment_proxy does not match the challenge");
|
|
87
|
+
}
|
|
88
|
+
if (!sameAddress(pr.fulfillment_verifier?.account ?? "", expectedVerifier.account)) {
|
|
89
|
+
throw new Error("atum-escrow: fulfillment_verifier.account does not match the challenge releaser");
|
|
90
|
+
}
|
|
91
|
+
if ((pr.fulfillment_verifier?.endpoint ?? "") !== expectedVerifier.endpoint) {
|
|
92
|
+
throw new Error("atum-escrow: fulfillment_verifier.endpoint does not match the challenge");
|
|
93
|
+
}
|
|
94
|
+
const nowMs = now();
|
|
95
|
+
const quote = Date.parse(pr.quote_deadline);
|
|
96
|
+
const fulfillment = Date.parse(pr.fulfillment_deadline);
|
|
97
|
+
if (!(nowMs < quote && quote < fulfillment)) {
|
|
98
|
+
throw new Error(
|
|
99
|
+
"atum-escrow: deadline ordering violated (now < quote_deadline < fulfillment_deadline)"
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
if (quote > nowMs + extra.quoteDeadlineSeconds * 1e3 + DEADLINE_SKEW_TOLERANCE_MS) {
|
|
103
|
+
throw new Error("atum-escrow: quote_deadline exceeds the advertised budget");
|
|
104
|
+
}
|
|
105
|
+
if (fulfillment > nowMs + extra.fulfillmentDeadlineSeconds * 1e3 + DEADLINE_SKEW_TOLERANCE_MS) {
|
|
106
|
+
throw new Error("atum-escrow: fulfillment_deadline exceeds the advertised budget");
|
|
107
|
+
}
|
|
108
|
+
if (namespace !== "solana" && authTerms.deadlineSec * 1e3 < fulfillment) {
|
|
109
|
+
throw new Error("atum-escrow: permit deadline expires before fulfillment_deadline");
|
|
110
|
+
}
|
|
111
|
+
const result = await config.submitter.submit(pr);
|
|
112
|
+
const fc = result.fulfillment_confirmation;
|
|
113
|
+
if (!fc) {
|
|
114
|
+
throw new Error(
|
|
115
|
+
"atum-escrow: settlement did not complete within the synchronous window (no FulfillmentConfirmation)"
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
method: METHOD_NAME,
|
|
120
|
+
status: "success",
|
|
121
|
+
timestamp: fc.fulfillment_timestamp ?? new Date(nowMs).toISOString(),
|
|
122
|
+
reference: fc.destination_tx_hash,
|
|
123
|
+
fulfillmentConfirmation: fc
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function applyMarkupBps(amount, bps) {
|
|
129
|
+
return (BigInt(amount) * BigInt(1e4 + bps) / 10000n).toString();
|
|
130
|
+
}
|
|
131
|
+
function validateCorridor(corridor) {
|
|
132
|
+
if (!Number.isFinite(corridor.quoteDeadlineSeconds) || corridor.quoteDeadlineSeconds <= 0) {
|
|
133
|
+
throw new Error("atum-escrow: quoteDeadlineSeconds must be a positive number of seconds");
|
|
134
|
+
}
|
|
135
|
+
if (!Number.isFinite(corridor.fulfillmentDeadlineSeconds) || corridor.fulfillmentDeadlineSeconds <= 0) {
|
|
136
|
+
throw new Error("atum-escrow: fulfillmentDeadlineSeconds must be a positive number of seconds");
|
|
137
|
+
}
|
|
138
|
+
if (corridor.quoteDeadlineSeconds >= corridor.fulfillmentDeadlineSeconds) {
|
|
139
|
+
throw new Error(
|
|
140
|
+
"atum-escrow: quoteDeadlineSeconds must be strictly less than fulfillmentDeadlineSeconds"
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
if (!Number.isFinite(corridor.markupBps) || corridor.markupBps < 0) {
|
|
144
|
+
throw new Error("atum-escrow: markupBps must be a non-negative number of basis points");
|
|
145
|
+
}
|
|
146
|
+
if (!corridor.sources || corridor.sources.length === 0) {
|
|
147
|
+
throw new Error("atum-escrow: corridor must configure at least one source");
|
|
148
|
+
}
|
|
149
|
+
for (const src of corridor.sources) {
|
|
150
|
+
for (const field of ["network", "escrow", "reserver", "releaser", "fulfillmentVerifierEndpoint"]) {
|
|
151
|
+
if (!src[field]) {
|
|
152
|
+
throw new Error(`atum-escrow: source ${src.network ?? "?"} is missing '${field}'`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (!src.assets || src.assets.length === 0 || src.assets.some((a) => !a)) {
|
|
156
|
+
throw new Error(`atum-escrow: source ${src.network} must list at least one non-empty asset in 'assets'`);
|
|
157
|
+
}
|
|
158
|
+
if (namespaceOf(src.network) === "tron") {
|
|
159
|
+
(0, import_payment_request_sender_auth.resolveTronPermit2)(src.network);
|
|
160
|
+
}
|
|
161
|
+
if (namespaceOf(src.network) === "solana") {
|
|
162
|
+
if (!src.svmSignatureClusterId || src.svmSignatureDomainVersion == null) {
|
|
163
|
+
throw new Error(
|
|
164
|
+
`atum-escrow: Solana source ${src.network} requires svmSignatureClusterId and svmSignatureDomainVersion`
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
if (corridor.fulfillmentDeadlineSeconds > SOLANA_MAX_FULFILLMENT_DEADLINE_SECONDS) {
|
|
168
|
+
throw new Error(
|
|
169
|
+
`atum-escrow: a corridor with a Solana source must set fulfillmentDeadlineSeconds <= ${SOLANA_MAX_FULFILLMENT_DEADLINE_SECONDS} (Solana deposits expire within the escrow replay window); got ${corridor.fulfillmentDeadlineSeconds}`
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function buildChargeRequest(corridor, select, fulfillmentAmount, options) {
|
|
176
|
+
validateCorridor(corridor);
|
|
177
|
+
const src = corridor.sources.find(
|
|
178
|
+
(s) => s.network === select.network && s.assets.some((a) => sameAddress(a, select.asset))
|
|
179
|
+
);
|
|
180
|
+
if (!src) {
|
|
181
|
+
throw new Error(
|
|
182
|
+
`atum-escrow: no source option configured for ${select.network} / ${select.asset}`
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
const selectedAsset = src.assets.find((a) => sameAddress(a, select.asset));
|
|
186
|
+
const isSolana = namespaceOf(src.network) === "solana";
|
|
187
|
+
if (isSolana && options?.issuedAt !== void 0 && !/^[0-9]+$/.test(options.issuedAt)) {
|
|
188
|
+
throw new Error(
|
|
189
|
+
`atum-escrow: issuedAt must be epoch seconds (digits only), got '${options.issuedAt}'`
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
source: {
|
|
194
|
+
network: src.network,
|
|
195
|
+
asset: selectedAsset,
|
|
196
|
+
amount: applyMarkupBps(fulfillmentAmount, corridor.markupBps)
|
|
197
|
+
},
|
|
198
|
+
extra: {
|
|
199
|
+
// The corridor config carries the receive side as `account`; the wire `extra` names it
|
|
200
|
+
// `address` (the x402 scheme field), so map it here.
|
|
201
|
+
destination: {
|
|
202
|
+
network: corridor.destination.network,
|
|
203
|
+
asset: corridor.destination.asset,
|
|
204
|
+
address: corridor.destination.account
|
|
205
|
+
},
|
|
206
|
+
fulfillmentAmount,
|
|
207
|
+
escrow: src.escrow,
|
|
208
|
+
fulfillmentProxy: corridor.fulfillmentProxy,
|
|
209
|
+
reserver: src.reserver,
|
|
210
|
+
releaser: src.releaser,
|
|
211
|
+
fulfillmentVerifierEndpoint: src.fulfillmentVerifierEndpoint,
|
|
212
|
+
quoteDeadlineSeconds: corridor.quoteDeadlineSeconds,
|
|
213
|
+
fulfillmentDeadlineSeconds: corridor.fulfillmentDeadlineSeconds,
|
|
214
|
+
...src.svmSignatureClusterId ? { svmSignatureClusterId: src.svmSignatureClusterId } : {},
|
|
215
|
+
...src.svmSignatureDomainVersion != null ? { svmSignatureDomainVersion: src.svmSignatureDomainVersion } : {},
|
|
216
|
+
...isSolana && options?.issuedAt ? { issuedAt: options.issuedAt } : {}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
async function corridorFromDefaults(defaults, params) {
|
|
221
|
+
const [destDefaults, ...sourceDefaults] = await Promise.all([
|
|
222
|
+
defaults.fetchChainDefaults(params.destination.network),
|
|
223
|
+
...params.sources.map((s) => defaults.fetchChainDefaults(s.network))
|
|
224
|
+
]);
|
|
225
|
+
const sources = params.sources.map((s, i) => {
|
|
226
|
+
const d = sourceDefaults[i];
|
|
227
|
+
return {
|
|
228
|
+
network: s.network,
|
|
229
|
+
assets: s.assets,
|
|
230
|
+
escrow: d.escrowContract,
|
|
231
|
+
reserver: d.quoteSelector,
|
|
232
|
+
releaser: d.fulfillmentVerifierAccount,
|
|
233
|
+
fulfillmentVerifierEndpoint: d.fulfillmentVerifierEndpoint,
|
|
234
|
+
...d.svmSignatureClusterId ? { svmSignatureClusterId: d.svmSignatureClusterId } : {},
|
|
235
|
+
...d.svmSignatureDomainVersion != null ? { svmSignatureDomainVersion: d.svmSignatureDomainVersion } : {}
|
|
236
|
+
};
|
|
237
|
+
});
|
|
238
|
+
return {
|
|
239
|
+
destination: params.destination,
|
|
240
|
+
fulfillmentProxy: destDefaults.fulfillmentProxy,
|
|
241
|
+
markupBps: params.markupBps,
|
|
242
|
+
quoteDeadlineSeconds: params.quoteDeadlineSeconds,
|
|
243
|
+
fulfillmentDeadlineSeconds: params.fulfillmentDeadlineSeconds,
|
|
244
|
+
sources
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export {
|
|
249
|
+
registerServer,
|
|
250
|
+
validateCorridor,
|
|
251
|
+
buildChargeRequest,
|
|
252
|
+
corridorFromDefaults
|
|
253
|
+
};
|
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as zod_v4_core from 'zod/v4/core';
|
|
2
2
|
import * as z from 'zod/mini';
|
|
3
3
|
import { Signer } from 'ethers';
|
|
4
|
-
import { S as SenderSigner, f as SenderSignerOptions, h as SolanaClusterUnixTimeReader } from './internal-
|
|
5
|
-
export { A as AtumEscrowChallenge, a as AtumEscrowCredential, C as ChargeCredentialPayload, c as ChargeRequest, d as ChargeRequestSchema, e as CredentialPayloadSchema, I as INTENT, M as METHOD_NAME,
|
|
4
|
+
import { S as SenderSigner, f as SenderSignerOptions, h as SolanaClusterUnixTimeReader } from './internal-DzEGXm14.js';
|
|
5
|
+
export { A as AtumEscrowChallenge, a as AtumEscrowCredential, C as ChargeCredentialPayload, c as ChargeRequest, d as ChargeRequestSchema, e as CredentialPayloadSchema, I as INTENT, M as METHOD_NAME, g as atumEscrowChargeMethod } from './internal-DzEGXm14.js';
|
|
6
6
|
import { Method } from 'mppx';
|
|
7
|
+
export { PaymentRequest } from './generated/index.js';
|
|
7
8
|
|
|
8
9
|
/** Configuration for the payer side of the method. */
|
|
9
10
|
interface AtumEscrowClientConfig {
|
|
@@ -22,8 +23,10 @@ interface AtumEscrowClientConfig {
|
|
|
22
23
|
/** Clock (epoch ms) used to derive absolute deadlines from the challenge budgets. Defaults to `Date.now`. */
|
|
23
24
|
now?: () => number;
|
|
24
25
|
/**
|
|
25
|
-
* Solana-only
|
|
26
|
-
*
|
|
26
|
+
* Solana-only: supplies the `issued_at` a Solana deposit is stamped with, keeping the
|
|
27
|
+
* build fully offline. Used only when the challenge does not carry a merchant-stamped
|
|
28
|
+
* `extra.issuedAt` (which takes precedence); if neither is present, the client clock is
|
|
29
|
+
* used. Ignored for EVM/Tron.
|
|
27
30
|
*/
|
|
28
31
|
solanaClockReader?: SolanaClusterUnixTimeReader;
|
|
29
32
|
}
|
|
@@ -62,7 +65,7 @@ declare function registerClient(config: AtumEscrowClientConfig): Method.Client<{
|
|
|
62
65
|
destination: z.ZodMiniObject<{
|
|
63
66
|
network: z.ZodMiniString<string>;
|
|
64
67
|
asset: z.ZodMiniString<string>;
|
|
65
|
-
|
|
68
|
+
address: z.ZodMiniString<string>;
|
|
66
69
|
}, zod_v4_core.$strip>;
|
|
67
70
|
fulfillmentAmount: z.ZodMiniString<string>;
|
|
68
71
|
escrow: z.ZodMiniString<string>;
|
|
@@ -72,9 +75,9 @@ declare function registerClient(config: AtumEscrowClientConfig): Method.Client<{
|
|
|
72
75
|
fulfillmentVerifierEndpoint: z.ZodMiniString<string>;
|
|
73
76
|
quoteDeadlineSeconds: z.ZodMiniNumber<number>;
|
|
74
77
|
fulfillmentDeadlineSeconds: z.ZodMiniNumber<number>;
|
|
75
|
-
permit2: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
76
78
|
svmSignatureClusterId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
77
79
|
svmSignatureDomainVersion: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
80
|
+
issuedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
78
81
|
}, zod_v4_core.$strip>;
|
|
79
82
|
}, zod_v4_core.$strip>;
|
|
80
83
|
readonly credential: {
|
package/dist/client.js
CHANGED
|
@@ -8,14 +8,14 @@ import { createRequire as __atumCreateRequire } from 'module'; const require = _
|
|
|
8
8
|
import {
|
|
9
9
|
ensureSourceApproval,
|
|
10
10
|
registerClient
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IPZJXELQ.js";
|
|
12
12
|
import {
|
|
13
13
|
ChargeRequestSchema,
|
|
14
14
|
CredentialPayloadSchema,
|
|
15
15
|
INTENT,
|
|
16
16
|
METHOD_NAME,
|
|
17
17
|
atumEscrowChargeMethod
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-4P34CLTO.js";
|
|
19
19
|
export {
|
|
20
20
|
ChargeRequestSchema,
|
|
21
21
|
CredentialPayloadSchema,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { A as AtumEscrowChallenge, a as AtumEscrowCredential, b as AtumEscrowRequest, C as ChargeCredentialPayload, c as ChargeRequest, d as ChargeRequestSchema, e as CredentialPayloadSchema, I as INTENT, M as METHOD_NAME,
|
|
1
|
+
export { A as AtumEscrowChallenge, a as AtumEscrowCredential, b as AtumEscrowRequest, C as ChargeCredentialPayload, c as ChargeRequest, d as ChargeRequestSchema, e as CredentialPayloadSchema, I as INTENT, M as METHOD_NAME, S as SenderSigner, f as SenderSignerOptions, g as atumEscrowChargeMethod } from './internal-DzEGXm14.js';
|
|
2
2
|
export { AtumEscrowClientConfig, EnsureApprovalResult, ensureSourceApproval, registerClient } from './client.js';
|
|
3
3
|
export { AtumEscrowCorridor, AtumEscrowReceipt, AtumEscrowServerConfig, AtumEscrowSource, ChainDefaultsSource, FulfillmentConfirmation, PaymentSubmitter, buildChargeRequest, corridorFromDefaults, registerServer, validateCorridor } from './server.js';
|
|
4
|
+
export { PaymentRequest } from './generated/index.js';
|
|
4
5
|
import 'zod/mini';
|
|
5
6
|
import 'mppx';
|
|
6
7
|
import 'zod/v4/core';
|
|
@@ -12,11 +13,11 @@ import 'ethers';
|
|
|
12
13
|
* and run json-schema-to-typescript to regenerate this file.
|
|
13
14
|
*/
|
|
14
15
|
/**
|
|
15
|
-
* The `extra.atum` object carried inside an atum-escrow x402 PaymentRequirements entry (accepts[]): the merchant's receive-side plus the contract/role addresses and deadline budgets. Scheme-specific data the standard x402 `extra` bag treats as opaque, so it is owned here and shared by all role mechanisms. Addresses are chain-general: an EVM `0x`-
|
|
16
|
+
* The `extra.atum` object carried inside an atum-escrow x402 PaymentRequirements entry (accepts[]): the merchant's receive-side plus the contract/role addresses and deadline budgets. Scheme-specific data the standard x402 `extra` bag treats as opaque, so it is owned here and shared by all role mechanisms. Addresses are chain-general: an EVM `0x`-hex address (20 bytes) or a base58-encoded address (Solana/Tron), per the field's CAIP-2 chain.
|
|
16
17
|
*/
|
|
17
18
|
interface AtumEscrowExtra {
|
|
18
19
|
/**
|
|
19
|
-
* Where the merchant receives (CAIP-2 chain, token,
|
|
20
|
+
* Where the merchant receives (CAIP-2 chain, token, address).
|
|
20
21
|
*/
|
|
21
22
|
destination: {
|
|
22
23
|
/**
|
|
@@ -24,36 +25,36 @@ interface AtumEscrowExtra {
|
|
|
24
25
|
*/
|
|
25
26
|
network: string;
|
|
26
27
|
/**
|
|
27
|
-
* Destination token address (EVM hex or base58).
|
|
28
|
+
* Destination token contract address (EVM hex or base58, per the destination chain).
|
|
28
29
|
*/
|
|
29
30
|
asset: string;
|
|
30
31
|
/**
|
|
31
|
-
* Merchant receive
|
|
32
|
+
* Merchant receive address (EVM hex or base58, per the destination chain).
|
|
32
33
|
*/
|
|
33
|
-
|
|
34
|
+
address: string;
|
|
34
35
|
};
|
|
35
36
|
/**
|
|
36
37
|
* Exact amount the merchant receives, in atomic token units.
|
|
37
38
|
*/
|
|
38
39
|
fulfillmentAmount: string;
|
|
39
40
|
/**
|
|
40
|
-
* Source-chain escrow contract (the x402 payTo).
|
|
41
|
+
* Source-chain escrow contract (the x402 payTo); EVM hex or base58, per the source chain.
|
|
41
42
|
*/
|
|
42
43
|
escrow: string;
|
|
43
44
|
/**
|
|
44
|
-
* Destination-chain fulfillment proxy contract.
|
|
45
|
+
* Destination-chain fulfillment proxy contract (EVM hex or base58, per the destination chain).
|
|
45
46
|
*/
|
|
46
47
|
fulfillmentProxy: string;
|
|
47
48
|
/**
|
|
48
|
-
*
|
|
49
|
+
* Atum reserver role address (escrow deposit witness); EVM hex or base58, per the source chain.
|
|
49
50
|
*/
|
|
50
51
|
reserver: string;
|
|
51
52
|
/**
|
|
52
|
-
*
|
|
53
|
+
* Atum releaser role address (escrow deposit witness); EVM hex or base58, per the source chain.
|
|
53
54
|
*/
|
|
54
55
|
releaser: string;
|
|
55
56
|
/**
|
|
56
|
-
* Source-chain fulfillment-verifier endpoint the payment request carries. The verifier account and the
|
|
57
|
+
* Source-chain fulfillment-verifier endpoint the payment request carries. The verifier account and the quote_selector are the releaser and reserver respectively (the network derives the deposit witness roles from them), so only the endpoint is not otherwise present in this object.
|
|
57
58
|
*/
|
|
58
59
|
fulfillmentVerifierEndpoint: string;
|
|
59
60
|
/**
|
|
@@ -65,17 +66,17 @@ interface AtumEscrowExtra {
|
|
|
65
66
|
*/
|
|
66
67
|
fulfillmentDeadlineSeconds: number;
|
|
67
68
|
/**
|
|
68
|
-
*
|
|
69
|
-
*/
|
|
70
|
-
permit2?: string;
|
|
71
|
-
/**
|
|
72
|
-
* Solana-only: cluster identifier used to domain-separate the deposit authorization. Present only when the source chain is Solana; omitted for EVM/Tron.
|
|
69
|
+
* Solana source only: cluster name used to build the 32-byte cluster_id in the V3 escrow signature domain. Optional; the facilitator requires it for a Solana source.
|
|
73
70
|
*/
|
|
74
71
|
svmSignatureClusterId?: string;
|
|
75
72
|
/**
|
|
76
|
-
* Solana
|
|
73
|
+
* Solana source only: escrow signature-domain version (V3 domain separation). Optional; required for a Solana source.
|
|
77
74
|
*/
|
|
78
75
|
svmSignatureDomainVersion?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Solana source only: merchant-stamped issue time in epoch seconds. The merchant reads the cluster clock so the client makes no RPC and the 402 stays self-contained. Optional; required for a Solana source.
|
|
78
|
+
*/
|
|
79
|
+
issuedAt?: string;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
export type { AtumEscrowExtra };
|
package/dist/index.js
CHANGED
|
@@ -8,20 +8,20 @@ import { createRequire as __atumCreateRequire } from 'module'; const require = _
|
|
|
8
8
|
import {
|
|
9
9
|
ensureSourceApproval,
|
|
10
10
|
registerClient
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IPZJXELQ.js";
|
|
12
12
|
import {
|
|
13
13
|
buildChargeRequest,
|
|
14
14
|
corridorFromDefaults,
|
|
15
15
|
registerServer,
|
|
16
16
|
validateCorridor
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-NEM3HEZW.js";
|
|
18
18
|
import {
|
|
19
19
|
ChargeRequestSchema,
|
|
20
20
|
CredentialPayloadSchema,
|
|
21
21
|
INTENT,
|
|
22
22
|
METHOD_NAME,
|
|
23
23
|
atumEscrowChargeMethod
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-4P34CLTO.js";
|
|
25
25
|
export {
|
|
26
26
|
ChargeRequestSchema,
|
|
27
27
|
CredentialPayloadSchema,
|