@atumlabs/mppx-atum-escrow 0.3.0 → 0.4.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/client.d.ts CHANGED
@@ -1,10 +1,187 @@
1
1
  import * as zod_v4_core from 'zod/v4/core';
2
2
  import * as z from 'zod/mini';
3
- import { Signer } from 'ethers';
4
- import { S as SenderSigner, g as SenderSignerOptions, i as SolanaClusterUnixTimeReader } from './internal-9tB7y-A7.js';
5
- export { A as AtumEscrowChallenge, a as AtumEscrowCredential, C as ChargeCredentialPayload, c as ChargeRequest, d as ChargeRequestSchema, e as CredentialPayloadSchema, I as INTENT, f as INTENT_ID_META_KEY, M as METHOD_NAME, h as atumEscrowChargeMethod } from './internal-9tB7y-A7.js';
3
+ import { S as SenderSigner, h as SenderSignerOptions, k as SolanaClusterUnixTimeReader } from './internal-BZBJJfaL.js';
4
+ export { A as AtumEscrowChallenge, a as AtumEscrowCredential, C as ChargeCredentialPayload, d as ChargeRequest, e as ChargeRequestSchema, f as CredentialPayloadSchema, I as INTENT, g as INTENT_ID_META_KEY, M as METHOD_NAME, i as atumEscrowChargeMethod } from './internal-BZBJJfaL.js';
6
5
  import { Method } from 'mppx';
6
+ import { Signer } from 'ethers';
7
7
  export { PaymentRequest } from './generated/index.js';
