@ghostpaygg/node 0.0.0-stage → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2647 @@
1
+ interface components {
2
+ schemas: {
3
+ Error: {
4
+ error: {
5
+ /** @enum {string} */
6
+ code: "invalid_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "idempotency_key_reused" | "insufficient_balance" | "invalid_address" | "below_minimum" | "network_paused" | "withdrawals_paused" | "currency_not_supported" | "invalid_state" | "network_fee_unavailable" | "api_error";
7
+ message: string;
8
+ /** @description The request field or header at fault. */
9
+ param?: string;
10
+ };
11
+ };
12
+ /**
13
+ * @description Decimal string in whole units.
14
+ * @example 0.015
15
+ */
16
+ Decimal: string;
17
+ /** Format: date-time */
18
+ Timestamp: string;
19
+ /** Format: date-time */
20
+ NullableTimestamp: string | null;
21
+ /** @enum {string} */
22
+ NetworkId: "ethereum" | "bitcoin" | "solana" | "litecoin";
23
+ /**
24
+ * @description Case-insensitive.
25
+ * @enum {string}
26
+ */
27
+ CurrencyCode: "ETH" | "BTC" | "SOL" | "USDT" | "USDC" | "DAI" | "LTC";
28
+ /** @enum {string} */
29
+ NetworkCurrencyId: "eth" | "usdt_eth" | "usdc_eth" | "dai_eth" | "btc" | "sol" | "usdc_sol" | "usdt_sol" | "ltc";
30
+ /** @enum {string} */
31
+ Family: "EVM" | "UTXO" | "SOLANA";
32
+ /**
33
+ * @description Your own id.
34
+ * @example player_1
35
+ */
36
+ ExternalId: string;
37
+ /** @description Any JSON object, at most 4 KB. */
38
+ Metadata: {
39
+ [key: string]: unknown;
40
+ };
41
+ /** @description Indicative USD value of `amount`. Omitted when no rate is available. */
42
+ UsdValue: {
43
+ usd: components["schemas"]["Decimal"];
44
+ };
45
+ Page: {
46
+ data: unknown[];
47
+ has_more: boolean;
48
+ };
49
+ Network: {
50
+ id: components["schemas"]["NetworkId"];
51
+ /** @constant */
52
+ object: "network";
53
+ /** @example Ethereum */
54
+ name: string;
55
+ family: components["schemas"]["Family"];
56
+ /** @description Confirmations before a deposit is credited. */
57
+ confirmations: number;
58
+ /** @description Internal; can be ignored. */
59
+ sweeps: boolean;
60
+ block_time_ms: number;
61
+ deposits_enabled: boolean;
62
+ withdrawals_enabled: boolean;
63
+ /** @example https://etherscan.io/tx/{hash} */
64
+ explorer_tx_url: string;
65
+ explorer_address_url: string;
66
+ };
67
+ NetworkList: {
68
+ data: components["schemas"]["Network"][];
69
+ /** @constant */
70
+ has_more: false;
71
+ };
72
+ Currency: {
73
+ network_currency: components["schemas"]["NetworkCurrencyId"];
74
+ /** @example USDT */
75
+ currency: string;
76
+ network: components["schemas"]["NetworkId"];
77
+ family: components["schemas"]["Family"];
78
+ /** @description Token contract or mint; null for native coins. */
79
+ contract: string | null;
80
+ decimals: number;
81
+ min_deposit: components["schemas"]["Decimal"];
82
+ min_withdrawal: components["schemas"]["Decimal"];
83
+ confirmations: number;
84
+ deposits_enabled: boolean;
85
+ withdrawals_enabled: boolean;
86
+ /** @description There is no withdrawal fee; withdrawals pay only their actual network cost (see Quote a withdrawal). */
87
+ fees: {
88
+ /**
89
+ * @description Your service fee on deposits, in percent.
90
+ * @example 1.5
91
+ */
92
+ deposit_percent: string;
93
+ deposit_network: components["schemas"]["Decimal"];
94
+ };
95
+ };
96
+ CurrencyList: {
97
+ data: components["schemas"]["Currency"][];
98
+ /** @constant */
99
+ has_more: false;
100
+ };
101
+ Balance: {
102
+ /** @constant */
103
+ object: "balance";
104
+ currency: string;
105
+ network: components["schemas"]["NetworkId"];
106
+ network_currency: components["schemas"]["NetworkCurrencyId"];
107
+ available: components["schemas"]["Decimal"];
108
+ on_hold: components["schemas"]["Decimal"];
109
+ pending: components["schemas"]["Decimal"];
110
+ /** @description Temporarily paused while our team checks balances. */
111
+ withdrawals_paused: boolean;
112
+ deposits_enabled: boolean;
113
+ withdrawals_enabled: boolean;
114
+ value?: components["schemas"]["UsdValue"];
115
+ };
116
+ Transaction: {
117
+ /** @description `dep_…` or `wd_…`. */
118
+ id: string;
119
+ /** @constant */
120
+ object: "transaction";
121
+ /** @enum {string} */
122
+ type: "deposit" | "top_up" | "withdrawal" | "payout";
123
+ /** @enum {string} */
124
+ direction: "in" | "out";
125
+ /** @description The deposit or withdrawal status. */
126
+ status: string;
127
+ customer: string | null;
128
+ currency: string;
129
+ network: components["schemas"]["NetworkId"];
130
+ network_currency: components["schemas"]["NetworkCurrencyId"];
131
+ amount: components["schemas"]["Decimal"];
132
+ /** @description Deposits: service + network fee. Withdrawals: the network cost (held maximum until completed). */
133
+ fee: components["schemas"]["Decimal"];
134
+ net_amount: components["schemas"]["Decimal"];
135
+ from_address: string | null;
136
+ to_address: string;
137
+ tx_hash: string | null;
138
+ explorer_url: string | null;
139
+ confirmations: number | null;
140
+ confirmations_required: number;
141
+ created_at: components["schemas"]["Timestamp"];
142
+ completed_at: components["schemas"]["NullableTimestamp"];
143
+ value?: components["schemas"]["UsdValue"];
144
+ };
145
+ TransactionDetail: components["schemas"]["Transaction"] & {
146
+ deposit?: components["schemas"]["Deposit"];
147
+ withdrawal?: components["schemas"]["Withdrawal"];
148
+ events: {
149
+ id: string;
150
+ type: string;
151
+ created_at: components["schemas"]["Timestamp"];
152
+ deliveries: (components["schemas"]["WebhookDelivery"] & {
153
+ endpoint_url: string;
154
+ })[];
155
+ }[];
156
+ };
157
+ StatsBucket: {
158
+ count: number;
159
+ volume_usd: components["schemas"]["Decimal"];
160
+ fees_usd: components["schemas"]["Decimal"];
161
+ };
162
+ Stats: {
163
+ /** @constant */
164
+ object: "stats";
165
+ days: number;
166
+ since: components["schemas"]["Timestamp"];
167
+ /** @constant */
168
+ valued_at: "current_rates";
169
+ balance: {
170
+ total_usd: components["schemas"]["Decimal"];
171
+ available_usd: components["schemas"]["Decimal"];
172
+ on_hold_usd: components["schemas"]["Decimal"];
173
+ pending_usd: components["schemas"]["Decimal"];
174
+ };
175
+ deposits: components["schemas"]["StatsBucket"];
176
+ top_ups: components["schemas"]["StatsBucket"];
177
+ payouts: components["schemas"]["StatsBucket"];
178
+ withdrawals: components["schemas"]["StatsBucket"];
179
+ pending_deposits: number;
180
+ pending_withdrawals: number;
181
+ active_customers: number;
182
+ daily: {
183
+ /** Format: date */
184
+ date: string;
185
+ deposits_usd: components["schemas"]["Decimal"];
186
+ withdrawals_usd: components["schemas"]["Decimal"];
187
+ deposit_count: number;
188
+ withdrawal_count: number;
189
+ }[];
190
+ };
191
+ Customer: {
192
+ /** @example cus_06GT4P1Q3S5U7W9Y1A3C5E7G9J */
193
+ id: string;
194
+ /** @constant */
195
+ object: "customer";
196
+ external_id: components["schemas"]["ExternalId"];
197
+ metadata: components["schemas"]["Metadata"];
198
+ created_at: components["schemas"]["Timestamp"];
199
+ updated_at: components["schemas"]["Timestamp"];
200
+ };
201
+ AcceptedCurrency: {
202
+ currency: string;
203
+ network: components["schemas"]["NetworkId"];
204
+ network_currency: components["schemas"]["NetworkCurrencyId"];
205
+ decimals: number;
206
+ min_deposit: components["schemas"]["Decimal"];
207
+ };
208
+ Address: {
209
+ /** @example addr_06GT4Q2B4D6F8H0K2M4P6R8T0V */
210
+ id: string;
211
+ /** @constant */
212
+ object: "address";
213
+ /** @example 0x5cfaade23ea1ee5b76d2316cee3e893852c3b9d0 */
214
+ address: string;
215
+ /** @description Your own top-up address (see List top-up addresses): deposits to it are credited with no fees. */
216
+ top_up: boolean;
217
+ family: components["schemas"]["Family"];
218
+ /** @constant */
219
+ kind: "DEPOSIT";
220
+ /** @description Your external id. */
221
+ customer: string | null;
222
+ /** @description Set for an invoice's dedicated address. */
223
+ invoice: string | null;
224
+ accepts: components["schemas"]["AcceptedCurrency"][];
225
+ retired_at: components["schemas"]["NullableTimestamp"];
226
+ created_at: components["schemas"]["Timestamp"];
227
+ };
228
+ /**
229
+ * @description `PENDING` seen, waiting for confirmations · `CREDITED` added to your balance (final) ·
230
+ * `HELD` held for review, see `hold_reason` · `FAILED` below the minimum, never credited (final) ·
231
+ * `ORPHANED` dropped by a chain reorganisation.
232
+ * @enum {string}
233
+ */
234
+ DepositStatus: "PENDING" | "CREDITED" | "HELD" | "FAILED" | "ORPHANED";
235
+ Deposit: {
236
+ /** @example dep_06GT5A9H1C3E5G7J9K2M4N6P8Q */
237
+ id: string;
238
+ /** @constant */
239
+ object: "deposit";
240
+ status: components["schemas"]["DepositStatus"];
241
+ /** @description Your external id. */
242
+ customer: string | null;
243
+ address: string;
244
+ /** @description Paid to one of your top-up addresses; credited with no fees. */
245
+ top_up: boolean;
246
+ currency: string;
247
+ network: components["schemas"]["NetworkId"];
248
+ network_currency: components["schemas"]["NetworkCurrencyId"];
249
+ amount: components["schemas"]["Decimal"];
250
+ fee: components["schemas"]["Decimal"];
251
+ /** @description amount − fee; what is added to your balance. */
252
+ net_amount: components["schemas"]["Decimal"];
253
+ tx_hash: string;
254
+ from_address: string | null;
255
+ confirmations: number;
256
+ confirmations_required: number;
257
+ block_height: string | null;
258
+ invoice: string | null;
259
+ /** @enum {string|null} */
260
+ hold_reason: "REVIEW" | null;
261
+ /** @description Paid to an invoice after it expired. */
262
+ late: boolean;
263
+ explorer_url: string | null;
264
+ /** @description Increases on every change; use it to ignore stale webhooks. */
265
+ version: number;
266
+ created_at: components["schemas"]["Timestamp"];
267
+ credited_at: components["schemas"]["NullableTimestamp"];
268
+ value?: components["schemas"]["UsdValue"];
269
+ };
270
+ /** @enum {string} */
271
+ InvoiceStatus: "NEW" | "PENDING" | "PAID" | "UNDERPAID" | "EXPIRED" | "CANCELLED";
272
+ Invoice: {
273
+ /** @example inv_06GT5D0A2C4E6G8J0K2M4P6R8T */
274
+ id: string;
275
+ /** @constant */
276
+ object: "invoice";
277
+ status: components["schemas"]["InvoiceStatus"];
278
+ order_id: string;
279
+ description: string | null;
280
+ customer: string | null;
281
+ price_amount: components["schemas"]["Decimal"];
282
+ price_currency: string;
283
+ /** @description Null until chosen. */
284
+ currency: string | null;
285
+ network: string | null;
286
+ network_currency: string | null;
287
+ /** @description Dedicated address for this invoice, once the currency is chosen. */
288
+ address: string | null;
289
+ /** @description Amount due in `currency`. */
290
+ pay_amount: string | null;
291
+ paid_amount: components["schemas"]["Decimal"];
292
+ payer_pays_fees: boolean;
293
+ /**
294
+ * Format: uri
295
+ * @description Hosted payment page to send the payer to.
296
+ */
297
+ checkout_url: string;
298
+ return_url: string | null;
299
+ /** @description `dep_…` ids paid to this invoice. */
300
+ deposits: string[];
301
+ metadata: components["schemas"]["Metadata"];
302
+ version: number;
303
+ expires_at: components["schemas"]["Timestamp"];
304
+ paid_at: components["schemas"]["NullableTimestamp"];
305
+ created_at: components["schemas"]["Timestamp"];
306
+ };
307
+ Checkout: {
308
+ id: string;
309
+ /** @constant */
310
+ object: "checkout";
311
+ status: components["schemas"]["InvoiceStatus"];
312
+ merchant: {
313
+ name: string;
314
+ };
315
+ order_id: string;
316
+ description: string | null;
317
+ price_amount: components["schemas"]["Decimal"];
318
+ price_currency: string;
319
+ currency: string | null;
320
+ network: string | null;
321
+ network_currency: string | null;
322
+ address: string | null;
323
+ pay_amount: string | null;
324
+ paid_amount: components["schemas"]["Decimal"];
325
+ payer_pays_fees: boolean;
326
+ return_url: string | null;
327
+ can_select_currency: boolean;
328
+ accepts: components["schemas"]["AcceptedCurrency"][];
329
+ expires_at: components["schemas"]["Timestamp"];
330
+ paid_at: components["schemas"]["NullableTimestamp"];
331
+ created_at: components["schemas"]["Timestamp"];
332
+ };
333
+ /**
334
+ * @description `QUEUED` about to be sent ·
335
+ * `SENT` broadcast · `COMPLETED` confirmed (final) · `FAILED` not sent, hold returned (final) ·
336
+ * `CANCELLED` cancelled before sending, hold returned (final).
337
+ * @enum {string}
338
+ */
339
+ WithdrawalStatus: "QUEUED" | "SENT" | "COMPLETED" | "FAILED" | "CANCELLED";
340
+ Withdrawal: {
341
+ /** @example wd_06GT5C1P3R5T7V9X1Z3B5D7F9H */
342
+ id: string;
343
+ /** @constant */
344
+ object: "withdrawal";
345
+ status: components["schemas"]["WithdrawalStatus"];
346
+ external_id: string | null;
347
+ customer: string | null;
348
+ currency: string;
349
+ network: components["schemas"]["NetworkId"];
350
+ network_currency: components["schemas"]["NetworkCurrencyId"];
351
+ address: string;
352
+ /** @description What the recipient receives. */
353
+ amount: components["schemas"]["Decimal"];
354
+ /** @description The actual network cost charged, set on completion. There is no withdrawal fee. */
355
+ network_fee: components["schemas"]["Decimal"] | null;
356
+ /** @description Held at creation: 1.5× the estimated network cost. Unused hold is returned. */
357
+ network_fee_max: components["schemas"]["Decimal"];
358
+ /** @description What leaves your balance: amount + network_fee once completed, amount + network_fee_max until then. */
359
+ total: components["schemas"]["Decimal"];
360
+ /** @description Can change while SENT if the fee is bumped. */
361
+ tx_hash: string | null;
362
+ explorer_url: string | null;
363
+ failure_reason: string | null;
364
+ version: number;
365
+ created_at: components["schemas"]["Timestamp"];
366
+ completed_at: components["schemas"]["NullableTimestamp"];
367
+ value?: components["schemas"]["UsdValue"];
368
+ };
369
+ WithdrawalQuote: {
370
+ /** @constant */
371
+ object: "withdrawal_quote";
372
+ currency: string;
373
+ network: components["schemas"]["NetworkId"];
374
+ network_currency: components["schemas"]["NetworkCurrencyId"];
375
+ amount: components["schemas"]["Decimal"];
376
+ /** @description Held: 1.5× the estimated network cost. You are charged only the actual cost. */
377
+ network_fee_max: components["schemas"]["Decimal"];
378
+ /** @description amount + network_fee_max: what must be available. */
379
+ total_max: components["schemas"]["Decimal"];
380
+ min_withdrawal: components["schemas"]["Decimal"];
381
+ available: components["schemas"]["Decimal"];
382
+ sufficient_balance: boolean;
383
+ withdrawals_paused: boolean;
384
+ value?: components["schemas"]["UsdValue"];
385
+ };
386
+ /** @enum {string} */
387
+ EventType: "deposit.pending" | "deposit.credited" | "deposit.held" | "deposit.failed" | "deposit.orphaned" | "withdrawal.created" | "withdrawal.sent" | "withdrawal.completed" | "withdrawal.failed" | "withdrawal.cancelled" | "invoice.pending" | "invoice.paid" | "invoice.underpaid" | "invoice.expired" | "invoice.cancelled" | "ping";
388
+ /** @description Event types this endpoint receives (duplicates are ignored). No wildcards; `ping` is only sent by the test call. Each type can belong to only one of your endpoints. */
389
+ EndpointEventTypes: ("deposit.pending" | "deposit.credited" | "deposit.held" | "deposit.failed" | "deposit.orphaned" | "withdrawal.created" | "withdrawal.sent" | "withdrawal.completed" | "withdrawal.failed" | "withdrawal.cancelled" | "invoice.pending" | "invoice.paid" | "invoice.underpaid" | "invoice.expired" | "invoice.cancelled")[];
390
+ Event: {
391
+ /** @example evt_06GT5B2D4ZQ7K1M3P8R5T0V9WX */
392
+ id: string;
393
+ /** @constant */
394
+ object: "event";
395
+ type: components["schemas"]["EventType"];
396
+ object_id: string;
397
+ /** @description The deposit, withdrawal or invoice as it was when the event happened. */
398
+ data: Record<string, never>;
399
+ created_at: components["schemas"]["Timestamp"];
400
+ };
401
+ WebhookPayload: {
402
+ /** @description Event id; equals the `webhook-id` header. */
403
+ id: string;
404
+ type: components["schemas"]["EventType"];
405
+ created_at: components["schemas"]["Timestamp"];
406
+ data: components["schemas"]["Deposit"] | components["schemas"]["Withdrawal"] | components["schemas"]["Invoice"] | {
407
+ /** @constant */
408
+ object?: "ping";
409
+ endpoint?: string;
410
+ message?: string;
411
+ };
412
+ };
413
+ /** @enum {string} */
414
+ DeliveryStatus: "PENDING" | "SUCCEEDED" | "FAILED";
415
+ WebhookEndpoint: {
416
+ id: string;
417
+ /** @constant */
418
+ object: "webhook_endpoint";
419
+ /** Format: uri */
420
+ url: string;
421
+ event_types: components["schemas"]["EndpointEventTypes"];
422
+ /** @description Retry failed deliveries on the fixed schedule. false = one attempt. */
423
+ auto_retry: boolean;
424
+ enabled: boolean;
425
+ failing_since: components["schemas"]["NullableTimestamp"];
426
+ disabled_reason: string | null;
427
+ /** @description Share of finished deliveries that succeeded in the last 24 h. */
428
+ success_rate_24h?: number | null;
429
+ created_at: components["schemas"]["Timestamp"];
430
+ updated_at: components["schemas"]["Timestamp"];
431
+ };
432
+ WebhookDelivery: {
433
+ id: string;
434
+ /** @constant */
435
+ object: "webhook_delivery";
436
+ event: string;
437
+ event_type: components["schemas"]["EventType"];
438
+ endpoint: string;
439
+ status: components["schemas"]["DeliveryStatus"];
440
+ attempts: number;
441
+ next_attempt_at: components["schemas"]["NullableTimestamp"];
442
+ last_status: number | null;
443
+ last_error: string | null;
444
+ created_at: components["schemas"]["Timestamp"];
445
+ updated_at: components["schemas"]["Timestamp"];
446
+ succeeded_at: components["schemas"]["NullableTimestamp"];
447
+ };
448
+ WebhookAttempt: {
449
+ attempt: number;
450
+ status_code: number | null;
451
+ response_body: string | null;
452
+ duration_ms: number | null;
453
+ error: string | null;
454
+ created_at: components["schemas"]["Timestamp"];
455
+ };
456
+ Settings: {
457
+ /** @constant */
458
+ object: "settings";
459
+ merchant: {
460
+ /** @example mer_06GT4MZSYBNV3Q2V2Q6R9Q3GZM */
461
+ id: string;
462
+ name: string;
463
+ status: string;
464
+ };
465
+ invoice_lifetime_sec: number;
466
+ /** @description An invoice paid within this shortfall counts as PAID. */
467
+ invoice_underpaid_tolerance_bps: number;
468
+ updated_at: components["schemas"]["Timestamp"];
469
+ };
470
+ };
471
+ responses: {
472
+ /** @description Invalid request (`invalid_request`). */
473
+ BadRequest: {
474
+ headers: {
475
+ [name: string]: unknown;
476
+ };
477
+ content: {
478
+ /**
479
+ * @example {
480
+ * "error": {
481
+ * "code": "invalid_request",
482
+ * "message": "amount: must be a decimal string like \"12.5\"",
483
+ * "param": "amount"
484
+ * }
485
+ * }
486
+ */
487
+ "application/json": components["schemas"]["Error"];
488
+ };
489
+ };
490
+ /** @description Missing or invalid API key. */
491
+ Unauthorized: {
492
+ headers: {
493
+ [name: string]: unknown;
494
+ };
495
+ content: {
496
+ /**
497
+ * @example {
498
+ * "error": {
499
+ * "code": "unauthorized",
500
+ * "message": "Invalid API key"
501
+ * }
502
+ * }
503
+ */
504
+ "application/json": components["schemas"]["Error"];
505
+ };
506
+ };
507
+ /** @description Not allowed (key without withdraw permission, IP not allowlisted, merchant inactive). */
508
+ Forbidden: {
509
+ headers: {
510
+ [name: string]: unknown;
511
+ };
512
+ content: {
513
+ /**
514
+ * @example {
515
+ * "error": {
516
+ * "code": "forbidden",
517
+ * "message": "This API key cannot create withdrawals"
518
+ * }
519
+ * }
520
+ */
521
+ "application/json": components["schemas"]["Error"];
522
+ };
523
+ };
524
+ /** @description No such object. */
525
+ NotFound: {
526
+ headers: {
527
+ [name: string]: unknown;
528
+ };
529
+ content: {
530
+ /**
531
+ * @example {
532
+ * "error": {
533
+ * "code": "not_found",
534
+ * "message": "No such deposit: dep_…"
535
+ * }
536
+ * }
537
+ */
538
+ "application/json": components["schemas"]["Error"];
539
+ };
540
+ };
541
+ /** @description Duplicate, or an idempotent request with this key is still running. */
542
+ Conflict: {
543
+ headers: {
544
+ [name: string]: unknown;
545
+ };
546
+ content: {
547
+ /**
548
+ * @example {
549
+ * "error": {
550
+ * "code": "conflict",
551
+ * "message": "A withdrawal with external_id payout_881 already exists",
552
+ * "param": "external_id"
553
+ * }
554
+ * }
555
+ */
556
+ "application/json": components["schemas"]["Error"];
557
+ };
558
+ };
559
+ /**
560
+ * @description Valid request that cannot be done: `insufficient_balance`, `invalid_address`, `below_minimum`,
561
+ * `network_paused`, `withdrawals_paused`, `currency_not_supported`, `invalid_state`, `idempotency_key_reused`.
562
+ */
563
+ Unprocessable: {
564
+ headers: {
565
+ [name: string]: unknown;
566
+ };
567
+ content: {
568
+ /**
569
+ * @example {
570
+ * "error": {
571
+ * "code": "below_minimum",
572
+ * "message": "The minimum withdrawal is 0.001 ETH",
573
+ * "param": "amount"
574
+ * }
575
+ * }
576
+ */
577
+ "application/json": components["schemas"]["Error"];
578
+ };
579
+ };
580
+ /** @description The network fee can't be estimated right now. Nothing was created; retry shortly. */
581
+ NetworkFeeUnavailable: {
582
+ headers: {
583
+ [name: string]: unknown;
584
+ };
585
+ content: {
586
+ /**
587
+ * @example {
588
+ * "error": {
589
+ * "code": "network_fee_unavailable",
590
+ * "message": "The Ethereum network fee can't be estimated right now; try again shortly"
591
+ * }
592
+ * }
593
+ */
594
+ "application/json": components["schemas"]["Error"];
595
+ };
596
+ };
597
+ };
598
+ parameters: {
599
+ /** @description Unique key per operation (≤ 255 chars). Retries with the same key and body replay the first response for 24 h. */
600
+ IdempotencyKey: string;
601
+ Limit: number;
602
+ /** @description Id of the last item of the previous page. */
603
+ After: string;
604
+ /** @description Your external id, `ext:<external_id>`, or a `cus_…` id. */
605
+ CustomerFilter: string;
606
+ /** @description `wd_…` id, or your `external_id` (optionally as `ext:<external_id>`). */
607
+ WithdrawalRef: string;
608
+ InvoiceId: string;
609
+ };
610
+ requestBodies: never;
611
+ headers: {
612
+ /** @description `true` when this response is a stored replay of an earlier request with the same Idempotency-Key. */
613
+ IdempotentReplayed: "true";
614
+ };
615
+ pathItems: never;
616
+ }
617
+ interface operations {
618
+ listNetworks: {
619
+ parameters: {
620
+ query?: never;
621
+ header?: never;
622
+ path?: never;
623
+ cookie?: never;
624
+ };
625
+ requestBody?: never;
626
+ responses: {
627
+ /** @description All networks. */
628
+ 200: {
629
+ headers: {
630
+ [name: string]: unknown;
631
+ };
632
+ content: {
633
+ "application/json": components["schemas"]["NetworkList"];
634
+ };
635
+ };
636
+ 401: components["responses"]["Unauthorized"];
637
+ };
638
+ };
639
+ listCurrencies: {
640
+ parameters: {
641
+ query?: never;
642
+ header?: never;
643
+ path?: never;
644
+ cookie?: never;
645
+ };
646
+ requestBody?: never;
647
+ responses: {
648
+ /** @description Enabled currencies. */
649
+ 200: {
650
+ headers: {
651
+ [name: string]: unknown;
652
+ };
653
+ content: {
654
+ "application/json": components["schemas"]["CurrencyList"];
655
+ };
656
+ };
657
+ 401: components["responses"]["Unauthorized"];
658
+ };
659
+ };
660
+ listRates: {
661
+ parameters: {
662
+ query?: never;
663
+ header?: never;
664
+ path?: never;
665
+ cookie?: never;
666
+ };
667
+ requestBody?: never;
668
+ responses: {
669
+ /** @description Current rates. */
670
+ 200: {
671
+ headers: {
672
+ [name: string]: unknown;
673
+ };
674
+ content: {
675
+ "application/json": {
676
+ data: {
677
+ /** @example ETH */
678
+ currency: string;
679
+ usd: components["schemas"]["Decimal"];
680
+ }[];
681
+ /** @constant */
682
+ has_more: false;
683
+ };
684
+ };
685
+ };
686
+ 401: components["responses"]["Unauthorized"];
687
+ };
688
+ };
689
+ listBalances: {
690
+ parameters: {
691
+ query?: never;
692
+ header?: never;
693
+ path?: never;
694
+ cookie?: never;
695
+ };
696
+ requestBody?: never;
697
+ responses: {
698
+ /** @description Your balances. */
699
+ 200: {
700
+ headers: {
701
+ [name: string]: unknown;
702
+ };
703
+ content: {
704
+ "application/json": {
705
+ data: components["schemas"]["Balance"][];
706
+ /** @constant */
707
+ has_more: false;
708
+ };
709
+ };
710
+ };
711
+ 401: components["responses"]["Unauthorized"];
712
+ };
713
+ };
714
+ listCustomers: {
715
+ parameters: {
716
+ query?: {
717
+ limit?: components["parameters"]["Limit"];
718
+ /** @description Id of the last item of the previous page. */
719
+ after?: components["parameters"]["After"];
720
+ };
721
+ header?: never;
722
+ path?: never;
723
+ cookie?: never;
724
+ };
725
+ requestBody?: never;
726
+ responses: {
727
+ /** @description A page of customers. */
728
+ 200: {
729
+ headers: {
730
+ [name: string]: unknown;
731
+ };
732
+ content: {
733
+ "application/json": components["schemas"]["Page"] & {
734
+ data?: components["schemas"]["Customer"][];
735
+ };
736
+ };
737
+ };
738
+ 401: components["responses"]["Unauthorized"];
739
+ };
740
+ };
741
+ upsertCustomer: {
742
+ parameters: {
743
+ query?: never;
744
+ header?: {
745
+ /** @description Unique key per operation (≤ 255 chars). Retries with the same key and body replay the first response for 24 h. */
746
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
747
+ };
748
+ path?: never;
749
+ cookie?: never;
750
+ };
751
+ requestBody: {
752
+ content: {
753
+ "application/json": {
754
+ external_id: components["schemas"]["ExternalId"];
755
+ metadata?: components["schemas"]["Metadata"];
756
+ };
757
+ };
758
+ };
759
+ responses: {
760
+ /** @description The customer. */
761
+ 200: {
762
+ headers: {
763
+ [name: string]: unknown;
764
+ };
765
+ content: {
766
+ "application/json": components["schemas"]["Customer"];
767
+ };
768
+ };
769
+ 400: components["responses"]["BadRequest"];
770
+ 401: components["responses"]["Unauthorized"];
771
+ };
772
+ };
773
+ getCustomer: {
774
+ parameters: {
775
+ query?: never;
776
+ header?: never;
777
+ path: {
778
+ /**
779
+ * @description `cus_…` id, or `ext:<external_id>`.
780
+ * @example ext:player_1
781
+ */
782
+ customer: string;
783
+ };
784
+ cookie?: never;
785
+ };
786
+ requestBody?: never;
787
+ responses: {
788
+ /** @description The customer. */
789
+ 200: {
790
+ headers: {
791
+ [name: string]: unknown;
792
+ };
793
+ content: {
794
+ "application/json": components["schemas"]["Customer"];
795
+ };
796
+ };
797
+ 404: components["responses"]["NotFound"];
798
+ };
799
+ };
800
+ listAddresses: {
801
+ parameters: {
802
+ query?: {
803
+ limit?: components["parameters"]["Limit"];
804
+ /** @description Id of the last item of the previous page. */
805
+ after?: components["parameters"]["After"];
806
+ /** @description Your external id, `ext:<external_id>`, or a `cus_…` id. */
807
+ customer?: components["parameters"]["CustomerFilter"];
808
+ network?: components["schemas"]["NetworkId"];
809
+ family?: components["schemas"]["Family"];
810
+ };
811
+ header?: never;
812
+ path?: never;
813
+ cookie?: never;
814
+ };
815
+ requestBody?: never;
816
+ responses: {
817
+ /** @description A page of addresses. */
818
+ 200: {
819
+ headers: {
820
+ [name: string]: unknown;
821
+ };
822
+ content: {
823
+ "application/json": components["schemas"]["Page"] & {
824
+ data?: components["schemas"]["Address"][];
825
+ };
826
+ };
827
+ };
828
+ };
829
+ };
830
+ getOrCreateAddress: {
831
+ parameters: {
832
+ query?: never;
833
+ header?: {
834
+ /** @description Unique key per operation (≤ 255 chars). Retries with the same key and body replay the first response for 24 h. */
835
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
836
+ };
837
+ path?: never;
838
+ cookie?: never;
839
+ };
840
+ requestBody: {
841
+ content: {
842
+ /**
843
+ * @example {
844
+ * "customer": "player_1",
845
+ * "network": "ethereum"
846
+ * }
847
+ */
848
+ "application/json": {
849
+ customer: components["schemas"]["ExternalId"];
850
+ network: components["schemas"]["NetworkId"];
851
+ };
852
+ };
853
+ };
854
+ responses: {
855
+ /** @description Existing address. */
856
+ 200: {
857
+ headers: {
858
+ [name: string]: unknown;
859
+ };
860
+ content: {
861
+ "application/json": components["schemas"]["Address"];
862
+ };
863
+ };
864
+ /** @description New address. */
865
+ 201: {
866
+ headers: {
867
+ [name: string]: unknown;
868
+ };
869
+ content: {
870
+ "application/json": components["schemas"]["Address"];
871
+ };
872
+ };
873
+ 400: components["responses"]["BadRequest"];
874
+ 422: components["responses"]["Unprocessable"];
875
+ };
876
+ };
877
+ listTopUpAddresses: {
878
+ parameters: {
879
+ query?: never;
880
+ header?: never;
881
+ path?: never;
882
+ cookie?: never;
883
+ };
884
+ requestBody?: never;
885
+ responses: {
886
+ /** @description Every top-up address with the currencies it accepts. */
887
+ 200: {
888
+ headers: {
889
+ [name: string]: unknown;
890
+ };
891
+ content: {
892
+ "application/json": {
893
+ data: components["schemas"]["Address"][];
894
+ };
895
+ };
896
+ };
897
+ };
898
+ };
899
+ getAddress: {
900
+ parameters: {
901
+ query?: never;
902
+ header?: never;
903
+ path: {
904
+ /** @description `addr_…` id or the on-chain address. */
905
+ address: string;
906
+ };
907
+ cookie?: never;
908
+ };
909
+ requestBody?: never;
910
+ responses: {
911
+ /** @description The address. */
912
+ 200: {
913
+ headers: {
914
+ [name: string]: unknown;
915
+ };
916
+ content: {
917
+ "application/json": components["schemas"]["Address"];
918
+ };
919
+ };
920
+ 404: components["responses"]["NotFound"];
921
+ };
922
+ };
923
+ retireAddress: {
924
+ parameters: {
925
+ query?: never;
926
+ header?: {
927
+ /** @description Unique key per operation (≤ 255 chars). Retries with the same key and body replay the first response for 24 h. */
928
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
929
+ };
930
+ path: {
931
+ /** @description `addr_…` id or the on-chain address. */
932
+ address: string;
933
+ };
934
+ cookie?: never;
935
+ };
936
+ requestBody?: never;
937
+ responses: {
938
+ /** @description The retired address. */
939
+ 200: {
940
+ headers: {
941
+ [name: string]: unknown;
942
+ };
943
+ content: {
944
+ "application/json": components["schemas"]["Address"];
945
+ };
946
+ };
947
+ 404: components["responses"]["NotFound"];
948
+ 422: components["responses"]["Unprocessable"];
949
+ };
950
+ };
951
+ listDeposits: {
952
+ parameters: {
953
+ query?: {
954
+ limit?: components["parameters"]["Limit"];
955
+ /** @description Id of the last item of the previous page. */
956
+ after?: components["parameters"]["After"];
957
+ /** @description Your external id, `ext:<external_id>`, or a `cus_…` id. */
958
+ customer?: components["parameters"]["CustomerFilter"];
959
+ status?: components["schemas"]["DepositStatus"];
960
+ network?: components["schemas"]["NetworkId"];
961
+ currency?: components["schemas"]["CurrencyCode"];
962
+ tx_hash?: string;
963
+ /** @description `inv_…` id. */
964
+ invoice?: string;
965
+ };
966
+ header?: never;
967
+ path?: never;
968
+ cookie?: never;
969
+ };
970
+ requestBody?: never;
971
+ responses: {
972
+ /** @description A page of deposits. */
973
+ 200: {
974
+ headers: {
975
+ [name: string]: unknown;
976
+ };
977
+ content: {
978
+ "application/json": components["schemas"]["Page"] & {
979
+ data?: components["schemas"]["Deposit"][];
980
+ };
981
+ };
982
+ };
983
+ };
984
+ };
985
+ getDeposit: {
986
+ parameters: {
987
+ query?: never;
988
+ header?: never;
989
+ path: {
990
+ id: string;
991
+ };
992
+ cookie?: never;
993
+ };
994
+ requestBody?: never;
995
+ responses: {
996
+ /** @description The deposit. */
997
+ 200: {
998
+ headers: {
999
+ [name: string]: unknown;
1000
+ };
1001
+ content: {
1002
+ "application/json": components["schemas"]["Deposit"];
1003
+ };
1004
+ };
1005
+ 404: components["responses"]["NotFound"];
1006
+ };
1007
+ };
1008
+ listInvoices: {
1009
+ parameters: {
1010
+ query?: {
1011
+ limit?: components["parameters"]["Limit"];
1012
+ /** @description Id of the last item of the previous page. */
1013
+ after?: components["parameters"]["After"];
1014
+ /** @description Your external id, `ext:<external_id>`, or a `cus_…` id. */
1015
+ customer?: components["parameters"]["CustomerFilter"];
1016
+ status?: components["schemas"]["InvoiceStatus"];
1017
+ order_id?: string;
1018
+ };
1019
+ header?: never;
1020
+ path?: never;
1021
+ cookie?: never;
1022
+ };
1023
+ requestBody?: never;
1024
+ responses: {
1025
+ /** @description A page of invoices. */
1026
+ 200: {
1027
+ headers: {
1028
+ [name: string]: unknown;
1029
+ };
1030
+ content: {
1031
+ "application/json": components["schemas"]["Page"] & {
1032
+ data?: components["schemas"]["Invoice"][];
1033
+ };
1034
+ };
1035
+ };
1036
+ };
1037
+ };
1038
+ createInvoice: {
1039
+ parameters: {
1040
+ query?: never;
1041
+ header?: {
1042
+ /** @description Unique key per operation (≤ 255 chars). Retries with the same key and body replay the first response for 24 h. */
1043
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
1044
+ };
1045
+ path?: never;
1046
+ cookie?: never;
1047
+ };
1048
+ requestBody: {
1049
+ content: {
1050
+ /**
1051
+ * @example {
1052
+ * "order_id": "order_1042",
1053
+ * "price_amount": "25.00",
1054
+ * "price_currency": "USD",
1055
+ * "currency": "USDT",
1056
+ * "network": "solana",
1057
+ * "customer": "player_1"
1058
+ * }
1059
+ */
1060
+ "application/json": {
1061
+ /** @description Unique per merchant. */
1062
+ order_id: string;
1063
+ price_amount: components["schemas"]["Decimal"];
1064
+ /**
1065
+ * @description `USD` or a supported currency code.
1066
+ * @example USD
1067
+ */
1068
+ price_currency: string;
1069
+ currency?: components["schemas"]["CurrencyCode"];
1070
+ network?: components["schemas"]["NetworkId"];
1071
+ customer?: components["schemas"]["ExternalId"];
1072
+ /** @default false */
1073
+ payer_pays_fees?: boolean;
1074
+ description?: string;
1075
+ /**
1076
+ * Format: uri
1077
+ * @description Where the checkout page links back to.
1078
+ */
1079
+ return_url?: string;
1080
+ metadata?: components["schemas"]["Metadata"];
1081
+ };
1082
+ };
1083
+ };
1084
+ responses: {
1085
+ /** @description The invoice. */
1086
+ 201: {
1087
+ headers: {
1088
+ [name: string]: unknown;
1089
+ };
1090
+ content: {
1091
+ "application/json": components["schemas"]["Invoice"];
1092
+ };
1093
+ };
1094
+ 400: components["responses"]["BadRequest"];
1095
+ 409: components["responses"]["Conflict"];
1096
+ 422: components["responses"]["Unprocessable"];
1097
+ };
1098
+ };
1099
+ getInvoice: {
1100
+ parameters: {
1101
+ query?: never;
1102
+ header?: never;
1103
+ path: {
1104
+ id: string;
1105
+ };
1106
+ cookie?: never;
1107
+ };
1108
+ requestBody?: never;
1109
+ responses: {
1110
+ /** @description The invoice. */
1111
+ 200: {
1112
+ headers: {
1113
+ [name: string]: unknown;
1114
+ };
1115
+ content: {
1116
+ "application/json": components["schemas"]["Invoice"];
1117
+ };
1118
+ };
1119
+ 404: components["responses"]["NotFound"];
1120
+ };
1121
+ };
1122
+ cancelInvoice: {
1123
+ parameters: {
1124
+ query?: never;
1125
+ header?: {
1126
+ /** @description Unique key per operation (≤ 255 chars). Retries with the same key and body replay the first response for 24 h. */
1127
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
1128
+ };
1129
+ path: {
1130
+ id: string;
1131
+ };
1132
+ cookie?: never;
1133
+ };
1134
+ requestBody?: never;
1135
+ responses: {
1136
+ /** @description The cancelled invoice. */
1137
+ 200: {
1138
+ headers: {
1139
+ [name: string]: unknown;
1140
+ };
1141
+ content: {
1142
+ "application/json": components["schemas"]["Invoice"];
1143
+ };
1144
+ };
1145
+ 404: components["responses"]["NotFound"];
1146
+ 422: components["responses"]["Unprocessable"];
1147
+ };
1148
+ };
1149
+ quoteWithdrawal: {
1150
+ parameters: {
1151
+ query?: never;
1152
+ header?: never;
1153
+ path?: never;
1154
+ cookie?: never;
1155
+ };
1156
+ requestBody: {
1157
+ content: {
1158
+ "application/json": {
1159
+ currency: components["schemas"]["CurrencyCode"];
1160
+ network: components["schemas"]["NetworkId"];
1161
+ amount: components["schemas"]["Decimal"];
1162
+ address: string;
1163
+ };
1164
+ };
1165
+ };
1166
+ responses: {
1167
+ /** @description The quote. */
1168
+ 200: {
1169
+ headers: {
1170
+ [name: string]: unknown;
1171
+ };
1172
+ content: {
1173
+ "application/json": components["schemas"]["WithdrawalQuote"];
1174
+ };
1175
+ };
1176
+ 400: components["responses"]["BadRequest"];
1177
+ 422: components["responses"]["Unprocessable"];
1178
+ 503: components["responses"]["NetworkFeeUnavailable"];
1179
+ };
1180
+ };
1181
+ listWithdrawals: {
1182
+ parameters: {
1183
+ query?: {
1184
+ limit?: components["parameters"]["Limit"];
1185
+ /** @description Id of the last item of the previous page. */
1186
+ after?: components["parameters"]["After"];
1187
+ /** @description Your external id, `ext:<external_id>`, or a `cus_…` id. */
1188
+ customer?: components["parameters"]["CustomerFilter"];
1189
+ status?: components["schemas"]["WithdrawalStatus"];
1190
+ network?: components["schemas"]["NetworkId"];
1191
+ currency?: components["schemas"]["CurrencyCode"];
1192
+ external_id?: string;
1193
+ };
1194
+ header?: never;
1195
+ path?: never;
1196
+ cookie?: never;
1197
+ };
1198
+ requestBody?: never;
1199
+ responses: {
1200
+ /** @description A page of withdrawals. */
1201
+ 200: {
1202
+ headers: {
1203
+ [name: string]: unknown;
1204
+ };
1205
+ content: {
1206
+ "application/json": components["schemas"]["Page"] & {
1207
+ data?: components["schemas"]["Withdrawal"][];
1208
+ };
1209
+ };
1210
+ };
1211
+ };
1212
+ };
1213
+ createWithdrawal: {
1214
+ parameters: {
1215
+ query?: never;
1216
+ header?: {
1217
+ /** @description Unique key per operation (≤ 255 chars). Retries with the same key and body replay the first response for 24 h. */
1218
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
1219
+ };
1220
+ path?: never;
1221
+ cookie?: never;
1222
+ };
1223
+ requestBody: {
1224
+ content: {
1225
+ /**
1226
+ * @example {
1227
+ * "external_id": "payout_881",
1228
+ * "currency": "ETH",
1229
+ * "network": "ethereum",
1230
+ * "address": "0x3fD30B246D9A2309093d1ED65d797138872F97B8",
1231
+ * "amount": "0.01",
1232
+ * "customer": "player_1"
1233
+ * }
1234
+ */
1235
+ "application/json": {
1236
+ external_id?: components["schemas"]["ExternalId"];
1237
+ currency: components["schemas"]["CurrencyCode"];
1238
+ network: components["schemas"]["NetworkId"];
1239
+ address: string;
1240
+ amount: components["schemas"]["Decimal"];
1241
+ customer?: components["schemas"]["ExternalId"];
1242
+ };
1243
+ };
1244
+ };
1245
+ responses: {
1246
+ /** @description The withdrawal. */
1247
+ 201: {
1248
+ headers: {
1249
+ "Idempotent-Replayed": components["headers"]["IdempotentReplayed"];
1250
+ [name: string]: unknown;
1251
+ };
1252
+ content: {
1253
+ "application/json": components["schemas"]["Withdrawal"];
1254
+ };
1255
+ };
1256
+ 400: components["responses"]["BadRequest"];
1257
+ 403: components["responses"]["Forbidden"];
1258
+ 409: components["responses"]["Conflict"];
1259
+ 422: components["responses"]["Unprocessable"];
1260
+ 503: components["responses"]["NetworkFeeUnavailable"];
1261
+ };
1262
+ };
1263
+ getWithdrawal: {
1264
+ parameters: {
1265
+ query?: never;
1266
+ header?: never;
1267
+ path: {
1268
+ /** @description `wd_…` id, or your `external_id` (optionally as `ext:<external_id>`). */
1269
+ withdrawal: components["parameters"]["WithdrawalRef"];
1270
+ };
1271
+ cookie?: never;
1272
+ };
1273
+ requestBody?: never;
1274
+ responses: {
1275
+ /** @description The withdrawal. */
1276
+ 200: {
1277
+ headers: {
1278
+ [name: string]: unknown;
1279
+ };
1280
+ content: {
1281
+ "application/json": components["schemas"]["Withdrawal"];
1282
+ };
1283
+ };
1284
+ 404: components["responses"]["NotFound"];
1285
+ };
1286
+ };
1287
+ cancelWithdrawal: {
1288
+ parameters: {
1289
+ query?: never;
1290
+ header?: {
1291
+ /** @description Unique key per operation (≤ 255 chars). Retries with the same key and body replay the first response for 24 h. */
1292
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
1293
+ };
1294
+ path: {
1295
+ /** @description `wd_…` id, or your `external_id` (optionally as `ext:<external_id>`). */
1296
+ withdrawal: components["parameters"]["WithdrawalRef"];
1297
+ };
1298
+ cookie?: never;
1299
+ };
1300
+ requestBody?: never;
1301
+ responses: {
1302
+ /** @description The cancelled withdrawal. */
1303
+ 200: {
1304
+ headers: {
1305
+ [name: string]: unknown;
1306
+ };
1307
+ content: {
1308
+ "application/json": components["schemas"]["Withdrawal"];
1309
+ };
1310
+ };
1311
+ 404: components["responses"]["NotFound"];
1312
+ 422: components["responses"]["Unprocessable"];
1313
+ };
1314
+ };
1315
+ listWebhookEndpoints: {
1316
+ parameters: {
1317
+ query?: {
1318
+ limit?: components["parameters"]["Limit"];
1319
+ /** @description Id of the last item of the previous page. */
1320
+ after?: components["parameters"]["After"];
1321
+ };
1322
+ header?: never;
1323
+ path?: never;
1324
+ cookie?: never;
1325
+ };
1326
+ requestBody?: never;
1327
+ responses: {
1328
+ /** @description A page of endpoints. */
1329
+ 200: {
1330
+ headers: {
1331
+ [name: string]: unknown;
1332
+ };
1333
+ content: {
1334
+ "application/json": components["schemas"]["Page"] & {
1335
+ data?: components["schemas"]["WebhookEndpoint"][];
1336
+ };
1337
+ };
1338
+ };
1339
+ };
1340
+ };
1341
+ createWebhookEndpoint: {
1342
+ parameters: {
1343
+ query?: never;
1344
+ header?: {
1345
+ /** @description Unique key per operation (≤ 255 chars). Retries with the same key and body replay the first response for 24 h. */
1346
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
1347
+ };
1348
+ path?: never;
1349
+ cookie?: never;
1350
+ };
1351
+ requestBody: {
1352
+ content: {
1353
+ /**
1354
+ * @example {
1355
+ * "url": "https://casino.example/webhooks/ghostpay",
1356
+ * "event_types": [
1357
+ * "deposit.credited",
1358
+ * "withdrawal.completed",
1359
+ * "withdrawal.failed"
1360
+ * ]
1361
+ * }
1362
+ */
1363
+ "application/json": {
1364
+ /**
1365
+ * Format: uri
1366
+ * @description Must be https.
1367
+ */
1368
+ url: string;
1369
+ event_types: components["schemas"]["EndpointEventTypes"];
1370
+ /**
1371
+ * @description false = one attempt per delivery; failed deliveries are not retried automatically.
1372
+ * @default true
1373
+ */
1374
+ auto_retry?: boolean;
1375
+ };
1376
+ };
1377
+ };
1378
+ responses: {
1379
+ /** @description The endpoint with its signing secret. */
1380
+ 201: {
1381
+ headers: {
1382
+ [name: string]: unknown;
1383
+ };
1384
+ content: {
1385
+ "application/json": components["schemas"]["WebhookEndpoint"] & {
1386
+ /** @example whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw */
1387
+ secret: string;
1388
+ };
1389
+ };
1390
+ };
1391
+ 400: components["responses"]["BadRequest"];
1392
+ 409: components["responses"]["Conflict"];
1393
+ };
1394
+ };
1395
+ getWebhookEndpoint: {
1396
+ parameters: {
1397
+ query?: never;
1398
+ header?: never;
1399
+ path: {
1400
+ id: string;
1401
+ };
1402
+ cookie?: never;
1403
+ };
1404
+ requestBody?: never;
1405
+ responses: {
1406
+ /** @description The endpoint. */
1407
+ 200: {
1408
+ headers: {
1409
+ [name: string]: unknown;
1410
+ };
1411
+ content: {
1412
+ "application/json": components["schemas"]["WebhookEndpoint"];
1413
+ };
1414
+ };
1415
+ 404: components["responses"]["NotFound"];
1416
+ };
1417
+ };
1418
+ deleteWebhookEndpoint: {
1419
+ parameters: {
1420
+ query?: never;
1421
+ header?: never;
1422
+ path: {
1423
+ id: string;
1424
+ };
1425
+ cookie?: never;
1426
+ };
1427
+ requestBody?: never;
1428
+ responses: {
1429
+ /** @description Deleted. */
1430
+ 200: {
1431
+ headers: {
1432
+ [name: string]: unknown;
1433
+ };
1434
+ content: {
1435
+ "application/json": {
1436
+ id: string;
1437
+ /** @constant */
1438
+ object: "webhook_endpoint";
1439
+ /** @constant */
1440
+ deleted: true;
1441
+ };
1442
+ };
1443
+ };
1444
+ 404: components["responses"]["NotFound"];
1445
+ };
1446
+ };
1447
+ updateWebhookEndpoint: {
1448
+ parameters: {
1449
+ query?: never;
1450
+ header?: never;
1451
+ path: {
1452
+ id: string;
1453
+ };
1454
+ cookie?: never;
1455
+ };
1456
+ requestBody: {
1457
+ content: {
1458
+ "application/json": {
1459
+ /** Format: uri */
1460
+ url?: string;
1461
+ event_types?: components["schemas"]["EndpointEventTypes"];
1462
+ auto_retry?: boolean;
1463
+ enabled?: boolean;
1464
+ };
1465
+ };
1466
+ };
1467
+ responses: {
1468
+ /** @description The updated endpoint. */
1469
+ 200: {
1470
+ headers: {
1471
+ [name: string]: unknown;
1472
+ };
1473
+ content: {
1474
+ "application/json": components["schemas"]["WebhookEndpoint"];
1475
+ };
1476
+ };
1477
+ 400: components["responses"]["BadRequest"];
1478
+ 404: components["responses"]["NotFound"];
1479
+ 409: components["responses"]["Conflict"];
1480
+ };
1481
+ };
1482
+ testWebhookEndpoint: {
1483
+ parameters: {
1484
+ query?: never;
1485
+ header?: never;
1486
+ path: {
1487
+ id: string;
1488
+ };
1489
+ cookie?: never;
1490
+ };
1491
+ requestBody?: never;
1492
+ responses: {
1493
+ /** @description The ping event and its delivery. */
1494
+ 201: {
1495
+ headers: {
1496
+ [name: string]: unknown;
1497
+ };
1498
+ content: {
1499
+ "application/json": {
1500
+ event: components["schemas"]["Event"];
1501
+ delivery: components["schemas"]["WebhookDelivery"];
1502
+ };
1503
+ };
1504
+ };
1505
+ 404: components["responses"]["NotFound"];
1506
+ };
1507
+ };
1508
+ replayWebhookEndpoint: {
1509
+ parameters: {
1510
+ query?: never;
1511
+ header?: never;
1512
+ path: {
1513
+ id: string;
1514
+ };
1515
+ cookie?: never;
1516
+ };
1517
+ requestBody: {
1518
+ content: {
1519
+ "application/json": {
1520
+ /** Format: date-time */
1521
+ from: string;
1522
+ /** Format: date-time */
1523
+ to: string;
1524
+ /** @description Only these types (within the endpoint's own). Default: all of the endpoint's types. */
1525
+ event_types?: components["schemas"]["EventType"][];
1526
+ /**
1527
+ * @description Only events whose delivery to this endpoint failed and never succeeded.
1528
+ * @default false
1529
+ */
1530
+ only_failed?: boolean;
1531
+ };
1532
+ };
1533
+ };
1534
+ responses: {
1535
+ /** @description Number of deliveries queued. */
1536
+ 200: {
1537
+ headers: {
1538
+ [name: string]: unknown;
1539
+ };
1540
+ content: {
1541
+ "application/json": {
1542
+ queued: number;
1543
+ };
1544
+ };
1545
+ };
1546
+ 400: components["responses"]["BadRequest"];
1547
+ 404: components["responses"]["NotFound"];
1548
+ };
1549
+ };
1550
+ listWebhookDeliveries: {
1551
+ parameters: {
1552
+ query?: {
1553
+ limit?: components["parameters"]["Limit"];
1554
+ /** @description Id of the last item of the previous page. */
1555
+ after?: components["parameters"]["After"];
1556
+ endpoint?: string;
1557
+ status?: components["schemas"]["DeliveryStatus"];
1558
+ /** @description `evt_…` id. */
1559
+ event?: string;
1560
+ };
1561
+ header?: never;
1562
+ path?: never;
1563
+ cookie?: never;
1564
+ };
1565
+ requestBody?: never;
1566
+ responses: {
1567
+ /** @description A page of deliveries. */
1568
+ 200: {
1569
+ headers: {
1570
+ [name: string]: unknown;
1571
+ };
1572
+ content: {
1573
+ "application/json": components["schemas"]["Page"] & {
1574
+ data?: components["schemas"]["WebhookDelivery"][];
1575
+ };
1576
+ };
1577
+ };
1578
+ };
1579
+ };
1580
+ getWebhookDelivery: {
1581
+ parameters: {
1582
+ query?: never;
1583
+ header?: never;
1584
+ path: {
1585
+ id: string;
1586
+ };
1587
+ cookie?: never;
1588
+ };
1589
+ requestBody?: never;
1590
+ responses: {
1591
+ /** @description The delivery and every attempt (status code, response body, timing). */
1592
+ 200: {
1593
+ headers: {
1594
+ [name: string]: unknown;
1595
+ };
1596
+ content: {
1597
+ "application/json": components["schemas"]["WebhookDelivery"] & {
1598
+ attempt_log: components["schemas"]["WebhookAttempt"][];
1599
+ };
1600
+ };
1601
+ };
1602
+ 404: components["responses"]["NotFound"];
1603
+ };
1604
+ };
1605
+ retryWebhookDelivery: {
1606
+ parameters: {
1607
+ query?: never;
1608
+ header?: never;
1609
+ path: {
1610
+ id: string;
1611
+ };
1612
+ cookie?: never;
1613
+ };
1614
+ requestBody?: never;
1615
+ responses: {
1616
+ /** @description The new delivery (PENDING). */
1617
+ 201: {
1618
+ headers: {
1619
+ [name: string]: unknown;
1620
+ };
1621
+ content: {
1622
+ "application/json": components["schemas"]["WebhookDelivery"];
1623
+ };
1624
+ };
1625
+ 404: components["responses"]["NotFound"];
1626
+ 422: components["responses"]["Unprocessable"];
1627
+ };
1628
+ };
1629
+ listTransactions: {
1630
+ parameters: {
1631
+ query?: {
1632
+ limit?: components["parameters"]["Limit"];
1633
+ /** @description Id of the last item of the previous page. */
1634
+ after?: components["parameters"]["After"];
1635
+ /** @description Your external id, `ext:<external_id>`, or a `cus_…` id. */
1636
+ customer?: components["parameters"]["CustomerFilter"];
1637
+ type?: "deposit" | "top_up" | "withdrawal" | "payout";
1638
+ network?: components["schemas"]["NetworkId"];
1639
+ currency?: components["schemas"]["CurrencyCode"];
1640
+ /** @description A deposit or withdrawal status; only transactions of the kind that has it match. */
1641
+ status?: "PENDING" | "CREDITED" | "HELD" | "ORPHANED" | "FAILED" | "QUEUED" | "SENT" | "COMPLETED" | "CANCELLED";
1642
+ };
1643
+ header?: never;
1644
+ path?: never;
1645
+ cookie?: never;
1646
+ };
1647
+ requestBody?: never;
1648
+ responses: {
1649
+ /** @description A page of transactions. */
1650
+ 200: {
1651
+ headers: {
1652
+ [name: string]: unknown;
1653
+ };
1654
+ content: {
1655
+ "application/json": {
1656
+ data: components["schemas"]["Transaction"][];
1657
+ has_more: boolean;
1658
+ };
1659
+ };
1660
+ };
1661
+ 400: components["responses"]["BadRequest"];
1662
+ };
1663
+ };
1664
+ getTransaction: {
1665
+ parameters: {
1666
+ query?: never;
1667
+ header?: never;
1668
+ path: {
1669
+ /** @description `dep_…` or `wd_…` id. */
1670
+ id: string;
1671
+ };
1672
+ cookie?: never;
1673
+ };
1674
+ requestBody?: never;
1675
+ responses: {
1676
+ /** @description The transaction. */
1677
+ 200: {
1678
+ headers: {
1679
+ [name: string]: unknown;
1680
+ };
1681
+ content: {
1682
+ "application/json": components["schemas"]["TransactionDetail"];
1683
+ };
1684
+ };
1685
+ 404: components["responses"]["NotFound"];
1686
+ };
1687
+ };
1688
+ getStats: {
1689
+ parameters: {
1690
+ query?: {
1691
+ days?: number;
1692
+ };
1693
+ header?: never;
1694
+ path?: never;
1695
+ cookie?: never;
1696
+ };
1697
+ requestBody?: never;
1698
+ responses: {
1699
+ /** @description The stats. */
1700
+ 200: {
1701
+ headers: {
1702
+ [name: string]: unknown;
1703
+ };
1704
+ content: {
1705
+ "application/json": components["schemas"]["Stats"];
1706
+ };
1707
+ };
1708
+ 400: components["responses"]["BadRequest"];
1709
+ };
1710
+ };
1711
+ listEvents: {
1712
+ parameters: {
1713
+ query?: {
1714
+ limit?: components["parameters"]["Limit"];
1715
+ /** @description Return events after this id, oldest first. */
1716
+ after?: string;
1717
+ type?: components["schemas"]["EventType"];
1718
+ /** @description e.g. a `dep_…` or `wd_…` id. */
1719
+ object_id?: string;
1720
+ };
1721
+ header?: never;
1722
+ path?: never;
1723
+ cookie?: never;
1724
+ };
1725
+ requestBody?: never;
1726
+ responses: {
1727
+ /** @description A page of events. */
1728
+ 200: {
1729
+ headers: {
1730
+ [name: string]: unknown;
1731
+ };
1732
+ content: {
1733
+ "application/json": components["schemas"]["Page"] & {
1734
+ data?: components["schemas"]["Event"][];
1735
+ };
1736
+ };
1737
+ };
1738
+ };
1739
+ };
1740
+ getEvent: {
1741
+ parameters: {
1742
+ query?: never;
1743
+ header?: never;
1744
+ path: {
1745
+ id: string;
1746
+ };
1747
+ cookie?: never;
1748
+ };
1749
+ requestBody?: never;
1750
+ responses: {
1751
+ /** @description The event. */
1752
+ 200: {
1753
+ headers: {
1754
+ [name: string]: unknown;
1755
+ };
1756
+ content: {
1757
+ "application/json": components["schemas"]["Event"];
1758
+ };
1759
+ };
1760
+ 404: components["responses"]["NotFound"];
1761
+ };
1762
+ };
1763
+ getSettings: {
1764
+ parameters: {
1765
+ query?: never;
1766
+ header?: never;
1767
+ path?: never;
1768
+ cookie?: never;
1769
+ };
1770
+ requestBody?: never;
1771
+ responses: {
1772
+ /** @description Your settings. */
1773
+ 200: {
1774
+ headers: {
1775
+ [name: string]: unknown;
1776
+ };
1777
+ content: {
1778
+ "application/json": components["schemas"]["Settings"];
1779
+ };
1780
+ };
1781
+ };
1782
+ };
1783
+ getCheckout: {
1784
+ parameters: {
1785
+ query?: never;
1786
+ header?: never;
1787
+ path: {
1788
+ invoice: components["parameters"]["InvoiceId"];
1789
+ };
1790
+ cookie?: never;
1791
+ };
1792
+ requestBody?: never;
1793
+ responses: {
1794
+ /** @description The checkout. */
1795
+ 200: {
1796
+ headers: {
1797
+ [name: string]: unknown;
1798
+ };
1799
+ content: {
1800
+ "application/json": components["schemas"]["Checkout"];
1801
+ };
1802
+ };
1803
+ 404: components["responses"]["NotFound"];
1804
+ };
1805
+ };
1806
+ selectCheckoutCurrency: {
1807
+ parameters: {
1808
+ query?: never;
1809
+ header?: never;
1810
+ path: {
1811
+ invoice: components["parameters"]["InvoiceId"];
1812
+ };
1813
+ cookie?: never;
1814
+ };
1815
+ requestBody: {
1816
+ content: {
1817
+ "application/json": {
1818
+ currency: components["schemas"]["CurrencyCode"];
1819
+ network: components["schemas"]["NetworkId"];
1820
+ };
1821
+ };
1822
+ };
1823
+ responses: {
1824
+ /** @description The updated checkout. */
1825
+ 200: {
1826
+ headers: {
1827
+ [name: string]: unknown;
1828
+ };
1829
+ content: {
1830
+ "application/json": components["schemas"]["Checkout"];
1831
+ };
1832
+ };
1833
+ 404: components["responses"]["NotFound"];
1834
+ 422: components["responses"]["Unprocessable"];
1835
+ };
1836
+ };
1837
+ receiveEvent: {
1838
+ parameters: {
1839
+ query?: never;
1840
+ header: {
1841
+ /** @description The event id (`evt_…`). Same on every retry. */
1842
+ "webhook-id": string;
1843
+ /** @description Unix seconds when this attempt was signed. */
1844
+ "webhook-timestamp": string;
1845
+ /** @description `v1,<base64 HMAC-SHA256 of "{id}.{timestamp}.{body}">` */
1846
+ "webhook-signature": string;
1847
+ };
1848
+ path?: never;
1849
+ cookie?: never;
1850
+ };
1851
+ requestBody: {
1852
+ content: {
1853
+ "application/json": components["schemas"]["WebhookPayload"];
1854
+ };
1855
+ };
1856
+ responses: {
1857
+ /** @description Any 2xx acknowledges the event. */
1858
+ 200: {
1859
+ headers: {
1860
+ [name: string]: unknown;
1861
+ };
1862
+ content?: never;
1863
+ };
1864
+ };
1865
+ };
1866
+ }
1867
+
1868
+ type Schemas = components["schemas"];
1869
+ type Body<Op extends keyof operations> = operations[Op] extends {
1870
+ requestBody: {
1871
+ content: {
1872
+ "application/json": infer B;
1873
+ };
1874
+ };
1875
+ } ? B : never;
1876
+ type Query<Op extends keyof operations> = operations[Op] extends {
1877
+ parameters: {
1878
+ query?: infer Q;
1879
+ };
1880
+ } ? NonNullable<Q> : never;
1881
+ type NetworkId = Schemas["NetworkId"];
1882
+ type CurrencyCode = Schemas["CurrencyCode"];
1883
+ type NetworkCurrencyId = Schemas["NetworkCurrencyId"];
1884
+ type Family = Schemas["Family"];
1885
+ type Decimal = Schemas["Decimal"];
1886
+ type Metadata = Schemas["Metadata"];
1887
+ type Network = Schemas["Network"];
1888
+ type Currency = Schemas["Currency"];
1889
+ type Rate = Data<operations["listRates"]>[number];
1890
+ type Balance = Schemas["Balance"];
1891
+ type Customer = Schemas["Customer"];
1892
+ type Address = Schemas["Address"];
1893
+ type AcceptedCurrency = Schemas["AcceptedCurrency"];
1894
+ type Deposit = Schemas["Deposit"];
1895
+ type DepositStatus = Schemas["DepositStatus"];
1896
+ type Invoice = Schemas["Invoice"];
1897
+ type InvoiceStatus = Schemas["InvoiceStatus"];
1898
+ type Checkout = Schemas["Checkout"];
1899
+ type Withdrawal = Schemas["Withdrawal"];
1900
+ type WithdrawalStatus = Schemas["WithdrawalStatus"];
1901
+ type WithdrawalQuote = Schemas["WithdrawalQuote"];
1902
+ type WebhookEndpoint = Schemas["WebhookEndpoint"];
1903
+ type WebhookEndpointWithSecret = WebhookEndpoint & {
1904
+ secret: string;
1905
+ };
1906
+ type WebhookDelivery = Schemas["WebhookDelivery"];
1907
+ type WebhookAttempt = Schemas["WebhookAttempt"];
1908
+ type WebhookDeliveryWithAttempts = WebhookDelivery & {
1909
+ attempt_log: WebhookAttempt[];
1910
+ };
1911
+ type DeliveryStatus = Schemas["DeliveryStatus"];
1912
+ type Settings = Schemas["Settings"];
1913
+ type Transaction = Schemas["Transaction"];
1914
+ type TransactionDetail = Schemas["TransactionDetail"];
1915
+ type TransactionType = Transaction["type"];
1916
+ type Stats = Schemas["Stats"];
1917
+ type ErrorCode = Schemas["Error"]["error"]["code"];
1918
+ type EventType = Schemas["EventType"];
1919
+ type EndpointEventType = Schemas["EndpointEventTypes"][number];
1920
+ type Ping = {
1921
+ object: "ping";
1922
+ endpoint: string;
1923
+ message: string;
1924
+ };
1925
+ /** The object an event of each type carries. */
1926
+ type EventData<T extends EventType> = T extends `deposit.${string}` ? Deposit : T extends `withdrawal.${string}` ? Withdrawal : T extends `invoice.${string}` ? Invoice : Ping;
1927
+ /** A webhook request body, narrowed by `type`. */
1928
+ type WebhookEvent = {
1929
+ [T in EventType]: {
1930
+ id: string;
1931
+ type: T;
1932
+ created_at: string;
1933
+ data: EventData<T>;
1934
+ };
1935
+ }[EventType];
1936
+ /** An event from `GET /v1/events`, narrowed by `type`. */
1937
+ type Event = {
1938
+ [T in EventType]: {
1939
+ id: string;
1940
+ object: "event";
1941
+ type: T;
1942
+ object_id: string;
1943
+ data: EventData<T>;
1944
+ created_at: string;
1945
+ };
1946
+ }[EventType];
1947
+ type Page<T> = {
1948
+ data: T[];
1949
+ has_more: boolean;
1950
+ };
1951
+ type Data<Op> = Op extends {
1952
+ responses: {
1953
+ 200: {
1954
+ content: {
1955
+ "application/json": {
1956
+ data: infer D;
1957
+ };
1958
+ };
1959
+ };
1960
+ };
1961
+ } ? D : never;
1962
+ type CustomerUpsertParams = Body<"upsertCustomer">;
1963
+ type CustomerListParams = Query<"listCustomers">;
1964
+ type AddressCreateParams = Body<"getOrCreateAddress">;
1965
+ type AddressListParams = Query<"listAddresses">;
1966
+ type DepositListParams = Query<"listDeposits">;
1967
+ type InvoiceCreateParams = Body<"createInvoice">;
1968
+ type InvoiceListParams = Query<"listInvoices">;
1969
+ type WithdrawalQuoteParams = Body<"quoteWithdrawal">;
1970
+ type WithdrawalCreateParams = Body<"createWithdrawal">;
1971
+ type WithdrawalListParams = Query<"listWithdrawals">;
1972
+ type WebhookEndpointCreateParams = Body<"createWebhookEndpoint">;
1973
+ type WebhookEndpointListParams = Query<"listWebhookEndpoints">;
1974
+ type WebhookEndpointUpdateParams = Body<"updateWebhookEndpoint">;
1975
+ type WebhookReplayParams = Body<"replayWebhookEndpoint">;
1976
+ type WebhookDeliveryListParams = Query<"listWebhookDeliveries">;
1977
+ type EventListParams = Query<"listEvents">;
1978
+ type TransactionListParams = Query<"listTransactions">;
1979
+ type StatsParams = Query<"getStats">;
1980
+ type CheckoutSelectParams = Body<"selectCheckoutCurrency">;
1981
+
1982
+ interface GhostPayOptions {
1983
+ /** Secret API key (`gp_live_…`). Only the public checkout calls work without one. */
1984
+ apiKey?: string;
1985
+ /** API host. Default `https://api.ghostpay.gg`. */
1986
+ baseUrl?: string;
1987
+ /** Per-attempt timeout. Default 30 s. */
1988
+ timeoutMs?: number;
1989
+ /** Retries after a network error, timeout, 429 or 5xx (always with the same Idempotency-Key). Default 2. */
1990
+ maxRetries?: number;
1991
+ /** Custom fetch (proxies, tests). Default: global fetch. */
1992
+ fetch?: typeof fetch;
1993
+ /** Appended to the User-Agent, e.g. `my-casino/2.1`. */
1994
+ appInfo?: string;
1995
+ }
1996
+ interface RequestOptions {
1997
+ /** Idempotency-Key for this POST. Default: a random UUID, reused on every retry of this call. */
1998
+ idempotencyKey?: string;
1999
+ timeoutMs?: number;
2000
+ maxRetries?: number;
2001
+ signal?: AbortSignal;
2002
+ headers?: Record<string, string>;
2003
+ }
2004
+ interface ResponseMeta {
2005
+ status: number;
2006
+ headers: Headers;
2007
+ /** The API replayed a stored response for this Idempotency-Key. */
2008
+ idempotentReplayed: boolean;
2009
+ idempotencyKey: string | undefined;
2010
+ }
2011
+ /** A response object; `lastResponse` (not enumerable, not serialized) has status, headers and idempotency info. */
2012
+ type WithResponse<T> = T & {
2013
+ readonly lastResponse: ResponseMeta;
2014
+ };
2015
+ /** A list call: await it for one page, or `for await` it to walk every item across pages. */
2016
+ type ListResult<T> = Promise<WithResponse<Page<T>>> & AsyncIterable<T>;
2017
+
2018
+ type WebhookHeaders = Headers | Record<string, string | string[] | undefined>;
2019
+ type WebhookPayload = string | Uint8Array;
2020
+ interface WebhookOptions {
2021
+ /** Accepted clock difference in seconds, both ways. Default 300 (5 minutes). */
2022
+ toleranceSec?: number;
2023
+ }
2024
+ /**
2025
+ * Verifies GhostPay webhook requests (Standard Webhooks: HMAC-SHA256 over `{webhook-id}.{webhook-timestamp}.{body}`).
2026
+ * Pass several secrets while rotating an endpoint's secret.
2027
+ */
2028
+ declare class Webhook {
2029
+ private readonly keys;
2030
+ private readonly toleranceSec;
2031
+ constructor(secret: string | string[], options?: WebhookOptions);
2032
+ /**
2033
+ * Checks the signature and timestamp and returns the parsed, typed event. `payload` must be the raw request body,
2034
+ * exactly as received (e.g. `express.raw({ type: "application/json" })`), never re-serialized JSON.
2035
+ */
2036
+ verify(payload: WebhookPayload, headers: WebhookHeaders, now?: Date): WebhookEvent;
2037
+ /** The `webhook-signature` header value for a body (for your own tests). */
2038
+ sign(id: string, timestamp: number | Date, payload: WebhookPayload): string;
2039
+ }
2040
+
2041
+ declare class GhostPay {
2042
+ readonly networks: {
2043
+ /** Every network, with confirmations and whether deposits/withdrawals are on. */
2044
+ list: (opts?: RequestOptions) => Promise<WithResponse<Page<{
2045
+ id: components["schemas"]["NetworkId"];
2046
+ object: "network";
2047
+ name: string;
2048
+ family: components["schemas"]["Family"];
2049
+ confirmations: number;
2050
+ sweeps: boolean;
2051
+ block_time_ms: number;
2052
+ deposits_enabled: boolean;
2053
+ withdrawals_enabled: boolean;
2054
+ explorer_tx_url: string;
2055
+ explorer_address_url: string;
2056
+ }>>>;
2057
+ };
2058
+ readonly currencies: {
2059
+ /** Enabled currencies with your minimums and fees. */
2060
+ list: (opts?: RequestOptions) => Promise<WithResponse<Page<{
2061
+ network_currency: components["schemas"]["NetworkCurrencyId"];
2062
+ currency: string;
2063
+ network: components["schemas"]["NetworkId"];
2064
+ family: components["schemas"]["Family"];
2065
+ contract: string | null;
2066
+ decimals: number;
2067
+ min_deposit: components["schemas"]["Decimal"];
2068
+ min_withdrawal: components["schemas"]["Decimal"];
2069
+ confirmations: number;
2070
+ deposits_enabled: boolean;
2071
+ withdrawals_enabled: boolean;
2072
+ fees: {
2073
+ deposit_percent: string;
2074
+ deposit_network: components["schemas"]["Decimal"];
2075
+ };
2076
+ }>>>;
2077
+ };
2078
+ readonly rates: {
2079
+ /** Indicative USD price per currency. */
2080
+ list: (opts?: RequestOptions) => Promise<WithResponse<Page<{
2081
+ currency: string;
2082
+ usd: components["schemas"]["Decimal"];
2083
+ }>>>;
2084
+ };
2085
+ readonly balances: {
2086
+ /** Available, on-hold and pending balance per currency. */
2087
+ list: (opts?: RequestOptions) => Promise<WithResponse<Page<{
2088
+ object: "balance";
2089
+ currency: string;
2090
+ network: components["schemas"]["NetworkId"];
2091
+ network_currency: components["schemas"]["NetworkCurrencyId"];
2092
+ available: components["schemas"]["Decimal"];
2093
+ on_hold: components["schemas"]["Decimal"];
2094
+ pending: components["schemas"]["Decimal"];
2095
+ withdrawals_paused: boolean;
2096
+ deposits_enabled: boolean;
2097
+ withdrawals_enabled: boolean;
2098
+ value?: components["schemas"]["UsdValue"];
2099
+ }>>>;
2100
+ };
2101
+ readonly customers: {
2102
+ /** Create the customer, or update its metadata if `external_id` exists. */
2103
+ upsert: (params: CustomerUpsertParams, opts?: RequestOptions) => Promise<WithResponse<{
2104
+ id: string;
2105
+ object: "customer";
2106
+ external_id: components["schemas"]["ExternalId"];
2107
+ metadata: components["schemas"]["Metadata"];
2108
+ created_at: components["schemas"]["Timestamp"];
2109
+ updated_at: components["schemas"]["Timestamp"];
2110
+ }>>;
2111
+ list: (params?: CustomerListParams, opts?: RequestOptions) => ListResult<Customer>;
2112
+ /** By `cus_…` id or `ext:<external_id>`. */
2113
+ get: (customer: string, opts?: RequestOptions) => Promise<WithResponse<{
2114
+ id: string;
2115
+ object: "customer";
2116
+ external_id: components["schemas"]["ExternalId"];
2117
+ metadata: components["schemas"]["Metadata"];
2118
+ created_at: components["schemas"]["Timestamp"];
2119
+ updated_at: components["schemas"]["Timestamp"];
2120
+ }>>;
2121
+ getByExternalId: (externalId: string, opts?: RequestOptions) => Promise<WithResponse<{
2122
+ id: string;
2123
+ object: "customer";
2124
+ external_id: components["schemas"]["ExternalId"];
2125
+ metadata: components["schemas"]["Metadata"];
2126
+ created_at: components["schemas"]["Timestamp"];
2127
+ updated_at: components["schemas"]["Timestamp"];
2128
+ }>>;
2129
+ };
2130
+ readonly addresses: {
2131
+ /** The customer's permanent deposit address for the network's address scope (created on first call; `lastResponse.status` 201). */
2132
+ getOrCreate: (params: AddressCreateParams, opts?: RequestOptions) => Promise<WithResponse<{
2133
+ id: string;
2134
+ object: "address";
2135
+ address: string;
2136
+ top_up: boolean;
2137
+ family: components["schemas"]["Family"];
2138
+ kind: "DEPOSIT";
2139
+ customer: string | null;
2140
+ invoice: string | null;
2141
+ accepts: components["schemas"]["AcceptedCurrency"][];
2142
+ retired_at: components["schemas"]["NullableTimestamp"];
2143
+ created_at: components["schemas"]["Timestamp"];
2144
+ }>>;
2145
+ list: (params?: AddressListParams, opts?: RequestOptions) => ListResult<Address>;
2146
+ /** By `addr_…` id or the on-chain address. */
2147
+ get: (address: string, opts?: RequestOptions) => Promise<WithResponse<{
2148
+ id: string;
2149
+ object: "address";
2150
+ address: string;
2151
+ top_up: boolean;
2152
+ family: components["schemas"]["Family"];
2153
+ kind: "DEPOSIT";
2154
+ customer: string | null;
2155
+ invoice: string | null;
2156
+ accepts: components["schemas"]["AcceptedCurrency"][];
2157
+ retired_at: components["schemas"]["NullableTimestamp"];
2158
+ created_at: components["schemas"]["Timestamp"];
2159
+ }>>;
2160
+ /** Stop handing this address out; payments to it are still credited. */
2161
+ retire: (address: string, opts?: RequestOptions) => Promise<WithResponse<{
2162
+ id: string;
2163
+ object: "address";
2164
+ address: string;
2165
+ top_up: boolean;
2166
+ family: components["schemas"]["Family"];
2167
+ kind: "DEPOSIT";
2168
+ customer: string | null;
2169
+ invoice: string | null;
2170
+ accepts: components["schemas"]["AcceptedCurrency"][];
2171
+ retired_at: components["schemas"]["NullableTimestamp"];
2172
+ created_at: components["schemas"]["Timestamp"];
2173
+ }>>;
2174
+ /** Your own addresses for funding your balance, one per address scope; credited with no fees. */
2175
+ topUps: (opts?: RequestOptions) => Promise<WithResponse<{
2176
+ data: Address[];
2177
+ }>>;
2178
+ };
2179
+ readonly deposits: {
2180
+ list: (params?: DepositListParams, opts?: RequestOptions) => ListResult<Deposit>;
2181
+ get: (id: string, opts?: RequestOptions) => Promise<WithResponse<{
2182
+ id: string;
2183
+ object: "deposit";
2184
+ status: components["schemas"]["DepositStatus"];
2185
+ customer: string | null;
2186
+ address: string;
2187
+ top_up: boolean;
2188
+ currency: string;
2189
+ network: components["schemas"]["NetworkId"];
2190
+ network_currency: components["schemas"]["NetworkCurrencyId"];
2191
+ amount: components["schemas"]["Decimal"];
2192
+ fee: components["schemas"]["Decimal"];
2193
+ net_amount: components["schemas"]["Decimal"];
2194
+ tx_hash: string;
2195
+ from_address: string | null;
2196
+ confirmations: number;
2197
+ confirmations_required: number;
2198
+ block_height: string | null;
2199
+ invoice: string | null;
2200
+ hold_reason: "REVIEW" | null;
2201
+ late: boolean;
2202
+ explorer_url: string | null;
2203
+ version: number;
2204
+ created_at: components["schemas"]["Timestamp"];
2205
+ credited_at: components["schemas"]["NullableTimestamp"];
2206
+ value?: components["schemas"]["UsdValue"];
2207
+ }>>;
2208
+ };
2209
+ readonly invoices: {
2210
+ create: (params: InvoiceCreateParams, opts?: RequestOptions) => Promise<WithResponse<{
2211
+ id: string;
2212
+ object: "invoice";
2213
+ status: components["schemas"]["InvoiceStatus"];
2214
+ order_id: string;
2215
+ description: string | null;
2216
+ customer: string | null;
2217
+ price_amount: components["schemas"]["Decimal"];
2218
+ price_currency: string;
2219
+ currency: string | null;
2220
+ network: string | null;
2221
+ network_currency: string | null;
2222
+ address: string | null;
2223
+ pay_amount: string | null;
2224
+ paid_amount: components["schemas"]["Decimal"];
2225
+ payer_pays_fees: boolean;
2226
+ checkout_url: string;
2227
+ return_url: string | null;
2228
+ deposits: string[];
2229
+ metadata: components["schemas"]["Metadata"];
2230
+ version: number;
2231
+ expires_at: components["schemas"]["Timestamp"];
2232
+ paid_at: components["schemas"]["NullableTimestamp"];
2233
+ created_at: components["schemas"]["Timestamp"];
2234
+ }>>;
2235
+ list: (params?: InvoiceListParams, opts?: RequestOptions) => ListResult<Invoice>;
2236
+ get: (id: string, opts?: RequestOptions) => Promise<WithResponse<{
2237
+ id: string;
2238
+ object: "invoice";
2239
+ status: components["schemas"]["InvoiceStatus"];
2240
+ order_id: string;
2241
+ description: string | null;
2242
+ customer: string | null;
2243
+ price_amount: components["schemas"]["Decimal"];
2244
+ price_currency: string;
2245
+ currency: string | null;
2246
+ network: string | null;
2247
+ network_currency: string | null;
2248
+ address: string | null;
2249
+ pay_amount: string | null;
2250
+ paid_amount: components["schemas"]["Decimal"];
2251
+ payer_pays_fees: boolean;
2252
+ checkout_url: string;
2253
+ return_url: string | null;
2254
+ deposits: string[];
2255
+ metadata: components["schemas"]["Metadata"];
2256
+ version: number;
2257
+ expires_at: components["schemas"]["Timestamp"];
2258
+ paid_at: components["schemas"]["NullableTimestamp"];
2259
+ created_at: components["schemas"]["Timestamp"];
2260
+ }>>;
2261
+ /** Only while `NEW`. */
2262
+ cancel: (id: string, opts?: RequestOptions) => Promise<WithResponse<{
2263
+ id: string;
2264
+ object: "invoice";
2265
+ status: components["schemas"]["InvoiceStatus"];
2266
+ order_id: string;
2267
+ description: string | null;
2268
+ customer: string | null;
2269
+ price_amount: components["schemas"]["Decimal"];
2270
+ price_currency: string;
2271
+ currency: string | null;
2272
+ network: string | null;
2273
+ network_currency: string | null;
2274
+ address: string | null;
2275
+ pay_amount: string | null;
2276
+ paid_amount: components["schemas"]["Decimal"];
2277
+ payer_pays_fees: boolean;
2278
+ checkout_url: string;
2279
+ return_url: string | null;
2280
+ deposits: string[];
2281
+ metadata: components["schemas"]["Metadata"];
2282
+ version: number;
2283
+ expires_at: components["schemas"]["Timestamp"];
2284
+ paid_at: components["schemas"]["NullableTimestamp"];
2285
+ created_at: components["schemas"]["Timestamp"];
2286
+ }>>;
2287
+ };
2288
+ readonly withdrawals: {
2289
+ /** Fee, total and whether your balance covers it. Creates nothing. */
2290
+ quote: (params: WithdrawalQuoteParams, opts?: RequestOptions) => Promise<WithResponse<{
2291
+ object: "withdrawal_quote";
2292
+ currency: string;
2293
+ network: components["schemas"]["NetworkId"];
2294
+ network_currency: components["schemas"]["NetworkCurrencyId"];
2295
+ amount: components["schemas"]["Decimal"];
2296
+ network_fee_max: components["schemas"]["Decimal"];
2297
+ total_max: components["schemas"]["Decimal"];
2298
+ min_withdrawal: components["schemas"]["Decimal"];
2299
+ available: components["schemas"]["Decimal"];
2300
+ sufficient_balance: boolean;
2301
+ withdrawals_paused: boolean;
2302
+ value?: components["schemas"]["UsdValue"];
2303
+ }>>;
2304
+ /**
2305
+ * Pays out from your balance. The Idempotency-Key defaults to `withdrawal:<external_id>` when you give an
2306
+ * `external_id`, so retrying the same payout (even after a restart) can never pay twice.
2307
+ */
2308
+ create: (params: WithdrawalCreateParams, opts?: RequestOptions) => Promise<WithResponse<{
2309
+ id: string;
2310
+ object: "withdrawal";
2311
+ status: components["schemas"]["WithdrawalStatus"];
2312
+ external_id: string | null;
2313
+ customer: string | null;
2314
+ currency: string;
2315
+ network: components["schemas"]["NetworkId"];
2316
+ network_currency: components["schemas"]["NetworkCurrencyId"];
2317
+ address: string;
2318
+ amount: components["schemas"]["Decimal"];
2319
+ network_fee: components["schemas"]["Decimal"] | null;
2320
+ network_fee_max: components["schemas"]["Decimal"];
2321
+ total: components["schemas"]["Decimal"];
2322
+ tx_hash: string | null;
2323
+ explorer_url: string | null;
2324
+ failure_reason: string | null;
2325
+ version: number;
2326
+ created_at: components["schemas"]["Timestamp"];
2327
+ completed_at: components["schemas"]["NullableTimestamp"];
2328
+ value?: components["schemas"]["UsdValue"];
2329
+ }>>;
2330
+ list: (params?: WithdrawalListParams, opts?: RequestOptions) => ListResult<Withdrawal>;
2331
+ /** By `wd_…` id or your external id. */
2332
+ get: (withdrawal: string, opts?: RequestOptions) => Promise<WithResponse<{
2333
+ id: string;
2334
+ object: "withdrawal";
2335
+ status: components["schemas"]["WithdrawalStatus"];
2336
+ external_id: string | null;
2337
+ customer: string | null;
2338
+ currency: string;
2339
+ network: components["schemas"]["NetworkId"];
2340
+ network_currency: components["schemas"]["NetworkCurrencyId"];
2341
+ address: string;
2342
+ amount: components["schemas"]["Decimal"];
2343
+ network_fee: components["schemas"]["Decimal"] | null;
2344
+ network_fee_max: components["schemas"]["Decimal"];
2345
+ total: components["schemas"]["Decimal"];
2346
+ tx_hash: string | null;
2347
+ explorer_url: string | null;
2348
+ failure_reason: string | null;
2349
+ version: number;
2350
+ created_at: components["schemas"]["Timestamp"];
2351
+ completed_at: components["schemas"]["NullableTimestamp"];
2352
+ value?: components["schemas"]["UsdValue"];
2353
+ }>>;
2354
+ getByExternalId: (externalId: string, opts?: RequestOptions) => Promise<WithResponse<{
2355
+ id: string;
2356
+ object: "withdrawal";
2357
+ status: components["schemas"]["WithdrawalStatus"];
2358
+ external_id: string | null;
2359
+ customer: string | null;
2360
+ currency: string;
2361
+ network: components["schemas"]["NetworkId"];
2362
+ network_currency: components["schemas"]["NetworkCurrencyId"];
2363
+ address: string;
2364
+ amount: components["schemas"]["Decimal"];
2365
+ network_fee: components["schemas"]["Decimal"] | null;
2366
+ network_fee_max: components["schemas"]["Decimal"];
2367
+ total: components["schemas"]["Decimal"];
2368
+ tx_hash: string | null;
2369
+ explorer_url: string | null;
2370
+ failure_reason: string | null;
2371
+ version: number;
2372
+ created_at: components["schemas"]["Timestamp"];
2373
+ completed_at: components["schemas"]["NullableTimestamp"];
2374
+ value?: components["schemas"]["UsdValue"];
2375
+ }>>;
2376
+ /** Only before it is sent. The hold returns to your available balance. */
2377
+ cancel: (withdrawal: string, opts?: RequestOptions) => Promise<WithResponse<{
2378
+ id: string;
2379
+ object: "withdrawal";
2380
+ status: components["schemas"]["WithdrawalStatus"];
2381
+ external_id: string | null;
2382
+ customer: string | null;
2383
+ currency: string;
2384
+ network: components["schemas"]["NetworkId"];
2385
+ network_currency: components["schemas"]["NetworkCurrencyId"];
2386
+ address: string;
2387
+ amount: components["schemas"]["Decimal"];
2388
+ network_fee: components["schemas"]["Decimal"] | null;
2389
+ network_fee_max: components["schemas"]["Decimal"];
2390
+ total: components["schemas"]["Decimal"];
2391
+ tx_hash: string | null;
2392
+ explorer_url: string | null;
2393
+ failure_reason: string | null;
2394
+ version: number;
2395
+ created_at: components["schemas"]["Timestamp"];
2396
+ completed_at: components["schemas"]["NullableTimestamp"];
2397
+ value?: components["schemas"]["UsdValue"];
2398
+ }>>;
2399
+ };
2400
+ readonly webhookEndpoints: {
2401
+ /** The response's `secret` is shown only once: store it. Not retried once sent (a retry would create a second endpoint). */
2402
+ create: (params: WebhookEndpointCreateParams, opts?: RequestOptions) => Promise<WithResponse<WebhookEndpointWithSecret>>;
2403
+ list: (params?: WebhookEndpointListParams, opts?: RequestOptions) => ListResult<WebhookEndpoint>;
2404
+ get: (id: string, opts?: RequestOptions) => Promise<WithResponse<{
2405
+ id: string;
2406
+ object: "webhook_endpoint";
2407
+ url: string;
2408
+ event_types: components["schemas"]["EndpointEventTypes"];
2409
+ auto_retry: boolean;
2410
+ enabled: boolean;
2411
+ failing_since: components["schemas"]["NullableTimestamp"];
2412
+ disabled_reason: string | null;
2413
+ success_rate_24h?: number | null;
2414
+ created_at: components["schemas"]["Timestamp"];
2415
+ updated_at: components["schemas"]["Timestamp"];
2416
+ }>>;
2417
+ update: (id: string, params: WebhookEndpointUpdateParams, opts?: RequestOptions) => Promise<WithResponse<{
2418
+ id: string;
2419
+ object: "webhook_endpoint";
2420
+ url: string;
2421
+ event_types: components["schemas"]["EndpointEventTypes"];
2422
+ auto_retry: boolean;
2423
+ enabled: boolean;
2424
+ failing_since: components["schemas"]["NullableTimestamp"];
2425
+ disabled_reason: string | null;
2426
+ success_rate_24h?: number | null;
2427
+ created_at: components["schemas"]["Timestamp"];
2428
+ updated_at: components["schemas"]["Timestamp"];
2429
+ }>>;
2430
+ delete: (id: string, opts?: RequestOptions) => Promise<WithResponse<{
2431
+ id: string;
2432
+ object: "webhook_endpoint";
2433
+ deleted: true;
2434
+ }>>;
2435
+ /** Sends a `ping` event to this endpoint. */
2436
+ test: (id: string, opts?: RequestOptions) => Promise<WithResponse<{
2437
+ event: Event;
2438
+ delivery: WebhookDelivery;
2439
+ }>>;
2440
+ /** Re-sends matching events created in `[from, to]` as new deliveries; events already queued for the endpoint are skipped. */
2441
+ replay: (id: string, params: WebhookReplayParams, opts?: RequestOptions) => Promise<WithResponse<{
2442
+ queued: number;
2443
+ }>>;
2444
+ };
2445
+ readonly webhookDeliveries: {
2446
+ list: (params?: WebhookDeliveryListParams, opts?: RequestOptions) => ListResult<WebhookDelivery>;
2447
+ /** With every attempt (status code, response body, timing). */
2448
+ get: (id: string, opts?: RequestOptions) => Promise<WithResponse<WebhookDeliveryWithAttempts>>;
2449
+ /** Re-sends a FAILED delivery's event as a new delivery (returned), retried per the endpoint's `auto_retry`. */
2450
+ retry: (id: string, opts?: RequestOptions) => Promise<WithResponse<{
2451
+ id: string;
2452
+ object: "webhook_delivery";
2453
+ event: string;
2454
+ event_type: components["schemas"]["EventType"];
2455
+ endpoint: string;
2456
+ status: components["schemas"]["DeliveryStatus"];
2457
+ attempts: number;
2458
+ next_attempt_at: components["schemas"]["NullableTimestamp"];
2459
+ last_status: number | null;
2460
+ last_error: string | null;
2461
+ created_at: components["schemas"]["Timestamp"];
2462
+ updated_at: components["schemas"]["Timestamp"];
2463
+ succeeded_at: components["schemas"]["NullableTimestamp"];
2464
+ }>>;
2465
+ };
2466
+ readonly events: {
2467
+ /** One page: newest first, or oldest first after `params.after`. */
2468
+ list: (params?: EventListParams, opts?: RequestOptions) => Promise<WithResponse<Page<Event>>>;
2469
+ get: (id: string, opts?: RequestOptions) => Promise<WithResponse<Event>>;
2470
+ /**
2471
+ * Every event after `after` (default: from the very first), oldest first, across pages. Store the last id you
2472
+ * processed and pass it next time to catch up after downtime.
2473
+ */
2474
+ since: (after?: string, params?: Omit<EventListParams, "after">, opts?: RequestOptions) => AsyncIterable<Event>;
2475
+ };
2476
+ readonly transactions: {
2477
+ /** Deposits, top-ups, withdrawals and payouts, newest first. */
2478
+ list: (params?: TransactionListParams, opts?: RequestOptions) => ListResult<Transaction>;
2479
+ /** With the full deposit or withdrawal and every event about it, including webhook deliveries. */
2480
+ get: (id: string, opts?: RequestOptions) => Promise<WithResponse<{
2481
+ id: string;
2482
+ object: "transaction";
2483
+ type: "deposit" | "top_up" | "withdrawal" | "payout";
2484
+ direction: "in" | "out";
2485
+ status: string;
2486
+ customer: string | null;
2487
+ currency: string;
2488
+ network: components["schemas"]["NetworkId"];
2489
+ network_currency: components["schemas"]["NetworkCurrencyId"];
2490
+ amount: components["schemas"]["Decimal"];
2491
+ fee: components["schemas"]["Decimal"];
2492
+ net_amount: components["schemas"]["Decimal"];
2493
+ from_address: string | null;
2494
+ to_address: string;
2495
+ tx_hash: string | null;
2496
+ explorer_url: string | null;
2497
+ confirmations: number | null;
2498
+ confirmations_required: number;
2499
+ created_at: components["schemas"]["Timestamp"];
2500
+ completed_at: components["schemas"]["NullableTimestamp"];
2501
+ value?: components["schemas"]["UsdValue"];
2502
+ } & {
2503
+ deposit?: components["schemas"]["Deposit"];
2504
+ withdrawal?: components["schemas"]["Withdrawal"];
2505
+ events: {
2506
+ id: string;
2507
+ type: string;
2508
+ created_at: components["schemas"]["Timestamp"];
2509
+ deliveries: (components["schemas"]["WebhookDelivery"] & {
2510
+ endpoint_url: string;
2511
+ })[];
2512
+ }[];
2513
+ }>>;
2514
+ };
2515
+ readonly stats: {
2516
+ /** Balances and daily volume in USD at current rates (default 30 days). */
2517
+ get: (params?: StatsParams, opts?: RequestOptions) => Promise<WithResponse<{
2518
+ object: "stats";
2519
+ days: number;
2520
+ since: components["schemas"]["Timestamp"];
2521
+ valued_at: "current_rates";
2522
+ balance: {
2523
+ total_usd: components["schemas"]["Decimal"];
2524
+ available_usd: components["schemas"]["Decimal"];
2525
+ on_hold_usd: components["schemas"]["Decimal"];
2526
+ pending_usd: components["schemas"]["Decimal"];
2527
+ };
2528
+ deposits: components["schemas"]["StatsBucket"];
2529
+ top_ups: components["schemas"]["StatsBucket"];
2530
+ payouts: components["schemas"]["StatsBucket"];
2531
+ withdrawals: components["schemas"]["StatsBucket"];
2532
+ pending_deposits: number;
2533
+ pending_withdrawals: number;
2534
+ active_customers: number;
2535
+ daily: {
2536
+ date: string;
2537
+ deposits_usd: components["schemas"]["Decimal"];
2538
+ withdrawals_usd: components["schemas"]["Decimal"];
2539
+ deposit_count: number;
2540
+ withdrawal_count: number;
2541
+ }[];
2542
+ }>>;
2543
+ };
2544
+ readonly settings: {
2545
+ get: (opts?: RequestOptions) => Promise<WithResponse<{
2546
+ object: "settings";
2547
+ merchant: {
2548
+ id: string;
2549
+ name: string;
2550
+ status: string;
2551
+ };
2552
+ invoice_lifetime_sec: number;
2553
+ invoice_underpaid_tolerance_bps: number;
2554
+ updated_at: components["schemas"]["Timestamp"];
2555
+ }>>;
2556
+ };
2557
+ readonly checkout: {
2558
+ /** Public: what a payer needs to pay an invoice (no API key needed). */
2559
+ get: (invoiceId: string, opts?: RequestOptions) => Promise<WithResponse<{
2560
+ id: string;
2561
+ object: "checkout";
2562
+ status: components["schemas"]["InvoiceStatus"];
2563
+ merchant: {
2564
+ name: string;
2565
+ };
2566
+ order_id: string;
2567
+ description: string | null;
2568
+ price_amount: components["schemas"]["Decimal"];
2569
+ price_currency: string;
2570
+ currency: string | null;
2571
+ network: string | null;
2572
+ network_currency: string | null;
2573
+ address: string | null;
2574
+ pay_amount: string | null;
2575
+ paid_amount: components["schemas"]["Decimal"];
2576
+ payer_pays_fees: boolean;
2577
+ return_url: string | null;
2578
+ can_select_currency: boolean;
2579
+ accepts: components["schemas"]["AcceptedCurrency"][];
2580
+ expires_at: components["schemas"]["Timestamp"];
2581
+ paid_at: components["schemas"]["NullableTimestamp"];
2582
+ created_at: components["schemas"]["Timestamp"];
2583
+ }>>;
2584
+ /** Public: choose the payment currency once, while the invoice is `NEW`. */
2585
+ select: (invoiceId: string, params: CheckoutSelectParams, opts?: RequestOptions) => Promise<WithResponse<{
2586
+ id: string;
2587
+ object: "checkout";
2588
+ status: components["schemas"]["InvoiceStatus"];
2589
+ merchant: {
2590
+ name: string;
2591
+ };
2592
+ order_id: string;
2593
+ description: string | null;
2594
+ price_amount: components["schemas"]["Decimal"];
2595
+ price_currency: string;
2596
+ currency: string | null;
2597
+ network: string | null;
2598
+ network_currency: string | null;
2599
+ address: string | null;
2600
+ pay_amount: string | null;
2601
+ paid_amount: components["schemas"]["Decimal"];
2602
+ payer_pays_fees: boolean;
2603
+ return_url: string | null;
2604
+ can_select_currency: boolean;
2605
+ accepts: components["schemas"]["AcceptedCurrency"][];
2606
+ expires_at: components["schemas"]["Timestamp"];
2607
+ paid_at: components["schemas"]["NullableTimestamp"];
2608
+ created_at: components["schemas"]["Timestamp"];
2609
+ }>>;
2610
+ };
2611
+ readonly webhooks: {
2612
+ /** Verify a webhook request and return the typed event (see `Webhook.verify`). */
2613
+ verify: (payload: WebhookPayload, headers: WebhookHeaders, secret: string | string[], options?: WebhookOptions) => WebhookEvent;
2614
+ };
2615
+ constructor(options: GhostPayOptions);
2616
+ }
2617
+
2618
+ /** Base class of every error this SDK throws. */
2619
+ declare class GhostPayError extends Error {
2620
+ name: string;
2621
+ }
2622
+ /** The API answered with an error envelope. Switch on `code`; it is stable. */
2623
+ declare class GhostPayApiError extends GhostPayError {
2624
+ name: string;
2625
+ readonly status: number;
2626
+ readonly code: ErrorCode;
2627
+ readonly param: string | undefined;
2628
+ readonly headers: Headers;
2629
+ readonly raw: unknown;
2630
+ constructor(status: number, code: ErrorCode, message: string, param: string | undefined, headers: Headers, raw: unknown);
2631
+ }
2632
+ /** No response: DNS, connection refused/reset, or the request timed out. Safe to retry with the same Idempotency-Key. */
2633
+ declare class GhostPayConnectionError extends GhostPayError {
2634
+ name: string;
2635
+ readonly timedOut: boolean;
2636
+ constructor(message: string, timedOut: boolean, options?: {
2637
+ cause?: unknown;
2638
+ });
2639
+ }
2640
+ /** A webhook request failed signature or timestamp checks. Reply 400 and do not process it. */
2641
+ declare class WebhookVerificationError extends GhostPayError {
2642
+ name: string;
2643
+ }
2644
+
2645
+ declare const VERSION = "1.1.0";
2646
+
2647
+ export { type AcceptedCurrency, type Address, type AddressCreateParams, type AddressListParams, type Balance, type Checkout, type CheckoutSelectParams, type Currency, type CurrencyCode, type Customer, type CustomerListParams, type CustomerUpsertParams, type Decimal, type DeliveryStatus, type Deposit, type DepositListParams, type DepositStatus, type EndpointEventType, type ErrorCode, type Event, type EventData, type EventListParams, type EventType, type Family, GhostPay, GhostPayApiError, GhostPayConnectionError, GhostPayError, type GhostPayOptions, type Invoice, type InvoiceCreateParams, type InvoiceListParams, type InvoiceStatus, type ListResult, type Metadata, type Network, type NetworkCurrencyId, type NetworkId, type Page, type Ping, type Rate, type RequestOptions, type ResponseMeta, type Settings, type Stats, type StatsParams, type Transaction, type TransactionDetail, type TransactionListParams, type TransactionType, VERSION, Webhook, type WebhookAttempt, type WebhookDelivery, type WebhookDeliveryListParams, type WebhookDeliveryWithAttempts, type WebhookEndpoint, type WebhookEndpointCreateParams, type WebhookEndpointListParams, type WebhookEndpointUpdateParams, type WebhookEndpointWithSecret, type WebhookEvent, type WebhookHeaders, type WebhookOptions, type WebhookPayload, type WebhookReplayParams, WebhookVerificationError, type WithResponse, type Withdrawal, type WithdrawalCreateParams, type WithdrawalListParams, type WithdrawalQuote, type WithdrawalQuoteParams, type WithdrawalStatus, GhostPay as default };