@oasisprotocol/privana-sdk 0.5.6 → 0.5.8
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 +88 -7
- package/dist/{chunk-TNR7AA52.cjs → chunk-EXFISDHQ.cjs} +1241 -101
- package/dist/chunk-EXFISDHQ.cjs.map +1 -0
- package/dist/{chunk-DLGIPF4N.js → chunk-ONXJGUOH.js} +1233 -103
- package/dist/chunk-ONXJGUOH.js.map +1 -0
- package/dist/index.cjs +781 -305
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +13 -5
- package/dist/index.d.ts +13 -5
- package/dist/index.js +545 -69
- package/dist/index.js.map +1 -1
- package/dist/on-ramp.cjs +11 -3
- package/dist/on-ramp.d.cts +61 -7
- package/dist/on-ramp.d.ts +61 -7
- package/dist/on-ramp.js +1 -1
- package/dist/{pending-lock-BIMYw4gd.d.cts → pending-lock-DIL2jCaT.d.cts} +33 -1
- package/dist/{pending-lock-BIMYw4gd.d.ts → pending-lock-DIL2jCaT.d.ts} +33 -1
- package/package.json +1 -1
- package/dist/chunk-DLGIPF4N.js.map +0 -1
- package/dist/chunk-TNR7AA52.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkEXFISDHQ_cjs = require('./chunk-EXFISDHQ.cjs');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var reactQuery = require('@tanstack/react-query');
|
|
7
7
|
var wagmi = require('wagmi');
|
|
@@ -35,18 +35,18 @@ var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive)
|
|
|
35
35
|
|
|
36
36
|
// src/sdk/hooks/use-privana-client.ts
|
|
37
37
|
function usePrivanaClient() {
|
|
38
|
-
const { client } =
|
|
38
|
+
const { client } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
39
39
|
return client;
|
|
40
40
|
}
|
|
41
41
|
var hostedAuthExchangeInflight = /* @__PURE__ */ new Map();
|
|
42
42
|
function normalizeHostedAuthError(error) {
|
|
43
|
-
if (error instanceof
|
|
44
|
-
return new
|
|
43
|
+
if (error instanceof chunkEXFISDHQ_cjs.AccountingApiError && error.detail) {
|
|
44
|
+
return new chunkEXFISDHQ_cjs.HostedAuthError(error.detail);
|
|
45
45
|
}
|
|
46
46
|
if (error instanceof Error) {
|
|
47
47
|
return error;
|
|
48
48
|
}
|
|
49
|
-
return new
|
|
49
|
+
return new chunkEXFISDHQ_cjs.HostedAuthError("Hosted authentication failed.");
|
|
50
50
|
}
|
|
51
51
|
function useHostedRedirectAuth() {
|
|
52
52
|
const {
|
|
@@ -57,30 +57,30 @@ function useHostedRedirectAuth() {
|
|
|
57
57
|
setHostedAuthSession,
|
|
58
58
|
clearHostedAuthSession,
|
|
59
59
|
refreshHostedAuthSession
|
|
60
|
-
} =
|
|
60
|
+
} = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
61
61
|
const [error, setError] = react.useState(null);
|
|
62
62
|
const [isLoading, setIsLoading] = react.useState(false);
|
|
63
63
|
const loginInflight = react.useRef(null);
|
|
64
64
|
const completionInflight = react.useRef(null);
|
|
65
65
|
const pendingStorageKey = react.useMemo(
|
|
66
|
-
() => hostedAuthConfig ?
|
|
66
|
+
() => hostedAuthConfig ? chunkEXFISDHQ_cjs.createHostedAuthPendingStorageKey(client.getBaseUrl(), hostedAuthConfig) : null,
|
|
67
67
|
[client, hostedAuthConfig]
|
|
68
68
|
);
|
|
69
69
|
const clearPendingLogin = react.useCallback(() => {
|
|
70
70
|
if (!pendingStorageKey || typeof window === "undefined") return;
|
|
71
|
-
|
|
71
|
+
chunkEXFISDHQ_cjs.clearHostedAuthPendingTransaction(window.sessionStorage, pendingStorageKey);
|
|
72
72
|
}, [pendingStorageKey]);
|
|
73
73
|
const login = react.useCallback(async () => {
|
|
74
74
|
if (!hostedAuthConfig) {
|
|
75
|
-
throw new
|
|
75
|
+
throw new chunkEXFISDHQ_cjs.HostedAuthRequiredError(
|
|
76
76
|
"Hosted redirect authentication is not configured for this provider."
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
if (typeof window === "undefined") {
|
|
80
|
-
throw new
|
|
80
|
+
throw new chunkEXFISDHQ_cjs.HostedAuthError("Hosted redirect authentication requires a browser environment.");
|
|
81
81
|
}
|
|
82
82
|
if (!pendingStorageKey) {
|
|
83
|
-
throw new
|
|
83
|
+
throw new chunkEXFISDHQ_cjs.HostedAuthError("Hosted redirect authentication storage is not configured.");
|
|
84
84
|
}
|
|
85
85
|
if (loginInflight.current) {
|
|
86
86
|
return loginInflight.current;
|
|
@@ -89,10 +89,10 @@ function useHostedRedirectAuth() {
|
|
|
89
89
|
setIsLoading(true);
|
|
90
90
|
setError(null);
|
|
91
91
|
try {
|
|
92
|
-
const verifier =
|
|
93
|
-
const codeChallenge = await
|
|
94
|
-
const state =
|
|
95
|
-
|
|
92
|
+
const verifier = chunkEXFISDHQ_cjs.createPkceVerifier();
|
|
93
|
+
const codeChallenge = await chunkEXFISDHQ_cjs.createPkceChallenge(verifier);
|
|
94
|
+
const state = chunkEXFISDHQ_cjs.createHostedAuthState();
|
|
95
|
+
chunkEXFISDHQ_cjs.persistHostedAuthPendingTransaction(window.sessionStorage, pendingStorageKey, {
|
|
96
96
|
codeVerifier: verifier,
|
|
97
97
|
state
|
|
98
98
|
});
|
|
@@ -121,15 +121,15 @@ function useHostedRedirectAuth() {
|
|
|
121
121
|
}, [clearPendingLogin, client, hostedAuthConfig, networkConfig.chainId, pendingStorageKey]);
|
|
122
122
|
const completeLogin = react.useCallback(async () => {
|
|
123
123
|
if (!hostedAuthConfig) {
|
|
124
|
-
throw new
|
|
124
|
+
throw new chunkEXFISDHQ_cjs.HostedAuthRequiredError(
|
|
125
125
|
"Hosted redirect authentication is not configured for this provider."
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
128
|
if (typeof window === "undefined") {
|
|
129
|
-
throw new
|
|
129
|
+
throw new chunkEXFISDHQ_cjs.HostedAuthError("Hosted redirect authentication requires a browser environment.");
|
|
130
130
|
}
|
|
131
131
|
if (!pendingStorageKey) {
|
|
132
|
-
throw new
|
|
132
|
+
throw new chunkEXFISDHQ_cjs.HostedAuthError("Hosted redirect authentication storage is not configured.");
|
|
133
133
|
}
|
|
134
134
|
if (completionInflight.current) {
|
|
135
135
|
return completionInflight.current;
|
|
@@ -139,30 +139,30 @@ function useHostedRedirectAuth() {
|
|
|
139
139
|
setError(null);
|
|
140
140
|
const callbackUrl = new URL(window.location.href);
|
|
141
141
|
const cleanupCallbackUrl = () => {
|
|
142
|
-
window.history.replaceState(null, "",
|
|
142
|
+
window.history.replaceState(null, "", chunkEXFISDHQ_cjs.stripHostedAuthCallbackParams(callbackUrl));
|
|
143
143
|
};
|
|
144
144
|
try {
|
|
145
|
-
const callback =
|
|
145
|
+
const callback = chunkEXFISDHQ_cjs.parseHostedAuthCallback(callbackUrl, hostedAuthConfig.redirectUri);
|
|
146
146
|
if (!callback) {
|
|
147
147
|
return null;
|
|
148
148
|
}
|
|
149
|
-
const pending =
|
|
149
|
+
const pending = chunkEXFISDHQ_cjs.readHostedAuthPendingTransaction(window.sessionStorage, pendingStorageKey);
|
|
150
150
|
if (!pending) {
|
|
151
151
|
clearPendingLogin();
|
|
152
152
|
cleanupCallbackUrl();
|
|
153
|
-
throw new
|
|
153
|
+
throw new chunkEXFISDHQ_cjs.HostedAuthError(
|
|
154
154
|
"Hosted authentication response could not be matched to a pending login request."
|
|
155
155
|
);
|
|
156
156
|
}
|
|
157
157
|
if (!callback.state || callback.state !== pending.state) {
|
|
158
158
|
clearPendingLogin();
|
|
159
159
|
cleanupCallbackUrl();
|
|
160
|
-
throw new
|
|
160
|
+
throw new chunkEXFISDHQ_cjs.HostedAuthStateMismatchError();
|
|
161
161
|
}
|
|
162
162
|
if ("error" in callback) {
|
|
163
163
|
clearPendingLogin();
|
|
164
164
|
cleanupCallbackUrl();
|
|
165
|
-
throw new
|
|
165
|
+
throw new chunkEXFISDHQ_cjs.HostedAuthError(
|
|
166
166
|
callback.errorDescription || callback.error || "Hosted authentication failed."
|
|
167
167
|
);
|
|
168
168
|
}
|
|
@@ -177,7 +177,7 @@ function useHostedRedirectAuth() {
|
|
|
177
177
|
client_id: hostedAuthConfig.clientId,
|
|
178
178
|
redirect_uri: hostedAuthConfig.redirectUri
|
|
179
179
|
});
|
|
180
|
-
const session =
|
|
180
|
+
const session = chunkEXFISDHQ_cjs.buildHostedAuthSession(response, hostedAuthConfig);
|
|
181
181
|
setHostedAuthSession(session);
|
|
182
182
|
clearPendingLogin();
|
|
183
183
|
cleanupCallbackUrl();
|
|
@@ -222,7 +222,7 @@ function useHostedRedirectAuth() {
|
|
|
222
222
|
try {
|
|
223
223
|
return await refreshHostedAuthSession();
|
|
224
224
|
} catch (refreshError) {
|
|
225
|
-
const normalizedError = refreshError instanceof Error ? refreshError : new
|
|
225
|
+
const normalizedError = refreshError instanceof Error ? refreshError : new chunkEXFISDHQ_cjs.HostedAuthError("Hosted authentication refresh failed.");
|
|
226
226
|
setError(normalizedError);
|
|
227
227
|
throw normalizedError;
|
|
228
228
|
} finally {
|
|
@@ -242,12 +242,12 @@ function useHostedRedirectAuth() {
|
|
|
242
242
|
}
|
|
243
243
|
function useBalance(options = {}) {
|
|
244
244
|
const queryClient = react.useContext(reactQuery.QueryClientContext);
|
|
245
|
-
const accountingContext =
|
|
245
|
+
const accountingContext = chunkEXFISDHQ_cjs.useSafePrivanaContext();
|
|
246
246
|
const hasProviders = !!queryClient && !!accountingContext;
|
|
247
247
|
const client = accountingContext?.client;
|
|
248
248
|
const defaultToken = accountingContext?.defaultToken;
|
|
249
249
|
const pollingInterval = accountingContext?.pollingInterval ?? 1e4;
|
|
250
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
250
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkEXFISDHQ_cjs.usePrivateReadRequest();
|
|
251
251
|
const tokenId = options.tokenId ?? defaultToken?.id;
|
|
252
252
|
const query = reactQuery.useQuery({
|
|
253
253
|
queryKey: ["accounting-balance", ...privateReadQueryScope, tokenId],
|
|
@@ -264,7 +264,7 @@ function useBalance(options = {}) {
|
|
|
264
264
|
return {
|
|
265
265
|
balance: balanceWei,
|
|
266
266
|
balanceWei,
|
|
267
|
-
balanceFormatted:
|
|
267
|
+
balanceFormatted: chunkEXFISDHQ_cjs.formatTokenAmount(balanceWei),
|
|
268
268
|
tokenSymbol: query.data?.token_symbol ?? "",
|
|
269
269
|
chainId: query.data?.chain_id ?? "",
|
|
270
270
|
isLoading: query.isPending || query.isLoading,
|
|
@@ -274,8 +274,8 @@ function useBalance(options = {}) {
|
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
276
|
function useBatchBalances(options) {
|
|
277
|
-
const { client, pollingInterval } =
|
|
278
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
277
|
+
const { client, pollingInterval } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
278
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkEXFISDHQ_cjs.usePrivateReadRequest();
|
|
279
279
|
const query = reactQuery.useQuery({
|
|
280
280
|
queryKey: ["accounting-batch-balances", ...privateReadQueryScope, options.tokenIds],
|
|
281
281
|
queryFn: async () => {
|
|
@@ -307,17 +307,17 @@ function storageKey(address) {
|
|
|
307
307
|
return `privana:pending-deposit:${address.toLowerCase()}`;
|
|
308
308
|
}
|
|
309
309
|
function savePendingDeposit(address, data) {
|
|
310
|
-
const stored =
|
|
310
|
+
const stored = chunkEXFISDHQ_cjs.setBrowserStorageItem(storageKey(address), JSON.stringify(data));
|
|
311
311
|
if (!stored && data.signedLock) {
|
|
312
312
|
throw new Error("Unable to persist pending locked deposit for recovery");
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
function loadPendingDeposit(address) {
|
|
316
316
|
try {
|
|
317
|
-
const raw =
|
|
317
|
+
const raw = chunkEXFISDHQ_cjs.getBrowserStorageItem(storageKey(address));
|
|
318
318
|
if (!raw) return null;
|
|
319
319
|
const data = JSON.parse(raw);
|
|
320
|
-
if (Date.now() - data.savedAt > STALE_MS && !(data.signedLock &&
|
|
320
|
+
if (Date.now() - data.savedAt > STALE_MS && !(data.signedLock && chunkEXFISDHQ_cjs.isSignedLockUsable(data.signedLock))) {
|
|
321
321
|
clearPendingDeposit(address);
|
|
322
322
|
return null;
|
|
323
323
|
}
|
|
@@ -329,21 +329,21 @@ function loadPendingDeposit(address) {
|
|
|
329
329
|
function clearPendingDeposit(address, onlyForTxHash) {
|
|
330
330
|
if (onlyForTxHash) {
|
|
331
331
|
try {
|
|
332
|
-
const raw =
|
|
332
|
+
const raw = chunkEXFISDHQ_cjs.getBrowserStorageItem(storageKey(address));
|
|
333
333
|
const recordTxHash = raw ? JSON.parse(raw).txHash : void 0;
|
|
334
334
|
if (recordTxHash && recordTxHash !== onlyForTxHash) return;
|
|
335
335
|
} catch {
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
|
-
|
|
338
|
+
chunkEXFISDHQ_cjs.removeBrowserStorageItem(storageKey(address));
|
|
339
339
|
}
|
|
340
340
|
function useDeposit(options = {}) {
|
|
341
341
|
const { address } = wagmi.useAccount();
|
|
342
|
-
const { client, enabledTokens, getChainById: getChainById2, networkConfig, serviceAddress } =
|
|
342
|
+
const { client, enabledTokens, getChainById: getChainById2, networkConfig, serviceAddress } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
343
343
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
344
344
|
const queryClient = reactQuery.useQueryClient();
|
|
345
345
|
const config = wagmi.useConfig();
|
|
346
|
-
const { executePrivateRead, privateReadAddress } =
|
|
346
|
+
const { executePrivateRead, privateReadAddress } = chunkEXFISDHQ_cjs.usePrivateReadRequest();
|
|
347
347
|
const privateReadAddressRef = react.useRef(privateReadAddress);
|
|
348
348
|
privateReadAddressRef.current = privateReadAddress;
|
|
349
349
|
const [depositAddress, setDepositAddress] = react.useState(null);
|
|
@@ -382,7 +382,7 @@ function useDeposit(options = {}) {
|
|
|
382
382
|
const submitPendingLockAfterCredit = react.useCallback(
|
|
383
383
|
async (signedLock, creditedAmount) => {
|
|
384
384
|
try {
|
|
385
|
-
const result = await
|
|
385
|
+
const result = await chunkEXFISDHQ_cjs.submitPendingLock({
|
|
386
386
|
client,
|
|
387
387
|
payload: signedLock,
|
|
388
388
|
creditedAmount
|
|
@@ -393,7 +393,7 @@ function useDeposit(options = {}) {
|
|
|
393
393
|
queryClient.invalidateQueries({ queryKey: ["accounting-history"] });
|
|
394
394
|
onLockSubmittedRef.current?.(result);
|
|
395
395
|
} catch (err) {
|
|
396
|
-
const error2 = err instanceof
|
|
396
|
+
const error2 = err instanceof chunkEXFISDHQ_cjs.PostDepositLockError ? err : new chunkEXFISDHQ_cjs.PostDepositLockError(
|
|
397
397
|
err instanceof Error ? err.message : "Lock submission failed",
|
|
398
398
|
"submission-failed",
|
|
399
399
|
BigInt(signedLock.amount),
|
|
@@ -412,7 +412,7 @@ function useDeposit(options = {}) {
|
|
|
412
412
|
error: verificationError,
|
|
413
413
|
verify,
|
|
414
414
|
reset: resetVerification
|
|
415
|
-
} =
|
|
415
|
+
} = chunkEXFISDHQ_cjs.useDepositVerification({
|
|
416
416
|
pollInterval: options.pollInterval,
|
|
417
417
|
pollTimeout: options.pollTimeout,
|
|
418
418
|
onCredited: (hash, response, creditedAmount) => {
|
|
@@ -462,7 +462,7 @@ function useDeposit(options = {}) {
|
|
|
462
462
|
} = wagmi.useSendTransaction();
|
|
463
463
|
const isSendingTx = isWritingContract || isSendingNative;
|
|
464
464
|
const sendError = writeError ?? sendNativeError;
|
|
465
|
-
const { ensureCorrectChain } =
|
|
465
|
+
const { ensureCorrectChain } = chunkEXFISDHQ_cjs.useEnsureCorrectChain();
|
|
466
466
|
const invalidateGeneration = react.useCallback(() => {
|
|
467
467
|
generationRef.current++;
|
|
468
468
|
}, []);
|
|
@@ -511,16 +511,16 @@ function useDeposit(options = {}) {
|
|
|
511
511
|
const confirmations = resolveConfirmations(persisted.depositAddress, persisted.chainId);
|
|
512
512
|
let confirmed = false;
|
|
513
513
|
try {
|
|
514
|
-
const receipt = await
|
|
514
|
+
const receipt = await chunkEXFISDHQ_cjs.getTransactionReceipt(config, {
|
|
515
515
|
hash,
|
|
516
516
|
chainId: persisted.chainId
|
|
517
517
|
});
|
|
518
|
-
const blockNumber = await
|
|
518
|
+
const blockNumber = await chunkEXFISDHQ_cjs.getBlockNumber(config, { chainId: persisted.chainId });
|
|
519
519
|
confirmed = blockNumber - receipt.blockNumber + 1n >= BigInt(confirmations);
|
|
520
520
|
} catch {
|
|
521
521
|
}
|
|
522
522
|
if (!confirmed) {
|
|
523
|
-
await
|
|
523
|
+
await chunkEXFISDHQ_cjs.waitForTransactionReceipt(config, {
|
|
524
524
|
hash,
|
|
525
525
|
chainId: persisted.chainId,
|
|
526
526
|
confirmations
|
|
@@ -572,13 +572,13 @@ function useDeposit(options = {}) {
|
|
|
572
572
|
);
|
|
573
573
|
}
|
|
574
574
|
const confirmations = resolveConfirmations(addrResponse, sourceChain.id);
|
|
575
|
-
if (params.postDepositLock && !
|
|
575
|
+
if (params.postDepositLock && !chunkEXFISDHQ_cjs.canUseBrowserStorage()) {
|
|
576
576
|
throw new Error("Browser storage is required for locked deposit recovery");
|
|
577
577
|
}
|
|
578
|
-
const lockAmount =
|
|
578
|
+
const lockAmount = chunkEXFISDHQ_cjs.clampLockAmount(params.amount, params.postDepositLock?.maxAmount);
|
|
579
579
|
let signedLock;
|
|
580
580
|
if (params.postDepositLock) {
|
|
581
|
-
const lockOwner =
|
|
581
|
+
const lockOwner = chunkEXFISDHQ_cjs.requireDepositLockOwner(address, privateReadAddress);
|
|
582
582
|
setIsSwitchingChain(true);
|
|
583
583
|
try {
|
|
584
584
|
await ensureCorrectChain(networkConfig.chainId);
|
|
@@ -586,15 +586,15 @@ function useDeposit(options = {}) {
|
|
|
586
586
|
if (!isStale()) setIsSwitchingChain(false);
|
|
587
587
|
}
|
|
588
588
|
if (isStale()) return;
|
|
589
|
-
const signingWalletClient = await
|
|
589
|
+
const signingWalletClient = await chunkEXFISDHQ_cjs.getWalletClient(config, {
|
|
590
590
|
chainId: networkConfig.chainId
|
|
591
591
|
});
|
|
592
|
-
signedLock = await
|
|
592
|
+
signedLock = await chunkEXFISDHQ_cjs.createSignedLockRequest({
|
|
593
593
|
client,
|
|
594
594
|
walletClient: signingWalletClient,
|
|
595
595
|
userAddress: lockOwner,
|
|
596
596
|
networkConfig,
|
|
597
|
-
serviceAddress:
|
|
597
|
+
serviceAddress: chunkEXFISDHQ_cjs.requireServiceAddress(
|
|
598
598
|
params.postDepositLock.serviceAddress ?? serviceAddress
|
|
599
599
|
),
|
|
600
600
|
tokenId: params.tokenId,
|
|
@@ -648,7 +648,7 @@ function useDeposit(options = {}) {
|
|
|
648
648
|
try {
|
|
649
649
|
setIsWaitingForConfirmation(true);
|
|
650
650
|
try {
|
|
651
|
-
await
|
|
651
|
+
await chunkEXFISDHQ_cjs.waitForTransactionReceipt(config, {
|
|
652
652
|
hash,
|
|
653
653
|
chainId: sourceChain.id,
|
|
654
654
|
confirmations
|
|
@@ -724,10 +724,10 @@ function useDeposit(options = {}) {
|
|
|
724
724
|
}
|
|
725
725
|
function useDepositAddress(options = {}) {
|
|
726
726
|
const queryClient = react.useContext(reactQuery.QueryClientContext);
|
|
727
|
-
const accountingContext =
|
|
727
|
+
const accountingContext = chunkEXFISDHQ_cjs.useSafePrivanaContext();
|
|
728
728
|
const hasProviders = !!queryClient && !!accountingContext;
|
|
729
729
|
const client = accountingContext?.client;
|
|
730
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
730
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkEXFISDHQ_cjs.usePrivateReadRequest();
|
|
731
731
|
const isReady = hasProviders && privateReadReady && !!privateReadAddress && !!client;
|
|
732
732
|
const query = reactQuery.useQuery({
|
|
733
733
|
queryKey: ["accounting-deposit-address", ...privateReadQueryScope],
|
|
@@ -751,9 +751,9 @@ function useDepositAddress(options = {}) {
|
|
|
751
751
|
function useWithdraw(options = {}) {
|
|
752
752
|
const { address } = wagmi.useAccount();
|
|
753
753
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
754
|
-
const { client, networkConfig } =
|
|
754
|
+
const { client, networkConfig } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
755
755
|
const queryClient = reactQuery.useQueryClient();
|
|
756
|
-
const { chainId, ensureCorrectChain } =
|
|
756
|
+
const { chainId, ensureCorrectChain } = chunkEXFISDHQ_cjs.useEnsureCorrectChain();
|
|
757
757
|
const pollInterval = options.pollInterval ?? 3e3;
|
|
758
758
|
const pollTimeout = options.pollTimeout ?? 18e4;
|
|
759
759
|
const [currentStep, setCurrentStep] = react.useState("idle");
|
|
@@ -821,7 +821,7 @@ function useWithdraw(options = {}) {
|
|
|
821
821
|
if (isStale()) return void 0;
|
|
822
822
|
const nonce = BigInt(nonceResponse.nonce);
|
|
823
823
|
setCurrentStep("signing");
|
|
824
|
-
const signature = await
|
|
824
|
+
const signature = await chunkEXFISDHQ_cjs.signWithdrawMessage({
|
|
825
825
|
walletClient,
|
|
826
826
|
chainId: signingChainId,
|
|
827
827
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -950,7 +950,7 @@ function useWithdraw(options = {}) {
|
|
|
950
950
|
function useLockFunds(options = {}) {
|
|
951
951
|
const { address } = wagmi.useAccount();
|
|
952
952
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
953
|
-
const { client, networkConfig, serviceAddress } =
|
|
953
|
+
const { client, networkConfig, serviceAddress } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
954
954
|
const queryClient = reactQuery.useQueryClient();
|
|
955
955
|
const mutation = reactQuery.useMutation({
|
|
956
956
|
mutationFn: async (params) => {
|
|
@@ -961,7 +961,7 @@ function useLockFunds(options = {}) {
|
|
|
961
961
|
throw new Error("Service address not configured");
|
|
962
962
|
}
|
|
963
963
|
const { nonce } = await client.getLockNonce(address);
|
|
964
|
-
const signature = await
|
|
964
|
+
const signature = await chunkEXFISDHQ_cjs.signLockMessage({
|
|
965
965
|
walletClient,
|
|
966
966
|
chainId: networkConfig.chainId,
|
|
967
967
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1009,7 +1009,7 @@ function useLockFunds(options = {}) {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
function useUnlockFunds(options = {}) {
|
|
1011
1011
|
const { address } = wagmi.useAccount();
|
|
1012
|
-
const { client } =
|
|
1012
|
+
const { client } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
1013
1013
|
const queryClient = reactQuery.useQueryClient();
|
|
1014
1014
|
const unlockMutation = reactQuery.useMutation({
|
|
1015
1015
|
mutationFn: async (params) => {
|
|
@@ -1079,7 +1079,7 @@ function useUnlockFunds(options = {}) {
|
|
|
1079
1079
|
function useTransfer(options = {}) {
|
|
1080
1080
|
const { address } = wagmi.useAccount();
|
|
1081
1081
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
1082
|
-
const { client, networkConfig, serviceAddress } =
|
|
1082
|
+
const { client, networkConfig, serviceAddress } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
1083
1083
|
const queryClient = reactQuery.useQueryClient();
|
|
1084
1084
|
const transferMutation = reactQuery.useMutation({
|
|
1085
1085
|
mutationFn: async (params) => {
|
|
@@ -1087,7 +1087,7 @@ function useTransfer(options = {}) {
|
|
|
1087
1087
|
throw new Error("Wallet not connected");
|
|
1088
1088
|
}
|
|
1089
1089
|
const { nonce } = await client.getTransferNonce(address);
|
|
1090
|
-
const signature = await
|
|
1090
|
+
const signature = await chunkEXFISDHQ_cjs.signTransferMessage({
|
|
1091
1091
|
walletClient,
|
|
1092
1092
|
chainId: networkConfig.chainId,
|
|
1093
1093
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1124,7 +1124,7 @@ function useTransfer(options = {}) {
|
|
|
1124
1124
|
throw new Error("Service address not configured");
|
|
1125
1125
|
}
|
|
1126
1126
|
const { nonce } = await client.getTransferLockedNonce(serviceAddress);
|
|
1127
|
-
const signature = await
|
|
1127
|
+
const signature = await chunkEXFISDHQ_cjs.signTransferLockedMessage({
|
|
1128
1128
|
walletClient,
|
|
1129
1129
|
chainId: networkConfig.chainId,
|
|
1130
1130
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1184,8 +1184,8 @@ function useTransfer(options = {}) {
|
|
|
1184
1184
|
};
|
|
1185
1185
|
}
|
|
1186
1186
|
function useLockedFunds(options = {}) {
|
|
1187
|
-
const { client, pollingInterval, serviceAddress } =
|
|
1188
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1187
|
+
const { client, pollingInterval, serviceAddress } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
1188
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkEXFISDHQ_cjs.usePrivateReadRequest();
|
|
1189
1189
|
const query = reactQuery.useQuery({
|
|
1190
1190
|
queryKey: ["accounting-locked-funds", ...privateReadQueryScope, serviceAddress ?? null],
|
|
1191
1191
|
queryFn: async () => {
|
|
@@ -1207,8 +1207,8 @@ function useLockedFunds(options = {}) {
|
|
|
1207
1207
|
};
|
|
1208
1208
|
}
|
|
1209
1209
|
function useTotalLockedBalance(options = {}) {
|
|
1210
|
-
const { client, pollingInterval, defaultToken } =
|
|
1211
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1210
|
+
const { client, pollingInterval, defaultToken } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
1211
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkEXFISDHQ_cjs.usePrivateReadRequest();
|
|
1212
1212
|
const tokenId = options.tokenId ?? defaultToken?.id;
|
|
1213
1213
|
const query = reactQuery.useQuery({
|
|
1214
1214
|
queryKey: ["accounting-total-locked-balance", ...privateReadQueryScope, tokenId],
|
|
@@ -1229,8 +1229,8 @@ function useTotalLockedBalance(options = {}) {
|
|
|
1229
1229
|
};
|
|
1230
1230
|
}
|
|
1231
1231
|
function useExpiredLocks(options = {}) {
|
|
1232
|
-
const { client, pollingInterval } =
|
|
1233
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1232
|
+
const { client, pollingInterval } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
1233
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkEXFISDHQ_cjs.usePrivateReadRequest();
|
|
1234
1234
|
const query = reactQuery.useQuery({
|
|
1235
1235
|
queryKey: ["accounting-expired-locks", ...privateReadQueryScope],
|
|
1236
1236
|
queryFn: async () => {
|
|
@@ -1251,14 +1251,14 @@ function useExpiredLocks(options = {}) {
|
|
|
1251
1251
|
};
|
|
1252
1252
|
}
|
|
1253
1253
|
function statusCodeOf(error) {
|
|
1254
|
-
return error instanceof
|
|
1254
|
+
return error instanceof chunkEXFISDHQ_cjs.AccountingApiError ? error.statusCode : void 0;
|
|
1255
1255
|
}
|
|
1256
1256
|
function usePendingDeposits(options = {}) {
|
|
1257
1257
|
const queryClient = react.useContext(reactQuery.QueryClientContext);
|
|
1258
|
-
const accountingContext =
|
|
1258
|
+
const accountingContext = chunkEXFISDHQ_cjs.useSafePrivanaContext();
|
|
1259
1259
|
const hasProviders = !!queryClient && !!accountingContext;
|
|
1260
1260
|
const client = accountingContext?.client;
|
|
1261
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1261
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkEXFISDHQ_cjs.usePrivateReadRequest();
|
|
1262
1262
|
const { chainId, tokenAddress, lookbackBlocks } = options;
|
|
1263
1263
|
const query = reactQuery.useQuery({
|
|
1264
1264
|
queryKey: ["accounting-pending-deposits", ...privateReadQueryScope, chainId, tokenAddress],
|
|
@@ -1305,7 +1305,7 @@ function usePendingDeposits(options = {}) {
|
|
|
1305
1305
|
}
|
|
1306
1306
|
function usePendingWithdrawals(options = {}) {
|
|
1307
1307
|
const { address, isConnected } = wagmi.useAccount();
|
|
1308
|
-
const { client, pollingInterval } =
|
|
1308
|
+
const { client, pollingInterval } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
1309
1309
|
const query = reactQuery.useQuery({
|
|
1310
1310
|
queryKey: ["accounting-pending-withdrawals", address],
|
|
1311
1311
|
queryFn: async () => {
|
|
@@ -1341,8 +1341,8 @@ function usePendingWithdrawals(options = {}) {
|
|
|
1341
1341
|
};
|
|
1342
1342
|
}
|
|
1343
1343
|
function useHistory(options = {}) {
|
|
1344
|
-
const { client, pollingInterval } =
|
|
1345
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1344
|
+
const { client, pollingInterval } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
1345
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkEXFISDHQ_cjs.usePrivateReadRequest();
|
|
1346
1346
|
const offset = options.offset ?? -1;
|
|
1347
1347
|
const limit = options.limit ?? 50;
|
|
1348
1348
|
const query = reactQuery.useQuery({
|
|
@@ -1366,7 +1366,7 @@ function useHistory(options = {}) {
|
|
|
1366
1366
|
};
|
|
1367
1367
|
}
|
|
1368
1368
|
function useTokenInfo(options = {}) {
|
|
1369
|
-
const { client } =
|
|
1369
|
+
const { client } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
1370
1370
|
const { tokenId } = options;
|
|
1371
1371
|
const query = reactQuery.useQuery({
|
|
1372
1372
|
queryKey: ["accounting-token-info", tokenId],
|
|
@@ -1386,7 +1386,7 @@ function useTokenInfo(options = {}) {
|
|
|
1386
1386
|
};
|
|
1387
1387
|
}
|
|
1388
1388
|
function useTokenList(options = {}) {
|
|
1389
|
-
const { client } =
|
|
1389
|
+
const { client } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
1390
1390
|
const query = reactQuery.useQuery({
|
|
1391
1391
|
queryKey: ["accounting-token-list"],
|
|
1392
1392
|
queryFn: () => client.listTokens(),
|
|
@@ -1404,7 +1404,7 @@ function useTokenList(options = {}) {
|
|
|
1404
1404
|
function useModifyLock(options = {}) {
|
|
1405
1405
|
const { address } = wagmi.useAccount();
|
|
1406
1406
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
1407
|
-
const { client, networkConfig } =
|
|
1407
|
+
const { client, networkConfig } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
1408
1408
|
const queryClient = reactQuery.useQueryClient();
|
|
1409
1409
|
const mutation = reactQuery.useMutation({
|
|
1410
1410
|
mutationFn: async (params) => {
|
|
@@ -1412,7 +1412,7 @@ function useModifyLock(options = {}) {
|
|
|
1412
1412
|
throw new Error("Wallet not connected");
|
|
1413
1413
|
}
|
|
1414
1414
|
const { nonce } = await client.getModifyLockNonce(address);
|
|
1415
|
-
const signature = await
|
|
1415
|
+
const signature = await chunkEXFISDHQ_cjs.signModifyLockMessage({
|
|
1416
1416
|
walletClient,
|
|
1417
1417
|
chainId: networkConfig.chainId,
|
|
1418
1418
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1471,7 +1471,7 @@ function DialogOverlay({
|
|
|
1471
1471
|
{
|
|
1472
1472
|
"data-slot": "dialog-overlay",
|
|
1473
1473
|
"data-privana": true,
|
|
1474
|
-
className:
|
|
1474
|
+
className: chunkEXFISDHQ_cjs.cn(
|
|
1475
1475
|
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
1476
1476
|
className
|
|
1477
1477
|
),
|
|
@@ -1493,7 +1493,7 @@ function DialogContent({
|
|
|
1493
1493
|
{
|
|
1494
1494
|
"data-slot": "dialog-content",
|
|
1495
1495
|
"data-privana": true,
|
|
1496
|
-
className:
|
|
1496
|
+
className: chunkEXFISDHQ_cjs.cn(
|
|
1497
1497
|
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",
|
|
1498
1498
|
className
|
|
1499
1499
|
),
|
|
@@ -1521,7 +1521,7 @@ function DialogTitle({ className, ...props }) {
|
|
|
1521
1521
|
DialogPrimitive__namespace.Title,
|
|
1522
1522
|
{
|
|
1523
1523
|
"data-slot": "dialog-title",
|
|
1524
|
-
className:
|
|
1524
|
+
className: chunkEXFISDHQ_cjs.cn("text-lg leading-none font-semibold", className),
|
|
1525
1525
|
...props
|
|
1526
1526
|
}
|
|
1527
1527
|
);
|
|
@@ -1534,7 +1534,7 @@ function DialogDescription({
|
|
|
1534
1534
|
DialogPrimitive__namespace.Description,
|
|
1535
1535
|
{
|
|
1536
1536
|
"data-slot": "dialog-description",
|
|
1537
|
-
className:
|
|
1537
|
+
className: chunkEXFISDHQ_cjs.cn("text-muted-foreground text-sm", className),
|
|
1538
1538
|
...props
|
|
1539
1539
|
}
|
|
1540
1540
|
);
|
|
@@ -1576,7 +1576,7 @@ function sessionKey(owner, sessionId) {
|
|
|
1576
1576
|
return `${SESSION_PREFIX}${owner.toLowerCase()}:${sessionId}`;
|
|
1577
1577
|
}
|
|
1578
1578
|
function activeSessionId(owner) {
|
|
1579
|
-
const value =
|
|
1579
|
+
const value = chunkEXFISDHQ_cjs.getSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1580
1580
|
return value || void 0;
|
|
1581
1581
|
}
|
|
1582
1582
|
function isPositiveIntegerString(value) {
|
|
@@ -1608,7 +1608,7 @@ function isSessionRecord(value) {
|
|
|
1608
1608
|
}
|
|
1609
1609
|
function writeSessionRecord(session) {
|
|
1610
1610
|
const id = externalDepositSessionId(session.chainId, session.tokenId);
|
|
1611
|
-
return
|
|
1611
|
+
return chunkEXFISDHQ_cjs.setSharedBrowserStorageItem(sessionKey(session.owner, id), JSON.stringify(session));
|
|
1612
1612
|
}
|
|
1613
1613
|
function saveExternalDepositLockSession(session, expectedSession = null) {
|
|
1614
1614
|
if (!isSessionRecord(session)) throw new Error("Invalid external deposit lock session");
|
|
@@ -1622,12 +1622,12 @@ function saveExternalDepositLockSession(session, expectedSession = null) {
|
|
|
1622
1622
|
throw new Error("Unable to persist external deposit lock session");
|
|
1623
1623
|
}
|
|
1624
1624
|
if (previousId !== nextId) {
|
|
1625
|
-
if (!
|
|
1626
|
-
|
|
1625
|
+
if (!chunkEXFISDHQ_cjs.setSharedBrowserStorageItem(activeSessionKey(session.owner), nextId)) {
|
|
1626
|
+
chunkEXFISDHQ_cjs.removeSharedBrowserStorageItem(sessionKey(session.owner, nextId));
|
|
1627
1627
|
throw new Error("Unable to persist external deposit lock session");
|
|
1628
1628
|
}
|
|
1629
1629
|
if (previousId) {
|
|
1630
|
-
|
|
1630
|
+
chunkEXFISDHQ_cjs.removeSharedBrowserStorageItem(sessionKey(session.owner, previousId));
|
|
1631
1631
|
}
|
|
1632
1632
|
}
|
|
1633
1633
|
}
|
|
@@ -1636,17 +1636,17 @@ function loadExternalDepositLockSession(owner) {
|
|
|
1636
1636
|
if (!id) return void 0;
|
|
1637
1637
|
const key = sessionKey(owner, id);
|
|
1638
1638
|
try {
|
|
1639
|
-
const raw =
|
|
1639
|
+
const raw = chunkEXFISDHQ_cjs.getSharedBrowserStorageItem(key);
|
|
1640
1640
|
const parsed = raw ? JSON.parse(raw) : void 0;
|
|
1641
1641
|
if (!isSessionRecord(parsed) || parsed.owner.toLowerCase() !== owner.toLowerCase() || externalDepositSessionId(parsed.chainId, parsed.tokenId) !== id) {
|
|
1642
|
-
|
|
1643
|
-
|
|
1642
|
+
chunkEXFISDHQ_cjs.removeSharedBrowserStorageItem(key);
|
|
1643
|
+
chunkEXFISDHQ_cjs.removeSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1644
1644
|
return void 0;
|
|
1645
1645
|
}
|
|
1646
1646
|
return parsed;
|
|
1647
1647
|
} catch {
|
|
1648
|
-
|
|
1649
|
-
|
|
1648
|
+
chunkEXFISDHQ_cjs.removeSharedBrowserStorageItem(key);
|
|
1649
|
+
chunkEXFISDHQ_cjs.removeSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1650
1650
|
return void 0;
|
|
1651
1651
|
}
|
|
1652
1652
|
}
|
|
@@ -1677,8 +1677,8 @@ function clearExternalDepositLockSession(owner, expectedSessionId, expectedGener
|
|
|
1677
1677
|
const current = loadExternalDepositLockSession(owner);
|
|
1678
1678
|
if (!current || current.generation !== expectedGeneration) return;
|
|
1679
1679
|
}
|
|
1680
|
-
|
|
1681
|
-
|
|
1680
|
+
chunkEXFISDHQ_cjs.removeSharedBrowserStorageItem(sessionKey(owner, id));
|
|
1681
|
+
chunkEXFISDHQ_cjs.removeSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1682
1682
|
}
|
|
1683
1683
|
function isSameVerification(left, right) {
|
|
1684
1684
|
if (!left || !right) return left === right;
|
|
@@ -1731,7 +1731,7 @@ function markSubmissionAmbiguous(session, signature) {
|
|
|
1731
1731
|
return writeSessionRecord({ ...current, submissionAmbiguous: true });
|
|
1732
1732
|
}
|
|
1733
1733
|
function ambiguousSubmissionError(error) {
|
|
1734
|
-
return new
|
|
1734
|
+
return new chunkEXFISDHQ_cjs.PostDepositLockError(
|
|
1735
1735
|
"Lock submission could not be confirmed. Retry only the saved signature, or check locked funds before stopping recovery.",
|
|
1736
1736
|
error.reason,
|
|
1737
1737
|
error.signedAmount,
|
|
@@ -1744,7 +1744,7 @@ function ambiguousSubmissionError(error) {
|
|
|
1744
1744
|
}
|
|
1745
1745
|
function isDefinitiveSubmissionFailure(error) {
|
|
1746
1746
|
const cause = error.cause;
|
|
1747
|
-
return cause instanceof
|
|
1747
|
+
return cause instanceof chunkEXFISDHQ_cjs.AccountingApiError && cause.statusCode !== 408 && cause.statusCode < 500;
|
|
1748
1748
|
}
|
|
1749
1749
|
function submissionLockName(session) {
|
|
1750
1750
|
return `privana:external-deposit-lock:submit:${session.owner.toLowerCase()}:${externalDepositSessionId(session.chainId, session.tokenId)}`;
|
|
@@ -1764,7 +1764,7 @@ async function submitExternalDepositLock(client, session) {
|
|
|
1764
1764
|
return withSubmissionLock(session, async (crossTabExclusive) => {
|
|
1765
1765
|
const current = loadExternalDepositLockSession(session.owner);
|
|
1766
1766
|
if (!current || current.generation !== session.generation) {
|
|
1767
|
-
throw new
|
|
1767
|
+
throw new chunkEXFISDHQ_cjs.PostDepositLockError(
|
|
1768
1768
|
"External deposit lock session changed before submission",
|
|
1769
1769
|
"not-found",
|
|
1770
1770
|
BigInt(session.maxLockAmount),
|
|
@@ -1783,7 +1783,7 @@ async function submitExternalDepositLock(client, session) {
|
|
|
1783
1783
|
async function submitExternalDepositLockAttempt(client, session, crossTabExclusive) {
|
|
1784
1784
|
const creditedAmount = session.creditedAmount ? BigInt(session.creditedAmount) : void 0;
|
|
1785
1785
|
if (!creditedAmount) {
|
|
1786
|
-
throw new
|
|
1786
|
+
throw new chunkEXFISDHQ_cjs.PostDepositLockError(
|
|
1787
1787
|
"External deposit has not been credited",
|
|
1788
1788
|
"submission-failed",
|
|
1789
1789
|
BigInt(session.maxLockAmount)
|
|
@@ -1791,7 +1791,7 @@ async function submitExternalDepositLockAttempt(client, session, crossTabExclusi
|
|
|
1791
1791
|
}
|
|
1792
1792
|
const payload = session.payload;
|
|
1793
1793
|
if (!payload) {
|
|
1794
|
-
throw new
|
|
1794
|
+
throw new chunkEXFISDHQ_cjs.PostDepositLockError(
|
|
1795
1795
|
"No persisted signed policy found for this deposit session",
|
|
1796
1796
|
"not-found",
|
|
1797
1797
|
BigInt(session.maxLockAmount),
|
|
@@ -1799,7 +1799,7 @@ async function submitExternalDepositLockAttempt(client, session, crossTabExclusi
|
|
|
1799
1799
|
);
|
|
1800
1800
|
}
|
|
1801
1801
|
try {
|
|
1802
|
-
return await
|
|
1802
|
+
return await chunkEXFISDHQ_cjs.submitPendingLock({
|
|
1803
1803
|
client,
|
|
1804
1804
|
payload,
|
|
1805
1805
|
creditedAmount,
|
|
@@ -1810,23 +1810,23 @@ async function submitExternalDepositLockAttempt(client, session, crossTabExclusi
|
|
|
1810
1810
|
}
|
|
1811
1811
|
});
|
|
1812
1812
|
} catch (err) {
|
|
1813
|
-
if (err instanceof
|
|
1813
|
+
if (err instanceof chunkEXFISDHQ_cjs.PostDepositLockError && err.reason === "submission-failed" && crossTabExclusive && !session.submissionAmbiguous && isDefinitiveSubmissionFailure(err)) {
|
|
1814
1814
|
if (!clearSubmittedPayload(session, payload.signature, true)) {
|
|
1815
1815
|
const latest = loadExternalDepositLockSession(session.owner);
|
|
1816
1816
|
if (latest?.submissionAmbiguous) throw ambiguousSubmissionError(err);
|
|
1817
1817
|
}
|
|
1818
|
-
} else if (err instanceof
|
|
1818
|
+
} else if (err instanceof chunkEXFISDHQ_cjs.PostDepositLockError && err.reason === "submission-failed") {
|
|
1819
1819
|
const ambiguous = markSubmissionAmbiguous(session, payload.signature) || loadExternalDepositLockSession(session.owner)?.submissionAmbiguous === true;
|
|
1820
1820
|
if (ambiguous) throw ambiguousSubmissionError(err);
|
|
1821
1821
|
} else {
|
|
1822
1822
|
const current = loadExternalDepositLockSession(session.owner);
|
|
1823
1823
|
if (session.submissionAmbiguous || current?.submissionAmbiguous) {
|
|
1824
|
-
if (err instanceof
|
|
1824
|
+
if (err instanceof chunkEXFISDHQ_cjs.PostDepositLockError) throw ambiguousSubmissionError(err);
|
|
1825
1825
|
throw err;
|
|
1826
1826
|
}
|
|
1827
1827
|
if (!clearSubmittedPayload(session, payload.signature)) {
|
|
1828
1828
|
const latest = loadExternalDepositLockSession(session.owner);
|
|
1829
|
-
if (latest?.submissionAmbiguous && err instanceof
|
|
1829
|
+
if (latest?.submissionAmbiguous && err instanceof chunkEXFISDHQ_cjs.PostDepositLockError) {
|
|
1830
1830
|
throw ambiguousSubmissionError(err);
|
|
1831
1831
|
}
|
|
1832
1832
|
}
|
|
@@ -1839,12 +1839,12 @@ function useExternalDepositLock({
|
|
|
1839
1839
|
onLockSubmitted,
|
|
1840
1840
|
onLockFailed
|
|
1841
1841
|
}) {
|
|
1842
|
-
const { client, networkConfig, serviceAddress, getTokenById, tokensStatus } =
|
|
1842
|
+
const { client, networkConfig, serviceAddress, getTokenById, tokensStatus } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
1843
1843
|
const config = wagmi.useConfig();
|
|
1844
1844
|
const queryClient = reactQuery.useQueryClient();
|
|
1845
1845
|
const { address } = wagmi.useAccount();
|
|
1846
|
-
const { privateReadAddress } =
|
|
1847
|
-
const { ensureCorrectChain } =
|
|
1846
|
+
const { privateReadAddress } = chunkEXFISDHQ_cjs.usePrivateReadRequest();
|
|
1847
|
+
const { ensureCorrectChain } = chunkEXFISDHQ_cjs.useEnsureCorrectChain();
|
|
1848
1848
|
const [isSigning, setIsSigning] = react.useState(false);
|
|
1849
1849
|
const [isSubmittingLock, setIsSubmittingLock] = react.useState(false);
|
|
1850
1850
|
const [session, setSession] = react.useState(null);
|
|
@@ -1904,7 +1904,7 @@ function useExternalDepositLock({
|
|
|
1904
1904
|
result = await submitExternalDepositLock(client, submission);
|
|
1905
1905
|
} catch (err) {
|
|
1906
1906
|
const stored = loadExternalDepositLockSession(active.owner);
|
|
1907
|
-
const error = err instanceof
|
|
1907
|
+
const error = err instanceof chunkEXFISDHQ_cjs.PostDepositLockError ? err : new chunkEXFISDHQ_cjs.PostDepositLockError(
|
|
1908
1908
|
err instanceof Error ? err.message : "Lock submission failed",
|
|
1909
1909
|
"submission-failed",
|
|
1910
1910
|
BigInt(active.maxLockAmount),
|
|
@@ -1983,7 +1983,7 @@ function useExternalDepositLock({
|
|
|
1983
1983
|
void submitSession(restored);
|
|
1984
1984
|
} else if (restored.creditedAmount) {
|
|
1985
1985
|
notifyFailure(
|
|
1986
|
-
new
|
|
1986
|
+
new chunkEXFISDHQ_cjs.PostDepositLockError(
|
|
1987
1987
|
"Deposit credited; sign a fresh policy to lock the funds",
|
|
1988
1988
|
"not-found",
|
|
1989
1989
|
BigInt(restored.maxLockAmount),
|
|
@@ -2023,10 +2023,10 @@ function useExternalDepositLock({
|
|
|
2023
2023
|
if (signingRef.current || settlingRef.current) {
|
|
2024
2024
|
throw new Error("A policy operation is already in progress");
|
|
2025
2025
|
}
|
|
2026
|
-
if (!
|
|
2026
|
+
if (!chunkEXFISDHQ_cjs.canUseSharedBrowserStorage()) {
|
|
2027
2027
|
throw new Error("Browser storage is required for locked deposit recovery");
|
|
2028
2028
|
}
|
|
2029
|
-
const owner =
|
|
2029
|
+
const owner = chunkEXFISDHQ_cjs.requireDepositLockOwner(address, privateReadAddress);
|
|
2030
2030
|
if (sessionRef.current || loadExternalDepositLockSession(owner)) {
|
|
2031
2031
|
throw new Error("Finish or cancel the active external deposit before starting another");
|
|
2032
2032
|
}
|
|
@@ -2035,26 +2035,26 @@ function useExternalDepositLock({
|
|
|
2035
2035
|
if (token.contract === viem.zeroAddress) {
|
|
2036
2036
|
throw new Error("External deposits support ERC20 tokens only");
|
|
2037
2037
|
}
|
|
2038
|
-
const targetService =
|
|
2039
|
-
const lockDuration = allowance.lockDuration ??
|
|
2038
|
+
const targetService = chunkEXFISDHQ_cjs.requireServiceAddress(serviceAddress);
|
|
2039
|
+
const lockDuration = allowance.lockDuration ?? chunkEXFISDHQ_cjs.DEFAULT_LOCK_DURATION_SECONDS;
|
|
2040
2040
|
signingRef.current = true;
|
|
2041
2041
|
setIsSigning(true);
|
|
2042
2042
|
try {
|
|
2043
2043
|
await ensureCorrectChain(networkConfig.chainId);
|
|
2044
|
-
const signingWalletClient = await
|
|
2044
|
+
const signingWalletClient = await chunkEXFISDHQ_cjs.getWalletClient(config, {
|
|
2045
2045
|
chainId: networkConfig.chainId
|
|
2046
2046
|
});
|
|
2047
|
-
const payload = await
|
|
2047
|
+
const payload = await chunkEXFISDHQ_cjs.createSignedLockRequest({
|
|
2048
2048
|
client,
|
|
2049
2049
|
walletClient: signingWalletClient,
|
|
2050
2050
|
userAddress: owner,
|
|
2051
2051
|
networkConfig,
|
|
2052
2052
|
serviceAddress: targetService,
|
|
2053
2053
|
tokenId: token.id,
|
|
2054
|
-
amount:
|
|
2054
|
+
amount: chunkEXFISDHQ_cjs.clampLockAmount(amount, BigInt(allowance.value)),
|
|
2055
2055
|
lockDuration
|
|
2056
2056
|
});
|
|
2057
|
-
const startBlock = await
|
|
2057
|
+
const startBlock = await chunkEXFISDHQ_cjs.getBlockNumber(config, { chainId: token.chainId });
|
|
2058
2058
|
if (startBlock > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
2059
2059
|
throw new Error("Source-chain block number exceeds the supported range");
|
|
2060
2060
|
}
|
|
@@ -2120,7 +2120,7 @@ function useExternalDepositLock({
|
|
|
2120
2120
|
pendingCreditedTransitionRef.current = { predecessor: active, credited };
|
|
2121
2121
|
installSession(credited);
|
|
2122
2122
|
notifyFailure(
|
|
2123
|
-
new
|
|
2123
|
+
new chunkEXFISDHQ_cjs.PostDepositLockError(
|
|
2124
2124
|
err instanceof Error ? err.message : "Unable to persist credited deposit state",
|
|
2125
2125
|
"submission-failed",
|
|
2126
2126
|
BigInt(active.maxLockAmount),
|
|
@@ -2180,7 +2180,7 @@ function useExternalDepositLock({
|
|
|
2180
2180
|
if (!token || token.chainId !== active.chainId || token.contract === viem.zeroAddress) {
|
|
2181
2181
|
throw new Error("The credited token is no longer available");
|
|
2182
2182
|
}
|
|
2183
|
-
const targetService =
|
|
2183
|
+
const targetService = chunkEXFISDHQ_cjs.requireServiceAddress(serviceAddress);
|
|
2184
2184
|
if (targetService.toLowerCase() !== active.serviceAddress.toLowerCase()) {
|
|
2185
2185
|
throw new Error("The service for this credited deposit has changed");
|
|
2186
2186
|
}
|
|
@@ -2193,17 +2193,17 @@ function useExternalDepositLock({
|
|
|
2193
2193
|
"The previous lock submission may have succeeded; a fresh signature is unsafe"
|
|
2194
2194
|
);
|
|
2195
2195
|
}
|
|
2196
|
-
const owner =
|
|
2196
|
+
const owner = chunkEXFISDHQ_cjs.requireDepositLockOwner(address, privateReadAddress);
|
|
2197
2197
|
const amount = externalDepositRetryAmount(active);
|
|
2198
2198
|
let retrySession;
|
|
2199
2199
|
signingRef.current = true;
|
|
2200
2200
|
setIsSigning(true);
|
|
2201
2201
|
try {
|
|
2202
2202
|
await ensureCorrectChain(networkConfig.chainId);
|
|
2203
|
-
const signingWalletClient = await
|
|
2203
|
+
const signingWalletClient = await chunkEXFISDHQ_cjs.getWalletClient(config, {
|
|
2204
2204
|
chainId: networkConfig.chainId
|
|
2205
2205
|
});
|
|
2206
|
-
const payload = await
|
|
2206
|
+
const payload = await chunkEXFISDHQ_cjs.createSignedLockRequest({
|
|
2207
2207
|
client,
|
|
2208
2208
|
walletClient: signingWalletClient,
|
|
2209
2209
|
userAddress: owner,
|
|
@@ -2336,7 +2336,7 @@ function BaseIcon({ className, size = 24 }) {
|
|
|
2336
2336
|
}
|
|
2337
2337
|
);
|
|
2338
2338
|
}
|
|
2339
|
-
function
|
|
2339
|
+
function EthereumIcon({ className, size = 24 }) {
|
|
2340
2340
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2341
2341
|
"svg",
|
|
2342
2342
|
{
|
|
@@ -2387,18 +2387,19 @@ function WETHIcon({ className, size = 24 }) {
|
|
|
2387
2387
|
}
|
|
2388
2388
|
function getTokenIcon(symbol, size) {
|
|
2389
2389
|
const iconSize = size ?? 24;
|
|
2390
|
-
switch (symbol.toUpperCase()) {
|
|
2390
|
+
switch ((symbol ?? "").toUpperCase()) {
|
|
2391
2391
|
case "USDC":
|
|
2392
2392
|
return /* @__PURE__ */ jsxRuntime.jsx(USDCIcon, { size: iconSize });
|
|
2393
|
+
case "ETH":
|
|
2393
2394
|
case "WETH":
|
|
2394
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2395
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EthereumIcon, { size: iconSize });
|
|
2395
2396
|
default:
|
|
2396
2397
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2397
2398
|
"div",
|
|
2398
2399
|
{
|
|
2399
2400
|
className: "bg-muted flex items-center justify-center rounded-full text-xs font-bold",
|
|
2400
2401
|
style: { width: iconSize, height: iconSize },
|
|
2401
|
-
children: symbol.slice(0, 2)
|
|
2402
|
+
children: (symbol ?? "?").slice(0, 2)
|
|
2402
2403
|
}
|
|
2403
2404
|
);
|
|
2404
2405
|
}
|
|
@@ -2406,8 +2407,12 @@ function getTokenIcon(symbol, size) {
|
|
|
2406
2407
|
function getChainIcon(chainId, size) {
|
|
2407
2408
|
const iconSize = size ?? 24;
|
|
2408
2409
|
switch (chainId) {
|
|
2410
|
+
case 8453:
|
|
2409
2411
|
case 84532:
|
|
2410
2412
|
return /* @__PURE__ */ jsxRuntime.jsx(BaseIcon, { size: iconSize });
|
|
2413
|
+
case 1:
|
|
2414
|
+
case 11155111:
|
|
2415
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EthereumIcon, { size: iconSize });
|
|
2411
2416
|
default:
|
|
2412
2417
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2413
2418
|
"div",
|
|
@@ -2420,16 +2425,17 @@ function getChainIcon(chainId, size) {
|
|
|
2420
2425
|
}
|
|
2421
2426
|
}
|
|
2422
2427
|
function TokenSelectorView({ selectedTokenId, onSelect }) {
|
|
2423
|
-
const { enabledTokens } =
|
|
2428
|
+
const { enabledTokens, getChainById: getChainById2 } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
2424
2429
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted flex flex-col rounded-[10px] p-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex max-h-72 flex-col gap-1 overflow-y-auto", children: [
|
|
2425
2430
|
enabledTokens.map((token) => {
|
|
2426
2431
|
const isSelected = selectedTokenId === token.id;
|
|
2432
|
+
const chainName = getChainById2(token.chainId)?.name;
|
|
2427
2433
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2428
2434
|
"button",
|
|
2429
2435
|
{
|
|
2430
2436
|
type: "button",
|
|
2431
2437
|
onClick: () => onSelect(token.id),
|
|
2432
|
-
className:
|
|
2438
|
+
className: chunkEXFISDHQ_cjs.cn(
|
|
2433
2439
|
"hover:bg-secondary flex w-full cursor-pointer items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors",
|
|
2434
2440
|
isSelected && "bg-secondary"
|
|
2435
2441
|
),
|
|
@@ -2437,7 +2443,10 @@ function TokenSelectorView({ selectedTokenId, onSelect }) {
|
|
|
2437
2443
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-6 w-6 shrink-0 overflow-hidden rounded-full", children: getTokenIcon(token.symbol, 24) }),
|
|
2438
2444
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
2439
2445
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-foreground text-sm font-medium", children: token.symbol }),
|
|
2440
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2446
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-muted-foreground text-[11px]", children: [
|
|
2447
|
+
"on ",
|
|
2448
|
+
chainName ?? "\u2014"
|
|
2449
|
+
] })
|
|
2441
2450
|
] }),
|
|
2442
2451
|
isSelected && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-primary flex h-4 w-4 shrink-0 items-center justify-center rounded-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2443
2452
|
"svg",
|
|
@@ -2467,15 +2476,356 @@ function TokenSelectorView({ selectedTokenId, onSelect }) {
|
|
|
2467
2476
|
enabledTokens.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground px-3 py-6 text-center text-sm", children: "No tokens available" })
|
|
2468
2477
|
] }) });
|
|
2469
2478
|
}
|
|
2479
|
+
function assertTransakCheckoutPreconditions({
|
|
2480
|
+
activeIntentId,
|
|
2481
|
+
canOpen,
|
|
2482
|
+
canRecreateSession
|
|
2483
|
+
}) {
|
|
2484
|
+
if (activeIntentId && !canRecreateSession) {
|
|
2485
|
+
throw new Error("Continue signed-intent recovery instead of reopening this checkout");
|
|
2486
|
+
}
|
|
2487
|
+
if (!canOpen) {
|
|
2488
|
+
throw new Error("Card checkout is unavailable; close this purchase and start again");
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
function TransakCardWidgetView({
|
|
2492
|
+
token,
|
|
2493
|
+
providerAssetCode,
|
|
2494
|
+
amount,
|
|
2495
|
+
allowance,
|
|
2496
|
+
lockServiceAddress,
|
|
2497
|
+
onCredited,
|
|
2498
|
+
onLockSubmitted,
|
|
2499
|
+
onLockFailed,
|
|
2500
|
+
onLeave,
|
|
2501
|
+
onUnsafeToCloseChange,
|
|
2502
|
+
onActiveFlowChange,
|
|
2503
|
+
useOnRamp = chunkEXFISDHQ_cjs.useTransakOnRamp
|
|
2504
|
+
}) {
|
|
2505
|
+
const [actionError, setActionError] = react.useState(null);
|
|
2506
|
+
const [rowError, setRowError] = react.useState(null);
|
|
2507
|
+
const [lockSettled, setLockSettled] = react.useState(false);
|
|
2508
|
+
const [lockError, setLockError] = react.useState(null);
|
|
2509
|
+
const [ownedTerminal, setOwnedTerminal] = react.useState(false);
|
|
2510
|
+
const ownedIntentIdRef = react.useRef(null);
|
|
2511
|
+
const postDepositLock = react.useMemo(
|
|
2512
|
+
() => allowance ? {
|
|
2513
|
+
serviceAddress: lockServiceAddress,
|
|
2514
|
+
maxAmount: BigInt(allowance.value),
|
|
2515
|
+
lockDuration: allowance.lockDuration
|
|
2516
|
+
} : void 0,
|
|
2517
|
+
[allowance, lockServiceAddress]
|
|
2518
|
+
);
|
|
2519
|
+
const ownsRecord = react.useCallback(
|
|
2520
|
+
(record) => Boolean(
|
|
2521
|
+
ownedIntentIdRef.current && chunkEXFISDHQ_cjs.matchesOnRampTransaction(record, ownedIntentIdRef.current)
|
|
2522
|
+
),
|
|
2523
|
+
[]
|
|
2524
|
+
);
|
|
2525
|
+
const {
|
|
2526
|
+
status,
|
|
2527
|
+
activeIntentId,
|
|
2528
|
+
pending,
|
|
2529
|
+
activeVerificationId,
|
|
2530
|
+
error,
|
|
2531
|
+
finalityProgress,
|
|
2532
|
+
depositAddress,
|
|
2533
|
+
minDepositBaseUnits,
|
|
2534
|
+
selectedToken,
|
|
2535
|
+
isLaunching,
|
|
2536
|
+
isWidgetOpen,
|
|
2537
|
+
canRecreateSession,
|
|
2538
|
+
widget,
|
|
2539
|
+
launch,
|
|
2540
|
+
recreateSession,
|
|
2541
|
+
closeWidget,
|
|
2542
|
+
finishPendingVerification,
|
|
2543
|
+
refreshPending
|
|
2544
|
+
} = useOnRamp({
|
|
2545
|
+
tokenId: token.id,
|
|
2546
|
+
postDepositLock,
|
|
2547
|
+
iframeTitle: "Card checkout",
|
|
2548
|
+
iframeClassName: "h-[680px] w-full border-0",
|
|
2549
|
+
onCredited: (_depositTxHash, record) => {
|
|
2550
|
+
if (!ownsRecord(record)) return;
|
|
2551
|
+
onCredited?.();
|
|
2552
|
+
if (!postDepositLock) {
|
|
2553
|
+
setOwnedTerminal(true);
|
|
2554
|
+
onActiveFlowChange?.(false);
|
|
2555
|
+
}
|
|
2556
|
+
},
|
|
2557
|
+
onLockSubmitted: (_response, record) => {
|
|
2558
|
+
if (!ownsRecord(record)) return;
|
|
2559
|
+
setLockError(null);
|
|
2560
|
+
setLockSettled(true);
|
|
2561
|
+
setOwnedTerminal(true);
|
|
2562
|
+
onActiveFlowChange?.(false);
|
|
2563
|
+
onLockSubmitted?.();
|
|
2564
|
+
},
|
|
2565
|
+
onLockFailed: (nextError, record) => {
|
|
2566
|
+
if (!ownsRecord(record)) return;
|
|
2567
|
+
setLockError(nextError);
|
|
2568
|
+
setOwnedTerminal(true);
|
|
2569
|
+
onActiveFlowChange?.(false);
|
|
2570
|
+
onLockFailed?.(nextError);
|
|
2571
|
+
}
|
|
2572
|
+
});
|
|
2573
|
+
const ownedIntentId = ownedIntentIdRef.current ?? activeIntentId;
|
|
2574
|
+
react.useEffect(() => {
|
|
2575
|
+
if (activeIntentId && !ownedIntentIdRef.current) {
|
|
2576
|
+
ownedIntentIdRef.current = activeIntentId;
|
|
2577
|
+
}
|
|
2578
|
+
}, [activeIntentId]);
|
|
2579
|
+
let amountBaseUnits;
|
|
2580
|
+
try {
|
|
2581
|
+
amountBaseUnits = viem.parseUnits(amount, token.decimals);
|
|
2582
|
+
} catch {
|
|
2583
|
+
}
|
|
2584
|
+
const minimumTargetBaseUnits = minDepositBaseUnits === void 0 ? void 0 : chunkEXFISDHQ_cjs.getTransakMinimumTargetBaseUnits(minDepositBaseUnits);
|
|
2585
|
+
const belowMinimum = amountBaseUnits !== void 0 && minimumTargetBaseUnits !== void 0 && amountBaseUnits < minimumTargetBaseUnits;
|
|
2586
|
+
const minimumUnknown = minimumTargetBaseUnits === void 0;
|
|
2587
|
+
const tokenMismatch = !chunkEXFISDHQ_cjs.matchesFrozenOnRampToken(token, selectedToken);
|
|
2588
|
+
const isSettling = status === "awaiting-delivery" || status === "verifying";
|
|
2589
|
+
const lockPending = !!allowance && status === "credited" && !lockSettled && !lockError;
|
|
2590
|
+
const ownedPending = ownedIntentId ? pending.filter((record) => chunkEXFISDHQ_cjs.matchesOnRampTransaction(record, ownedIntentId)) : [];
|
|
2591
|
+
const ownedFlowActive = !ownedTerminal && (Boolean(activeIntentId && activeIntentId === ownedIntentId) || ownedPending.length > 0 || lockPending);
|
|
2592
|
+
const canOpen = Boolean(selectedToken && depositAddress && amountBaseUnits && amountBaseUnits > 0n) && !tokenMismatch && !minimumUnknown && !belowMinimum && !isLaunching && !isWidgetOpen && !isSettling && status !== "credited" && (!activeIntentId || canRecreateSession);
|
|
2593
|
+
react.useEffect(() => {
|
|
2594
|
+
onActiveFlowChange?.(ownedFlowActive);
|
|
2595
|
+
}, [onActiveFlowChange, ownedFlowActive]);
|
|
2596
|
+
const unsafeToClose = isLaunching || lockPending;
|
|
2597
|
+
react.useEffect(() => {
|
|
2598
|
+
onUnsafeToCloseChange?.(unsafeToClose);
|
|
2599
|
+
return () => onUnsafeToCloseChange?.(false);
|
|
2600
|
+
}, [onUnsafeToCloseChange, unsafeToClose]);
|
|
2601
|
+
const runCheckout = react.useCallback(async () => {
|
|
2602
|
+
setActionError(null);
|
|
2603
|
+
try {
|
|
2604
|
+
assertTransakCheckoutPreconditions({ activeIntentId, canOpen, canRecreateSession });
|
|
2605
|
+
setLockError(null);
|
|
2606
|
+
setLockSettled(false);
|
|
2607
|
+
setOwnedTerminal(false);
|
|
2608
|
+
if (!activeIntentId) ownedIntentIdRef.current = null;
|
|
2609
|
+
if (activeIntentId) await recreateSession();
|
|
2610
|
+
else await launch({ providerAssetCode, quoteCurrencyAmount: amount });
|
|
2611
|
+
} catch (nextError) {
|
|
2612
|
+
setActionError(
|
|
2613
|
+
nextError instanceof Error ? nextError : new Error("Failed to open card checkout")
|
|
2614
|
+
);
|
|
2615
|
+
}
|
|
2616
|
+
}, [
|
|
2617
|
+
activeIntentId,
|
|
2618
|
+
amount,
|
|
2619
|
+
canOpen,
|
|
2620
|
+
canRecreateSession,
|
|
2621
|
+
launch,
|
|
2622
|
+
providerAssetCode,
|
|
2623
|
+
recreateSession
|
|
2624
|
+
]);
|
|
2625
|
+
const handleClose = react.useCallback(async () => {
|
|
2626
|
+
setActionError(null);
|
|
2627
|
+
try {
|
|
2628
|
+
await closeWidget();
|
|
2629
|
+
} catch (nextError) {
|
|
2630
|
+
setActionError(
|
|
2631
|
+
nextError instanceof Error ? nextError : new Error("Failed to close card checkout")
|
|
2632
|
+
);
|
|
2633
|
+
}
|
|
2634
|
+
}, [closeWidget]);
|
|
2635
|
+
const handleLeave = react.useCallback(() => {
|
|
2636
|
+
setActionError(null);
|
|
2637
|
+
onActiveFlowChange?.(false);
|
|
2638
|
+
onLeave?.();
|
|
2639
|
+
}, [onActiveFlowChange, onLeave]);
|
|
2640
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-muted flex flex-col gap-4 rounded-[10px] p-5", children: [
|
|
2641
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2642
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: "Complete your purchase" }),
|
|
2643
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground mt-1 text-sm", children: [
|
|
2644
|
+
"Buy ",
|
|
2645
|
+
token.symbol,
|
|
2646
|
+
" and deposit it directly into your Privana balance."
|
|
2647
|
+
] })
|
|
2648
|
+
] }),
|
|
2649
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border bg-card rounded-lg border p-3 text-sm", children: [
|
|
2650
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-foreground font-medium", children: [
|
|
2651
|
+
"Target receipt: at least ",
|
|
2652
|
+
amount,
|
|
2653
|
+
" ",
|
|
2654
|
+
token.symbol
|
|
2655
|
+
] }),
|
|
2656
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mt-1", children: "In Transak, adjust the fiat amount until \u201CYou receive\u201D is at least this target." }),
|
|
2657
|
+
allowance && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mt-1", children: "The pre-signed lock is 98% of the target, capped by the service allowance." })
|
|
2658
|
+
] }),
|
|
2659
|
+
widget ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border bg-card overflow-hidden rounded-xl border", children: [
|
|
2660
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border flex items-center justify-between border-b px-4 py-2 text-sm", children: [
|
|
2661
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: "Card checkout" }),
|
|
2662
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkEXFISDHQ_cjs.Button, { type: "button", variant: "outline", size: "sm", onClick: () => void handleClose(), children: "Close" })
|
|
2663
|
+
] }),
|
|
2664
|
+
widget
|
|
2665
|
+
] }) : status === "credited" && !lockPending && !lockError ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2 py-8 text-center", children: [
|
|
2666
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleCheckIcon, { className: "text-primary size-8", "aria-hidden": true }),
|
|
2667
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground text-sm font-medium", children: "Purchase credited" }),
|
|
2668
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground text-sm", children: [
|
|
2669
|
+
"Your ",
|
|
2670
|
+
token.symbol,
|
|
2671
|
+
" deposit is now available in your balance."
|
|
2672
|
+
] })
|
|
2673
|
+
] }) : !activeIntentId || canRecreateSession ? /* @__PURE__ */ jsxRuntime.jsxs(chunkEXFISDHQ_cjs.Button, { type: "button", disabled: !canOpen, onClick: () => void runCheckout(), children: [
|
|
2674
|
+
isLaunching && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin", "aria-hidden": true }),
|
|
2675
|
+
isLaunching ? "Opening checkout\u2026" : activeIntentId ? "Reopen card checkout" : allowance ? "Sign policy and open checkout" : "Open card checkout"
|
|
2676
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "This signed purchase is in recovery. Do not open another checkout for it." }),
|
|
2677
|
+
!depositAddress && !error && !actionError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Preparing your secure deposit address\u2026" }),
|
|
2678
|
+
tokenMismatch && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", role: "alert", children: "The token configuration changed. Close this purchase and start again." }),
|
|
2679
|
+
!tokenMismatch && depositAddress && minimumUnknown && !error && !actionError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", role: "alert", children: "The minimum purchase amount is unavailable. Close this purchase and try again." }),
|
|
2680
|
+
belowMinimum && minimumTargetBaseUnits !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-destructive text-sm", role: "alert", children: [
|
|
2681
|
+
"Minimum target is ",
|
|
2682
|
+
viem.formatUnits(minimumTargetBaseUnits, token.decimals),
|
|
2683
|
+
" ",
|
|
2684
|
+
token.symbol,
|
|
2685
|
+
", including a 5% delivery buffer."
|
|
2686
|
+
] }),
|
|
2687
|
+
isSettling && pending.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground flex items-center gap-2 text-sm", children: [
|
|
2688
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin", "aria-hidden": true }),
|
|
2689
|
+
"Verifying your purchase\u2026"
|
|
2690
|
+
] }),
|
|
2691
|
+
lockPending && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground flex items-center gap-2 text-sm", children: [
|
|
2692
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin", "aria-hidden": true }),
|
|
2693
|
+
"Purchase credited. Locking your funds\u2026"
|
|
2694
|
+
] }),
|
|
2695
|
+
pending.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
2696
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground text-sm font-medium", children: "Validating purchases" }),
|
|
2697
|
+
pending.map((record) => {
|
|
2698
|
+
const isActivelyVerifying = record.transaction_id === activeVerificationId;
|
|
2699
|
+
const progress = parseFinalityProgress(finalityProgress[record.transaction_id]);
|
|
2700
|
+
const showRetry = chunkEXFISDHQ_cjs.canRetryOnRampVerification(record, activeVerificationId);
|
|
2701
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2702
|
+
"div",
|
|
2703
|
+
{
|
|
2704
|
+
className: "border-border flex flex-col gap-2 rounded-md border p-2",
|
|
2705
|
+
children: [
|
|
2706
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground flex items-center gap-1 text-xs", children: [
|
|
2707
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-3 animate-spin", "aria-hidden": true }),
|
|
2708
|
+
record.on_chain_tx_hash ? progress ?? (isActivelyVerifying ? "Verifying\u2026" : "Ready to verify") : "Waiting for provider delivery\u2026"
|
|
2709
|
+
] }),
|
|
2710
|
+
rowError?.id === record.transaction_id && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-xs", children: rowError.message }),
|
|
2711
|
+
showRetry && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2712
|
+
chunkEXFISDHQ_cjs.Button,
|
|
2713
|
+
{
|
|
2714
|
+
type: "button",
|
|
2715
|
+
variant: "outline",
|
|
2716
|
+
size: "sm",
|
|
2717
|
+
onClick: async () => {
|
|
2718
|
+
setRowError(null);
|
|
2719
|
+
try {
|
|
2720
|
+
await finishPendingVerification(record);
|
|
2721
|
+
} catch (nextError) {
|
|
2722
|
+
setRowError({
|
|
2723
|
+
id: record.transaction_id,
|
|
2724
|
+
message: nextError instanceof Error ? nextError.message : "Verification failed"
|
|
2725
|
+
});
|
|
2726
|
+
}
|
|
2727
|
+
},
|
|
2728
|
+
children: "Retry verification"
|
|
2729
|
+
}
|
|
2730
|
+
),
|
|
2731
|
+
!record.on_chain_tx_hash && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2732
|
+
chunkEXFISDHQ_cjs.Button,
|
|
2733
|
+
{
|
|
2734
|
+
type: "button",
|
|
2735
|
+
variant: "outline",
|
|
2736
|
+
size: "sm",
|
|
2737
|
+
onClick: () => void refreshPending(),
|
|
2738
|
+
children: "Refresh delivery"
|
|
2739
|
+
}
|
|
2740
|
+
)
|
|
2741
|
+
]
|
|
2742
|
+
},
|
|
2743
|
+
record.transaction_id
|
|
2744
|
+
);
|
|
2745
|
+
})
|
|
2746
|
+
] }),
|
|
2747
|
+
onLeave && ownedFlowActive && !unsafeToClose && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2748
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkEXFISDHQ_cjs.Button, { type: "button", variant: "outline", onClick: handleLeave, children: "Leave checkout" }),
|
|
2749
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: "Privana will keep this signed purchase available for exact recovery." })
|
|
2750
|
+
] }),
|
|
2751
|
+
(actionError ?? error) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", role: "alert", children: (actionError ?? error)?.message }),
|
|
2752
|
+
lockError && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-destructive text-sm", role: "alert", children: [
|
|
2753
|
+
"Purchase credited, but locking the funds failed: ",
|
|
2754
|
+
lockError.message
|
|
2755
|
+
] })
|
|
2756
|
+
] });
|
|
2757
|
+
}
|
|
2758
|
+
function parseFinalityProgress(message) {
|
|
2759
|
+
if (!message) return null;
|
|
2760
|
+
const match = message.match(/(\d+\/\d+)\s+confirmations/i);
|
|
2761
|
+
return match ? `${match[1]} confirmations` : null;
|
|
2762
|
+
}
|
|
2470
2763
|
function CreditCardWidgetView({
|
|
2471
2764
|
token,
|
|
2765
|
+
onRamp,
|
|
2472
2766
|
amount,
|
|
2473
2767
|
allowance,
|
|
2768
|
+
lockServiceAddress,
|
|
2474
2769
|
onCredited,
|
|
2475
2770
|
onLockSubmitted,
|
|
2476
|
-
onLockFailed
|
|
2771
|
+
onLockFailed,
|
|
2772
|
+
onLeave,
|
|
2773
|
+
onUnsafeToCloseChange,
|
|
2774
|
+
onActiveFlowChange
|
|
2775
|
+
}) {
|
|
2776
|
+
if (onRamp.unavailableReason || !token || !onRamp.provider || !onRamp.providerAssetCode) {
|
|
2777
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-muted flex flex-col gap-2 rounded-[10px] p-5", children: [
|
|
2778
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: "Card purchases unavailable" }),
|
|
2779
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", children: onRamp.unavailableReason ?? "The card on-ramp is not configured for this token." })
|
|
2780
|
+
] });
|
|
2781
|
+
}
|
|
2782
|
+
if (onRamp.provider === "transak") {
|
|
2783
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2784
|
+
TransakCardWidgetView,
|
|
2785
|
+
{
|
|
2786
|
+
token,
|
|
2787
|
+
providerAssetCode: onRamp.providerAssetCode,
|
|
2788
|
+
amount,
|
|
2789
|
+
allowance,
|
|
2790
|
+
lockServiceAddress,
|
|
2791
|
+
onCredited,
|
|
2792
|
+
onLockSubmitted,
|
|
2793
|
+
onLockFailed,
|
|
2794
|
+
onLeave,
|
|
2795
|
+
onUnsafeToCloseChange,
|
|
2796
|
+
onActiveFlowChange
|
|
2797
|
+
}
|
|
2798
|
+
);
|
|
2799
|
+
}
|
|
2800
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2801
|
+
MoonPayCardWidgetView,
|
|
2802
|
+
{
|
|
2803
|
+
token,
|
|
2804
|
+
amount,
|
|
2805
|
+
allowance,
|
|
2806
|
+
lockServiceAddress,
|
|
2807
|
+
onCredited,
|
|
2808
|
+
onLockSubmitted,
|
|
2809
|
+
onLockFailed,
|
|
2810
|
+
onLeaveFlow: onLeave,
|
|
2811
|
+
onUnsafeToCloseChange,
|
|
2812
|
+
onActiveFlowChange
|
|
2813
|
+
}
|
|
2814
|
+
);
|
|
2815
|
+
}
|
|
2816
|
+
function MoonPayCardWidgetView({
|
|
2817
|
+
token,
|
|
2818
|
+
amount,
|
|
2819
|
+
allowance,
|
|
2820
|
+
lockServiceAddress,
|
|
2821
|
+
onCredited,
|
|
2822
|
+
onLockSubmitted,
|
|
2823
|
+
onLockFailed,
|
|
2824
|
+
onLeaveFlow,
|
|
2825
|
+
onUnsafeToCloseChange,
|
|
2826
|
+
onActiveFlowChange
|
|
2477
2827
|
}) {
|
|
2478
|
-
const moonpayCurrencyCode = token
|
|
2828
|
+
const moonpayCurrencyCode = token.moonpayCurrencyCode;
|
|
2479
2829
|
const containerRef = react.useRef(null);
|
|
2480
2830
|
const [widgetTheme, setWidgetTheme] = react.useState();
|
|
2481
2831
|
react.useEffect(() => {
|
|
@@ -2483,26 +2833,32 @@ function CreditCardWidgetView({
|
|
|
2483
2833
|
}, []);
|
|
2484
2834
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: [
|
|
2485
2835
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: "Complete your purchase" }),
|
|
2486
|
-
|
|
2487
|
-
|
|
2836
|
+
moonpayCurrencyCode ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2837
|
+
chunkEXFISDHQ_cjs.FiatOnRampForm,
|
|
2488
2838
|
{
|
|
2489
2839
|
tokenId: token.id,
|
|
2840
|
+
frozenToken: token,
|
|
2490
2841
|
currencyCode: moonpayCurrencyCode,
|
|
2491
2842
|
quoteCurrencyAmount: amount || void 0,
|
|
2492
2843
|
lockAmount: true,
|
|
2493
2844
|
variant: "embedded",
|
|
2494
2845
|
autoStart: true,
|
|
2495
2846
|
theme: widgetTheme,
|
|
2847
|
+
onlyRouteActiveIntentCallbacks: true,
|
|
2848
|
+
onUnsafeToCloseChange,
|
|
2849
|
+
onActiveFlowChange,
|
|
2496
2850
|
postDepositLock: allowance ? {
|
|
2851
|
+
serviceAddress: lockServiceAddress,
|
|
2497
2852
|
maxAmount: BigInt(allowance.value),
|
|
2498
2853
|
lockDuration: allowance.lockDuration
|
|
2499
2854
|
} : void 0,
|
|
2500
2855
|
onCredited,
|
|
2501
2856
|
onLockSubmitted,
|
|
2502
|
-
onLockFailed
|
|
2857
|
+
onLockFailed,
|
|
2858
|
+
onLeaveFlow
|
|
2503
2859
|
}
|
|
2504
2860
|
) : /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground text-sm", children: [
|
|
2505
|
-
token
|
|
2861
|
+
token.symbol,
|
|
2506
2862
|
" isn\u2019t available for card purchases yet."
|
|
2507
2863
|
] })
|
|
2508
2864
|
] });
|
|
@@ -2773,7 +3129,7 @@ function ChevronDownIcon({
|
|
|
2773
3129
|
height: "16",
|
|
2774
3130
|
viewBox: "0 0 16 16",
|
|
2775
3131
|
fill: "none",
|
|
2776
|
-
className:
|
|
3132
|
+
className: chunkEXFISDHQ_cjs.cn(
|
|
2777
3133
|
"transition-transform",
|
|
2778
3134
|
direction === "right" && "-rotate-90",
|
|
2779
3135
|
direction === "up" && "rotate-180",
|
|
@@ -2811,7 +3167,7 @@ function CopyIcon() {
|
|
|
2811
3167
|
}
|
|
2812
3168
|
);
|
|
2813
3169
|
}
|
|
2814
|
-
function
|
|
3170
|
+
function CircleCheckIcon2() {
|
|
2815
3171
|
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
|
|
2816
3172
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "10", cy: "10", r: "9", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
2817
3173
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2926,11 +3282,11 @@ function PolicyTermRow({
|
|
|
2926
3282
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2927
3283
|
"div",
|
|
2928
3284
|
{
|
|
2929
|
-
className:
|
|
3285
|
+
className: chunkEXFISDHQ_cjs.cn(
|
|
2930
3286
|
"mt-0.5 shrink-0",
|
|
2931
3287
|
kind === "permission" ? "text-emerald-500" : "text-orange-500"
|
|
2932
3288
|
),
|
|
2933
|
-
children: kind === "permission" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3289
|
+
children: kind === "permission" ? /* @__PURE__ */ jsxRuntime.jsx(CircleCheckIcon2, {}) : /* @__PURE__ */ jsxRuntime.jsx(CircleXIcon, {})
|
|
2934
3290
|
}
|
|
2935
3291
|
),
|
|
2936
3292
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
@@ -2990,6 +3346,7 @@ function AllowancePolicySection({
|
|
|
2990
3346
|
function DepositView({
|
|
2991
3347
|
source,
|
|
2992
3348
|
selectedToken,
|
|
3349
|
+
onRamp,
|
|
2993
3350
|
amount,
|
|
2994
3351
|
allowance,
|
|
2995
3352
|
externalMinimum,
|
|
@@ -2999,7 +3356,7 @@ function DepositView({
|
|
|
2999
3356
|
onSubmit,
|
|
3000
3357
|
isSubmitting = false
|
|
3001
3358
|
}) {
|
|
3002
|
-
const { getChainById: getChainById2, chains, serviceName, serviceIcon, networkConfig, hostedAuthConfig } =
|
|
3359
|
+
const { getChainById: getChainById2, chains, serviceName, serviceIcon, networkConfig, hostedAuthConfig } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
3003
3360
|
const { address, isConnected } = wagmi.useAccount();
|
|
3004
3361
|
const appName = serviceName ?? "Privana";
|
|
3005
3362
|
const chain = selectedToken ? getChainById2(selectedToken.chainId) : void 0;
|
|
@@ -3008,6 +3365,8 @@ function DepositView({
|
|
|
3008
3365
|
const isConnectedSource = source === "connected";
|
|
3009
3366
|
const isExternal = source === "external";
|
|
3010
3367
|
const isCreditCard = source === "credit-card";
|
|
3368
|
+
const isMoonPayCard = isCreditCard && chunkEXFISDHQ_cjs.isMoonPayProductOnRamp(onRamp);
|
|
3369
|
+
const isTransakCard = isCreditCard && onRamp.provider === "transak";
|
|
3011
3370
|
const isNative = selectedToken?.contract === viem.zeroAddress;
|
|
3012
3371
|
const { data: nativeBalanceData } = wagmi.useBalance({
|
|
3013
3372
|
address,
|
|
@@ -3023,7 +3382,7 @@ function DepositView({
|
|
|
3023
3382
|
query: { enabled: isConnectedSource && !!address && !!selectedToken && !isNative }
|
|
3024
3383
|
});
|
|
3025
3384
|
const walletBalance = isNative ? nativeBalanceData?.value : erc20Balance;
|
|
3026
|
-
const formattedWalletBalance = walletBalance != null && selectedToken ?
|
|
3385
|
+
const formattedWalletBalance = walletBalance != null && selectedToken ? chunkEXFISDHQ_cjs.formatTokenAmount(walletBalance.toString(), selectedToken.decimals) : "0.00";
|
|
3027
3386
|
const {
|
|
3028
3387
|
minBuyAmount: moonpayMinBuy,
|
|
3029
3388
|
isLoading: moonpayLimitsLoading,
|
|
@@ -3031,20 +3390,20 @@ function DepositView({
|
|
|
3031
3390
|
} = useMoonpayLimits({
|
|
3032
3391
|
currencyCode: selectedToken?.moonpayCurrencyCode,
|
|
3033
3392
|
apiBaseUrl: networkConfig.moonpayApiUrl,
|
|
3034
|
-
enabled:
|
|
3393
|
+
enabled: isMoonPayCard
|
|
3035
3394
|
});
|
|
3036
3395
|
const hasValidAmount = !!amount && parseFloat(amount) > 0;
|
|
3037
|
-
const maxAmountDecimals =
|
|
3396
|
+
const maxAmountDecimals = isMoonPayCard ? 2 : selectedToken?.decimals;
|
|
3038
3397
|
const tooManyDecimals = hasValidAmount && maxAmountDecimals != null && amount.includes(".") && amount.split(".")[1].length > maxAmountDecimals;
|
|
3039
|
-
const exceedsBalance = isConnectedSource && hasValidAmount && !tooManyDecimals && !!selectedToken && walletBalance != null &&
|
|
3040
|
-
const belowMoonpayMin =
|
|
3041
|
-
const moonpayLimitsUnready =
|
|
3042
|
-
const creditCardUnavailable = isCreditCard && !!
|
|
3398
|
+
const exceedsBalance = isConnectedSource && hasValidAmount && !tooManyDecimals && !!selectedToken && walletBalance != null && chunkEXFISDHQ_cjs.parseTokenAmount(amount, selectedToken.decimals) > walletBalance;
|
|
3399
|
+
const belowMoonpayMin = isMoonPayCard && hasValidAmount && moonpayMinBuy != null && parseFloat(amount) < moonpayMinBuy;
|
|
3400
|
+
const moonpayLimitsUnready = isMoonPayCard && !!onRamp.providerAssetCode && moonpayMinBuy == null;
|
|
3401
|
+
const creditCardUnavailable = isCreditCard && !!onRamp.unavailableReason;
|
|
3043
3402
|
const externalTokenUnavailable = isExternal && !!selectedToken && isNative;
|
|
3044
3403
|
const externalMinimumRequired = isExternal && !!allowance && !!selectedToken;
|
|
3045
3404
|
const externalMinimumLoading = externalMinimumRequired && externalMinimum === void 0;
|
|
3046
3405
|
const externalMinimumUnavailable = externalMinimumRequired && externalMinimum === null;
|
|
3047
|
-
const belowExternalMinimum = externalMinimumRequired && hasValidAmount && !tooManyDecimals && !!selectedToken && typeof externalMinimum === "bigint" &&
|
|
3406
|
+
const belowExternalMinimum = externalMinimumRequired && hasValidAmount && !tooManyDecimals && !!selectedToken && typeof externalMinimum === "bigint" && chunkEXFISDHQ_cjs.parseTokenAmount(amount, selectedToken.decimals) < externalMinimum;
|
|
3048
3407
|
const externalNeedsWallet = isExternal && (!!allowance || !hostedAuthConfig);
|
|
3049
3408
|
const needsConnect = (isConnectedSource || externalNeedsWallet) && !isConnected;
|
|
3050
3409
|
const canDeposit = hasValidAmount && !!selectedToken && !tooManyDecimals && !exceedsBalance && !belowMoonpayMin && !moonpayLimitsUnready && !creditCardUnavailable && !externalTokenUnavailable && !externalMinimumLoading && !externalMinimumUnavailable && !belowExternalMinimum && !needsConnect;
|
|
@@ -3054,8 +3413,8 @@ function DepositView({
|
|
|
3054
3413
|
};
|
|
3055
3414
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: [
|
|
3056
3415
|
isCreditCard ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
3057
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: "Buy with
|
|
3058
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Enter your deposit amount and proceed to sign a policy." })
|
|
3416
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: "Buy with card and deposit" }),
|
|
3417
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: isTransakCard ? "Enter your target deposit amount and continue." : "Enter your deposit amount and proceed to sign a policy." })
|
|
3059
3418
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
3060
3419
|
/* @__PURE__ */ jsxRuntime.jsxs("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: [
|
|
3061
3420
|
"Deposit from ",
|
|
@@ -3070,7 +3429,7 @@ function DepositView({
|
|
|
3070
3429
|
{
|
|
3071
3430
|
type: "button",
|
|
3072
3431
|
onClick: onSelectToken,
|
|
3073
|
-
disabled: isSubmitting,
|
|
3432
|
+
disabled: isSubmitting || isCreditCard && onRamp.tokenSelectionLocked,
|
|
3074
3433
|
className: "border-border bg-input flex w-full cursor-pointer items-center gap-3 rounded-lg border p-3 text-left disabled:cursor-not-allowed disabled:opacity-50",
|
|
3075
3434
|
children: [
|
|
3076
3435
|
selectedToken ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -3083,7 +3442,7 @@ function DepositView({
|
|
|
3083
3442
|
] })
|
|
3084
3443
|
] })
|
|
3085
3444
|
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground flex-1 text-sm", children: "Select token" }),
|
|
3086
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground flex h-5 w-5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, {}) })
|
|
3445
|
+
(!isCreditCard || !onRamp.tokenSelectionLocked) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground flex h-5 w-5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, {}) })
|
|
3087
3446
|
]
|
|
3088
3447
|
}
|
|
3089
3448
|
)
|
|
@@ -3101,7 +3460,7 @@ function DepositView({
|
|
|
3101
3460
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3102
3461
|
"div",
|
|
3103
3462
|
{
|
|
3104
|
-
className:
|
|
3463
|
+
className: chunkEXFISDHQ_cjs.cn(
|
|
3105
3464
|
"border-border bg-input flex items-center gap-2 rounded-[10px] border",
|
|
3106
3465
|
isConnectedSource ? "py-1 pr-1 pl-3" : "px-3 py-3"
|
|
3107
3466
|
),
|
|
@@ -3153,12 +3512,9 @@ function DepositView({
|
|
|
3153
3512
|
] }),
|
|
3154
3513
|
externalMinimumLoading && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Checking minimum deposit\u2026" }),
|
|
3155
3514
|
externalMinimumUnavailable && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", children: "Couldn\u2019t load the minimum deposit. Please try again." }),
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
creditCardUnavailable && /* @__PURE__ */ jsxRuntime.
|
|
3159
|
-
selectedToken?.symbol ?? "This token",
|
|
3160
|
-
" isn\u2019t available for card purchases yet."
|
|
3161
|
-
] }),
|
|
3515
|
+
isMoonPayCard && moonpayLimitsError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", children: "Couldn\u2019t load purchase limits. Please try again." }),
|
|
3516
|
+
isMoonPayCard && moonpayLimitsLoading && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Checking purchase limits\u2026" }),
|
|
3517
|
+
creditCardUnavailable && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", children: onRamp.unavailableReason }),
|
|
3162
3518
|
externalTokenUnavailable && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-destructive text-sm", children: [
|
|
3163
3519
|
selectedToken?.symbol ?? "This token",
|
|
3164
3520
|
" can\u2019t be used for external deposits. Choose an ERC20 token."
|
|
@@ -3185,7 +3541,7 @@ function DepositView({
|
|
|
3185
3541
|
if (selectedToken) onSubmit({ source, tokenId: selectedToken.id, amount });
|
|
3186
3542
|
},
|
|
3187
3543
|
className: "bg-primary text-primary-foreground hover:bg-primary/90 flex h-10 w-full cursor-pointer items-center justify-center rounded-[10px] px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",
|
|
3188
|
-
children: needsConnect ? "Connect Wallet" : allowance ? "Sign Policy and Deposit" : "Deposit"
|
|
3544
|
+
children: needsConnect ? "Connect Wallet" : isTransakCard ? "Continue" : allowance ? "Sign Policy and Deposit" : "Deposit"
|
|
3189
3545
|
}
|
|
3190
3546
|
)
|
|
3191
3547
|
] });
|
|
@@ -3241,7 +3597,7 @@ function ExternalDepositView({
|
|
|
3241
3597
|
onDiscardLock,
|
|
3242
3598
|
lock
|
|
3243
3599
|
}) {
|
|
3244
|
-
const { getChainById: getChainById2, getTokenById, serviceName } =
|
|
3600
|
+
const { getChainById: getChainById2, getTokenById, serviceName } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
3245
3601
|
const appName = serviceName ?? "Privana";
|
|
3246
3602
|
const { depositAddress, isReady, isLoading } = depositAddressState;
|
|
3247
3603
|
const chain = token ? getChainById2(token.chainId) : void 0;
|
|
@@ -3257,7 +3613,7 @@ function ExternalDepositView({
|
|
|
3257
3613
|
const [nothingFound, setNothingFound] = react.useState(false);
|
|
3258
3614
|
const [credited, setCredited] = react.useState(null);
|
|
3259
3615
|
const [showCancelWarning, setShowCancelWarning] = react.useState(false);
|
|
3260
|
-
const verification =
|
|
3616
|
+
const verification = chunkEXFISDHQ_cjs.useDepositVerification({
|
|
3261
3617
|
onCredited: (txHash, _response, creditedAmount) => {
|
|
3262
3618
|
if (settleAfterCredit) {
|
|
3263
3619
|
void settleAfterCredit(txHash, creditedAmount);
|
|
@@ -3381,11 +3737,11 @@ function ExternalDepositView({
|
|
|
3381
3737
|
] }),
|
|
3382
3738
|
showDepositInstructions && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3383
3739
|
!scanPaused && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Send the displayed amount in one transfer. Transfers below the minimum are not combined or automatically returned." }),
|
|
3384
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-secondary flex h-50 items-center justify-center rounded-[10px]", children: !isReady ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground px-6 text-center text-sm", children: "Connect your wallet to generate a deposit address." }) : depositAddress ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-[10px] bg-white p-3", children: /* @__PURE__ */ jsxRuntime.jsx(qrcode_react.QRCodeSVG, { value: depositAddress, size: 160 }) }) : isLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3740
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-secondary flex h-50 items-center justify-center rounded-[10px]", children: !isReady ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground px-6 text-center text-sm", children: "Connect your wallet to generate a deposit address." }) : depositAddress ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-[10px] bg-white p-3", children: /* @__PURE__ */ jsxRuntime.jsx(qrcode_react.QRCodeSVG, { value: depositAddress, size: 160 }) }) : isLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkEXFISDHQ_cjs.Skeleton, { className: "h-full w-full rounded-[10px]" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm", children: "Deposit address unavailable" }) }),
|
|
3385
3741
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
3386
3742
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Deposit Address" }),
|
|
3387
3743
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
3388
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-border flex h-10 min-w-0 flex-1 items-center rounded-[10px] border px-3", children: depositAddress ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground min-w-0 flex-1 truncate text-sm", children: depositAddress }) : isReady && isLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3744
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-border flex h-10 min-w-0 flex-1 items-center rounded-[10px] border px-3", children: depositAddress ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground min-w-0 flex-1 truncate text-sm", children: depositAddress }) : isReady && isLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkEXFISDHQ_cjs.Skeleton, { className: "h-4 w-3/4" }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "\u2014" }) }),
|
|
3389
3745
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3390
3746
|
"button",
|
|
3391
3747
|
{
|
|
@@ -3440,7 +3796,7 @@ function ExternalDepositView({
|
|
|
3440
3796
|
TransactionSuccessView,
|
|
3441
3797
|
{
|
|
3442
3798
|
title: "Deposit Credited",
|
|
3443
|
-
message: `Transfer ${
|
|
3799
|
+
message: `Transfer ${chunkEXFISDHQ_cjs.shortenAddress(credited.txHash)} has been credited to your Privana balance.`,
|
|
3444
3800
|
onDone: () => {
|
|
3445
3801
|
setCredited(null);
|
|
3446
3802
|
verification.reset();
|
|
@@ -3469,7 +3825,7 @@ function ExternalDepositView({
|
|
|
3469
3825
|
{
|
|
3470
3826
|
title: "Awaiting Deposit",
|
|
3471
3827
|
subtitle: listening ? "We are listening for your incoming transaction for the next hour." : "We've stopped listening automatically. Use the button below to check for your deposit.",
|
|
3472
|
-
remaining: listening ?
|
|
3828
|
+
remaining: listening ? chunkEXFISDHQ_cjs.formatCountdown(secondsLeft) : void 0
|
|
3473
3829
|
}
|
|
3474
3830
|
),
|
|
3475
3831
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
@@ -3497,9 +3853,11 @@ function ExternalDepositView({
|
|
|
3497
3853
|
] })
|
|
3498
3854
|
] });
|
|
3499
3855
|
}
|
|
3500
|
-
function MoonPayGate({
|
|
3501
|
-
|
|
3502
|
-
|
|
3856
|
+
function MoonPayGate({
|
|
3857
|
+
enabled,
|
|
3858
|
+
apiKey,
|
|
3859
|
+
children
|
|
3860
|
+
}) {
|
|
3503
3861
|
if (!enabled || !apiKey) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
3504
3862
|
return /* @__PURE__ */ jsxRuntime.jsx(moonpayReact.MoonPayProvider, { apiKey, children });
|
|
3505
3863
|
}
|
|
@@ -3519,7 +3877,7 @@ function MethodTabs({
|
|
|
3519
3877
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3520
3878
|
"div",
|
|
3521
3879
|
{
|
|
3522
|
-
className:
|
|
3880
|
+
className: chunkEXFISDHQ_cjs.cn(
|
|
3523
3881
|
"bg-input absolute top-1 bottom-1 left-1 w-[calc(50%-8px)] rounded-md transition-transform duration-200",
|
|
3524
3882
|
activeTab === "credit-card" && "translate-x-[calc(100%+8px)]"
|
|
3525
3883
|
)
|
|
@@ -3530,7 +3888,7 @@ function MethodTabs({
|
|
|
3530
3888
|
{
|
|
3531
3889
|
type: "button",
|
|
3532
3890
|
onClick: () => onTabChange("crypto"),
|
|
3533
|
-
className:
|
|
3891
|
+
className: chunkEXFISDHQ_cjs.cn(
|
|
3534
3892
|
"relative z-10 flex-1 cursor-pointer rounded-md px-3 py-[9px] text-sm font-medium transition-colors",
|
|
3535
3893
|
activeTab === "crypto" ? "text-foreground" : "text-muted-foreground"
|
|
3536
3894
|
),
|
|
@@ -3542,7 +3900,7 @@ function MethodTabs({
|
|
|
3542
3900
|
{
|
|
3543
3901
|
type: "button",
|
|
3544
3902
|
onClick: () => onTabChange("credit-card"),
|
|
3545
|
-
className:
|
|
3903
|
+
className: chunkEXFISDHQ_cjs.cn(
|
|
3546
3904
|
"relative z-10 flex-1 cursor-pointer rounded-md px-3 py-[9px] text-sm font-medium transition-colors",
|
|
3547
3905
|
activeTab === "credit-card" ? "text-foreground" : "text-muted-foreground"
|
|
3548
3906
|
),
|
|
@@ -3586,15 +3944,52 @@ function DepositModalContent({
|
|
|
3586
3944
|
onCloseBlockedChange,
|
|
3587
3945
|
onExit
|
|
3588
3946
|
}) {
|
|
3589
|
-
const {
|
|
3947
|
+
const {
|
|
3948
|
+
serviceName,
|
|
3949
|
+
enabledTokens,
|
|
3950
|
+
defaultToken,
|
|
3951
|
+
hostedAuthConfig,
|
|
3952
|
+
serviceAddress,
|
|
3953
|
+
getChainById: getChainById2,
|
|
3954
|
+
getTokenById,
|
|
3955
|
+
networkConfig,
|
|
3956
|
+
onRamp
|
|
3957
|
+
} = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
3590
3958
|
const { address } = wagmi.useAccount();
|
|
3959
|
+
const { privateReadQueryScope } = chunkEXFISDHQ_cjs.usePrivateReadRequest();
|
|
3960
|
+
const [privateReadApiUrl, accountingChainId, beneficiaryAddress] = privateReadQueryScope;
|
|
3591
3961
|
const appName = serviceName ?? "Privana";
|
|
3592
3962
|
const [activeTab, setActiveTab] = react.useState(defaultTab);
|
|
3593
3963
|
const [view, setView] = react.useState("method");
|
|
3594
3964
|
const [source, setSource] = react.useState("connected");
|
|
3595
3965
|
const [selectedTokenId, setSelectedTokenId] = react.useState(defaultToken?.id ?? "");
|
|
3596
3966
|
const [amount, setAmount] = react.useState("");
|
|
3597
|
-
const
|
|
3967
|
+
const [cardFlow, setCardFlow] = react.useState(null);
|
|
3968
|
+
const [cardFlowActive, setCardFlowActive] = react.useState(false);
|
|
3969
|
+
const [cardUnsafeToClose, setCardUnsafeToClose] = react.useState(false);
|
|
3970
|
+
const nextCardFlowId = react.useRef(0);
|
|
3971
|
+
const stateSelectedToken = enabledTokens.find((t) => t.id === selectedTokenId) ?? defaultToken;
|
|
3972
|
+
const cardOnRamp = react.useMemo(
|
|
3973
|
+
() => chunkEXFISDHQ_cjs.resolveProductOnRamp({
|
|
3974
|
+
config: onRamp,
|
|
3975
|
+
enabledTokens,
|
|
3976
|
+
legacyToken: stateSelectedToken,
|
|
3977
|
+
moonpayApiKey: networkConfig.moonpayApiKey
|
|
3978
|
+
}),
|
|
3979
|
+
[enabledTokens, networkConfig.moonpayApiKey, onRamp, stateSelectedToken]
|
|
3980
|
+
);
|
|
3981
|
+
const cardOnRampScope = react.useMemo(
|
|
3982
|
+
() => ({
|
|
3983
|
+
apiUrl: privateReadApiUrl,
|
|
3984
|
+
accountingChainId,
|
|
3985
|
+
accountingContract: networkConfig.accountingContract,
|
|
3986
|
+
beneficiaryAddress
|
|
3987
|
+
}),
|
|
3988
|
+
[accountingChainId, beneficiaryAddress, networkConfig.accountingContract, privateReadApiUrl]
|
|
3989
|
+
);
|
|
3990
|
+
const mountedCardFlow = cardFlow && chunkEXFISDHQ_cjs.matchesProductOnRampScope(cardFlow.scope, cardOnRampScope) ? cardFlow : null;
|
|
3991
|
+
const displayedCardOnRamp = view === "credit-card-widget" && mountedCardFlow ? mountedCardFlow.selection : cardOnRamp;
|
|
3992
|
+
const selectedToken = source === "credit-card" ? displayedCardOnRamp.token : stateSelectedToken;
|
|
3598
3993
|
const externalDepositAddress = useDepositAddress({
|
|
3599
3994
|
enabled: source === "external" && (view === "deposit" || view === "external-deposit")
|
|
3600
3995
|
});
|
|
@@ -3608,6 +4003,9 @@ function DepositModalContent({
|
|
|
3608
4003
|
setView("method");
|
|
3609
4004
|
setAmount("");
|
|
3610
4005
|
setSelectedTokenId("");
|
|
4006
|
+
setCardFlow(null);
|
|
4007
|
+
setCardFlowActive(false);
|
|
4008
|
+
setCardUnsafeToClose(false);
|
|
3611
4009
|
}
|
|
3612
4010
|
}, [address, hostedAuthConfig]);
|
|
3613
4011
|
const openDeposit = (next) => {
|
|
@@ -3630,9 +4028,33 @@ function DepositModalContent({
|
|
|
3630
4028
|
}
|
|
3631
4029
|
};
|
|
3632
4030
|
const finishCardPurchase = () => {
|
|
4031
|
+
setCardFlowActive(false);
|
|
4032
|
+
setCardUnsafeToClose(false);
|
|
3633
4033
|
setAmount("");
|
|
3634
4034
|
onDepositSuccess?.();
|
|
3635
4035
|
};
|
|
4036
|
+
const leaveCardPurchase = react.useCallback(() => {
|
|
4037
|
+
setCardFlow(null);
|
|
4038
|
+
setCardFlowActive(false);
|
|
4039
|
+
setCardUnsafeToClose(false);
|
|
4040
|
+
setAmount("");
|
|
4041
|
+
setView("deposit");
|
|
4042
|
+
}, []);
|
|
4043
|
+
react.useEffect(() => {
|
|
4044
|
+
if (cardFlow && !chunkEXFISDHQ_cjs.matchesProductOnRampScope(cardFlow.scope, cardOnRampScope)) {
|
|
4045
|
+
leaveCardPurchase();
|
|
4046
|
+
}
|
|
4047
|
+
}, [cardFlow, cardOnRampScope, leaveCardPurchase]);
|
|
4048
|
+
const cardOutcomeCallbacks = mountedCardFlow ? chunkEXFISDHQ_cjs.createProductOnRampOutcomeCallbacks({
|
|
4049
|
+
requiresLock: mountedCardFlow.requiresLock,
|
|
4050
|
+
onComplete: finishCardPurchase,
|
|
4051
|
+
onLockFailed: (err) => {
|
|
4052
|
+
setCardFlowActive(false);
|
|
4053
|
+
setCardUnsafeToClose(false);
|
|
4054
|
+
setLockFailure(err);
|
|
4055
|
+
onLockFailed?.(err);
|
|
4056
|
+
}
|
|
4057
|
+
}) : null;
|
|
3636
4058
|
const {
|
|
3637
4059
|
txHash,
|
|
3638
4060
|
isGettingAddress,
|
|
@@ -3702,7 +4124,7 @@ function DepositModalContent({
|
|
|
3702
4124
|
setView("deposit");
|
|
3703
4125
|
}
|
|
3704
4126
|
}, [allowance, externalLock.session, view]);
|
|
3705
|
-
const isUnsafeToClose = (isGettingAddress || isSendingTransaction) && !cancelled || externalLock.isSigning || externalLock.isSubmittingLock;
|
|
4127
|
+
const isUnsafeToClose = (isGettingAddress || isSendingTransaction) && !cancelled || externalLock.isSigning || externalLock.isSubmittingLock || cardUnsafeToClose;
|
|
3706
4128
|
react.useEffect(() => {
|
|
3707
4129
|
onCloseBlockedChange?.(isUnsafeToClose);
|
|
3708
4130
|
}, [isUnsafeToClose, onCloseBlockedChange]);
|
|
@@ -3721,7 +4143,7 @@ function DepositModalContent({
|
|
|
3721
4143
|
sonner.toast.error("External deposits support ERC20 tokens only");
|
|
3722
4144
|
return;
|
|
3723
4145
|
}
|
|
3724
|
-
const depositAmount =
|
|
4146
|
+
const depositAmount = chunkEXFISDHQ_cjs.parseTokenAmount(args.amount, token2.decimals);
|
|
3725
4147
|
if (!allowance) {
|
|
3726
4148
|
setView("external-deposit");
|
|
3727
4149
|
return;
|
|
@@ -3745,6 +4167,28 @@ function DepositModalContent({
|
|
|
3745
4167
|
return;
|
|
3746
4168
|
}
|
|
3747
4169
|
if (args.source === "credit-card") {
|
|
4170
|
+
if (cardFlow && cardFlowActive) {
|
|
4171
|
+
setView("credit-card-widget");
|
|
4172
|
+
return;
|
|
4173
|
+
}
|
|
4174
|
+
try {
|
|
4175
|
+
setCardFlow(
|
|
4176
|
+
chunkEXFISDHQ_cjs.createProductOnRampFlowSnapshot({
|
|
4177
|
+
id: ++nextCardFlowId.current,
|
|
4178
|
+
selection: cardOnRamp,
|
|
4179
|
+
amount: args.amount,
|
|
4180
|
+
allowance,
|
|
4181
|
+
lockServiceAddress: serviceAddress,
|
|
4182
|
+
moonpayApiKey: networkConfig.moonpayApiKey,
|
|
4183
|
+
scope: cardOnRampScope
|
|
4184
|
+
})
|
|
4185
|
+
);
|
|
4186
|
+
} catch (error) {
|
|
4187
|
+
sonner.toast.error(error instanceof Error ? error.message : "Card purchase is unavailable");
|
|
4188
|
+
return;
|
|
4189
|
+
}
|
|
4190
|
+
setCardFlowActive(false);
|
|
4191
|
+
setCardUnsafeToClose(false);
|
|
3748
4192
|
setView("credit-card-widget");
|
|
3749
4193
|
return;
|
|
3750
4194
|
}
|
|
@@ -3754,7 +4198,7 @@ function DepositModalContent({
|
|
|
3754
4198
|
setCancelled(false);
|
|
3755
4199
|
deposit({
|
|
3756
4200
|
tokenId: token.id,
|
|
3757
|
-
amount:
|
|
4201
|
+
amount: chunkEXFISDHQ_cjs.parseTokenAmount(args.amount, token.decimals),
|
|
3758
4202
|
postDepositLock: allowance ? {
|
|
3759
4203
|
maxAmount: BigInt(allowance.value),
|
|
3760
4204
|
lockDuration: allowance.lockDuration
|
|
@@ -3795,7 +4239,7 @@ function DepositModalContent({
|
|
|
3795
4239
|
];
|
|
3796
4240
|
const hasExternalLockRecovery = view === "external-deposit" && !!externalLock.session?.creditedAmount;
|
|
3797
4241
|
const externalSubmissionAmbiguous = hasExternalLockRecovery && !!lockFailure?.submissionMayHaveSucceeded;
|
|
3798
|
-
const savedExternalPayloadUsable = !!externalLock.session?.payload &&
|
|
4242
|
+
const savedExternalPayloadUsable = !!externalLock.session?.payload && chunkEXFISDHQ_cjs.isSignedLockUsable(externalLock.session.payload);
|
|
3799
4243
|
const ambiguousRecoveryMustBeAbandoned = externalSubmissionAmbiguous && !savedExternalPayloadUsable;
|
|
3800
4244
|
const externalRecoveryExitLabel = externalSubmissionAmbiguous ? "Stop recovery" : "Keep funds unlocked";
|
|
3801
4245
|
const lockFailureToken = hasExternalLockRecovery && externalLock.session ? getTokenById(externalLock.session.tokenId) ?? selectedToken : selectedToken;
|
|
@@ -3822,6 +4266,12 @@ function DepositModalContent({
|
|
|
3822
4266
|
setCancelled(false);
|
|
3823
4267
|
resetDeposit();
|
|
3824
4268
|
if (view === "external-deposit") setView("deposit");
|
|
4269
|
+
if (view === "credit-card-widget") {
|
|
4270
|
+
setCardFlow(null);
|
|
4271
|
+
setCardFlowActive(false);
|
|
4272
|
+
setCardUnsafeToClose(false);
|
|
4273
|
+
setView("deposit");
|
|
4274
|
+
}
|
|
3825
4275
|
};
|
|
3826
4276
|
const handleExternalLockRetry = () => {
|
|
3827
4277
|
externalLock.retryAfterCredit().catch((err) => {
|
|
@@ -3845,12 +4295,20 @@ function DepositModalContent({
|
|
|
3845
4295
|
retryVerification().catch(() => {
|
|
3846
4296
|
});
|
|
3847
4297
|
};
|
|
3848
|
-
const back = view === "external-deposit" ? { to: "deposit", label: "Deposit from External Wallet" } : view === "credit-card-widget" ? { to: "deposit", label: "Buy with
|
|
4298
|
+
const back = view === "external-deposit" ? { to: "deposit", label: "Deposit from External Wallet" } : view === "credit-card-widget" ? { to: "deposit", label: "Buy with card and deposit" } : view === "select-token" ? { to: "deposit", label: "Deposit" } : { to: "method", label: "Deposit Method" };
|
|
3849
4299
|
const goBack = () => {
|
|
3850
4300
|
if (view === "external-deposit" && externalLock.session) {
|
|
3851
4301
|
sonner.toast.error("Cancel the active deposit from the address screen before going back");
|
|
3852
4302
|
return;
|
|
3853
4303
|
}
|
|
4304
|
+
if (view === "credit-card-widget" && (cardUnsafeToClose || cardFlowActive)) {
|
|
4305
|
+
sonner.toast.error("Finish or recover the active card purchase before going back");
|
|
4306
|
+
return;
|
|
4307
|
+
}
|
|
4308
|
+
if (view === "credit-card-widget") {
|
|
4309
|
+
setCardFlow(null);
|
|
4310
|
+
setCardUnsafeToClose(false);
|
|
4311
|
+
}
|
|
3854
4312
|
if (back.to === "method") {
|
|
3855
4313
|
setAmount("");
|
|
3856
4314
|
setSelectedTokenId("");
|
|
@@ -3865,7 +4323,7 @@ function DepositModalContent({
|
|
|
3865
4323
|
onClick: onClose,
|
|
3866
4324
|
disabled: isUnsafeToClose,
|
|
3867
4325
|
"aria-label": "Close",
|
|
3868
|
-
className:
|
|
4326
|
+
className: chunkEXFISDHQ_cjs.cn(
|
|
3869
4327
|
"absolute top-6 right-5 z-20 flex h-5 w-5 items-center justify-center transition-colors",
|
|
3870
4328
|
isUnsafeToClose ? "text-muted-foreground/40 cursor-not-allowed" : "text-muted-foreground hover:text-foreground cursor-pointer"
|
|
3871
4329
|
),
|
|
@@ -3936,8 +4394,8 @@ function DepositModalContent({
|
|
|
3936
4394
|
] }),
|
|
3937
4395
|
activeView === "method" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: [
|
|
3938
4396
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
3939
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: activeTab === "crypto" ? "Choose the deposit method" : "Buy with
|
|
3940
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: activeTab === "crypto" ? "Choose the deposit method." : "
|
|
4397
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: activeTab === "crypto" ? "Choose the deposit method" : "Buy with card and deposit" }),
|
|
4398
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: activeTab === "crypto" ? "Choose the deposit method." : "Buy crypto by card and deposit it into your account." })
|
|
3941
4399
|
] }),
|
|
3942
4400
|
/* @__PURE__ */ jsxRuntime.jsx(MethodTabs, { activeTab, onTabChange: setActiveTab }),
|
|
3943
4401
|
activeTab === "crypto" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
@@ -3966,8 +4424,8 @@ function DepositModalContent({
|
|
|
3966
4424
|
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3967
4425
|
MethodOption,
|
|
3968
4426
|
{
|
|
3969
|
-
title: "
|
|
3970
|
-
description: "
|
|
4427
|
+
title: "Buy with card",
|
|
4428
|
+
description: "Purchase and deposit directly into your account.",
|
|
3971
4429
|
onClick: () => {
|
|
3972
4430
|
onSelectCreditCard?.();
|
|
3973
4431
|
openDeposit("credit-card");
|
|
@@ -3975,21 +4433,29 @@ function DepositModalContent({
|
|
|
3975
4433
|
}
|
|
3976
4434
|
) })
|
|
3977
4435
|
] }),
|
|
3978
|
-
activeView === "deposit" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3979
|
-
|
|
4436
|
+
activeView === "deposit" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4437
|
+
MoonPayGate,
|
|
3980
4438
|
{
|
|
3981
|
-
source,
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
4439
|
+
enabled: source === "credit-card" && cardOnRamp.provider === "moonpay" && !cardOnRamp.unavailableReason,
|
|
4440
|
+
apiKey: networkConfig.moonpayApiKey,
|
|
4441
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4442
|
+
DepositView,
|
|
4443
|
+
{
|
|
4444
|
+
source,
|
|
4445
|
+
selectedToken,
|
|
4446
|
+
onRamp: cardOnRamp,
|
|
4447
|
+
amount,
|
|
4448
|
+
allowance,
|
|
4449
|
+
externalMinimum,
|
|
4450
|
+
onAmountChange: setAmount,
|
|
4451
|
+
onSelectToken: () => setView("select-token"),
|
|
4452
|
+
onConnectWallet,
|
|
4453
|
+
onSubmit: handleSubmit,
|
|
4454
|
+
isSubmitting: isPending || externalLock.isSigning || externalLock.isSubmittingLock
|
|
4455
|
+
}
|
|
4456
|
+
)
|
|
3991
4457
|
}
|
|
3992
|
-
)
|
|
4458
|
+
),
|
|
3993
4459
|
activeView === "select-token" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3994
4460
|
TokenSelectorView,
|
|
3995
4461
|
{
|
|
@@ -4011,20 +4477,30 @@ function DepositModalContent({
|
|
|
4011
4477
|
lock: externalLock.session ? externalLock : void 0
|
|
4012
4478
|
}
|
|
4013
4479
|
),
|
|
4014
|
-
activeView === "credit-card-widget" &&
|
|
4015
|
-
|
|
4480
|
+
activeView === "credit-card-widget" && mountedCardFlow && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4481
|
+
MoonPayGate,
|
|
4016
4482
|
{
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4483
|
+
enabled: mountedCardFlow.selection.provider === "moonpay",
|
|
4484
|
+
apiKey: mountedCardFlow.moonpayApiKey,
|
|
4485
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4486
|
+
CreditCardWidgetView,
|
|
4487
|
+
{
|
|
4488
|
+
token: mountedCardFlow.selection.token,
|
|
4489
|
+
onRamp: mountedCardFlow.selection,
|
|
4490
|
+
amount: mountedCardFlow.amount,
|
|
4491
|
+
allowance: mountedCardFlow.allowance,
|
|
4492
|
+
lockServiceAddress: mountedCardFlow.lockServiceAddress,
|
|
4493
|
+
onUnsafeToCloseChange: setCardUnsafeToClose,
|
|
4494
|
+
onActiveFlowChange: setCardFlowActive,
|
|
4495
|
+
onCredited: cardOutcomeCallbacks?.onCredited,
|
|
4496
|
+
onLockSubmitted: cardOutcomeCallbacks?.onLockSubmitted,
|
|
4497
|
+
onLockFailed: cardOutcomeCallbacks?.onLockFailed,
|
|
4498
|
+
onLeave: leaveCardPurchase
|
|
4499
|
+
},
|
|
4500
|
+
mountedCardFlow.id
|
|
4501
|
+
)
|
|
4026
4502
|
}
|
|
4027
|
-
)
|
|
4503
|
+
)
|
|
4028
4504
|
] });
|
|
4029
4505
|
}
|
|
4030
4506
|
function DepositModal({ open, onClose, ...handlers }) {
|
|
@@ -4073,7 +4549,7 @@ function DepositInlineModal({ className, ...handlers }) {
|
|
|
4073
4549
|
"div",
|
|
4074
4550
|
{
|
|
4075
4551
|
"data-privana": true,
|
|
4076
|
-
className:
|
|
4552
|
+
className: chunkEXFISDHQ_cjs.cn(
|
|
4077
4553
|
"bg-card relative flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
4078
4554
|
className
|
|
4079
4555
|
),
|
|
@@ -4089,7 +4565,7 @@ function WithdrawView({
|
|
|
4089
4565
|
onPendingChange,
|
|
4090
4566
|
onWithdrawSuccess
|
|
4091
4567
|
}) {
|
|
4092
|
-
const { chains, getChainById: getChainById2 } =
|
|
4568
|
+
const { chains, getChainById: getChainById2 } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
4093
4569
|
const { isConnected, address } = wagmi.useAccount();
|
|
4094
4570
|
const [showSuccess, setShowSuccess] = react.useState(false);
|
|
4095
4571
|
const [showTimeout, setShowTimeout] = react.useState(false);
|
|
@@ -4103,7 +4579,7 @@ function WithdrawView({
|
|
|
4103
4579
|
tokenId: selectedToken?.id,
|
|
4104
4580
|
enabled: !!selectedToken
|
|
4105
4581
|
});
|
|
4106
|
-
const formattedBalance = selectedToken ?
|
|
4582
|
+
const formattedBalance = selectedToken ? chunkEXFISDHQ_cjs.formatTokenAmount(balanceWei, selectedToken.decimals) : "0.00";
|
|
4107
4583
|
const { withdraw, isPending, currentStep, error, reset } = useWithdraw({
|
|
4108
4584
|
onProcessingSuccess: () => {
|
|
4109
4585
|
onAmountChange("");
|
|
@@ -4119,7 +4595,7 @@ function WithdrawView({
|
|
|
4119
4595
|
setShowTimeout(true);
|
|
4120
4596
|
}
|
|
4121
4597
|
});
|
|
4122
|
-
const explorerUrl = address && targetChain ?
|
|
4598
|
+
const explorerUrl = address && targetChain ? chunkEXFISDHQ_cjs.getExplorerAddressUrl(targetChain.id, address) : void 0;
|
|
4123
4599
|
const getStepStatus = (step, after) => {
|
|
4124
4600
|
if (currentStep === step) return "active";
|
|
4125
4601
|
if (after.includes(currentStep)) return "completed";
|
|
@@ -4144,7 +4620,7 @@ function WithdrawView({
|
|
|
4144
4620
|
}, [isPending, cancelled, onPendingChange]);
|
|
4145
4621
|
const hasValidAmount = !!amount && parseFloat(amount) > 0;
|
|
4146
4622
|
const tooManyDecimals = !!hasValidAmount && !!selectedToken && amount.includes(".") && amount.split(".")[1].length > selectedToken.decimals;
|
|
4147
|
-
const exceedsBalance = !!hasValidAmount && !tooManyDecimals && !!selectedToken && !isBalanceLoading && !isBalanceError &&
|
|
4623
|
+
const exceedsBalance = !!hasValidAmount && !tooManyDecimals && !!selectedToken && !isBalanceLoading && !isBalanceError && chunkEXFISDHQ_cjs.parseTokenAmount(amount, selectedToken.decimals) > BigInt(balanceWei);
|
|
4148
4624
|
const canWithdraw = isConnected && hasValidAmount && !!selectedToken && !tooManyDecimals && !exceedsBalance;
|
|
4149
4625
|
const handleMax = () => {
|
|
4150
4626
|
if (!selectedToken) return;
|
|
@@ -4156,7 +4632,7 @@ function WithdrawView({
|
|
|
4156
4632
|
setCancelled(false);
|
|
4157
4633
|
await withdraw({
|
|
4158
4634
|
tokenId: selectedToken.id,
|
|
4159
|
-
amount:
|
|
4635
|
+
amount: chunkEXFISDHQ_cjs.parseTokenAmount(amount, selectedToken.decimals)
|
|
4160
4636
|
});
|
|
4161
4637
|
};
|
|
4162
4638
|
const handleCancel = () => {
|
|
@@ -4176,7 +4652,7 @@ function WithdrawView({
|
|
|
4176
4652
|
title: "Withdrawal Complete",
|
|
4177
4653
|
message: `Your ${selectedToken.symbol} withdrawal has been processed. Funds should appear in your wallet shortly.`,
|
|
4178
4654
|
explorerUrl,
|
|
4179
|
-
explorerLabel: targetChain ?
|
|
4655
|
+
explorerLabel: targetChain ? chunkEXFISDHQ_cjs.getExplorerLabel(targetChain.id) : void 0,
|
|
4180
4656
|
onDone: handleDone
|
|
4181
4657
|
}
|
|
4182
4658
|
) });
|
|
@@ -4288,7 +4764,7 @@ function WithdrawModalContent({
|
|
|
4288
4764
|
onBack,
|
|
4289
4765
|
onWithdrawSuccess
|
|
4290
4766
|
}) {
|
|
4291
|
-
const { serviceName, enabledTokens, defaultToken, hostedAuthConfig } =
|
|
4767
|
+
const { serviceName, enabledTokens, defaultToken, hostedAuthConfig } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
4292
4768
|
const { address } = wagmi.useAccount();
|
|
4293
4769
|
const appName = serviceName ?? "Privana";
|
|
4294
4770
|
const [view, setView] = react.useState("form");
|
|
@@ -4414,7 +4890,7 @@ function WithdrawInlineModal({ className, onWithdrawSuccess }) {
|
|
|
4414
4890
|
"div",
|
|
4415
4891
|
{
|
|
4416
4892
|
"data-privana": true,
|
|
4417
|
-
className:
|
|
4893
|
+
className: chunkEXFISDHQ_cjs.cn(
|
|
4418
4894
|
"bg-card relative flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
4419
4895
|
className
|
|
4420
4896
|
),
|
|
@@ -4458,14 +4934,14 @@ function SegmentedBalanceBar({
|
|
|
4458
4934
|
showAvailable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4459
4935
|
"div",
|
|
4460
4936
|
{
|
|
4461
|
-
className:
|
|
4937
|
+
className: chunkEXFISDHQ_cjs.cn(AVAILABLE_COLOR, "rounded-l-full", !showInUse && "rounded-r-full"),
|
|
4462
4938
|
style: { flexGrow: grow(availableWei) }
|
|
4463
4939
|
}
|
|
4464
4940
|
),
|
|
4465
4941
|
showInUse && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4466
4942
|
"div",
|
|
4467
4943
|
{
|
|
4468
|
-
className:
|
|
4944
|
+
className: chunkEXFISDHQ_cjs.cn(IN_USE_COLOR, "rounded-r-full", !showAvailable && "rounded-l-full"),
|
|
4469
4945
|
style: { flexGrow: grow(inUseWei) }
|
|
4470
4946
|
}
|
|
4471
4947
|
)
|
|
@@ -4473,7 +4949,7 @@ function SegmentedBalanceBar({
|
|
|
4473
4949
|
}
|
|
4474
4950
|
function BalanceLegendItem({ color, label }) {
|
|
4475
4951
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
4476
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className:
|
|
4952
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkEXFISDHQ_cjs.cn("h-2.5 w-2.5 rounded-full", color) }),
|
|
4477
4953
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground text-sm leading-5", children: label })
|
|
4478
4954
|
] });
|
|
4479
4955
|
}
|
|
@@ -4486,7 +4962,7 @@ function WalletBalanceView({
|
|
|
4486
4962
|
onAddFunds,
|
|
4487
4963
|
onWithdraw
|
|
4488
4964
|
}) {
|
|
4489
|
-
const { serviceName, serviceIcon, defaultToken } =
|
|
4965
|
+
const { serviceName, serviceIcon, defaultToken } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
4490
4966
|
const appName = serviceName ?? "Privana";
|
|
4491
4967
|
const token = defaultToken;
|
|
4492
4968
|
const {
|
|
@@ -4499,14 +4975,14 @@ function WalletBalanceView({
|
|
|
4499
4975
|
const variant = !session ? "idle" : inUseWei === 0n ? "session-zero" : availableWei === 0n ? "fully-in-use" : "mixed";
|
|
4500
4976
|
const expiry = session?.expiry;
|
|
4501
4977
|
useNow(3e4, expiry != null);
|
|
4502
|
-
const countdown = expiry != null ?
|
|
4978
|
+
const countdown = expiry != null ? chunkEXFISDHQ_cjs.formatTimeRemaining(expiry) : null;
|
|
4503
4979
|
const decimals = token?.decimals ?? 18;
|
|
4504
|
-
const totalFormatted =
|
|
4505
|
-
const availableFormatted =
|
|
4506
|
-
const inUseFormatted =
|
|
4980
|
+
const totalFormatted = chunkEXFISDHQ_cjs.formatTokenAmount((availableWei + inUseWei).toString(), decimals);
|
|
4981
|
+
const availableFormatted = chunkEXFISDHQ_cjs.formatTokenAmount(availableWei.toString(), decimals);
|
|
4982
|
+
const inUseFormatted = chunkEXFISDHQ_cjs.formatTokenAmount(inUseWei.toString(), decimals);
|
|
4507
4983
|
const hasValidAmount = !!amount && parseFloat(amount) > 0;
|
|
4508
4984
|
const tooManyDecimals = hasValidAmount && !!token && amount.includes(".") && amount.split(".")[1].length > token.decimals;
|
|
4509
|
-
const exceedsBalance = hasValidAmount && !tooManyDecimals && !!token && !isBalanceLoading && !isBalanceError &&
|
|
4985
|
+
const exceedsBalance = hasValidAmount && !tooManyDecimals && !!token && !isBalanceLoading && !isBalanceError && chunkEXFISDHQ_cjs.parseTokenAmount(amount, token.decimals) > availableWei;
|
|
4510
4986
|
const canFundSession = hasValidAmount && !!token && !tooManyDecimals && !exceedsBalance && !isBalanceLoading && !isBalanceError;
|
|
4511
4987
|
const handleMax = () => {
|
|
4512
4988
|
const max = availableFormatted.replace(/\s/g, "");
|
|
@@ -4524,7 +5000,7 @@ function WalletBalanceView({
|
|
|
4524
5000
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm leading-[14px]", children: "Total" }),
|
|
4525
5001
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-secondary text-muted-foreground rounded-full px-2 py-[5px] text-[10px] leading-[10px] font-bold", children: token?.symbol ?? "\u2014" })
|
|
4526
5002
|
] }),
|
|
4527
|
-
isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5003
|
+
isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkEXFISDHQ_cjs.Skeleton, { className: "h-9 w-40" }) : isBalanceError ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-[32px] leading-9 font-medium", children: "\u2014" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground text-[32px] leading-9 font-medium", children: totalFormatted })
|
|
4528
5004
|
] }),
|
|
4529
5005
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
4530
5006
|
/* @__PURE__ */ jsxRuntime.jsx(SegmentedBalanceBar, { availableWei, inUseWei }),
|
|
@@ -4675,7 +5151,7 @@ function WalletModalContent({
|
|
|
4675
5151
|
onCloseBlockedChange,
|
|
4676
5152
|
...depositHandlers
|
|
4677
5153
|
}) {
|
|
4678
|
-
const { serviceName, hostedAuthConfig } =
|
|
5154
|
+
const { serviceName, hostedAuthConfig } = chunkEXFISDHQ_cjs.usePrivanaContext();
|
|
4679
5155
|
const { address } = wagmi.useAccount();
|
|
4680
5156
|
const appName = serviceName ?? "Privana";
|
|
4681
5157
|
const [view, setView] = react.useState("balance");
|
|
@@ -4779,7 +5255,7 @@ function WalletModalContent({
|
|
|
4779
5255
|
onClick: onClose,
|
|
4780
5256
|
disabled: closeBlocked,
|
|
4781
5257
|
"aria-label": "Close",
|
|
4782
|
-
className:
|
|
5258
|
+
className: chunkEXFISDHQ_cjs.cn(
|
|
4783
5259
|
"absolute top-6 right-5 z-20 flex h-5 w-5 items-center justify-center transition-colors",
|
|
4784
5260
|
closeBlocked ? "text-muted-foreground/40 cursor-not-allowed" : "text-muted-foreground hover:text-foreground cursor-pointer"
|
|
4785
5261
|
),
|
|
@@ -4907,7 +5383,7 @@ function WalletInlineModal({ className, ...handlers }) {
|
|
|
4907
5383
|
"div",
|
|
4908
5384
|
{
|
|
4909
5385
|
"data-privana": true,
|
|
4910
|
-
className:
|
|
5386
|
+
className: chunkEXFISDHQ_cjs.cn(
|
|
4911
5387
|
"bg-card relative flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
4912
5388
|
className
|
|
4913
5389
|
),
|
|
@@ -4918,295 +5394,295 @@ function WalletInlineModal({ className, ...handlers }) {
|
|
|
4918
5394
|
|
|
4919
5395
|
Object.defineProperty(exports, "AccountingApiError", {
|
|
4920
5396
|
enumerable: true,
|
|
4921
|
-
get: function () { return
|
|
5397
|
+
get: function () { return chunkEXFISDHQ_cjs.AccountingApiError; }
|
|
4922
5398
|
});
|
|
4923
5399
|
Object.defineProperty(exports, "Button", {
|
|
4924
5400
|
enumerable: true,
|
|
4925
|
-
get: function () { return
|
|
5401
|
+
get: function () { return chunkEXFISDHQ_cjs.Button; }
|
|
4926
5402
|
});
|
|
4927
5403
|
Object.defineProperty(exports, "DEFAULT_LOCK_DURATION_SECONDS", {
|
|
4928
5404
|
enumerable: true,
|
|
4929
|
-
get: function () { return
|
|
5405
|
+
get: function () { return chunkEXFISDHQ_cjs.DEFAULT_LOCK_DURATION_SECONDS; }
|
|
4930
5406
|
});
|
|
4931
5407
|
Object.defineProperty(exports, "DEFAULT_ONRAMP_LOCK_BUFFER", {
|
|
4932
5408
|
enumerable: true,
|
|
4933
|
-
get: function () { return
|
|
5409
|
+
get: function () { return chunkEXFISDHQ_cjs.DEFAULT_ONRAMP_LOCK_BUFFER; }
|
|
4934
5410
|
});
|
|
4935
5411
|
Object.defineProperty(exports, "HOSTED_AUTH_CLOCK_SKEW_MS", {
|
|
4936
5412
|
enumerable: true,
|
|
4937
|
-
get: function () { return
|
|
5413
|
+
get: function () { return chunkEXFISDHQ_cjs.HOSTED_AUTH_CLOCK_SKEW_MS; }
|
|
4938
5414
|
});
|
|
4939
5415
|
Object.defineProperty(exports, "HostedAuthError", {
|
|
4940
5416
|
enumerable: true,
|
|
4941
|
-
get: function () { return
|
|
5417
|
+
get: function () { return chunkEXFISDHQ_cjs.HostedAuthError; }
|
|
4942
5418
|
});
|
|
4943
5419
|
Object.defineProperty(exports, "HostedAuthRequiredError", {
|
|
4944
5420
|
enumerable: true,
|
|
4945
|
-
get: function () { return
|
|
5421
|
+
get: function () { return chunkEXFISDHQ_cjs.HostedAuthRequiredError; }
|
|
4946
5422
|
});
|
|
4947
5423
|
Object.defineProperty(exports, "HostedAuthStateMismatchError", {
|
|
4948
5424
|
enumerable: true,
|
|
4949
|
-
get: function () { return
|
|
5425
|
+
get: function () { return chunkEXFISDHQ_cjs.HostedAuthStateMismatchError; }
|
|
4950
5426
|
});
|
|
4951
5427
|
Object.defineProperty(exports, "HttpClient", {
|
|
4952
5428
|
enumerable: true,
|
|
4953
|
-
get: function () { return
|
|
5429
|
+
get: function () { return chunkEXFISDHQ_cjs.HttpClient; }
|
|
4954
5430
|
});
|
|
4955
5431
|
Object.defineProperty(exports, "LOCK_TYPES", {
|
|
4956
5432
|
enumerable: true,
|
|
4957
|
-
get: function () { return
|
|
5433
|
+
get: function () { return chunkEXFISDHQ_cjs.LOCK_TYPES; }
|
|
4958
5434
|
});
|
|
4959
5435
|
Object.defineProperty(exports, "MODIFY_LOCK_TYPES", {
|
|
4960
5436
|
enumerable: true,
|
|
4961
|
-
get: function () { return
|
|
5437
|
+
get: function () { return chunkEXFISDHQ_cjs.MODIFY_LOCK_TYPES; }
|
|
4962
5438
|
});
|
|
4963
5439
|
Object.defineProperty(exports, "NETWORK_CONFIG", {
|
|
4964
5440
|
enumerable: true,
|
|
4965
|
-
get: function () { return
|
|
5441
|
+
get: function () { return chunkEXFISDHQ_cjs.NETWORK_CONFIG; }
|
|
4966
5442
|
});
|
|
4967
5443
|
Object.defineProperty(exports, "NetworkError", {
|
|
4968
5444
|
enumerable: true,
|
|
4969
|
-
get: function () { return
|
|
5445
|
+
get: function () { return chunkEXFISDHQ_cjs.NetworkError; }
|
|
4970
5446
|
});
|
|
4971
5447
|
Object.defineProperty(exports, "PostDepositLockError", {
|
|
4972
5448
|
enumerable: true,
|
|
4973
|
-
get: function () { return
|
|
5449
|
+
get: function () { return chunkEXFISDHQ_cjs.PostDepositLockError; }
|
|
4974
5450
|
});
|
|
4975
5451
|
Object.defineProperty(exports, "PrivanaClient", {
|
|
4976
5452
|
enumerable: true,
|
|
4977
|
-
get: function () { return
|
|
5453
|
+
get: function () { return chunkEXFISDHQ_cjs.PrivanaClient; }
|
|
4978
5454
|
});
|
|
4979
5455
|
Object.defineProperty(exports, "PrivanaProvider", {
|
|
4980
5456
|
enumerable: true,
|
|
4981
|
-
get: function () { return
|
|
5457
|
+
get: function () { return chunkEXFISDHQ_cjs.PrivanaProvider; }
|
|
4982
5458
|
});
|
|
4983
5459
|
Object.defineProperty(exports, "SUPPORTED_CHAINS", {
|
|
4984
5460
|
enumerable: true,
|
|
4985
|
-
get: function () { return
|
|
5461
|
+
get: function () { return chunkEXFISDHQ_cjs.SUPPORTED_CHAINS; }
|
|
4986
5462
|
});
|
|
4987
5463
|
Object.defineProperty(exports, "SiweAuthProvider", {
|
|
4988
5464
|
enumerable: true,
|
|
4989
|
-
get: function () { return
|
|
5465
|
+
get: function () { return chunkEXFISDHQ_cjs.SiweAuthProvider; }
|
|
4990
5466
|
});
|
|
4991
5467
|
Object.defineProperty(exports, "Skeleton", {
|
|
4992
5468
|
enumerable: true,
|
|
4993
|
-
get: function () { return
|
|
5469
|
+
get: function () { return chunkEXFISDHQ_cjs.Skeleton; }
|
|
4994
5470
|
});
|
|
4995
5471
|
Object.defineProperty(exports, "TRANSFER_LOCKED_TYPES", {
|
|
4996
5472
|
enumerable: true,
|
|
4997
|
-
get: function () { return
|
|
5473
|
+
get: function () { return chunkEXFISDHQ_cjs.TRANSFER_LOCKED_TYPES; }
|
|
4998
5474
|
});
|
|
4999
5475
|
Object.defineProperty(exports, "TRANSFER_TYPES", {
|
|
5000
5476
|
enumerable: true,
|
|
5001
|
-
get: function () { return
|
|
5477
|
+
get: function () { return chunkEXFISDHQ_cjs.TRANSFER_TYPES; }
|
|
5002
5478
|
});
|
|
5003
5479
|
Object.defineProperty(exports, "ValidationError", {
|
|
5004
5480
|
enumerable: true,
|
|
5005
|
-
get: function () { return
|
|
5481
|
+
get: function () { return chunkEXFISDHQ_cjs.ValidationError; }
|
|
5006
5482
|
});
|
|
5007
5483
|
Object.defineProperty(exports, "WITHDRAW_FROM_LOCK_TYPES", {
|
|
5008
5484
|
enumerable: true,
|
|
5009
|
-
get: function () { return
|
|
5485
|
+
get: function () { return chunkEXFISDHQ_cjs.WITHDRAW_FROM_LOCK_TYPES; }
|
|
5010
5486
|
});
|
|
5011
5487
|
Object.defineProperty(exports, "WITHDRAW_TYPES", {
|
|
5012
5488
|
enumerable: true,
|
|
5013
|
-
get: function () { return
|
|
5489
|
+
get: function () { return chunkEXFISDHQ_cjs.WITHDRAW_TYPES; }
|
|
5014
5490
|
});
|
|
5015
5491
|
Object.defineProperty(exports, "applyLockBuffer", {
|
|
5016
5492
|
enumerable: true,
|
|
5017
|
-
get: function () { return
|
|
5493
|
+
get: function () { return chunkEXFISDHQ_cjs.applyLockBuffer; }
|
|
5018
5494
|
});
|
|
5019
5495
|
Object.defineProperty(exports, "applyRefreshResponse", {
|
|
5020
5496
|
enumerable: true,
|
|
5021
|
-
get: function () { return
|
|
5497
|
+
get: function () { return chunkEXFISDHQ_cjs.applyRefreshResponse; }
|
|
5022
5498
|
});
|
|
5023
5499
|
Object.defineProperty(exports, "buildHostedAuthSession", {
|
|
5024
5500
|
enumerable: true,
|
|
5025
|
-
get: function () { return
|
|
5501
|
+
get: function () { return chunkEXFISDHQ_cjs.buildHostedAuthSession; }
|
|
5026
5502
|
});
|
|
5027
5503
|
Object.defineProperty(exports, "buildSiweStatement", {
|
|
5028
5504
|
enumerable: true,
|
|
5029
|
-
get: function () { return
|
|
5505
|
+
get: function () { return chunkEXFISDHQ_cjs.buildSiweStatement; }
|
|
5030
5506
|
});
|
|
5031
5507
|
Object.defineProperty(exports, "buttonVariants", {
|
|
5032
5508
|
enumerable: true,
|
|
5033
|
-
get: function () { return
|
|
5509
|
+
get: function () { return chunkEXFISDHQ_cjs.buttonVariants; }
|
|
5034
5510
|
});
|
|
5035
5511
|
Object.defineProperty(exports, "clampLockAmount", {
|
|
5036
5512
|
enumerable: true,
|
|
5037
|
-
get: function () { return
|
|
5513
|
+
get: function () { return chunkEXFISDHQ_cjs.clampLockAmount; }
|
|
5038
5514
|
});
|
|
5039
5515
|
Object.defineProperty(exports, "clearHostedAuthPendingTransaction", {
|
|
5040
5516
|
enumerable: true,
|
|
5041
|
-
get: function () { return
|
|
5517
|
+
get: function () { return chunkEXFISDHQ_cjs.clearHostedAuthPendingTransaction; }
|
|
5042
5518
|
});
|
|
5043
5519
|
Object.defineProperty(exports, "clearPendingLock", {
|
|
5044
5520
|
enumerable: true,
|
|
5045
|
-
get: function () { return
|
|
5521
|
+
get: function () { return chunkEXFISDHQ_cjs.clearPendingLock; }
|
|
5046
5522
|
});
|
|
5047
5523
|
Object.defineProperty(exports, "createDomain", {
|
|
5048
5524
|
enumerable: true,
|
|
5049
|
-
get: function () { return
|
|
5525
|
+
get: function () { return chunkEXFISDHQ_cjs.createDomain; }
|
|
5050
5526
|
});
|
|
5051
5527
|
Object.defineProperty(exports, "createHostedAuthPendingStorageKey", {
|
|
5052
5528
|
enumerable: true,
|
|
5053
|
-
get: function () { return
|
|
5529
|
+
get: function () { return chunkEXFISDHQ_cjs.createHostedAuthPendingStorageKey; }
|
|
5054
5530
|
});
|
|
5055
5531
|
Object.defineProperty(exports, "createHostedAuthState", {
|
|
5056
5532
|
enumerable: true,
|
|
5057
|
-
get: function () { return
|
|
5533
|
+
get: function () { return chunkEXFISDHQ_cjs.createHostedAuthState; }
|
|
5058
5534
|
});
|
|
5059
5535
|
Object.defineProperty(exports, "createHostedAuthStorageKey", {
|
|
5060
5536
|
enumerable: true,
|
|
5061
|
-
get: function () { return
|
|
5537
|
+
get: function () { return chunkEXFISDHQ_cjs.createHostedAuthStorageKey; }
|
|
5062
5538
|
});
|
|
5063
5539
|
Object.defineProperty(exports, "createLockExpiry", {
|
|
5064
5540
|
enumerable: true,
|
|
5065
|
-
get: function () { return
|
|
5541
|
+
get: function () { return chunkEXFISDHQ_cjs.createLockExpiry; }
|
|
5066
5542
|
});
|
|
5067
5543
|
Object.defineProperty(exports, "createPkceChallenge", {
|
|
5068
5544
|
enumerable: true,
|
|
5069
|
-
get: function () { return
|
|
5545
|
+
get: function () { return chunkEXFISDHQ_cjs.createPkceChallenge; }
|
|
5070
5546
|
});
|
|
5071
5547
|
Object.defineProperty(exports, "createPkceVerifier", {
|
|
5072
5548
|
enumerable: true,
|
|
5073
|
-
get: function () { return
|
|
5549
|
+
get: function () { return chunkEXFISDHQ_cjs.createPkceVerifier; }
|
|
5074
5550
|
});
|
|
5075
5551
|
Object.defineProperty(exports, "createSignedLockRequest", {
|
|
5076
5552
|
enumerable: true,
|
|
5077
|
-
get: function () { return
|
|
5553
|
+
get: function () { return chunkEXFISDHQ_cjs.createSignedLockRequest; }
|
|
5078
5554
|
});
|
|
5079
5555
|
Object.defineProperty(exports, "getAccountingContract", {
|
|
5080
5556
|
enumerable: true,
|
|
5081
|
-
get: function () { return
|
|
5557
|
+
get: function () { return chunkEXFISDHQ_cjs.getAccountingContract; }
|
|
5082
5558
|
});
|
|
5083
5559
|
Object.defineProperty(exports, "getApiUrl", {
|
|
5084
5560
|
enumerable: true,
|
|
5085
|
-
get: function () { return
|
|
5561
|
+
get: function () { return chunkEXFISDHQ_cjs.getApiUrl; }
|
|
5086
5562
|
});
|
|
5087
5563
|
Object.defineProperty(exports, "getChainById", {
|
|
5088
5564
|
enumerable: true,
|
|
5089
|
-
get: function () { return
|
|
5565
|
+
get: function () { return chunkEXFISDHQ_cjs.getChainById; }
|
|
5090
5566
|
});
|
|
5091
5567
|
Object.defineProperty(exports, "getChainId", {
|
|
5092
5568
|
enumerable: true,
|
|
5093
|
-
get: function () { return
|
|
5569
|
+
get: function () { return chunkEXFISDHQ_cjs.getChainId; }
|
|
5094
5570
|
});
|
|
5095
5571
|
Object.defineProperty(exports, "getExplorerAddressUrl", {
|
|
5096
5572
|
enumerable: true,
|
|
5097
|
-
get: function () { return
|
|
5573
|
+
get: function () { return chunkEXFISDHQ_cjs.getExplorerAddressUrl; }
|
|
5098
5574
|
});
|
|
5099
5575
|
Object.defineProperty(exports, "getExplorerLabel", {
|
|
5100
5576
|
enumerable: true,
|
|
5101
|
-
get: function () { return
|
|
5577
|
+
get: function () { return chunkEXFISDHQ_cjs.getExplorerLabel; }
|
|
5102
5578
|
});
|
|
5103
5579
|
Object.defineProperty(exports, "isHostedAuthRefreshActive", {
|
|
5104
5580
|
enumerable: true,
|
|
5105
|
-
get: function () { return
|
|
5581
|
+
get: function () { return chunkEXFISDHQ_cjs.isHostedAuthRefreshActive; }
|
|
5106
5582
|
});
|
|
5107
5583
|
Object.defineProperty(exports, "isHostedAuthSessionActive", {
|
|
5108
5584
|
enumerable: true,
|
|
5109
|
-
get: function () { return
|
|
5585
|
+
get: function () { return chunkEXFISDHQ_cjs.isHostedAuthSessionActive; }
|
|
5110
5586
|
});
|
|
5111
5587
|
Object.defineProperty(exports, "isSignedLockUsable", {
|
|
5112
5588
|
enumerable: true,
|
|
5113
|
-
get: function () { return
|
|
5589
|
+
get: function () { return chunkEXFISDHQ_cjs.isSignedLockUsable; }
|
|
5114
5590
|
});
|
|
5115
5591
|
Object.defineProperty(exports, "loadPendingLock", {
|
|
5116
5592
|
enumerable: true,
|
|
5117
|
-
get: function () { return
|
|
5593
|
+
get: function () { return chunkEXFISDHQ_cjs.loadPendingLock; }
|
|
5118
5594
|
});
|
|
5119
5595
|
Object.defineProperty(exports, "normalizeAddress", {
|
|
5120
5596
|
enumerable: true,
|
|
5121
|
-
get: function () { return
|
|
5597
|
+
get: function () { return chunkEXFISDHQ_cjs.normalizeAddress; }
|
|
5122
5598
|
});
|
|
5123
5599
|
Object.defineProperty(exports, "normalizeHex", {
|
|
5124
5600
|
enumerable: true,
|
|
5125
|
-
get: function () { return
|
|
5601
|
+
get: function () { return chunkEXFISDHQ_cjs.normalizeHex; }
|
|
5126
5602
|
});
|
|
5127
5603
|
Object.defineProperty(exports, "parseHostedAuthCallback", {
|
|
5128
5604
|
enumerable: true,
|
|
5129
|
-
get: function () { return
|
|
5605
|
+
get: function () { return chunkEXFISDHQ_cjs.parseHostedAuthCallback; }
|
|
5130
5606
|
});
|
|
5131
5607
|
Object.defineProperty(exports, "persistHostedAuthPendingTransaction", {
|
|
5132
5608
|
enumerable: true,
|
|
5133
|
-
get: function () { return
|
|
5609
|
+
get: function () { return chunkEXFISDHQ_cjs.persistHostedAuthPendingTransaction; }
|
|
5134
5610
|
});
|
|
5135
5611
|
Object.defineProperty(exports, "readHostedAuthPendingTransaction", {
|
|
5136
5612
|
enumerable: true,
|
|
5137
|
-
get: function () { return
|
|
5613
|
+
get: function () { return chunkEXFISDHQ_cjs.readHostedAuthPendingTransaction; }
|
|
5138
5614
|
});
|
|
5139
5615
|
Object.defineProperty(exports, "readStoredHostedAuthSession", {
|
|
5140
5616
|
enumerable: true,
|
|
5141
|
-
get: function () { return
|
|
5617
|
+
get: function () { return chunkEXFISDHQ_cjs.readStoredHostedAuthSession; }
|
|
5142
5618
|
});
|
|
5143
5619
|
Object.defineProperty(exports, "requireDepositLockOwner", {
|
|
5144
5620
|
enumerable: true,
|
|
5145
|
-
get: function () { return
|
|
5621
|
+
get: function () { return chunkEXFISDHQ_cjs.requireDepositLockOwner; }
|
|
5146
5622
|
});
|
|
5147
5623
|
Object.defineProperty(exports, "requireServiceAddress", {
|
|
5148
5624
|
enumerable: true,
|
|
5149
|
-
get: function () { return
|
|
5625
|
+
get: function () { return chunkEXFISDHQ_cjs.requireServiceAddress; }
|
|
5150
5626
|
});
|
|
5151
5627
|
Object.defineProperty(exports, "savePendingLock", {
|
|
5152
5628
|
enumerable: true,
|
|
5153
|
-
get: function () { return
|
|
5629
|
+
get: function () { return chunkEXFISDHQ_cjs.savePendingLock; }
|
|
5154
5630
|
});
|
|
5155
5631
|
Object.defineProperty(exports, "signLockMessage", {
|
|
5156
5632
|
enumerable: true,
|
|
5157
|
-
get: function () { return
|
|
5633
|
+
get: function () { return chunkEXFISDHQ_cjs.signLockMessage; }
|
|
5158
5634
|
});
|
|
5159
5635
|
Object.defineProperty(exports, "signModifyLockMessage", {
|
|
5160
5636
|
enumerable: true,
|
|
5161
|
-
get: function () { return
|
|
5637
|
+
get: function () { return chunkEXFISDHQ_cjs.signModifyLockMessage; }
|
|
5162
5638
|
});
|
|
5163
5639
|
Object.defineProperty(exports, "signTransferLockedMessage", {
|
|
5164
5640
|
enumerable: true,
|
|
5165
|
-
get: function () { return
|
|
5641
|
+
get: function () { return chunkEXFISDHQ_cjs.signTransferLockedMessage; }
|
|
5166
5642
|
});
|
|
5167
5643
|
Object.defineProperty(exports, "signTransferMessage", {
|
|
5168
5644
|
enumerable: true,
|
|
5169
|
-
get: function () { return
|
|
5645
|
+
get: function () { return chunkEXFISDHQ_cjs.signTransferMessage; }
|
|
5170
5646
|
});
|
|
5171
5647
|
Object.defineProperty(exports, "signWithdrawFromLockMessage", {
|
|
5172
5648
|
enumerable: true,
|
|
5173
|
-
get: function () { return
|
|
5649
|
+
get: function () { return chunkEXFISDHQ_cjs.signWithdrawFromLockMessage; }
|
|
5174
5650
|
});
|
|
5175
5651
|
Object.defineProperty(exports, "signWithdrawMessage", {
|
|
5176
5652
|
enumerable: true,
|
|
5177
|
-
get: function () { return
|
|
5653
|
+
get: function () { return chunkEXFISDHQ_cjs.signWithdrawMessage; }
|
|
5178
5654
|
});
|
|
5179
5655
|
Object.defineProperty(exports, "stripHostedAuthCallbackParams", {
|
|
5180
5656
|
enumerable: true,
|
|
5181
|
-
get: function () { return
|
|
5657
|
+
get: function () { return chunkEXFISDHQ_cjs.stripHostedAuthCallbackParams; }
|
|
5182
5658
|
});
|
|
5183
5659
|
Object.defineProperty(exports, "submitPendingLock", {
|
|
5184
5660
|
enumerable: true,
|
|
5185
|
-
get: function () { return
|
|
5661
|
+
get: function () { return chunkEXFISDHQ_cjs.submitPendingLock; }
|
|
5186
5662
|
});
|
|
5187
5663
|
Object.defineProperty(exports, "syncHostedAuthSessionToClient", {
|
|
5188
5664
|
enumerable: true,
|
|
5189
|
-
get: function () { return
|
|
5665
|
+
get: function () { return chunkEXFISDHQ_cjs.syncHostedAuthSessionToClient; }
|
|
5190
5666
|
});
|
|
5191
5667
|
Object.defineProperty(exports, "useDepositVerification", {
|
|
5192
5668
|
enumerable: true,
|
|
5193
|
-
get: function () { return
|
|
5669
|
+
get: function () { return chunkEXFISDHQ_cjs.useDepositVerification; }
|
|
5194
5670
|
});
|
|
5195
5671
|
Object.defineProperty(exports, "usePrivanaContext", {
|
|
5196
5672
|
enumerable: true,
|
|
5197
|
-
get: function () { return
|
|
5673
|
+
get: function () { return chunkEXFISDHQ_cjs.usePrivanaContext; }
|
|
5198
5674
|
});
|
|
5199
5675
|
Object.defineProperty(exports, "useSafeAccount", {
|
|
5200
5676
|
enumerable: true,
|
|
5201
|
-
get: function () { return
|
|
5677
|
+
get: function () { return chunkEXFISDHQ_cjs.useSafeAccount; }
|
|
5202
5678
|
});
|
|
5203
5679
|
Object.defineProperty(exports, "useSafePrivanaContext", {
|
|
5204
5680
|
enumerable: true,
|
|
5205
|
-
get: function () { return
|
|
5681
|
+
get: function () { return chunkEXFISDHQ_cjs.useSafePrivanaContext; }
|
|
5206
5682
|
});
|
|
5207
5683
|
Object.defineProperty(exports, "useSiweAuth", {
|
|
5208
5684
|
enumerable: true,
|
|
5209
|
-
get: function () { return
|
|
5685
|
+
get: function () { return chunkEXFISDHQ_cjs.useSiweAuth; }
|
|
5210
5686
|
});
|
|
5211
5687
|
exports.DepositInlineModal = DepositInlineModal;
|
|
5212
5688
|
exports.DepositModal = DepositModal;
|