8
+ import './sender-auth-verify-C-Q-zvAO.js';
9
+
10
+ /**
11
+ * Result of an {@link ensureSourceApproval} call.
12
+ */
13
+ interface EnsureApprovalResult {
14
+ /** The existing allowance already covered the requirement; no transaction was sent. */
15
+ alreadySufficient: boolean;
16
+ /** The approval transaction hash, when one was sent. */
17
+ txHash?: string;
18
+ /**
19
+ * Set only when the token refused to overwrite a non-zero allowance and it had to be reset to
20
+ * zero first: the hash of that reset. Its absence means one transaction was sent, not two.
21
+ */
22
+ resetTxHash?: string;
23
+ }
24
+ /** What TronWeb reports about a broadcast transaction. Empty until it is confirmed. */
25
+ interface TronTransactionInfo {
26
+ receipt?: {
27
+ result?: string;
28
+ };
29
+ }
30
+ /**
31
+ * The slice of a TronWeb instance this package needs.
32
+ *
33
+ * Declared structurally rather than imported from `tronweb` on purpose: the package then
34
+ * type-checks and builds with tronweb absent, and consumers that never pay from Tron do not
35
+ * carry an 11 MB dependency they cannot reach. The caller constructs the instance and passes
36
+ * it in, exactly as the EVM path takes a caller-constructed ethers signer.
37
+ */
38
+ interface TronWebLike {
39
+ /**
40
+ * The ABI-and-address form, which builds the handle locally. The `contract().at(address)`
41
+ * form fetches the ABI from the node instead: a round trip per use, and an interface that
42
+ * depends on what the chain happens to report for that address.
43
+ *
44
+ * Returns `unknown` on purpose. TronWeb types this as a contract whose methods are produced
45
+ * dynamically from the ABI, so pinning it to {@link TronTokenContract} here would stop a real
46
+ * TronWeb instance assigning to this interface at all and force every caller to write a cast.
47
+ * The cast belongs in one place — next to the ABI we passed, which is what makes it true.
48
+ */
49
+ contract(abi: unknown, address: string): unknown;
50
+ trx: {
51
+ getTransactionInfo(txId: string): Promise<TronTransactionInfo>;
52
+ };
53
+ /**
54
+ * The account this instance signs as. Read to check it against `owner` before broadcasting,
55
+ * since an approval only ever applies to the account that sends it.
56
+ *
57
+ * Optional, and `false` is TronWeb's own "not set": both mean the instance cannot say which
58
+ * account it would use, and neither is treated as a mismatch.
59
+ */
60
+ defaultAddress?: {
61
+ base58?: string | false;
62
+ };
63
+ }
64
+ /** How long to wait for a broadcast approval to confirm before giving up, on either chain. */
65
+ interface ConfirmationOptions {
66
+ /**
67
+ * Default 60_000. On timeout the approval is reported as unconfirmed rather than failed: it
68
+ * was broadcast and may still confirm, so the caller is told to check it before sending
69
+ * another one.
70
+ */
71
+ timeoutMs?: number;
72
+ /** Tron only: how often to poll for the receipt. Default 1_500, under Tron's ~3s block time. */
73
+ pollIntervalMs?: number;
74
+ /** Tron only: default 100_000_000 SUN. Tron charges the caller for contract execution. */
75
+ feeLimit?: number;
76
+ }
77
+ /**
78
+ * Inputs to {@link ensureSourceApproval} and {@link needsSourceApproval}.
79
+ *
80
+ * `signer` and `tronWeb` are both optional here because which one is required is decided by
81
+ * `network`, a runtime string that no type can constrain. Supplying the wrong one for the
82
+ * chain fails with a message naming the one that was needed.
83
+ */
84
+ interface ApprovalParams {
85
+ /** CAIP-2 source chain id, e.g. `eip155:8453` or `tron:mainnet`. */
86
+ network: string;
87
+ /** Source token address. */
88
+ token: string;
89
+ /** The payer's account. */
90
+ owner: string;
91
+ /**
92
+ * The contract to approve. Defaults to the canonical Permit2 for the chain: the EVM
93
+ * deployment on `eip155:*`, and the pinned per-network address on `tron:*`.
94
+ */
95
+ spender?: string;
96
+ /**
97
+ * The minimum allowance this charge needs. Answers "is what I already have enough?".
98
+ * When omitted, only an unlimited approval counts as sufficient, so a smaller leftover
99
+ * allowance cannot be mistaken for enough and revert a larger later charge on-chain.
100
+ */
101
+ requiredAllowance?: bigint;
102
+ /**
103
+ * How much to approve when an approval IS sent. Defaults to unlimited, so later charges on
104
+ * the same token need no further transaction.
105
+ *
106
+ * On its own, a bounded amount is treated as its own requirement: an allowance still holding
107
+ * the full bound is left alone rather than re-approved. That is the right answer for a one-off
108
+ * approval, where nothing else in the call says what a later charge would need.
109
+ *
110
+ * Across repeated payments, PAIR IT WITH `requiredAllowance`. Permit2 decrements the allowance
111
+ * on every payment, so a bound measured against itself stops being sufficient the moment the
112
+ * first charge lands, and every later call sends another approval. `requiredAllowance` states
113
+ * what the NEXT charge needs, which is the question a partly spent bound can still answer yes
114
+ * to.
115
+ *
116
+ * Trade-off: a bounded approval limits what the escrow can ever move, but it is consumed as it
117
+ * is spent and eventually has to be granted again, whichever way it is used.
118
+ */
119
+ approvalAmount?: bigint;
120
+ /** An ethers signer connected to the source chain. Required for `eip155:*`. */
121
+ signer?: Signer;
122
+ /** A TronWeb instance configured for the source chain. Required for `tron:*`. */
123
+ tronWeb?: TronWebLike;
124
+ /** Broadcast and confirmation tuning. Applies to both chains. */
125
+ confirmation?: ConfirmationOptions;
126
+ /**
127
+ * Called with each transaction hash the moment it is broadcast, before the wait for it to
128
+ * confirm. Without this a caller has nothing to show for a transaction that is already
129
+ * spending their gas — and nothing to look up if the wait times out.
130
+ *
131
+ * `purpose` distinguishes the approval itself from the zero-reset some tokens demand first,
132
+ * so two hashes in one call read as one deliberate sequence rather than a double spend.
133
+ */
134
+ onSubmitted?: (txHash: string, purpose: "approval" | "reset") => void;
135
+ }
136
+
137
+ /** Whether an error came from a broadcast transaction that was never seen to confirm. */
138
+ declare function isUnconfirmed(error: unknown): boolean;
139
+
140
+ /**
141
+ * Payer-side Permit2 approval for the source token an escrow deposit moves.
142
+ *
143
+ * On EVM and Tron the escrow moves the source token through Permit2, so the payer must have
144
+ * approved Permit2 on that token BEFORE paying. Without it the payment is built, signed and
145
+ * accepted by the gateway, and then the deposit reverts on-chain at settlement — a late and
146
+ * misleading failure. Solana authorizes the transfer inside the signed deposit itself, so
147
+ * there is nothing to approve there.
148
+ *
149
+ * Worth arranging before the payment is signed: a deposit that reverts is a terminal
150
+ * settlement failure, and a terminal failure is bound to the request identifier that produced
151
+ * it, so re-attempting then needs a NEW identifier. Getting the allowance right up front keeps
152
+ * the identifier usable.
153
+ *
154
+ * This package reads chain state and broadcasts a transaction, which is why it is separate
155
+ * from the sender-auth SDK next door: that one is pure, offline and byte-parity-tested against
156
+ * Go. The caller supplies the connected signer, so this package never chooses an RPC endpoint.
157
+ */
158
+
159
+ /**
160
+ * Whether a payment on these terms would need an approval transaction first.
161
+ *
162
+ * Read-only: it spends no gas and sends nothing, so it is safe to call on every payment as a
163
+ * preflight. Returns false on Solana, which needs no approval at all.
164
+ *
165
+ * @remarks
166
+ * Unlike a try-and-see, this reports the answer instead of acting on it — use it to tell a
167
+ * payer what is about to happen, or to check whether a wallet is ready before asking for a
168
+ * signature.
169
+ */
170
+ declare function needsSourceApproval(params: ApprovalParams): Promise<boolean>;
171
+ /**
172
+ * Ensure the payer has approved Permit2 to move the source token, so the escrow deposit does
173
+ * not revert at settlement. Reads the current allowance and sends an approval only if it falls
174
+ * short; the approval it sends is unlimited unless `approvalAmount` bounds it.
175
+ *
176
+ * Applies to EVM (`params.signer`) and Tron (`params.tronWeb`). On Solana it reports
177
+ * `alreadySufficient` without touching the chain.
178
+ *
179
+ * @remarks
180
+ * Not concurrency-safe: two overlapping calls for the same `(owner, token, spender)` may both
181
+ * read a short allowance and both send an approval. They target the same value, so this only
182
+ * wastes gas; serialize calls per token if that matters.
183
+ */
184
+ declare function ensureSourceApproval(params: ApprovalParams): Promise<EnsureApprovalResult>;
8
185
 
