@atumlabs/payment-gateway-client 3.0.1 → 4.0.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.
@@ -87,6 +87,13 @@ type PaymentRequest = {
87
87
  * point no new quotes are accepted. The gateway injects no default and validates the value
88
88
  * is in the future. The originator must supply it, and a request that omits it or supplies
89
89
  * a past value is rejected with 400.
90
+ *
91
+ * Keep this window short. A settler holds its quoted price for a limited period of its
92
+ * own choosing, and the gateway selects only once the window has closed, so a deadline
93
+ * set beyond that hold leaves no quote still awardable and the request is declined with
94
+ * QUOTE_WINDOW_TOO_LONG. That hold is set by each settler and is not part of this
95
+ * contract, so treat 60 seconds as a practical upper bound and prefer a shorter window
96
+ * where your integration allows.
90
97
  */
91
98
  quote_deadline: string;
92
99
  /**
@@ -96,6 +103,14 @@ type PaymentRequest = {
96
103
  * supplies a past value is rejected with 400.
97
104
  */
98
105
  fulfillment_deadline: string;
106
+ /**
107
+ * Who performs each leg of the payment. Omitted on the wire means settler for every leg. The split object keeps deposit, reserve, and fulfill as separate keys.
108
+ */
109
+ executor?: 'settler' | 'originator' | {
110
+ deposit: 'settler' | 'originator';
111
+ reserve: 'settler' | 'originator';
112
+ fulfill: 'settler' | 'originator';
113
+ };
99
114
  /**
100
115
  * Policy requirements for settler authentication. Keys are policy names, values indicate if the policy is required.
101
116
  */
@@ -110,10 +125,11 @@ type PaymentRequest = {
110
125
  */
111
126
  quote_selector?: string;
112
127
  /**
113
- * Third-party service that will independently verify your payment was delivered.
114
- * Leave empty to use the default verifier.
128
+ * The verification service that confirms the payment was delivered before the escrow
129
+ * releases the source funds, and the account it signs with. Required on every chain:
130
+ * the gateway's `/v1/defaults` response supplies it for each chain.
115
131
  */
116
- fulfillment_verifier?: {
132
+ fulfillment_verifier: {
117
133
  /**
118
134
  * The wallet address or public key of the verification service
119
135
  */
@@ -126,9 +142,9 @@ type PaymentRequest = {
126
142
  endpoint: string;
127
143
  };
128
144
  /**
129
- * Escrow contract address, used to protect source funds until proof of fulfillment has been verified. Leave empty to use the default.
145
+ * Escrow contract on the source chain that holds the source funds until proof of fulfillment has been verified. Required on every chain. Take the value for the source chain from the payment gateway's GET /v1/defaults (`escrow_contract`).
130
146
  */
131
- escrow_contract_address?: string;
147
+ escrow_contract_address: string;
132
148
  /**
133
149
  * Fulfillment Proxy contract address, used to emit proof of fulfillment on the destination chain. Leave empty to use the default.
134
150
  */
@@ -147,6 +163,47 @@ type PaymentRequest = {
147
163
  blacklist?: Array<(string)>;
148
164
  };
149
165
  };
166
+ type deposit = 'settler' | 'originator';
167
+ type reserve = 'settler' | 'originator';
168
+ type fulfill = 'settler' | 'originator';
169
+ /**
170
+ * Authorization for an originator to fulfill a payment request. The settler produces this declaration after authorizeFulfillment when the payment request's fulfill executor is "originator". A settler fulfill does not produce it.
171
+ *
172
+ * Canonical JSON Schema: schemas/declarations/FulfillmentAuthorization/v1/schema.json
173
+ * Published at https://schemas.atum.xyz/declarations/FulfillmentAuthorization/v1
174
+ */
175
+ type FulfillmentAuthorization = {
176
+ /**
177
+ * Semver-shaped declaration version (MAJOR.MINOR). The major component is locked to this schema's parent directory (v1 → major must be 1).
178
+ */
179
+ version: string;
180
+ /**
181
+ * Authorization scheme.
182
+ */
183
+ scheme: 'EIP-3009';
184
+ /**
185
+ * Signed authorization. For scheme EIP-3009, message_prehash is the EIP-712 TransferWithAuthorization typed data as a JSON string ({domain, types, primaryType, message}, with uint256 values as decimal strings), message is its EIP-712 digest, signature is the settler's 65-byte signature over that digest, and payload is absent. message.validBefore is the payment request's fulfillment_deadline in whole unix seconds, and message.nonce is the fulfillment quote hash.
186
+ */
187
+ authorization: SignedMessage;
188
+ /**
189
+ * Raw JSON of the fulfillment quote (schemas/declarations/FulfillmentQuote/v1/schema.json), including proof metadata so its canonical quote hash can be computed.
190
+ */
191
+ fulfillment_quote_json: string;
192
+ /**
193
+ * Pointer to the on-chain evidence of the fulfillment authorization.
194
+ */
195
+ evidence: {
196
+ /**
197
+ * Chain transaction identifier. EVM transactions are 0x-prefixed hex, Tron transactions are hex without that prefix, and Solana transactions are base58.
198
+ */
199
+ transaction_id: string;
200
+ log_index: number;
201
+ };
202
+ };
203
+ /**
204
+ * Authorization scheme.
205
+ */
206
+ type scheme = 'EIP-3009';
150
207
  /**
151
208
  * Confirmation details after a payment has been successfully delivered.
152
209
  * Contains proof of delivery and transaction details for both source and destination chains.
@@ -168,7 +225,7 @@ type FulfillmentConfirmation = {
168
225
  /**
169
226
  * Timestamp when the fulfillment was completed
170
227
  */
171
- fulfillment_timestamp: string;
228
+ fulfillment_timestamp?: string;
172
229
  /**
173
230
  * The blockchain where funds were locked in escrow, using CAIP-2 format.
174
231
  * CAIP-2 is a standard way to identify blockchains: {namespace}:{reference}
@@ -194,11 +251,11 @@ type FulfillmentConfirmation = {
194
251
  /**
195
252
  * Transaction hash of the escrow reservation on the source chain
196
253
  */
197
- source_tx_hash?: string;
254
+ source_tx_hash: string;
198
255
  /**
199
256
  * Transaction hash of the fulfillment on the destination chain
200
257
  */
201
- destination_tx_hash?: string;
258
+ destination_tx_hash: string;
202
259
  /**
203
260
  * Block number where the source transaction was confirmed
204
261
  */
@@ -264,14 +321,12 @@ type SenderAuthMessageScheme = 'EVM_PERMIT2' | 'EVM_PERMIT2_ESCROW' | 'SOLANA' |
264
321
  */
265
322
  type SignedMessage = {
266
323
  /**
267
- * The data that was signed. Format depends on the blockchain:
268
- * - EVM: Hex-encoded message hash (with 0x prefix)
269
- * - Solana: Hex-encoded message hash (with 0x prefix)
270
- * - Tron: Hex-encoded message hash (possibly without 0x prefix)
324
+ * The data that was signed, hex-encoded with a 0x prefix on every supported chain. For the deposit (signed_messages[0]) it is the 32-byte hash of message_prehash.
271
325
  */
272
326
  message: string;
273
327
  /**
274
- * Optional: If 'message' contains a hash, this field contains the original data before it was hashed. Useful for verification and debugging.
328
+ * The original data that `message` is the hash of. Required on every entry of a payment
329
+ * request's `sender_auth.signed_messages`: the gateway reads the signed terms from it.
275
330
  */
276
331
  message_prehash?: string;
277
332
  /**
@@ -363,9 +418,20 @@ type VerifiableCredential = {
363
418
  * - `completed`: delivered, with the required confirmations behind it.
364
419
  * - `failed`: did not complete. Any funds held in escrow are returned, and `error`
365
420
  * describes what went wrong.
421
+ * - `refunding`: the settler will not deliver this payment and your funds are being
422
+ * returned from escrow. NOT FINAL: it becomes `refund_available` or `refunded`, and it
423
+ * can still become `completed` or `failed`.
424
+ * - `refund_available`: the settler did not deliver and the refund is authorized for you
425
+ * to submit. GET /v1/payments/{paymentId}/status returns `refund_signature`, which you
426
+ * submit to the source escrow to return your funds. The other responses report this
427
+ * status without the signature. NOT FINAL: the funds are still in escrow, so it becomes
428
+ * `refunded` once the refund lands, or `completed` if the settler delivers late and is
429
+ * paid first. Do not pay again while it is `refund_available`.
430
+ * - `refunded`: your funds were returned from the source escrow. `transactions.refund` is
431
+ * the refund transaction, when it is known.
366
432
  *
367
- * `completed` and `failed` are final and will not change afterwards. `pending` and
368
- * `finalizing` will.
433
+ * `completed`, `failed` and `refunded` are final and will not change afterwards.
434
+ * `pending`, `finalizing`, `refunding` and `refund_available` will.
369
435
  *
370
436
  * **Do not treat `finalizing` as delivered.** It says the payment has been made on
371
437
  * chain but is not yet irreversible, much as a card authorization is not yet a
@@ -379,7 +445,7 @@ type VerifiableCredential = {
379
445
  * the recipient yet.
380
446
  *
381
447
  */
382
- type PaymentStatus = 'pending' | 'finalizing' | 'completed' | 'failed';
448
+ type PaymentStatus = 'pending' | 'finalizing' | 'completed' | 'failed' | 'refunding' | 'refund_available' | 'refunded';
383
449
  /**
384
450
  * One on-chain transaction belonging to a payment: which chain, which transaction, and
385
451
  * which block it landed in.
@@ -413,9 +479,10 @@ type PaymentTransaction = {
413
479
  * The transactions a payment has produced, one entry per stage, added as each becomes
414
480
  * known. A stage absent here has produced no transaction yet.
415
481
  *
416
- * These are the two movements that decide whether your payment happened: your funds
417
- * being committed, and your recipient being paid. Present on every outcome, so a
418
- * payment that did not complete can still be traced on chain.
482
+ * These are the movements that decide whether your payment happened: your funds being
483
+ * committed, your recipient being paid, and your funds being returned when the payment
484
+ * is refunded. Present on every outcome, so a payment that did not complete can still be
485
+ * traced on chain.
419
486
  * `fulfillment_confirmation` is not a substitute: it is written only once a payment
420
487
  * completes, and describes the finished delivery rather than progress towards it.
421
488
  *
@@ -432,6 +499,39 @@ type PaymentTransactions = {
432
499
  * Paying your recipient on the destination chain.
433
500
  */
434
501
  fulfillment?: PaymentTransaction;
502
+ /**
503
+ * Returning your funds from the escrow on the source chain. Can be absent on a
504
+ * `refunded` payment when the refund transaction is not known.
505
+ *
506
+ */
507
+ refund?: PaymentTransaction;
508
+ };
509
+ /**
510
+ * The refund authorization for a `refund_available` payment, as the verifier signed it.
511
+ * Submit it to the source chain's escrow `refund` to return your funds yourself.
512
+ *
513
+ * Anyone holding it can submit the refund, but the escrow only ever pays the depositor. If
514
+ * the settler delivers late and is paid first, the refund no longer goes through.
515
+ * On Solana the submitter also receives the rent of the deposit account the refund closes.
516
+ *
517
+ */
518
+ type RefundSignature = {
519
+ /**
520
+ * The verifier's signature over `message_hash`. Hex with the `0x` prefix on EVM and
521
+ * Tron chains, hex without it on Solana.
522
+ *
523
+ */
524
+ signature: string;
525
+ /**
526
+ * The signed digest, hex without the `0x` prefix.
527
+ */
528
+ message_hash: string;
529
+ /**
530
+ * The signed message as JSON. On EVM and Tron chains it carries the RefundWitness the
531
+ * escrow's `refund` takes.
532
+ *
533
+ */
534
+ message_prehash: string;
435
535
  };
436
536
  /**
437
537
  * Response from submitting a payment request. If settlement completes inside the
@@ -522,7 +622,63 @@ type PaymentResponse = {
522
622
  [key: string]: unknown;
523
623
  };
524
624
  fulfillment_confirmation?: FulfillmentConfirmation;
625
+ /**
626
+ * The settler-signed FulfillmentAuthorization for this payment, returned verbatim as an
627
+ * opaque signed document (structurally the canonical FulfillmentAuthorization/v1 declaration at
628
+ * https://schemas.atum.xyz/declarations/FulfillmentAuthorization/v1; see also
629
+ * `#/components/schemas/FulfillmentAuthorization`). The inner declaration requires
630
+ * `version`, `scheme`, `authorization` (the signed EIP-3009 transfer, in `authorization.message_prehash`), `fulfillment_quote_json`,
631
+ * and `evidence` (the on-chain authorizeFulfillment transaction). On the wire the settler
632
+ * typically wraps that declaration in JSON-LD with `@context`, `type`, and `proof` — those
633
+ * envelope fields ride alongside the declaration and MUST be preserved byte-for-byte.
634
+ *
635
+ * Present when the settler authorized an originator fulfill. Mutually exclusive with
636
+ * `fulfillment_confirmation` until the originator fulfills: when this field is populated,
637
+ * `fulfillment_confirmation` is absent.
638
+ *
639
+ * The service returns these bytes verbatim and does not re-serialize through a typed
640
+ * representation (which would normalize timestamps and reorder JSON-LD envelope fields).
641
+ *
642
+ */
643
+ fulfillment_authorization?: {
644
+ [key: string]: unknown;
645
+ };
525
646
  error?: PaymentFailure;
647
+ /**
648
+ * Why the settler did not deliver, as it reported when it gave up. Present only when
649
+ * `status` is `refunding`, `refund_available` or `refunded`, and absent when the refund
650
+ * started without a reason from the settler. `status` decides what to do next: its
651
+ * `retry_classification` and `request_id_reusable` describe the settler's error, not
652
+ * this payment, and never mean paying again while it is `refunding` or `refund_available`.
653
+ *
654
+ */
655
+ refund_reason?: PaymentFailure;
656
+ /**
657
+ * How many settler agents this payment's auction was broadcast to. Accompanies
658
+ * `decline_summary` and is present under the same condition. Same meaning and same
659
+ * absence rule as on GET /v1/payments/{paymentId}/status: absent means unknown, never
660
+ * zero.
661
+ *
662
+ */
663
+ requested_count?: number;
664
+ /**
665
+ * Why the payment drew few or no quotes, carried on the submission response so that a
666
+ * `failed` payment explains itself here rather than requiring a follow-up read. A
667
+ * payment that ran out its quote deadline reports `NO_QUOTES_RECEIVED` on `error`;
668
+ * this is what the settlers actually said.
669
+ *
670
+ * Present when `status` is `failed`, alongside `error`. A submission rejected before
671
+ * its auction opened is answered as an error response rather than this type and carries
672
+ * no breakdown, and GET /v1/payments/{paymentId}/status reports the breakdown in every
673
+ * state.
674
+ *
675
+ * Same counting rules as GET /v1/payments/{paymentId}/status: every declining agent is
676
+ * counted exactly once under its most recent reason, empty means no agent declined,
677
+ * absent means the breakdown could not be read. The free-form decline detail is never
678
+ * relayed.
679
+ *
680
+ */
681
+ decline_summary?: Array<DeclineSummaryEntry>;
526
682
  };
527
683
  type GetPaymentStatusResponse = {
528
684
  /**
@@ -569,7 +725,41 @@ type GetPaymentStatusResponse = {
569
725
  [key: string]: unknown;
570
726
  };
571
727
  fulfillment_confirmation?: FulfillmentConfirmation;
728
+ /**
729
+ * The settler-signed FulfillmentAuthorization for this payment, returned verbatim as an
730
+ * opaque signed document (structurally the canonical FulfillmentAuthorization/v1 declaration at
731
+ * https://schemas.atum.xyz/declarations/FulfillmentAuthorization/v1; see also
732
+ * `#/components/schemas/FulfillmentAuthorization`). The inner declaration requires
733
+ * `version`, `scheme`, `authorization` (the signed EIP-3009 transfer, in `authorization.message_prehash`), `fulfillment_quote_json`,
734
+ * and `evidence` (the on-chain authorizeFulfillment transaction). On the wire the settler
735
+ * typically wraps that declaration in JSON-LD with `@context`, `type`, and `proof` — those
736
+ * envelope fields ride alongside the declaration and MUST be preserved byte-for-byte.
737
+ *
738
+ * Present when the settler authorized an originator fulfill. Mutually exclusive with
739
+ * `fulfillment_confirmation` until the originator fulfills: when this field is populated,
740
+ * `fulfillment_confirmation` is absent.
741
+ *
742
+ * The service returns these bytes verbatim and does not re-serialize through a typed
743
+ * representation (which would normalize timestamps and reorder JSON-LD envelope fields).
744
+ *
745
+ */
746
+ fulfillment_authorization?: {
747
+ [key: string]: unknown;
748
+ };
572
749
  error?: PaymentFailure;
750
+ /**
751
+ * Why the settler did not deliver, as it reported when it gave up. Present only when
752
+ * `status` is `refunding`, `refund_available` or `refunded`, and absent when the refund
753
+ * started without a reason from the settler. `status` decides what to do next: its
754
+ * `retry_classification` and `request_id_reusable` describe the settler's error, not
755
+ * this payment, and never mean paying again while it is `refunding` or `refund_available`.
756
+ *
757
+ */
758
+ refund_reason?: PaymentFailure;
759
+ /**
760
+ * Present only when `status` is `refund_available`.
761
+ */
762
+ refund_signature?: RefundSignature;
573
763
  /**
574
764
  * How many settler agents this payment's auction was broadcast to. Absent means
575
765
  * unknown, never zero.
@@ -591,7 +781,8 @@ type GetPaymentStatusResponse = {
591
781
  decline_summary?: Array<DeclineSummaryEntry>;
592
782
  };
593
783
  /**
594
- * Why a payment failed. Present only when `status` is `failed`, and identical
784
+ * Why a payment failed, or why its settler gave up. As `error` it is present only when
785
+ * `status` is `failed`, as `refund_reason` only on the refund statuses, and it is identical
595
786
  * however you ask about the payment.
596
787
  *
597
788
  * `code` is the stable, machine-readable identity of the failure — branch on it
@@ -628,6 +819,10 @@ type PaymentFailure = {
628
819
  * Re-sending the same `request_id` is an idempotent replay and always safe. This value is about submitting a new one, which starts a new payment. See https://docs.atum.xyz/errors for the value set.
629
820
  */
630
821
  retry_classification?: string;
822
+ /**
823
+ * Whether the caller may re-send the `request_id` this payment was created under. On this shape it is almost always false, because a payment exists by definition, but it is carried rather than assumed so a caller reads the same field here as on a synchronous error. Absent means undetermined, which a caller should read as false.
824
+ */
825
+ request_id_reusable?: boolean;
631
826
  blockchain_context?: PaymentBlockchainContext;
632
827
  };
633
828
  /**
@@ -781,6 +976,15 @@ type PaymentTimelineResponse = {
781
976
  total_duration_ms?: number;
782
977
  summary?: PaymentSummary;
783
978
  error?: PaymentFailure;
979
+ /**
980
+ * Why the settler did not deliver, as it reported when it gave up. Present only when
981
+ * `status` is `refunding`, `refund_available` or `refunded`, and absent when the refund
982
+ * started without a reason from the settler. `status` decides what to do next: its
983
+ * `retry_classification` and `request_id_reusable` describe the settler's error, not
984
+ * this payment, and never mean paying again while it is `refunding` or `refund_available`.
985
+ *
986
+ */
987
+ refund_reason?: PaymentFailure;
784
988
  steps: Array<TimelineStep>;
785
989
  };
786
990
  /**
@@ -897,6 +1101,10 @@ type ErrorResponse = {
897
1101
  * Re-sending the same `request_id` is an idempotent replay and always safe. This value is about submitting a new one, which starts a new operation. See https://docs.atum.xyz/errors for the value set.
898
1102
  */
899
1103
  retry_classification?: string;
1104
+ /**
1105
+ * Whether the caller may re-send this same request_id. True means no payment was created for it, so the id is still free. False means a payment exists for it, so the id is spent and re-sending only replays this outcome. Absent means undetermined, which a caller should read as false. Separate from retry_classification, which answers what the caller must change rather than whether the id survived.
1106
+ */
1107
+ request_id_reusable?: boolean;
900
1108
  };
