@unifold/ui-web 0.1.65 → 0.1.67
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +151 -41
- package/dist/index.mjs +151 -41
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnifoldConnectProviderConfig, DepositConfig, DepositResult, WithdrawConfig, WithdrawResult } from '@unifold/connect-react';
|
|
2
|
-
export { DepositConfig, DepositError, DepositInitialScreen, DepositResult, UnifoldConnectProviderConfig, WithdrawConfig, WithdrawError, WithdrawResult, WithdrawTransactionInfo } from '@unifold/connect-react';
|
|
2
|
+
export { DepositConfig, DepositError, DepositInitialScreen, DepositMethod, DepositResult, UnifoldConnectProviderConfig, WithdrawConfig, WithdrawError, WithdrawResult, WithdrawTransactionInfo } from '@unifold/connect-react';
|
|
3
3
|
|
|
4
4
|
type UnifoldConfig = UnifoldConnectProviderConfig["config"];
|
|
5
5
|
interface UnifoldHandle {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnifoldConnectProviderConfig, DepositConfig, DepositResult, WithdrawConfig, WithdrawResult } from '@unifold/connect-react';
|
|
2
|
-
export { DepositConfig, DepositError, DepositInitialScreen, DepositResult, UnifoldConnectProviderConfig, WithdrawConfig, WithdrawError, WithdrawResult, WithdrawTransactionInfo } from '@unifold/connect-react';
|
|
2
|
+
export { DepositConfig, DepositError, DepositInitialScreen, DepositMethod, DepositResult, UnifoldConnectProviderConfig, WithdrawConfig, WithdrawError, WithdrawResult, WithdrawTransactionInfo } from '@unifold/connect-react';
|
|
3
3
|
|
|
4
4
|
type UnifoldConfig = UnifoldConnectProviderConfig["config"];
|
|
5
5
|
interface UnifoldHandle {
|
package/dist/index.js
CHANGED
|
@@ -38524,6 +38524,15 @@ var ArrowUpDown = createLucideIcon("ArrowUpDown", [
|
|
|
38524
38524
|
["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
|
|
38525
38525
|
["path", { d: "M7 4v16", key: "1glfcx" }]
|
|
38526
38526
|
]);
|
|
38527
|
+
var Bitcoin = createLucideIcon("Bitcoin", [
|
|
38528
|
+
[
|
|
38529
|
+
"path",
|
|
38530
|
+
{
|
|
38531
|
+
d: "M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",
|
|
38532
|
+
key: "yr8idg"
|
|
38533
|
+
}
|
|
38534
|
+
]
|
|
38535
|
+
]);
|
|
38527
38536
|
var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
38528
38537
|
var ChevronDown = createLucideIcon("ChevronDown", [
|
|
38529
38538
|
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
@@ -44099,8 +44108,13 @@ async function sendHypercoreTransaction(request, publishableKey) {
|
|
|
44099
44108
|
}
|
|
44100
44109
|
var DepositEventType = /* @__PURE__ */ ((DepositEventType2) => {
|
|
44101
44110
|
DepositEventType2["ONRAMP_SESSION_CREATED"] = "onramp_session.created";
|
|
44111
|
+
DepositEventType2["DIRECT_EXECUTION_SUCCEEDED"] = "direct_execution.succeeded";
|
|
44102
44112
|
return DepositEventType2;
|
|
44103
44113
|
})(DepositEventType || {});
|
|
44114
|
+
var WithdrawEventType = /* @__PURE__ */ ((WithdrawEventType2) => {
|
|
44115
|
+
WithdrawEventType2["DIRECT_EXECUTION_SUCCEEDED"] = "direct_execution.succeeded";
|
|
44116
|
+
return WithdrawEventType2;
|
|
44117
|
+
})(WithdrawEventType || {});
|
|
44104
44118
|
var import_qr_code_styling = __toESM2(require_qr_code_styling(), 1);
|
|
44105
44119
|
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
44106
44120
|
var use = React25[" use ".trim().toString()];
|
|
@@ -51732,6 +51746,31 @@ function useDepositPolling({
|
|
|
51732
51746
|
onDepositSuccess,
|
|
51733
51747
|
onDepositError
|
|
51734
51748
|
}) {
|
|
51749
|
+
const createExecutionSuccessEvent = (execution) => ({
|
|
51750
|
+
id: generatePrefixedKSUID("sevt"),
|
|
51751
|
+
type: DepositEventType.DIRECT_EXECUTION_SUCCEEDED,
|
|
51752
|
+
created: 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),
|
|
51753
|
+
data: { object: mapToDirectExecution(execution) }
|
|
51754
|
+
});
|
|
51755
|
+
const mapToDirectExecution = (execution) => ({
|
|
51756
|
+
id: execution.id,
|
|
51757
|
+
transactionHash: execution.transaction_hash,
|
|
51758
|
+
recipientAddress: execution.recipient_address,
|
|
51759
|
+
depositAddress: execution.deposit_wallet?.address,
|
|
51760
|
+
sourceChainType: execution.source_chain_type,
|
|
51761
|
+
sourceChainId: execution.source_chain_id,
|
|
51762
|
+
sourceTokenAddress: execution.source_token_address,
|
|
51763
|
+
destinationChainType: execution.destination_chain_type,
|
|
51764
|
+
destinationChainId: execution.destination_chain_id,
|
|
51765
|
+
destinationTokenAddress: execution.destination_token_address,
|
|
51766
|
+
sourceAmountBaseUnit: execution.source_amount_base_unit,
|
|
51767
|
+
sourceAmountUsd: execution.source_amount_usd,
|
|
51768
|
+
destinationAmountBaseUnit: execution.destination_amount_base_unit,
|
|
51769
|
+
destinationAmountUsd: execution.destination_amount_usd,
|
|
51770
|
+
destinationTransactionHashes: execution.destination_transaction_hashes,
|
|
51771
|
+
status: execution.status,
|
|
51772
|
+
failureReason: execution.failure_reason
|
|
51773
|
+
});
|
|
51735
51774
|
const [executions, setExecutions] = (0, import_react10.useState)([]);
|
|
51736
51775
|
const [isPolling, setIsPolling] = (0, import_react10.useState)(false);
|
|
51737
51776
|
const [pollingEnabled, setPollingEnabled] = (0, import_react10.useState)(false);
|
|
@@ -51845,7 +51884,9 @@ function useDepositPolling({
|
|
|
51845
51884
|
onDepositSuccessRef.current?.({
|
|
51846
51885
|
message: "Deposit completed successfully",
|
|
51847
51886
|
executionId: execution.id,
|
|
51848
|
-
|
|
51887
|
+
// Backward compatibility: keep transaction in API response shape.
|
|
51888
|
+
transaction: execution,
|
|
51889
|
+
execution: createExecutionSuccessEvent(execution)
|
|
51849
51890
|
});
|
|
51850
51891
|
} else if (execution.status === ExecutionStatus.FAILED && previousStatus !== ExecutionStatus.FAILED) {
|
|
51851
51892
|
onDepositErrorRef.current?.({
|
|
@@ -58026,6 +58067,8 @@ function CoinbaseConnect({
|
|
|
58026
58067
|
destinationChainId,
|
|
58027
58068
|
destinationChainType,
|
|
58028
58069
|
onTransferSuccess,
|
|
58070
|
+
onDepositSuccess,
|
|
58071
|
+
onDepositError,
|
|
58029
58072
|
onTransferError,
|
|
58030
58073
|
onClose,
|
|
58031
58074
|
onBack: parentOnBack,
|
|
@@ -58173,10 +58216,14 @@ function CoinbaseConnect({
|
|
|
58173
58216
|
depositWalletId: transferDepositWalletId,
|
|
58174
58217
|
enabled: view === "success" && !!transferDepositWalletId,
|
|
58175
58218
|
immediateDirectPolling: true,
|
|
58176
|
-
onDepositSuccess: onTransferSuccess ? () => {
|
|
58177
|
-
|
|
58219
|
+
onDepositSuccess: onDepositSuccess || onTransferSuccess ? (data) => {
|
|
58220
|
+
onDepositSuccess?.(data);
|
|
58221
|
+
if (onTransferSuccess && confirmResult) onTransferSuccess(confirmResult);
|
|
58178
58222
|
} : void 0,
|
|
58179
|
-
onDepositError: onTransferError
|
|
58223
|
+
onDepositError: onDepositError || onTransferError ? (error) => {
|
|
58224
|
+
onDepositError?.(error);
|
|
58225
|
+
onTransferError?.({ message: error.message });
|
|
58226
|
+
} : void 0
|
|
58180
58227
|
});
|
|
58181
58228
|
(0, import_react18.useEffect)(() => {
|
|
58182
58229
|
onExecutionsChange?.(depositExecutions);
|
|
@@ -64363,7 +64410,10 @@ function WalletConnect({
|
|
|
64363
64410
|
children: [
|
|
64364
64411
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
|
|
64365
64412
|
WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(WalletIconWithNetwork, { WalletIcon: WALLET_ICONS3[wallet.id], networks: wallet.networks, size: 40, className: "uf-rounded-lg" }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
|
|
64366
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.
|
|
64413
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
64414
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-text-sm uf-font-medium", style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: wallet.name }),
|
|
64415
|
+
wallet.id === recentWalletId && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "uf-text-xs uf-px-2 uf-py-0.5 uf-rounded-full", style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium }, children: "Last used" })
|
|
64416
|
+
] })
|
|
64367
64417
|
] }),
|
|
64368
64418
|
isPending ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin", style: { color: colors2.primary } }) : wallet.isInstalled ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "uf-text-xs uf-px-2 uf-py-1 uf-rounded-full", style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium }, children: "Detected" }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
|
|
64369
64419
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: showOpenInApp ? "Open" : "Install" }),
|
|
@@ -64624,6 +64674,23 @@ function DepositModal({
|
|
|
64624
64674
|
depositTrackerSubTitle = t7.depositTracker.subtitle
|
|
64625
64675
|
}) {
|
|
64626
64676
|
const { colors: colors2, fonts, components } = useTheme();
|
|
64677
|
+
const onDepositSuccessFor = (0, import_react3.useCallback)(
|
|
64678
|
+
(method) => onDepositSuccess || onEvent ? (data) => {
|
|
64679
|
+
const payload = { ...data, method };
|
|
64680
|
+
onDepositSuccess?.(payload);
|
|
64681
|
+
if (payload.execution) {
|
|
64682
|
+
onEvent?.({
|
|
64683
|
+
...payload.execution,
|
|
64684
|
+
method
|
|
64685
|
+
});
|
|
64686
|
+
}
|
|
64687
|
+
} : void 0,
|
|
64688
|
+
[onDepositSuccess, onEvent]
|
|
64689
|
+
);
|
|
64690
|
+
const onDepositErrorFor = (0, import_react3.useCallback)(
|
|
64691
|
+
(method) => onDepositError ? (error) => onDepositError({ ...error, method }) : void 0,
|
|
64692
|
+
[onDepositError]
|
|
64693
|
+
);
|
|
64627
64694
|
const effectiveInitialScreen = (0, import_react3.useMemo)(() => {
|
|
64628
64695
|
const s = initialScreen ?? "main";
|
|
64629
64696
|
if (s === "tracker" && hideDepositTracker === true) return "main";
|
|
@@ -65164,8 +65231,8 @@ function DepositModal({
|
|
|
65164
65231
|
cashAppMenuButton
|
|
65165
65232
|
].filter(Boolean);
|
|
65166
65233
|
const depositTabs = [
|
|
65167
|
-
{ id: "crypto", label: "Use Crypto", buttons: cryptoMenuButtons },
|
|
65168
|
-
{ id: "cash", label: "Use Cash", buttons: cashMenuButtons }
|
|
65234
|
+
{ id: "crypto", label: "Use Crypto", icon: Bitcoin, buttons: cryptoMenuButtons },
|
|
65235
|
+
{ id: "cash", label: "Use Cash", icon: DollarSign, buttons: cashMenuButtons }
|
|
65169
65236
|
].filter((tab) => tab.buttons.length > 0);
|
|
65170
65237
|
const activeDepositTab = depositTabs.find((tab) => tab.id === depositTab) ?? depositTabs[0];
|
|
65171
65238
|
const renderMainMenuBody = () => {
|
|
@@ -65188,18 +65255,16 @@ function DepositModal({
|
|
|
65188
65255
|
role: "tablist",
|
|
65189
65256
|
children: depositTabs.map((tab) => {
|
|
65190
65257
|
const active = activeDepositTab.id === tab.id;
|
|
65191
|
-
|
|
65258
|
+
const TabIcon = tab.icon;
|
|
65259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
65192
65260
|
"button",
|
|
65193
65261
|
{
|
|
65194
65262
|
type: "button",
|
|
65195
65263
|
role: "tab",
|
|
65196
65264
|
"aria-selected": active,
|
|
65197
65265
|
onClick: () => setDepositTab(tab.id),
|
|
65198
|
-
className: "uf-flex-1 uf-py-2 uf-px-3 uf-rounded-lg uf-text-sm uf-transition-all",
|
|
65266
|
+
className: "uf-flex-1 uf-py-2 uf-px-3 uf-rounded-lg uf-text-sm uf-transition-all uf-flex uf-items-center uf-justify-center uf-gap-1.5",
|
|
65199
65267
|
style: {
|
|
65200
|
-
// Active tab is a soft, blurred glass pill — a faint accent
|
|
65201
|
-
// tint with its own backdrop blur and a subtle border/shadow,
|
|
65202
|
-
// so it looks frosted instead of like a hard solid button.
|
|
65203
65268
|
backgroundColor: active ? `color-mix(in srgb, ${colors2.primary} 22%, transparent)` : "transparent",
|
|
65204
65269
|
backdropFilter: active ? "blur(8px)" : void 0,
|
|
65205
65270
|
WebkitBackdropFilter: active ? "blur(8px)" : void 0,
|
|
@@ -65207,7 +65272,19 @@ function DepositModal({
|
|
|
65207
65272
|
color: active ? colors2.foreground : colors2.foregroundMuted,
|
|
65208
65273
|
fontFamily: fonts.medium
|
|
65209
65274
|
},
|
|
65210
|
-
children:
|
|
65275
|
+
children: [
|
|
65276
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
65277
|
+
"span",
|
|
65278
|
+
{
|
|
65279
|
+
className: "uf-inline-flex uf-items-center uf-justify-center uf-rounded-full uf-w-5 uf-h-5 uf-flex-shrink-0",
|
|
65280
|
+
style: {
|
|
65281
|
+
backgroundColor: active ? colors2.foreground : colors2.foregroundMuted
|
|
65282
|
+
},
|
|
65283
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TabIcon, { size: 12, style: { color: active ? colors2.background : colors2.background }, strokeWidth: 2.5 })
|
|
65284
|
+
}
|
|
65285
|
+
),
|
|
65286
|
+
tab.label
|
|
65287
|
+
]
|
|
65211
65288
|
},
|
|
65212
65289
|
tab.id
|
|
65213
65290
|
);
|
|
@@ -65298,8 +65375,8 @@ function DepositModal({
|
|
|
65298
65375
|
defaultSourceSymbol,
|
|
65299
65376
|
depositConfirmationMode,
|
|
65300
65377
|
onExecutionsChange: setDepositExecutions,
|
|
65301
|
-
onDepositSuccess,
|
|
65302
|
-
onDepositError,
|
|
65378
|
+
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
65379
|
+
onDepositError: onDepositErrorFor("transfer"),
|
|
65303
65380
|
wallets
|
|
65304
65381
|
}
|
|
65305
65382
|
) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
@@ -65317,8 +65394,8 @@ function DepositModal({
|
|
|
65317
65394
|
defaultSourceSymbol,
|
|
65318
65395
|
depositConfirmationMode,
|
|
65319
65396
|
onExecutionsChange: setDepositExecutions,
|
|
65320
|
-
onDepositSuccess,
|
|
65321
|
-
onDepositError,
|
|
65397
|
+
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
65398
|
+
onDepositError: onDepositErrorFor("transfer"),
|
|
65322
65399
|
wallets
|
|
65323
65400
|
}
|
|
65324
65401
|
),
|
|
@@ -65383,8 +65460,8 @@ function DepositModal({
|
|
|
65383
65460
|
destinationChainType,
|
|
65384
65461
|
destinationChainId,
|
|
65385
65462
|
destinationTokenAddress,
|
|
65386
|
-
onDepositSuccess,
|
|
65387
|
-
onDepositError,
|
|
65463
|
+
onDepositSuccess: onDepositSuccessFor("card"),
|
|
65464
|
+
onDepositError: onDepositErrorFor("card"),
|
|
65388
65465
|
onEvent,
|
|
65389
65466
|
themeClass,
|
|
65390
65467
|
wallets,
|
|
@@ -65419,8 +65496,8 @@ function DepositModal({
|
|
|
65419
65496
|
destinationChainType,
|
|
65420
65497
|
destinationChainId,
|
|
65421
65498
|
destinationTokenAddress,
|
|
65422
|
-
onDepositSuccess,
|
|
65423
|
-
onDepositError,
|
|
65499
|
+
onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
|
|
65500
|
+
onDepositError: onDepositErrorFor("pay_with_exchange"),
|
|
65424
65501
|
wallets,
|
|
65425
65502
|
defaultToken: defaultToken ?? null
|
|
65426
65503
|
}
|
|
@@ -65438,14 +65515,10 @@ function DepositModal({
|
|
|
65438
65515
|
destinationTokenAddress: destinationTokenAddress ?? "",
|
|
65439
65516
|
destinationChainId: destinationChainId ?? "",
|
|
65440
65517
|
destinationChainType: destinationChainType ?? "",
|
|
65441
|
-
|
|
65442
|
-
|
|
65443
|
-
message: "Transfer completed via Coinbase Connect",
|
|
65444
|
-
transaction: result
|
|
65445
|
-
});
|
|
65446
|
-
},
|
|
65518
|
+
onDepositSuccess: onDepositSuccessFor("exchange_connect"),
|
|
65519
|
+
onDepositError: onDepositErrorFor("exchange_connect"),
|
|
65447
65520
|
onTransferError: (error) => {
|
|
65448
|
-
|
|
65521
|
+
onDepositErrorFor("exchange_connect")?.({
|
|
65449
65522
|
message: error.message,
|
|
65450
65523
|
error
|
|
65451
65524
|
});
|
|
@@ -65474,20 +65547,14 @@ function DepositModal({
|
|
|
65474
65547
|
publishableKey,
|
|
65475
65548
|
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
65476
65549
|
projectName: projectConfig?.project_name,
|
|
65477
|
-
onSuccess: (txHash) => {
|
|
65478
|
-
onDepositSuccess?.({
|
|
65479
|
-
message: "Transaction sent successfully",
|
|
65480
|
-
transaction: { txHash }
|
|
65481
|
-
});
|
|
65482
|
-
},
|
|
65483
65550
|
onError: (error) => {
|
|
65484
|
-
|
|
65551
|
+
onDepositErrorFor("wallet_connect")?.({
|
|
65485
65552
|
message: error.message,
|
|
65486
65553
|
error
|
|
65487
65554
|
});
|
|
65488
65555
|
},
|
|
65489
|
-
onDepositSuccess,
|
|
65490
|
-
onDepositError,
|
|
65556
|
+
onDepositSuccess: onDepositSuccessFor("wallet_connect"),
|
|
65557
|
+
onDepositError: onDepositErrorFor("wallet_connect"),
|
|
65491
65558
|
amountQuickSelect: browserWalletAmountQuickSelect,
|
|
65492
65559
|
onWalletDisconnect: handleWalletDisconnect,
|
|
65493
65560
|
onWalletConnected: (info, dw) => {
|
|
@@ -65531,8 +65598,8 @@ function DepositModal({
|
|
|
65531
65598
|
onViewChange: setCashAppView,
|
|
65532
65599
|
onAmountChange: setCashAppAmount,
|
|
65533
65600
|
onEvent,
|
|
65534
|
-
onDepositSuccess,
|
|
65535
|
-
onDepositError
|
|
65601
|
+
onDepositSuccess: onDepositSuccessFor("cashapp"),
|
|
65602
|
+
onDepositError: onDepositErrorFor("cashapp")
|
|
65536
65603
|
}
|
|
65537
65604
|
),
|
|
65538
65605
|
depositPoweredByFooter
|
|
@@ -66370,6 +66437,31 @@ function useWithdrawPolling({
|
|
|
66370
66437
|
onWithdrawSuccess,
|
|
66371
66438
|
onWithdrawError
|
|
66372
66439
|
}) {
|
|
66440
|
+
const createExecutionSuccessEvent = (execution) => ({
|
|
66441
|
+
id: generatePrefixedKSUID("sevt"),
|
|
66442
|
+
type: WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED,
|
|
66443
|
+
created: 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),
|
|
66444
|
+
data: { object: mapToDirectExecution(execution) }
|
|
66445
|
+
});
|
|
66446
|
+
const mapToDirectExecution = (execution) => ({
|
|
66447
|
+
id: execution.id,
|
|
66448
|
+
transactionHash: execution.transaction_hash,
|
|
66449
|
+
recipientAddress: execution.recipient_address,
|
|
66450
|
+
depositAddress: execution.deposit_wallet?.address,
|
|
66451
|
+
sourceChainType: execution.source_chain_type,
|
|
66452
|
+
sourceChainId: execution.source_chain_id,
|
|
66453
|
+
sourceTokenAddress: execution.source_token_address,
|
|
66454
|
+
destinationChainType: execution.destination_chain_type,
|
|
66455
|
+
destinationChainId: execution.destination_chain_id,
|
|
66456
|
+
destinationTokenAddress: execution.destination_token_address,
|
|
66457
|
+
sourceAmountBaseUnit: execution.source_amount_base_unit,
|
|
66458
|
+
sourceAmountUsd: execution.source_amount_usd,
|
|
66459
|
+
destinationAmountBaseUnit: execution.destination_amount_base_unit,
|
|
66460
|
+
destinationAmountUsd: execution.destination_amount_usd,
|
|
66461
|
+
destinationTransactionHashes: execution.destination_transaction_hashes,
|
|
66462
|
+
status: execution.status,
|
|
66463
|
+
failureReason: execution.failure_reason
|
|
66464
|
+
});
|
|
66373
66465
|
const [executions, setExecutions] = (0, import_react31.useState)([]);
|
|
66374
66466
|
const [isPolling, setIsPolling] = (0, import_react31.useState)(false);
|
|
66375
66467
|
const enabledAtRef = (0, import_react31.useRef)(/* @__PURE__ */ new Date());
|
|
@@ -66437,7 +66529,13 @@ function useWithdrawPolling({
|
|
|
66437
66529
|
return [...list, ex];
|
|
66438
66530
|
});
|
|
66439
66531
|
if (ex.status === ExecutionStatus.SUCCEEDED && (!prev || inProgress.includes(prev))) {
|
|
66440
|
-
onSuccessRef.current?.({
|
|
66532
|
+
onSuccessRef.current?.({
|
|
66533
|
+
message: "Withdrawal completed successfully",
|
|
66534
|
+
executionId: ex.id,
|
|
66535
|
+
// Backward compatibility: keep transaction in API response shape.
|
|
66536
|
+
transaction: ex,
|
|
66537
|
+
execution: createExecutionSuccessEvent(ex)
|
|
66538
|
+
});
|
|
66441
66539
|
} else if (ex.status === ExecutionStatus.FAILED && prev !== ExecutionStatus.FAILED) {
|
|
66442
66540
|
onErrorRef.current?.({ message: "Withdrawal failed", code: "WITHDRAW_FAILED", error: ex });
|
|
66443
66541
|
}
|
|
@@ -67639,9 +67737,19 @@ function WithdrawModal({
|
|
|
67639
67737
|
onWithdraw,
|
|
67640
67738
|
onWithdrawSuccess,
|
|
67641
67739
|
onWithdrawError,
|
|
67740
|
+
onEvent,
|
|
67642
67741
|
theme = "dark",
|
|
67643
67742
|
hideOverlay = false
|
|
67644
67743
|
}) {
|
|
67744
|
+
const onWithdrawSuccessFor = (0, import_react30.useCallback)(
|
|
67745
|
+
(data) => {
|
|
67746
|
+
onWithdrawSuccess?.(data);
|
|
67747
|
+
if (data.execution) {
|
|
67748
|
+
onEvent?.(data.execution);
|
|
67749
|
+
}
|
|
67750
|
+
},
|
|
67751
|
+
[onWithdrawSuccess, onEvent]
|
|
67752
|
+
);
|
|
67645
67753
|
const { colors: colors2, fonts, components } = useTheme();
|
|
67646
67754
|
const [containerEl, setContainerEl] = (0, import_react30.useState)(null);
|
|
67647
67755
|
const containerCallbackRef = (0, import_react30.useCallback)((el) => {
|
|
@@ -67703,7 +67811,7 @@ function WithdrawModal({
|
|
|
67703
67811
|
publishableKey,
|
|
67704
67812
|
depositWalletId: withdrawDepositWalletId,
|
|
67705
67813
|
enabled: !!withdrawDepositWalletId && open,
|
|
67706
|
-
onWithdrawSuccess: onWithdrawSuccess
|
|
67814
|
+
onWithdrawSuccess: onWithdrawSuccess || onEvent ? onWithdrawSuccessFor : void 0,
|
|
67707
67815
|
onWithdrawError
|
|
67708
67816
|
});
|
|
67709
67817
|
const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
|
|
@@ -68200,6 +68308,7 @@ function UnifoldProvider2({
|
|
|
68200
68308
|
onWithdraw: withdrawConfig.withdraw,
|
|
68201
68309
|
onWithdrawSuccess: handleWithdrawSuccess,
|
|
68202
68310
|
onWithdrawError: handleWithdrawError,
|
|
68311
|
+
onEvent: withdrawConfig.onEvent,
|
|
68203
68312
|
theme: resolvedTheme
|
|
68204
68313
|
}
|
|
68205
68314
|
),
|
|
@@ -68405,6 +68514,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
|
68405
68514
|
lucide-react/dist/esm/icons/arrow-left-right.js:
|
|
68406
68515
|
lucide-react/dist/esm/icons/arrow-left.js:
|
|
68407
68516
|
lucide-react/dist/esm/icons/arrow-up-down.js:
|
|
68517
|
+
lucide-react/dist/esm/icons/bitcoin.js:
|
|
68408
68518
|
lucide-react/dist/esm/icons/check.js:
|
|
68409
68519
|
lucide-react/dist/esm/icons/chevron-down.js:
|
|
68410
68520
|
lucide-react/dist/esm/icons/chevron-right.js:
|
package/dist/index.mjs
CHANGED
|
@@ -38511,6 +38511,15 @@ var ArrowUpDown = createLucideIcon("ArrowUpDown", [
|
|
|
38511
38511
|
["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
|
|
38512
38512
|
["path", { d: "M7 4v16", key: "1glfcx" }]
|
|
38513
38513
|
]);
|
|
38514
|
+
var Bitcoin = createLucideIcon("Bitcoin", [
|
|
38515
|
+
[
|
|
38516
|
+
"path",
|
|
38517
|
+
{
|
|
38518
|
+
d: "M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",
|
|
38519
|
+
key: "yr8idg"
|
|
38520
|
+
}
|
|
38521
|
+
]
|
|
38522
|
+
]);
|
|
38514
38523
|
var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
38515
38524
|
var ChevronDown = createLucideIcon("ChevronDown", [
|
|
38516
38525
|
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
@@ -44086,8 +44095,13 @@ async function sendHypercoreTransaction(request, publishableKey) {
|
|
|
44086
44095
|
}
|
|
44087
44096
|
var DepositEventType = /* @__PURE__ */ ((DepositEventType2) => {
|
|
44088
44097
|
DepositEventType2["ONRAMP_SESSION_CREATED"] = "onramp_session.created";
|
|
44098
|
+
DepositEventType2["DIRECT_EXECUTION_SUCCEEDED"] = "direct_execution.succeeded";
|
|
44089
44099
|
return DepositEventType2;
|
|
44090
44100
|
})(DepositEventType || {});
|
|
44101
|
+
var WithdrawEventType = /* @__PURE__ */ ((WithdrawEventType2) => {
|
|
44102
|
+
WithdrawEventType2["DIRECT_EXECUTION_SUCCEEDED"] = "direct_execution.succeeded";
|
|
44103
|
+
return WithdrawEventType2;
|
|
44104
|
+
})(WithdrawEventType || {});
|
|
44091
44105
|
var import_qr_code_styling = __toESM2(require_qr_code_styling(), 1);
|
|
44092
44106
|
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
44093
44107
|
var use = React25[" use ".trim().toString()];
|
|
@@ -51719,6 +51733,31 @@ function useDepositPolling({
|
|
|
51719
51733
|
onDepositSuccess,
|
|
51720
51734
|
onDepositError
|
|
51721
51735
|
}) {
|
|
51736
|
+
const createExecutionSuccessEvent = (execution) => ({
|
|
51737
|
+
id: generatePrefixedKSUID("sevt"),
|
|
51738
|
+
type: DepositEventType.DIRECT_EXECUTION_SUCCEEDED,
|
|
51739
|
+
created: 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),
|
|
51740
|
+
data: { object: mapToDirectExecution(execution) }
|
|
51741
|
+
});
|
|
51742
|
+
const mapToDirectExecution = (execution) => ({
|
|
51743
|
+
id: execution.id,
|
|
51744
|
+
transactionHash: execution.transaction_hash,
|
|
51745
|
+
recipientAddress: execution.recipient_address,
|
|
51746
|
+
depositAddress: execution.deposit_wallet?.address,
|
|
51747
|
+
sourceChainType: execution.source_chain_type,
|
|
51748
|
+
sourceChainId: execution.source_chain_id,
|
|
51749
|
+
sourceTokenAddress: execution.source_token_address,
|
|
51750
|
+
destinationChainType: execution.destination_chain_type,
|
|
51751
|
+
destinationChainId: execution.destination_chain_id,
|
|
51752
|
+
destinationTokenAddress: execution.destination_token_address,
|
|
51753
|
+
sourceAmountBaseUnit: execution.source_amount_base_unit,
|
|
51754
|
+
sourceAmountUsd: execution.source_amount_usd,
|
|
51755
|
+
destinationAmountBaseUnit: execution.destination_amount_base_unit,
|
|
51756
|
+
destinationAmountUsd: execution.destination_amount_usd,
|
|
51757
|
+
destinationTransactionHashes: execution.destination_transaction_hashes,
|
|
51758
|
+
status: execution.status,
|
|
51759
|
+
failureReason: execution.failure_reason
|
|
51760
|
+
});
|
|
51722
51761
|
const [executions, setExecutions] = (0, import_react10.useState)([]);
|
|
51723
51762
|
const [isPolling, setIsPolling] = (0, import_react10.useState)(false);
|
|
51724
51763
|
const [pollingEnabled, setPollingEnabled] = (0, import_react10.useState)(false);
|
|
@@ -51832,7 +51871,9 @@ function useDepositPolling({
|
|
|
51832
51871
|
onDepositSuccessRef.current?.({
|
|
51833
51872
|
message: "Deposit completed successfully",
|
|
51834
51873
|
executionId: execution.id,
|
|
51835
|
-
|
|
51874
|
+
// Backward compatibility: keep transaction in API response shape.
|
|
51875
|
+
transaction: execution,
|
|
51876
|
+
execution: createExecutionSuccessEvent(execution)
|
|
51836
51877
|
});
|
|
51837
51878
|
} else if (execution.status === ExecutionStatus.FAILED && previousStatus !== ExecutionStatus.FAILED) {
|
|
51838
51879
|
onDepositErrorRef.current?.({
|
|
@@ -58013,6 +58054,8 @@ function CoinbaseConnect({
|
|
|
58013
58054
|
destinationChainId,
|
|
58014
58055
|
destinationChainType,
|
|
58015
58056
|
onTransferSuccess,
|
|
58057
|
+
onDepositSuccess,
|
|
58058
|
+
onDepositError,
|
|
58016
58059
|
onTransferError,
|
|
58017
58060
|
onClose,
|
|
58018
58061
|
onBack: parentOnBack,
|
|
@@ -58160,10 +58203,14 @@ function CoinbaseConnect({
|
|
|
58160
58203
|
depositWalletId: transferDepositWalletId,
|
|
58161
58204
|
enabled: view === "success" && !!transferDepositWalletId,
|
|
58162
58205
|
immediateDirectPolling: true,
|
|
58163
|
-
onDepositSuccess: onTransferSuccess ? () => {
|
|
58164
|
-
|
|
58206
|
+
onDepositSuccess: onDepositSuccess || onTransferSuccess ? (data) => {
|
|
58207
|
+
onDepositSuccess?.(data);
|
|
58208
|
+
if (onTransferSuccess && confirmResult) onTransferSuccess(confirmResult);
|
|
58165
58209
|
} : void 0,
|
|
58166
|
-
onDepositError: onTransferError
|
|
58210
|
+
onDepositError: onDepositError || onTransferError ? (error) => {
|
|
58211
|
+
onDepositError?.(error);
|
|
58212
|
+
onTransferError?.({ message: error.message });
|
|
58213
|
+
} : void 0
|
|
58167
58214
|
});
|
|
58168
58215
|
(0, import_react18.useEffect)(() => {
|
|
58169
58216
|
onExecutionsChange?.(depositExecutions);
|
|
@@ -64350,7 +64397,10 @@ function WalletConnect({
|
|
|
64350
64397
|
children: [
|
|
64351
64398
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
|
|
64352
64399
|
WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(WalletIconWithNetwork, { WalletIcon: WALLET_ICONS3[wallet.id], networks: wallet.networks, size: 40, className: "uf-rounded-lg" }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
|
|
64353
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.
|
|
64400
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
64401
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "uf-text-sm uf-font-medium", style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: wallet.name }),
|
|
64402
|
+
wallet.id === recentWalletId && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "uf-text-xs uf-px-2 uf-py-0.5 uf-rounded-full", style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium }, children: "Last used" })
|
|
64403
|
+
] })
|
|
64354
64404
|
] }),
|
|
64355
64405
|
isPending ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin", style: { color: colors2.primary } }) : wallet.isInstalled ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "uf-text-xs uf-px-2 uf-py-1 uf-rounded-full", style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium }, children: "Detected" }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
|
|
64356
64406
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: showOpenInApp ? "Open" : "Install" }),
|
|
@@ -64611,6 +64661,23 @@ function DepositModal({
|
|
|
64611
64661
|
depositTrackerSubTitle = t7.depositTracker.subtitle
|
|
64612
64662
|
}) {
|
|
64613
64663
|
const { colors: colors2, fonts, components } = useTheme();
|
|
64664
|
+
const onDepositSuccessFor = (0, import_react3.useCallback)(
|
|
64665
|
+
(method) => onDepositSuccess || onEvent ? (data) => {
|
|
64666
|
+
const payload = { ...data, method };
|
|
64667
|
+
onDepositSuccess?.(payload);
|
|
64668
|
+
if (payload.execution) {
|
|
64669
|
+
onEvent?.({
|
|
64670
|
+
...payload.execution,
|
|
64671
|
+
method
|
|
64672
|
+
});
|
|
64673
|
+
}
|
|
64674
|
+
} : void 0,
|
|
64675
|
+
[onDepositSuccess, onEvent]
|
|
64676
|
+
);
|
|
64677
|
+
const onDepositErrorFor = (0, import_react3.useCallback)(
|
|
64678
|
+
(method) => onDepositError ? (error) => onDepositError({ ...error, method }) : void 0,
|
|
64679
|
+
[onDepositError]
|
|
64680
|
+
);
|
|
64614
64681
|
const effectiveInitialScreen = (0, import_react3.useMemo)(() => {
|
|
64615
64682
|
const s = initialScreen ?? "main";
|
|
64616
64683
|
if (s === "tracker" && hideDepositTracker === true) return "main";
|
|
@@ -65151,8 +65218,8 @@ function DepositModal({
|
|
|
65151
65218
|
cashAppMenuButton
|
|
65152
65219
|
].filter(Boolean);
|
|
65153
65220
|
const depositTabs = [
|
|
65154
|
-
{ id: "crypto", label: "Use Crypto", buttons: cryptoMenuButtons },
|
|
65155
|
-
{ id: "cash", label: "Use Cash", buttons: cashMenuButtons }
|
|
65221
|
+
{ id: "crypto", label: "Use Crypto", icon: Bitcoin, buttons: cryptoMenuButtons },
|
|
65222
|
+
{ id: "cash", label: "Use Cash", icon: DollarSign, buttons: cashMenuButtons }
|
|
65156
65223
|
].filter((tab) => tab.buttons.length > 0);
|
|
65157
65224
|
const activeDepositTab = depositTabs.find((tab) => tab.id === depositTab) ?? depositTabs[0];
|
|
65158
65225
|
const renderMainMenuBody = () => {
|
|
@@ -65175,18 +65242,16 @@ function DepositModal({
|
|
|
65175
65242
|
role: "tablist",
|
|
65176
65243
|
children: depositTabs.map((tab) => {
|
|
65177
65244
|
const active = activeDepositTab.id === tab.id;
|
|
65178
|
-
|
|
65245
|
+
const TabIcon = tab.icon;
|
|
65246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
65179
65247
|
"button",
|
|
65180
65248
|
{
|
|
65181
65249
|
type: "button",
|
|
65182
65250
|
role: "tab",
|
|
65183
65251
|
"aria-selected": active,
|
|
65184
65252
|
onClick: () => setDepositTab(tab.id),
|
|
65185
|
-
className: "uf-flex-1 uf-py-2 uf-px-3 uf-rounded-lg uf-text-sm uf-transition-all",
|
|
65253
|
+
className: "uf-flex-1 uf-py-2 uf-px-3 uf-rounded-lg uf-text-sm uf-transition-all uf-flex uf-items-center uf-justify-center uf-gap-1.5",
|
|
65186
65254
|
style: {
|
|
65187
|
-
// Active tab is a soft, blurred glass pill — a faint accent
|
|
65188
|
-
// tint with its own backdrop blur and a subtle border/shadow,
|
|
65189
|
-
// so it looks frosted instead of like a hard solid button.
|
|
65190
65255
|
backgroundColor: active ? `color-mix(in srgb, ${colors2.primary} 22%, transparent)` : "transparent",
|
|
65191
65256
|
backdropFilter: active ? "blur(8px)" : void 0,
|
|
65192
65257
|
WebkitBackdropFilter: active ? "blur(8px)" : void 0,
|
|
@@ -65194,7 +65259,19 @@ function DepositModal({
|
|
|
65194
65259
|
color: active ? colors2.foreground : colors2.foregroundMuted,
|
|
65195
65260
|
fontFamily: fonts.medium
|
|
65196
65261
|
},
|
|
65197
|
-
children:
|
|
65262
|
+
children: [
|
|
65263
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
65264
|
+
"span",
|
|
65265
|
+
{
|
|
65266
|
+
className: "uf-inline-flex uf-items-center uf-justify-center uf-rounded-full uf-w-5 uf-h-5 uf-flex-shrink-0",
|
|
65267
|
+
style: {
|
|
65268
|
+
backgroundColor: active ? colors2.foreground : colors2.foregroundMuted
|
|
65269
|
+
},
|
|
65270
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TabIcon, { size: 12, style: { color: active ? colors2.background : colors2.background }, strokeWidth: 2.5 })
|
|
65271
|
+
}
|
|
65272
|
+
),
|
|
65273
|
+
tab.label
|
|
65274
|
+
]
|
|
65198
65275
|
},
|
|
65199
65276
|
tab.id
|
|
65200
65277
|
);
|
|
@@ -65285,8 +65362,8 @@ function DepositModal({
|
|
|
65285
65362
|
defaultSourceSymbol,
|
|
65286
65363
|
depositConfirmationMode,
|
|
65287
65364
|
onExecutionsChange: setDepositExecutions,
|
|
65288
|
-
onDepositSuccess,
|
|
65289
|
-
onDepositError,
|
|
65365
|
+
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
65366
|
+
onDepositError: onDepositErrorFor("transfer"),
|
|
65290
65367
|
wallets
|
|
65291
65368
|
}
|
|
65292
65369
|
) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
@@ -65304,8 +65381,8 @@ function DepositModal({
|
|
|
65304
65381
|
defaultSourceSymbol,
|
|
65305
65382
|
depositConfirmationMode,
|
|
65306
65383
|
onExecutionsChange: setDepositExecutions,
|
|
65307
|
-
onDepositSuccess,
|
|
65308
|
-
onDepositError,
|
|
65384
|
+
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
65385
|
+
onDepositError: onDepositErrorFor("transfer"),
|
|
65309
65386
|
wallets
|
|
65310
65387
|
}
|
|
65311
65388
|
),
|
|
@@ -65370,8 +65447,8 @@ function DepositModal({
|
|
|
65370
65447
|
destinationChainType,
|
|
65371
65448
|
destinationChainId,
|
|
65372
65449
|
destinationTokenAddress,
|
|
65373
|
-
onDepositSuccess,
|
|
65374
|
-
onDepositError,
|
|
65450
|
+
onDepositSuccess: onDepositSuccessFor("card"),
|
|
65451
|
+
onDepositError: onDepositErrorFor("card"),
|
|
65375
65452
|
onEvent,
|
|
65376
65453
|
themeClass,
|
|
65377
65454
|
wallets,
|
|
@@ -65406,8 +65483,8 @@ function DepositModal({
|
|
|
65406
65483
|
destinationChainType,
|
|
65407
65484
|
destinationChainId,
|
|
65408
65485
|
destinationTokenAddress,
|
|
65409
|
-
onDepositSuccess,
|
|
65410
|
-
onDepositError,
|
|
65486
|
+
onDepositSuccess: onDepositSuccessFor("pay_with_exchange"),
|
|
65487
|
+
onDepositError: onDepositErrorFor("pay_with_exchange"),
|
|
65411
65488
|
wallets,
|
|
65412
65489
|
defaultToken: defaultToken ?? null
|
|
65413
65490
|
}
|
|
@@ -65425,14 +65502,10 @@ function DepositModal({
|
|
|
65425
65502
|
destinationTokenAddress: destinationTokenAddress ?? "",
|
|
65426
65503
|
destinationChainId: destinationChainId ?? "",
|
|
65427
65504
|
destinationChainType: destinationChainType ?? "",
|
|
65428
|
-
|
|
65429
|
-
|
|
65430
|
-
message: "Transfer completed via Coinbase Connect",
|
|
65431
|
-
transaction: result
|
|
65432
|
-
});
|
|
65433
|
-
},
|
|
65505
|
+
onDepositSuccess: onDepositSuccessFor("exchange_connect"),
|
|
65506
|
+
onDepositError: onDepositErrorFor("exchange_connect"),
|
|
65434
65507
|
onTransferError: (error) => {
|
|
65435
|
-
|
|
65508
|
+
onDepositErrorFor("exchange_connect")?.({
|
|
65436
65509
|
message: error.message,
|
|
65437
65510
|
error
|
|
65438
65511
|
});
|
|
@@ -65461,20 +65534,14 @@ function DepositModal({
|
|
|
65461
65534
|
publishableKey,
|
|
65462
65535
|
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
65463
65536
|
projectName: projectConfig?.project_name,
|
|
65464
|
-
onSuccess: (txHash) => {
|
|
65465
|
-
onDepositSuccess?.({
|
|
65466
|
-
message: "Transaction sent successfully",
|
|
65467
|
-
transaction: { txHash }
|
|
65468
|
-
});
|
|
65469
|
-
},
|
|
65470
65537
|
onError: (error) => {
|
|
65471
|
-
|
|
65538
|
+
onDepositErrorFor("wallet_connect")?.({
|
|
65472
65539
|
message: error.message,
|
|
65473
65540
|
error
|
|
65474
65541
|
});
|
|
65475
65542
|
},
|
|
65476
|
-
onDepositSuccess,
|
|
65477
|
-
onDepositError,
|
|
65543
|
+
onDepositSuccess: onDepositSuccessFor("wallet_connect"),
|
|
65544
|
+
onDepositError: onDepositErrorFor("wallet_connect"),
|
|
65478
65545
|
amountQuickSelect: browserWalletAmountQuickSelect,
|
|
65479
65546
|
onWalletDisconnect: handleWalletDisconnect,
|
|
65480
65547
|
onWalletConnected: (info, dw) => {
|
|
@@ -65518,8 +65585,8 @@ function DepositModal({
|
|
|
65518
65585
|
onViewChange: setCashAppView,
|
|
65519
65586
|
onAmountChange: setCashAppAmount,
|
|
65520
65587
|
onEvent,
|
|
65521
|
-
onDepositSuccess,
|
|
65522
|
-
onDepositError
|
|
65588
|
+
onDepositSuccess: onDepositSuccessFor("cashapp"),
|
|
65589
|
+
onDepositError: onDepositErrorFor("cashapp")
|
|
65523
65590
|
}
|
|
65524
65591
|
),
|
|
65525
65592
|
depositPoweredByFooter
|
|
@@ -66357,6 +66424,31 @@ function useWithdrawPolling({
|
|
|
66357
66424
|
onWithdrawSuccess,
|
|
66358
66425
|
onWithdrawError
|
|
66359
66426
|
}) {
|
|
66427
|
+
const createExecutionSuccessEvent = (execution) => ({
|
|
66428
|
+
id: generatePrefixedKSUID("sevt"),
|
|
66429
|
+
type: WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED,
|
|
66430
|
+
created: 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),
|
|
66431
|
+
data: { object: mapToDirectExecution(execution) }
|
|
66432
|
+
});
|
|
66433
|
+
const mapToDirectExecution = (execution) => ({
|
|
66434
|
+
id: execution.id,
|
|
66435
|
+
transactionHash: execution.transaction_hash,
|
|
66436
|
+
recipientAddress: execution.recipient_address,
|
|
66437
|
+
depositAddress: execution.deposit_wallet?.address,
|
|
66438
|
+
sourceChainType: execution.source_chain_type,
|
|
66439
|
+
sourceChainId: execution.source_chain_id,
|
|
66440
|
+
sourceTokenAddress: execution.source_token_address,
|
|
66441
|
+
destinationChainType: execution.destination_chain_type,
|
|
66442
|
+
destinationChainId: execution.destination_chain_id,
|
|
66443
|
+
destinationTokenAddress: execution.destination_token_address,
|
|
66444
|
+
sourceAmountBaseUnit: execution.source_amount_base_unit,
|
|
66445
|
+
sourceAmountUsd: execution.source_amount_usd,
|
|
66446
|
+
destinationAmountBaseUnit: execution.destination_amount_base_unit,
|
|
66447
|
+
destinationAmountUsd: execution.destination_amount_usd,
|
|
66448
|
+
destinationTransactionHashes: execution.destination_transaction_hashes,
|
|
66449
|
+
status: execution.status,
|
|
66450
|
+
failureReason: execution.failure_reason
|
|
66451
|
+
});
|
|
66360
66452
|
const [executions, setExecutions] = (0, import_react31.useState)([]);
|
|
66361
66453
|
const [isPolling, setIsPolling] = (0, import_react31.useState)(false);
|
|
66362
66454
|
const enabledAtRef = (0, import_react31.useRef)(/* @__PURE__ */ new Date());
|
|
@@ -66424,7 +66516,13 @@ function useWithdrawPolling({
|
|
|
66424
66516
|
return [...list, ex];
|
|
66425
66517
|
});
|
|
66426
66518
|
if (ex.status === ExecutionStatus.SUCCEEDED && (!prev || inProgress.includes(prev))) {
|
|
66427
|
-
onSuccessRef.current?.({
|
|
66519
|
+
onSuccessRef.current?.({
|
|
66520
|
+
message: "Withdrawal completed successfully",
|
|
66521
|
+
executionId: ex.id,
|
|
66522
|
+
// Backward compatibility: keep transaction in API response shape.
|
|
66523
|
+
transaction: ex,
|
|
66524
|
+
execution: createExecutionSuccessEvent(ex)
|
|
66525
|
+
});
|
|
66428
66526
|
} else if (ex.status === ExecutionStatus.FAILED && prev !== ExecutionStatus.FAILED) {
|
|
66429
66527
|
onErrorRef.current?.({ message: "Withdrawal failed", code: "WITHDRAW_FAILED", error: ex });
|
|
66430
66528
|
}
|
|
@@ -67626,9 +67724,19 @@ function WithdrawModal({
|
|
|
67626
67724
|
onWithdraw,
|
|
67627
67725
|
onWithdrawSuccess,
|
|
67628
67726
|
onWithdrawError,
|
|
67727
|
+
onEvent,
|
|
67629
67728
|
theme = "dark",
|
|
67630
67729
|
hideOverlay = false
|
|
67631
67730
|
}) {
|
|
67731
|
+
const onWithdrawSuccessFor = (0, import_react30.useCallback)(
|
|
67732
|
+
(data) => {
|
|
67733
|
+
onWithdrawSuccess?.(data);
|
|
67734
|
+
if (data.execution) {
|
|
67735
|
+
onEvent?.(data.execution);
|
|
67736
|
+
}
|
|
67737
|
+
},
|
|
67738
|
+
[onWithdrawSuccess, onEvent]
|
|
67739
|
+
);
|
|
67632
67740
|
const { colors: colors2, fonts, components } = useTheme();
|
|
67633
67741
|
const [containerEl, setContainerEl] = (0, import_react30.useState)(null);
|
|
67634
67742
|
const containerCallbackRef = (0, import_react30.useCallback)((el) => {
|
|
@@ -67690,7 +67798,7 @@ function WithdrawModal({
|
|
|
67690
67798
|
publishableKey,
|
|
67691
67799
|
depositWalletId: withdrawDepositWalletId,
|
|
67692
67800
|
enabled: !!withdrawDepositWalletId && open,
|
|
67693
|
-
onWithdrawSuccess: onWithdrawSuccess
|
|
67801
|
+
onWithdrawSuccess: onWithdrawSuccess || onEvent ? onWithdrawSuccessFor : void 0,
|
|
67694
67802
|
onWithdrawError
|
|
67695
67803
|
});
|
|
67696
67804
|
const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
|
|
@@ -68187,6 +68295,7 @@ function UnifoldProvider2({
|
|
|
68187
68295
|
onWithdraw: withdrawConfig.withdraw,
|
|
68188
68296
|
onWithdrawSuccess: handleWithdrawSuccess,
|
|
68189
68297
|
onWithdrawError: handleWithdrawError,
|
|
68298
|
+
onEvent: withdrawConfig.onEvent,
|
|
68190
68299
|
theme: resolvedTheme
|
|
68191
68300
|
}
|
|
68192
68301
|
),
|
|
@@ -68391,6 +68500,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
|
68391
68500
|
lucide-react/dist/esm/icons/arrow-left-right.js:
|
|
68392
68501
|
lucide-react/dist/esm/icons/arrow-left.js:
|
|
68393
68502
|
lucide-react/dist/esm/icons/arrow-up-down.js:
|
|
68503
|
+
lucide-react/dist/esm/icons/bitcoin.js:
|
|
68394
68504
|
lucide-react/dist/esm/icons/check.js:
|
|
68395
68505
|
lucide-react/dist/esm/icons/chevron-down.js:
|
|
68396
68506
|
lucide-react/dist/esm/icons/chevron-right.js:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unifold/ui-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.67",
|
|
4
4
|
"description": "Unifold UI Web - Framework-agnostic deposit widget",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"@types/react-dom": "^19.0.0",
|
|
31
31
|
"tsup": "^8.0.0",
|
|
32
32
|
"typescript": "^5.0.0",
|
|
33
|
-
"@unifold/connect-react": "0.1.
|
|
34
|
-
"@unifold/
|
|
35
|
-
"@unifold/
|
|
36
|
-
"@unifold/
|
|
33
|
+
"@unifold/connect-react": "0.1.67",
|
|
34
|
+
"@unifold/react-provider": "0.1.67",
|
|
35
|
+
"@unifold/ui-react": "0.1.67",
|
|
36
|
+
"@unifold/core": "0.1.67"
|
|
37
37
|
},
|
|
38
38
|
"keywords": [
|
|
39
39
|
"unifold",
|