9
186
  /** Configuration for the payer side of the method. */
10
187
  interface AtumEscrowClientConfig {
@@ -89,43 +266,5 @@ declare function registerClient(config: AtumEscrowClientConfig): Method.Client<{
89
266
  };
90
267
  };
91
268
  }, undefined>;
92
- /** Result of an {@link ensureSourceApproval} call. */
93
- interface EnsureApprovalResult {
94
- /** The existing allowance already covered the required amount; no transaction was sent. */
95
- alreadySufficient: boolean;
96
- /** The approval transaction hash, when one was sent. */
97
- txHash?: string;
98
- }
99
- /**
100
- * Ensure the payer has approved the token-transfer contract (Permit2) to move the source
101
- * token, so the escrow deposit does not revert at settlement. Reads the current allowance
102
- * and sends an approval only if it falls short.
103
- *
104
- * Applies to EVM and Tron sources (which use a Permit2-style allowance); Solana sources
105
- * authorize the transfer in the signed deposit itself, so this is a no-op there.
106
- *
107
- * @param params.network - CAIP-2 source chain id.
108
- * @param params.token - source token address.
109
- * @param params.owner - the payer's account.
110
- * @param params.signer - an ethers signer able to send the approval on `network`.
111
- * @param params.spender - the contract to approve; defaults to the canonical EVM Permit2.
112
- * Required for Tron (its Permit2 address is chain-specific).
113
- * @param params.requiredAllowance - the minimum allowance this charge needs (pass the
114
- * source cap, `challenge.request.source.amount`). When omitted, the function ensures an
115
- * unlimited approval — a smaller leftover allowance is NOT treated as sufficient, so a
116
- * later larger charge cannot slip through and revert on-chain.
117
- *
118
- * Not concurrency-safe: two overlapping calls for the same `(owner, token, spender)` may
119
- * both read a short allowance and both send an approval. They target the same value, so
120
- * this only wastes gas; serialize calls per token if that matters.
121
- */
122
- declare function ensureSourceApproval(params: {
123
- network: string;
124
- token: string;
125
- owner: string;
126
- signer: Signer;
127
- spender?: string;
128
- requiredAllowance?: bigint;
129
- }): Promise<EnsureApprovalResult>;
130
269
 
