@unifold/core 0.1.68-beta.0 → 0.1.68-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -27,6 +27,7 @@ __export(index_exports, {
27
27
  IneligibilityReason: () => IneligibilityReason,
28
28
  IntegrationProvider: () => IntegrationProvider,
29
29
  SOLANA_USDC_ADDRESS: () => SOLANA_USDC_ADDRESS,
30
+ StripeApiResponseError: () => StripeApiResponseError,
30
31
  WithdrawEventType: () => WithdrawEventType,
31
32
  authenticateIntegrationOAuth: () => authenticateIntegrationOAuth,
32
33
  buildHypercoreTransaction: () => buildHypercoreTransaction,
@@ -34,20 +35,27 @@ __export(index_exports, {
34
35
  checkHypercoreActivation: () => checkHypercoreActivation,
35
36
  confirmIntegrationTransfer: () => confirmIntegrationTransfer,
36
37
  createCashAppSession: () => createCashAppSession,
38
+ createCoinbaseApplePaySession: () => createCoinbaseApplePaySession,
37
39
  createDepositAddress: () => createDepositAddress,
38
40
  createExchangeSession: () => createExchangeSession,
39
41
  createIntegrationTransfer: () => createIntegrationTransfer,
40
42
  createOnrampSession: () => createOnrampSession,
43
+ createOnrampVerificationSession: () => createOnrampVerificationSession,
44
+ exchangeOnrampVerificationToken: () => exchangeOnrampVerificationToken,
41
45
  formatStablecoinAmount: () => formatStablecoinAmount,
42
46
  generateKSUID: () => generateKSUID,
43
47
  generatePrefixedKSUID: () => generatePrefixedKSUID,
44
48
  getAddressBalance: () => getAddressBalance,
45
49
  getAddressBalances: () => getAddressBalances,
46
50
  getApiBaseUrl: () => getApiBaseUrl,
51
+ getApplePayLimitUpgradeStatus: () => getApplePayLimitUpgradeStatus,
52
+ getApplePayProviders: () => getApplePayProviders,
47
53
  getBankTransferProviders: () => getBankTransferProviders,
48
54
  getCashAppLimits: () => getCashAppLimits,
49
55
  getCashAppSessionStatus: () => getCashAppSessionStatus,
50
56
  getChainName: () => getChainName,
57
+ getCoinbaseApplePayLimits: () => getCoinbaseApplePayLimits,
58
+ getCoinbaseLegalAgreements: () => getCoinbaseLegalAgreements,
51
59
  getDefaultOnrampToken: () => getDefaultOnrampToken,
52
60
  getDepositAddress: () => getDepositAddress,
53
61
  getDepositQuote: () => getDepositQuote,
@@ -63,6 +71,7 @@ __export(index_exports, {
63
71
  getIpAddress: () => getIpAddress,
64
72
  getOnrampQuotes: () => getOnrampQuotes,
65
73
  getOnrampSessionStartUrl: () => getOnrampSessionStartUrl,
74
+ getOnrampVerificationSession: () => getOnrampVerificationSession,
66
75
  getPreferredIconUrl: () => getPreferredIconUrl,
67
76
  getProjectConfig: () => getProjectConfig,
68
77
  getSupportedDepositTokens: () => getSupportedDepositTokens,
@@ -72,17 +81,35 @@ __export(index_exports, {
72
81
  getWalletByChainType: () => getWalletByChainType,
73
82
  getWalletMobileDeepLink: () => getWalletMobileDeepLink,
74
83
  i18n: () => i18n,
84
+ isApplePayLimitReached: () => isApplePayLimitReached,
75
85
  listPaymentIntentExecutions: () => listPaymentIntentExecutions,
76
86
  pollDirectExecutions: () => pollDirectExecutions,
77
87
  queryExecutions: () => queryExecutions,
78
88
  refreshIntegrationToken: () => refreshIntegrationToken,
89
+ requestCoinbaseApplePayLimitUpgrade: () => requestCoinbaseApplePayLimitUpgrade,
79
90
  retrievePaymentIntent: () => retrievePaymentIntent,
80
91
  revokeIntegrationToken: () => revokeIntegrationToken,
81
92
  sendHypercoreTransaction: () => sendHypercoreTransaction,
93
+ sendOnrampVerificationOtp: () => sendOnrampVerificationOtp,
82
94
  sendSolanaTransaction: () => sendSolanaTransaction,
83
95
  setApiConfig: () => setApiConfig,
84
96
  startIntegrationOAuth: () => startIntegrationOAuth,
97
+ stripeConfirmSession: () => stripeConfirmSession,
98
+ stripeCreateAuthIntent: () => stripeCreateAuthIntent,
99
+ stripeCreateSession: () => stripeCreateSession,
100
+ stripeExchangeTokens: () => stripeExchangeTokens,
101
+ stripeGetConfig: () => stripeGetConfig,
102
+ stripeGetCustomer: () => stripeGetCustomer,
103
+ stripeGetDefaultToken: () => stripeGetDefaultToken,
104
+ stripeGetQuotes: () => stripeGetQuotes,
105
+ stripeGetSession: () => stripeGetSession,
106
+ stripeGetTransactionLimits: () => stripeGetTransactionLimits,
107
+ stripeListPaymentTokens: () => stripeListPaymentTokens,
108
+ stripeListWallets: () => stripeListWallets,
109
+ stripeRefreshQuote: () => stripeRefreshQuote,
110
+ stripeRefreshToken: () => stripeRefreshToken,
85
111
  useUserIp: () => useUserIp,
112
+ verifyOnrampVerificationOtp: () => verifyOnrampVerificationOtp,
86
113
  verifyRecipientAddress: () => verifyRecipientAddress
87
114
  });
88
115
  module.exports = __toCommonJS(index_exports);
@@ -217,18 +244,15 @@ async function createDepositAddress(overrides, publishableKey) {
217
244
  async function getDepositAddress(params, publishableKey) {
218
245
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
219
246
  validatePublishableKey(pk);
220
- const response = await fetch(
221
- `${API_BASE_URL}/v1/public/deposit_addresses/existing`,
222
- {
223
- method: "POST",
224
- headers: {
225
- accept: "application/json",
226
- "x-publishable-key": pk,
227
- "Content-Type": "application/json"
228
- },
229
- body: JSON.stringify(params)
230
- }
231
- );
247
+ const response = await fetch(`${API_BASE_URL}/v1/public/deposit_addresses/existing`, {
248
+ method: "POST",
249
+ headers: {
250
+ accept: "application/json",
251
+ "x-publishable-key": pk,
252
+ "Content-Type": "application/json"
253
+ },
254
+ body: JSON.stringify(params)
255
+ });
232
256
  if (!response.ok) {
233
257
  throw new Error(`Failed to get deposit addresses: ${response.statusText}`);
234
258
  }
@@ -254,18 +278,15 @@ async function queryExecutions(externalUserId, publishableKey, actionType = "dep
254
278
  external_user_id: externalUserId,
255
279
  action_type: actionType
256
280
  };
257
- const response = await fetch(
258
- `${API_BASE_URL}/v1/public/direct_executions/query`,
259
- {
260
- method: "POST",
261
- headers: {
262
- accept: "application/json",
263
- "x-publishable-key": pk,
264
- "Content-Type": "application/json"
265
- },
266
- body: JSON.stringify(body)
267
- }
268
- );
281
+ const response = await fetch(`${API_BASE_URL}/v1/public/direct_executions/query`, {
282
+ method: "POST",
283
+ headers: {
284
+ accept: "application/json",
285
+ "x-publishable-key": pk,
286
+ "Content-Type": "application/json"
287
+ },
288
+ body: JSON.stringify(body)
289
+ });
269
290
  if (!response.ok) {
270
291
  throw new Error(`Failed to query executions: ${response.statusText}`);
271
292
  }
@@ -274,18 +295,15 @@ async function queryExecutions(externalUserId, publishableKey, actionType = "dep
274
295
  async function pollDirectExecutions(request, publishableKey) {
275
296
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
276
297
  validatePublishableKey(pk);
277
- const response = await fetch(
278
- `${API_BASE_URL}/v1/public/direct_executions/poll`,
279
- {
280
- method: "POST",
281
- headers: {
282
- accept: "application/json",
283
- "x-publishable-key": pk,
284
- "Content-Type": "application/json"
285
- },
286
- body: JSON.stringify(request)
287
- }
288
- );
298
+ const response = await fetch(`${API_BASE_URL}/v1/public/direct_executions/poll`, {
299
+ method: "POST",
300
+ headers: {
301
+ accept: "application/json",
302
+ "x-publishable-key": pk,
303
+ "Content-Type": "application/json"
304
+ },
305
+ body: JSON.stringify(request)
306
+ });
289
307
  if (!response.ok) {
290
308
  throw new Error(`Failed to poll direct executions: ${response.statusText}`);
291
309
  }
@@ -311,9 +329,7 @@ async function getSupportedDestinationTokens(publishableKey, options) {
311
329
  }
312
330
  });
313
331
  if (!response.ok) {
314
- throw new Error(
315
- `Failed to fetch supported destination tokens: ${response.statusText}`
316
- );
332
+ throw new Error(`Failed to fetch supported destination tokens: ${response.statusText}`);
317
333
  }
318
334
  return response.json();
319
335
  }
@@ -342,9 +358,7 @@ async function getSupportedDepositTokens(publishableKey, options) {
342
358
  }
343
359
  });
344
360
  if (!response.ok) {
345
- throw new Error(
346
- `Failed to fetch supported deposit tokens: ${response.statusText}`
347
- );
361
+ throw new Error(`Failed to fetch supported deposit tokens: ${response.statusText}`);
348
362
  }
349
363
  return response.json();
350
364
  }
@@ -356,16 +370,13 @@ async function getTokenMetadata(request, publishableKey) {
356
370
  chainId: request.chain_id,
357
371
  tokenAddress: request.token_address
358
372
  });
359
- const response = await fetch(
360
- `${API_BASE_URL}/v1/public/tokens/token?${params.toString()}`,
361
- {
362
- method: "GET",
363
- headers: {
364
- accept: "application/json",
365
- "x-publishable-key": pk
366
- }
373
+ const response = await fetch(`${API_BASE_URL}/v1/public/tokens/token?${params.toString()}`, {
374
+ method: "GET",
375
+ headers: {
376
+ accept: "application/json",
377
+ "x-publishable-key": pk
367
378
  }
368
- );
379
+ });
369
380
  if (!response.ok) {
370
381
  throw new Error(`Failed to fetch token metadata: ${response.statusText}`);
371
382
  }
@@ -384,16 +395,13 @@ function getPreferredIconUrl(iconUrls, preferredFormat = "svg") {
384
395
  async function getFiatCurrencies(publishableKey) {
385
396
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
386
397
  validatePublishableKey(pk);
387
- const response = await fetch(
388
- `${API_BASE_URL}/v1/public/onramps/fiat_currencies`,
389
- {
390
- method: "GET",
391
- headers: {
392
- accept: "application/json",
393
- "x-publishable-key": pk
394
- }
398
+ const response = await fetch(`${API_BASE_URL}/v1/public/onramps/fiat_currencies`, {
399
+ method: "GET",
400
+ headers: {
401
+ accept: "application/json",
402
+ "x-publishable-key": pk
395
403
  }
396
- );
404
+ });
397
405
  if (!response.ok) {
398
406
  throw new Error(`Failed to fetch fiat currencies: ${response.statusText}`);
399
407
  }
@@ -402,18 +410,15 @@ async function getFiatCurrencies(publishableKey) {
402
410
  async function getOnrampQuotes(request, publishableKey) {
403
411
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
404
412
  validatePublishableKey(pk);
405
- const response = await fetch(
406
- `${API_BASE_URL}/v1/public/onramps/quotes`,
407
- {
408
- method: "POST",
409
- headers: {
410
- accept: "application/json",
411
- "x-publishable-key": pk,
412
- "Content-Type": "application/json"
413
- },
414
- body: JSON.stringify(request)
415
- }
416
- );
413
+ const response = await fetch(`${API_BASE_URL}/v1/public/onramps/quotes`, {
414
+ method: "POST",
415
+ headers: {
416
+ accept: "application/json",
417
+ "x-publishable-key": pk,
418
+ "Content-Type": "application/json"
419
+ },
420
+ body: JSON.stringify(request)
421
+ });
417
422
  if (!response.ok) {
418
423
  throw new Error(`Failed to fetch onramp quotes: ${response.statusText}`);
419
424
  }
@@ -422,18 +427,15 @@ async function getOnrampQuotes(request, publishableKey) {
422
427
  async function createOnrampSession(request, publishableKey) {
423
428
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
424
429
  validatePublishableKey(pk);
425
- const response = await fetch(
426
- `${API_BASE_URL}/v1/public/onramps/sessions`,
427
- {
428
- method: "POST",
429
- headers: {
430
- accept: "application/json",
431
- "x-publishable-key": pk,
432
- "Content-Type": "application/json"
433
- },
434
- body: JSON.stringify(request)
435
- }
436
- );
430
+ const response = await fetch(`${API_BASE_URL}/v1/public/onramps/sessions`, {
431
+ method: "POST",
432
+ headers: {
433
+ accept: "application/json",
434
+ "x-publishable-key": pk,
435
+ "Content-Type": "application/json"
436
+ },
437
+ body: JSON.stringify(request)
438
+ });
437
439
  if (!response.ok) {
438
440
  throw new Error(`Failed to create onramp session: ${response.statusText}`);
439
441
  }
@@ -456,9 +458,23 @@ async function getBankTransferProviders(publishableKey, options = {}) {
456
458
  }
457
459
  });
458
460
  if (!response.ok) {
459
- throw new Error(
460
- `Failed to fetch bank-transfer providers: ${response.statusText}`
461
- );
461
+ throw new Error(`Failed to fetch bank-transfer providers: ${response.statusText}`);
462
+ }
463
+ return response.json();
464
+ }
465
+ async function getApplePayProviders(publishableKey) {
466
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
467
+ validatePublishableKey(pk);
468
+ const url = `${API_BASE_URL}/v1/public/onramps/apple_pay/providers`;
469
+ const response = await fetch(url, {
470
+ method: "GET",
471
+ headers: {
472
+ accept: "application/json",
473
+ "x-publishable-key": pk
474
+ }
475
+ });
476
+ if (!response.ok) {
477
+ throw new Error(`Failed to fetch Apple Pay providers: ${response.statusText}`);
462
478
  }
463
479
  return response.json();
464
480
  }
@@ -531,10 +547,18 @@ function getChainName(chains, chainType, chainId) {
531
547
  if (!chainType) return chainId || "Unknown";
532
548
  return chainType.charAt(0).toUpperCase() + chainType.slice(1);
533
549
  }
534
- async function getProjectConfig(publishableKey) {
550
+ async function getProjectConfig(publishableKey, options) {
535
551
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
536
552
  validatePublishableKey(pk);
537
- const url = `${API_BASE_URL}/v1/public/projects/config`;
553
+ const params = new URLSearchParams();
554
+ if (options?.countryCode) {
555
+ params.set("country_code", options.countryCode);
556
+ }
557
+ if (options?.subdivisionCode) {
558
+ params.set("subdivision_code", options.subdivisionCode);
559
+ }
560
+ const queryString = params.toString();
561
+ const url = `${API_BASE_URL}/v1/public/projects/config${queryString ? `?${queryString}` : ""}`;
538
562
  const response = await fetch(url, {
539
563
  method: "GET",
540
564
  headers: {
@@ -556,9 +580,7 @@ async function getIpAddress() {
556
580
  }
557
581
  });
558
582
  if (!response.ok) {
559
- throw new Error(
560
- `Failed to fetch IP address information: ${response.statusText}`
561
- );
583
+ throw new Error(`Failed to fetch IP address information: ${response.statusText}`);
562
584
  }
563
585
  return response.json();
564
586
  }
@@ -660,31 +682,24 @@ async function verifyRecipientAddress(request, publishableKey) {
660
682
  body: JSON.stringify(request)
661
683
  });
662
684
  if (!response.ok) {
663
- throw new Error(
664
- `Failed to verify recipient address: ${response.statusText}`
665
- );
685
+ throw new Error(`Failed to verify recipient address: ${response.statusText}`);
666
686
  }
667
687
  return response.json();
668
688
  }
669
689
  async function checkHypercoreActivation(request, publishableKey) {
670
690
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
671
691
  validatePublishableKey(pk);
672
- const response = await fetch(
673
- `${API_BASE_URL}/v1/public/addresses/hypercore/activation`,
674
- {
675
- method: "POST",
676
- headers: {
677
- accept: "application/json",
678
- "x-publishable-key": pk,
679
- "Content-Type": "application/json"
680
- },
681
- body: JSON.stringify(request)
682
- }
683
- );
692
+ const response = await fetch(`${API_BASE_URL}/v1/public/addresses/hypercore/activation`, {
693
+ method: "POST",
694
+ headers: {
695
+ accept: "application/json",
696
+ "x-publishable-key": pk,
697
+ "Content-Type": "application/json"
698
+ },
699
+ body: JSON.stringify(request)
700
+ });
684
701
  if (!response.ok) {
685
- throw new Error(
686
- `HyperCore activation check failed: ${response.statusText}`
687
- );
702
+ throw new Error(`HyperCore activation check failed: ${response.statusText}`);
688
703
  }
689
704
  return response.json();
690
705
  }
@@ -692,7 +707,8 @@ async function getExchanges(query, publishableKey) {
692
707
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
693
708
  validatePublishableKey(pk);
694
709
  const params = new URLSearchParams();
695
- if (query?.destination_currency) params.append("destination_currency", query.destination_currency);
710
+ if (query?.destination_currency)
711
+ params.append("destination_currency", query.destination_currency);
696
712
  if (query?.destination_network) params.append("destination_network", query.destination_network);
697
713
  const queryString = params.toString();
698
714
  const url = `${API_BASE_URL}/v1/public/onramps/exchanges${queryString ? `?${queryString}` : ""}`;
@@ -712,18 +728,15 @@ async function getExchanges(query, publishableKey) {
712
728
  async function createExchangeSession(request, publishableKey) {
713
729
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
714
730
  validatePublishableKey(pk);
715
- const response = await fetch(
716
- `${API_BASE_URL}/v1/public/onramps/exchanges/sessions`,
717
- {
718
- method: "POST",
719
- headers: {
720
- accept: "application/json",
721
- "x-publishable-key": pk,
722
- "Content-Type": "application/json"
723
- },
724
- body: JSON.stringify(request)
725
- }
726
- );
731
+ const response = await fetch(`${API_BASE_URL}/v1/public/onramps/exchanges/sessions`, {
732
+ method: "POST",
733
+ headers: {
734
+ accept: "application/json",
735
+ "x-publishable-key": pk,
736
+ "Content-Type": "application/json"
737
+ },
738
+ body: JSON.stringify(request)
739
+ });
727
740
  if (!response.ok) {
728
741
  throw new Error(`Failed to create exchange session: ${response.statusText}`);
729
742
  }
@@ -876,15 +889,18 @@ async function confirmIntegrationTransfer(transferId, accessToken, mfaCode, publ
876
889
  validatePublishableKey(pk);
877
890
  const body = { access_token: accessToken };
878
891
  if (mfaCode) body.mfa_code = mfaCode;
879
- const response = await fetch(`${API_BASE_URL}/v1/public/integrations/transfers/${transferId}/confirm`, {
880
- method: "POST",
881
- headers: {
882
- accept: "application/json",
883
- "x-publishable-key": pk,
884
- "Content-Type": "application/json"
885
- },
886
- body: JSON.stringify(body)
887
- });
892
+ const response = await fetch(
893
+ `${API_BASE_URL}/v1/public/integrations/transfers/${transferId}/confirm`,
894
+ {
895
+ method: "POST",
896
+ headers: {
897
+ accept: "application/json",
898
+ "x-publishable-key": pk,
899
+ "Content-Type": "application/json"
900
+ },
901
+ body: JSON.stringify(body)
902
+ }
903
+ );
888
904
  if (!response.ok) {
889
905
  const err = await response.json().catch(() => ({ message: response.statusText }));
890
906
  throw new Error(`Failed to confirm transfer: ${err.message || response.statusText}`);
@@ -923,9 +939,7 @@ async function buildSolanaTransaction(request, publishableKey) {
923
939
  });
924
940
  if (!response.ok) {
925
941
  const error = await response.json().catch(() => ({ message: response.statusText }));
926
- throw new Error(
927
- `Failed to build Solana transaction: ${error.message || response.statusText}`
928
- );
942
+ throw new Error(`Failed to build Solana transaction: ${error.message || response.statusText}`);
929
943
  }
930
944
  return response.json();
931
945
  }
@@ -943,50 +957,40 @@ async function sendSolanaTransaction(request, publishableKey) {
943
957
  });
944
958
  if (!response.ok) {
945
959
  const error = await response.json().catch(() => ({ message: response.statusText }));
946
- throw new Error(
947
- `Failed to send Solana transaction: ${error.message || response.statusText}`
948
- );
960
+ throw new Error(`Failed to send Solana transaction: ${error.message || response.statusText}`);
949
961
  }
950
962
  return response.json();
951
963
  }
952
964
  async function retrievePaymentIntent(clientSecret, publishableKey) {
953
965
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
954
966
  validatePublishableKey(pk);
955
- const response = await fetch(
956
- `${API_BASE_URL}/v1/public/payment_intents/retrieve`,
957
- {
958
- method: "POST",
959
- headers: {
960
- accept: "application/json",
961
- "x-publishable-key": pk,
962
- "Content-Type": "application/json"
963
- },
964
- body: JSON.stringify({ client_secret: clientSecret })
965
- }
966
- );
967
+ const response = await fetch(`${API_BASE_URL}/v1/public/payment_intents/retrieve`, {
968
+ method: "POST",
969
+ headers: {
970
+ accept: "application/json",
971
+ "x-publishable-key": pk,
972
+ "Content-Type": "application/json"
973
+ },
974
+ body: JSON.stringify({ client_secret: clientSecret })
975
+ });
967
976
  if (!response.ok) {
968
977
  const error = await response.json().catch(() => ({ message: response.statusText }));
969
- throw new Error(
970
- `Failed to retrieve payment intent: ${error.message || response.statusText}`
971
- );
978
+ throw new Error(`Failed to retrieve payment intent: ${error.message || response.statusText}`);
972
979
  }
973
980
  return response.json();
974
981
  }
975
982
  async function listPaymentIntentExecutions(clientSecret, publishableKey) {
976
983
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
977
984
  validatePublishableKey(pk);
978
- const response = await fetch(
979
- `${API_BASE_URL}/v1/public/payment_intents/executions`,
980
- {
981
- method: "POST",
982
- headers: {
983
- accept: "application/json",
984
- "x-publishable-key": pk,
985
- "Content-Type": "application/json"
986
- },
987
- body: JSON.stringify({ client_secret: clientSecret })
988
- }
989
- );
985
+ const response = await fetch(`${API_BASE_URL}/v1/public/payment_intents/executions`, {
986
+ method: "POST",
987
+ headers: {
988
+ accept: "application/json",
989
+ "x-publishable-key": pk,
990
+ "Content-Type": "application/json"
991
+ },
992
+ body: JSON.stringify({ client_secret: clientSecret })
993
+ });
990
994
  if (!response.ok) {
991
995
  const error = await response.json().catch(() => ({ message: response.statusText }));
992
996
  throw new Error(
@@ -1009,9 +1013,7 @@ async function getDepositQuote(request, publishableKey) {
1009
1013
  });
1010
1014
  if (!response.ok) {
1011
1015
  const error = await response.json().catch(() => ({ message: response.statusText }));
1012
- throw new Error(
1013
- `Failed to get deposit quote: ${error.message || response.statusText}`
1014
- );
1016
+ throw new Error(`Failed to get deposit quote: ${error.message || response.statusText}`);
1015
1017
  }
1016
1018
  const json = await response.json();
1017
1019
  return json.data;
@@ -1019,18 +1021,15 @@ async function getDepositQuote(request, publishableKey) {
1019
1021
  async function buildHypercoreTransaction(request, publishableKey) {
1020
1022
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1021
1023
  validatePublishableKey(pk);
1022
- const response = await fetch(
1023
- `${API_BASE_URL}/v1/public/transactions/hypercore/build`,
1024
- {
1025
- method: "POST",
1026
- headers: {
1027
- accept: "application/json",
1028
- "x-publishable-key": pk,
1029
- "Content-Type": "application/json"
1030
- },
1031
- body: JSON.stringify(request)
1032
- }
1033
- );
1024
+ const response = await fetch(`${API_BASE_URL}/v1/public/transactions/hypercore/build`, {
1025
+ method: "POST",
1026
+ headers: {
1027
+ accept: "application/json",
1028
+ "x-publishable-key": pk,
1029
+ "Content-Type": "application/json"
1030
+ },
1031
+ body: JSON.stringify(request)
1032
+ });
1034
1033
  if (!response.ok) {
1035
1034
  const error = await response.json().catch(() => ({ message: response.statusText }));
1036
1035
  throw new Error(
@@ -1054,40 +1053,60 @@ async function getCashAppLimits(currency = "usd", publishableKey) {
1054
1053
  );
1055
1054
  if (!response.ok) {
1056
1055
  const error = await response.json().catch(() => ({ message: response.statusText }));
1057
- throw new Error(
1058
- `Failed to get Cash App limits: ${error.message || response.statusText}`
1059
- );
1056
+ throw new Error(`Failed to get Cash App limits: ${error.message || response.statusText}`);
1060
1057
  }
1061
1058
  return response.json();
1062
1059
  }
1063
1060
  async function createCashAppSession(request, publishableKey) {
1061
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1062
+ validatePublishableKey(pk);
1063
+ const response = await fetch(`${API_BASE_URL}/v1/public/onramps/cashapp/sessions`, {
1064
+ method: "POST",
1065
+ headers: {
1066
+ accept: "application/json",
1067
+ "x-publishable-key": pk,
1068
+ "Content-Type": "application/json"
1069
+ },
1070
+ body: JSON.stringify(request)
1071
+ });
1072
+ if (!response.ok) {
1073
+ const error = await response.json().catch(() => ({ message: response.statusText }));
1074
+ throw new Error(`Failed to create Cash App session: ${error.message || response.statusText}`);
1075
+ }
1076
+ return response.json();
1077
+ }
1078
+ async function getCashAppSessionStatus(externalId, publishableKey) {
1064
1079
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1065
1080
  validatePublishableKey(pk);
1066
1081
  const response = await fetch(
1067
- `${API_BASE_URL}/v1/public/onramps/cashapp/sessions`,
1082
+ `${API_BASE_URL}/v1/public/onramps/cashapp/sessions/${encodeURIComponent(externalId)}/status`,
1068
1083
  {
1069
- method: "POST",
1084
+ method: "GET",
1070
1085
  headers: {
1071
1086
  accept: "application/json",
1072
- "x-publishable-key": pk,
1073
- "Content-Type": "application/json"
1074
- },
1075
- body: JSON.stringify(request)
1087
+ "x-publishable-key": pk
1088
+ }
1076
1089
  }
1077
1090
  );
1078
1091
  if (!response.ok) {
1079
1092
  const error = await response.json().catch(() => ({ message: response.statusText }));
1080
1093
  throw new Error(
1081
- `Failed to create Cash App session: ${error.message || response.statusText}`
1094
+ `Failed to get Cash App session status: ${error.message || response.statusText}`
1082
1095
  );
1083
1096
  }
1084
1097
  return response.json();
1085
1098
  }
1086
- async function getCashAppSessionStatus(externalId, publishableKey) {
1099
+ async function stripeGetDefaultToken(params, publishableKey) {
1087
1100
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1088
1101
  validatePublishableKey(pk);
1102
+ const query = new URLSearchParams({
1103
+ token_address: params.tokenAddress,
1104
+ chain_id: params.chainId,
1105
+ chain_type: params.chainType
1106
+ });
1107
+ if (params.countryCode) query.append("country_code", params.countryCode);
1089
1108
  const response = await fetch(
1090
- `${API_BASE_URL}/v1/public/onramps/cashapp/sessions/${encodeURIComponent(externalId)}/status`,
1109
+ `${API_BASE_URL}${HEADLESS_STRIPE_BASE}/default_token?${query.toString()}`,
1091
1110
  {
1092
1111
  method: "GET",
1093
1112
  headers: {
@@ -1096,29 +1115,317 @@ async function getCashAppSessionStatus(externalId, publishableKey) {
1096
1115
  }
1097
1116
  }
1098
1117
  );
1118
+ if (!response.ok) {
1119
+ const error = await response.json().catch(() => ({ message: response.statusText }));
1120
+ throwStripeError("Failed to get Stripe default token", response, error);
1121
+ }
1122
+ return response.json();
1123
+ }
1124
+ var HEADLESS_STRIPE_BASE = "/v1/public/onramps/headless/stripe";
1125
+ var StripeApiResponseError = class extends Error {
1126
+ constructor(message, statusCode, stripeCode, errorType) {
1127
+ super(message);
1128
+ this.statusCode = statusCode;
1129
+ this.stripeCode = stripeCode;
1130
+ this.errorType = errorType;
1131
+ this.name = "StripeApiResponseError";
1132
+ }
1133
+ };
1134
+ function throwStripeError(prefix, response, error) {
1135
+ const stripeError = error.details?.stripe_error;
1136
+ const detailMessage = stripeError?.message || error.message || response.statusText;
1137
+ throw new StripeApiResponseError(
1138
+ `${prefix}: ${detailMessage}`,
1139
+ response.status,
1140
+ stripeError?.code,
1141
+ error.error_type
1142
+ );
1143
+ }
1144
+ async function stripeGetConfig(publishableKey) {
1145
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1146
+ validatePublishableKey(pk);
1147
+ const response = await fetch(`${API_BASE_URL}${HEADLESS_STRIPE_BASE}/config`, {
1148
+ method: "GET",
1149
+ headers: {
1150
+ accept: "application/json",
1151
+ "x-publishable-key": pk
1152
+ }
1153
+ });
1154
+ if (!response.ok) {
1155
+ const error = await response.json().catch(() => ({ message: response.statusText }));
1156
+ throwStripeError("Failed to get Stripe config", response, error);
1157
+ }
1158
+ return response.json();
1159
+ }
1160
+ async function stripeCreateAuthIntent(email, publishableKey) {
1161
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1162
+ validatePublishableKey(pk);
1163
+ const response = await fetch(`${API_BASE_URL}${HEADLESS_STRIPE_BASE}/oauth/start`, {
1164
+ method: "POST",
1165
+ headers: {
1166
+ accept: "application/json",
1167
+ "x-publishable-key": pk,
1168
+ "Content-Type": "application/json"
1169
+ },
1170
+ body: JSON.stringify({ email })
1171
+ });
1172
+ if (!response.ok) {
1173
+ const error = await response.json().catch(() => ({ message: response.statusText }));
1174
+ throwStripeError("Failed to create Stripe auth intent", response, error);
1175
+ }
1176
+ return response.json();
1177
+ }
1178
+ async function stripeExchangeTokens(authIntentId, publishableKey) {
1179
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1180
+ validatePublishableKey(pk);
1181
+ const response = await fetch(`${API_BASE_URL}${HEADLESS_STRIPE_BASE}/oauth/token`, {
1182
+ method: "POST",
1183
+ headers: {
1184
+ accept: "application/json",
1185
+ "x-publishable-key": pk,
1186
+ "Content-Type": "application/json"
1187
+ },
1188
+ body: JSON.stringify({ auth_intent_id: authIntentId })
1189
+ });
1190
+ if (!response.ok) {
1191
+ const error = await response.json().catch(() => ({ message: response.statusText }));
1192
+ throwStripeError("Failed to exchange Stripe tokens", response, error);
1193
+ }
1194
+ return response.json();
1195
+ }
1196
+ async function stripeRefreshToken(refreshToken, publishableKey) {
1197
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1198
+ validatePublishableKey(pk);
1199
+ const response = await fetch(`${API_BASE_URL}${HEADLESS_STRIPE_BASE}/oauth/token/refresh`, {
1200
+ method: "POST",
1201
+ headers: {
1202
+ accept: "application/json",
1203
+ "x-publishable-key": pk,
1204
+ "Content-Type": "application/json"
1205
+ },
1206
+ body: JSON.stringify({ refresh_token: refreshToken })
1207
+ });
1208
+ if (!response.ok) {
1209
+ const error = await response.json().catch(() => ({ message: response.statusText }));
1210
+ throwStripeError("Failed to refresh Stripe token", response, error);
1211
+ }
1212
+ return response.json();
1213
+ }
1214
+ async function stripeGetCustomer(customerId, oauthToken, publishableKey) {
1215
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1216
+ validatePublishableKey(pk);
1217
+ const response = await fetch(
1218
+ `${API_BASE_URL}${HEADLESS_STRIPE_BASE}/customers/${encodeURIComponent(customerId)}`,
1219
+ {
1220
+ method: "GET",
1221
+ headers: {
1222
+ accept: "application/json",
1223
+ "x-publishable-key": pk,
1224
+ "x-stripe-oauth-token": oauthToken
1225
+ }
1226
+ }
1227
+ );
1228
+ if (!response.ok) {
1229
+ const error = await response.json().catch(() => ({ message: response.statusText }));
1230
+ throwStripeError("Failed to get Stripe customer", response, error);
1231
+ }
1232
+ return response.json();
1233
+ }
1234
+ async function stripeListWallets(customerId, oauthToken, publishableKey) {
1235
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1236
+ validatePublishableKey(pk);
1237
+ const response = await fetch(
1238
+ `${API_BASE_URL}${HEADLESS_STRIPE_BASE}/customers/${encodeURIComponent(customerId)}/wallet_addresses`,
1239
+ {
1240
+ method: "GET",
1241
+ headers: {
1242
+ accept: "application/json",
1243
+ "x-publishable-key": pk,
1244
+ "x-stripe-oauth-token": oauthToken
1245
+ }
1246
+ }
1247
+ );
1248
+ if (!response.ok) {
1249
+ const error = await response.json().catch(() => ({ message: response.statusText }));
1250
+ throwStripeError("Failed to list Stripe wallets", response, error);
1251
+ }
1252
+ return response.json();
1253
+ }
1254
+ async function stripeListPaymentTokens(customerId, oauthToken, publishableKey) {
1255
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1256
+ validatePublishableKey(pk);
1257
+ const response = await fetch(
1258
+ `${API_BASE_URL}${HEADLESS_STRIPE_BASE}/customers/${encodeURIComponent(customerId)}/payment_tokens`,
1259
+ {
1260
+ method: "GET",
1261
+ headers: {
1262
+ accept: "application/json",
1263
+ "x-publishable-key": pk,
1264
+ "x-stripe-oauth-token": oauthToken
1265
+ }
1266
+ }
1267
+ );
1099
1268
  if (!response.ok) {
1100
1269
  const error = await response.json().catch(() => ({ message: response.statusText }));
1101
1270
  throw new Error(
1102
- `Failed to get Cash App session status: ${error.message || response.statusText}`
1271
+ `Failed to list Stripe payment tokens: ${error.message || response.statusText}`
1103
1272
  );
1104
1273
  }
1105
1274
  return response.json();
1106
1275
  }
1107
- async function sendHypercoreTransaction(request, publishableKey) {
1276
+ async function stripeCreateSession(request, oauthToken, publishableKey) {
1277
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1278
+ validatePublishableKey(pk);
1279
+ const response = await fetch(`${API_BASE_URL}${HEADLESS_STRIPE_BASE}/sessions`, {
1280
+ method: "POST",
1281
+ headers: {
1282
+ accept: "application/json",
1283
+ "x-publishable-key": pk,
1284
+ "x-stripe-oauth-token": oauthToken,
1285
+ "Content-Type": "application/json"
1286
+ },
1287
+ body: JSON.stringify({
1288
+ crypto_customer_id: request.cryptoCustomerId,
1289
+ payment_token: request.paymentToken,
1290
+ source_amount: request.sourceAmount,
1291
+ source_currency: request.sourceCurrency,
1292
+ destination_currency: request.destinationCurrency,
1293
+ destination_network: request.destinationNetwork,
1294
+ wallet_address: request.walletAddress
1295
+ })
1296
+ });
1297
+ if (!response.ok) {
1298
+ const error = await response.json().catch(() => ({ message: response.statusText }));
1299
+ throwStripeError("Failed to create Stripe session", response, error);
1300
+ }
1301
+ return response.json();
1302
+ }
1303
+ async function stripeConfirmSession(sessionId, oauthToken, request, publishableKey) {
1108
1304
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1109
1305
  validatePublishableKey(pk);
1110
1306
  const response = await fetch(
1111
- `${API_BASE_URL}/v1/public/transactions/hypercore/send`,
1307
+ `${API_BASE_URL}${HEADLESS_STRIPE_BASE}/sessions/${encodeURIComponent(sessionId)}/confirm`,
1112
1308
  {
1113
1309
  method: "POST",
1114
1310
  headers: {
1115
1311
  accept: "application/json",
1116
1312
  "x-publishable-key": pk,
1313
+ "x-stripe-oauth-token": oauthToken,
1117
1314
  "Content-Type": "application/json"
1118
1315
  },
1119
- body: JSON.stringify(request)
1316
+ body: JSON.stringify(request?.mandateData ? { mandate_data: request.mandateData } : {})
1120
1317
  }
1121
1318
  );
1319
+ if (!response.ok) {
1320
+ const error = await response.json().catch(() => ({ message: response.statusText }));
1321
+ throwStripeError("Failed to confirm Stripe session", response, error);
1322
+ }
1323
+ return response.json();
1324
+ }
1325
+ async function stripeRefreshQuote(sessionId, oauthToken, publishableKey) {
1326
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1327
+ validatePublishableKey(pk);
1328
+ const response = await fetch(
1329
+ `${API_BASE_URL}${HEADLESS_STRIPE_BASE}/sessions/${encodeURIComponent(sessionId)}/quote/refresh`,
1330
+ {
1331
+ method: "POST",
1332
+ headers: {
1333
+ accept: "application/json",
1334
+ "x-publishable-key": pk,
1335
+ "x-stripe-oauth-token": oauthToken
1336
+ }
1337
+ }
1338
+ );
1339
+ if (!response.ok) {
1340
+ const error = await response.json().catch(() => ({ message: response.statusText }));
1341
+ throwStripeError("Failed to refresh Stripe quote", response, error);
1342
+ }
1343
+ return response.json();
1344
+ }
1345
+ async function stripeGetSession(sessionId, oauthToken, publishableKey) {
1346
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1347
+ validatePublishableKey(pk);
1348
+ const response = await fetch(
1349
+ `${API_BASE_URL}${HEADLESS_STRIPE_BASE}/sessions/${encodeURIComponent(sessionId)}`,
1350
+ {
1351
+ method: "GET",
1352
+ headers: {
1353
+ accept: "application/json",
1354
+ "x-publishable-key": pk,
1355
+ "x-stripe-oauth-token": oauthToken
1356
+ }
1357
+ }
1358
+ );
1359
+ if (!response.ok) {
1360
+ const error = await response.json().catch(() => ({ message: response.statusText }));
1361
+ throwStripeError("Failed to get Stripe session", response, error);
1362
+ }
1363
+ return response.json();
1364
+ }
1365
+ async function stripeGetQuotes(request, oauthToken, publishableKey) {
1366
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1367
+ validatePublishableKey(pk);
1368
+ const headers = {
1369
+ accept: "application/json",
1370
+ "x-publishable-key": pk,
1371
+ "Content-Type": "application/json"
1372
+ };
1373
+ if (oauthToken) headers["x-stripe-oauth-token"] = oauthToken;
1374
+ const response = await fetch(`${API_BASE_URL}${HEADLESS_STRIPE_BASE}/quotes`, {
1375
+ method: "POST",
1376
+ headers,
1377
+ body: JSON.stringify({
1378
+ source_amount: request.sourceAmount,
1379
+ source_currency: request.sourceCurrency,
1380
+ destination_currency: request.destinationCurrency,
1381
+ destination_network: request.destinationNetwork
1382
+ })
1383
+ });
1384
+ if (!response.ok) {
1385
+ const error = await response.json().catch(() => ({ message: response.statusText }));
1386
+ throwStripeError("Failed to get Stripe quotes", response, error);
1387
+ }
1388
+ return response.json();
1389
+ }
1390
+ async function stripeGetTransactionLimits(params, oauthToken, publishableKey) {
1391
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1392
+ validatePublishableKey(pk);
1393
+ const query = new URLSearchParams({
1394
+ crypto_customer_id: params.cryptoCustomerId,
1395
+ destination_network: params.destinationNetwork,
1396
+ wallet_address: params.walletAddress
1397
+ });
1398
+ if (params.destinationTag) query.append("destination_tag", params.destinationTag);
1399
+ if (params.refresh) query.append("refresh", "true");
1400
+ const response = await fetch(
1401
+ `${API_BASE_URL}${HEADLESS_STRIPE_BASE}/transaction_limits?${query.toString()}`,
1402
+ {
1403
+ method: "GET",
1404
+ headers: {
1405
+ accept: "application/json",
1406
+ "x-publishable-key": pk,
1407
+ "x-stripe-oauth-token": oauthToken
1408
+ }
1409
+ }
1410
+ );
1411
+ if (!response.ok) {
1412
+ const error = await response.json().catch(() => ({ message: response.statusText }));
1413
+ throwStripeError("Failed to get Stripe transaction limits", response, error);
1414
+ }
1415
+ return response.json();
1416
+ }
1417
+ async function sendHypercoreTransaction(request, publishableKey) {
1418
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1419
+ validatePublishableKey(pk);
1420
+ const response = await fetch(`${API_BASE_URL}/v1/public/transactions/hypercore/send`, {
1421
+ method: "POST",
1422
+ headers: {
1423
+ accept: "application/json",
1424
+ "x-publishable-key": pk,
1425
+ "Content-Type": "application/json"
1426
+ },
1427
+ body: JSON.stringify(request)
1428
+ });
1122
1429
  if (!response.ok) {
1123
1430
  const error = await response.json().catch(() => ({ message: response.statusText }));
1124
1431
  throw new Error(
@@ -1127,6 +1434,186 @@ async function sendHypercoreTransaction(request, publishableKey) {
1127
1434
  }
1128
1435
  return response.json();
1129
1436
  }
1437
+ async function getCoinbaseLegalAgreements(publishableKey) {
1438
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1439
+ validatePublishableKey(pk);
1440
+ const response = await fetch(
1441
+ `${API_BASE_URL}/v1/public/onramps/headless/coinbase/legal_agreements`,
1442
+ {
1443
+ method: "GET",
1444
+ headers: { accept: "application/json", "x-publishable-key": pk }
1445
+ }
1446
+ );
1447
+ if (!response.ok) {
1448
+ throw new Error(`Failed to fetch Coinbase legal agreements: ${response.statusText}`);
1449
+ }
1450
+ return response.json();
1451
+ }
1452
+ var VERIFICATION_BASE = "/v1/public/onramps/verification_sessions";
1453
+ async function jsonOrThrow(response, label) {
1454
+ if (!response.ok) {
1455
+ const error = await response.json().catch(() => ({ message: response.statusText }));
1456
+ const body = error;
1457
+ const tag = body.error_type ? ` [${body.error_type}]` : "";
1458
+ throw new Error(`${label}${tag}: ${body.message || response.statusText}`);
1459
+ }
1460
+ return response.json();
1461
+ }
1462
+ async function createOnrampVerificationSession(request, publishableKey) {
1463
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1464
+ validatePublishableKey(pk);
1465
+ const response = await fetch(`${API_BASE_URL}${VERIFICATION_BASE}`, {
1466
+ method: "POST",
1467
+ headers: {
1468
+ accept: "application/json",
1469
+ "x-publishable-key": pk,
1470
+ "Content-Type": "application/json"
1471
+ },
1472
+ body: JSON.stringify(request)
1473
+ });
1474
+ return jsonOrThrow(response, "Failed to create verification session");
1475
+ }
1476
+ async function postVerificationAction(id, factor, action, body, publishableKey) {
1477
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1478
+ validatePublishableKey(pk);
1479
+ const response = await fetch(
1480
+ `${API_BASE_URL}${VERIFICATION_BASE}/${encodeURIComponent(id)}/${factor}/${action}`,
1481
+ {
1482
+ method: "POST",
1483
+ headers: {
1484
+ accept: "application/json",
1485
+ "x-publishable-key": pk,
1486
+ "Content-Type": "application/json"
1487
+ },
1488
+ body: JSON.stringify(body)
1489
+ }
1490
+ );
1491
+ return jsonOrThrow(response, `Failed to ${action} ${factor} OTP`);
1492
+ }
1493
+ async function sendOnrampVerificationOtp(id, factor, clientSecret, publishableKey) {
1494
+ return postVerificationAction(
1495
+ id,
1496
+ factor,
1497
+ "send",
1498
+ { client_secret: clientSecret },
1499
+ publishableKey
1500
+ );
1501
+ }
1502
+ async function verifyOnrampVerificationOtp(id, factor, clientSecret, code, publishableKey) {
1503
+ return postVerificationAction(
1504
+ id,
1505
+ factor,
1506
+ "verify",
1507
+ { client_secret: clientSecret, code },
1508
+ publishableKey
1509
+ );
1510
+ }
1511
+ async function exchangeOnrampVerificationToken(id, clientSecret, publishableKey) {
1512
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1513
+ validatePublishableKey(pk);
1514
+ const response = await fetch(
1515
+ `${API_BASE_URL}${VERIFICATION_BASE}/${encodeURIComponent(id)}/token`,
1516
+ {
1517
+ method: "POST",
1518
+ headers: {
1519
+ accept: "application/json",
1520
+ "x-publishable-key": pk,
1521
+ "Content-Type": "application/json"
1522
+ },
1523
+ body: JSON.stringify({ client_secret: clientSecret })
1524
+ }
1525
+ );
1526
+ return jsonOrThrow(
1527
+ response,
1528
+ "Failed to exchange verification token"
1529
+ );
1530
+ }
1531
+ async function getOnrampVerificationSession(id, clientSecret, publishableKey) {
1532
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1533
+ validatePublishableKey(pk);
1534
+ const url = new URL(`${API_BASE_URL}${VERIFICATION_BASE}/${encodeURIComponent(id)}`);
1535
+ url.searchParams.set("client_secret", clientSecret);
1536
+ const response = await fetch(url.toString(), {
1537
+ method: "GET",
1538
+ headers: { accept: "application/json", "x-publishable-key": pk }
1539
+ });
1540
+ return jsonOrThrow(response, "Failed to fetch verification session");
1541
+ }
1542
+ function isApplePayLimitReached(response) {
1543
+ return response.limits.some((l) => l.remaining === "0");
1544
+ }
1545
+ function getApplePayLimitUpgradeStatus(response) {
1546
+ const opt = response.limit_upgrade_options?.[0];
1547
+ if (!opt || typeof opt.status !== "string") return null;
1548
+ return opt.status;
1549
+ }
1550
+ async function getCoinbaseApplePayLimits(phone, publishableKey, signal) {
1551
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1552
+ validatePublishableKey(pk);
1553
+ const response = await fetch(
1554
+ `${API_BASE_URL}/v1/public/onramps/headless/coinbase/apple_pay/limits`,
1555
+ {
1556
+ method: "POST",
1557
+ headers: {
1558
+ accept: "application/json",
1559
+ "x-publishable-key": pk,
1560
+ "Content-Type": "application/json"
1561
+ },
1562
+ body: JSON.stringify({ phone }),
1563
+ signal
1564
+ }
1565
+ );
1566
+ const raw = await jsonOrThrow(response, "Failed to fetch Apple Pay limits");
1567
+ return {
1568
+ limits: raw.limits,
1569
+ limit_upgrade_options: raw.limit_upgrade_options,
1570
+ limit_reached: isApplePayLimitReached(raw),
1571
+ upgrade_status: getApplePayLimitUpgradeStatus(raw)
1572
+ };
1573
+ }
1574
+ async function requestCoinbaseApplePayLimitUpgrade(request, publishableKey, signal) {
1575
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1576
+ validatePublishableKey(pk);
1577
+ const response = await fetch(
1578
+ `${API_BASE_URL}/v1/public/onramps/headless/coinbase/apple_pay/limits/upgrade`,
1579
+ {
1580
+ method: "POST",
1581
+ headers: {
1582
+ accept: "application/json",
1583
+ "x-publishable-key": pk,
1584
+ "Content-Type": "application/json"
1585
+ },
1586
+ body: JSON.stringify(request),
1587
+ signal
1588
+ }
1589
+ );
1590
+ return jsonOrThrow(
1591
+ response,
1592
+ "Failed to request Apple Pay limit upgrade"
1593
+ );
1594
+ }
1595
+ async function createCoinbaseApplePaySession(request, onrampToken, publishableKey, signal) {
1596
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1597
+ validatePublishableKey(pk);
1598
+ const response = await fetch(
1599
+ `${API_BASE_URL}/v1/public/onramps/headless/coinbase/apple_pay/sessions`,
1600
+ {
1601
+ method: "POST",
1602
+ headers: {
1603
+ accept: "application/json",
1604
+ "x-publishable-key": pk,
1605
+ "Content-Type": "application/json",
1606
+ "x-onramp-token": onrampToken
1607
+ },
1608
+ body: JSON.stringify(request),
1609
+ signal
1610
+ }
1611
+ );
1612
+ return jsonOrThrow(
1613
+ response,
1614
+ "Failed to create Apple Pay session"
1615
+ );
1616
+ }
1130
1617
 
1131
1618
  // src/lib/events.ts
1132
1619
  var DepositEventType = /* @__PURE__ */ ((DepositEventType2) => {
@@ -1283,6 +1770,7 @@ var i18n = en_default;
1283
1770
  IneligibilityReason,
1284
1771
  IntegrationProvider,
1285
1772
  SOLANA_USDC_ADDRESS,
1773
+ StripeApiResponseError,
1286
1774
  WithdrawEventType,
1287
1775
  authenticateIntegrationOAuth,
1288
1776
  buildHypercoreTransaction,
@@ -1290,20 +1778,27 @@ var i18n = en_default;
1290
1778
  checkHypercoreActivation,
1291
1779
  confirmIntegrationTransfer,
1292
1780
  createCashAppSession,
1781
+ createCoinbaseApplePaySession,
1293
1782
  createDepositAddress,
1294
1783
  createExchangeSession,
1295
1784
  createIntegrationTransfer,
1296
1785
  createOnrampSession,
1786
+ createOnrampVerificationSession,
1787
+ exchangeOnrampVerificationToken,
1297
1788
  formatStablecoinAmount,
1298
1789
  generateKSUID,
1299
1790
  generatePrefixedKSUID,
1300
1791
  getAddressBalance,
1301
1792
  getAddressBalances,
1302
1793
  getApiBaseUrl,
1794
+ getApplePayLimitUpgradeStatus,
1795
+ getApplePayProviders,
1303
1796
  getBankTransferProviders,
1304
1797
  getCashAppLimits,
1305
1798
  getCashAppSessionStatus,
1306
1799
  getChainName,
1800
+ getCoinbaseApplePayLimits,
1801
+ getCoinbaseLegalAgreements,
1307
1802
  getDefaultOnrampToken,
1308
1803
  getDepositAddress,
1309
1804
  getDepositQuote,
@@ -1319,6 +1814,7 @@ var i18n = en_default;
1319
1814
  getIpAddress,
1320
1815
  getOnrampQuotes,
1321
1816
  getOnrampSessionStartUrl,
1817
+ getOnrampVerificationSession,
1322
1818
  getPreferredIconUrl,
1323
1819
  getProjectConfig,
1324
1820
  getSupportedDepositTokens,
@@ -1328,16 +1824,34 @@ var i18n = en_default;
1328
1824
  getWalletByChainType,
1329
1825
  getWalletMobileDeepLink,
1330
1826
  i18n,
1827
+ isApplePayLimitReached,
1331
1828
  listPaymentIntentExecutions,
1332
1829
  pollDirectExecutions,
1333
1830
  queryExecutions,
1334
1831
  refreshIntegrationToken,
1832
+ requestCoinbaseApplePayLimitUpgrade,
1335
1833
  retrievePaymentIntent,
1336
1834
  revokeIntegrationToken,
1337
1835
  sendHypercoreTransaction,
1836
+ sendOnrampVerificationOtp,
1338
1837
  sendSolanaTransaction,
1339
1838
  setApiConfig,
1340
1839
  startIntegrationOAuth,
1840
+ stripeConfirmSession,
1841
+ stripeCreateAuthIntent,
1842
+ stripeCreateSession,
1843
+ stripeExchangeTokens,
1844
+ stripeGetConfig,
1845
+ stripeGetCustomer,
1846
+ stripeGetDefaultToken,
1847
+ stripeGetQuotes,
1848
+ stripeGetSession,
1849
+ stripeGetTransactionLimits,
1850
+ stripeListPaymentTokens,
1851
+ stripeListWallets,
1852
+ stripeRefreshQuote,
1853
+ stripeRefreshToken,
1341
1854
  useUserIp,
1855
+ verifyOnrampVerificationOtp,
1342
1856
  verifyRecipientAddress
1343
1857
  });