@atumlabs/payment-gateway-client 1.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/LICENSE.md +83 -0
- package/README.md +247 -0
- package/dist/cli/payment-status.d.ts +1 -0
- package/dist/cli/payment-status.js +3125 -0
- package/dist/cli/quote-status.d.ts +1 -0
- package/dist/cli/quote-status.js +3125 -0
- package/dist/cli/request-quote.d.ts +1 -0
- package/dist/cli/request-quote.js +3177 -0
- package/dist/cli/send-payment.d.ts +1 -0
- package/dist/cli/send-payment.js +5472 -0
- package/dist/index.d.ts +3645 -0
- package/dist/index.js +7031 -0
- package/package.json +80 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3645 @@
|
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
+
|
|
3
|
+
type ApiRequestOptions = {
|
|
4
|
+
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
|
|
5
|
+
readonly url: string;
|
|
6
|
+
readonly path?: Record<string, unknown>;
|
|
7
|
+
readonly cookies?: Record<string, unknown>;
|
|
8
|
+
readonly headers?: Record<string, unknown>;
|
|
9
|
+
readonly query?: Record<string, unknown>;
|
|
10
|
+
readonly formData?: Record<string, unknown>;
|
|
11
|
+
readonly body?: any;
|
|
12
|
+
readonly mediaType?: string;
|
|
13
|
+
readonly responseHeader?: string;
|
|
14
|
+
readonly errors?: Record<number, string>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
declare class CancelError extends Error {
|
|
18
|
+
constructor(message: string);
|
|
19
|
+
get isCancelled(): boolean;
|
|
20
|
+
}
|
|
21
|
+
interface OnCancel {
|
|
22
|
+
readonly isResolved: boolean;
|
|
23
|
+
readonly isRejected: boolean;
|
|
24
|
+
readonly isCancelled: boolean;
|
|
25
|
+
(cancelHandler: () => void): void;
|
|
26
|
+
}
|
|
27
|
+
declare class CancelablePromise<T> implements Promise<T> {
|
|
28
|
+
private _isResolved;
|
|
29
|
+
private _isRejected;
|
|
30
|
+
private _isCancelled;
|
|
31
|
+
readonly cancelHandlers: (() => void)[];
|
|
32
|
+
readonly promise: Promise<T>;
|
|
33
|
+
private _resolve?;
|
|
34
|
+
private _reject?;
|
|
35
|
+
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: unknown) => void, onCancel: OnCancel) => void);
|
|
36
|
+
get [Symbol.toStringTag](): string;
|
|
37
|
+
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
38
|
+
catch<TResult = never>(onRejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
39
|
+
finally(onFinally?: (() => void) | null): Promise<T>;
|
|
40
|
+
cancel(): void;
|
|
41
|
+
get isCancelled(): boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type Headers = Record<string, string>;
|
|
45
|
+
type Middleware<T> = (value: T) => T | Promise<T>;
|
|
46
|
+
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
47
|
+
declare class Interceptors<T> {
|
|
48
|
+
_fns: Middleware<T>[];
|
|
49
|
+
constructor();
|
|
50
|
+
eject(fn: Middleware<T>): void;
|
|
51
|
+
use(fn: Middleware<T>): void;
|
|
52
|
+
}
|
|
53
|
+
type OpenAPIConfig = {
|
|
54
|
+
BASE: string;
|
|
55
|
+
CREDENTIALS: 'include' | 'omit' | 'same-origin';
|
|
56
|
+
ENCODE_PATH?: ((path: string) => string) | undefined;
|
|
57
|
+
HEADERS?: Headers | Resolver<Headers> | undefined;
|
|
58
|
+
PASSWORD?: string | Resolver<string> | undefined;
|
|
59
|
+
TOKEN?: string | Resolver<string> | undefined;
|
|
60
|
+
USERNAME?: string | Resolver<string> | undefined;
|
|
61
|
+
VERSION: string;
|
|
62
|
+
WITH_CREDENTIALS: boolean;
|
|
63
|
+
interceptors: {
|
|
64
|
+
request: Interceptors<AxiosRequestConfig>;
|
|
65
|
+
response: Interceptors<AxiosResponse>;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
declare const OpenAPI: OpenAPIConfig;
|
|
69
|
+
|
|
70
|
+
declare abstract class BaseHttpRequest {
|
|
71
|
+
readonly config: OpenAPIConfig;
|
|
72
|
+
constructor(config: OpenAPIConfig);
|
|
73
|
+
abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The result of a counterparty authorization request. Contains either
|
|
78
|
+
* the PSP's authorization decision (authorized/declined with proof) or
|
|
79
|
+
* an error indicating why authorization could not be completed.
|
|
80
|
+
*
|
|
81
|
+
*/
|
|
82
|
+
type AuthorizationResult = {
|
|
83
|
+
/**
|
|
84
|
+
* Correlation key for this authorization
|
|
85
|
+
*/
|
|
86
|
+
payment_id: string;
|
|
87
|
+
/**
|
|
88
|
+
* The beneficiary PSP's DID
|
|
89
|
+
*/
|
|
90
|
+
counterparty_did: string;
|
|
91
|
+
/**
|
|
92
|
+
* Authorization outcome. "authorized" or "declined" when the PSP responded.
|
|
93
|
+
* "error" or "timeout" when the authorization could not be completed.
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
96
|
+
status: 'authorized' | 'declined' | 'error' | 'timeout';
|
|
97
|
+
/**
|
|
98
|
+
* The PSP's raw authorization response (present when status is authorized or declined)
|
|
99
|
+
*/
|
|
100
|
+
authorization_response?: {
|
|
101
|
+
[key: string]: unknown;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Machine-readable error code (present when status is error or timeout).
|
|
105
|
+
* The counterparty and webhook codes (COUNTERPARTY_NOT_FOUND, COUNTERPARTY_TIMEOUT,
|
|
106
|
+
* WEBHOOK_ERROR, WEBHOOK_CONNECTION_ERROR, INTERNAL_ERROR) mirror the AuthorizationErrorCode
|
|
107
|
+
* protobuf enum. GATEWAY_TIMEOUT, PROOF_INVALID, and PROOF_STALE are produced by payment-gw
|
|
108
|
+
* itself and have no protobuf equivalent.
|
|
109
|
+
*
|
|
110
|
+
*/
|
|
111
|
+
error_code?: 'COUNTERPARTY_NOT_FOUND' | 'COUNTERPARTY_TIMEOUT' | 'WEBHOOK_ERROR' | 'WEBHOOK_CONNECTION_ERROR' | 'INTERNAL_ERROR' | 'GATEWAY_TIMEOUT' | 'PROOF_INVALID' | 'PROOF_STALE';
|
|
112
|
+
/**
|
|
113
|
+
* Human-readable error description
|
|
114
|
+
*/
|
|
115
|
+
error_message?: string;
|
|
116
|
+
/**
|
|
117
|
+
* HTTP status code from the PSP webhook (only for WEBHOOK_ERROR)
|
|
118
|
+
*/
|
|
119
|
+
webhook_http_status?: number;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Authorization outcome. "authorized" or "declined" when the PSP responded.
|
|
123
|
+
* "error" or "timeout" when the authorization could not be completed.
|
|
124
|
+
*
|
|
125
|
+
*/
|
|
126
|
+
type status = 'authorized' | 'declined' | 'error' | 'timeout';
|
|
127
|
+
/**
|
|
128
|
+
* Machine-readable error code (present when status is error or timeout).
|
|
129
|
+
* The counterparty and webhook codes (COUNTERPARTY_NOT_FOUND, COUNTERPARTY_TIMEOUT,
|
|
130
|
+
* WEBHOOK_ERROR, WEBHOOK_CONNECTION_ERROR, INTERNAL_ERROR) mirror the AuthorizationErrorCode
|
|
131
|
+
* protobuf enum. GATEWAY_TIMEOUT, PROOF_INVALID, and PROOF_STALE are produced by payment-gw
|
|
132
|
+
* itself and have no protobuf equivalent.
|
|
133
|
+
*
|
|
134
|
+
*/
|
|
135
|
+
type error_code = 'COUNTERPARTY_NOT_FOUND' | 'COUNTERPARTY_TIMEOUT' | 'WEBHOOK_ERROR' | 'WEBHOOK_CONNECTION_ERROR' | 'INTERNAL_ERROR' | 'GATEWAY_TIMEOUT' | 'PROOF_INVALID' | 'PROOF_STALE';
|
|
136
|
+
/**
|
|
137
|
+
* Structured payment request with sender authorization and optional W3C Verifiable Credentials
|
|
138
|
+
*/
|
|
139
|
+
type PaymentRequest = {
|
|
140
|
+
/**
|
|
141
|
+
* Semver-shaped declaration version (MAJOR.MINOR). The major component is locked to this schema's
|
|
142
|
+
* parent directory (v1 → major must be 1). Producers MUST emit the canonical value exported by the
|
|
143
|
+
* bindings' Version constant; the canonical bumps on each additive minor evolution.
|
|
144
|
+
*
|
|
145
|
+
*/
|
|
146
|
+
version: string;
|
|
147
|
+
/**
|
|
148
|
+
* Unique identifier for this payment request (used for idempotency)
|
|
149
|
+
*/
|
|
150
|
+
request_id: string;
|
|
151
|
+
source: OwnedAsset;
|
|
152
|
+
/**
|
|
153
|
+
* Array of destination assets for the settlement agent to choose from (at least one required)
|
|
154
|
+
*/
|
|
155
|
+
destination: Array<OwnedAsset>;
|
|
156
|
+
/**
|
|
157
|
+
* The exact amount to be received at the destination (in the smallest unit, e.g., wei for ETH, cents for USD).
|
|
158
|
+
*
|
|
159
|
+
*/
|
|
160
|
+
fulfillment_amount: string;
|
|
161
|
+
/**
|
|
162
|
+
* The maximum amount willing to be spent from the source (in the smallest unit).
|
|
163
|
+
*
|
|
164
|
+
*/
|
|
165
|
+
max_source_amount?: string;
|
|
166
|
+
/**
|
|
167
|
+
* Required. The deadline for receiving price quotes from settlement providers. After this
|
|
168
|
+
* point no new quotes are accepted. The gateway injects no default and validates the value
|
|
169
|
+
* is in the future. The originator must supply it, and a request that omits it or supplies
|
|
170
|
+
* a past value is rejected with 400.
|
|
171
|
+
*
|
|
172
|
+
*/
|
|
173
|
+
quote_deadline: string;
|
|
174
|
+
/**
|
|
175
|
+
* Required. The final deadline for completing the payment. If not completed by this time the
|
|
176
|
+
* payment is cancelled and eligible for a refund. The gateway injects no default and validates
|
|
177
|
+
* the value is in the future. The originator must supply it, and a request that omits it or
|
|
178
|
+
* supplies a past value is rejected with 400.
|
|
179
|
+
*
|
|
180
|
+
*/
|
|
181
|
+
fulfillment_deadline: string;
|
|
182
|
+
/**
|
|
183
|
+
* Policy requirements for settler authentication. Keys are policy names, values indicate if the policy is required.
|
|
184
|
+
*
|
|
185
|
+
*/
|
|
186
|
+
settler_auth_required?: {
|
|
187
|
+
[key: string]: (boolean);
|
|
188
|
+
};
|
|
189
|
+
sender_auth: SenderAuth;
|
|
190
|
+
originator_auth?: VerifiableCredentialAuth;
|
|
191
|
+
/**
|
|
192
|
+
* Wallet address or public key of a trusted service that will automatically select
|
|
193
|
+
* the best exchange rate for your payment. Leave empty to use the default selector.
|
|
194
|
+
*
|
|
195
|
+
*/
|
|
196
|
+
quote_selector?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Third-party service that will independently verify your payment was delivered.
|
|
199
|
+
* Leave empty to use the default verifier.
|
|
200
|
+
*
|
|
201
|
+
*/
|
|
202
|
+
fulfillment_verifier?: {
|
|
203
|
+
/**
|
|
204
|
+
* The wallet address or public key of the verification service
|
|
205
|
+
*/
|
|
206
|
+
account: string;
|
|
207
|
+
/**
|
|
208
|
+
* The API endpoint URL where the verification service can be reached
|
|
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 processing completes within 30 seconds,
|
|
449
|
+
* the response will include a fulfillment_confirmation with full settlement details.
|
|
450
|
+
* Otherwise, you'll receive a payment_id that you can use to poll the
|
|
451
|
+
* /v1/payments/{paymentId}/status endpoint for updates.
|
|
452
|
+
*
|
|
453
|
+
*/
|
|
454
|
+
type PaymentResponse = {
|
|
455
|
+
/**
|
|
456
|
+
* Unique ID for tracking this payment. Save this to check status later.
|
|
457
|
+
*
|
|
458
|
+
*/
|
|
459
|
+
payment_id?: string;
|
|
460
|
+
fulfillment_confirmation?: FulfillmentConfirmation;
|
|
461
|
+
};
|
|
462
|
+
type GetPaymentStatusResponse = {
|
|
463
|
+
/**
|
|
464
|
+
* The payment ID you're checking status for.
|
|
465
|
+
*
|
|
466
|
+
*/
|
|
467
|
+
payment_id?: string;
|
|
468
|
+
/**
|
|
469
|
+
* Current status of your payment:
|
|
470
|
+
* - `pending`: Payment is being processed
|
|
471
|
+
* - `completed`: Payment successfully delivered
|
|
472
|
+
* - `failed`: Payment failed (funds returned if escrowed)
|
|
473
|
+
* - `cancelled`: Payment was cancelled before completion
|
|
474
|
+
*
|
|
475
|
+
*/
|
|
476
|
+
status?: 'pending' | 'completed' | 'failed' | 'cancelled';
|
|
477
|
+
/**
|
|
478
|
+
* When the status was last updated
|
|
479
|
+
*/
|
|
480
|
+
updated_at?: string;
|
|
481
|
+
fulfillment_confirmation?: FulfillmentConfirmation;
|
|
482
|
+
error?: PaymentError;
|
|
483
|
+
};
|
|
484
|
+
/**
|
|
485
|
+
* Current status of your payment:
|
|
486
|
+
* - `pending`: Payment is being processed
|
|
487
|
+
* - `completed`: Payment successfully delivered
|
|
488
|
+
* - `failed`: Payment failed (funds returned if escrowed)
|
|
489
|
+
* - `cancelled`: Payment was cancelled before completion
|
|
490
|
+
*
|
|
491
|
+
*/
|
|
492
|
+
type status2 = 'pending' | 'completed' | 'failed' | 'cancelled';
|
|
493
|
+
/**
|
|
494
|
+
* Error details when payment status is "failed".
|
|
495
|
+
* Only present when the payment has failed. Contains a machine-readable
|
|
496
|
+
* code for programmatic handling and a human-readable message for debugging.
|
|
497
|
+
*
|
|
498
|
+
*/
|
|
499
|
+
type PaymentError = {
|
|
500
|
+
/**
|
|
501
|
+
* Machine-readable error code in SCREAMING_SNAKE_CASE.
|
|
502
|
+
* Common codes:
|
|
503
|
+
* - `QUOTE_DEADLINE_EXPIRED`: No settlement quotes received in time
|
|
504
|
+
* - `QUOTE_SELECTION_FAILED`: Quotes received but none met requirements
|
|
505
|
+
* - `INSUFFICIENT_FUNDS`: Sender wallet has insufficient balance
|
|
506
|
+
* - `FULFILLMENT_TIMEOUT`: Settlement agent didn't complete in time
|
|
507
|
+
*
|
|
508
|
+
*/
|
|
509
|
+
code: string;
|
|
510
|
+
/**
|
|
511
|
+
* Human-readable error description with additional context.
|
|
512
|
+
*
|
|
513
|
+
*/
|
|
514
|
+
message: string;
|
|
515
|
+
/**
|
|
516
|
+
* Service domain where the error originated.
|
|
517
|
+
*
|
|
518
|
+
*/
|
|
519
|
+
domain?: 'PAYMENT_GATEWAY' | 'SOLVER_GATEWAY' | 'SETTLER_AGENT' | 'WALLET_ORCHESTRATION' | 'VERIFICATION_SERVICE' | 'BLOCKCHAIN' | 'EXTERNAL_SERVICE';
|
|
520
|
+
blockchain_context?: PaymentBlockchainContext;
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* Service domain where the error originated.
|
|
524
|
+
*
|
|
525
|
+
*/
|
|
526
|
+
type domain = 'PAYMENT_GATEWAY' | 'SOLVER_GATEWAY' | 'SETTLER_AGENT' | 'WALLET_ORCHESTRATION' | 'VERIFICATION_SERVICE' | 'BLOCKCHAIN' | 'EXTERNAL_SERVICE';
|
|
527
|
+
/**
|
|
528
|
+
* Blockchain-specific error context. Only present when the error
|
|
529
|
+
* originated from an on-chain operation (e.g., escrow revert,
|
|
530
|
+
* fulfillment failure).
|
|
531
|
+
*
|
|
532
|
+
*/
|
|
533
|
+
type PaymentBlockchainContext = {
|
|
534
|
+
/**
|
|
535
|
+
* CAIP-2 chain identifier
|
|
536
|
+
*/
|
|
537
|
+
chain_id?: string;
|
|
538
|
+
/**
|
|
539
|
+
* Failed transaction hash
|
|
540
|
+
*/
|
|
541
|
+
tx_hash?: string;
|
|
542
|
+
/**
|
|
543
|
+
* Block number where error occurred
|
|
544
|
+
*/
|
|
545
|
+
block_number?: number;
|
|
546
|
+
/**
|
|
547
|
+
* Contract address involved in the error
|
|
548
|
+
*/
|
|
549
|
+
contract_address?: string;
|
|
550
|
+
/**
|
|
551
|
+
* Smart contract revert reason
|
|
552
|
+
*/
|
|
553
|
+
revert_reason?: string;
|
|
554
|
+
/**
|
|
555
|
+
* Gas consumed before failure
|
|
556
|
+
*/
|
|
557
|
+
gas_used?: string;
|
|
558
|
+
/**
|
|
559
|
+
* Estimated gas needed for success
|
|
560
|
+
*/
|
|
561
|
+
estimated_gas_needed?: string;
|
|
562
|
+
};
|
|
563
|
+
/**
|
|
564
|
+
* Human-readable payment request parameters for generating an unsigned PaymentRequest.
|
|
565
|
+
* Asset identifiers use a CAIP-19-like format with "/" separator and support friendly names.
|
|
566
|
+
*
|
|
567
|
+
*/
|
|
568
|
+
type PreparePaymentRequest = {
|
|
569
|
+
/**
|
|
570
|
+
* Unique identifier for tracking this payment request.
|
|
571
|
+
* Used for idempotency and matching responses to requests.
|
|
572
|
+
*
|
|
573
|
+
*/
|
|
574
|
+
request_id: string;
|
|
575
|
+
/**
|
|
576
|
+
* Source asset in human-readable CAIP-19-like format: {chain}/{asset}
|
|
577
|
+
* Supports both friendly names and full CAIP-19 identifiers:
|
|
578
|
+
* - "ethereum/usdc" (friendly names)
|
|
579
|
+
* - "eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" (full CAIP-19)
|
|
580
|
+
*
|
|
581
|
+
*/
|
|
582
|
+
source_asset: string;
|
|
583
|
+
/**
|
|
584
|
+
* Wallet address that will send the payment
|
|
585
|
+
*/
|
|
586
|
+
source_account: string;
|
|
587
|
+
/**
|
|
588
|
+
* Destination asset in human-readable CAIP-19-like format: {chain}/{asset}
|
|
589
|
+
* Supports both friendly names and full CAIP-19 identifiers:
|
|
590
|
+
* - "arbitrum/usdc"
|
|
591
|
+
* - "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831"
|
|
592
|
+
*
|
|
593
|
+
*/
|
|
594
|
+
destination_asset: string;
|
|
595
|
+
/**
|
|
596
|
+
* Wallet address that will receive the payment
|
|
597
|
+
*/
|
|
598
|
+
destination_account: string;
|
|
599
|
+
/**
|
|
600
|
+
* Simple amount specification in decimal format (e.g., "1.50" for $1.50 USDC).
|
|
601
|
+
* Use this OR specify both max_source_amount and fulfillment_amount.
|
|
602
|
+
* Cannot be used together with max_source_amount/fulfillment_amount.
|
|
603
|
+
*
|
|
604
|
+
*/
|
|
605
|
+
amount?: string;
|
|
606
|
+
/**
|
|
607
|
+
* Maximum amount willing to spend from source (in decimal format).
|
|
608
|
+
* Must be specified together with fulfillment_amount.
|
|
609
|
+
* Cannot be used together with amount field.
|
|
610
|
+
*
|
|
611
|
+
*/
|
|
612
|
+
max_source_amount?: string;
|
|
613
|
+
/**
|
|
614
|
+
* Exact amount to be fulfilled at destination (in decimal format).
|
|
615
|
+
* Must be specified together with max_source_amount.
|
|
616
|
+
* Cannot be used together with amount field.
|
|
617
|
+
*
|
|
618
|
+
*/
|
|
619
|
+
fulfillment_amount?: string;
|
|
620
|
+
/**
|
|
621
|
+
* Seconds until quote deadline (from now).
|
|
622
|
+
* How long to wait for settlement provider quotes.
|
|
623
|
+
*
|
|
624
|
+
*/
|
|
625
|
+
quote_deadline_seconds?: number;
|
|
626
|
+
/**
|
|
627
|
+
* Seconds until fulfillment deadline (from now).
|
|
628
|
+
* Final deadline for completing the payment.
|
|
629
|
+
*
|
|
630
|
+
*/
|
|
631
|
+
fulfillment_deadline_seconds?: number;
|
|
632
|
+
};
|
|
633
|
+
/**
|
|
634
|
+
* Complete unsigned PaymentRequest ready for signing.
|
|
635
|
+
* Contains all resolved technical details and typed data ready for signing.
|
|
636
|
+
*
|
|
637
|
+
*/
|
|
638
|
+
type PreparePaymentResponse = {
|
|
639
|
+
/**
|
|
640
|
+
* Complete PaymentRequest with signature field set to null.
|
|
641
|
+
* Client should fill in the signature field(s) in
|
|
642
|
+
* sender_auth.signed_messages, either by signing the message_hash
|
|
643
|
+
* field in signed_messages or by using typed data signing on the
|
|
644
|
+
* message_prehash field in signed messages, and then submit the full
|
|
645
|
+
* object to POST /v1/payments.
|
|
646
|
+
*
|
|
647
|
+
*/
|
|
648
|
+
payment_request: PaymentRequest;
|
|
649
|
+
};
|
|
650
|
+
type ResolvePaymentResponse = {
|
|
651
|
+
/**
|
|
652
|
+
* The payment ID that corresponds to the given request ID
|
|
653
|
+
*/
|
|
654
|
+
payment_id: string;
|
|
655
|
+
};
|
|
656
|
+
/**
|
|
657
|
+
* Step-by-step view of a payment's settlement lifecycle. Includes a route
|
|
658
|
+
* summary, a list of steps with timings, and if the payment failed, a
|
|
659
|
+
* structured error describing where and why.
|
|
660
|
+
*
|
|
661
|
+
*/
|
|
662
|
+
type PaymentTimelineResponse = {
|
|
663
|
+
payment_id: string;
|
|
664
|
+
/**
|
|
665
|
+
* High-level status:
|
|
666
|
+
* - `pending`: Bidding, awarded, or early in settlement
|
|
667
|
+
* - `settling`: Settlement in progress (on-chain steps executing)
|
|
668
|
+
* - `completed`: Payment successfully delivered
|
|
669
|
+
* - `failed`: Payment failed
|
|
670
|
+
* - `cancelled`: Payment was cancelled
|
|
671
|
+
*
|
|
672
|
+
*/
|
|
673
|
+
status: 'pending' | 'settling' | 'completed' | 'failed' | 'cancelled';
|
|
674
|
+
created_at: string;
|
|
675
|
+
updated_at: string;
|
|
676
|
+
/**
|
|
677
|
+
* Total time from first step to last completed step (only set for terminal states)
|
|
678
|
+
*/
|
|
679
|
+
total_duration_ms?: number;
|
|
680
|
+
summary?: PaymentSummary;
|
|
681
|
+
error?: TimelineError;
|
|
682
|
+
steps: Array<TimelineStep>;
|
|
683
|
+
};
|
|
684
|
+
/**
|
|
685
|
+
* High-level status:
|
|
686
|
+
* - `pending`: Bidding, awarded, or early in settlement
|
|
687
|
+
* - `settling`: Settlement in progress (on-chain steps executing)
|
|
688
|
+
* - `completed`: Payment successfully delivered
|
|
689
|
+
* - `failed`: Payment failed
|
|
690
|
+
* - `cancelled`: Payment was cancelled
|
|
691
|
+
*
|
|
692
|
+
*/
|
|
693
|
+
type status3 = 'pending' | 'settling' | 'completed' | 'failed' | 'cancelled';
|
|
694
|
+
/**
|
|
695
|
+
* Top-level context about the payment (parties, assets, amounts)
|
|
696
|
+
*/
|
|
697
|
+
type PaymentSummary = {
|
|
698
|
+
/**
|
|
699
|
+
* CAIP-19 identifier of the source asset
|
|
700
|
+
*/
|
|
701
|
+
source_asset?: string;
|
|
702
|
+
source_account?: string;
|
|
703
|
+
dest_asset?: string;
|
|
704
|
+
dest_account?: string;
|
|
705
|
+
/**
|
|
706
|
+
* Raw fulfillment amount in smallest token units
|
|
707
|
+
*/
|
|
708
|
+
fulfillment_amount?: string;
|
|
709
|
+
/**
|
|
710
|
+
* Human-readable formatted amount with symbol, e.g. "1.00 USDC".
|
|
711
|
+
* Only set when the source asset's decimals are known via the token registry.
|
|
712
|
+
*
|
|
713
|
+
*/
|
|
714
|
+
display_amount?: string;
|
|
715
|
+
/**
|
|
716
|
+
* Raw max source amount in smallest token units
|
|
717
|
+
*/
|
|
718
|
+
max_source_amount?: string;
|
|
719
|
+
request_id?: string;
|
|
720
|
+
};
|
|
721
|
+
/**
|
|
722
|
+
* Structured error details when a payment has failed
|
|
723
|
+
*/
|
|
724
|
+
type TimelineError = {
|
|
725
|
+
/**
|
|
726
|
+
* Machine-readable error code
|
|
727
|
+
*/
|
|
728
|
+
code: string;
|
|
729
|
+
/**
|
|
730
|
+
* Human-readable error description
|
|
731
|
+
*/
|
|
732
|
+
message: string;
|
|
733
|
+
/**
|
|
734
|
+
* Which component reported the error
|
|
735
|
+
*/
|
|
736
|
+
domain?: string;
|
|
737
|
+
/**
|
|
738
|
+
* CAIP-2 chain where the error occurred (if on-chain)
|
|
739
|
+
*/
|
|
740
|
+
chain_id?: string;
|
|
741
|
+
/**
|
|
742
|
+
* Transaction hash of the failed on-chain attempt (if applicable)
|
|
743
|
+
*/
|
|
744
|
+
tx_hash?: string;
|
|
745
|
+
/**
|
|
746
|
+
* Smart-contract revert reason (if the error was an on-chain revert)
|
|
747
|
+
*/
|
|
748
|
+
revert_reason?: string;
|
|
749
|
+
};
|
|
750
|
+
type TimelineStep = {
|
|
751
|
+
/**
|
|
752
|
+
* Name of the step
|
|
753
|
+
*/
|
|
754
|
+
name: string;
|
|
755
|
+
/**
|
|
756
|
+
* Human-readable label
|
|
757
|
+
*/
|
|
758
|
+
label: string;
|
|
759
|
+
/**
|
|
760
|
+
* Current status of this step:
|
|
761
|
+
* - `completed`: Step finished successfully
|
|
762
|
+
* - `in_progress`: Step currently executing
|
|
763
|
+
* - `pending`: Step hasn't started yet
|
|
764
|
+
* - `failed`: Step errored out
|
|
765
|
+
* - `skipped`: Step will never execute because an earlier step failed
|
|
766
|
+
*
|
|
767
|
+
*/
|
|
768
|
+
status: 'completed' | 'in_progress' | 'pending' | 'failed' | 'skipped';
|
|
769
|
+
/**
|
|
770
|
+
* When the step completed (if it has)
|
|
771
|
+
*/
|
|
772
|
+
timestamp?: string;
|
|
773
|
+
/**
|
|
774
|
+
* Time this step took, measured from the previous step
|
|
775
|
+
*/
|
|
776
|
+
duration_ms?: number;
|
|
777
|
+
/**
|
|
778
|
+
* CAIP-2 chain this step happened on (if on-chain)
|
|
779
|
+
*/
|
|
780
|
+
chain_id?: string;
|
|
781
|
+
/**
|
|
782
|
+
* Transaction hash associated with this step (if on-chain)
|
|
783
|
+
*/
|
|
784
|
+
tx_hash?: string;
|
|
785
|
+
/**
|
|
786
|
+
* Additional step-specific data (e.g. block_number, settler, reason)
|
|
787
|
+
*/
|
|
788
|
+
details?: {
|
|
789
|
+
[key: string]: unknown;
|
|
790
|
+
};
|
|
791
|
+
};
|
|
792
|
+
/**
|
|
793
|
+
* Current status of this step:
|
|
794
|
+
* - `completed`: Step finished successfully
|
|
795
|
+
* - `in_progress`: Step currently executing
|
|
796
|
+
* - `pending`: Step hasn't started yet
|
|
797
|
+
* - `failed`: Step errored out
|
|
798
|
+
* - `skipped`: Step will never execute because an earlier step failed
|
|
799
|
+
*
|
|
800
|
+
*/
|
|
801
|
+
type status4 = 'completed' | 'in_progress' | 'pending' | 'failed' | 'skipped';
|
|
802
|
+
type ErrorResponse = {
|
|
803
|
+
/**
|
|
804
|
+
* Error message
|
|
805
|
+
*/
|
|
806
|
+
error?: string;
|
|
807
|
+
};
|
|
808
|
+
/**
|
|
809
|
+
* Request body for opening a quote-request batch. Structurally the existing PaymentRequest
|
|
810
|
+
* with `sender_auth` omitted (the spend authorization is deferred to the award call); see
|
|
811
|
+
* schemas/declarations/PaymentRequest/v1/schema.json.
|
|
812
|
+
*
|
|
813
|
+
*/
|
|
814
|
+
type CreateQuoteRequest = {
|
|
815
|
+
/**
|
|
816
|
+
* Semver-shaped declaration version (MAJOR.MINOR), locked to major 1 for v1. Producers emit
|
|
817
|
+
* the canonical value exported by the bindings' Version constant.
|
|
818
|
+
*
|
|
819
|
+
*/
|
|
820
|
+
version: string;
|
|
821
|
+
/**
|
|
822
|
+
* Client-supplied idempotency key for this quote-request. The same request_id from the
|
|
823
|
+
* same originator returns the same quote_request_id. Independent of the award-call request_id.
|
|
824
|
+
*
|
|
825
|
+
*/
|
|
826
|
+
request_id: string;
|
|
827
|
+
source: OwnedAsset;
|
|
828
|
+
/**
|
|
829
|
+
* Array of destination assets for the settlement agent to choose from (at least one required).
|
|
830
|
+
*/
|
|
831
|
+
destination: Array<OwnedAsset>;
|
|
832
|
+
/**
|
|
833
|
+
* The exact amount to be received at the destination (smallest unit, e.g. wei or cents).
|
|
834
|
+
*/
|
|
835
|
+
fulfillment_amount: string;
|
|
836
|
+
/**
|
|
837
|
+
* Optional cap on what the originator is willing to spend from source (smallest unit).
|
|
838
|
+
* Quotes with source_amount above this are filtered. No cap applied if omitted.
|
|
839
|
+
*
|
|
840
|
+
*/
|
|
841
|
+
max_source_amount?: string;
|
|
842
|
+
/**
|
|
843
|
+
* Required. End of the collection window. After this point no new quotes are accepted.
|
|
844
|
+
* The gateway injects no default and never mutates the originator-supplied body, so the
|
|
845
|
+
* value is carried through verbatim to the award call. It must be supplied and must be in
|
|
846
|
+
* the future. Must be strictly earlier than fulfillment_deadline.
|
|
847
|
+
*
|
|
848
|
+
*/
|
|
849
|
+
quote_deadline: string;
|
|
850
|
+
/**
|
|
851
|
+
* Required. Final deadline for completing the payment. Past it the payment is cancelled and
|
|
852
|
+
* eligible for refund. The gateway injects no default and never mutates the
|
|
853
|
+
* originator-supplied body, so the value is carried through verbatim to the award call. It
|
|
854
|
+
* must be supplied and must be in the future. Must be strictly later than quote_deadline.
|
|
855
|
+
*
|
|
856
|
+
*/
|
|
857
|
+
fulfillment_deadline: string;
|
|
858
|
+
/**
|
|
859
|
+
* Policy requirements for settler authentication. Keys are policy names, values indicate if required.
|
|
860
|
+
*/
|
|
861
|
+
settler_auth_required?: {
|
|
862
|
+
[key: string]: (boolean);
|
|
863
|
+
};
|
|
864
|
+
originator_auth?: VerifiableCredentialAuth;
|
|
865
|
+
/**
|
|
866
|
+
* Wallet address or public key of a trusted service that auto-selects the best rate.
|
|
867
|
+
* Leave empty to use the default selector.
|
|
868
|
+
*
|
|
869
|
+
*/
|
|
870
|
+
quote_selector?: string;
|
|
871
|
+
/**
|
|
872
|
+
* Optional third-party service that independently verifies delivery. Leave empty for the default verifier.
|
|
873
|
+
*/
|
|
874
|
+
fulfillment_verifier?: {
|
|
875
|
+
/**
|
|
876
|
+
* The wallet address or public key of the verification service
|
|
877
|
+
*/
|
|
878
|
+
account: string;
|
|
879
|
+
/**
|
|
880
|
+
* The API endpoint URL where the verification service can be reached
|
|
881
|
+
*/
|
|
882
|
+
endpoint: string;
|
|
883
|
+
};
|
|
884
|
+
/**
|
|
885
|
+
* Optional escrow contract address. Leave empty to use the default.
|
|
886
|
+
*/
|
|
887
|
+
escrow_contract_address?: string;
|
|
888
|
+
/**
|
|
889
|
+
* Optional fulfillment-proxy contract address on the destination chain. Leave empty to use the default.
|
|
890
|
+
*/
|
|
891
|
+
fulfillment_proxy?: string;
|
|
892
|
+
/**
|
|
893
|
+
* Optional settler filtering. If whitelist is present, only whitelisted settlers may win.
|
|
894
|
+
* If blacklist is present, blacklisted settlers are excluded. Both can be specified;
|
|
895
|
+
* blacklist takes precedence (a settler in both is rejected).
|
|
896
|
+
*
|
|
897
|
+
*/
|
|
898
|
+
settler_requirements?: {
|
|
899
|
+
/**
|
|
900
|
+
* Settler DIDs permitted to fulfill this request (W3C DID format). If present, only these may win.
|
|
901
|
+
*/
|
|
902
|
+
whitelist?: Array<(string)>;
|
|
903
|
+
/**
|
|
904
|
+
* Settler DIDs excluded from fulfilling this request (W3C DID format).
|
|
905
|
+
*/
|
|
906
|
+
blacklist?: Array<(string)>;
|
|
907
|
+
};
|
|
908
|
+
/**
|
|
909
|
+
* Optional JSON-LD context URLs — present when the originator wraps the request in a W3C
|
|
910
|
+
* Data Integrity envelope so a downstream verifier can recover the signer identity.
|
|
911
|
+
*
|
|
912
|
+
*/
|
|
913
|
+
'@context'?: Array<(string)>;
|
|
914
|
+
proof?: DataIntegrityProof;
|
|
915
|
+
/**
|
|
916
|
+
* Optional document-level W3C Verifiable Credentials (e.g. KnownToAtum about the request producer).
|
|
917
|
+
*/
|
|
918
|
+
verifiableCredential?: Array<VerifiableCredential>;
|
|
919
|
+
};
|
|
920
|
+
/**
|
|
921
|
+
* W3C Data Integrity proof conforming to the Data Integrity 1.0 specification.
|
|
922
|
+
*/
|
|
923
|
+
type DataIntegrityProof = {
|
|
924
|
+
/**
|
|
925
|
+
* Proof type identifier (e.g. EcdsaSecp256k1RecoverySignature2020).
|
|
926
|
+
*/
|
|
927
|
+
type: string;
|
|
928
|
+
/**
|
|
929
|
+
* ISO 8601 timestamp when the proof was created.
|
|
930
|
+
*/
|
|
931
|
+
created: string;
|
|
932
|
+
/**
|
|
933
|
+
* DID URL identifying the verification method.
|
|
934
|
+
*/
|
|
935
|
+
verificationMethod: string;
|
|
936
|
+
/**
|
|
937
|
+
* Purpose of the proof (e.g. assertionMethod, authentication).
|
|
938
|
+
*/
|
|
939
|
+
proofPurpose: string;
|
|
940
|
+
/**
|
|
941
|
+
* Detached JWS signature (header..signature format for ES256K-R).
|
|
942
|
+
*/
|
|
943
|
+
jws?: string;
|
|
944
|
+
/**
|
|
945
|
+
* Alternative to jws: base-encoded proof value.
|
|
946
|
+
*/
|
|
947
|
+
proofValue?: string;
|
|
948
|
+
};
|
|
949
|
+
/**
|
|
950
|
+
* One collected quote — the content-hash identifier plus the verbatim settler-signed FulfillmentQuote.
|
|
951
|
+
*/
|
|
952
|
+
type Quote = {
|
|
953
|
+
/**
|
|
954
|
+
* Canonical content-hash of the signed quote bytes; identifies the quote server-side at
|
|
955
|
+
* award time. Provided as a convenience — the gateway re-derives it from
|
|
956
|
+
* bid_award.fulfillment_quote_json.
|
|
957
|
+
*
|
|
958
|
+
*/
|
|
959
|
+
quote_id: string;
|
|
960
|
+
/**
|
|
961
|
+
* The settler-signed FulfillmentQuote (structurally the canonical FulfillmentQuote/v1
|
|
962
|
+
* declaration at https://schemas.atum.network/declarations/FulfillmentQuote/v1), returned
|
|
963
|
+
* verbatim as an opaque signed document. A client recomputes quote_hash over the returned
|
|
964
|
+
* bytes and verifies the settler signature, then re-embeds them into
|
|
965
|
+
* bid_award.fulfillment_quote_json at award. quote_hash is canonicalization-based
|
|
966
|
+
* (URDNA2015), so it is stable across JSON key-order/whitespace normalization. The
|
|
967
|
+
* returned bytes are hash-equivalent to, but not necessarily byte-identical with, what the
|
|
968
|
+
* settler emitted (quotes are stored as JSONB, which normalizes on write). The gateway
|
|
969
|
+
* still never re-serializes the quote through a typed struct (that renormalizes timestamp
|
|
970
|
+
* values and WOULD change quote_hash), so the Go binding exposes it as a raw JSON passthrough.
|
|
971
|
+
*
|
|
972
|
+
*/
|
|
973
|
+
fulfillment_quote: {
|
|
974
|
+
[key: string]: unknown;
|
|
975
|
+
};
|
|
976
|
+
};
|
|
977
|
+
/**
|
|
978
|
+
* A collected quote in the status response, annotated with its award linkage.
|
|
979
|
+
*/
|
|
980
|
+
type AwardedQuote = {
|
|
981
|
+
quote_id: string;
|
|
982
|
+
/**
|
|
983
|
+
* The settler-signed FulfillmentQuote (structurally the canonical FulfillmentQuote/v1
|
|
984
|
+
* declaration at https://schemas.atum.network/declarations/FulfillmentQuote/v1), returned
|
|
985
|
+
* verbatim as an opaque signed document. A client recomputes quote_hash over the returned
|
|
986
|
+
* bytes and verifies the settler signature, then re-embeds them into
|
|
987
|
+
* bid_award.fulfillment_quote_json at award. quote_hash is canonicalization-based
|
|
988
|
+
* (URDNA2015), so it is stable across JSON key-order/whitespace normalization. The
|
|
989
|
+
* returned bytes are hash-equivalent to, but not necessarily byte-identical with, what the
|
|
990
|
+
* settler emitted (quotes are stored as JSONB, which normalizes on write). The gateway
|
|
991
|
+
* still never re-serializes the quote through a typed struct (that renormalizes timestamp
|
|
992
|
+
* values and WOULD change quote_hash), so the Go binding exposes it as a raw JSON passthrough.
|
|
993
|
+
*
|
|
994
|
+
*/
|
|
995
|
+
fulfillment_quote: {
|
|
996
|
+
[key: string]: unknown;
|
|
997
|
+
};
|
|
998
|
+
/**
|
|
999
|
+
* payment_id if this quote was awarded; null otherwise. Under MVP single-award, at most
|
|
1000
|
+
* one quote per batch carries a non-null value.
|
|
1001
|
+
*
|
|
1002
|
+
*/
|
|
1003
|
+
awarded_payment_id?: string | null;
|
|
1004
|
+
};
|
|
1005
|
+
/**
|
|
1006
|
+
* A (quote_id, payment_id) pair for an awarded quote in a batch.
|
|
1007
|
+
*/
|
|
1008
|
+
type AwardedPayment = {
|
|
1009
|
+
quote_id: string;
|
|
1010
|
+
payment_id: string;
|
|
1011
|
+
};
|
|
1012
|
+
/**
|
|
1013
|
+
* Synchronous response to POST /v1/payments/quote-requests. Self-contained — the corridor
|
|
1014
|
+
* fields are echoed at the response root so a drop-recovery client can build the award call
|
|
1015
|
+
* without retaining the original request body.
|
|
1016
|
+
*
|
|
1017
|
+
*/
|
|
1018
|
+
type QuoteRequestResponse = {
|
|
1019
|
+
/**
|
|
1020
|
+
* Gateway-generated resource ID for the batch, used in subsequent status reads and awards.
|
|
1021
|
+
*/
|
|
1022
|
+
quote_request_id: string;
|
|
1023
|
+
/**
|
|
1024
|
+
* Collection-phase outcome of the create call:
|
|
1025
|
+
* - `ready` — collection complete; `quotes` populated. If no settler bid, this is still
|
|
1026
|
+
* `ready` with an empty `quotes` array (a successful "no quotes available" result —
|
|
1027
|
+
* distinct from `expired`, which only applies to collected quotes that later lapse).
|
|
1028
|
+
* - `collecting` — the sync wait cap fired before the quote deadline; poll the status endpoint for quotes.
|
|
1029
|
+
* The `awarded` and `expired` lifecycle states are observed only via the status endpoint, not here.
|
|
1030
|
+
*
|
|
1031
|
+
*/
|
|
1032
|
+
status: 'collecting' | 'ready';
|
|
1033
|
+
source?: OwnedAsset;
|
|
1034
|
+
destination?: Array<OwnedAsset>;
|
|
1035
|
+
fulfillment_amount?: string;
|
|
1036
|
+
max_source_amount?: string;
|
|
1037
|
+
fulfillment_deadline?: string;
|
|
1038
|
+
quote_deadline?: string;
|
|
1039
|
+
/**
|
|
1040
|
+
* Collected quotes. Present when status is `ready` — an empty array if no settler bid.
|
|
1041
|
+
*/
|
|
1042
|
+
quotes?: Array<Quote>;
|
|
1043
|
+
};
|
|
1044
|
+
/**
|
|
1045
|
+
* Collection-phase outcome of the create call:
|
|
1046
|
+
* - `ready` — collection complete; `quotes` populated. If no settler bid, this is still
|
|
1047
|
+
* `ready` with an empty `quotes` array (a successful "no quotes available" result —
|
|
1048
|
+
* distinct from `expired`, which only applies to collected quotes that later lapse).
|
|
1049
|
+
* - `collecting` — the sync wait cap fired before the quote deadline; poll the status endpoint for quotes.
|
|
1050
|
+
* The `awarded` and `expired` lifecycle states are observed only via the status endpoint, not here.
|
|
1051
|
+
*
|
|
1052
|
+
*/
|
|
1053
|
+
type status5 = 'collecting' | 'ready';
|
|
1054
|
+
/**
|
|
1055
|
+
* Asynchronous (202) response to POST /v1/payments/quote-requests. Returns the batch handle
|
|
1056
|
+
* plus the echoed corridor; quotes are retrieved via the status endpoint.
|
|
1057
|
+
*
|
|
1058
|
+
*/
|
|
1059
|
+
type QuoteRequestAccepted = {
|
|
1060
|
+
quote_request_id: string;
|
|
1061
|
+
/**
|
|
1062
|
+
* Always `collecting` — collection is in progress server-side.
|
|
1063
|
+
*/
|
|
1064
|
+
status: 'collecting';
|
|
1065
|
+
source?: OwnedAsset;
|
|
1066
|
+
destination?: Array<OwnedAsset>;
|
|
1067
|
+
fulfillment_amount?: string;
|
|
1068
|
+
max_source_amount?: string;
|
|
1069
|
+
fulfillment_deadline?: string;
|
|
1070
|
+
quote_deadline?: string;
|
|
1071
|
+
};
|
|
1072
|
+
/**
|
|
1073
|
+
* Always `collecting` — collection is in progress server-side.
|
|
1074
|
+
*/
|
|
1075
|
+
type status6 = 'collecting';
|
|
1076
|
+
/**
|
|
1077
|
+
* Response to GET /v1/payments/quote-requests/{quoteRequestId}. The `status` enum describes
|
|
1078
|
+
* the quote-request batch lifecycle and is disjoint from the payment-status enum.
|
|
1079
|
+
*
|
|
1080
|
+
*/
|
|
1081
|
+
type QuoteRequestStatusResponse = {
|
|
1082
|
+
quote_request_id: string;
|
|
1083
|
+
/**
|
|
1084
|
+
* Derived batch lifecycle, computed at read time (not a stored state machine). Disjoint
|
|
1085
|
+
* from the payment-status enum returned by the award and payment-status endpoints.
|
|
1086
|
+
* - `collecting` — collection window in progress; `quotes` absent.
|
|
1087
|
+
* - `ready` — collection complete; none awarded yet; either at least one quote is still
|
|
1088
|
+
* within its `award_deadline`, or no settler bid (empty `quotes` array — the successful
|
|
1089
|
+
* "no quotes available" result).
|
|
1090
|
+
* - `awarded` — a quote produced a payment row; no further awards accepted (MVP).
|
|
1091
|
+
* - `expired` — collection closed, nothing awarded, and every collected quote is now past
|
|
1092
|
+
* its `award_deadline` ("quotes lapsed"). An empty batch is `ready`, not `expired` — the
|
|
1093
|
+
* two are deliberately distinct ("no quotes available" vs "quotes lapsed").
|
|
1094
|
+
*
|
|
1095
|
+
*/
|
|
1096
|
+
status: 'collecting' | 'ready' | 'awarded' | 'expired';
|
|
1097
|
+
/**
|
|
1098
|
+
* Collected quotes with award linkage. Absent while status is `collecting`.
|
|
1099
|
+
*/
|
|
1100
|
+
quotes?: Array<AwardedQuote>;
|
|
1101
|
+
/**
|
|
1102
|
+
* Flat list of awarded (quote_id, payment_id) pairs. At most one entry under MVP single-award.
|
|
1103
|
+
*/
|
|
1104
|
+
payments?: Array<AwardedPayment>;
|
|
1105
|
+
};
|
|
1106
|
+
/**
|
|
1107
|
+
* Derived batch lifecycle, computed at read time (not a stored state machine). Disjoint
|
|
1108
|
+
* from the payment-status enum returned by the award and payment-status endpoints.
|
|
1109
|
+
* - `collecting` — collection window in progress; `quotes` absent.
|
|
1110
|
+
* - `ready` — collection complete; none awarded yet; either at least one quote is still
|
|
1111
|
+
* within its `award_deadline`, or no settler bid (empty `quotes` array — the successful
|
|
1112
|
+
* "no quotes available" result).
|
|
1113
|
+
* - `awarded` — a quote produced a payment row; no further awards accepted (MVP).
|
|
1114
|
+
* - `expired` — collection closed, nothing awarded, and every collected quote is now past
|
|
1115
|
+
* its `award_deadline` ("quotes lapsed"). An empty batch is `ready`, not `expired` — the
|
|
1116
|
+
* two are deliberately distinct ("no quotes available" vs "quotes lapsed").
|
|
1117
|
+
*
|
|
1118
|
+
*/
|
|
1119
|
+
type status7 = 'collecting' | 'ready' | 'awarded' | 'expired';
|
|
1120
|
+
/**
|
|
1121
|
+
* Request body for POST /v1/payments/awards. Carries the two originator-signed artifacts:
|
|
1122
|
+
* `sender_auth` (Permit2 deposit authorization) and a fully-formed `bid_award` declaration.
|
|
1123
|
+
* The awarded quote is derived server-side from bid_award.fulfillment_quote_json — no
|
|
1124
|
+
* explicit quote_id on the wire.
|
|
1125
|
+
*
|
|
1126
|
+
*/
|
|
1127
|
+
type AwardRequest = {
|
|
1128
|
+
/**
|
|
1129
|
+
* Client-supplied idempotency key for this award call. Independent of the quote-request's request_id.
|
|
1130
|
+
*/
|
|
1131
|
+
request_id: string;
|
|
1132
|
+
sender_auth: SenderAuth;
|
|
1133
|
+
bid_award: BidAward;
|
|
1134
|
+
};
|
|
1135
|
+
/**
|
|
1136
|
+
* Fully-formed, originator-signed bid award. Mirrors schemas/declarations/BidAward/v1/schema.json.
|
|
1137
|
+
* `authorization` carries the Escrow reserve-witness signature naming the chosen settler;
|
|
1138
|
+
* `fulfillment_quote_json` is the verbatim settler-signed quote string received in the quote
|
|
1139
|
+
* response (carrying the settler's proof).
|
|
1140
|
+
*
|
|
1141
|
+
*/
|
|
1142
|
+
type BidAward = {
|
|
1143
|
+
/**
|
|
1144
|
+
* Semver-shaped declaration version (MAJOR.MINOR), locked to major 1 for v1. Producers emit
|
|
1145
|
+
* the canonical value exported by the bindings' Version constant.
|
|
1146
|
+
*
|
|
1147
|
+
*/
|
|
1148
|
+
version: string;
|
|
1149
|
+
authorization: SignedMessage;
|
|
1150
|
+
/**
|
|
1151
|
+
* The settler-signed FulfillmentQuote received in the quote response, forwarded verbatim.
|
|
1152
|
+
* Verification is canonicalization-based — the settler's W3C Data Integrity proof is checked
|
|
1153
|
+
* over the canonicalized form, and `quote_id` is derived as the canonical content-hash — so a
|
|
1154
|
+
* JSON decode/re-encode that only changes key order or whitespace does not invalidate it.
|
|
1155
|
+
* Clients SHOULD still forward the received bytes as-is rather than rebuild the object; the
|
|
1156
|
+
* SDK helpers do this and also expose settler-proof verification.
|
|
1157
|
+
*
|
|
1158
|
+
*/
|
|
1159
|
+
fulfillment_quote_json: string;
|
|
1160
|
+
/**
|
|
1161
|
+
* Optional JSON-LD context URLs when the award is wrapped in a W3C Data Integrity envelope.
|
|
1162
|
+
*/
|
|
1163
|
+
'@context'?: Array<(string)>;
|
|
1164
|
+
proof?: DataIntegrityProof;
|
|
1165
|
+
/**
|
|
1166
|
+
* Optional W3C Verifiable Credentials attesting the award producer.
|
|
1167
|
+
*/
|
|
1168
|
+
verifiableCredential?: Array<VerifiableCredential>;
|
|
1169
|
+
};
|
|
1170
|
+
/**
|
|
1171
|
+
* Synchronous response to POST /v1/payments/awards. The `status` field describes the payment
|
|
1172
|
+
* lifecycle. Note there are two distinct status surfaces for a Quote-API payment, with
|
|
1173
|
+
* different vocabularies: (1) this award response (`awarding`/`completed`/…), and
|
|
1174
|
+
* (2) the separate GET /v1/payments/{paymentId}/status endpoint you poll afterward, which
|
|
1175
|
+
* reports the same payment under its own values (an in-progress payment reads as `pending`
|
|
1176
|
+
* there). Both are disjoint from the quote-request batch status on the quote-request endpoints.
|
|
1177
|
+
*
|
|
1178
|
+
*/
|
|
1179
|
+
type AwardResponse = {
|
|
1180
|
+
payment_id: string;
|
|
1181
|
+
/**
|
|
1182
|
+
* Payment lifecycle status on the award response:
|
|
1183
|
+
* - `completed` — settlement finished within the sync wait (includes fulfillment_confirmation).
|
|
1184
|
+
* - `awarding` — settlement still in progress when the sync cap fired (or on wait=false);
|
|
1185
|
+
* poll GET /v1/payments/{paymentId}/status.
|
|
1186
|
+
* - `failed` — settlement reached a terminal failure (e.g. the settler could not fulfill, or
|
|
1187
|
+
* an on-chain step was rejected).
|
|
1188
|
+
* - `cancelled` — the payment was terminated before settlement completed and will not proceed.
|
|
1189
|
+
* `failed` and `cancelled` are terminal states surfaced here only when they occur within the
|
|
1190
|
+
* sync wait; otherwise the response is `awarding` and the terminal state is read from the
|
|
1191
|
+
* payment-status endpoint.
|
|
1192
|
+
*
|
|
1193
|
+
*/
|
|
1194
|
+
status: 'awarding' | 'completed' | 'failed' | 'cancelled';
|
|
1195
|
+
fulfillment_confirmation?: FulfillmentConfirmation;
|
|
1196
|
+
};
|
|
1197
|
+
/**
|
|
1198
|
+
* Payment lifecycle status on the award response:
|
|
1199
|
+
* - `completed` — settlement finished within the sync wait (includes fulfillment_confirmation).
|
|
1200
|
+
* - `awarding` — settlement still in progress when the sync cap fired (or on wait=false);
|
|
1201
|
+
* poll GET /v1/payments/{paymentId}/status.
|
|
1202
|
+
* - `failed` — settlement reached a terminal failure (e.g. the settler could not fulfill, or
|
|
1203
|
+
* an on-chain step was rejected).
|
|
1204
|
+
* - `cancelled` — the payment was terminated before settlement completed and will not proceed.
|
|
1205
|
+
* `failed` and `cancelled` are terminal states surfaced here only when they occur within the
|
|
1206
|
+
* sync wait; otherwise the response is `awarding` and the terminal state is read from the
|
|
1207
|
+
* payment-status endpoint.
|
|
1208
|
+
*
|
|
1209
|
+
*/
|
|
1210
|
+
type status8 = 'awarding' | 'completed' | 'failed' | 'cancelled';
|
|
1211
|
+
/**
|
|
1212
|
+
* Asynchronous (202) response to POST /v1/payments/awards — just the payment handle.
|
|
1213
|
+
*/
|
|
1214
|
+
type AwardAccepted = {
|
|
1215
|
+
payment_id: string;
|
|
1216
|
+
/**
|
|
1217
|
+
* Always `awarding` — settlement is in progress server-side.
|
|
1218
|
+
*/
|
|
1219
|
+
status: 'awarding';
|
|
1220
|
+
};
|
|
1221
|
+
/**
|
|
1222
|
+
* Always `awarding` — settlement is in progress server-side.
|
|
1223
|
+
*/
|
|
1224
|
+
type status9 = 'awarding';
|
|
1225
|
+
type SubmitPaymentData = {
|
|
1226
|
+
requestBody: PaymentRequest;
|
|
1227
|
+
};
|
|
1228
|
+
type SubmitPaymentResponse = PaymentResponse;
|
|
1229
|
+
type GetPaymentStatusData = {
|
|
1230
|
+
/**
|
|
1231
|
+
* The ID of the payment to query
|
|
1232
|
+
*/
|
|
1233
|
+
paymentId: string;
|
|
1234
|
+
};
|
|
1235
|
+
type GetPaymentStatusResponse2 = GetPaymentStatusResponse;
|
|
1236
|
+
type ResolvePaymentData = {
|
|
1237
|
+
/**
|
|
1238
|
+
* The client-supplied request ID embedded in the payment request
|
|
1239
|
+
*/
|
|
1240
|
+
requestId: string;
|
|
1241
|
+
};
|
|
1242
|
+
type ResolvePaymentResponse2 = ResolvePaymentResponse;
|
|
1243
|
+
type GetPaymentTimelineData = {
|
|
1244
|
+
/**
|
|
1245
|
+
* The ID of the payment to query
|
|
1246
|
+
*/
|
|
1247
|
+
paymentId: string;
|
|
1248
|
+
};
|
|
1249
|
+
type GetPaymentTimelineResponse = PaymentTimelineResponse;
|
|
1250
|
+
type PreparePaymentData = {
|
|
1251
|
+
requestBody: PreparePaymentRequest;
|
|
1252
|
+
};
|
|
1253
|
+
type PreparePaymentResponse2 = PreparePaymentResponse;
|
|
1254
|
+
type AuthorizePaymentData = {
|
|
1255
|
+
requestBody: PaymentRequest;
|
|
1256
|
+
};
|
|
1257
|
+
type AuthorizePaymentResponse = AuthorizationResult;
|
|
1258
|
+
type CreateQuoteRequestData = {
|
|
1259
|
+
requestBody: CreateQuoteRequest;
|
|
1260
|
+
/**
|
|
1261
|
+
* Return a handle immediately (`false`, default) or hold the connection for collected quotes (`true`).
|
|
1262
|
+
*/
|
|
1263
|
+
wait?: boolean;
|
|
1264
|
+
};
|
|
1265
|
+
type CreateQuoteRequestResponse = QuoteRequestResponse | QuoteRequestAccepted;
|
|
1266
|
+
type GetQuoteRequestStatusData = {
|
|
1267
|
+
/**
|
|
1268
|
+
* The ID of the quote-request batch to query
|
|
1269
|
+
*/
|
|
1270
|
+
quoteRequestId: string;
|
|
1271
|
+
};
|
|
1272
|
+
type GetQuoteRequestStatusResponse = QuoteRequestStatusResponse;
|
|
1273
|
+
type AwardQuoteData = {
|
|
1274
|
+
requestBody: AwardRequest;
|
|
1275
|
+
/**
|
|
1276
|
+
* Return a handle immediately (`false`, default) or hold the connection for the payment result (`true`).
|
|
1277
|
+
*/
|
|
1278
|
+
wait?: boolean;
|
|
1279
|
+
};
|
|
1280
|
+
type AwardQuoteResponse = AwardResponse | AwardAccepted;
|
|
1281
|
+
type HealthCheckResponse = {
|
|
1282
|
+
status?: string;
|
|
1283
|
+
};
|
|
1284
|
+
type $OpenApiTs = {
|
|
1285
|
+
'/v1/payments': {
|
|
1286
|
+
post: {
|
|
1287
|
+
req: SubmitPaymentData;
|
|
1288
|
+
res: {
|
|
1289
|
+
/**
|
|
1290
|
+
* Payment request submitted successfully
|
|
1291
|
+
*/
|
|
1292
|
+
200: PaymentResponse;
|
|
1293
|
+
/**
|
|
1294
|
+
* Invalid request
|
|
1295
|
+
*/
|
|
1296
|
+
400: ErrorResponse;
|
|
1297
|
+
/**
|
|
1298
|
+
* Internal server error
|
|
1299
|
+
*/
|
|
1300
|
+
500: ErrorResponse;
|
|
1301
|
+
};
|
|
1302
|
+
};
|
|
1303
|
+
};
|
|
1304
|
+
'/v1/payments/{paymentId}/status': {
|
|
1305
|
+
get: {
|
|
1306
|
+
req: GetPaymentStatusData;
|
|
1307
|
+
res: {
|
|
1308
|
+
/**
|
|
1309
|
+
* Payment status retrieved successfully
|
|
1310
|
+
*/
|
|
1311
|
+
200: GetPaymentStatusResponse;
|
|
1312
|
+
/**
|
|
1313
|
+
* Payment not found
|
|
1314
|
+
*/
|
|
1315
|
+
404: ErrorResponse;
|
|
1316
|
+
/**
|
|
1317
|
+
* Internal server error
|
|
1318
|
+
*/
|
|
1319
|
+
500: ErrorResponse;
|
|
1320
|
+
};
|
|
1321
|
+
};
|
|
1322
|
+
};
|
|
1323
|
+
'/v1/payments/resolve': {
|
|
1324
|
+
get: {
|
|
1325
|
+
req: ResolvePaymentData;
|
|
1326
|
+
res: {
|
|
1327
|
+
/**
|
|
1328
|
+
* Payment found
|
|
1329
|
+
*/
|
|
1330
|
+
200: ResolvePaymentResponse;
|
|
1331
|
+
/**
|
|
1332
|
+
* Missing request_id parameter
|
|
1333
|
+
*/
|
|
1334
|
+
400: ErrorResponse;
|
|
1335
|
+
/**
|
|
1336
|
+
* No payment found for the given request ID
|
|
1337
|
+
*/
|
|
1338
|
+
404: ErrorResponse;
|
|
1339
|
+
/**
|
|
1340
|
+
* Internal server error
|
|
1341
|
+
*/
|
|
1342
|
+
500: ErrorResponse;
|
|
1343
|
+
};
|
|
1344
|
+
};
|
|
1345
|
+
};
|
|
1346
|
+
'/v1/payments/{paymentId}/timeline': {
|
|
1347
|
+
get: {
|
|
1348
|
+
req: GetPaymentTimelineData;
|
|
1349
|
+
res: {
|
|
1350
|
+
/**
|
|
1351
|
+
* Timeline retrieved successfully
|
|
1352
|
+
*/
|
|
1353
|
+
200: PaymentTimelineResponse;
|
|
1354
|
+
/**
|
|
1355
|
+
* Payment not found
|
|
1356
|
+
*/
|
|
1357
|
+
404: ErrorResponse;
|
|
1358
|
+
/**
|
|
1359
|
+
* Internal server error
|
|
1360
|
+
*/
|
|
1361
|
+
500: ErrorResponse;
|
|
1362
|
+
};
|
|
1363
|
+
};
|
|
1364
|
+
};
|
|
1365
|
+
'/v1/payments/prepare': {
|
|
1366
|
+
post: {
|
|
1367
|
+
req: PreparePaymentData;
|
|
1368
|
+
res: {
|
|
1369
|
+
/**
|
|
1370
|
+
* Payment request prepared successfully
|
|
1371
|
+
*/
|
|
1372
|
+
200: PreparePaymentResponse;
|
|
1373
|
+
/**
|
|
1374
|
+
* Invalid request parameters
|
|
1375
|
+
*/
|
|
1376
|
+
400: ErrorResponse;
|
|
1377
|
+
/**
|
|
1378
|
+
* Endpoint not yet implemented
|
|
1379
|
+
*/
|
|
1380
|
+
501: ErrorResponse;
|
|
1381
|
+
};
|
|
1382
|
+
};
|
|
1383
|
+
};
|
|
1384
|
+
'/v1/payments/authorizations': {
|
|
1385
|
+
post: {
|
|
1386
|
+
req: AuthorizePaymentData;
|
|
1387
|
+
res: {
|
|
1388
|
+
/**
|
|
1389
|
+
* Authorization decision received (authorized or declined)
|
|
1390
|
+
*/
|
|
1391
|
+
200: AuthorizationResult;
|
|
1392
|
+
/**
|
|
1393
|
+
* Invalid payment request
|
|
1394
|
+
*/
|
|
1395
|
+
400: ErrorResponse;
|
|
1396
|
+
/**
|
|
1397
|
+
* Counterparty not found (no registration for the resolved DID)
|
|
1398
|
+
*/
|
|
1399
|
+
404: ErrorResponse;
|
|
1400
|
+
/**
|
|
1401
|
+
* Counterparty webhook error (HTTP error or connection failure)
|
|
1402
|
+
*/
|
|
1403
|
+
502: ErrorResponse;
|
|
1404
|
+
/**
|
|
1405
|
+
* Authorization timed out (counterparty did not respond)
|
|
1406
|
+
*/
|
|
1407
|
+
504: ErrorResponse;
|
|
1408
|
+
};
|
|
1409
|
+
};
|
|
1410
|
+
};
|
|
1411
|
+
'/v1/payments/quote-requests': {
|
|
1412
|
+
post: {
|
|
1413
|
+
req: CreateQuoteRequestData;
|
|
1414
|
+
res: {
|
|
1415
|
+
/**
|
|
1416
|
+
* Quote-request resolved synchronously. `status` is `ready` when quotes were collected,
|
|
1417
|
+
* or `collecting` when the sync wait cap fired before the quote deadline.
|
|
1418
|
+
*
|
|
1419
|
+
*/
|
|
1420
|
+
200: QuoteRequestResponse;
|
|
1421
|
+
/**
|
|
1422
|
+
* Quote-request accepted; collection continues asynchronously.
|
|
1423
|
+
*/
|
|
1424
|
+
202: QuoteRequestAccepted;
|
|
1425
|
+
/**
|
|
1426
|
+
* Invalid request
|
|
1427
|
+
*/
|
|
1428
|
+
400: ErrorResponse;
|
|
1429
|
+
/**
|
|
1430
|
+
* Internal server error
|
|
1431
|
+
*/
|
|
1432
|
+
500: ErrorResponse;
|
|
1433
|
+
};
|
|
1434
|
+
};
|
|
1435
|
+
};
|
|
1436
|
+
'/v1/payments/quote-requests/{quoteRequestId}': {
|
|
1437
|
+
get: {
|
|
1438
|
+
req: GetQuoteRequestStatusData;
|
|
1439
|
+
res: {
|
|
1440
|
+
/**
|
|
1441
|
+
* Quote-request status retrieved successfully
|
|
1442
|
+
*/
|
|
1443
|
+
200: QuoteRequestStatusResponse;
|
|
1444
|
+
/**
|
|
1445
|
+
* Quote-request not found, or not owned by the caller.
|
|
1446
|
+
*/
|
|
1447
|
+
404: ErrorResponse;
|
|
1448
|
+
/**
|
|
1449
|
+
* Internal server error
|
|
1450
|
+
*/
|
|
1451
|
+
500: ErrorResponse;
|
|
1452
|
+
};
|
|
1453
|
+
};
|
|
1454
|
+
};
|
|
1455
|
+
'/v1/payments/awards': {
|
|
1456
|
+
post: {
|
|
1457
|
+
req: AwardQuoteData;
|
|
1458
|
+
res: {
|
|
1459
|
+
/**
|
|
1460
|
+
* Award resolved synchronously. `status` is `completed` with a fulfillment_confirmation
|
|
1461
|
+
* when settlement finished within the sync wait, or a non-terminal payment status
|
|
1462
|
+
* (e.g. `awarding`) if the cap fired first.
|
|
1463
|
+
*
|
|
1464
|
+
*/
|
|
1465
|
+
200: AwardResponse;
|
|
1466
|
+
/**
|
|
1467
|
+
* Award accepted; settlement continues asynchronously.
|
|
1468
|
+
*/
|
|
1469
|
+
202: AwardAccepted;
|
|
1470
|
+
/**
|
|
1471
|
+
* Invalid request (bad signatures, expired quote, or ownership mismatch)
|
|
1472
|
+
*/
|
|
1473
|
+
400: ErrorResponse;
|
|
1474
|
+
/**
|
|
1475
|
+
* The quote, or another quote in the same batch, has already been awarded
|
|
1476
|
+
* (single-award-per-batch, FR-09).
|
|
1477
|
+
*
|
|
1478
|
+
*/
|
|
1479
|
+
409: ErrorResponse;
|
|
1480
|
+
/**
|
|
1481
|
+
* Internal server error
|
|
1482
|
+
*/
|
|
1483
|
+
500: ErrorResponse;
|
|
1484
|
+
};
|
|
1485
|
+
};
|
|
1486
|
+
};
|
|
1487
|
+
'/health': {
|
|
1488
|
+
get: {
|
|
1489
|
+
res: {
|
|
1490
|
+
/**
|
|
1491
|
+
* Service is healthy
|
|
1492
|
+
*/
|
|
1493
|
+
200: {
|
|
1494
|
+
status?: string;
|
|
1495
|
+
};
|
|
1496
|
+
};
|
|
1497
|
+
};
|
|
1498
|
+
};
|
|
1499
|
+
};
|
|
1500
|
+
|
|
1501
|
+
declare class PaymentsService {
|
|
1502
|
+
readonly httpRequest: BaseHttpRequest;
|
|
1503
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
1504
|
+
/**
|
|
1505
|
+
* Submit a payment request
|
|
1506
|
+
* Initiates a payment by submitting a cryptographically signed payment request.
|
|
1507
|
+
*
|
|
1508
|
+
* The payment gateway will:
|
|
1509
|
+
* 1. Validate the request and signatures
|
|
1510
|
+
* 2. Find optimal settlement routes across chains/assets
|
|
1511
|
+
* 3. Secure funds in escrow
|
|
1512
|
+
* 4. Coordinate with settlement agents for execution
|
|
1513
|
+
* 5. Return a real-time result if processing completes within 30 seconds,
|
|
1514
|
+
* otherwise return a payment ID for status polling
|
|
1515
|
+
*
|
|
1516
|
+
* @param data The data for the request.
|
|
1517
|
+
* @param data.requestBody
|
|
1518
|
+
* @returns PaymentResponse Payment request submitted successfully
|
|
1519
|
+
* @throws ApiError
|
|
1520
|
+
*/
|
|
1521
|
+
submitPayment(data: SubmitPaymentData): CancelablePromise<SubmitPaymentResponse>;
|
|
1522
|
+
/**
|
|
1523
|
+
* Get payment status
|
|
1524
|
+
* Retrieve the status of a payment by its ID
|
|
1525
|
+
* @param data The data for the request.
|
|
1526
|
+
* @param data.paymentId The ID of the payment to query
|
|
1527
|
+
* @returns GetPaymentStatusResponse Payment status retrieved successfully
|
|
1528
|
+
* @throws ApiError
|
|
1529
|
+
*/
|
|
1530
|
+
getPaymentStatus(data: GetPaymentStatusData): CancelablePromise<GetPaymentStatusResponse2>;
|
|
1531
|
+
/**
|
|
1532
|
+
* Resolve a request ID to a payment ID
|
|
1533
|
+
* Looks up the payment ID associated with a given client-supplied request ID.
|
|
1534
|
+
* Used by tooling like the payment explorer so callers can look a payment up
|
|
1535
|
+
* by the request ID they originally submitted.
|
|
1536
|
+
*
|
|
1537
|
+
* @param data The data for the request.
|
|
1538
|
+
* @param data.requestId The client-supplied request ID embedded in the payment request
|
|
1539
|
+
* @returns ResolvePaymentResponse Payment found
|
|
1540
|
+
* @throws ApiError
|
|
1541
|
+
*/
|
|
1542
|
+
resolvePayment(data: ResolvePaymentData): CancelablePromise<ResolvePaymentResponse2>;
|
|
1543
|
+
/**
|
|
1544
|
+
* Get step-by-step payment timeline
|
|
1545
|
+
* Returns the settlement timeline for a payment, including every step the
|
|
1546
|
+
* payment has passed through, per-step durations, chain IDs, transaction
|
|
1547
|
+
* hashes, and — if the payment has failed — a structured error describing
|
|
1548
|
+
* where and why it failed.
|
|
1549
|
+
*
|
|
1550
|
+
* @param data The data for the request.
|
|
1551
|
+
* @param data.paymentId The ID of the payment to query
|
|
1552
|
+
* @returns PaymentTimelineResponse Timeline retrieved successfully
|
|
1553
|
+
* @throws ApiError
|
|
1554
|
+
*/
|
|
1555
|
+
getPaymentTimeline(data: GetPaymentTimelineData): CancelablePromise<GetPaymentTimelineResponse>;
|
|
1556
|
+
/**
|
|
1557
|
+
* Prepare an unsigned payment request
|
|
1558
|
+
* Generates an unsigned PaymentRequest object from human-readable inputs.
|
|
1559
|
+
* This endpoint allows clients to:
|
|
1560
|
+
* 1. Use friendly asset identifiers (e.g., "ethereum/usdc" instead of full CAIP-19)
|
|
1561
|
+
* 2. Specify amounts in decimal format
|
|
1562
|
+
* 3. Get back a complete PaymentRequest with typed data (eg EIP-712 for EVM-compatible chains) ready for signing
|
|
1563
|
+
*
|
|
1564
|
+
* The response includes everything needed to sign and submit a payment, except the signature itself.
|
|
1565
|
+
*
|
|
1566
|
+
* @param data The data for the request.
|
|
1567
|
+
* @param data.requestBody
|
|
1568
|
+
* @returns PreparePaymentResponse Payment request prepared successfully
|
|
1569
|
+
* @throws ApiError
|
|
1570
|
+
*/
|
|
1571
|
+
preparePayment(data: PreparePaymentData): CancelablePromise<PreparePaymentResponse2>;
|
|
1572
|
+
}
|
|
1573
|
+
declare class AuthorizationsService {
|
|
1574
|
+
readonly httpRequest: BaseHttpRequest;
|
|
1575
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
1576
|
+
/**
|
|
1577
|
+
* Request counterparty authorization
|
|
1578
|
+
* Submits a PaymentRequest for counterparty authorization before settlement.
|
|
1579
|
+
* The call blocks synchronously until the beneficiary PSP responds or the
|
|
1580
|
+
* timeout expires (default 30 seconds).
|
|
1581
|
+
*
|
|
1582
|
+
* If authorized, the response includes the counterparty's proof which can
|
|
1583
|
+
* be attached to the subsequent SubmitPayment call.
|
|
1584
|
+
*
|
|
1585
|
+
* Authorization and RFQ submission are separate steps. This endpoint does
|
|
1586
|
+
* NOT trigger an auction — the originator must call SubmitPayment separately.
|
|
1587
|
+
*
|
|
1588
|
+
* @param data The data for the request.
|
|
1589
|
+
* @param data.requestBody
|
|
1590
|
+
* @returns AuthorizationResult Authorization decision received (authorized or declined)
|
|
1591
|
+
* @throws ApiError
|
|
1592
|
+
*/
|
|
1593
|
+
authorizePayment(data: AuthorizePaymentData): CancelablePromise<AuthorizePaymentResponse>;
|
|
1594
|
+
}
|
|
1595
|
+
declare class QuoteRequestsService {
|
|
1596
|
+
readonly httpRequest: BaseHttpRequest;
|
|
1597
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
1598
|
+
/**
|
|
1599
|
+
* Create a quote-request batch
|
|
1600
|
+
* Opens a quote-request batch: broadcasts the corridor to settlement agents and collects
|
|
1601
|
+
* their signed quotes. This is the first phase of the two-phase quote → award flow — the
|
|
1602
|
+
* originator later picks one quote and commits in a separate POST /v1/payments/awards call.
|
|
1603
|
+
* No spend authorization is supplied here; `sender_auth` is deferred to award time.
|
|
1604
|
+
*
|
|
1605
|
+
* Wait modes (the `wait` query parameter):
|
|
1606
|
+
* - `wait=false` (default): return 202 immediately with status `collecting`; poll
|
|
1607
|
+
* GET /v1/payments/quote-requests/{quoteRequestId} until status is `ready`.
|
|
1608
|
+
* - `wait=true`: hold the connection for up to
|
|
1609
|
+
* min(quote_deadline, quote_sync_wait_seconds) and return 200 with the collected quotes
|
|
1610
|
+
* (status `ready`). If the sync cap fires before the quote deadline, return 200 with
|
|
1611
|
+
* status `collecting` and poll the status endpoint.
|
|
1612
|
+
*
|
|
1613
|
+
* Collection continues server-side until the quote deadline regardless of the HTTP
|
|
1614
|
+
* connection, so quotes remain retrievable via the status endpoint in either mode.
|
|
1615
|
+
*
|
|
1616
|
+
* @param data The data for the request.
|
|
1617
|
+
* @param data.requestBody
|
|
1618
|
+
* @param data.wait Return a handle immediately (`false`, default) or hold the connection for collected quotes (`true`).
|
|
1619
|
+
* @returns QuoteRequestResponse Quote-request resolved synchronously. `status` is `ready` when quotes were collected,
|
|
1620
|
+
* or `collecting` when the sync wait cap fired before the quote deadline.
|
|
1621
|
+
*
|
|
1622
|
+
* @returns QuoteRequestAccepted Quote-request accepted; collection continues asynchronously.
|
|
1623
|
+
* @throws ApiError
|
|
1624
|
+
*/
|
|
1625
|
+
createQuoteRequest(data: CreateQuoteRequestData): CancelablePromise<CreateQuoteRequestResponse>;
|
|
1626
|
+
/**
|
|
1627
|
+
* Get quote-request batch status
|
|
1628
|
+
* Returns the current state of a quote-request batch: a derived status, the collected
|
|
1629
|
+
* quotes (each with its settler-signed `award_deadline`), and the awarded
|
|
1630
|
+
* (quote_id, payment_id) pairs once a quote has been awarded. Used for async polling,
|
|
1631
|
+
* connection-drop recovery, and re-reading quotes before awarding.
|
|
1632
|
+
*
|
|
1633
|
+
* The `status` here describes the quote-request batch lifecycle
|
|
1634
|
+
* (`collecting`/`ready`/`awarded`/`expired`) and is disjoint from the payment-status enum
|
|
1635
|
+
* returned by the award and payment-status endpoints.
|
|
1636
|
+
*
|
|
1637
|
+
* @param data The data for the request.
|
|
1638
|
+
* @param data.quoteRequestId The ID of the quote-request batch to query
|
|
1639
|
+
* @returns QuoteRequestStatusResponse Quote-request status retrieved successfully
|
|
1640
|
+
* @throws ApiError
|
|
1641
|
+
*/
|
|
1642
|
+
getQuoteRequestStatus(data: GetQuoteRequestStatusData): CancelablePromise<GetQuoteRequestStatusResponse>;
|
|
1643
|
+
/**
|
|
1644
|
+
* Award a quote
|
|
1645
|
+
* Commits to a payment by awarding one quote from a previously-collected batch. The
|
|
1646
|
+
* originator submits two signatures from their wallet: `sender_auth` (the Permit2 deposit
|
|
1647
|
+
* authorization) and a fully-formed `bid_award` declaration whose `authorization` carries
|
|
1648
|
+
* the Escrow reserve-witness signature naming the chosen settler. The awarded quote is
|
|
1649
|
+
* identified server-side by content-hashing `bid_award.fulfillment_quote_json` — there is
|
|
1650
|
+
* no `quote_id` on the wire.
|
|
1651
|
+
*
|
|
1652
|
+
* From this call onward the `status` field describes the payment lifecycle (disjoint from the
|
|
1653
|
+
* quote-request batch status). Track the payment afterward via
|
|
1654
|
+
* GET /v1/payments/{paymentId}/status — a separate endpoint with its own status vocabulary
|
|
1655
|
+
* (an in-progress payment reads as `pending` there).
|
|
1656
|
+
*
|
|
1657
|
+
* Wait modes (the `wait` query parameter):
|
|
1658
|
+
* - `wait=false` (default): return 202 immediately with `payment_id` and status `awarding`;
|
|
1659
|
+
* poll GET /v1/payments/{paymentId}/status.
|
|
1660
|
+
* - `wait=true`: hold the connection for up to payment_sync_wait_seconds and
|
|
1661
|
+
* return 200 with the payment result. If the sync cap fires first, return 200 with a
|
|
1662
|
+
* non-terminal status (`awarding`); poll GET /v1/payments/{paymentId}/status.
|
|
1663
|
+
*
|
|
1664
|
+
* @param data The data for the request.
|
|
1665
|
+
* @param data.requestBody
|
|
1666
|
+
* @param data.wait Return a handle immediately (`false`, default) or hold the connection for the payment result (`true`).
|
|
1667
|
+
* @returns AwardResponse Award resolved synchronously. `status` is `completed` with a fulfillment_confirmation
|
|
1668
|
+
* when settlement finished within the sync wait, or a non-terminal payment status
|
|
1669
|
+
* (e.g. `awarding`) if the cap fired first.
|
|
1670
|
+
*
|
|
1671
|
+
* @returns AwardAccepted Award accepted; settlement continues asynchronously.
|
|
1672
|
+
* @throws ApiError
|
|
1673
|
+
*/
|
|
1674
|
+
awardQuote(data: AwardQuoteData): CancelablePromise<AwardQuoteResponse>;
|
|
1675
|
+
}
|
|
1676
|
+
declare class HealthService {
|
|
1677
|
+
readonly httpRequest: BaseHttpRequest;
|
|
1678
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
1679
|
+
/**
|
|
1680
|
+
* Health check
|
|
1681
|
+
* Returns the health status of the service
|
|
1682
|
+
* @returns unknown Service is healthy
|
|
1683
|
+
* @throws ApiError
|
|
1684
|
+
*/
|
|
1685
|
+
healthCheck(): CancelablePromise<HealthCheckResponse>;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
type HttpRequestConstructor$1 = new (config: OpenAPIConfig) => BaseHttpRequest;
|
|
1689
|
+
declare class PaymentGatewayClient$1 {
|
|
1690
|
+
readonly authorizations: AuthorizationsService;
|
|
1691
|
+
readonly health: HealthService;
|
|
1692
|
+
readonly payments: PaymentsService;
|
|
1693
|
+
readonly quoteRequests: QuoteRequestsService;
|
|
1694
|
+
readonly request: BaseHttpRequest;
|
|
1695
|
+
constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor$1);
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
interface Logger {
|
|
1699
|
+
debug(obj: unknown, msg?: string): void;
|
|
1700
|
+
info(obj: unknown, msg?: string): void;
|
|
1701
|
+
warn(obj: unknown, msg?: string): void;
|
|
1702
|
+
error(obj: unknown, msg?: string): void;
|
|
1703
|
+
child(bindings: Record<string, unknown>): Logger;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
interface Counter {
|
|
1707
|
+
add(value: number, attributes?: Record<string, unknown>): void;
|
|
1708
|
+
}
|
|
1709
|
+
interface Histogram {
|
|
1710
|
+
record(value: number, attributes?: Record<string, unknown>): void;
|
|
1711
|
+
}
|
|
1712
|
+
interface InstrumentOptions {
|
|
1713
|
+
description?: string;
|
|
1714
|
+
unit?: string;
|
|
1715
|
+
}
|
|
1716
|
+
interface Meter {
|
|
1717
|
+
createCounter(name: string, options?: InstrumentOptions): Counter;
|
|
1718
|
+
createHistogram(name: string, options?: InstrumentOptions): Histogram;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
/**
|
|
1722
|
+
* Resolves the `issued_at` timestamp for a Solana deposit authorization from the
|
|
1723
|
+
* cluster's on-chain clock instead of the local wall clock.
|
|
1724
|
+
*
|
|
1725
|
+
* The escrow validates `now_sec >= issued_at` against Solana's `Clock` sysvar
|
|
1726
|
+
* (crates/replay/src/check.rs). That on-chain clock is global consensus and only
|
|
1727
|
+
* moves forward, so a value read at build time is a safe lower bound at
|
|
1728
|
+
* settlement, which removes the `Escrow_FutureTransaction` failure that a raw
|
|
1729
|
+
* `Date.now()` (client wall clock, possibly ahead of the lagging cluster clock)
|
|
1730
|
+
* can trigger.
|
|
1731
|
+
*
|
|
1732
|
+
* The read is best-effort: on any failure, timeout, or unresolved RPC it falls
|
|
1733
|
+
* back to `Date.now()` minus a skew buffer, so a flaky public endpoint degrades
|
|
1734
|
+
* to the previous behavior rather than blocking the payment.
|
|
1735
|
+
*/
|
|
1736
|
+
|
|
1737
|
+
/** Reads the cluster's on-chain unix timestamp (seconds) from an RPC endpoint. */
|
|
1738
|
+
type SolanaClusterUnixTimeReader = (rpcUrl: string, timeoutMs: number) => Promise<bigint>;
|
|
1739
|
+
|
|
1740
|
+
/**
|
|
1741
|
+
* Chain defaults returned by the payment gateway /defaults endpoint.
|
|
1742
|
+
*/
|
|
1743
|
+
interface ChainDefaults {
|
|
1744
|
+
escrowContract: string;
|
|
1745
|
+
quoteSelector: string;
|
|
1746
|
+
fulfillmentVerifierAccount: string;
|
|
1747
|
+
fulfillmentVerifierEndpoint: string;
|
|
1748
|
+
fulfillmentProxy: string;
|
|
1749
|
+
permit2Contract?: string;
|
|
1750
|
+
/**
|
|
1751
|
+
* V3 Solana escrow domain-separation fields, surfaced by payment-gw
|
|
1752
|
+
* `/defaults` for Solana source chains. Used to build the EscrowDomain that the
|
|
1753
|
+
* V3 deposit hash binds to. Absent for EVM/Tron.
|
|
1754
|
+
*/
|
|
1755
|
+
svmSignatureClusterId?: string;
|
|
1756
|
+
svmSignatureDomainVersion?: number;
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* Result of building a sender auth message for a specific chain.
|
|
1760
|
+
*/
|
|
1761
|
+
interface AuthMessageResult {
|
|
1762
|
+
messageScheme: SenderAuthMessageScheme;
|
|
1763
|
+
messageHash: string;
|
|
1764
|
+
messagePrehash: string;
|
|
1765
|
+
}
|
|
1766
|
+
/**
|
|
1767
|
+
* Chain-specific overrides for the request-body contract fields
|
|
1768
|
+
* (`quote_selector`, `fulfillment_verifier`). Some chains must rewrite the raw
|
|
1769
|
+
* /defaults values before they go on the wire — e.g. Tron normalizes base58
|
|
1770
|
+
* (`T…`) addresses to the canonical 20-byte hex the on-chain verifier and the
|
|
1771
|
+
* signed permit witness use. A chain that needs no rewrite returns undefined
|
|
1772
|
+
* and the caller falls back to the raw defaults. Applied identically on the
|
|
1773
|
+
* payment and quote paths, so their contract fields never diverge.
|
|
1774
|
+
*/
|
|
1775
|
+
interface ContractFieldOverrides {
|
|
1776
|
+
quote_selector?: string;
|
|
1777
|
+
fulfillment_verifier?: {
|
|
1778
|
+
account: string;
|
|
1779
|
+
endpoint: string;
|
|
1780
|
+
};
|
|
1781
|
+
}
|
|
1782
|
+
/**
|
|
1783
|
+
* Chain adapter that handles all chain-specific logic:
|
|
1784
|
+
* message building (SDK), key formatting, and signing (CLI).
|
|
1785
|
+
*/
|
|
1786
|
+
interface ChainAdapter {
|
|
1787
|
+
/**
|
|
1788
|
+
* Turnkey account address format (e.g. `ADDRESS_FORMAT_ETHEREUM`), used to map a
|
|
1789
|
+
* wallet account back to this chain's namespace.
|
|
1790
|
+
*/
|
|
1791
|
+
turnkeyAddressFormat: string;
|
|
1792
|
+
/**
|
|
1793
|
+
* Build the sender_auth message (hash + prehash). May be async: the Solana
|
|
1794
|
+
* adapter reads the on-chain cluster clock to ground `issued_at`.
|
|
1795
|
+
*/
|
|
1796
|
+
buildAuthMessage(params: {
|
|
1797
|
+
sourceAsset: string;
|
|
1798
|
+
depositor: string;
|
|
1799
|
+
fulfillmentAmount: string;
|
|
1800
|
+
requestId: string;
|
|
1801
|
+
sourceDefaults: ChainDefaults;
|
|
1802
|
+
deadlineSeconds?: number;
|
|
1803
|
+
/** Solana-only: override the RPC used to read the cluster clock for issued_at. */
|
|
1804
|
+
solanaRpcUrl?: string;
|
|
1805
|
+
/** Solana-only: injectable clock reader, primarily a test seam. */
|
|
1806
|
+
solanaClockReader?: SolanaClusterUnixTimeReader;
|
|
1807
|
+
/** Solana-only: optional logger; warns if the cluster clock read fails and issued_at falls back to the wall clock. */
|
|
1808
|
+
solanaLogger?: Logger;
|
|
1809
|
+
}): Promise<AuthMessageResult>;
|
|
1810
|
+
/**
|
|
1811
|
+
* Resolve chain-specific overrides for the request-body contract fields
|
|
1812
|
+
* (`quote_selector`, `fulfillment_verifier`). Both preparePaymentRequest and
|
|
1813
|
+
* prepareQuoteRequest resolve these fields through this one method, so the
|
|
1814
|
+
* payment and quote paths always carry byte-identical contract fields.
|
|
1815
|
+
* Returns undefined when the chain needs no rewrite (EVM); Tron normalizes
|
|
1816
|
+
* base58 → canonical hex.
|
|
1817
|
+
*/
|
|
1818
|
+
resolveContractOverrides?(sourceDefaults: ChainDefaults): ContractFieldOverrides | undefined;
|
|
1819
|
+
/** Normalize private key format for this chain. */
|
|
1820
|
+
formatPrivateKey(key: string): string;
|
|
1821
|
+
/**
|
|
1822
|
+
* Reject a malformed raw key value-free (throwing `Invalid private key`)
|
|
1823
|
+
* before it reaches the chain's signing library. Chains whose key decoding
|
|
1824
|
+
* already fails without echoing the key (e.g. Solana's bs58/length checks)
|
|
1825
|
+
* omit this; EVM/Tron implement it because `ethers.Wallet` embeds the key
|
|
1826
|
+
* value verbatim in its error for malformed input.
|
|
1827
|
+
*/
|
|
1828
|
+
validatePrivateKey?(key: string): void;
|
|
1829
|
+
/**
|
|
1830
|
+
* Sign a sender-auth signed_messages[i] entry, returning a 0x-prefixed
|
|
1831
|
+
* hex signature. The adapter chooses the appropriate signing scheme
|
|
1832
|
+
* based on its chain:
|
|
1833
|
+
* - EVM: EIP-712 typed-data signing over signedMessage.message_prehash
|
|
1834
|
+
* (which is shaped to be a direct ethers.signTypedData arg set).
|
|
1835
|
+
* - Tron: TIP-712 typed-data signing (chain-specific quirks).
|
|
1836
|
+
* - Solana: ed25519 over a chain-specific canonicalized digest.
|
|
1837
|
+
*/
|
|
1838
|
+
sign(signedMessage: SignedMessage, privateKey: string): Promise<string>;
|
|
1839
|
+
/**
|
|
1840
|
+
* Derive the base58 public key of the signing key, for chains whose signatures
|
|
1841
|
+
* are NOT public-key-recoverable and must therefore ship the signer's pubkey
|
|
1842
|
+
* alongside the signature. Solana (Ed25519) implements this; EVM/Tron do not
|
|
1843
|
+
* (secp256k1 signatures are recoverable via ecrecover, so the verifier derives
|
|
1844
|
+
* the signer from the signature itself). The result is attached to
|
|
1845
|
+
* sender_auth.signed_messages[0].payload.delegate_signer so the settler can feed
|
|
1846
|
+
* it to the on-chain Ed25519 verify instruction.
|
|
1847
|
+
*/
|
|
1848
|
+
deriveDelegateSigner?(privateKey: string): string;
|
|
1849
|
+
/**
|
|
1850
|
+
* Assert the private key derives `address`, so a wrong key/sender pair fails
|
|
1851
|
+
* fast (mirrors the Turnkey pinnedAddress check) instead of signing as the
|
|
1852
|
+
* wrong depositor and only failing downstream. Throws on mismatch. The error
|
|
1853
|
+
* names the addresses (public) but never the key.
|
|
1854
|
+
*/
|
|
1855
|
+
verifyAddressMatchesKey?(privateKey: string, address: string): void;
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
/** Result of signing a sender_auth message. */
|
|
1859
|
+
interface SenderSignature {
|
|
1860
|
+
/** 0x-prefixed signature hex (65-byte secp256k1 for EVM/Tron, 64-byte ed25519 for Solana). */
|
|
1861
|
+
signature: string;
|
|
1862
|
+
/**
|
|
1863
|
+
* base58 signer public key for non-recoverable schemes (Solana), attached to
|
|
1864
|
+
* the signed message's payload.delegate_signer. Absent for EVM/Tron, whose
|
|
1865
|
+
* secp256k1 signatures are recoverable.
|
|
1866
|
+
*/
|
|
1867
|
+
delegateSigner?: string;
|
|
1868
|
+
}
|
|
1869
|
+
/** Signs a single sender_auth signed message for a payment request. */
|
|
1870
|
+
interface SenderSigner {
|
|
1871
|
+
sign(signedMessage: SignedMessage): Promise<SenderSignature>;
|
|
1872
|
+
}
|
|
1873
|
+
/** Turnkey provider configuration (shared by the SDK and the CLI env loader). */
|
|
1874
|
+
interface TurnkeyConfig {
|
|
1875
|
+
organizationId: string;
|
|
1876
|
+
walletId: string;
|
|
1877
|
+
apiPublicKey: string;
|
|
1878
|
+
apiPrivateKey: string;
|
|
1879
|
+
/**
|
|
1880
|
+
* Chain-native address the signer is expected to resolve to. Verified against
|
|
1881
|
+
* the address Turnkey returns at initialize(); a mismatch fails fast rather
|
|
1882
|
+
* than signing as the wrong depositor.
|
|
1883
|
+
*/
|
|
1884
|
+
pinnedAddress?: string;
|
|
1885
|
+
/**
|
|
1886
|
+
* Optional observability threaded to the Turnkey network path (default noop).
|
|
1887
|
+
* SDK consumers can wire their own logger and meter; the CLI leaves them unset.
|
|
1888
|
+
*/
|
|
1889
|
+
logger?: Logger;
|
|
1890
|
+
meter?: Meter;
|
|
1891
|
+
}
|
|
1892
|
+
/** Options selecting a sender-signing provider. Defaults to the private-key provider. */
|
|
1893
|
+
type SenderSignerOptions = {
|
|
1894
|
+
provider?: 'raw';
|
|
1895
|
+
privateKey: string;
|
|
1896
|
+
pinnedAddress?: string;
|
|
1897
|
+
} | ({
|
|
1898
|
+
provider: 'turnkey';
|
|
1899
|
+
} & TurnkeyConfig);
|
|
1900
|
+
|
|
1901
|
+
/**
|
|
1902
|
+
* Private-key sender signer. Delegates to the chain adapter so the local-key
|
|
1903
|
+
* signing path is unchanged. The adapter validates the key in the constructor,
|
|
1904
|
+
* so a malformed EVM/Tron key can't leak via ethers even on direct construction.
|
|
1905
|
+
*/
|
|
1906
|
+
declare class RawSenderSigner implements SenderSigner {
|
|
1907
|
+
private readonly adapter;
|
|
1908
|
+
private readonly privateKey;
|
|
1909
|
+
constructor(adapter: ChainAdapter, privateKey: string);
|
|
1910
|
+
sign(signedMessage: SignedMessage): Promise<SenderSignature>;
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
/** Typed contract for the lazily-loaded ./turnkey-impl module; also the test's conformance target. */
|
|
1914
|
+
interface TurnkeyImplModule {
|
|
1915
|
+
turnkeySign: (chainPrefix: string, cfg: {
|
|
1916
|
+
organizationId: string;
|
|
1917
|
+
walletId: string;
|
|
1918
|
+
apiPublicKey: string;
|
|
1919
|
+
apiPrivateKey: string;
|
|
1920
|
+
pinnedAddress?: string;
|
|
1921
|
+
logger?: Logger;
|
|
1922
|
+
meter?: Meter;
|
|
1923
|
+
}, message: string, messagePrehash: string | undefined) => Promise<SenderSignature>;
|
|
1924
|
+
}
|
|
1925
|
+
/** Turnkey-backed sender signer for a single source chain; the heavy impl is loaded lazily. */
|
|
1926
|
+
declare class TurnkeySenderSigner implements SenderSigner {
|
|
1927
|
+
private readonly chainPrefix;
|
|
1928
|
+
private readonly cfg;
|
|
1929
|
+
private readonly loader;
|
|
1930
|
+
constructor(chainPrefix: string, cfg: TurnkeyConfig, loader?: () => Promise<TurnkeyImplModule>);
|
|
1931
|
+
sign(signedMessage: SignedMessage): Promise<SenderSignature>;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
/**
|
|
1935
|
+
* Build a SenderSigner for the given CAIP-2 source chain. Defaults to the
|
|
1936
|
+
* private-key provider (unchanged local signing); pass
|
|
1937
|
+
* `{ provider: 'turnkey', ... }` to sign the sender_auth message via a Turnkey
|
|
1938
|
+
* wallet instead.
|
|
1939
|
+
*/
|
|
1940
|
+
declare function createSenderSigner(sourceChainId: string, opts: SenderSignerOptions): SenderSigner;
|
|
1941
|
+
/**
|
|
1942
|
+
* Resolve a Turnkey wallet's sender addresses keyed by CAIP-2 namespace, in one
|
|
1943
|
+
* query. The Turnkey impl is loaded lazily so a plain SDK import stays free of
|
|
1944
|
+
* @solana/web3.js.
|
|
1945
|
+
*/
|
|
1946
|
+
declare function resolveTurnkeyAddresses(cfg: TurnkeyConfig): Promise<Record<string, string>>;
|
|
1947
|
+
|
|
1948
|
+
declare const $AuthorizationResult: {
|
|
1949
|
+
readonly type: "object";
|
|
1950
|
+
readonly description: "The result of a counterparty authorization request. Contains either\nthe PSP's authorization decision (authorized/declined with proof) or\nan error indicating why authorization could not be completed.\n";
|
|
1951
|
+
readonly required: readonly ["payment_id", "counterparty_did", "status"];
|
|
1952
|
+
readonly properties: {
|
|
1953
|
+
readonly payment_id: {
|
|
1954
|
+
readonly type: "string";
|
|
1955
|
+
readonly description: "Correlation key for this authorization";
|
|
1956
|
+
readonly example: "0x1234abcd";
|
|
1957
|
+
};
|
|
1958
|
+
readonly counterparty_did: {
|
|
1959
|
+
readonly type: "string";
|
|
1960
|
+
readonly description: "The beneficiary PSP's DID";
|
|
1961
|
+
readonly example: "did:pkh:eip155:1:0xdeadbeef";
|
|
1962
|
+
};
|
|
1963
|
+
readonly status: {
|
|
1964
|
+
readonly type: "string";
|
|
1965
|
+
readonly description: "Authorization outcome. \"authorized\" or \"declined\" when the PSP responded.\n\"error\" or \"timeout\" when the authorization could not be completed.\n";
|
|
1966
|
+
readonly enum: readonly ["authorized", "declined", "error", "timeout"];
|
|
1967
|
+
readonly example: "authorized";
|
|
1968
|
+
};
|
|
1969
|
+
readonly authorization_response: {
|
|
1970
|
+
readonly type: "object";
|
|
1971
|
+
readonly description: "The PSP's raw authorization response (present when status is authorized or declined)";
|
|
1972
|
+
readonly additionalProperties: true;
|
|
1973
|
+
};
|
|
1974
|
+
readonly error_code: {
|
|
1975
|
+
readonly type: "string";
|
|
1976
|
+
readonly description: "Machine-readable error code (present when status is error or timeout).\nThe counterparty and webhook codes (COUNTERPARTY_NOT_FOUND, COUNTERPARTY_TIMEOUT,\nWEBHOOK_ERROR, WEBHOOK_CONNECTION_ERROR, INTERNAL_ERROR) mirror the AuthorizationErrorCode\nprotobuf enum. GATEWAY_TIMEOUT, PROOF_INVALID, and PROOF_STALE are produced by payment-gw\nitself and have no protobuf equivalent.\n";
|
|
1977
|
+
readonly enum: readonly ["COUNTERPARTY_NOT_FOUND", "COUNTERPARTY_TIMEOUT", "WEBHOOK_ERROR", "WEBHOOK_CONNECTION_ERROR", "INTERNAL_ERROR", "GATEWAY_TIMEOUT", "PROOF_INVALID", "PROOF_STALE"];
|
|
1978
|
+
readonly 'x-enum-description': "The counterparty and webhook codes mirror the AuthorizationErrorCode protobuf enum\n(without the AUTHORIZATION_ERROR_CODE_ prefix for readability in HTTP responses).\nGATEWAY_TIMEOUT, PROOF_INVALID, and PROOF_STALE are payment-gw-local codes with no protobuf equivalent.\n";
|
|
1979
|
+
};
|
|
1980
|
+
readonly error_message: {
|
|
1981
|
+
readonly type: "string";
|
|
1982
|
+
readonly description: "Human-readable error description";
|
|
1983
|
+
};
|
|
1984
|
+
readonly webhook_http_status: {
|
|
1985
|
+
readonly type: "integer";
|
|
1986
|
+
readonly description: "HTTP status code from the PSP webhook (only for WEBHOOK_ERROR)";
|
|
1987
|
+
};
|
|
1988
|
+
};
|
|
1989
|
+
};
|
|
1990
|
+
declare const $PaymentRequest: {
|
|
1991
|
+
readonly type: "object";
|
|
1992
|
+
readonly description: "Structured payment request with sender authorization and optional W3C Verifiable Credentials";
|
|
1993
|
+
readonly required: readonly ["version", "request_id", "source", "destination", "fulfillment_amount", "sender_auth", "quote_deadline", "fulfillment_deadline"];
|
|
1994
|
+
readonly properties: {
|
|
1995
|
+
readonly version: {
|
|
1996
|
+
readonly type: "string";
|
|
1997
|
+
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";
|
|
1998
|
+
readonly pattern: "^1\\.[0-9]+$";
|
|
1999
|
+
readonly example: "1.0";
|
|
2000
|
+
};
|
|
2001
|
+
readonly request_id: {
|
|
2002
|
+
readonly type: "string";
|
|
2003
|
+
readonly description: "Unique identifier for this payment request (used for idempotency)";
|
|
2004
|
+
readonly example: "req_123456789";
|
|
2005
|
+
};
|
|
2006
|
+
readonly source: {
|
|
2007
|
+
readonly $ref: "#/components/schemas/OwnedAsset";
|
|
2008
|
+
};
|
|
2009
|
+
readonly destination: {
|
|
2010
|
+
readonly type: "array";
|
|
2011
|
+
readonly description: "Array of destination assets for the settlement agent to choose from (at least one required)";
|
|
2012
|
+
readonly minItems: 1;
|
|
2013
|
+
readonly items: {
|
|
2014
|
+
readonly $ref: "#/components/schemas/OwnedAsset";
|
|
2015
|
+
};
|
|
2016
|
+
};
|
|
2017
|
+
readonly fulfillment_amount: {
|
|
2018
|
+
readonly type: "string";
|
|
2019
|
+
readonly description: "The exact amount to be received at the destination (in the smallest unit, e.g., wei for ETH, cents for USD).\n";
|
|
2020
|
+
readonly example: "1000000";
|
|
2021
|
+
};
|
|
2022
|
+
readonly max_source_amount: {
|
|
2023
|
+
readonly type: "string";
|
|
2024
|
+
readonly description: "The maximum amount willing to be spent from the source (in the smallest unit).\n";
|
|
2025
|
+
readonly example: "1000000";
|
|
2026
|
+
};
|
|
2027
|
+
readonly quote_deadline: {
|
|
2028
|
+
readonly type: "string";
|
|
2029
|
+
readonly format: "date-time";
|
|
2030
|
+
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";
|
|
2031
|
+
readonly example: "2024-12-25T10:30:00Z";
|
|
2032
|
+
};
|
|
2033
|
+
readonly fulfillment_deadline: {
|
|
2034
|
+
readonly type: "string";
|
|
2035
|
+
readonly format: "date-time";
|
|
2036
|
+
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";
|
|
2037
|
+
readonly example: "2024-12-25T11:00:00Z";
|
|
2038
|
+
};
|
|
2039
|
+
readonly settler_auth_required: {
|
|
2040
|
+
readonly type: "object";
|
|
2041
|
+
readonly description: "Policy requirements for settler authentication. Keys are policy names, values indicate if the policy is required.\n";
|
|
2042
|
+
readonly additionalProperties: {
|
|
2043
|
+
readonly type: "boolean";
|
|
2044
|
+
};
|
|
2045
|
+
};
|
|
2046
|
+
readonly sender_auth: {
|
|
2047
|
+
readonly $ref: "#/components/schemas/SenderAuth";
|
|
2048
|
+
};
|
|
2049
|
+
readonly originator_auth: {
|
|
2050
|
+
readonly $ref: "#/components/schemas/VerifiableCredentialAuth";
|
|
2051
|
+
};
|
|
2052
|
+
readonly quote_selector: {
|
|
2053
|
+
readonly type: "string";
|
|
2054
|
+
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";
|
|
2055
|
+
readonly example: "0x742d35Cc6634C0532925a3b844Bc9e7595f4136";
|
|
2056
|
+
};
|
|
2057
|
+
readonly fulfillment_verifier: {
|
|
2058
|
+
readonly type: "object";
|
|
2059
|
+
readonly description: "Third-party service that will independently verify your payment was delivered.\nLeave empty to use the default verifier.\n";
|
|
2060
|
+
readonly required: readonly ["account", "endpoint"];
|
|
2061
|
+
readonly properties: {
|
|
2062
|
+
readonly account: {
|
|
2063
|
+
readonly type: "string";
|
|
2064
|
+
readonly description: "The wallet address or public key of the verification service";
|
|
2065
|
+
readonly example: "0x892BB2e4F6b14a2B5b82Ba8d33E5925D42D4431F";
|
|
2066
|
+
};
|
|
2067
|
+
readonly endpoint: {
|
|
2068
|
+
readonly type: "string";
|
|
2069
|
+
readonly format: "uri";
|
|
2070
|
+
readonly description: "The API endpoint URL where the verification service can be reached";
|
|
2071
|
+
readonly example: "https://verifier.atum.network/api/v1/verify";
|
|
2072
|
+
};
|
|
2073
|
+
};
|
|
2074
|
+
};
|
|
2075
|
+
readonly escrow_contract_address: {
|
|
2076
|
+
readonly type: "string";
|
|
2077
|
+
readonly description: "Escrow contract address, used to protect source funds until proof of fulfillment has been verified. Leave empty to use the default.\n";
|
|
2078
|
+
readonly example: "0x742d35Cc6634C0532925a3b844Bc9e7595f4136";
|
|
2079
|
+
};
|
|
2080
|
+
readonly fulfillment_proxy: {
|
|
2081
|
+
readonly type: "string";
|
|
2082
|
+
readonly description: "Fulfillment Proxy contract address, used to emit proof of fulfillment on the destination chain. Leave empty to use the default.\n";
|
|
2083
|
+
readonly example: "0x892BB2e4F6b14a2B5b82Ba8d33E5925D42D4431F";
|
|
2084
|
+
};
|
|
2085
|
+
readonly settler_requirements: {
|
|
2086
|
+
readonly type: "object";
|
|
2087
|
+
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";
|
|
2088
|
+
readonly properties: {
|
|
2089
|
+
readonly whitelist: {
|
|
2090
|
+
readonly type: "array";
|
|
2091
|
+
readonly description: "List of settler DIDs permitted to fulfill this request.\nIf present, only these settlers may win.\nUse W3C DID format.\n";
|
|
2092
|
+
readonly minItems: 1;
|
|
2093
|
+
readonly maxItems: 100;
|
|
2094
|
+
readonly uniqueItems: true;
|
|
2095
|
+
readonly items: {
|
|
2096
|
+
readonly type: "string";
|
|
2097
|
+
readonly pattern: "^did:[a-z][a-z0-9]*:[a-zA-Z0-9._:%-]+$";
|
|
2098
|
+
};
|
|
2099
|
+
readonly example: readonly ["did:pkh:eip155:1:0x742d35Cc6634C0532925a3b844Bc9e7595f4136"];
|
|
2100
|
+
};
|
|
2101
|
+
readonly blacklist: {
|
|
2102
|
+
readonly type: "array";
|
|
2103
|
+
readonly description: "List of settler DIDs excluded from fulfilling this request.\nUse W3C DID format.\n";
|
|
2104
|
+
readonly minItems: 1;
|
|
2105
|
+
readonly maxItems: 100;
|
|
2106
|
+
readonly uniqueItems: true;
|
|
2107
|
+
readonly items: {
|
|
2108
|
+
readonly type: "string";
|
|
2109
|
+
readonly pattern: "^did:[a-z][a-z0-9]*:[a-zA-Z0-9._:%-]+$";
|
|
2110
|
+
};
|
|
2111
|
+
readonly example: readonly ["did:pkh:eip155:1:0x892BB2e4F6b14a2B5b82Ba8d33E5925D42D4432F"];
|
|
2112
|
+
};
|
|
2113
|
+
};
|
|
2114
|
+
};
|
|
2115
|
+
};
|
|
2116
|
+
};
|
|
2117
|
+
declare const $FulfillmentConfirmation: {
|
|
2118
|
+
readonly type: "object";
|
|
2119
|
+
readonly description: "Confirmation details after a payment has been successfully delivered.\nContains proof of delivery and transaction details for both source and destination chains.\n";
|
|
2120
|
+
readonly required: readonly ["payment_id", "request_id", "fulfillment_timestamp", "source_chain_id", "destination_chain_id"];
|
|
2121
|
+
readonly properties: {
|
|
2122
|
+
readonly payment_id: {
|
|
2123
|
+
readonly type: "string";
|
|
2124
|
+
readonly description: "Unique identifier for this payment transaction.\nUse this to track the payment across all systems.\n";
|
|
2125
|
+
readonly example: "0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f";
|
|
2126
|
+
};
|
|
2127
|
+
readonly request_id: {
|
|
2128
|
+
readonly type: "string";
|
|
2129
|
+
readonly description: "Your original request ID that was provided when creating the payment.\nHelps match confirmations to your internal systems.\n";
|
|
2130
|
+
readonly example: "req_123456789";
|
|
2131
|
+
};
|
|
2132
|
+
readonly fulfillment_timestamp: {
|
|
2133
|
+
readonly type: "string";
|
|
2134
|
+
readonly format: "date-time";
|
|
2135
|
+
readonly description: "Timestamp when the fulfillment was completed";
|
|
2136
|
+
};
|
|
2137
|
+
readonly source_chain_id: {
|
|
2138
|
+
readonly type: "string";
|
|
2139
|
+
readonly description: "The blockchain where funds were locked in escrow, using CAIP-2 format.\nCAIP-2 is a standard way to identify blockchains: {namespace}:{reference}\nExamples:\n- \"eip155:1\" for Ethereum mainnet\n- \"eip155:42161\" for Arbitrum\n- \"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp\" for Solana\n- \"tron:mainnet\" for Tron\n";
|
|
2140
|
+
readonly example: "eip155:1";
|
|
2141
|
+
};
|
|
2142
|
+
readonly destination_chain_id: {
|
|
2143
|
+
readonly type: "string";
|
|
2144
|
+
readonly description: "The blockchain where the payment was delivered, using CAIP-2 format.\nCAIP-2 is a standard way to identify blockchains: {namespace}:{reference}\nExamples:\n- \"eip155:1\" for Ethereum mainnet\n- \"eip155:42161\" for Arbitrum\n- \"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp\" for Solana\n- \"tron:mainnet\" for Tron\n";
|
|
2145
|
+
readonly example: "eip155:42161";
|
|
2146
|
+
};
|
|
2147
|
+
readonly source_tx_hash: {
|
|
2148
|
+
readonly type: "string";
|
|
2149
|
+
readonly description: "Transaction hash of the escrow reservation on the source chain";
|
|
2150
|
+
readonly example: "0xa1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456";
|
|
2151
|
+
};
|
|
2152
|
+
readonly destination_tx_hash: {
|
|
2153
|
+
readonly type: "string";
|
|
2154
|
+
readonly description: "Transaction hash of the fulfillment on the destination chain";
|
|
2155
|
+
readonly example: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef";
|
|
2156
|
+
};
|
|
2157
|
+
readonly source_block_number: {
|
|
2158
|
+
readonly type: "integer";
|
|
2159
|
+
readonly description: "Block number where the source transaction was confirmed";
|
|
2160
|
+
};
|
|
2161
|
+
readonly destination_block_number: {
|
|
2162
|
+
readonly type: "integer";
|
|
2163
|
+
readonly description: "Block number where the destination transaction was confirmed";
|
|
2164
|
+
};
|
|
2165
|
+
};
|
|
2166
|
+
readonly 'x-go-type': "fulfillmentconfirmation.SchemaJson";
|
|
2167
|
+
readonly 'x-go-type-import': {
|
|
2168
|
+
readonly name: "fulfillmentconfirmation";
|
|
2169
|
+
readonly path: "github.com/atum-labs/protocol/schemas/apis/fulfillment-confirmation/v1/bindings/go";
|
|
2170
|
+
};
|
|
2171
|
+
};
|
|
2172
|
+
declare const $OwnedAsset: {
|
|
2173
|
+
readonly type: "object";
|
|
2174
|
+
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";
|
|
2175
|
+
readonly required: readonly ["asset_identifier", "account"];
|
|
2176
|
+
readonly properties: {
|
|
2177
|
+
readonly asset_identifier: {
|
|
2178
|
+
readonly type: "string";
|
|
2179
|
+
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";
|
|
2180
|
+
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})?$";
|
|
2181
|
+
readonly example: "eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
2182
|
+
};
|
|
2183
|
+
readonly account: {
|
|
2184
|
+
readonly type: "string";
|
|
2185
|
+
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";
|
|
2186
|
+
readonly minLength: 1;
|
|
2187
|
+
readonly maxLength: 128;
|
|
2188
|
+
readonly example: "0x742d35Cc6634C0532925a3b844Bc9e7595f4136";
|
|
2189
|
+
};
|
|
2190
|
+
};
|
|
2191
|
+
};
|
|
2192
|
+
declare const $SenderAuth: {
|
|
2193
|
+
readonly type: "object";
|
|
2194
|
+
readonly description: "Authorization from the asset owner to execute the payment. The exact format depends on \nthe source blockchain's authorization mechanism.\n";
|
|
2195
|
+
readonly required: readonly ["message_scheme", "signed_messages"];
|
|
2196
|
+
readonly properties: {
|
|
2197
|
+
readonly verifiable_credential: {
|
|
2198
|
+
readonly $ref: "#/components/schemas/VerifiableCredentialAuth";
|
|
2199
|
+
};
|
|
2200
|
+
readonly message_scheme: {
|
|
2201
|
+
readonly $ref: "#/components/schemas/SenderAuthMessageScheme";
|
|
2202
|
+
};
|
|
2203
|
+
readonly signed_messages: {
|
|
2204
|
+
readonly type: "array";
|
|
2205
|
+
readonly description: "Array of signed messages (at least one required)";
|
|
2206
|
+
readonly minItems: 1;
|
|
2207
|
+
readonly items: {
|
|
2208
|
+
readonly $ref: "#/components/schemas/SignedMessage";
|
|
2209
|
+
};
|
|
2210
|
+
};
|
|
2211
|
+
};
|
|
2212
|
+
};
|
|
2213
|
+
declare const $SenderAuthMessageScheme: {
|
|
2214
|
+
readonly type: "string";
|
|
2215
|
+
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";
|
|
2216
|
+
readonly enum: readonly ["EVM_PERMIT2", "EVM_PERMIT2_ESCROW", "SOLANA", "TRON"];
|
|
2217
|
+
};
|
|
2218
|
+
declare const $SignedMessage: {
|
|
2219
|
+
readonly type: "object";
|
|
2220
|
+
readonly description: "A message that has been cryptographically signed to prove authorization.\nThe signature proves you control the wallet that's sending funds.\n";
|
|
2221
|
+
readonly required: readonly ["message", "signature"];
|
|
2222
|
+
readonly properties: {
|
|
2223
|
+
readonly message: {
|
|
2224
|
+
readonly type: "string";
|
|
2225
|
+
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";
|
|
2226
|
+
readonly example: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef";
|
|
2227
|
+
};
|
|
2228
|
+
readonly message_prehash: {
|
|
2229
|
+
readonly type: "string";
|
|
2230
|
+
readonly description: "Optional: If 'message' contains a hash, this field contains the original data\nbefore it was hashed. Useful for verification and debugging.\n";
|
|
2231
|
+
readonly example: "{\"permit\":{\"token\":\"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\"amount\":\"1000000\"}}";
|
|
2232
|
+
};
|
|
2233
|
+
readonly signature: {
|
|
2234
|
+
readonly type: "string";
|
|
2235
|
+
readonly description: "The cryptographic signature proving you authorized this message.\nFormat varies by blockchain (hex for EVM/Tron, base58 for Solana).\n";
|
|
2236
|
+
readonly example: "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab1c";
|
|
2237
|
+
};
|
|
2238
|
+
};
|
|
2239
|
+
};
|
|
2240
|
+
declare const $VerifiableCredentialAuth: {
|
|
2241
|
+
readonly type: "object";
|
|
2242
|
+
readonly description: "Optional identity verification using cryptographic credentials.\nRequired when regulatory compliance or KYC verification is needed for the payment.\n";
|
|
2243
|
+
readonly required: readonly ["verifiable_credential", "verification_method_id", "signature"];
|
|
2244
|
+
readonly properties: {
|
|
2245
|
+
readonly verifiable_credential: {
|
|
2246
|
+
readonly $ref: "#/components/schemas/VerifiableCredential";
|
|
2247
|
+
};
|
|
2248
|
+
readonly verification_method_id: {
|
|
2249
|
+
readonly type: "string";
|
|
2250
|
+
readonly description: "Reference to verification method from the DID Document";
|
|
2251
|
+
};
|
|
2252
|
+
readonly signature: {
|
|
2253
|
+
readonly type: "string";
|
|
2254
|
+
readonly description: "Cryptographic signature matching the verification method type";
|
|
2255
|
+
};
|
|
2256
|
+
};
|
|
2257
|
+
};
|
|
2258
|
+
declare const $VerifiableCredential: {
|
|
2259
|
+
readonly type: "object";
|
|
2260
|
+
readonly description: "W3C Verifiable Credential structure conforming to the W3C Verifiable Credentials Data Model v1.1";
|
|
2261
|
+
readonly required: readonly ["@context", "id", "type", "issuer", "issuanceDate", "credentialSubject", "proof"];
|
|
2262
|
+
readonly properties: {
|
|
2263
|
+
readonly '@context': {
|
|
2264
|
+
readonly type: "array";
|
|
2265
|
+
readonly description: "JSON-LD context array, must include 'https://www.w3.org/2018/credentials/v1'";
|
|
2266
|
+
readonly items: {
|
|
2267
|
+
readonly type: "string";
|
|
2268
|
+
};
|
|
2269
|
+
readonly example: readonly ["https://www.w3.org/2018/credentials/v1"];
|
|
2270
|
+
};
|
|
2271
|
+
readonly id: {
|
|
2272
|
+
readonly type: "string";
|
|
2273
|
+
readonly description: "Unique identifier for this credential";
|
|
2274
|
+
};
|
|
2275
|
+
readonly type: {
|
|
2276
|
+
readonly type: "array";
|
|
2277
|
+
readonly description: "Credential types, must include 'VerifiableCredential'";
|
|
2278
|
+
readonly items: {
|
|
2279
|
+
readonly type: "string";
|
|
2280
|
+
};
|
|
2281
|
+
readonly example: readonly ["VerifiableCredential", "KYCVerifiedCredential"];
|
|
2282
|
+
};
|
|
2283
|
+
readonly issuer: {
|
|
2284
|
+
readonly oneOf: readonly [{
|
|
2285
|
+
readonly type: "string";
|
|
2286
|
+
}, {
|
|
2287
|
+
readonly type: "object";
|
|
2288
|
+
}];
|
|
2289
|
+
readonly description: "DID or issuer object of the credential issuer";
|
|
2290
|
+
};
|
|
2291
|
+
readonly issuanceDate: {
|
|
2292
|
+
readonly type: "string";
|
|
2293
|
+
readonly format: "date-time";
|
|
2294
|
+
readonly description: "When the credential was issued";
|
|
2295
|
+
};
|
|
2296
|
+
readonly expirationDate: {
|
|
2297
|
+
readonly type: "string";
|
|
2298
|
+
readonly format: "date-time";
|
|
2299
|
+
readonly description: "When the credential expires";
|
|
2300
|
+
};
|
|
2301
|
+
readonly credentialSubject: {
|
|
2302
|
+
readonly type: "object";
|
|
2303
|
+
readonly description: "Claims about the credential subject (structure varies by issuer)";
|
|
2304
|
+
readonly additionalProperties: true;
|
|
2305
|
+
};
|
|
2306
|
+
readonly credentialStatus: {
|
|
2307
|
+
readonly type: "object";
|
|
2308
|
+
readonly description: "Information for credential revocation checking";
|
|
2309
|
+
readonly additionalProperties: true;
|
|
2310
|
+
};
|
|
2311
|
+
readonly proof: {
|
|
2312
|
+
readonly type: "object";
|
|
2313
|
+
readonly description: "Cryptographic proof of credential integrity";
|
|
2314
|
+
readonly additionalProperties: true;
|
|
2315
|
+
};
|
|
2316
|
+
};
|
|
2317
|
+
};
|
|
2318
|
+
declare const $PaymentResponse: {
|
|
2319
|
+
readonly type: "object";
|
|
2320
|
+
readonly description: "Response from submitting a payment request. If processing completes within 30 seconds,\nthe response will include a fulfillment_confirmation with full settlement details.\nOtherwise, you'll receive a payment_id that you can use to poll the\n/v1/payments/{paymentId}/status endpoint for updates.\n";
|
|
2321
|
+
readonly properties: {
|
|
2322
|
+
readonly payment_id: {
|
|
2323
|
+
readonly type: "string";
|
|
2324
|
+
readonly description: "Unique ID for tracking this payment. Save this to check status later.\n";
|
|
2325
|
+
readonly example: "550e8400-e29b-41d4-a716-446655440000";
|
|
2326
|
+
};
|
|
2327
|
+
readonly fulfillment_confirmation: {
|
|
2328
|
+
readonly $ref: "#/components/schemas/FulfillmentConfirmation";
|
|
2329
|
+
};
|
|
2330
|
+
};
|
|
2331
|
+
};
|
|
2332
|
+
declare const $GetPaymentStatusResponse: {
|
|
2333
|
+
readonly type: "object";
|
|
2334
|
+
readonly properties: {
|
|
2335
|
+
readonly payment_id: {
|
|
2336
|
+
readonly type: "string";
|
|
2337
|
+
readonly description: "The payment ID you're checking status for.\n";
|
|
2338
|
+
readonly example: "550e8400-e29b-41d4-a716-446655440000";
|
|
2339
|
+
};
|
|
2340
|
+
readonly status: {
|
|
2341
|
+
readonly type: "string";
|
|
2342
|
+
readonly enum: readonly ["pending", "completed", "failed", "cancelled"];
|
|
2343
|
+
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";
|
|
2344
|
+
};
|
|
2345
|
+
readonly updated_at: {
|
|
2346
|
+
readonly type: "string";
|
|
2347
|
+
readonly format: "date-time";
|
|
2348
|
+
readonly description: "When the status was last updated";
|
|
2349
|
+
};
|
|
2350
|
+
readonly fulfillment_confirmation: {
|
|
2351
|
+
readonly $ref: "#/components/schemas/FulfillmentConfirmation";
|
|
2352
|
+
};
|
|
2353
|
+
readonly error: {
|
|
2354
|
+
readonly $ref: "#/components/schemas/PaymentError";
|
|
2355
|
+
};
|
|
2356
|
+
};
|
|
2357
|
+
};
|
|
2358
|
+
declare const $PaymentError: {
|
|
2359
|
+
readonly type: "object";
|
|
2360
|
+
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";
|
|
2361
|
+
readonly required: readonly ["code", "message"];
|
|
2362
|
+
readonly properties: {
|
|
2363
|
+
readonly code: {
|
|
2364
|
+
readonly type: "string";
|
|
2365
|
+
readonly description: "Machine-readable error code in SCREAMING_SNAKE_CASE.\nCommon codes:\n- `QUOTE_DEADLINE_EXPIRED`: No settlement quotes received in time\n- `QUOTE_SELECTION_FAILED`: Quotes received but none met requirements\n- `INSUFFICIENT_FUNDS`: Sender wallet has insufficient balance\n- `FULFILLMENT_TIMEOUT`: Settlement agent didn't complete in time\n";
|
|
2366
|
+
readonly example: "QUOTE_DEADLINE_EXPIRED";
|
|
2367
|
+
};
|
|
2368
|
+
readonly message: {
|
|
2369
|
+
readonly type: "string";
|
|
2370
|
+
readonly description: "Human-readable error description with additional context.\n";
|
|
2371
|
+
readonly example: "No quotes received within the auction window";
|
|
2372
|
+
};
|
|
2373
|
+
readonly domain: {
|
|
2374
|
+
readonly type: "string";
|
|
2375
|
+
readonly description: "Service domain where the error originated.\n";
|
|
2376
|
+
readonly enum: readonly ["PAYMENT_GATEWAY", "SOLVER_GATEWAY", "SETTLER_AGENT", "WALLET_ORCHESTRATION", "VERIFICATION_SERVICE", "BLOCKCHAIN", "EXTERNAL_SERVICE"];
|
|
2377
|
+
readonly example: "PAYMENT_GATEWAY";
|
|
2378
|
+
};
|
|
2379
|
+
readonly blockchain_context: {
|
|
2380
|
+
readonly $ref: "#/components/schemas/PaymentBlockchainContext";
|
|
2381
|
+
};
|
|
2382
|
+
};
|
|
2383
|
+
};
|
|
2384
|
+
declare const $PaymentBlockchainContext: {
|
|
2385
|
+
readonly type: "object";
|
|
2386
|
+
readonly description: "Blockchain-specific error context. Only present when the error\noriginated from an on-chain operation (e.g., escrow revert,\nfulfillment failure).\n";
|
|
2387
|
+
readonly properties: {
|
|
2388
|
+
readonly chain_id: {
|
|
2389
|
+
readonly type: "string";
|
|
2390
|
+
readonly description: "CAIP-2 chain identifier";
|
|
2391
|
+
readonly example: "eip155:42161";
|
|
2392
|
+
};
|
|
2393
|
+
readonly tx_hash: {
|
|
2394
|
+
readonly type: "string";
|
|
2395
|
+
readonly description: "Failed transaction hash";
|
|
2396
|
+
readonly example: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef";
|
|
2397
|
+
};
|
|
2398
|
+
readonly block_number: {
|
|
2399
|
+
readonly type: "integer";
|
|
2400
|
+
readonly description: "Block number where error occurred";
|
|
2401
|
+
readonly example: 12345678;
|
|
2402
|
+
};
|
|
2403
|
+
readonly contract_address: {
|
|
2404
|
+
readonly type: "string";
|
|
2405
|
+
readonly description: "Contract address involved in the error";
|
|
2406
|
+
readonly example: "0x1234567890abcdef1234567890abcdef12345678";
|
|
2407
|
+
};
|
|
2408
|
+
readonly revert_reason: {
|
|
2409
|
+
readonly type: "string";
|
|
2410
|
+
readonly description: "Smart contract revert reason";
|
|
2411
|
+
readonly example: "Insufficient balance";
|
|
2412
|
+
};
|
|
2413
|
+
readonly gas_used: {
|
|
2414
|
+
readonly type: "string";
|
|
2415
|
+
readonly description: "Gas consumed before failure";
|
|
2416
|
+
readonly example: "21000";
|
|
2417
|
+
};
|
|
2418
|
+
readonly estimated_gas_needed: {
|
|
2419
|
+
readonly type: "string";
|
|
2420
|
+
readonly description: "Estimated gas needed for success";
|
|
2421
|
+
readonly example: "50000";
|
|
2422
|
+
};
|
|
2423
|
+
};
|
|
2424
|
+
};
|
|
2425
|
+
declare const $PreparePaymentRequest: {
|
|
2426
|
+
readonly type: "object";
|
|
2427
|
+
readonly description: "Human-readable payment request parameters for generating an unsigned PaymentRequest.\nAsset identifiers use a CAIP-19-like format with \"/\" separator and support friendly names.\n";
|
|
2428
|
+
readonly required: readonly ["request_id", "source_asset", "source_account", "destination_asset", "destination_account"];
|
|
2429
|
+
readonly properties: {
|
|
2430
|
+
readonly request_id: {
|
|
2431
|
+
readonly type: "string";
|
|
2432
|
+
readonly description: "Unique identifier for tracking this payment request.\nUsed for idempotency and matching responses to requests.\n";
|
|
2433
|
+
readonly example: "req_123456789";
|
|
2434
|
+
};
|
|
2435
|
+
readonly source_asset: {
|
|
2436
|
+
readonly type: "string";
|
|
2437
|
+
readonly description: "Source asset in human-readable CAIP-19-like format: {chain}/{asset}\nSupports both friendly names and full CAIP-19 identifiers:\n- \"ethereum/usdc\" (friendly names)\n- \"eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\" (full CAIP-19)\n";
|
|
2438
|
+
readonly example: "ethereum/usdc";
|
|
2439
|
+
};
|
|
2440
|
+
readonly source_account: {
|
|
2441
|
+
readonly type: "string";
|
|
2442
|
+
readonly description: "Wallet address that will send the payment";
|
|
2443
|
+
readonly example: "0x742d35Cc6634C0532925a3b844Bc9e7595f4136";
|
|
2444
|
+
};
|
|
2445
|
+
readonly destination_asset: {
|
|
2446
|
+
readonly type: "string";
|
|
2447
|
+
readonly description: "Destination asset in human-readable CAIP-19-like format: {chain}/{asset}\nSupports both friendly names and full CAIP-19 identifiers:\n- \"arbitrum/usdc\"\n- \"eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831\"\n";
|
|
2448
|
+
readonly example: "arbitrum/usdc";
|
|
2449
|
+
};
|
|
2450
|
+
readonly destination_account: {
|
|
2451
|
+
readonly type: "string";
|
|
2452
|
+
readonly description: "Wallet address that will receive the payment";
|
|
2453
|
+
readonly example: "0x892BB2e4F6b14a2B5b82Ba8d33E5925D42D4431F";
|
|
2454
|
+
};
|
|
2455
|
+
readonly amount: {
|
|
2456
|
+
readonly type: "string";
|
|
2457
|
+
readonly description: "Simple amount specification in decimal format (e.g., \"1.50\" for $1.50 USDC).\nUse this OR specify both max_source_amount and fulfillment_amount.\nCannot be used together with max_source_amount/fulfillment_amount.\n";
|
|
2458
|
+
readonly example: "1.50";
|
|
2459
|
+
};
|
|
2460
|
+
readonly max_source_amount: {
|
|
2461
|
+
readonly type: "string";
|
|
2462
|
+
readonly description: "Maximum amount willing to spend from source (in decimal format).\nMust be specified together with fulfillment_amount.\nCannot be used together with amount field.\n";
|
|
2463
|
+
readonly example: "1.60";
|
|
2464
|
+
};
|
|
2465
|
+
readonly fulfillment_amount: {
|
|
2466
|
+
readonly type: "string";
|
|
2467
|
+
readonly description: "Exact amount to be fulfilled at destination (in decimal format).\nMust be specified together with max_source_amount.\nCannot be used together with amount field.\n";
|
|
2468
|
+
readonly example: "1.50";
|
|
2469
|
+
};
|
|
2470
|
+
readonly quote_deadline_seconds: {
|
|
2471
|
+
readonly type: "integer";
|
|
2472
|
+
readonly description: "Seconds until quote deadline (from now).\nHow long to wait for settlement provider quotes.\n";
|
|
2473
|
+
readonly default: 10;
|
|
2474
|
+
readonly example: 10;
|
|
2475
|
+
};
|
|
2476
|
+
readonly fulfillment_deadline_seconds: {
|
|
2477
|
+
readonly type: "integer";
|
|
2478
|
+
readonly description: "Seconds until fulfillment deadline (from now).\nFinal deadline for completing the payment.\n";
|
|
2479
|
+
readonly default: 3600;
|
|
2480
|
+
readonly example: 3600;
|
|
2481
|
+
};
|
|
2482
|
+
};
|
|
2483
|
+
};
|
|
2484
|
+
declare const $PreparePaymentResponse: {
|
|
2485
|
+
readonly type: "object";
|
|
2486
|
+
readonly description: "Complete unsigned PaymentRequest ready for signing.\nContains all resolved technical details and typed data ready for signing.\n";
|
|
2487
|
+
readonly required: readonly ["payment_request"];
|
|
2488
|
+
readonly properties: {
|
|
2489
|
+
readonly payment_request: {
|
|
2490
|
+
readonly $ref: "#/components/schemas/PaymentRequest";
|
|
2491
|
+
readonly description: "Complete PaymentRequest with signature field set to null.\nClient should fill in the signature field(s) in\nsender_auth.signed_messages, either by signing the message_hash\nfield in signed_messages or by using typed data signing on the\nmessage_prehash field in signed messages, and then submit the full\nobject to POST /v1/payments.\n";
|
|
2492
|
+
};
|
|
2493
|
+
};
|
|
2494
|
+
};
|
|
2495
|
+
declare const $ResolvePaymentResponse: {
|
|
2496
|
+
readonly type: "object";
|
|
2497
|
+
readonly required: readonly ["payment_id"];
|
|
2498
|
+
readonly properties: {
|
|
2499
|
+
readonly payment_id: {
|
|
2500
|
+
readonly type: "string";
|
|
2501
|
+
readonly description: "The payment ID that corresponds to the given request ID";
|
|
2502
|
+
readonly example: "0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f";
|
|
2503
|
+
};
|
|
2504
|
+
};
|
|
2505
|
+
};
|
|
2506
|
+
declare const $PaymentTimelineResponse: {
|
|
2507
|
+
readonly type: "object";
|
|
2508
|
+
readonly description: "Step-by-step view of a payment's settlement lifecycle. Includes a route\nsummary, a list of steps with timings, and if the payment failed, a\nstructured error describing where and why.\n";
|
|
2509
|
+
readonly required: readonly ["payment_id", "status", "created_at", "updated_at", "steps"];
|
|
2510
|
+
readonly properties: {
|
|
2511
|
+
readonly payment_id: {
|
|
2512
|
+
readonly type: "string";
|
|
2513
|
+
readonly example: "0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f";
|
|
2514
|
+
};
|
|
2515
|
+
readonly status: {
|
|
2516
|
+
readonly type: "string";
|
|
2517
|
+
readonly enum: readonly ["pending", "settling", "completed", "failed", "cancelled"];
|
|
2518
|
+
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";
|
|
2519
|
+
};
|
|
2520
|
+
readonly created_at: {
|
|
2521
|
+
readonly type: "string";
|
|
2522
|
+
readonly format: "date-time";
|
|
2523
|
+
};
|
|
2524
|
+
readonly updated_at: {
|
|
2525
|
+
readonly type: "string";
|
|
2526
|
+
readonly format: "date-time";
|
|
2527
|
+
};
|
|
2528
|
+
readonly total_duration_ms: {
|
|
2529
|
+
readonly type: "integer";
|
|
2530
|
+
readonly format: "int64";
|
|
2531
|
+
readonly description: "Total time from first step to last completed step (only set for terminal states)";
|
|
2532
|
+
};
|
|
2533
|
+
readonly summary: {
|
|
2534
|
+
readonly $ref: "#/components/schemas/PaymentSummary";
|
|
2535
|
+
};
|
|
2536
|
+
readonly error: {
|
|
2537
|
+
readonly $ref: "#/components/schemas/TimelineError";
|
|
2538
|
+
};
|
|
2539
|
+
readonly steps: {
|
|
2540
|
+
readonly type: "array";
|
|
2541
|
+
readonly items: {
|
|
2542
|
+
readonly $ref: "#/components/schemas/TimelineStep";
|
|
2543
|
+
};
|
|
2544
|
+
};
|
|
2545
|
+
};
|
|
2546
|
+
};
|
|
2547
|
+
declare const $PaymentSummary: {
|
|
2548
|
+
readonly type: "object";
|
|
2549
|
+
readonly description: "Top-level context about the payment (parties, assets, amounts)";
|
|
2550
|
+
readonly properties: {
|
|
2551
|
+
readonly source_asset: {
|
|
2552
|
+
readonly type: "string";
|
|
2553
|
+
readonly description: "CAIP-19 identifier of the source asset";
|
|
2554
|
+
readonly example: "eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
2555
|
+
};
|
|
2556
|
+
readonly source_account: {
|
|
2557
|
+
readonly type: "string";
|
|
2558
|
+
readonly example: "0x742d35Cc6634C0532925a3b844Bc9e7595f4136";
|
|
2559
|
+
};
|
|
2560
|
+
readonly dest_asset: {
|
|
2561
|
+
readonly type: "string";
|
|
2562
|
+
readonly example: "eip155:42161/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831";
|
|
2563
|
+
};
|
|
2564
|
+
readonly dest_account: {
|
|
2565
|
+
readonly type: "string";
|
|
2566
|
+
readonly example: "0x892BB2e4F6b14a2B5b82Ba8d33E5925D42D4431F";
|
|
2567
|
+
};
|
|
2568
|
+
readonly fulfillment_amount: {
|
|
2569
|
+
readonly type: "string";
|
|
2570
|
+
readonly description: "Raw fulfillment amount in smallest token units";
|
|
2571
|
+
readonly example: "1000000";
|
|
2572
|
+
};
|
|
2573
|
+
readonly display_amount: {
|
|
2574
|
+
readonly type: "string";
|
|
2575
|
+
readonly description: "Human-readable formatted amount with symbol, e.g. \"1.00 USDC\".\nOnly set when the source asset's decimals are known via the token registry.\n";
|
|
2576
|
+
readonly example: "1.00 USDC";
|
|
2577
|
+
};
|
|
2578
|
+
readonly max_source_amount: {
|
|
2579
|
+
readonly type: "string";
|
|
2580
|
+
readonly description: "Raw max source amount in smallest token units";
|
|
2581
|
+
readonly example: "1005000";
|
|
2582
|
+
};
|
|
2583
|
+
readonly request_id: {
|
|
2584
|
+
readonly type: "string";
|
|
2585
|
+
readonly example: "req_123456789";
|
|
2586
|
+
};
|
|
2587
|
+
};
|
|
2588
|
+
};
|
|
2589
|
+
declare const $TimelineError: {
|
|
2590
|
+
readonly type: "object";
|
|
2591
|
+
readonly description: "Structured error details when a payment has failed";
|
|
2592
|
+
readonly required: readonly ["code", "message"];
|
|
2593
|
+
readonly properties: {
|
|
2594
|
+
readonly code: {
|
|
2595
|
+
readonly type: "string";
|
|
2596
|
+
readonly description: "Machine-readable error code";
|
|
2597
|
+
readonly example: "ESCROW_DEPOSIT_FAILED";
|
|
2598
|
+
};
|
|
2599
|
+
readonly message: {
|
|
2600
|
+
readonly type: "string";
|
|
2601
|
+
readonly description: "Human-readable error description";
|
|
2602
|
+
};
|
|
2603
|
+
readonly domain: {
|
|
2604
|
+
readonly type: "string";
|
|
2605
|
+
readonly description: "Which component reported the error";
|
|
2606
|
+
readonly example: "SETTLER_AGENT";
|
|
2607
|
+
};
|
|
2608
|
+
readonly chain_id: {
|
|
2609
|
+
readonly type: "string";
|
|
2610
|
+
readonly description: "CAIP-2 chain where the error occurred (if on-chain)";
|
|
2611
|
+
readonly example: "eip155:1";
|
|
2612
|
+
};
|
|
2613
|
+
readonly tx_hash: {
|
|
2614
|
+
readonly type: "string";
|
|
2615
|
+
readonly description: "Transaction hash of the failed on-chain attempt (if applicable)";
|
|
2616
|
+
};
|
|
2617
|
+
readonly revert_reason: {
|
|
2618
|
+
readonly type: "string";
|
|
2619
|
+
readonly description: "Smart-contract revert reason (if the error was an on-chain revert)";
|
|
2620
|
+
};
|
|
2621
|
+
};
|
|
2622
|
+
};
|
|
2623
|
+
declare const $TimelineStep: {
|
|
2624
|
+
readonly type: "object";
|
|
2625
|
+
readonly required: readonly ["name", "label", "status"];
|
|
2626
|
+
readonly properties: {
|
|
2627
|
+
readonly name: {
|
|
2628
|
+
readonly type: "string";
|
|
2629
|
+
readonly description: "Name of the step";
|
|
2630
|
+
readonly example: "BID_AWARDED";
|
|
2631
|
+
};
|
|
2632
|
+
readonly label: {
|
|
2633
|
+
readonly type: "string";
|
|
2634
|
+
readonly description: "Human-readable label";
|
|
2635
|
+
readonly example: "Best Bid Selected";
|
|
2636
|
+
};
|
|
2637
|
+
readonly status: {
|
|
2638
|
+
readonly type: "string";
|
|
2639
|
+
readonly enum: readonly ["completed", "in_progress", "pending", "failed", "skipped"];
|
|
2640
|
+
readonly description: "Current status of this step:\n- `completed`: Step finished successfully\n- `in_progress`: Step currently executing\n- `pending`: Step hasn't started yet\n- `failed`: Step errored out\n- `skipped`: Step will never execute because an earlier step failed\n";
|
|
2641
|
+
};
|
|
2642
|
+
readonly timestamp: {
|
|
2643
|
+
readonly type: "string";
|
|
2644
|
+
readonly format: "date-time";
|
|
2645
|
+
readonly description: "When the step completed (if it has)";
|
|
2646
|
+
};
|
|
2647
|
+
readonly duration_ms: {
|
|
2648
|
+
readonly type: "integer";
|
|
2649
|
+
readonly format: "int64";
|
|
2650
|
+
readonly description: "Time this step took, measured from the previous step";
|
|
2651
|
+
};
|
|
2652
|
+
readonly chain_id: {
|
|
2653
|
+
readonly type: "string";
|
|
2654
|
+
readonly description: "CAIP-2 chain this step happened on (if on-chain)";
|
|
2655
|
+
readonly example: "eip155:1";
|
|
2656
|
+
};
|
|
2657
|
+
readonly tx_hash: {
|
|
2658
|
+
readonly type: "string";
|
|
2659
|
+
readonly description: "Transaction hash associated with this step (if on-chain)";
|
|
2660
|
+
};
|
|
2661
|
+
readonly details: {
|
|
2662
|
+
readonly type: "object";
|
|
2663
|
+
readonly description: "Additional step-specific data (e.g. block_number, settler, reason)";
|
|
2664
|
+
readonly additionalProperties: true;
|
|
2665
|
+
};
|
|
2666
|
+
};
|
|
2667
|
+
};
|
|
2668
|
+
declare const $ErrorResponse: {
|
|
2669
|
+
readonly type: "object";
|
|
2670
|
+
readonly properties: {
|
|
2671
|
+
readonly error: {
|
|
2672
|
+
readonly type: "string";
|
|
2673
|
+
readonly description: "Error message";
|
|
2674
|
+
readonly example: "Invalid request: missing required field";
|
|
2675
|
+
};
|
|
2676
|
+
};
|
|
2677
|
+
};
|
|
2678
|
+
declare const $CreateQuoteRequest: {
|
|
2679
|
+
readonly type: "object";
|
|
2680
|
+
readonly description: "Request body for opening a quote-request batch. Structurally the existing PaymentRequest\nwith `sender_auth` omitted (the spend authorization is deferred to the award call); see\nschemas/declarations/PaymentRequest/v1/schema.json.\n";
|
|
2681
|
+
readonly required: readonly ["version", "request_id", "source", "destination", "fulfillment_amount", "quote_deadline", "fulfillment_deadline"];
|
|
2682
|
+
readonly properties: {
|
|
2683
|
+
readonly version: {
|
|
2684
|
+
readonly type: "string";
|
|
2685
|
+
readonly description: "Semver-shaped declaration version (MAJOR.MINOR), locked to major 1 for v1. Producers emit\nthe canonical value exported by the bindings' Version constant.\n";
|
|
2686
|
+
readonly pattern: "^1\\.[0-9]+$";
|
|
2687
|
+
readonly example: "1.0";
|
|
2688
|
+
};
|
|
2689
|
+
readonly request_id: {
|
|
2690
|
+
readonly type: "string";
|
|
2691
|
+
readonly description: "Client-supplied idempotency key for this quote-request. The same request_id from the\nsame originator returns the same quote_request_id. Independent of the award-call request_id.\n";
|
|
2692
|
+
readonly example: "qr-2026-04-29-001";
|
|
2693
|
+
};
|
|
2694
|
+
readonly source: {
|
|
2695
|
+
readonly $ref: "#/components/schemas/OwnedAsset";
|
|
2696
|
+
};
|
|
2697
|
+
readonly destination: {
|
|
2698
|
+
readonly type: "array";
|
|
2699
|
+
readonly description: "Array of destination assets for the settlement agent to choose from (at least one required).";
|
|
2700
|
+
readonly minItems: 1;
|
|
2701
|
+
readonly items: {
|
|
2702
|
+
readonly $ref: "#/components/schemas/OwnedAsset";
|
|
2703
|
+
};
|
|
2704
|
+
};
|
|
2705
|
+
readonly fulfillment_amount: {
|
|
2706
|
+
readonly type: "string";
|
|
2707
|
+
readonly description: "The exact amount to be received at the destination (smallest unit, e.g. wei or cents).";
|
|
2708
|
+
readonly example: "100000000";
|
|
2709
|
+
};
|
|
2710
|
+
readonly max_source_amount: {
|
|
2711
|
+
readonly type: "string";
|
|
2712
|
+
readonly description: "Optional cap on what the originator is willing to spend from source (smallest unit).\nQuotes with source_amount above this are filtered. No cap applied if omitted.\n";
|
|
2713
|
+
readonly example: "101000000";
|
|
2714
|
+
};
|
|
2715
|
+
readonly quote_deadline: {
|
|
2716
|
+
readonly type: "string";
|
|
2717
|
+
readonly format: "date-time";
|
|
2718
|
+
readonly description: "Required. End of the collection window. After this point no new quotes are accepted.\nThe gateway injects no default and never mutates the originator-supplied body, so the\nvalue is carried through verbatim to the award call. It must be supplied and must be in\nthe future. Must be strictly earlier than fulfillment_deadline.\n";
|
|
2719
|
+
readonly example: "2026-04-29T12:00:03Z";
|
|
2720
|
+
};
|
|
2721
|
+
readonly fulfillment_deadline: {
|
|
2722
|
+
readonly type: "string";
|
|
2723
|
+
readonly format: "date-time";
|
|
2724
|
+
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";
|
|
2725
|
+
readonly example: "2026-04-29T12:30:00Z";
|
|
2726
|
+
};
|
|
2727
|
+
readonly settler_auth_required: {
|
|
2728
|
+
readonly type: "object";
|
|
2729
|
+
readonly description: "Policy requirements for settler authentication. Keys are policy names, values indicate if required.";
|
|
2730
|
+
readonly additionalProperties: {
|
|
2731
|
+
readonly type: "boolean";
|
|
2732
|
+
};
|
|
2733
|
+
};
|
|
2734
|
+
readonly originator_auth: {
|
|
2735
|
+
readonly $ref: "#/components/schemas/VerifiableCredentialAuth";
|
|
2736
|
+
};
|
|
2737
|
+
readonly quote_selector: {
|
|
2738
|
+
readonly type: "string";
|
|
2739
|
+
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";
|
|
2740
|
+
readonly example: "0x742d35Cc6634C0532925a3b844Bc9e7595f4136";
|
|
2741
|
+
};
|
|
2742
|
+
readonly fulfillment_verifier: {
|
|
2743
|
+
readonly type: "object";
|
|
2744
|
+
readonly description: "Optional third-party service that independently verifies delivery. Leave empty for the default verifier.";
|
|
2745
|
+
readonly required: readonly ["account", "endpoint"];
|
|
2746
|
+
readonly properties: {
|
|
2747
|
+
readonly account: {
|
|
2748
|
+
readonly type: "string";
|
|
2749
|
+
readonly description: "The wallet address or public key of the verification service";
|
|
2750
|
+
readonly example: "0x892BB2e4F6b14a2B5b82Ba8d33E5925D42D4431F";
|
|
2751
|
+
};
|
|
2752
|
+
readonly endpoint: {
|
|
2753
|
+
readonly type: "string";
|
|
2754
|
+
readonly format: "uri";
|
|
2755
|
+
readonly description: "The API endpoint URL where the verification service can be reached";
|
|
2756
|
+
readonly example: "https://verifier.atum.network/api/v1/verify";
|
|
2757
|
+
};
|
|
2758
|
+
};
|
|
2759
|
+
};
|
|
2760
|
+
readonly escrow_contract_address: {
|
|
2761
|
+
readonly type: "string";
|
|
2762
|
+
readonly description: "Optional escrow contract address. Leave empty to use the default.";
|
|
2763
|
+
readonly example: "0x742d35Cc6634C0532925a3b844Bc9e7595f4136";
|
|
2764
|
+
};
|
|
2765
|
+
readonly fulfillment_proxy: {
|
|
2766
|
+
readonly type: "string";
|
|
2767
|
+
readonly description: "Optional fulfillment-proxy contract address on the destination chain. Leave empty to use the default.";
|
|
2768
|
+
readonly example: "0x892BB2e4F6b14a2B5b82Ba8d33E5925D42D4431F";
|
|
2769
|
+
};
|
|
2770
|
+
readonly settler_requirements: {
|
|
2771
|
+
readonly type: "object";
|
|
2772
|
+
readonly description: "Optional settler filtering. If whitelist is present, only whitelisted settlers may win.\nIf blacklist is present, blacklisted settlers are excluded. Both can be specified;\nblacklist takes precedence (a settler in both is rejected).\n";
|
|
2773
|
+
readonly properties: {
|
|
2774
|
+
readonly whitelist: {
|
|
2775
|
+
readonly type: "array";
|
|
2776
|
+
readonly description: "Settler DIDs permitted to fulfill this request (W3C DID format). If present, only these may win.";
|
|
2777
|
+
readonly minItems: 1;
|
|
2778
|
+
readonly maxItems: 100;
|
|
2779
|
+
readonly uniqueItems: true;
|
|
2780
|
+
readonly items: {
|
|
2781
|
+
readonly type: "string";
|
|
2782
|
+
readonly pattern: "^did:[a-z][a-z0-9]*:[a-zA-Z0-9._:%-]+$";
|
|
2783
|
+
};
|
|
2784
|
+
readonly example: readonly ["did:pkh:eip155:1:0x742d35Cc6634C0532925a3b844Bc9e7595f4136"];
|
|
2785
|
+
};
|
|
2786
|
+
readonly blacklist: {
|
|
2787
|
+
readonly type: "array";
|
|
2788
|
+
readonly description: "Settler DIDs excluded from fulfilling this request (W3C DID format).";
|
|
2789
|
+
readonly minItems: 1;
|
|
2790
|
+
readonly maxItems: 100;
|
|
2791
|
+
readonly uniqueItems: true;
|
|
2792
|
+
readonly items: {
|
|
2793
|
+
readonly type: "string";
|
|
2794
|
+
readonly pattern: "^did:[a-z][a-z0-9]*:[a-zA-Z0-9._:%-]+$";
|
|
2795
|
+
};
|
|
2796
|
+
readonly example: readonly ["did:pkh:eip155:1:0x892BB2e4F6b14a2B5b82Ba8d33E5925D42D4432F"];
|
|
2797
|
+
};
|
|
2798
|
+
};
|
|
2799
|
+
};
|
|
2800
|
+
readonly '@context': {
|
|
2801
|
+
readonly type: "array";
|
|
2802
|
+
readonly description: "Optional JSON-LD context URLs — present when the originator wraps the request in a W3C\nData Integrity envelope so a downstream verifier can recover the signer identity.\n";
|
|
2803
|
+
readonly items: {
|
|
2804
|
+
readonly type: "string";
|
|
2805
|
+
};
|
|
2806
|
+
};
|
|
2807
|
+
readonly proof: {
|
|
2808
|
+
readonly $ref: "#/components/schemas/DataIntegrityProof";
|
|
2809
|
+
};
|
|
2810
|
+
readonly verifiableCredential: {
|
|
2811
|
+
readonly type: "array";
|
|
2812
|
+
readonly description: "Optional document-level W3C Verifiable Credentials (e.g. KnownToAtum about the request producer).";
|
|
2813
|
+
readonly items: {
|
|
2814
|
+
readonly $ref: "#/components/schemas/VerifiableCredential";
|
|
2815
|
+
};
|
|
2816
|
+
};
|
|
2817
|
+
};
|
|
2818
|
+
};
|
|
2819
|
+
declare const $DataIntegrityProof: {
|
|
2820
|
+
readonly type: "object";
|
|
2821
|
+
readonly description: "W3C Data Integrity proof conforming to the Data Integrity 1.0 specification.";
|
|
2822
|
+
readonly required: readonly ["type", "created", "verificationMethod", "proofPurpose"];
|
|
2823
|
+
readonly properties: {
|
|
2824
|
+
readonly type: {
|
|
2825
|
+
readonly type: "string";
|
|
2826
|
+
readonly description: "Proof type identifier (e.g. EcdsaSecp256k1RecoverySignature2020).";
|
|
2827
|
+
readonly example: "EcdsaSecp256k1RecoverySignature2020";
|
|
2828
|
+
};
|
|
2829
|
+
readonly created: {
|
|
2830
|
+
readonly type: "string";
|
|
2831
|
+
readonly format: "date-time";
|
|
2832
|
+
readonly description: "ISO 8601 timestamp when the proof was created.";
|
|
2833
|
+
readonly example: "2026-04-29T12:00:00Z";
|
|
2834
|
+
};
|
|
2835
|
+
readonly verificationMethod: {
|
|
2836
|
+
readonly type: "string";
|
|
2837
|
+
readonly description: "DID URL identifying the verification method.";
|
|
2838
|
+
readonly example: "did:pkh:eip155:42161:0xabc...#blockchainAccountId";
|
|
2839
|
+
};
|
|
2840
|
+
readonly proofPurpose: {
|
|
2841
|
+
readonly type: "string";
|
|
2842
|
+
readonly description: "Purpose of the proof (e.g. assertionMethod, authentication).";
|
|
2843
|
+
readonly example: "assertionMethod";
|
|
2844
|
+
};
|
|
2845
|
+
readonly jws: {
|
|
2846
|
+
readonly type: "string";
|
|
2847
|
+
readonly description: "Detached JWS signature (header..signature format for ES256K-R).";
|
|
2848
|
+
};
|
|
2849
|
+
readonly proofValue: {
|
|
2850
|
+
readonly type: "string";
|
|
2851
|
+
readonly description: "Alternative to jws: base-encoded proof value.";
|
|
2852
|
+
};
|
|
2853
|
+
};
|
|
2854
|
+
};
|
|
2855
|
+
declare const $Quote: {
|
|
2856
|
+
readonly type: "object";
|
|
2857
|
+
readonly description: "One collected quote — the content-hash identifier plus the verbatim settler-signed FulfillmentQuote.";
|
|
2858
|
+
readonly required: readonly ["quote_id", "fulfillment_quote"];
|
|
2859
|
+
readonly properties: {
|
|
2860
|
+
readonly quote_id: {
|
|
2861
|
+
readonly type: "string";
|
|
2862
|
+
readonly description: "Canonical content-hash of the signed quote bytes; identifies the quote server-side at\naward time. Provided as a convenience — the gateway re-derives it from\nbid_award.fulfillment_quote_json.\n";
|
|
2863
|
+
readonly example: "0x4e7f...c2a1";
|
|
2864
|
+
};
|
|
2865
|
+
readonly fulfillment_quote: {
|
|
2866
|
+
readonly type: "object";
|
|
2867
|
+
readonly description: "The settler-signed FulfillmentQuote (structurally the canonical FulfillmentQuote/v1\ndeclaration at https://schemas.atum.network/declarations/FulfillmentQuote/v1), returned\nverbatim as an opaque signed document. A client recomputes quote_hash over the returned\nbytes and verifies the settler signature, then re-embeds them into\nbid_award.fulfillment_quote_json at award. quote_hash is canonicalization-based\n(URDNA2015), so it is stable across JSON key-order/whitespace normalization. The\nreturned bytes are hash-equivalent to, but not necessarily byte-identical with, what the\nsettler emitted (quotes are stored as JSONB, which normalizes on write). The gateway\nstill never re-serializes the quote through a typed struct (that renormalizes timestamp\nvalues and WOULD change quote_hash), so the Go binding exposes it as a raw JSON passthrough.\n";
|
|
2868
|
+
readonly 'x-go-type': "json.RawMessage";
|
|
2869
|
+
};
|
|
2870
|
+
};
|
|
2871
|
+
};
|
|
2872
|
+
declare const $AwardedQuote: {
|
|
2873
|
+
readonly type: "object";
|
|
2874
|
+
readonly description: "A collected quote in the status response, annotated with its award linkage.";
|
|
2875
|
+
readonly required: readonly ["quote_id", "fulfillment_quote"];
|
|
2876
|
+
readonly properties: {
|
|
2877
|
+
readonly quote_id: {
|
|
2878
|
+
readonly type: "string";
|
|
2879
|
+
readonly example: "0x9a3b...e8d4";
|
|
2880
|
+
};
|
|
2881
|
+
readonly fulfillment_quote: {
|
|
2882
|
+
readonly type: "object";
|
|
2883
|
+
readonly description: "The settler-signed FulfillmentQuote (structurally the canonical FulfillmentQuote/v1\ndeclaration at https://schemas.atum.network/declarations/FulfillmentQuote/v1), returned\nverbatim as an opaque signed document. A client recomputes quote_hash over the returned\nbytes and verifies the settler signature, then re-embeds them into\nbid_award.fulfillment_quote_json at award. quote_hash is canonicalization-based\n(URDNA2015), so it is stable across JSON key-order/whitespace normalization. The\nreturned bytes are hash-equivalent to, but not necessarily byte-identical with, what the\nsettler emitted (quotes are stored as JSONB, which normalizes on write). The gateway\nstill never re-serializes the quote through a typed struct (that renormalizes timestamp\nvalues and WOULD change quote_hash), so the Go binding exposes it as a raw JSON passthrough.\n";
|
|
2884
|
+
readonly 'x-go-type': "json.RawMessage";
|
|
2885
|
+
};
|
|
2886
|
+
readonly awarded_payment_id: {
|
|
2887
|
+
readonly type: "string";
|
|
2888
|
+
readonly nullable: true;
|
|
2889
|
+
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";
|
|
2890
|
+
readonly example: "py_9876fedc-ba98-7654-3210-fedcba987654";
|
|
2891
|
+
};
|
|
2892
|
+
};
|
|
2893
|
+
};
|
|
2894
|
+
declare const $AwardedPayment: {
|
|
2895
|
+
readonly type: "object";
|
|
2896
|
+
readonly description: "A (quote_id, payment_id) pair for an awarded quote in a batch.";
|
|
2897
|
+
readonly required: readonly ["quote_id", "payment_id"];
|
|
2898
|
+
readonly properties: {
|
|
2899
|
+
readonly quote_id: {
|
|
2900
|
+
readonly type: "string";
|
|
2901
|
+
readonly example: "0x9a3b...e8d4";
|
|
2902
|
+
};
|
|
2903
|
+
readonly payment_id: {
|
|
2904
|
+
readonly type: "string";
|
|
2905
|
+
readonly example: "py_9876fedc-ba98-7654-3210-fedcba987654";
|
|
2906
|
+
};
|
|
2907
|
+
};
|
|
2908
|
+
};
|
|
2909
|
+
declare const $QuoteRequestResponse: {
|
|
2910
|
+
readonly type: "object";
|
|
2911
|
+
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";
|
|
2912
|
+
readonly required: readonly ["quote_request_id", "status"];
|
|
2913
|
+
readonly properties: {
|
|
2914
|
+
readonly quote_request_id: {
|
|
2915
|
+
readonly type: "string";
|
|
2916
|
+
readonly description: "Gateway-generated resource ID for the batch, used in subsequent status reads and awards.";
|
|
2917
|
+
readonly example: "qr_a1b2c3d4-5678-90ef-1234-567890abcdef";
|
|
2918
|
+
};
|
|
2919
|
+
readonly status: {
|
|
2920
|
+
readonly type: "string";
|
|
2921
|
+
readonly enum: readonly ["collecting", "ready"];
|
|
2922
|
+
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";
|
|
2923
|
+
readonly example: "ready";
|
|
2924
|
+
};
|
|
2925
|
+
readonly source: {
|
|
2926
|
+
readonly $ref: "#/components/schemas/OwnedAsset";
|
|
2927
|
+
};
|
|
2928
|
+
readonly destination: {
|
|
2929
|
+
readonly type: "array";
|
|
2930
|
+
readonly items: {
|
|
2931
|
+
readonly $ref: "#/components/schemas/OwnedAsset";
|
|
2932
|
+
};
|
|
2933
|
+
};
|
|
2934
|
+
readonly fulfillment_amount: {
|
|
2935
|
+
readonly type: "string";
|
|
2936
|
+
readonly example: "100000000";
|
|
2937
|
+
};
|
|
2938
|
+
readonly max_source_amount: {
|
|
2939
|
+
readonly type: "string";
|
|
2940
|
+
readonly example: "101000000";
|
|
2941
|
+
};
|
|
2942
|
+
readonly fulfillment_deadline: {
|
|
2943
|
+
readonly type: "string";
|
|
2944
|
+
readonly format: "date-time";
|
|
2945
|
+
readonly example: "2026-04-29T12:30:00Z";
|
|
2946
|
+
};
|
|
2947
|
+
readonly quote_deadline: {
|
|
2948
|
+
readonly type: "string";
|
|
2949
|
+
readonly format: "date-time";
|
|
2950
|
+
readonly example: "2026-04-29T12:00:03Z";
|
|
2951
|
+
};
|
|
2952
|
+
readonly quotes: {
|
|
2953
|
+
readonly type: "array";
|
|
2954
|
+
readonly description: "Collected quotes. Present when status is `ready` — an empty array if no settler bid.";
|
|
2955
|
+
readonly items: {
|
|
2956
|
+
readonly $ref: "#/components/schemas/Quote";
|
|
2957
|
+
};
|
|
2958
|
+
};
|
|
2959
|
+
};
|
|
2960
|
+
};
|
|
2961
|
+
declare const $QuoteRequestAccepted: {
|
|
2962
|
+
readonly type: "object";
|
|
2963
|
+
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";
|
|
2964
|
+
readonly required: readonly ["quote_request_id", "status"];
|
|
2965
|
+
readonly properties: {
|
|
2966
|
+
readonly quote_request_id: {
|
|
2967
|
+
readonly type: "string";
|
|
2968
|
+
readonly example: "qr_a1b2c3d4-5678-90ef-1234-567890abcdef";
|
|
2969
|
+
};
|
|
2970
|
+
readonly status: {
|
|
2971
|
+
readonly type: "string";
|
|
2972
|
+
readonly enum: readonly ["collecting"];
|
|
2973
|
+
readonly description: "Always `collecting` — collection is in progress server-side.";
|
|
2974
|
+
readonly example: "collecting";
|
|
2975
|
+
};
|
|
2976
|
+
readonly source: {
|
|
2977
|
+
readonly $ref: "#/components/schemas/OwnedAsset";
|
|
2978
|
+
};
|
|
2979
|
+
readonly destination: {
|
|
2980
|
+
readonly type: "array";
|
|
2981
|
+
readonly items: {
|
|
2982
|
+
readonly $ref: "#/components/schemas/OwnedAsset";
|
|
2983
|
+
};
|
|
2984
|
+
};
|
|
2985
|
+
readonly fulfillment_amount: {
|
|
2986
|
+
readonly type: "string";
|
|
2987
|
+
readonly example: "100000000";
|
|
2988
|
+
};
|
|
2989
|
+
readonly max_source_amount: {
|
|
2990
|
+
readonly type: "string";
|
|
2991
|
+
readonly example: "101000000";
|
|
2992
|
+
};
|
|
2993
|
+
readonly fulfillment_deadline: {
|
|
2994
|
+
readonly type: "string";
|
|
2995
|
+
readonly format: "date-time";
|
|
2996
|
+
readonly example: "2026-04-29T12:30:00Z";
|
|
2997
|
+
};
|
|
2998
|
+
readonly quote_deadline: {
|
|
2999
|
+
readonly type: "string";
|
|
3000
|
+
readonly format: "date-time";
|
|
3001
|
+
readonly example: "2026-04-29T12:00:03Z";
|
|
3002
|
+
};
|
|
3003
|
+
};
|
|
3004
|
+
};
|
|
3005
|
+
declare const $QuoteRequestStatusResponse: {
|
|
3006
|
+
readonly type: "object";
|
|
3007
|
+
readonly description: "Response to GET /v1/payments/quote-requests/{quoteRequestId}. The `status` enum describes\nthe quote-request batch lifecycle and is disjoint from the payment-status enum.\n";
|
|
3008
|
+
readonly required: readonly ["quote_request_id", "status"];
|
|
3009
|
+
readonly properties: {
|
|
3010
|
+
readonly quote_request_id: {
|
|
3011
|
+
readonly type: "string";
|
|
3012
|
+
readonly example: "qr_a1b2c3d4-5678-90ef-1234-567890abcdef";
|
|
3013
|
+
};
|
|
3014
|
+
readonly status: {
|
|
3015
|
+
readonly type: "string";
|
|
3016
|
+
readonly enum: readonly ["collecting", "ready", "awarded", "expired"];
|
|
3017
|
+
readonly description: "Derived batch lifecycle, computed at read time (not a stored state machine). Disjoint\nfrom the payment-status enum returned by the award and payment-status endpoints.\n- `collecting` — collection window in progress; `quotes` absent.\n- `ready` — collection complete; none awarded yet; either at least one quote is still\n within its `award_deadline`, or no settler bid (empty `quotes` array — the successful\n \"no quotes available\" result).\n- `awarded` — a quote produced a payment row; no further awards accepted (MVP).\n- `expired` — collection closed, nothing awarded, and every collected quote is now past\n its `award_deadline` (\"quotes lapsed\"). An empty batch is `ready`, not `expired` — the\n two are deliberately distinct (\"no quotes available\" vs \"quotes lapsed\").\n";
|
|
3018
|
+
readonly example: "awarded";
|
|
3019
|
+
};
|
|
3020
|
+
readonly quotes: {
|
|
3021
|
+
readonly type: "array";
|
|
3022
|
+
readonly description: "Collected quotes with award linkage. Absent while status is `collecting`.";
|
|
3023
|
+
readonly items: {
|
|
3024
|
+
readonly $ref: "#/components/schemas/AwardedQuote";
|
|
3025
|
+
};
|
|
3026
|
+
};
|
|
3027
|
+
readonly payments: {
|
|
3028
|
+
readonly type: "array";
|
|
3029
|
+
readonly description: "Flat list of awarded (quote_id, payment_id) pairs. At most one entry under MVP single-award.";
|
|
3030
|
+
readonly items: {
|
|
3031
|
+
readonly $ref: "#/components/schemas/AwardedPayment";
|
|
3032
|
+
};
|
|
3033
|
+
};
|
|
3034
|
+
};
|
|
3035
|
+
};
|
|
3036
|
+
declare const $AwardRequest: {
|
|
3037
|
+
readonly type: "object";
|
|
3038
|
+
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";
|
|
3039
|
+
readonly required: readonly ["request_id", "sender_auth", "bid_award"];
|
|
3040
|
+
readonly properties: {
|
|
3041
|
+
readonly request_id: {
|
|
3042
|
+
readonly type: "string";
|
|
3043
|
+
readonly description: "Client-supplied idempotency key for this award call. Independent of the quote-request's request_id.";
|
|
3044
|
+
readonly example: "award-2026-04-29-001";
|
|
3045
|
+
};
|
|
3046
|
+
readonly sender_auth: {
|
|
3047
|
+
readonly $ref: "#/components/schemas/SenderAuth";
|
|
3048
|
+
};
|
|
3049
|
+
readonly bid_award: {
|
|
3050
|
+
readonly $ref: "#/components/schemas/BidAward";
|
|
3051
|
+
};
|
|
3052
|
+
};
|
|
3053
|
+
};
|
|
3054
|
+
declare const $BidAward: {
|
|
3055
|
+
readonly type: "object";
|
|
3056
|
+
readonly description: "Fully-formed, originator-signed bid award. Mirrors schemas/declarations/BidAward/v1/schema.json.\n`authorization` carries the Escrow reserve-witness signature naming the chosen settler;\n`fulfillment_quote_json` is the verbatim settler-signed quote string received in the quote\nresponse (carrying the settler's proof).\n";
|
|
3057
|
+
readonly required: readonly ["version", "authorization", "fulfillment_quote_json"];
|
|
3058
|
+
readonly properties: {
|
|
3059
|
+
readonly version: {
|
|
3060
|
+
readonly type: "string";
|
|
3061
|
+
readonly pattern: "^1\\.[0-9]+$";
|
|
3062
|
+
readonly description: "Semver-shaped declaration version (MAJOR.MINOR), locked to major 1 for v1. Producers emit\nthe canonical value exported by the bindings' Version constant.\n";
|
|
3063
|
+
readonly example: "1.0";
|
|
3064
|
+
};
|
|
3065
|
+
readonly authorization: {
|
|
3066
|
+
readonly $ref: "#/components/schemas/SignedMessage";
|
|
3067
|
+
};
|
|
3068
|
+
readonly fulfillment_quote_json: {
|
|
3069
|
+
readonly type: "string";
|
|
3070
|
+
readonly description: "The settler-signed FulfillmentQuote received in the quote response, forwarded verbatim.\nVerification is canonicalization-based — the settler's W3C Data Integrity proof is checked\nover the canonicalized form, and `quote_id` is derived as the canonical content-hash — so a\nJSON decode/re-encode that only changes key order or whitespace does not invalidate it.\nClients SHOULD still forward the received bytes as-is rather than rebuild the object; the\nSDK helpers do this and also expose settler-proof verification.\n";
|
|
3071
|
+
};
|
|
3072
|
+
readonly '@context': {
|
|
3073
|
+
readonly type: "array";
|
|
3074
|
+
readonly description: "Optional JSON-LD context URLs when the award is wrapped in a W3C Data Integrity envelope.";
|
|
3075
|
+
readonly items: {
|
|
3076
|
+
readonly type: "string";
|
|
3077
|
+
};
|
|
3078
|
+
};
|
|
3079
|
+
readonly proof: {
|
|
3080
|
+
readonly $ref: "#/components/schemas/DataIntegrityProof";
|
|
3081
|
+
};
|
|
3082
|
+
readonly verifiableCredential: {
|
|
3083
|
+
readonly type: "array";
|
|
3084
|
+
readonly description: "Optional W3C Verifiable Credentials attesting the award producer.";
|
|
3085
|
+
readonly items: {
|
|
3086
|
+
readonly $ref: "#/components/schemas/VerifiableCredential";
|
|
3087
|
+
};
|
|
3088
|
+
};
|
|
3089
|
+
};
|
|
3090
|
+
};
|
|
3091
|
+
declare const $AwardResponse: {
|
|
3092
|
+
readonly type: "object";
|
|
3093
|
+
readonly description: "Synchronous response to POST /v1/payments/awards. The `status` field describes the payment\nlifecycle. Note there are two distinct status surfaces for a Quote-API payment, with\ndifferent vocabularies: (1) this award response (`awarding`/`completed`/…), and\n(2) the separate GET /v1/payments/{paymentId}/status endpoint you poll afterward, which\nreports the same payment under its own values (an in-progress payment reads as `pending`\nthere). Both are disjoint from the quote-request batch status on the quote-request endpoints.\n";
|
|
3094
|
+
readonly required: readonly ["payment_id", "status"];
|
|
3095
|
+
readonly properties: {
|
|
3096
|
+
readonly payment_id: {
|
|
3097
|
+
readonly type: "string";
|
|
3098
|
+
readonly example: "py_9876fedc-ba98-7654-3210-fedcba987654";
|
|
3099
|
+
};
|
|
3100
|
+
readonly status: {
|
|
3101
|
+
readonly type: "string";
|
|
3102
|
+
readonly enum: readonly ["awarding", "completed", "failed", "cancelled"];
|
|
3103
|
+
readonly description: "Payment lifecycle status on the award response:\n- `completed` — settlement finished within the sync wait (includes fulfillment_confirmation).\n- `awarding` — settlement still in progress when the sync cap fired (or on wait=false);\n poll GET /v1/payments/{paymentId}/status.\n- `failed` — settlement reached a terminal failure (e.g. the settler could not fulfill, or\n an on-chain step was rejected).\n- `cancelled` — the payment was terminated before settlement completed and will not proceed.\n`failed` and `cancelled` are terminal states surfaced here only when they occur within the\nsync wait; otherwise the response is `awarding` and the terminal state is read from the\npayment-status endpoint.\n";
|
|
3104
|
+
readonly example: "completed";
|
|
3105
|
+
};
|
|
3106
|
+
readonly fulfillment_confirmation: {
|
|
3107
|
+
readonly $ref: "#/components/schemas/FulfillmentConfirmation";
|
|
3108
|
+
};
|
|
3109
|
+
};
|
|
3110
|
+
};
|
|
3111
|
+
declare const $AwardAccepted: {
|
|
3112
|
+
readonly type: "object";
|
|
3113
|
+
readonly description: "Asynchronous (202) response to POST /v1/payments/awards — just the payment handle.";
|
|
3114
|
+
readonly required: readonly ["payment_id", "status"];
|
|
3115
|
+
readonly properties: {
|
|
3116
|
+
readonly payment_id: {
|
|
3117
|
+
readonly type: "string";
|
|
3118
|
+
readonly example: "py_9876fedc-ba98-7654-3210-fedcba987654";
|
|
3119
|
+
};
|
|
3120
|
+
readonly status: {
|
|
3121
|
+
readonly type: "string";
|
|
3122
|
+
readonly enum: readonly ["awarding"];
|
|
3123
|
+
readonly description: "Always `awarding` — settlement is in progress server-side.";
|
|
3124
|
+
readonly example: "awarding";
|
|
3125
|
+
};
|
|
3126
|
+
};
|
|
3127
|
+
};
|
|
3128
|
+
|
|
3129
|
+
type ApiResult<TData = any> = {
|
|
3130
|
+
readonly body: TData;
|
|
3131
|
+
readonly ok: boolean;
|
|
3132
|
+
readonly status: number;
|
|
3133
|
+
readonly statusText: string;
|
|
3134
|
+
readonly url: string;
|
|
3135
|
+
};
|
|
3136
|
+
|
|
3137
|
+
declare class ApiError extends Error {
|
|
3138
|
+
readonly url: string;
|
|
3139
|
+
readonly status: number;
|
|
3140
|
+
readonly statusText: string;
|
|
3141
|
+
readonly body: unknown;
|
|
3142
|
+
readonly request: ApiRequestOptions;
|
|
3143
|
+
constructor(request: ApiRequestOptions, response: ApiResult, message: string);
|
|
3144
|
+
}
|
|
3145
|
+
|
|
3146
|
+
/**
|
|
3147
|
+
* EVM Permit2 PermitWitnessTransferFrom deposit prehash + EIP-712 digest.
|
|
3148
|
+
*
|
|
3149
|
+
* Byte-for-byte counterpart of the sibling Go encoder (deposit_encoder.go,
|
|
3150
|
+
* `EscrowDepositEncoder`). This is the sender-authorization scheme the Atum
|
|
3151
|
+
* protocol uses on EVM chains: it authorizes Permit2 to move tokens into the
|
|
3152
|
+
* escrow contract, with a DepositWitness {reserver, releaser}.
|
|
3153
|
+
*
|
|
3154
|
+
* The sender signs the digest this produces, and the serialized prehash travels
|
|
3155
|
+
* to the settler as `message_prehash`, so BOTH the digest and the JSON
|
|
3156
|
+
* serialization (top-level key order, and `chainId` as a lowercase hex string
|
|
3157
|
+
* matching the Go encoder's %#x form) must stay pinned to the Go output. See
|
|
3158
|
+
* deposit-encoder.test.ts.
|
|
3159
|
+
*/
|
|
3160
|
+
/**
|
|
3161
|
+
* The Permit2 contract address deployed at the same address on all supported
|
|
3162
|
+
* EVM chains; the EIP-712 domain verifyingContract for PermitWitnessTransferFrom.
|
|
3163
|
+
*/
|
|
3164
|
+
declare const PERMIT2_CONTRACT_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
3165
|
+
interface PermitWitnessTransferFromParams {
|
|
3166
|
+
/** EIP-155 chain ID. */
|
|
3167
|
+
chainId: number;
|
|
3168
|
+
/** The Permit2 contract (PERMIT2_CONTRACT_ADDRESS). */
|
|
3169
|
+
verifyingContract: string;
|
|
3170
|
+
/** TokenPermissions: source token + amount (smallest units, decimal string). */
|
|
3171
|
+
token: string;
|
|
3172
|
+
amount: string;
|
|
3173
|
+
/** The escrow contract address (spender). */
|
|
3174
|
+
spender: string;
|
|
3175
|
+
nonce: bigint;
|
|
3176
|
+
deadline: bigint;
|
|
3177
|
+
/** DepositWitness (V3): reserver (quote selector) + releaser (fulfillment verifier). */
|
|
3178
|
+
reserver: string;
|
|
3179
|
+
releaser: string;
|
|
3180
|
+
}
|
|
3181
|
+
/**
|
|
3182
|
+
* Build the structured prehash for PermitWitnessTransferFrom. The shape is a
|
|
3183
|
+
* direct argument set for `wallet.signTypedData(domain, types, message)`:
|
|
3184
|
+
* - `domain` carries only Permit2's on-chain EIP712Domain fields (name,
|
|
3185
|
+
* chainId, verifyingContract; no `version`, no `salt`).
|
|
3186
|
+
* - `types` omits an EIP712Domain entry (ethers derives it from the domain
|
|
3187
|
+
* object's keys and rejects an explicit one).
|
|
3188
|
+
* - `chainId` is emitted as a lowercase hex string to match the Go encoder's
|
|
3189
|
+
* %#x serialization and the settler's `message_prehash` contract; the EIP-712
|
|
3190
|
+
* digest itself is invariant to the number-vs-hex representation.
|
|
3191
|
+
*/
|
|
3192
|
+
declare function createPermitWitnessTransferFromPrehash(params: PermitWitnessTransferFromParams): {
|
|
3193
|
+
types: {
|
|
3194
|
+
PermitWitnessTransferFrom: {
|
|
3195
|
+
name: string;
|
|
3196
|
+
type: string;
|
|
3197
|
+
}[];
|
|
3198
|
+
TokenPermissions: {
|
|
3199
|
+
name: string;
|
|
3200
|
+
type: string;
|
|
3201
|
+
}[];
|
|
3202
|
+
DepositWitness: {
|
|
3203
|
+
name: string;
|
|
3204
|
+
type: string;
|
|
3205
|
+
}[];
|
|
3206
|
+
};
|
|
3207
|
+
primaryType: string;
|
|
3208
|
+
domain: {
|
|
3209
|
+
name: string;
|
|
3210
|
+
chainId: string;
|
|
3211
|
+
verifyingContract: string;
|
|
3212
|
+
};
|
|
3213
|
+
message: {
|
|
3214
|
+
permitted: {
|
|
3215
|
+
token: string;
|
|
3216
|
+
amount: string;
|
|
3217
|
+
};
|
|
3218
|
+
spender: string;
|
|
3219
|
+
nonce: string;
|
|
3220
|
+
deadline: string;
|
|
3221
|
+
witness: {
|
|
3222
|
+
reserver: string;
|
|
3223
|
+
releaser: string;
|
|
3224
|
+
};
|
|
3225
|
+
};
|
|
3226
|
+
};
|
|
3227
|
+
/**
|
|
3228
|
+
* Hash a PermitWitnessTransferFrom prehash into its EIP-712 digest (0x-prefixed
|
|
3229
|
+
* 32-byte hex). Accepts the object returned by
|
|
3230
|
+
* createPermitWitnessTransferFromPrehash (or an equivalent parsed from JSON).
|
|
3231
|
+
*/
|
|
3232
|
+
declare function hashPermitWitnessTransferFrom(prehash: {
|
|
3233
|
+
domain: any;
|
|
3234
|
+
types: any;
|
|
3235
|
+
message: any;
|
|
3236
|
+
}): string;
|
|
3237
|
+
|
|
3238
|
+
/**
|
|
3239
|
+
* EVM Permit2 PermitWitnessTransferFrom sender-auth scheme.
|
|
3240
|
+
*
|
|
3241
|
+
* The encoder now lives in the shared @atum-labs/evm-escrow-encoding package
|
|
3242
|
+
* (byte-parity with the Go EscrowDepositEncoder). This module re-exports it so
|
|
3243
|
+
* the pg-client public API and the EVM chain adapter keep the same import
|
|
3244
|
+
* surface.
|
|
3245
|
+
*/
|
|
3246
|
+
|
|
3247
|
+
/** Hash a request ID string to a 32-byte identifier. V1 legacy, unused by the V3 deposit witness. */
|
|
3248
|
+
declare function hashRequestId(requestId: string): string;
|
|
3249
|
+
|
|
3250
|
+
/**
|
|
3251
|
+
* Masks a chain ID to 4 bytes for Tron TIP-712 compatibility.
|
|
3252
|
+
*
|
|
3253
|
+
* Tron's EIP-712 implementation uses a 4-byte chain ID (uint32),
|
|
3254
|
+
* unlike EVM which uses the full numeric value.
|
|
3255
|
+
*
|
|
3256
|
+
* @param chainId - The raw chain ID
|
|
3257
|
+
* @returns The chain ID masked to 32 bits (unsigned)
|
|
3258
|
+
*/
|
|
3259
|
+
declare function maskChainId(chainId: number): number;
|
|
3260
|
+
|
|
3261
|
+
/**
|
|
3262
|
+
* Tron address normalization, byte-for-byte faithful to the Go gateway
|
|
3263
|
+
* (tvm_address.go `NormalizeAddress` / `ConvertBase58ToHex`). This is the
|
|
3264
|
+
* originator side where a fat-fingered "T…" address originates, so it must
|
|
3265
|
+
* reject exactly what the on-chain verifier rejects — otherwise a typo'd or
|
|
3266
|
+
* malformed address would be signed here and only fail downstream.
|
|
3267
|
+
*
|
|
3268
|
+
* Shared by the paymentId derivation (payment-id.ts) and the Permit2 deposit
|
|
3269
|
+
* encoder (deposit-encoder.ts), and re-exported for SDK consumers.
|
|
3270
|
+
*/
|
|
3271
|
+
/**
|
|
3272
|
+
* Convert a Tron base58 address (e.g. "TYaKH9ApqbdftVGSnTMPVL9kp1S5AQBQSs") to
|
|
3273
|
+
* its 21-byte hex form (0x41 mainnet prefix ‖ 20-byte address), without a `0x`
|
|
3274
|
+
* prefix. `normalizeAddress` then strips the 0x41 to get the bare 20-byte form
|
|
3275
|
+
* that TIP-712 hashes.
|
|
3276
|
+
*
|
|
3277
|
+
* A Tron base58 address is base58check: 0x41 ‖ 20-byte address ‖ 4-byte
|
|
3278
|
+
* checksum (25 bytes), where the checksum is the first 4 bytes of
|
|
3279
|
+
* sha256(sha256(0x41 ‖ address)). The checksum MUST be validated: the Go
|
|
3280
|
+
* gateway (address.Base58ToAddress) rejects a bad checksum, so accepting one
|
|
3281
|
+
* here would sign a wrong/typo'd address that only fails on-chain later.
|
|
3282
|
+
*/
|
|
3283
|
+
declare function base58ToHex(base58Address: string): string;
|
|
3284
|
+
/**
|
|
3285
|
+
* Normalize a Tron address (base58, or hex with an optional 0x / 0x41 prefix) to
|
|
3286
|
+
* the canonical TIP-712 hex form: 0x-prefixed, 20 bytes (40 hex chars). This is
|
|
3287
|
+
* the wire format `wallet.signTypedData` expects for an `address`.
|
|
3288
|
+
*/
|
|
3289
|
+
declare function normalizeAddress(address: string): string;
|
|
3290
|
+
|
|
3291
|
+
/**
|
|
3292
|
+
* TVM (Tron) Permit2 PermitWitnessTransferFrom deposit prehash + TIP-712 digest.
|
|
3293
|
+
*
|
|
3294
|
+
* Byte-for-byte counterpart of the sibling Go encoder (deposit_encoder.go,
|
|
3295
|
+
* `EscrowDepositEncoder`). Same shape as the EVM deposit encoder, with the
|
|
3296
|
+
* Tron-specific normalization applied here: the chainId is masked to its lower
|
|
3297
|
+
* 4 bytes (Tron's TIP-712 domain uses a uint32 chainId) and every address is
|
|
3298
|
+
* converted from base58 to bare 20-byte hex (0x41 prefix stripped).
|
|
3299
|
+
*
|
|
3300
|
+
* The sender signs the digest this produces, and the serialized prehash travels
|
|
3301
|
+
* to the settler as `message_prehash`, so BOTH the digest and the JSON
|
|
3302
|
+
* serialization (key order, and `chainId` as a lowercase hex string) must stay
|
|
3303
|
+
* pinned to the Go output. See deposit-encoder.test.ts.
|
|
3304
|
+
*
|
|
3305
|
+
* V3: DepositWitness is `{reserver, releaser}` — `requestId` is gone.
|
|
3306
|
+
*/
|
|
3307
|
+
/**
|
|
3308
|
+
* Parameters for a TVM V3 Permit2 deposit prehash. Addresses may be base58 or
|
|
3309
|
+
* hex; they are normalized to bare 20-byte hex internally.
|
|
3310
|
+
*/
|
|
3311
|
+
interface TvmPermitWitnessTransferFromParams {
|
|
3312
|
+
chainId: number;
|
|
3313
|
+
permit2Address: string;
|
|
3314
|
+
tokenAddress: string;
|
|
3315
|
+
amount: string;
|
|
3316
|
+
spenderAddress: string;
|
|
3317
|
+
nonce: bigint;
|
|
3318
|
+
deadline: bigint;
|
|
3319
|
+
reserverAddress: string;
|
|
3320
|
+
releaserAddress: string;
|
|
3321
|
+
}
|
|
3322
|
+
/**
|
|
3323
|
+
* Build the V3 TIP-712 prehash for a Permit2 deposit on Tron, shaped for direct
|
|
3324
|
+
* `wallet.signTypedData(domain, types, message)` consumption:
|
|
3325
|
+
* - `domain` carries only name, chainId (pre-masked, lowercase hex string),
|
|
3326
|
+
* verifyingContract — Permit2's on-chain EIP712Domain has no version/salt.
|
|
3327
|
+
* - `types` omits an EIP712Domain entry (ethers derives it from the domain keys).
|
|
3328
|
+
* - all addresses are hex-normalized (0x41 prefix stripped).
|
|
3329
|
+
*/
|
|
3330
|
+
declare function createTvmPermitWitnessTransferFromPrehash(params: TvmPermitWitnessTransferFromParams): {
|
|
3331
|
+
types: {
|
|
3332
|
+
PermitWitnessTransferFrom: {
|
|
3333
|
+
name: string;
|
|
3334
|
+
type: string;
|
|
3335
|
+
}[];
|
|
3336
|
+
TokenPermissions: {
|
|
3337
|
+
name: string;
|
|
3338
|
+
type: string;
|
|
3339
|
+
}[];
|
|
3340
|
+
DepositWitness: {
|
|
3341
|
+
name: string;
|
|
3342
|
+
type: string;
|
|
3343
|
+
}[];
|
|
3344
|
+
};
|
|
3345
|
+
primaryType: string;
|
|
3346
|
+
domain: {
|
|
3347
|
+
name: string;
|
|
3348
|
+
chainId: string;
|
|
3349
|
+
verifyingContract: string;
|
|
3350
|
+
};
|
|
3351
|
+
message: {
|
|
3352
|
+
permitted: {
|
|
3353
|
+
token: string;
|
|
3354
|
+
amount: string;
|
|
3355
|
+
};
|
|
3356
|
+
spender: string;
|
|
3357
|
+
nonce: string;
|
|
3358
|
+
deadline: string;
|
|
3359
|
+
witness: {
|
|
3360
|
+
reserver: string;
|
|
3361
|
+
releaser: string;
|
|
3362
|
+
};
|
|
3363
|
+
};
|
|
3364
|
+
};
|
|
3365
|
+
/**
|
|
3366
|
+
* Hash a TVM Permit2 prehash into its TIP-712 digest (0x-prefixed 32-byte hex).
|
|
3367
|
+
* The Tron-specific work (chainId mask, address normalization) already happened
|
|
3368
|
+
* in createTvmPermitWitnessTransferFromPrehash.
|
|
3369
|
+
*/
|
|
3370
|
+
declare function hashTvmPermitWitnessTransferFrom(prehash: {
|
|
3371
|
+
domain: any;
|
|
3372
|
+
types: any;
|
|
3373
|
+
message: any;
|
|
3374
|
+
}): string;
|
|
3375
|
+
|
|
3376
|
+
/**
|
|
3377
|
+
* Encodes a bigint as 8-byte little-endian Uint8Array.
|
|
3378
|
+
* This matches Solana/Borsh convention and Rust's `to_le_bytes()`.
|
|
3379
|
+
*/
|
|
3380
|
+
declare function encodeU64LE(value: bigint): Uint8Array;
|
|
3381
|
+
|
|
3382
|
+
declare const MAX_VALID_SLOT: number;
|
|
3383
|
+
|
|
3384
|
+
/**
|
|
3385
|
+
* Solana deposit message sender auth scheme implementation.
|
|
3386
|
+
*
|
|
3387
|
+
* This module provides utilities for creating and hashing Solana deposit
|
|
3388
|
+
* authorization messages for the Atum payment gateway.
|
|
3389
|
+
*
|
|
3390
|
+
* The deposit message is a 199-byte binary structure hashed with Keccak-256:
|
|
3391
|
+
* keccak256("deposit" || payment_id[32] || depositor[32] || mint[32] ||
|
|
3392
|
+
* amount[8,LE] || reserver[32] || releaser[32] ||
|
|
3393
|
+
* nonce[8,LE] || issued_at[8,LE] || deadline[8,LE])
|
|
3394
|
+
*
|
|
3395
|
+
* encodeU64LE, generateSolanaNonce (generateNonce), and MAX_VALID_SLOT are
|
|
3396
|
+
* imported from the shared @atum-labs/solana-escrow-encoding package and
|
|
3397
|
+
* re-exported here to preserve the public API. The V1 hashSolanaDeposit,
|
|
3398
|
+
* base58ToBytes, payment-id generation, and prehash creation stay local: the
|
|
3399
|
+
* package has no non-domain-separated V1 hash, and the local base58/hex helpers
|
|
3400
|
+
* carry the exact error messages the client tests assert. The V3 deposit hash
|
|
3401
|
+
* already delegates to the package (hashSolanaDepositV3 → computeDepositHash).
|
|
3402
|
+
*
|
|
3403
|
+
* The canonical reference is the @atum-labs/solana-escrow-encoding package in
|
|
3404
|
+
* this repo (contracts/svm/escrow-encoding), the TypeScript sibling of the
|
|
3405
|
+
* on-chain Solana escrow program and the Go signing library.
|
|
3406
|
+
*/
|
|
3407
|
+
|
|
3408
|
+
/** Replay horizon in seconds — deposit deadline must be within this window of issuedAt. */
|
|
3409
|
+
declare const REPLAY_HORIZON_SECS = 128;
|
|
3410
|
+
/** Total number of replay-protection buckets. */
|
|
3411
|
+
declare const TOTAL_BUCKETS = 131072;
|
|
3412
|
+
/** Exact byte size of a serialized deposit message (7 + 32*5 + 8*3). */
|
|
3413
|
+
declare const DEPOSIT_MESSAGE_SIZE = 199;
|
|
3414
|
+
/**
|
|
3415
|
+
* Parameters for constructing a Solana deposit authorization message.
|
|
3416
|
+
*/
|
|
3417
|
+
interface SolanaDepositParams {
|
|
3418
|
+
/** Base58 Solana public key of the depositor. */
|
|
3419
|
+
depositor: string;
|
|
3420
|
+
/** Base58 SPL token mint address. */
|
|
3421
|
+
mint: string;
|
|
3422
|
+
/** Token amount in smallest units (uint64). */
|
|
3423
|
+
amount: bigint;
|
|
3424
|
+
/** Base58 public key authorized to reserve funds (quote selector). */
|
|
3425
|
+
reserver: string;
|
|
3426
|
+
/** Base58 public key authorized to release/refund funds (fulfillment verifier). */
|
|
3427
|
+
releaser: string;
|
|
3428
|
+
/** Replay protection nonce (uint64). */
|
|
3429
|
+
nonce: bigint;
|
|
3430
|
+
/** Unix timestamp (seconds) when the authorization was created (uint64). */
|
|
3431
|
+
issuedAt: bigint;
|
|
3432
|
+
/** Unix timestamp (seconds) when the deposit authorization expires (uint64). */
|
|
3433
|
+
deadline: bigint;
|
|
3434
|
+
/** Original request ID string (used for payment ID generation). */
|
|
3435
|
+
requestId: string;
|
|
3436
|
+
}
|
|
3437
|
+
/**
|
|
3438
|
+
* Decodes a Base58-encoded Solana public key to a 32-byte Uint8Array. Kept local
|
|
3439
|
+
* rather than using Pubkey.fromBase58: the client tests assert this exact
|
|
3440
|
+
* "Invalid Solana public key length" message.
|
|
3441
|
+
*/
|
|
3442
|
+
declare function base58ToBytes(address: string): Uint8Array;
|
|
3443
|
+
/**
|
|
3444
|
+
* Converts a Uint8Array to a 0x-prefixed hex string.
|
|
3445
|
+
*/
|
|
3446
|
+
declare function bytesToHex(bytes: Uint8Array): string;
|
|
3447
|
+
/**
|
|
3448
|
+
* Converts a hex string (with or without 0x prefix) to a Uint8Array.
|
|
3449
|
+
*/
|
|
3450
|
+
declare function hexToBytes(hex: string): Uint8Array;
|
|
3451
|
+
/**
|
|
3452
|
+
* Generates a 32-byte payment ID from the request ID and deposit parameters.
|
|
3453
|
+
*
|
|
3454
|
+
* Formula: keccak256(requestId_str || "deposit" || depositor[32] ||
|
|
3455
|
+
* amount[8,LE] || reserver[32] || releaser[32] ||
|
|
3456
|
+
* nonce[8,LE] || issuedAt[8,LE] || deadline[8,LE])
|
|
3457
|
+
*
|
|
3458
|
+
* TODO: the V3 gateway simplified this to
|
|
3459
|
+
* just keccak256(requestID). When we migrate to v3, this function should change
|
|
3460
|
+
* to: return keccak256(toUtf8Bytes(requestId)); and the params argument can be
|
|
3461
|
+
* removed. The gateway reads payment_id from the prehash so both approaches work.
|
|
3462
|
+
*
|
|
3463
|
+
* @returns 0x-prefixed hex string (32 bytes)
|
|
3464
|
+
*/
|
|
3465
|
+
declare function generateSolanaPaymentId(requestId: string, params: Omit<SolanaDepositParams, 'requestId'>): string;
|
|
3466
|
+
/**
|
|
3467
|
+
* Prehash structure for a Solana deposit message.
|
|
3468
|
+
* Uses base58 addresses and string numbers for settler parsing.
|
|
3469
|
+
*/
|
|
3470
|
+
interface SolanaDepositPrehash {
|
|
3471
|
+
payment_id: string;
|
|
3472
|
+
depositor: string;
|
|
3473
|
+
mint: string;
|
|
3474
|
+
amount: string;
|
|
3475
|
+
reserver: string;
|
|
3476
|
+
releaser: string;
|
|
3477
|
+
nonce: string;
|
|
3478
|
+
issued_at: string;
|
|
3479
|
+
deadline: string;
|
|
3480
|
+
}
|
|
3481
|
+
/**
|
|
3482
|
+
* Creates the JSON prehash structure for a Solana deposit message.
|
|
3483
|
+
* The prehash contains base58 addresses and string numbers, matching the
|
|
3484
|
+
* format the settler agent expects in `message_prehash`.
|
|
3485
|
+
*
|
|
3486
|
+
* @param paymentId 0x-prefixed hex string (32 bytes) from generateSolanaPaymentId()
|
|
3487
|
+
* @param params The deposit parameters
|
|
3488
|
+
* @returns The structured prehash object
|
|
3489
|
+
*/
|
|
3490
|
+
declare function createSolanaDepositPrehash(paymentId: string, params: SolanaDepositParams): SolanaDepositPrehash;
|
|
3491
|
+
/**
|
|
3492
|
+
* Computes the keccak256 deposit hash from a prehash structure.
|
|
3493
|
+
*
|
|
3494
|
+
* Formula: keccak256("deposit" || payment_id[32] || depositor[32] || mint[32] ||
|
|
3495
|
+
* amount[8,LE] || reserver[32] || releaser[32] ||
|
|
3496
|
+
* nonce[8,LE] || issued_at[8,LE] || deadline[8,LE])
|
|
3497
|
+
*
|
|
3498
|
+
* Total input: 199 bytes (7 + 32*5 + 8*3)
|
|
3499
|
+
*
|
|
3500
|
+
* TODO: Replace with computeDepositHash from @atum-labs/solana-escrow-encoding once public.
|
|
3501
|
+
* The bindings version uses EscrowDepositParams with Pubkey objects instead of base58 strings,
|
|
3502
|
+
* so this function will need to convert from prehash strings to the bindings' types.
|
|
3503
|
+
*
|
|
3504
|
+
* @param prehash The structured prehash from createSolanaDepositPrehash()
|
|
3505
|
+
* @returns 0x-prefixed hex string (32 bytes)
|
|
3506
|
+
*/
|
|
3507
|
+
declare function hashSolanaDeposit(prehash: SolanaDepositPrehash): string;
|
|
3508
|
+
/**
|
|
3509
|
+
* Generates a valid nonce for Solana replay protection (upper 32 bits: random
|
|
3510
|
+
* bucket, lower 8 bits: random slot 0..MAX_VALID_SLOT). Delegates to the shared
|
|
3511
|
+
* package's generateNonce (which uses a CSPRNG with rejection sampling).
|
|
3512
|
+
*
|
|
3513
|
+
* @returns A bigint nonce suitable for the deposit message
|
|
3514
|
+
*/
|
|
3515
|
+
declare function generateSolanaNonce(): bigint;
|
|
3516
|
+
|
|
3517
|
+
/**
|
|
3518
|
+
* Payment Gateway TypeScript Client
|
|
3519
|
+
*
|
|
3520
|
+
* Main entry point that combines auto-generated API client code with
|
|
3521
|
+
* manually-crafted utilities for the Atum payment gateway.
|
|
3522
|
+
*/
|
|
3523
|
+
|
|
3524
|
+
declare const PAYMENT_REQUEST_VERSION = "1.0";
|
|
3525
|
+
|
|
3526
|
+
/**
|
|
3527
|
+
* Applies a SenderSigner to an unsigned PaymentRequest, signing every entry in
|
|
3528
|
+
* signed_messages (filling each signature, and payload.delegate_signer where the
|
|
3529
|
+
* chain requires it). Mirrors the CLI signing step for SDK consumers. The gateway
|
|
3530
|
+
* verifies every signed message, so a multi-message request must have them all
|
|
3531
|
+
* signed; the common single-message case is signed exactly as before.
|
|
3532
|
+
*/
|
|
3533
|
+
declare function signPaymentRequest(request: PaymentRequest, signer: SenderSigner): Promise<PaymentRequest>;
|
|
3534
|
+
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
|
3535
|
+
declare const defaultGateway: string;
|
|
3536
|
+
/**
|
|
3537
|
+
* Default quote-collection window for {@link PaymentGatewayClient.prepareQuoteRequest}
|
|
3538
|
+
* (`quote_deadline = now + this`, in seconds). Chosen as the largest value that still
|
|
3539
|
+
* lands under the gateway's `quote_sync_wait_seconds` cap (5s): a sync (`?wait=true`)
|
|
3540
|
+
* request holds for `min(quote_deadline − receipt, cap)`, so ≤5s returns `ready` with
|
|
3541
|
+
* quotes inline while ≥6s returns a poll-instead `collecting`. 5s also gives the widest
|
|
3542
|
+
* collection window under that cap — enough to catch slower / backup settlers, where a
|
|
3543
|
+
* shorter window can drop them — plus headroom against client↔gateway clock skew. A
|
|
3544
|
+
* caller on a badly-skewed clock can still pass a larger `quoteDeadlineSeconds`.
|
|
3545
|
+
*/
|
|
3546
|
+
declare const DEFAULT_QUOTE_DEADLINE_SECONDS = 5;
|
|
3547
|
+
/** Default settlement horizon (`fulfillment_deadline = now + this`, seconds); shared by both request builders. */
|
|
3548
|
+
declare const DEFAULT_FULFILLMENT_DEADLINE_SECONDS = 3600;
|
|
3549
|
+
/**
|
|
3550
|
+
* Default `quote_deadline` the single-shot payment path ({@link PaymentGatewayClient.preparePaymentRequest})
|
|
3551
|
+
* stamps (seconds) when the caller passes no `quoteDeadlineSeconds`. Higher than the
|
|
3552
|
+
* quote-request default because the payment path is not bound by the quote sync-wait cap.
|
|
3553
|
+
*/
|
|
3554
|
+
declare const DEFAULT_PAYMENT_QUOTE_DEADLINE_SECONDS = 10;
|
|
3555
|
+
/**
|
|
3556
|
+
* Extended PaymentGatewayClient with convenience methods
|
|
3557
|
+
*/
|
|
3558
|
+
declare class PaymentGatewayClient extends PaymentGatewayClient$1 {
|
|
3559
|
+
private baseUrl;
|
|
3560
|
+
constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
|
|
3561
|
+
/**
|
|
3562
|
+
* Fetches chain defaults from the payment gateway.
|
|
3563
|
+
*
|
|
3564
|
+
* @param chainId The CAIP-2 chain identifier (e.g., "eip155:42161")
|
|
3565
|
+
* @returns The chain defaults including escrow, quote selector, and fulfillment verifier
|
|
3566
|
+
*/
|
|
3567
|
+
fetchChainDefaults(chainId: string): Promise<ChainDefaults>;
|
|
3568
|
+
/**
|
|
3569
|
+
* Prepares a payment request with defaults, ready for signing.
|
|
3570
|
+
*
|
|
3571
|
+
* @param params Payment parameters
|
|
3572
|
+
* @returns A complete PaymentRequest object without the signature
|
|
3573
|
+
*/
|
|
3574
|
+
preparePaymentRequest(params: {
|
|
3575
|
+
depositor: string;
|
|
3576
|
+
fulfillmentAmount: string;
|
|
3577
|
+
sourceAsset: string;
|
|
3578
|
+
destinationAccount: string;
|
|
3579
|
+
destinationAsset: string;
|
|
3580
|
+
maxSourceAmount?: string;
|
|
3581
|
+
requestId?: string;
|
|
3582
|
+
requestIdPrefix?: string;
|
|
3583
|
+
settlerRequirements?: {
|
|
3584
|
+
whitelist?: string[];
|
|
3585
|
+
blacklist?: string[];
|
|
3586
|
+
};
|
|
3587
|
+
deadlineSeconds?: number;
|
|
3588
|
+
quoteDeadlineSeconds?: number;
|
|
3589
|
+
fulfillmentDeadlineSeconds?: number;
|
|
3590
|
+
/** Solana-only: override the RPC used to read the cluster clock for issued_at. */
|
|
3591
|
+
solanaRpcUrl?: string;
|
|
3592
|
+
}): Promise<PaymentRequest>;
|
|
3593
|
+
/**
|
|
3594
|
+
* Prepares a quote-request body (`CreateQuoteRequest`), ready to POST to
|
|
3595
|
+
* `/v1/payments/quote-requests`. This is the quote-phase counterpart to
|
|
3596
|
+
* `preparePaymentRequest`: it builds the same corridor shape but **without
|
|
3597
|
+
* `sender_auth`** — quote-time is the unauthenticated browse step, so no
|
|
3598
|
+
* signing (and no private key) is required. The spend authorization arrives
|
|
3599
|
+
* later, at the award call.
|
|
3600
|
+
*
|
|
3601
|
+
* Both deadlines are populated here because the gateway requires them and
|
|
3602
|
+
* injects no defaults — it never mutates the originator-supplied body.
|
|
3603
|
+
* `quote_deadline` bounds the collection window (default
|
|
3604
|
+
* `DEFAULT_QUOTE_DEADLINE_SECONDS`); `fulfillment_deadline` bounds settlement
|
|
3605
|
+
* (default `DEFAULT_FULFILLMENT_DEADLINE_SECONDS`). `quote_deadline` must be
|
|
3606
|
+
* strictly earlier than `fulfillment_deadline` (enforced server-side; guarded
|
|
3607
|
+
* here for a clear client-side error).
|
|
3608
|
+
*
|
|
3609
|
+
* `quote_deadline` is stamped client-side and the gateway rejects it unless it
|
|
3610
|
+
* is strictly in the gateway's future, so a caller whose clock may lag the
|
|
3611
|
+
* gateway should pass a larger `quoteDeadlineSeconds` (see
|
|
3612
|
+
* `DEFAULT_QUOTE_DEADLINE_SECONDS` for why the default is what it is).
|
|
3613
|
+
*
|
|
3614
|
+
* Like `preparePaymentRequest`, this fetches the source/destination chain
|
|
3615
|
+
* defaults and populates the SAME contract fields (`escrow_contract_address`,
|
|
3616
|
+
* `quote_selector`, `fulfillment_verifier`, `fulfillment_proxy`). These are not
|
|
3617
|
+
* optional in practice: the gateway requires `fulfillment_verifier` to build the
|
|
3618
|
+
* QuoteRequested event it broadcasts to settlers, so the quote-request body
|
|
3619
|
+
* must carry the identical contract fields the payment flow does. The ONLY
|
|
3620
|
+
* field this drops relative to `preparePaymentRequest` is `sender_auth`, which
|
|
3621
|
+
* is supplied at award time (quote-time is unauthenticated — no signing, no
|
|
3622
|
+
* private key).
|
|
3623
|
+
*
|
|
3624
|
+
* @param params Quote-request parameters
|
|
3625
|
+
* @returns A complete `CreateQuoteRequest` body (no signature step needed)
|
|
3626
|
+
*/
|
|
3627
|
+
prepareQuoteRequest(params: {
|
|
3628
|
+
depositor: string;
|
|
3629
|
+
fulfillmentAmount: string;
|
|
3630
|
+
sourceAsset: string;
|
|
3631
|
+
destinationAccount: string;
|
|
3632
|
+
destinationAsset: string;
|
|
3633
|
+
maxSourceAmount?: string;
|
|
3634
|
+
requestId?: string;
|
|
3635
|
+
requestIdPrefix?: string;
|
|
3636
|
+
settlerRequirements?: {
|
|
3637
|
+
whitelist?: string[];
|
|
3638
|
+
blacklist?: string[];
|
|
3639
|
+
};
|
|
3640
|
+
quoteDeadlineSeconds?: number;
|
|
3641
|
+
fulfillmentDeadlineSeconds?: number;
|
|
3642
|
+
}): Promise<CreateQuoteRequest>;
|
|
3643
|
+
}
|
|
3644
|
+
|
|
3645
|
+
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 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, RawSenderSigner, type ResolvePaymentData, type ResolvePaymentResponse, type ResolvePaymentResponse2, type SenderAuth, type SenderAuthMessageScheme, type SenderSignature, type SenderSigner, type SenderSignerOptions, type SignedMessage, 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, hashPermitWitnessTransferFrom, hashRequestId, hashSolanaDeposit, hashTvmPermitWitnessTransferFrom, hexToBytes, maskChainId, normalizeAddress, resolveTurnkeyAddresses, signPaymentRequest, type status, type status2, type status3, type status4, type status5, type status6, type status7, type status8, type status9 };
|