131
- export { type AtumEscrowClientConfig, type EnsureApprovalResult, SenderSigner, SenderSignerOptions, ensureSourceApproval, registerClient };
270
+ export { type ApprovalParams, type AtumEscrowClientConfig, type ConfirmationOptions, type EnsureApprovalResult, SenderSigner, SenderSignerOptions, type TronWebLike, ensureSourceApproval, isUnconfirmed, needsSourceApproval, registerClient };
package/dist/client.js CHANGED
@@ -1,14 +1,12 @@
1
1
  /*
2
- * Copyright (c) 2026 Atum Labs, Inc. All rights reserved.
3
- * Proprietary and confidential.
4
- * Access and use are governed by the LICENSE file distributed with this package.
5
- * Do not remove, alter, or obscure this notice.
2
+ * Copyright 2026 Atum Labs, Inc.
3
+ * SPDX-License-Identifier: Apache-2.0
6
4
  */
7
5
  import { createRequire as __atumCreateRequire } from 'module'; const require = __atumCreateRequire(import.meta.url);
8
6
  import {
9
- ensureSourceApproval,
7
+ import_payment_request_token_approval,
10
8
  registerClient
11
- } from "./chunk-ZFA5SSUP.js";
9
+ } from "./chunk-IGTT7XSG.js";
12
10
  import {
13
11
  ChargeRequestSchema,
14
12
  CredentialPayloadSchema,
@@ -16,7 +14,10 @@ import {
16
14
  INTENT_ID_META_KEY,
17
15
  METHOD_NAME,
18
16
  atumEscrowChargeMethod
19
- } from "./chunk-Z3AUNEU5.js";
17
+ } from "./chunk-LAWFMGYD.js";
18
+ var export_ensureSourceApproval = import_payment_request_token_approval.ensureSourceApproval;
19
+ var export_isUnconfirmed = import_payment_request_token_approval.isUnconfirmed;
20
+ var export_needsSourceApproval = import_payment_request_token_approval.needsSourceApproval;
20
21
  export {
21
22
  ChargeRequestSchema,
22
23
  CredentialPayloadSchema,
@@ -24,6 +25,8 @@ export {
24
25
  INTENT_ID_META_KEY,
25
26
  METHOD_NAME,
26
27
  atumEscrowChargeMethod,
27
- ensureSourceApproval,
28
+ export_ensureSourceApproval as ensureSourceApproval,
29
+ export_isUnconfirmed as isUnconfirmed,
30
+ export_needsSourceApproval as needsSourceApproval,
28
31
  registerClient
29
32
  };
package/dist/index.d.ts CHANGED
@@ -1,82 +1,9 @@
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, f as INTENT_ID_META_KEY, M as METHOD_NAME, S as SenderSigner, g as SenderSignerOptions, h as atumEscrowChargeMethod } from './internal-9tB7y-A7.js';
2
- export { AtumEscrowClientConfig, EnsureApprovalResult, ensureSourceApproval, registerClient } from './client.js';
3
- export { AtumEscrowCorridor, AtumEscrowReceipt, AtumEscrowServerConfig, AtumEscrowSource, ChainDefaultsSource, ChargeChallenge, FulfillmentConfirmation, PaymentRejectedError, PaymentSettlementStatus, PaymentSubmitResult, PaymentSubmitter, SettlementErrorDetails, SettlementFailedError, SettlementPendingError, buildChargeChallenge, buildChargeRequest, corridorFromDefaults, isPaymentRejected, isSettlementFailed, isSettlementPending, registerServer, validateCorridor } from './server.js';
1
+ export { A as AtumEscrowChallenge, a as AtumEscrowCredential, b as AtumEscrowExtra, c as AtumEscrowRequest, C as ChargeCredentialPayload, d as ChargeRequest, e as ChargeRequestSchema, f as CredentialPayloadSchema, I as INTENT, g as INTENT_ID_META_KEY, M as METHOD_NAME, S as SenderSigner, h as SenderSignerOptions, i as atumEscrowChargeMethod } from './internal-BZBJJfaL.js';
2
+ export { ApprovalParams, AtumEscrowClientConfig, ConfirmationOptions, EnsureApprovalResult, TronWebLike, ensureSourceApproval, isUnconfirmed, needsSourceApproval, registerClient } from './client.js';
3
+ export { AtumEscrowCorridor, AtumEscrowReceipt, AtumEscrowServer, AtumEscrowServerConfig, AtumEscrowSource, ChainDefaultsSource, ChargeChallenge, FulfillmentConfirmation, PaymentRejectedError, PaymentSettlementStatus, PaymentSubmitResult, PaymentSubmitter, SettlementErrorDetails, SettlementFailedError, SettlementPendingError, buildChargeChallenge, buildChargeRequest, corridorFromDefaults, isPaymentRejected, isSettlementFailed, isSettlementPending, registerServer, validateCorridor } from './server.js';
4
4
  export { PaymentRequest } from './generated/index.js';
