@atumlabs/payment-gateway-client 3.0.0 → 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.
@@ -0,0 +1,2316 @@
1
+ /**
2
+ * The result of a counterparty authorization request. Contains either
3
+ * the PSP's authorization decision (authorized/declined with proof) or
4
+ * an error indicating why authorization could not be completed.
5
+ *
6
+ */
7
+ type AuthorizationResult = {
8
+ /**
9
+ * Correlation key for this authorization
10
+ */
11
+ payment_id: string;
12
+ /**
13
+ * The beneficiary PSP's DID
14
+ */
15
+ counterparty_did: string;
16
+ /**
17
+ * Authorization outcome. "authorized" or "declined" when the PSP responded.
18
+ * "error" or "timeout" when the authorization could not be completed.
19
+ *
20
+ */
21
+ status: 'authorized' | 'declined' | 'error' | 'timeout';
22
+ /**
23
+ * The PSP's raw authorization response (present when status is authorized or declined)
24
+ */
25
+ authorization_response?: {
26
+ [key: string]: unknown;
27
+ };
28
+ /**
29
+ * Machine-readable error code (present when status is error or timeout).
30
+ * Counterparty-sourced codes are derived from the error code the
31
+ * Counterparty Gateway publishes. GATEWAY_TIMEOUT, PROOF_INVALID, and
32
+ * PROOF_STALE are raised by this gateway itself (no counterparty envelope corresponds).
33
+ *
34
+ */
35
+ error_code?: 'COUNTERPARTY_NOT_FOUND' | 'COUNTERPARTY_TIMEOUT' | 'WEBHOOK_ERROR' | 'WEBHOOK_CONNECTION_ERROR' | 'INTERNAL_ERROR' | 'GATEWAY_TIMEOUT' | 'PROOF_INVALID' | 'PROOF_STALE';
36
+ /**
37
+ * Human-readable error description
38
+ */
39
+ error_message?: string;
40
+ /**
41
+ * HTTP status code from the PSP webhook (only for WEBHOOK_ERROR)
42
+ */
43
+ webhook_http_status?: number;
44
+ };
45
+ /**
46
+ * Authorization outcome. "authorized" or "declined" when the PSP responded.
47
+ * "error" or "timeout" when the authorization could not be completed.
48
+ *
49
+ */
50
+ type status = 'authorized' | 'declined' | 'error' | 'timeout';
51
+ /**
52
+ * Machine-readable error code (present when status is error or timeout).
53
+ * Counterparty-sourced codes are derived from the error code the
54
+ * Counterparty Gateway publishes. GATEWAY_TIMEOUT, PROOF_INVALID, and
55
+ * PROOF_STALE are raised by this gateway itself (no counterparty envelope corresponds).
56
+ *
57
+ */
58
+ type error_code = 'COUNTERPARTY_NOT_FOUND' | 'COUNTERPARTY_TIMEOUT' | 'WEBHOOK_ERROR' | 'WEBHOOK_CONNECTION_ERROR' | 'INTERNAL_ERROR' | 'GATEWAY_TIMEOUT' | 'PROOF_INVALID' | 'PROOF_STALE';
59
+ /**
60
+ * Structured payment request with sender authorization and optional W3C Verifiable Credentials
61
+ */
62
+ type PaymentRequest = {
63
+ /**
64
+ * Semver-shaped declaration version (MAJOR.MINOR). The major component is locked to this schema's parent directory (v1 → major must be 1). Producers MUST emit the canonical value exported by the bindings' Version constant; the canonical bumps on each additive minor evolution.
65
+ */
66
+ version: string;
67
+ /**
68
+ * Unique identifier for this payment request (used for idempotency)
69
+ */
70
+ request_id: string;
71
+ source: OwnedAsset;
72
+ /**
73
+ * Array of destination assets for the settlement agent to choose from (at least one required, at most 16).
74
+ * The ceiling bounds the fan-out one request can buy: every consumer iterates this list.
75
+ */
76
+ destination: Array<OwnedAsset>;
77
+ /**
78
+ * The exact amount to be received at the destination (in the smallest unit, e.g., wei for ETH, cents for USD).
79
+ */
80
+ fulfillment_amount: string;
81
+ /**
82
+ * The maximum amount willing to be spent from the source (in the smallest unit).
83
+ */
84
+ max_source_amount?: string;
85
+ /**
86
+ * Required. The deadline for receiving price quotes from settlement providers. After this
87
+ * point no new quotes are accepted. The gateway injects no default and validates the value
88
+ * is in the future. The originator must supply it, and a request that omits it or supplies
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.
97
+ */
98
+ quote_deadline: string;
99
+ /**
100
+ * Required. The final deadline for completing the payment. If not completed by this time the
101
+ * payment fails and is eligible for a refund. The gateway injects no default and validates
102
+ * the value is in the future. The originator must supply it, and a request that omits it or
103
+ * supplies a past value is rejected with 400.
104
+ */
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
+ };
114
+ /**
115
+ * Policy requirements for settler authentication. Keys are policy names, values indicate if the policy is required.
116
+ */
117
+ settler_auth_required?: {
118
+ [key: string]: (boolean);
119
+ };
120
+ sender_auth: SenderAuth;
121
+ originator_auth?: VerifiableCredentialAuth;
122
+ /**
123
+ * Wallet address or public key of a trusted service that will automatically select
124
+ * the best exchange rate for your payment. Leave empty to use the default selector.
125
+ */
126
+ quote_selector?: string;
127
+ /**
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.
131
+ */
132
+ fulfillment_verifier: {
133
+ /**
134
+ * The wallet address or public key of the verification service
135
+ */
136
+ account: string;
137
+ /**
138
+ * Origin of the fulfillment verifier service, with no path — the caller
139
+ * appends the verifier's own API paths. The gateway's `/v1/defaults` response
140
+ * supplies the default fulfillment verifier for each chain.
141
+ */
142
+ endpoint: string;
143
+ };
144
+ /**
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`).
146
+ */
147
+ escrow_contract_address: string;
148
+ /**
149
+ * Fulfillment Proxy contract address, used to emit proof of fulfillment on the destination chain. Leave empty to use the default.
150
+ */
151
+ fulfillment_proxy?: string;
152
+ /**
153
+ * Optional settler filtering requirements. If whitelist is present, only whitelisted settlers may win. If blacklist is present, blacklisted settlers are excluded. Both can be specified; blacklist takes precedence (a settler in both lists is rejected).
154
+ */
155
+ settler_requirements?: {
156
+ /**
157
+ * List of settler DIDs permitted to fulfill this request. If present and non-empty, only these settlers may win. Use W3C DID format (e.g., did:pkh:eip155:1:0xABC...).
158
+ */
159
+ whitelist?: Array<(string)>;
160
+ /**
161
+ * List of settler DIDs excluded from fulfilling this request. If present and non-empty, these settlers are rejected. Use W3C DID format (e.g., did:pkh:eip155:1:0xABC...).
162
+ */
163
+ blacklist?: Array<(string)>;
164
+ };
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';
207
+ /**
208
+ * Confirmation details after a payment has been successfully delivered.
209
+ * Contains proof of delivery and transaction details for both source and destination chains.
210
+ *
211
+ */
212
+ type FulfillmentConfirmation = {
213
+ /**
214
+ * Unique identifier for this payment transaction.
215
+ * Use this to track the payment across all systems.
216
+ *
217
+ */
218
+ payment_id: string;
219
+ /**
220
+ * Your original request ID that was provided when creating the payment.
221
+ * Helps match confirmations to your internal systems.
222
+ *
223
+ */
224
+ request_id: string;
225
+ /**
226
+ * Timestamp when the fulfillment was completed
227
+ */
228
+ fulfillment_timestamp?: string;
229
+ /**
230
+ * The blockchain where funds were locked in escrow, using CAIP-2 format.
231
+ * CAIP-2 is a standard way to identify blockchains: {namespace}:{reference}
232
+ * Examples:
233
+ * - "eip155:1" for Ethereum mainnet
234
+ * - "eip155:42161" for Arbitrum
235
+ * - "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp" for Solana
236
+ * - "tron:mainnet" for Tron
237
+ *
238
+ */
239
+ source_chain_id: string;
240
+ /**
241
+ * The blockchain where the payment was delivered, using CAIP-2 format.
242
+ * CAIP-2 is a standard way to identify blockchains: {namespace}:{reference}
243
+ * Examples:
244
+ * - "eip155:1" for Ethereum mainnet
245
+ * - "eip155:42161" for Arbitrum
246
+ * - "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp" for Solana
247
+ * - "tron:mainnet" for Tron
248
+ *
249
+ */
250
+ destination_chain_id: string;
251
+ /**
252
+ * Transaction hash of the escrow reservation on the source chain
253
+ */
254
+ source_tx_hash: string;
255
+ /**
256
+ * Transaction hash of the fulfillment on the destination chain
257
+ */
258
+ destination_tx_hash: string;
259
+ /**
260
+ * Block number where the source transaction was confirmed
261
+ */
262
+ source_block_number?: number;
263
+ /**
264
+ * Block number where the destination transaction was confirmed
265
+ */
266
+ destination_block_number?: number;
267
+ };
268
+ /**
269
+ * Represents a cryptocurrency or token in a specific wallet. This tells the system what asset you're sending/receiving and which wallet to use.
270
+ */
271
+ type OwnedAsset = {
272
+ /**
273
+ * A unique identifier for the asset using CAIP-19 format.
274
+ * CAIP-19 is a standard way to identify blockchain assets: {chain_id}/{asset_namespace}:{asset_reference}
275
+ * Examples:
276
+ * - Ethereum USDC: "eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
277
+ * - Arbitrum USDC: "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831"
278
+ * - Solana USDC: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
279
+ * - Tron USDT: "tron:mainnet/trc20:TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
280
+ */
281
+ asset_identifier: string;
282
+ /**
283
+ * The wallet address that owns this asset.
284
+ * Format depends on the blockchain:
285
+ * - Ethereum/EVM: 0x-prefixed hex address (42 characters)
286
+ * - Solana: Base58 encoded address
287
+ * - Tron: T-prefixed Base58 address
288
+ *
289
+ * A destination account is checked at ingress and must be payable on the chain named by
290
+ * its `asset_identifier`: it parses for that chain, carries a valid EIP-55 checksum when
291
+ * mixed-case, has no surrounding whitespace, and is not the zero address. A receiver that
292
+ * fails any of these is refused with `INVALID_DESTINATION_ACCOUNT`, before any funds move.
293
+ */
294
+ account: string;
295
+ };
296
+ /**
297
+ * Authorization from the asset owner to execute the payment. The exact format depends on the source blockchain's authorization mechanism.
298
+ */
299
+ type SenderAuth = {
300
+ /**
301
+ * DEPRECATED: inner-document credential carrier. Credentials MUST ride ONLY in the holder-signed PaymentRequestEnvelope (PRE); the inner PaymentRequest carries no credential and its Data Integrity signature EXCLUDES this field (stripped before canonicalization on both producer and verifier). Populated only for one back-compat rollout cycle, then removed.
302
+ * @deprecated
303
+ */
304
+ verifiable_credential?: VerifiableCredentialAuth;
305
+ message_scheme: SenderAuthMessageScheme;
306
+ /**
307
+ * Array of signed messages (at least one required)
308
+ */
309
+ signed_messages: Array<SignedMessage>;
310
+ };
311
+ /**
312
+ * The signature method used for authorizing this payment:
313
+ * - `EVM_PERMIT2`: Gasless token approvals for Ethereum/EVM chains
314
+ * - `EVM_PERMIT2_ESCROW`: Gasless approvals with escrow support
315
+ * - `SOLANA`: Standard Solana transaction signatures
316
+ * - `TRON`: Tron transaction signatures
317
+ */
318
+ type SenderAuthMessageScheme = 'EVM_PERMIT2' | 'EVM_PERMIT2_ESCROW' | 'SOLANA' | 'TRON';
319
+ /**
320
+ * A message that has been cryptographically signed to prove authorization. The signature proves you control the wallet that's sending funds.
321
+ */
322
+ type SignedMessage = {
323
+ /**
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.
325
+ */
326
+ message: string;
327
+ /**
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.
330
+ */
331
+ message_prehash?: string;
332
+ /**
333
+ * The cryptographic signature proving you authorized this message. Hex-encoded with a 0x prefix on every supported chain. The signer's own public key is base58 on Solana, but the signature itself is not.
334
+ */
335
+ signature: string;
336
+ /**
337
+ * Optional chain-specific payload containing additional signing context (e.g., delegate_signer for Solana). Preserved through the pipeline for downstream consumers.
338
+ */
339
+ payload?: {
340
+ [key: string]: unknown;
341
+ };
342
+ };
343
+ /**
344
+ * Optional identity verification using cryptographic credentials.
345
+ *
346
+ * DEPRECATED. Credentials are moving to a holder-signed W3C VerifiablePresentation that
347
+ * travels alongside a request rather than inside it. That envelope is not part of this
348
+ * HTTP contract, so there is nothing here to move them to yet: treat this as a legacy
349
+ * carrier, and do not build a new integration on it.
350
+ */
351
+ type VerifiableCredentialAuth = {
352
+ verifiable_credential: VerifiableCredential;
353
+ /**
354
+ * Reference to verification method from the DID Document
355
+ */
356
+ verification_method_id: string;
357
+ /**
358
+ * Cryptographic signature matching the verification method type
359
+ */
360
+ signature: string;
361
+ };
362
+ /**
363
+ * W3C Verifiable Credential structure conforming to the W3C Verifiable Credentials Data Model v1.1
364
+ */
365
+ type VerifiableCredential = {
366
+ /**
367
+ * JSON-LD context array, must include 'https://www.w3.org/2018/credentials/v1'
368
+ */
369
+ '@context': Array<(string)>;
370
+ /**
371
+ * Unique identifier for this credential
372
+ */
373
+ id: string;
374
+ /**
375
+ * Credential types, must include 'VerifiableCredential'
376
+ */
377
+ type: Array<(string)>;
378
+ /**
379
+ * DID or issuer object of the credential issuer
380
+ */
381
+ issuer: string | {
382
+ [key: string]: unknown;
383
+ };
384
+ /**
385
+ * When the credential was issued
386
+ */
387
+ issuanceDate: string;
388
+ /**
389
+ * When the credential expires
390
+ */
391
+ expirationDate?: string;
392
+ /**
393
+ * Claims about the credential subject (structure varies by issuer)
394
+ */
395
+ credentialSubject: {
396
+ [key: string]: unknown;
397
+ };
398
+ /**
399
+ * Information for credential revocation checking. Not consulted by the verifier today.
400
+ */
401
+ credentialStatus?: {
402
+ [key: string]: unknown;
403
+ };
404
+ /**
405
+ * Cryptographic proof of credential integrity
406
+ */
407
+ proof: {
408
+ [key: string]: unknown;
409
+ };
410
+ };
411
+ /**
412
+ * Where your payment is in its lifecycle. One payment reads the same however you ask
413
+ * about it.
414
+ *
415
+ * - `pending`: accepted and in progress. Nothing has reached the recipient yet.
416
+ * - `finalizing`: the transaction paying your recipient is on chain and is accruing
417
+ * the confirmations its chain requires. NOT FINAL, see below.
418
+ * - `completed`: delivered, with the required confirmations behind it.
419
+ * - `failed`: did not complete. Any funds held in escrow are returned, and `error`
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.
432
+ *
433
+ * `completed`, `failed` and `refunded` are final and will not change afterwards.
434
+ * `pending`, `finalizing`, `refunding` and `refund_available` will.
435
+ *
436
+ * **Do not treat `finalizing` as delivered.** It says the payment has been made on
437
+ * chain but is not yet irreversible, much as a card authorization is not yet a
438
+ * settlement. It normally becomes `completed`, and it can still become `failed` if
439
+ * the transaction never reaches the confirmation depth its chain requires. Acting on
440
+ * `finalizing` — releasing goods, crediting an account — means accepting that risk
441
+ * deliberately, at whatever threshold suits you rather than the one we wait for.
442
+ *
443
+ * `finalizing` is about paying the recipient. While your own funds are still being
444
+ * committed on the source chain the payment is `pending`, because nothing has reached
445
+ * the recipient yet.
446
+ *
447
+ */
448
+ type PaymentStatus = 'pending' | 'finalizing' | 'completed' | 'failed' | 'refunding' | 'refund_available' | 'refunded';
449
+ /**
450
+ * One on-chain transaction belonging to a payment: which chain, which transaction, and
451
+ * which block it landed in.
452
+ *
453
+ * Whether the payment has actually happened is answered by `status`, not here. Read this
454
+ * to look the transaction up on chain and to verify it yourself.
455
+ *
456
+ */
457
+ type PaymentTransaction = {
458
+ /**
459
+ * The transaction's hash on its chain. Hex hashes carry the `0x` prefix, including on
460
+ * Tron, whose own tooling omits it.
461
+ *
462
+ */
463
+ transaction_hash: string;
464
+ /**
465
+ * CAIP-2 identifier of the chain the transaction is on.
466
+ */
467
+ chain_id: string;
468
+ /**
469
+ * The block the transaction landed in. Absent until it has been mined.
470
+ *
471
+ * Provisional while `status` is `finalizing`: on a chain that settles against another,
472
+ * a reorganization there can move the transaction to a different block. Settled once
473
+ * `status` is `completed` — keep it as a final record only from then.
474
+ *
475
+ */
476
+ block_number?: number;
477
+ };
478
+ /**
479
+ * The transactions a payment has produced, one entry per stage, added as each becomes
480
+ * known. A stage absent here has produced no transaction yet.
481
+ *
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.
486
+ * `fulfillment_confirmation` is not a substitute: it is written only once a payment
487
+ * completes, and describes the finished delivery rather than progress towards it.
488
+ *
489
+ * Where a stage is attempted more than once, the entry describes the attempt that
490
+ * counts — the one that succeeded, or the last one if none did.
491
+ *
492
+ */
493
+ type PaymentTransactions = {
494
+ /**
495
+ * Committing your funds on the source chain.
496
+ */
497
+ deposit?: PaymentTransaction;
498
+ /**
499
+ * Paying your recipient on the destination chain.
500
+ */
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;
535
+ };
536
+ /**
537
+ * Response from submitting a payment request. If settlement completes inside the
538
+ * gateway's synchronous window, the response includes a fulfillment_confirmation with
539
+ * full settlement details. Otherwise you receive a payment_id plus the payment's
540
+ * current `status`, and can poll /v1/payments/{paymentId}/status for updates.
541
+ *
542
+ * Read `status` before deciding what to do next: a `pending` or `finalizing` payment is
543
+ * in flight and must NOT be re-submitted under a new request_id (that would be a second
544
+ * payment), whereas a `failed` one is terminal — re-submitting it under the SAME
545
+ * request_id resolves to the same terminal payment, so a genuine re-attempt needs a
546
+ * new request_id.
547
+ *
548
+ * **A synchronously-completed payment carries proof of QUOTE as well as of delivery.** When
549
+ * settlement lands inside the window you get `status: completed`, a full
550
+ * `fulfillment_confirmation`, and — since a quote necessarily was awarded to get there —
551
+ * `quote_id` and `fulfillment_quote`. The fast path therefore needs no follow-up call to
552
+ * verify: recompute `quote_hash` over the returned quote and compare it against the on-chain
553
+ * commitment from this response alone.
554
+ *
555
+ * `status` is present on every response. `completed` is always accompanied by
556
+ * fulfillment_confirmation; `failed` is accompanied by `error` where a reason has been
557
+ * recorded.
558
+ *
559
+ */
560
+ type PaymentResponse = {
561
+ /**
562
+ * Unique ID for tracking this payment. Save this to check status later.
563
+ *
564
+ */
565
+ payment_id: string;
566
+ status: PaymentStatus;
567
+ transactions?: PaymentTransactions;
568
+ /**
569
+ * Whether this response describes a payment that already existed, rather than one
570
+ * created by this request. `true` means the request_id had been used before and you
571
+ * are being handed the ORIGINAL payment — no second payment was created and nothing
572
+ * additional was charged.
573
+ *
574
+ * **Re-attempting a payment.** Re-submit the same request and you get the same payment
575
+ * back. You may re-send the original bytes unchanged: the deadlines will have expired by
576
+ * then — `quote_deadline` bounds the auction and is short, while this endpoint may hold a
577
+ * submission for up to 30 seconds — and an expired deadline on a re-submission is not an
578
+ * error, because the request is resolved onto the payment that already exists rather than
579
+ * used to create one.
580
+ *
581
+ * Re-signing with fresh deadlines is equally fine and returns the same payment. What you
582
+ * must NOT change is the request_id, and what you must not change under it is the
583
+ * payment's economics — source, destination, fulfillment_amount, max_source_amount — which
584
+ * are rejected with 409 IDEMPOTENCY_TERMS_MISMATCH. Deadlines and the signature are
585
+ * exempt precisely so that a re-attempt is possible.
586
+ *
587
+ * A genuinely new payment needs a NEW request_id. In particular a `failed` payment is
588
+ * terminal: re-submitting its request_id keeps returning that dead payment, so recovering
589
+ * means starting a new one under a new key.
590
+ *
591
+ * Present on every response, `false` for a newly created payment. A response without
592
+ * the field is from a gateway predating it, not a newly created payment.
593
+ *
594
+ * This is the field to read when reconciling a suspected double charge: two
595
+ * submissions where the second reports `true` are one payment, whereas two both
596
+ * reporting `false` are two. It says nothing about how far the payment has got —
597
+ * read `status` for that.
598
+ *
599
+ */
600
+ idempotent_replay: boolean;
601
+ /**
602
+ * The winning quote's ID. Present when `status` is `completed` — a payment cannot settle
603
+ * without an award — and absent on a `pending` response, where no quote has been selected
604
+ * yet. Same value and meaning as on GET /v1/payments/{paymentId}/status.
605
+ *
606
+ */
607
+ quote_id?: string;
608
+ /**
609
+ * The settler-signed FulfillmentQuote for the winning quote, returned verbatim as an
610
+ * opaque signed document — the PREIMAGE of the `quote_hash` committed on-chain. Same
611
+ * value, semantics and canonicalization caveats as on
612
+ * GET /v1/payments/{paymentId}/status; see that field for how to verify it.
613
+ *
614
+ * Present when `status` is `completed`. It may be absent even then, if the stored quote
615
+ * is unreadable: the award is reported through `quote_id` regardless, so a present
616
+ * `quote_id` with no `fulfillment_quote` means "verification preimage unavailable" and
617
+ * never "no quote was awarded". A consumer that requires the preimage should fall back to
618
+ * the status endpoint rather than treat the payment as unverified.
619
+ *
620
+ */
621
+ fulfillment_quote?: {
622
+ [key: string]: unknown;
623
+ };
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
+ };
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>;
682
+ };
683
+ type GetPaymentStatusResponse = {
684
+ /**
685
+ * The payment ID you're checking status for.
686
+ *
687
+ */
688
+ payment_id?: string;
689
+ status?: PaymentStatus;
690
+ transactions?: PaymentTransactions;
691
+ /**
692
+ * When the status was last updated
693
+ */
694
+ updated_at?: string;
695
+ /**
696
+ * The winning quote's ID. Present once a quote has been awarded for this payment;
697
+ * absent while the payment is still collecting or awarding. Cross-references the
698
+ * `quote_id` returned by GET /v1/payments/quote-requests/{quoteRequestId}.
699
+ *
700
+ */
701
+ quote_id?: string;
702
+ /**
703
+ * The settler-signed FulfillmentQuote for the winning quote, returned verbatim as an
704
+ * opaque signed document (structurally the canonical FulfillmentQuote/v1 declaration at
705
+ * https://schemas.atum.xyz/declarations/FulfillmentQuote/v1). Present once a quote has
706
+ * been awarded — including after the payment completes and `fulfillment_confirmation` is
707
+ * populated, since that is precisely when a consumer verifies.
708
+ *
709
+ * This is the PREIMAGE of the `quote_hash` committed on-chain in the escrow deposit and
710
+ * reserve witnesses. On-chain we commit only the hash, so a quote-selector consumer
711
+ * recomputes quote_hash over these bytes and compares it against the on-chain commitment
712
+ * to confirm the payment settled against the quote it selected ("trust but verify"), and
713
+ * verifies the settler signature over the same bytes.
714
+ *
715
+ * quote_hash is canonicalization-based (URDNA2015), so it is stable across JSON
716
+ * key-order/whitespace normalization and across JSON string-escaping differences. The
717
+ * returned bytes are hash-equivalent to, but not necessarily byte-identical with, what
718
+ * the settler emitted (quotes are stored as JSONB, which normalizes on write). The
719
+ * gateway still never re-serializes the quote through a typed struct (that renormalizes
720
+ * timestamp values and WOULD change quote_hash), so the Go binding exposes it as a raw
721
+ * JSON passthrough.
722
+ *
723
+ */
724
+ fulfillment_quote?: {
725
+ [key: string]: unknown;
726
+ };
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
+ };
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;
763
+ /**
764
+ * How many settler agents this payment's auction was broadcast to. Absent means
765
+ * unknown, never zero.
766
+ *
767
+ */
768
+ requested_count?: number;
769
+ /**
770
+ * Why the payment drew few or no quotes. Read from the same settler reports as the
771
+ * quote-request endpoints, keyed by this payment, so a payment that failed on an expired
772
+ * quote deadline can say WHY nobody funded it instead of only that nobody did.
773
+ *
774
+ * Every declining agent is counted exactly once under its most recent reason. Empty means
775
+ * no agent declined against this payment, absent means the breakdown could not be read. A
776
+ * payment awarded out of a quote-request batch was bid on at quote time, so its declines
777
+ * are keyed to that batch and are read from the batch's status endpoint rather than here.
778
+ * As on the quote-request endpoints, the free-form decline detail is never relayed.
779
+ *
780
+ */
781
+ decline_summary?: Array<DeclineSummaryEntry>;
782
+ };
783
+ /**
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
786
+ * however you ask about the payment.
787
+ *
788
+ * `code` is the stable, machine-readable identity of the failure — branch on it
789
+ * rather than on `message`, which is written for a person and may be reworded.
790
+ * `docs_url` points at the page describing that code.
791
+ *
792
+ */
793
+ type PaymentFailure = {
794
+ /**
795
+ * Public error category in SCREAMING_SNAKE_CASE. Common codes:
796
+ * - `SETTLEMENT_FAILED`: the settlement could not be completed
797
+ * - `NO_QUOTES_RECEIVED`: no quotes arrived within the auction window
798
+ * - `INTERNAL_ERROR`: an unexpected error occurred
799
+ *
800
+ */
801
+ code: string;
802
+ /**
803
+ * Human-readable description of the failure, for a person reading it. Do not
804
+ * branch on this text.
805
+ *
806
+ */
807
+ message: string;
808
+ /**
809
+ * Which part of the system reported the failure.
810
+ *
811
+ */
812
+ domain?: 'PAYMENT_GATEWAY' | 'SETTLER_GATEWAY' | 'SETTLER_AGENT' | 'WALLET_ORCHESTRATION' | 'VERIFICATION_SERVICE' | 'BLOCKCHAIN' | 'EXTERNAL_SERVICE';
813
+ /**
814
+ * Link to the documentation page for this public code.
815
+ */
816
+ docs_url?: string;
817
+ /**
818
+ * What the caller should do next. Absent means the condition has not been classified, which is not the same as safe to retry.
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.
820
+ */
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;
826
+ blockchain_context?: PaymentBlockchainContext;
827
+ };
828
+ /**
829
+ * Which part of the system reported the failure.
830
+ *
831
+ */
832
+ type domain = 'PAYMENT_GATEWAY' | 'SETTLER_GATEWAY' | 'SETTLER_AGENT' | 'WALLET_ORCHESTRATION' | 'VERIFICATION_SERVICE' | 'BLOCKCHAIN' | 'EXTERNAL_SERVICE';
833
+ /**
834
+ * Where on chain a failed payment failed. Present only when the failure happened
835
+ * on chain — an escrow revert, or a fulfillment that could not be delivered — so a
836
+ * payment that failed before any transaction was sent carries no context here.
837
+ */
838
+ type PaymentBlockchainContext = {
839
+ /**
840
+ * CAIP-2 chain identifier
841
+ */
842
+ chain_id?: string;
843
+ /**
844
+ * Failed transaction hash
845
+ */
846
+ transaction_hash?: string;
847
+ /**
848
+ * Block number where error occurred
849
+ */
850
+ block_number?: number;
851
+ /**
852
+ * Contract that caused the error
853
+ */
854
+ contract_address?: string;
855
+ /**
856
+ * Smart contract revert reason
857
+ */
858
+ revert_reason?: string;
859
+ /**
860
+ * Gas consumed before failure
861
+ */
862
+ gas_used?: string;
863
+ /**
864
+ * Estimated gas needed for success
865
+ */
866
+ estimated_gas_needed?: string;
867
+ };
868
+ /**
869
+ * Human-readable payment request parameters for generating an unsigned PaymentRequest.
870
+ * Asset identifiers use a CAIP-19-like format with "/" separator and support friendly names.
871
+ *
872
+ */
873
+ type PreparePaymentRequest = {
874
+ /**
875
+ * Unique identifier for tracking this payment request.
876
+ * Used for idempotency and matching responses to requests.
877
+ *
878
+ */
879
+ request_id: string;
880
+ /**
881
+ * Source asset in human-readable CAIP-19-like format: {chain}/{asset}
882
+ * Supports both friendly names and full CAIP-19 identifiers:
883
+ * - "ethereum/usdc" (friendly names)
884
+ * - "eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" (full CAIP-19)
885
+ *
886
+ */
887
+ source_asset: string;
888
+ /**
889
+ * Wallet address that will send the payment
890
+ */
891
+ source_account: string;
892
+ /**
893
+ * Destination asset in human-readable CAIP-19-like format: {chain}/{asset}
894
+ * Supports both friendly names and full CAIP-19 identifiers:
895
+ * - "arbitrum/usdc"
896
+ * - "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831"
897
+ *
898
+ */
899
+ destination_asset: string;
900
+ /**
901
+ * Wallet address that will receive the payment
902
+ */
903
+ destination_account: string;
904
+ /**
905
+ * Simple amount specification in decimal format (e.g., "1.50" for $1.50 USDC).
906
+ * Use this OR specify both max_source_amount and fulfillment_amount.
907
+ * Cannot be used together with max_source_amount/fulfillment_amount.
908
+ *
909
+ */
910
+ amount?: string;
911
+ /**
912
+ * Maximum amount willing to spend from source (in decimal format).
913
+ * Must be specified together with fulfillment_amount.
914
+ * Cannot be used together with amount field.
915
+ *
916
+ */
917
+ max_source_amount?: string;
918
+ /**
919
+ * Exact amount to be fulfilled at destination (in decimal format).
920
+ * Must be specified together with max_source_amount.
921
+ * Cannot be used together with amount field.
922
+ *
923
+ */
924
+ fulfillment_amount?: string;
925
+ /**
926
+ * Seconds until quote deadline (from now).
927
+ * How long to wait for settlement provider quotes.
928
+ *
929
+ */
930
+ quote_deadline_seconds?: number;
931
+ /**
932
+ * Seconds until fulfillment deadline (from now).
933
+ * Final deadline for completing the payment.
934
+ *
935
+ */
936
+ fulfillment_deadline_seconds?: number;
937
+ };
938
+ /**
939
+ * Complete unsigned PaymentRequest ready for signing.
940
+ * Contains all resolved technical details and typed data ready for signing.
941
+ *
942
+ */
943
+ type PreparePaymentResponse = {
944
+ /**
945
+ * Complete PaymentRequest with signature field set to null.
946
+ * Client should fill in the signature field(s) in
947
+ * sender_auth.signed_messages, either by signing the message_hash
948
+ * field in signed_messages or by using typed data signing on the
949
+ * message_prehash field in signed messages, and then submit the full
950
+ * object to POST /v1/payments.
951
+ *
952
+ */
953
+ payment_request: PaymentRequest;
954
+ };
955
+ type ResolvePaymentResponse = {
956
+ /**
957
+ * The payment ID that corresponds to the given request ID
958
+ */
959
+ payment_id: string;
960
+ };
961
+ /**
962
+ * Step-by-step view of a payment's settlement lifecycle. Includes a route
963
+ * summary, a list of steps with timings, and if the payment failed, a
964
+ * structured error describing where and why.
965
+ *
966
+ */
967
+ type PaymentTimelineResponse = {
968
+ payment_id: string;
969
+ status: PaymentStatus;
970
+ transactions?: PaymentTransactions;
971
+ created_at: string;
972
+ updated_at: string;
973
+ /**
974
+ * Total time from first step to last completed step (only set for terminal states)
975
+ */
976
+ total_duration_ms?: number;
977
+ summary?: PaymentSummary;
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;
988
+ steps: Array<TimelineStep>;
989
+ };
990
+ /**
991
+ * Top-level context about the payment (parties, assets, amounts)
992
+ */
993
+ type PaymentSummary = {
994
+ /**
995
+ * CAIP-19 identifier of the source asset
996
+ */
997
+ source_asset?: string;
998
+ source_account?: string;
999
+ dest_asset?: string;
1000
+ dest_account?: string;
1001
+ /**
1002
+ * Raw fulfillment amount in smallest token units
1003
+ */
1004
+ fulfillment_amount?: string;
1005
+ /**
1006
+ * Human-readable formatted amount with symbol, e.g. "1.00 USDC".
1007
+ * Only set when the source asset's decimals are known via the token registry.
1008
+ *
1009
+ */
1010
+ display_amount?: string;
1011
+ /**
1012
+ * Raw max source amount in smallest token units
1013
+ */
1014
+ max_source_amount?: string;
1015
+ request_id?: string;
1016
+ };
1017
+ type TimelineStep = {
1018
+ /**
1019
+ * Internal name of the step (matches settlement event type)
1020
+ */
1021
+ name: string;
1022
+ /**
1023
+ * Human-readable label
1024
+ */
1025
+ label: string;
1026
+ /**
1027
+ * Current status of this step:
1028
+ * - `completed`: Step finished successfully
1029
+ * - `in_progress`: Step currently executing
1030
+ * - `pending`: Step hasn't started yet
1031
+ * - `failed`: Step errored out
1032
+ * - `skipped`: Step will never execute because an earlier step failed
1033
+ *
1034
+ */
1035
+ status: 'completed' | 'in_progress' | 'pending' | 'failed' | 'skipped';
1036
+ /**
1037
+ * When the step completed (if it has)
1038
+ */
1039
+ timestamp?: string;
1040
+ /**
1041
+ * Time this step took, measured from the previous step
1042
+ */
1043
+ duration_ms?: number;
1044
+ /**
1045
+ * CAIP-2 chain this step happened on (if on-chain)
1046
+ */
1047
+ chain_id?: string;
1048
+ /**
1049
+ * Transaction hash associated with this step (if on-chain)
1050
+ */
1051
+ transaction_hash?: string;
1052
+ /**
1053
+ * Additional step-specific data (e.g. block_number, settler, reason)
1054
+ */
1055
+ details?: {
1056
+ [key: string]: unknown;
1057
+ };
1058
+ };
1059
+ /**
1060
+ * Current status of this step:
1061
+ * - `completed`: Step finished successfully
1062
+ * - `in_progress`: Step currently executing
1063
+ * - `pending`: Step hasn't started yet
1064
+ * - `failed`: Step errored out
1065
+ * - `skipped`: Step will never execute because an earlier step failed
1066
+ *
1067
+ */
1068
+ type status2 = 'completed' | 'in_progress' | 'pending' | 'failed' | 'skipped';
1069
+ /**
1070
+ * Safe, outward-facing error. Derived from an internal error through the shared error catalog. The public code identifies the category and the message is a curated, safe description.
1071
+ *
1072
+ * A panic is caught by shared middleware that responds `{"error": "Internal server error occurred"}` instead, so a 500 is not guaranteed to carry this shape.
1073
+ */
1074
+ type ErrorResponse = {
1075
+ /**
1076
+ * Public, machine-readable error category in SCREAMING_SNAKE_CASE.
1077
+ */
1078
+ code: string;
1079
+ /**
1080
+ * Curated, safe, human-readable message.
1081
+ */
1082
+ message: string;
1083
+ /**
1084
+ * Correlation id to quote to support to locate the internal error record.
1085
+ */
1086
+ request_id?: string;
1087
+ /**
1088
+ * The payment this error was raised against. Absent when the error is not about a specific payment.
1089
+ */
1090
+ payment_id?: string;
1091
+ /**
1092
+ * Link to the documentation page for this public code.
1093
+ */
1094
+ docs_url?: string;
1095
+ /**
1096
+ * Originating service domain.
1097
+ */
1098
+ domain?: string;
1099
+ /**
1100
+ * What the caller should do next. Absent means the condition has not been classified, which is not the same as safe to retry.
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.
1102
+ */
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;
1108
+ };
1109
+ /**
1110
+ * Request body for opening a quote-request batch. Structurally the existing PaymentRequest
1111
+ * with `sender_auth` omitted (the spend authorization is deferred to the award call); see
1112
+ * schemas/declarations/PaymentRequest/v1/schema.json.
1113
+ *
1114
+ */
1115
+ type CreateQuoteRequest = {
1116
+ /**
1117
+ * Semver-shaped declaration version (MAJOR.MINOR), locked to major 1 for v1. Producers emit
1118
+ * the canonical value exported by the bindings' Version constant.
1119
+ *
1120
+ */
1121
+ version: string;
1122
+ /**
1123
+ * Client-supplied idempotency key for this quote-request. The same request_id from the
1124
+ * same originator returns the same quote_request_id. Independent of the award-call request_id.
1125
+ *
1126
+ */
1127
+ request_id: string;
1128
+ source: OwnedAsset;
1129
+ /**
1130
+ * Array of destination assets for the settlement agent to choose from (at least one required, at most 16).
1131
+ * The ceiling bounds the fan-out one request can buy: every consumer iterates this list.
1132
+ *
1133
+ */
1134
+ destination: Array<OwnedAsset>;
1135
+ /**
1136
+ * The exact amount to be received at the destination (smallest unit, e.g. wei or cents).
1137
+ */
1138
+ fulfillment_amount: string;
1139
+ /**
1140
+ * Optional cap on what the originator is willing to spend from source (smallest unit).
1141
+ * Quotes with source_amount above this are filtered. No cap applied if omitted.
1142
+ *
1143
+ */
1144
+ max_source_amount?: string;
1145
+ /**
1146
+ * Required. End of the collection window. After this point no new quotes are accepted.
1147
+ * The gateway injects no default and never mutates the originator-supplied body, so the
1148
+ * value is carried through verbatim to the award call. It must be supplied and must be in
1149
+ * the future. Must be strictly earlier than fulfillment_deadline.
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
+ *
1158
+ */
1159
+ quote_deadline: string;
1160
+ /**
1161
+ * Required. Final deadline for completing the payment. Past it the payment fails and
1162
+ * eligible for refund. The gateway injects no default and never mutates the
1163
+ * originator-supplied body, so the value is carried through verbatim to the award call. It
1164
+ * must be supplied and must be in the future. Must be strictly later than quote_deadline.
1165
+ *
1166
+ */
1167
+ fulfillment_deadline: string;
1168
+ /**
1169
+ * Policy requirements for settler authentication. Keys are policy names, values indicate if required.
1170
+ */
1171
+ settler_auth_required?: {
1172
+ [key: string]: (boolean);
1173
+ };
1174
+ originator_auth?: VerifiableCredentialAuth;
1175
+ /**
1176
+ * Wallet address or public key of a trusted service that auto-selects the best rate.
1177
+ * Leave empty to use the default selector.
1178
+ *
1179
+ */
1180
+ quote_selector?: string;
1181
+ /**
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
+ *
1186
+ */
1187
+ fulfillment_verifier: {
1188
+ /**
1189
+ * The wallet address or public key of the verification service
1190
+ */
1191
+ account: string;
1192
+ /**
1193
+ * Origin of the fulfillment verifier service, with no path — the caller
1194
+ * appends the verifier's own API paths. The gateway's `/v1/defaults` response
1195
+ * supplies the default fulfillment verifier for each chain.
1196
+ *
1197
+ */
1198
+ endpoint: string;
1199
+ };
1200
+ /**
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
+ *
1205
+ */
1206
+ escrow_contract_address: string;
1207
+ /**
1208
+ * Optional fulfillment-proxy contract address on the destination chain. Leave empty to use the default.
1209
+ */
1210
+ fulfillment_proxy?: string;
1211
+ /**
1212
+ * Optional settler filtering. If whitelist is present, only whitelisted settlers may win.
1213
+ * If blacklist is present, blacklisted settlers are excluded. Both can be specified;
1214
+ * blacklist takes precedence (a settler in both is rejected).
1215
+ *
1216
+ */
1217
+ settler_requirements?: {
1218
+ /**
1219
+ * Settler DIDs permitted to fulfill this request (W3C DID format). If present, only these may win.
1220
+ */
1221
+ whitelist?: Array<(string)>;
1222
+ /**
1223
+ * Settler DIDs excluded from fulfilling this request (W3C DID format).
1224
+ */
1225
+ blacklist?: Array<(string)>;
1226
+ };
1227
+ /**
1228
+ * Optional JSON-LD context URLs — present when the originator wraps the request in a W3C
1229
+ * Data Integrity envelope so a downstream verifier can recover the signer identity.
1230
+ *
1231
+ */
1232
+ '@context'?: Array<(string)>;
1233
+ proof?: DataIntegrityProof;
1234
+ /**
1235
+ * Optional document-level W3C Verifiable Credentials (e.g. KnownToAtum about the request producer).
1236
+ */
1237
+ verifiableCredential?: Array<VerifiableCredential>;
1238
+ };
1239
+ /**
1240
+ * W3C Data Integrity proof conforming to the Data Integrity 1.0 specification. Which of jws or proofValue is required depends on the cryptosuite named in type, and that pairing is checked where the proof is verified rather than by this schema, so a document can satisfy the schema and still be refused at verification.
1241
+ */
1242
+ type DataIntegrityProof = {
1243
+ /**
1244
+ * Proof type identifier. ECDSA-secp256k1 (recoverable, EVM-compatible) for did:pkh:eip155:* signers; Ed25519 for did:pkh:solana:* signers.
1245
+ */
1246
+ type: string;
1247
+ /**
1248
+ * ISO 8601 timestamp when the proof was created. Canonicalize the value exactly as it appears in the raw JSON: parsing it into a date-time and re-serializing can change the spelling (Z versus +00:00), and a different spelling canonicalizes to different bytes, so the signature no longer verifies.
1249
+ */
1250
+ created: string;
1251
+ /**
1252
+ * DID URL identifying the verification method, e.g., 'did:pkh:eip155:1:0x...#blockchainAccountId' for ECDSA or 'did:pkh:solana:<chain>:<addr>#SolanaMethod2021' for Ed25519.
1253
+ */
1254
+ verificationMethod: string;
1255
+ /**
1256
+ * Purpose of the proof (e.g., assertionMethod, authentication).
1257
+ */
1258
+ proofPurpose: string;
1259
+ /**
1260
+ * Detached JWS signature in <base64url(header)>..<base64url(sig)> form, header {alg:ES256K-R, b64:false, crit:[b64]}. Required at runtime for EcdsaSecp256k1RecoverySignature2020.
1261
+ */
1262
+ jws?: string;
1263
+ /**
1264
+ * Multibase-encoded raw signature bytes. Required at runtime for Ed25519Signature2020; mutually exclusive with jws in practice.
1265
+ */
1266
+ proofValue?: string;
1267
+ };
1268
+ /**
1269
+ * One collected quote — the content-hash identifier plus the verbatim settler-signed FulfillmentQuote.
1270
+ */
1271
+ type Quote = {
1272
+ /**
1273
+ * Canonical content-hash of the signed quote bytes; identifies the quote server-side at
1274
+ * award time. Provided as a convenience — the gateway re-derives it from
1275
+ * bid_award.fulfillment_quote_json.
1276
+ *
1277
+ */
1278
+ quote_id: string;
1279
+ /**
1280
+ * The settler-signed FulfillmentQuote (structurally the canonical FulfillmentQuote/v1
1281
+ * declaration at https://schemas.atum.xyz/declarations/FulfillmentQuote/v1), returned
1282
+ * verbatim as an opaque signed document. A client recomputes quote_hash over the returned
1283
+ * bytes and verifies the settler signature, then re-embeds them into
1284
+ * bid_award.fulfillment_quote_json at award. quote_hash is canonicalization-based
1285
+ * (URDNA2015), so it is stable across JSON key-order/whitespace normalization. The
1286
+ * returned bytes are hash-equivalent to, but not necessarily byte-identical with, what the
1287
+ * settler emitted (quotes are stored as JSONB, which normalizes on write). The gateway
1288
+ * still never re-serializes the quote through a typed struct (that renormalizes timestamp
1289
+ * values and WOULD change quote_hash), so the Go binding exposes it as a raw JSON passthrough.
1290
+ *
1291
+ */
1292
+ fulfillment_quote: {
1293
+ [key: string]: unknown;
1294
+ };
1295
+ };
1296
+ /**
1297
+ * A collected quote in the status response, annotated with its award linkage.
1298
+ */
1299
+ type AwardedQuote = {
1300
+ quote_id: string;
1301
+ /**
1302
+ * The settler-signed FulfillmentQuote (structurally the canonical FulfillmentQuote/v1
1303
+ * declaration at https://schemas.atum.xyz/declarations/FulfillmentQuote/v1), returned
1304
+ * verbatim as an opaque signed document. A client recomputes quote_hash over the returned
1305
+ * bytes and verifies the settler signature, then re-embeds them into
1306
+ * bid_award.fulfillment_quote_json at award. quote_hash is canonicalization-based
1307
+ * (URDNA2015), so it is stable across JSON key-order/whitespace normalization. The
1308
+ * returned bytes are hash-equivalent to, but not necessarily byte-identical with, what the
1309
+ * settler emitted (quotes are stored as JSONB, which normalizes on write). The gateway
1310
+ * still never re-serializes the quote through a typed struct (that renormalizes timestamp
1311
+ * values and WOULD change quote_hash), so the Go binding exposes it as a raw JSON passthrough.
1312
+ *
1313
+ */
1314
+ fulfillment_quote: {
1315
+ [key: string]: unknown;
1316
+ };
1317
+ /**
1318
+ * payment_id if this quote was awarded; null otherwise. Under MVP single-award, at most
1319
+ * one quote per batch carries a non-null value.
1320
+ *
1321
+ */
1322
+ awarded_payment_id?: string | null;
1323
+ };
1324
+ /**
1325
+ * A (quote_id, payment_id) pair for an awarded quote in a batch.
1326
+ */
1327
+ type AwardedPayment = {
1328
+ quote_id: string;
1329
+ payment_id: string;
1330
+ };
1331
+ /**
1332
+ * Synchronous response to POST /v1/payments/quote-requests. Self-contained — the corridor
1333
+ * fields are echoed at the response root so a drop-recovery client can build the award call
1334
+ * without retaining the original request body.
1335
+ *
1336
+ * The corridor echoed here describes the batch you actually receive. On an idempotent
1337
+ * replay that is the ORIGINAL batch's corridor and window, which may differ from what you
1338
+ * just sent in the ways a retry is allowed to differ (the deadlines, and address casing).
1339
+ *
1340
+ */
1341
+ type QuoteRequestResponse = {
1342
+ /**
1343
+ * Gateway-generated resource ID for the batch, used in subsequent status reads and awards.
1344
+ */
1345
+ quote_request_id: string;
1346
+ /**
1347
+ * Collection-phase outcome of the create call:
1348
+ * - `ready` — collection complete; `quotes` populated. If no settler bid, this is still
1349
+ * `ready` with an empty `quotes` array (a successful "no quotes available" result —
1350
+ * distinct from `expired`, which only applies to collected quotes that later lapse).
1351
+ * - `collecting` — the sync wait cap fired before the quote deadline; poll the status endpoint for quotes.
1352
+ * The `awarded` and `expired` lifecycle states are observed only via the status endpoint, not here.
1353
+ *
1354
+ */
1355
+ status: 'collecting' | 'ready';
1356
+ /**
1357
+ * Whether this response describes a batch that already existed, rather than one opened
1358
+ * by this request. `true` means the `request_id` had been used before and you are being
1359
+ * handed the ORIGINAL batch — no second batch was opened and no second broadcast went
1360
+ * out to settlement agents.
1361
+ *
1362
+ * **Re-attempting a quote-request.** Re-submit the same request and you get the same
1363
+ * batch back. You may re-send the original bytes unchanged: `quote_deadline` bounds the
1364
+ * collection window and is short, so it will usually have expired by the time you
1365
+ * retry, and an expired deadline on a re-submission is not an error — the request is
1366
+ * resolved onto the batch that already exists rather than used to open one.
1367
+ * Re-signing with fresh deadlines is equally fine and returns the same batch.
1368
+ *
1369
+ * The window is NOT extended either way: it belongs to the batch, and `quote_deadline`
1370
+ * in this response is the batch's own. Read `status` to see whether collection is
1371
+ * still running.
1372
+ *
1373
+ * What you must not change under one `request_id` is the corridor's economics —
1374
+ * accounts, assets, or amounts — which are rejected with 409
1375
+ * IDEMPOTENCY_TERMS_MISMATCH rather than resolved onto the first batch. A genuinely
1376
+ * different corridor needs a new `request_id`.
1377
+ *
1378
+ * Present on every response, `false` for a newly opened batch. A response without the
1379
+ * field is from a gateway predating it, not a newly opened batch.
1380
+ *
1381
+ */
1382
+ idempotent_replay: boolean;
1383
+ source?: OwnedAsset;
1384
+ destination?: Array<OwnedAsset>;
1385
+ fulfillment_amount?: string;
1386
+ max_source_amount?: string;
1387
+ fulfillment_deadline?: string;
1388
+ quote_deadline?: string;
1389
+ /**
1390
+ * Collected quotes. Present when status is `ready` — an empty array if no settler bid.
1391
+ */
1392
+ quotes?: Array<Quote>;
1393
+ /**
1394
+ * How many agents the request was broadcast to, so silence is distinguishable from a
1395
+ * decline without a second call. Same meaning and same absence rule as on the status
1396
+ * endpoint: absent means unknown, never zero.
1397
+ *
1398
+ */
1399
+ requested_count?: number;
1400
+ /**
1401
+ * Why the request drew few or no quotes, carried here so that a `ready` response with an
1402
+ * empty `quotes` array explains itself rather than requiring a follow-up read.
1403
+ *
1404
+ * Same counting rules as the status endpoint: every declining agent counted exactly once
1405
+ * under its most recent reason, empty when nobody declined, absent when the detail could not
1406
+ * be read. Provisional while `status` is `collecting`, because agents are still responding.
1407
+ *
1408
+ */
1409
+ decline_summary?: Array<DeclineSummaryEntry>;
1410
+ };
1411
+ /**
1412
+ * Collection-phase outcome of the create call:
1413
+ * - `ready` — collection complete; `quotes` populated. If no settler bid, this is still
1414
+ * `ready` with an empty `quotes` array (a successful "no quotes available" result —
1415
+ * distinct from `expired`, which only applies to collected quotes that later lapse).
1416
+ * - `collecting` — the sync wait cap fired before the quote deadline; poll the status endpoint for quotes.
1417
+ * The `awarded` and `expired` lifecycle states are observed only via the status endpoint, not here.
1418
+ *
1419
+ */
1420
+ type status3 = 'collecting' | 'ready';
1421
+ /**
1422
+ * Asynchronous (202) response to POST /v1/payments/quote-requests. Returns the batch handle
1423
+ * plus the echoed corridor; quotes are retrieved via the status endpoint.
1424
+ *
1425
+ * The corridor echoed here describes the batch you actually receive. On an idempotent
1426
+ * replay that is the ORIGINAL batch's corridor and window, which may differ from what you
1427
+ * just sent in the ways a retry is allowed to differ (the deadlines, and address casing).
1428
+ *
1429
+ */
1430
+ type QuoteRequestAccepted = {
1431
+ quote_request_id: string;
1432
+ /**
1433
+ * Always `collecting` — a constant on this response, not a report of the batch's state.
1434
+ * On an idempotent replay the batch's window may already have closed; read
1435
+ * GET /v1/payments/quote-requests/{quoteRequestId} for its actual state.
1436
+ *
1437
+ */
1438
+ status: 'collecting';
1439
+ /**
1440
+ * Whether this response describes a batch that already existed, rather than one opened
1441
+ * by this request. `true` means the `request_id` had been used before and you are being
1442
+ * handed the ORIGINAL batch — no second batch was opened and no second broadcast went
1443
+ * out to settlement agents.
1444
+ *
1445
+ * The idempotency contract is the same as on the synchronous (200) response: a
1446
+ * re-submission may carry expired deadlines and is resolved onto the existing batch
1447
+ * rather than rejected, the collection window is the batch's own and is not extended,
1448
+ * and differing economics are rejected with 409 IDEMPOTENCY_TERMS_MISMATCH rather than
1449
+ * collapsed onto the first batch.
1450
+ *
1451
+ * Present on every response, `false` for a newly opened batch. A response without the
1452
+ * field is from a gateway predating it, not a newly opened batch.
1453
+ *
1454
+ */
1455
+ idempotent_replay: boolean;
1456
+ source?: OwnedAsset;
1457
+ destination?: Array<OwnedAsset>;
1458
+ fulfillment_amount?: string;
1459
+ max_source_amount?: string;
1460
+ fulfillment_deadline?: string;
1461
+ quote_deadline?: string;
1462
+ };
1463
+ /**
1464
+ * Always `collecting` — a constant on this response, not a report of the batch's state.
1465
+ * On an idempotent replay the batch's window may already have closed; read
1466
+ * GET /v1/payments/quote-requests/{quoteRequestId} for its actual state.
1467
+ *
1468
+ */
1469
+ type status4 = 'collecting';
1470
+ /**
1471
+ * Response to GET /v1/payments/quote-requests/{quoteRequestId}. The `status` enum describes
1472
+ * the quote-request batch lifecycle and is disjoint from the payment-status enum.
1473
+ *
1474
+ */
1475
+ type QuoteRequestStatusResponse = {
1476
+ quote_request_id: string;
1477
+ /**
1478
+ * Derived batch lifecycle, computed at read time (not a stored state machine). Disjoint
1479
+ * from the payment-status enum returned by the award and payment-status endpoints.
1480
+ * - `collecting` — collection window still open; `quotes` lists those collected so far
1481
+ * (a quote is awardable from arrival, by its own `award_deadline`; more may arrive until
1482
+ * `collection_close`).
1483
+ * - `ready` — collection complete; none awarded yet; either at least one quote is still
1484
+ * within its `award_deadline`, or no settler bid (empty `quotes` array — the successful
1485
+ * "no quotes available" result).
1486
+ * - `awarded` — a quote produced a payment row; no further awards accepted (MVP).
1487
+ * - `expired` — collection closed, nothing awarded, and every collected quote is now past
1488
+ * its `award_deadline` ("quotes lapsed"). An empty batch is `ready`, not `expired` — the
1489
+ * two are deliberately distinct ("no quotes available" vs "quotes lapsed").
1490
+ *
1491
+ */
1492
+ status: 'collecting' | 'ready' | 'awarded' | 'expired';
1493
+ /**
1494
+ * Collected quotes with award linkage — those collected so far while `collecting`, the full set once the window closes.
1495
+ */
1496
+ quotes?: Array<AwardedQuote>;
1497
+ /**
1498
+ * Flat list of awarded (quote_id, payment_id) pairs. At most one entry under MVP single-award.
1499
+ */
1500
+ payments?: Array<AwardedPayment>;
1501
+ /**
1502
+ * How many agents the request was broadcast to. The only auction count that is not
1503
+ * derivable from the rest of this response:
1504
+ *
1505
+ * - quoted = `quotes` length
1506
+ * - declined = sum of `decline_summary[].count`
1507
+ * - participated = quoted + declined
1508
+ * - silent = `requested_count` - participated
1509
+ *
1510
+ * Silence and a decline are different signals, which is why the denominator is surfaced
1511
+ * rather than left implicit.
1512
+ *
1513
+ * ABSENT when the number is unknown, which happens when the broadcast count was never
1514
+ * recorded or when the auction detail could not be read. Absence means unknown, never zero,
1515
+ * so `silent` is derivable only when this field is present.
1516
+ *
1517
+ */
1518
+ requested_count?: number;
1519
+ /**
1520
+ * Why the request drew few or no quotes, so a caller can tell "nobody can fund this right
1521
+ * now" from "my request was malformed".
1522
+ *
1523
+ * EXHAUSTIVE over agents: every agent that declined is counted exactly once, under its most
1524
+ * recent reason, so the counts sum to the number of agents that declined. An agent that
1525
+ * declined more than once with different reasons is counted once, not once per reason.
1526
+ *
1527
+ * Empty means nobody declined. ABSENT means the auction detail could not be read, so the
1528
+ * breakdown is unknown. While `status` is `collecting` it is provisional, because agents are
1529
+ * still responding.
1530
+ *
1531
+ * The free-form decline detail is never relayed, because that detail carries an agent's
1532
+ * balances and would let a caller map inventory by polling cheap quote-requests across
1533
+ * corridors.
1534
+ *
1535
+ */
1536
+ decline_summary?: Array<DeclineSummaryEntry>;
1537
+ };
1538
+ /**
1539
+ * Derived batch lifecycle, computed at read time (not a stored state machine). Disjoint
1540
+ * from the payment-status enum returned by the award and payment-status endpoints.
1541
+ * - `collecting` — collection window still open; `quotes` lists those collected so far
1542
+ * (a quote is awardable from arrival, by its own `award_deadline`; more may arrive until
1543
+ * `collection_close`).
1544
+ * - `ready` — collection complete; none awarded yet; either at least one quote is still
1545
+ * within its `award_deadline`, or no settler bid (empty `quotes` array — the successful
1546
+ * "no quotes available" result).
1547
+ * - `awarded` — a quote produced a payment row; no further awards accepted (MVP).
1548
+ * - `expired` — collection closed, nothing awarded, and every collected quote is now past
1549
+ * its `award_deadline` ("quotes lapsed"). An empty batch is `ready`, not `expired` — the
1550
+ * two are deliberately distinct ("no quotes available" vs "quotes lapsed").
1551
+ *
1552
+ */
1553
+ type status5 = 'collecting' | 'ready' | 'awarded' | 'expired';
1554
+ type DeclineSummaryEntry = {
1555
+ reason: DeclineReason;
1556
+ /**
1557
+ * Agents whose most recent decline reason was this one. Counts agents, never rows, and an
1558
+ * agent appears under one reason only.
1559
+ *
1560
+ */
1561
+ count: number;
1562
+ /**
1563
+ * What would have to change for a settler giving this reason to submit a price quote,
1564
+ * drawn from the same closed set as the `retry_classification` on an error response so
1565
+ * a caller reads one vocabulary.
1566
+ *
1567
+ * It describes the decline only. The authoritative instruction for the payment is the
1568
+ * `retry_classification` on its own error response: a payment can fail for a reason no
1569
+ * settler named, and it can succeed while some settlers declined.
1570
+ *
1571
+ * Optional, and a pattern-constrained string for the same reason `DeclineReason` is.
1572
+ *
1573
+ */
1574
+ retry_classification?: string;
1575
+ /**
1576
+ * Link to the documentation for this reason. Absent rather than empty when no page is
1577
+ * published, so a reader never follows a link to the site root.
1578
+ *
1579
+ */
1580
+ docs_url?: string;
1581
+ };
1582
+ /**
1583
+ * A settler's reason for not bidding, projected from its internal reason code through
1584
+ * the shared decline catalog (`apis/decline/v1/catalog.json`), which is the single
1585
+ * source of truth for the reason set. Several internal codes may map to one public
1586
+ * reason.
1587
+ *
1588
+ * Deliberately a pattern-constrained string rather than a closed enum. The set grows
1589
+ * whenever a settler gains a cause worth naming, and a consumer whose generated client
1590
+ * closes the set rejects the whole response on a value it has not seen. Treat an
1591
+ * unrecognised value as `OTHER`.
1592
+ *
1593
+ * `OTHER` covers a reason whose detail is settler-authored free text, and any reason
1594
+ * this gateway does not recognise. Both are counted so the summary stays exhaustive,
1595
+ * without relaying text we neither author nor validate.
1596
+ *
1597
+ */
1598
+ type DeclineReason = string;
1599
+ /**
1600
+ * Request body for POST /v1/payments/awards. Carries the two originator-signed artifacts:
1601
+ * `sender_auth` (Permit2 deposit authorization) and a fully-formed `bid_award` declaration.
1602
+ * The awarded quote is derived server-side from bid_award.fulfillment_quote_json — no
1603
+ * explicit quote_id on the wire.
1604
+ *
1605
+ */
1606
+ type AwardRequest = {
1607
+ /**
1608
+ * Client-supplied idempotency key for this award call. Independent of the quote-request's request_id.
1609
+ */
1610
+ request_id: string;
1611
+ sender_auth: SenderAuth;
1612
+ bid_award: BidAward;
1613
+ };
1614
+ /**
1615
+ * Fully-formed, originator-signed bid award. Mirrors schemas/declarations/BidAward/v1/schema.json.
1616
+ * `authorization` carries the Escrow reserve-witness signature naming the chosen settler;
1617
+ * `fulfillment_quote_json` is the verbatim settler-signed quote string received in the quote
1618
+ * response (carrying the settler's proof).
1619
+ *
1620
+ */
1621
+ type BidAward = {
1622
+ /**
1623
+ * Semver-shaped declaration version (MAJOR.MINOR), locked to major 1 for v1. Producers emit
1624
+ * the canonical value exported by the bindings' Version constant.
1625
+ *
1626
+ */
1627
+ version: string;
1628
+ authorization: SignedMessage;
1629
+ /**
1630
+ * The settler-signed FulfillmentQuote received in the quote response, forwarded verbatim.
1631
+ * Verification is canonicalization-based — the settler's W3C Data Integrity proof is checked
1632
+ * over the canonicalized form, and `quote_id` is derived as the canonical content-hash — so a
1633
+ * JSON decode/re-encode that only changes key order or whitespace does not invalidate it.
1634
+ * Clients SHOULD still forward the received bytes as-is rather than rebuild the object; the
1635
+ * SDK helpers do this and also expose settler-proof verification.
1636
+ *
1637
+ */
1638
+ fulfillment_quote_json: string;
1639
+ /**
1640
+ * Optional JSON-LD context URLs when the award is wrapped in a W3C Data Integrity envelope.
1641
+ */
1642
+ '@context'?: Array<(string)>;
1643
+ proof?: DataIntegrityProof;
1644
+ /**
1645
+ * Optional W3C Verifiable Credentials attesting the award producer.
1646
+ */
1647
+ verifiableCredential?: Array<VerifiableCredential>;
1648
+ };
1649
+ /**
1650
+ * Synchronous response to POST /v1/payments/awards. The `status` field describes the payment
1651
+ * lifecycle. Note there are two distinct status surfaces for a Quote-API payment, with
1652
+ * different vocabularies: (1) this award response (`awarding`/`completed`/…), and
1653
+ * (2) the separate GET /v1/payments/{paymentId}/status endpoint you poll afterward, which
1654
+ * reports the same payment under its own values (an in-progress payment reads as `pending`
1655
+ * there). Both are disjoint from the quote-request batch status on the quote-request endpoints.
1656
+ *
1657
+ */
1658
+ type AwardResponse = {
1659
+ payment_id: string;
1660
+ /**
1661
+ * Payment lifecycle status on the award response:
1662
+ * - `completed` — settlement finished within the sync wait (includes fulfillment_confirmation).
1663
+ * - `awarding` — settlement still in progress when the sync cap fired (or on wait=false);
1664
+ * poll GET /v1/payments/{paymentId}/status.
1665
+ * - `failed` — settlement reached a terminal failure (e.g. the settler could not fulfill, or
1666
+ * an on-chain step was rejected).
1667
+ * - `cancelled` — the payment was terminated before settlement completed and will not proceed.
1668
+ * `failed` and `cancelled` are terminal states surfaced here only when they occur within the
1669
+ * sync wait; otherwise the response is `awarding` and the terminal state is read from the
1670
+ * payment-status endpoint.
1671
+ *
1672
+ */
1673
+ status: 'awarding' | 'completed' | 'failed' | 'cancelled';
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
+ };
1696
+ };
1697
+ /**
1698
+ * Payment lifecycle status on the award response:
1699
+ * - `completed` — settlement finished within the sync wait (includes fulfillment_confirmation).
1700
+ * - `awarding` — settlement still in progress when the sync cap fired (or on wait=false);
1701
+ * poll GET /v1/payments/{paymentId}/status.
1702
+ * - `failed` — settlement reached a terminal failure (e.g. the settler could not fulfill, or
1703
+ * an on-chain step was rejected).
1704
+ * - `cancelled` — the payment was terminated before settlement completed and will not proceed.
1705
+ * `failed` and `cancelled` are terminal states surfaced here only when they occur within the
1706
+ * sync wait; otherwise the response is `awarding` and the terminal state is read from the
1707
+ * payment-status endpoint.
1708
+ *
1709
+ */
1710
+ type status6 = 'awarding' | 'completed' | 'failed' | 'cancelled';
1711
+ /**
1712
+ * Asynchronous (202) response to POST /v1/payments/awards — just the payment handle.
1713
+ */
1714
+ type AwardAccepted = {
1715
+ payment_id: string;
1716
+ /**
1717
+ * Always `awarding` — settlement is in progress server-side.
1718
+ */
1719
+ status: 'awarding';
1720
+ };
1721
+ /**
1722
+ * Always `awarding` — settlement is in progress server-side.
1723
+ */
1724
+ type status7 = 'awarding';
1725
+ /**
1726
+ * The addresses for one chain. Optional fields appear only where they apply to that
1727
+ * chain; an absent optional field is not an error.
1728
+ *
1729
+ */
1730
+ type ChainDefaults = {
1731
+ /**
1732
+ * CAIP-2 identifier of the chain these defaults describe, normalised to lower case.
1733
+ */
1734
+ chain_id: string;
1735
+ /**
1736
+ * The account named as the reserver in the deposit authorization. Sign against this exact value; a deposit reserved by anyone else is rejected.
1737
+ */
1738
+ quote_selector: string;
1739
+ /**
1740
+ * The escrow the deposit is made into, and the spender of the token approval. Empty when the chain is not fully configured.
1741
+ */
1742
+ escrow_contract: string;
1743
+ /**
1744
+ * The contract that pays the receiver. Read this from the DESTINATION chain's defaults, not the source chain's. Empty when the chain is not fully configured.
1745
+ */
1746
+ fulfillment_proxy: string;
1747
+ /**
1748
+ * The service that attests settlement, and the account it signs with.
1749
+ */
1750
+ fulfillment_verifier: {
1751
+ /**
1752
+ * The account named as the releaser in the deposit authorization. Sign against this exact value.
1753
+ */
1754
+ account: string;
1755
+ /**
1756
+ * Base URL of the fulfillment verifier serving this chain.
1757
+ */
1758
+ endpoint: string;
1759
+ };
1760
+ /**
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.
1762
+ */
1763
+ permit2_contract?: string;
1764
+ /**
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.
1766
+ */
1767
+ tokens?: Array<{
1768
+ symbol: string;
1769
+ /**
1770
+ * Token contract address, in the chain's native address format.
1771
+ */
1772
+ address: string;
1773
+ /**
1774
+ * Decimal places, for converting a human amount to base units.
1775
+ */
1776
+ decimals: number;
1777
+ }>;
1778
+ /**
1779
+ * Solana only. The cluster the escrow's signing domain is bound to, needed to build the deposit hash. Absent for EVM and Tron.
1780
+ */
1781
+ svm_signature_cluster_id?: string;
1782
+ /**
1783
+ * Solana only. The escrow's signature domain version, which the deposit hash commits to. Absent for EVM and Tron.
1784
+ */
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;
1790
+ };
1791
+ /**
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.
1793
+ */
1794
+ type GetDefaultsResult = ChainDefaults | ChainDefaultsByChain;
1795
+ /**
1796
+ * Defaults for every chain the gateway serves, keyed by CAIP-2 chain id. Each key repeats the `chain_id` of the value it maps to.
1797
+ */
1798
+ type ChainDefaultsByChain = {
1799
+ [key: string]: ChainDefaults;
1800
+ };
1801
+ type SubmitPaymentData = {
1802
+ requestBody: PaymentRequest;
1803
+ };
1804
+ type SubmitPaymentResponse = PaymentResponse;
1805
+ type GetPaymentStatusData = {
1806
+ /**
1807
+ * The ID of the payment to query
1808
+ */
1809
+ paymentId: string;
1810
+ };
1811
+ type GetPaymentStatusResponse2 = GetPaymentStatusResponse;
1812
+ type ResolvePaymentData = {
1813
+ /**
1814
+ * The client-supplied request ID embedded in the payment request
1815
+ */
1816
+ requestId: string;
1817
+ };
1818
+ type ResolvePaymentResponse2 = ResolvePaymentResponse;
1819
+ type GetPaymentTimelineData = {
1820
+ /**
1821
+ * The ID of the payment to query
1822
+ */
1823
+ paymentId: string;
1824
+ };
1825
+ type GetPaymentTimelineResponse = PaymentTimelineResponse;
1826
+ type PreparePaymentData = {
1827
+ requestBody: PreparePaymentRequest;
1828
+ };
1829
+ type PreparePaymentResponse2 = PreparePaymentResponse;
1830
+ type AuthorizePaymentData = {
1831
+ requestBody: PaymentRequest;
1832
+ };
1833
+ type AuthorizePaymentResponse = AuthorizationResult;
1834
+ type CreateQuoteRequestData = {
1835
+ requestBody: CreateQuoteRequest;
1836
+ /**
1837
+ * Return a handle immediately (`false`, default) or hold the connection for collected quotes (`true`).
1838
+ */
1839
+ wait?: boolean;
1840
+ };
1841
+ type CreateQuoteRequestResponse = QuoteRequestResponse | QuoteRequestAccepted;
1842
+ type GetQuoteRequestStatusData = {
1843
+ /**
1844
+ * The ID of the quote-request batch to query
1845
+ */
1846
+ quoteRequestId: string;
1847
+ };
1848
+ type GetQuoteRequestStatusResponse = QuoteRequestStatusResponse;
1849
+ type AwardQuoteData = {
1850
+ requestBody: AwardRequest;
1851
+ /**
1852
+ * Return a handle immediately (`false`, default) or hold the connection for the payment result (`true`).
1853
+ */
1854
+ wait?: boolean;
1855
+ };
1856
+ type AwardQuoteResponse = AwardResponse | AwardAccepted;
1857
+ type GetDefaultsData = {
1858
+ /**
1859
+ * CAIP-2 chain identifier. Omit it, or send it empty, to receive every chain the gateway serves, keyed by chain id.
1860
+ */
1861
+ chainId?: string;
1862
+ };
1863
+ type GetDefaultsResponse = GetDefaultsResult;
1864
+ type HealthCheckResponse = {
1865
+ status?: string;
1866
+ };
1867
+ type $OpenApiTs = {
1868
+ '/v1/payments': {
1869
+ post: {
1870
+ req: SubmitPaymentData;
1871
+ res: {
1872
+ /**
1873
+ * Payment request submitted successfully
1874
+ */
1875
+ 200: PaymentResponse;
1876
+ /**
1877
+ * Invalid request
1878
+ */
1879
+ 400: ErrorResponse;
1880
+ /**
1881
+ * Signature or sender authorization could not be verified
1882
+ */
1883
+ 401: ErrorResponse;
1884
+ /**
1885
+ * Payment declined during counterparty authorization
1886
+ */
1887
+ 403: ErrorResponse;
1888
+ /**
1889
+ * The `request_id` has already been used for a payment with different economics
1890
+ * (`IDEMPOTENCY_TERMS_MISMATCH`). Re-submitting one `request_id` is how a retry is
1891
+ * made safe, so it must identify one payment; use a distinct `request_id` per
1892
+ * payment.
1893
+ *
1894
+ */
1895
+ 409: ErrorResponse;
1896
+ /**
1897
+ * Payment request too large to process
1898
+ */
1899
+ 413: ErrorResponse;
1900
+ /**
1901
+ * Internal server error
1902
+ */
1903
+ 500: ErrorResponse;
1904
+ /**
1905
+ * The request was not accepted: a dependency is temporarily unavailable, or this operation is paused (`SERVICE_PAUSED`). Nothing was submitted, so the request is safe to retry.
1906
+ */
1907
+ 503: ErrorResponse;
1908
+ };
1909
+ };
1910
+ };
1911
+ '/v1/payments/{paymentId}/status': {
1912
+ get: {
1913
+ req: GetPaymentStatusData;
1914
+ res: {
1915
+ /**
1916
+ * Payment status retrieved successfully
1917
+ */
1918
+ 200: GetPaymentStatusResponse;
1919
+ /**
1920
+ * Payment not found
1921
+ */
1922
+ 404: ErrorResponse;
1923
+ /**
1924
+ * Internal server error
1925
+ */
1926
+ 500: ErrorResponse;
1927
+ };
1928
+ };
1929
+ };
1930
+ '/v1/payments/resolve': {
1931
+ get: {
1932
+ req: ResolvePaymentData;
1933
+ res: {
1934
+ /**
1935
+ * Payment found
1936
+ */
1937
+ 200: ResolvePaymentResponse;
1938
+ /**
1939
+ * Missing request_id parameter
1940
+ */
1941
+ 400: ErrorResponse;
1942
+ /**
1943
+ * No payment found for the given request ID
1944
+ */
1945
+ 404: ErrorResponse;
1946
+ /**
1947
+ * Internal server error
1948
+ */
1949
+ 500: ErrorResponse;
1950
+ };
1951
+ };
1952
+ };
1953
+ '/v1/payments/{paymentId}/timeline': {
1954
+ get: {
1955
+ req: GetPaymentTimelineData;
1956
+ res: {
1957
+ /**
1958
+ * Timeline retrieved successfully
1959
+ */
1960
+ 200: PaymentTimelineResponse;
1961
+ /**
1962
+ * Payment not found
1963
+ */
1964
+ 404: ErrorResponse;
1965
+ /**
1966
+ * Internal server error
1967
+ */
1968
+ 500: ErrorResponse;
1969
+ };
1970
+ };
1971
+ };
1972
+ '/v1/payments/prepare': {
1973
+ post: {
1974
+ req: PreparePaymentData;
1975
+ res: {
1976
+ /**
1977
+ * Payment request prepared successfully
1978
+ */
1979
+ 200: PreparePaymentResponse;
1980
+ /**
1981
+ * Invalid request parameters
1982
+ */
1983
+ 400: ErrorResponse;
1984
+ /**
1985
+ * Endpoint not yet implemented
1986
+ */
1987
+ 501: ErrorResponse;
1988
+ };
1989
+ };
1990
+ };
1991
+ '/v1/payments/authorizations': {
1992
+ post: {
1993
+ req: AuthorizePaymentData;
1994
+ res: {
1995
+ /**
1996
+ * Authorization decision received (authorized or declined)
1997
+ */
1998
+ 200: AuthorizationResult;
1999
+ /**
2000
+ * The request was rejected before authorization was attempted, so no
2001
+ * authorization outcome exists.
2002
+ *
2003
+ */
2004
+ 400: ErrorResponse;
2005
+ /**
2006
+ * The counterparty's proof was rejected (`PROOF_INVALID` or `PROOF_STALE`).
2007
+ * This is an authorization outcome, so the body is an `AuthorizationResult`
2008
+ * with `status: error`.
2009
+ *
2010
+ */
2011
+ 401: AuthorizationResult;
2012
+ /**
2013
+ * Counterparty not found (no registration for the resolved DID). An
2014
+ * authorization outcome, so the body is an `AuthorizationResult` with
2015
+ * `status: error` and `error_code: COUNTERPARTY_NOT_FOUND`.
2016
+ *
2017
+ */
2018
+ 404: AuthorizationResult;
2019
+ /**
2020
+ * Either shape, depending on where the failure happened. A failure before
2021
+ * authorization was attempted returns `ErrorResponse`. A failure carrying an
2022
+ * authorization outcome returns `AuthorizationResult` with `status: error`.
2023
+ *
2024
+ */
2025
+ 500: ErrorResponse | AuthorizationResult;
2026
+ /**
2027
+ * Counterparty webhook error (HTTP error or connection failure). An
2028
+ * authorization outcome, so the body is an `AuthorizationResult` with
2029
+ * `status: error` and `error_code: WEBHOOK_ERROR` or
2030
+ * `WEBHOOK_CONNECTION_ERROR`.
2031
+ *
2032
+ */
2033
+ 502: AuthorizationResult;
2034
+ /**
2035
+ * Authorization timed out (the counterparty did not respond). An
2036
+ * authorization outcome, so the body is an `AuthorizationResult` with
2037
+ * `status: timeout`.
2038
+ *
2039
+ */
2040
+ 504: AuthorizationResult;
2041
+ };
2042
+ };
2043
+ };
2044
+ '/v1/payments/quote-requests': {
2045
+ post: {
2046
+ req: CreateQuoteRequestData;
2047
+ res: {
2048
+ /**
2049
+ * Quote-request resolved synchronously. `status` is `ready` when quotes were collected,
2050
+ * or `collecting` when the sync wait cap fired before the quote deadline.
2051
+ *
2052
+ */
2053
+ 200: QuoteRequestResponse;
2054
+ /**
2055
+ * Quote-request accepted; collection continues asynchronously.
2056
+ */
2057
+ 202: QuoteRequestAccepted;
2058
+ /**
2059
+ * Invalid request. `QUOTE_DEADLINE_NOT_FUTURE` is the one worth planning for: a NEW
2060
+ * quote-request whose `quote_deadline` has already passed is refused, because there is
2061
+ * no window left to collect quotes in. It does not apply to a re-submission — an
2062
+ * already-used `request_id` resolves onto the batch that exists and its expired
2063
+ * deadline is ignored, which is what makes a retry recoverable.
2064
+ *
2065
+ */
2066
+ 400: ErrorResponse;
2067
+ /**
2068
+ * The `request_id` has already been used for a quote-request with different
2069
+ * economics (`IDEMPOTENCY_TERMS_MISMATCH`). Re-submitting one `request_id` is how a
2070
+ * retry is made safe, so it must identify one batch; use a distinct `request_id`
2071
+ * per quote-request.
2072
+ *
2073
+ */
2074
+ 409: ErrorResponse;
2075
+ /**
2076
+ * Internal server error
2077
+ */
2078
+ 500: ErrorResponse;
2079
+ /**
2080
+ * The request was not accepted: a dependency is temporarily unavailable, or this operation is paused (`SERVICE_PAUSED`). Nothing was submitted, so the request is safe to retry.
2081
+ */
2082
+ 503: ErrorResponse;
2083
+ };
2084
+ };
2085
+ };
2086
+ '/v1/payments/quote-requests/{quoteRequestId}': {
2087
+ get: {
2088
+ req: GetQuoteRequestStatusData;
2089
+ res: {
2090
+ /**
2091
+ * Quote-request status retrieved successfully
2092
+ */
2093
+ 200: QuoteRequestStatusResponse;
2094
+ /**
2095
+ * Quote-request not found, or not owned by the caller.
2096
+ */
2097
+ 404: ErrorResponse;
2098
+ /**
2099
+ * Internal server error
2100
+ */
2101
+ 500: ErrorResponse;
2102
+ };
2103
+ };
2104
+ };
2105
+ '/v1/payments/awards': {
2106
+ post: {
2107
+ req: AwardQuoteData;
2108
+ res: {
2109
+ /**
2110
+ * Award resolved synchronously. `status` is `completed` with a fulfillment_confirmation
2111
+ * when settlement finished within the sync wait, or a non-terminal payment status
2112
+ * (e.g. `awarding`) if the cap fired first.
2113
+ *
2114
+ */
2115
+ 200: AwardResponse;
2116
+ /**
2117
+ * Award accepted; settlement continues asynchronously.
2118
+ */
2119
+ 202: AwardAccepted;
2120
+ /**
2121
+ * Invalid request (bad signatures, expired quote, or ownership mismatch)
2122
+ */
2123
+ 400: ErrorResponse;
2124
+ /**
2125
+ * The quote, or another quote in the same batch, has already been awarded
2126
+ * (single-award-per-batch, FR-09).
2127
+ *
2128
+ */
2129
+ 409: ErrorResponse;
2130
+ /**
2131
+ * Internal server error
2132
+ */
2133
+ 500: ErrorResponse;
2134
+ };
2135
+ };
2136
+ };
2137
+ '/v1/defaults': {
2138
+ get: {
2139
+ req: GetDefaultsData;
2140
+ res: {
2141
+ /**
2142
+ * Chain defaults. A single object when `chain_id` was supplied, otherwise an object keyed by CAIP-2 chain id.
2143
+ */
2144
+ 200: GetDefaultsResult;
2145
+ /**
2146
+ * The `chain_id` is not a valid CAIP-2 chain identifier
2147
+ */
2148
+ 400: ErrorResponse;
2149
+ /**
2150
+ * The requested chain is not served by this gateway, or - when `chain_id` was omitted - no chain could be resolved at all
2151
+ */
2152
+ 404: ErrorResponse;
2153
+ /**
2154
+ * A dependency is temporarily unavailable
2155
+ */
2156
+ 503: ErrorResponse;
2157
+ };
2158
+ };
2159
+ };
2160
+ '/health': {
2161
+ get: {
2162
+ res: {
2163
+ /**
2164
+ * Service is healthy
2165
+ */
2166
+ 200: {
2167
+ status?: string;
2168
+ };
2169
+ };
2170
+ };
2171
+ };
2172
+ };
2173
+
2174
+ /** The signed terms a recovered permit carries. */
2175
+ interface AuthTerms {
2176
+ /** Atomic units, decimal string. */
2177
+ amount: string;
2178
+ /** Unix seconds. */
2179
+ deadlineSec: number;
2180
+ }
2181
+ /** The recovered and parsed permit, so a consumer can run its own policy checks. */
2182
+ interface ParsedPermit {
2183
+ scheme: SenderAuthMessageScheme;
2184
+ /** EVM/Tron: permit token; Solana: mint. */
2185
+ token: string;
2186
+ amount: string;
2187
+ deadlineSec: number;
2188
+ reserver: string;
2189
+ releaser: string;
2190
+ /** EVM/Tron only (Permit2 spender). */
2191
+ spender?: string;
2192
+ /** Solana only (the signed depositor). */
2193
+ depositor?: string;
2194
+ /** The escrow commitments as signed: the payee and the hash of the request id. */
2195
+ destination?: string;
2196
+ depositRequestHash?: string;
2197
+ }
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. */
2224
+ interface VerifiedSenderAuth extends AuthTerms {
2225
+ permit: ParsedPermit;
2226
+ commitment: CommitmentResult;
2227
+ }
2228
+ /** What {@link verifyPaymentRequest} returns. */
2229
+ interface VerifyResult {
2230
+ /** One entry per `sender_auth.signed_messages[]`, in order. */
2231
+ results: VerifiedSenderAuth[];
2232
+ /** The `source.account` every signature was verified to recover to. */
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;
2240
+ }
2241
+ /**
2242
+ * Expectations for {@link verifyPaymentRequest}.
2243
+ *
2244
+ * Pass the first three to check the signatures against your own terms. When omitted, the token,
2245
+ * network and amount are taken from the request itself, which proves only that the signatures
2246
+ * are consistent with fields the request's author controls.
2247
+ */
2248
+ interface VerifyPaymentRequestExpectations {
2249
+ /** Authoritative source-asset address (bare token, no CAIP prefix). */
2250
+ sourceAsset?: string;
2251
+ /** Authoritative CAIP-2 network. Parsed from the request when omitted. */
2252
+ network?: string;
2253
+ /** Authoritative max source amount to bind the permit amount against. */
2254
+ maxSourceAmount?: string;
2255
+ /** Opt-in atum-escrow-scheme fail-fast checks. */
2256
+ escrowContract?: string;
2257
+ reserver?: string;
2258
+ releaser?: string;
2259
+ /** Solana: additionally required by the deposit-hash domain, independent of role binding. */
2260
+ svmSignatureClusterId?: string;
2261
+ svmSignatureDomainVersion?: number;
2262
+ /** EVM/Tron: the Permit2 contract the signature is bound to. */
2263
+ permit2Contract?: string;
2264
+ /** Freshness reference, Unix seconds. Defaults to now. */
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';
2273
+ }
2274
+ /**
2275
+ * Recovers every `sender_auth.signed_messages[]` entry and binds the signed terms to
2276
+ * `expected`, returning the parsed permits and the account they all recover to.
2277
+ *
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.
2280
+ *
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.
2289
+ */
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;
2315
+
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 };