@atumlabs/payment-gateway-client 2.2.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import { AxiosRequestConfig, AxiosResponse } from 'axios';
2
+ import { d as AuthorizePaymentData, e as AuthorizePaymentResponse, G as GetDefaultsData, f as GetDefaultsResponse, H as HealthCheckResponse, S as SubmitPaymentData, g as SubmitPaymentResponse, h as GetPaymentStatusData, i as GetPaymentStatusResponse2, R as ResolvePaymentData, j as ResolvePaymentResponse2, k as GetPaymentTimelineData, l as GetPaymentTimelineResponse, m as PreparePaymentData, n as PreparePaymentResponse2, C as CreateQuoteRequestData, o as CreateQuoteRequestResponse, p as GetQuoteRequestStatusData, q as GetQuoteRequestStatusResponse, r as AwardQuoteData, s as AwardQuoteResponse, t as SignedMessage, E as ErrorResponse, P as PaymentRequest, u as CreateQuoteRequest } from './sender-auth-verify-C-Q-zvAO.js';
3
+ export { $ as $OpenApiTs, A as AuthTerms, w as AuthorizationResult, x as AwardAccepted, y as AwardRequest, z as AwardResponse, B as AwardedPayment, D as AwardedQuote, F as BidAward, I as ChainDefaultsByChain, J as ChainDefaultsWire, K as DataIntegrityProof, L as DeclineReason, M as DeclineSummaryEntry, N as FulfillmentConfirmation, O as GetDefaultsResult, Q as GetPaymentStatusResponse, T as OwnedAsset, a as ParsedPermit, U as PaymentBlockchainContext, W as PaymentFailure, X as PaymentResponse, Y as PaymentStatus, Z as PaymentSummary, _ as PaymentTimelineResponse, a0 as PaymentTransaction, a1 as PaymentTransactions, a2 as PreparePaymentRequest, a3 as PreparePaymentResponse, a4 as Quote, a5 as QuoteRequestAccepted, a6 as QuoteRequestResponse, a7 as QuoteRequestStatusResponse, a8 as ResolvePaymentResponse, a9 as SenderAuth, aa as SenderAuthMessageScheme, ab as TimelineStep, ac as VerifiableCredential, ad as VerifiableCredentialAuth, V as VerifiedSenderAuth, b as VerifyPaymentRequestExpectations, c as VerifyResult, ae as domain, af as error_code, ag as status, ah as status2, ai as status3, aj as status4, ak as status5, al as status6, am as status7 } from './sender-auth-verify-C-Q-zvAO.js';
4
+ import { Signer } from 'ethers';
2
5
 
