@oasisprotocol/privana-sdk 0.5.7 → 0.5.9
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-FFYLKZ7J.cjs → chunk-KCXYYUUG.cjs} +1228 -105
- package/dist/chunk-KCXYYUUG.cjs.map +1 -0
- package/dist/{chunk-4VOTSHNC.js → chunk-RDYNQUMV.js} +1220 -107
- package/dist/chunk-RDYNQUMV.js.map +1 -0
- package/dist/index.cjs +797 -317
- 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 +560 -80
- 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-4VOTSHNC.js.map +0 -1
- package/dist/chunk-FFYLKZ7J.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 chunkKCXYYUUG_cjs = require('./chunk-KCXYYUUG.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 } = chunkKCXYYUUG_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 chunkKCXYYUUG_cjs.AccountingApiError && error.detail) {
|
|
44
|
+
return new chunkKCXYYUUG_cjs.HostedAuthError(error.detail);
|
|
45
45
|
}
|
|
46
46
|
if (error instanceof Error) {
|
|
47
47
|
return error;
|
|
48
48
|
}
|
|
49
|
-
return new
|
|
49
|
+
return new chunkKCXYYUUG_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
|
+
} = chunkKCXYYUUG_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 ? chunkKCXYYUUG_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
|
+
chunkKCXYYUUG_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 chunkKCXYYUUG_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 chunkKCXYYUUG_cjs.HostedAuthError("Hosted redirect authentication requires a browser environment.");
|
|
81
81
|
}
|
|
82
82
|
if (!pendingStorageKey) {
|
|
83
|
-
throw new
|
|
83
|
+
throw new chunkKCXYYUUG_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 = chunkKCXYYUUG_cjs.createPkceVerifier();
|
|
93
|
+
const codeChallenge = await chunkKCXYYUUG_cjs.createPkceChallenge(verifier);
|
|
94
|
+
const state = chunkKCXYYUUG_cjs.createHostedAuthState();
|
|
95
|
+
chunkKCXYYUUG_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 chunkKCXYYUUG_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 chunkKCXYYUUG_cjs.HostedAuthError("Hosted redirect authentication requires a browser environment.");
|
|
130
130
|
}
|
|
131
131
|
if (!pendingStorageKey) {
|
|
132
|
-
throw new
|
|
132
|
+
throw new chunkKCXYYUUG_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, "", chunkKCXYYUUG_cjs.stripHostedAuthCallbackParams(callbackUrl));
|
|
143
143
|
};
|
|
144
144
|
try {
|
|
145
|
-
const callback =
|
|
145
|
+
const callback = chunkKCXYYUUG_cjs.parseHostedAuthCallback(callbackUrl, hostedAuthConfig.redirectUri);
|
|
146
146
|
if (!callback) {
|
|
147
147
|
return null;
|
|
148
148
|
}
|
|
149
|
-
const pending =
|
|
149
|
+
const pending = chunkKCXYYUUG_cjs.readHostedAuthPendingTransaction(window.sessionStorage, pendingStorageKey);
|
|
150
150
|
if (!pending) {
|
|
151
151
|
clearPendingLogin();
|
|
152
152
|
cleanupCallbackUrl();
|
|
153
|
-
throw new
|
|
153
|
+
throw new chunkKCXYYUUG_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 chunkKCXYYUUG_cjs.HostedAuthStateMismatchError();
|
|
161
161
|
}
|
|
162
162
|
if ("error" in callback) {
|
|
163
163
|
clearPendingLogin();
|
|
164
164
|
cleanupCallbackUrl();
|
|
165
|
-
throw new
|
|
165
|
+
throw new chunkKCXYYUUG_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 = chunkKCXYYUUG_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 chunkKCXYYUUG_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 = chunkKCXYYUUG_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 } = chunkKCXYYUUG_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: chunkKCXYYUUG_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 } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
278
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkKCXYYUUG_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 = chunkKCXYYUUG_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 = chunkKCXYYUUG_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 && chunkKCXYYUUG_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 = chunkKCXYYUUG_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
|
+
chunkKCXYYUUG_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 } = chunkKCXYYUUG_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 } = chunkKCXYYUUG_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 chunkKCXYYUUG_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 chunkKCXYYUUG_cjs.PostDepositLockError ? err : new chunkKCXYYUUG_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
|
+
} = chunkKCXYYUUG_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 } = chunkKCXYYUUG_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 chunkKCXYYUUG_cjs.getTransactionReceipt(config, {
|
|
515
515
|
hash,
|
|
516
516
|
chainId: persisted.chainId
|
|
517
517
|
});
|
|
518
|
-
const blockNumber = await
|
|
518
|
+
const blockNumber = await chunkKCXYYUUG_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 chunkKCXYYUUG_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 && !chunkKCXYYUUG_cjs.canUseBrowserStorage()) {
|
|
576
576
|
throw new Error("Browser storage is required for locked deposit recovery");
|
|
577
577
|
}
|
|
578
|
-
const lockAmount =
|
|
578
|
+
const lockAmount = chunkKCXYYUUG_cjs.clampLockAmount(params.amount, params.postDepositLock?.maxAmount);
|
|
579
579
|
let signedLock;
|
|
580
580
|
if (params.postDepositLock) {
|
|
581
|
-
const lockOwner =
|
|
581
|
+
const lockOwner = chunkKCXYYUUG_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 chunkKCXYYUUG_cjs.getWalletClient(config, {
|
|
590
590
|
chainId: networkConfig.chainId
|
|
591
591
|
});
|
|
592
|
-
signedLock = await
|
|
592
|
+
signedLock = await chunkKCXYYUUG_cjs.createSignedLockRequest({
|
|
593
593
|
client,
|
|
594
594
|
walletClient: signingWalletClient,
|
|
595
595
|
userAddress: lockOwner,
|
|
596
596
|
networkConfig,
|
|
597
|
-
serviceAddress:
|
|
597
|
+
serviceAddress: chunkKCXYYUUG_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 chunkKCXYYUUG_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 = chunkKCXYYUUG_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 } = chunkKCXYYUUG_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 } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
755
755
|
const queryClient = reactQuery.useQueryClient();
|
|
756
|
-
const { chainId, ensureCorrectChain } =
|
|
756
|
+
const { chainId, ensureCorrectChain } = chunkKCXYYUUG_cjs.useEnsureCorrectChain();
|
|
757
757
|
const pollInterval = options.pollInterval ?? 3e3;
|
|
758
758
|
const pollTimeout = options.pollTimeout ?? 18e4;
|
|
759
759
|
const [currentStep, setCurrentStep] = react.useState("idle");
|
|
@@ -809,6 +809,7 @@ function useWithdraw(options = {}) {
|
|
|
809
809
|
const isStale = () => generation !== generationRef.current;
|
|
810
810
|
try {
|
|
811
811
|
if (!address || !walletClient) throw new Error("Wallet not connected");
|
|
812
|
+
setCurrentStep("preparing");
|
|
812
813
|
const pendingResponse = await client.getPendingWithdrawals(address);
|
|
813
814
|
if (isStale()) return void 0;
|
|
814
815
|
const knownIndices = new Set(pendingResponse.pending_withdrawals.map((w) => w.index));
|
|
@@ -821,7 +822,7 @@ function useWithdraw(options = {}) {
|
|
|
821
822
|
if (isStale()) return void 0;
|
|
822
823
|
const nonce = BigInt(nonceResponse.nonce);
|
|
823
824
|
setCurrentStep("signing");
|
|
824
|
-
const signature = await
|
|
825
|
+
const signature = await chunkKCXYYUUG_cjs.signWithdrawMessage({
|
|
825
826
|
walletClient,
|
|
826
827
|
chainId: signingChainId,
|
|
827
828
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -950,7 +951,7 @@ function useWithdraw(options = {}) {
|
|
|
950
951
|
function useLockFunds(options = {}) {
|
|
951
952
|
const { address } = wagmi.useAccount();
|
|
952
953
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
953
|
-
const { client, networkConfig, serviceAddress } =
|
|
954
|
+
const { client, networkConfig, serviceAddress } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
954
955
|
const queryClient = reactQuery.useQueryClient();
|
|
955
956
|
const mutation = reactQuery.useMutation({
|
|
956
957
|
mutationFn: async (params) => {
|
|
@@ -961,7 +962,7 @@ function useLockFunds(options = {}) {
|
|
|
961
962
|
throw new Error("Service address not configured");
|
|
962
963
|
}
|
|
963
964
|
const { nonce } = await client.getLockNonce(address);
|
|
964
|
-
const signature = await
|
|
965
|
+
const signature = await chunkKCXYYUUG_cjs.signLockMessage({
|
|
965
966
|
walletClient,
|
|
966
967
|
chainId: networkConfig.chainId,
|
|
967
968
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1009,7 +1010,7 @@ function useLockFunds(options = {}) {
|
|
|
1009
1010
|
}
|
|
1010
1011
|
function useUnlockFunds(options = {}) {
|
|
1011
1012
|
const { address } = wagmi.useAccount();
|
|
1012
|
-
const { client } =
|
|
1013
|
+
const { client } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1013
1014
|
const queryClient = reactQuery.useQueryClient();
|
|
1014
1015
|
const unlockMutation = reactQuery.useMutation({
|
|
1015
1016
|
mutationFn: async (params) => {
|
|
@@ -1079,7 +1080,7 @@ function useUnlockFunds(options = {}) {
|
|
|
1079
1080
|
function useTransfer(options = {}) {
|
|
1080
1081
|
const { address } = wagmi.useAccount();
|
|
1081
1082
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
1082
|
-
const { client, networkConfig, serviceAddress } =
|
|
1083
|
+
const { client, networkConfig, serviceAddress } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1083
1084
|
const queryClient = reactQuery.useQueryClient();
|
|
1084
1085
|
const transferMutation = reactQuery.useMutation({
|
|
1085
1086
|
mutationFn: async (params) => {
|
|
@@ -1087,7 +1088,7 @@ function useTransfer(options = {}) {
|
|
|
1087
1088
|
throw new Error("Wallet not connected");
|
|
1088
1089
|
}
|
|
1089
1090
|
const { nonce } = await client.getTransferNonce(address);
|
|
1090
|
-
const signature = await
|
|
1091
|
+
const signature = await chunkKCXYYUUG_cjs.signTransferMessage({
|
|
1091
1092
|
walletClient,
|
|
1092
1093
|
chainId: networkConfig.chainId,
|
|
1093
1094
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1124,7 +1125,7 @@ function useTransfer(options = {}) {
|
|
|
1124
1125
|
throw new Error("Service address not configured");
|
|
1125
1126
|
}
|
|
1126
1127
|
const { nonce } = await client.getTransferLockedNonce(serviceAddress);
|
|
1127
|
-
const signature = await
|
|
1128
|
+
const signature = await chunkKCXYYUUG_cjs.signTransferLockedMessage({
|
|
1128
1129
|
walletClient,
|
|
1129
1130
|
chainId: networkConfig.chainId,
|
|
1130
1131
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1184,8 +1185,8 @@ function useTransfer(options = {}) {
|
|
|
1184
1185
|
};
|
|
1185
1186
|
}
|
|
1186
1187
|
function useLockedFunds(options = {}) {
|
|
1187
|
-
const { client, pollingInterval, serviceAddress } =
|
|
1188
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1188
|
+
const { client, pollingInterval, serviceAddress } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1189
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
1189
1190
|
const query = reactQuery.useQuery({
|
|
1190
1191
|
queryKey: ["accounting-locked-funds", ...privateReadQueryScope, serviceAddress ?? null],
|
|
1191
1192
|
queryFn: async () => {
|
|
@@ -1207,8 +1208,8 @@ function useLockedFunds(options = {}) {
|
|
|
1207
1208
|
};
|
|
1208
1209
|
}
|
|
1209
1210
|
function useTotalLockedBalance(options = {}) {
|
|
1210
|
-
const { client, pollingInterval, defaultToken } =
|
|
1211
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1211
|
+
const { client, pollingInterval, defaultToken } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1212
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
1212
1213
|
const tokenId = options.tokenId ?? defaultToken?.id;
|
|
1213
1214
|
const query = reactQuery.useQuery({
|
|
1214
1215
|
queryKey: ["accounting-total-locked-balance", ...privateReadQueryScope, tokenId],
|
|
@@ -1229,8 +1230,8 @@ function useTotalLockedBalance(options = {}) {
|
|
|
1229
1230
|
};
|
|
1230
1231
|
}
|
|
1231
1232
|
function useExpiredLocks(options = {}) {
|
|
1232
|
-
const { client, pollingInterval } =
|
|
1233
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1233
|
+
const { client, pollingInterval } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1234
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
1234
1235
|
const query = reactQuery.useQuery({
|
|
1235
1236
|
queryKey: ["accounting-expired-locks", ...privateReadQueryScope],
|
|
1236
1237
|
queryFn: async () => {
|
|
@@ -1251,14 +1252,14 @@ function useExpiredLocks(options = {}) {
|
|
|
1251
1252
|
};
|
|
1252
1253
|
}
|
|
1253
1254
|
function statusCodeOf(error) {
|
|
1254
|
-
return error instanceof
|
|
1255
|
+
return error instanceof chunkKCXYYUUG_cjs.AccountingApiError ? error.statusCode : void 0;
|
|
1255
1256
|
}
|
|
1256
1257
|
function usePendingDeposits(options = {}) {
|
|
1257
1258
|
const queryClient = react.useContext(reactQuery.QueryClientContext);
|
|
1258
|
-
const accountingContext =
|
|
1259
|
+
const accountingContext = chunkKCXYYUUG_cjs.useSafePrivanaContext();
|
|
1259
1260
|
const hasProviders = !!queryClient && !!accountingContext;
|
|
1260
1261
|
const client = accountingContext?.client;
|
|
1261
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1262
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
1262
1263
|
const { chainId, tokenAddress, lookbackBlocks } = options;
|
|
1263
1264
|
const query = reactQuery.useQuery({
|
|
1264
1265
|
queryKey: ["accounting-pending-deposits", ...privateReadQueryScope, chainId, tokenAddress],
|
|
@@ -1305,7 +1306,7 @@ function usePendingDeposits(options = {}) {
|
|
|
1305
1306
|
}
|
|
1306
1307
|
function usePendingWithdrawals(options = {}) {
|
|
1307
1308
|
const { address, isConnected } = wagmi.useAccount();
|
|
1308
|
-
const { client, pollingInterval } =
|
|
1309
|
+
const { client, pollingInterval } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1309
1310
|
const query = reactQuery.useQuery({
|
|
1310
1311
|
queryKey: ["accounting-pending-withdrawals", address],
|
|
1311
1312
|
queryFn: async () => {
|
|
@@ -1341,8 +1342,8 @@ function usePendingWithdrawals(options = {}) {
|
|
|
1341
1342
|
};
|
|
1342
1343
|
}
|
|
1343
1344
|
function useHistory(options = {}) {
|
|
1344
|
-
const { client, pollingInterval } =
|
|
1345
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1345
|
+
const { client, pollingInterval } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1346
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
1346
1347
|
const offset = options.offset ?? -1;
|
|
1347
1348
|
const limit = options.limit ?? 50;
|
|
1348
1349
|
const query = reactQuery.useQuery({
|
|
@@ -1366,7 +1367,7 @@ function useHistory(options = {}) {
|
|
|
1366
1367
|
};
|
|
1367
1368
|
}
|
|
1368
1369
|
function useTokenInfo(options = {}) {
|
|
1369
|
-
const { client } =
|
|
1370
|
+
const { client } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1370
1371
|
const { tokenId } = options;
|
|
1371
1372
|
const query = reactQuery.useQuery({
|
|
1372
1373
|
queryKey: ["accounting-token-info", tokenId],
|
|
@@ -1386,7 +1387,7 @@ function useTokenInfo(options = {}) {
|
|
|
1386
1387
|
};
|
|
1387
1388
|
}
|
|
1388
1389
|
function useTokenList(options = {}) {
|
|
1389
|
-
const { client } =
|
|
1390
|
+
const { client } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1390
1391
|
const query = reactQuery.useQuery({
|
|
1391
1392
|
queryKey: ["accounting-token-list"],
|
|
1392
1393
|
queryFn: () => client.listTokens(),
|
|
@@ -1404,7 +1405,7 @@ function useTokenList(options = {}) {
|
|
|
1404
1405
|
function useModifyLock(options = {}) {
|
|
1405
1406
|
const { address } = wagmi.useAccount();
|
|
1406
1407
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
1407
|
-
const { client, networkConfig } =
|
|
1408
|
+
const { client, networkConfig } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1408
1409
|
const queryClient = reactQuery.useQueryClient();
|
|
1409
1410
|
const mutation = reactQuery.useMutation({
|
|
1410
1411
|
mutationFn: async (params) => {
|
|
@@ -1412,7 +1413,7 @@ function useModifyLock(options = {}) {
|
|
|
1412
1413
|
throw new Error("Wallet not connected");
|
|
1413
1414
|
}
|
|
1414
1415
|
const { nonce } = await client.getModifyLockNonce(address);
|
|
1415
|
-
const signature = await
|
|
1416
|
+
const signature = await chunkKCXYYUUG_cjs.signModifyLockMessage({
|
|
1416
1417
|
walletClient,
|
|
1417
1418
|
chainId: networkConfig.chainId,
|
|
1418
1419
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1471,7 +1472,7 @@ function DialogOverlay({
|
|
|
1471
1472
|
{
|
|
1472
1473
|
"data-slot": "dialog-overlay",
|
|
1473
1474
|
"data-privana": true,
|
|
1474
|
-
className:
|
|
1475
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
1475
1476
|
"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
1477
|
className
|
|
1477
1478
|
),
|
|
@@ -1493,7 +1494,7 @@ function DialogContent({
|
|
|
1493
1494
|
{
|
|
1494
1495
|
"data-slot": "dialog-content",
|
|
1495
1496
|
"data-privana": true,
|
|
1496
|
-
className:
|
|
1497
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
1497
1498
|
"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
1499
|
className
|
|
1499
1500
|
),
|
|
@@ -1521,7 +1522,7 @@ function DialogTitle({ className, ...props }) {
|
|
|
1521
1522
|
DialogPrimitive__namespace.Title,
|
|
1522
1523
|
{
|
|
1523
1524
|
"data-slot": "dialog-title",
|
|
1524
|
-
className:
|
|
1525
|
+
className: chunkKCXYYUUG_cjs.cn("text-lg leading-none font-semibold", className),
|
|
1525
1526
|
...props
|
|
1526
1527
|
}
|
|
1527
1528
|
);
|
|
@@ -1534,7 +1535,7 @@ function DialogDescription({
|
|
|
1534
1535
|
DialogPrimitive__namespace.Description,
|
|
1535
1536
|
{
|
|
1536
1537
|
"data-slot": "dialog-description",
|
|
1537
|
-
className:
|
|
1538
|
+
className: chunkKCXYYUUG_cjs.cn("text-muted-foreground text-sm", className),
|
|
1538
1539
|
...props
|
|
1539
1540
|
}
|
|
1540
1541
|
);
|
|
@@ -1576,7 +1577,7 @@ function sessionKey(owner, sessionId) {
|
|
|
1576
1577
|
return `${SESSION_PREFIX}${owner.toLowerCase()}:${sessionId}`;
|
|
1577
1578
|
}
|
|
1578
1579
|
function activeSessionId(owner) {
|
|
1579
|
-
const value =
|
|
1580
|
+
const value = chunkKCXYYUUG_cjs.getSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1580
1581
|
return value || void 0;
|
|
1581
1582
|
}
|
|
1582
1583
|
function isPositiveIntegerString(value) {
|
|
@@ -1608,7 +1609,7 @@ function isSessionRecord(value) {
|
|
|
1608
1609
|
}
|
|
1609
1610
|
function writeSessionRecord(session) {
|
|
1610
1611
|
const id = externalDepositSessionId(session.chainId, session.tokenId);
|
|
1611
|
-
return
|
|
1612
|
+
return chunkKCXYYUUG_cjs.setSharedBrowserStorageItem(sessionKey(session.owner, id), JSON.stringify(session));
|
|
1612
1613
|
}
|
|
1613
1614
|
function saveExternalDepositLockSession(session, expectedSession = null) {
|
|
1614
1615
|
if (!isSessionRecord(session)) throw new Error("Invalid external deposit lock session");
|
|
@@ -1622,12 +1623,12 @@ function saveExternalDepositLockSession(session, expectedSession = null) {
|
|
|
1622
1623
|
throw new Error("Unable to persist external deposit lock session");
|
|
1623
1624
|
}
|
|
1624
1625
|
if (previousId !== nextId) {
|
|
1625
|
-
if (!
|
|
1626
|
-
|
|
1626
|
+
if (!chunkKCXYYUUG_cjs.setSharedBrowserStorageItem(activeSessionKey(session.owner), nextId)) {
|
|
1627
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(sessionKey(session.owner, nextId));
|
|
1627
1628
|
throw new Error("Unable to persist external deposit lock session");
|
|
1628
1629
|
}
|
|
1629
1630
|
if (previousId) {
|
|
1630
|
-
|
|
1631
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(sessionKey(session.owner, previousId));
|
|
1631
1632
|
}
|
|
1632
1633
|
}
|
|
1633
1634
|
}
|
|
@@ -1636,17 +1637,17 @@ function loadExternalDepositLockSession(owner) {
|
|
|
1636
1637
|
if (!id) return void 0;
|
|
1637
1638
|
const key = sessionKey(owner, id);
|
|
1638
1639
|
try {
|
|
1639
|
-
const raw =
|
|
1640
|
+
const raw = chunkKCXYYUUG_cjs.getSharedBrowserStorageItem(key);
|
|
1640
1641
|
const parsed = raw ? JSON.parse(raw) : void 0;
|
|
1641
1642
|
if (!isSessionRecord(parsed) || parsed.owner.toLowerCase() !== owner.toLowerCase() || externalDepositSessionId(parsed.chainId, parsed.tokenId) !== id) {
|
|
1642
|
-
|
|
1643
|
-
|
|
1643
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(key);
|
|
1644
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1644
1645
|
return void 0;
|
|
1645
1646
|
}
|
|
1646
1647
|
return parsed;
|
|
1647
1648
|
} catch {
|
|
1648
|
-
|
|
1649
|
-
|
|
1649
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(key);
|
|
1650
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1650
1651
|
return void 0;
|
|
1651
1652
|
}
|
|
1652
1653
|
}
|
|
@@ -1677,8 +1678,8 @@ function clearExternalDepositLockSession(owner, expectedSessionId, expectedGener
|
|
|
1677
1678
|
const current = loadExternalDepositLockSession(owner);
|
|
1678
1679
|
if (!current || current.generation !== expectedGeneration) return;
|
|
1679
1680
|
}
|
|
1680
|
-
|
|
1681
|
-
|
|
1681
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(sessionKey(owner, id));
|
|
1682
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1682
1683
|
}
|
|
1683
1684
|
function isSameVerification(left, right) {
|
|
1684
1685
|
if (!left || !right) return left === right;
|
|
@@ -1731,7 +1732,7 @@ function markSubmissionAmbiguous(session, signature) {
|
|
|
1731
1732
|
return writeSessionRecord({ ...current, submissionAmbiguous: true });
|
|
1732
1733
|
}
|
|
1733
1734
|
function ambiguousSubmissionError(error) {
|
|
1734
|
-
return new
|
|
1735
|
+
return new chunkKCXYYUUG_cjs.PostDepositLockError(
|
|
1735
1736
|
"Lock submission could not be confirmed. Retry only the saved signature, or check locked funds before stopping recovery.",
|
|
1736
1737
|
error.reason,
|
|
1737
1738
|
error.signedAmount,
|
|
@@ -1744,7 +1745,7 @@ function ambiguousSubmissionError(error) {
|
|
|
1744
1745
|
}
|
|
1745
1746
|
function isDefinitiveSubmissionFailure(error) {
|
|
1746
1747
|
const cause = error.cause;
|
|
1747
|
-
return cause instanceof
|
|
1748
|
+
return cause instanceof chunkKCXYYUUG_cjs.AccountingApiError && cause.statusCode !== 408 && cause.statusCode < 500;
|
|
1748
1749
|
}
|
|
1749
1750
|
function submissionLockName(session) {
|
|
1750
1751
|
return `privana:external-deposit-lock:submit:${session.owner.toLowerCase()}:${externalDepositSessionId(session.chainId, session.tokenId)}`;
|
|
@@ -1764,7 +1765,7 @@ async function submitExternalDepositLock(client, session) {
|
|
|
1764
1765
|
return withSubmissionLock(session, async (crossTabExclusive) => {
|
|
1765
1766
|
const current = loadExternalDepositLockSession(session.owner);
|
|
1766
1767
|
if (!current || current.generation !== session.generation) {
|
|
1767
|
-
throw new
|
|
1768
|
+
throw new chunkKCXYYUUG_cjs.PostDepositLockError(
|
|
1768
1769
|
"External deposit lock session changed before submission",
|
|
1769
1770
|
"not-found",
|
|
1770
1771
|
BigInt(session.maxLockAmount),
|
|
@@ -1783,7 +1784,7 @@ async function submitExternalDepositLock(client, session) {
|
|
|
1783
1784
|
async function submitExternalDepositLockAttempt(client, session, crossTabExclusive) {
|
|
1784
1785
|
const creditedAmount = session.creditedAmount ? BigInt(session.creditedAmount) : void 0;
|
|
1785
1786
|
if (!creditedAmount) {
|
|
1786
|
-
throw new
|
|
1787
|
+
throw new chunkKCXYYUUG_cjs.PostDepositLockError(
|
|
1787
1788
|
"External deposit has not been credited",
|
|
1788
1789
|
"submission-failed",
|
|
1789
1790
|
BigInt(session.maxLockAmount)
|
|
@@ -1791,7 +1792,7 @@ async function submitExternalDepositLockAttempt(client, session, crossTabExclusi
|
|
|
1791
1792
|
}
|
|
1792
1793
|
const payload = session.payload;
|
|
1793
1794
|
if (!payload) {
|
|
1794
|
-
throw new
|
|
1795
|
+
throw new chunkKCXYYUUG_cjs.PostDepositLockError(
|
|
1795
1796
|
"No persisted signed policy found for this deposit session",
|
|
1796
1797
|
"not-found",
|
|
1797
1798
|
BigInt(session.maxLockAmount),
|
|
@@ -1799,7 +1800,7 @@ async function submitExternalDepositLockAttempt(client, session, crossTabExclusi
|
|
|
1799
1800
|
);
|
|
1800
1801
|
}
|
|
1801
1802
|
try {
|
|
1802
|
-
return await
|
|
1803
|
+
return await chunkKCXYYUUG_cjs.submitPendingLock({
|
|
1803
1804
|
client,
|
|
1804
1805
|
payload,
|
|
1805
1806
|
creditedAmount,
|
|
@@ -1810,23 +1811,23 @@ async function submitExternalDepositLockAttempt(client, session, crossTabExclusi
|
|
|
1810
1811
|
}
|
|
1811
1812
|
});
|
|
1812
1813
|
} catch (err) {
|
|
1813
|
-
if (err instanceof
|
|
1814
|
+
if (err instanceof chunkKCXYYUUG_cjs.PostDepositLockError && err.reason === "submission-failed" && crossTabExclusive && !session.submissionAmbiguous && isDefinitiveSubmissionFailure(err)) {
|
|
1814
1815
|
if (!clearSubmittedPayload(session, payload.signature, true)) {
|
|
1815
1816
|
const latest = loadExternalDepositLockSession(session.owner);
|
|
1816
1817
|
if (latest?.submissionAmbiguous) throw ambiguousSubmissionError(err);
|
|
1817
1818
|
}
|
|
1818
|
-
} else if (err instanceof
|
|
1819
|
+
} else if (err instanceof chunkKCXYYUUG_cjs.PostDepositLockError && err.reason === "submission-failed") {
|
|
1819
1820
|
const ambiguous = markSubmissionAmbiguous(session, payload.signature) || loadExternalDepositLockSession(session.owner)?.submissionAmbiguous === true;
|
|
1820
1821
|
if (ambiguous) throw ambiguousSubmissionError(err);
|
|
1821
1822
|
} else {
|
|
1822
1823
|
const current = loadExternalDepositLockSession(session.owner);
|
|
1823
1824
|
if (session.submissionAmbiguous || current?.submissionAmbiguous) {
|
|
1824
|
-
if (err instanceof
|
|
1825
|
+
if (err instanceof chunkKCXYYUUG_cjs.PostDepositLockError) throw ambiguousSubmissionError(err);
|
|
1825
1826
|
throw err;
|
|
1826
1827
|
}
|
|
1827
1828
|
if (!clearSubmittedPayload(session, payload.signature)) {
|
|
1828
1829
|
const latest = loadExternalDepositLockSession(session.owner);
|
|
1829
|
-
if (latest?.submissionAmbiguous && err instanceof
|
|
1830
|
+
if (latest?.submissionAmbiguous && err instanceof chunkKCXYYUUG_cjs.PostDepositLockError) {
|
|
1830
1831
|
throw ambiguousSubmissionError(err);
|
|
1831
1832
|
}
|
|
1832
1833
|
}
|
|
@@ -1839,12 +1840,12 @@ function useExternalDepositLock({
|
|
|
1839
1840
|
onLockSubmitted,
|
|
1840
1841
|
onLockFailed
|
|
1841
1842
|
}) {
|
|
1842
|
-
const { client, networkConfig, serviceAddress, getTokenById, tokensStatus } =
|
|
1843
|
+
const { client, networkConfig, serviceAddress, getTokenById, tokensStatus } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1843
1844
|
const config = wagmi.useConfig();
|
|
1844
1845
|
const queryClient = reactQuery.useQueryClient();
|
|
1845
1846
|
const { address } = wagmi.useAccount();
|
|
1846
|
-
const { privateReadAddress } =
|
|
1847
|
-
const { ensureCorrectChain } =
|
|
1847
|
+
const { privateReadAddress } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
1848
|
+
const { ensureCorrectChain } = chunkKCXYYUUG_cjs.useEnsureCorrectChain();
|
|
1848
1849
|
const [isSigning, setIsSigning] = react.useState(false);
|
|
1849
1850
|
const [isSubmittingLock, setIsSubmittingLock] = react.useState(false);
|
|
1850
1851
|
const [session, setSession] = react.useState(null);
|
|
@@ -1904,7 +1905,7 @@ function useExternalDepositLock({
|
|
|
1904
1905
|
result = await submitExternalDepositLock(client, submission);
|
|
1905
1906
|
} catch (err) {
|
|
1906
1907
|
const stored = loadExternalDepositLockSession(active.owner);
|
|
1907
|
-
const error = err instanceof
|
|
1908
|
+
const error = err instanceof chunkKCXYYUUG_cjs.PostDepositLockError ? err : new chunkKCXYYUUG_cjs.PostDepositLockError(
|
|
1908
1909
|
err instanceof Error ? err.message : "Lock submission failed",
|
|
1909
1910
|
"submission-failed",
|
|
1910
1911
|
BigInt(active.maxLockAmount),
|
|
@@ -1983,7 +1984,7 @@ function useExternalDepositLock({
|
|
|
1983
1984
|
void submitSession(restored);
|
|
1984
1985
|
} else if (restored.creditedAmount) {
|
|
1985
1986
|
notifyFailure(
|
|
1986
|
-
new
|
|
1987
|
+
new chunkKCXYYUUG_cjs.PostDepositLockError(
|
|
1987
1988
|
"Deposit credited; sign a fresh policy to lock the funds",
|
|
1988
1989
|
"not-found",
|
|
1989
1990
|
BigInt(restored.maxLockAmount),
|
|
@@ -2023,10 +2024,10 @@ function useExternalDepositLock({
|
|
|
2023
2024
|
if (signingRef.current || settlingRef.current) {
|
|
2024
2025
|
throw new Error("A policy operation is already in progress");
|
|
2025
2026
|
}
|
|
2026
|
-
if (!
|
|
2027
|
+
if (!chunkKCXYYUUG_cjs.canUseSharedBrowserStorage()) {
|
|
2027
2028
|
throw new Error("Browser storage is required for locked deposit recovery");
|
|
2028
2029
|
}
|
|
2029
|
-
const owner =
|
|
2030
|
+
const owner = chunkKCXYYUUG_cjs.requireDepositLockOwner(address, privateReadAddress);
|
|
2030
2031
|
if (sessionRef.current || loadExternalDepositLockSession(owner)) {
|
|
2031
2032
|
throw new Error("Finish or cancel the active external deposit before starting another");
|
|
2032
2033
|
}
|
|
@@ -2035,26 +2036,26 @@ function useExternalDepositLock({
|
|
|
2035
2036
|
if (token.contract === viem.zeroAddress) {
|
|
2036
2037
|
throw new Error("External deposits support ERC20 tokens only");
|
|
2037
2038
|
}
|
|
2038
|
-
const targetService =
|
|
2039
|
-
const lockDuration = allowance.lockDuration ??
|
|
2039
|
+
const targetService = chunkKCXYYUUG_cjs.requireServiceAddress(serviceAddress);
|
|
2040
|
+
const lockDuration = allowance.lockDuration ?? chunkKCXYYUUG_cjs.DEFAULT_LOCK_DURATION_SECONDS;
|
|
2040
2041
|
signingRef.current = true;
|
|
2041
2042
|
setIsSigning(true);
|
|
2042
2043
|
try {
|
|
2043
2044
|
await ensureCorrectChain(networkConfig.chainId);
|
|
2044
|
-
const signingWalletClient = await
|
|
2045
|
+
const signingWalletClient = await chunkKCXYYUUG_cjs.getWalletClient(config, {
|
|
2045
2046
|
chainId: networkConfig.chainId
|
|
2046
2047
|
});
|
|
2047
|
-
const payload = await
|
|
2048
|
+
const payload = await chunkKCXYYUUG_cjs.createSignedLockRequest({
|
|
2048
2049
|
client,
|
|
2049
2050
|
walletClient: signingWalletClient,
|
|
2050
2051
|
userAddress: owner,
|
|
2051
2052
|
networkConfig,
|
|
2052
2053
|
serviceAddress: targetService,
|
|
2053
2054
|
tokenId: token.id,
|
|
2054
|
-
amount:
|
|
2055
|
+
amount: chunkKCXYYUUG_cjs.clampLockAmount(amount, BigInt(allowance.value)),
|
|
2055
2056
|
lockDuration
|
|
2056
2057
|
});
|
|
2057
|
-
const startBlock = await
|
|
2058
|
+
const startBlock = await chunkKCXYYUUG_cjs.getBlockNumber(config, { chainId: token.chainId });
|
|
2058
2059
|
if (startBlock > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
2059
2060
|
throw new Error("Source-chain block number exceeds the supported range");
|
|
2060
2061
|
}
|
|
@@ -2120,7 +2121,7 @@ function useExternalDepositLock({
|
|
|
2120
2121
|
pendingCreditedTransitionRef.current = { predecessor: active, credited };
|
|
2121
2122
|
installSession(credited);
|
|
2122
2123
|
notifyFailure(
|
|
2123
|
-
new
|
|
2124
|
+
new chunkKCXYYUUG_cjs.PostDepositLockError(
|
|
2124
2125
|
err instanceof Error ? err.message : "Unable to persist credited deposit state",
|
|
2125
2126
|
"submission-failed",
|
|
2126
2127
|
BigInt(active.maxLockAmount),
|
|
@@ -2180,7 +2181,7 @@ function useExternalDepositLock({
|
|
|
2180
2181
|
if (!token || token.chainId !== active.chainId || token.contract === viem.zeroAddress) {
|
|
2181
2182
|
throw new Error("The credited token is no longer available");
|
|
2182
2183
|
}
|
|
2183
|
-
const targetService =
|
|
2184
|
+
const targetService = chunkKCXYYUUG_cjs.requireServiceAddress(serviceAddress);
|
|
2184
2185
|
if (targetService.toLowerCase() !== active.serviceAddress.toLowerCase()) {
|
|
2185
2186
|
throw new Error("The service for this credited deposit has changed");
|
|
2186
2187
|
}
|
|
@@ -2193,17 +2194,17 @@ function useExternalDepositLock({
|
|
|
2193
2194
|
"The previous lock submission may have succeeded; a fresh signature is unsafe"
|
|
2194
2195
|
);
|
|
2195
2196
|
}
|
|
2196
|
-
const owner =
|
|
2197
|
+
const owner = chunkKCXYYUUG_cjs.requireDepositLockOwner(address, privateReadAddress);
|
|
2197
2198
|
const amount = externalDepositRetryAmount(active);
|
|
2198
2199
|
let retrySession;
|
|
2199
2200
|
signingRef.current = true;
|
|
2200
2201
|
setIsSigning(true);
|
|
2201
2202
|
try {
|
|
2202
2203
|
await ensureCorrectChain(networkConfig.chainId);
|
|
2203
|
-
const signingWalletClient = await
|
|
2204
|
+
const signingWalletClient = await chunkKCXYYUUG_cjs.getWalletClient(config, {
|
|
2204
2205
|
chainId: networkConfig.chainId
|
|
2205
2206
|
});
|
|
2206
|
-
const payload = await
|
|
2207
|
+
const payload = await chunkKCXYYUUG_cjs.createSignedLockRequest({
|
|
2207
2208
|
client,
|
|
2208
2209
|
walletClient: signingWalletClient,
|
|
2209
2210
|
userAddress: owner,
|
|
@@ -2425,7 +2426,7 @@ function getChainIcon(chainId, size) {
|
|
|
2425
2426
|
}
|
|
2426
2427
|
}
|
|
2427
2428
|
function TokenSelectorView({ selectedTokenId, onSelect }) {
|
|
2428
|
-
const { enabledTokens, getChainById: getChainById2 } =
|
|
2429
|
+
const { enabledTokens, getChainById: getChainById2 } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
2429
2430
|
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: [
|
|
2430
2431
|
enabledTokens.map((token) => {
|
|
2431
2432
|
const isSelected = selectedTokenId === token.id;
|
|
@@ -2435,7 +2436,7 @@ function TokenSelectorView({ selectedTokenId, onSelect }) {
|
|
|
2435
2436
|
{
|
|
2436
2437
|
type: "button",
|
|
2437
2438
|
onClick: () => onSelect(token.id),
|
|
2438
|
-
className:
|
|
2439
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
2439
2440
|
"hover:bg-secondary flex w-full cursor-pointer items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors",
|
|
2440
2441
|
isSelected && "bg-secondary"
|
|
2441
2442
|
),
|
|
@@ -2476,15 +2477,356 @@ function TokenSelectorView({ selectedTokenId, onSelect }) {
|
|
|
2476
2477
|
enabledTokens.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground px-3 py-6 text-center text-sm", children: "No tokens available" })
|
|
2477
2478
|
] }) });
|
|
2478
2479
|
}
|
|
2480
|
+
function assertTransakCheckoutPreconditions({
|
|
2481
|
+
activeIntentId,
|
|
2482
|
+
canOpen,
|
|
2483
|
+
canRecreateSession
|
|
2484
|
+
}) {
|
|
2485
|
+
if (activeIntentId && !canRecreateSession) {
|
|
2486
|
+
throw new Error("Continue signed-intent recovery instead of reopening this checkout");
|
|
2487
|
+
}
|
|
2488
|
+
if (!canOpen) {
|
|
2489
|
+
throw new Error("Card checkout is unavailable; close this purchase and start again");
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
function TransakCardWidgetView({
|
|
2493
|
+
token,
|
|
2494
|
+
providerAssetCode,
|
|
2495
|
+
amount,
|
|
2496
|
+
allowance,
|
|
2497
|
+
lockServiceAddress,
|
|
2498
|
+
onCredited,
|
|
2499
|
+
onLockSubmitted,
|
|
2500
|
+
onLockFailed,
|
|
2501
|
+
onLeave,
|
|
2502
|
+
onUnsafeToCloseChange,
|
|
2503
|
+
onActiveFlowChange,
|
|
2504
|
+
useOnRamp = chunkKCXYYUUG_cjs.useTransakOnRamp
|
|
2505
|
+
}) {
|
|
2506
|
+
const [actionError, setActionError] = react.useState(null);
|
|
2507
|
+
const [rowError, setRowError] = react.useState(null);
|
|
2508
|
+
const [lockSettled, setLockSettled] = react.useState(false);
|
|
2509
|
+
const [lockError, setLockError] = react.useState(null);
|
|
2510
|
+
const [ownedTerminal, setOwnedTerminal] = react.useState(false);
|
|
2511
|
+
const ownedIntentIdRef = react.useRef(null);
|
|
2512
|
+
const postDepositLock = react.useMemo(
|
|
2513
|
+
() => allowance ? {
|
|
2514
|
+
serviceAddress: lockServiceAddress,
|
|
2515
|
+
maxAmount: BigInt(allowance.value),
|
|
2516
|
+
lockDuration: allowance.lockDuration
|
|
2517
|
+
} : void 0,
|
|
2518
|
+
[allowance, lockServiceAddress]
|
|
2519
|
+
);
|
|
2520
|
+
const ownsRecord = react.useCallback(
|
|
2521
|
+
(record) => Boolean(
|
|
2522
|
+
ownedIntentIdRef.current && chunkKCXYYUUG_cjs.matchesOnRampTransaction(record, ownedIntentIdRef.current)
|
|
2523
|
+
),
|
|
2524
|
+
[]
|
|
2525
|
+
);
|
|
2526
|
+
const {
|
|
2527
|
+
status,
|
|
2528
|
+
activeIntentId,
|
|
2529
|
+
pending,
|
|
2530
|
+
activeVerificationId,
|
|
2531
|
+
error,
|
|
2532
|
+
finalityProgress,
|
|
2533
|
+
depositAddress,
|
|
2534
|
+
minDepositBaseUnits,
|
|
2535
|
+
selectedToken,
|
|
2536
|
+
isLaunching,
|
|
2537
|
+
isWidgetOpen,
|
|
2538
|
+
canRecreateSession,
|
|
2539
|
+
widget,
|
|
2540
|
+
launch,
|
|
2541
|
+
recreateSession,
|
|
2542
|
+
closeWidget,
|
|
2543
|
+
finishPendingVerification,
|
|
2544
|
+
refreshPending
|
|
2545
|
+
} = useOnRamp({
|
|
2546
|
+
tokenId: token.id,
|
|
2547
|
+
postDepositLock,
|
|
2548
|
+
iframeTitle: "Card checkout",
|
|
2549
|
+
iframeClassName: "h-[680px] w-full border-0",
|
|
2550
|
+
onCredited: (_depositTxHash, record) => {
|
|
2551
|
+
if (!ownsRecord(record)) return;
|
|
2552
|
+
onCredited?.();
|
|
2553
|
+
if (!postDepositLock) {
|
|
2554
|
+
setOwnedTerminal(true);
|
|
2555
|
+
onActiveFlowChange?.(false);
|
|
2556
|
+
}
|
|
2557
|
+
},
|
|
2558
|
+
onLockSubmitted: (_response, record) => {
|
|
2559
|
+
if (!ownsRecord(record)) return;
|
|
2560
|
+
setLockError(null);
|
|
2561
|
+
setLockSettled(true);
|
|
2562
|
+
setOwnedTerminal(true);
|
|
2563
|
+
onActiveFlowChange?.(false);
|
|
2564
|
+
onLockSubmitted?.();
|
|
2565
|
+
},
|
|
2566
|
+
onLockFailed: (nextError, record) => {
|
|
2567
|
+
if (!ownsRecord(record)) return;
|
|
2568
|
+
setLockError(nextError);
|
|
2569
|
+
setOwnedTerminal(true);
|
|
2570
|
+
onActiveFlowChange?.(false);
|
|
2571
|
+
onLockFailed?.(nextError);
|
|
2572
|
+
}
|
|
2573
|
+
});
|
|
2574
|
+
const ownedIntentId = ownedIntentIdRef.current ?? activeIntentId;
|
|
2575
|
+
react.useEffect(() => {
|
|
2576
|
+
if (activeIntentId && !ownedIntentIdRef.current) {
|
|
2577
|
+
ownedIntentIdRef.current = activeIntentId;
|
|
2578
|
+
}
|
|
2579
|
+
}, [activeIntentId]);
|
|
2580
|
+
let amountBaseUnits;
|
|
2581
|
+
try {
|
|
2582
|
+
amountBaseUnits = viem.parseUnits(amount, token.decimals);
|
|
2583
|
+
} catch {
|
|
2584
|
+
}
|
|
2585
|
+
const minimumTargetBaseUnits = minDepositBaseUnits === void 0 ? void 0 : chunkKCXYYUUG_cjs.getTransakMinimumTargetBaseUnits(minDepositBaseUnits);
|
|
2586
|
+
const belowMinimum = amountBaseUnits !== void 0 && minimumTargetBaseUnits !== void 0 && amountBaseUnits < minimumTargetBaseUnits;
|
|
2587
|
+
const minimumUnknown = minimumTargetBaseUnits === void 0;
|
|
2588
|
+
const tokenMismatch = !chunkKCXYYUUG_cjs.matchesFrozenOnRampToken(token, selectedToken);
|
|
2589
|
+
const isSettling = status === "awaiting-delivery" || status === "verifying";
|
|
2590
|
+
const lockPending = !!allowance && status === "credited" && !lockSettled && !lockError;
|
|
2591
|
+
const ownedPending = ownedIntentId ? pending.filter((record) => chunkKCXYYUUG_cjs.matchesOnRampTransaction(record, ownedIntentId)) : [];
|
|
2592
|
+
const ownedFlowActive = !ownedTerminal && (Boolean(activeIntentId && activeIntentId === ownedIntentId) || ownedPending.length > 0 || lockPending);
|
|
2593
|
+
const canOpen = Boolean(selectedToken && depositAddress && amountBaseUnits && amountBaseUnits > 0n) && !tokenMismatch && !minimumUnknown && !belowMinimum && !isLaunching && !isWidgetOpen && !isSettling && status !== "credited" && (!activeIntentId || canRecreateSession);
|
|
2594
|
+
react.useEffect(() => {
|
|
2595
|
+
onActiveFlowChange?.(ownedFlowActive);
|
|
2596
|
+
}, [onActiveFlowChange, ownedFlowActive]);
|
|
2597
|
+
const unsafeToClose = isLaunching || lockPending;
|
|
2598
|
+
react.useEffect(() => {
|
|
2599
|
+
onUnsafeToCloseChange?.(unsafeToClose);
|
|
2600
|
+
return () => onUnsafeToCloseChange?.(false);
|
|
2601
|
+
}, [onUnsafeToCloseChange, unsafeToClose]);
|
|
2602
|
+
const runCheckout = react.useCallback(async () => {
|
|
2603
|
+
setActionError(null);
|
|
2604
|
+
try {
|
|
2605
|
+
assertTransakCheckoutPreconditions({ activeIntentId, canOpen, canRecreateSession });
|
|
2606
|
+
setLockError(null);
|
|
2607
|
+
setLockSettled(false);
|
|
2608
|
+
setOwnedTerminal(false);
|
|
2609
|
+
if (!activeIntentId) ownedIntentIdRef.current = null;
|
|
2610
|
+
if (activeIntentId) await recreateSession();
|
|
2611
|
+
else await launch({ providerAssetCode, quoteCurrencyAmount: amount });
|
|
2612
|
+
} catch (nextError) {
|
|
2613
|
+
setActionError(
|
|
2614
|
+
nextError instanceof Error ? nextError : new Error("Failed to open card checkout")
|
|
2615
|
+
);
|
|
2616
|
+
}
|
|
2617
|
+
}, [
|
|
2618
|
+
activeIntentId,
|
|
2619
|
+
amount,
|
|
2620
|
+
canOpen,
|
|
2621
|
+
canRecreateSession,
|
|
2622
|
+
launch,
|
|
2623
|
+
providerAssetCode,
|
|
2624
|
+
recreateSession
|
|
2625
|
+
]);
|
|
2626
|
+
const handleClose = react.useCallback(async () => {
|
|
2627
|
+
setActionError(null);
|
|
2628
|
+
try {
|
|
2629
|
+
await closeWidget();
|
|
2630
|
+
} catch (nextError) {
|
|
2631
|
+
setActionError(
|
|
2632
|
+
nextError instanceof Error ? nextError : new Error("Failed to close card checkout")
|
|
2633
|
+
);
|
|
2634
|
+
}
|
|
2635
|
+
}, [closeWidget]);
|
|
2636
|
+
const handleLeave = react.useCallback(() => {
|
|
2637
|
+
setActionError(null);
|
|
2638
|
+
onActiveFlowChange?.(false);
|
|
2639
|
+
onLeave?.();
|
|
2640
|
+
}, [onActiveFlowChange, onLeave]);
|
|
2641
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-muted flex flex-col gap-4 rounded-[10px] p-5", children: [
|
|
2642
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2643
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: "Complete your purchase" }),
|
|
2644
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground mt-1 text-sm", children: [
|
|
2645
|
+
"Buy ",
|
|
2646
|
+
token.symbol,
|
|
2647
|
+
" and deposit it directly into your Privana balance."
|
|
2648
|
+
] })
|
|
2649
|
+
] }),
|
|
2650
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border bg-card rounded-lg border p-3 text-sm", children: [
|
|
2651
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-foreground font-medium", children: [
|
|
2652
|
+
"Target receipt: at least ",
|
|
2653
|
+
amount,
|
|
2654
|
+
" ",
|
|
2655
|
+
token.symbol
|
|
2656
|
+
] }),
|
|
2657
|
+
/* @__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." }),
|
|
2658
|
+
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." })
|
|
2659
|
+
] }),
|
|
2660
|
+
widget ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border bg-card overflow-hidden rounded-xl border", children: [
|
|
2661
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border flex items-center justify-between border-b px-4 py-2 text-sm", children: [
|
|
2662
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: "Card checkout" }),
|
|
2663
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkKCXYYUUG_cjs.Button, { type: "button", variant: "outline", size: "sm", onClick: () => void handleClose(), children: "Close" })
|
|
2664
|
+
] }),
|
|
2665
|
+
widget
|
|
2666
|
+
] }) : status === "credited" && !lockPending && !lockError ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2 py-8 text-center", children: [
|
|
2667
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleCheckIcon, { className: "text-primary size-8", "aria-hidden": true }),
|
|
2668
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground text-sm font-medium", children: "Purchase credited" }),
|
|
2669
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground text-sm", children: [
|
|
2670
|
+
"Your ",
|
|
2671
|
+
token.symbol,
|
|
2672
|
+
" deposit is now available in your balance."
|
|
2673
|
+
] })
|
|
2674
|
+
] }) : !activeIntentId || canRecreateSession ? /* @__PURE__ */ jsxRuntime.jsxs(chunkKCXYYUUG_cjs.Button, { type: "button", disabled: !canOpen, onClick: () => void runCheckout(), children: [
|
|
2675
|
+
isLaunching && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin", "aria-hidden": true }),
|
|
2676
|
+
isLaunching ? "Opening checkout\u2026" : activeIntentId ? "Reopen card checkout" : allowance ? "Sign policy and open checkout" : "Open card checkout"
|
|
2677
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "This signed purchase is in recovery. Do not open another checkout for it." }),
|
|
2678
|
+
!depositAddress && !error && !actionError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Preparing your secure deposit address\u2026" }),
|
|
2679
|
+
tokenMismatch && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", role: "alert", children: "The token configuration changed. Close this purchase and start again." }),
|
|
2680
|
+
!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." }),
|
|
2681
|
+
belowMinimum && minimumTargetBaseUnits !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-destructive text-sm", role: "alert", children: [
|
|
2682
|
+
"Minimum target is ",
|
|
2683
|
+
viem.formatUnits(minimumTargetBaseUnits, token.decimals),
|
|
2684
|
+
" ",
|
|
2685
|
+
token.symbol,
|
|
2686
|
+
", including a 5% delivery buffer."
|
|
2687
|
+
] }),
|
|
2688
|
+
isSettling && pending.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground flex items-center gap-2 text-sm", children: [
|
|
2689
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin", "aria-hidden": true }),
|
|
2690
|
+
"Verifying your purchase\u2026"
|
|
2691
|
+
] }),
|
|
2692
|
+
lockPending && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground flex items-center gap-2 text-sm", children: [
|
|
2693
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin", "aria-hidden": true }),
|
|
2694
|
+
"Purchase credited. Locking your funds\u2026"
|
|
2695
|
+
] }),
|
|
2696
|
+
pending.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
2697
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground text-sm font-medium", children: "Validating purchases" }),
|
|
2698
|
+
pending.map((record) => {
|
|
2699
|
+
const isActivelyVerifying = record.transaction_id === activeVerificationId;
|
|
2700
|
+
const progress = parseFinalityProgress(finalityProgress[record.transaction_id]);
|
|
2701
|
+
const showRetry = chunkKCXYYUUG_cjs.canRetryOnRampVerification(record, activeVerificationId);
|
|
2702
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2703
|
+
"div",
|
|
2704
|
+
{
|
|
2705
|
+
className: "border-border flex flex-col gap-2 rounded-md border p-2",
|
|
2706
|
+
children: [
|
|
2707
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground flex items-center gap-1 text-xs", children: [
|
|
2708
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-3 animate-spin", "aria-hidden": true }),
|
|
2709
|
+
record.on_chain_tx_hash ? progress ?? (isActivelyVerifying ? "Verifying\u2026" : "Ready to verify") : "Waiting for provider delivery\u2026"
|
|
2710
|
+
] }),
|
|
2711
|
+
rowError?.id === record.transaction_id && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-xs", children: rowError.message }),
|
|
2712
|
+
showRetry && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2713
|
+
chunkKCXYYUUG_cjs.Button,
|
|
2714
|
+
{
|
|
2715
|
+
type: "button",
|
|
2716
|
+
variant: "outline",
|
|
2717
|
+
size: "sm",
|
|
2718
|
+
onClick: async () => {
|
|
2719
|
+
setRowError(null);
|
|
2720
|
+
try {
|
|
2721
|
+
await finishPendingVerification(record);
|
|
2722
|
+
} catch (nextError) {
|
|
2723
|
+
setRowError({
|
|
2724
|
+
id: record.transaction_id,
|
|
2725
|
+
message: nextError instanceof Error ? nextError.message : "Verification failed"
|
|
2726
|
+
});
|
|
2727
|
+
}
|
|
2728
|
+
},
|
|
2729
|
+
children: "Retry verification"
|
|
2730
|
+
}
|
|
2731
|
+
),
|
|
2732
|
+
!record.on_chain_tx_hash && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2733
|
+
chunkKCXYYUUG_cjs.Button,
|
|
2734
|
+
{
|
|
2735
|
+
type: "button",
|
|
2736
|
+
variant: "outline",
|
|
2737
|
+
size: "sm",
|
|
2738
|
+
onClick: () => void refreshPending(),
|
|
2739
|
+
children: "Refresh delivery"
|
|
2740
|
+
}
|
|
2741
|
+
)
|
|
2742
|
+
]
|
|
2743
|
+
},
|
|
2744
|
+
record.transaction_id
|
|
2745
|
+
);
|
|
2746
|
+
})
|
|
2747
|
+
] }),
|
|
2748
|
+
onLeave && ownedFlowActive && !unsafeToClose && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2749
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkKCXYYUUG_cjs.Button, { type: "button", variant: "outline", onClick: handleLeave, children: "Leave checkout" }),
|
|
2750
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: "Privana will keep this signed purchase available for exact recovery." })
|
|
2751
|
+
] }),
|
|
2752
|
+
(actionError ?? error) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", role: "alert", children: (actionError ?? error)?.message }),
|
|
2753
|
+
lockError && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-destructive text-sm", role: "alert", children: [
|
|
2754
|
+
"Purchase credited, but locking the funds failed: ",
|
|
2755
|
+
lockError.message
|
|
2756
|
+
] })
|
|
2757
|
+
] });
|
|
2758
|
+
}
|
|
2759
|
+
function parseFinalityProgress(message) {
|
|
2760
|
+
if (!message) return null;
|
|
2761
|
+
const match = message.match(/(\d+\/\d+)\s+confirmations/i);
|
|
2762
|
+
return match ? `${match[1]} confirmations` : null;
|
|
2763
|
+
}
|
|
2479
2764
|
function CreditCardWidgetView({
|
|
2480
2765
|
token,
|
|
2766
|
+
onRamp,
|
|
2481
2767
|
amount,
|
|
2482
2768
|
allowance,
|
|
2769
|
+
lockServiceAddress,
|
|
2483
2770
|
onCredited,
|
|
2484
2771
|
onLockSubmitted,
|
|
2485
|
-
onLockFailed
|
|
2772
|
+
onLockFailed,
|
|
2773
|
+
onLeave,
|
|
2774
|
+
onUnsafeToCloseChange,
|
|
2775
|
+
onActiveFlowChange
|
|
2486
2776
|
}) {
|
|
2487
|
-
|
|
2777
|
+
if (onRamp.unavailableReason || !token || !onRamp.provider || !onRamp.providerAssetCode) {
|
|
2778
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-muted flex flex-col gap-2 rounded-[10px] p-5", children: [
|
|
2779
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: "Card purchases unavailable" }),
|
|
2780
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", children: onRamp.unavailableReason ?? "The card on-ramp is not configured for this token." })
|
|
2781
|
+
] });
|
|
2782
|
+
}
|
|
2783
|
+
if (onRamp.provider === "transak") {
|
|
2784
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2785
|
+
TransakCardWidgetView,
|
|
2786
|
+
{
|
|
2787
|
+
token,
|
|
2788
|
+
providerAssetCode: onRamp.providerAssetCode,
|
|
2789
|
+
amount,
|
|
2790
|
+
allowance,
|
|
2791
|
+
lockServiceAddress,
|
|
2792
|
+
onCredited,
|
|
2793
|
+
onLockSubmitted,
|
|
2794
|
+
onLockFailed,
|
|
2795
|
+
onLeave,
|
|
2796
|
+
onUnsafeToCloseChange,
|
|
2797
|
+
onActiveFlowChange
|
|
2798
|
+
}
|
|
2799
|
+
);
|
|
2800
|
+
}
|
|
2801
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2802
|
+
MoonPayCardWidgetView,
|
|
2803
|
+
{
|
|
2804
|
+
token,
|
|
2805
|
+
amount,
|
|
2806
|
+
allowance,
|
|
2807
|
+
lockServiceAddress,
|
|
2808
|
+
onCredited,
|
|
2809
|
+
onLockSubmitted,
|
|
2810
|
+
onLockFailed,
|
|
2811
|
+
onLeaveFlow: onLeave,
|
|
2812
|
+
onUnsafeToCloseChange,
|
|
2813
|
+
onActiveFlowChange
|
|
2814
|
+
}
|
|
2815
|
+
);
|
|
2816
|
+
}
|
|
2817
|
+
function MoonPayCardWidgetView({
|
|
2818
|
+
token,
|
|
2819
|
+
amount,
|
|
2820
|
+
allowance,
|
|
2821
|
+
lockServiceAddress,
|
|
2822
|
+
onCredited,
|
|
2823
|
+
onLockSubmitted,
|
|
2824
|
+
onLockFailed,
|
|
2825
|
+
onLeaveFlow,
|
|
2826
|
+
onUnsafeToCloseChange,
|
|
2827
|
+
onActiveFlowChange
|
|
2828
|
+
}) {
|
|
2829
|
+
const moonpayCurrencyCode = token.moonpayCurrencyCode;
|
|
2488
2830
|
const containerRef = react.useRef(null);
|
|
2489
2831
|
const [widgetTheme, setWidgetTheme] = react.useState();
|
|
2490
2832
|
react.useEffect(() => {
|
|
@@ -2492,26 +2834,32 @@ function CreditCardWidgetView({
|
|
|
2492
2834
|
}, []);
|
|
2493
2835
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: [
|
|
2494
2836
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: "Complete your purchase" }),
|
|
2495
|
-
|
|
2496
|
-
|
|
2837
|
+
moonpayCurrencyCode ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2838
|
+
chunkKCXYYUUG_cjs.FiatOnRampForm,
|
|
2497
2839
|
{
|
|
2498
2840
|
tokenId: token.id,
|
|
2841
|
+
frozenToken: token,
|
|
2499
2842
|
currencyCode: moonpayCurrencyCode,
|
|
2500
2843
|
quoteCurrencyAmount: amount || void 0,
|
|
2501
2844
|
lockAmount: true,
|
|
2502
2845
|
variant: "embedded",
|
|
2503
2846
|
autoStart: true,
|
|
2504
2847
|
theme: widgetTheme,
|
|
2848
|
+
onlyRouteActiveIntentCallbacks: true,
|
|
2849
|
+
onUnsafeToCloseChange,
|
|
2850
|
+
onActiveFlowChange,
|
|
2505
2851
|
postDepositLock: allowance ? {
|
|
2852
|
+
serviceAddress: lockServiceAddress,
|
|
2506
2853
|
maxAmount: BigInt(allowance.value),
|
|
2507
2854
|
lockDuration: allowance.lockDuration
|
|
2508
2855
|
} : void 0,
|
|
2509
2856
|
onCredited,
|
|
2510
2857
|
onLockSubmitted,
|
|
2511
|
-
onLockFailed
|
|
2858
|
+
onLockFailed,
|
|
2859
|
+
onLeaveFlow
|
|
2512
2860
|
}
|
|
2513
2861
|
) : /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground text-sm", children: [
|
|
2514
|
-
token
|
|
2862
|
+
token.symbol,
|
|
2515
2863
|
" isn\u2019t available for card purchases yet."
|
|
2516
2864
|
] })
|
|
2517
2865
|
] });
|
|
@@ -2782,7 +3130,7 @@ function ChevronDownIcon({
|
|
|
2782
3130
|
height: "16",
|
|
2783
3131
|
viewBox: "0 0 16 16",
|
|
2784
3132
|
fill: "none",
|
|
2785
|
-
className:
|
|
3133
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
2786
3134
|
"transition-transform",
|
|
2787
3135
|
direction === "right" && "-rotate-90",
|
|
2788
3136
|
direction === "up" && "rotate-180",
|
|
@@ -2820,7 +3168,7 @@ function CopyIcon() {
|
|
|
2820
3168
|
}
|
|
2821
3169
|
);
|
|
2822
3170
|
}
|
|
2823
|
-
function
|
|
3171
|
+
function CircleCheckIcon2() {
|
|
2824
3172
|
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [
|
|
2825
3173
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "10", cy: "10", r: "9", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
2826
3174
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2935,11 +3283,11 @@ function PolicyTermRow({
|
|
|
2935
3283
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2936
3284
|
"div",
|
|
2937
3285
|
{
|
|
2938
|
-
className:
|
|
3286
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
2939
3287
|
"mt-0.5 shrink-0",
|
|
2940
3288
|
kind === "permission" ? "text-emerald-500" : "text-orange-500"
|
|
2941
3289
|
),
|
|
2942
|
-
children: kind === "permission" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3290
|
+
children: kind === "permission" ? /* @__PURE__ */ jsxRuntime.jsx(CircleCheckIcon2, {}) : /* @__PURE__ */ jsxRuntime.jsx(CircleXIcon, {})
|
|
2943
3291
|
}
|
|
2944
3292
|
),
|
|
2945
3293
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
@@ -2999,6 +3347,7 @@ function AllowancePolicySection({
|
|
|
2999
3347
|
function DepositView({
|
|
3000
3348
|
source,
|
|
3001
3349
|
selectedToken,
|
|
3350
|
+
onRamp,
|
|
3002
3351
|
amount,
|
|
3003
3352
|
allowance,
|
|
3004
3353
|
externalMinimum,
|
|
@@ -3008,7 +3357,7 @@ function DepositView({
|
|
|
3008
3357
|
onSubmit,
|
|
3009
3358
|
isSubmitting = false
|
|
3010
3359
|
}) {
|
|
3011
|
-
const { getChainById: getChainById2, chains, serviceName, serviceIcon, networkConfig, hostedAuthConfig } =
|
|
3360
|
+
const { getChainById: getChainById2, chains, serviceName, serviceIcon, networkConfig, hostedAuthConfig } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
3012
3361
|
const { address, isConnected } = wagmi.useAccount();
|
|
3013
3362
|
const appName = serviceName ?? "Privana";
|
|
3014
3363
|
const chain = selectedToken ? getChainById2(selectedToken.chainId) : void 0;
|
|
@@ -3017,13 +3366,15 @@ function DepositView({
|
|
|
3017
3366
|
const isConnectedSource = source === "connected";
|
|
3018
3367
|
const isExternal = source === "external";
|
|
3019
3368
|
const isCreditCard = source === "credit-card";
|
|
3369
|
+
const isMoonPayCard = isCreditCard && chunkKCXYYUUG_cjs.isMoonPayProductOnRamp(onRamp);
|
|
3370
|
+
const isTransakCard = isCreditCard && onRamp.provider === "transak";
|
|
3020
3371
|
const isNative = selectedToken?.contract === viem.zeroAddress;
|
|
3021
|
-
const { data: nativeBalanceData } = wagmi.useBalance({
|
|
3372
|
+
const { data: nativeBalanceData, isLoading: isNativeBalanceLoading } = wagmi.useBalance({
|
|
3022
3373
|
address,
|
|
3023
3374
|
chainId: targetChain?.id,
|
|
3024
3375
|
query: { enabled: isConnectedSource && !!address && !!selectedToken && isNative }
|
|
3025
3376
|
});
|
|
3026
|
-
const { data: erc20Balance } = wagmi.useReadContract({
|
|
3377
|
+
const { data: erc20Balance, isLoading: isErc20BalanceLoading } = wagmi.useReadContract({
|
|
3027
3378
|
address: selectedToken?.contract,
|
|
3028
3379
|
abi: viem.erc20Abi,
|
|
3029
3380
|
functionName: "balanceOf",
|
|
@@ -3032,7 +3383,8 @@ function DepositView({
|
|
|
3032
3383
|
query: { enabled: isConnectedSource && !!address && !!selectedToken && !isNative }
|
|
3033
3384
|
});
|
|
3034
3385
|
const walletBalance = isNative ? nativeBalanceData?.value : erc20Balance;
|
|
3035
|
-
const
|
|
3386
|
+
const isWalletBalanceLoading = isNative ? isNativeBalanceLoading : isErc20BalanceLoading;
|
|
3387
|
+
const formattedWalletBalance = walletBalance != null && selectedToken ? chunkKCXYYUUG_cjs.formatTokenAmount(walletBalance.toString(), selectedToken.decimals) : "0.00";
|
|
3036
3388
|
const {
|
|
3037
3389
|
minBuyAmount: moonpayMinBuy,
|
|
3038
3390
|
isLoading: moonpayLimitsLoading,
|
|
@@ -3040,31 +3392,31 @@ function DepositView({
|
|
|
3040
3392
|
} = useMoonpayLimits({
|
|
3041
3393
|
currencyCode: selectedToken?.moonpayCurrencyCode,
|
|
3042
3394
|
apiBaseUrl: networkConfig.moonpayApiUrl,
|
|
3043
|
-
enabled:
|
|
3395
|
+
enabled: isMoonPayCard
|
|
3044
3396
|
});
|
|
3045
3397
|
const hasValidAmount = !!amount && parseFloat(amount) > 0;
|
|
3046
|
-
const maxAmountDecimals =
|
|
3398
|
+
const maxAmountDecimals = isMoonPayCard ? 2 : selectedToken?.decimals;
|
|
3047
3399
|
const tooManyDecimals = hasValidAmount && maxAmountDecimals != null && amount.includes(".") && amount.split(".")[1].length > maxAmountDecimals;
|
|
3048
|
-
const exceedsBalance = isConnectedSource && hasValidAmount && !tooManyDecimals && !!selectedToken && walletBalance != null &&
|
|
3049
|
-
const belowMoonpayMin =
|
|
3050
|
-
const moonpayLimitsUnready =
|
|
3051
|
-
const creditCardUnavailable = isCreditCard && !!
|
|
3400
|
+
const exceedsBalance = isConnectedSource && hasValidAmount && !tooManyDecimals && !!selectedToken && walletBalance != null && chunkKCXYYUUG_cjs.parseTokenAmount(amount, selectedToken.decimals) > walletBalance;
|
|
3401
|
+
const belowMoonpayMin = isMoonPayCard && hasValidAmount && moonpayMinBuy != null && parseFloat(amount) < moonpayMinBuy;
|
|
3402
|
+
const moonpayLimitsUnready = isMoonPayCard && !!onRamp.providerAssetCode && moonpayMinBuy == null;
|
|
3403
|
+
const creditCardUnavailable = isCreditCard && !!onRamp.unavailableReason;
|
|
3052
3404
|
const externalTokenUnavailable = isExternal && !!selectedToken && isNative;
|
|
3053
3405
|
const externalMinimumRequired = isExternal && !!allowance && !!selectedToken;
|
|
3054
3406
|
const externalMinimumLoading = externalMinimumRequired && externalMinimum === void 0;
|
|
3055
3407
|
const externalMinimumUnavailable = externalMinimumRequired && externalMinimum === null;
|
|
3056
|
-
const belowExternalMinimum = externalMinimumRequired && hasValidAmount && !tooManyDecimals && !!selectedToken && typeof externalMinimum === "bigint" &&
|
|
3408
|
+
const belowExternalMinimum = externalMinimumRequired && hasValidAmount && !tooManyDecimals && !!selectedToken && typeof externalMinimum === "bigint" && chunkKCXYYUUG_cjs.parseTokenAmount(amount, selectedToken.decimals) < externalMinimum;
|
|
3057
3409
|
const externalNeedsWallet = isExternal && (!!allowance || !hostedAuthConfig);
|
|
3058
3410
|
const needsConnect = (isConnectedSource || externalNeedsWallet) && !isConnected;
|
|
3059
3411
|
const canDeposit = hasValidAmount && !!selectedToken && !tooManyDecimals && !exceedsBalance && !belowMoonpayMin && !moonpayLimitsUnready && !creditCardUnavailable && !externalTokenUnavailable && !externalMinimumLoading && !externalMinimumUnavailable && !belowExternalMinimum && !needsConnect;
|
|
3060
3412
|
const handleMax = () => {
|
|
3061
|
-
|
|
3062
|
-
|
|
3413
|
+
if (selectedToken && walletBalance != null && walletBalance > 0n)
|
|
3414
|
+
onAmountChange(viem.formatUnits(walletBalance, selectedToken.decimals));
|
|
3063
3415
|
};
|
|
3064
3416
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: [
|
|
3065
3417
|
isCreditCard ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
3066
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: "Buy with
|
|
3067
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Enter your deposit amount and proceed to sign a policy." })
|
|
3418
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: "Buy with card and deposit" }),
|
|
3419
|
+
/* @__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." })
|
|
3068
3420
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
3069
3421
|
/* @__PURE__ */ jsxRuntime.jsxs("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: [
|
|
3070
3422
|
"Deposit from ",
|
|
@@ -3079,7 +3431,7 @@ function DepositView({
|
|
|
3079
3431
|
{
|
|
3080
3432
|
type: "button",
|
|
3081
3433
|
onClick: onSelectToken,
|
|
3082
|
-
disabled: isSubmitting,
|
|
3434
|
+
disabled: isSubmitting || isCreditCard && onRamp.tokenSelectionLocked,
|
|
3083
3435
|
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",
|
|
3084
3436
|
children: [
|
|
3085
3437
|
selectedToken ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -3092,7 +3444,7 @@ function DepositView({
|
|
|
3092
3444
|
] })
|
|
3093
3445
|
] })
|
|
3094
3446
|
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground flex-1 text-sm", children: "Select token" }),
|
|
3095
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground flex h-5 w-5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, {}) })
|
|
3447
|
+
(!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, {}) })
|
|
3096
3448
|
]
|
|
3097
3449
|
}
|
|
3098
3450
|
)
|
|
@@ -3100,17 +3452,16 @@ function DepositView({
|
|
|
3100
3452
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
3101
3453
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
3102
3454
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-muted-foreground text-sm", children: "Amount" }),
|
|
3103
|
-
isConnectedSource && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground text-sm", children: [
|
|
3104
|
-
"Available
|
|
3105
|
-
formattedWalletBalance,
|
|
3455
|
+
isConnectedSource && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground flex items-center gap-1 text-sm", children: [
|
|
3456
|
+
"Available",
|
|
3106
3457
|
" ",
|
|
3107
|
-
selectedToken?.symbol
|
|
3458
|
+
isWalletBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkKCXYYUUG_cjs.Skeleton, { className: "h-4 w-16" }) : `${formattedWalletBalance} ${selectedToken?.symbol ?? ""}`
|
|
3108
3459
|
] })
|
|
3109
3460
|
] }),
|
|
3110
3461
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3111
3462
|
"div",
|
|
3112
3463
|
{
|
|
3113
|
-
className:
|
|
3464
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
3114
3465
|
"border-border bg-input flex items-center gap-2 rounded-[10px] border",
|
|
3115
3466
|
isConnectedSource ? "py-1 pr-1 pl-3" : "px-3 py-3"
|
|
3116
3467
|
),
|
|
@@ -3135,7 +3486,8 @@ function DepositView({
|
|
|
3135
3486
|
{
|
|
3136
3487
|
type: "button",
|
|
3137
3488
|
onClick: handleMax,
|
|
3138
|
-
|
|
3489
|
+
disabled: isWalletBalanceLoading,
|
|
3490
|
+
className: "bg-secondary text-foreground hover:bg-secondary/80 cursor-pointer rounded px-3 py-2.5 text-xs font-semibold transition-colors disabled:cursor-default disabled:opacity-50",
|
|
3139
3491
|
children: "MAX"
|
|
3140
3492
|
}
|
|
3141
3493
|
) : isCreditCard ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm", children: selectedToken?.symbol ?? "USD" }) : selectedToken && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm", children: selectedToken.symbol })
|
|
@@ -3162,12 +3514,9 @@ function DepositView({
|
|
|
3162
3514
|
] }),
|
|
3163
3515
|
externalMinimumLoading && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Checking minimum deposit\u2026" }),
|
|
3164
3516
|
externalMinimumUnavailable && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", children: "Couldn\u2019t load the minimum deposit. Please try again." }),
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
creditCardUnavailable && /* @__PURE__ */ jsxRuntime.
|
|
3168
|
-
selectedToken?.symbol ?? "This token",
|
|
3169
|
-
" isn\u2019t available for card purchases yet."
|
|
3170
|
-
] }),
|
|
3517
|
+
isMoonPayCard && moonpayLimitsError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", children: "Couldn\u2019t load purchase limits. Please try again." }),
|
|
3518
|
+
isMoonPayCard && moonpayLimitsLoading && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Checking purchase limits\u2026" }),
|
|
3519
|
+
creditCardUnavailable && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", children: onRamp.unavailableReason }),
|
|
3171
3520
|
externalTokenUnavailable && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-destructive text-sm", children: [
|
|
3172
3521
|
selectedToken?.symbol ?? "This token",
|
|
3173
3522
|
" can\u2019t be used for external deposits. Choose an ERC20 token."
|
|
@@ -3194,7 +3543,7 @@ function DepositView({
|
|
|
3194
3543
|
if (selectedToken) onSubmit({ source, tokenId: selectedToken.id, amount });
|
|
3195
3544
|
},
|
|
3196
3545
|
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",
|
|
3197
|
-
children: needsConnect ? "Connect Wallet" : allowance ? "Sign Policy and Deposit" : "Deposit"
|
|
3546
|
+
children: needsConnect ? "Connect Wallet" : isTransakCard ? "Continue" : allowance ? "Sign Policy and Deposit" : "Deposit"
|
|
3198
3547
|
}
|
|
3199
3548
|
)
|
|
3200
3549
|
] });
|
|
@@ -3250,7 +3599,7 @@ function ExternalDepositView({
|
|
|
3250
3599
|
onDiscardLock,
|
|
3251
3600
|
lock
|
|
3252
3601
|
}) {
|
|
3253
|
-
const { getChainById: getChainById2, getTokenById, serviceName } =
|
|
3602
|
+
const { getChainById: getChainById2, getTokenById, serviceName } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
3254
3603
|
const appName = serviceName ?? "Privana";
|
|
3255
3604
|
const { depositAddress, isReady, isLoading } = depositAddressState;
|
|
3256
3605
|
const chain = token ? getChainById2(token.chainId) : void 0;
|
|
@@ -3266,7 +3615,7 @@ function ExternalDepositView({
|
|
|
3266
3615
|
const [nothingFound, setNothingFound] = react.useState(false);
|
|
3267
3616
|
const [credited, setCredited] = react.useState(null);
|
|
3268
3617
|
const [showCancelWarning, setShowCancelWarning] = react.useState(false);
|
|
3269
|
-
const verification =
|
|
3618
|
+
const verification = chunkKCXYYUUG_cjs.useDepositVerification({
|
|
3270
3619
|
onCredited: (txHash, _response, creditedAmount) => {
|
|
3271
3620
|
if (settleAfterCredit) {
|
|
3272
3621
|
void settleAfterCredit(txHash, creditedAmount);
|
|
@@ -3390,11 +3739,11 @@ function ExternalDepositView({
|
|
|
3390
3739
|
] }),
|
|
3391
3740
|
showDepositInstructions && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3392
3741
|
!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." }),
|
|
3393
|
-
/* @__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(
|
|
3742
|
+
/* @__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(chunkKCXYYUUG_cjs.Skeleton, { className: "h-full w-full rounded-[10px]" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm", children: "Deposit address unavailable" }) }),
|
|
3394
3743
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
3395
3744
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Deposit Address" }),
|
|
3396
3745
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
3397
|
-
/* @__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(
|
|
3746
|
+
/* @__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(chunkKCXYYUUG_cjs.Skeleton, { className: "h-4 w-3/4" }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "\u2014" }) }),
|
|
3398
3747
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3399
3748
|
"button",
|
|
3400
3749
|
{
|
|
@@ -3449,7 +3798,7 @@ function ExternalDepositView({
|
|
|
3449
3798
|
TransactionSuccessView,
|
|
3450
3799
|
{
|
|
3451
3800
|
title: "Deposit Credited",
|
|
3452
|
-
message: `Transfer ${
|
|
3801
|
+
message: `Transfer ${chunkKCXYYUUG_cjs.shortenAddress(credited.txHash)} has been credited to your Privana balance.`,
|
|
3453
3802
|
onDone: () => {
|
|
3454
3803
|
setCredited(null);
|
|
3455
3804
|
verification.reset();
|
|
@@ -3478,7 +3827,7 @@ function ExternalDepositView({
|
|
|
3478
3827
|
{
|
|
3479
3828
|
title: "Awaiting Deposit",
|
|
3480
3829
|
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.",
|
|
3481
|
-
remaining: listening ?
|
|
3830
|
+
remaining: listening ? chunkKCXYYUUG_cjs.formatCountdown(secondsLeft) : void 0
|
|
3482
3831
|
}
|
|
3483
3832
|
),
|
|
3484
3833
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
@@ -3506,9 +3855,11 @@ function ExternalDepositView({
|
|
|
3506
3855
|
] })
|
|
3507
3856
|
] });
|
|
3508
3857
|
}
|
|
3509
|
-
function MoonPayGate({
|
|
3510
|
-
|
|
3511
|
-
|
|
3858
|
+
function MoonPayGate({
|
|
3859
|
+
enabled,
|
|
3860
|
+
apiKey,
|
|
3861
|
+
children
|
|
3862
|
+
}) {
|
|
3512
3863
|
if (!enabled || !apiKey) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
3513
3864
|
return /* @__PURE__ */ jsxRuntime.jsx(moonpayReact.MoonPayProvider, { apiKey, children });
|
|
3514
3865
|
}
|
|
@@ -3528,7 +3879,7 @@ function MethodTabs({
|
|
|
3528
3879
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3529
3880
|
"div",
|
|
3530
3881
|
{
|
|
3531
|
-
className:
|
|
3882
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
3532
3883
|
"bg-input absolute top-1 bottom-1 left-1 w-[calc(50%-8px)] rounded-md transition-transform duration-200",
|
|
3533
3884
|
activeTab === "credit-card" && "translate-x-[calc(100%+8px)]"
|
|
3534
3885
|
)
|
|
@@ -3539,7 +3890,7 @@ function MethodTabs({
|
|
|
3539
3890
|
{
|
|
3540
3891
|
type: "button",
|
|
3541
3892
|
onClick: () => onTabChange("crypto"),
|
|
3542
|
-
className:
|
|
3893
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
3543
3894
|
"relative z-10 flex-1 cursor-pointer rounded-md px-3 py-[9px] text-sm font-medium transition-colors",
|
|
3544
3895
|
activeTab === "crypto" ? "text-foreground" : "text-muted-foreground"
|
|
3545
3896
|
),
|
|
@@ -3551,7 +3902,7 @@ function MethodTabs({
|
|
|
3551
3902
|
{
|
|
3552
3903
|
type: "button",
|
|
3553
3904
|
onClick: () => onTabChange("credit-card"),
|
|
3554
|
-
className:
|
|
3905
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
3555
3906
|
"relative z-10 flex-1 cursor-pointer rounded-md px-3 py-[9px] text-sm font-medium transition-colors",
|
|
3556
3907
|
activeTab === "credit-card" ? "text-foreground" : "text-muted-foreground"
|
|
3557
3908
|
),
|
|
@@ -3595,15 +3946,52 @@ function DepositModalContent({
|
|
|
3595
3946
|
onCloseBlockedChange,
|
|
3596
3947
|
onExit
|
|
3597
3948
|
}) {
|
|
3598
|
-
const {
|
|
3949
|
+
const {
|
|
3950
|
+
serviceName,
|
|
3951
|
+
enabledTokens,
|
|
3952
|
+
defaultToken,
|
|
3953
|
+
hostedAuthConfig,
|
|
3954
|
+
serviceAddress,
|
|
3955
|
+
getChainById: getChainById2,
|
|
3956
|
+
getTokenById,
|
|
3957
|
+
networkConfig,
|
|
3958
|
+
onRamp
|
|
3959
|
+
} = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
3599
3960
|
const { address } = wagmi.useAccount();
|
|
3961
|
+
const { privateReadQueryScope } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
3962
|
+
const [privateReadApiUrl, accountingChainId, beneficiaryAddress] = privateReadQueryScope;
|
|
3600
3963
|
const appName = serviceName ?? "Privana";
|
|
3601
3964
|
const [activeTab, setActiveTab] = react.useState(defaultTab);
|
|
3602
3965
|
const [view, setView] = react.useState("method");
|
|
3603
3966
|
const [source, setSource] = react.useState("connected");
|
|
3604
3967
|
const [selectedTokenId, setSelectedTokenId] = react.useState(defaultToken?.id ?? "");
|
|
3605
3968
|
const [amount, setAmount] = react.useState("");
|
|
3606
|
-
const
|
|
3969
|
+
const [cardFlow, setCardFlow] = react.useState(null);
|
|
3970
|
+
const [cardFlowActive, setCardFlowActive] = react.useState(false);
|
|
3971
|
+
const [cardUnsafeToClose, setCardUnsafeToClose] = react.useState(false);
|
|
3972
|
+
const nextCardFlowId = react.useRef(0);
|
|
3973
|
+
const stateSelectedToken = enabledTokens.find((t) => t.id === selectedTokenId) ?? defaultToken;
|
|
3974
|
+
const cardOnRamp = react.useMemo(
|
|
3975
|
+
() => chunkKCXYYUUG_cjs.resolveProductOnRamp({
|
|
3976
|
+
config: onRamp,
|
|
3977
|
+
enabledTokens,
|
|
3978
|
+
legacyToken: stateSelectedToken,
|
|
3979
|
+
moonpayApiKey: networkConfig.moonpayApiKey
|
|
3980
|
+
}),
|
|
3981
|
+
[enabledTokens, networkConfig.moonpayApiKey, onRamp, stateSelectedToken]
|
|
3982
|
+
);
|
|
3983
|
+
const cardOnRampScope = react.useMemo(
|
|
3984
|
+
() => ({
|
|
3985
|
+
apiUrl: privateReadApiUrl,
|
|
3986
|
+
accountingChainId,
|
|
3987
|
+
accountingContract: networkConfig.accountingContract,
|
|
3988
|
+
beneficiaryAddress
|
|
3989
|
+
}),
|
|
3990
|
+
[accountingChainId, beneficiaryAddress, networkConfig.accountingContract, privateReadApiUrl]
|
|
3991
|
+
);
|
|
3992
|
+
const mountedCardFlow = cardFlow && chunkKCXYYUUG_cjs.matchesProductOnRampScope(cardFlow.scope, cardOnRampScope) ? cardFlow : null;
|
|
3993
|
+
const displayedCardOnRamp = view === "credit-card-widget" && mountedCardFlow ? mountedCardFlow.selection : cardOnRamp;
|
|
3994
|
+
const selectedToken = source === "credit-card" ? displayedCardOnRamp.token : stateSelectedToken;
|
|
3607
3995
|
const externalDepositAddress = useDepositAddress({
|
|
3608
3996
|
enabled: source === "external" && (view === "deposit" || view === "external-deposit")
|
|
3609
3997
|
});
|
|
@@ -3617,6 +4005,9 @@ function DepositModalContent({
|
|
|
3617
4005
|
setView("method");
|
|
3618
4006
|
setAmount("");
|
|
3619
4007
|
setSelectedTokenId("");
|
|
4008
|
+
setCardFlow(null);
|
|
4009
|
+
setCardFlowActive(false);
|
|
4010
|
+
setCardUnsafeToClose(false);
|
|
3620
4011
|
}
|
|
3621
4012
|
}, [address, hostedAuthConfig]);
|
|
3622
4013
|
const openDeposit = (next) => {
|
|
@@ -3639,9 +4030,33 @@ function DepositModalContent({
|
|
|
3639
4030
|
}
|
|
3640
4031
|
};
|
|
3641
4032
|
const finishCardPurchase = () => {
|
|
4033
|
+
setCardFlowActive(false);
|
|
4034
|
+
setCardUnsafeToClose(false);
|
|
3642
4035
|
setAmount("");
|
|
3643
4036
|
onDepositSuccess?.();
|
|
3644
4037
|
};
|
|
4038
|
+
const leaveCardPurchase = react.useCallback(() => {
|
|
4039
|
+
setCardFlow(null);
|
|
4040
|
+
setCardFlowActive(false);
|
|
4041
|
+
setCardUnsafeToClose(false);
|
|
4042
|
+
setAmount("");
|
|
4043
|
+
setView("deposit");
|
|
4044
|
+
}, []);
|
|
4045
|
+
react.useEffect(() => {
|
|
4046
|
+
if (cardFlow && !chunkKCXYYUUG_cjs.matchesProductOnRampScope(cardFlow.scope, cardOnRampScope)) {
|
|
4047
|
+
leaveCardPurchase();
|
|
4048
|
+
}
|
|
4049
|
+
}, [cardFlow, cardOnRampScope, leaveCardPurchase]);
|
|
4050
|
+
const cardOutcomeCallbacks = mountedCardFlow ? chunkKCXYYUUG_cjs.createProductOnRampOutcomeCallbacks({
|
|
4051
|
+
requiresLock: mountedCardFlow.requiresLock,
|
|
4052
|
+
onComplete: finishCardPurchase,
|
|
4053
|
+
onLockFailed: (err) => {
|
|
4054
|
+
setCardFlowActive(false);
|
|
4055
|
+
setCardUnsafeToClose(false);
|
|
4056
|
+
setLockFailure(err);
|
|
4057
|
+
onLockFailed?.(err);
|
|
4058
|
+
}
|
|
4059
|
+
}) : null;
|
|
3645
4060
|
const {
|
|
3646
4061
|
txHash,
|
|
3647
4062
|
isGettingAddress,
|
|
@@ -3711,7 +4126,7 @@ function DepositModalContent({
|
|
|
3711
4126
|
setView("deposit");
|
|
3712
4127
|
}
|
|
3713
4128
|
}, [allowance, externalLock.session, view]);
|
|
3714
|
-
const isUnsafeToClose = (isGettingAddress || isSendingTransaction) && !cancelled || externalLock.isSigning || externalLock.isSubmittingLock;
|
|
4129
|
+
const isUnsafeToClose = (isGettingAddress || isSendingTransaction) && !cancelled || externalLock.isSigning || externalLock.isSubmittingLock || cardUnsafeToClose;
|
|
3715
4130
|
react.useEffect(() => {
|
|
3716
4131
|
onCloseBlockedChange?.(isUnsafeToClose);
|
|
3717
4132
|
}, [isUnsafeToClose, onCloseBlockedChange]);
|
|
@@ -3730,7 +4145,7 @@ function DepositModalContent({
|
|
|
3730
4145
|
sonner.toast.error("External deposits support ERC20 tokens only");
|
|
3731
4146
|
return;
|
|
3732
4147
|
}
|
|
3733
|
-
const depositAmount =
|
|
4148
|
+
const depositAmount = chunkKCXYYUUG_cjs.parseTokenAmount(args.amount, token2.decimals);
|
|
3734
4149
|
if (!allowance) {
|
|
3735
4150
|
setView("external-deposit");
|
|
3736
4151
|
return;
|
|
@@ -3754,6 +4169,28 @@ function DepositModalContent({
|
|
|
3754
4169
|
return;
|
|
3755
4170
|
}
|
|
3756
4171
|
if (args.source === "credit-card") {
|
|
4172
|
+
if (cardFlow && cardFlowActive) {
|
|
4173
|
+
setView("credit-card-widget");
|
|
4174
|
+
return;
|
|
4175
|
+
}
|
|
4176
|
+
try {
|
|
4177
|
+
setCardFlow(
|
|
4178
|
+
chunkKCXYYUUG_cjs.createProductOnRampFlowSnapshot({
|
|
4179
|
+
id: ++nextCardFlowId.current,
|
|
4180
|
+
selection: cardOnRamp,
|
|
4181
|
+
amount: args.amount,
|
|
4182
|
+
allowance,
|
|
4183
|
+
lockServiceAddress: serviceAddress,
|
|
4184
|
+
moonpayApiKey: networkConfig.moonpayApiKey,
|
|
4185
|
+
scope: cardOnRampScope
|
|
4186
|
+
})
|
|
4187
|
+
);
|
|
4188
|
+
} catch (error) {
|
|
4189
|
+
sonner.toast.error(error instanceof Error ? error.message : "Card purchase is unavailable");
|
|
4190
|
+
return;
|
|
4191
|
+
}
|
|
4192
|
+
setCardFlowActive(false);
|
|
4193
|
+
setCardUnsafeToClose(false);
|
|
3757
4194
|
setView("credit-card-widget");
|
|
3758
4195
|
return;
|
|
3759
4196
|
}
|
|
@@ -3763,7 +4200,7 @@ function DepositModalContent({
|
|
|
3763
4200
|
setCancelled(false);
|
|
3764
4201
|
deposit({
|
|
3765
4202
|
tokenId: token.id,
|
|
3766
|
-
amount:
|
|
4203
|
+
amount: chunkKCXYYUUG_cjs.parseTokenAmount(args.amount, token.decimals),
|
|
3767
4204
|
postDepositLock: allowance ? {
|
|
3768
4205
|
maxAmount: BigInt(allowance.value),
|
|
3769
4206
|
lockDuration: allowance.lockDuration
|
|
@@ -3804,7 +4241,7 @@ function DepositModalContent({
|
|
|
3804
4241
|
];
|
|
3805
4242
|
const hasExternalLockRecovery = view === "external-deposit" && !!externalLock.session?.creditedAmount;
|
|
3806
4243
|
const externalSubmissionAmbiguous = hasExternalLockRecovery && !!lockFailure?.submissionMayHaveSucceeded;
|
|
3807
|
-
const savedExternalPayloadUsable = !!externalLock.session?.payload &&
|
|
4244
|
+
const savedExternalPayloadUsable = !!externalLock.session?.payload && chunkKCXYYUUG_cjs.isSignedLockUsable(externalLock.session.payload);
|
|
3808
4245
|
const ambiguousRecoveryMustBeAbandoned = externalSubmissionAmbiguous && !savedExternalPayloadUsable;
|
|
3809
4246
|
const externalRecoveryExitLabel = externalSubmissionAmbiguous ? "Stop recovery" : "Keep funds unlocked";
|
|
3810
4247
|
const lockFailureToken = hasExternalLockRecovery && externalLock.session ? getTokenById(externalLock.session.tokenId) ?? selectedToken : selectedToken;
|
|
@@ -3831,6 +4268,12 @@ function DepositModalContent({
|
|
|
3831
4268
|
setCancelled(false);
|
|
3832
4269
|
resetDeposit();
|
|
3833
4270
|
if (view === "external-deposit") setView("deposit");
|
|
4271
|
+
if (view === "credit-card-widget") {
|
|
4272
|
+
setCardFlow(null);
|
|
4273
|
+
setCardFlowActive(false);
|
|
4274
|
+
setCardUnsafeToClose(false);
|
|
4275
|
+
setView("deposit");
|
|
4276
|
+
}
|
|
3834
4277
|
};
|
|
3835
4278
|
const handleExternalLockRetry = () => {
|
|
3836
4279
|
externalLock.retryAfterCredit().catch((err) => {
|
|
@@ -3854,12 +4297,20 @@ function DepositModalContent({
|
|
|
3854
4297
|
retryVerification().catch(() => {
|
|
3855
4298
|
});
|
|
3856
4299
|
};
|
|
3857
|
-
const back = view === "external-deposit" ? { to: "deposit", label: "Deposit from External Wallet" } : view === "credit-card-widget" ? { to: "deposit", label: "Buy with
|
|
4300
|
+
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" };
|
|
3858
4301
|
const goBack = () => {
|
|
3859
4302
|
if (view === "external-deposit" && externalLock.session) {
|
|
3860
4303
|
sonner.toast.error("Cancel the active deposit from the address screen before going back");
|
|
3861
4304
|
return;
|
|
3862
4305
|
}
|
|
4306
|
+
if (view === "credit-card-widget" && (cardUnsafeToClose || cardFlowActive)) {
|
|
4307
|
+
sonner.toast.error("Finish or recover the active card purchase before going back");
|
|
4308
|
+
return;
|
|
4309
|
+
}
|
|
4310
|
+
if (view === "credit-card-widget") {
|
|
4311
|
+
setCardFlow(null);
|
|
4312
|
+
setCardUnsafeToClose(false);
|
|
4313
|
+
}
|
|
3863
4314
|
if (back.to === "method") {
|
|
3864
4315
|
setAmount("");
|
|
3865
4316
|
setSelectedTokenId("");
|
|
@@ -3874,7 +4325,7 @@ function DepositModalContent({
|
|
|
3874
4325
|
onClick: onClose,
|
|
3875
4326
|
disabled: isUnsafeToClose,
|
|
3876
4327
|
"aria-label": "Close",
|
|
3877
|
-
className:
|
|
4328
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
3878
4329
|
"absolute top-6 right-5 z-20 flex h-5 w-5 items-center justify-center transition-colors",
|
|
3879
4330
|
isUnsafeToClose ? "text-muted-foreground/40 cursor-not-allowed" : "text-muted-foreground hover:text-foreground cursor-pointer"
|
|
3880
4331
|
),
|
|
@@ -3945,8 +4396,8 @@ function DepositModalContent({
|
|
|
3945
4396
|
] }),
|
|
3946
4397
|
activeView === "method" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: [
|
|
3947
4398
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
3948
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: activeTab === "crypto" ? "Choose the deposit method" : "Buy with
|
|
3949
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: activeTab === "crypto" ? "Choose the deposit method." : "
|
|
4399
|
+
/* @__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" }),
|
|
4400
|
+
/* @__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." })
|
|
3950
4401
|
] }),
|
|
3951
4402
|
/* @__PURE__ */ jsxRuntime.jsx(MethodTabs, { activeTab, onTabChange: setActiveTab }),
|
|
3952
4403
|
activeTab === "crypto" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
@@ -3975,8 +4426,8 @@ function DepositModalContent({
|
|
|
3975
4426
|
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3976
4427
|
MethodOption,
|
|
3977
4428
|
{
|
|
3978
|
-
title: "
|
|
3979
|
-
description: "
|
|
4429
|
+
title: "Buy with card",
|
|
4430
|
+
description: "Purchase and deposit directly into your account.",
|
|
3980
4431
|
onClick: () => {
|
|
3981
4432
|
onSelectCreditCard?.();
|
|
3982
4433
|
openDeposit("credit-card");
|
|
@@ -3984,26 +4435,35 @@ function DepositModalContent({
|
|
|
3984
4435
|
}
|
|
3985
4436
|
) })
|
|
3986
4437
|
] }),
|
|
3987
|
-
activeView === "deposit" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3988
|
-
|
|
4438
|
+
activeView === "deposit" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4439
|
+
MoonPayGate,
|
|
3989
4440
|
{
|
|
3990
|
-
source,
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4441
|
+
enabled: source === "credit-card" && cardOnRamp.provider === "moonpay" && !cardOnRamp.unavailableReason,
|
|
4442
|
+
apiKey: networkConfig.moonpayApiKey,
|
|
4443
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4444
|
+
DepositView,
|
|
4445
|
+
{
|
|
4446
|
+
source,
|
|
4447
|
+
selectedToken,
|
|
4448
|
+
onRamp: cardOnRamp,
|
|
4449
|
+
amount,
|
|
4450
|
+
allowance,
|
|
4451
|
+
externalMinimum,
|
|
4452
|
+
onAmountChange: setAmount,
|
|
4453
|
+
onSelectToken: () => setView("select-token"),
|
|
4454
|
+
onConnectWallet,
|
|
4455
|
+
onSubmit: handleSubmit,
|
|
4456
|
+
isSubmitting: isPending || externalLock.isSigning || externalLock.isSubmittingLock
|
|
4457
|
+
}
|
|
4458
|
+
)
|
|
4000
4459
|
}
|
|
4001
|
-
)
|
|
4460
|
+
),
|
|
4002
4461
|
activeView === "select-token" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4003
4462
|
TokenSelectorView,
|
|
4004
4463
|
{
|
|
4005
4464
|
selectedTokenId: selectedToken?.id,
|
|
4006
4465
|
onSelect: (id) => {
|
|
4466
|
+
if (id !== selectedTokenId) setAmount("");
|
|
4007
4467
|
setSelectedTokenId(id);
|
|
4008
4468
|
setView("deposit");
|
|
4009
4469
|
}
|
|
@@ -4020,20 +4480,30 @@ function DepositModalContent({
|
|
|
4020
4480
|
lock: externalLock.session ? externalLock : void 0
|
|
4021
4481
|
}
|
|
4022
4482
|
),
|
|
4023
|
-
activeView === "credit-card-widget" &&
|
|
4024
|
-
|
|
4483
|
+
activeView === "credit-card-widget" && mountedCardFlow && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4484
|
+
MoonPayGate,
|
|
4025
4485
|
{
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4486
|
+
enabled: mountedCardFlow.selection.provider === "moonpay",
|
|
4487
|
+
apiKey: mountedCardFlow.moonpayApiKey,
|
|
4488
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4489
|
+
CreditCardWidgetView,
|
|
4490
|
+
{
|
|
4491
|
+
token: mountedCardFlow.selection.token,
|
|
4492
|
+
onRamp: mountedCardFlow.selection,
|
|
4493
|
+
amount: mountedCardFlow.amount,
|
|
4494
|
+
allowance: mountedCardFlow.allowance,
|
|
4495
|
+
lockServiceAddress: mountedCardFlow.lockServiceAddress,
|
|
4496
|
+
onUnsafeToCloseChange: setCardUnsafeToClose,
|
|
4497
|
+
onActiveFlowChange: setCardFlowActive,
|
|
4498
|
+
onCredited: cardOutcomeCallbacks?.onCredited,
|
|
4499
|
+
onLockSubmitted: cardOutcomeCallbacks?.onLockSubmitted,
|
|
4500
|
+
onLockFailed: cardOutcomeCallbacks?.onLockFailed,
|
|
4501
|
+
onLeave: leaveCardPurchase
|
|
4502
|
+
},
|
|
4503
|
+
mountedCardFlow.id
|
|
4504
|
+
)
|
|
4035
4505
|
}
|
|
4036
|
-
)
|
|
4506
|
+
)
|
|
4037
4507
|
] });
|
|
4038
4508
|
}
|
|
4039
4509
|
function DepositModal({ open, onClose, ...handlers }) {
|
|
@@ -4082,7 +4552,7 @@ function DepositInlineModal({ className, ...handlers }) {
|
|
|
4082
4552
|
"div",
|
|
4083
4553
|
{
|
|
4084
4554
|
"data-privana": true,
|
|
4085
|
-
className:
|
|
4555
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
4086
4556
|
"bg-card relative flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
4087
4557
|
className
|
|
4088
4558
|
),
|
|
@@ -4098,7 +4568,7 @@ function WithdrawView({
|
|
|
4098
4568
|
onPendingChange,
|
|
4099
4569
|
onWithdrawSuccess
|
|
4100
4570
|
}) {
|
|
4101
|
-
const { chains, getChainById: getChainById2 } =
|
|
4571
|
+
const { chains, getChainById: getChainById2 } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
4102
4572
|
const { isConnected, address } = wagmi.useAccount();
|
|
4103
4573
|
const [showSuccess, setShowSuccess] = react.useState(false);
|
|
4104
4574
|
const [showTimeout, setShowTimeout] = react.useState(false);
|
|
@@ -4112,7 +4582,7 @@ function WithdrawView({
|
|
|
4112
4582
|
tokenId: selectedToken?.id,
|
|
4113
4583
|
enabled: !!selectedToken
|
|
4114
4584
|
});
|
|
4115
|
-
const formattedBalance = selectedToken ?
|
|
4585
|
+
const formattedBalance = selectedToken ? chunkKCXYYUUG_cjs.formatTokenAmount(balanceWei, selectedToken.decimals) : "0.00";
|
|
4116
4586
|
const { withdraw, isPending, currentStep, error, reset } = useWithdraw({
|
|
4117
4587
|
onProcessingSuccess: () => {
|
|
4118
4588
|
onAmountChange("");
|
|
@@ -4128,13 +4598,22 @@ function WithdrawView({
|
|
|
4128
4598
|
setShowTimeout(true);
|
|
4129
4599
|
}
|
|
4130
4600
|
});
|
|
4131
|
-
const explorerUrl = address && targetChain ?
|
|
4601
|
+
const explorerUrl = address && targetChain ? chunkKCXYYUUG_cjs.getExplorerAddressUrl(targetChain.id, address) : void 0;
|
|
4132
4602
|
const getStepStatus = (step, after) => {
|
|
4133
4603
|
if (currentStep === step) return "active";
|
|
4134
4604
|
if (after.includes(currentStep)) return "completed";
|
|
4135
4605
|
return "pending";
|
|
4136
4606
|
};
|
|
4137
4607
|
const withdrawSteps = [
|
|
4608
|
+
{
|
|
4609
|
+
label: "Preparing withdrawal",
|
|
4610
|
+
status: getStepStatus("preparing", [
|
|
4611
|
+
"switching-chain",
|
|
4612
|
+
"signing",
|
|
4613
|
+
"submitting",
|
|
4614
|
+
"processing"
|
|
4615
|
+
])
|
|
4616
|
+
},
|
|
4138
4617
|
{
|
|
4139
4618
|
label: "Switching to signing chain",
|
|
4140
4619
|
status: getStepStatus("switching-chain", ["signing", "submitting", "processing"])
|
|
@@ -4153,19 +4632,19 @@ function WithdrawView({
|
|
|
4153
4632
|
}, [isPending, cancelled, onPendingChange]);
|
|
4154
4633
|
const hasValidAmount = !!amount && parseFloat(amount) > 0;
|
|
4155
4634
|
const tooManyDecimals = !!hasValidAmount && !!selectedToken && amount.includes(".") && amount.split(".")[1].length > selectedToken.decimals;
|
|
4156
|
-
const exceedsBalance = !!hasValidAmount && !tooManyDecimals && !!selectedToken && !isBalanceLoading && !isBalanceError &&
|
|
4635
|
+
const exceedsBalance = !!hasValidAmount && !tooManyDecimals && !!selectedToken && !isBalanceLoading && !isBalanceError && chunkKCXYYUUG_cjs.parseTokenAmount(amount, selectedToken.decimals) > BigInt(balanceWei);
|
|
4157
4636
|
const canWithdraw = isConnected && hasValidAmount && !!selectedToken && !tooManyDecimals && !exceedsBalance;
|
|
4158
4637
|
const handleMax = () => {
|
|
4159
4638
|
if (!selectedToken) return;
|
|
4160
|
-
const
|
|
4161
|
-
if (
|
|
4639
|
+
const wei = BigInt(balanceWei);
|
|
4640
|
+
if (wei > 0n) onAmountChange(viem.formatUnits(wei, selectedToken.decimals));
|
|
4162
4641
|
};
|
|
4163
4642
|
const handleWithdraw = async () => {
|
|
4164
4643
|
if (!selectedToken || !canWithdraw) return;
|
|
4165
4644
|
setCancelled(false);
|
|
4166
4645
|
await withdraw({
|
|
4167
4646
|
tokenId: selectedToken.id,
|
|
4168
|
-
amount:
|
|
4647
|
+
amount: chunkKCXYYUUG_cjs.parseTokenAmount(amount, selectedToken.decimals)
|
|
4169
4648
|
});
|
|
4170
4649
|
};
|
|
4171
4650
|
const handleCancel = () => {
|
|
@@ -4185,7 +4664,7 @@ function WithdrawView({
|
|
|
4185
4664
|
title: "Withdrawal Complete",
|
|
4186
4665
|
message: `Your ${selectedToken.symbol} withdrawal has been processed. Funds should appear in your wallet shortly.`,
|
|
4187
4666
|
explorerUrl,
|
|
4188
|
-
explorerLabel: targetChain ?
|
|
4667
|
+
explorerLabel: targetChain ? chunkKCXYYUUG_cjs.getExplorerLabel(targetChain.id) : void 0,
|
|
4189
4668
|
onDone: handleDone
|
|
4190
4669
|
}
|
|
4191
4670
|
) });
|
|
@@ -4201,7 +4680,7 @@ function WithdrawView({
|
|
|
4201
4680
|
) });
|
|
4202
4681
|
}
|
|
4203
4682
|
if (isPending && !cancelled) {
|
|
4204
|
-
const canCancel = currentStep === "idle" || currentStep === "switching-chain" || currentStep === "signing";
|
|
4683
|
+
const canCancel = currentStep === "idle" || currentStep === "preparing" || currentStep === "switching-chain" || currentStep === "signing";
|
|
4205
4684
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4206
4685
|
TransactionProgressView,
|
|
4207
4686
|
{
|
|
@@ -4240,11 +4719,10 @@ function WithdrawView({
|
|
|
4240
4719
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
4241
4720
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
4242
4721
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-muted-foreground text-sm", children: "Amount" }),
|
|
4243
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground text-sm", children: [
|
|
4244
|
-
"Available
|
|
4245
|
-
formattedBalance,
|
|
4722
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground flex items-center gap-1 text-sm", children: [
|
|
4723
|
+
"Available",
|
|
4246
4724
|
" ",
|
|
4247
|
-
selectedToken?.symbol
|
|
4725
|
+
isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkKCXYYUUG_cjs.Skeleton, { className: "h-4 w-16" }) : `${formattedBalance} ${selectedToken?.symbol ?? ""}`
|
|
4248
4726
|
] })
|
|
4249
4727
|
] }),
|
|
4250
4728
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border bg-input flex items-center gap-2 rounded-[10px] border py-1 pr-1 pl-3", children: [
|
|
@@ -4267,7 +4745,8 @@ function WithdrawView({
|
|
|
4267
4745
|
{
|
|
4268
4746
|
type: "button",
|
|
4269
4747
|
onClick: handleMax,
|
|
4270
|
-
|
|
4748
|
+
disabled: isBalanceLoading,
|
|
4749
|
+
className: "bg-secondary text-foreground hover:bg-secondary/80 cursor-pointer rounded px-3 py-2.5 text-xs font-semibold transition-colors disabled:cursor-default disabled:opacity-50",
|
|
4271
4750
|
children: "MAX"
|
|
4272
4751
|
}
|
|
4273
4752
|
)
|
|
@@ -4297,7 +4776,7 @@ function WithdrawModalContent({
|
|
|
4297
4776
|
onBack,
|
|
4298
4777
|
onWithdrawSuccess
|
|
4299
4778
|
}) {
|
|
4300
|
-
const { serviceName, enabledTokens, defaultToken, hostedAuthConfig } =
|
|
4779
|
+
const { serviceName, enabledTokens, defaultToken, hostedAuthConfig } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
4301
4780
|
const { address } = wagmi.useAccount();
|
|
4302
4781
|
const appName = serviceName ?? "Privana";
|
|
4303
4782
|
const [view, setView] = react.useState("form");
|
|
@@ -4370,6 +4849,7 @@ function WithdrawModalContent({
|
|
|
4370
4849
|
{
|
|
4371
4850
|
selectedTokenId: selectedToken?.id,
|
|
4372
4851
|
onSelect: (id) => {
|
|
4852
|
+
if (id !== selectedTokenId) setAmount("");
|
|
4373
4853
|
setSelectedTokenId(id);
|
|
4374
4854
|
setView("form");
|
|
4375
4855
|
}
|
|
@@ -4423,7 +4903,7 @@ function WithdrawInlineModal({ className, onWithdrawSuccess }) {
|
|
|
4423
4903
|
"div",
|
|
4424
4904
|
{
|
|
4425
4905
|
"data-privana": true,
|
|
4426
|
-
className:
|
|
4906
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
4427
4907
|
"bg-card relative flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
4428
4908
|
className
|
|
4429
4909
|
),
|
|
@@ -4467,14 +4947,14 @@ function SegmentedBalanceBar({
|
|
|
4467
4947
|
showAvailable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4468
4948
|
"div",
|
|
4469
4949
|
{
|
|
4470
|
-
className:
|
|
4950
|
+
className: chunkKCXYYUUG_cjs.cn(AVAILABLE_COLOR, "rounded-l-full", !showInUse && "rounded-r-full"),
|
|
4471
4951
|
style: { flexGrow: grow(availableWei) }
|
|
4472
4952
|
}
|
|
4473
4953
|
),
|
|
4474
4954
|
showInUse && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4475
4955
|
"div",
|
|
4476
4956
|
{
|
|
4477
|
-
className:
|
|
4957
|
+
className: chunkKCXYYUUG_cjs.cn(IN_USE_COLOR, "rounded-r-full", !showAvailable && "rounded-l-full"),
|
|
4478
4958
|
style: { flexGrow: grow(inUseWei) }
|
|
4479
4959
|
}
|
|
4480
4960
|
)
|
|
@@ -4482,7 +4962,7 @@ function SegmentedBalanceBar({
|
|
|
4482
4962
|
}
|
|
4483
4963
|
function BalanceLegendItem({ color, label }) {
|
|
4484
4964
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
4485
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className:
|
|
4965
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkKCXYYUUG_cjs.cn("h-2.5 w-2.5 rounded-full", color) }),
|
|
4486
4966
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground text-sm leading-5", children: label })
|
|
4487
4967
|
] });
|
|
4488
4968
|
}
|
|
@@ -4495,7 +4975,7 @@ function WalletBalanceView({
|
|
|
4495
4975
|
onAddFunds,
|
|
4496
4976
|
onWithdraw
|
|
4497
4977
|
}) {
|
|
4498
|
-
const { serviceName, serviceIcon, defaultToken } =
|
|
4978
|
+
const { serviceName, serviceIcon, defaultToken } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
4499
4979
|
const appName = serviceName ?? "Privana";
|
|
4500
4980
|
const token = defaultToken;
|
|
4501
4981
|
const {
|
|
@@ -4508,14 +4988,14 @@ function WalletBalanceView({
|
|
|
4508
4988
|
const variant = !session ? "idle" : inUseWei === 0n ? "session-zero" : availableWei === 0n ? "fully-in-use" : "mixed";
|
|
4509
4989
|
const expiry = session?.expiry;
|
|
4510
4990
|
useNow(3e4, expiry != null);
|
|
4511
|
-
const countdown = expiry != null ?
|
|
4991
|
+
const countdown = expiry != null ? chunkKCXYYUUG_cjs.formatTimeRemaining(expiry) : null;
|
|
4512
4992
|
const decimals = token?.decimals ?? 18;
|
|
4513
|
-
const totalFormatted =
|
|
4514
|
-
const availableFormatted =
|
|
4515
|
-
const inUseFormatted =
|
|
4993
|
+
const totalFormatted = chunkKCXYYUUG_cjs.formatTokenAmount((availableWei + inUseWei).toString(), decimals);
|
|
4994
|
+
const availableFormatted = chunkKCXYYUUG_cjs.formatTokenAmount(availableWei.toString(), decimals);
|
|
4995
|
+
const inUseFormatted = chunkKCXYYUUG_cjs.formatTokenAmount(inUseWei.toString(), decimals);
|
|
4516
4996
|
const hasValidAmount = !!amount && parseFloat(amount) > 0;
|
|
4517
4997
|
const tooManyDecimals = hasValidAmount && !!token && amount.includes(".") && amount.split(".")[1].length > token.decimals;
|
|
4518
|
-
const exceedsBalance = hasValidAmount && !tooManyDecimals && !!token && !isBalanceLoading && !isBalanceError &&
|
|
4998
|
+
const exceedsBalance = hasValidAmount && !tooManyDecimals && !!token && !isBalanceLoading && !isBalanceError && chunkKCXYYUUG_cjs.parseTokenAmount(amount, token.decimals) > availableWei;
|
|
4519
4999
|
const canFundSession = hasValidAmount && !!token && !tooManyDecimals && !exceedsBalance && !isBalanceLoading && !isBalanceError;
|
|
4520
5000
|
const handleMax = () => {
|
|
4521
5001
|
const max = availableFormatted.replace(/\s/g, "");
|
|
@@ -4533,7 +5013,7 @@ function WalletBalanceView({
|
|
|
4533
5013
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm leading-[14px]", children: "Total" }),
|
|
4534
5014
|
/* @__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" })
|
|
4535
5015
|
] }),
|
|
4536
|
-
isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5016
|
+
isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkKCXYYUUG_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 })
|
|
4537
5017
|
] }),
|
|
4538
5018
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
4539
5019
|
/* @__PURE__ */ jsxRuntime.jsx(SegmentedBalanceBar, { availableWei, inUseWei }),
|
|
@@ -4684,7 +5164,7 @@ function WalletModalContent({
|
|
|
4684
5164
|
onCloseBlockedChange,
|
|
4685
5165
|
...depositHandlers
|
|
4686
5166
|
}) {
|
|
4687
|
-
const { serviceName, hostedAuthConfig } =
|
|
5167
|
+
const { serviceName, hostedAuthConfig } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
4688
5168
|
const { address } = wagmi.useAccount();
|
|
4689
5169
|
const appName = serviceName ?? "Privana";
|
|
4690
5170
|
const [view, setView] = react.useState("balance");
|
|
@@ -4788,7 +5268,7 @@ function WalletModalContent({
|
|
|
4788
5268
|
onClick: onClose,
|
|
4789
5269
|
disabled: closeBlocked,
|
|
4790
5270
|
"aria-label": "Close",
|
|
4791
|
-
className:
|
|
5271
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
4792
5272
|
"absolute top-6 right-5 z-20 flex h-5 w-5 items-center justify-center transition-colors",
|
|
4793
5273
|
closeBlocked ? "text-muted-foreground/40 cursor-not-allowed" : "text-muted-foreground hover:text-foreground cursor-pointer"
|
|
4794
5274
|
),
|
|
@@ -4916,7 +5396,7 @@ function WalletInlineModal({ className, ...handlers }) {
|
|
|
4916
5396
|
"div",
|
|
4917
5397
|
{
|
|
4918
5398
|
"data-privana": true,
|
|
4919
|
-
className:
|
|
5399
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
4920
5400
|
"bg-card relative flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
4921
5401
|
className
|
|
4922
5402
|
),
|
|
@@ -4927,295 +5407,295 @@ function WalletInlineModal({ className, ...handlers }) {
|
|
|
4927
5407
|
|
|
4928
5408
|
Object.defineProperty(exports, "AccountingApiError", {
|
|
4929
5409
|
enumerable: true,
|
|
4930
|
-
get: function () { return
|
|
5410
|
+
get: function () { return chunkKCXYYUUG_cjs.AccountingApiError; }
|
|
4931
5411
|
});
|
|
4932
5412
|
Object.defineProperty(exports, "Button", {
|
|
4933
5413
|
enumerable: true,
|
|
4934
|
-
get: function () { return
|
|
5414
|
+
get: function () { return chunkKCXYYUUG_cjs.Button; }
|
|
4935
5415
|
});
|
|
4936
5416
|
Object.defineProperty(exports, "DEFAULT_LOCK_DURATION_SECONDS", {
|
|
4937
5417
|
enumerable: true,
|
|
4938
|
-
get: function () { return
|
|
5418
|
+
get: function () { return chunkKCXYYUUG_cjs.DEFAULT_LOCK_DURATION_SECONDS; }
|
|
4939
5419
|
});
|
|
4940
5420
|
Object.defineProperty(exports, "DEFAULT_ONRAMP_LOCK_BUFFER", {
|
|
4941
5421
|
enumerable: true,
|
|
4942
|
-
get: function () { return
|
|
5422
|
+
get: function () { return chunkKCXYYUUG_cjs.DEFAULT_ONRAMP_LOCK_BUFFER; }
|
|
4943
5423
|
});
|
|
4944
5424
|
Object.defineProperty(exports, "HOSTED_AUTH_CLOCK_SKEW_MS", {
|
|
4945
5425
|
enumerable: true,
|
|
4946
|
-
get: function () { return
|
|
5426
|
+
get: function () { return chunkKCXYYUUG_cjs.HOSTED_AUTH_CLOCK_SKEW_MS; }
|
|
4947
5427
|
});
|
|
4948
5428
|
Object.defineProperty(exports, "HostedAuthError", {
|
|
4949
5429
|
enumerable: true,
|
|
4950
|
-
get: function () { return
|
|
5430
|
+
get: function () { return chunkKCXYYUUG_cjs.HostedAuthError; }
|
|
4951
5431
|
});
|
|
4952
5432
|
Object.defineProperty(exports, "HostedAuthRequiredError", {
|
|
4953
5433
|
enumerable: true,
|
|
4954
|
-
get: function () { return
|
|
5434
|
+
get: function () { return chunkKCXYYUUG_cjs.HostedAuthRequiredError; }
|
|
4955
5435
|
});
|
|
4956
5436
|
Object.defineProperty(exports, "HostedAuthStateMismatchError", {
|
|
4957
5437
|
enumerable: true,
|
|
4958
|
-
get: function () { return
|
|
5438
|
+
get: function () { return chunkKCXYYUUG_cjs.HostedAuthStateMismatchError; }
|
|
4959
5439
|
});
|
|
4960
5440
|
Object.defineProperty(exports, "HttpClient", {
|
|
4961
5441
|
enumerable: true,
|
|
4962
|
-
get: function () { return
|
|
5442
|
+
get: function () { return chunkKCXYYUUG_cjs.HttpClient; }
|
|
4963
5443
|
});
|
|
4964
5444
|
Object.defineProperty(exports, "LOCK_TYPES", {
|
|
4965
5445
|
enumerable: true,
|
|
4966
|
-
get: function () { return
|
|
5446
|
+
get: function () { return chunkKCXYYUUG_cjs.LOCK_TYPES; }
|
|
4967
5447
|
});
|
|
4968
5448
|
Object.defineProperty(exports, "MODIFY_LOCK_TYPES", {
|
|
4969
5449
|
enumerable: true,
|
|
4970
|
-
get: function () { return
|
|
5450
|
+
get: function () { return chunkKCXYYUUG_cjs.MODIFY_LOCK_TYPES; }
|
|
4971
5451
|
});
|
|
4972
5452
|
Object.defineProperty(exports, "NETWORK_CONFIG", {
|
|
4973
5453
|
enumerable: true,
|
|
4974
|
-
get: function () { return
|
|
5454
|
+
get: function () { return chunkKCXYYUUG_cjs.NETWORK_CONFIG; }
|
|
4975
5455
|
});
|
|
4976
5456
|
Object.defineProperty(exports, "NetworkError", {
|
|
4977
5457
|
enumerable: true,
|
|
4978
|
-
get: function () { return
|
|
5458
|
+
get: function () { return chunkKCXYYUUG_cjs.NetworkError; }
|
|
4979
5459
|
});
|
|
4980
5460
|
Object.defineProperty(exports, "PostDepositLockError", {
|
|
4981
5461
|
enumerable: true,
|
|
4982
|
-
get: function () { return
|
|
5462
|
+
get: function () { return chunkKCXYYUUG_cjs.PostDepositLockError; }
|
|
4983
5463
|
});
|
|
4984
5464
|
Object.defineProperty(exports, "PrivanaClient", {
|
|
4985
5465
|
enumerable: true,
|
|
4986
|
-
get: function () { return
|
|
5466
|
+
get: function () { return chunkKCXYYUUG_cjs.PrivanaClient; }
|
|
4987
5467
|
});
|
|
4988
5468
|
Object.defineProperty(exports, "PrivanaProvider", {
|
|
4989
5469
|
enumerable: true,
|
|
4990
|
-
get: function () { return
|
|
5470
|
+
get: function () { return chunkKCXYYUUG_cjs.PrivanaProvider; }
|
|
4991
5471
|
});
|
|
4992
5472
|
Object.defineProperty(exports, "SUPPORTED_CHAINS", {
|
|
4993
5473
|
enumerable: true,
|
|
4994
|
-
get: function () { return
|
|
5474
|
+
get: function () { return chunkKCXYYUUG_cjs.SUPPORTED_CHAINS; }
|
|
4995
5475
|
});
|
|
4996
5476
|
Object.defineProperty(exports, "SiweAuthProvider", {
|
|
4997
5477
|
enumerable: true,
|
|
4998
|
-
get: function () { return
|
|
5478
|
+
get: function () { return chunkKCXYYUUG_cjs.SiweAuthProvider; }
|
|
4999
5479
|
});
|
|
5000
5480
|
Object.defineProperty(exports, "Skeleton", {
|
|
5001
5481
|
enumerable: true,
|
|
5002
|
-
get: function () { return
|
|
5482
|
+
get: function () { return chunkKCXYYUUG_cjs.Skeleton; }
|
|
5003
5483
|
});
|
|
5004
5484
|
Object.defineProperty(exports, "TRANSFER_LOCKED_TYPES", {
|
|
5005
5485
|
enumerable: true,
|
|
5006
|
-
get: function () { return
|
|
5486
|
+
get: function () { return chunkKCXYYUUG_cjs.TRANSFER_LOCKED_TYPES; }
|
|
5007
5487
|
});
|
|
5008
5488
|
Object.defineProperty(exports, "TRANSFER_TYPES", {
|
|
5009
5489
|
enumerable: true,
|
|
5010
|
-
get: function () { return
|
|
5490
|
+
get: function () { return chunkKCXYYUUG_cjs.TRANSFER_TYPES; }
|
|
5011
5491
|
});
|
|
5012
5492
|
Object.defineProperty(exports, "ValidationError", {
|
|
5013
5493
|
enumerable: true,
|
|
5014
|
-
get: function () { return
|
|
5494
|
+
get: function () { return chunkKCXYYUUG_cjs.ValidationError; }
|
|
5015
5495
|
});
|
|
5016
5496
|
Object.defineProperty(exports, "WITHDRAW_FROM_LOCK_TYPES", {
|
|
5017
5497
|
enumerable: true,
|
|
5018
|
-
get: function () { return
|
|
5498
|
+
get: function () { return chunkKCXYYUUG_cjs.WITHDRAW_FROM_LOCK_TYPES; }
|
|
5019
5499
|
});
|
|
5020
5500
|
Object.defineProperty(exports, "WITHDRAW_TYPES", {
|
|
5021
5501
|
enumerable: true,
|
|
5022
|
-
get: function () { return
|
|
5502
|
+
get: function () { return chunkKCXYYUUG_cjs.WITHDRAW_TYPES; }
|
|
5023
5503
|
});
|
|
5024
5504
|
Object.defineProperty(exports, "applyLockBuffer", {
|
|
5025
5505
|
enumerable: true,
|
|
5026
|
-
get: function () { return
|
|
5506
|
+
get: function () { return chunkKCXYYUUG_cjs.applyLockBuffer; }
|
|
5027
5507
|
});
|
|
5028
5508
|
Object.defineProperty(exports, "applyRefreshResponse", {
|
|
5029
5509
|
enumerable: true,
|
|
5030
|
-
get: function () { return
|
|
5510
|
+
get: function () { return chunkKCXYYUUG_cjs.applyRefreshResponse; }
|
|
5031
5511
|
});
|
|
5032
5512
|
Object.defineProperty(exports, "buildHostedAuthSession", {
|
|
5033
5513
|
enumerable: true,
|
|
5034
|
-
get: function () { return
|
|
5514
|
+
get: function () { return chunkKCXYYUUG_cjs.buildHostedAuthSession; }
|
|
5035
5515
|
});
|
|
5036
5516
|
Object.defineProperty(exports, "buildSiweStatement", {
|
|
5037
5517
|
enumerable: true,
|
|
5038
|
-
get: function () { return
|
|
5518
|
+
get: function () { return chunkKCXYYUUG_cjs.buildSiweStatement; }
|
|
5039
5519
|
});
|
|
5040
5520
|
Object.defineProperty(exports, "buttonVariants", {
|
|
5041
5521
|
enumerable: true,
|
|
5042
|
-
get: function () { return
|
|
5522
|
+
get: function () { return chunkKCXYYUUG_cjs.buttonVariants; }
|
|
5043
5523
|
});
|
|
5044
5524
|
Object.defineProperty(exports, "clampLockAmount", {
|
|
5045
5525
|
enumerable: true,
|
|
5046
|
-
get: function () { return
|
|
5526
|
+
get: function () { return chunkKCXYYUUG_cjs.clampLockAmount; }
|
|
5047
5527
|
});
|
|
5048
5528
|
Object.defineProperty(exports, "clearHostedAuthPendingTransaction", {
|
|
5049
5529
|
enumerable: true,
|
|
5050
|
-
get: function () { return
|
|
5530
|
+
get: function () { return chunkKCXYYUUG_cjs.clearHostedAuthPendingTransaction; }
|
|
5051
5531
|
});
|
|
5052
5532
|
Object.defineProperty(exports, "clearPendingLock", {
|
|
5053
5533
|
enumerable: true,
|
|
5054
|
-
get: function () { return
|
|
5534
|
+
get: function () { return chunkKCXYYUUG_cjs.clearPendingLock; }
|
|
5055
5535
|
});
|
|
5056
5536
|
Object.defineProperty(exports, "createDomain", {
|
|
5057
5537
|
enumerable: true,
|
|
5058
|
-
get: function () { return
|
|
5538
|
+
get: function () { return chunkKCXYYUUG_cjs.createDomain; }
|
|
5059
5539
|
});
|
|
5060
5540
|
Object.defineProperty(exports, "createHostedAuthPendingStorageKey", {
|
|
5061
5541
|
enumerable: true,
|
|
5062
|
-
get: function () { return
|
|
5542
|
+
get: function () { return chunkKCXYYUUG_cjs.createHostedAuthPendingStorageKey; }
|
|
5063
5543
|
});
|
|
5064
5544
|
Object.defineProperty(exports, "createHostedAuthState", {
|
|
5065
5545
|
enumerable: true,
|
|
5066
|
-
get: function () { return
|
|
5546
|
+
get: function () { return chunkKCXYYUUG_cjs.createHostedAuthState; }
|
|
5067
5547
|
});
|
|
5068
5548
|
Object.defineProperty(exports, "createHostedAuthStorageKey", {
|
|
5069
5549
|
enumerable: true,
|
|
5070
|
-
get: function () { return
|
|
5550
|
+
get: function () { return chunkKCXYYUUG_cjs.createHostedAuthStorageKey; }
|
|
5071
5551
|
});
|
|
5072
5552
|
Object.defineProperty(exports, "createLockExpiry", {
|
|
5073
5553
|
enumerable: true,
|
|
5074
|
-
get: function () { return
|
|
5554
|
+
get: function () { return chunkKCXYYUUG_cjs.createLockExpiry; }
|
|
5075
5555
|
});
|
|
5076
5556
|
Object.defineProperty(exports, "createPkceChallenge", {
|
|
5077
5557
|
enumerable: true,
|
|
5078
|
-
get: function () { return
|
|
5558
|
+
get: function () { return chunkKCXYYUUG_cjs.createPkceChallenge; }
|
|
5079
5559
|
});
|
|
5080
5560
|
Object.defineProperty(exports, "createPkceVerifier", {
|
|
5081
5561
|
enumerable: true,
|
|
5082
|
-
get: function () { return
|
|
5562
|
+
get: function () { return chunkKCXYYUUG_cjs.createPkceVerifier; }
|
|
5083
5563
|
});
|
|
5084
5564
|
Object.defineProperty(exports, "createSignedLockRequest", {
|
|
5085
5565
|
enumerable: true,
|
|
5086
|
-
get: function () { return
|
|
5566
|
+
get: function () { return chunkKCXYYUUG_cjs.createSignedLockRequest; }
|
|
5087
5567
|
});
|
|
5088
5568
|
Object.defineProperty(exports, "getAccountingContract", {
|
|
5089
5569
|
enumerable: true,
|
|
5090
|
-
get: function () { return
|
|
5570
|
+
get: function () { return chunkKCXYYUUG_cjs.getAccountingContract; }
|
|
5091
5571
|
});
|
|
5092
5572
|
Object.defineProperty(exports, "getApiUrl", {
|
|
5093
5573
|
enumerable: true,
|
|
5094
|
-
get: function () { return
|
|
5574
|
+
get: function () { return chunkKCXYYUUG_cjs.getApiUrl; }
|
|
5095
5575
|
});
|
|
5096
5576
|
Object.defineProperty(exports, "getChainById", {
|
|
5097
5577
|
enumerable: true,
|
|
5098
|
-
get: function () { return
|
|
5578
|
+
get: function () { return chunkKCXYYUUG_cjs.getChainById; }
|
|
5099
5579
|
});
|
|
5100
5580
|
Object.defineProperty(exports, "getChainId", {
|
|
5101
5581
|
enumerable: true,
|
|
5102
|
-
get: function () { return
|
|
5582
|
+
get: function () { return chunkKCXYYUUG_cjs.getChainId; }
|
|
5103
5583
|
});
|
|
5104
5584
|
Object.defineProperty(exports, "getExplorerAddressUrl", {
|
|
5105
5585
|
enumerable: true,
|
|
5106
|
-
get: function () { return
|
|
5586
|
+
get: function () { return chunkKCXYYUUG_cjs.getExplorerAddressUrl; }
|
|
5107
5587
|
});
|
|
5108
5588
|
Object.defineProperty(exports, "getExplorerLabel", {
|
|
5109
5589
|
enumerable: true,
|
|
5110
|
-
get: function () { return
|
|
5590
|
+
get: function () { return chunkKCXYYUUG_cjs.getExplorerLabel; }
|
|
5111
5591
|
});
|
|
5112
5592
|
Object.defineProperty(exports, "isHostedAuthRefreshActive", {
|
|
5113
5593
|
enumerable: true,
|
|
5114
|
-
get: function () { return
|
|
5594
|
+
get: function () { return chunkKCXYYUUG_cjs.isHostedAuthRefreshActive; }
|
|
5115
5595
|
});
|
|
5116
5596
|
Object.defineProperty(exports, "isHostedAuthSessionActive", {
|
|
5117
5597
|
enumerable: true,
|
|
5118
|
-
get: function () { return
|
|
5598
|
+
get: function () { return chunkKCXYYUUG_cjs.isHostedAuthSessionActive; }
|
|
5119
5599
|
});
|
|
5120
5600
|
Object.defineProperty(exports, "isSignedLockUsable", {
|
|
5121
5601
|
enumerable: true,
|
|
5122
|
-
get: function () { return
|
|
5602
|
+
get: function () { return chunkKCXYYUUG_cjs.isSignedLockUsable; }
|
|
5123
5603
|
});
|
|
5124
5604
|
Object.defineProperty(exports, "loadPendingLock", {
|
|
5125
5605
|
enumerable: true,
|
|
5126
|
-
get: function () { return
|
|
5606
|
+
get: function () { return chunkKCXYYUUG_cjs.loadPendingLock; }
|
|
5127
5607
|
});
|
|
5128
5608
|
Object.defineProperty(exports, "normalizeAddress", {
|
|
5129
5609
|
enumerable: true,
|
|
5130
|
-
get: function () { return
|
|
5610
|
+
get: function () { return chunkKCXYYUUG_cjs.normalizeAddress; }
|
|
5131
5611
|
});
|
|
5132
5612
|
Object.defineProperty(exports, "normalizeHex", {
|
|
5133
5613
|
enumerable: true,
|
|
5134
|
-
get: function () { return
|
|
5614
|
+
get: function () { return chunkKCXYYUUG_cjs.normalizeHex; }
|
|
5135
5615
|
});
|
|
5136
5616
|
Object.defineProperty(exports, "parseHostedAuthCallback", {
|
|
5137
5617
|
enumerable: true,
|
|
5138
|
-
get: function () { return
|
|
5618
|
+
get: function () { return chunkKCXYYUUG_cjs.parseHostedAuthCallback; }
|
|
5139
5619
|
});
|
|
5140
5620
|
Object.defineProperty(exports, "persistHostedAuthPendingTransaction", {
|
|
5141
5621
|
enumerable: true,
|
|
5142
|
-
get: function () { return
|
|
5622
|
+
get: function () { return chunkKCXYYUUG_cjs.persistHostedAuthPendingTransaction; }
|
|
5143
5623
|
});
|
|
5144
5624
|
Object.defineProperty(exports, "readHostedAuthPendingTransaction", {
|
|
5145
5625
|
enumerable: true,
|
|
5146
|
-
get: function () { return
|
|
5626
|
+
get: function () { return chunkKCXYYUUG_cjs.readHostedAuthPendingTransaction; }
|
|
5147
5627
|
});
|
|
5148
5628
|
Object.defineProperty(exports, "readStoredHostedAuthSession", {
|
|
5149
5629
|
enumerable: true,
|
|
5150
|
-
get: function () { return
|
|
5630
|
+
get: function () { return chunkKCXYYUUG_cjs.readStoredHostedAuthSession; }
|
|
5151
5631
|
});
|
|
5152
5632
|
Object.defineProperty(exports, "requireDepositLockOwner", {
|
|
5153
5633
|
enumerable: true,
|
|
5154
|
-
get: function () { return
|
|
5634
|
+
get: function () { return chunkKCXYYUUG_cjs.requireDepositLockOwner; }
|
|
5155
5635
|
});
|
|
5156
5636
|
Object.defineProperty(exports, "requireServiceAddress", {
|
|
5157
5637
|
enumerable: true,
|
|
5158
|
-
get: function () { return
|
|
5638
|
+
get: function () { return chunkKCXYYUUG_cjs.requireServiceAddress; }
|
|
5159
5639
|
});
|
|
5160
5640
|
Object.defineProperty(exports, "savePendingLock", {
|
|
5161
5641
|
enumerable: true,
|
|
5162
|
-
get: function () { return
|
|
5642
|
+
get: function () { return chunkKCXYYUUG_cjs.savePendingLock; }
|
|
5163
5643
|
});
|
|
5164
5644
|
Object.defineProperty(exports, "signLockMessage", {
|
|
5165
5645
|
enumerable: true,
|
|
5166
|
-
get: function () { return
|
|
5646
|
+
get: function () { return chunkKCXYYUUG_cjs.signLockMessage; }
|
|
5167
5647
|
});
|
|
5168
5648
|
Object.defineProperty(exports, "signModifyLockMessage", {
|
|
5169
5649
|
enumerable: true,
|
|
5170
|
-
get: function () { return
|
|
5650
|
+
get: function () { return chunkKCXYYUUG_cjs.signModifyLockMessage; }
|
|
5171
5651
|
});
|
|
5172
5652
|
Object.defineProperty(exports, "signTransferLockedMessage", {
|
|
5173
5653
|
enumerable: true,
|
|
5174
|
-
get: function () { return
|
|
5654
|
+
get: function () { return chunkKCXYYUUG_cjs.signTransferLockedMessage; }
|
|
5175
5655
|
});
|
|
5176
5656
|
Object.defineProperty(exports, "signTransferMessage", {
|
|
5177
5657
|
enumerable: true,
|
|
5178
|
-
get: function () { return
|
|
5658
|
+
get: function () { return chunkKCXYYUUG_cjs.signTransferMessage; }
|
|
5179
5659
|
});
|
|
5180
5660
|
Object.defineProperty(exports, "signWithdrawFromLockMessage", {
|
|
5181
5661
|
enumerable: true,
|
|
5182
|
-
get: function () { return
|
|
5662
|
+
get: function () { return chunkKCXYYUUG_cjs.signWithdrawFromLockMessage; }
|
|
5183
5663
|
});
|
|
5184
5664
|
Object.defineProperty(exports, "signWithdrawMessage", {
|
|
5185
5665
|
enumerable: true,
|
|
5186
|
-
get: function () { return
|
|
5666
|
+
get: function () { return chunkKCXYYUUG_cjs.signWithdrawMessage; }
|
|
5187
5667
|
});
|
|
5188
5668
|
Object.defineProperty(exports, "stripHostedAuthCallbackParams", {
|
|
5189
5669
|
enumerable: true,
|
|
5190
|
-
get: function () { return
|
|
5670
|
+
get: function () { return chunkKCXYYUUG_cjs.stripHostedAuthCallbackParams; }
|
|
5191
5671
|
});
|
|
5192
5672
|
Object.defineProperty(exports, "submitPendingLock", {
|
|
5193
5673
|
enumerable: true,
|
|
5194
|
-
get: function () { return
|
|
5674
|
+
get: function () { return chunkKCXYYUUG_cjs.submitPendingLock; }
|
|
5195
5675
|
});
|
|
5196
5676
|
Object.defineProperty(exports, "syncHostedAuthSessionToClient", {
|
|
5197
5677
|
enumerable: true,
|
|
5198
|
-
get: function () { return
|
|
5678
|
+
get: function () { return chunkKCXYYUUG_cjs.syncHostedAuthSessionToClient; }
|
|
5199
5679
|
});
|
|
5200
5680
|
Object.defineProperty(exports, "useDepositVerification", {
|
|
5201
5681
|
enumerable: true,
|
|
5202
|
-
get: function () { return
|
|
5682
|
+
get: function () { return chunkKCXYYUUG_cjs.useDepositVerification; }
|
|
5203
5683
|
});
|
|
5204
5684
|
Object.defineProperty(exports, "usePrivanaContext", {
|
|
5205
5685
|
enumerable: true,
|
|
5206
|
-
get: function () { return
|
|
5686
|
+
get: function () { return chunkKCXYYUUG_cjs.usePrivanaContext; }
|
|
5207
5687
|
});
|
|
5208
5688
|
Object.defineProperty(exports, "useSafeAccount", {
|
|
5209
5689
|
enumerable: true,
|
|
5210
|
-
get: function () { return
|
|
5690
|
+
get: function () { return chunkKCXYYUUG_cjs.useSafeAccount; }
|
|
5211
5691
|
});
|
|
5212
5692
|
Object.defineProperty(exports, "useSafePrivanaContext", {
|
|
5213
5693
|
enumerable: true,
|
|
5214
|
-
get: function () { return
|
|
5694
|
+
get: function () { return chunkKCXYYUUG_cjs.useSafePrivanaContext; }
|
|
5215
5695
|
});
|
|
5216
5696
|
Object.defineProperty(exports, "useSiweAuth", {
|
|
5217
5697
|
enumerable: true,
|
|
5218
|
-
get: function () { return
|
|
5698
|
+
get: function () { return chunkKCXYYUUG_cjs.useSiweAuth; }
|
|
5219
5699
|
});
|
|
5220
5700
|
exports.DepositInlineModal = DepositInlineModal;
|
|
5221
5701
|
exports.DepositModal = DepositModal;
|