@oasisprotocol/privana-sdk 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/{chunk-RDMJGMI3.cjs → chunk-CRJNDCDT.cjs} +19 -3
- package/dist/chunk-CRJNDCDT.cjs.map +1 -0
- package/dist/{chunk-ZVNC4FTJ.js → chunk-ZXFQJ5MG.js} +19 -4
- package/dist/chunk-ZXFQJ5MG.js.map +1 -0
- package/dist/index.cjs +153 -157
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +6 -13
- package/dist/index.js.map +1 -1
- package/dist/on-ramp.cjs +173 -53
- package/dist/on-ramp.cjs.map +1 -1
- package/dist/on-ramp.d.cts +28 -1
- package/dist/on-ramp.d.ts +28 -1
- package/dist/on-ramp.js +170 -50
- package/dist/on-ramp.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-RDMJGMI3.cjs.map +0 -1
- package/dist/chunk-ZVNC4FTJ.js.map +0 -1
package/dist/on-ramp.cjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkCRJNDCDT_cjs = require('./chunk-CRJNDCDT.cjs');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var viem = require('viem');
|
|
7
7
|
var wagmi = require('wagmi');
|
|
8
|
+
var lucideReact = require('lucide-react');
|
|
8
9
|
var moonpayReact = require('@moonpay/moonpay-react');
|
|
9
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
11
|
|
|
@@ -20,8 +21,8 @@ function useFiatOnRamp(options) {
|
|
|
20
21
|
const deliveryPollInterval = options.deliveryPollInterval ?? 3e3;
|
|
21
22
|
const verificationTimeout = options.verificationTimeout ?? DEFAULT_VERIFICATION_TIMEOUT_MS;
|
|
22
23
|
const finalityRetryInterval = options.finalityRetryInterval ?? DEFAULT_FINALITY_RETRY_INTERVAL_MS;
|
|
23
|
-
const { client, enabledTokens } =
|
|
24
|
-
const { executePrivateRead, privateReadReady } =
|
|
24
|
+
const { client, enabledTokens } = chunkCRJNDCDT_cjs.usePrivanaContext();
|
|
25
|
+
const { executePrivateRead, privateReadReady } = chunkCRJNDCDT_cjs.usePrivateReadRequest();
|
|
25
26
|
const wagmiConfig = wagmi.useConfig();
|
|
26
27
|
const selectedToken = enabledTokens.find((t) => t.id.toLowerCase() === tokenId.toLowerCase());
|
|
27
28
|
const [status, setStatus] = react.useState("idle");
|
|
@@ -30,6 +31,7 @@ function useFiatOnRamp(options) {
|
|
|
30
31
|
const [depositAddress, setDepositAddress] = react.useState();
|
|
31
32
|
const [minDepositBaseUnits, setMinDepositBaseUnits] = react.useState();
|
|
32
33
|
const [activeIntentId, setActiveIntentId] = react.useState(null);
|
|
34
|
+
const [finalityProgress, setFinalityProgress] = react.useState({});
|
|
33
35
|
const onCreditedRef = react.useRef(onCredited);
|
|
34
36
|
const onErrorRef = react.useRef(onError);
|
|
35
37
|
const onDebugEventRef = react.useRef(onDebugEvent);
|
|
@@ -39,6 +41,7 @@ function useFiatOnRamp(options) {
|
|
|
39
41
|
const activeVerificationKeyRef = react.useRef(null);
|
|
40
42
|
const triggeredVerificationKeysRef = react.useRef(/* @__PURE__ */ new Set());
|
|
41
43
|
const closeReconcilePromiseRef = react.useRef(null);
|
|
44
|
+
const purchaseInitiatedRef = react.useRef(false);
|
|
42
45
|
react.useEffect(() => {
|
|
43
46
|
onCreditedRef.current = onCredited;
|
|
44
47
|
onErrorRef.current = onError;
|
|
@@ -130,17 +133,36 @@ function useFiatOnRamp(options) {
|
|
|
130
133
|
activeVerificationKeyRef.current = null;
|
|
131
134
|
activeVerificationRecordRef.current = null;
|
|
132
135
|
}, []);
|
|
133
|
-
const { verify } =
|
|
136
|
+
const { verify } = chunkCRJNDCDT_cjs.useDepositVerification({
|
|
134
137
|
pollTimeout: verificationTimeout,
|
|
135
138
|
pollInterval: options.verificationPollInterval,
|
|
136
139
|
finalityRetryInterval,
|
|
140
|
+
onCheckRetry: (message) => {
|
|
141
|
+
const record = activeVerificationRecordRef.current;
|
|
142
|
+
if (!record) return;
|
|
143
|
+
emitDebug("verification:check-retry", {
|
|
144
|
+
message,
|
|
145
|
+
record: summariseOnRampRecord(record)
|
|
146
|
+
});
|
|
147
|
+
setFinalityProgress((prev) => ({ ...prev, [record.transaction_id]: message }));
|
|
148
|
+
},
|
|
137
149
|
onCredited: (depositTxHash) => {
|
|
138
150
|
const record = activeVerificationRecordRef.current;
|
|
139
151
|
emitDebug("verification:credited", {
|
|
140
152
|
depositTxHash,
|
|
141
153
|
record: record ? summariseOnRampRecord(record) : null
|
|
142
154
|
});
|
|
143
|
-
|
|
155
|
+
if (record && activeIntentIdRef.current === record.transaction_id) {
|
|
156
|
+
setStatus("credited");
|
|
157
|
+
}
|
|
158
|
+
if (record) {
|
|
159
|
+
setFinalityProgress((prev) => {
|
|
160
|
+
if (!(record.transaction_id in prev)) return prev;
|
|
161
|
+
const next = { ...prev };
|
|
162
|
+
delete next[record.transaction_id];
|
|
163
|
+
return next;
|
|
164
|
+
});
|
|
165
|
+
}
|
|
144
166
|
void (async () => {
|
|
145
167
|
try {
|
|
146
168
|
if (record && depositTxHash.startsWith("0x")) {
|
|
@@ -172,21 +194,27 @@ function useFiatOnRamp(options) {
|
|
|
172
194
|
onCreditedRef.current?.(depositTxHash);
|
|
173
195
|
},
|
|
174
196
|
onCheckTimeout: (depositTxHash) => {
|
|
197
|
+
const record = activeVerificationRecordRef.current;
|
|
175
198
|
const err = new Error(
|
|
176
199
|
"Privana verification is still pending. Retry from the pending on-ramp list if it does not complete."
|
|
177
200
|
);
|
|
178
201
|
emitDebug("verification:timeout", { depositTxHash, message: err.message });
|
|
179
202
|
clearActiveVerification();
|
|
180
|
-
|
|
181
|
-
|
|
203
|
+
if (!record || activeIntentIdRef.current === record.transaction_id) {
|
|
204
|
+
setStatus("failed");
|
|
205
|
+
setError(err);
|
|
206
|
+
}
|
|
182
207
|
void refreshPending();
|
|
183
208
|
onErrorRef.current?.(err);
|
|
184
209
|
},
|
|
185
210
|
onError: (err) => {
|
|
211
|
+
const record = activeVerificationRecordRef.current;
|
|
186
212
|
emitDebug("verification:error", errorPayload(err));
|
|
187
213
|
clearActiveVerification();
|
|
188
|
-
|
|
189
|
-
|
|
214
|
+
if (!record || activeIntentIdRef.current === record.transaction_id) {
|
|
215
|
+
setStatus("failed");
|
|
216
|
+
setError(err);
|
|
217
|
+
}
|
|
190
218
|
onErrorRef.current?.(err);
|
|
191
219
|
}
|
|
192
220
|
});
|
|
@@ -198,6 +226,7 @@ function useFiatOnRamp(options) {
|
|
|
198
226
|
}) => {
|
|
199
227
|
try {
|
|
200
228
|
setError(null);
|
|
229
|
+
purchaseInitiatedRef.current = false;
|
|
201
230
|
const token = enabledTokens.find((t) => t.id.toLowerCase() === tokenId.toLowerCase());
|
|
202
231
|
if (!token) throw new Error(`Unknown token: ${tokenId}`);
|
|
203
232
|
if (!depositAddress) throw new Error("Privana deposit address is not ready");
|
|
@@ -280,6 +309,7 @@ function useFiatOnRamp(options) {
|
|
|
280
309
|
const handleTransactionCreated = react.useCallback(
|
|
281
310
|
async (props) => {
|
|
282
311
|
emitDebug("moonpay:onTransactionCreated", summariseMoonPayEventProps(props));
|
|
312
|
+
purchaseInitiatedRef.current = true;
|
|
283
313
|
await registerOnRampTokenMapping(props.id);
|
|
284
314
|
},
|
|
285
315
|
[emitDebug, registerOnRampTokenMapping]
|
|
@@ -358,6 +388,12 @@ function useFiatOnRamp(options) {
|
|
|
358
388
|
triggeredVerificationKeysRef.current.add(verificationKey);
|
|
359
389
|
activeVerificationKeyRef.current = verificationKey;
|
|
360
390
|
activeVerificationRecordRef.current = record;
|
|
391
|
+
setFinalityProgress((prev) => {
|
|
392
|
+
if (!(record.transaction_id in prev)) return prev;
|
|
393
|
+
const next = { ...prev };
|
|
394
|
+
delete next[record.transaction_id];
|
|
395
|
+
return next;
|
|
396
|
+
});
|
|
361
397
|
emitDebug("verification:start", {
|
|
362
398
|
verificationKey,
|
|
363
399
|
record: summariseOnRampRecord(record)
|
|
@@ -398,7 +434,9 @@ function useFiatOnRamp(options) {
|
|
|
398
434
|
`Delivered amount (${record.quote_currency_amount}) is below the minimum deposit.`
|
|
399
435
|
);
|
|
400
436
|
}
|
|
401
|
-
|
|
437
|
+
if (activeIntentIdRef.current === record.transaction_id) {
|
|
438
|
+
setStatus("verifying");
|
|
439
|
+
}
|
|
402
440
|
emitDebug("verification:check-deposit-request", {
|
|
403
441
|
hash: record.on_chain_tx_hash,
|
|
404
442
|
chainId: record.chain_id,
|
|
@@ -466,6 +504,17 @@ function useFiatOnRamp(options) {
|
|
|
466
504
|
await refreshPending();
|
|
467
505
|
return;
|
|
468
506
|
}
|
|
507
|
+
if (!purchaseInitiatedRef.current) {
|
|
508
|
+
emitDebug("moonpay:widget-closed-without-purchase", {
|
|
509
|
+
previousStatus,
|
|
510
|
+
transactionId
|
|
511
|
+
});
|
|
512
|
+
await refreshPending();
|
|
513
|
+
if (previousStatus === "awaiting-purchase" || previousStatus === "awaiting-delivery") {
|
|
514
|
+
setStatus("idle");
|
|
515
|
+
}
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
469
518
|
try {
|
|
470
519
|
setStatus("awaiting-delivery");
|
|
471
520
|
const record = await waitForOnChainHash(transactionId);
|
|
@@ -504,15 +553,39 @@ function useFiatOnRamp(options) {
|
|
|
504
553
|
setStatus("failed");
|
|
505
554
|
setError(e);
|
|
506
555
|
onErrorRef.current?.(e);
|
|
556
|
+
throw e;
|
|
507
557
|
}
|
|
508
558
|
},
|
|
509
559
|
[emitDebug, triggerVerification]
|
|
510
560
|
);
|
|
561
|
+
const triggerVerificationRef = react.useRef(triggerVerification);
|
|
562
|
+
react.useEffect(() => {
|
|
563
|
+
triggerVerificationRef.current = triggerVerification;
|
|
564
|
+
}, [triggerVerification]);
|
|
565
|
+
react.useEffect(() => {
|
|
566
|
+
let cancelled = false;
|
|
567
|
+
void (async () => {
|
|
568
|
+
for (const record of pending) {
|
|
569
|
+
if (cancelled) break;
|
|
570
|
+
if (!record.on_chain_tx_hash || !record.quote_currency_amount) continue;
|
|
571
|
+
const key = getOnRampVerificationKey(record);
|
|
572
|
+
if (triggeredVerificationKeysRef.current.has(key)) continue;
|
|
573
|
+
try {
|
|
574
|
+
await triggerVerificationRef.current(record);
|
|
575
|
+
} catch {
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
})();
|
|
579
|
+
return () => {
|
|
580
|
+
cancelled = true;
|
|
581
|
+
};
|
|
582
|
+
}, [pending]);
|
|
511
583
|
return {
|
|
512
584
|
status,
|
|
513
585
|
activeIntentId,
|
|
514
586
|
pending,
|
|
515
587
|
error,
|
|
588
|
+
finalityProgress,
|
|
516
589
|
depositAddress,
|
|
517
590
|
minDepositBaseUnits,
|
|
518
591
|
selectedToken,
|
|
@@ -564,9 +637,11 @@ async function resolveDeliveredAmount({
|
|
|
564
637
|
}
|
|
565
638
|
let receiptError;
|
|
566
639
|
try {
|
|
567
|
-
const receipt = await
|
|
640
|
+
const receipt = await chunkCRJNDCDT_cjs.waitForTransactionReceipt(wagmiConfig, {
|
|
568
641
|
hash: onChainTxHash,
|
|
569
|
-
chainId
|
|
642
|
+
chainId,
|
|
643
|
+
timeout: 6e4,
|
|
644
|
+
pollingInterval: 4e3
|
|
570
645
|
});
|
|
571
646
|
let delivered = 0n;
|
|
572
647
|
for (const log of receipt.logs) {
|
|
@@ -664,6 +739,12 @@ function FiatOnRampForm({
|
|
|
664
739
|
baseCurrencyCode = "usd",
|
|
665
740
|
defaultBaseCurrencyAmount = "100",
|
|
666
741
|
tokenSymbol,
|
|
742
|
+
theme,
|
|
743
|
+
themeId,
|
|
744
|
+
colorCode,
|
|
745
|
+
variant = "overlay",
|
|
746
|
+
lockAmount,
|
|
747
|
+
paymentMethod,
|
|
667
748
|
onCredited,
|
|
668
749
|
onError,
|
|
669
750
|
onDebugEvent
|
|
@@ -671,11 +752,13 @@ function FiatOnRampForm({
|
|
|
671
752
|
const { address } = wagmi.useAccount();
|
|
672
753
|
const [visible, setVisible] = react.useState(false);
|
|
673
754
|
const [isPreparing, setIsPreparing] = react.useState(false);
|
|
755
|
+
const [rowError, setRowError] = react.useState(null);
|
|
674
756
|
const {
|
|
675
757
|
status,
|
|
676
758
|
activeIntentId,
|
|
677
759
|
pending,
|
|
678
760
|
error,
|
|
761
|
+
finalityProgress,
|
|
679
762
|
depositAddress,
|
|
680
763
|
minDepositBaseUnits,
|
|
681
764
|
selectedToken,
|
|
@@ -688,6 +771,10 @@ function FiatOnRampForm({
|
|
|
688
771
|
} = useFiatOnRamp({ tokenId, onCredited, onError, onDebugEvent });
|
|
689
772
|
const decimals = selectedToken?.decimals;
|
|
690
773
|
const displaySymbol = tokenSymbol ?? selectedToken?.symbol ?? currencyCode.toUpperCase();
|
|
774
|
+
const overlayNode = react.useMemo(
|
|
775
|
+
() => variant === "overlay" ? buildOverlayNode() : void 0,
|
|
776
|
+
[variant]
|
|
777
|
+
);
|
|
691
778
|
const emitFormDebug = react.useCallback(
|
|
692
779
|
(event, payload) => {
|
|
693
780
|
onDebugEvent?.({
|
|
@@ -702,15 +789,17 @@ function FiatOnRampForm({
|
|
|
702
789
|
);
|
|
703
790
|
const minFiatGate = minDepositBaseUnits !== void 0 && decimals !== void 0 ? Number(viem.formatUnits(minDepositBaseUnits, decimals)) * 1.05 : void 0;
|
|
704
791
|
const isBelowMin = minFiatGate !== void 0 && Number(defaultBaseCurrencyAmount) < minFiatGate;
|
|
705
|
-
const isBusy = isPreparing || status === "awaiting-purchase"
|
|
792
|
+
const isBusy = isPreparing || status === "awaiting-purchase";
|
|
793
|
+
const isInitializing = !!address && !depositAddress;
|
|
706
794
|
const blockReasons = react.useMemo(
|
|
707
795
|
() => [
|
|
708
796
|
!address ? "wallet-not-connected" : null,
|
|
709
797
|
!depositAddress ? "deposit-address-not-loaded" : null,
|
|
710
798
|
isBusy ? `busy:${isPreparing ? "preparing" : status}` : null,
|
|
799
|
+
visible ? "widget-open" : null,
|
|
711
800
|
isBelowMin ? "below-minimum" : null
|
|
712
801
|
].filter((reason) => Boolean(reason)),
|
|
713
|
-
[address, depositAddress, isBelowMin, isBusy, isPreparing, status]
|
|
802
|
+
[address, depositAddress, isBelowMin, isBusy, isPreparing, status, visible]
|
|
714
803
|
);
|
|
715
804
|
const canBuy = blockReasons.length === 0;
|
|
716
805
|
const handleOpen = react.useCallback(async () => {
|
|
@@ -785,11 +874,10 @@ function FiatOnRampForm({
|
|
|
785
874
|
const handleReady = react.useCallback(async () => {
|
|
786
875
|
emitFormDebug("moonpay:onReady");
|
|
787
876
|
}, [emitFormDebug]);
|
|
788
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
789
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
790
|
-
|
|
791
|
-
"
|
|
792
|
-
blockReasons.join(", ")
|
|
877
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-privana": true, className: "flex flex-col gap-4", children: [
|
|
878
|
+
isInitializing ? /* @__PURE__ */ jsxRuntime.jsx(chunkCRJNDCDT_cjs.Skeleton, { className: "h-9 w-full rounded-md" }) : /* @__PURE__ */ jsxRuntime.jsxs(chunkCRJNDCDT_cjs.Button, { type: "button", onClick: handleOpen, disabled: !canBuy, children: [
|
|
879
|
+
(isBusy || visible) && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin", "aria-hidden": true }),
|
|
880
|
+
"Buy"
|
|
793
881
|
] }),
|
|
794
882
|
error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", role: "alert", children: error.message }),
|
|
795
883
|
isBelowMin && minFiatGate !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-destructive text-sm", role: "alert", children: [
|
|
@@ -798,32 +886,68 @@ function FiatOnRampForm({
|
|
|
798
886
|
"."
|
|
799
887
|
] }),
|
|
800
888
|
pending.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 rounded-md border p-3", children: [
|
|
801
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium", children: "
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
889
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium", children: "Pending payments" }),
|
|
890
|
+
pending.map((record) => {
|
|
891
|
+
const progress = parseFinalityProgress(finalityProgress[record.transaction_id]);
|
|
892
|
+
const hasProgress = !!finalityProgress[record.transaction_id];
|
|
893
|
+
const isStalled = !hasProgress && Date.now() / 1e3 - (record.updated_at ?? 0) > 60;
|
|
894
|
+
const showRetry = rowError?.id === record.transaction_id || isStalled;
|
|
895
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
896
|
+
"div",
|
|
897
|
+
{
|
|
898
|
+
className: "border-border flex flex-col gap-1 rounded-md border p-2",
|
|
899
|
+
children: [
|
|
900
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
901
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground flex items-center gap-1 text-xs", children: [
|
|
902
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-3 animate-spin", "aria-hidden": true }),
|
|
903
|
+
progress ?? "Verifying\u2026"
|
|
904
|
+
] }),
|
|
905
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground text-xs", children: [
|
|
906
|
+
record.quote_currency_amount ?? "?",
|
|
907
|
+
" ",
|
|
908
|
+
displaySymbol
|
|
909
|
+
] })
|
|
910
|
+
] }),
|
|
911
|
+
rowError?.id === record.transaction_id && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-xs", children: rowError.message }),
|
|
912
|
+
showRetry && /* @__PURE__ */ jsxRuntime.jsx(
|
|
913
|
+
chunkCRJNDCDT_cjs.Button,
|
|
914
|
+
{
|
|
915
|
+
type: "button",
|
|
916
|
+
variant: "outline",
|
|
917
|
+
size: "sm",
|
|
918
|
+
onClick: async () => {
|
|
919
|
+
setRowError(null);
|
|
920
|
+
try {
|
|
921
|
+
await finishPendingVerification(record);
|
|
922
|
+
} catch (err) {
|
|
923
|
+
setRowError({
|
|
924
|
+
id: record.transaction_id,
|
|
925
|
+
message: err instanceof Error ? err.message : "Verification failed"
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
},
|
|
929
|
+
children: "Retry"
|
|
930
|
+
}
|
|
931
|
+
)
|
|
932
|
+
]
|
|
933
|
+
},
|
|
934
|
+
record.transaction_id
|
|
935
|
+
);
|
|
936
|
+
})
|
|
819
937
|
] }),
|
|
820
938
|
visible && depositAddress && activeIntentId && /* @__PURE__ */ jsxRuntime.jsx(
|
|
821
939
|
moonpayReact.MoonPayBuyWidget,
|
|
822
940
|
{
|
|
823
|
-
variant
|
|
941
|
+
variant,
|
|
824
942
|
visible: true,
|
|
943
|
+
theme,
|
|
944
|
+
themeId,
|
|
945
|
+
colorCode,
|
|
946
|
+
overlayNode,
|
|
825
947
|
baseCurrencyCode,
|
|
826
948
|
baseCurrencyAmount: defaultBaseCurrencyAmount,
|
|
949
|
+
lockAmount: lockAmount ? "true" : void 0,
|
|
950
|
+
paymentMethod,
|
|
827
951
|
currencyCode,
|
|
828
952
|
walletAddress: depositAddress,
|
|
829
953
|
externalCustomerId: address?.toLowerCase(),
|
|
@@ -838,21 +962,17 @@ function FiatOnRampForm({
|
|
|
838
962
|
)
|
|
839
963
|
] });
|
|
840
964
|
}
|
|
841
|
-
function
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
return "Failed";
|
|
853
|
-
default:
|
|
854
|
-
return "";
|
|
855
|
-
}
|
|
965
|
+
function parseFinalityProgress(message) {
|
|
966
|
+
if (!message) return null;
|
|
967
|
+
const match = message.match(/(\d+\/\d+)\s+confirmations/i);
|
|
968
|
+
return match ? `${match[1]} confirmations` : null;
|
|
969
|
+
}
|
|
970
|
+
function buildOverlayNode() {
|
|
971
|
+
if (typeof document === "undefined") return void 0;
|
|
972
|
+
const wrap = document.createElement("div");
|
|
973
|
+
wrap.style.cssText = "display:flex;flex-direction:column;align-items:center;gap:12px";
|
|
974
|
+
wrap.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="139" height="20.61" viewBox="0 0 139 20.61"><path d="M15.08,20.61L10.49,20.61L10.49,0.00L17.96,0.00L18.81,0.02L19.62,0.10L20.38,0.22L21.11,0.39L21.79,0.60L22.43,0.87L23.03,1.18L23.58,1.53L24.08,1.92L24.53,2.35L24.93,2.82L25.29,3.33L25.59,3.88L25.84,4.47L26.03,5.09L26.17,5.75L26.25,6.44L26.28,7.17L26.28,7.17L26.28,7.62L26.25,8.33L26.17,9.01L26.03,9.66L25.84,10.27L25.59,10.86L25.29,11.41L24.93,11.93L24.53,12.40L24.08,12.83L23.58,13.23L23.03,13.58L22.43,13.89L21.79,14.15L21.11,14.37L20.38,14.54L19.62,14.66L18.81,14.73L17.96,14.76L17.96,14.76L15.08,14.76L15.08,20.61ZM18.19,3.98L15.08,3.98L15.08,10.78L18.19,10.78L18.53,10.77L18.87,10.73L19.18,10.68L19.48,10.59L19.76,10.49L20.02,10.36L20.27,10.21L20.50,10.04L20.70,9.85L20.89,9.64L21.06,9.42L21.21,9.17L21.34,8.91L21.45,8.63L21.53,8.34L21.59,8.04L21.62,7.72L21.63,7.39L21.63,7.39L21.62,7.05L21.59,6.72L21.53,6.40L21.45,6.10L21.34,5.82L21.21,5.56L21.06,5.31L20.89,5.09L20.70,4.88L20.50,4.69L20.27,4.53L20.02,4.38L19.76,4.26L19.48,4.16L19.18,4.08L18.87,4.02L18.53,3.99L18.19,3.98L18.19,3.98ZM31.76,20.61L27.16,20.61L27.16,0.00L35.20,0.00L36.03,0.02L36.82,0.09L37.58,0.19L38.30,0.34L38.98,0.53L39.62,0.77L40.23,1.05L40.78,1.37L41.28,1.73L41.74,2.13L42.15,2.57L42.51,3.05L42.82,3.58L43.07,4.15L43.26,4.76L43.40,5.42L43.49,6.12L43.52,6.86L43.52,6.86L43.52,7.31L43.49,8.04L43.40,8.73L43.26,9.38L43.07,9.98L42.82,10.54L42.51,11.06L42.51,11.06L42.15,11.53L41.75,11.97L41.30,12.36L40.80,12.72L40.26,13.03L39.68,13.30L39.68,13.30L44.89,20.61L39.57,20.61L35.12,14.06L31.76,14.06L31.76,20.61ZM35.56,3.89L31.76,3.89L31.76,10.44L35.56,10.44L35.89,10.43L36.21,10.40L36.51,10.34L36.79,10.26L37.06,10.16L37.31,10.04L37.55,9.89L37.77,9.73L37.97,9.55L38.15,9.35L38.32,9.13L38.46,8.89L38.59,8.64L38.69,8.37L38.77,8.09L38.82,7.79L38.86,7.49L38.87,7.17L38.86,6.85L38.82,6.54L38.77,6.25L38.69,5.97L38.59,5.70L38.46,5.45L38.32,5.21L38.15,4.99L37.97,4.79L37.77,4.61L37.55,4.44L37.31,4.30L37.06,4.17L36.79,4.07L36.51,3.99L36.21,3.94L35.89,3.90L35.56,3.89L35.56,3.89ZM50.25,20.61L45.66,20.61L45.66,0.17L50.25,0.17L50.25,20.61ZM64.88,20.61L57.41,20.61L51.19,0.17L55.92,0.17L60.71,16.88L61.66,16.88L66.09,0.17L70.68,0.17L64.88,20.61ZM71.44,20.61L66.85,20.61L73.60,0.17L81.02,0.17L88.02,20.61L83.26,20.61L81.61,15.54L73.07,15.54L71.44,20.61ZM74.27,11.73L80.35,11.73L77.80,3.92L76.76,3.92L74.27,11.73ZM92.94,20.61L88.68,20.61L88.68,0.17L96.21,0.17L103.91,16.88L104.30,16.88L104.30,0.17L108.62,0.17L108.62,20.61L101.03,20.61L93.33,3.89L92.94,3.89L92.94,20.61ZM113.87,20.61L109.28,20.61L116.02,0.17L123.44,0.17L130.44,20.61L125.68,20.61L124.03,15.54L115.49,15.54L113.87,20.61ZM116.70,11.73L122.77,11.73L120.22,3.92L119.19,3.92L116.70,11.73Z" fill="#ffffff"/></svg><span>Your secure checkout is loading</span>`;
|
|
975
|
+
return wrap;
|
|
856
976
|
}
|
|
857
977
|
|
|
858
978
|
exports.FiatOnRampForm = FiatOnRampForm;
|