901
1109
  /**
902
1110
  * Request body for opening a quote-request batch. Structurally the existing PaymentRequest
@@ -940,6 +1148,13 @@ type CreateQuoteRequest = {
940
1148
  * value is carried through verbatim to the award call. It must be supplied and must be in
941
1149
  * the future. Must be strictly earlier than fulfillment_deadline.
942
1150
  *
1151
+ * Keep this window short. A settler holds its quoted price for a limited period of its
1152
+ * own choosing, and the gateway selects only once the window has closed, so a deadline
1153
+ * set beyond that hold leaves no quote still awardable and the request is declined with
1154
+ * QUOTE_WINDOW_TOO_LONG. That hold is set by each settler and is not part of this
1155
+ * contract, so treat 60 seconds as a practical upper bound and prefer a shorter window
1156
+ * where your integration allows.
1157
+ *
943
1158
  */
944
1159
  quote_deadline: string;
945
1160
  /**
@@ -964,9 +1179,12 @@ type CreateQuoteRequest = {
964
1179
  */
965
1180
  quote_selector?: string;
966
1181
  /**
967
- * Optional third-party service that independently verifies delivery. Leave empty for the default verifier.
1182
+ * The verification service that confirms the payment was delivered before the escrow
1183
+ * releases the source funds, and the account it signs with. Required on every chain:
1184
+ * the gateway's `/v1/defaults` response supplies it for each chain.
1185
+ *
968
1186
  */