5
+ import './sender-auth-verify-C-Q-zvAO.js';
5
6
  import 'zod/mini';
6
7
  import 'mppx';
7
8
  import 'zod/v4/core';
8
9
  import 'ethers';
9
-
10
- /**
11
- * This file was automatically generated by json-schema-to-typescript.
12
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
13
- * and run json-schema-to-typescript to regenerate this file.
14
- */
15
- /**
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.
17
- */
18
- interface AtumEscrowExtra {
19
- /**
20
- * Where the merchant receives (CAIP-2 chain, token, address).
21
- */
22
- destination: {
23
- /**
24
- * CAIP-2 destination chain id (e.g. eip155:42161).
25
- */
26
- network: string;
27
- /**
28
- * Destination token contract address (EVM hex or base58, per the destination chain).
29
- */
30
- asset: string;
31
- /**
32
- * Merchant receive address (EVM hex or base58, per the destination chain).
33
- */
34
- address: string;
35
- };
36
- /**
37
- * Exact amount the merchant receives, in atomic token units.
38
- */
39
- fulfillmentAmount: string;
40
- /**
41
- * Source-chain escrow contract (the x402 payTo); EVM hex or base58, per the source chain.
42
- */
43
- escrow: string;
44
- /**
45
- * Destination-chain fulfillment proxy contract (EVM hex or base58, per the destination chain).
46
- */
47
- fulfillmentProxy: string;
48
- /**
49
- * Atum reserver role address (escrow deposit witness); EVM hex or base58, per the source chain.
50
- */
51
- reserver: string;
52
- /**
53
- * Atum releaser role address (escrow deposit witness); EVM hex or base58, per the source chain.
54
- */
55
- releaser: string;
56
- /**
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.
58
- */
59
- fulfillmentVerifierEndpoint: string;
60
- /**
61
- * Recommended quote-deadline budget in seconds, relative to signing time.
62
- */
63
- quoteDeadlineSeconds: number;
64
- /**
65
- * Recommended fulfillment-deadline budget in seconds, relative to signing time.
66
- */
67
- fulfillmentDeadlineSeconds: number;
68
- /**
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.
70
- */
71
- svmSignatureClusterId?: string;
72
- /**
73
- * Solana source only: escrow signature-domain version (V3 domain separation). Optional; required for a Solana source.
74
- */
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;
80
- }
81
-
82
- export type { AtumEscrowExtra };
package/dist/index.js CHANGED
@@ -1,14 +1,12 @@
1
1
  /*
2
- * Copyright (c) 2026 Atum Labs, Inc. All rights reserved.
3
- * Proprietary and confidential.
4
- * Access and use are governed by the LICENSE file distributed with this package.
5
- * Do not remove, alter, or obscure this notice.
2
+ * Copyright 2026 Atum Labs, Inc.
3
+ * SPDX-License-Identifier: Apache-2.0
6
4
  */
7
5
  import { createRequire as __atumCreateRequire } from 'module'; const require = __atumCreateRequire(import.meta.url);