3
6
  type ApiRequestOptions = {
4
7
  readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
@@ -72,1544 +75,6 @@ declare abstract class BaseHttpRequest {
72
75
  abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
73
76
  }
74
77
 
75
- /**
76
- * The result of a counterparty authorization request. Contains either
77
- * the PSP's authorization decision (authorized/declined with proof) or
78
- * an error indicating why authorization could not be completed.
79
- *
80
- */
81
- type AuthorizationResult = {
82
- /**
83
- * Correlation key for this authorization
84
- */
85
- payment_id: string;
86
- /**
87
- * The beneficiary PSP's DID
88
- */
89
- counterparty_did: string;
90
- /**
91
- * Authorization outcome. "authorized" or "declined" when the PSP responded.
92
- * "error" or "timeout" when the authorization could not be completed.
93
- *
94
- */
95
- status: 'authorized' | 'declined' | 'error' | 'timeout';
96
- /**
97
- * The PSP's raw authorization response (present when status is authorized or declined)
98
- */
99
- authorization_response?: {
100
- [key: string]: unknown;
101
- };
102
- /**
103
- * Machine-readable error code (present when status is error or timeout).
104
- * Counterparty-sourced codes are derived from the error code the
105
- * Counterparty Gateway publishes. GATEWAY_TIMEOUT, PROOF_INVALID, and
106
- * PROOF_STALE are payment-gw-specific (no counterparty envelope corresponds).
107
- *
108
- */
109
- error_code?: 'COUNTERPARTY_NOT_FOUND' | 'COUNTERPARTY_TIMEOUT' | 'WEBHOOK_ERROR' | 'WEBHOOK_CONNECTION_ERROR' | 'INTERNAL_ERROR' | 'GATEWAY_TIMEOUT' | 'PROOF_INVALID' | 'PROOF_STALE';
110
- /**
111
- * Human-readable error description
112
- */
113
- error_message?: string;
114
- /**
115
- * HTTP status code from the PSP webhook (only for WEBHOOK_ERROR)
116
- */
117
- webhook_http_status?: number;
118
- };
119
- /**
120
- * Authorization outcome. "authorized" or "declined" when the PSP responded.
121
- * "error" or "timeout" when the authorization could not be completed.
122
- *
123
- */
124
- type status = 'authorized' | 'declined' | 'error' | 'timeout';
125
- /**
126
- * Machine-readable error code (present when status is error or timeout).
127
- * Counterparty-sourced codes are derived from the error code the
128
- * Counterparty Gateway publishes. GATEWAY_TIMEOUT, PROOF_INVALID, and
129
- * PROOF_STALE are payment-gw-specific (no counterparty envelope corresponds).
130
- *
131
- */
132
- type error_code = 'COUNTERPARTY_NOT_FOUND' | 'COUNTERPARTY_TIMEOUT' | 'WEBHOOK_ERROR' | 'WEBHOOK_CONNECTION_ERROR' | 'INTERNAL_ERROR' | 'GATEWAY_TIMEOUT' | 'PROOF_INVALID' | 'PROOF_STALE';
133
- /**
134
- * Structured payment request with sender authorization and optional W3C Verifiable Credentials
135
- */
136
- type PaymentRequest = {
137
- /**
138
- * Semver-shaped declaration version (MAJOR.MINOR). The major component is locked to this schema's
139
- * parent directory (v1 → major must be 1). Producers MUST emit the canonical value exported by the
140
- * bindings' Version constant; the canonical bumps on each additive minor evolution.
141
- *
142
- */
143
- version: string;
144
- /**
145
- * Unique identifier for this payment request (used for idempotency)
146
- */
147
- request_id: string;
148
- source: OwnedAsset;
149
- /**
150
- * Array of destination assets for the settlement agent to choose from (at least one required)
151
- */
152
- destination: Array<OwnedAsset>;
153
- /**
154
- * The exact amount to be received at the destination (in the smallest unit, e.g., wei for ETH, cents for USD).
155
- *
156
- */
157
- fulfillment_amount: string;
158
- /**
159
- * The maximum amount willing to be spent from the source (in the smallest unit).
160
- *
161
- */
162
- max_source_amount?: string;
163
- /**
164
- * Required. The deadline for receiving price quotes from settlement providers. After this
165
- * point no new quotes are accepted. The gateway injects no default and validates the value
166
- * is in the future. The originator must supply it, and a request that omits it or supplies
167
- * a past value is rejected with 400.
168
- *
169
- */
170
- quote_deadline: string;
171
- /**
172
- * Required. The final deadline for completing the payment. If not completed by this time the
173
- * payment is cancelled and eligible for a refund. The gateway injects no default and validates
174
- * the value is in the future. The originator must supply it, and a request that omits it or
175
- * supplies a past value is rejected with 400.
176
- *
177
- */
178
- fulfillment_deadline: string;
179
- /**
180
- * Policy requirements for settler authentication. Keys are policy names, values indicate if the policy is required.
181
- *
182
- */
183
- settler_auth_required?: {
184
- [key: string]: (boolean);
185
- };
186
- sender_auth: SenderAuth;
187
- originator_auth?: VerifiableCredentialAuth;
188
- /**
189
- * Wallet address or public key of a trusted service that will automatically select
190
- * the best exchange rate for your payment. Leave empty to use the default selector.
191
- *
192
- */
193
- quote_selector?: string;
194
- /**
195
- * Third-party service that will independently verify your payment was delivered.
196
- * Leave empty to use the default verifier.
197
- *
198
- */
199
- fulfillment_verifier?: {
200
- /**
201
- * The wallet address or public key of the verification service
202
- */
203
- account: string;
204
- /**
205
- * Origin of the fulfillment verifier service, with no path — the caller
206
- * appends the verifier's own API paths. The gateway's `/defaults` response
207
- * supplies the default fulfillment verifier for each chain.
208
- *
209
- */
210
- endpoint: string;
211
- };
212
- /**
213
- * Escrow contract address, used to protect source funds until proof of fulfillment has been verified. Leave empty to use the default.
214
- *
215
- */
216
- escrow_contract_address?: string;
217
- /**
218
- * Fulfillment Proxy contract address, used to emit proof of fulfillment on the destination chain. Leave empty to use the default.
219
- *
220
- */
221
- fulfillment_proxy?: string;
222
- /**
223
- * Optional settler filtering requirements.
224
- * If whitelist is present, only whitelisted settlers may win.
225
- * If blacklist is present, blacklisted settlers are excluded.
226
- * Both can be specified together; blacklist takes precedence
227
- * (a settler in both lists is rejected).
228
- *
229
- */
230
- settler_requirements?: {
231
- /**
232
- * List of settler DIDs permitted to fulfill this request.
233
- * If present, only these settlers may win.
234
- * Use W3C DID format.
235
- *
236
- */
237
- whitelist?: Array<(string)>;
238
- /**
239
- * List of settler DIDs excluded from fulfilling this request.
240
- * Use W3C DID format.
241
- *
242
- */
243
- blacklist?: Array<(string)>;
244
- };
245
- };
246
- /**
247
- * Confirmation details after a payment has been successfully delivered.
248
- * Contains proof of delivery and transaction details for both source and destination chains.
249
- *
250
- */
251
- type FulfillmentConfirmation = {
252
- /**
253
- * Unique identifier for this payment transaction.
254
- * Use this to track the payment across all systems.
255
- *
256
- */
257
- payment_id: string;
258
- /**
259
- * Your original request ID that was provided when creating the payment.
260
- * Helps match confirmations to your internal systems.
261
- *
262
- */
263
- request_id: string;
264
- /**
265
- * Timestamp when the fulfillment was completed
266
- */
267
- fulfillment_timestamp: string;
268
- /**
269
- * The blockchain where funds were locked in escrow, using CAIP-2 format.
270
- * CAIP-2 is a standard way to identify blockchains: {namespace}:{reference}
271
- * Examples:
272
- * - "eip155:1" for Ethereum mainnet
273
- * - "eip155:42161" for Arbitrum
274
- * - "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp" for Solana
275
- * - "tron:mainnet" for Tron
276
- *
277
- */
278
- source_chain_id: string;
279
- /**
280
- * The blockchain where the payment was delivered, using CAIP-2 format.
281
- * CAIP-2 is a standard way to identify blockchains: {namespace}:{reference}
282
- * Examples:
283
- * - "eip155:1" for Ethereum mainnet
284
- * - "eip155:42161" for Arbitrum
285
- * - "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp" for Solana
286
- * - "tron:mainnet" for Tron
287
- *
288
- */
289
- destination_chain_id: string;
290
- /**
291
- * Transaction hash of the escrow reservation on the source chain
292
- */
293
- source_tx_hash?: string;
294
- /**
295
- * Transaction hash of the fulfillment on the destination chain
296
- */
297
- destination_tx_hash?: string;
298
- /**
299
- * Block number where the source transaction was confirmed
300
- */
301
- source_block_number?: number;
302
- /**
303
- * Block number where the destination transaction was confirmed
304
- */
305
- destination_block_number?: number;
306
- };
307
- /**
308
- * Represents a cryptocurrency or token in a specific wallet.
309
- * This tells the system what asset you're sending/receiving and which wallet to use.
310
- *
311
- */
312
- type OwnedAsset = {
313
- /**
314
- * A unique identifier for the asset using CAIP-19 format.
315
- * CAIP-19 is a standard way to identify blockchain assets: {chain_id}/{asset_namespace}:{asset_reference}
316
- * Examples:
317
- * - Ethereum USDC: "eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
318
- * - Arbitrum USDC: "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831"
319
- * - Solana USDC: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
320
- * - Tron USDT: "tron:mainnet/trc20:TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
321
- *
322
- */
323
- asset_identifier: string;
324
- /**
325
- * The wallet address that owns this asset.
326
- * Format depends on the blockchain:
327
- * - Ethereum/EVM: 0x-prefixed hex address (42 characters)
328
- * - Solana: Base58 encoded address
329
- * - Tron: T-prefixed Base58 address
330
- *
331
- */
332
- account: string;
333
- };
334
- /**
335
- * Authorization from the asset owner to execute the payment. The exact format depends on
336
- * the source blockchain's authorization mechanism.
337
- *
338
- */
339
- type SenderAuth = {
340
- verifiable_credential?: VerifiableCredentialAuth;
341
- message_scheme: SenderAuthMessageScheme;
342
- /**
343
- * Array of signed messages (at least one required)
344
- */
345
- signed_messages: Array<SignedMessage>;
346
- };
347
- /**
348
- * The signature method used for authorizing this payment:
349
- * - `EVM_PERMIT2`: Gasless token approvals for Ethereum/EVM chains
350
- * - `SOLANA`: Standard Solana transaction signatures
351
- * - `TRON`: Tron transaction signatures
352
- *
353
- */
354
- type SenderAuthMessageScheme = 'EVM_PERMIT2' | 'EVM_PERMIT2_ESCROW' | 'SOLANA' | 'TRON';
355
- /**
356
- * A message that has been cryptographically signed to prove authorization.
357
- * The signature proves you control the wallet that's sending funds.
358
- *
359
- */
360
- type SignedMessage = {
361
- /**
362
- * The data that was signed. Format depends on the blockchain:
363
- * - EVM: Hex-encoded message hash (with 0x prefix)
364
- * - Solana: Base64 encoded message
365
- * - Tron: Hex-encoded message hash (possibly without 0x prefix)
366
- *
367
- */
368
- message: string;
369
- /**
370
- * Optional: If 'message' contains a hash, this field contains the original data
371
- * before it was hashed. Useful for verification and debugging.
372
- *
373
- */
374
- message_prehash?: string;
375
- /**
376
- * The cryptographic signature proving you authorized this message.
377
- * Format varies by blockchain (hex for EVM/Tron, base58 for Solana).
378
- *
379
- */
380
- signature: string;
381
- };
382
- /**
383
- * Optional identity verification using cryptographic credentials.
384
- * Required when regulatory compliance or KYC verification is needed for the payment.
385
- *
386
- */
387
- type VerifiableCredentialAuth = {
388
- verifiable_credential: VerifiableCredential;
389
- /**
390
- * Reference to verification method from the DID Document
391
- */
392
- verification_method_id: string;
393
- /**
394
- * Cryptographic signature matching the verification method type
395
- */
396
- signature: string;
397
- };
398
- /**
399
- * W3C Verifiable Credential structure conforming to the W3C Verifiable Credentials Data Model v1.1
400
- */
401
- type VerifiableCredential = {
402
- /**
403
- * JSON-LD context array, must include 'https://www.w3.org/2018/credentials/v1'
404
- */
405
- '@context': Array<(string)>;
406
- /**
407
- * Unique identifier for this credential
408
- */
409
- id: string;
410
- /**
411
- * Credential types, must include 'VerifiableCredential'
412
- */
413
- type: Array<(string)>;
414
- /**
415
- * DID or issuer object of the credential issuer
416
- */
417
- issuer: string | {
418
- [key: string]: unknown;
419
- };
420
- /**
421
- * When the credential was issued
422
- */
423
- issuanceDate: string;
424
- /**
425
- * When the credential expires
426
- */
427
- expirationDate?: string;
428
- /**
429
- * Claims about the credential subject (structure varies by issuer)
430
- */
431
- credentialSubject: {
432
- [key: string]: unknown;
433
- };
434
- /**
435
- * Information for credential revocation checking
436
- */
437
- credentialStatus?: {
438
- [key: string]: unknown;
439
- };
440
- /**
441
- * Cryptographic proof of credential integrity
442
- */
443
- proof: {
444
- [key: string]: unknown;
445
- };
446
- };
447
- /**
448
- * Response from submitting a payment request. If settlement completes inside the
449
- * gateway's synchronous window, the response includes a fulfillment_confirmation with
450
- * full settlement details. Otherwise you receive a payment_id plus the payment's
451
- * current `status`, and can poll /v1/payments/{paymentId}/status for updates.
452
- *
453
- * Read `status` before deciding what to do next: a `pending` payment is in flight and
454
- * must NOT be re-submitted under a new request_id (that would be a second payment),
455
- * whereas a `failed` or `cancelled` one is terminal — re-submitting it under the SAME
456
- * request_id resolves to the same terminal payment, so a genuine re-attempt needs a
457
- * new request_id.
458
- *
459
- */
460
- type PaymentResponse = {
461
- /**
462
- * Unique ID for tracking this payment. Save this to check status later.
463
- *
464
- */
465
- payment_id: string;
466
- /**
467
- * Current status of the payment, with the same meaning as on
468
- * /v1/payments/{paymentId}/status:
469
- * - `pending`: accepted and being processed
470
- * - `completed`: successfully delivered
471
- * - `failed`: failed (funds returned if escrowed)
472
- * - `cancelled`: cancelled before completion
473
- *
474
- * Present on every response. `completed` is always accompanied by
475
- * fulfillment_confirmation; `failed` is accompanied by `error` where a reason has
476
- * been recorded.
477
- *
478
- */
479
- status: 'pending' | 'completed' | 'failed' | 'cancelled';
480
- /**
481
- * Whether this response describes a payment that already existed, rather than one
482
- * created by this request. `true` means the request_id had been used before and you
483
- * are being handed the ORIGINAL payment — no second payment was created and nothing
484
- * additional was charged.
485
- *
486
- * **Re-attempting a payment.** Re-submit the same request and you get the same payment
487
- * back. You may re-send the original bytes unchanged: the deadlines will have expired by
488
- * then — `quote_deadline` bounds the auction and is short, while this endpoint may hold a
489
- * submission for up to 30 seconds — and an expired deadline on a re-submission is not an
490
- * error, because the request is resolved onto the payment that already exists rather than
491
- * used to create one.
492
- *
493
- * Re-signing with fresh deadlines is equally fine and returns the same payment. What you
494
- * must NOT change is the request_id, and what you must not change under it is the
495
- * payment's economics — source, destination, fulfillment_amount, max_source_amount — which
496
- * are rejected with 409 IDEMPOTENCY_TERMS_MISMATCH. Deadlines and the signature are
497
- * exempt precisely so that a re-attempt is possible.
498
- *
499
- * A genuinely new payment needs a NEW request_id. In particular a `failed` payment is
500
- * terminal: re-submitting its request_id keeps returning that dead payment, so recovering
501
- * means starting a new one under a new key.
502
- *
503
- * Present on every response, `false` for a newly created payment. A response without
504
- * the field is from a gateway predating it, not a newly created payment.
505
- *
506
- * This is the field to read when reconciling a suspected double charge: two
507
- * submissions where the second reports `true` are one payment, whereas two both
508
- * reporting `false` are two. It says nothing about how far the payment has got —
509
- * read `status` for that.
510
- *
511
- */
512
- idempotent_replay: boolean;
513
- fulfillment_confirmation?: FulfillmentConfirmation;
514
- error?: PaymentError;
515
- };
516
- /**
517
- * Current status of the payment, with the same meaning as on
518
- * /v1/payments/{paymentId}/status:
519
- * - `pending`: accepted and being processed
520
- * - `completed`: successfully delivered
521
- * - `failed`: failed (funds returned if escrowed)
522
- * - `cancelled`: cancelled before completion
523
- *
524
- * Present on every response. `completed` is always accompanied by
525
- * fulfillment_confirmation; `failed` is accompanied by `error` where a reason has
526
- * been recorded.
527
- *
528
- */
529
- type status2 = 'pending' | 'completed' | 'failed' | 'cancelled';
530
- type GetPaymentStatusResponse = {
531
- /**
532
- * The payment ID you're checking status for.
533
- *
534
- */
535
- payment_id?: string;
536
- /**
537
- * Current status of your payment:
538
- * - `pending`: Payment is being processed
539
- * - `completed`: Payment successfully delivered
540
- * - `failed`: Payment failed (funds returned if escrowed)
541
- * - `cancelled`: Payment was cancelled before completion
542
- *
543
- */
544
- status?: 'pending' | 'completed' | 'failed' | 'cancelled';
545
- /**
546
- * When the status was last updated
547
- */
548
- updated_at?: string;
549
- fulfillment_confirmation?: FulfillmentConfirmation;
550
- error?: PaymentError;
551
- };
552
- /**
553
- * Error details when payment status is "failed".
554
- * Only present when the payment has failed. Contains a machine-readable
555
- * code for programmatic handling and a human-readable message for debugging.
556
- *
557
- */
558
- type PaymentError = {
559
- /**
560
- * Public error category in SCREAMING_SNAKE_CASE.
561
- * Common codes:
562
- * - `SETTLEMENT_FAILED`: The settlement could not be completed
563
- * - `NO_ROUTE_AVAILABLE`: No settlement route was available
564
- * - `INTERNAL_ERROR`: An unexpected error occurred
565
- *
566
- */
567
- code: string;
568
- /**
569
- * Human-readable error description with additional context.
570
- *
571
- */
572
- message: string;
573
- /**
574
- * Service domain where the error originated.
575
- *
576
- */
577
- domain?: 'PAYMENT_GATEWAY' | 'SOLVER_GATEWAY' | 'SETTLER_AGENT' | 'WALLET_ORCHESTRATION' | 'VERIFICATION_SERVICE' | 'BLOCKCHAIN' | 'EXTERNAL_SERVICE';
578
- blockchain_context?: PaymentBlockchainContext;
579
- };
580
- /**
581
- * Service domain where the error originated.
582
- *
583
- */
584
- type domain = 'PAYMENT_GATEWAY' | 'SOLVER_GATEWAY' | 'SETTLER_AGENT' | 'WALLET_ORCHESTRATION' | 'VERIFICATION_SERVICE' | 'BLOCKCHAIN' | 'EXTERNAL_SERVICE';
585
- /**
586
- * Blockchain-specific error context. Only present when the error
587
- * originated from an on-chain operation (e.g., escrow revert,
588
- * fulfillment failure).
589
- *
590
- */
591
- type PaymentBlockchainContext = {
592
- /**
593
- * CAIP-2 chain identifier
594
- */
595
- chain_id?: string;
596
- /**
597
- * Failed transaction hash
598
- */
599
- tx_hash?: string;
600
- /**
601
- * Block number where error occurred
602
- */
603
- block_number?: number;
604
- /**
605
- * Contract address involved in the error
606
- */
607
- contract_address?: string;
608
- /**
609
- * Smart contract revert reason
610
- */
611
- revert_reason?: string;
612
- /**
613
- * Gas consumed before failure
614
- */
615
- gas_used?: string;
616
- /**
617
- * Estimated gas needed for success
618
- */
619
- estimated_gas_needed?: string;
620
- };
621
- /**
622
- * Human-readable payment request parameters for generating an unsigned PaymentRequest.
623
- * Asset identifiers use a CAIP-19-like format with "/" separator and support friendly names.
624
- *
625
- */
626
- type PreparePaymentRequest = {
627
- /**
628
- * Unique identifier for tracking this payment request.
629
- * Used for idempotency and matching responses to requests.
630
- *
631
- */
632
- request_id: string;
633
- /**
634
- * Source asset in human-readable CAIP-19-like format: {chain}/{asset}
635
- * Supports both friendly names and full CAIP-19 identifiers:
636
- * - "ethereum/usdc" (friendly names)
637
- * - "eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" (full CAIP-19)
638
- *
639
- */
640
- source_asset: string;
641
- /**
642
- * Wallet address that will send the payment
643
- */
644
- source_account: string;
645
- /**
646
- * Destination asset in human-readable CAIP-19-like format: {chain}/{asset}
647
- * Supports both friendly names and full CAIP-19 identifiers:
648
- * - "arbitrum/usdc"
649
- * - "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831"
650
- *
651
- */
652
- destination_asset: string;
653
- /**
654
- * Wallet address that will receive the payment
655
- */
656
- destination_account: string;
657
- /**
658
- * Simple amount specification in decimal format (e.g., "1.50" for $1.50 USDC).
659
- * Use this OR specify both max_source_amount and fulfillment_amount.
660
- * Cannot be used together with max_source_amount/fulfillment_amount.
661
- *
662
- */
663
- amount?: string;
664
- /**
665
- * Maximum amount willing to spend from source (in decimal format).
666
- * Must be specified together with fulfillment_amount.
667
- * Cannot be used together with amount field.
668
- *
669
- */
670
- max_source_amount?: string;
671
- /**
672
- * Exact amount to be fulfilled at destination (in decimal format).
673
- * Must be specified together with max_source_amount.
674
- * Cannot be used together with amount field.
675
- *
676
- */
677
- fulfillment_amount?: string;
678
- /**
679
- * Seconds until quote deadline (from now).
680
- * How long to wait for settlement provider quotes.
681
- *
682
- */
683
- quote_deadline_seconds?: number;
684
- /**
685
- * Seconds until fulfillment deadline (from now).
686
- * Final deadline for completing the payment.
687
- *
688
- */
689
- fulfillment_deadline_seconds?: number;
690
- };
691
- /**
692
- * Complete unsigned PaymentRequest ready for signing.
693
- * Contains all resolved technical details and typed data ready for signing.
694
- *
695
- */
696
- type PreparePaymentResponse = {
697
- /**
698
- * Complete PaymentRequest with signature field set to null.
699
- * Client should fill in the signature field(s) in
700
- * sender_auth.signed_messages, either by signing the message_hash
701
- * field in signed_messages or by using typed data signing on the
702
- * message_prehash field in signed messages, and then submit the full
703
- * object to POST /v1/payments.
704
- *
705
- */
706
- payment_request: PaymentRequest;
707
- };
708
- type ResolvePaymentResponse = {
709
- /**
710
- * The payment ID that corresponds to the given request ID
711
- */
712
- payment_id: string;
713
- };
714
- /**
715
- * Step-by-step view of a payment's settlement lifecycle. Includes a route
716
- * summary, a list of steps with timings, and if the payment failed, a
717
- * structured error describing where and why.
718
- *
719
- */
720
- type PaymentTimelineResponse = {
721
- payment_id: string;
722
- /**
723
- * High-level status:
724
- * - `pending`: Bidding, awarded, or early in settlement
725
- * - `settling`: Settlement in progress (on-chain steps executing)
726
- * - `completed`: Payment successfully delivered
727
- * - `failed`: Payment failed
728
- * - `cancelled`: Payment was cancelled
729
- *
730
- */
731
- status: 'pending' | 'settling' | 'completed' | 'failed' | 'cancelled';
732
- created_at: string;
733
- updated_at: string;
734
- /**
735
- * Total time from first step to last completed step (only set for terminal states)
736
- */
737
- total_duration_ms?: number;
738
- summary?: PaymentSummary;
739
- error?: TimelineError;
740
- steps: Array<TimelineStep>;
741
- };
742
- /**
743
- * High-level status:
744
- * - `pending`: Bidding, awarded, or early in settlement
745
- * - `settling`: Settlement in progress (on-chain steps executing)
746
- * - `completed`: Payment successfully delivered
747
- * - `failed`: Payment failed
748
- * - `cancelled`: Payment was cancelled
749
- *
750
- */
751
- type status3 = 'pending' | 'settling' | 'completed' | 'failed' | 'cancelled';
752
- /**
753
- * Top-level context about the payment (parties, assets, amounts)
754
- */
755
- type PaymentSummary = {
756
- /**
757
- * CAIP-19 identifier of the source asset
758
- */
759
- source_asset?: string;
760
- source_account?: string;
761
- dest_asset?: string;
762
- dest_account?: string;
763
- /**
764
- * Raw fulfillment amount in smallest token units
765
- */
766
- fulfillment_amount?: string;
767
- /**
768
- * Human-readable formatted amount with symbol, e.g. "1.00 USDC".
769
- * Only set when the source asset's decimals are known via the token registry.
770
- *
771
- */
772
- display_amount?: string;
773
- /**
774
- * Raw max source amount in smallest token units
775
- */
776
- max_source_amount?: string;
777
- request_id?: string;
778
- };
779
- /**
780
- * Structured error details when a payment has failed
781
- */
782
- type TimelineError = {
783
- /**
784
- * Machine-readable error code
785
- */
786
- code: string;
787
- /**
788
- * Human-readable error description
789
- */
790
- message: string;
791
- /**
792
- * Which component reported the error
793
- */
794
- domain?: string;
795
- /**
796
- * CAIP-2 chain where the error occurred (if on-chain)
797
- */
798
- chain_id?: string;
799
- /**
800
- * Transaction hash of the failed on-chain attempt (if applicable)
801
- */
802
- tx_hash?: string;
803
- /**
804
- * Smart-contract revert reason (if the error was an on-chain revert)
805
- */
806
- revert_reason?: string;
807
- };
808
- type TimelineStep = {
809
- /**
810
- * Internal name of the step (matches settlement event type)
811
- */
812
- name: string;
813
- /**
814
- * Human-readable label
815
- */
816
- label: string;
817
- /**
818
- * Current status of this step:
819
- * - `completed`: Step finished successfully
820
- * - `in_progress`: Step currently executing
821
- * - `pending`: Step hasn't started yet
822
- * - `failed`: Step errored out
823
- * - `skipped`: Step will never execute because an earlier step failed
824
- *
825
- */
826
- status: 'completed' | 'in_progress' | 'pending' | 'failed' | 'skipped';
827
- /**
828
- * When the step completed (if it has)
829
- */
830
- timestamp?: string;
831
- /**
832
- * Time this step took, measured from the previous step
833
- */
834
- duration_ms?: number;
835
- /**
836
- * CAIP-2 chain this step happened on (if on-chain)
837
- */
838
- chain_id?: string;
839
- /**
840
- * Transaction hash associated with this step (if on-chain)
841
- */
842
- tx_hash?: string;
843
- /**
844
- * Additional step-specific data (e.g. block_number, settler, reason)
845
- */
846
- details?: {
847
- [key: string]: unknown;
848
- };
849
- };
850
- /**
851
- * Current status of this step:
852
- * - `completed`: Step finished successfully
853
- * - `in_progress`: Step currently executing
854
- * - `pending`: Step hasn't started yet
855
- * - `failed`: Step errored out
856
- * - `skipped`: Step will never execute because an earlier step failed
857
- *
858
- */
859
- type status4 = 'completed' | 'in_progress' | 'pending' | 'failed' | 'skipped';
860
- /**
861
- * 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.
862
- */
863
- type ErrorResponse = {
864
- /**
865
- * Public, machine-readable error category in SCREAMING_SNAKE_CASE.
866
- */
867
- code: string;
868
- /**
869
- * Curated, safe, human-readable message.
870
- */
871
- message: string;
872
- /**
873
- * Correlation id to quote to support to locate the internal error record.
874
- */
875
- request_id?: string;
876
- /**
877
- * Link to the documentation page for this public code.
878
- */
879
- docs_url?: string;
880
- /**
881
- * Originating service domain.
882
- */
883
- domain?: string;
884
- };
885
- /**
886
- * Request body for opening a quote-request batch. Structurally the existing PaymentRequest
887
- * with `sender_auth` omitted (the spend authorization is deferred to the award call); see
888
- * schemas/declarations/PaymentRequest/v1/schema.json.
889
- *
890
- */
891
- type CreateQuoteRequest = {
892
- /**
893
- * Semver-shaped declaration version (MAJOR.MINOR), locked to major 1 for v1. Producers emit
894
- * the canonical value exported by the bindings' Version constant.
895
- *
896
- */
897
- version: string;
898
- /**
899
- * Client-supplied idempotency key for this quote-request. The same request_id from the
900
- * same originator returns the same quote_request_id. Independent of the award-call request_id.
901
- *
902
- */
903
- request_id: string;
904
- source: OwnedAsset;
905
- /**
906
- * Array of destination assets for the settlement agent to choose from (at least one required).
907
- */
908
- destination: Array<OwnedAsset>;
909
- /**
910
- * The exact amount to be received at the destination (smallest unit, e.g. wei or cents).
911
- */
912
- fulfillment_amount: string;
913
- /**
914
- * Optional cap on what the originator is willing to spend from source (smallest unit).
915
- * Quotes with source_amount above this are filtered. No cap applied if omitted.
916
- *
917
- */
918
- max_source_amount?: string;
919
- /**
920
- * Required. End of the collection window. After this point no new quotes are accepted.
921
- * The gateway injects no default and never mutates the originator-supplied body, so the
922
- * value is carried through verbatim to the award call. It must be supplied and must be in
923
- * the future. Must be strictly earlier than fulfillment_deadline.
924
- *
925
- */
926
- quote_deadline: string;
927
- /**
928
- * Required. Final deadline for completing the payment. Past it the payment is cancelled and
929
- * eligible for refund. The gateway injects no default and never mutates the
930
- * originator-supplied body, so the value is carried through verbatim to the award call. It
931
- * must be supplied and must be in the future. Must be strictly later than quote_deadline.
932
- *
933
- */
934
- fulfillment_deadline: string;
935
- /**
936
- * Policy requirements for settler authentication. Keys are policy names, values indicate if required.
937
- */
938
- settler_auth_required?: {
939
- [key: string]: (boolean);
940
- };
941
- originator_auth?: VerifiableCredentialAuth;
942
- /**
943
- * Wallet address or public key of a trusted service that auto-selects the best rate.
944
- * Leave empty to use the default selector.
945
- *
946
- */
947
- quote_selector?: string;
948
- /**
949
- * Optional third-party service that independently verifies delivery. Leave empty for the default verifier.
950
- */
951
- fulfillment_verifier?: {
952
- /**
953
- * The wallet address or public key of the verification service
954
- */
955
- account: string;
956
- /**
957
- * Origin of the fulfillment verifier service, with no path — the caller
958
- * appends the verifier's own API paths. The gateway's `/defaults` response
959
- * supplies the default fulfillment verifier for each chain.
960
- *
961
- */
962
- endpoint: string;
963
- };
964
- /**
965
- * Optional escrow contract address. Leave empty to use the default.
966
- */
967
- escrow_contract_address?: string;
968
- /**
969
- * Optional fulfillment-proxy contract address on the destination chain. Leave empty to use the default.
970
- */
971
- fulfillment_proxy?: string;
972
- /**
973
- * Optional settler filtering. If whitelist is present, only whitelisted settlers may win.
974
- * If blacklist is present, blacklisted settlers are excluded. Both can be specified;
975
- * blacklist takes precedence (a settler in both is rejected).
976
- *
977
- */
978
- settler_requirements?: {
979
- /**
980
- * Settler DIDs permitted to fulfill this request (W3C DID format). If present, only these may win.
981
- */
982
- whitelist?: Array<(string)>;
983
- /**
984
- * Settler DIDs excluded from fulfilling this request (W3C DID format).
985
- */
986
- blacklist?: Array<(string)>;
987
- };
988
- /**
989
- * Optional JSON-LD context URLs — present when the originator wraps the request in a W3C
990
- * Data Integrity envelope so a downstream verifier can recover the signer identity.
991
- *
992
- */
993
- '@context'?: Array<(string)>;
994
- proof?: DataIntegrityProof;
995
- /**
996
- * Optional document-level W3C Verifiable Credentials (e.g. KnownToAtum about the request producer).
997
- */
998
- verifiableCredential?: Array<VerifiableCredential>;
999
- };
1000
- /**
1001
- * W3C Data Integrity proof conforming to the Data Integrity 1.0 specification.
1002
- */
1003
- type DataIntegrityProof = {
1004
- /**
1005
- * Proof type identifier (e.g. EcdsaSecp256k1RecoverySignature2020).
1006
- */
1007
- type: string;
1008
- /**
1009
- * ISO 8601 timestamp when the proof was created.
1010
- */
1011
- created: string;
1012
- /**
1013
- * DID URL identifying the verification method.
1014
- */
1015
- verificationMethod: string;
1016
- /**
1017
- * Purpose of the proof (e.g. assertionMethod, authentication).
1018
- */
1019
- proofPurpose: string;
1020
- /**
1021
- * Detached JWS signature (header..signature format for ES256K-R).
1022
- */
1023
- jws?: string;
1024
- /**
1025
- * Alternative to jws: base-encoded proof value.
1026
- */
1027
- proofValue?: string;
1028
- };
1029
- /**
1030
- * One collected quote — the content-hash identifier plus the verbatim settler-signed FulfillmentQuote.
1031
- */
1032
- type Quote = {
1033
- /**
1034
- * Canonical content-hash of the signed quote bytes; identifies the quote server-side at
1035
- * award time. Provided as a convenience — the gateway re-derives it from
1036
- * bid_award.fulfillment_quote_json.
1037
- *
1038
- */
1039
- quote_id: string;
1040
- /**
1041
- * The settler-signed FulfillmentQuote (structurally the canonical FulfillmentQuote/v1
1042
- * declaration at https://schemas.atum.xyz/declarations/FulfillmentQuote/v1), returned
1043
- * verbatim as an opaque signed document. A client recomputes quote_hash over the returned
1044
- * bytes and verifies the settler signature, then re-embeds them into
1045
- * bid_award.fulfillment_quote_json at award. quote_hash is canonicalization-based
1046
- * (URDNA2015), so it is stable across JSON key-order/whitespace normalization. The
1047
- * returned bytes are hash-equivalent to, but not necessarily byte-identical with, what the
1048
- * settler emitted (quotes are stored as JSONB, which normalizes on write). The gateway
1049
- * still never re-serializes the quote through a typed struct (that renormalizes timestamp
1050
- * values and WOULD change quote_hash), so the Go binding exposes it as a raw JSON passthrough.
1051
- *
1052
- */
1053
- fulfillment_quote: {
1054
- [key: string]: unknown;
1055
- };
1056
- };
1057
- /**
1058
- * A collected quote in the status response, annotated with its award linkage.
1059
- */
1060
- type AwardedQuote = {
1061
- quote_id: string;
1062
- /**
1063
- * The settler-signed FulfillmentQuote (structurally the canonical FulfillmentQuote/v1
1064
- * declaration at https://schemas.atum.xyz/declarations/FulfillmentQuote/v1), returned
1065
- * verbatim as an opaque signed document. A client recomputes quote_hash over the returned
1066
- * bytes and verifies the settler signature, then re-embeds them into
1067
- * bid_award.fulfillment_quote_json at award. quote_hash is canonicalization-based
1068
- * (URDNA2015), so it is stable across JSON key-order/whitespace normalization. The
1069
- * returned bytes are hash-equivalent to, but not necessarily byte-identical with, what the
1070
- * settler emitted (quotes are stored as JSONB, which normalizes on write). The gateway
1071
- * still never re-serializes the quote through a typed struct (that renormalizes timestamp
1072
- * values and WOULD change quote_hash), so the Go binding exposes it as a raw JSON passthrough.
1073
- *
1074
- */
1075
- fulfillment_quote: {
1076
- [key: string]: unknown;
1077
- };
1078
- /**
1079
- * payment_id if this quote was awarded; null otherwise. Under MVP single-award, at most
1080
- * one quote per batch carries a non-null value.
1081
- *
1082
- */
1083
- awarded_payment_id?: string | null;
1084
- };
1085
- /**
1086
- * A (quote_id, payment_id) pair for an awarded quote in a batch.
1087
- */
1088
- type AwardedPayment = {
1089
- quote_id: string;
1090
- payment_id: string;
1091
- };
1092
- /**
1093
- * Synchronous response to POST /v1/payments/quote-requests. Self-contained — the corridor
1094
- * fields are echoed at the response root so a drop-recovery client can build the award call
1095
- * without retaining the original request body.
1096
- *
1097
- */
1098
- type QuoteRequestResponse = {
1099
- /**
1100
- * Gateway-generated resource ID for the batch, used in subsequent status reads and awards.
1101
- */
1102
- quote_request_id: string;
1103
- /**
1104
- * Collection-phase outcome of the create call:
1105
- * - `ready` — collection complete; `quotes` populated. If no settler bid, this is still
1106
- * `ready` with an empty `quotes` array (a successful "no quotes available" result —
1107
- * distinct from `expired`, which only applies to collected quotes that later lapse).
1108
- * - `collecting` — the sync wait cap fired before the quote deadline; poll the status endpoint for quotes.
1109
- * The `awarded` and `expired` lifecycle states are observed only via the status endpoint, not here.
1110
- *
1111
- */
1112
- status: 'collecting' | 'ready';
1113
- source?: OwnedAsset;
1114
- destination?: Array<OwnedAsset>;
1115
- fulfillment_amount?: string;
1116
- max_source_amount?: string;
1117
- fulfillment_deadline?: string;
1118
- quote_deadline?: string;
1119
- /**
1120
- * Collected quotes. Present when status is `ready` — an empty array if no settler bid.
1121
- */
1122
- quotes?: Array<Quote>;
1123
- };
1124
- /**
1125
- * Collection-phase outcome of the create call:
1126
- * - `ready` — collection complete; `quotes` populated. If no settler bid, this is still
1127
- * `ready` with an empty `quotes` array (a successful "no quotes available" result —
1128
- * distinct from `expired`, which only applies to collected quotes that later lapse).
1129
- * - `collecting` — the sync wait cap fired before the quote deadline; poll the status endpoint for quotes.
1130
- * The `awarded` and `expired` lifecycle states are observed only via the status endpoint, not here.
1131
- *
1132
- */
1133
- type status5 = 'collecting' | 'ready';
1134
- /**
1135
- * Asynchronous (202) response to POST /v1/payments/quote-requests. Returns the batch handle
1136
- * plus the echoed corridor; quotes are retrieved via the status endpoint.
1137
- *
1138
- */
1139
- type QuoteRequestAccepted = {
1140
- quote_request_id: string;
1141
- /**
1142
- * Always `collecting` — collection is in progress server-side.
1143
- */
1144
- status: 'collecting';
1145
- source?: OwnedAsset;
1146
- destination?: Array<OwnedAsset>;
1147
- fulfillment_amount?: string;
1148
- max_source_amount?: string;
1149
- fulfillment_deadline?: string;
1150
- quote_deadline?: string;
1151
- };
1152
- /**
1153
- * Always `collecting` — collection is in progress server-side.
1154
- */
1155
- type status6 = 'collecting';
1156
- /**
1157
- * Response to GET /v1/payments/quote-requests/{quoteRequestId}. The `status` enum describes
1158
- * the quote-request batch lifecycle and is disjoint from the payment-status enum.
1159
- *
1160
- */
1161
- type QuoteRequestStatusResponse = {
1162
- quote_request_id: string;
1163
- /**
1164
- * Derived batch lifecycle, computed at read time (not a stored state machine). Disjoint
1165
- * from the payment-status enum returned by the award and payment-status endpoints.
1166
- * - `collecting` — collection window still open; `quotes` lists those collected so far
1167
- * (a quote is awardable from arrival, by its own `award_deadline`; more may arrive until
1168
- * `collection_close`).
1169
- * - `ready` — collection complete; none awarded yet; either at least one quote is still
1170
- * within its `award_deadline`, or no settler bid (empty `quotes` array — the successful
1171
- * "no quotes available" result).
1172
- * - `awarded` — a quote produced a payment row; no further awards accepted (MVP).
1173
- * - `expired` — collection closed, nothing awarded, and every collected quote is now past
1174
- * its `award_deadline` ("quotes lapsed"). An empty batch is `ready`, not `expired` — the
1175
- * two are deliberately distinct ("no quotes available" vs "quotes lapsed").
1176
- *
1177
- */
1178
- status: 'collecting' | 'ready' | 'awarded' | 'expired';
1179
- /**
1180
- * Collected quotes with award linkage — those collected so far while `collecting`, the full set once the window closes.
1181
- */
1182
- quotes?: Array<AwardedQuote>;
1183
- /**
1184
- * Flat list of awarded (quote_id, payment_id) pairs. At most one entry under MVP single-award.
1185
- */
1186
- payments?: Array<AwardedPayment>;
1187
- };
1188
- /**
1189
- * Derived batch lifecycle, computed at read time (not a stored state machine). Disjoint
1190
- * from the payment-status enum returned by the award and payment-status endpoints.
1191
- * - `collecting` — collection window still open; `quotes` lists those collected so far
1192
- * (a quote is awardable from arrival, by its own `award_deadline`; more may arrive until
1193
- * `collection_close`).
1194
- * - `ready` — collection complete; none awarded yet; either at least one quote is still
1195
- * within its `award_deadline`, or no settler bid (empty `quotes` array — the successful
1196
- * "no quotes available" result).
1197
- * - `awarded` — a quote produced a payment row; no further awards accepted (MVP).
1198
- * - `expired` — collection closed, nothing awarded, and every collected quote is now past
1199
- * its `award_deadline` ("quotes lapsed"). An empty batch is `ready`, not `expired` — the
1200
- * two are deliberately distinct ("no quotes available" vs "quotes lapsed").
1201
- *
1202
- */
1203
- type status7 = 'collecting' | 'ready' | 'awarded' | 'expired';
1204
- /**
1205
- * Request body for POST /v1/payments/awards. Carries the two originator-signed artifacts:
1206
- * `sender_auth` (Permit2 deposit authorization) and a fully-formed `bid_award` declaration.
1207
- * The awarded quote is derived server-side from bid_award.fulfillment_quote_json — no
1208
- * explicit quote_id on the wire.
1209
- *
1210
- */
1211
- type AwardRequest = {
1212
- /**
1213
- * Client-supplied idempotency key for this award call. Independent of the quote-request's request_id.
1214
- */
1215
- request_id: string;
1216
- sender_auth: SenderAuth;
1217
- bid_award: BidAward;
1218
- };
1219
- /**
1220
- * Fully-formed, originator-signed bid award. Mirrors schemas/declarations/BidAward/v1/schema.json.
1221
- * `authorization` carries the Escrow reserve-witness signature naming the chosen settler;
1222
- * `fulfillment_quote_json` is the verbatim settler-signed quote string received in the quote
1223
- * response (carrying the settler's proof).
1224
- *
1225
- */
1226
- type BidAward = {
1227
- /**
1228
- * Semver-shaped declaration version (MAJOR.MINOR), locked to major 1 for v1. Producers emit
1229
- * the canonical value exported by the bindings' Version constant.
1230
- *
1231
- */
1232
- version: string;
1233
- authorization: SignedMessage;
1234
- /**
1235
- * The settler-signed FulfillmentQuote received in the quote response, forwarded verbatim.
1236
- * Verification is canonicalization-based — the settler's W3C Data Integrity proof is checked
1237
- * over the canonicalized form, and `quote_id` is derived as the canonical content-hash — so a
1238
- * JSON decode/re-encode that only changes key order or whitespace does not invalidate it.
1239
- * Clients SHOULD still forward the received bytes as-is rather than rebuild the object; the
1240
- * SDK helpers do this and also expose settler-proof verification.
1241
- *
1242
- */
1243
- fulfillment_quote_json: string;
1244
- /**
1245
- * Optional JSON-LD context URLs when the award is wrapped in a W3C Data Integrity envelope.
1246
- */
1247
- '@context'?: Array<(string)>;
1248
- proof?: DataIntegrityProof;
1249
- /**
1250
- * Optional W3C Verifiable Credentials attesting the award producer.
1251
- */
1252
- verifiableCredential?: Array<VerifiableCredential>;
1253
- };
1254
- /**
1255
- * Synchronous response to POST /v1/payments/awards. The `status` field describes the payment
1256
- * lifecycle. Note there are two distinct status surfaces for a Quote-API payment, with
1257
- * different vocabularies: (1) this award response (`awarding`/`completed`/…), and
1258
- * (2) the separate GET /v1/payments/{paymentId}/status endpoint you poll afterward, which
1259
- * reports the same payment under its own values (an in-progress payment reads as `pending`
1260
- * there). Both are disjoint from the quote-request batch status on the quote-request endpoints.
1261
- *
1262
- */
1263
- type AwardResponse = {
1264
- payment_id: string;
1265
- /**
1266
- * Payment lifecycle status on the award response:
1267
- * - `completed` — settlement finished within the sync wait (includes fulfillment_confirmation).
1268
- * - `awarding` — settlement still in progress when the sync cap fired (or on wait=false);
1269
- * poll GET /v1/payments/{paymentId}/status.
1270
- * - `failed` — settlement reached a terminal failure (e.g. the settler could not fulfill, or
1271
- * an on-chain step was rejected).
1272
- * - `cancelled` — the payment was terminated before settlement completed and will not proceed.
1273
- * `failed` and `cancelled` are terminal states surfaced here only when they occur within the
1274
- * sync wait; otherwise the response is `awarding` and the terminal state is read from the
1275
- * payment-status endpoint.
1276
- *
1277
- */
1278
- status: 'awarding' | 'completed' | 'failed' | 'cancelled';
1279
- fulfillment_confirmation?: FulfillmentConfirmation;
1280
- };
1281
- /**
1282
- * Payment lifecycle status on the award response:
1283
- * - `completed` — settlement finished within the sync wait (includes fulfillment_confirmation).
1284
- * - `awarding` — settlement still in progress when the sync cap fired (or on wait=false);
1285
- * poll GET /v1/payments/{paymentId}/status.
1286
- * - `failed` — settlement reached a terminal failure (e.g. the settler could not fulfill, or
1287
- * an on-chain step was rejected).
1288
- * - `cancelled` — the payment was terminated before settlement completed and will not proceed.
1289
- * `failed` and `cancelled` are terminal states surfaced here only when they occur within the
1290
- * sync wait; otherwise the response is `awarding` and the terminal state is read from the
1291
- * payment-status endpoint.
1292
- *
1293
- */
1294
- type status8 = 'awarding' | 'completed' | 'failed' | 'cancelled';
1295
- /**
1296
- * Asynchronous (202) response to POST /v1/payments/awards — just the payment handle.
1297
- */
1298
- type AwardAccepted = {
1299
- payment_id: string;
1300
- /**
1301
- * Always `awarding` — settlement is in progress server-side.
1302
- */
1303
- status: 'awarding';
1304
- };
1305
- /**
1306
- * Always `awarding` — settlement is in progress server-side.
1307
- */
1308
- type status9 = 'awarding';
1309
- type SubmitPaymentData = {
1310
- requestBody: PaymentRequest;
1311
- };
1312
- type SubmitPaymentResponse = PaymentResponse;
1313
- type GetPaymentStatusData = {
1314
- /**
1315
- * The ID of the payment to query
1316
- */
1317
- paymentId: string;
1318
- };
1319
- type GetPaymentStatusResponse2 = GetPaymentStatusResponse;
1320
- type ResolvePaymentData = {
1321
- /**
1322
- * The client-supplied request ID embedded in the payment request
1323
- */
1324
- requestId: string;
1325
- };
1326
- type ResolvePaymentResponse2 = ResolvePaymentResponse;
1327
- type GetPaymentTimelineData = {
1328
- /**
1329
- * The ID of the payment to query
1330
- */
1331
- paymentId: string;
1332
- };
1333
- type GetPaymentTimelineResponse = PaymentTimelineResponse;
1334
- type PreparePaymentData = {
1335
- requestBody: PreparePaymentRequest;
1336
- };
1337
- type PreparePaymentResponse2 = PreparePaymentResponse;
1338
- type AuthorizePaymentData = {
1339
- requestBody: PaymentRequest;
1340
- };
1341
- type AuthorizePaymentResponse = AuthorizationResult;
1342
- type CreateQuoteRequestData = {
1343
- requestBody: CreateQuoteRequest;
1344
- /**
1345
- * Return a handle immediately (`false`, default) or hold the connection for collected quotes (`true`).
1346
- */
1347
- wait?: boolean;
1348
- };
1349
- type CreateQuoteRequestResponse = QuoteRequestResponse | QuoteRequestAccepted;
1350
- type GetQuoteRequestStatusData = {
1351
- /**
1352
- * The ID of the quote-request batch to query
1353
- */
1354
- quoteRequestId: string;
1355
- };
1356
- type GetQuoteRequestStatusResponse = QuoteRequestStatusResponse;
1357
- type AwardQuoteData = {
1358
- requestBody: AwardRequest;
1359
- /**
1360
- * Return a handle immediately (`false`, default) or hold the connection for the payment result (`true`).
1361
- */
1362
- wait?: boolean;
1363
- };
1364
- type AwardQuoteResponse = AwardResponse | AwardAccepted;
1365
- type HealthCheckResponse = {
1366
- status?: string;
1367
- };
1368
- type $OpenApiTs = {
1369
- '/v1/payments': {
1370
- post: {
1371
- req: SubmitPaymentData;
1372
- res: {
1373
- /**
1374
- * Payment request submitted successfully
1375
- */
1376
- 200: PaymentResponse;
1377
- /**
1378
- * Invalid request
1379
- */
1380
- 400: ErrorResponse;
1381
- /**
1382
- * Signature or sender authorization could not be verified
1383
- */
1384
- 401: ErrorResponse;
1385
- /**
1386
- * Payment declined during counterparty authorization
1387
- */
1388
- 403: ErrorResponse;
1389
- /**
1390
- * The `request_id` has already been used for a payment with different economics
1391
- * (`IDEMPOTENCY_TERMS_MISMATCH`). Re-submitting one `request_id` is how a retry is
1392
- * made safe, so it must identify one payment; use a distinct `request_id` per
1393
- * payment.
1394
- *
1395
- */
1396
- 409: ErrorResponse;
1397
- /**
1398
- * Payment request too large to process
1399
- */
1400
- 413: ErrorResponse;
1401
- /**
1402
- * Internal server error
1403
- */
1404
- 500: ErrorResponse;
1405
- /**
1406
- * A dependency is temporarily unavailable
1407
- */
1408
- 503: ErrorResponse;
1409
- };
1410
- };
1411
- };
1412
- '/v1/payments/{paymentId}/status': {
1413
- get: {
1414
- req: GetPaymentStatusData;
1415
- res: {
1416
- /**
1417
- * Payment status retrieved successfully
1418
- */
1419
- 200: GetPaymentStatusResponse;
1420
- /**
1421
- * Payment not found
1422
- */
1423
- 404: ErrorResponse;
1424
- /**
1425
- * Internal server error
1426
- */
1427
- 500: ErrorResponse;
1428
- };
1429
- };
1430
- };
1431
- '/v1/payments/resolve': {
1432
- get: {
1433
- req: ResolvePaymentData;
1434
- res: {
1435
- /**
1436
- * Payment found
1437
- */
1438
- 200: ResolvePaymentResponse;
1439
- /**
1440
- * Missing request_id parameter
1441
- */
1442
- 400: ErrorResponse;
1443
- /**
1444
- * No payment found for the given request ID
1445
- */
1446
- 404: ErrorResponse;
1447
- /**
1448
- * Internal server error
1449
- */
1450
- 500: ErrorResponse;
1451
- };
1452
- };
1453
- };
1454
- '/v1/payments/{paymentId}/timeline': {
1455
- get: {
1456
- req: GetPaymentTimelineData;
1457
- res: {
1458
- /**
1459
- * Timeline retrieved successfully
1460
- */
1461
- 200: PaymentTimelineResponse;
1462
- /**
1463
- * Payment not found
1464
- */
1465
- 404: ErrorResponse;
1466
- /**
1467
- * Internal server error
1468
- */
1469
- 500: ErrorResponse;
1470
- };
1471
- };
1472
- };
1473
- '/v1/payments/prepare': {
1474
- post: {
1475
- req: PreparePaymentData;
1476
- res: {
1477
- /**
1478
- * Payment request prepared successfully
1479
- */
1480
- 200: PreparePaymentResponse;
1481
- /**
1482
- * Invalid request parameters
1483
- */
1484
- 400: ErrorResponse;
1485
- /**
1486
- * Endpoint not yet implemented
1487
- */
1488
- 501: ErrorResponse;
1489
- };
1490
- };
1491
- };
1492
- '/v1/payments/authorizations': {
1493
- post: {
1494
- req: AuthorizePaymentData;
1495
- res: {
1496
- /**
1497
- * Authorization decision received (authorized or declined)
1498
- */
1499
- 200: AuthorizationResult;
1500
- /**
1501
- * Invalid payment request
1502
- */
1503
- 400: ErrorResponse;
1504
- /**
1505
- * Counterparty not found (no registration for the resolved DID)
1506
- */
1507
- 404: ErrorResponse;
1508
- /**
1509
- * Internal server error
1510
- */
1511
- 500: ErrorResponse;
1512
- /**
1513
- * Counterparty webhook error (HTTP error or connection failure)
1514
- */
1515
- 502: ErrorResponse;
1516
- /**
1517
- * Authorization timed out (counterparty did not respond)
1518
- */
1519
- 504: ErrorResponse;
1520
- };
1521
- };
1522
- };
1523
- '/v1/payments/quote-requests': {
1524
- post: {
1525
- req: CreateQuoteRequestData;
1526
- res: {
1527
- /**
1528
- * Quote-request resolved synchronously. `status` is `ready` when quotes were collected,
1529
- * or `collecting` when the sync wait cap fired before the quote deadline.
1530
- *
1531
- */
1532
- 200: QuoteRequestResponse;
1533
- /**
1534
- * Quote-request accepted; collection continues asynchronously.
1535
- */
1536
- 202: QuoteRequestAccepted;
1537
- /**
1538
- * Invalid request
1539
- */
1540
- 400: ErrorResponse;
1541
- /**
1542
- * Internal server error
1543
- */
1544
- 500: ErrorResponse;
1545
- };
1546
- };
1547
- };
1548
- '/v1/payments/quote-requests/{quoteRequestId}': {
1549
- get: {
1550
- req: GetQuoteRequestStatusData;
1551
- res: {
1552
- /**
1553
- * Quote-request status retrieved successfully
1554
- */
1555
- 200: QuoteRequestStatusResponse;
1556
- /**
1557
- * Quote-request not found, or not owned by the caller.
1558
- */
1559
- 404: ErrorResponse;
1560
- /**
1561
- * Internal server error
1562
- */
1563
- 500: ErrorResponse;
1564
- };
1565
- };
1566
- };
1567
- '/v1/payments/awards': {
1568
- post: {
1569
- req: AwardQuoteData;
1570
- res: {
1571
- /**
1572
- * Award resolved synchronously. `status` is `completed` with a fulfillment_confirmation
1573
- * when settlement finished within the sync wait, or a non-terminal payment status
1574
- * (e.g. `awarding`) if the cap fired first.
1575
- *
1576
- */
1577
- 200: AwardResponse;
1578
- /**
1579
- * Award accepted; settlement continues asynchronously.
1580
- */
1581
- 202: AwardAccepted;
1582
- /**
1583
- * Invalid request (bad signatures, expired quote, or ownership mismatch)
1584
- */
1585
- 400: ErrorResponse;
1586
- /**
1587
- * The quote, or another quote in the same batch, has already been awarded
1588
- * (single-award-per-batch, FR-09).
1589
- *
1590
- */
1591
- 409: ErrorResponse;
1592
- /**
1593
- * Internal server error
1594
- */
1595
- 500: ErrorResponse;
1596
- };
1597
- };
1598
- };
1599
- '/health': {
1600
- get: {
1601
- res: {
1602
- /**
1603
- * Service is healthy
1604
- */
1605
- 200: {
1606
- status?: string;
1607
- };
1608
- };
1609
- };
1610
- };
1611
- };
1612
-
1613
78
  declare class PaymentsService {
1614
79
  readonly httpRequest: BaseHttpRequest;
1615
80
  constructor(httpRequest: BaseHttpRequest);
@@ -1693,6 +158,9 @@ declare class PaymentsService {
1693
158
  *
1694
159
  * The response includes everything needed to sign and submit a payment, except the signature itself.
1695
160
  *
161
+ * Not available on every gateway or every source chain; where it is not, this
162
+ * returns `501`. Sign the returned request and submit it to `POST /v1/payments`.
163
+ *
1696
164
  * @param data The data for the request.
1697
165
  * @param data.requestBody
1698
166
  * @returns PreparePaymentResponse Payment request prepared successfully
@@ -1743,6 +211,31 @@ declare class QuoteRequestsService {
1743
211
  * Collection continues server-side until the quote deadline regardless of the HTTP
1744
212
  * connection, so quotes remain retrievable via the status endpoint in either mode.
1745
213
  *
214
+ * **Idempotency.** `request_id` is the idempotency key, scoped to the source account
215
+ * and originator — the same key, and the same contract, as POST /v1/payments.
216
+ * Submitting the same `request_id` again returns the ORIGINAL batch instead of opening
217
+ * a second one, so a client whose request timed out or failed in transit can safely
218
+ * re-submit and recover its `quote_request_id`.
219
+ *
220
+ * Because a re-submission must be admissible on its own, some fields legitimately
221
+ * differ between attempts and are excluded from the comparison: `quote_deadline` and
222
+ * `fulfillment_deadline` (both must be in the future, so a later attempt has to move
223
+ * them) and the `proof` that covers them. An expired `quote_deadline` on a
224
+ * re-submission is NOT an error — the request is resolved onto the batch that already
225
+ * exists rather than used to open one. There is no `sender_auth` to re-sign here: this
226
+ * endpoint rejects it, because the spend authorization belongs to the award call.
227
+ *
228
+ * The collection window belongs to the BATCH, not to the request. Asking again with a
229
+ * later `quote_deadline` does not extend a window already open; `quote_deadline` in the
230
+ * response is the batch's own, and `status` says whether collection is still running.
231
+ *
232
+ * What must NOT differ is the corridor's economics — source account and asset,
233
+ * destination accounts and assets, `fulfillment_amount`, and `max_source_amount`.
234
+ * Re-using one `request_id` for a genuinely different corridor is a client bug that
235
+ * would otherwise be silently collapsed onto the first batch, returning quotes for a
236
+ * corridor that was never requested. It is rejected with `409` and
237
+ * `IDEMPOTENCY_TERMS_MISMATCH`. Use a distinct `request_id` per quote-request.
238
+ *
1746
239
  * @param data The data for the request.
1747
240
  * @param data.requestBody
1748
241
  * @param data.wait Return a handle immediately (`false`, default) or hold the connection for collected quotes (`true`).
@@ -1803,6 +296,29 @@ declare class QuoteRequestsService {
1803
296
  */
1804
297
  awardQuote(data: AwardQuoteData): CancelablePromise<AwardQuoteResponse>;
1805
298
  }
299
+ declare class ChainDefaultsService {
300
+ readonly httpRequest: BaseHttpRequest;
301
+ constructor(httpRequest: BaseHttpRequest);
302
+ /**
303
+ * Get chain defaults
304
+ * The addresses needed to build a payment on a chain: the escrow, the accounts named
305
+ * in the deposit authorization, and the fulfillment verifier. Fetch these rather than
306
+ * hardcoding them - they change when a chain's contracts are redeployed.
307
+ *
308
+ * With `chain_id`, returns that chain. Without it, or with an empty value, returns
309
+ * every chain the gateway serves, keyed by CAIP-2 chain id.
310
+ *
311
+ * A chain that is not fully configured is still returned when asked for by
312
+ * `chain_id`, with the missing address empty, but is left out of the full listing.
313
+ * Treat an empty address as a chain you cannot pay on.
314
+ *
315
+ * @param data The data for the request.
316
+ * @param data.chainId CAIP-2 chain identifier. Omit it, or send it empty, to receive every chain the gateway serves, keyed by chain id.
317
+ * @returns GetDefaultsResult Chain defaults. A single object when `chain_id` was supplied, otherwise an object keyed by CAIP-2 chain id.
318
+ * @throws ApiError
319
+ */
320
+ getDefaults(data?: GetDefaultsData): CancelablePromise<GetDefaultsResponse>;
321
+ }
1806
322
  declare class HealthService {
1807
323
  readonly httpRequest: BaseHttpRequest;
1808
324
  constructor(httpRequest: BaseHttpRequest);
@@ -1818,6 +334,7 @@ declare class HealthService {
1818
334
  type HttpRequestConstructor$1 = new (config: OpenAPIConfig) => BaseHttpRequest;
1819
335
  declare class PaymentGatewayClient$1 {
1820
336
  readonly authorizations: AuthorizationsService;
337
+ readonly chainDefaults: ChainDefaultsService;
1821
338
  readonly health: HealthService;
1822
339
  readonly payments: PaymentsService;
1823
340
  readonly quoteRequests: QuoteRequestsService;
@@ -1826,7 +343,30 @@ declare class PaymentGatewayClient$1 {
1826
343
  }
1827
344
 
1828
345
  /**
1829
- * Chain defaults returned by the payment gateway /defaults endpoint.
346
+ * Budget for a request the gateway answers as soon as it can. Generous on
347
+ * purpose: aborting a live submit loses track of a payment, while waiting only
348
+ * costs patience. Bounds socket inactivity, not total time, so a large healthy
349
+ * response is never cut off partway.
350
+ */
351
+ declare const DEFAULT_REQUEST_TIMEOUT_MS = 30000;
352
+ /**
353
+ * Budget for a request the gateway holds open while it collects quotes or
354
+ * settles. Must clear the server's own cap (`payment_sync_wait_seconds` 30s,
355
+ * `quote_sync_wait_seconds` 5s, both deployment-configurable) with margin: the
356
+ * client's timer starts at connect, before the server arms its own, so an equal
357
+ * budget loses the race every time.
358
+ */
359
+ declare const DEFAULT_SYNC_WAIT_TIMEOUT_MS = 120000;
360
+ /** Per-client overrides for the two budgets above. */
361
+ type RequestTimeouts = {
362
+ /** Requests answered as soon as possible. Defaults to {@link DEFAULT_REQUEST_TIMEOUT_MS}. */
363
+ timeoutMs?: number;
364
+ /** Requests the gateway holds open. Defaults to {@link DEFAULT_SYNC_WAIT_TIMEOUT_MS}. */
365
+ syncWaitTimeoutMs?: number;
366
+ };
367
+
368
+ /**
369
+ * Chain defaults returned by the payment gateway /v1/defaults endpoint.
1830
370
  */
1831
371
  interface ChainDefaults {
1832
372
  escrowContract: string;
@@ -1835,9 +375,22 @@ interface ChainDefaults {
1835
375
  fulfillmentVerifierEndpoint: string;
1836
376
  fulfillmentProxy: string;
1837
377
  permit2Contract?: string;
378
+ /**
379
+ * Which deposit witness the escrow deployed on this chain pins, surfaced by payment-gw
380
+ * `/v1/defaults` as `deposit_witness_version`. EVM/Tron only — Solana carries the
381
+ * same fact in `svmSignatureDomainVersion` below.
382
+ *
383
+ * `4` and above select the four-member witness
384
+ * (`depositRequestHash`, `destination`, `reserver`, `releaser`); `3` selects the two-member
385
+ * witness a not-yet-redeployed escrow pins. ABSENT means four — see the sender-auth package's
386
+ * `ChainDefaults.depositWitnessVersion` for why absence is the permissive default.
387
+ *
388
+ * Passed through to the sender_auth adapter verbatim; this type only has to carry it.
389
+ */
390
+ depositWitnessVersion?: number;
1838
391
  /**
1839
392
  * V3 Solana escrow domain-separation fields, surfaced by payment-gw
1840
- * `/defaults` for Solana source chains. Used to build the EscrowDomain that the
393
+ * `/v1/defaults` for Solana source chains. Used to build the EscrowDomain that the
1841
394
  * V3 deposit hash binds to. Absent for EVM/Tron.
1842
395
  */
1843
396
  svmSignatureClusterId?: string;
@@ -1910,7 +463,8 @@ interface TurnkeyConfig {
1910
463
  /**
1911
464
  * Chain-native address the signer is expected to resolve to. Verified against
1912
465
  * the address Turnkey returns at initialize(); a mismatch fails fast rather
1913
- * than signing as the wrong depositor.
466
+ * than signing as the wrong depositor. Omit it to skip the check; an empty
467
+ * value is rejected rather than treated as omitted.
1914
468
  */
1915
469
  pinnedAddress?: string;
1916
470
  /**
@@ -1920,7 +474,10 @@ interface TurnkeyConfig {
1920
474
  logger?: Logger;
1921
475
  meter?: Meter;
1922
476
  }
1923
- /** Options selecting a sender-signing provider. Defaults to the private-key provider. */
477
+ /**
478
+ * Options selecting a sender-signing provider. Defaults to the private-key provider.
479
+ * `pinnedAddress` behaves the same on both: omitted skips the sender check, empty is rejected.
480
+ */
1924
481
  type SenderSignerOptions = {
1925
482
  provider?: 'raw';
1926
483
  privateKey: string;
@@ -1946,6 +503,11 @@ declare class TurnkeySenderSigner implements SenderSigner {
1946
503
  private readonly chainPrefix;
1947
504
  private readonly cfg;
1948
505
  private readonly loader;
506
+ /**
507
+ * Validated at construction and read from here rather than from `cfg`, so a caller that
508
+ * later blanks the config object it passed cannot erase the pin before it is forwarded.
509
+ */
510
+ private readonly pinnedAddress;
1949
511
  constructor(chainPrefix: string, cfg: TurnkeyConfig, loader?: () => Promise<TurnkeyImplModule>);
1950
512
  sign(signedMessage: SignedMessage): Promise<SenderSignature>;
1951
513
  }
@@ -1962,7 +524,88 @@ declare function createSenderSigner(sourceChainId: string, opts: SenderSignerOpt
1962
524
  * query. The Turnkey impl is loaded lazily so a plain SDK import stays free of
1963
525
  * @solana/web3.js.
1964
526
  */
1965
- declare function resolveTurnkeyAddresses(cfg: TurnkeyConfig): Promise<Record<string, string>>;
527
+ declare function resolveTurnkeyAddresses(cfg: Omit<TurnkeyConfig, 'pinnedAddress'>): Promise<Record<string, string>>;
528
+
529
+ /**
530
+ * CAIP-19 asset identifier parsing, backing the caller-facing entry points.
531
+ *
532
+ * Every caller-facing entry point parses here first. Downstream, the deposit builders read an
533
+ * identifier as raw string slicing (`asset.split('/')[1]!.split(':')[1]!`) and hand the result to
534
+ * `ethers`, which can only report a bad value as a TypeError or as `invalid address`, so the value
535
+ * has to be named and explained before it gets there. Parsing also canonicalizes the segments CAIP
536
+ * requires lowercase.
537
+ */
538
+ /** An asset identifier split into its parts, canonicalized. */
539
+ interface ParsedAssetIdentifier {
540
+ /** CAIP-2 chain id, namespace lowercased: `eip155:421614`. */
541
+ chainId: string;
542
+ /** Lowercased CAIP-2 namespace: `eip155`, `tron`, `solana`. */
543
+ namespace: string;
544
+ /**
545
+ * CAIP-2 chain reference, canonicalized per namespace, mirroring `manifest.CanonicalizeCAIP2`.
546
+ * A tron reference is an ASCII cluster name and folds to lowercase, so `TRON:MAINNET` routes
547
+ * instead of dying at a Permit2 lookup that resolves by exact chain id. A solana reference is
548
+ * preserved: it is base58, and its cluster name is UTF-8 encoded into the escrow's on-chain
549
+ * `cluster_id`, so folding it would change the signing domain.
550
+ */
551
+ reference: string;
552
+ /** Lowercased asset namespace: `erc20`, `trc20`, `token`, … */
553
+ assetNamespace: string;
554
+ /** Token address, exactly as the caller wrote it. */
555
+ tokenAddress: string;
556
+ /** CAIP-19 token id, for the asset types that carry one. */
557
+ tokenId?: string;
558
+ /**
559
+ * The identifier with the namespaces lowercased and a tron reference folded with them. The
560
+ * PaymentRequest schema pins `asset_identifier` to lowercase namespaces, so this is the spelling
561
+ * that goes on the wire and into the deposit builders.
562
+ *
563
+ * Aligned with `manifest.CanonicalizeCAIP2`, not with `blockchain.AssetIdentifier.String()`,
564
+ * which preserves the asset namespace this lowercases. Aligning to `String()` is not an option:
565
+ * the schema pattern rejects an uppercase asset namespace, so Go's own `ComputeRequestHash`
566
+ * refuses to hash one.
567
+ *
568
+ * Not a commitment preimage. `ComputeRequestHash` covers this string verbatim, so the spelling is
569
+ * the request's identity, but anything that hashes a CAIP-19 across independent producers has to
570
+ * derive it from one shared implementation rather than from here, since the escrow's destination
571
+ * commitment composes and folds the string on different rules.
572
+ */
573
+ normalized: string;
574
+ }
575
+ /**
576
+ * Parse and validate a CAIP-19 asset identifier.
577
+ *
578
+ * The two namespaces are lowercased, and a tron chain reference with them. A solana reference, the
579
+ * token address and the token id are returned as written, so a case-sensitive base58 value
580
+ * survives. Their case still matters:
581
+ * `ComputeRequestHash` covers the spelling verbatim, so two spellings of one asset give two
582
+ * different `request_hash` values while leaving the deposit digest identical.
583
+ */
584
+ declare function parseAssetIdentifier(value: unknown): ParsedAssetIdentifier;
585
+ /**
586
+ * The CAIP-2 chain id with its namespace lowercased, for callers that only need to route on the
587
+ * chain. Applies the same validation, so a malformed identifier fails with the same message.
588
+ */
589
+ declare function assetChainId(value: unknown): string;
590
+
591
+ /**
592
+ * The frozen rejection taxonomy. These strings are part of the cross-language contract: Go must
593
+ * reject the same input with the same reason.
594
+ *
595
+ * The union is derived from this array rather than declared beside it, so a reason cannot be added
596
+ * to the type without appearing here, and the coverage test that demands a vector per reason reads
597
+ * the same source. An array declared separately from the union would not be checked against it: a
598
+ * `Reason[]` may omit members freely.
599
+ */
600
+ declare const REASONS: readonly ["EMPTY", "SURROUNDING_WHITESPACE", "UNSUPPORTED_NAMESPACE", "UNPARSEABLE", "ZERO"];
601
+ type Reason = (typeof REASONS)[number];
602
+ declare class InvalidAccountError extends Error {
603
+ readonly reason: Reason;
604
+ readonly network: string;
605
+ readonly account: string;
606
+ readonly detail: string;
607
+ constructor(reason: Reason, network: string, account: string, detail?: string);
608
+ }
1966
609
 
1967
610
  declare const $AuthorizationResult: {
1968
611
  readonly type: "object";
@@ -1972,7 +615,7 @@ declare const $AuthorizationResult: {
1972
615
  readonly payment_id: {
1973
616
  readonly type: "string";
1974
617
  readonly description: "Correlation key for this authorization";
1975
- readonly example: "0x1234abcd";
618
+ readonly example: "0x761989729fefb4b0cb8b3e6f787301a3878c91e8fba35ed362a079292879f34f";
1976
619
  };
1977
620
  readonly counterparty_did: {
1978
621
  readonly type: "string";
@@ -1992,9 +635,9 @@ declare const $AuthorizationResult: {
1992
635
  };
1993
636
  readonly error_code: {
1994
637
  readonly type: "string";
1995
- readonly description: "Machine-readable error code (present when status is error or timeout).\nCounterparty-sourced codes are derived from the error code the\nCounterparty Gateway publishes. GATEWAY_TIMEOUT, PROOF_INVALID, and\nPROOF_STALE are payment-gw-specific (no counterparty envelope corresponds).\n";
638
+ readonly description: "Machine-readable error code (present when status is error or timeout).\nCounterparty-sourced codes are derived from the error code the\nCounterparty Gateway publishes. GATEWAY_TIMEOUT, PROOF_INVALID, and\nPROOF_STALE are raised by this gateway itself (no counterparty envelope corresponds).\n";
1996
639
  readonly enum: readonly ["COUNTERPARTY_NOT_FOUND", "COUNTERPARTY_TIMEOUT", "WEBHOOK_ERROR", "WEBHOOK_CONNECTION_ERROR", "INTERNAL_ERROR", "GATEWAY_TIMEOUT", "PROOF_INVALID", "PROOF_STALE"];
1997
- readonly 'x-enum-description': "COUNTERPARTY_NOT_FOUND, COUNTERPARTY_TIMEOUT, WEBHOOK_ERROR,\nWEBHOOK_CONNECTION_ERROR, and INTERNAL_ERROR are derived from the\nerror code the Counterparty Gateway publishes.\nGATEWAY_TIMEOUT is emitted by payment-gw when no authorization\nresponse is received within the system-wide timeout — source unknown\n(counterparty delay, transport failure, or gateway unavailability).\nOriginator should retry; counterparty-side idempotency prevents PSP re-charge\nif the original was already processed.\n\nPROOF_INVALID is emitted when the W3C Data Integrity proof on the\nbeneficiary PSP's AuthorizationResponse fails verification: signature\nrecovery failed, recovered DID does not match the destination DID,\nresponse shape is malformed (missing @context / payment_id /\ncounterparty_did / proof), or the suite type is unsupported. The\nunderlying reason cardinality is collapsed so originators see one\nactionable category.\n\nPROOF_STALE is emitted when proof.created falls outside the\nconfigured freshness window. Originators should retry with a fresh\nrequest — the freshness window closes a replay attack vector where a\ncaptured-but-cryptographically-valid proof could otherwise be replayed\nindefinitely.\n";
640
+ readonly 'x-enum-description': "COUNTERPARTY_NOT_FOUND, COUNTERPARTY_TIMEOUT, WEBHOOK_ERROR,\nWEBHOOK_CONNECTION_ERROR, and INTERNAL_ERROR are derived from the\nerror code the Counterparty Gateway publishes.\nGATEWAY_TIMEOUT is emitted by the gateway when no authorization\nresponse is received within the system-wide timeout — source unknown\n(counterparty delay, transport failure, or gateway unavailability).\nOriginator should retry; counterparty-side idempotency prevents PSP re-charge\nif the original was already processed.\n\nPROOF_INVALID is emitted when the W3C Data Integrity proof on the\nbeneficiary PSP's AuthorizationResponse fails verification: signature\nrecovery failed, recovered DID does not match the destination DID,\nresponse shape is malformed (missing @context / payment_id /\ncounterparty_did / proof), or the suite type is unsupported. The\nunderlying reason cardinality is collapsed so originators see one\nactionable category.\n\nPROOF_STALE is emitted when proof.created falls outside the\nconfigured freshness window. Originators should retry with a fresh\nrequest — the freshness window closes a replay attack vector where a\ncaptured-but-cryptographically-valid proof could otherwise be replayed\nindefinitely.\n";
1998
641
  };
1999
642
  readonly error_message: {
2000
643
  readonly type: "string";
@@ -2007,13 +650,13 @@ declare const $AuthorizationResult: {
2007
650
  };
2008
651
  };
2009
652
  declare const $PaymentRequest: {
2010
- readonly type: "object";
2011
653
  readonly description: "Structured payment request with sender authorization and optional W3C Verifiable Credentials";
654
+ readonly type: "object";
2012
655
  readonly required: readonly ["version", "request_id", "source", "destination", "fulfillment_amount", "sender_auth", "quote_deadline", "fulfillment_deadline"];
2013
656
  readonly properties: {
2014
657
  readonly version: {
2015
658
  readonly type: "string";
2016
- readonly description: "Semver-shaped declaration version (MAJOR.MINOR). The major component is locked to this schema's\nparent directory (v1 → major must be 1). Producers MUST emit the canonical value exported by the\nbindings' Version constant; the canonical bumps on each additive minor evolution.\n";
659
+ readonly description: "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.";
2017
660
  readonly pattern: "^1\\.[0-9]+$";
2018
661
  readonly example: "1.0";
2019
662
  };
@@ -2027,37 +670,38 @@ declare const $PaymentRequest: {
2027
670
  };
2028
671
  readonly destination: {
2029
672
  readonly type: "array";
2030
- readonly description: "Array of destination assets for the settlement agent to choose from (at least one required)";
673
+ readonly description: "Array of destination assets for the settlement agent to choose from (at least one required, at most 16).\nThe ceiling bounds the fan-out one request can buy: every consumer iterates this list.";
2031
674
  readonly minItems: 1;
675
+ readonly maxItems: 16;
2032
676
  readonly items: {
2033
677
  readonly $ref: "#/components/schemas/OwnedAsset";
2034
678
  };
2035
679
  };
2036
680
  readonly fulfillment_amount: {
2037
681
  readonly type: "string";
2038
- readonly description: "The exact amount to be received at the destination (in the smallest unit, e.g., wei for ETH, cents for USD).\n";
682
+ readonly description: "The exact amount to be received at the destination (in the smallest unit, e.g., wei for ETH, cents for USD).";
2039
683
  readonly example: "1000000";
2040
684
  };
2041
685
  readonly max_source_amount: {
2042
686
  readonly type: "string";
2043
- readonly description: "The maximum amount willing to be spent from the source (in the smallest unit).\n";
687
+ readonly description: "The maximum amount willing to be spent from the source (in the smallest unit).";
2044
688
  readonly example: "1000000";
2045
689
  };
2046
690
  readonly quote_deadline: {
2047
691
  readonly type: "string";
2048
692
  readonly format: "date-time";
2049
- readonly description: "Required. The deadline for receiving price quotes from settlement providers. After this\npoint no new quotes are accepted. The gateway injects no default and validates the value\nis in the future. The originator must supply it, and a request that omits it or supplies\na past value is rejected with 400.\n";
693
+ readonly description: "Required. The deadline for receiving price quotes from settlement providers. After this\npoint no new quotes are accepted. The gateway injects no default and validates the value\nis in the future. The originator must supply it, and a request that omits it or supplies\na past value is rejected with 400.";
2050
694
  readonly example: "2024-12-25T10:30:00Z";
2051
695
  };
2052
696
  readonly fulfillment_deadline: {
2053
697
  readonly type: "string";
2054
698
  readonly format: "date-time";
2055
- readonly description: "Required. The final deadline for completing the payment. If not completed by this time the\npayment is cancelled and eligible for a refund. The gateway injects no default and validates\nthe value is in the future. The originator must supply it, and a request that omits it or\nsupplies a past value is rejected with 400.\n";
699
+ readonly description: "Required. The final deadline for completing the payment. If not completed by this time the\npayment fails and is eligible for a refund. The gateway injects no default and validates\nthe value is in the future. The originator must supply it, and a request that omits it or\nsupplies a past value is rejected with 400.";
2056
700
  readonly example: "2024-12-25T11:00:00Z";
2057
701
  };
2058
702
  readonly settler_auth_required: {
2059
703
  readonly type: "object";
2060
- readonly description: "Policy requirements for settler authentication. Keys are policy names, values indicate if the policy is required.\n";
704
+ readonly description: "Policy requirements for settler authentication. Keys are policy names, values indicate if the policy is required.";
2061
705
  readonly additionalProperties: {
2062
706
  readonly type: "boolean";
2063
707
  };
@@ -2070,12 +714,12 @@ declare const $PaymentRequest: {
2070
714
  };
2071
715
  readonly quote_selector: {
2072
716
  readonly type: "string";
2073
- readonly description: "Wallet address or public key of a trusted service that will automatically select \nthe best exchange rate for your payment. Leave empty to use the default selector.\n";
2074
- readonly example: "0x742d35Cc6634C0532925a3b844Bc9e7595f4136";
717
+ readonly description: "Wallet address or public key of a trusted service that will automatically select\nthe best exchange rate for your payment. Leave empty to use the default selector.";
718
+ readonly example: "0x742D35cC6634c0532925a3b844Bc9e7595F41360";
2075
719
  };
2076
720
  readonly fulfillment_verifier: {
2077
721
  readonly type: "object";
2078
- readonly description: "Third-party service that will independently verify your payment was delivered.\nLeave empty to use the default verifier.\n";
722
+ readonly description: "Third-party service that will independently verify your payment was delivered.\nLeave empty to use the default verifier.";
2079
723
  readonly required: readonly ["account", "endpoint"];
2080
724
  readonly properties: {
2081
725
  readonly account: {
@@ -2086,48 +730,48 @@ declare const $PaymentRequest: {
2086
730
  readonly endpoint: {
2087
731
  readonly type: "string";
2088
732
  readonly format: "uri";
2089
- readonly description: "Origin of the fulfillment verifier service, with no path — the caller\nappends the verifier's own API paths. The gateway's `/defaults` response\nsupplies the default fulfillment verifier for each chain.\n";
733
+ readonly description: "Origin of the fulfillment verifier service, with no path — the caller\nappends the verifier's own API paths. The gateway's `/v1/defaults` response\nsupplies the default fulfillment verifier for each chain.";
2090
734
  readonly example: "https://veri-fill.production-testnet.atum.xyz";
2091
735
  };
2092
736
  };
2093
737
  };
2094
738
  readonly escrow_contract_address: {
2095
739
  readonly type: "string";
2096
- readonly description: "Escrow contract address, used to protect source funds until proof of fulfillment has been verified. Leave empty to use the default.\n";
2097
- readonly example: "0x742d35Cc6634C0532925a3b844Bc9e7595f4136";
740
+ readonly description: "Escrow contract address, used to protect source funds until proof of fulfillment has been verified. Leave empty to use the default.";
741
+ readonly example: "0x742D35cC6634c0532925a3b844Bc9e7595F41360";
2098
742
  };
2099
743
  readonly fulfillment_proxy: {
2100
744
  readonly type: "string";
2101
- readonly description: "Fulfillment Proxy contract address, used to emit proof of fulfillment on the destination chain. Leave empty to use the default.\n";
745
+ readonly description: "Fulfillment Proxy contract address, used to emit proof of fulfillment on the destination chain. Leave empty to use the default.";
2102
746
  readonly example: "0x892BB2e4F6b14a2B5b82Ba8d33E5925D42D4431F";
2103
747
  };
2104
748
  readonly settler_requirements: {
2105
749
  readonly type: "object";
2106
- readonly description: "Optional settler filtering requirements.\nIf whitelist is present, only whitelisted settlers may win.\nIf blacklist is present, blacklisted settlers are excluded.\nBoth can be specified together; blacklist takes precedence\n(a settler in both lists is rejected).\n";
750
+ readonly description: "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).";
2107
751
  readonly properties: {
2108
752
  readonly whitelist: {
2109
753
  readonly type: "array";
2110
- readonly description: "List of settler DIDs permitted to fulfill this request.\nIf present, only these settlers may win.\nUse W3C DID format.\n";
754
+ readonly uniqueItems: true;
2111
755
  readonly minItems: 1;
2112
756
  readonly maxItems: 100;
2113
- readonly uniqueItems: true;
757
+ readonly description: "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...).";
2114
758
  readonly items: {
2115
759
  readonly type: "string";
2116
760
  readonly pattern: "^did:[a-z][a-z0-9]*:[a-zA-Z0-9._:%-]+$";
2117
761
  };
2118
- readonly example: readonly ["did:pkh:eip155:1:0x742d35Cc6634C0532925a3b844Bc9e7595f4136"];
762
+ readonly example: readonly ["did:pkh:eip155:1:0x742D35cC6634c0532925a3b844Bc9e7595F41360"];
2119
763
  };
2120
764
  readonly blacklist: {
2121
765
  readonly type: "array";
2122
- readonly description: "List of settler DIDs excluded from fulfilling this request.\nUse W3C DID format.\n";
766
+ readonly uniqueItems: true;
2123
767
  readonly minItems: 1;
2124
768
  readonly maxItems: 100;
2125
- readonly uniqueItems: true;
769
+ readonly description: "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...).";
2126
770
  readonly items: {
2127
771
  readonly type: "string";
2128
772
  readonly pattern: "^did:[a-z][a-z0-9]*:[a-zA-Z0-9._:%-]+$";
2129
773
  };
2130
- readonly example: readonly ["did:pkh:eip155:1:0x892BB2e4F6b14a2B5b82Ba8d33E5925D42D4432F"];
774
+ readonly example: readonly ["did:pkh:eip155:1:0x892bb2E4F6b14a2B5b82bA8D33e5925d42d4432f"];
2131
775
  };
2132
776
  };
2133
777
  };
@@ -2190,31 +834,33 @@ declare const $FulfillmentConfirmation: {
2190
834
  };
2191
835
  declare const $OwnedAsset: {
2192
836
  readonly type: "object";
2193
- readonly description: "Represents a cryptocurrency or token in a specific wallet.\nThis tells the system what asset you're sending/receiving and which wallet to use.\n";
837
+ readonly description: "Represents a cryptocurrency or token in a specific wallet. This tells the system what asset you're sending/receiving and which wallet to use.";
2194
838
  readonly required: readonly ["asset_identifier", "account"];
2195
839
  readonly properties: {
2196
840
  readonly asset_identifier: {
2197
841
  readonly type: "string";
2198
- readonly description: "A unique identifier for the asset using CAIP-19 format.\nCAIP-19 is a standard way to identify blockchain assets: {chain_id}/{asset_namespace}:{asset_reference}\nExamples:\n- Ethereum USDC: \"eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"\n- Arbitrum USDC: \"eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831\"\n- Solana USDC: \"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\"\n- Tron USDT: \"tron:mainnet/trc20:TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t\"\n";
842
+ readonly description: "A unique identifier for the asset using CAIP-19 format.\nCAIP-19 is a standard way to identify blockchain assets: {chain_id}/{asset_namespace}:{asset_reference}\nExamples:\n- Ethereum USDC: \"eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"\n- Arbitrum USDC: \"eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831\"\n- Solana USDC: \"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\"\n- Tron USDT: \"tron:mainnet/trc20:TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t\"";
2199
843
  readonly pattern: "^[a-z0-9]+:[a-zA-Z0-9_-]+/[a-z0-9-]{3,8}:[-.%a-zA-Z0-9]{1,128}(/[-.%a-zA-Z0-9]{1,78})?$";
2200
844
  readonly example: "eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
2201
845
  };
2202
846
  readonly account: {
2203
847
  readonly type: "string";
2204
- readonly description: "The wallet address that owns this asset.\nFormat depends on the blockchain:\n- Ethereum/EVM: 0x-prefixed hex address (42 characters)\n- Solana: Base58 encoded address\n- Tron: T-prefixed Base58 address\n";
848
+ readonly description: "The wallet address that owns this asset.\nFormat depends on the blockchain:\n- Ethereum/EVM: 0x-prefixed hex address (42 characters)\n- Solana: Base58 encoded address\n- Tron: T-prefixed Base58 address\n\nA destination account is checked at ingress and must be payable on the chain named by\nits `asset_identifier`: it parses for that chain, carries a valid EIP-55 checksum when\nmixed-case, has no surrounding whitespace, and is not the zero address. A receiver that\nfails any of these is refused with `INVALID_DESTINATION_ACCOUNT`, before any funds move.";
2205
849
  readonly minLength: 1;
2206
850
  readonly maxLength: 128;
2207
- readonly example: "0x742d35Cc6634C0532925a3b844Bc9e7595f4136";
851
+ readonly example: "0x742D35cC6634c0532925a3b844Bc9e7595F41360";
2208
852
  };
2209
853
  };
2210
854
  };
2211
855
  declare const $SenderAuth: {
2212
856
  readonly type: "object";
2213
- readonly description: "Authorization from the asset owner to execute the payment. The exact format depends on \nthe source blockchain's authorization mechanism.\n";
857
+ readonly description: "Authorization from the asset owner to execute the payment. The exact format depends on the source blockchain's authorization mechanism.";
2214
858
  readonly required: readonly ["message_scheme", "signed_messages"];
2215
859
  readonly properties: {
2216
860
  readonly verifiable_credential: {
2217
861
  readonly $ref: "#/components/schemas/VerifiableCredentialAuth";
862
+ readonly deprecated: true;
863
+ readonly description: "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.";
2218
864
  };
2219
865
  readonly message_scheme: {
2220
866
  readonly $ref: "#/components/schemas/SenderAuthMessageScheme";
@@ -2231,34 +877,42 @@ declare const $SenderAuth: {
2231
877
  };
2232
878
  declare const $SenderAuthMessageScheme: {
2233
879
  readonly type: "string";
2234
- readonly description: "The signature method used for authorizing this payment:\n- `EVM_PERMIT2`: Gasless token approvals for Ethereum/EVM chains\n- `SOLANA`: Standard Solana transaction signatures\n- `TRON`: Tron transaction signatures\n";
880
+ readonly description: "The signature method used for authorizing this payment:\n- `EVM_PERMIT2`: Gasless token approvals for Ethereum/EVM chains\n- `EVM_PERMIT2_ESCROW`: Gasless approvals with escrow support\n- `SOLANA`: Standard Solana transaction signatures\n- `TRON`: Tron transaction signatures";
2235
881
  readonly enum: readonly ["EVM_PERMIT2", "EVM_PERMIT2_ESCROW", "SOLANA", "TRON"];
2236
882
  };
2237
883
  declare const $SignedMessage: {
2238
884
  readonly type: "object";
2239
- readonly description: "A message that has been cryptographically signed to prove authorization.\nThe signature proves you control the wallet that's sending funds.\n";
885
+ readonly description: "A message that has been cryptographically signed to prove authorization. The signature proves you control the wallet that's sending funds.";
2240
886
  readonly required: readonly ["message", "signature"];
2241
887
  readonly properties: {
2242
888
  readonly message: {
2243
889
  readonly type: "string";
2244
- readonly description: "The data that was signed. Format depends on the blockchain:\n- EVM: Hex-encoded message hash (with 0x prefix)\n- Solana: Base64 encoded message\n- Tron: Hex-encoded message hash (possibly without 0x prefix)\n";
890
+ readonly description: "The data that was signed. Format depends on the blockchain:\n- EVM: Hex-encoded message hash (with 0x prefix)\n- Solana: Hex-encoded message hash (with 0x prefix)\n- Tron: Hex-encoded message hash (possibly without 0x prefix)";
2245
891
  readonly example: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef";
2246
892
  };
2247
893
  readonly message_prehash: {
2248
894
  readonly type: "string";
2249
- readonly description: "Optional: If 'message' contains a hash, this field contains the original data\nbefore it was hashed. Useful for verification and debugging.\n";
895
+ readonly description: "Optional: If 'message' contains a hash, this field contains the original data before it was hashed. Useful for verification and debugging.";
2250
896
  readonly example: "{\"permit\":{\"token\":\"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\"amount\":\"1000000\"}}";
2251
897
  };
2252
898
  readonly signature: {
2253
899
  readonly type: "string";
2254
- readonly description: "The cryptographic signature proving you authorized this message.\nFormat varies by blockchain (hex for EVM/Tron, base58 for Solana).\n";
900
+ readonly description: "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.";
2255
901
  readonly example: "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab1c";
2256
902
  };
903
+ readonly payload: {
904
+ readonly type: "object";
905
+ readonly description: "Optional chain-specific payload containing additional signing context (e.g., delegate_signer for Solana). Preserved through the pipeline for downstream consumers.";
906
+ readonly additionalProperties: true;
907
+ readonly example: {
908
+ readonly delegate_signer: "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin";
909
+ };
910
+ };
2257
911
  };
2258
912
  };
2259
913
  declare const $VerifiableCredentialAuth: {
2260
914
  readonly type: "object";
2261
- readonly description: "Optional identity verification using cryptographic credentials.\nRequired when regulatory compliance or KYC verification is needed for the payment.\n";
915
+ readonly description: "Optional identity verification using cryptographic credentials.\n\nDEPRECATED. Credentials are moving to a holder-signed W3C VerifiablePresentation that\ntravels alongside a request rather than inside it. That envelope is not part of this\nHTTP contract, so there is nothing here to move them to yet: treat this as a legacy\ncarrier, and do not build a new integration on it.";
2262
916
  readonly required: readonly ["verifiable_credential", "verification_method_id", "signature"];
2263
917
  readonly properties: {
2264
918
  readonly verifiable_credential: {
@@ -2324,7 +978,7 @@ declare const $VerifiableCredential: {
2324
978
  };
2325
979
  readonly credentialStatus: {
2326
980
  readonly type: "object";
2327
- readonly description: "Information for credential revocation checking";
981
+ readonly description: "Information for credential revocation checking. Not consulted by the verifier today.";
2328
982
  readonly additionalProperties: true;
2329
983
  };
2330
984
  readonly proof: {
@@ -2334,31 +988,90 @@ declare const $VerifiableCredential: {
2334
988
  };
2335
989
  };
2336
990
  };
991
+ declare const $PaymentStatus: {
992
+ readonly type: "string";
993
+ readonly description: "Where your payment is in its lifecycle. One payment reads the same however you ask\nabout it.\n\n- `pending`: accepted and in progress. Nothing has reached the recipient yet.\n- `finalizing`: the transaction paying your recipient is on chain and is accruing\n the confirmations its chain requires. NOT FINAL, see below.\n- `completed`: delivered, with the required confirmations behind it.\n- `failed`: did not complete. Any funds held in escrow are returned, and `error`\n describes what went wrong.\n\n`completed` and `failed` are final and will not change afterwards. `pending` and\n`finalizing` will.\n\n**Do not treat `finalizing` as delivered.** It says the payment has been made on\nchain but is not yet irreversible, much as a card authorization is not yet a\nsettlement. It normally becomes `completed`, and it can still become `failed` if\nthe transaction never reaches the confirmation depth its chain requires. Acting on\n`finalizing` — releasing goods, crediting an account — means accepting that risk\ndeliberately, at whatever threshold suits you rather than the one we wait for.\n\n`finalizing` is about paying the recipient. While your own funds are still being\ncommitted on the source chain the payment is `pending`, because nothing has reached\nthe recipient yet.\n";
994
+ readonly enum: readonly ["pending", "finalizing", "completed", "failed"];
995
+ readonly example: "pending";
996
+ };
997
+ declare const $PaymentTransaction: {
998
+ readonly type: "object";
999
+ readonly description: "One on-chain transaction belonging to a payment: which chain, which transaction, and\nwhich block it landed in.\n\nWhether the payment has actually happened is answered by `status`, not here. Read this\nto look the transaction up on chain and to verify it yourself.\n";
1000
+ readonly required: readonly ["transaction_hash", "chain_id"];
1001
+ readonly properties: {
1002
+ readonly transaction_hash: {
1003
+ readonly type: "string";
1004
+ readonly description: "The transaction's hash on its chain. Hex hashes carry the `0x` prefix, including on\nTron, whose own tooling omits it.\n";
1005
+ readonly pattern: "^(0x[a-fA-F0-9]{64}|[1-9A-HJ-NP-Za-km-z]{32,88})$";
1006
+ readonly example: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef";
1007
+ };
1008
+ readonly chain_id: {
1009
+ readonly type: "string";
1010
+ readonly description: "CAIP-2 identifier of the chain the transaction is on.";
1011
+ readonly pattern: "^[a-z0-9]+:[a-zA-Z0-9_-]+$";
1012
+ readonly example: "eip155:42161";
1013
+ };
1014
+ readonly block_number: {
1015
+ readonly type: "integer";
1016
+ readonly description: "The block the transaction landed in. Absent until it has been mined.\n\nProvisional while `status` is `finalizing`: on a chain that settles against another,\na reorganization there can move the transaction to a different block. Settled once\n`status` is `completed` — keep it as a final record only from then.\n";
1017
+ readonly example: 61234567;
1018
+ };
1019
+ };
1020
+ };
1021
+ declare const $PaymentTransactions: {
1022
+ readonly type: "object";
1023
+ readonly description: "The transactions a payment has produced, one entry per stage, added as each becomes\nknown. A stage absent here has produced no transaction yet.\n\nThese are the two movements that decide whether your payment happened: your funds\nbeing committed, and your recipient being paid. Present on every outcome, so a\npayment that did not complete can still be traced on chain.\n`fulfillment_confirmation` is not a substitute: it is written only once a payment\ncompletes, and describes the finished delivery rather than progress towards it.\n\nWhere a stage is attempted more than once, the entry describes the attempt that\ncounts — the one that succeeded, or the last one if none did.\n";
1024
+ readonly properties: {
1025
+ readonly deposit: {
1026
+ readonly allOf: readonly [{
1027
+ readonly $ref: "#/components/schemas/PaymentTransaction";
1028
+ }];
1029
+ readonly description: "Committing your funds on the source chain.";
1030
+ };
1031
+ readonly fulfillment: {
1032
+ readonly allOf: readonly [{
1033
+ readonly $ref: "#/components/schemas/PaymentTransaction";
1034
+ }];
1035
+ readonly description: "Paying your recipient on the destination chain.";
1036
+ };
1037
+ };
1038
+ };
2337
1039
  declare const $PaymentResponse: {
2338
1040
  readonly type: "object";
2339
- readonly description: "Response from submitting a payment request. If settlement completes inside the\ngateway's synchronous window, the response includes a fulfillment_confirmation with\nfull settlement details. Otherwise you receive a payment_id plus the payment's\ncurrent `status`, and can poll /v1/payments/{paymentId}/status for updates.\n\nRead `status` before deciding what to do next: a `pending` payment is in flight and\nmust NOT be re-submitted under a new request_id (that would be a second payment),\nwhereas a `failed` or `cancelled` one is terminal — re-submitting it under the SAME\nrequest_id resolves to the same terminal payment, so a genuine re-attempt needs a\nnew request_id.\n";
1041
+ readonly description: "Response from submitting a payment request. If settlement completes inside the\ngateway's synchronous window, the response includes a fulfillment_confirmation with\nfull settlement details. Otherwise you receive a payment_id plus the payment's\ncurrent `status`, and can poll /v1/payments/{paymentId}/status for updates.\n\nRead `status` before deciding what to do next: a `pending` or `finalizing` payment is\nin flight and must NOT be re-submitted under a new request_id (that would be a second\npayment), whereas a `failed` one is terminal — re-submitting it under the SAME\nrequest_id resolves to the same terminal payment, so a genuine re-attempt needs a\nnew request_id.\n\n**A synchronously-completed payment carries proof of QUOTE as well as of delivery.** When\nsettlement lands inside the window you get `status: completed`, a full\n`fulfillment_confirmation`, and — since a quote necessarily was awarded to get there —\n`quote_id` and `fulfillment_quote`. The fast path therefore needs no follow-up call to\nverify: recompute `quote_hash` over the returned quote and compare it against the on-chain\ncommitment from this response alone.\n\n`status` is present on every response. `completed` is always accompanied by\nfulfillment_confirmation; `failed` is accompanied by `error` where a reason has been\nrecorded.\n";
2340
1042
  readonly required: readonly ["payment_id", "status", "idempotent_replay"];
2341
1043
  readonly properties: {
2342
1044
  readonly payment_id: {
2343
1045
  readonly type: "string";
2344
1046
  readonly description: "Unique ID for tracking this payment. Save this to check status later.\n";
2345
- readonly example: "550e8400-e29b-41d4-a716-446655440000";
1047
+ readonly example: "0x761989729fefb4b0cb8b3e6f787301a3878c91e8fba35ed362a079292879f34f";
2346
1048
  };
2347
1049
  readonly status: {
2348
- readonly type: "string";
2349
- readonly enum: readonly ["pending", "completed", "failed", "cancelled"];
2350
- readonly description: "Current status of the payment, with the same meaning as on\n/v1/payments/{paymentId}/status:\n- `pending`: accepted and being processed\n- `completed`: successfully delivered\n- `failed`: failed (funds returned if escrowed)\n- `cancelled`: cancelled before completion\n\nPresent on every response. `completed` is always accompanied by\nfulfillment_confirmation; `failed` is accompanied by `error` where a reason has\nbeen recorded.\n";
1050
+ readonly $ref: "#/components/schemas/PaymentStatus";
1051
+ };
1052
+ readonly transactions: {
1053
+ readonly $ref: "#/components/schemas/PaymentTransactions";
2351
1054
  };
2352
1055
  readonly idempotent_replay: {
2353
1056
  readonly type: "boolean";
2354
1057
  readonly description: "Whether this response describes a payment that already existed, rather than one\ncreated by this request. `true` means the request_id had been used before and you\nare being handed the ORIGINAL payment — no second payment was created and nothing\nadditional was charged.\n\n**Re-attempting a payment.** Re-submit the same request and you get the same payment\nback. You may re-send the original bytes unchanged: the deadlines will have expired by\nthen — `quote_deadline` bounds the auction and is short, while this endpoint may hold a\nsubmission for up to 30 seconds — and an expired deadline on a re-submission is not an\nerror, because the request is resolved onto the payment that already exists rather than\nused to create one.\n\nRe-signing with fresh deadlines is equally fine and returns the same payment. What you\nmust NOT change is the request_id, and what you must not change under it is the\npayment's economics — source, destination, fulfillment_amount, max_source_amount — which\nare rejected with 409 IDEMPOTENCY_TERMS_MISMATCH. Deadlines and the signature are\nexempt precisely so that a re-attempt is possible.\n\nA genuinely new payment needs a NEW request_id. In particular a `failed` payment is\nterminal: re-submitting its request_id keeps returning that dead payment, so recovering\nmeans starting a new one under a new key.\n\nPresent on every response, `false` for a newly created payment. A response without\nthe field is from a gateway predating it, not a newly created payment.\n\nThis is the field to read when reconciling a suspected double charge: two\nsubmissions where the second reports `true` are one payment, whereas two both\nreporting `false` are two. It says nothing about how far the payment has got —\nread `status` for that.\n";
2355
1058
  readonly example: false;
2356
1059
  };
1060
+ readonly quote_id: {
1061
+ readonly type: "string";
1062
+ readonly description: "The winning quote's ID. Present when `status` is `completed` — a payment cannot settle\nwithout an award — and absent on a `pending` response, where no quote has been selected\nyet. Same value and meaning as on GET /v1/payments/{paymentId}/status.\n";
1063
+ readonly example: "0x9a3b...e8d4";
1064
+ };
1065
+ readonly fulfillment_quote: {
1066
+ readonly type: "object";
1067
+ readonly description: "The settler-signed FulfillmentQuote for the winning quote, returned verbatim as an\nopaque signed document — the PREIMAGE of the `quote_hash` committed on-chain. Same\nvalue, semantics and canonicalization caveats as on\nGET /v1/payments/{paymentId}/status; see that field for how to verify it.\n\nPresent when `status` is `completed`. It may be absent even then, if the stored quote\nis unreadable: the award is reported through `quote_id` regardless, so a present\n`quote_id` with no `fulfillment_quote` means \"verification preimage unavailable\" and\nnever \"no quote was awarded\". A consumer that requires the preimage should fall back to\nthe status endpoint rather than treat the payment as unverified.\n";
1068
+ readonly 'x-go-type': "json.RawMessage";
1069
+ };
2357
1070
  readonly fulfillment_confirmation: {
2358
1071
  readonly $ref: "#/components/schemas/FulfillmentConfirmation";
2359
1072
  };
2360
1073
  readonly error: {
2361
- readonly $ref: "#/components/schemas/PaymentError";
1074
+ readonly $ref: "#/components/schemas/PaymentFailure";
2362
1075
  };
2363
1076
  };
2364
1077
  };
@@ -2368,47 +1081,80 @@ declare const $GetPaymentStatusResponse: {
2368
1081
  readonly payment_id: {
2369
1082
  readonly type: "string";
2370
1083
  readonly description: "The payment ID you're checking status for.\n";
2371
- readonly example: "550e8400-e29b-41d4-a716-446655440000";
1084
+ readonly example: "0x761989729fefb4b0cb8b3e6f787301a3878c91e8fba35ed362a079292879f34f";
2372
1085
  };
2373
1086
  readonly status: {
2374
- readonly type: "string";
2375
- readonly enum: readonly ["pending", "completed", "failed", "cancelled"];
2376
- readonly description: "Current status of your payment:\n- `pending`: Payment is being processed\n- `completed`: Payment successfully delivered\n- `failed`: Payment failed (funds returned if escrowed)\n- `cancelled`: Payment was cancelled before completion\n";
1087
+ readonly $ref: "#/components/schemas/PaymentStatus";
1088
+ };
1089
+ readonly transactions: {
1090
+ readonly $ref: "#/components/schemas/PaymentTransactions";
2377
1091
  };
2378
1092
  readonly updated_at: {
2379
1093
  readonly type: "string";
2380
1094
  readonly format: "date-time";
2381
1095
  readonly description: "When the status was last updated";
2382
1096
  };
1097
+ readonly quote_id: {
1098
+ readonly type: "string";
1099
+ readonly description: "The winning quote's ID. Present once a quote has been awarded for this payment;\nabsent while the payment is still collecting or awarding. Cross-references the\n`quote_id` returned by GET /v1/payments/quote-requests/{quoteRequestId}.\n";
1100
+ readonly example: "0x9a3b...e8d4";
1101
+ };
1102
+ readonly fulfillment_quote: {
1103
+ readonly type: "object";
1104
+ readonly description: "The settler-signed FulfillmentQuote for the winning quote, returned verbatim as an\nopaque signed document (structurally the canonical FulfillmentQuote/v1 declaration at\nhttps://schemas.atum.xyz/declarations/FulfillmentQuote/v1). Present once a quote has\nbeen awarded — including after the payment completes and `fulfillment_confirmation` is\npopulated, since that is precisely when a consumer verifies.\n\nThis is the PREIMAGE of the `quote_hash` committed on-chain in the escrow deposit and\nreserve witnesses. On-chain we commit only the hash, so a quote-selector consumer\nrecomputes quote_hash over these bytes and compares it against the on-chain commitment\nto confirm the payment settled against the quote it selected (\"trust but verify\"), and\nverifies the settler signature over the same bytes.\n\nquote_hash is canonicalization-based (URDNA2015), so it is stable across JSON\nkey-order/whitespace normalization and across JSON string-escaping differences. The\nreturned bytes are hash-equivalent to, but not necessarily byte-identical with, what\nthe settler emitted (quotes are stored as JSONB, which normalizes on write). The\ngateway still never re-serializes the quote through a typed struct (that renormalizes\ntimestamp values and WOULD change quote_hash), so the Go binding exposes it as a raw\nJSON passthrough.\n";
1105
+ readonly 'x-go-type': "json.RawMessage";
1106
+ };
2383
1107
  readonly fulfillment_confirmation: {
2384
1108
  readonly $ref: "#/components/schemas/FulfillmentConfirmation";
2385
1109
  };
2386
1110
  readonly error: {
2387
- readonly $ref: "#/components/schemas/PaymentError";
1111
+ readonly $ref: "#/components/schemas/PaymentFailure";
1112
+ };
1113
+ readonly requested_count: {
1114
+ readonly type: "integer";
1115
+ readonly description: "How many settler agents this payment's auction was broadcast to. Absent means\nunknown, never zero.\n";
1116
+ readonly example: 8;
1117
+ };
1118
+ readonly decline_summary: {
1119
+ readonly type: "array";
1120
+ readonly description: "Why the payment drew few or no quotes. Read from the same settler reports as the\nquote-request endpoints, keyed by this payment, so a payment that failed on an expired\nquote deadline can say WHY nobody funded it instead of only that nobody did.\n\nEvery declining agent is counted exactly once under its most recent reason. Empty means\nno agent declined against this payment, absent means the breakdown could not be read. A\npayment awarded out of a quote-request batch was bid on at quote time, so its declines\nare keyed to that batch and are read from the batch's status endpoint rather than here.\nAs on the quote-request endpoints, the free-form decline detail is never relayed.\n";
1121
+ readonly items: {
1122
+ readonly $ref: "#/components/schemas/DeclineSummaryEntry";
1123
+ };
2388
1124
  };
2389
1125
  };
2390
1126
  };
2391
- declare const $PaymentError: {
1127
+ declare const $PaymentFailure: {
2392
1128
  readonly type: "object";
2393
- readonly description: "Error details when payment status is \"failed\".\nOnly present when the payment has failed. Contains a machine-readable\ncode for programmatic handling and a human-readable message for debugging.\n";
1129
+ readonly description: "Why a payment failed. Present only when `status` is `failed`, and identical\nhowever you ask about the payment.\n\n`code` is the stable, machine-readable identity of the failure — branch on it\nrather than on `message`, which is written for a person and may be reworded.\n`docs_url` points at the page describing that code.\n";
2394
1130
  readonly required: readonly ["code", "message"];
2395
1131
  readonly properties: {
2396
1132
  readonly code: {
2397
1133
  readonly type: "string";
2398
- readonly description: "Public error category in SCREAMING_SNAKE_CASE.\nCommon codes:\n- `SETTLEMENT_FAILED`: The settlement could not be completed\n- `NO_ROUTE_AVAILABLE`: No settlement route was available\n- `INTERNAL_ERROR`: An unexpected error occurred\n";
1134
+ readonly description: "Public error category in SCREAMING_SNAKE_CASE. Common codes:\n- `SETTLEMENT_FAILED`: the settlement could not be completed\n- `NO_QUOTES_RECEIVED`: no quotes arrived within the auction window\n- `INTERNAL_ERROR`: an unexpected error occurred\n";
2399
1135
  readonly example: "SETTLEMENT_FAILED";
2400
1136
  };
2401
1137
  readonly message: {
2402
1138
  readonly type: "string";
2403
- readonly description: "Human-readable error description with additional context.\n";
1139
+ readonly description: "Human-readable description of the failure, for a person reading it. Do not\nbranch on this text.\n";
2404
1140
  readonly example: "No quotes received within the auction window";
2405
1141
  };
2406
1142
  readonly domain: {
2407
1143
  readonly type: "string";
2408
- readonly description: "Service domain where the error originated.\n";
2409
- readonly enum: readonly ["PAYMENT_GATEWAY", "SOLVER_GATEWAY", "SETTLER_AGENT", "WALLET_ORCHESTRATION", "VERIFICATION_SERVICE", "BLOCKCHAIN", "EXTERNAL_SERVICE"];
1144
+ readonly description: "Which part of the system reported the failure.\n";
1145
+ readonly enum: readonly ["PAYMENT_GATEWAY", "SETTLER_GATEWAY", "SETTLER_AGENT", "WALLET_ORCHESTRATION", "VERIFICATION_SERVICE", "BLOCKCHAIN", "EXTERNAL_SERVICE"];
2410
1146
  readonly example: "PAYMENT_GATEWAY";
2411
1147
  };
1148
+ readonly docs_url: {
1149
+ readonly type: "string";
1150
+ readonly format: "uri";
1151
+ readonly description: "Link to the documentation page for this public code.";
1152
+ };
1153
+ readonly retry_classification: {
1154
+ readonly type: "string";
1155
+ readonly description: "What the caller should do next. Absent means the condition has not been classified, which is not the same as safe to retry.\nRe-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.";
1156
+ readonly example: "RECONCILE_THEN_DECIDE";
1157
+ };
2412
1158
  readonly blockchain_context: {
2413
1159
  readonly $ref: "#/components/schemas/PaymentBlockchainContext";
2414
1160
  };
@@ -2416,44 +1162,45 @@ declare const $PaymentError: {
2416
1162
  };
2417
1163
  declare const $PaymentBlockchainContext: {
2418
1164
  readonly type: "object";
2419
- readonly description: "Blockchain-specific error context. Only present when the error\noriginated from an on-chain operation (e.g., escrow revert,\nfulfillment failure).\n";
1165
+ readonly description: "Where on chain a failed payment failed. Present only when the failure happened\non chain — an escrow revert, or a fulfillment that could not be delivered — so a\npayment that failed before any transaction was sent carries no context here.";
2420
1166
  readonly properties: {
2421
1167
  readonly chain_id: {
2422
1168
  readonly type: "string";
2423
1169
  readonly description: "CAIP-2 chain identifier";
2424
- readonly example: "eip155:42161";
1170
+ readonly pattern: "^[a-z0-9]+:[a-zA-Z0-9_-]+$";
2425
1171
  };
2426
- readonly tx_hash: {
1172
+ readonly transaction_hash: {
2427
1173
  readonly type: "string";
2428
1174
  readonly description: "Failed transaction hash";
2429
- readonly example: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef";
1175
+ readonly pattern: "^(0x[a-fA-F0-9]{64}|[1-9A-HJ-NP-Za-km-z]{32,88})$";
2430
1176
  };
2431
1177
  readonly block_number: {
2432
1178
  readonly type: "integer";
2433
1179
  readonly description: "Block number where error occurred";
2434
- readonly example: 12345678;
2435
1180
  };
2436
1181
  readonly contract_address: {
2437
1182
  readonly type: "string";
2438
- readonly description: "Contract address involved in the error";
2439
- readonly example: "0x1234567890abcdef1234567890abcdef12345678";
1183
+ readonly description: "Contract that caused the error";
1184
+ readonly pattern: "^(0x[a-fA-F0-9]{40}|[1-9A-HJ-NP-Za-km-z]{32,44})$";
2440
1185
  };
2441
1186
  readonly revert_reason: {
2442
1187
  readonly type: "string";
2443
1188
  readonly description: "Smart contract revert reason";
2444
- readonly example: "Insufficient balance";
2445
1189
  };
2446
1190
  readonly gas_used: {
2447
1191
  readonly type: "string";
2448
1192
  readonly description: "Gas consumed before failure";
2449
- readonly example: "21000";
2450
1193
  };
2451
1194
  readonly estimated_gas_needed: {
2452
1195
  readonly type: "string";
2453
1196
  readonly description: "Estimated gas needed for success";
2454
- readonly example: "50000";
2455
1197
  };
2456
1198
  };
1199
+ readonly 'x-go-type': "atumerror.BlockchainContext";
1200
+ readonly 'x-go-type-import': {
1201
+ readonly name: "atumerror";
1202
+ readonly path: "github.com/atum-labs/protocol/schemas/apis/error/v1/bindings/go";
1203
+ };
2457
1204
  };
2458
1205
  declare const $PreparePaymentRequest: {
2459
1206
  readonly type: "object";
@@ -2473,7 +1220,7 @@ declare const $PreparePaymentRequest: {
2473
1220
  readonly source_account: {
2474
1221
  readonly type: "string";
2475
1222
  readonly description: "Wallet address that will send the payment";
2476
- readonly example: "0x742d35Cc6634C0532925a3b844Bc9e7595f4136";
1223
+ readonly example: "0x742D35cC6634c0532925a3b844Bc9e7595F41360";
2477
1224
  };
2478
1225
  readonly destination_asset: {
2479
1226
  readonly type: "string";
@@ -2546,9 +1293,10 @@ declare const $PaymentTimelineResponse: {
2546
1293
  readonly example: "0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f";
2547
1294
  };
2548
1295
  readonly status: {
2549
- readonly type: "string";
2550
- readonly enum: readonly ["pending", "settling", "completed", "failed", "cancelled"];
2551
- readonly description: "High-level status:\n- `pending`: Bidding, awarded, or early in settlement\n- `settling`: Settlement in progress (on-chain steps executing)\n- `completed`: Payment successfully delivered\n- `failed`: Payment failed\n- `cancelled`: Payment was cancelled\n";
1296
+ readonly $ref: "#/components/schemas/PaymentStatus";
1297
+ };
1298
+ readonly transactions: {
1299
+ readonly $ref: "#/components/schemas/PaymentTransactions";
2552
1300
  };
2553
1301
  readonly created_at: {
2554
1302
  readonly type: "string";
@@ -2567,7 +1315,7 @@ declare const $PaymentTimelineResponse: {
2567
1315
  readonly $ref: "#/components/schemas/PaymentSummary";
2568
1316
  };
2569
1317
  readonly error: {
2570
- readonly $ref: "#/components/schemas/TimelineError";
1318
+ readonly $ref: "#/components/schemas/PaymentFailure";
2571
1319
  };
2572
1320
  readonly steps: {
2573
1321
  readonly type: "array";
@@ -2588,7 +1336,7 @@ declare const $PaymentSummary: {
2588
1336
  };
2589
1337
  readonly source_account: {
2590
1338
  readonly type: "string";
2591
- readonly example: "0x742d35Cc6634C0532925a3b844Bc9e7595f4136";
1339
+ readonly example: "0x742D35cC6634c0532925a3b844Bc9e7595F41360";
2592
1340
  };
2593
1341
  readonly dest_asset: {
2594
1342
  readonly type: "string";
@@ -2619,40 +1367,6 @@ declare const $PaymentSummary: {
2619
1367
  };
2620
1368
  };
2621
1369
  };
2622
- declare const $TimelineError: {
2623
- readonly type: "object";
2624
- readonly description: "Structured error details when a payment has failed";
2625
- readonly required: readonly ["code", "message"];
2626
- readonly properties: {
2627
- readonly code: {
2628
- readonly type: "string";
2629
- readonly description: "Machine-readable error code";
2630
- readonly example: "ESCROW_DEPOSIT_FAILED";
2631
- };
2632
- readonly message: {
2633
- readonly type: "string";
2634
- readonly description: "Human-readable error description";
2635
- };
2636
- readonly domain: {
2637
- readonly type: "string";
2638
- readonly description: "Which component reported the error";
2639
- readonly example: "SETTLER_AGENT";
2640
- };
2641
- readonly chain_id: {
2642
- readonly type: "string";
2643
- readonly description: "CAIP-2 chain where the error occurred (if on-chain)";
2644
- readonly example: "eip155:1";
2645
- };
2646
- readonly tx_hash: {
2647
- readonly type: "string";
2648
- readonly description: "Transaction hash of the failed on-chain attempt (if applicable)";
2649
- };
2650
- readonly revert_reason: {
2651
- readonly type: "string";
2652
- readonly description: "Smart-contract revert reason (if the error was an on-chain revert)";
2653
- };
2654
- };
2655
- };
2656
1370
  declare const $TimelineStep: {
2657
1371
  readonly type: "object";
2658
1372
  readonly required: readonly ["name", "label", "status"];
@@ -2687,7 +1401,7 @@ declare const $TimelineStep: {
2687
1401
  readonly description: "CAIP-2 chain this step happened on (if on-chain)";
2688
1402
  readonly example: "eip155:1";
2689
1403
  };
2690
- readonly tx_hash: {
1404
+ readonly transaction_hash: {
2691
1405
  readonly type: "string";
2692
1406
  readonly description: "Transaction hash associated with this step (if on-chain)";
2693
1407
  };
@@ -2700,7 +1414,7 @@ declare const $TimelineStep: {
2700
1414
  };
2701
1415
  declare const $ErrorResponse: {
2702
1416
  readonly type: "object";
2703
- readonly description: "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.";
1417
+ readonly description: "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.\n\nA panic is caught by shared middleware that responds `{\"error\": \"Internal server error occurred\"}` instead, so a 500 is not guaranteed to carry this shape.";
2704
1418
  readonly required: readonly ["code", "message"];
2705
1419
  readonly properties: {
2706
1420
  readonly code: {
@@ -2720,6 +1434,11 @@ declare const $ErrorResponse: {
2720
1434
  readonly description: "Correlation id to quote to support to locate the internal error record.";
2721
1435
  readonly example: "req_123456789";
2722
1436
  };
1437
+ readonly payment_id: {
1438
+ readonly type: "string";
1439
+ readonly description: "The payment this error was raised against. Absent when the error is not about a specific payment.";
1440
+ readonly example: "0xc7108e200d11580e7e75185991084b42a535af588ba8267cd0d1e7df089e5c9c";
1441
+ };
2723
1442
  readonly docs_url: {
2724
1443
  readonly type: "string";
2725
1444
  readonly format: "uri";
@@ -2730,6 +1449,11 @@ declare const $ErrorResponse: {
2730
1449
  readonly description: "Originating service domain.";
2731
1450
  readonly example: "PAYMENT_GATEWAY";
2732
1451
  };
1452
+ readonly retry_classification: {
1453
+ readonly type: "string";
1454
+ readonly description: "What the caller should do next. Absent means the condition has not been classified, which is not the same as safe to retry.\nRe-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.";
1455
+ readonly example: "RECONCILE_THEN_DECIDE";
1456
+ };
2733
1457
  };
2734
1458
  };
2735
1459
  declare const $CreateQuoteRequest: {
@@ -2753,8 +1477,9 @@ declare const $CreateQuoteRequest: {
2753
1477
  };
2754
1478
  readonly destination: {
2755
1479
  readonly type: "array";
2756
- readonly description: "Array of destination assets for the settlement agent to choose from (at least one required).";
1480
+ readonly description: "Array of destination assets for the settlement agent to choose from (at least one required, at most 16).\nThe ceiling bounds the fan-out one request can buy: every consumer iterates this list.\n";
2757
1481
  readonly minItems: 1;
1482
+ readonly maxItems: 16;
2758
1483
  readonly items: {
2759
1484
  readonly $ref: "#/components/schemas/OwnedAsset";
2760
1485
  };
@@ -2778,7 +1503,7 @@ declare const $CreateQuoteRequest: {
2778
1503
  readonly fulfillment_deadline: {
2779
1504
  readonly type: "string";
2780
1505
  readonly format: "date-time";
2781
- readonly description: "Required. Final deadline for completing the payment. Past it the payment is cancelled and\neligible for refund. The gateway injects no default and never mutates the\noriginator-supplied body, so the value is carried through verbatim to the award call. It\nmust be supplied and must be in the future. Must be strictly later than quote_deadline.\n";
1506
+ readonly description: "Required. Final deadline for completing the payment. Past it the payment fails and\neligible for refund. The gateway injects no default and never mutates the\noriginator-supplied body, so the value is carried through verbatim to the award call. It\nmust be supplied and must be in the future. Must be strictly later than quote_deadline.\n";
2782
1507
  readonly example: "2026-04-29T12:30:00Z";
2783
1508
  };
2784
1509
  readonly settler_auth_required: {
@@ -2794,7 +1519,7 @@ declare const $CreateQuoteRequest: {
2794
1519
  readonly quote_selector: {
2795
1520
  readonly type: "string";
2796
1521
  readonly description: "Wallet address or public key of a trusted service that auto-selects the best rate.\nLeave empty to use the default selector.\n";
2797
- readonly example: "0x742d35Cc6634C0532925a3b844Bc9e7595f4136";
1522
+ readonly example: "0x742D35cC6634c0532925a3b844Bc9e7595F41360";
2798
1523
  };
2799
1524
  readonly fulfillment_verifier: {
2800
1525
  readonly type: "object";
@@ -2809,7 +1534,7 @@ declare const $CreateQuoteRequest: {
2809
1534
  readonly endpoint: {
2810
1535
  readonly type: "string";
2811
1536
  readonly format: "uri";
2812
- readonly description: "Origin of the fulfillment verifier service, with no path — the caller\nappends the verifier's own API paths. The gateway's `/defaults` response\nsupplies the default fulfillment verifier for each chain.\n";
1537
+ readonly description: "Origin of the fulfillment verifier service, with no path — the caller\nappends the verifier's own API paths. The gateway's `/v1/defaults` response\nsupplies the default fulfillment verifier for each chain.\n";
2813
1538
  readonly example: "https://veri-fill.production-testnet.atum.xyz";
2814
1539
  };
2815
1540
  };
@@ -2817,7 +1542,7 @@ declare const $CreateQuoteRequest: {
2817
1542
  readonly escrow_contract_address: {
2818
1543
  readonly type: "string";
2819
1544
  readonly description: "Optional escrow contract address. Leave empty to use the default.";
2820
- readonly example: "0x742d35Cc6634C0532925a3b844Bc9e7595f4136";
1545
+ readonly example: "0x742D35cC6634c0532925a3b844Bc9e7595F41360";
2821
1546
  };
2822
1547
  readonly fulfillment_proxy: {
2823
1548
  readonly type: "string";
@@ -2838,7 +1563,7 @@ declare const $CreateQuoteRequest: {
2838
1563
  readonly type: "string";
2839
1564
  readonly pattern: "^did:[a-z][a-z0-9]*:[a-zA-Z0-9._:%-]+$";
2840
1565
  };
2841
- readonly example: readonly ["did:pkh:eip155:1:0x742d35Cc6634C0532925a3b844Bc9e7595f4136"];
1566
+ readonly example: readonly ["did:pkh:eip155:1:0x742D35cC6634c0532925a3b844Bc9e7595F41360"];
2842
1567
  };
2843
1568
  readonly blacklist: {
2844
1569
  readonly type: "array";
@@ -2850,7 +1575,7 @@ declare const $CreateQuoteRequest: {
2850
1575
  readonly type: "string";
2851
1576
  readonly pattern: "^did:[a-z][a-z0-9]*:[a-zA-Z0-9._:%-]+$";
2852
1577
  };
2853
- readonly example: readonly ["did:pkh:eip155:1:0x892BB2e4F6b14a2B5b82Ba8d33E5925D42D4432F"];
1578
+ readonly example: readonly ["did:pkh:eip155:1:0x892bb2E4F6b14a2B5b82bA8D33e5925d42d4432f"];
2854
1579
  };
2855
1580
  };
2856
1581
  };
@@ -2875,37 +1600,37 @@ declare const $CreateQuoteRequest: {
2875
1600
  };
2876
1601
  declare const $DataIntegrityProof: {
2877
1602
  readonly type: "object";
2878
- readonly description: "W3C Data Integrity proof conforming to the Data Integrity 1.0 specification.";
1603
+ readonly description: "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.";
2879
1604
  readonly required: readonly ["type", "created", "verificationMethod", "proofPurpose"];
2880
1605
  readonly properties: {
2881
1606
  readonly type: {
2882
1607
  readonly type: "string";
2883
- readonly description: "Proof type identifier (e.g. EcdsaSecp256k1RecoverySignature2020).";
1608
+ readonly description: "Proof type identifier. ECDSA-secp256k1 (recoverable, EVM-compatible) for did:pkh:eip155:* signers; Ed25519 for did:pkh:solana:* signers.";
2884
1609
  readonly example: "EcdsaSecp256k1RecoverySignature2020";
2885
1610
  };
2886
1611
  readonly created: {
2887
1612
  readonly type: "string";
2888
1613
  readonly format: "date-time";
2889
- readonly description: "ISO 8601 timestamp when the proof was created.";
1614
+ readonly description: "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.";
2890
1615
  readonly example: "2026-04-29T12:00:00Z";
2891
1616
  };
2892
1617
  readonly verificationMethod: {
2893
1618
  readonly type: "string";
2894
- readonly description: "DID URL identifying the verification method.";
1619
+ readonly description: "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.";
2895
1620
  readonly example: "did:pkh:eip155:42161:0xabc...#blockchainAccountId";
2896
1621
  };
2897
1622
  readonly proofPurpose: {
2898
1623
  readonly type: "string";
2899
- readonly description: "Purpose of the proof (e.g. assertionMethod, authentication).";
1624
+ readonly description: "Purpose of the proof (e.g., assertionMethod, authentication).";
2900
1625
  readonly example: "assertionMethod";
2901
1626
  };
2902
1627
  readonly jws: {
2903
1628
  readonly type: "string";
2904
- readonly description: "Detached JWS signature (header..signature format for ES256K-R).";
1629
+ readonly description: "Detached JWS signature in <base64url(header)>..<base64url(sig)> form, header {alg:ES256K-R, b64:false, crit:[b64]}. Required at runtime for EcdsaSecp256k1RecoverySignature2020.";
2905
1630
  };
2906
1631
  readonly proofValue: {
2907
1632
  readonly type: "string";
2908
- readonly description: "Alternative to jws: base-encoded proof value.";
1633
+ readonly description: "Multibase-encoded raw signature bytes. Required at runtime for Ed25519Signature2020; mutually exclusive with jws in practice.";
2909
1634
  };
2910
1635
  };
2911
1636
  };
@@ -2944,7 +1669,7 @@ declare const $AwardedQuote: {
2944
1669
  readonly type: "string";
2945
1670
  readonly nullable: true;
2946
1671
  readonly description: "payment_id if this quote was awarded; null otherwise. Under MVP single-award, at most\none quote per batch carries a non-null value.\n";
2947
- readonly example: "py_9876fedc-ba98-7654-3210-fedcba987654";
1672
+ readonly example: "0x761989729fefb4b0cb8b3e6f787301a3878c91e8fba35ed362a079292879f34f";
2948
1673
  };
2949
1674
  };
2950
1675
  };
@@ -2959,14 +1684,14 @@ declare const $AwardedPayment: {
2959
1684
  };
2960
1685
  readonly payment_id: {
2961
1686
  readonly type: "string";
2962
- readonly example: "py_9876fedc-ba98-7654-3210-fedcba987654";
1687
+ readonly example: "0x761989729fefb4b0cb8b3e6f787301a3878c91e8fba35ed362a079292879f34f";
2963
1688
  };
2964
1689
  };
2965
1690
  };
2966
1691
  declare const $QuoteRequestResponse: {
2967
1692
  readonly type: "object";
2968
- readonly description: "Synchronous response to POST /v1/payments/quote-requests. Self-contained — the corridor\nfields are echoed at the response root so a drop-recovery client can build the award call\nwithout retaining the original request body.\n";
2969
- readonly required: readonly ["quote_request_id", "status"];
1693
+ readonly description: "Synchronous response to POST /v1/payments/quote-requests. Self-contained — the corridor\nfields are echoed at the response root so a drop-recovery client can build the award call\nwithout retaining the original request body.\n\nThe corridor echoed here describes the batch you actually receive. On an idempotent\nreplay that is the ORIGINAL batch's corridor and window, which may differ from what you\njust sent in the ways a retry is allowed to differ (the deadlines, and address casing).\n";
1694
+ readonly required: readonly ["quote_request_id", "status", "idempotent_replay"];
2970
1695
  readonly properties: {
2971
1696
  readonly quote_request_id: {
2972
1697
  readonly type: "string";
@@ -2979,6 +1704,10 @@ declare const $QuoteRequestResponse: {
2979
1704
  readonly description: "Collection-phase outcome of the create call:\n- `ready` — collection complete; `quotes` populated. If no settler bid, this is still\n `ready` with an empty `quotes` array (a successful \"no quotes available\" result —\n distinct from `expired`, which only applies to collected quotes that later lapse).\n- `collecting` — the sync wait cap fired before the quote deadline; poll the status endpoint for quotes.\nThe `awarded` and `expired` lifecycle states are observed only via the status endpoint, not here.\n";
2980
1705
  readonly example: "ready";
2981
1706
  };
1707
+ readonly idempotent_replay: {
1708
+ readonly type: "boolean";
1709
+ readonly description: "Whether this response describes a batch that already existed, rather than one opened\nby this request. `true` means the `request_id` had been used before and you are being\nhanded the ORIGINAL batch — no second batch was opened and no second broadcast went\nout to settlement agents.\n\n**Re-attempting a quote-request.** Re-submit the same request and you get the same\nbatch back. You may re-send the original bytes unchanged: `quote_deadline` bounds the\ncollection window and is short, so it will usually have expired by the time you\nretry, and an expired deadline on a re-submission is not an error — the request is\nresolved onto the batch that already exists rather than used to open one.\nRe-signing with fresh deadlines is equally fine and returns the same batch.\n\nThe window is NOT extended either way: it belongs to the batch, and `quote_deadline`\nin this response is the batch's own. Read `status` to see whether collection is\nstill running.\n\nWhat you must not change under one `request_id` is the corridor's economics —\naccounts, assets, or amounts — which are rejected with 409\nIDEMPOTENCY_TERMS_MISMATCH rather than resolved onto the first batch. A genuinely\ndifferent corridor needs a new `request_id`.\n\nPresent on every response, `false` for a newly opened batch. A response without the\nfield is from a gateway predating it, not a newly opened batch.\n";
1710
+ };
2982
1711
  readonly source: {
2983
1712
  readonly $ref: "#/components/schemas/OwnedAsset";
2984
1713
  };
@@ -3013,12 +1742,24 @@ declare const $QuoteRequestResponse: {
3013
1742
  readonly $ref: "#/components/schemas/Quote";
3014
1743
  };
3015
1744
  };
1745
+ readonly requested_count: {
1746
+ readonly type: "integer";
1747
+ readonly description: "How many agents the request was broadcast to, so silence is distinguishable from a\ndecline without a second call. Same meaning and same absence rule as on the status\nendpoint: absent means unknown, never zero.\n";
1748
+ readonly example: 8;
1749
+ };
1750
+ readonly decline_summary: {
1751
+ readonly type: "array";
1752
+ readonly description: "Why the request drew few or no quotes, carried here so that a `ready` response with an\nempty `quotes` array explains itself rather than requiring a follow-up read.\n\nSame counting rules as the status endpoint: every declining agent counted exactly once\nunder its most recent reason, empty when nobody declined, absent when the detail could not\nbe read. Provisional while `status` is `collecting`, because agents are still responding.\n";
1753
+ readonly items: {
1754
+ readonly $ref: "#/components/schemas/DeclineSummaryEntry";
1755
+ };
1756
+ };
3016
1757
  };
3017
1758
  };
3018
1759
  declare const $QuoteRequestAccepted: {
3019
1760
  readonly type: "object";
3020
- readonly description: "Asynchronous (202) response to POST /v1/payments/quote-requests. Returns the batch handle\nplus the echoed corridor; quotes are retrieved via the status endpoint.\n";
3021
- readonly required: readonly ["quote_request_id", "status"];
1761
+ readonly description: "Asynchronous (202) response to POST /v1/payments/quote-requests. Returns the batch handle\nplus the echoed corridor; quotes are retrieved via the status endpoint.\n\nThe corridor echoed here describes the batch you actually receive. On an idempotent\nreplay that is the ORIGINAL batch's corridor and window, which may differ from what you\njust sent in the ways a retry is allowed to differ (the deadlines, and address casing).\n";
1762
+ readonly required: readonly ["quote_request_id", "status", "idempotent_replay"];
3022
1763
  readonly properties: {
3023
1764
  readonly quote_request_id: {
3024
1765
  readonly type: "string";
@@ -3027,9 +1768,13 @@ declare const $QuoteRequestAccepted: {
3027
1768
  readonly status: {
3028
1769
  readonly type: "string";
3029
1770
  readonly enum: readonly ["collecting"];
3030
- readonly description: "Always `collecting` — collection is in progress server-side.";
1771
+ readonly description: "Always `collecting` — a constant on this response, not a report of the batch's state.\nOn an idempotent replay the batch's window may already have closed; read\nGET /v1/payments/quote-requests/{quoteRequestId} for its actual state.\n";
3031
1772
  readonly example: "collecting";
3032
1773
  };
1774
+ readonly idempotent_replay: {
1775
+ readonly type: "boolean";
1776
+ readonly description: "Whether this response describes a batch that already existed, rather than one opened\nby this request. `true` means the `request_id` had been used before and you are being\nhanded the ORIGINAL batch — no second batch was opened and no second broadcast went\nout to settlement agents.\n\nThe idempotency contract is the same as on the synchronous (200) response: a\nre-submission may carry expired deadlines and is resolved onto the existing batch\nrather than rejected, the collection window is the batch's own and is not extended,\nand differing economics are rejected with 409 IDEMPOTENCY_TERMS_MISMATCH rather than\ncollapsed onto the first batch.\n\nPresent on every response, `false` for a newly opened batch. A response without the\nfield is from a gateway predating it, not a newly opened batch.\n";
1777
+ };
3033
1778
  readonly source: {
3034
1779
  readonly $ref: "#/components/schemas/OwnedAsset";
3035
1780
  };
@@ -3088,8 +1833,52 @@ declare const $QuoteRequestStatusResponse: {
3088
1833
  readonly $ref: "#/components/schemas/AwardedPayment";
3089
1834
  };
3090
1835
  };
1836
+ readonly requested_count: {
1837
+ readonly type: "integer";
1838
+ readonly description: "How many agents the request was broadcast to. The only auction count that is not\nderivable from the rest of this response:\n\n- quoted = `quotes` length\n- declined = sum of `decline_summary[].count`\n- participated = quoted + declined\n- silent = `requested_count` - participated\n\nSilence and a decline are different signals, which is why the denominator is surfaced\nrather than left implicit.\n\nABSENT when the number is unknown, which happens when the broadcast count was never\nrecorded or when the auction detail could not be read. Absence means unknown, never zero,\nso `silent` is derivable only when this field is present.\n";
1839
+ readonly example: 8;
1840
+ };
1841
+ readonly decline_summary: {
1842
+ readonly type: "array";
1843
+ readonly description: "Why the request drew few or no quotes, so a caller can tell \"nobody can fund this right\nnow\" from \"my request was malformed\".\n\nEXHAUSTIVE over agents: every agent that declined is counted exactly once, under its most\nrecent reason, so the counts sum to the number of agents that declined. An agent that\ndeclined more than once with different reasons is counted once, not once per reason.\n\nEmpty means nobody declined. ABSENT means the auction detail could not be read, so the\nbreakdown is unknown. While `status` is `collecting` it is provisional, because agents are\nstill responding.\n\nThe free-form decline detail is never relayed, because that detail carries an agent's\nbalances and would let a caller map inventory by polling cheap quote-requests across\ncorridors.\n";
1844
+ readonly items: {
1845
+ readonly $ref: "#/components/schemas/DeclineSummaryEntry";
1846
+ };
1847
+ };
1848
+ };
1849
+ };
1850
+ declare const $DeclineSummaryEntry: {
1851
+ readonly type: "object";
1852
+ readonly required: readonly ["reason", "count"];
1853
+ readonly properties: {
1854
+ readonly reason: {
1855
+ readonly $ref: "#/components/schemas/DeclineReason";
1856
+ };
1857
+ readonly count: {
1858
+ readonly type: "integer";
1859
+ readonly description: "Agents whose most recent decline reason was this one. Counts agents, never rows, and an\nagent appears under one reason only.\n";
1860
+ readonly example: 4;
1861
+ };
1862
+ readonly retry_classification: {
1863
+ readonly type: "string";
1864
+ readonly description: "What would have to change for a settler giving this reason to submit a price quote,\ndrawn from the same closed set as the `retry_classification` on an error response so\na caller reads one vocabulary.\n\nIt describes the decline only. The authoritative instruction for the payment is the\n`retry_classification` on its own error response: a payment can fail for a reason no\nsettler named, and it can succeed while some settlers declined.\n\nOptional, and a pattern-constrained string for the same reason `DeclineReason` is.\n";
1865
+ readonly pattern: "^[A-Z][A-Z0-9_]*$";
1866
+ readonly example: "RETRY_AFTER_DELAY";
1867
+ };
1868
+ readonly docs_url: {
1869
+ readonly type: "string";
1870
+ readonly format: "uri";
1871
+ readonly description: "Link to the documentation for this reason. Absent rather than empty when no page is\npublished, so a reader never follows a link to the site root.\n";
1872
+ readonly example: "https://docs.atum.xyz/decline-reasons#insufficient-liquidity";
1873
+ };
3091
1874
  };
3092
1875
  };
1876
+ declare const $DeclineReason: {
1877
+ readonly type: "string";
1878
+ readonly description: "A settler's reason for not bidding, projected from its internal reason code through\nthe shared decline catalog (`apis/decline/v1/catalog.json`), which is the single\nsource of truth for the reason set. Several internal codes may map to one public\nreason.\n\nDeliberately a pattern-constrained string rather than a closed enum. The set grows\nwhenever a settler gains a cause worth naming, and a consumer whose generated client\ncloses the set rejects the whole response on a value it has not seen. Treat an\nunrecognised value as `OTHER`.\n\n`OTHER` covers a reason whose detail is settler-authored free text, and any reason\nthis gateway does not recognise. Both are counted so the summary stays exhaustive,\nwithout relaying text we neither author nor validate.\n";
1879
+ readonly pattern: "^[A-Z][A-Z0-9_]*$";
1880
+ readonly example: "INSUFFICIENT_LIQUIDITY";
1881
+ };
3093
1882
  declare const $AwardRequest: {
3094
1883
  readonly type: "object";
3095
1884
  readonly description: "Request body for POST /v1/payments/awards. Carries the two originator-signed artifacts:\n`sender_auth` (Permit2 deposit authorization) and a fully-formed `bid_award` declaration.\nThe awarded quote is derived server-side from bid_award.fulfillment_quote_json — no\nexplicit quote_id on the wire.\n";
@@ -3152,7 +1941,7 @@ declare const $AwardResponse: {
3152
1941
  readonly properties: {
3153
1942
  readonly payment_id: {
3154
1943
  readonly type: "string";
3155
- readonly example: "py_9876fedc-ba98-7654-3210-fedcba987654";
1944
+ readonly example: "0x761989729fefb4b0cb8b3e6f787301a3878c91e8fba35ed362a079292879f34f";
3156
1945
  };
3157
1946
  readonly status: {
3158
1947
  readonly type: "string";
@@ -3172,7 +1961,7 @@ declare const $AwardAccepted: {
3172
1961
  readonly properties: {
3173
1962
  readonly payment_id: {
3174
1963
  readonly type: "string";
3175
- readonly example: "py_9876fedc-ba98-7654-3210-fedcba987654";
1964
+ readonly example: "0x761989729fefb4b0cb8b3e6f787301a3878c91e8fba35ed362a079292879f34f";
3176
1965
  };
3177
1966
  readonly status: {
3178
1967
  readonly type: "string";
@@ -3182,6 +1971,125 @@ declare const $AwardAccepted: {
3182
1971
  };
3183
1972
  };
3184
1973
  };
1974
+ declare const $ChainDefaults: {
1975
+ readonly type: "object";
1976
+ readonly description: "The addresses for one chain. Optional fields appear only where they apply to that\nchain; an absent optional field is not an error.\n";
1977
+ readonly required: readonly ["chain_id", "quote_selector", "escrow_contract", "fulfillment_proxy", "fulfillment_verifier"];
1978
+ readonly properties: {
1979
+ readonly chain_id: {
1980
+ readonly type: "string";
1981
+ readonly description: "CAIP-2 identifier of the chain these defaults describe, normalised to lower case.";
1982
+ readonly example: "eip155:84532";
1983
+ };
1984
+ readonly quote_selector: {
1985
+ readonly type: "string";
1986
+ readonly description: "The account named as the reserver in the deposit authorization. Sign against this exact value; a deposit reserved by anyone else is rejected.";
1987
+ readonly example: "0xd0f080E23F95571D26eEb1FAD24a5F3d66835195";
1988
+ };
1989
+ readonly escrow_contract: {
1990
+ readonly type: "string";
1991
+ readonly description: "The escrow the deposit is made into, and the spender of the token approval. Empty when the chain is not fully configured.";
1992
+ readonly example: "0xa61a0C025943Aa79B73D8D07E3aDbEe1873738b4";
1993
+ };
1994
+ readonly fulfillment_proxy: {
1995
+ readonly type: "string";
1996
+ readonly description: "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.";
1997
+ readonly example: "0x09A5a0d6955E5394A661Cd9E7007076fa63B4158";
1998
+ };
1999
+ readonly fulfillment_verifier: {
2000
+ readonly type: "object";
2001
+ readonly description: "The service that attests settlement, and the account it signs with.";
2002
+ readonly required: readonly ["account", "endpoint"];
2003
+ readonly properties: {
2004
+ readonly account: {
2005
+ readonly type: "string";
2006
+ readonly description: "The account named as the releaser in the deposit authorization. Sign against this exact value.";
2007
+ readonly example: "0x27050EE47befC43F4dF7807a7AA8073039e5fa89";
2008
+ };
2009
+ readonly endpoint: {
2010
+ readonly type: "string";
2011
+ readonly format: "uri";
2012
+ readonly description: "Base URL of the fulfillment verifier serving this chain.";
2013
+ readonly example: "https://veri-fill.example.com";
2014
+ };
2015
+ };
2016
+ };
2017
+ readonly permit2_contract: {
2018
+ readonly type: "string";
2019
+ readonly minLength: 1;
2020
+ readonly description: "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.";
2021
+ readonly example: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
2022
+ };
2023
+ readonly deposit_witness_version: {
2024
+ readonly type: "integer";
2025
+ readonly minimum: 3;
2026
+ readonly description: "Which deposit witness this chain's escrow expects. `4` and above select the four-member witness, `3` the two-member one; absent means four. EVM and Tron only - on Solana this is carried by `svm_signature_domain_version`.";
2027
+ readonly example: 4;
2028
+ };
2029
+ readonly tokens: {
2030
+ readonly type: "array";
2031
+ readonly description: "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.";
2032
+ readonly items: {
2033
+ readonly type: "object";
2034
+ readonly required: readonly ["symbol", "address", "decimals"];
2035
+ readonly properties: {
2036
+ readonly symbol: {
2037
+ readonly type: "string";
2038
+ readonly example: "USDC";
2039
+ };
2040
+ readonly address: {
2041
+ readonly type: "string";
2042
+ readonly description: "Token contract address, in the chain's native address format.";
2043
+ readonly example: "0x036cbd53842c5426634e7929541ec2318f3dcf7e";
2044
+ };
2045
+ readonly decimals: {
2046
+ readonly type: "integer";
2047
+ readonly description: "Decimal places, for converting a human amount to base units.";
2048
+ readonly example: 6;
2049
+ };
2050
+ };
2051
+ };
2052
+ };
2053
+ readonly svm_signature_cluster_id: {
2054
+ readonly type: "string";
2055
+ readonly description: "Solana only. The cluster the escrow's signing domain is bound to, needed to build the deposit hash. Absent for EVM and Tron.";
2056
+ readonly example: "devnet";
2057
+ };
2058
+ readonly svm_signature_domain_version: {
2059
+ readonly type: "integer";
2060
+ readonly minimum: 1;
2061
+ readonly description: "Solana only. Version of the escrow's signing domain. Absent for EVM and Tron.";
2062
+ readonly example: 2;
2063
+ };
2064
+ };
2065
+ };
2066
+ declare const $GetDefaultsResult: {
2067
+ readonly description: "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.";
2068
+ readonly oneOf: readonly [{
2069
+ readonly $ref: "#/components/schemas/ChainDefaults";
2070
+ }, {
2071
+ readonly $ref: "#/components/schemas/ChainDefaultsByChain";
2072
+ }];
2073
+ };
2074
+ declare const $ChainDefaultsByChain: {
2075
+ readonly type: "object";
2076
+ readonly description: "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.";
2077
+ readonly additionalProperties: {
2078
+ readonly $ref: "#/components/schemas/ChainDefaults";
2079
+ };
2080
+ readonly example: {
2081
+ readonly 'eip155:84532': {
2082
+ readonly chain_id: "eip155:84532";
2083
+ readonly quote_selector: "0xd0f080E23F95571D26eEb1FAD24a5F3d66835195";
2084
+ readonly escrow_contract: "0xa61a0C025943Aa79B73D8D07E3aDbEe1873738b4";
2085
+ readonly fulfillment_proxy: "0x09A5a0d6955E5394A661Cd9E7007076fa63B4158";
2086
+ readonly fulfillment_verifier: {
2087
+ readonly account: "0x27050EE47befC43F4dF7807a7AA8073039e5fa89";
2088
+ readonly endpoint: "https://veri-fill.example.com";
2089
+ };
2090
+ };
2091
+ };
2092
+ };
3185
2093
 
3186
2094
  type ApiResult<TData = any> = {
3187
2095
  readonly body: TData;
@@ -3200,6 +2108,20 @@ declare class ApiError extends Error {
3200
2108
  constructor(request: ApiRequestOptions, response: ApiResult, message: string);
3201
2109
  }
3202
2110
 
2111
+ /**
2112
+ * The gateway accepted the request but did not answer inside the client's budget.
2113
+ *
2114
+ * Not an {@link ApiError}: there is no response, status or error body, so
2115
+ * `isApiError` and `getErrorResponse` stay false for it. It carries no verdict on
2116
+ * the request either, since a timed-out submit may still have been accepted.
2117
+ */
2118
+ declare class GatewayTimeoutError extends Error {
2119
+ readonly baseUrl: string;
2120
+ readonly timeoutMs: number;
2121
+ constructor(baseUrl: string, timeoutMs: number);
2122
+ }
2123
+ /** Type guard for {@link GatewayTimeoutError}, the unresponsive-gateway case. */
2124
+ declare function isGatewayTimeoutError(err: unknown): err is GatewayTimeoutError;
3203
2125
  /**
3204
2126
  * Type guard for the SDK's transport-level error.
3205
2127
  *
@@ -3213,10 +2135,12 @@ declare function isApiError(err: unknown): err is ApiError;
3213
2135
  * body is not the public {@link ErrorResponse} shape.
3214
2136
  *
3215
2137
  * The gateway serializes errors as an {@link ErrorResponse}
3216
- * (`{ code, message, request_id?, docs_url?, domain? }`), but the generated
3217
- * client widens the parsed body to `unknown`. This helper narrows it back so
3218
- * consumers can branch on `code` and quote `request_id` to support. It only
3219
- * ever exposes this outward-facing shape — never any internal error taxonomy.
2138
+ * (`{ code, message, request_id?, payment_id?, docs_url?, domain? }`), but the
2139
+ * generated client widens the parsed body to `unknown`. This helper narrows it
2140
+ * back so consumers can branch on `code`, quote `request_id` to support, and read
2141
+ * `payment_id` to reconcile the payment a failed settlement was attempted under.
2142
+ * It only ever exposes this outward-facing shape — never any internal error
2143
+ * taxonomy.
3220
2144
  *
3221
2145
  * @example
3222
2146
  * try {
@@ -3232,6 +2156,275 @@ declare function isApiError(err: unknown): err is ApiError;
3232
2156
  */
3233
2157
  declare function getErrorResponse(err: unknown): ErrorResponse | undefined;
3234
2158
 
2159
+ /**
2160
+ * Polling a submitted payment until it reaches a state it cannot leave.
2161
+ *
2162
+ * The gateway holds a submission for its own synchronous window before answering, so a payment that
2163
+ * is still pending by the time the caller sees it settled more slowly than that window. A submission usually
2164
+ * comes back pending, so following one is the ordinary path rather than an edge case.
2165
+ *
2166
+ * The wait budget is a client-side convenience, not a deadline with any meaning to the network.
2167
+ * Nothing is affected by giving up: the payment continues, and re-submitting the same request id or
2168
+ * asking for the payment's status picks up wherever it got to. In particular a settlement that
2169
+ * stalls will never become terminal on its own, so no budget can promise a terminal answer — giving
2170
+ * up while still pending is a normal ending, not a failure.
2171
+ */
2172
+ /**
2173
+ * True for the states a payment can never leave.
2174
+ *
2175
+ * An unrecognized or absent status is deliberately NOT terminal: a status this client does not
2176
+ * know is treated as still in flight, so a gateway that adds one does not make a caller report a
2177
+ * payment as finished on the strength of a value it cannot interpret.
2178
+ */
2179
+ declare function isTerminalStatus(status: string | undefined): boolean;
2180
+ /**
2181
+ * Default budget for {@link waitForTerminalStatus}, in milliseconds.
2182
+ *
2183
+ * The gateway has already held the submission for its own window by the time a caller sees a
2184
+ * pending payment, so anything still pending is settling slowly. A minute past that covers the
2185
+ * common case without holding a request handler open indefinitely.
2186
+ */
2187
+ declare const DEFAULT_WAIT_BUDGET_MS: number;
2188
+ /** Gap between status checks. Short enough to feel responsive, long enough not to hammer. */
2189
+ declare const DEFAULT_POLL_INTERVAL_MS = 2000;
2190
+ /**
2191
+ * All this module needs of a status response: something that reports a status. Deciding when to
2192
+ * stop is the only thing it does, so it constrains the shape rather than defining it, and callers
2193
+ * get their own richer type back unchanged.
2194
+ */
2195
+ interface StatusSnapshot {
2196
+ status?: string;
2197
+ }
2198
+ /** Outcome of a wait. */
2199
+ interface WaitOutcome<T extends StatusSnapshot> {
2200
+ /** The last status successfully read, or undefined if no check ever succeeded. */
2201
+ snapshot?: T;
2202
+ /**
2203
+ * Whether the wait ended without the payment reaching a terminal state — because the budget ran
2204
+ * out, or because {@link WaitParams.signal} was aborted. False only when `snapshot` holds a
2205
+ * terminal status, so it is safe to branch on: a payment is finished when this is false.
2206
+ */
2207
+ timedOut: boolean;
2208
+ /** Whether {@link WaitParams.signal} ended the wait. Implies `timedOut`. */
2209
+ aborted: boolean;
2210
+ /** How many status checks failed outright (network or gateway errors). */
2211
+ errorCount: number;
2212
+ }
2213
+ /** Everything the wait needs, with time and I/O injected so it can be tested without a clock. */
2214
+ interface WaitParams<T extends StatusSnapshot> {
2215
+ /** Read the payment's current status. */
2216
+ fetchStatus: () => Promise<T>;
2217
+ /**
2218
+ * How long to keep checking, in **milliseconds**; defaults to {@link DEFAULT_WAIT_BUDGET_MS}.
2219
+ * A budget of zero or less checks nothing.
2220
+ */
2221
+ budgetMs?: number;
2222
+ /** Gap between checks; defaults to {@link DEFAULT_POLL_INTERVAL_MS}. */
2223
+ intervalMs?: number;
2224
+ /** Monotonic-enough clock, in milliseconds; defaults to `Date.now`. */
2225
+ now?: () => number;
2226
+ /**
2227
+ * Test seam for the delay. Replacing it opts out of abort-aware sleeping, so a wait then ends
2228
+ * at the next check rather than immediately.
2229
+ */
2230
+ sleep?: (ms: number) => Promise<void>;
2231
+ /** Called for each failed check, so a caller can report it without this module owning output. */
2232
+ onError?: (error: unknown) => void;
2233
+ /**
2234
+ * Ends the wait early, for a caller that must stop on shutdown or when its request is cancelled.
2235
+ * The outcome reports `aborted`, and carries the last status read.
2236
+ */
2237
+ signal?: AbortSignal;
2238
+ }
2239
+ /**
2240
+ * Poll a payment's status until it is terminal, the budget runs out, or `signal` is aborted.
2241
+ *
2242
+ * A failed check does not end the wait: a blip while a payment is mid-settlement is exactly when
2243
+ * giving up is least useful, so failures are counted, reported through `onError`, and polling
2244
+ * continues until the budget is spent.
2245
+ *
2246
+ * @param params - the status reader, the budget, and injectable time
2247
+ * @returns the last status read, whether the wait ended without a terminal status, whether
2248
+ * `signal` ended it, and how many checks failed
2249
+ */
2250
+ declare function waitForTerminalStatus<T extends StatusSnapshot>(params: WaitParams<T>): Promise<WaitOutcome<T>>;
2251
+
2252
+ /**
2253
+ * Result of an {@link ensureSourceApproval} call.
2254
+ */
2255
+ interface EnsureApprovalResult {
2256
+ /** The existing allowance already covered the requirement; no transaction was sent. */
2257
+ alreadySufficient: boolean;
2258
+ /** The approval transaction hash, when one was sent. */
2259
+ txHash?: string;
2260
+ /**
2261
+ * Set only when the token refused to overwrite a non-zero allowance and it had to be reset to
2262
+ * zero first: the hash of that reset. Its absence means one transaction was sent, not two.
2263
+ */
2264
+ resetTxHash?: string;
2265
+ }
2266
+ /** What TronWeb reports about a broadcast transaction. Empty until it is confirmed. */
2267
+ interface TronTransactionInfo {
2268
+ receipt?: {
2269
+ result?: string;
2270
+ };
2271
+ }
2272
+ /**
2273
+ * The slice of a TronWeb instance this package needs.
2274
+ *
2275
+ * Declared structurally rather than imported from `tronweb` on purpose: the package then
2276
+ * type-checks and builds with tronweb absent, and consumers that never pay from Tron do not
2277
+ * carry an 11 MB dependency they cannot reach. The caller constructs the instance and passes
2278
+ * it in, exactly as the EVM path takes a caller-constructed ethers signer.
2279
+ */
2280
+ interface TronWebLike {
2281
+ /**
2282
+ * The ABI-and-address form, which builds the handle locally. The `contract().at(address)`
2283
+ * form fetches the ABI from the node instead: a round trip per use, and an interface that
2284
+ * depends on what the chain happens to report for that address.
2285
+ *
2286
+ * Returns `unknown` on purpose. TronWeb types this as a contract whose methods are produced
2287
+ * dynamically from the ABI, so pinning it to {@link TronTokenContract} here would stop a real
2288
+ * TronWeb instance assigning to this interface at all and force every caller to write a cast.
2289
+ * The cast belongs in one place — next to the ABI we passed, which is what makes it true.
2290
+ */
2291
+ contract(abi: unknown, address: string): unknown;
2292
+ trx: {
2293
+ getTransactionInfo(txId: string): Promise<TronTransactionInfo>;
2294
+ };
2295
+ /**
2296
+ * The account this instance signs as. Read to check it against `owner` before broadcasting,
2297
+ * since an approval only ever applies to the account that sends it.
2298
+ *
2299
+ * Optional, and `false` is TronWeb's own "not set": both mean the instance cannot say which
2300
+ * account it would use, and neither is treated as a mismatch.
2301
+ */
2302
+ defaultAddress?: {
2303
+ base58?: string | false;
2304
+ };
2305
+ }
2306
+ /** How long to wait for a broadcast approval to confirm before giving up, on either chain. */
2307
+ interface ConfirmationOptions {
2308
+ /**
2309
+ * Default 60_000. On timeout the approval is reported as unconfirmed rather than failed: it
2310
+ * was broadcast and may still confirm, so the caller is told to check it before sending
2311
+ * another one.
2312
+ */
2313
+ timeoutMs?: number;
2314
+ /** Tron only: how often to poll for the receipt. Default 1_500, under Tron's ~3s block time. */
2315
+ pollIntervalMs?: number;
2316
+ /** Tron only: default 100_000_000 SUN. Tron charges the caller for contract execution. */
2317
+ feeLimit?: number;
2318
+ }
2319
+ /**
2320
+ * Inputs to {@link ensureSourceApproval} and {@link needsSourceApproval}.
2321
+ *
2322
+ * `signer` and `tronWeb` are both optional here because which one is required is decided by
2323
+ * `network`, a runtime string that no type can constrain. Supplying the wrong one for the
2324
+ * chain fails with a message naming the one that was needed.
2325
+ */
2326
+ interface ApprovalParams {
2327
+ /** CAIP-2 source chain id, e.g. `eip155:8453` or `tron:mainnet`. */
2328
+ network: string;
2329
+ /** Source token address. */
2330
+ token: string;
2331
+ /** The payer's account. */
2332
+ owner: string;
2333
+ /**
2334
+ * The contract to approve. Defaults to the canonical Permit2 for the chain: the EVM
2335
+ * deployment on `eip155:*`, and the pinned per-network address on `tron:*`.
2336
+ */
2337
+ spender?: string;
2338
+ /**
2339
+ * The minimum allowance this charge needs. Answers "is what I already have enough?".
2340
+ * When omitted, only an unlimited approval counts as sufficient, so a smaller leftover
2341
+ * allowance cannot be mistaken for enough and revert a larger later charge on-chain.
2342
+ */
2343
+ requiredAllowance?: bigint;
2344
+ /**
2345
+ * How much to approve when an approval IS sent. Defaults to unlimited, so later charges on
2346
+ * the same token need no further transaction.
2347
+ *
2348
+ * On its own, a bounded amount is treated as its own requirement: an allowance still holding
2349
+ * the full bound is left alone rather than re-approved. That is the right answer for a one-off
2350
+ * approval, where nothing else in the call says what a later charge would need.
2351
+ *
2352
+ * Across repeated payments, PAIR IT WITH `requiredAllowance`. Permit2 decrements the allowance
2353
+ * on every payment, so a bound measured against itself stops being sufficient the moment the
2354
+ * first charge lands, and every later call sends another approval. `requiredAllowance` states
2355
+ * what the NEXT charge needs, which is the question a partly spent bound can still answer yes
2356
+ * to.
2357
+ *
2358
+ * Trade-off: a bounded approval limits what the escrow can ever move, but it is consumed as it
2359
+ * is spent and eventually has to be granted again, whichever way it is used.
2360
+ */
2361
+ approvalAmount?: bigint;
2362
+ /** An ethers signer connected to the source chain. Required for `eip155:*`. */
2363
+ signer?: Signer;
2364
+ /** A TronWeb instance configured for the source chain. Required for `tron:*`. */
2365
+ tronWeb?: TronWebLike;
2366
+ /** Broadcast and confirmation tuning. Applies to both chains. */
2367
+ confirmation?: ConfirmationOptions;
2368
+ /**
2369
+ * Called with each transaction hash the moment it is broadcast, before the wait for it to
2370
+ * confirm. Without this a caller has nothing to show for a transaction that is already
2371
+ * spending their gas — and nothing to look up if the wait times out.
2372
+ *
2373
+ * `purpose` distinguishes the approval itself from the zero-reset some tokens demand first,
2374
+ * so two hashes in one call read as one deliberate sequence rather than a double spend.
2375
+ */
2376
+ onSubmitted?: (txHash: string, purpose: "approval" | "reset") => void;
2377
+ }
2378
+
2379
+ /** Whether an error came from a broadcast transaction that was never seen to confirm. */
2380
+ declare function isUnconfirmed(error: unknown): boolean;
2381
+
2382
+ /**
2383
+ * Payer-side Permit2 approval for the source token an escrow deposit moves.
2384
+ *
2385
+ * On EVM and Tron the escrow moves the source token through Permit2, so the payer must have
2386
+ * approved Permit2 on that token BEFORE paying. Without it the payment is built, signed and
2387
+ * accepted by the gateway, and then the deposit reverts on-chain at settlement — a late and
2388
+ * misleading failure. Solana authorizes the transfer inside the signed deposit itself, so
2389
+ * there is nothing to approve there.
2390
+ *
2391
+ * Worth arranging before the payment is signed: a deposit that reverts is a terminal
2392
+ * settlement failure, and a terminal failure is bound to the request identifier that produced
2393
+ * it, so re-attempting then needs a NEW identifier. Getting the allowance right up front keeps
2394
+ * the identifier usable.
2395
+ *
2396
+ * This package reads chain state and broadcasts a transaction, which is why it is separate
2397
+ * from the sender-auth SDK next door: that one is pure, offline and byte-parity-tested against
2398
+ * Go. The caller supplies the connected signer, so this package never chooses an RPC endpoint.
2399
+ */
2400
+
2401
+ /**
2402
+ * Whether a payment on these terms would need an approval transaction first.
2403
+ *
2404
+ * Read-only: it spends no gas and sends nothing, so it is safe to call on every payment as a
2405
+ * preflight. Returns false on Solana, which needs no approval at all.
2406
+ *
2407
+ * @remarks
2408
+ * Unlike a try-and-see, this reports the answer instead of acting on it — use it to tell a
2409
+ * payer what is about to happen, or to check whether a wallet is ready before asking for a
2410
+ * signature.
2411
+ */
2412
+ declare function needsSourceApproval(params: ApprovalParams): Promise<boolean>;
2413
+ /**
2414
+ * Ensure the payer has approved Permit2 to move the source token, so the escrow deposit does
2415
+ * not revert at settlement. Reads the current allowance and sends an approval only if it falls
2416
+ * short; the approval it sends is unlimited unless `approvalAmount` bounds it.
2417
+ *
2418
+ * Applies to EVM (`params.signer`) and Tron (`params.tronWeb`). On Solana it reports
2419
+ * `alreadySufficient` without touching the chain.
2420
+ *
2421
+ * @remarks
2422
+ * Not concurrency-safe: two overlapping calls for the same `(owner, token, spender)` may both
2423
+ * read a short allowance and both send an approval. They target the same value, so this only
2424
+ * wastes gas; serialize calls per token if that matters.
2425
+ */
2426
+ declare function ensureSourceApproval(params: ApprovalParams): Promise<EnsureApprovalResult>;
2427
+
3235
2428
  /**
3236
2429
  * EVM Permit2 PermitWitnessTransferFrom deposit prehash + EIP-712 digest.
3237
2430
  *
@@ -3483,11 +2676,16 @@ declare const MAX_VALID_SLOT: number;
3483
2676
  *
3484
2677
  * encodeU64LE, generateSolanaNonce (generateNonce), and MAX_VALID_SLOT are
3485
2678
  * imported from the shared @atum-labs/solana-escrow-encoding package and
3486
- * re-exported here to preserve the public API. The V1 hashSolanaDeposit,
3487
- * base58ToBytes, payment-id generation, and prehash creation stay local: the
3488
- * package has no non-domain-separated V1 hash, and the local base58/hex helpers
3489
- * carry the exact error messages the client tests assert. The V3 deposit hash
3490
- * already delegates to the package (hashSolanaDepositV3 → computeDepositHash).
2679
+ * re-exported here to preserve the public API. base58ToBytes, payment-id
2680
+ * generation, and prehash creation stay local, because the local base58/hex
2681
+ * helpers carry the exact error messages the client tests assert.
2682
+ *
2683
+ * NO DEPOSIT HASH IS COMPUTED HERE ANY MORE. hashSolanaDeposit computed the
2684
+ * pre-domain-separation layout above and now throws (see its doc comment), and
2685
+ * hashSolanaDepositV3 was deleted as an un-exported third copy of the package's
2686
+ * own call. Build a deposit through the shared sender_auth adapter, which selects
2687
+ * the preimage from the escrow domain version; reach for computeDepositHash /
2688
+ * computeDepositHashV2 from the package if you need the raw primitive.
3491
2689
  *
3492
2690
  * The canonical reference is the @atum-labs/solana-escrow-encoding package in
3493
2691
  * this repo (contracts/svm/escrow-encoding), the TypeScript sibling of the
@@ -3496,7 +2694,10 @@ declare const MAX_VALID_SLOT: number;
3496
2694
 
3497
2695
  /** Replay horizon in seconds — deposit deadline must be within this window of issuedAt. */
3498
2696
  declare const REPLAY_HORIZON_SECS = 128;
3499
- /** Total number of replay-protection buckets. */
2697
+ /**
2698
+ * Widest bucket ID the replay nonce layout carries. Generated nonces draw from the smaller
2699
+ * bounded set the escrow-encoding package defines, which keeps the replay_bucket PDAs reusable.
2700
+ */
3500
2701
  declare const TOTAL_BUCKETS = 131072;
3501
2702
  /** Exact byte size of a serialized deposit message (7 + 32*5 + 8*3). */
3502
2703
  declare const DEPOSIT_MESSAGE_SIZE = 199;
@@ -3578,22 +2779,34 @@ interface SolanaDepositPrehash {
3578
2779
  */
3579
2780
  declare function createSolanaDepositPrehash(paymentId: string, params: SolanaDepositParams): SolanaDepositPrehash;
3580
2781
  /**
3581
- * Computes the keccak256 deposit hash from a prehash structure.
2782
+ * REMOVED — this function computed the PRE-DOMAIN-SEPARATION deposit hash, which no deployed
2783
+ * escrow program accepts. It now throws rather than returning one.
3582
2784
  *
3583
- * Formula: keccak256("deposit" || payment_id[32] || depositor[32] || mint[32] ||
3584
- * amount[8,LE] || reserver[32] || releaser[32] ||
3585
- * nonce[8,LE] || issued_at[8,LE] || deadline[8,LE])
2785
+ * The layout it used, kept here as a record of the historical scheme:
3586
2786
  *
3587
- * Total input: 199 bytes (7 + 32*5 + 8*3)
2787
+ * keccak256("deposit" || payment_id[32] || depositor[32] || mint[32] ||
2788
+ * amount[8,LE] || reserver[32] || releaser[32] ||
2789
+ * nonce[8,LE] || issued_at[8,LE] || deadline[8,LE]) = 199 bytes
3588
2790
  *
3589
- * TODO: Replace with computeDepositHash from @atum-labs/solana-escrow-encoding once public.
3590
- * The bindings version uses EscrowDepositParams with Pubkey objects instead of base58 strings,
3591
- * so this function will need to convert from prehash strings to the bindings' types.
2791
+ * Every current program prefixes the preimage with its domain —
2792
+ * `"escrow" || signature_domain_version || cluster_id[32] || program_id[32]` — and from domain
2793
+ * version 4 also binds `destination_hash`. So the 199-byte hash is not merely out of date, it is
2794
+ * unverifiable everywhere: `escrow.rs`'s `require!(deposit_hash == message, DepositHashMismatch)`
2795
+ * rejects it on every cluster.
3592
2796
  *
3593
- * @param prehash The structured prehash from createSolanaDepositPrehash()
3594
- * @returns 0x-prefixed hex string (32 bytes)
2797
+ * WHY IT THROWS INSTEAD OF BEING DELETED OR LEFT ALONE. It was exported from this package's
2798
+ * entry point, so removing the symbol outright is a hard break for any consumer that imports it,
2799
+ * while leaving it was worse: it returned a well-formed 32-byte hash that fails on-chain with
2800
+ * `DepositHashMismatch` and no indication why. Throwing turns an undiagnosable on-chain rejection into an
2801
+ * error at the call site that names the replacement.
2802
+ *
2803
+ * Build deposit authorizations through the shared sender_auth adapter
2804
+ * (`getChainAdapter(chainId).buildAuthMessage(...)`), which selects the correct preimage from the
2805
+ * domain version it is given and is the same implementation the facilitator verifies against.
2806
+ *
2807
+ * @throws Always.
3595
2808
  */
3596
- declare function hashSolanaDeposit(prehash: SolanaDepositPrehash): string;
2809
+ declare function hashSolanaDeposit(_prehash: SolanaDepositPrehash): never;
3597
2810
  /**
3598
2811
  * Generates a valid nonce for Solana replay protection (upper 32 bits: random
3599
2812
  * bucket, lower 8 bits: random slot 0..MAX_VALID_SLOT). Delegates to the shared
@@ -3621,6 +2834,11 @@ declare const PAYMENT_REQUEST_VERSION = "1.0";
3621
2834
  */
3622
2835
  declare function signPaymentRequest(request: PaymentRequest, signer: SenderSigner): Promise<PaymentRequest>;
3623
2836
  type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
2837
+ /**
2838
+ * Request-layer configuration plus this package's network timeouts. Omit the
2839
+ * timeouts for the defaults; see {@link RequestTimeouts}.
2840
+ */
2841
+ type PaymentGatewayClientConfig = Partial<OpenAPIConfig> & RequestTimeouts;
3624
2842
  declare const defaultGateway: string;
3625
2843
  /**
3626
2844
  * Default request-layer configuration, with `BASE` set to this package's default
@@ -3660,11 +2878,14 @@ declare const DEFAULT_PAYMENT_QUOTE_DEADLINE_SECONDS = 10;
3660
2878
  * Extended PaymentGatewayClient with convenience methods
3661
2879
  */
3662
2880
  declare class PaymentGatewayClient extends PaymentGatewayClient$1 {
3663
- private baseUrl;
3664
- constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
2881
+ constructor(config?: PaymentGatewayClientConfig, HttpRequest?: HttpRequestConstructor);
3665
2882
  /**
3666
2883
  * Fetches chain defaults from the payment gateway.
3667
2884
  *
2885
+ * Goes through the generated typed client, so the request shares the payment calls'
2886
+ * transport: one base URL, one timeout policy, and `/v1/defaults` is described by the
2887
+ * OpenAPI contract rather than assembled by hand here.
2888
+ *
3668
2889
  * @param chainId The CAIP-2 chain identifier (e.g., "eip155:42161")
3669
2890
  * @returns The chain defaults including escrow, quote selector, and fulfillment verifier
3670
2891
  */
@@ -3672,7 +2893,7 @@ declare class PaymentGatewayClient extends PaymentGatewayClient$1 {
3672
2893
  /**
3673
2894
  * Prepares a payment request with defaults, ready for signing.
3674
2895
  *
3675
- * By default this resolves the corridor addresses from the gateway `/defaults`
2896
+ * By default this resolves the corridor addresses from the gateway `/v1/defaults`
3676
2897
  * endpoint. It reaches the gateway only for what the caller has NOT already
3677
2898
  * supplied via `resolvedDefaults`: supply `resolvedDefaults.source` to skip the
3678
2899
  * source-chain fetch and `resolvedDefaults.destination` to skip the destination
@@ -3748,7 +2969,7 @@ declare class PaymentGatewayClient extends PaymentGatewayClient$1 {
3748
2969
  solanaClockReader?: SolanaClusterUnixTimeReader;
3749
2970
  /**
3750
2971
  * Pre-resolved corridor addresses. Omit to fetch them from the gateway
3751
- * `/defaults`; supply to build offline. Each side is resolved independently —
2972
+ * `/v1/defaults`; supply to build offline. Each side is resolved independently —
3752
2973
  * a field left out is still fetched. The destination contributes only its
3753
2974
  * `fulfillmentProxy` (its escrow/roles are source-side concepts, unused here).
3754
2975
  */
@@ -3782,7 +3003,7 @@ declare class PaymentGatewayClient extends PaymentGatewayClient$1 {
3782
3003
  * defaults and populates the SAME contract fields (`escrow_contract_address`,
3783
3004
  * `quote_selector`, `fulfillment_verifier`, `fulfillment_proxy`). These are not
3784
3005
  * optional in practice: the gateway requires `fulfillment_verifier` to build the
3785
- * QuoteRequested event it broadcasts to settlers, so the quote-request body
3006
+ * request event it broadcasts to settlers, so the quote-request body
3786
3007
  * must carry the identical contract fields the payment flow does. The ONLY
3787
3008
  * field this drops relative to `preparePaymentRequest` is `sender_auth`, which
3788
3009
  * is supplied at award time (quote-time is unauthenticated — no signing, no
@@ -3798,8 +3019,12 @@ declare class PaymentGatewayClient extends PaymentGatewayClient$1 {
3798
3019
  destinationAccount: string;
3799
3020
  destinationAsset: string;
3800
3021
  maxSourceAmount?: string;
3801
- requestId?: string;
3802
- requestIdPrefix?: string;
3022
+ /**
3023
+ * The request id. Reuse the SAME value to retry: the gateway returns the original batch
3024
+ * (same `quote_request_id`) instead of opening a second one, and answers `409`
3025
+ * IDEMPOTENCY_TERMS_MISMATCH if you reuse it for a different corridor.
3026
+ */
3027
+ requestId: string;
3803
3028
  settlerRequirements?: {
3804
3029
  whitelist?: string[];
3805
3030
  blacklist?: string[];
@@ -3809,4 +3034,4 @@ declare class PaymentGatewayClient extends PaymentGatewayClient$1 {
3809
3034
  }): Promise<CreateQuoteRequest>;
3810
3035
  }
3811
3036
 
3812
- export { $AuthorizationResult, $AwardAccepted, $AwardRequest, $AwardResponse, $AwardedPayment, $AwardedQuote, $BidAward, $CreateQuoteRequest, $DataIntegrityProof, $ErrorResponse, $FulfillmentConfirmation, $GetPaymentStatusResponse, type $OpenApiTs, $OwnedAsset, $PaymentBlockchainContext, $PaymentError, $PaymentRequest, $PaymentResponse, $PaymentSummary, $PaymentTimelineResponse, $PreparePaymentRequest, $PreparePaymentResponse, $Quote, $QuoteRequestAccepted, $QuoteRequestResponse, $QuoteRequestStatusResponse, $ResolvePaymentResponse, $SenderAuth, $SenderAuthMessageScheme, $SignedMessage, $TimelineError, $TimelineStep, $VerifiableCredential, $VerifiableCredentialAuth, ApiError, type ApiRequestOptions, type ApiResult, type AuthorizationResult, AuthorizationsService, type AuthorizePaymentData, type AuthorizePaymentResponse, type AwardAccepted, type AwardQuoteData, type AwardQuoteResponse, type AwardRequest, type AwardResponse, type AwardedPayment, type AwardedQuote, type BidAward, CancelError, CancelablePromise, type ChainDefaults, type CreateQuoteRequest, type CreateQuoteRequestData, type CreateQuoteRequestResponse, DEFAULT_FULFILLMENT_DEADLINE_SECONDS, DEFAULT_PAYMENT_QUOTE_DEADLINE_SECONDS, DEFAULT_QUOTE_DEADLINE_SECONDS, DEPOSIT_MESSAGE_SIZE, type DataIntegrityProof, type ErrorResponse, type FulfillmentConfirmation, type GetPaymentStatusData, type GetPaymentStatusResponse, type GetPaymentStatusResponse2, type GetPaymentTimelineData, type GetPaymentTimelineResponse, type GetQuoteRequestStatusData, type GetQuoteRequestStatusResponse, type HealthCheckResponse, HealthService, Interceptors, MAX_VALID_SLOT, type OnCancel, OpenAPI, type OpenAPIConfig, type OwnedAsset, PAYMENT_REQUEST_VERSION, PERMIT2_CONTRACT_ADDRESS, type PaymentBlockchainContext, type PaymentError, PaymentGatewayClient, type PaymentRequest, type PaymentResponse, type PaymentSummary, type PaymentTimelineResponse, PaymentsService, type PermitWitnessTransferFromParams, type PreparePaymentData, type PreparePaymentRequest, type PreparePaymentResponse, type PreparePaymentResponse2, type Quote, type QuoteRequestAccepted, type QuoteRequestResponse, type QuoteRequestStatusResponse, QuoteRequestsService, REPLAY_HORIZON_SECS, type ResolvePaymentData, type ResolvePaymentResponse, type ResolvePaymentResponse2, type SenderAuth, type SenderAuthMessageScheme, type SenderSignature, type SenderSigner, type SenderSignerOptions, type SignedMessage, type SolanaClusterUnixTimeReader, type SolanaDepositParams, type SolanaDepositPrehash, type SubmitPaymentData, type SubmitPaymentResponse, TOTAL_BUCKETS, type TimelineError, type TimelineStep, type TurnkeyConfig, TurnkeySenderSigner, type TvmPermitWitnessTransferFromParams, type VerifiableCredential, type VerifiableCredentialAuth, base58ToBytes, base58ToHex, bytesToHex, createPermitWitnessTransferFromPrehash, createSenderSigner, createSolanaDepositPrehash, createTvmPermitWitnessTransferFromPrehash, defaultGateway, type domain, encodeU64LE, type error_code, generateSolanaNonce, generateSolanaPaymentId, getErrorResponse, hashPermitWitnessTransferFrom, hashRequestId, hashSolanaDeposit, hashTvmPermitWitnessTransferFrom, hexToBytes, isApiError, maskChainId, normalizeAddress, resolveTurnkeyAddresses, signPaymentRequest, type status, type status2, type status3, type status4, type status5, type status6, type status7, type status8, type status9 };
3037
+ export { $AuthorizationResult, $AwardAccepted, $AwardRequest, $AwardResponse, $AwardedPayment, $AwardedQuote, $BidAward, $ChainDefaults, $ChainDefaultsByChain, $CreateQuoteRequest, $DataIntegrityProof, $DeclineReason, $DeclineSummaryEntry, $ErrorResponse, $FulfillmentConfirmation, $GetDefaultsResult, $GetPaymentStatusResponse, $OwnedAsset, $PaymentBlockchainContext, $PaymentFailure, $PaymentRequest, $PaymentResponse, $PaymentStatus, $PaymentSummary, $PaymentTimelineResponse, $PaymentTransaction, $PaymentTransactions, $PreparePaymentRequest, $PreparePaymentResponse, $Quote, $QuoteRequestAccepted, $QuoteRequestResponse, $QuoteRequestStatusResponse, $ResolvePaymentResponse, $SenderAuth, $SenderAuthMessageScheme, $SignedMessage, $TimelineStep, $VerifiableCredential, $VerifiableCredentialAuth, ApiError, type ApiRequestOptions, type ApiResult, type ApprovalParams, AuthorizationsService, AuthorizePaymentData, AuthorizePaymentResponse, AwardQuoteData, AwardQuoteResponse, CancelError, CancelablePromise, type ChainDefaults, ChainDefaultsService, type ConfirmationOptions, CreateQuoteRequest, CreateQuoteRequestData, CreateQuoteRequestResponse, DEFAULT_FULFILLMENT_DEADLINE_SECONDS, DEFAULT_PAYMENT_QUOTE_DEADLINE_SECONDS, DEFAULT_POLL_INTERVAL_MS, DEFAULT_QUOTE_DEADLINE_SECONDS, DEFAULT_REQUEST_TIMEOUT_MS, DEFAULT_SYNC_WAIT_TIMEOUT_MS, DEFAULT_WAIT_BUDGET_MS, DEPOSIT_MESSAGE_SIZE, type EnsureApprovalResult, ErrorResponse, GatewayTimeoutError, GetDefaultsData, GetDefaultsResponse, GetPaymentStatusData, GetPaymentStatusResponse2, GetPaymentTimelineData, GetPaymentTimelineResponse, GetQuoteRequestStatusData, GetQuoteRequestStatusResponse, HealthCheckResponse, HealthService, Interceptors, InvalidAccountError, type Reason as InvalidAccountReason, MAX_VALID_SLOT, type OnCancel, OpenAPI, type OpenAPIConfig, PAYMENT_REQUEST_VERSION, PERMIT2_CONTRACT_ADDRESS, type ParsedAssetIdentifier, PaymentGatewayClient, type PaymentGatewayClientConfig, PaymentRequest, PaymentsService, type PermitWitnessTransferFromParams, PreparePaymentData, PreparePaymentResponse2, QuoteRequestsService, REPLAY_HORIZON_SECS, type RequestTimeouts, ResolvePaymentData, ResolvePaymentResponse2, type SenderSignature, type SenderSigner, type SenderSignerOptions, SignedMessage, type SolanaClusterUnixTimeReader, type SolanaDepositParams, type SolanaDepositPrehash, type StatusSnapshot, SubmitPaymentData, SubmitPaymentResponse, TOTAL_BUCKETS, type TronWebLike, type TurnkeyConfig, TurnkeySenderSigner, type TvmPermitWitnessTransferFromParams, type WaitOutcome, type WaitParams, assetChainId, base58ToBytes, base58ToHex, bytesToHex, createPermitWitnessTransferFromPrehash, createSenderSigner, createSolanaDepositPrehash, createTvmPermitWitnessTransferFromPrehash, defaultGateway, encodeU64LE, ensureSourceApproval, generateSolanaNonce, generateSolanaPaymentId, getErrorResponse, hashPermitWitnessTransferFrom, hashRequestId, hashSolanaDeposit, hashTvmPermitWitnessTransferFrom, hexToBytes, isApiError, isGatewayTimeoutError, isTerminalStatus, isUnconfirmed, maskChainId, needsSourceApproval, normalizeAddress, parseAssetIdentifier, resolveTurnkeyAddresses, signPaymentRequest, waitForTerminalStatus };