@moonpay/platform-protocol 1.6.0 → 1.8.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.
@@ -1,569 +1 @@
1
- /**
2
- * A fiat currency or crypto token
3
- */
4
- type Asset = {
5
- /**
6
- * A fiat or crypto currency code.
7
- *
8
- * **Fiat**
9
- * Fiat codes are represented as [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) codes.
10
- *
11
- * Currently only `USD` is supported.
12
- *
13
- * **Crypto**
14
- * For crypto currency codes, see [supported currencies](https://dev.moonpay.com/docs/list-of-supported-cryptocurrencies).
15
- *
16
- * Examples: `BTC` `SOL` `ETH` `USDC_BASE` `USDC_SOL`
17
- */
18
- code: string;
19
- /**
20
- * The human-readable name
21
- */
22
- name?: string;
23
- /**
24
- * The number of supported decimal places
25
- */
26
- precision?: number;
27
- };
28
- type AssetBase = {
29
- /**
30
- * A fiat or crypto currency code.
31
- *
32
- * **Fiat**
33
- * Fiat codes are represented as [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) codes.
34
- *
35
- * Currently only `USD` is supported.
36
- *
37
- * **Crypto**
38
- * For crypto currency codes, see [supported currencies](https://dev.moonpay.com/docs/list-of-supported-cryptocurrencies).
39
- *
40
- * Examples: `BTC` `SOL` `ETH` `USDC_BASE` `USDC_SOL`
41
- */
42
- code: string;
43
- };
44
- /**
45
- * Current status flags for an asset.
46
- */
47
- type AssetStatus = {
48
- /**
49
- * Temporarily unavailable for trading.
50
- */
51
- suspended: boolean;
52
- /**
53
- * Disabled for trading.
54
- */
55
- disabled: boolean;
56
- };
57
- /**
58
- * Destination crypto asset. Identify it by `code` for CeFi assets, or by `caip19` (the CAIP-19 identifier from the assets listing) for DeFi tokens, whose `code` is not unique. Provide exactly one; `caip19` takes precedence if both are sent.
59
- */
60
- type BuyQuoteDestinationAsset = {
61
- /**
62
- * CeFi currency code, e.g. `BTC` or `ETH`. Use for centralised assets.
63
- */
64
- code?: string;
65
- /**
66
- * CAIP-19 asset identifier from the assets listing. Required for DeFi tokens.
67
- */
68
- caip19?: string;
69
- };
70
- type CreateSessionTokenRequestBody = {
71
- /**
72
- * A unique identifier for the customer from your system.
73
- */
74
- externalCustomerId?: string;
75
- /**
76
- * The IP address of the user's device to ensure the integrity of the session. Both IPv4 and IPv6 values are supported.
77
- */
78
- deviceIp: IPv4Address | IPv6Address;
79
- /**
80
- * The customer's email address. Must be a valid email. If provided, enables email OTP authentication.
81
- */
82
- email?: string;
83
- /**
84
- * The customer's phone number in E.164 format. If both email and phone are provided, enables phone OTP authentication for returning customers.
85
- */
86
- phoneNumber?: string;
87
- /**
88
- * An [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of when the customer accepted MoonPay's Terms of Use. Send this when you capture Terms of Use acceptance in your own UI. The value can be at most 60 seconds ahead of server time, with no past limit. MoonPay records the terms version live at this timestamp and binds the acceptance to the customer when the session is authorized.
89
- */
90
- termsAcceptedAt?: string;
91
- };
92
- type CreateSessionTokenResponse = {
93
- /**
94
- * An opaque session token used to set up a connection on your frontend. This token is single-use and must be generated each time the customer visits your app.
95
- *
96
- * Token expires 24 hours after issuance.
97
- */
98
- sessionToken: string;
99
- };
100
- type Fees = {
101
- /**
102
- * Network fees (in fiat) for the transaction.
103
- */
104
- network?: MonetaryFeeAmount;
105
- /**
106
- * MoonPay fees (in fiat) for the transaction.
107
- */
108
- moonpay?: MonetaryFeeAmount;
109
- /**
110
- * Ecosystem fees (in fiat) for the transaction, if applicable.
111
- */
112
- ecosystem?: MonetaryFeeAmount;
113
- /**
114
- * DeFi swap fee (in fiat) for the transaction, converted to the quote's base currency like the other fees. Present only for DeFi swaps that carry an itemized swap fee; when the fee is taken on-chain it is reflected in `destination.amount` instead.
115
- */
116
- defi?: MonetaryFeeAmount;
117
- /**
118
- * Partner fees (in fiat) for the transaction, if applicable. Deprecated: use `fees.ecosystem` instead. This field will be removed in a future release.
119
- * @deprecated
120
- */
121
- partner?: MonetaryFeeAmount;
122
- };
123
- type GetQuoteBody = {
124
- /**
125
- * Source asset in fiat. Amount can be set in `source` or `destination`.
126
- */
127
- source: {
128
- /**
129
- * The currency or token being spent
130
- */
131
- asset: AssetBase;
132
- /**
133
- * A stringified amount, which can include decimals.
134
- */
135
- amount?: string;
136
- };
137
- /**
138
- * Destination asset in crypto. Amount can be set in `destination` or `source`. For DeFi tokens, identify the asset by `caip19` and set the amount on `source` only (quoting by destination token amount is not supported).
139
- */
140
- destination: {
141
- asset: BuyQuoteDestinationAsset;
142
- /**
143
- * The amount being received, if known
144
- */
145
- amount?: string;
146
- };
147
- /**
148
- * Wallet address and optional tag where the crypto will be sent. Required for the quote to be executable.
149
- */
150
- wallet?: Wallet;
151
- /**
152
- * Payment method for the transaction. Required for the quote to be executable.
153
- */
154
- paymentMethod?: QuotePaymentMethod;
155
- };
156
- /**
157
- * Quote for a fiat-to-crypto buy. Contains locked rate, fees, expiry, and signature for payment execution.
158
- */
159
- type GetQuoteResponse = {
160
- /**
161
- * Source side of the quote: amount and asset (fiat currency) you send.
162
- */
163
- source: {
164
- /**
165
- * A stringified amount, which can include decimals.
166
- */
167
- amount: string;
168
- /**
169
- * The currency or token being spent
170
- */
171
- asset: Asset;
172
- };
173
- /**
174
- * Destination side of the quote: amount and asset (cryptocurrency) the customer receives.
175
- */
176
- destination: {
177
- /**
178
- * A stringified amount, which can include decimals.
179
- */
180
- amount: string;
181
- asset: QuoteDestinationAsset;
182
- };
183
- /**
184
- * Breakdown of network, MoonPay, and ecosystem fees.
185
- */
186
- fees: Fees;
187
- /**
188
- * Wallet address and optional tag where the crypto will be sent. Null when not provided.
189
- */
190
- wallet: Wallet | null;
191
- /**
192
- * The payment method used for the quote.
193
- */
194
- paymentMethod: QuotePaymentMethod | null;
195
- limits: QuoteLimits | null;
196
- /**
197
- * An [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of when the quote expires.
198
- */
199
- expiresAt: string;
200
- /**
201
- * Whether the quote can be executed. Only `executable` quotes can be used to initiate payment frames.
202
- */
203
- executable: boolean;
204
- /**
205
- * The rate used to convert fiat <-> crypto, expressed as the fiat value of one unit of crypto (e.g. `1 SOL = {exchangeRate} USD`).
206
- */
207
- exchangeRate: string;
208
- /**
209
- * Slippage tolerance applied to the DeFi swap, in basis points (e.g. `50` = 0.5%). Only present when the destination is a DeFi token.
210
- */
211
- slippageBps?: number;
212
- /**
213
- * Disclosures the partner must render verbatim before the customer can complete the transaction. Empty when no disclosure is required for the customer's geography, payment method, and asset combination.
214
- */
215
- paymentDisclosures: Array<PaymentDisclosure>;
216
- /**
217
- * An opaque token representing the quote to initiate payment frames.
218
- */
219
- signature: string;
220
- };
221
- type IPv4Address = string;
222
- type IPv6Address = string;
223
- type LimitWithAsset = {
224
- /**
225
- * A stringified amount, which can include decimals.
226
- */
227
- amount: string;
228
- asset: AssetBase;
229
- };
230
- type MonetaryFeeAmount = {
231
- /**
232
- * The amount of fees in fiat.
233
- */
234
- amount: string;
235
- /**
236
- * The fiat currency used to pay the fees.
237
- */
238
- asset: AssetBase;
239
- };
240
- type MoonPayCorePaginationInfo = {
241
- /**
242
- * The cursor to use as the starting point for the next page of results.
243
- */
244
- nextCursor: string | null;
245
- };
246
- /**
247
- * The card network brand.
248
- */
249
- type MoonPayPaymentsCardBrand = 'visa' | 'mastercard' | 'maestro' | 'american_express' | 'other';
250
- /**
251
- * The type of card: credit, debit, or unknown.
252
- */
253
- type MoonPayPaymentsCardType = 'credit' | 'debit' | 'unknown';
254
- type MoonPayPaymentsListPaymentMethodsResponse = {
255
- /**
256
- * List of available payment method configurations
257
- */
258
- paymentMethodConfigs?: Array<MoonPayPaymentsPaymentMethod>;
259
- /**
260
- * List of stored payment methods available for the customer
261
- */
262
- paymentMethods?: Array<MoonPayPaymentsStoredPaymentMethod>;
263
- };
264
- type MoonPayPaymentsPaymentMethod = {
265
- type: PaymentMethodType;
266
- /**
267
- * Details of how the payment method can be used.
268
- */
269
- capabilities: MoonPayPaymentsPaymentMethodCapabilities;
270
- availability: MoonPayPaymentsPaymentMethodAvailability;
271
- };
272
- type MoonPayPaymentsPaymentMethodAvailability = {
273
- /**
274
- * Whether the payment method is available
275
- */
276
- active: boolean;
277
- /**
278
- * If the payment method is not available, reasons explaining why.
279
- */
280
- reasons?: Array<string>;
281
- };
282
- type MoonPayPaymentsPaymentMethodCapabilities = {
283
- /**
284
- * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) codes of fiat currencies supported by this payment method.
285
- */
286
- supportedCurrencies: Array<string>;
287
- /**
288
- * Transaction types supported by this payment method.
289
- */
290
- supportedTransactionTypes: Array<string>;
291
- /**
292
- * Whether this payment method can be deleted.
293
- */
294
- allowsDeletion: boolean;
295
- /**
296
- * Whether this payment method requires the MoonPay widget to complete the payment flow.
297
- */
298
- requiresWidget: boolean;
299
- };
300
- type MoonPayPaymentsStoredCardPaymentMethod = MoonPayPaymentsStoredPaymentMethodBase & {
301
- cardType: MoonPayPaymentsCardType;
302
- /**
303
- * The card network brand
304
- */
305
- brand: MoonPayPaymentsCardBrand;
306
- /**
307
- * Last 4 digits of the card number
308
- */
309
- last4: string;
310
- /**
311
- * Expiration month as 2-digit string
312
- */
313
- expirationMonth: string;
314
- /**
315
- * Expiration year as 4-digit string
316
- */
317
- expirationYear: string;
318
- /**
319
- * Current availability of this stored card
320
- */
321
- availability: MoonPayPaymentsPaymentMethodAvailability;
322
- };
323
- /**
324
- * A stored payment method.
325
- */
326
- type MoonPayPaymentsStoredPaymentMethod = MoonPayPaymentsStoredPaymentMethodBase | MoonPayPaymentsStoredCardPaymentMethod;
327
- type MoonPayPaymentsStoredPaymentMethodBase = {
328
- /**
329
- * Unique identifier for the stored payment method
330
- */
331
- id: string;
332
- type: PaymentMethodType;
333
- };
334
- /**
335
- * A payment disclosure that the partner must render verbatim before the customer can complete the transaction.
336
- */
337
- type PaymentDisclosure = {
338
- /**
339
- * Stable identifier of the disclosure. Each id maps to one specific piece of text. The full list of ids and their canonical text is published in the developer documentation.
340
- */
341
- id: string;
342
- /**
343
- * Version of the disclosure text. Bumped whenever the canonical wording for this `id` changes. Partners that receive an unknown `(id, version)` pair should fall back to a conservative disclosure and alert their integration team.
344
- */
345
- version: string;
346
- };
347
- type PaymentMethodType = 'apple_pay' | 'card' | 'ach' | 'fps' | 'fps_open_banking' | 'google_pay' | 'sepa' | 'sepa_open_banking' | 'pix' | 'paypal' | 'venmo' | 'revolut_pay' | 'moonpay_balance' | 'interac';
348
- /**
349
- * A crypto asset available for purchase through MoonPay.
350
- */
351
- type PlatformAsset = {
352
- /**
353
- * The CAIP-19 asset identifier (encodes chain and contract). Use this value when creating quotes for DeFi tokens.
354
- */
355
- caip19: string;
356
- /**
357
- * The asset code. Use this value when creating quotes for CeFi assets.
358
- */
359
- code: string;
360
- /**
361
- * The human-readable name of the asset.
362
- */
363
- name: string;
364
- /**
365
- * The blockchain network code this asset belongs to.
366
- */
367
- network: string;
368
- /**
369
- * Whether this is a centralised asset listed by MoonPay (`cefi`) or a DeFi token (`defi`). Quote CeFi assets by `code` and DeFi tokens by `caip19`.
370
- */
371
- source: 'cefi' | 'defi';
372
- /**
373
- * The on-chain contract address. Null for native gas tokens.
374
- */
375
- contractAddress: string | null;
376
- /**
377
- * The number of decimal places used on-chain, or null if unknown.
378
- */
379
- decimals: number | null;
380
- /**
381
- * The maximum decimal places MoonPay supports for trading this asset, or null if unknown.
382
- */
383
- precision: number | null;
384
- status: AssetStatus;
385
- };
386
- /**
387
- * Destination crypto asset returned on the quote. Adds the resolved network and, for DeFi tokens, the CAIP-19 identifier on top of the base asset fields.
388
- */
389
- type QuoteDestinationAsset = {
390
- /**
391
- * A fiat or crypto currency code.
392
- *
393
- * **Fiat**
394
- * Fiat codes are represented as [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) codes.
395
- *
396
- * Currently only `USD` is supported.
397
- *
398
- * **Crypto**
399
- * For crypto currency codes, see [supported currencies](https://dev.moonpay.com/docs/list-of-supported-cryptocurrencies).
400
- *
401
- * Examples: `BTC` `SOL` `ETH` `USDC_BASE` `USDC_SOL`
402
- */
403
- code: string;
404
- /**
405
- * The human-readable name
406
- */
407
- name?: string;
408
- /**
409
- * The number of supported decimal places
410
- */
411
- precision?: number;
412
- /**
413
- * The CAIP-19 asset identifier (encodes chain and contract). Present for DeFi tokens.
414
- */
415
- caip19?: string;
416
- };
417
- type QuoteLimitEntry = {
418
- /**
419
- * The maximum amount.
420
- */
421
- limit: LimitWithAsset;
422
- /**
423
- * The remaining amount.
424
- */
425
- remaining: LimitWithAsset;
426
- };
427
- /**
428
- * Limits applicable to the quote.
429
- */
430
- type QuoteLimits = {
431
- /**
432
- * The daily limit.
433
- */
434
- daily?: QuoteLimitEntry;
435
- /**
436
- * The monthly limit.
437
- */
438
- monthly?: QuoteLimitEntry;
439
- /**
440
- * The yearly limit.
441
- */
442
- yearly?: QuoteLimitEntry;
443
- };
444
- type QuotePaymentMethod = {
445
- type: PaymentMethodType;
446
- /**
447
- * Unique identifier of the payment method. Used to identify the specific card when type is card.
448
- */
449
- id?: string;
450
- };
451
- /**
452
- * A stage in the transaction lifecycle
453
- */
454
- type Stage = {
455
- kind?: StageKind;
456
- /**
457
- * The human-readable name of the stage.
458
- */
459
- name?: string;
460
- status?: StageStatus;
461
- /**
462
- * A developer-friendly message if the status is `failed`
463
- */
464
- failureReason?: string | null;
465
- };
466
- /**
467
- * The stages in a transaction lifecycle.
468
- */
469
- type StageKind = 'ordering' | 'waiting_payment' | 'waiting_authentication' | 'verification' | 'processing' | 'delivery' | 'crypto_hold';
470
- /**
471
- * The status of a transaction stage.
472
- */
473
- type StageStatus = 'not_started' | 'in_progress' | 'success' | 'failed';
474
- type Transaction = {
475
- /**
476
- * The MoonPay ID of the transaction.
477
- */
478
- id: string;
479
- /**
480
- * An [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of when the transaction was created.
481
- */
482
- createdAt: string;
483
- /**
484
- * An [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of when the transaction was last updated.
485
- */
486
- updatedAt: string;
487
- status: TransactionStatus;
488
- /**
489
- * Source amount and asset (fiat currency) the customer paid.
490
- */
491
- source: {
492
- /**
493
- * A stringified amount, which can include decimals.
494
- */
495
- amount: string;
496
- /**
497
- * The currency or token being spent
498
- */
499
- asset: AssetBase;
500
- };
501
- /**
502
- * Destination amount and asset (cryptocurrency) the customer receives.
503
- */
504
- destination: {
505
- /**
506
- * A stringified amount, which can include decimals.
507
- */
508
- amount: string;
509
- asset: AssetBase;
510
- };
511
- /**
512
- * Details of fees for the transaction.
513
- */
514
- fees: Fees;
515
- /**
516
- * The wallet used for the transaction.
517
- */
518
- wallet: Wallet;
519
- customer: TransactionCustomer;
520
- paymentMethod?: TransactionPaymentMethod;
521
- };
522
- type TransactionCustomer = {
523
- /**
524
- * The MoonPay ID of the customer associated with the transaction.
525
- */
526
- id: string;
527
- };
528
- type TransactionPaymentMethod = {
529
- type: PaymentMethodType;
530
- };
531
- /**
532
- * The status of a transaction.
533
- *
534
- * - `completed`: The transaction is finalized and assets were delivered.
535
- * - `failed`: The transaction failed. No payment was executed and funds were not transferred.
536
- * - `pending`: The transaction was created and payment is accepted. The transfer is in progress.
537
- */
538
- type TransactionStatus = 'completed' | 'failed' | 'pending';
539
- /**
540
- * Transaction with lifecycle stages showing step-by-step progress.
541
- */
542
- type TransactionWithStages = Transaction & {
543
- /**
544
- * Details of the stages in the transaction lifecycle.
545
- */
546
- stages?: Array<Stage>;
547
- };
548
- type Wallet = {
549
- /**
550
- * The wallet address used for the transaction.
551
- */
552
- address: string;
553
- /**
554
- * An optional memo or destination tag (used by some blockchains such as XRP or XLM).
555
- */
556
- tag?: string;
557
- };
558
- type AssetControllerListAssetsResponses = {
559
- /**
560
- * The request has succeeded.
561
- */
562
- 200: {
563
- data: Array<PlatformAsset>;
564
- pageInfo: MoonPayCorePaginationInfo;
565
- };
566
- };
567
- type AssetControllerListAssetsResponse = AssetControllerListAssetsResponses[keyof AssetControllerListAssetsResponses];
568
-
569
- export type { Asset, AssetBase, AssetStatus, CreateSessionTokenRequestBody, CreateSessionTokenResponse as CreateSessionTokenReturnType, Fees, GetQuoteBody as GetQuoteParams, LimitWithAsset, AssetControllerListAssetsResponse as ListAssetsResponse, MoonPayPaymentsListPaymentMethodsResponse as ListPaymentMethodsResponse, MonetaryFeeAmount, MoonPayCorePaginationInfo as PaginationInfo, MoonPayPaymentsPaymentMethodAvailability as PaymentMethodAvailability, MoonPayPaymentsPaymentMethodCapabilities as PaymentMethodCapabilities, MoonPayPaymentsPaymentMethod as PaymentMethodConfig, PaymentMethodType, PlatformAsset, GetQuoteResponse as Quote, QuoteLimitEntry, QuoteLimits, QuotePaymentMethod, Stage, StageKind, StageStatus, MoonPayPaymentsStoredCardPaymentMethod as StoredCardPaymentMethod, MoonPayPaymentsStoredPaymentMethod as StoredPaymentMethod, Transaction, TransactionCustomer, TransactionPaymentMethod, TransactionStatus, TransactionWithStages, Wallet };
1
+ export { A as Asset, y as AssetBase, z as AssetStatus, B as CreateSessionTokenRequestBody, D as CreateSessionTokenReturnType, F as FeeBehavior, E as Fees, G as GetQuoteParams, L as LimitWithAsset, H as ListAssetsResponse, M as ListPaymentMethodsResponse, J as MonetaryFeeAmount, K as PaginationInfo, N as PaymentMethodAvailability, O as PaymentMethodCapabilities, P as PaymentMethodConfig, Q as PaymentMethodType, T as PlatformAsset, V as Quote, W as QuoteLimitEntry, X as QuoteLimits, Y as QuotePaymentMethod, Z as Stage, _ as StageKind, $ as StageStatus, a0 as StoredCardPaymentMethod, a1 as StoredPaymentMethod, a2 as Transaction, a3 as TransactionCustomer, a4 as TransactionPaymentMethod, a5 as TransactionStatus, a6 as TransactionWithStages, a7 as Wallet } from './customer.cjs';