8
6
  import {
9
- ensureSourceApproval,
7
+ import_payment_request_token_approval,
10
8
  registerClient
11
- } from "./chunk-ZFA5SSUP.js";
9
+ } from "./chunk-IGTT7XSG.js";
12
10
  import {
13
11
  PaymentRejectedError,
14
12
  SettlementFailedError,
@@ -21,7 +19,7 @@ import {
21
19
  isSettlementPending,
22
20
  registerServer,
23
21
  validateCorridor
24
- } from "./chunk-4YD6566T.js";
22
+ } from "./chunk-EWIOTGMO.js";
25
23
  import {
26
24
  ChargeRequestSchema,
27
25
  CredentialPayloadSchema,
@@ -29,7 +27,10 @@ import {
29
27
  INTENT_ID_META_KEY,
30
28
  METHOD_NAME,
31
29
  atumEscrowChargeMethod
32
- } from "./chunk-Z3AUNEU5.js";
30
+ } from "./chunk-LAWFMGYD.js";
31
+ var export_ensureSourceApproval = import_payment_request_token_approval.ensureSourceApproval;
32
+ var export_isUnconfirmed = import_payment_request_token_approval.isUnconfirmed;
33
+ var export_needsSourceApproval = import_payment_request_token_approval.needsSourceApproval;
33
34
  export {
34
35
  ChargeRequestSchema,
35
36
  CredentialPayloadSchema,
@@ -43,10 +44,12 @@ export {
43
44
  buildChargeChallenge,
44
45
  buildChargeRequest,
45
46
  corridorFromDefaults,
46
- ensureSourceApproval,
47
+ export_ensureSourceApproval as ensureSourceApproval,
47
48
  isPaymentRejected,
48
49
  isSettlementFailed,
49
50
  isSettlementPending,
51
+ export_isUnconfirmed as isUnconfirmed,
52
+ export_needsSourceApproval as needsSourceApproval,
50
53
  registerClient,
51
54
  registerServer,
52
55
  validateCorridor
@@ -1,37 +1,10 @@
1
+ import { t } from './sender-auth-verify-C-Q-zvAO.js';
1
2
  import * as z from 'zod/mini';
2
3
  import { PaymentRequest } from './generated/index.js';
3
4
  import { Challenge, Credential } from 'mppx';
4
5
 
5
6
  /**
6
- * A message that has been cryptographically signed to prove authorization.
7
- * The signature proves you control the wallet that's sending funds.
8
- *
9
- */
10
- type SignedMessage = {
11
- /**
12
- * The data that was signed. Format depends on the blockchain:
13
- * - EVM: Hex-encoded message hash (with 0x prefix)
14
- * - Solana: Base64 encoded message
15
- * - Tron: Hex-encoded message hash (possibly without 0x prefix)
16
- *
17
- */
18
- message: string;
19
- /**
20
- * Optional: If 'message' contains a hash, this field contains the original data
21
- * before it was hashed. Useful for verification and debugging.
22
- *
23
- */
24
- message_prehash?: string;
25
- /**
26
- * The cryptographic signature proving you authorized this message.
27
- * Format varies by blockchain (hex for EVM/Tron, base58 for Solana).
28
- *
29
- */
30
- signature: string;
31
- };
32
-
33
- /**
34
- * Chain defaults returned by the payment gateway /defaults endpoint.
7
+ * Chain defaults returned by the payment gateway /v1/defaults endpoint.
35
8
  */
36
9
  interface ChainDefaults {
37
10
  escrowContract: string;
@@ -40,9 +13,22 @@ interface ChainDefaults {
40
13
  fulfillmentVerifierEndpoint: string;
41
14
  fulfillmentProxy: string;
42
15
  permit2Contract?: string;
16
+ /**
17
+ * Which deposit witness the escrow deployed on this chain pins, surfaced by payment-gw
18
+ * `/v1/defaults` as `deposit_witness_version`. EVM/Tron only — Solana carries the
19
+ * same fact in `svmSignatureDomainVersion` below.
20
+ *
21
+ * `4` and above select the four-member witness
22
+ * (`depositRequestHash`, `destination`, `reserver`, `releaser`); `3` selects the two-member
23
+ * witness a not-yet-redeployed escrow pins. ABSENT means four — see the sender-auth package's
24
+ * `ChainDefaults.depositWitnessVersion` for why absence is the permissive default.
25
+ *
26
+ * Passed through to the sender_auth adapter verbatim; this type only has to carry it.
27
+ */
28
+ depositWitnessVersion?: number;
43
29
  /**
44
30
  * V3 Solana escrow domain-separation fields, surfaced by payment-gw
45
- * `/defaults` for Solana source chains. Used to build the EscrowDomain that the
31
+ * `/v1/defaults` for Solana source chains. Used to build the EscrowDomain that the
46
32
  * V3 deposit hash binds to. Absent for EVM/Tron.
47
33
  */
48
34
  svmSignatureClusterId?: string;
@@ -104,7 +90,7 @@ interface SenderSignature {
104
90
  }
105
91
  /** Signs a single sender_auth signed message for a payment request. */
106
92
  interface SenderSigner {
107
- sign(signedMessage: SignedMessage): Promise<SenderSignature>;
93
+ sign(signedMessage: t): Promise<SenderSignature>;
108
94
  }
109
95
  /** Turnkey provider configuration (shared by the SDK and the CLI env loader). */
110
96
  interface TurnkeyConfig {
@@ -115,7 +101,8 @@ interface TurnkeyConfig {
115
101
  /**
116
102
  * Chain-native address the signer is expected to resolve to. Verified against
117
103
  * the address Turnkey returns at initialize(); a mismatch fails fast rather
118
- * than signing as the wrong depositor.
104
+ * than signing as the wrong depositor. Omit it to skip the check; an empty
105
+ * value is rejected rather than treated as omitted.
119
106
  */
120
107
  pinnedAddress?: string;
121
108
  /**
@@ -125,7 +112,10 @@ interface TurnkeyConfig {
125
112
  logger?: Logger;
126
113
  meter?: Meter;
127
114
  }
128
- /** Options selecting a sender-signing provider. Defaults to the private-key provider. */
115
+ /**
116
+ * Options selecting a sender-signing provider. Defaults to the private-key provider.
117
+ * `pinnedAddress` behaves the same on both: omitted skips the sender check, empty is rejected.
118
+ */
129
119
  type SenderSignerOptions = {
130
120
  provider?: 'raw';
131
121
  privateKey: string;
@@ -134,6 +124,74 @@ type SenderSignerOptions = {
134
124
  provider: 'turnkey';
135
125
  } & TurnkeyConfig);
136
126
 
127
+ /**
128
+ * This file was automatically generated by json-schema-to-typescript.
129
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
130
+ * and run json-schema-to-typescript to regenerate this file.
131
+ */
132
+ /**
133
+ * 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.
134
+ */
135
+ interface AtumEscrowExtra$1 {
136
+ /**
137
+ * Where the merchant receives (CAIP-2 chain, token, address).
138
+ */
139
+ destination: {
140
+ /**
141
+ * CAIP-2 destination chain id (e.g. eip155:42161).
142
+ */
143
+ network: string;
144
+ /**
145
+ * Destination token contract address (EVM hex or base58, per the destination chain).
146
+ */
147
+ asset: string;
148
+ /**
149
+ * Merchant receive address (EVM hex or base58, per the destination chain).
150
+ */
151
+ address: string;
152
+ };
153
+ /**
154
+ * Exact amount the merchant receives, in atomic token units.
155
+ */
156
+ fulfillmentAmount: string;
157
+ /**
158
+ * Source-chain escrow contract (the x402 payTo); EVM hex or base58, per the source chain.
159
+ */
160
+ escrow: string;
161
+ /**
162
+ * Destination-chain fulfillment proxy contract (EVM hex or base58, per the destination chain).
163
+ */
164
+ fulfillmentProxy: string;
165
+ /**
166
+ * Atum reserver role address (escrow deposit witness); EVM hex or base58, per the source chain.
167
+ */
168
+ reserver: string;
169
+ /**
170
+ * Atum releaser role address (escrow deposit witness); EVM hex or base58, per the source chain.
171
+ */
172
+ releaser: string;
173
+ /**
174
+ * 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.
175
+ */
176
+ fulfillmentVerifierEndpoint: string;
177
+ /**
178
+ * Recommended quote-deadline budget in seconds, relative to signing time.
179
+ */
180
+ quoteDeadlineSeconds: number;
181
+ /**
182
+ * Recommended fulfillment-deadline budget in seconds, relative to signing time.
183
+ */
184
+ fulfillmentDeadlineSeconds: number;
185
+ /**
186
+ * 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.
187
+ */
188
+ svmSignatureClusterId?: string;
189
+ /**
190
+ * Solana source only: escrow signature-domain version (V3 domain separation). Optional; required for a Solana source.
191
+ */
192
+ svmSignatureDomainVersion?: number;
193
+ }
194
+
137
195
  /**
138
196
  * This file was automatically generated by json-schema-to-typescript.
139
197
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -223,10 +281,6 @@ interface AtumEscrowExtra {
223
281
  * Solana source only: escrow signature-domain version (V3 domain separation). Optional; required for a Solana source.
224
282
  */
225
283
  svmSignatureDomainVersion?: number;
226
- /**
227
- * 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.
228
- */
229
- issuedAt?: string;
230
284
  }
231
285
 
232
286
  /**
@@ -304,10 +358,19 @@ declare const CredentialPayloadSchema: z.ZodMiniObject<{
304
358
  }, z.core.$strip>;
305
359
  /**
306
360
  * The `charge` challenge request — the canonical `AtumEscrowRequest` shape (source option
307
- * + the destination/corridor `extra`). The runtime schema above is verified against this
308
- * type at compile time (below), so the validator and the canonical schema cannot drift.
361
+ * + the destination/corridor `extra`), plus the Solana issue time this scheme stamps.
362
+ *
363
+ * `issuedAt` is declared here rather than borrowed, because the shared x402 `extra` contract
364
+ * does not carry it: an x402 resource server rebuilds its requirements on the paid request and
365
+ * compares them against what the payer echoed, which no clock reading survives. MPP has no such
366
+ * rebuild, so a merchant-stamped issue time remains coherent here — and is declared where it is
367
+ * emitted ({@link buildChargeRequest}) rather than inherited from a contract that dropped it.
309
368
  */
310
- type ChargeRequest = AtumEscrowRequest;
369
+ type ChargeRequest = Omit<AtumEscrowRequest, 'extra'> & {
370
+ extra: AtumEscrowExtra$1 & {
371
+ issuedAt?: string;
372
+ };
373
+ };
311
374
  /** The `charge` credential payload, carrying the signed Atum payment request. */
312
375
  interface ChargeCredentialPayload {
313
376
  /** The signed Atum payment request: source/destination, amounts, and authorizations. */
@@ -318,7 +381,7 @@ interface ChargeCredentialPayload {
318
381
  * (equal to {@link ChargeRequest} by the compile-time guard above, and compatible with
319
382
  * the framework's `Record<string, unknown>` request constraint).
320
383
  */
321
- type AtumEscrowChallenge = Challenge.Challenge<z.infer<typeof ChargeRequestSchema>, "charge", "atum-escrow">;
384
+ type AtumEscrowChallenge = Challenge.Challenge<z.infer<typeof ChargeRequestSchema>, 'charge', 'atum-escrow'>;
322
385
  /** The MPP credential for this method. */
323
386
  type AtumEscrowCredential = Credential.Credential<ChargeCredentialPayload, AtumEscrowChallenge>;
324
387
  /**
@@ -362,4 +425,4 @@ declare const atumEscrowChargeMethod: {
362
425
  };
363
426
  };
364
427
 
365
- export { type AtumEscrowChallenge as A, type ChargeCredentialPayload as C, INTENT as I, METHOD_NAME as M, type SenderSigner as S, type AtumEscrowCredential as a, type AtumEscrowRequest as b, type ChargeRequest as c, ChargeRequestSchema as d, CredentialPayloadSchema as e, INTENT_ID_META_KEY as f, type SenderSignerOptions as g, atumEscrowChargeMethod as h, type SolanaClusterUnixTimeReader as i, type ChainDefaults as j };
428
+ export { type AtumEscrowChallenge as A, type ChargeCredentialPayload as C, INTENT as I, METHOD_NAME as M, type SenderSigner as S, type AtumEscrowCredential as a, type AtumEscrowExtra$1 as b, type AtumEscrowRequest as c, type ChargeRequest as d, ChargeRequestSchema as e, CredentialPayloadSchema as f, INTENT_ID_META_KEY as g, type SenderSignerOptions as h, atumEscrowChargeMethod as i, type ChainDefaults as j, type SolanaClusterUnixTimeReader as k };