@unifold/connect-react 0.1.78 → 0.1.79
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 +308 -322
- package/dist/index.mjs +53 -67
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1152,61 +1152,61 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
|
|
|
1152
1152
|
// src/index.ts
|
|
1153
1153
|
var index_exports = {};
|
|
1154
1154
|
__export(index_exports, {
|
|
1155
|
-
ActionType: () =>
|
|
1155
|
+
ActionType: () => import_core60.ActionType,
|
|
1156
1156
|
Button: () => Button,
|
|
1157
|
-
CheckoutEventType: () =>
|
|
1157
|
+
CheckoutEventType: () => import_core60.CheckoutEventType,
|
|
1158
1158
|
ConfirmingView: () => ConfirmingView,
|
|
1159
|
-
DepositEventType: () =>
|
|
1160
|
-
ExecutionStatus: () =>
|
|
1159
|
+
DepositEventType: () => import_core60.DepositEventType,
|
|
1160
|
+
ExecutionStatus: () => import_core60.ExecutionStatus,
|
|
1161
1161
|
I18nProvider: () => I18nProvider,
|
|
1162
|
-
SOLANA_USDC_ADDRESS: () =>
|
|
1162
|
+
SOLANA_USDC_ADDRESS: () => import_core60.SOLANA_USDC_ADDRESS,
|
|
1163
1163
|
SUPPORTED_LOCALES: () => SUPPORTED_LOCALES,
|
|
1164
1164
|
UnifoldProvider: () => UnifoldProvider,
|
|
1165
|
-
WithdrawEventType: () =>
|
|
1166
|
-
createDepositAddress: () =>
|
|
1167
|
-
createOnrampSession: () =>
|
|
1165
|
+
WithdrawEventType: () => import_core60.WithdrawEventType,
|
|
1166
|
+
createDepositAddress: () => import_core60.createDepositAddress,
|
|
1167
|
+
createOnrampSession: () => import_core60.createOnrampSession,
|
|
1168
1168
|
detectBrowserLocale: () => detectBrowserLocale,
|
|
1169
|
-
generatePrefixedKSUID: () =>
|
|
1170
|
-
getApiBaseUrl: () =>
|
|
1171
|
-
getChainName: () =>
|
|
1172
|
-
getDefaultOnrampToken: () =>
|
|
1173
|
-
getDepositQuote: () =>
|
|
1174
|
-
getFiatCurrencies: () =>
|
|
1175
|
-
getIconUrl: () =>
|
|
1176
|
-
getIconUrlWithCdn: () =>
|
|
1177
|
-
getIpAddress: () =>
|
|
1178
|
-
getOnrampQuotes: () =>
|
|
1179
|
-
getPreferredIconUrl: () =>
|
|
1180
|
-
getProjectConfig: () =>
|
|
1181
|
-
getSupportedDepositTokens: () =>
|
|
1182
|
-
getSupportedDestinationTokens: () =>
|
|
1183
|
-
getTokenChains: () =>
|
|
1184
|
-
getWalletByChainType: () =>
|
|
1185
|
-
i18n: () =>
|
|
1169
|
+
generatePrefixedKSUID: () => import_core60.generatePrefixedKSUID,
|
|
1170
|
+
getApiBaseUrl: () => import_core60.getApiBaseUrl,
|
|
1171
|
+
getChainName: () => import_core60.getChainName,
|
|
1172
|
+
getDefaultOnrampToken: () => import_core60.getDefaultOnrampToken,
|
|
1173
|
+
getDepositQuote: () => import_core60.getDepositQuote,
|
|
1174
|
+
getFiatCurrencies: () => import_core60.getFiatCurrencies,
|
|
1175
|
+
getIconUrl: () => import_core60.getIconUrl,
|
|
1176
|
+
getIconUrlWithCdn: () => import_core60.getIconUrlWithCdn,
|
|
1177
|
+
getIpAddress: () => import_core60.getIpAddress,
|
|
1178
|
+
getOnrampQuotes: () => import_core60.getOnrampQuotes,
|
|
1179
|
+
getPreferredIconUrl: () => import_core60.getPreferredIconUrl,
|
|
1180
|
+
getProjectConfig: () => import_core60.getProjectConfig,
|
|
1181
|
+
getSupportedDepositTokens: () => import_core60.getSupportedDepositTokens,
|
|
1182
|
+
getSupportedDestinationTokens: () => import_core60.getSupportedDestinationTokens,
|
|
1183
|
+
getTokenChains: () => import_core60.getTokenChains,
|
|
1184
|
+
getWalletByChainType: () => import_core60.getWalletByChainType,
|
|
1185
|
+
i18n: () => import_core60.i18n,
|
|
1186
1186
|
interpolate: () => interpolate,
|
|
1187
1187
|
normalizeLocale: () => normalizeLocale,
|
|
1188
|
-
queryExecutions: () =>
|
|
1189
|
-
retrievePaymentIntent: () =>
|
|
1190
|
-
sendSolanaTransaction: () =>
|
|
1191
|
-
setApiConfig: () =>
|
|
1192
|
-
stripeConfirmSession: () =>
|
|
1193
|
-
stripeCreateAuthIntent: () =>
|
|
1194
|
-
stripeCreateSession: () =>
|
|
1195
|
-
stripeExchangeTokens: () =>
|
|
1196
|
-
stripeGetConfig: () =>
|
|
1197
|
-
stripeGetCustomer: () =>
|
|
1198
|
-
stripeGetDefaultToken: () =>
|
|
1199
|
-
stripeGetQuotes: () =>
|
|
1200
|
-
stripeGetSession: () =>
|
|
1201
|
-
stripeListPaymentTokens: () =>
|
|
1202
|
-
stripeListWallets: () =>
|
|
1203
|
-
stripeRefreshQuote: () =>
|
|
1204
|
-
stripeRefreshToken: () =>
|
|
1188
|
+
queryExecutions: () => import_core60.queryExecutions,
|
|
1189
|
+
retrievePaymentIntent: () => import_core60.retrievePaymentIntent,
|
|
1190
|
+
sendSolanaTransaction: () => import_core60.sendSolanaTransaction,
|
|
1191
|
+
setApiConfig: () => import_core60.setApiConfig,
|
|
1192
|
+
stripeConfirmSession: () => import_core60.stripeConfirmSession,
|
|
1193
|
+
stripeCreateAuthIntent: () => import_core60.stripeCreateAuthIntent,
|
|
1194
|
+
stripeCreateSession: () => import_core60.stripeCreateSession,
|
|
1195
|
+
stripeExchangeTokens: () => import_core60.stripeExchangeTokens,
|
|
1196
|
+
stripeGetConfig: () => import_core60.stripeGetConfig,
|
|
1197
|
+
stripeGetCustomer: () => import_core60.stripeGetCustomer,
|
|
1198
|
+
stripeGetDefaultToken: () => import_core60.stripeGetDefaultToken,
|
|
1199
|
+
stripeGetQuotes: () => import_core60.stripeGetQuotes,
|
|
1200
|
+
stripeGetSession: () => import_core60.stripeGetSession,
|
|
1201
|
+
stripeListPaymentTokens: () => import_core60.stripeListPaymentTokens,
|
|
1202
|
+
stripeListWallets: () => import_core60.stripeListWallets,
|
|
1203
|
+
stripeRefreshQuote: () => import_core60.stripeRefreshQuote,
|
|
1204
|
+
stripeRefreshToken: () => import_core60.stripeRefreshToken,
|
|
1205
1205
|
useAllowedCountry: () => useAllowedCountry2,
|
|
1206
1206
|
useI18n: () => useI18n,
|
|
1207
1207
|
useSupportedDepositTokens: () => useSupportedDepositTokens,
|
|
1208
1208
|
useUnifold: () => useUnifold,
|
|
1209
|
-
useUserIp: () =>
|
|
1209
|
+
useUserIp: () => import_core60.useUserIp
|
|
1210
1210
|
});
|
|
1211
1211
|
module.exports = __toCommonJS(index_exports);
|
|
1212
1212
|
|
|
@@ -6198,15 +6198,13 @@ var import_core18 = require("@unifold/core");
|
|
|
6198
6198
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
6199
6199
|
var import_react25 = require("react");
|
|
6200
6200
|
var import_core19 = require("@unifold/core");
|
|
6201
|
-
var import_react_query9 = require("@tanstack/react-query");
|
|
6202
|
-
var import_core20 = require("@unifold/core");
|
|
6203
6201
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6204
6202
|
var import_react26 = require("react");
|
|
6203
|
+
var import_core20 = require("@unifold/core");
|
|
6204
|
+
var import_react_query9 = require("@tanstack/react-query");
|
|
6205
6205
|
var import_core21 = require("@unifold/core");
|
|
6206
|
-
var import_react_query10 = require("@tanstack/react-query");
|
|
6207
|
-
var import_core22 = require("@unifold/core");
|
|
6208
6206
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6209
|
-
var
|
|
6207
|
+
var import_core22 = require("@unifold/core");
|
|
6210
6208
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
6211
6209
|
var React92 = __toESM(require("react"), 1);
|
|
6212
6210
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
@@ -6374,7 +6372,7 @@ var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
|
6374
6372
|
var React182 = __toESM(require("react"), 1);
|
|
6375
6373
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
6376
6374
|
var React332 = __toESM(require("react"), 1);
|
|
6377
|
-
var
|
|
6375
|
+
var import_core23 = require("@unifold/core");
|
|
6378
6376
|
|
|
6379
6377
|
// ../../node_modules/.pnpm/mipd@0.0.7_typescript@5.9.3/node_modules/mipd/dist/esm/utils.js
|
|
6380
6378
|
function requestProviders(listener) {
|
|
@@ -6464,25 +6462,25 @@ var React342 = __toESM(require("react"), 1);
|
|
|
6464
6462
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
6465
6463
|
var import_react27 = require("react");
|
|
6466
6464
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6467
|
-
var
|
|
6465
|
+
var import_core24 = require("@unifold/core");
|
|
6468
6466
|
var import_react28 = require("react");
|
|
6469
6467
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6470
6468
|
var import_react29 = require("react");
|
|
6469
|
+
var import_core25 = require("@unifold/core");
|
|
6470
|
+
var import_react_query10 = require("@tanstack/react-query");
|
|
6471
6471
|
var import_core26 = require("@unifold/core");
|
|
6472
6472
|
var import_react_query11 = require("@tanstack/react-query");
|
|
6473
6473
|
var import_core27 = require("@unifold/core");
|
|
6474
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
6474
6475
|
var import_react_query12 = require("@tanstack/react-query");
|
|
6475
6476
|
var import_core28 = require("@unifold/core");
|
|
6476
|
-
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
6477
6477
|
var import_react_query13 = require("@tanstack/react-query");
|
|
6478
6478
|
var import_core29 = require("@unifold/core");
|
|
6479
6479
|
var import_react_query14 = require("@tanstack/react-query");
|
|
6480
6480
|
var import_core30 = require("@unifold/core");
|
|
6481
|
-
var import_react_query15 = require("@tanstack/react-query");
|
|
6482
6481
|
var import_core31 = require("@unifold/core");
|
|
6483
|
-
var import_core32 = require("@unifold/core");
|
|
6484
6482
|
var import_react30 = require("react");
|
|
6485
|
-
var
|
|
6483
|
+
var import_core32 = require("@unifold/core");
|
|
6486
6484
|
|
|
6487
6485
|
// ../analytics/dist/index.mjs
|
|
6488
6486
|
var __defProp2 = Object.defineProperty;
|
|
@@ -6577,7 +6575,7 @@ function generateKSUID() {
|
|
|
6577
6575
|
function generatePrefixedKSUID(prefix) {
|
|
6578
6576
|
return `${prefix}_${generateKSUID()}`;
|
|
6579
6577
|
}
|
|
6580
|
-
var PACKAGE_VERSION = "0.1.
|
|
6578
|
+
var PACKAGE_VERSION = "0.1.79";
|
|
6581
6579
|
var LIBRARY_NAME = "@unifold/analytics";
|
|
6582
6580
|
var DEFAULT_DEDUP_MS = 500;
|
|
6583
6581
|
var SESSION_PREFIX = "asess";
|
|
@@ -6729,16 +6727,16 @@ function createEventTracker(config) {
|
|
|
6729
6727
|
}
|
|
6730
6728
|
|
|
6731
6729
|
// ../ui-react/dist/index.mjs
|
|
6730
|
+
var import_core33 = require("@unifold/core");
|
|
6732
6731
|
var import_core34 = require("@unifold/core");
|
|
6732
|
+
var import_react_query15 = require("@tanstack/react-query");
|
|
6733
6733
|
var import_core35 = require("@unifold/core");
|
|
6734
|
-
var import_react_query16 = require("@tanstack/react-query");
|
|
6735
|
-
var import_core36 = require("@unifold/core");
|
|
6736
6734
|
var import_react31 = require("react");
|
|
6737
6735
|
var import_react32 = require("react");
|
|
6738
6736
|
var React362 = __toESM(require("react"), 1);
|
|
6739
6737
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
6740
6738
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
6741
|
-
var
|
|
6739
|
+
var import_core36 = require("@unifold/core");
|
|
6742
6740
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
6743
6741
|
var import_react33 = require("react");
|
|
6744
6742
|
|
|
@@ -11484,9 +11482,9 @@ var Content22 = TooltipContent;
|
|
|
11484
11482
|
|
|
11485
11483
|
// ../ui-react/dist/index.mjs
|
|
11486
11484
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
11485
|
+
var import_core37 = require("@unifold/core");
|
|
11486
|
+
var import_react_query16 = require("@tanstack/react-query");
|
|
11487
11487
|
var import_core38 = require("@unifold/core");
|
|
11488
|
-
var import_react_query17 = require("@tanstack/react-query");
|
|
11489
|
-
var import_core39 = require("@unifold/core");
|
|
11490
11488
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
11491
11489
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
11492
11490
|
var import_react36 = require("react");
|
|
@@ -12726,15 +12724,15 @@ var Separator = SelectSeparator;
|
|
|
12726
12724
|
|
|
12727
12725
|
// ../ui-react/dist/index.mjs
|
|
12728
12726
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
12729
|
-
var
|
|
12727
|
+
var import_core39 = require("@unifold/core");
|
|
12730
12728
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
12731
12729
|
var React39 = __toESM(require("react"), 1);
|
|
12730
|
+
var import_core40 = require("@unifold/core");
|
|
12732
12731
|
var import_core41 = require("@unifold/core");
|
|
12732
|
+
var import_react_query17 = require("@tanstack/react-query");
|
|
12733
12733
|
var import_core42 = require("@unifold/core");
|
|
12734
12734
|
var import_react_query18 = require("@tanstack/react-query");
|
|
12735
12735
|
var import_core43 = require("@unifold/core");
|
|
12736
|
-
var import_react_query19 = require("@tanstack/react-query");
|
|
12737
|
-
var import_core44 = require("@unifold/core");
|
|
12738
12736
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
12739
12737
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
12740
12738
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
@@ -12749,38 +12747,38 @@ var React41 = __toESM(require("react"), 1);
|
|
|
12749
12747
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
12750
12748
|
var import_react38 = require("react");
|
|
12751
12749
|
var import_react39 = require("react");
|
|
12750
|
+
var import_core44 = require("@unifold/core");
|
|
12751
|
+
var import_react_query19 = require("@tanstack/react-query");
|
|
12752
12752
|
var import_core45 = require("@unifold/core");
|
|
12753
|
-
var import_react_query20 = require("@tanstack/react-query");
|
|
12754
12753
|
var import_core46 = require("@unifold/core");
|
|
12755
|
-
var import_core47 = require("@unifold/core");
|
|
12756
12754
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
12757
12755
|
var import_react40 = require("react");
|
|
12756
|
+
var import_react_query20 = require("@tanstack/react-query");
|
|
12757
|
+
var import_core47 = require("@unifold/core");
|
|
12758
12758
|
var import_react_query21 = require("@tanstack/react-query");
|
|
12759
12759
|
var import_core48 = require("@unifold/core");
|
|
12760
12760
|
var import_react_query22 = require("@tanstack/react-query");
|
|
12761
12761
|
var import_core49 = require("@unifold/core");
|
|
12762
12762
|
var import_react_query23 = require("@tanstack/react-query");
|
|
12763
12763
|
var import_core50 = require("@unifold/core");
|
|
12764
|
-
var import_react_query24 = require("@tanstack/react-query");
|
|
12765
|
-
var import_core51 = require("@unifold/core");
|
|
12766
12764
|
var import_react41 = require("react");
|
|
12767
|
-
var
|
|
12765
|
+
var import_core51 = require("@unifold/core");
|
|
12768
12766
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
12769
12767
|
var import_react42 = require("react");
|
|
12768
|
+
var import_core52 = require("@unifold/core");
|
|
12769
|
+
var import_react_query24 = require("@tanstack/react-query");
|
|
12770
12770
|
var import_core53 = require("@unifold/core");
|
|
12771
|
-
var import_react_query25 = require("@tanstack/react-query");
|
|
12772
12771
|
var import_core54 = require("@unifold/core");
|
|
12773
|
-
var import_core55 = require("@unifold/core");
|
|
12774
12772
|
var import_react43 = require("react");
|
|
12773
|
+
var import_core55 = require("@unifold/core");
|
|
12774
|
+
var import_react_query25 = require("@tanstack/react-query");
|
|
12775
12775
|
var import_core56 = require("@unifold/core");
|
|
12776
|
-
var import_react_query26 = require("@tanstack/react-query");
|
|
12777
|
-
var import_core57 = require("@unifold/core");
|
|
12778
12776
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
12779
|
-
var
|
|
12777
|
+
var import_core57 = require("@unifold/core");
|
|
12780
12778
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
12781
12779
|
var import_react44 = require("react");
|
|
12782
12780
|
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
12783
|
-
var
|
|
12781
|
+
var import_core58 = require("@unifold/core");
|
|
12784
12782
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
12785
12783
|
var import_react45 = require("react");
|
|
12786
12784
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
@@ -21815,16 +21813,6 @@ function PayWithExchange({
|
|
|
21815
21813
|
}
|
|
21816
21814
|
);
|
|
21817
21815
|
}
|
|
21818
|
-
function useCashAppLimits({ publishableKey, currency = "usd" }) {
|
|
21819
|
-
return (0, import_react_query9.useQuery)({
|
|
21820
|
-
queryKey: ["unifold", "cashAppLimits", currency, publishableKey],
|
|
21821
|
-
queryFn: () => (0, import_core20.getCashAppLimits)(currency, publishableKey),
|
|
21822
|
-
enabled: !!publishableKey,
|
|
21823
|
-
staleTime: 2 * 60 * 6e4,
|
|
21824
|
-
gcTime: 4 * 60 * 6e4,
|
|
21825
|
-
retry: 2
|
|
21826
|
-
});
|
|
21827
|
-
}
|
|
21828
21816
|
var POLL_INTERVAL_MS3 = 5e3;
|
|
21829
21817
|
var FALLBACK_MIN_USD = 5;
|
|
21830
21818
|
var SUGGESTED_AMOUNTS = [25, 50, 100];
|
|
@@ -21860,9 +21848,11 @@ function PayWithCashApp({
|
|
|
21860
21848
|
const b = parseInt(bg.slice(4, 6), 16);
|
|
21861
21849
|
return (r2 * 299 + g * 587 + b * 114) / 1e3 < 128;
|
|
21862
21850
|
})();
|
|
21863
|
-
const { data:
|
|
21864
|
-
|
|
21865
|
-
|
|
21851
|
+
const { data: fiatCurrencies, isLoading: limitsLoading } = useFiatCurrencies({
|
|
21852
|
+
publishableKey
|
|
21853
|
+
});
|
|
21854
|
+
const minUsd = fiatCurrencies?.data.find((entry) => entry.currency_code.toLowerCase() === "usd")?.minimum_amount ?? FALLBACK_MIN_USD;
|
|
21855
|
+
const quickAmounts = SUGGESTED_AMOUNTS.filter((value) => value >= minUsd);
|
|
21866
21856
|
const [amount, setAmount] = (0, import_react25.useState)(() => sanitizePrefilledUsd(prefilledAmountUsd));
|
|
21867
21857
|
const [loading, setLoading] = (0, import_react25.useState)(false);
|
|
21868
21858
|
const [session, setSession] = (0, import_react25.useState)(null);
|
|
@@ -21917,6 +21907,8 @@ function PayWithCashApp({
|
|
|
21917
21907
|
setError(strings.depositModal.cashAppErrors.missingFields);
|
|
21918
21908
|
return;
|
|
21919
21909
|
}
|
|
21910
|
+
const amountNum2 = parseFloat(amount);
|
|
21911
|
+
if (isNaN(amountNum2) || amountNum2 < minUsd) return;
|
|
21920
21912
|
setLoading(true);
|
|
21921
21913
|
setError(null);
|
|
21922
21914
|
try {
|
|
@@ -21965,6 +21957,7 @@ function PayWithCashApp({
|
|
|
21965
21957
|
}
|
|
21966
21958
|
}, [
|
|
21967
21959
|
amount,
|
|
21960
|
+
minUsd,
|
|
21968
21961
|
userId,
|
|
21969
21962
|
publishableKey,
|
|
21970
21963
|
recipientAddress,
|
|
@@ -22068,8 +22061,7 @@ function PayWithCashApp({
|
|
|
22068
22061
|
const amountNum = parseFloat(amount);
|
|
22069
22062
|
const hasInput = !isNaN(amountNum) && amountNum > 0;
|
|
22070
22063
|
const belowMin = hasInput && amountNum < minUsd;
|
|
22071
|
-
const
|
|
22072
|
-
const isValidAmount = hasInput && !belowMin && !aboveMax;
|
|
22064
|
+
const isValidAmount = hasInput && !belowMin;
|
|
22073
22065
|
if (view === "amount") {
|
|
22074
22066
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
22075
22067
|
"div",
|
|
@@ -22098,7 +22090,7 @@ function PayWithCashApp({
|
|
|
22098
22090
|
}
|
|
22099
22091
|
}
|
|
22100
22092
|
) }) }),
|
|
22101
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "uf-flex uf-gap-3 uf-justify-center", children:
|
|
22093
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "uf-flex uf-gap-3 uf-justify-center", children: quickAmounts.map((quickAmount) => {
|
|
22102
22094
|
const isSelected = parseFloat(amount) === quickAmount;
|
|
22103
22095
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
22104
22096
|
"button",
|
|
@@ -22124,23 +22116,17 @@ function PayWithCashApp({
|
|
|
22124
22116
|
quickAmount
|
|
22125
22117
|
);
|
|
22126
22118
|
}) }),
|
|
22127
|
-
|
|
22128
|
-
"div",
|
|
22129
|
-
{
|
|
22130
|
-
className: "uf-text-sm uf-text-center uf-mt-3 uf-px-2",
|
|
22131
|
-
style: { color: colors2.error, fontFamily: fonts.regular },
|
|
22132
|
-
children: interpolate(strings.common.minimumAmount, { amount: `$${minUsd}` })
|
|
22133
|
-
}
|
|
22134
|
-
) : amount && maxUsd !== null && amountNum > maxUsd && !error ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
22119
|
+
!limitsLoading && minUsd > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
22135
22120
|
"div",
|
|
22136
22121
|
{
|
|
22137
|
-
className: "uf-text-
|
|
22138
|
-
style: { color: colors2.
|
|
22139
|
-
children: interpolate(strings.common.
|
|
22140
|
-
amount: `$${
|
|
22122
|
+
className: "uf-text-center uf-text-xs uf-mt-4",
|
|
22123
|
+
style: { color: colors2.warning, fontFamily: fonts.regular },
|
|
22124
|
+
children: interpolate(strings.common.minimumDeposit, {
|
|
22125
|
+
amount: `$${minUsd.toFixed(2)}`
|
|
22141
22126
|
})
|
|
22142
22127
|
}
|
|
22143
|
-
)
|
|
22128
|
+
),
|
|
22129
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
22144
22130
|
"div",
|
|
22145
22131
|
{
|
|
22146
22132
|
className: "uf-text-sm uf-text-center uf-mt-3 uf-px-2",
|
|
@@ -22149,7 +22135,7 @@ function PayWithCashApp({
|
|
|
22149
22135
|
}
|
|
22150
22136
|
) : null
|
|
22151
22137
|
] }),
|
|
22152
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "uf-px-1", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
22138
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "uf-px-1 uf-mt-5", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
22153
22139
|
"button",
|
|
22154
22140
|
{
|
|
22155
22141
|
onClick: handleCreateSession,
|
|
@@ -22370,9 +22356,9 @@ function useBankTransferProviders({
|
|
|
22370
22356
|
countryCode
|
|
22371
22357
|
}) {
|
|
22372
22358
|
const normalizedCountry = countryCode?.toUpperCase();
|
|
22373
|
-
const { data: providers, isLoading } = (0,
|
|
22359
|
+
const { data: providers, isLoading } = (0, import_react_query9.useQuery)({
|
|
22374
22360
|
queryKey: ["unifold", "bankTransferProviders", publishableKey, normalizedCountry ?? null],
|
|
22375
|
-
queryFn: () => (0,
|
|
22361
|
+
queryFn: () => (0, import_core21.getBankTransferProviders)(publishableKey, { countryCode: normalizedCountry }),
|
|
22376
22362
|
enabled,
|
|
22377
22363
|
staleTime: 1e3 * 60 * 30,
|
|
22378
22364
|
refetchOnMount: true,
|
|
@@ -22452,7 +22438,7 @@ function BankTransfer({
|
|
|
22452
22438
|
const providers = providersResponse?.data ?? [];
|
|
22453
22439
|
const pollingWalletId = (0, import_react26.useMemo)(() => {
|
|
22454
22440
|
if (!defaultToken) return void 0;
|
|
22455
|
-
return (0,
|
|
22441
|
+
return (0, import_core20.getWalletByChainType)(
|
|
22456
22442
|
wallets,
|
|
22457
22443
|
defaultToken.destination_token_metadata.chain_type
|
|
22458
22444
|
)?.id;
|
|
@@ -22485,7 +22471,7 @@ function BankTransfer({
|
|
|
22485
22471
|
let rate = sourceCurrency2 === "usd" ? 1 : fiatExchangeRates[sourceCurrency2];
|
|
22486
22472
|
if ((!rate || rate <= 0) && sourceCurrency2 !== "usd") {
|
|
22487
22473
|
try {
|
|
22488
|
-
const response = await (0,
|
|
22474
|
+
const response = await (0, import_core20.getFiatExchangeRates)({}, publishableKey);
|
|
22489
22475
|
if (response?.rates) {
|
|
22490
22476
|
setFiatExchangeRates((prev) => ({
|
|
22491
22477
|
...prev,
|
|
@@ -22518,7 +22504,7 @@ function BankTransfer({
|
|
|
22518
22504
|
setSessionError(strings.buyWithCard.errors.destinationTokenUnresolved);
|
|
22519
22505
|
return;
|
|
22520
22506
|
}
|
|
22521
|
-
const wallet = (0,
|
|
22507
|
+
const wallet = (0, import_core20.getWalletByChainType)(
|
|
22522
22508
|
wallets,
|
|
22523
22509
|
defaultToken.destination_token_metadata.chain_type
|
|
22524
22510
|
);
|
|
@@ -22567,9 +22553,9 @@ function BankTransfer({
|
|
|
22567
22553
|
setView("pending");
|
|
22568
22554
|
};
|
|
22569
22555
|
const openSession = (request) => {
|
|
22570
|
-
const externalId = (0,
|
|
22556
|
+
const externalId = (0, import_core20.generatePrefixedKSUID)("orsext");
|
|
22571
22557
|
const requestWithId = { ...request, external_id: externalId };
|
|
22572
|
-
const sessionStartUrl = (0,
|
|
22558
|
+
const sessionStartUrl = (0, import_core20.getOnrampSessionStartUrl)(requestWithId, publishableKey);
|
|
22573
22559
|
track("flow_started", {
|
|
22574
22560
|
method: "bank_transfer",
|
|
22575
22561
|
flow_type: "deposit",
|
|
@@ -22580,8 +22566,8 @@ function BankTransfer({
|
|
|
22580
22566
|
deposit_wallet_id: pollingWalletId
|
|
22581
22567
|
});
|
|
22582
22568
|
onEvent?.({
|
|
22583
|
-
id: (0,
|
|
22584
|
-
type:
|
|
22569
|
+
id: (0, import_core20.generatePrefixedKSUID)("sevt"),
|
|
22570
|
+
type: import_core20.DepositEventType.ONRAMP_SESSION_CREATED,
|
|
22585
22571
|
created: Math.floor(Date.now() / 1e3),
|
|
22586
22572
|
sessionId: getSessionId() ?? "",
|
|
22587
22573
|
method: "bank_transfer",
|
|
@@ -22595,7 +22581,7 @@ function BankTransfer({
|
|
|
22595
22581
|
};
|
|
22596
22582
|
const offerable = providers.filter((provider) => provider.enabled);
|
|
22597
22583
|
const noEnabledProviders = providers.length > 0 && offerable.length === 0;
|
|
22598
|
-
const sourceCurrencyIcon = assetCdnUrl ? (0,
|
|
22584
|
+
const sourceCurrencyIcon = assetCdnUrl ? (0, import_core20.getIconUrlWithCdn)(`/icons/currencies/png/${sourceCurrency}.png`, assetCdnUrl) : void 0;
|
|
22599
22585
|
const onrampTokenIcon = defaultToken?.destination_token_metadata?.icon_url;
|
|
22600
22586
|
const onrampChainIcon = defaultToken?.destination_token_metadata?.chain?.icon_url;
|
|
22601
22587
|
const onrampTokenSymbol = defaultToken?.destination_token_metadata?.symbol?.toUpperCase() ?? "USDC";
|
|
@@ -23056,7 +23042,7 @@ function BankTransfer({
|
|
|
23056
23042
|
function DepositExecutionItem({ execution, onClick }) {
|
|
23057
23043
|
const { colors: colors2, fonts, components } = useTheme();
|
|
23058
23044
|
const { t: strings, locale } = useI18n();
|
|
23059
|
-
const isPending = execution.status ===
|
|
23045
|
+
const isPending = execution.status === import_core22.ExecutionStatus.PENDING || execution.status === import_core22.ExecutionStatus.WAITING || execution.status === import_core22.ExecutionStatus.DELAYED;
|
|
23060
23046
|
const formatDateTime = (timestamp) => {
|
|
23061
23047
|
try {
|
|
23062
23048
|
const date = new Date(timestamp);
|
|
@@ -23103,7 +23089,7 @@ function DepositExecutionItem({ execution, onClick }) {
|
|
|
23103
23089
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
23104
23090
|
"img",
|
|
23105
23091
|
{
|
|
23106
|
-
src: execution.destination_token_metadata?.icon_url || (0,
|
|
23092
|
+
src: execution.destination_token_metadata?.icon_url || (0, import_core22.getIconUrl)("/icons/tokens/svg/usdc.svg"),
|
|
23107
23093
|
alt: "Token",
|
|
23108
23094
|
width: 36,
|
|
23109
23095
|
height: 36,
|
|
@@ -26472,7 +26458,7 @@ function BrowserWalletButton({
|
|
|
26472
26458
|
let cancelled = false;
|
|
26473
26459
|
const walletChainType = wallet.type === "phantom-solana" || wallet.type === "solflare" || wallet.type === "backpack" || wallet.type === "glow" ? "solana" : "ethereum";
|
|
26474
26460
|
setIsLoadingBalance(true);
|
|
26475
|
-
(0,
|
|
26461
|
+
(0, import_core23.getAddressBalances)(wallet.address, walletChainType, publishableKey).then((response) => {
|
|
26476
26462
|
if (cancelled) return;
|
|
26477
26463
|
if (response.balances && response.balances.length > 0) {
|
|
26478
26464
|
const totalUsd = response.balances.reduce((sum, balance) => {
|
|
@@ -27176,7 +27162,7 @@ var STRIPE_SESSION_STATUS = {
|
|
|
27176
27162
|
var STRIPE_SESSION_POLL_INTERVAL_MS = 3e3;
|
|
27177
27163
|
var STRIPE_CONSUMED_PAYMENT_METHOD_CODE = "payment_method_unexpected_state";
|
|
27178
27164
|
function isConsumedPaymentMethodError(err) {
|
|
27179
|
-
return err instanceof
|
|
27165
|
+
return err instanceof import_core24.StripeApiResponseError && (err.errorType === "stripe_onramp_payment_method_consumed" || err.stripeCode === STRIPE_CONSUMED_PAYMENT_METHOD_CODE);
|
|
27180
27166
|
}
|
|
27181
27167
|
function describeStripePaymentFailure(reason) {
|
|
27182
27168
|
if (!reason) return null;
|
|
@@ -27334,7 +27320,7 @@ function PayWithStripeLink({
|
|
|
27334
27320
|
let active = true;
|
|
27335
27321
|
const fetchConfig = async () => {
|
|
27336
27322
|
try {
|
|
27337
|
-
const cfg = await (0,
|
|
27323
|
+
const cfg = await (0, import_core24.stripeGetConfig)(publishableKey);
|
|
27338
27324
|
if (active && cfg.publishable_key) setResolvedStripeKey(cfg.publishable_key);
|
|
27339
27325
|
else if (active) {
|
|
27340
27326
|
console.error("[PayWithStripeLink] Config response missing publishable_key");
|
|
@@ -27356,7 +27342,7 @@ function PayWithStripeLink({
|
|
|
27356
27342
|
let active = true;
|
|
27357
27343
|
const retryConfig = async () => {
|
|
27358
27344
|
try {
|
|
27359
|
-
const cfg = await (0,
|
|
27345
|
+
const cfg = await (0, import_core24.stripeGetConfig)(publishableKey);
|
|
27360
27346
|
if (active && cfg.publishable_key) setResolvedStripeKey(cfg.publishable_key);
|
|
27361
27347
|
} catch (err) {
|
|
27362
27348
|
const msg = err instanceof Error ? err.message : t.formErrors.configLoadFailed;
|
|
@@ -27422,7 +27408,7 @@ function PayWithStripeLink({
|
|
|
27422
27408
|
if (!rt) return null;
|
|
27423
27409
|
const doRefresh = async () => {
|
|
27424
27410
|
try {
|
|
27425
|
-
const res = await (0,
|
|
27411
|
+
const res = await (0, import_core24.stripeRefreshToken)(rt, publishableKey);
|
|
27426
27412
|
const newToken = res.access_token;
|
|
27427
27413
|
const newRefresh = extractRefreshToken(res) || rt;
|
|
27428
27414
|
setOauthToken(newToken);
|
|
@@ -27456,7 +27442,7 @@ function PayWithStripeLink({
|
|
|
27456
27442
|
try {
|
|
27457
27443
|
return await fn(token);
|
|
27458
27444
|
} catch (err) {
|
|
27459
|
-
const is403 = err instanceof
|
|
27445
|
+
const is403 = err instanceof import_core24.StripeApiResponseError && err.statusCode === 403 || err instanceof Error && (err.message.includes("403") || err.message.toLowerCase().includes("forbidden"));
|
|
27460
27446
|
if (is403) {
|
|
27461
27447
|
if (!refreshTokenRef.current) {
|
|
27462
27448
|
setStep("email");
|
|
@@ -27491,7 +27477,7 @@ function PayWithStripeLink({
|
|
|
27491
27477
|
return;
|
|
27492
27478
|
}
|
|
27493
27479
|
try {
|
|
27494
|
-
const res = await (0,
|
|
27480
|
+
const res = await (0, import_core24.stripeRefreshToken)(stored.refreshToken, publishableKey);
|
|
27495
27481
|
if (cancelled) return;
|
|
27496
27482
|
token = res.access_token;
|
|
27497
27483
|
refresh = extractRefreshToken(res) || stored.refreshToken;
|
|
@@ -27514,7 +27500,7 @@ function PayWithStripeLink({
|
|
|
27514
27500
|
refreshTokenRef.current = refresh;
|
|
27515
27501
|
if (stored.email) setEmail(stored.email);
|
|
27516
27502
|
try {
|
|
27517
|
-
const cust = await (0,
|
|
27503
|
+
const cust = await (0, import_core24.stripeGetCustomer)(stored.customerId, token, publishableKey);
|
|
27518
27504
|
if (cancelled) return;
|
|
27519
27505
|
setCustomer(cust);
|
|
27520
27506
|
const tiers = cust.kyc_tiers ?? [];
|
|
@@ -27523,7 +27509,7 @@ function PayWithStripeLink({
|
|
|
27523
27509
|
const hasPending = ["l0", "l1", "l2"].some((t2) => getTierStatus(t2) === "pending");
|
|
27524
27510
|
if (l1Status === "verified" && !hasPending) {
|
|
27525
27511
|
try {
|
|
27526
|
-
const pmResult = await (0,
|
|
27512
|
+
const pmResult = await (0, import_core24.stripeListPaymentTokens)(
|
|
27527
27513
|
stored.customerId,
|
|
27528
27514
|
token,
|
|
27529
27515
|
publishableKey
|
|
@@ -27683,7 +27669,7 @@ function PayWithStripeLink({
|
|
|
27683
27669
|
(0, import_react27.useEffect)(() => {
|
|
27684
27670
|
if (!destinationTokenAddress || !destinationChainId || !destinationChainType) return;
|
|
27685
27671
|
let cancelled = false;
|
|
27686
|
-
(0,
|
|
27672
|
+
(0, import_core24.stripeGetDefaultToken)(
|
|
27687
27673
|
{
|
|
27688
27674
|
tokenAddress: destinationTokenAddress,
|
|
27689
27675
|
chainId: destinationChainId,
|
|
@@ -27753,7 +27739,7 @@ function PayWithStripeLink({
|
|
|
27753
27739
|
enabled: !externalWallets?.length
|
|
27754
27740
|
});
|
|
27755
27741
|
const depositWallets = externalWallets?.length ? externalWallets : depositAddressResponse?.data ?? [];
|
|
27756
|
-
const onrampWalletAddress = (0,
|
|
27742
|
+
const onrampWalletAddress = (0, import_core24.getWalletByChainType)(depositWallets, stripeDestChainType)?.address;
|
|
27757
27743
|
const [registeredWalletKey, setRegisteredWalletKey] = (0, import_react27.useState)(null);
|
|
27758
27744
|
const walletKeyFor = (address) => `${stripeDestNetwork}:${stripeDestChainType === "ethereum" ? address.toLowerCase() : address}`;
|
|
27759
27745
|
const isOnrampWalletRegistered = !!onrampWalletAddress && registeredWalletKey === walletKeyFor(onrampWalletAddress);
|
|
@@ -27766,7 +27752,7 @@ function PayWithStripeLink({
|
|
|
27766
27752
|
);
|
|
27767
27753
|
}
|
|
27768
27754
|
}, [depositWallets, onrampWalletAddress, stripeDestChainType]);
|
|
27769
|
-
const depositWalletId = (0,
|
|
27755
|
+
const depositWalletId = (0, import_core24.getWalletByChainType)(depositWallets, stripeDestChainType)?.id;
|
|
27770
27756
|
const depositPollingActive = step === "checkout" || step === "success";
|
|
27771
27757
|
const { executions } = useDepositPolling({
|
|
27772
27758
|
userId,
|
|
@@ -27793,7 +27779,7 @@ function PayWithStripeLink({
|
|
|
27793
27779
|
executionReconciledSessionRef.current = confirmedSessionId;
|
|
27794
27780
|
handledTerminalSessionRef.current = confirmedSessionId;
|
|
27795
27781
|
let cancelled = false;
|
|
27796
|
-
void withTokenRefresh((tok) => (0,
|
|
27782
|
+
void withTokenRefresh((tok) => (0, import_core24.stripeGetSession)(confirmedSessionId, tok, publishableKey)).then((session) => {
|
|
27797
27783
|
if (cancelled) return;
|
|
27798
27784
|
setSessionStatus(
|
|
27799
27785
|
session.status === STRIPE_SESSION_STATUS.REJECTED || session.status === STRIPE_SESSION_STATUS.EXPIRED ? session.status : STRIPE_SESSION_STATUS.FULFILLMENT_COMPLETE
|
|
@@ -27819,7 +27805,7 @@ function PayWithStripeLink({
|
|
|
27819
27805
|
const poll = async () => {
|
|
27820
27806
|
try {
|
|
27821
27807
|
const session = await withTokenRefresh(
|
|
27822
|
-
(tok) => (0,
|
|
27808
|
+
(tok) => (0, import_core24.stripeGetSession)(confirmedSessionId, tok, publishableKey)
|
|
27823
27809
|
);
|
|
27824
27810
|
if (cancelled) return;
|
|
27825
27811
|
setSessionStatus(session.status);
|
|
@@ -27858,7 +27844,7 @@ function PayWithStripeLink({
|
|
|
27858
27844
|
setLoading(true);
|
|
27859
27845
|
setError(null);
|
|
27860
27846
|
try {
|
|
27861
|
-
const result = await (0,
|
|
27847
|
+
const result = await (0, import_core24.stripeCreateAuthIntent)(emailToUse.trim(), publishableKey);
|
|
27862
27848
|
setAuthIntentId(result.auth_intent_id);
|
|
27863
27849
|
setStep("auth");
|
|
27864
27850
|
} catch (err) {
|
|
@@ -27892,7 +27878,7 @@ function PayWithStripeLink({
|
|
|
27892
27878
|
}
|
|
27893
27879
|
const formattedPhone = `+1${digits}`;
|
|
27894
27880
|
await sdk.registerLinkUser(email.trim(), formattedPhone, "US");
|
|
27895
|
-
const result = await (0,
|
|
27881
|
+
const result = await (0, import_core24.stripeCreateAuthIntent)(email.trim(), publishableKey);
|
|
27896
27882
|
setAuthIntentId(result.auth_intent_id);
|
|
27897
27883
|
setStep("auth");
|
|
27898
27884
|
} catch (err) {
|
|
@@ -27935,7 +27921,7 @@ function PayWithStripeLink({
|
|
|
27935
27921
|
return;
|
|
27936
27922
|
}
|
|
27937
27923
|
try {
|
|
27938
|
-
const authResult = await (0,
|
|
27924
|
+
const authResult = await (0, import_core24.stripeCreateAuthIntent)(knownEmail, publishableKey);
|
|
27939
27925
|
setAuthIntentId(authResult.auth_intent_id);
|
|
27940
27926
|
setStep("auth");
|
|
27941
27927
|
} catch (err) {
|
|
@@ -27962,7 +27948,7 @@ function PayWithStripeLink({
|
|
|
27962
27948
|
setCustomerId(result.crypto_customer_id);
|
|
27963
27949
|
sdkAuthenticatedRef.current = true;
|
|
27964
27950
|
everAuthenticatedRef.current = true;
|
|
27965
|
-
const tokens = await (0,
|
|
27951
|
+
const tokens = await (0, import_core24.stripeExchangeTokens)(
|
|
27966
27952
|
authIntentId,
|
|
27967
27953
|
publishableKey,
|
|
27968
27954
|
result.crypto_customer_id
|
|
@@ -28040,7 +28026,7 @@ function PayWithStripeLink({
|
|
|
28040
28026
|
}
|
|
28041
28027
|
try {
|
|
28042
28028
|
const cust = await withTokenRefresh(
|
|
28043
|
-
(tok) => (0,
|
|
28029
|
+
(tok) => (0, import_core24.stripeGetCustomer)(customerId, tok, publishableKey)
|
|
28044
28030
|
);
|
|
28045
28031
|
if (!mounted) return;
|
|
28046
28032
|
setCustomer(cust);
|
|
@@ -28239,7 +28225,7 @@ function PayWithStripeLink({
|
|
|
28239
28225
|
try {
|
|
28240
28226
|
if (!onrampWalletAddress) return;
|
|
28241
28227
|
const existingWallets = await withTokenRefresh(
|
|
28242
|
-
(tok) => (0,
|
|
28228
|
+
(tok) => (0, import_core24.stripeListWallets)(customerId, tok, publishableKey)
|
|
28243
28229
|
);
|
|
28244
28230
|
if (!mounted) return;
|
|
28245
28231
|
setWallets(existingWallets.data);
|
|
@@ -28299,7 +28285,7 @@ function PayWithStripeLink({
|
|
|
28299
28285
|
return isEvm ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
28300
28286
|
};
|
|
28301
28287
|
const list = await withTokenRefresh(
|
|
28302
|
-
(tok) => (0,
|
|
28288
|
+
(tok) => (0, import_core24.stripeListWallets)(customerId, tok, publishableKey)
|
|
28303
28289
|
);
|
|
28304
28290
|
if (cancelled) return;
|
|
28305
28291
|
setWallets(list.data);
|
|
@@ -28349,7 +28335,7 @@ function PayWithStripeLink({
|
|
|
28349
28335
|
setLoading(true);
|
|
28350
28336
|
try {
|
|
28351
28337
|
const existing = await withTokenRefresh(
|
|
28352
|
-
(tok) => (0,
|
|
28338
|
+
(tok) => (0, import_core24.stripeListPaymentTokens)(customerId, tok, publishableKey)
|
|
28353
28339
|
);
|
|
28354
28340
|
if (!mounted) return;
|
|
28355
28341
|
setPaymentTokens(existing.data);
|
|
@@ -28369,7 +28355,7 @@ function PayWithStripeLink({
|
|
|
28369
28355
|
try {
|
|
28370
28356
|
const sdk = await initialize();
|
|
28371
28357
|
if (!sdk) throw new Error("SDK failed to load");
|
|
28372
|
-
const authResult = await (0,
|
|
28358
|
+
const authResult = await (0, import_core24.stripeCreateAuthIntent)(email, publishableKey);
|
|
28373
28359
|
if (!mounted) return;
|
|
28374
28360
|
setAuthIntentId(authResult.auth_intent_id);
|
|
28375
28361
|
setStep("auth");
|
|
@@ -28420,7 +28406,7 @@ function PayWithStripeLink({
|
|
|
28420
28406
|
if (!sdkAuthenticatedRef.current) {
|
|
28421
28407
|
if (email) {
|
|
28422
28408
|
pendingAddPaymentRef.current = true;
|
|
28423
|
-
const authResult = await (0,
|
|
28409
|
+
const authResult = await (0, import_core24.stripeCreateAuthIntent)(email, publishableKey);
|
|
28424
28410
|
if (!mounted) return;
|
|
28425
28411
|
setAuthIntentId(authResult.auth_intent_id);
|
|
28426
28412
|
setStep("auth");
|
|
@@ -28455,7 +28441,7 @@ function PayWithStripeLink({
|
|
|
28455
28441
|
if (display) {
|
|
28456
28442
|
applyAndAdvance();
|
|
28457
28443
|
if (customerId && accessTokenRef.current) {
|
|
28458
|
-
(0,
|
|
28444
|
+
(0, import_core24.stripeListPaymentTokens)(customerId, accessTokenRef.current, publishableKey).then((tokens) => {
|
|
28459
28445
|
if (mounted) setPaymentTokens(tokens.data);
|
|
28460
28446
|
}).catch(() => {
|
|
28461
28447
|
});
|
|
@@ -28464,7 +28450,7 @@ function PayWithStripeLink({
|
|
|
28464
28450
|
}
|
|
28465
28451
|
try {
|
|
28466
28452
|
if (customerId && accessTokenRef.current) {
|
|
28467
|
-
const tokens = await (0,
|
|
28453
|
+
const tokens = await (0, import_core24.stripeListPaymentTokens)(
|
|
28468
28454
|
customerId,
|
|
28469
28455
|
accessTokenRef.current,
|
|
28470
28456
|
publishableKey
|
|
@@ -28525,10 +28511,10 @@ function PayWithStripeLink({
|
|
|
28525
28511
|
setRequiredStepUp(tier ?? null);
|
|
28526
28512
|
setStep("amount");
|
|
28527
28513
|
if (customerId && onrampWalletAddress) {
|
|
28528
|
-
void withTokenRefresh((tok) => (0,
|
|
28514
|
+
void withTokenRefresh((tok) => (0, import_core24.stripeGetCustomer)(customerId, tok, publishableKey)).then((cust) => setCustomer(cust)).catch(() => {
|
|
28529
28515
|
});
|
|
28530
28516
|
void withTokenRefresh(
|
|
28531
|
-
(tok) => (0,
|
|
28517
|
+
(tok) => (0, import_core24.stripeGetTransactionLimits)(
|
|
28532
28518
|
{
|
|
28533
28519
|
cryptoCustomerId: customerId,
|
|
28534
28520
|
destinationNetwork: getStripeNetwork(),
|
|
@@ -28589,13 +28575,13 @@ function PayWithStripeLink({
|
|
|
28589
28575
|
return coordinator.performCheckout(sid, async (onrampSessionId) => {
|
|
28590
28576
|
try {
|
|
28591
28577
|
await withTokenRefresh(
|
|
28592
|
-
(tok) => (0,
|
|
28578
|
+
(tok) => (0, import_core24.stripeRefreshQuote)(onrampSessionId, tok, publishableKey)
|
|
28593
28579
|
);
|
|
28594
28580
|
} catch {
|
|
28595
28581
|
}
|
|
28596
28582
|
try {
|
|
28597
28583
|
const confirmResponse = await withTokenRefresh(
|
|
28598
|
-
(tok) => (0,
|
|
28584
|
+
(tok) => (0, import_core24.stripeConfirmSession)(onrampSessionId, tok, {}, publishableKey)
|
|
28599
28585
|
);
|
|
28600
28586
|
lastConfirmError = null;
|
|
28601
28587
|
return confirmResponse.client_secret ?? "";
|
|
@@ -28607,13 +28593,13 @@ function PayWithStripeLink({
|
|
|
28607
28593
|
};
|
|
28608
28594
|
const lastErrorFor = async (sid) => {
|
|
28609
28595
|
const sessionState = await withTokenRefresh(
|
|
28610
|
-
(tok) => (0,
|
|
28596
|
+
(tok) => (0, import_core24.stripeGetSession)(sid, tok, publishableKey)
|
|
28611
28597
|
);
|
|
28612
28598
|
return sessionState.transaction_details?.last_error ?? null;
|
|
28613
28599
|
};
|
|
28614
28600
|
const createFreshSession = async () => {
|
|
28615
28601
|
const fresh = await withTokenRefresh(
|
|
28616
|
-
(tok) => (0,
|
|
28602
|
+
(tok) => (0, import_core24.stripeCreateSession)(
|
|
28617
28603
|
{
|
|
28618
28604
|
cryptoCustomerId: customerId,
|
|
28619
28605
|
paymentToken: selectedPaymentToken,
|
|
@@ -28685,7 +28671,7 @@ function PayWithStripeLink({
|
|
|
28685
28671
|
} else if (isConsumedPaymentMethodError(lastConfirmError)) {
|
|
28686
28672
|
dropConsumedToken(CONSUMED_TOKEN_MESSAGE, lastConfirmError);
|
|
28687
28673
|
} else {
|
|
28688
|
-
const confirmErr = lastConfirmError instanceof
|
|
28674
|
+
const confirmErr = lastConfirmError instanceof import_core24.StripeApiResponseError ? lastConfirmError : void 0;
|
|
28689
28675
|
const reason = describeStripePaymentFailure(lastError) ?? describeStripePaymentFailure(confirmErr?.stripeCode) ?? unmappedPaymentFailureMessage(confirmErr?.stripeMessage);
|
|
28690
28676
|
if (!isRetriablePaymentToken(selectedPaymentToken)) {
|
|
28691
28677
|
dropConsumedToken(reason, lastConfirmError ?? void 0);
|
|
@@ -28703,7 +28689,7 @@ function PayWithStripeLink({
|
|
|
28703
28689
|
}
|
|
28704
28690
|
} catch (err) {
|
|
28705
28691
|
if (isStale()) return;
|
|
28706
|
-
const stripeErr = lastConfirmError instanceof
|
|
28692
|
+
const stripeErr = lastConfirmError instanceof import_core24.StripeApiResponseError ? lastConfirmError : err instanceof import_core24.StripeApiResponseError ? err : void 0;
|
|
28707
28693
|
const effectiveError = stripeErr ?? err;
|
|
28708
28694
|
const msg = stripeErr?.message ?? (err instanceof Error ? err.message : t.formErrors.checkoutFailed);
|
|
28709
28695
|
const errorType = stripeErr?.errorType;
|
|
@@ -28751,7 +28737,7 @@ function PayWithStripeLink({
|
|
|
28751
28737
|
if (!customerId) return;
|
|
28752
28738
|
try {
|
|
28753
28739
|
const existing = await withTokenRefresh(
|
|
28754
|
-
(tok) => (0,
|
|
28740
|
+
(tok) => (0, import_core24.stripeListPaymentTokens)(customerId, tok, publishableKey)
|
|
28755
28741
|
);
|
|
28756
28742
|
setPaymentTokens(existing.data);
|
|
28757
28743
|
const stored = getStoredSelectedToken(customerId);
|
|
@@ -28788,7 +28774,7 @@ function PayWithStripeLink({
|
|
|
28788
28774
|
const fetchLimits = async () => {
|
|
28789
28775
|
try {
|
|
28790
28776
|
const result = await withTokenRefresh(
|
|
28791
|
-
(tok) => (0,
|
|
28777
|
+
(tok) => (0, import_core24.stripeGetTransactionLimits)(
|
|
28792
28778
|
{
|
|
28793
28779
|
cryptoCustomerId: customerId,
|
|
28794
28780
|
destinationNetwork: getStripeNetwork(),
|
|
@@ -28864,8 +28850,8 @@ function PayWithStripeLink({
|
|
|
28864
28850
|
const canRefreshExisting = step === "review" && existing != null && existing.amount === amount && existing.paymentToken === selectedPaymentToken && // Never refresh (and thereby reuse) a session already checked out —
|
|
28865
28851
|
// its PaymentIntent is spent. Build a fresh one instead.
|
|
28866
28852
|
!spentSessionIdsRef.current.has(existing.id);
|
|
28867
|
-
const session = canRefreshExisting ? await withTokenRefresh((tok) => (0,
|
|
28868
|
-
(tok) => (0,
|
|
28853
|
+
const session = canRefreshExisting ? await withTokenRefresh((tok) => (0, import_core24.stripeRefreshQuote)(existing.id, tok, publishableKey)) : await withTokenRefresh(
|
|
28854
|
+
(tok) => (0, import_core24.stripeCreateSession)(
|
|
28869
28855
|
{
|
|
28870
28856
|
cryptoCustomerId: customerId,
|
|
28871
28857
|
paymentToken: selectedPaymentToken,
|
|
@@ -28907,7 +28893,7 @@ function PayWithStripeLink({
|
|
|
28907
28893
|
}
|
|
28908
28894
|
} else {
|
|
28909
28895
|
setSessionForCheckout(null);
|
|
28910
|
-
const result = await (0,
|
|
28896
|
+
const result = await (0, import_core24.stripeGetQuotes)(
|
|
28911
28897
|
{
|
|
28912
28898
|
sourceAmount: amount,
|
|
28913
28899
|
sourceCurrency: "usd",
|
|
@@ -28935,7 +28921,7 @@ function PayWithStripeLink({
|
|
|
28935
28921
|
if (!active) return;
|
|
28936
28922
|
setQuote(null);
|
|
28937
28923
|
setSessionForCheckout(null);
|
|
28938
|
-
const qErrorType = err instanceof
|
|
28924
|
+
const qErrorType = err instanceof import_core24.StripeApiResponseError ? err.errorType : void 0;
|
|
28939
28925
|
if (qErrorType === "stripe_onramp_missing_document_verification") {
|
|
28940
28926
|
setLimitReachedAmount(num);
|
|
28941
28927
|
setRequiredStepUp("l2");
|
|
@@ -30724,17 +30710,17 @@ function useProjectConfig({
|
|
|
30724
30710
|
data: projectConfig,
|
|
30725
30711
|
isLoading,
|
|
30726
30712
|
error
|
|
30727
|
-
} = (0,
|
|
30713
|
+
} = (0, import_react_query10.useQuery)({
|
|
30728
30714
|
// Country is part of the key so a region change refetches the region-aware
|
|
30729
30715
|
// config. Omitted when undefined so callers that don't pass a country keep
|
|
30730
30716
|
// sharing the base cache entry.
|
|
30731
30717
|
queryKey: countryCode ? ["unifold", "projectConfig", publishableKey, countryCode, subdivisionCode ?? null] : ["unifold", "projectConfig", publishableKey],
|
|
30732
|
-
queryFn: () => (0,
|
|
30718
|
+
queryFn: () => (0, import_core26.getProjectConfig)(publishableKey, countryCode ? { countryCode, subdivisionCode } : void 0),
|
|
30733
30719
|
enabled,
|
|
30734
30720
|
// Keep the previous (e.g. no-country) config visible while the region-aware
|
|
30735
30721
|
// config refetches after the country resolves, so unrelated config-driven
|
|
30736
30722
|
// UI doesn't flash back to defaults.
|
|
30737
|
-
placeholderData:
|
|
30723
|
+
placeholderData: import_react_query10.keepPreviousData,
|
|
30738
30724
|
staleTime: 1e3 * 60 * 30,
|
|
30739
30725
|
refetchOnMount: true,
|
|
30740
30726
|
refetchOnWindowFocus: true
|
|
@@ -30746,7 +30732,7 @@ function useIntegrationTransferDefaultToken({
|
|
|
30746
30732
|
publishableKey,
|
|
30747
30733
|
enabled = true
|
|
30748
30734
|
}) {
|
|
30749
|
-
return (0,
|
|
30735
|
+
return (0, import_react_query11.useQuery)({
|
|
30750
30736
|
queryKey: [
|
|
30751
30737
|
"unifold",
|
|
30752
30738
|
"integrationTransferDefaultToken",
|
|
@@ -30759,7 +30745,7 @@ function useIntegrationTransferDefaultToken({
|
|
|
30759
30745
|
params?.country_code ?? null,
|
|
30760
30746
|
params?.subdivision_code ?? null
|
|
30761
30747
|
],
|
|
30762
|
-
queryFn: () => (0,
|
|
30748
|
+
queryFn: () => (0, import_core27.getIntegrationTransferDefaultToken)(params, publishableKey),
|
|
30763
30749
|
enabled: enabled && !!params,
|
|
30764
30750
|
staleTime: 1e3 * 60 * 5,
|
|
30765
30751
|
gcTime: 1e3 * 60 * 30,
|
|
@@ -30858,7 +30844,7 @@ function CoinbaseConnect({
|
|
|
30858
30844
|
const appName = projectConfig?.project_name ?? "Unifold";
|
|
30859
30845
|
const { t: strings } = useI18n();
|
|
30860
30846
|
const t = strings.connectExchange;
|
|
30861
|
-
const initialView = skipToHoldings && getStoredIntegrationToken(
|
|
30847
|
+
const initialView = skipToHoldings && getStoredIntegrationToken(import_core25.IntegrationProvider.COINBASE) ? "holdings" : "select_exchange";
|
|
30862
30848
|
const [view, setView] = (0, import_react29.useState)(initialView);
|
|
30863
30849
|
const [prevView, setPrevView] = (0, import_react29.useState)(initialView);
|
|
30864
30850
|
const [isTransitioning, setIsTransitioning] = (0, import_react29.useState)(false);
|
|
@@ -30894,7 +30880,7 @@ function CoinbaseConnect({
|
|
|
30894
30880
|
}, [selectedExchange]);
|
|
30895
30881
|
const defaultTokenParams = (0, import_react29.useMemo)(
|
|
30896
30882
|
() => selectedAsset ? {
|
|
30897
|
-
integration_provider:
|
|
30883
|
+
integration_provider: import_core25.IntegrationProvider.COINBASE,
|
|
30898
30884
|
source_currency: selectedAsset.currency.toLowerCase(),
|
|
30899
30885
|
destination_token_address: destinationTokenAddress,
|
|
30900
30886
|
destination_chain_id: destinationChainId,
|
|
@@ -31015,16 +31001,16 @@ function CoinbaseConnect({
|
|
|
31015
31001
|
const tryRefreshToken = (0, import_react29.useCallback)(
|
|
31016
31002
|
async (currentToken) => {
|
|
31017
31003
|
try {
|
|
31018
|
-
const result = await (0,
|
|
31004
|
+
const result = await (0, import_core25.refreshIntegrationToken)(currentToken, publishableKey);
|
|
31019
31005
|
setStoredIntegrationToken({
|
|
31020
|
-
integration_provider:
|
|
31006
|
+
integration_provider: import_core25.IntegrationProvider.COINBASE,
|
|
31021
31007
|
access_token: result.access_token,
|
|
31022
31008
|
expires_at: result.expires_at
|
|
31023
31009
|
});
|
|
31024
31010
|
setAccessToken(result.access_token);
|
|
31025
31011
|
return result.access_token;
|
|
31026
31012
|
} catch {
|
|
31027
|
-
clearStoredIntegrationToken(
|
|
31013
|
+
clearStoredIntegrationToken(import_core25.IntegrationProvider.COINBASE);
|
|
31028
31014
|
setAccessToken(null);
|
|
31029
31015
|
return null;
|
|
31030
31016
|
}
|
|
@@ -31032,7 +31018,7 @@ function CoinbaseConnect({
|
|
|
31032
31018
|
[publishableKey]
|
|
31033
31019
|
);
|
|
31034
31020
|
(0, import_react29.useEffect)(() => {
|
|
31035
|
-
const stored = getStoredIntegrationToken(
|
|
31021
|
+
const stored = getStoredIntegrationToken(import_core25.IntegrationProvider.COINBASE);
|
|
31036
31022
|
if (stored) {
|
|
31037
31023
|
setAccessToken(stored.access_token);
|
|
31038
31024
|
if (skipToHoldings) {
|
|
@@ -31044,7 +31030,7 @@ function CoinbaseConnect({
|
|
|
31044
31030
|
const userSubdivisionCode = userIpInfo?.subdivisionCode ?? void 0;
|
|
31045
31031
|
(0, import_react29.useEffect)(() => {
|
|
31046
31032
|
let cancelled = false;
|
|
31047
|
-
(0,
|
|
31033
|
+
(0, import_core25.getIntegrationExchanges)(
|
|
31048
31034
|
publishableKey,
|
|
31049
31035
|
userCountryCode ? {
|
|
31050
31036
|
country_code: userCountryCode,
|
|
@@ -31057,7 +31043,7 @@ function CoinbaseConnect({
|
|
|
31057
31043
|
if (prev) {
|
|
31058
31044
|
return res.data.find((e) => e.service_provider === prev.service_provider) ?? prev;
|
|
31059
31045
|
}
|
|
31060
|
-
return res.data.find((e) => e.service_provider ===
|
|
31046
|
+
return res.data.find((e) => e.service_provider === import_core25.IntegrationProvider.COINBASE) ?? null;
|
|
31061
31047
|
});
|
|
31062
31048
|
}).catch(() => {
|
|
31063
31049
|
}).finally(() => {
|
|
@@ -31071,8 +31057,8 @@ function CoinbaseConnect({
|
|
|
31071
31057
|
async (token) => {
|
|
31072
31058
|
setIsLoading(true);
|
|
31073
31059
|
try {
|
|
31074
|
-
const result = await (0,
|
|
31075
|
-
|
|
31060
|
+
const result = await (0, import_core25.getIntegrationHoldings)(
|
|
31061
|
+
import_core25.IntegrationProvider.COINBASE,
|
|
31076
31062
|
token,
|
|
31077
31063
|
publishableKey
|
|
31078
31064
|
);
|
|
@@ -31089,8 +31075,8 @@ function CoinbaseConnect({
|
|
|
31089
31075
|
const refreshed = await tryRefreshToken(token);
|
|
31090
31076
|
if (refreshed) {
|
|
31091
31077
|
try {
|
|
31092
|
-
const retryResult = await (0,
|
|
31093
|
-
|
|
31078
|
+
const retryResult = await (0, import_core25.getIntegrationHoldings)(
|
|
31079
|
+
import_core25.IntegrationProvider.COINBASE,
|
|
31094
31080
|
refreshed,
|
|
31095
31081
|
publishableKey
|
|
31096
31082
|
);
|
|
@@ -31107,12 +31093,12 @@ function CoinbaseConnect({
|
|
|
31107
31093
|
retryFailed = true;
|
|
31108
31094
|
}
|
|
31109
31095
|
}
|
|
31110
|
-
clearStoredIntegrationToken(
|
|
31096
|
+
clearStoredIntegrationToken(import_core25.IntegrationProvider.COINBASE);
|
|
31111
31097
|
setAccessToken(null);
|
|
31112
31098
|
track("account_connection_failed", {
|
|
31113
31099
|
flow_type: "deposit",
|
|
31114
31100
|
method: "exchange_connect",
|
|
31115
|
-
provider:
|
|
31101
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31116
31102
|
failure_reason: retryFailed ? "holdings_unavailable" : "token_refresh_failed"
|
|
31117
31103
|
});
|
|
31118
31104
|
transitionTo("select_exchange");
|
|
@@ -31188,7 +31174,7 @@ function CoinbaseConnect({
|
|
|
31188
31174
|
...userIpInfo?.subdivisionCode ? { subdivision_code: userIpInfo.subdivisionCode } : {}
|
|
31189
31175
|
};
|
|
31190
31176
|
setRedirectSession({ exchange, requestParams });
|
|
31191
|
-
window.open((0,
|
|
31177
|
+
window.open((0, import_core25.getIntegrationExchangeSessionStartUrl)(requestParams, publishableKey), "_blank");
|
|
31192
31178
|
transitionTo("redirect_pending");
|
|
31193
31179
|
};
|
|
31194
31180
|
const handleCreateRedirectTransferSession = async () => {
|
|
@@ -31199,7 +31185,7 @@ function CoinbaseConnect({
|
|
|
31199
31185
|
if (redirectMinDepositUsd > 0 && amountNum < redirectMinDepositUsd) return;
|
|
31200
31186
|
setIsLoading(true);
|
|
31201
31187
|
try {
|
|
31202
|
-
const result = await (0,
|
|
31188
|
+
const result = await (0, import_core25.createIntegrationExchangeSession)(
|
|
31203
31189
|
{
|
|
31204
31190
|
service_provider: exchange.service_provider,
|
|
31205
31191
|
wallet_addresses: [{ address: wallet.address, chain_type: wallet.chain_type }],
|
|
@@ -31233,7 +31219,7 @@ function CoinbaseConnect({
|
|
|
31233
31219
|
const handleReopenRedirectExchange = () => {
|
|
31234
31220
|
if (!redirectSession?.requestParams) return;
|
|
31235
31221
|
window.open(
|
|
31236
|
-
(0,
|
|
31222
|
+
(0, import_core25.getIntegrationExchangeSessionStartUrl)(redirectSession.requestParams, publishableKey),
|
|
31237
31223
|
"_blank"
|
|
31238
31224
|
);
|
|
31239
31225
|
};
|
|
@@ -31250,7 +31236,7 @@ function CoinbaseConnect({
|
|
|
31250
31236
|
const externalId = redirectSession.externalId;
|
|
31251
31237
|
const poll = async () => {
|
|
31252
31238
|
try {
|
|
31253
|
-
const result = await (0,
|
|
31239
|
+
const result = await (0, import_core25.getOnrampSessionStatus)(externalId, publishableKey);
|
|
31254
31240
|
setRedirectStatus(result.status);
|
|
31255
31241
|
if (result.status === "failed") {
|
|
31256
31242
|
setErrorMessage("Payment failed");
|
|
@@ -31280,8 +31266,8 @@ function CoinbaseConnect({
|
|
|
31280
31266
|
handleOpenRedirectExchange(exchange);
|
|
31281
31267
|
return;
|
|
31282
31268
|
}
|
|
31283
|
-
if (exchange.service_provider ===
|
|
31284
|
-
const stored = getStoredIntegrationToken(
|
|
31269
|
+
if (exchange.service_provider === import_core25.IntegrationProvider.COINBASE) {
|
|
31270
|
+
const stored = getStoredIntegrationToken(import_core25.IntegrationProvider.COINBASE);
|
|
31285
31271
|
if (stored) {
|
|
31286
31272
|
setAccessToken(stored.access_token);
|
|
31287
31273
|
connectingReasonRef.current = "holdings";
|
|
@@ -31299,20 +31285,20 @@ function CoinbaseConnect({
|
|
|
31299
31285
|
track("account_connection_started", {
|
|
31300
31286
|
flow_type: "deposit",
|
|
31301
31287
|
method: "exchange_connect",
|
|
31302
|
-
provider:
|
|
31288
|
+
provider: import_core25.IntegrationProvider.COINBASE
|
|
31303
31289
|
});
|
|
31304
31290
|
try {
|
|
31305
|
-
const { redirect_url, state } = await (0,
|
|
31291
|
+
const { redirect_url, state } = await (0, import_core25.startIntegrationOAuth)(publishableKey);
|
|
31306
31292
|
popupRef.current = window.open(redirect_url, "_blank", "width=500,height=700");
|
|
31307
31293
|
pollRef.current = setInterval(async () => {
|
|
31308
31294
|
try {
|
|
31309
|
-
const result = await (0,
|
|
31295
|
+
const result = await (0, import_core25.authenticateIntegrationOAuth)({ state }, publishableKey);
|
|
31310
31296
|
if (result.status === "completed") {
|
|
31311
31297
|
if (pollRef.current) clearInterval(pollRef.current);
|
|
31312
31298
|
pollRef.current = null;
|
|
31313
31299
|
if (oauthAbandonedRef.current || viewRef.current !== "connecting") return;
|
|
31314
31300
|
setStoredIntegrationToken({
|
|
31315
|
-
integration_provider:
|
|
31301
|
+
integration_provider: import_core25.IntegrationProvider.COINBASE,
|
|
31316
31302
|
access_token: result.access_token,
|
|
31317
31303
|
expires_at: result.expires_at
|
|
31318
31304
|
});
|
|
@@ -31320,7 +31306,7 @@ function CoinbaseConnect({
|
|
|
31320
31306
|
track("account_connected", {
|
|
31321
31307
|
flow_type: "deposit",
|
|
31322
31308
|
method: "exchange_connect",
|
|
31323
|
-
provider:
|
|
31309
|
+
provider: import_core25.IntegrationProvider.COINBASE
|
|
31324
31310
|
});
|
|
31325
31311
|
transitionTo("connected");
|
|
31326
31312
|
}
|
|
@@ -31332,7 +31318,7 @@ function CoinbaseConnect({
|
|
|
31332
31318
|
track("account_connection_failed", {
|
|
31333
31319
|
flow_type: "deposit",
|
|
31334
31320
|
method: "exchange_connect",
|
|
31335
|
-
provider:
|
|
31321
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31336
31322
|
failure_reason: "oauth_start_failed",
|
|
31337
31323
|
error_code: message
|
|
31338
31324
|
});
|
|
@@ -31378,9 +31364,9 @@ function CoinbaseConnect({
|
|
|
31378
31364
|
if (matchingWallet?.id) {
|
|
31379
31365
|
setTransferDepositWalletId(matchingWallet.id);
|
|
31380
31366
|
}
|
|
31381
|
-
const createTransfer = async (token) => (0,
|
|
31367
|
+
const createTransfer = async (token) => (0, import_core25.createIntegrationTransfer)(
|
|
31382
31368
|
{
|
|
31383
|
-
integration_provider:
|
|
31369
|
+
integration_provider: import_core25.IntegrationProvider.COINBASE,
|
|
31384
31370
|
access_token: token,
|
|
31385
31371
|
currency: selectedAsset.currency.toLowerCase(),
|
|
31386
31372
|
amount: cryptoAmount,
|
|
@@ -31405,7 +31391,7 @@ function CoinbaseConnect({
|
|
|
31405
31391
|
track("account_connection_failed", {
|
|
31406
31392
|
flow_type: "deposit",
|
|
31407
31393
|
method: "exchange_connect",
|
|
31408
|
-
provider:
|
|
31394
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31409
31395
|
failure_reason: "token_refresh_failed"
|
|
31410
31396
|
});
|
|
31411
31397
|
throw new Error("Session expired. Please reconnect your exchange.");
|
|
@@ -31423,12 +31409,12 @@ function CoinbaseConnect({
|
|
|
31423
31409
|
setIsLoading(false);
|
|
31424
31410
|
}
|
|
31425
31411
|
};
|
|
31426
|
-
const transferErrorType = (err) => err instanceof
|
|
31412
|
+
const transferErrorType = (err) => err instanceof import_core25.IntegrationTransferError ? err.errorType : void 0;
|
|
31427
31413
|
const trackTransferStarted = () => {
|
|
31428
31414
|
track("flow_started", {
|
|
31429
31415
|
flow_type: "deposit",
|
|
31430
31416
|
method: "exchange_connect",
|
|
31431
|
-
provider:
|
|
31417
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31432
31418
|
// No execution yet — one appears when the exchange's transfer lands on
|
|
31433
31419
|
// this wallet, carrying the same id.
|
|
31434
31420
|
deposit_wallet_id: transferDepositWalletId,
|
|
@@ -31444,7 +31430,7 @@ function CoinbaseConnect({
|
|
|
31444
31430
|
track("verification_started", {
|
|
31445
31431
|
flow_type: "deposit",
|
|
31446
31432
|
method: "exchange_connect",
|
|
31447
|
-
provider:
|
|
31433
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31448
31434
|
verification_type: "mfa",
|
|
31449
31435
|
verification_status: result.status
|
|
31450
31436
|
});
|
|
@@ -31473,7 +31459,7 @@ function CoinbaseConnect({
|
|
|
31473
31459
|
let sessionExpired = false;
|
|
31474
31460
|
try {
|
|
31475
31461
|
let token = accessToken;
|
|
31476
|
-
const result = await (0,
|
|
31462
|
+
const result = await (0, import_core25.confirmIntegrationTransfer)(
|
|
31477
31463
|
transferIntent.id,
|
|
31478
31464
|
token,
|
|
31479
31465
|
void 0,
|
|
@@ -31485,7 +31471,7 @@ function CoinbaseConnect({
|
|
|
31485
31471
|
const refreshed = await tryRefreshToken(token);
|
|
31486
31472
|
if (refreshed) {
|
|
31487
31473
|
token = refreshed;
|
|
31488
|
-
return (0,
|
|
31474
|
+
return (0, import_core25.confirmIntegrationTransfer)(
|
|
31489
31475
|
transferIntent.id,
|
|
31490
31476
|
refreshed,
|
|
31491
31477
|
void 0,
|
|
@@ -31496,7 +31482,7 @@ function CoinbaseConnect({
|
|
|
31496
31482
|
track("account_connection_failed", {
|
|
31497
31483
|
flow_type: "deposit",
|
|
31498
31484
|
method: "exchange_connect",
|
|
31499
|
-
provider:
|
|
31485
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31500
31486
|
failure_reason: "token_refresh_failed"
|
|
31501
31487
|
});
|
|
31502
31488
|
throw err;
|
|
@@ -31521,11 +31507,11 @@ function CoinbaseConnect({
|
|
|
31521
31507
|
track("verification_submitted", {
|
|
31522
31508
|
flow_type: "deposit",
|
|
31523
31509
|
method: "exchange_connect",
|
|
31524
|
-
provider:
|
|
31510
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31525
31511
|
verification_type: "mfa"
|
|
31526
31512
|
});
|
|
31527
31513
|
try {
|
|
31528
|
-
const result = await (0,
|
|
31514
|
+
const result = await (0, import_core25.confirmIntegrationTransfer)(
|
|
31529
31515
|
transferIntent.id,
|
|
31530
31516
|
accessToken,
|
|
31531
31517
|
mfaCode,
|
|
@@ -31535,7 +31521,7 @@ function CoinbaseConnect({
|
|
|
31535
31521
|
track("verification_failed", {
|
|
31536
31522
|
flow_type: "deposit",
|
|
31537
31523
|
method: "exchange_connect",
|
|
31538
|
-
provider:
|
|
31524
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31539
31525
|
verification_type: "mfa",
|
|
31540
31526
|
verification_status: result.status,
|
|
31541
31527
|
failure_reason: "invalid_code"
|
|
@@ -31546,7 +31532,7 @@ function CoinbaseConnect({
|
|
|
31546
31532
|
track("verification_completed", {
|
|
31547
31533
|
flow_type: "deposit",
|
|
31548
31534
|
method: "exchange_connect",
|
|
31549
|
-
provider:
|
|
31535
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31550
31536
|
verification_type: "mfa",
|
|
31551
31537
|
verification_status: result.status
|
|
31552
31538
|
});
|
|
@@ -31558,7 +31544,7 @@ function CoinbaseConnect({
|
|
|
31558
31544
|
track("verification_failed", {
|
|
31559
31545
|
flow_type: "deposit",
|
|
31560
31546
|
method: "exchange_connect",
|
|
31561
|
-
provider:
|
|
31547
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31562
31548
|
verification_type: "mfa",
|
|
31563
31549
|
verification_status: result.status,
|
|
31564
31550
|
failure_reason: result.message || "transfer_failed"
|
|
@@ -31575,7 +31561,7 @@ function CoinbaseConnect({
|
|
|
31575
31561
|
track("verification_failed", {
|
|
31576
31562
|
flow_type: "deposit",
|
|
31577
31563
|
method: "exchange_connect",
|
|
31578
|
-
provider:
|
|
31564
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31579
31565
|
verification_type: "mfa",
|
|
31580
31566
|
failure_reason: errorType || (err instanceof Error ? err.message : "mfa_request_failed")
|
|
31581
31567
|
});
|
|
@@ -31608,14 +31594,14 @@ function CoinbaseConnect({
|
|
|
31608
31594
|
track("account_connection_failed", {
|
|
31609
31595
|
flow_type: "deposit",
|
|
31610
31596
|
method: "exchange_connect",
|
|
31611
|
-
provider:
|
|
31597
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31612
31598
|
failure_reason: "abandoned"
|
|
31613
31599
|
});
|
|
31614
31600
|
} else if (view === "mfa") {
|
|
31615
31601
|
track("verification_failed", {
|
|
31616
31602
|
flow_type: "deposit",
|
|
31617
31603
|
method: "exchange_connect",
|
|
31618
|
-
provider:
|
|
31604
|
+
provider: import_core25.IntegrationProvider.COINBASE,
|
|
31619
31605
|
verification_type: "mfa",
|
|
31620
31606
|
failure_reason: "abandoned"
|
|
31621
31607
|
});
|
|
@@ -31776,7 +31762,7 @@ function CoinbaseConnect({
|
|
|
31776
31762
|
},
|
|
31777
31763
|
children: t.comingSoon
|
|
31778
31764
|
}
|
|
31779
|
-
) : accessToken && exchange.service_provider ===
|
|
31765
|
+
) : accessToken && exchange.service_provider === import_core25.IntegrationProvider.COINBASE ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
31780
31766
|
"span",
|
|
31781
31767
|
{
|
|
31782
31768
|
className: "uf-text-xs uf-px-2.5 uf-py-1 uf-rounded-full",
|
|
@@ -33549,9 +33535,9 @@ function useExchanges({
|
|
|
33549
33535
|
publishableKey,
|
|
33550
33536
|
enabled = true
|
|
33551
33537
|
}) {
|
|
33552
|
-
const { data: exchanges = [], isLoading } = (0,
|
|
33538
|
+
const { data: exchanges = [], isLoading } = (0, import_react_query12.useQuery)({
|
|
33553
33539
|
queryKey: ["unifold", "exchanges", publishableKey],
|
|
33554
|
-
queryFn: () => (0,
|
|
33540
|
+
queryFn: () => (0, import_core28.getExchanges)(void 0, publishableKey).then((res) => res.data),
|
|
33555
33541
|
enabled,
|
|
33556
33542
|
staleTime: 1e3 * 60 * 30,
|
|
33557
33543
|
refetchOnMount: false,
|
|
@@ -33567,9 +33553,9 @@ function usePublicIncident({
|
|
|
33567
33553
|
data: incident,
|
|
33568
33554
|
isLoading,
|
|
33569
33555
|
error
|
|
33570
|
-
} = (0,
|
|
33556
|
+
} = (0, import_react_query13.useQuery)({
|
|
33571
33557
|
queryKey: ["unifold", "publicIncident", publishableKey],
|
|
33572
|
-
queryFn: () => (0,
|
|
33558
|
+
queryFn: () => (0, import_core29.getPublicIncident)(publishableKey),
|
|
33573
33559
|
enabled,
|
|
33574
33560
|
staleTime: 1e3 * 30,
|
|
33575
33561
|
refetchInterval: 1e3 * 30,
|
|
@@ -33582,9 +33568,9 @@ function useWalletPayProviders({
|
|
|
33582
33568
|
publishableKey,
|
|
33583
33569
|
enabled = true
|
|
33584
33570
|
}) {
|
|
33585
|
-
const { data: providers, isLoading } = (0,
|
|
33571
|
+
const { data: providers, isLoading } = (0, import_react_query14.useQuery)({
|
|
33586
33572
|
queryKey: ["unifold", "walletPayProviders", method, publishableKey],
|
|
33587
|
-
queryFn: () => (0,
|
|
33573
|
+
queryFn: () => (0, import_core30.getWalletPayProviders)(method, publishableKey),
|
|
33588
33574
|
enabled,
|
|
33589
33575
|
staleTime: 1e3 * 60 * 30,
|
|
33590
33576
|
refetchOnMount: true,
|
|
@@ -33662,9 +33648,9 @@ function walletConnectionPayload(event) {
|
|
|
33662
33648
|
};
|
|
33663
33649
|
}
|
|
33664
33650
|
var ACCOUNT_CONNECTION_EVENTS = {
|
|
33665
|
-
account_connection_started:
|
|
33666
|
-
account_connected:
|
|
33667
|
-
account_connection_failed:
|
|
33651
|
+
account_connection_started: import_core33.DepositEventType.ACCOUNT_CONNECTION_STARTED,
|
|
33652
|
+
account_connected: import_core33.DepositEventType.ACCOUNT_CONNECTED,
|
|
33653
|
+
account_connection_failed: import_core33.DepositEventType.ACCOUNT_CONNECTION_FAILED
|
|
33668
33654
|
};
|
|
33669
33655
|
var str3 = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
|
|
33670
33656
|
function accountConnectionPayload(event) {
|
|
@@ -33683,9 +33669,9 @@ function accountConnectionPayload(event) {
|
|
|
33683
33669
|
};
|
|
33684
33670
|
}
|
|
33685
33671
|
var VERIFICATION_EVENTS = {
|
|
33686
|
-
verification_started:
|
|
33687
|
-
verification_completed:
|
|
33688
|
-
verification_failed:
|
|
33672
|
+
verification_started: import_core34.DepositEventType.VERIFICATION_STARTED,
|
|
33673
|
+
verification_completed: import_core34.DepositEventType.VERIFICATION_COMPLETED,
|
|
33674
|
+
verification_failed: import_core34.DepositEventType.VERIFICATION_FAILED
|
|
33689
33675
|
};
|
|
33690
33676
|
function verificationPayload(event) {
|
|
33691
33677
|
const type = VERIFICATION_EVENTS[event.event];
|
|
@@ -33697,9 +33683,9 @@ function verificationPayload(event) {
|
|
|
33697
33683
|
};
|
|
33698
33684
|
}
|
|
33699
33685
|
var WALLET_CONNECTION_TYPES = {
|
|
33700
|
-
started:
|
|
33701
|
-
connected:
|
|
33702
|
-
failed:
|
|
33686
|
+
started: import_core32.DepositEventType.WALLET_CONNECTION_STARTED,
|
|
33687
|
+
connected: import_core32.DepositEventType.WALLET_CONNECTED,
|
|
33688
|
+
failed: import_core32.DepositEventType.WALLET_CONNECTION_FAILED
|
|
33703
33689
|
};
|
|
33704
33690
|
function depositMethodFromAnalytics(method) {
|
|
33705
33691
|
if (typeof method !== "string") return void 0;
|
|
@@ -33723,7 +33709,7 @@ function useForwardDepositEvents(onEvent) {
|
|
|
33723
33709
|
if (event.event === "flow_started") {
|
|
33724
33710
|
onEventRef.current?.({
|
|
33725
33711
|
...base,
|
|
33726
|
-
type:
|
|
33712
|
+
type: import_core32.DepositEventType.FLOW_STARTED,
|
|
33727
33713
|
...withMethod,
|
|
33728
33714
|
data: {
|
|
33729
33715
|
object: {
|
|
@@ -33772,7 +33758,7 @@ function useForwardDepositEvents(onEvent) {
|
|
|
33772
33758
|
case "token":
|
|
33773
33759
|
onEventRef.current?.({
|
|
33774
33760
|
...base,
|
|
33775
|
-
type:
|
|
33761
|
+
type: import_core32.DepositEventType.TOKEN_SELECTED,
|
|
33776
33762
|
...withMethod,
|
|
33777
33763
|
data: { object: selection.data }
|
|
33778
33764
|
});
|
|
@@ -33780,7 +33766,7 @@ function useForwardDepositEvents(onEvent) {
|
|
|
33780
33766
|
case "wallet":
|
|
33781
33767
|
onEventRef.current?.({
|
|
33782
33768
|
...base,
|
|
33783
|
-
type:
|
|
33769
|
+
type: import_core32.DepositEventType.WALLET_SELECTED,
|
|
33784
33770
|
...withMethod,
|
|
33785
33771
|
data: { object: selection.data }
|
|
33786
33772
|
});
|
|
@@ -33788,7 +33774,7 @@ function useForwardDepositEvents(onEvent) {
|
|
|
33788
33774
|
case "provider":
|
|
33789
33775
|
onEventRef.current?.({
|
|
33790
33776
|
...base,
|
|
33791
|
-
type:
|
|
33777
|
+
type: import_core32.DepositEventType.PROVIDER_SELECTED,
|
|
33792
33778
|
...withMethod,
|
|
33793
33779
|
data: { object: selection.data }
|
|
33794
33780
|
});
|
|
@@ -33848,7 +33834,7 @@ function useAddressValidation({
|
|
|
33848
33834
|
refetchOnMount = false
|
|
33849
33835
|
}) {
|
|
33850
33836
|
const shouldValidate = enabled && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
33851
|
-
const { data, isLoading, error } = (0,
|
|
33837
|
+
const { data, isLoading, error } = (0, import_react_query15.useQuery)({
|
|
33852
33838
|
queryKey: [
|
|
33853
33839
|
"unifold",
|
|
33854
33840
|
"addressValidation",
|
|
@@ -33857,7 +33843,7 @@ function useAddressValidation({
|
|
|
33857
33843
|
destinationChainId,
|
|
33858
33844
|
destinationTokenAddress
|
|
33859
33845
|
],
|
|
33860
|
-
queryFn: () => (0,
|
|
33846
|
+
queryFn: () => (0, import_core35.verifyRecipientAddress)(
|
|
33861
33847
|
{
|
|
33862
33848
|
chain_type: destinationChainType,
|
|
33863
33849
|
chain_id: destinationChainId,
|
|
@@ -34141,7 +34127,7 @@ function DepositsModal({
|
|
|
34141
34127
|
if (!open || !userId) return;
|
|
34142
34128
|
const fetchExecutions = async () => {
|
|
34143
34129
|
try {
|
|
34144
|
-
const response = await (0,
|
|
34130
|
+
const response = await (0, import_core36.queryExecutions)(userId, publishableKey, import_core36.ActionType.Deposit);
|
|
34145
34131
|
const sorted = [...response.data].sort((a, b) => {
|
|
34146
34132
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
34147
34133
|
const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
@@ -35251,9 +35237,9 @@ function useHypercoreActivation(params) {
|
|
|
35251
35237
|
const recipient = recipientAddress?.trim() ?? "";
|
|
35252
35238
|
const source = sourceAddress?.trim() ?? "";
|
|
35253
35239
|
const hasAddresses = !!recipient && !!source;
|
|
35254
|
-
const { data, isLoading } = (0,
|
|
35240
|
+
const { data, isLoading } = (0, import_react_query16.useQuery)({
|
|
35255
35241
|
queryKey: ["unifold", "hypercoreActivation", source, recipient, publishableKey],
|
|
35256
|
-
queryFn: () => (0,
|
|
35242
|
+
queryFn: () => (0, import_core38.checkHypercoreActivation)(
|
|
35257
35243
|
{
|
|
35258
35244
|
source_address: source,
|
|
35259
35245
|
recipient_address: recipient
|
|
@@ -35399,7 +35385,7 @@ function TransferCryptoSingleInput({
|
|
|
35399
35385
|
(c) => c.chain_type === currentChainCombo.chainType && c.chain_id === currentChainCombo.chainId
|
|
35400
35386
|
) : void 0;
|
|
35401
35387
|
const currentChainType = currentChainData?.chain_type || "ethereum";
|
|
35402
|
-
const currentWallet = (0,
|
|
35388
|
+
const currentWallet = (0, import_core37.getWalletByChainType)(wallets, currentChainType);
|
|
35403
35389
|
const depositAddress = currentWallet?.address || "";
|
|
35404
35390
|
const {
|
|
35405
35391
|
executions: depositExecutions,
|
|
@@ -35641,7 +35627,7 @@ function TransferCryptoSingleInput({
|
|
|
35641
35627
|
className: "uf-text-sm uf-font-semibold",
|
|
35642
35628
|
style: { color: components.card.titleColor, fontFamily: fonts.semibold },
|
|
35643
35629
|
children: [
|
|
35644
|
-
checkoutQuote.isStablecoin ? (0,
|
|
35630
|
+
checkoutQuote.isStablecoin ? (0, import_core37.formatStablecoinAmount)(
|
|
35645
35631
|
checkoutQuote.sourceAmount,
|
|
35646
35632
|
checkoutQuote.sourceTokenDecimals
|
|
35647
35633
|
) : (Number(checkoutQuote.sourceAmount) / 10 ** checkoutQuote.sourceTokenDecimals).toFixed(Math.min(checkoutQuote.sourceTokenDecimals, 6)),
|
|
@@ -36231,7 +36217,7 @@ function TransferCryptoDoubleInput({
|
|
|
36231
36217
|
(c) => c.chain_type === currentChainCombo.chainType && c.chain_id === currentChainCombo.chainId
|
|
36232
36218
|
) : void 0;
|
|
36233
36219
|
const currentChainType = currentChainData?.chain_type || "ethereum";
|
|
36234
|
-
const currentWallet = (0,
|
|
36220
|
+
const currentWallet = (0, import_core39.getWalletByChainType)(wallets, currentChainType);
|
|
36235
36221
|
const depositAddress = currentWallet?.address || "";
|
|
36236
36222
|
const {
|
|
36237
36223
|
executions: depositExecutions,
|
|
@@ -36982,7 +36968,7 @@ async function sendHypercoreEvmTransfer(params) {
|
|
|
36982
36968
|
params: []
|
|
36983
36969
|
});
|
|
36984
36970
|
const activeChainId = String(parseInt(currentChainHex, 16));
|
|
36985
|
-
const buildResult = await (0,
|
|
36971
|
+
const buildResult = await (0, import_core41.buildHypercoreTransaction)(
|
|
36986
36972
|
{
|
|
36987
36973
|
signature_chain_id: activeChainId,
|
|
36988
36974
|
recipient_address: recipientAddress,
|
|
@@ -36995,7 +36981,7 @@ async function sendHypercoreEvmTransfer(params) {
|
|
|
36995
36981
|
method: "eth_signTypedData_v4",
|
|
36996
36982
|
params: [fromAddress, JSON.stringify(buildResult.typed_data)]
|
|
36997
36983
|
});
|
|
36998
|
-
await (0,
|
|
36984
|
+
await (0, import_core41.sendHypercoreTransaction)(
|
|
36999
36985
|
{
|
|
37000
36986
|
action_payload: buildResult.action_payload,
|
|
37001
36987
|
signature,
|
|
@@ -37030,7 +37016,7 @@ function useDepositQuote(params) {
|
|
|
37030
37016
|
...adjustForSlippage ? { adjust_for_slippage: true } : {},
|
|
37031
37017
|
...stablecoinParity ? { stablecoin_parity: true } : {}
|
|
37032
37018
|
};
|
|
37033
|
-
return (0,
|
|
37019
|
+
return (0, import_react_query17.useQuery)({
|
|
37034
37020
|
queryKey: [
|
|
37035
37021
|
"unifold",
|
|
37036
37022
|
"depositQuote",
|
|
@@ -37045,7 +37031,7 @@ function useDepositQuote(params) {
|
|
|
37045
37031
|
stablecoinParity,
|
|
37046
37032
|
publishableKey
|
|
37047
37033
|
],
|
|
37048
|
-
queryFn: () => (0,
|
|
37034
|
+
queryFn: () => (0, import_core42.getDepositQuote)(request, publishableKey),
|
|
37049
37035
|
enabled: enabled && !!publishableKey && !!sourceChainType && !!sourceChainId && !!sourceTokenAddress && !!destinationAmount && destinationAmount !== "0" && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress,
|
|
37050
37036
|
staleTime: 3e4,
|
|
37051
37037
|
gcTime: 5 * 6e4,
|
|
@@ -37060,9 +37046,9 @@ function useExternalWallets({
|
|
|
37060
37046
|
publishableKey,
|
|
37061
37047
|
enabled = true
|
|
37062
37048
|
}) {
|
|
37063
|
-
const { data: wallets = [], isLoading } = (0,
|
|
37049
|
+
const { data: wallets = [], isLoading } = (0, import_react_query18.useQuery)({
|
|
37064
37050
|
queryKey: ["unifold", "external-wallets", publishableKey],
|
|
37065
|
-
queryFn: () => (0,
|
|
37051
|
+
queryFn: () => (0, import_core43.getExternalWallets)(publishableKey).then((res) => res.data),
|
|
37066
37052
|
enabled: enabled && !!publishableKey,
|
|
37067
37053
|
staleTime: 1e3 * 60 * 30,
|
|
37068
37054
|
refetchOnMount: false,
|
|
@@ -38445,7 +38431,7 @@ function WalletConnect({
|
|
|
38445
38431
|
try {
|
|
38446
38432
|
const cleanedAmountUsd = amountUsd?.replace(/[^0-9.]/g, "") ?? "";
|
|
38447
38433
|
const forwardedAmountUsd = parseFloat(cleanedAmountUsd) > 0 ? cleanedAmountUsd : void 0;
|
|
38448
|
-
const res = await (0,
|
|
38434
|
+
const res = await (0, import_core40.getWalletMobileDeepLink)(
|
|
38449
38435
|
wallet.id,
|
|
38450
38436
|
depositAddresses,
|
|
38451
38437
|
publishableKey,
|
|
@@ -38777,7 +38763,7 @@ function WalletConnect({
|
|
|
38777
38763
|
destination_chain_type: activeDepositWallet.destination_chain_type,
|
|
38778
38764
|
...productType ? { product_type: productType } : {}
|
|
38779
38765
|
};
|
|
38780
|
-
const response = await (0,
|
|
38766
|
+
const response = await (0, import_core40.getSupportedDepositTokens)(publishableKey, options);
|
|
38781
38767
|
if (cancelled) return;
|
|
38782
38768
|
const supportedToken = response.data.find(
|
|
38783
38769
|
(t2) => t2.symbol.toLowerCase() === token.symbol.toLowerCase()
|
|
@@ -38805,7 +38791,7 @@ function WalletConnect({
|
|
|
38805
38791
|
setIsLoading(true);
|
|
38806
38792
|
setError(null);
|
|
38807
38793
|
const sct = activeDepositWallet.chain_type === "algorand" || activeDepositWallet.chain_type === "xrpl" || activeDepositWallet.chain_type === "cardano" || activeDepositWallet.chain_type === "n1" || activeDepositWallet.chain_type === "tron" ? "ethereum" : activeDepositWallet.chain_type;
|
|
38808
|
-
(0,
|
|
38794
|
+
(0, import_core40.getAddressBalances)(activeWalletInfo.address, sct, publishableKey).then((response) => {
|
|
38809
38795
|
if (cancelled) return;
|
|
38810
38796
|
const nonZero = response.balances.filter((b) => b.amount !== "0");
|
|
38811
38797
|
const defaultSource = {
|
|
@@ -39098,7 +39084,7 @@ function WalletConnect({
|
|
|
39098
39084
|
if (!provider.publicKey) await provider.connect();
|
|
39099
39085
|
const isNative = token.token_address === "native" || token.token_address === "So11111111111111111111111111111111111111112" || token.token_address === "";
|
|
39100
39086
|
const smallestUnit = isNative ? decimalToSmallestUnit(amountStr, 9) : decimalToSmallestUnit(amountStr, token.decimals);
|
|
39101
|
-
const buildResp = await (0,
|
|
39087
|
+
const buildResp = await (0, import_core40.buildSolanaTransaction)(
|
|
39102
39088
|
{
|
|
39103
39089
|
chain_id: "mainnet",
|
|
39104
39090
|
token_address: token.token_address === "" ? "native" : token.token_address,
|
|
@@ -39120,7 +39106,7 @@ function WalletConnect({
|
|
|
39120
39106
|
const ser = signed.serialize();
|
|
39121
39107
|
let bs = "";
|
|
39122
39108
|
for (let i = 0; i < ser.length; i++) bs += String.fromCharCode(ser[i]);
|
|
39123
|
-
const resp = await (0,
|
|
39109
|
+
const resp = await (0, import_core40.sendSolanaTransaction)(
|
|
39124
39110
|
{ chain_id: "mainnet", signed_transaction: btoa(bs) },
|
|
39125
39111
|
publishableKey
|
|
39126
39112
|
);
|
|
@@ -39166,7 +39152,7 @@ function WalletConnect({
|
|
|
39166
39152
|
} else if (isHypercoreToken) {
|
|
39167
39153
|
let sendAmount = tokenAmount;
|
|
39168
39154
|
try {
|
|
39169
|
-
const activation = await (0,
|
|
39155
|
+
const activation = await (0, import_core40.checkHypercoreActivation)(
|
|
39170
39156
|
{ source_address: walletInfo.address, recipient_address: recipientAddress },
|
|
39171
39157
|
publishableKey
|
|
39172
39158
|
);
|
|
@@ -39527,8 +39513,8 @@ function WalletConnect({
|
|
|
39527
39513
|
] }) });
|
|
39528
39514
|
}
|
|
39529
39515
|
if (view === "mobile_deposit_status" && latestDepositExecution) {
|
|
39530
|
-
const isComplete = latestDepositExecution.status ===
|
|
39531
|
-
const isFailed = latestDepositExecution.status ===
|
|
39516
|
+
const isComplete = latestDepositExecution.status === import_core40.ExecutionStatus.SUCCEEDED;
|
|
39517
|
+
const isFailed = latestDepositExecution.status === import_core40.ExecutionStatus.FAILED;
|
|
39532
39518
|
const title = isComplete ? t.paymentComplete : isFailed ? t.paymentFailed : t.paymentProcessing;
|
|
39533
39519
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
39534
39520
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
@@ -39803,8 +39789,8 @@ function DepositModal({
|
|
|
39803
39789
|
(method) => {
|
|
39804
39790
|
track("payment_method_selected", { method: analyticsMethod(method), flow_type: "deposit" });
|
|
39805
39791
|
emitEvent({
|
|
39806
|
-
id: (0,
|
|
39807
|
-
type:
|
|
39792
|
+
id: (0, import_core31.generatePrefixedKSUID)("sevt"),
|
|
39793
|
+
type: import_core31.DepositEventType.METHOD_SELECTED,
|
|
39808
39794
|
created: Math.floor(Date.now() / 1e3),
|
|
39809
39795
|
sessionId: getSessionId() ?? "",
|
|
39810
39796
|
method,
|
|
@@ -39860,8 +39846,8 @@ function DepositModal({
|
|
|
39860
39846
|
});
|
|
39861
39847
|
onDepositError?.({ ...error, method });
|
|
39862
39848
|
emitEvent({
|
|
39863
|
-
id: (0,
|
|
39864
|
-
type:
|
|
39849
|
+
id: (0, import_core31.generatePrefixedKSUID)("sevt"),
|
|
39850
|
+
type: import_core31.DepositEventType.FLOW_FAILED,
|
|
39865
39851
|
created: Math.floor(Date.now() / 1e3),
|
|
39866
39852
|
sessionId: getSessionId() ?? "",
|
|
39867
39853
|
method,
|
|
@@ -39967,7 +39953,7 @@ function DepositModal({
|
|
|
39967
39953
|
const [integrationExchanges, setIntegrationExchanges] = (0, import_react7.useState)([]);
|
|
39968
39954
|
(0, import_react7.useEffect)(() => {
|
|
39969
39955
|
if (!showConnectExchange || !open) return;
|
|
39970
|
-
(0,
|
|
39956
|
+
(0, import_core31.getIntegrationExchanges)(
|
|
39971
39957
|
publishableKey,
|
|
39972
39958
|
userIpInfo?.alpha2 ? {
|
|
39973
39959
|
country_code: userIpInfo.alpha2,
|
|
@@ -39978,13 +39964,13 @@ function DepositModal({
|
|
|
39978
39964
|
}, [showConnectExchange, open, publishableKey, userIpInfo?.alpha2, userIpInfo?.subdivisionCode]);
|
|
39979
39965
|
const [connectedExchange, setConnectedExchange] = (0, import_react7.useState)(() => {
|
|
39980
39966
|
if (!showConnectExchange) return null;
|
|
39981
|
-
const stored = getStoredIntegrationToken(
|
|
39967
|
+
const stored = getStoredIntegrationToken(import_core31.IntegrationProvider.COINBASE);
|
|
39982
39968
|
if (!stored) return null;
|
|
39983
39969
|
return { name: "Coinbase", iconUrl: void 0, balanceUsd: null, isLoading: true };
|
|
39984
39970
|
});
|
|
39985
39971
|
(0, import_react7.useEffect)(() => {
|
|
39986
39972
|
if (!showConnectExchange || !open || view !== "main") return;
|
|
39987
|
-
const stored = getStoredIntegrationToken(
|
|
39973
|
+
const stored = getStoredIntegrationToken(import_core31.IntegrationProvider.COINBASE);
|
|
39988
39974
|
if (!stored) {
|
|
39989
39975
|
setConnectedExchange(null);
|
|
39990
39976
|
return;
|
|
@@ -40004,24 +39990,24 @@ function DepositModal({
|
|
|
40004
39990
|
}) : null;
|
|
40005
39991
|
setConnectedExchange((prev) => prev ? { ...prev, balanceUsd, isLoading: false } : null);
|
|
40006
39992
|
};
|
|
40007
|
-
(0,
|
|
39993
|
+
(0, import_core31.getIntegrationHoldings)(import_core31.IntegrationProvider.COINBASE, stored.access_token, publishableKey).then(processHoldings).catch(async () => {
|
|
40008
39994
|
try {
|
|
40009
|
-
const refreshResult = await (0,
|
|
40010
|
-
if (!getStoredIntegrationToken(
|
|
39995
|
+
const refreshResult = await (0, import_core31.refreshIntegrationToken)(stored.access_token, publishableKey);
|
|
39996
|
+
if (!getStoredIntegrationToken(import_core31.IntegrationProvider.COINBASE)) return;
|
|
40011
39997
|
setStoredIntegrationToken({
|
|
40012
|
-
integration_provider:
|
|
39998
|
+
integration_provider: import_core31.IntegrationProvider.COINBASE,
|
|
40013
39999
|
access_token: refreshResult.access_token,
|
|
40014
40000
|
expires_at: refreshResult.expires_at
|
|
40015
40001
|
});
|
|
40016
|
-
const retryResult = await (0,
|
|
40017
|
-
|
|
40002
|
+
const retryResult = await (0, import_core31.getIntegrationHoldings)(
|
|
40003
|
+
import_core31.IntegrationProvider.COINBASE,
|
|
40018
40004
|
refreshResult.access_token,
|
|
40019
40005
|
publishableKey
|
|
40020
40006
|
);
|
|
40021
40007
|
processHoldings(retryResult);
|
|
40022
40008
|
} catch {
|
|
40023
|
-
if (!getStoredIntegrationToken(
|
|
40024
|
-
clearStoredIntegrationToken(
|
|
40009
|
+
if (!getStoredIntegrationToken(import_core31.IntegrationProvider.COINBASE)) return;
|
|
40010
|
+
clearStoredIntegrationToken(import_core31.IntegrationProvider.COINBASE);
|
|
40025
40011
|
setConnectedExchange(null);
|
|
40026
40012
|
}
|
|
40027
40013
|
});
|
|
@@ -40029,7 +40015,7 @@ function DepositModal({
|
|
|
40029
40015
|
(0, import_react7.useEffect)(() => {
|
|
40030
40016
|
if (!connectedExchange || integrationExchanges.length === 0) return;
|
|
40031
40017
|
const cbExchange = integrationExchanges.find(
|
|
40032
|
-
(e) => e.service_provider ===
|
|
40018
|
+
(e) => e.service_provider === import_core31.IntegrationProvider.COINBASE
|
|
40033
40019
|
);
|
|
40034
40020
|
const iconUrl = cbExchange?.icon_urls?.find((u) => u.format === "svg")?.url || cbExchange?.icon_urls?.find((u) => u.format === "png")?.url || cbExchange?.icon_url;
|
|
40035
40021
|
if (iconUrl && iconUrl !== connectedExchange.iconUrl) {
|
|
@@ -40148,7 +40134,7 @@ function DepositModal({
|
|
|
40148
40134
|
if (view !== "tracker" || !userId) return;
|
|
40149
40135
|
const fetchExecutions = async () => {
|
|
40150
40136
|
try {
|
|
40151
|
-
const response = await (0,
|
|
40137
|
+
const response = await (0, import_core31.queryExecutions)(userId, publishableKey, import_core31.ActionType.Deposit);
|
|
40152
40138
|
const sorted = [...response.data].sort((a, b) => {
|
|
40153
40139
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
40154
40140
|
const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
@@ -40204,7 +40190,7 @@ function DepositModal({
|
|
|
40204
40190
|
const template = errors[code] ?? addressValidationMessages.defaultError;
|
|
40205
40191
|
return interpolate(template, metadata);
|
|
40206
40192
|
};
|
|
40207
|
-
const walletsRecipientError = (0,
|
|
40193
|
+
const walletsRecipientError = (0, import_core31.isDepositAddressValidationError)(walletsError) ? walletsError.message : null;
|
|
40208
40194
|
const isRecipientAddressInvalid = isAddressValid === false || walletsRecipientError !== null;
|
|
40209
40195
|
const recipientInvalidMessage = getAddressValidationErrorMessage(
|
|
40210
40196
|
addressFailureMessage ?? walletsRecipientError,
|
|
@@ -40262,11 +40248,11 @@ function DepositModal({
|
|
|
40262
40248
|
if (view === "wallet_connect" && sessionOpenedFromMenu) setView("main");
|
|
40263
40249
|
};
|
|
40264
40250
|
const handleExchangeDisconnect = () => {
|
|
40265
|
-
const stored = getStoredIntegrationToken(
|
|
40251
|
+
const stored = getStoredIntegrationToken(import_core31.IntegrationProvider.COINBASE);
|
|
40266
40252
|
if (stored) {
|
|
40267
|
-
(0,
|
|
40253
|
+
(0, import_core31.revokeIntegrationToken)(stored.access_token, publishableKey);
|
|
40268
40254
|
}
|
|
40269
|
-
clearStoredIntegrationToken(
|
|
40255
|
+
clearStoredIntegrationToken(import_core31.IntegrationProvider.COINBASE);
|
|
40270
40256
|
setConnectedExchange(null);
|
|
40271
40257
|
if (view === "coinbase_connect" && sessionOpenedFromMenu) setView("main");
|
|
40272
40258
|
};
|
|
@@ -41311,9 +41297,9 @@ var BuyWithGooglePay = React41.forwardRef(
|
|
|
41311
41297
|
);
|
|
41312
41298
|
BuyWithGooglePay.displayName = "BuyWithGooglePay";
|
|
41313
41299
|
var WALLET_CONNECTION_TYPES2 = {
|
|
41314
|
-
started:
|
|
41315
|
-
connected:
|
|
41316
|
-
failed:
|
|
41300
|
+
started: import_core44.CheckoutEventType.WALLET_CONNECTION_STARTED,
|
|
41301
|
+
connected: import_core44.CheckoutEventType.WALLET_CONNECTED,
|
|
41302
|
+
failed: import_core44.CheckoutEventType.WALLET_CONNECTION_FAILED
|
|
41317
41303
|
};
|
|
41318
41304
|
function checkoutMethodFromAnalytics(method) {
|
|
41319
41305
|
if (method !== "transfer_crypto" && method !== "transfer" && method !== "wallet_connect") {
|
|
@@ -41339,7 +41325,7 @@ function useForwardCheckoutEvents(onEvent, journeySessionId) {
|
|
|
41339
41325
|
if (event.event === "flow_started") {
|
|
41340
41326
|
onEventRef.current?.({
|
|
41341
41327
|
...base,
|
|
41342
|
-
type:
|
|
41328
|
+
type: import_core44.CheckoutEventType.FLOW_STARTED,
|
|
41343
41329
|
...withMethod,
|
|
41344
41330
|
data: {
|
|
41345
41331
|
object: {
|
|
@@ -41367,7 +41353,7 @@ function useForwardCheckoutEvents(onEvent, journeySessionId) {
|
|
|
41367
41353
|
case "token":
|
|
41368
41354
|
onEventRef.current?.({
|
|
41369
41355
|
...base,
|
|
41370
|
-
type:
|
|
41356
|
+
type: import_core44.CheckoutEventType.TOKEN_SELECTED,
|
|
41371
41357
|
...withMethod,
|
|
41372
41358
|
data: { object: selection.data }
|
|
41373
41359
|
});
|
|
@@ -41375,7 +41361,7 @@ function useForwardCheckoutEvents(onEvent, journeySessionId) {
|
|
|
41375
41361
|
case "wallet":
|
|
41376
41362
|
onEventRef.current?.({
|
|
41377
41363
|
...base,
|
|
41378
|
-
type:
|
|
41364
|
+
type: import_core44.CheckoutEventType.WALLET_SELECTED,
|
|
41379
41365
|
...withMethod,
|
|
41380
41366
|
data: { object: selection.data }
|
|
41381
41367
|
});
|
|
@@ -41392,9 +41378,9 @@ function useForwardCheckoutEvents(onEvent, journeySessionId) {
|
|
|
41392
41378
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["succeeded", "expired", "refunded", "canceled"]);
|
|
41393
41379
|
function usePaymentIntent(params) {
|
|
41394
41380
|
const { clientSecret, publishableKey, enabled = true, pollingInterval = 3e3 } = params;
|
|
41395
|
-
return (0,
|
|
41381
|
+
return (0, import_react_query19.useQuery)({
|
|
41396
41382
|
queryKey: ["unifold", "paymentIntent", clientSecret, publishableKey],
|
|
41397
|
-
queryFn: () => (0,
|
|
41383
|
+
queryFn: () => (0, import_core45.retrievePaymentIntent)(clientSecret, publishableKey),
|
|
41398
41384
|
enabled: enabled && !!clientSecret && !!publishableKey,
|
|
41399
41385
|
staleTime: 0,
|
|
41400
41386
|
refetchInterval: (query) => {
|
|
@@ -41509,8 +41495,8 @@ function CheckoutModal({
|
|
|
41509
41495
|
flow_type: "checkout"
|
|
41510
41496
|
});
|
|
41511
41497
|
emitEvent({
|
|
41512
|
-
id: (0,
|
|
41513
|
-
type:
|
|
41498
|
+
id: (0, import_core46.generatePrefixedKSUID)("sevt"),
|
|
41499
|
+
type: import_core46.CheckoutEventType.METHOD_SELECTED,
|
|
41514
41500
|
created: Math.floor(Date.now() / 1e3),
|
|
41515
41501
|
sessionId: getSessionId() ?? "",
|
|
41516
41502
|
method,
|
|
@@ -41528,8 +41514,8 @@ function CheckoutModal({
|
|
|
41528
41514
|
});
|
|
41529
41515
|
onCheckoutError?.(error);
|
|
41530
41516
|
emitEvent({
|
|
41531
|
-
id: (0,
|
|
41532
|
-
type:
|
|
41517
|
+
id: (0, import_core46.generatePrefixedKSUID)("sevt"),
|
|
41518
|
+
type: import_core46.CheckoutEventType.FLOW_FAILED,
|
|
41533
41519
|
created: Math.floor(Date.now() / 1e3),
|
|
41534
41520
|
sessionId: journeySessionIdRef.current ?? getSessionId() ?? "",
|
|
41535
41521
|
method: error.method,
|
|
@@ -41568,8 +41554,8 @@ function CheckoutModal({
|
|
|
41568
41554
|
if (isSucceeded && richIntent) {
|
|
41569
41555
|
const createdSec = data.paymentIntent?.updated_at ? Math.floor(new Date(data.paymentIntent.updated_at).getTime() / 1e3) : Math.floor(Date.now() / 1e3);
|
|
41570
41556
|
emitEvent({
|
|
41571
|
-
id: (0,
|
|
41572
|
-
type:
|
|
41557
|
+
id: (0, import_core46.generatePrefixedKSUID)("sevt"),
|
|
41558
|
+
type: import_core46.CheckoutEventType.PAYMENT_INTENT_SUCCEEDED,
|
|
41573
41559
|
// A poll can land after the journey ends, when getSessionId() is
|
|
41574
41560
|
// either empty or already another flow's. The payment belongs to
|
|
41575
41561
|
// the journey that started it.
|
|
@@ -42222,9 +42208,9 @@ function CheckoutModal({
|
|
|
42222
42208
|
) }) });
|
|
42223
42209
|
}
|
|
42224
42210
|
function useSupportedDestinationTokens(publishableKey, enabled = true) {
|
|
42225
|
-
return (0,
|
|
42211
|
+
return (0, import_react_query20.useQuery)({
|
|
42226
42212
|
queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
|
|
42227
|
-
queryFn: () => (0,
|
|
42213
|
+
queryFn: () => (0, import_core47.getSupportedDestinationTokens)(publishableKey),
|
|
42228
42214
|
staleTime: 1e3 * 60 * 5,
|
|
42229
42215
|
gcTime: 1e3 * 60 * 30,
|
|
42230
42216
|
refetchOnMount: false,
|
|
@@ -42260,7 +42246,7 @@ function useSourceTokenValidation(params) {
|
|
|
42260
42246
|
enabled = true
|
|
42261
42247
|
} = params;
|
|
42262
42248
|
const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
|
|
42263
|
-
return (0,
|
|
42249
|
+
return (0, import_react_query21.useQuery)({
|
|
42264
42250
|
queryKey: [
|
|
42265
42251
|
"unifold",
|
|
42266
42252
|
"sourceTokenValidation",
|
|
@@ -42270,7 +42256,7 @@ function useSourceTokenValidation(params) {
|
|
|
42270
42256
|
publishableKey
|
|
42271
42257
|
],
|
|
42272
42258
|
queryFn: async () => {
|
|
42273
|
-
const res = await (0,
|
|
42259
|
+
const res = await (0, import_core48.getSupportedDepositTokens)(publishableKey);
|
|
42274
42260
|
let matchedMinUsd = null;
|
|
42275
42261
|
let matchedProcessingTime = null;
|
|
42276
42262
|
let matchedSlippage = null;
|
|
@@ -42311,7 +42297,7 @@ function useSourceTokenValidation(params) {
|
|
|
42311
42297
|
function useAddressBalance(params) {
|
|
42312
42298
|
const { address, chainType, chainId, tokenAddress, publishableKey, enabled = true } = params;
|
|
42313
42299
|
const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
|
|
42314
|
-
return (0,
|
|
42300
|
+
return (0, import_react_query22.useQuery)({
|
|
42315
42301
|
queryKey: [
|
|
42316
42302
|
"unifold",
|
|
42317
42303
|
"addressBalance",
|
|
@@ -42322,7 +42308,7 @@ function useAddressBalance(params) {
|
|
|
42322
42308
|
publishableKey
|
|
42323
42309
|
],
|
|
42324
42310
|
queryFn: async () => {
|
|
42325
|
-
const res = await (0,
|
|
42311
|
+
const res = await (0, import_core49.getAddressBalance)(
|
|
42326
42312
|
address,
|
|
42327
42313
|
chainType,
|
|
42328
42314
|
chainId,
|
|
@@ -42366,10 +42352,10 @@ function useAddressBalance(params) {
|
|
|
42366
42352
|
});
|
|
42367
42353
|
}
|
|
42368
42354
|
function useExecutions(userId, publishableKey, options) {
|
|
42369
|
-
const actionType = options?.actionType ??
|
|
42370
|
-
const query = (0,
|
|
42355
|
+
const actionType = options?.actionType ?? import_core50.ActionType.Deposit;
|
|
42356
|
+
const query = (0, import_react_query23.useQuery)({
|
|
42371
42357
|
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
42372
|
-
queryFn: () => (0,
|
|
42358
|
+
queryFn: () => (0, import_core50.queryExecutions)(userId, publishableKey, actionType),
|
|
42373
42359
|
enabled: (options?.enabled ?? true) && !!userId,
|
|
42374
42360
|
refetchInterval: options?.refetchInterval ?? 3e3,
|
|
42375
42361
|
staleTime: 0,
|
|
@@ -42401,15 +42387,15 @@ function useWithdrawPolling({
|
|
|
42401
42387
|
const journeySessionId = () => sessionIdRef.current || (getSessionId() ?? "");
|
|
42402
42388
|
const executionCreatedSec = (execution) => execution.updated_at ? Math.floor(new Date(execution.updated_at).getTime() / 1e3) : execution.created_at ? Math.floor(new Date(execution.created_at).getTime() / 1e3) : Math.floor(Date.now() / 1e3);
|
|
42403
42389
|
const createExecutionSuccessEvent = (execution) => ({
|
|
42404
|
-
id: (0,
|
|
42405
|
-
type:
|
|
42390
|
+
id: (0, import_core51.generatePrefixedKSUID)("sevt"),
|
|
42391
|
+
type: import_core51.WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED,
|
|
42406
42392
|
created: executionCreatedSec(execution),
|
|
42407
42393
|
sessionId: journeySessionId(),
|
|
42408
42394
|
data: { object: mapToDirectExecution(execution) }
|
|
42409
42395
|
});
|
|
42410
42396
|
const createExecutionFailedEvent = (execution) => ({
|
|
42411
|
-
id: (0,
|
|
42412
|
-
type:
|
|
42397
|
+
id: (0, import_core51.generatePrefixedKSUID)("sevt"),
|
|
42398
|
+
type: import_core51.WithdrawEventType.DIRECT_EXECUTION_FAILED,
|
|
42413
42399
|
created: executionCreatedSec(execution),
|
|
42414
42400
|
sessionId: journeySessionId(),
|
|
42415
42401
|
data: { object: mapToDirectExecution(execution) }
|
|
@@ -42461,7 +42447,7 @@ function useWithdrawPolling({
|
|
|
42461
42447
|
const enabledAt = enabledAtRef.current;
|
|
42462
42448
|
const poll = async () => {
|
|
42463
42449
|
try {
|
|
42464
|
-
const response = await (0,
|
|
42450
|
+
const response = await (0, import_core51.queryExecutions)(userId, publishableKey, import_core51.ActionType.Withdraw);
|
|
42465
42451
|
const cutoff = new Date(enabledAt.getTime() - CUTOFF_BUFFER_MS2);
|
|
42466
42452
|
const sorted = [...response.data].sort((a, b) => {
|
|
42467
42453
|
const tA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
@@ -42469,11 +42455,11 @@ function useWithdrawPolling({
|
|
|
42469
42455
|
return tB - tA;
|
|
42470
42456
|
});
|
|
42471
42457
|
const inProgress = [
|
|
42472
|
-
|
|
42473
|
-
|
|
42474
|
-
|
|
42458
|
+
import_core51.ExecutionStatus.PENDING,
|
|
42459
|
+
import_core51.ExecutionStatus.WAITING,
|
|
42460
|
+
import_core51.ExecutionStatus.DELAYED
|
|
42475
42461
|
];
|
|
42476
|
-
const terminal = [
|
|
42462
|
+
const terminal = [import_core51.ExecutionStatus.SUCCEEDED, import_core51.ExecutionStatus.FAILED];
|
|
42477
42463
|
let target = null;
|
|
42478
42464
|
for (const ex of sorted) {
|
|
42479
42465
|
const t = ex.created_at ? new Date(ex.created_at) : null;
|
|
@@ -42503,7 +42489,7 @@ function useWithdrawPolling({
|
|
|
42503
42489
|
}
|
|
42504
42490
|
return [...list, ex];
|
|
42505
42491
|
});
|
|
42506
|
-
if (ex.status ===
|
|
42492
|
+
if (ex.status === import_core51.ExecutionStatus.SUCCEEDED && (!prev || inProgress.includes(prev))) {
|
|
42507
42493
|
onSuccessRef.current?.({
|
|
42508
42494
|
message: "Withdrawal completed successfully",
|
|
42509
42495
|
executionId: ex.id,
|
|
@@ -42511,7 +42497,7 @@ function useWithdrawPolling({
|
|
|
42511
42497
|
transaction: ex,
|
|
42512
42498
|
execution: createExecutionSuccessEvent(ex)
|
|
42513
42499
|
});
|
|
42514
|
-
} else if (ex.status ===
|
|
42500
|
+
} else if (ex.status === import_core51.ExecutionStatus.FAILED && prev !== import_core51.ExecutionStatus.FAILED) {
|
|
42515
42501
|
onErrorRef.current?.({
|
|
42516
42502
|
message: "Withdrawal failed",
|
|
42517
42503
|
code: "WITHDRAW_FAILED",
|
|
@@ -42541,7 +42527,7 @@ function useWithdrawPolling({
|
|
|
42541
42527
|
if (!enabled || !depositWalletId) return;
|
|
42542
42528
|
const trigger = async () => {
|
|
42543
42529
|
try {
|
|
42544
|
-
await (0,
|
|
42530
|
+
await (0, import_core51.pollDirectExecutions)({ deposit_wallet_id: depositWalletId }, publishableKey);
|
|
42545
42531
|
} catch {
|
|
42546
42532
|
}
|
|
42547
42533
|
};
|
|
@@ -42714,7 +42700,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
42714
42700
|
} = params;
|
|
42715
42701
|
const trimmedAddress = recipientAddress?.trim() || "";
|
|
42716
42702
|
const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
|
|
42717
|
-
return (0,
|
|
42703
|
+
return (0, import_react_query24.useQuery)({
|
|
42718
42704
|
queryKey: [
|
|
42719
42705
|
"unifold",
|
|
42720
42706
|
"verifyRecipientAddress",
|
|
@@ -42724,7 +42710,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
42724
42710
|
trimmedAddress,
|
|
42725
42711
|
publishableKey
|
|
42726
42712
|
],
|
|
42727
|
-
queryFn: () => (0,
|
|
42713
|
+
queryFn: () => (0, import_core53.verifyRecipientAddress)(
|
|
42728
42714
|
{
|
|
42729
42715
|
chain_type: chainType,
|
|
42730
42716
|
chain_id: chainId,
|
|
@@ -42753,7 +42739,7 @@ function useGetDepositAddress(params) {
|
|
|
42753
42739
|
enabled = true
|
|
42754
42740
|
} = params;
|
|
42755
42741
|
const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
42756
|
-
const query = (0,
|
|
42742
|
+
const query = (0, import_react_query25.useQuery)({
|
|
42757
42743
|
queryKey: [
|
|
42758
42744
|
"unifold",
|
|
42759
42745
|
"getDepositAddress",
|
|
@@ -42765,7 +42751,7 @@ function useGetDepositAddress(params) {
|
|
|
42765
42751
|
actionType ?? null,
|
|
42766
42752
|
publishableKey
|
|
42767
42753
|
],
|
|
42768
|
-
queryFn: () => (0,
|
|
42754
|
+
queryFn: () => (0, import_core56.getDepositAddress)(
|
|
42769
42755
|
{
|
|
42770
42756
|
external_user_id: userId,
|
|
42771
42757
|
recipient_address: recipientAddress,
|
|
@@ -42819,7 +42805,7 @@ function useHypercoreWithdrawActivation(params) {
|
|
|
42819
42805
|
destinationChainType,
|
|
42820
42806
|
destinationChainId,
|
|
42821
42807
|
destinationTokenAddress,
|
|
42822
|
-
actionType:
|
|
42808
|
+
actionType: import_core55.ActionType.Withdraw,
|
|
42823
42809
|
enabled: enabled && isHypercore(sourceChainId)
|
|
42824
42810
|
});
|
|
42825
42811
|
const depositWalletAddress = (0, import_react43.useMemo)(() => {
|
|
@@ -43119,7 +43105,7 @@ function WithdrawForm({
|
|
|
43119
43105
|
let humanAmount = isMaxed ? balanceData.balanceHuman : toSafeDecimalString(cryptoAmountFromInput, sourceDecimals);
|
|
43120
43106
|
if (isHypercoreChain(sourceChainId)) {
|
|
43121
43107
|
try {
|
|
43122
|
-
const check = await (0,
|
|
43108
|
+
const check = await (0, import_core52.checkHypercoreActivation)(
|
|
43123
43109
|
{
|
|
43124
43110
|
source_address: senderAddress,
|
|
43125
43111
|
recipient_address: depositWallet.address
|
|
@@ -43575,7 +43561,7 @@ function WithdrawForm({
|
|
|
43575
43561
|
function WithdrawExecutionItem({ execution, onClick }) {
|
|
43576
43562
|
const { colors: colors2, fonts, components } = useTheme();
|
|
43577
43563
|
const { t: strings, locale } = useI18n();
|
|
43578
|
-
const isPending = execution.status ===
|
|
43564
|
+
const isPending = execution.status === import_core57.ExecutionStatus.PENDING || execution.status === import_core57.ExecutionStatus.WAITING || execution.status === import_core57.ExecutionStatus.DELAYED;
|
|
43579
43565
|
const formatDateTime = (timestamp) => {
|
|
43580
43566
|
try {
|
|
43581
43567
|
const date = new Date(timestamp);
|
|
@@ -43622,7 +43608,7 @@ function WithdrawExecutionItem({ execution, onClick }) {
|
|
|
43622
43608
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
43623
43609
|
"img",
|
|
43624
43610
|
{
|
|
43625
|
-
src: execution.destination_token_metadata?.icon_url || (0,
|
|
43611
|
+
src: execution.destination_token_metadata?.icon_url || (0, import_core57.getIconUrl)("/icons/tokens/svg/usdc.svg"),
|
|
43626
43612
|
alt: "Token",
|
|
43627
43613
|
width: 36,
|
|
43628
43614
|
height: 36,
|
|
@@ -43893,10 +43879,10 @@ function WithdrawModal({
|
|
|
43893
43879
|
const selection = selectionPayload(event);
|
|
43894
43880
|
if (selection?.kind !== "token") return;
|
|
43895
43881
|
onEventRef.current?.({
|
|
43896
|
-
id: (0,
|
|
43882
|
+
id: (0, import_core58.generatePrefixedKSUID)("sevt"),
|
|
43897
43883
|
created: Math.floor(Date.now() / 1e3),
|
|
43898
43884
|
sessionId: getSessionId() ?? "",
|
|
43899
|
-
type:
|
|
43885
|
+
type: import_core58.WithdrawEventType.TOKEN_SELECTED,
|
|
43900
43886
|
data: { object: selection.data }
|
|
43901
43887
|
});
|
|
43902
43888
|
}),
|
|
@@ -44020,21 +44006,21 @@ function WithdrawModal({
|
|
|
44020
44006
|
onWithdrawError: onWithdrawErrorFor
|
|
44021
44007
|
});
|
|
44022
44008
|
const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
|
|
44023
|
-
actionType:
|
|
44009
|
+
actionType: import_core58.ActionType.Withdraw,
|
|
44024
44010
|
enabled: open,
|
|
44025
44011
|
refetchInterval: view === "tracker" || view === "detail" ? 5e3 : 15e3
|
|
44026
44012
|
});
|
|
44027
44013
|
const allWithdrawals = allWithdrawalsData?.data ?? [];
|
|
44028
44014
|
const handleDepositWalletCreation = (0, import_react40.useCallback)(
|
|
44029
44015
|
async (params) => {
|
|
44030
|
-
const response = await (0,
|
|
44016
|
+
const response = await (0, import_core58.createDepositAddress)(
|
|
44031
44017
|
{
|
|
44032
44018
|
external_user_id: externalUserId,
|
|
44033
44019
|
destination_chain_type: params.destinationChainType,
|
|
44034
44020
|
destination_chain_id: params.destinationChainId,
|
|
44035
44021
|
destination_token_address: params.destinationTokenAddress,
|
|
44036
44022
|
recipient_address: params.recipientAddress,
|
|
44037
|
-
action_type:
|
|
44023
|
+
action_type: import_core58.ActionType.Withdraw,
|
|
44038
44024
|
source_chain_type: sourceChainType
|
|
44039
44025
|
},
|
|
44040
44026
|
publishableKey
|
|
@@ -44042,7 +44028,7 @@ function WithdrawModal({
|
|
|
44042
44028
|
if (response.user_id) {
|
|
44043
44029
|
setUserId(response.user_id);
|
|
44044
44030
|
}
|
|
44045
|
-
const depositWallet = (0,
|
|
44031
|
+
const depositWallet = (0, import_core58.getWalletByChainType)(response.data, sourceChainType);
|
|
44046
44032
|
if (!depositWallet) {
|
|
44047
44033
|
throw new Error(`No deposit wallet available for ${sourceChainType}`);
|
|
44048
44034
|
}
|
|
@@ -44074,8 +44060,8 @@ function WithdrawModal({
|
|
|
44074
44060
|
deposit_wallet_id: withdrawDepositWalletIdRef.current
|
|
44075
44061
|
});
|
|
44076
44062
|
emitEvent({
|
|
44077
|
-
id: (0,
|
|
44078
|
-
type:
|
|
44063
|
+
id: (0, import_core58.generatePrefixedKSUID)("sevt"),
|
|
44064
|
+
type: import_core58.WithdrawEventType.FLOW_STARTED,
|
|
44079
44065
|
created: Math.floor(Date.now() / 1e3),
|
|
44080
44066
|
sessionId: getSessionId() ?? "",
|
|
44081
44067
|
data: {
|
|
@@ -44377,7 +44363,7 @@ function WithdrawModal({
|
|
|
44377
44363
|
}
|
|
44378
44364
|
|
|
44379
44365
|
// src/provider.tsx
|
|
44380
|
-
var
|
|
44366
|
+
var import_core59 = require("@unifold/core");
|
|
44381
44367
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
44382
44368
|
function UnifoldProvider({
|
|
44383
44369
|
children,
|
|
@@ -44396,7 +44382,7 @@ function UnifoldProvider({
|
|
|
44396
44382
|
const tracker = (0, import_react46.useMemo)(
|
|
44397
44383
|
() => createEventTracker({
|
|
44398
44384
|
publishableKey,
|
|
44399
|
-
endpoint: `${(0,
|
|
44385
|
+
endpoint: `${(0, import_core59.getApiBaseUrl)()}/v1/public/events`
|
|
44400
44386
|
}),
|
|
44401
44387
|
[publishableKey]
|
|
44402
44388
|
);
|
|
@@ -44407,7 +44393,7 @@ function UnifoldProvider({
|
|
|
44407
44393
|
}, [tracker]);
|
|
44408
44394
|
(0, import_react46.useEffect)(() => {
|
|
44409
44395
|
if (publishableKey) {
|
|
44410
|
-
(0,
|
|
44396
|
+
(0, import_core59.setApiConfig)({ publishableKey });
|
|
44411
44397
|
}
|
|
44412
44398
|
}, [publishableKey]);
|
|
44413
44399
|
import_react46.default.useEffect(() => {
|
|
@@ -44836,7 +44822,7 @@ function useAllowedCountry2() {
|
|
|
44836
44822
|
}
|
|
44837
44823
|
|
|
44838
44824
|
// src/index.ts
|
|
44839
|
-
var
|
|
44825
|
+
var import_core60 = require("@unifold/core");
|
|
44840
44826
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44841
44827
|
0 && (module.exports = {
|
|
44842
44828
|
ActionType,
|