969
- fulfillment_verifier?: {
1187
+ fulfillment_verifier: {
970
1188
  /**
971
1189
  * The wallet address or public key of the verification service
972
1190
  */
@@ -980,9 +1198,12 @@ type CreateQuoteRequest = {
980
1198
  endpoint: string;
981
1199
  };
982
1200
  /**
983
- * Optional escrow contract address. Leave empty to use the default.
1201
+ * Escrow contract on the source chain that holds the source funds until proof of
1202
+ * fulfillment has been verified. Required on every chain: the gateway's `/v1/defaults`
1203
+ * response supplies it for each chain (`escrow_contract`).
1204
+ *
984
1205
  */
985
- escrow_contract_address?: string;
1206
+ escrow_contract_address: string;
986
1207
  /**
987
1208
  * Optional fulfillment-proxy contract address on the destination chain. Leave empty to use the default.
988
1209
  */
@@ -1451,6 +1672,27 @@ type AwardResponse = {
1451
1672
  */
1452
1673
  status: 'awarding' | 'completed' | 'failed' | 'cancelled';
1453
1674
  fulfillment_confirmation?: FulfillmentConfirmation;
1675
+ /**
1676
+ * The settler-signed FulfillmentAuthorization for this payment, returned verbatim as an
1677
+ * opaque signed document (structurally the canonical FulfillmentAuthorization/v1 declaration at
1678
+ * https://schemas.atum.xyz/declarations/FulfillmentAuthorization/v1; see also
1679
+ * `#/components/schemas/FulfillmentAuthorization`). The inner declaration requires
1680
+ * `version`, `scheme`, `authorization` (the signed EIP-3009 transfer, in `authorization.message_prehash`), `fulfillment_quote_json`,
1681
+ * and `evidence` (the on-chain authorizeFulfillment transaction). On the wire the settler
1682
+ * typically wraps that declaration in JSON-LD with `@context`, `type`, and `proof` — those
1683
+ * envelope fields ride alongside the declaration and MUST be preserved byte-for-byte.
1684
+ *
1685
+ * Present when the settler authorized an originator fulfill within the sync wait.
1686
+ * Mutually exclusive with `fulfillment_confirmation` until the originator fulfills: when
1687
+ * this field is populated, `fulfillment_confirmation` is absent.
1688
+ *
1689
+ * The service returns these bytes verbatim and does not re-serialize through a typed
1690
+ * representation (which would normalize timestamps and reorder JSON-LD envelope fields).
1691
+ *
1692
+ */
1693
+ fulfillment_authorization?: {
1694
+ [key: string]: unknown;
1695
+ };
1454
1696
  };
1455
1697
  /**
1456
1698
  * Payment lifecycle status on the award response:
@@ -1519,10 +1761,6 @@ type ChainDefaults = {
1519
1761
  * The Permit2 this chain's escrow verifies against, sent only when it is not the canonical deployment. When absent, use the canonical Permit2 address for the chain. EVM and Tron only.
1520
1762
  */
1521
1763
  permit2_contract?: string;
1522
- /**
1523
- * Which deposit witness this chain's escrow expects. `4` and above select the four-member witness, `3` the two-member one; absent means four. EVM and Tron only - on Solana this is carried by `svm_signature_domain_version`.
1524
- */
1525
- deposit_witness_version?: number;
1526
1764
  /**
1527
1765
  * Tokens this chain's escrow accepts for deposit. Absent when the gateway has no listing for the chain, which does not mean no token is accepted.
1528
1766
  */
@@ -1542,9 +1780,13 @@ type ChainDefaults = {
1542
1780
  */
1543
1781
  svm_signature_cluster_id?: string;
1544
1782
  /**
1545
- * Solana only. Version of the escrow's signing domain. Absent for EVM and Tron.
1783
+ * Solana only. The escrow's signature domain version, which the deposit hash commits to. Absent for EVM and Tron.
1546
1784
  */
1547
1785
  svm_signature_domain_version?: number;
1786
+ /**
1787
+ * The depositRequestHash version to sign for a deposit from this chain: 1 is keccak256 of the request_id, 2 is the hash of the payment terms, computed over the request body exactly as it is then posted. Absent means 1. A deposit signed with version 1 is still accepted while the gateway publishes 2. The gateway publishes 2 for a chain only once every reader of the deposit there reads version 2, veri-fill's release check included, so this is the network-wide signal a client signs by and a merchant lists 2 in an x402 or MPP challenge by.
1788
+ */
1789
+ deposit_request_hash_version?: number;
1548
1790
  };
1549
1791
  /**
1550
1792
  * Either one chain's defaults or every chain keyed by CAIP-2 chain id, depending on whether `chain_id` was supplied. A top-level `chain_id` identifies the first.
@@ -1949,18 +2191,39 @@ interface ParsedPermit {
1949
2191
  spender?: string;
1950
2192
  /** Solana only (the signed depositor). */
1951
2193
  depositor?: string;
1952
- /**
1953
- * The escrow commitments as actually signed. EVM only today: Tron signs the frozen
1954
- * two-member witness and the Solana prehash has no destination member, so both leave these
1955
- * undefined. Undefined means "this scheme does not carry the commitment", NOT "the commitment
1956
- * was absent" — on EVM an absent one is rejected as a malformed prehash and never gets here.
1957
- */
2194
+ /** The escrow commitments as signed: the payee and the hash of the request id. */
1958
2195
  destination?: string;
1959
2196
  depositRequestHash?: string;
1960
2197
  }
1961
- /** One verified `signed_messages[]` entry: the signed terms plus the parsed permit. */
2198
+ /** How the destination commitment check ended. Only `verified` admits a payment. */
2199
+ type CommitmentOutcome = 'verified' | 'scheme_mismatch' | 'commitment_absent' | 'prehash_mismatch' | 'signer_mismatch' | 'destination_mismatch' | 'request_hash_mismatch' | 'request_malformed' | 'verifier_misconfigured' | 'quote_request_mismatch';
2200
+ /** The destination commitment check's result: the outcome and both copies of the payee. */
2201
+ interface CommitmentResult {
2202
+ outcome: CommitmentOutcome;
2203
+ detail: string;
2204
+ namespace: string;
2205
+ scheme: string;
2206
+ signedDestination: string;
2207
+ expectedDestination: string;
2208
+ signedDepositRequestHash: string;
2209
+ expectedDepositRequestHash: string;
2210
+ /** The request's depositRequestHash v2, when the check was given one (opted in, and the strict reader admitted the request). */
2211
+ expectedDepositRequestHashV2?: string;
2212
+ /** Why the strict reader refused the request, with `depositRequestHashV2Mode: 'audit'`. */
2213
+ strictDetail?: string;
2214
+ /** The depositRequestHash version the deposit matched, once opted in with `depositRequestHashV2Mode`. */
2215
+ depositRequestHashVersion?: 'v1' | 'v2';
2216
+ }
2217
+ /** The Solana escrow signature domain, from your chain configuration. */
2218
+ interface SolanaDomain {
2219
+ escrowProgramId: string;
2220
+ clusterId: string;
2221
+ domainVersion: number;
2222
+ }
2223
+ /** One verified `signed_messages[]` entry: the signed terms, the parsed permit and the commitment. */
1962
2224
  interface VerifiedSenderAuth extends AuthTerms {
1963
2225
  permit: ParsedPermit;
2226
+ commitment: CommitmentResult;
1964
2227
  }
1965
2228
  /** What {@link verifyPaymentRequest} returns. */
1966
2229
  interface VerifyResult {
@@ -1968,13 +2231,19 @@ interface VerifyResult {
1968
2231
  results: VerifiedSenderAuth[];
1969
2232
  /** The `source.account` every signature was verified to recover to. */
1970
2233
  recoveredAccount: string;
2234
+ /**
2235
+ * The commitment check's result, once {@link verifyPaymentRequestJSON} is opted in with
2236
+ * `depositRequestHashV2Mode`: the depositRequestHash version the deposit matched and, in audit mode,
2237
+ * `strictDetail`. Absent otherwise.
2238
+ */
2239
+ commitment?: CommitmentResult;
1971
2240
  }
1972
2241
  /**
1973
2242
  * Expectations for {@link verifyPaymentRequest}.
1974
2243
  *
1975
- * The first three are what turn this into a check against YOUR terms. Omit them and the token,
2244
+ * Pass the first three to check the signatures against your own terms. When omitted, the token,
1976
2245
  * network and amount are taken from the request itself, which proves only that the signatures
1977
- * are self-consistent with fields the request's author controls.
2246
+ * are consistent with fields the request's author controls.
1978
2247
  */
1979
2248
  interface VerifyPaymentRequestExpectations {
1980
2249
  /** Authoritative source-asset address (bare token, no CAIP prefix). */
@@ -1987,9 +2256,6 @@ interface VerifyPaymentRequestExpectations {
1987
2256
  escrowContract?: string;
1988
2257
  reserver?: string;
1989
2258
  releaser?: string;
1990
- /** Opt-in commitment checks. Compose `destination` from the REQUEST's destination. */
1991
- destination?: string;
1992
- requestId?: string;
1993
2259
  /** Solana: additionally required by the deposit-hash domain, independent of role binding. */
1994
2260
  svmSignatureClusterId?: string;
1995
2261
  svmSignatureDomainVersion?: number;
@@ -1997,17 +2263,54 @@ interface VerifyPaymentRequestExpectations {
1997
2263
  permit2Contract?: string;
1998
2264
  /** Freshness reference, Unix seconds. Defaults to now. */
1999
2265
  nowSec?: number;
2266
+ /**
2267
+ * How {@link verifyPaymentRequestJSON} reads depositRequestHash v2. Absent, only v1 is accepted, as
2268
+ * before v2. `audit` also accepts v2 and reports a request the strict reader refuses; `enforce`
2269
+ * also accepts v2 and refuses such a request. {@link verifyPaymentRequest} accepts only v1 and
2270
+ * refuses it as `verifier_misconfigured`.
2271
+ */
2272
+ depositRequestHashV2Mode?: 'audit' | 'enforce';
2000
2273
  }
2001
2274
  /**
2002
2275
  * Recovers every `sender_auth.signed_messages[]` entry and binds the signed terms to
2003
2276
  * `expected`, returning the parsed permits and the account they all recover to.
2004
2277
  *
2005
- * Strict by design: every entry must be a bindable permit, and a malformed one throws rather
2006
- * than being skipped. A caller with deliberately mixed messages — an EVM setup approval
2007
- * alongside the permit, say — must compose the per-entry adapter calls itself.
2278
+ * Every deposit must commit to the request's own `destination` and `request_id`, so a request
2279
+ * whose payee or request id was changed after signing is refused.
2008
2280
  *
2009
- * This is the sender_auth layer only. Request-shape and per-consumer policy are the caller's.
2281
+ * Every entry must be a bindable permit; a malformed entry throws. A caller with mixed messages
2282
+ * (for example an EVM setup approval alongside the permit) composes the per-entry adapter calls
2283
+ * itself. Request-shape and policy checks remain the caller's.
2284
+ *
2285
+ * @throws If any entry fails to recover, bind, or match `expected`.
2286
+ * @deprecated A parsed request keeps one value for a member name that appears twice, so this
2287
+ * checks a copy of the request rather than the text received, and it accepts only
2288
+ * depositRequestHash v1. Use {@link verifyPaymentRequestJSON} with the request as received.
2010
2289
  */
2011
2290
  declare function verifyPaymentRequest(request: PaymentRequest, expected?: VerifyPaymentRequestExpectations): VerifyResult;
2291
+ /**
2292
+ * Recovers every `sender_auth.signed_messages[]` entry of the request as received and binds the
2293
+ * signed terms to `expected`, returning the parsed permits and the account they all recover to. It
2294
+ * refuses a repeated member name, including names that differ only in letter case, where it reads,
2295
+ * and every deposit must commit to the request's own `destination` and request: depositRequestHash
2296
+ * v1 by default, v1 or v2 with `expected.depositRequestHashV2Mode`, which also returns the commitment
2297
+ * check's result as `commitment`.
2298
+ *
2299
+ * @throws If the JSON is ambiguous or does not decode, or if any entry fails to recover, bind, or
2300
+ * match `expected`; {@link commitmentResultOf} returns the outcome.
2301
+ */
2302
+ declare function verifyPaymentRequestJSON(request: string | Uint8Array, expected?: VerifyPaymentRequestExpectations): VerifyResult;
2303
+ /**
2304
+ * The payee check alone, over the request's JSON: the deposit must commit to the request's own
2305
+ * `destination` and `request_id`. It does not recover the signer, so it also serves a
2306
+ * contract-account payer (ERC-1271, such as a Safe), whose signature Permit2 checks on chain.
2307
+ * `solana` is required for a Solana source. `options.depositRequestHashV2Mode` also accepts a deposit
2308
+ * that commits depositRequestHash v2, as it does for {@link verifyPaymentRequestJSON}.
2309
+ *
2310
+ * @throws If the check refuses; {@link commitmentResultOf} returns the outcome.
2311
+ */
2312
+ declare function verifyRequestCommitment(request: string | Uint8Array, solana?: SolanaDomain, options?: Pick<VerifyPaymentRequestExpectations, 'depositRequestHashV2Mode'>): CommitmentResult;
2313
+ /** The commitment result a verification error carries, if any; log its outcome and detail. */
2314
+ declare function commitmentResultOf(error: unknown): CommitmentResult | undefined;
2012
2315
 
2013
- export { type $OpenApiTs as $, type AuthTerms as A, type AwardedPayment as B, type CreateQuoteRequestData as C, type AwardedQuote as D, type ErrorResponse as E, type BidAward as F, type GetDefaultsData as G, type HealthCheckResponse as H, type ChainDefaultsByChain as I, type ChainDefaults as J, type DataIntegrityProof as K, type DeclineReason as L, type DeclineSummaryEntry as M, type FulfillmentConfirmation as N, type GetDefaultsResult as O, type PaymentRequest as P, type GetPaymentStatusResponse as Q, type ResolvePaymentData as R, type SubmitPaymentData as S, type OwnedAsset as T, type PaymentBlockchainContext as U, type VerifiedSenderAuth as V, type PaymentFailure as W, type PaymentResponse as X, type PaymentStatus as Y, type PaymentSummary as Z, type PaymentTimelineResponse as _, type ParsedPermit as a, type PaymentTransaction as a0, type PaymentTransactions as a1, type PreparePaymentRequest as a2, type PreparePaymentResponse as a3, type Quote as a4, type QuoteRequestAccepted as a5, type QuoteRequestResponse as a6, type QuoteRequestStatusResponse as a7, type ResolvePaymentResponse as a8, type SenderAuth as a9, type SenderAuthMessageScheme as aa, type TimelineStep as ab, type VerifiableCredential as ac, type VerifiableCredentialAuth as ad, type domain as ae, type error_code as af, type status as ag, type status2 as ah, type status3 as ai, type status4 as aj, type status5 as ak, type status6 as al, type status7 as am, type VerifyPaymentRequestExpectations as b, type VerifyResult as c, type AuthorizePaymentData as d, type AuthorizePaymentResponse as e, type GetDefaultsResponse as f, type SubmitPaymentResponse as g, type GetPaymentStatusData as h, type GetPaymentStatusResponse2 as i, type ResolvePaymentResponse2 as j, type GetPaymentTimelineData as k, type GetPaymentTimelineResponse as l, type PreparePaymentData as m, type PreparePaymentResponse2 as n, type CreateQuoteRequestResponse as o, type GetQuoteRequestStatusData as p, type GetQuoteRequestStatusResponse as q, type AwardQuoteData as r, type AwardQuoteResponse as s, type SignedMessage as t, type CreateQuoteRequest as u, verifyPaymentRequest as v, type AuthorizationResult as w, type AwardAccepted as x, type AwardRequest as y, type AwardResponse as z };
2316
+ export { type $OpenApiTs as $, type AuthTerms as A, type SignedMessage as B, type CommitmentOutcome as C, type CreateQuoteRequest as D, type ErrorResponse as E, type AuthorizationResult as F, type GetDefaultsData as G, type HealthCheckResponse as H, type AwardAccepted as I, type AwardRequest as J, type AwardResponse as K, type AwardedPayment as L, type AwardedQuote as M, type BidAward as N, type ChainDefaultsByChain as O, type PaymentRequest as P, type ChainDefaults as Q, type ResolvePaymentData as R, type SolanaDomain as S, type DataIntegrityProof as T, type DeclineReason as U, type VerifiedSenderAuth as V, type DeclineSummaryEntry as W, type FulfillmentAuthorization as X, type FulfillmentConfirmation as Y, type GetDefaultsResult as Z, type GetPaymentStatusResponse as _, type CommitmentResult as a, type OwnedAsset as a0, type PaymentBlockchainContext as a1, type PaymentFailure as a2, type PaymentResponse as a3, type PaymentStatus as a4, type PaymentSummary as a5, type PaymentTimelineResponse as a6, type PaymentTransaction as a7, type PaymentTransactions as a8, type PreparePaymentRequest as a9, type PreparePaymentResponse as aa, type Quote as ab, type QuoteRequestAccepted as ac, type QuoteRequestResponse as ad, type QuoteRequestStatusResponse as ae, type RefundSignature as af, type ResolvePaymentResponse as ag, type SenderAuth as ah, type SenderAuthMessageScheme as ai, type TimelineStep as aj, type VerifiableCredential as ak, type VerifiableCredentialAuth as al, type deposit as am, type domain as an, type error_code as ao, type fulfill as ap, type reserve as aq, type scheme as ar, type status as as, type status2 as at, type status3 as au, type status4 as av, type status5 as aw, type status6 as ax, type status7 as ay, type ParsedPermit as b, type VerifyPaymentRequestExpectations as c, type VerifyResult as d, commitmentResultOf as e, verifyPaymentRequestJSON as f, verifyRequestCommitment as g, type AuthorizePaymentData as h, type AuthorizePaymentResponse as i, type GetDefaultsResponse as j, type SubmitPaymentData as k, type SubmitPaymentResponse as l, type GetPaymentStatusData as m, type GetPaymentStatusResponse2 as n, type ResolvePaymentResponse2 as o, type GetPaymentTimelineData as p, type GetPaymentTimelineResponse as q, type PreparePaymentData as r, type PreparePaymentResponse2 as s, type CreateQuoteRequestData as t, type CreateQuoteRequestResponse as u, verifyPaymentRequest as v, type GetQuoteRequestStatusData as w, type GetQuoteRequestStatusResponse as x, type AwardQuoteData as y, type AwardQuoteResponse as z };
package/dist/signing.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as PaymentRequest } from './sender-auth-verify-C-Q-zvAO.js';
2
- export { A as AuthTerms, a as ParsedPermit, V as VerifiedSenderAuth, b as VerifyPaymentRequestExpectations, c as VerifyResult, v as verifyPaymentRequest } from './sender-auth-verify-C-Q-zvAO.js';
1
+ import { P as PaymentRequest } from './sender-auth-verify-CEf7FN6s.js';
2
+ export { A as AuthTerms, C as CommitmentOutcome, a as CommitmentResult, b as ParsedPermit, S as SolanaDomain, V as VerifiedSenderAuth, c as VerifyPaymentRequestExpectations, d as VerifyResult, e as commitmentResultOf, v as verifyPaymentRequest, f as verifyPaymentRequestJSON, g as verifyRequestCommitment } from './sender-auth-verify-CEf7FN6s.js';
3
3
 
4
4
  /** Options for {@link signDeclaration}. */
5
5
  interface SignDeclarationOptions {