@oasisprotocol/privana-sdk 0.5.10 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-RDYNQUMV.js → chunk-OHSIARZ3.js} +385 -376
- package/dist/chunk-OHSIARZ3.js.map +1 -0
- package/dist/{chunk-KCXYYUUG.cjs → chunk-VNECVPMU.cjs} +385 -376
- package/dist/chunk-VNECVPMU.cjs.map +1 -0
- package/dist/index.cjs +346 -288
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +86 -29
- package/dist/index.js.map +1 -1
- package/dist/on-ramp.cjs +5 -5
- package/dist/on-ramp.d.cts +2 -2
- package/dist/on-ramp.d.ts +2 -2
- package/dist/on-ramp.js +1 -1
- package/dist/{pending-lock-DIL2jCaT.d.cts → pending-lock-rsz1iwZ-.d.cts} +1 -1
- package/dist/{pending-lock-DIL2jCaT.d.ts → pending-lock-rsz1iwZ-.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-KCXYYUUG.cjs.map +0 -1
- package/dist/chunk-RDYNQUMV.js.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 chunkVNECVPMU_cjs = require('./chunk-VNECVPMU.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 } = chunkVNECVPMU_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 chunkVNECVPMU_cjs.AccountingApiError && error.detail) {
|
|
44
|
+
return new chunkVNECVPMU_cjs.HostedAuthError(error.detail);
|
|
45
45
|
}
|
|
46
46
|
if (error instanceof Error) {
|
|
47
47
|
return error;
|
|
48
48
|
}
|
|
49
|
-
return new
|
|
49
|
+
return new chunkVNECVPMU_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
|
+
} = chunkVNECVPMU_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 ? chunkVNECVPMU_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
|
+
chunkVNECVPMU_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 chunkVNECVPMU_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 chunkVNECVPMU_cjs.HostedAuthError("Hosted redirect authentication requires a browser environment.");
|
|
81
81
|
}
|
|
82
82
|
if (!pendingStorageKey) {
|
|
83
|
-
throw new
|
|
83
|
+
throw new chunkVNECVPMU_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 = chunkVNECVPMU_cjs.createPkceVerifier();
|
|
93
|
+
const codeChallenge = await chunkVNECVPMU_cjs.createPkceChallenge(verifier);
|
|
94
|
+
const state = chunkVNECVPMU_cjs.createHostedAuthState();
|
|
95
|
+
chunkVNECVPMU_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 chunkVNECVPMU_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 chunkVNECVPMU_cjs.HostedAuthError("Hosted redirect authentication requires a browser environment.");
|
|
130
130
|
}
|
|
131
131
|
if (!pendingStorageKey) {
|
|
132
|
-
throw new
|
|
132
|
+
throw new chunkVNECVPMU_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, "", chunkVNECVPMU_cjs.stripHostedAuthCallbackParams(callbackUrl));
|
|
143
143
|
};
|
|
144
144
|
try {
|
|
145
|
-
const callback =
|
|
145
|
+
const callback = chunkVNECVPMU_cjs.parseHostedAuthCallback(callbackUrl, hostedAuthConfig.redirectUri);
|
|
146
146
|
if (!callback) {
|
|
147
147
|
return null;
|
|
148
148
|
}
|
|
149
|
-
const pending =
|
|
149
|
+
const pending = chunkVNECVPMU_cjs.readHostedAuthPendingTransaction(window.sessionStorage, pendingStorageKey);
|
|
150
150
|
if (!pending) {
|
|
151
151
|
clearPendingLogin();
|
|
152
152
|
cleanupCallbackUrl();
|
|
153
|
-
throw new
|
|
153
|
+
throw new chunkVNECVPMU_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 chunkVNECVPMU_cjs.HostedAuthStateMismatchError();
|
|
161
161
|
}
|
|
162
162
|
if ("error" in callback) {
|
|
163
163
|
clearPendingLogin();
|
|
164
164
|
cleanupCallbackUrl();
|
|
165
|
-
throw new
|
|
165
|
+
throw new chunkVNECVPMU_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 = chunkVNECVPMU_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 chunkVNECVPMU_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 = chunkVNECVPMU_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 } = chunkVNECVPMU_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: chunkVNECVPMU_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 } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
278
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkVNECVPMU_cjs.usePrivateReadRequest();
|
|
279
279
|
const query = reactQuery.useQuery({
|
|
280
280
|
queryKey: ["accounting-batch-balances", ...privateReadQueryScope, options.tokenIds],
|
|
281
281
|
queryFn: async () => {
|
|
@@ -295,6 +295,20 @@ function useBatchBalances(options) {
|
|
|
295
295
|
refetch: query.refetch
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
|
+
|
|
299
|
+
// src/sdk/utils/min-deposit.ts
|
|
300
|
+
function getMinDepositBaseUnits(response, chainId, kind) {
|
|
301
|
+
const value = response?.min_deposit?.[String(chainId)]?.[kind];
|
|
302
|
+
if (value === void 0) return void 0;
|
|
303
|
+
try {
|
|
304
|
+
const amount = BigInt(value);
|
|
305
|
+
return amount >= 0n ? amount : void 0;
|
|
306
|
+
} catch {
|
|
307
|
+
return void 0;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// src/sdk/hooks/use-deposit.ts
|
|
298
312
|
var STALE_MS = 30 * 60 * 1e3;
|
|
299
313
|
function resolveConfirmations(depositAddress, chainId) {
|
|
300
314
|
const confirmations = depositAddress.finality_depth?.[String(chainId)];
|
|
@@ -307,17 +321,17 @@ function storageKey(address) {
|
|
|
307
321
|
return `privana:pending-deposit:${address.toLowerCase()}`;
|
|
308
322
|
}
|
|
309
323
|
function savePendingDeposit(address, data) {
|
|
310
|
-
const stored =
|
|
324
|
+
const stored = chunkVNECVPMU_cjs.setBrowserStorageItem(storageKey(address), JSON.stringify(data));
|
|
311
325
|
if (!stored && data.signedLock) {
|
|
312
326
|
throw new Error("Unable to persist pending locked deposit for recovery");
|
|
313
327
|
}
|
|
314
328
|
}
|
|
315
329
|
function loadPendingDeposit(address) {
|
|
316
330
|
try {
|
|
317
|
-
const raw =
|
|
331
|
+
const raw = chunkVNECVPMU_cjs.getBrowserStorageItem(storageKey(address));
|
|
318
332
|
if (!raw) return null;
|
|
319
333
|
const data = JSON.parse(raw);
|
|
320
|
-
if (Date.now() - data.savedAt > STALE_MS && !(data.signedLock &&
|
|
334
|
+
if (Date.now() - data.savedAt > STALE_MS && !(data.signedLock && chunkVNECVPMU_cjs.isSignedLockUsable(data.signedLock))) {
|
|
321
335
|
clearPendingDeposit(address);
|
|
322
336
|
return null;
|
|
323
337
|
}
|
|
@@ -329,21 +343,21 @@ function loadPendingDeposit(address) {
|
|
|
329
343
|
function clearPendingDeposit(address, onlyForTxHash) {
|
|
330
344
|
if (onlyForTxHash) {
|
|
331
345
|
try {
|
|
332
|
-
const raw =
|
|
346
|
+
const raw = chunkVNECVPMU_cjs.getBrowserStorageItem(storageKey(address));
|
|
333
347
|
const recordTxHash = raw ? JSON.parse(raw).txHash : void 0;
|
|
334
348
|
if (recordTxHash && recordTxHash !== onlyForTxHash) return;
|
|
335
349
|
} catch {
|
|
336
350
|
}
|
|
337
351
|
}
|
|
338
|
-
|
|
352
|
+
chunkVNECVPMU_cjs.removeBrowserStorageItem(storageKey(address));
|
|
339
353
|
}
|
|
340
354
|
function useDeposit(options = {}) {
|
|
341
355
|
const { address } = wagmi.useAccount();
|
|
342
|
-
const { client, enabledTokens, getChainById: getChainById2, networkConfig, serviceAddress } =
|
|
356
|
+
const { client, enabledTokens, getChainById: getChainById2, networkConfig, serviceAddress } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
343
357
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
344
358
|
const queryClient = reactQuery.useQueryClient();
|
|
345
359
|
const config = wagmi.useConfig();
|
|
346
|
-
const { executePrivateRead, privateReadAddress } =
|
|
360
|
+
const { executePrivateRead, privateReadAddress } = chunkVNECVPMU_cjs.usePrivateReadRequest();
|
|
347
361
|
const privateReadAddressRef = react.useRef(privateReadAddress);
|
|
348
362
|
privateReadAddressRef.current = privateReadAddress;
|
|
349
363
|
const [depositAddress, setDepositAddress] = react.useState(null);
|
|
@@ -382,7 +396,7 @@ function useDeposit(options = {}) {
|
|
|
382
396
|
const submitPendingLockAfterCredit = react.useCallback(
|
|
383
397
|
async (signedLock, creditedAmount) => {
|
|
384
398
|
try {
|
|
385
|
-
const result = await
|
|
399
|
+
const result = await chunkVNECVPMU_cjs.submitPendingLock({
|
|
386
400
|
client,
|
|
387
401
|
payload: signedLock,
|
|
388
402
|
creditedAmount
|
|
@@ -393,7 +407,7 @@ function useDeposit(options = {}) {
|
|
|
393
407
|
queryClient.invalidateQueries({ queryKey: ["accounting-history"] });
|
|
394
408
|
onLockSubmittedRef.current?.(result);
|
|
395
409
|
} catch (err) {
|
|
396
|
-
const error2 = err instanceof
|
|
410
|
+
const error2 = err instanceof chunkVNECVPMU_cjs.PostDepositLockError ? err : new chunkVNECVPMU_cjs.PostDepositLockError(
|
|
397
411
|
err instanceof Error ? err.message : "Lock submission failed",
|
|
398
412
|
"submission-failed",
|
|
399
413
|
BigInt(signedLock.amount),
|
|
@@ -412,7 +426,7 @@ function useDeposit(options = {}) {
|
|
|
412
426
|
error: verificationError,
|
|
413
427
|
verify,
|
|
414
428
|
reset: resetVerification
|
|
415
|
-
} =
|
|
429
|
+
} = chunkVNECVPMU_cjs.useDepositVerification({
|
|
416
430
|
pollInterval: options.pollInterval,
|
|
417
431
|
pollTimeout: options.pollTimeout,
|
|
418
432
|
onCredited: (hash, response, creditedAmount) => {
|
|
@@ -462,7 +476,7 @@ function useDeposit(options = {}) {
|
|
|
462
476
|
} = wagmi.useSendTransaction();
|
|
463
477
|
const isSendingTx = isWritingContract || isSendingNative;
|
|
464
478
|
const sendError = writeError ?? sendNativeError;
|
|
465
|
-
const { ensureCorrectChain } =
|
|
479
|
+
const { ensureCorrectChain } = chunkVNECVPMU_cjs.useEnsureCorrectChain();
|
|
466
480
|
const invalidateGeneration = react.useCallback(() => {
|
|
467
481
|
generationRef.current++;
|
|
468
482
|
}, []);
|
|
@@ -511,16 +525,16 @@ function useDeposit(options = {}) {
|
|
|
511
525
|
const confirmations = resolveConfirmations(persisted.depositAddress, persisted.chainId);
|
|
512
526
|
let confirmed = false;
|
|
513
527
|
try {
|
|
514
|
-
const receipt = await
|
|
528
|
+
const receipt = await chunkVNECVPMU_cjs.getTransactionReceipt(config, {
|
|
515
529
|
hash,
|
|
516
530
|
chainId: persisted.chainId
|
|
517
531
|
});
|
|
518
|
-
const blockNumber = await
|
|
532
|
+
const blockNumber = await chunkVNECVPMU_cjs.getBlockNumber(config, { chainId: persisted.chainId });
|
|
519
533
|
confirmed = blockNumber - receipt.blockNumber + 1n >= BigInt(confirmations);
|
|
520
534
|
} catch {
|
|
521
535
|
}
|
|
522
536
|
if (!confirmed) {
|
|
523
|
-
await
|
|
537
|
+
await chunkVNECVPMU_cjs.waitForTransactionReceipt(config, {
|
|
524
538
|
hash,
|
|
525
539
|
chainId: persisted.chainId,
|
|
526
540
|
confirmations
|
|
@@ -564,21 +578,24 @@ function useDeposit(options = {}) {
|
|
|
564
578
|
throw new Error("Invalid deposit address received from API");
|
|
565
579
|
}
|
|
566
580
|
const isNative = token.contract === viem.zeroAddress;
|
|
567
|
-
const
|
|
568
|
-
|
|
569
|
-
|
|
581
|
+
const minimum = getMinDepositBaseUnits(
|
|
582
|
+
addrResponse,
|
|
583
|
+
sourceChain.id,
|
|
584
|
+
isNative ? "native" : "erc20"
|
|
585
|
+
);
|
|
586
|
+
if (minimum !== void 0 && params.amount < minimum) {
|
|
570
587
|
throw new Error(
|
|
571
|
-
`Amount is below the minimum deposit (${
|
|
588
|
+
`Amount is below the minimum deposit (${minimum}) for ${isNative ? "native" : "ERC-20"} on chain ${sourceChain.id}`
|
|
572
589
|
);
|
|
573
590
|
}
|
|
574
591
|
const confirmations = resolveConfirmations(addrResponse, sourceChain.id);
|
|
575
|
-
if (params.postDepositLock && !
|
|
592
|
+
if (params.postDepositLock && !chunkVNECVPMU_cjs.canUseBrowserStorage()) {
|
|
576
593
|
throw new Error("Browser storage is required for locked deposit recovery");
|
|
577
594
|
}
|
|
578
|
-
const lockAmount =
|
|
595
|
+
const lockAmount = chunkVNECVPMU_cjs.clampLockAmount(params.amount, params.postDepositLock?.maxAmount);
|
|
579
596
|
let signedLock;
|
|
580
597
|
if (params.postDepositLock) {
|
|
581
|
-
const lockOwner =
|
|
598
|
+
const lockOwner = chunkVNECVPMU_cjs.requireDepositLockOwner(address, privateReadAddress);
|
|
582
599
|
setIsSwitchingChain(true);
|
|
583
600
|
try {
|
|
584
601
|
await ensureCorrectChain(networkConfig.chainId);
|
|
@@ -586,15 +603,15 @@ function useDeposit(options = {}) {
|
|
|
586
603
|
if (!isStale()) setIsSwitchingChain(false);
|
|
587
604
|
}
|
|
588
605
|
if (isStale()) return;
|
|
589
|
-
const signingWalletClient = await
|
|
606
|
+
const signingWalletClient = await chunkVNECVPMU_cjs.getWalletClient(config, {
|
|
590
607
|
chainId: networkConfig.chainId
|
|
591
608
|
});
|
|
592
|
-
signedLock = await
|
|
609
|
+
signedLock = await chunkVNECVPMU_cjs.createSignedLockRequest({
|
|
593
610
|
client,
|
|
594
611
|
walletClient: signingWalletClient,
|
|
595
612
|
userAddress: lockOwner,
|
|
596
613
|
networkConfig,
|
|
597
|
-
serviceAddress:
|
|
614
|
+
serviceAddress: chunkVNECVPMU_cjs.requireServiceAddress(
|
|
598
615
|
params.postDepositLock.serviceAddress ?? serviceAddress
|
|
599
616
|
),
|
|
600
617
|
tokenId: params.tokenId,
|
|
@@ -648,7 +665,7 @@ function useDeposit(options = {}) {
|
|
|
648
665
|
try {
|
|
649
666
|
setIsWaitingForConfirmation(true);
|
|
650
667
|
try {
|
|
651
|
-
await
|
|
668
|
+
await chunkVNECVPMU_cjs.waitForTransactionReceipt(config, {
|
|
652
669
|
hash,
|
|
653
670
|
chainId: sourceChain.id,
|
|
654
671
|
confirmations
|
|
@@ -724,10 +741,10 @@ function useDeposit(options = {}) {
|
|
|
724
741
|
}
|
|
725
742
|
function useDepositAddress(options = {}) {
|
|
726
743
|
const queryClient = react.useContext(reactQuery.QueryClientContext);
|
|
727
|
-
const accountingContext =
|
|
744
|
+
const accountingContext = chunkVNECVPMU_cjs.useSafePrivanaContext();
|
|
728
745
|
const hasProviders = !!queryClient && !!accountingContext;
|
|
729
746
|
const client = accountingContext?.client;
|
|
730
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
747
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkVNECVPMU_cjs.usePrivateReadRequest();
|
|
731
748
|
const isReady = hasProviders && privateReadReady && !!privateReadAddress && !!client;
|
|
732
749
|
const query = reactQuery.useQuery({
|
|
733
750
|
queryKey: ["accounting-deposit-address", ...privateReadQueryScope],
|
|
@@ -751,9 +768,9 @@ function useDepositAddress(options = {}) {
|
|
|
751
768
|
function useWithdraw(options = {}) {
|
|
752
769
|
const { address } = wagmi.useAccount();
|
|
753
770
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
754
|
-
const { client, networkConfig } =
|
|
771
|
+
const { client, networkConfig } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
755
772
|
const queryClient = reactQuery.useQueryClient();
|
|
756
|
-
const { chainId, ensureCorrectChain } =
|
|
773
|
+
const { chainId, ensureCorrectChain } = chunkVNECVPMU_cjs.useEnsureCorrectChain();
|
|
757
774
|
const pollInterval = options.pollInterval ?? 3e3;
|
|
758
775
|
const pollTimeout = options.pollTimeout ?? 18e4;
|
|
759
776
|
const [currentStep, setCurrentStep] = react.useState("idle");
|
|
@@ -822,7 +839,7 @@ function useWithdraw(options = {}) {
|
|
|
822
839
|
if (isStale()) return void 0;
|
|
823
840
|
const nonce = BigInt(nonceResponse.nonce);
|
|
824
841
|
setCurrentStep("signing");
|
|
825
|
-
const signature = await
|
|
842
|
+
const signature = await chunkVNECVPMU_cjs.signWithdrawMessage({
|
|
826
843
|
walletClient,
|
|
827
844
|
chainId: signingChainId,
|
|
828
845
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -951,7 +968,7 @@ function useWithdraw(options = {}) {
|
|
|
951
968
|
function useLockFunds(options = {}) {
|
|
952
969
|
const { address } = wagmi.useAccount();
|
|
953
970
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
954
|
-
const { client, networkConfig, serviceAddress } =
|
|
971
|
+
const { client, networkConfig, serviceAddress } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
955
972
|
const queryClient = reactQuery.useQueryClient();
|
|
956
973
|
const mutation = reactQuery.useMutation({
|
|
957
974
|
mutationFn: async (params) => {
|
|
@@ -962,7 +979,7 @@ function useLockFunds(options = {}) {
|
|
|
962
979
|
throw new Error("Service address not configured");
|
|
963
980
|
}
|
|
964
981
|
const { nonce } = await client.getLockNonce(address);
|
|
965
|
-
const signature = await
|
|
982
|
+
const signature = await chunkVNECVPMU_cjs.signLockMessage({
|
|
966
983
|
walletClient,
|
|
967
984
|
chainId: networkConfig.chainId,
|
|
968
985
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1010,7 +1027,7 @@ function useLockFunds(options = {}) {
|
|
|
1010
1027
|
}
|
|
1011
1028
|
function useUnlockFunds(options = {}) {
|
|
1012
1029
|
const { address } = wagmi.useAccount();
|
|
1013
|
-
const { client } =
|
|
1030
|
+
const { client } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
1014
1031
|
const queryClient = reactQuery.useQueryClient();
|
|
1015
1032
|
const unlockMutation = reactQuery.useMutation({
|
|
1016
1033
|
mutationFn: async (params) => {
|
|
@@ -1080,7 +1097,7 @@ function useUnlockFunds(options = {}) {
|
|
|
1080
1097
|
function useTransfer(options = {}) {
|
|
1081
1098
|
const { address } = wagmi.useAccount();
|
|
1082
1099
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
1083
|
-
const { client, networkConfig, serviceAddress } =
|
|
1100
|
+
const { client, networkConfig, serviceAddress } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
1084
1101
|
const queryClient = reactQuery.useQueryClient();
|
|
1085
1102
|
const transferMutation = reactQuery.useMutation({
|
|
1086
1103
|
mutationFn: async (params) => {
|
|
@@ -1088,7 +1105,7 @@ function useTransfer(options = {}) {
|
|
|
1088
1105
|
throw new Error("Wallet not connected");
|
|
1089
1106
|
}
|
|
1090
1107
|
const { nonce } = await client.getTransferNonce(address);
|
|
1091
|
-
const signature = await
|
|
1108
|
+
const signature = await chunkVNECVPMU_cjs.signTransferMessage({
|
|
1092
1109
|
walletClient,
|
|
1093
1110
|
chainId: networkConfig.chainId,
|
|
1094
1111
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1125,7 +1142,7 @@ function useTransfer(options = {}) {
|
|
|
1125
1142
|
throw new Error("Service address not configured");
|
|
1126
1143
|
}
|
|
1127
1144
|
const { nonce } = await client.getTransferLockedNonce(serviceAddress);
|
|
1128
|
-
const signature = await
|
|
1145
|
+
const signature = await chunkVNECVPMU_cjs.signTransferLockedMessage({
|
|
1129
1146
|
walletClient,
|
|
1130
1147
|
chainId: networkConfig.chainId,
|
|
1131
1148
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1185,8 +1202,8 @@ function useTransfer(options = {}) {
|
|
|
1185
1202
|
};
|
|
1186
1203
|
}
|
|
1187
1204
|
function useLockedFunds(options = {}) {
|
|
1188
|
-
const { client, pollingInterval, serviceAddress } =
|
|
1189
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1205
|
+
const { client, pollingInterval, serviceAddress } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
1206
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkVNECVPMU_cjs.usePrivateReadRequest();
|
|
1190
1207
|
const query = reactQuery.useQuery({
|
|
1191
1208
|
queryKey: ["accounting-locked-funds", ...privateReadQueryScope, serviceAddress ?? null],
|
|
1192
1209
|
queryFn: async () => {
|
|
@@ -1208,8 +1225,8 @@ function useLockedFunds(options = {}) {
|
|
|
1208
1225
|
};
|
|
1209
1226
|
}
|
|
1210
1227
|
function useTotalLockedBalance(options = {}) {
|
|
1211
|
-
const { client, pollingInterval, defaultToken } =
|
|
1212
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1228
|
+
const { client, pollingInterval, defaultToken } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
1229
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkVNECVPMU_cjs.usePrivateReadRequest();
|
|
1213
1230
|
const tokenId = options.tokenId ?? defaultToken?.id;
|
|
1214
1231
|
const query = reactQuery.useQuery({
|
|
1215
1232
|
queryKey: ["accounting-total-locked-balance", ...privateReadQueryScope, tokenId],
|
|
@@ -1230,8 +1247,8 @@ function useTotalLockedBalance(options = {}) {
|
|
|
1230
1247
|
};
|
|
1231
1248
|
}
|
|
1232
1249
|
function useExpiredLocks(options = {}) {
|
|
1233
|
-
const { client, pollingInterval } =
|
|
1234
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1250
|
+
const { client, pollingInterval } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
1251
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkVNECVPMU_cjs.usePrivateReadRequest();
|
|
1235
1252
|
const query = reactQuery.useQuery({
|
|
1236
1253
|
queryKey: ["accounting-expired-locks", ...privateReadQueryScope],
|
|
1237
1254
|
queryFn: async () => {
|
|
@@ -1252,14 +1269,14 @@ function useExpiredLocks(options = {}) {
|
|
|
1252
1269
|
};
|
|
1253
1270
|
}
|
|
1254
1271
|
function statusCodeOf(error) {
|
|
1255
|
-
return error instanceof
|
|
1272
|
+
return error instanceof chunkVNECVPMU_cjs.AccountingApiError ? error.statusCode : void 0;
|
|
1256
1273
|
}
|
|
1257
1274
|
function usePendingDeposits(options = {}) {
|
|
1258
1275
|
const queryClient = react.useContext(reactQuery.QueryClientContext);
|
|
1259
|
-
const accountingContext =
|
|
1276
|
+
const accountingContext = chunkVNECVPMU_cjs.useSafePrivanaContext();
|
|
1260
1277
|
const hasProviders = !!queryClient && !!accountingContext;
|
|
1261
1278
|
const client = accountingContext?.client;
|
|
1262
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1279
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkVNECVPMU_cjs.usePrivateReadRequest();
|
|
1263
1280
|
const { chainId, tokenAddress, lookbackBlocks } = options;
|
|
1264
1281
|
const query = reactQuery.useQuery({
|
|
1265
1282
|
queryKey: ["accounting-pending-deposits", ...privateReadQueryScope, chainId, tokenAddress],
|
|
@@ -1306,7 +1323,7 @@ function usePendingDeposits(options = {}) {
|
|
|
1306
1323
|
}
|
|
1307
1324
|
function usePendingWithdrawals(options = {}) {
|
|
1308
1325
|
const { address, isConnected } = wagmi.useAccount();
|
|
1309
|
-
const { client, pollingInterval } =
|
|
1326
|
+
const { client, pollingInterval } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
1310
1327
|
const query = reactQuery.useQuery({
|
|
1311
1328
|
queryKey: ["accounting-pending-withdrawals", address],
|
|
1312
1329
|
queryFn: async () => {
|
|
@@ -1342,8 +1359,8 @@ function usePendingWithdrawals(options = {}) {
|
|
|
1342
1359
|
};
|
|
1343
1360
|
}
|
|
1344
1361
|
function useHistory(options = {}) {
|
|
1345
|
-
const { client, pollingInterval } =
|
|
1346
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1362
|
+
const { client, pollingInterval } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
1363
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkVNECVPMU_cjs.usePrivateReadRequest();
|
|
1347
1364
|
const offset = options.offset ?? -1;
|
|
1348
1365
|
const limit = options.limit ?? 50;
|
|
1349
1366
|
const query = reactQuery.useQuery({
|
|
@@ -1367,7 +1384,7 @@ function useHistory(options = {}) {
|
|
|
1367
1384
|
};
|
|
1368
1385
|
}
|
|
1369
1386
|
function useTokenInfo(options = {}) {
|
|
1370
|
-
const { client } =
|
|
1387
|
+
const { client } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
1371
1388
|
const { tokenId } = options;
|
|
1372
1389
|
const query = reactQuery.useQuery({
|
|
1373
1390
|
queryKey: ["accounting-token-info", tokenId],
|
|
@@ -1387,7 +1404,7 @@ function useTokenInfo(options = {}) {
|
|
|
1387
1404
|
};
|
|
1388
1405
|
}
|
|
1389
1406
|
function useTokenList(options = {}) {
|
|
1390
|
-
const { client } =
|
|
1407
|
+
const { client } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
1391
1408
|
const query = reactQuery.useQuery({
|
|
1392
1409
|
queryKey: ["accounting-token-list"],
|
|
1393
1410
|
queryFn: () => client.listTokens(),
|
|
@@ -1405,7 +1422,7 @@ function useTokenList(options = {}) {
|
|
|
1405
1422
|
function useModifyLock(options = {}) {
|
|
1406
1423
|
const { address } = wagmi.useAccount();
|
|
1407
1424
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
1408
|
-
const { client, networkConfig } =
|
|
1425
|
+
const { client, networkConfig } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
1409
1426
|
const queryClient = reactQuery.useQueryClient();
|
|
1410
1427
|
const mutation = reactQuery.useMutation({
|
|
1411
1428
|
mutationFn: async (params) => {
|
|
@@ -1413,7 +1430,7 @@ function useModifyLock(options = {}) {
|
|
|
1413
1430
|
throw new Error("Wallet not connected");
|
|
1414
1431
|
}
|
|
1415
1432
|
const { nonce } = await client.getModifyLockNonce(address);
|
|
1416
|
-
const signature = await
|
|
1433
|
+
const signature = await chunkVNECVPMU_cjs.signModifyLockMessage({
|
|
1417
1434
|
walletClient,
|
|
1418
1435
|
chainId: networkConfig.chainId,
|
|
1419
1436
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1472,7 +1489,7 @@ function DialogOverlay({
|
|
|
1472
1489
|
{
|
|
1473
1490
|
"data-slot": "dialog-overlay",
|
|
1474
1491
|
"data-privana": true,
|
|
1475
|
-
className:
|
|
1492
|
+
className: chunkVNECVPMU_cjs.cn(
|
|
1476
1493
|
"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",
|
|
1477
1494
|
className
|
|
1478
1495
|
),
|
|
@@ -1494,7 +1511,7 @@ function DialogContent({
|
|
|
1494
1511
|
{
|
|
1495
1512
|
"data-slot": "dialog-content",
|
|
1496
1513
|
"data-privana": true,
|
|
1497
|
-
className:
|
|
1514
|
+
className: chunkVNECVPMU_cjs.cn(
|
|
1498
1515
|
"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",
|
|
1499
1516
|
className
|
|
1500
1517
|
),
|
|
@@ -1522,7 +1539,7 @@ function DialogTitle({ className, ...props }) {
|
|
|
1522
1539
|
DialogPrimitive__namespace.Title,
|
|
1523
1540
|
{
|
|
1524
1541
|
"data-slot": "dialog-title",
|
|
1525
|
-
className:
|
|
1542
|
+
className: chunkVNECVPMU_cjs.cn("text-lg leading-none font-semibold", className),
|
|
1526
1543
|
...props
|
|
1527
1544
|
}
|
|
1528
1545
|
);
|
|
@@ -1535,13 +1552,13 @@ function DialogDescription({
|
|
|
1535
1552
|
DialogPrimitive__namespace.Description,
|
|
1536
1553
|
{
|
|
1537
1554
|
"data-slot": "dialog-description",
|
|
1538
|
-
className:
|
|
1555
|
+
className: chunkVNECVPMU_cjs.cn("text-muted-foreground text-sm", className),
|
|
1539
1556
|
...props
|
|
1540
1557
|
}
|
|
1541
1558
|
);
|
|
1542
1559
|
}
|
|
1543
1560
|
|
|
1544
|
-
// src/sdk/
|
|
1561
|
+
// src/sdk/utils/external-deposit-lock.ts
|
|
1545
1562
|
var ACTIVE_SESSION_PREFIX = "privana:external-deposit-lock:active:";
|
|
1546
1563
|
var SESSION_PREFIX = "privana:external-deposit-lock:session:";
|
|
1547
1564
|
var ExternalDepositLockSessionChangedError = class _ExternalDepositLockSessionChangedError extends Error {
|
|
@@ -1560,16 +1577,6 @@ function isExternalDepositBlockInSession(session, blockNumber) {
|
|
|
1560
1577
|
function isCurrentExternalDepositVerification(session, txHash) {
|
|
1561
1578
|
return session.creditedAmount === void 0 && session.verification?.hash.toLowerCase() === txHash.toLowerCase();
|
|
1562
1579
|
}
|
|
1563
|
-
function getExternalDepositMinimum(response, chainId) {
|
|
1564
|
-
const value = response?.min_deposit?.[String(chainId)]?.erc20;
|
|
1565
|
-
if (value === void 0) return void 0;
|
|
1566
|
-
try {
|
|
1567
|
-
const amount = BigInt(value);
|
|
1568
|
-
return amount >= 0n ? amount : void 0;
|
|
1569
|
-
} catch {
|
|
1570
|
-
return void 0;
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
1580
|
function activeSessionKey(owner) {
|
|
1574
1581
|
return `${ACTIVE_SESSION_PREFIX}${owner.toLowerCase()}`;
|
|
1575
1582
|
}
|
|
@@ -1577,7 +1584,7 @@ function sessionKey(owner, sessionId) {
|
|
|
1577
1584
|
return `${SESSION_PREFIX}${owner.toLowerCase()}:${sessionId}`;
|
|
1578
1585
|
}
|
|
1579
1586
|
function activeSessionId(owner) {
|
|
1580
|
-
const value =
|
|
1587
|
+
const value = chunkVNECVPMU_cjs.getSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1581
1588
|
return value || void 0;
|
|
1582
1589
|
}
|
|
1583
1590
|
function isPositiveIntegerString(value) {
|
|
@@ -1609,7 +1616,7 @@ function isSessionRecord(value) {
|
|
|
1609
1616
|
}
|
|
1610
1617
|
function writeSessionRecord(session) {
|
|
1611
1618
|
const id = externalDepositSessionId(session.chainId, session.tokenId);
|
|
1612
|
-
return
|
|
1619
|
+
return chunkVNECVPMU_cjs.setSharedBrowserStorageItem(sessionKey(session.owner, id), JSON.stringify(session));
|
|
1613
1620
|
}
|
|
1614
1621
|
function saveExternalDepositLockSession(session, expectedSession = null) {
|
|
1615
1622
|
if (!isSessionRecord(session)) throw new Error("Invalid external deposit lock session");
|
|
@@ -1623,12 +1630,12 @@ function saveExternalDepositLockSession(session, expectedSession = null) {
|
|
|
1623
1630
|
throw new Error("Unable to persist external deposit lock session");
|
|
1624
1631
|
}
|
|
1625
1632
|
if (previousId !== nextId) {
|
|
1626
|
-
if (!
|
|
1627
|
-
|
|
1633
|
+
if (!chunkVNECVPMU_cjs.setSharedBrowserStorageItem(activeSessionKey(session.owner), nextId)) {
|
|
1634
|
+
chunkVNECVPMU_cjs.removeSharedBrowserStorageItem(sessionKey(session.owner, nextId));
|
|
1628
1635
|
throw new Error("Unable to persist external deposit lock session");
|
|
1629
1636
|
}
|
|
1630
1637
|
if (previousId) {
|
|
1631
|
-
|
|
1638
|
+
chunkVNECVPMU_cjs.removeSharedBrowserStorageItem(sessionKey(session.owner, previousId));
|
|
1632
1639
|
}
|
|
1633
1640
|
}
|
|
1634
1641
|
}
|
|
@@ -1637,17 +1644,17 @@ function loadExternalDepositLockSession(owner) {
|
|
|
1637
1644
|
if (!id) return void 0;
|
|
1638
1645
|
const key = sessionKey(owner, id);
|
|
1639
1646
|
try {
|
|
1640
|
-
const raw =
|
|
1647
|
+
const raw = chunkVNECVPMU_cjs.getSharedBrowserStorageItem(key);
|
|
1641
1648
|
const parsed = raw ? JSON.parse(raw) : void 0;
|
|
1642
1649
|
if (!isSessionRecord(parsed) || parsed.owner.toLowerCase() !== owner.toLowerCase() || externalDepositSessionId(parsed.chainId, parsed.tokenId) !== id) {
|
|
1643
|
-
|
|
1644
|
-
|
|
1650
|
+
chunkVNECVPMU_cjs.removeSharedBrowserStorageItem(key);
|
|
1651
|
+
chunkVNECVPMU_cjs.removeSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1645
1652
|
return void 0;
|
|
1646
1653
|
}
|
|
1647
1654
|
return parsed;
|
|
1648
1655
|
} catch {
|
|
1649
|
-
|
|
1650
|
-
|
|
1656
|
+
chunkVNECVPMU_cjs.removeSharedBrowserStorageItem(key);
|
|
1657
|
+
chunkVNECVPMU_cjs.removeSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1651
1658
|
return void 0;
|
|
1652
1659
|
}
|
|
1653
1660
|
}
|
|
@@ -1678,8 +1685,8 @@ function clearExternalDepositLockSession(owner, expectedSessionId, expectedGener
|
|
|
1678
1685
|
const current = loadExternalDepositLockSession(owner);
|
|
1679
1686
|
if (!current || current.generation !== expectedGeneration) return;
|
|
1680
1687
|
}
|
|
1681
|
-
|
|
1682
|
-
|
|
1688
|
+
chunkVNECVPMU_cjs.removeSharedBrowserStorageItem(sessionKey(owner, id));
|
|
1689
|
+
chunkVNECVPMU_cjs.removeSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1683
1690
|
}
|
|
1684
1691
|
function isSameVerification(left, right) {
|
|
1685
1692
|
if (!left || !right) return left === right;
|
|
@@ -1732,7 +1739,7 @@ function markSubmissionAmbiguous(session, signature) {
|
|
|
1732
1739
|
return writeSessionRecord({ ...current, submissionAmbiguous: true });
|
|
1733
1740
|
}
|
|
1734
1741
|
function ambiguousSubmissionError(error) {
|
|
1735
|
-
return new
|
|
1742
|
+
return new chunkVNECVPMU_cjs.PostDepositLockError(
|
|
1736
1743
|
"Lock submission could not be confirmed. Retry only the saved signature, or check locked funds before stopping recovery.",
|
|
1737
1744
|
error.reason,
|
|
1738
1745
|
error.signedAmount,
|
|
@@ -1745,7 +1752,7 @@ function ambiguousSubmissionError(error) {
|
|
|
1745
1752
|
}
|
|
1746
1753
|
function isDefinitiveSubmissionFailure(error) {
|
|
1747
1754
|
const cause = error.cause;
|
|
1748
|
-
return cause instanceof
|
|
1755
|
+
return cause instanceof chunkVNECVPMU_cjs.AccountingApiError && cause.statusCode !== 408 && cause.statusCode < 500;
|
|
1749
1756
|
}
|
|
1750
1757
|
function submissionLockName(session) {
|
|
1751
1758
|
return `privana:external-deposit-lock:submit:${session.owner.toLowerCase()}:${externalDepositSessionId(session.chainId, session.tokenId)}`;
|
|
@@ -1765,7 +1772,7 @@ async function submitExternalDepositLock(client, session) {
|
|
|
1765
1772
|
return withSubmissionLock(session, async (crossTabExclusive) => {
|
|
1766
1773
|
const current = loadExternalDepositLockSession(session.owner);
|
|
1767
1774
|
if (!current || current.generation !== session.generation) {
|
|
1768
|
-
throw new
|
|
1775
|
+
throw new chunkVNECVPMU_cjs.PostDepositLockError(
|
|
1769
1776
|
"External deposit lock session changed before submission",
|
|
1770
1777
|
"not-found",
|
|
1771
1778
|
BigInt(session.maxLockAmount),
|
|
@@ -1784,7 +1791,7 @@ async function submitExternalDepositLock(client, session) {
|
|
|
1784
1791
|
async function submitExternalDepositLockAttempt(client, session, crossTabExclusive) {
|
|
1785
1792
|
const creditedAmount = session.creditedAmount ? BigInt(session.creditedAmount) : void 0;
|
|
1786
1793
|
if (!creditedAmount) {
|
|
1787
|
-
throw new
|
|
1794
|
+
throw new chunkVNECVPMU_cjs.PostDepositLockError(
|
|
1788
1795
|
"External deposit has not been credited",
|
|
1789
1796
|
"submission-failed",
|
|
1790
1797
|
BigInt(session.maxLockAmount)
|
|
@@ -1792,7 +1799,7 @@ async function submitExternalDepositLockAttempt(client, session, crossTabExclusi
|
|
|
1792
1799
|
}
|
|
1793
1800
|
const payload = session.payload;
|
|
1794
1801
|
if (!payload) {
|
|
1795
|
-
throw new
|
|
1802
|
+
throw new chunkVNECVPMU_cjs.PostDepositLockError(
|
|
1796
1803
|
"No persisted signed policy found for this deposit session",
|
|
1797
1804
|
"not-found",
|
|
1798
1805
|
BigInt(session.maxLockAmount),
|
|
@@ -1800,7 +1807,7 @@ async function submitExternalDepositLockAttempt(client, session, crossTabExclusi
|
|
|
1800
1807
|
);
|
|
1801
1808
|
}
|
|
1802
1809
|
try {
|
|
1803
|
-
return await
|
|
1810
|
+
return await chunkVNECVPMU_cjs.submitPendingLock({
|
|
1804
1811
|
client,
|
|
1805
1812
|
payload,
|
|
1806
1813
|
creditedAmount,
|
|
@@ -1811,23 +1818,23 @@ async function submitExternalDepositLockAttempt(client, session, crossTabExclusi
|
|
|
1811
1818
|
}
|
|
1812
1819
|
});
|
|
1813
1820
|
} catch (err) {
|
|
1814
|
-
if (err instanceof
|
|
1821
|
+
if (err instanceof chunkVNECVPMU_cjs.PostDepositLockError && err.reason === "submission-failed" && crossTabExclusive && !session.submissionAmbiguous && isDefinitiveSubmissionFailure(err)) {
|
|
1815
1822
|
if (!clearSubmittedPayload(session, payload.signature, true)) {
|
|
1816
1823
|
const latest = loadExternalDepositLockSession(session.owner);
|
|
1817
1824
|
if (latest?.submissionAmbiguous) throw ambiguousSubmissionError(err);
|
|
1818
1825
|
}
|
|
1819
|
-
} else if (err instanceof
|
|
1826
|
+
} else if (err instanceof chunkVNECVPMU_cjs.PostDepositLockError && err.reason === "submission-failed") {
|
|
1820
1827
|
const ambiguous = markSubmissionAmbiguous(session, payload.signature) || loadExternalDepositLockSession(session.owner)?.submissionAmbiguous === true;
|
|
1821
1828
|
if (ambiguous) throw ambiguousSubmissionError(err);
|
|
1822
1829
|
} else {
|
|
1823
1830
|
const current = loadExternalDepositLockSession(session.owner);
|
|
1824
1831
|
if (session.submissionAmbiguous || current?.submissionAmbiguous) {
|
|
1825
|
-
if (err instanceof
|
|
1832
|
+
if (err instanceof chunkVNECVPMU_cjs.PostDepositLockError) throw ambiguousSubmissionError(err);
|
|
1826
1833
|
throw err;
|
|
1827
1834
|
}
|
|
1828
1835
|
if (!clearSubmittedPayload(session, payload.signature)) {
|
|
1829
1836
|
const latest = loadExternalDepositLockSession(session.owner);
|
|
1830
|
-
if (latest?.submissionAmbiguous && err instanceof
|
|
1837
|
+
if (latest?.submissionAmbiguous && err instanceof chunkVNECVPMU_cjs.PostDepositLockError) {
|
|
1831
1838
|
throw ambiguousSubmissionError(err);
|
|
1832
1839
|
}
|
|
1833
1840
|
}
|
|
@@ -1835,17 +1842,19 @@ async function submitExternalDepositLockAttempt(client, session, crossTabExclusi
|
|
|
1835
1842
|
throw err;
|
|
1836
1843
|
}
|
|
1837
1844
|
}
|
|
1845
|
+
|
|
1846
|
+
// src/sdk/hooks/use-external-deposit-lock.ts
|
|
1838
1847
|
function useExternalDepositLock({
|
|
1839
1848
|
allowance,
|
|
1840
1849
|
onLockSubmitted,
|
|
1841
1850
|
onLockFailed
|
|
1842
1851
|
}) {
|
|
1843
|
-
const { client, networkConfig, serviceAddress, getTokenById, tokensStatus } =
|
|
1852
|
+
const { client, networkConfig, serviceAddress, getTokenById, tokensStatus } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
1844
1853
|
const config = wagmi.useConfig();
|
|
1845
1854
|
const queryClient = reactQuery.useQueryClient();
|
|
1846
1855
|
const { address } = wagmi.useAccount();
|
|
1847
|
-
const { privateReadAddress } =
|
|
1848
|
-
const { ensureCorrectChain } =
|
|
1856
|
+
const { privateReadAddress } = chunkVNECVPMU_cjs.usePrivateReadRequest();
|
|
1857
|
+
const { ensureCorrectChain } = chunkVNECVPMU_cjs.useEnsureCorrectChain();
|
|
1849
1858
|
const [isSigning, setIsSigning] = react.useState(false);
|
|
1850
1859
|
const [isSubmittingLock, setIsSubmittingLock] = react.useState(false);
|
|
1851
1860
|
const [session, setSession] = react.useState(null);
|
|
@@ -1905,7 +1914,7 @@ function useExternalDepositLock({
|
|
|
1905
1914
|
result = await submitExternalDepositLock(client, submission);
|
|
1906
1915
|
} catch (err) {
|
|
1907
1916
|
const stored = loadExternalDepositLockSession(active.owner);
|
|
1908
|
-
const error = err instanceof
|
|
1917
|
+
const error = err instanceof chunkVNECVPMU_cjs.PostDepositLockError ? err : new chunkVNECVPMU_cjs.PostDepositLockError(
|
|
1909
1918
|
err instanceof Error ? err.message : "Lock submission failed",
|
|
1910
1919
|
"submission-failed",
|
|
1911
1920
|
BigInt(active.maxLockAmount),
|
|
@@ -1984,7 +1993,7 @@ function useExternalDepositLock({
|
|
|
1984
1993
|
void submitSession(restored);
|
|
1985
1994
|
} else if (restored.creditedAmount) {
|
|
1986
1995
|
notifyFailure(
|
|
1987
|
-
new
|
|
1996
|
+
new chunkVNECVPMU_cjs.PostDepositLockError(
|
|
1988
1997
|
"Deposit credited; sign a fresh policy to lock the funds",
|
|
1989
1998
|
"not-found",
|
|
1990
1999
|
BigInt(restored.maxLockAmount),
|
|
@@ -2024,10 +2033,10 @@ function useExternalDepositLock({
|
|
|
2024
2033
|
if (signingRef.current || settlingRef.current) {
|
|
2025
2034
|
throw new Error("A policy operation is already in progress");
|
|
2026
2035
|
}
|
|
2027
|
-
if (!
|
|
2036
|
+
if (!chunkVNECVPMU_cjs.canUseSharedBrowserStorage()) {
|
|
2028
2037
|
throw new Error("Browser storage is required for locked deposit recovery");
|
|
2029
2038
|
}
|
|
2030
|
-
const owner =
|
|
2039
|
+
const owner = chunkVNECVPMU_cjs.requireDepositLockOwner(address, privateReadAddress);
|
|
2031
2040
|
if (sessionRef.current || loadExternalDepositLockSession(owner)) {
|
|
2032
2041
|
throw new Error("Finish or cancel the active external deposit before starting another");
|
|
2033
2042
|
}
|
|
@@ -2036,26 +2045,26 @@ function useExternalDepositLock({
|
|
|
2036
2045
|
if (token.contract === viem.zeroAddress) {
|
|
2037
2046
|
throw new Error("External deposits support ERC20 tokens only");
|
|
2038
2047
|
}
|
|
2039
|
-
const targetService =
|
|
2040
|
-
const lockDuration = allowance.lockDuration ??
|
|
2048
|
+
const targetService = chunkVNECVPMU_cjs.requireServiceAddress(serviceAddress);
|
|
2049
|
+
const lockDuration = allowance.lockDuration ?? chunkVNECVPMU_cjs.DEFAULT_LOCK_DURATION_SECONDS;
|
|
2041
2050
|
signingRef.current = true;
|
|
2042
2051
|
setIsSigning(true);
|
|
2043
2052
|
try {
|
|
2044
2053
|
await ensureCorrectChain(networkConfig.chainId);
|
|
2045
|
-
const signingWalletClient = await
|
|
2054
|
+
const signingWalletClient = await chunkVNECVPMU_cjs.getWalletClient(config, {
|
|
2046
2055
|
chainId: networkConfig.chainId
|
|
2047
2056
|
});
|
|
2048
|
-
const payload = await
|
|
2057
|
+
const payload = await chunkVNECVPMU_cjs.createSignedLockRequest({
|
|
2049
2058
|
client,
|
|
2050
2059
|
walletClient: signingWalletClient,
|
|
2051
2060
|
userAddress: owner,
|
|
2052
2061
|
networkConfig,
|
|
2053
2062
|
serviceAddress: targetService,
|
|
2054
2063
|
tokenId: token.id,
|
|
2055
|
-
amount:
|
|
2064
|
+
amount: chunkVNECVPMU_cjs.clampLockAmount(amount, BigInt(allowance.value)),
|
|
2056
2065
|
lockDuration
|
|
2057
2066
|
});
|
|
2058
|
-
const startBlock = await
|
|
2067
|
+
const startBlock = await chunkVNECVPMU_cjs.getBlockNumber(config, { chainId: token.chainId });
|
|
2059
2068
|
if (startBlock > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
2060
2069
|
throw new Error("Source-chain block number exceeds the supported range");
|
|
2061
2070
|
}
|
|
@@ -2121,7 +2130,7 @@ function useExternalDepositLock({
|
|
|
2121
2130
|
pendingCreditedTransitionRef.current = { predecessor: active, credited };
|
|
2122
2131
|
installSession(credited);
|
|
2123
2132
|
notifyFailure(
|
|
2124
|
-
new
|
|
2133
|
+
new chunkVNECVPMU_cjs.PostDepositLockError(
|
|
2125
2134
|
err instanceof Error ? err.message : "Unable to persist credited deposit state",
|
|
2126
2135
|
"submission-failed",
|
|
2127
2136
|
BigInt(active.maxLockAmount),
|
|
@@ -2181,7 +2190,7 @@ function useExternalDepositLock({
|
|
|
2181
2190
|
if (!token || token.chainId !== active.chainId || token.contract === viem.zeroAddress) {
|
|
2182
2191
|
throw new Error("The credited token is no longer available");
|
|
2183
2192
|
}
|
|
2184
|
-
const targetService =
|
|
2193
|
+
const targetService = chunkVNECVPMU_cjs.requireServiceAddress(serviceAddress);
|
|
2185
2194
|
if (targetService.toLowerCase() !== active.serviceAddress.toLowerCase()) {
|
|
2186
2195
|
throw new Error("The service for this credited deposit has changed");
|
|
2187
2196
|
}
|
|
@@ -2194,17 +2203,17 @@ function useExternalDepositLock({
|
|
|
2194
2203
|
"The previous lock submission may have succeeded; a fresh signature is unsafe"
|
|
2195
2204
|
);
|
|
2196
2205
|
}
|
|
2197
|
-
const owner =
|
|
2206
|
+
const owner = chunkVNECVPMU_cjs.requireDepositLockOwner(address, privateReadAddress);
|
|
2198
2207
|
const amount = externalDepositRetryAmount(active);
|
|
2199
2208
|
let retrySession;
|
|
2200
2209
|
signingRef.current = true;
|
|
2201
2210
|
setIsSigning(true);
|
|
2202
2211
|
try {
|
|
2203
2212
|
await ensureCorrectChain(networkConfig.chainId);
|
|
2204
|
-
const signingWalletClient = await
|
|
2213
|
+
const signingWalletClient = await chunkVNECVPMU_cjs.getWalletClient(config, {
|
|
2205
2214
|
chainId: networkConfig.chainId
|
|
2206
2215
|
});
|
|
2207
|
-
const payload = await
|
|
2216
|
+
const payload = await chunkVNECVPMU_cjs.createSignedLockRequest({
|
|
2208
2217
|
client,
|
|
2209
2218
|
walletClient: signingWalletClient,
|
|
2210
2219
|
userAddress: owner,
|
|
@@ -2386,6 +2395,29 @@ function EthereumIcon({ className, size = 24 }) {
|
|
|
2386
2395
|
}
|
|
2387
2396
|
);
|
|
2388
2397
|
}
|
|
2398
|
+
function HyperliquidIcon({ className, size = 24 }) {
|
|
2399
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2400
|
+
"svg",
|
|
2401
|
+
{
|
|
2402
|
+
width: size,
|
|
2403
|
+
height: size,
|
|
2404
|
+
viewBox: "0 0 24 24",
|
|
2405
|
+
fill: "none",
|
|
2406
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2407
|
+
className,
|
|
2408
|
+
children: [
|
|
2409
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "24", height: "24", rx: "12", fill: "#0F3933" }),
|
|
2410
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2411
|
+
"path",
|
|
2412
|
+
{
|
|
2413
|
+
d: "M21.0141 11.9135C21.0141 17.8492 17.3699 19.7541 15.4374 18.07C13.8638 16.6896 13.3944 13.7632 11.0202 13.4596C8.01092 13.1007 7.73484 17.1038 5.7471 17.1038C3.42805 17.1038 2.98633 13.7632 2.98633 12.0239C2.98633 10.2571 3.48327 7.85519 5.44341 7.85519C7.73484 7.85519 7.87289 11.3062 10.7441 11.1129C13.5877 10.9196 13.6429 7.33064 15.5202 5.81223C17.149 4.45945 21.0141 5.89505 21.0141 11.9135Z",
|
|
2414
|
+
fill: "#97FCE4"
|
|
2415
|
+
}
|
|
2416
|
+
)
|
|
2417
|
+
]
|
|
2418
|
+
}
|
|
2419
|
+
);
|
|
2420
|
+
}
|
|
2389
2421
|
function getTokenIcon(symbol, size) {
|
|
2390
2422
|
const iconSize = size ?? 24;
|
|
2391
2423
|
switch ((symbol ?? "").toUpperCase()) {
|
|
@@ -2394,6 +2426,9 @@ function getTokenIcon(symbol, size) {
|
|
|
2394
2426
|
case "ETH":
|
|
2395
2427
|
case "WETH":
|
|
2396
2428
|
return /* @__PURE__ */ jsxRuntime.jsx(EthereumIcon, { size: iconSize });
|
|
2429
|
+
case "HYPE":
|
|
2430
|
+
case "WHYPE":
|
|
2431
|
+
return /* @__PURE__ */ jsxRuntime.jsx(HyperliquidIcon, { size: iconSize });
|
|
2397
2432
|
default:
|
|
2398
2433
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2399
2434
|
"div",
|
|
@@ -2426,7 +2461,7 @@ function getChainIcon(chainId, size) {
|
|
|
2426
2461
|
}
|
|
2427
2462
|
}
|
|
2428
2463
|
function TokenSelectorView({ selectedTokenId, onSelect }) {
|
|
2429
|
-
const { enabledTokens, getChainById: getChainById2 } =
|
|
2464
|
+
const { enabledTokens, getChainById: getChainById2 } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
2430
2465
|
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: [
|
|
2431
2466
|
enabledTokens.map((token) => {
|
|
2432
2467
|
const isSelected = selectedTokenId === token.id;
|
|
@@ -2436,7 +2471,7 @@ function TokenSelectorView({ selectedTokenId, onSelect }) {
|
|
|
2436
2471
|
{
|
|
2437
2472
|
type: "button",
|
|
2438
2473
|
onClick: () => onSelect(token.id),
|
|
2439
|
-
className:
|
|
2474
|
+
className: chunkVNECVPMU_cjs.cn(
|
|
2440
2475
|
"hover:bg-secondary flex w-full cursor-pointer items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors",
|
|
2441
2476
|
isSelected && "bg-secondary"
|
|
2442
2477
|
),
|
|
@@ -2501,7 +2536,7 @@ function TransakCardWidgetView({
|
|
|
2501
2536
|
onLeave,
|
|
2502
2537
|
onUnsafeToCloseChange,
|
|
2503
2538
|
onActiveFlowChange,
|
|
2504
|
-
useOnRamp =
|
|
2539
|
+
useOnRamp = chunkVNECVPMU_cjs.useTransakOnRamp
|
|
2505
2540
|
}) {
|
|
2506
2541
|
const [actionError, setActionError] = react.useState(null);
|
|
2507
2542
|
const [rowError, setRowError] = react.useState(null);
|
|
@@ -2519,7 +2554,7 @@ function TransakCardWidgetView({
|
|
|
2519
2554
|
);
|
|
2520
2555
|
const ownsRecord = react.useCallback(
|
|
2521
2556
|
(record) => Boolean(
|
|
2522
|
-
ownedIntentIdRef.current &&
|
|
2557
|
+
ownedIntentIdRef.current && chunkVNECVPMU_cjs.matchesOnRampTransaction(record, ownedIntentIdRef.current)
|
|
2523
2558
|
),
|
|
2524
2559
|
[]
|
|
2525
2560
|
);
|
|
@@ -2582,13 +2617,13 @@ function TransakCardWidgetView({
|
|
|
2582
2617
|
amountBaseUnits = viem.parseUnits(amount, token.decimals);
|
|
2583
2618
|
} catch {
|
|
2584
2619
|
}
|
|
2585
|
-
const minimumTargetBaseUnits = minDepositBaseUnits === void 0 ? void 0 :
|
|
2620
|
+
const minimumTargetBaseUnits = minDepositBaseUnits === void 0 ? void 0 : chunkVNECVPMU_cjs.getTransakMinimumTargetBaseUnits(minDepositBaseUnits);
|
|
2586
2621
|
const belowMinimum = amountBaseUnits !== void 0 && minimumTargetBaseUnits !== void 0 && amountBaseUnits < minimumTargetBaseUnits;
|
|
2587
2622
|
const minimumUnknown = minimumTargetBaseUnits === void 0;
|
|
2588
|
-
const tokenMismatch = !
|
|
2623
|
+
const tokenMismatch = !chunkVNECVPMU_cjs.matchesFrozenOnRampToken(token, selectedToken);
|
|
2589
2624
|
const isSettling = status === "awaiting-delivery" || status === "verifying";
|
|
2590
2625
|
const lockPending = !!allowance && status === "credited" && !lockSettled && !lockError;
|
|
2591
|
-
const ownedPending = ownedIntentId ? pending.filter((record) =>
|
|
2626
|
+
const ownedPending = ownedIntentId ? pending.filter((record) => chunkVNECVPMU_cjs.matchesOnRampTransaction(record, ownedIntentId)) : [];
|
|
2592
2627
|
const ownedFlowActive = !ownedTerminal && (Boolean(activeIntentId && activeIntentId === ownedIntentId) || ownedPending.length > 0 || lockPending);
|
|
2593
2628
|
const canOpen = Boolean(selectedToken && depositAddress && amountBaseUnits && amountBaseUnits > 0n) && !tokenMismatch && !minimumUnknown && !belowMinimum && !isLaunching && !isWidgetOpen && !isSettling && status !== "credited" && (!activeIntentId || canRecreateSession);
|
|
2594
2629
|
react.useEffect(() => {
|
|
@@ -2660,7 +2695,7 @@ function TransakCardWidgetView({
|
|
|
2660
2695
|
widget ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border bg-card overflow-hidden rounded-xl border", children: [
|
|
2661
2696
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border flex items-center justify-between border-b px-4 py-2 text-sm", children: [
|
|
2662
2697
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: "Card checkout" }),
|
|
2663
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2698
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVNECVPMU_cjs.Button, { type: "button", variant: "outline", size: "sm", onClick: () => void handleClose(), children: "Close" })
|
|
2664
2699
|
] }),
|
|
2665
2700
|
widget
|
|
2666
2701
|
] }) : status === "credited" && !lockPending && !lockError ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2 py-8 text-center", children: [
|
|
@@ -2671,7 +2706,7 @@ function TransakCardWidgetView({
|
|
|
2671
2706
|
token.symbol,
|
|
2672
2707
|
" deposit is now available in your balance."
|
|
2673
2708
|
] })
|
|
2674
|
-
] }) : !activeIntentId || canRecreateSession ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2709
|
+
] }) : !activeIntentId || canRecreateSession ? /* @__PURE__ */ jsxRuntime.jsxs(chunkVNECVPMU_cjs.Button, { type: "button", disabled: !canOpen, onClick: () => void runCheckout(), children: [
|
|
2675
2710
|
isLaunching && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin", "aria-hidden": true }),
|
|
2676
2711
|
isLaunching ? "Opening checkout\u2026" : activeIntentId ? "Reopen card checkout" : allowance ? "Sign policy and open checkout" : "Open card checkout"
|
|
2677
2712
|
] }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "This signed purchase is in recovery. Do not open another checkout for it." }),
|
|
@@ -2698,7 +2733,7 @@ function TransakCardWidgetView({
|
|
|
2698
2733
|
pending.map((record) => {
|
|
2699
2734
|
const isActivelyVerifying = record.transaction_id === activeVerificationId;
|
|
2700
2735
|
const progress = parseFinalityProgress(finalityProgress[record.transaction_id]);
|
|
2701
|
-
const showRetry =
|
|
2736
|
+
const showRetry = chunkVNECVPMU_cjs.canRetryOnRampVerification(record, activeVerificationId);
|
|
2702
2737
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2703
2738
|
"div",
|
|
2704
2739
|
{
|
|
@@ -2710,7 +2745,7 @@ function TransakCardWidgetView({
|
|
|
2710
2745
|
] }),
|
|
2711
2746
|
rowError?.id === record.transaction_id && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-xs", children: rowError.message }),
|
|
2712
2747
|
showRetry && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2713
|
-
|
|
2748
|
+
chunkVNECVPMU_cjs.Button,
|
|
2714
2749
|
{
|
|
2715
2750
|
type: "button",
|
|
2716
2751
|
variant: "outline",
|
|
@@ -2730,7 +2765,7 @@ function TransakCardWidgetView({
|
|
|
2730
2765
|
}
|
|
2731
2766
|
),
|
|
2732
2767
|
!record.on_chain_tx_hash && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2733
|
-
|
|
2768
|
+
chunkVNECVPMU_cjs.Button,
|
|
2734
2769
|
{
|
|
2735
2770
|
type: "button",
|
|
2736
2771
|
variant: "outline",
|
|
@@ -2746,7 +2781,7 @@ function TransakCardWidgetView({
|
|
|
2746
2781
|
})
|
|
2747
2782
|
] }),
|
|
2748
2783
|
onLeave && ownedFlowActive && !unsafeToClose && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2749
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2784
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkVNECVPMU_cjs.Button, { type: "button", variant: "outline", onClick: handleLeave, children: "Leave checkout" }),
|
|
2750
2785
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: "Privana will keep this signed purchase available for exact recovery." })
|
|
2751
2786
|
] }),
|
|
2752
2787
|
(actionError ?? error) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", role: "alert", children: (actionError ?? error)?.message }),
|
|
@@ -2835,7 +2870,7 @@ function MoonPayCardWidgetView({
|
|
|
2835
2870
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: [
|
|
2836
2871
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: "Complete your purchase" }),
|
|
2837
2872
|
moonpayCurrencyCode ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2838
|
-
|
|
2873
|
+
chunkVNECVPMU_cjs.FiatOnRampForm,
|
|
2839
2874
|
{
|
|
2840
2875
|
tokenId: token.id,
|
|
2841
2876
|
frozenToken: token,
|
|
@@ -3130,7 +3165,7 @@ function ChevronDownIcon({
|
|
|
3130
3165
|
height: "16",
|
|
3131
3166
|
viewBox: "0 0 16 16",
|
|
3132
3167
|
fill: "none",
|
|
3133
|
-
className:
|
|
3168
|
+
className: chunkVNECVPMU_cjs.cn(
|
|
3134
3169
|
"transition-transform",
|
|
3135
3170
|
direction === "right" && "-rotate-90",
|
|
3136
3171
|
direction === "up" && "rotate-180",
|
|
@@ -3283,7 +3318,7 @@ function PolicyTermRow({
|
|
|
3283
3318
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3284
3319
|
"div",
|
|
3285
3320
|
{
|
|
3286
|
-
className:
|
|
3321
|
+
className: chunkVNECVPMU_cjs.cn(
|
|
3287
3322
|
"mt-0.5 shrink-0",
|
|
3288
3323
|
kind === "permission" ? "text-emerald-500" : "text-orange-500"
|
|
3289
3324
|
),
|
|
@@ -3351,13 +3386,14 @@ function DepositView({
|
|
|
3351
3386
|
amount,
|
|
3352
3387
|
allowance,
|
|
3353
3388
|
externalMinimum,
|
|
3389
|
+
walletMinimum,
|
|
3354
3390
|
onAmountChange,
|
|
3355
3391
|
onSelectToken,
|
|
3356
3392
|
onConnectWallet,
|
|
3357
3393
|
onSubmit,
|
|
3358
3394
|
isSubmitting = false
|
|
3359
3395
|
}) {
|
|
3360
|
-
const { getChainById: getChainById2, chains, serviceName, serviceIcon, networkConfig, hostedAuthConfig } =
|
|
3396
|
+
const { getChainById: getChainById2, chains, serviceName, serviceIcon, networkConfig, hostedAuthConfig } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
3361
3397
|
const { address, isConnected } = wagmi.useAccount();
|
|
3362
3398
|
const appName = serviceName ?? "Privana";
|
|
3363
3399
|
const chain = selectedToken ? getChainById2(selectedToken.chainId) : void 0;
|
|
@@ -3366,7 +3402,7 @@ function DepositView({
|
|
|
3366
3402
|
const isConnectedSource = source === "connected";
|
|
3367
3403
|
const isExternal = source === "external";
|
|
3368
3404
|
const isCreditCard = source === "credit-card";
|
|
3369
|
-
const isMoonPayCard = isCreditCard &&
|
|
3405
|
+
const isMoonPayCard = isCreditCard && chunkVNECVPMU_cjs.isMoonPayProductOnRamp(onRamp);
|
|
3370
3406
|
const isTransakCard = isCreditCard && onRamp.provider === "transak";
|
|
3371
3407
|
const isNative = selectedToken?.contract === viem.zeroAddress;
|
|
3372
3408
|
const { data: nativeBalanceData, isLoading: isNativeBalanceLoading } = wagmi.useBalance({
|
|
@@ -3384,7 +3420,7 @@ function DepositView({
|
|
|
3384
3420
|
});
|
|
3385
3421
|
const walletBalance = isNative ? nativeBalanceData?.value : erc20Balance;
|
|
3386
3422
|
const isWalletBalanceLoading = isNative ? isNativeBalanceLoading : isErc20BalanceLoading;
|
|
3387
|
-
const formattedWalletBalance = walletBalance != null && selectedToken ?
|
|
3423
|
+
const formattedWalletBalance = walletBalance != null && selectedToken ? chunkVNECVPMU_cjs.formatTokenAmount(walletBalance.toString(), selectedToken.decimals) : "0.00";
|
|
3388
3424
|
const {
|
|
3389
3425
|
minBuyAmount: moonpayMinBuy,
|
|
3390
3426
|
isLoading: moonpayLimitsLoading,
|
|
@@ -3397,18 +3433,19 @@ function DepositView({
|
|
|
3397
3433
|
const hasValidAmount = !!amount && parseFloat(amount) > 0;
|
|
3398
3434
|
const maxAmountDecimals = isMoonPayCard ? 2 : selectedToken?.decimals;
|
|
3399
3435
|
const tooManyDecimals = hasValidAmount && maxAmountDecimals != null && amount.includes(".") && amount.split(".")[1].length > maxAmountDecimals;
|
|
3400
|
-
const exceedsBalance = isConnectedSource && hasValidAmount && !tooManyDecimals && !!selectedToken && walletBalance != null &&
|
|
3436
|
+
const exceedsBalance = isConnectedSource && hasValidAmount && !tooManyDecimals && !!selectedToken && walletBalance != null && chunkVNECVPMU_cjs.parseTokenAmount(amount, selectedToken.decimals) > walletBalance;
|
|
3401
3437
|
const belowMoonpayMin = isMoonPayCard && hasValidAmount && moonpayMinBuy != null && parseFloat(amount) < moonpayMinBuy;
|
|
3402
3438
|
const moonpayLimitsUnready = isMoonPayCard && !!onRamp.providerAssetCode && moonpayMinBuy == null;
|
|
3403
3439
|
const creditCardUnavailable = isCreditCard && !!onRamp.unavailableReason;
|
|
3404
3440
|
const externalTokenUnavailable = isExternal && !!selectedToken && isNative;
|
|
3405
|
-
const externalMinimumRequired = isExternal && !!
|
|
3441
|
+
const externalMinimumRequired = isExternal && !!selectedToken;
|
|
3406
3442
|
const externalMinimumLoading = externalMinimumRequired && externalMinimum === void 0;
|
|
3407
3443
|
const externalMinimumUnavailable = externalMinimumRequired && externalMinimum === null;
|
|
3408
|
-
const belowExternalMinimum = externalMinimumRequired && hasValidAmount && !tooManyDecimals && !!selectedToken && typeof externalMinimum === "bigint" &&
|
|
3444
|
+
const belowExternalMinimum = externalMinimumRequired && hasValidAmount && !tooManyDecimals && !!selectedToken && typeof externalMinimum === "bigint" && chunkVNECVPMU_cjs.parseTokenAmount(amount, selectedToken.decimals) < externalMinimum;
|
|
3445
|
+
const belowWalletMinimum = isConnectedSource && hasValidAmount && !tooManyDecimals && !exceedsBalance && !!selectedToken && typeof walletMinimum === "bigint" && chunkVNECVPMU_cjs.parseTokenAmount(amount, selectedToken.decimals) < walletMinimum;
|
|
3409
3446
|
const externalNeedsWallet = isExternal && (!!allowance || !hostedAuthConfig);
|
|
3410
3447
|
const needsConnect = (isConnectedSource || externalNeedsWallet) && !isConnected;
|
|
3411
|
-
const canDeposit = hasValidAmount && !!selectedToken && !tooManyDecimals && !exceedsBalance && !belowMoonpayMin && !moonpayLimitsUnready && !creditCardUnavailable && !externalTokenUnavailable && !externalMinimumLoading && !externalMinimumUnavailable && !belowExternalMinimum && !needsConnect;
|
|
3448
|
+
const canDeposit = hasValidAmount && !!selectedToken && !tooManyDecimals && !exceedsBalance && !belowMoonpayMin && !moonpayLimitsUnready && !creditCardUnavailable && !externalTokenUnavailable && !externalMinimumLoading && !externalMinimumUnavailable && !belowExternalMinimum && !belowWalletMinimum && !needsConnect;
|
|
3412
3449
|
const handleMax = () => {
|
|
3413
3450
|
if (selectedToken && walletBalance != null && walletBalance > 0n)
|
|
3414
3451
|
onAmountChange(viem.formatUnits(walletBalance, selectedToken.decimals));
|
|
@@ -3455,13 +3492,13 @@ function DepositView({
|
|
|
3455
3492
|
isConnectedSource && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground flex items-center gap-1 text-sm", children: [
|
|
3456
3493
|
"Available",
|
|
3457
3494
|
" ",
|
|
3458
|
-
isWalletBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3495
|
+
isWalletBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkVNECVPMU_cjs.Skeleton, { className: "h-4 w-16" }) : `${formattedWalletBalance} ${selectedToken?.symbol ?? ""}`
|
|
3459
3496
|
] })
|
|
3460
3497
|
] }),
|
|
3461
3498
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3462
3499
|
"div",
|
|
3463
3500
|
{
|
|
3464
|
-
className:
|
|
3501
|
+
className: chunkVNECVPMU_cjs.cn(
|
|
3465
3502
|
"border-border bg-input flex items-center gap-2 rounded-[10px] border",
|
|
3466
3503
|
isConnectedSource ? "py-1 pr-1 pl-3" : "px-3 py-3"
|
|
3467
3504
|
),
|
|
@@ -3512,6 +3549,13 @@ function DepositView({
|
|
|
3512
3549
|
selectedToken.symbol,
|
|
3513
3550
|
"."
|
|
3514
3551
|
] }),
|
|
3552
|
+
belowWalletMinimum && selectedToken && typeof walletMinimum === "bigint" && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-destructive text-sm", children: [
|
|
3553
|
+
"Minimum deposit is ",
|
|
3554
|
+
viem.formatUnits(walletMinimum, selectedToken.decimals),
|
|
3555
|
+
" ",
|
|
3556
|
+
selectedToken.symbol,
|
|
3557
|
+
"."
|
|
3558
|
+
] }),
|
|
3515
3559
|
externalMinimumLoading && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Checking minimum deposit\u2026" }),
|
|
3516
3560
|
externalMinimumUnavailable && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", children: "Couldn\u2019t load the minimum deposit. Please try again." }),
|
|
3517
3561
|
isMoonPayCard && moonpayLimitsError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", children: "Couldn\u2019t load purchase limits. Please try again." }),
|
|
@@ -3595,13 +3639,15 @@ function ExternalDepositView({
|
|
|
3595
3639
|
token,
|
|
3596
3640
|
amount,
|
|
3597
3641
|
depositAddressState,
|
|
3642
|
+
externalMinimum,
|
|
3598
3643
|
onCredited,
|
|
3599
3644
|
onDiscardLock,
|
|
3600
3645
|
lock
|
|
3601
3646
|
}) {
|
|
3602
|
-
const { getChainById: getChainById2, getTokenById, serviceName } =
|
|
3647
|
+
const { getChainById: getChainById2, getTokenById, serviceName } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
3603
3648
|
const appName = serviceName ?? "Privana";
|
|
3604
3649
|
const { depositAddress, isReady, isLoading } = depositAddressState;
|
|
3650
|
+
const minimumLabel = token && typeof externalMinimum === "bigint" ? `${viem.formatUnits(externalMinimum, token.decimals)} ${token.symbol}` : void 0;
|
|
3605
3651
|
const chain = token ? getChainById2(token.chainId) : void 0;
|
|
3606
3652
|
const lockSession = lock?.session;
|
|
3607
3653
|
const recordVerification = lock?.recordVerification;
|
|
@@ -3615,7 +3661,7 @@ function ExternalDepositView({
|
|
|
3615
3661
|
const [nothingFound, setNothingFound] = react.useState(false);
|
|
3616
3662
|
const [credited, setCredited] = react.useState(null);
|
|
3617
3663
|
const [showCancelWarning, setShowCancelWarning] = react.useState(false);
|
|
3618
|
-
const verification =
|
|
3664
|
+
const verification = chunkVNECVPMU_cjs.useDepositVerification({
|
|
3619
3665
|
onCredited: (txHash, _response, creditedAmount) => {
|
|
3620
3666
|
if (settleAfterCredit) {
|
|
3621
3667
|
void settleAfterCredit(txHash, creditedAmount);
|
|
@@ -3738,12 +3784,16 @@ function ExternalDepositView({
|
|
|
3738
3784
|
/* @__PURE__ */ jsxRuntime.jsx(SummaryRow, { value: amount || "\u2014", label: "Value" })
|
|
3739
3785
|
] }),
|
|
3740
3786
|
showDepositInstructions && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3741
|
-
!scanPaused && /* @__PURE__ */ jsxRuntime.
|
|
3742
|
-
|
|
3787
|
+
!scanPaused && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground text-sm", children: [
|
|
3788
|
+
"Send the displayed amount in one transfer. Transfers below the minimum",
|
|
3789
|
+
minimumLabel ? ` (${minimumLabel})` : "",
|
|
3790
|
+
" are not combined or automatically returned."
|
|
3791
|
+
] }),
|
|
3792
|
+
/* @__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(chunkVNECVPMU_cjs.Skeleton, { className: "h-full w-full rounded-[10px]" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm", children: "Deposit address unavailable" }) }),
|
|
3743
3793
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
3744
3794
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Deposit Address" }),
|
|
3745
3795
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
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(
|
|
3796
|
+
/* @__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(chunkVNECVPMU_cjs.Skeleton, { className: "h-4 w-3/4" }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "\u2014" }) }),
|
|
3747
3797
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3748
3798
|
"button",
|
|
3749
3799
|
{
|
|
@@ -3798,7 +3848,7 @@ function ExternalDepositView({
|
|
|
3798
3848
|
TransactionSuccessView,
|
|
3799
3849
|
{
|
|
3800
3850
|
title: "Deposit Credited",
|
|
3801
|
-
message: `Transfer ${
|
|
3851
|
+
message: `Transfer ${chunkVNECVPMU_cjs.shortenAddress(credited.txHash)} has been credited to your Privana balance.`,
|
|
3802
3852
|
onDone: () => {
|
|
3803
3853
|
setCredited(null);
|
|
3804
3854
|
verification.reset();
|
|
@@ -3827,7 +3877,7 @@ function ExternalDepositView({
|
|
|
3827
3877
|
{
|
|
3828
3878
|
title: "Awaiting Deposit",
|
|
3829
3879
|
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.",
|
|
3830
|
-
remaining: listening ?
|
|
3880
|
+
remaining: listening ? chunkVNECVPMU_cjs.formatCountdown(secondsLeft) : void 0
|
|
3831
3881
|
}
|
|
3832
3882
|
),
|
|
3833
3883
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
@@ -3879,7 +3929,7 @@ function MethodTabs({
|
|
|
3879
3929
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3880
3930
|
"div",
|
|
3881
3931
|
{
|
|
3882
|
-
className:
|
|
3932
|
+
className: chunkVNECVPMU_cjs.cn(
|
|
3883
3933
|
"bg-input absolute top-1 bottom-1 left-1 w-[calc(50%-8px)] rounded-md transition-transform duration-200",
|
|
3884
3934
|
activeTab === "credit-card" && "translate-x-[calc(100%+8px)]"
|
|
3885
3935
|
)
|
|
@@ -3890,7 +3940,7 @@ function MethodTabs({
|
|
|
3890
3940
|
{
|
|
3891
3941
|
type: "button",
|
|
3892
3942
|
onClick: () => onTabChange("crypto"),
|
|
3893
|
-
className:
|
|
3943
|
+
className: chunkVNECVPMU_cjs.cn(
|
|
3894
3944
|
"relative z-10 flex-1 cursor-pointer rounded-md px-3 py-[9px] text-sm font-medium transition-colors",
|
|
3895
3945
|
activeTab === "crypto" ? "text-foreground" : "text-muted-foreground"
|
|
3896
3946
|
),
|
|
@@ -3902,7 +3952,7 @@ function MethodTabs({
|
|
|
3902
3952
|
{
|
|
3903
3953
|
type: "button",
|
|
3904
3954
|
onClick: () => onTabChange("credit-card"),
|
|
3905
|
-
className:
|
|
3955
|
+
className: chunkVNECVPMU_cjs.cn(
|
|
3906
3956
|
"relative z-10 flex-1 cursor-pointer rounded-md px-3 py-[9px] text-sm font-medium transition-colors",
|
|
3907
3957
|
activeTab === "credit-card" ? "text-foreground" : "text-muted-foreground"
|
|
3908
3958
|
),
|
|
@@ -3956,9 +4006,9 @@ function DepositModalContent({
|
|
|
3956
4006
|
getTokenById,
|
|
3957
4007
|
networkConfig,
|
|
3958
4008
|
onRamp
|
|
3959
|
-
} =
|
|
4009
|
+
} = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
3960
4010
|
const { address } = wagmi.useAccount();
|
|
3961
|
-
const { privateReadQueryScope } =
|
|
4011
|
+
const { privateReadQueryScope } = chunkVNECVPMU_cjs.usePrivateReadRequest();
|
|
3962
4012
|
const [privateReadApiUrl, accountingChainId, beneficiaryAddress] = privateReadQueryScope;
|
|
3963
4013
|
const appName = serviceName ?? "Privana";
|
|
3964
4014
|
const [activeTab, setActiveTab] = react.useState(defaultTab);
|
|
@@ -3972,7 +4022,7 @@ function DepositModalContent({
|
|
|
3972
4022
|
const nextCardFlowId = react.useRef(0);
|
|
3973
4023
|
const stateSelectedToken = enabledTokens.find((t) => t.id === selectedTokenId) ?? defaultToken;
|
|
3974
4024
|
const cardOnRamp = react.useMemo(
|
|
3975
|
-
() =>
|
|
4025
|
+
() => chunkVNECVPMU_cjs.resolveProductOnRamp({
|
|
3976
4026
|
config: onRamp,
|
|
3977
4027
|
enabledTokens,
|
|
3978
4028
|
legacyToken: stateSelectedToken,
|
|
@@ -3989,13 +4039,18 @@ function DepositModalContent({
|
|
|
3989
4039
|
}),
|
|
3990
4040
|
[accountingChainId, beneficiaryAddress, networkConfig.accountingContract, privateReadApiUrl]
|
|
3991
4041
|
);
|
|
3992
|
-
const mountedCardFlow = cardFlow &&
|
|
4042
|
+
const mountedCardFlow = cardFlow && chunkVNECVPMU_cjs.matchesProductOnRampScope(cardFlow.scope, cardOnRampScope) ? cardFlow : null;
|
|
3993
4043
|
const displayedCardOnRamp = view === "credit-card-widget" && mountedCardFlow ? mountedCardFlow.selection : cardOnRamp;
|
|
3994
4044
|
const selectedToken = source === "credit-card" ? displayedCardOnRamp.token : stateSelectedToken;
|
|
3995
|
-
const
|
|
3996
|
-
enabled: source === "external" && (view === "deposit" || view === "external-deposit")
|
|
4045
|
+
const depositAddressState = useDepositAddress({
|
|
4046
|
+
enabled: source === "external" && (view === "deposit" || view === "external-deposit") || source === "connected" && view === "deposit"
|
|
3997
4047
|
});
|
|
3998
|
-
const externalMinimum = source !== "external" || !selectedToken ? void 0 :
|
|
4048
|
+
const externalMinimum = source !== "external" || !selectedToken ? void 0 : depositAddressState.isError ? null : depositAddressState.response ? getMinDepositBaseUnits(depositAddressState.response, selectedToken.chainId, "erc20") ?? null : void 0;
|
|
4049
|
+
const walletMinimum = source !== "connected" || !selectedToken ? void 0 : depositAddressState.isError ? null : depositAddressState.response ? getMinDepositBaseUnits(
|
|
4050
|
+
depositAddressState.response,
|
|
4051
|
+
selectedToken.chainId,
|
|
4052
|
+
selectedToken.contract === viem.zeroAddress ? "native" : "erc20"
|
|
4053
|
+
) ?? null : void 0;
|
|
3999
4054
|
const prevAddressRef = react.useRef(address);
|
|
4000
4055
|
react.useEffect(() => {
|
|
4001
4056
|
const prev = prevAddressRef.current;
|
|
@@ -4043,11 +4098,11 @@ function DepositModalContent({
|
|
|
4043
4098
|
setView("deposit");
|
|
4044
4099
|
}, []);
|
|
4045
4100
|
react.useEffect(() => {
|
|
4046
|
-
if (cardFlow && !
|
|
4101
|
+
if (cardFlow && !chunkVNECVPMU_cjs.matchesProductOnRampScope(cardFlow.scope, cardOnRampScope)) {
|
|
4047
4102
|
leaveCardPurchase();
|
|
4048
4103
|
}
|
|
4049
4104
|
}, [cardFlow, cardOnRampScope, leaveCardPurchase]);
|
|
4050
|
-
const cardOutcomeCallbacks = mountedCardFlow ?
|
|
4105
|
+
const cardOutcomeCallbacks = mountedCardFlow ? chunkVNECVPMU_cjs.createProductOnRampOutcomeCallbacks({
|
|
4051
4106
|
requiresLock: mountedCardFlow.requiresLock,
|
|
4052
4107
|
onComplete: finishCardPurchase,
|
|
4053
4108
|
onLockFailed: (err) => {
|
|
@@ -4145,11 +4200,7 @@ function DepositModalContent({
|
|
|
4145
4200
|
sonner.toast.error("External deposits support ERC20 tokens only");
|
|
4146
4201
|
return;
|
|
4147
4202
|
}
|
|
4148
|
-
const depositAmount =
|
|
4149
|
-
if (!allowance) {
|
|
4150
|
-
setView("external-deposit");
|
|
4151
|
-
return;
|
|
4152
|
-
}
|
|
4203
|
+
const depositAmount = chunkVNECVPMU_cjs.parseTokenAmount(args.amount, token2.decimals);
|
|
4153
4204
|
if (typeof externalMinimum !== "bigint") {
|
|
4154
4205
|
sonner.toast.error("Minimum deposit is unavailable. Please try again.");
|
|
4155
4206
|
return;
|
|
@@ -4160,6 +4211,10 @@ function DepositModalContent({
|
|
|
4160
4211
|
);
|
|
4161
4212
|
return;
|
|
4162
4213
|
}
|
|
4214
|
+
if (!allowance) {
|
|
4215
|
+
setView("external-deposit");
|
|
4216
|
+
return;
|
|
4217
|
+
}
|
|
4163
4218
|
externalLock.signAndPersist({
|
|
4164
4219
|
tokenId: token2.id,
|
|
4165
4220
|
amount: depositAmount
|
|
@@ -4175,7 +4230,7 @@ function DepositModalContent({
|
|
|
4175
4230
|
}
|
|
4176
4231
|
try {
|
|
4177
4232
|
setCardFlow(
|
|
4178
|
-
|
|
4233
|
+
chunkVNECVPMU_cjs.createProductOnRampFlowSnapshot({
|
|
4179
4234
|
id: ++nextCardFlowId.current,
|
|
4180
4235
|
selection: cardOnRamp,
|
|
4181
4236
|
amount: args.amount,
|
|
@@ -4200,7 +4255,7 @@ function DepositModalContent({
|
|
|
4200
4255
|
setCancelled(false);
|
|
4201
4256
|
deposit({
|
|
4202
4257
|
tokenId: token.id,
|
|
4203
|
-
amount:
|
|
4258
|
+
amount: chunkVNECVPMU_cjs.parseTokenAmount(args.amount, token.decimals),
|
|
4204
4259
|
postDepositLock: allowance ? {
|
|
4205
4260
|
maxAmount: BigInt(allowance.value),
|
|
4206
4261
|
lockDuration: allowance.lockDuration
|
|
@@ -4241,7 +4296,7 @@ function DepositModalContent({
|
|
|
4241
4296
|
];
|
|
4242
4297
|
const hasExternalLockRecovery = view === "external-deposit" && !!externalLock.session?.creditedAmount;
|
|
4243
4298
|
const externalSubmissionAmbiguous = hasExternalLockRecovery && !!lockFailure?.submissionMayHaveSucceeded;
|
|
4244
|
-
const savedExternalPayloadUsable = !!externalLock.session?.payload &&
|
|
4299
|
+
const savedExternalPayloadUsable = !!externalLock.session?.payload && chunkVNECVPMU_cjs.isSignedLockUsable(externalLock.session.payload);
|
|
4245
4300
|
const ambiguousRecoveryMustBeAbandoned = externalSubmissionAmbiguous && !savedExternalPayloadUsable;
|
|
4246
4301
|
const externalRecoveryExitLabel = externalSubmissionAmbiguous ? "Stop recovery" : "Keep funds unlocked";
|
|
4247
4302
|
const lockFailureToken = hasExternalLockRecovery && externalLock.session ? getTokenById(externalLock.session.tokenId) ?? selectedToken : selectedToken;
|
|
@@ -4325,7 +4380,7 @@ function DepositModalContent({
|
|
|
4325
4380
|
onClick: onClose,
|
|
4326
4381
|
disabled: isUnsafeToClose,
|
|
4327
4382
|
"aria-label": "Close",
|
|
4328
|
-
className:
|
|
4383
|
+
className: chunkVNECVPMU_cjs.cn(
|
|
4329
4384
|
"absolute top-6 right-5 z-20 flex h-5 w-5 items-center justify-center transition-colors",
|
|
4330
4385
|
isUnsafeToClose ? "text-muted-foreground/40 cursor-not-allowed" : "text-muted-foreground hover:text-foreground cursor-pointer"
|
|
4331
4386
|
),
|
|
@@ -4449,6 +4504,7 @@ function DepositModalContent({
|
|
|
4449
4504
|
amount,
|
|
4450
4505
|
allowance,
|
|
4451
4506
|
externalMinimum,
|
|
4507
|
+
walletMinimum,
|
|
4452
4508
|
onAmountChange: setAmount,
|
|
4453
4509
|
onSelectToken: () => setView("select-token"),
|
|
4454
4510
|
onConnectWallet,
|
|
@@ -4474,7 +4530,8 @@ function DepositModalContent({
|
|
|
4474
4530
|
{
|
|
4475
4531
|
token: selectedToken,
|
|
4476
4532
|
amount,
|
|
4477
|
-
depositAddressState
|
|
4533
|
+
depositAddressState,
|
|
4534
|
+
externalMinimum,
|
|
4478
4535
|
onCredited: allowance ? void 0 : onDepositSuccess,
|
|
4479
4536
|
onDiscardLock: handleExternalVerificationDiscard,
|
|
4480
4537
|
lock: externalLock.session ? externalLock : void 0
|
|
@@ -4552,7 +4609,7 @@ function DepositInlineModal({ className, ...handlers }) {
|
|
|
4552
4609
|
"div",
|
|
4553
4610
|
{
|
|
4554
4611
|
"data-privana": true,
|
|
4555
|
-
className:
|
|
4612
|
+
className: chunkVNECVPMU_cjs.cn(
|
|
4556
4613
|
"bg-card relative flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
4557
4614
|
className
|
|
4558
4615
|
),
|
|
@@ -4568,7 +4625,7 @@ function WithdrawView({
|
|
|
4568
4625
|
onPendingChange,
|
|
4569
4626
|
onWithdrawSuccess
|
|
4570
4627
|
}) {
|
|
4571
|
-
const { chains, getChainById: getChainById2 } =
|
|
4628
|
+
const { chains, getChainById: getChainById2 } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
4572
4629
|
const { isConnected, address } = wagmi.useAccount();
|
|
4573
4630
|
const [showSuccess, setShowSuccess] = react.useState(false);
|
|
4574
4631
|
const [showTimeout, setShowTimeout] = react.useState(false);
|
|
@@ -4582,7 +4639,7 @@ function WithdrawView({
|
|
|
4582
4639
|
tokenId: selectedToken?.id,
|
|
4583
4640
|
enabled: !!selectedToken
|
|
4584
4641
|
});
|
|
4585
|
-
const formattedBalance = selectedToken ?
|
|
4642
|
+
const formattedBalance = selectedToken ? chunkVNECVPMU_cjs.formatTokenAmount(balanceWei, selectedToken.decimals) : "0.00";
|
|
4586
4643
|
const { withdraw, isPending, currentStep, error, reset } = useWithdraw({
|
|
4587
4644
|
onProcessingSuccess: () => {
|
|
4588
4645
|
onAmountChange("");
|
|
@@ -4598,7 +4655,7 @@ function WithdrawView({
|
|
|
4598
4655
|
setShowTimeout(true);
|
|
4599
4656
|
}
|
|
4600
4657
|
});
|
|
4601
|
-
const explorerUrl = address && targetChain ?
|
|
4658
|
+
const explorerUrl = address && targetChain ? chunkVNECVPMU_cjs.getExplorerAddressUrl(targetChain.id, address) : void 0;
|
|
4602
4659
|
const getStepStatus = (step, after) => {
|
|
4603
4660
|
if (currentStep === step) return "active";
|
|
4604
4661
|
if (after.includes(currentStep)) return "completed";
|
|
@@ -4632,7 +4689,7 @@ function WithdrawView({
|
|
|
4632
4689
|
}, [isPending, cancelled, onPendingChange]);
|
|
4633
4690
|
const hasValidAmount = !!amount && parseFloat(amount) > 0;
|
|
4634
4691
|
const tooManyDecimals = !!hasValidAmount && !!selectedToken && amount.includes(".") && amount.split(".")[1].length > selectedToken.decimals;
|
|
4635
|
-
const exceedsBalance = !!hasValidAmount && !tooManyDecimals && !!selectedToken && !isBalanceLoading && !isBalanceError &&
|
|
4692
|
+
const exceedsBalance = !!hasValidAmount && !tooManyDecimals && !!selectedToken && !isBalanceLoading && !isBalanceError && chunkVNECVPMU_cjs.parseTokenAmount(amount, selectedToken.decimals) > BigInt(balanceWei);
|
|
4636
4693
|
const canWithdraw = isConnected && hasValidAmount && !!selectedToken && !tooManyDecimals && !exceedsBalance;
|
|
4637
4694
|
const handleMax = () => {
|
|
4638
4695
|
if (!selectedToken) return;
|
|
@@ -4644,7 +4701,7 @@ function WithdrawView({
|
|
|
4644
4701
|
setCancelled(false);
|
|
4645
4702
|
await withdraw({
|
|
4646
4703
|
tokenId: selectedToken.id,
|
|
4647
|
-
amount:
|
|
4704
|
+
amount: chunkVNECVPMU_cjs.parseTokenAmount(amount, selectedToken.decimals)
|
|
4648
4705
|
});
|
|
4649
4706
|
};
|
|
4650
4707
|
const handleCancel = () => {
|
|
@@ -4664,7 +4721,7 @@ function WithdrawView({
|
|
|
4664
4721
|
title: "Withdrawal Complete",
|
|
4665
4722
|
message: `Your ${selectedToken.symbol} withdrawal has been processed. Funds should appear in your wallet shortly.`,
|
|
4666
4723
|
explorerUrl,
|
|
4667
|
-
explorerLabel: targetChain ?
|
|
4724
|
+
explorerLabel: targetChain ? chunkVNECVPMU_cjs.getExplorerLabel(targetChain.id) : void 0,
|
|
4668
4725
|
onDone: handleDone
|
|
4669
4726
|
}
|
|
4670
4727
|
) });
|
|
@@ -4722,7 +4779,7 @@ function WithdrawView({
|
|
|
4722
4779
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground flex items-center gap-1 text-sm", children: [
|
|
4723
4780
|
"Available",
|
|
4724
4781
|
" ",
|
|
4725
|
-
isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4782
|
+
isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkVNECVPMU_cjs.Skeleton, { className: "h-4 w-16" }) : `${formattedBalance} ${selectedToken?.symbol ?? ""}`
|
|
4726
4783
|
] })
|
|
4727
4784
|
] }),
|
|
4728
4785
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border bg-input flex items-center gap-2 rounded-[10px] border py-1 pr-1 pl-3", children: [
|
|
@@ -4776,7 +4833,7 @@ function WithdrawModalContent({
|
|
|
4776
4833
|
onBack,
|
|
4777
4834
|
onWithdrawSuccess
|
|
4778
4835
|
}) {
|
|
4779
|
-
const { serviceName, enabledTokens, defaultToken, hostedAuthConfig } =
|
|
4836
|
+
const { serviceName, enabledTokens, defaultToken, hostedAuthConfig } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
4780
4837
|
const { address } = wagmi.useAccount();
|
|
4781
4838
|
const appName = serviceName ?? "Privana";
|
|
4782
4839
|
const [view, setView] = react.useState("form");
|
|
@@ -4903,7 +4960,7 @@ function WithdrawInlineModal({ className, onWithdrawSuccess }) {
|
|
|
4903
4960
|
"div",
|
|
4904
4961
|
{
|
|
4905
4962
|
"data-privana": true,
|
|
4906
|
-
className:
|
|
4963
|
+
className: chunkVNECVPMU_cjs.cn(
|
|
4907
4964
|
"bg-card relative flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
4908
4965
|
className
|
|
4909
4966
|
),
|
|
@@ -4947,14 +5004,14 @@ function SegmentedBalanceBar({
|
|
|
4947
5004
|
showAvailable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4948
5005
|
"div",
|
|
4949
5006
|
{
|
|
4950
|
-
className:
|
|
5007
|
+
className: chunkVNECVPMU_cjs.cn(AVAILABLE_COLOR, "rounded-l-full", !showInUse && "rounded-r-full"),
|
|
4951
5008
|
style: { flexGrow: grow(availableWei) }
|
|
4952
5009
|
}
|
|
4953
5010
|
),
|
|
4954
5011
|
showInUse && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4955
5012
|
"div",
|
|
4956
5013
|
{
|
|
4957
|
-
className:
|
|
5014
|
+
className: chunkVNECVPMU_cjs.cn(IN_USE_COLOR, "rounded-r-full", !showAvailable && "rounded-l-full"),
|
|
4958
5015
|
style: { flexGrow: grow(inUseWei) }
|
|
4959
5016
|
}
|
|
4960
5017
|
)
|
|
@@ -4962,7 +5019,7 @@ function SegmentedBalanceBar({
|
|
|
4962
5019
|
}
|
|
4963
5020
|
function BalanceLegendItem({ color, label }) {
|
|
4964
5021
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
4965
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className:
|
|
5022
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkVNECVPMU_cjs.cn("h-2.5 w-2.5 rounded-full", color) }),
|
|
4966
5023
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground text-sm leading-5", children: label })
|
|
4967
5024
|
] });
|
|
4968
5025
|
}
|
|
@@ -4975,7 +5032,7 @@ function WalletBalanceView({
|
|
|
4975
5032
|
onAddFunds,
|
|
4976
5033
|
onWithdraw
|
|
4977
5034
|
}) {
|
|
4978
|
-
const { serviceName, serviceIcon, defaultToken } =
|
|
5035
|
+
const { serviceName, serviceIcon, defaultToken } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
4979
5036
|
const appName = serviceName ?? "Privana";
|
|
4980
5037
|
const token = defaultToken;
|
|
4981
5038
|
const {
|
|
@@ -4988,14 +5045,14 @@ function WalletBalanceView({
|
|
|
4988
5045
|
const variant = !session ? "idle" : inUseWei === 0n ? "session-zero" : availableWei === 0n ? "fully-in-use" : "mixed";
|
|
4989
5046
|
const expiry = session?.expiry;
|
|
4990
5047
|
useNow(3e4, expiry != null);
|
|
4991
|
-
const countdown = expiry != null ?
|
|
5048
|
+
const countdown = expiry != null ? chunkVNECVPMU_cjs.formatTimeRemaining(expiry) : null;
|
|
4992
5049
|
const decimals = token?.decimals ?? 18;
|
|
4993
|
-
const totalFormatted =
|
|
4994
|
-
const availableFormatted =
|
|
4995
|
-
const inUseFormatted =
|
|
5050
|
+
const totalFormatted = chunkVNECVPMU_cjs.formatTokenAmount((availableWei + inUseWei).toString(), decimals);
|
|
5051
|
+
const availableFormatted = chunkVNECVPMU_cjs.formatTokenAmount(availableWei.toString(), decimals);
|
|
5052
|
+
const inUseFormatted = chunkVNECVPMU_cjs.formatTokenAmount(inUseWei.toString(), decimals);
|
|
4996
5053
|
const hasValidAmount = !!amount && parseFloat(amount) > 0;
|
|
4997
5054
|
const tooManyDecimals = hasValidAmount && !!token && amount.includes(".") && amount.split(".")[1].length > token.decimals;
|
|
4998
|
-
const exceedsBalance = hasValidAmount && !tooManyDecimals && !!token && !isBalanceLoading && !isBalanceError &&
|
|
5055
|
+
const exceedsBalance = hasValidAmount && !tooManyDecimals && !!token && !isBalanceLoading && !isBalanceError && chunkVNECVPMU_cjs.parseTokenAmount(amount, token.decimals) > availableWei;
|
|
4999
5056
|
const canFundSession = hasValidAmount && !!token && !tooManyDecimals && !exceedsBalance && !isBalanceLoading && !isBalanceError;
|
|
5000
5057
|
const handleMax = () => {
|
|
5001
5058
|
const max = availableFormatted.replace(/\s/g, "");
|
|
@@ -5013,7 +5070,7 @@ function WalletBalanceView({
|
|
|
5013
5070
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm leading-[14px]", children: "Total" }),
|
|
5014
5071
|
/* @__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" })
|
|
5015
5072
|
] }),
|
|
5016
|
-
isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5073
|
+
isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkVNECVPMU_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 })
|
|
5017
5074
|
] }),
|
|
5018
5075
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
5019
5076
|
/* @__PURE__ */ jsxRuntime.jsx(SegmentedBalanceBar, { availableWei, inUseWei }),
|
|
@@ -5164,7 +5221,7 @@ function WalletModalContent({
|
|
|
5164
5221
|
onCloseBlockedChange,
|
|
5165
5222
|
...depositHandlers
|
|
5166
5223
|
}) {
|
|
5167
|
-
const { serviceName, hostedAuthConfig } =
|
|
5224
|
+
const { serviceName, hostedAuthConfig } = chunkVNECVPMU_cjs.usePrivanaContext();
|
|
5168
5225
|
const { address } = wagmi.useAccount();
|
|
5169
5226
|
const appName = serviceName ?? "Privana";
|
|
5170
5227
|
const [view, setView] = react.useState("balance");
|
|
@@ -5268,7 +5325,7 @@ function WalletModalContent({
|
|
|
5268
5325
|
onClick: onClose,
|
|
5269
5326
|
disabled: closeBlocked,
|
|
5270
5327
|
"aria-label": "Close",
|
|
5271
|
-
className:
|
|
5328
|
+
className: chunkVNECVPMU_cjs.cn(
|
|
5272
5329
|
"absolute top-6 right-5 z-20 flex h-5 w-5 items-center justify-center transition-colors",
|
|
5273
5330
|
closeBlocked ? "text-muted-foreground/40 cursor-not-allowed" : "text-muted-foreground hover:text-foreground cursor-pointer"
|
|
5274
5331
|
),
|
|
@@ -5396,7 +5453,7 @@ function WalletInlineModal({ className, ...handlers }) {
|
|
|
5396
5453
|
"div",
|
|
5397
5454
|
{
|
|
5398
5455
|
"data-privana": true,
|
|
5399
|
-
className:
|
|
5456
|
+
className: chunkVNECVPMU_cjs.cn(
|
|
5400
5457
|
"bg-card relative flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
5401
5458
|
className
|
|
5402
5459
|
),
|
|
@@ -5407,295 +5464,295 @@ function WalletInlineModal({ className, ...handlers }) {
|
|
|
5407
5464
|
|
|
5408
5465
|
Object.defineProperty(exports, "AccountingApiError", {
|
|
5409
5466
|
enumerable: true,
|
|
5410
|
-
get: function () { return
|
|
5467
|
+
get: function () { return chunkVNECVPMU_cjs.AccountingApiError; }
|
|
5411
5468
|
});
|
|
5412
5469
|
Object.defineProperty(exports, "Button", {
|
|
5413
5470
|
enumerable: true,
|
|
5414
|
-
get: function () { return
|
|
5471
|
+
get: function () { return chunkVNECVPMU_cjs.Button; }
|
|
5415
5472
|
});
|
|
5416
5473
|
Object.defineProperty(exports, "DEFAULT_LOCK_DURATION_SECONDS", {
|
|
5417
5474
|
enumerable: true,
|
|
5418
|
-
get: function () { return
|
|
5475
|
+
get: function () { return chunkVNECVPMU_cjs.DEFAULT_LOCK_DURATION_SECONDS; }
|
|
5419
5476
|
});
|
|
5420
5477
|
Object.defineProperty(exports, "DEFAULT_ONRAMP_LOCK_BUFFER", {
|
|
5421
5478
|
enumerable: true,
|
|
5422
|
-
get: function () { return
|
|
5479
|
+
get: function () { return chunkVNECVPMU_cjs.DEFAULT_ONRAMP_LOCK_BUFFER; }
|
|
5423
5480
|
});
|
|
5424
5481
|
Object.defineProperty(exports, "HOSTED_AUTH_CLOCK_SKEW_MS", {
|
|
5425
5482
|
enumerable: true,
|
|
5426
|
-
get: function () { return
|
|
5483
|
+
get: function () { return chunkVNECVPMU_cjs.HOSTED_AUTH_CLOCK_SKEW_MS; }
|
|
5427
5484
|
});
|
|
5428
5485
|
Object.defineProperty(exports, "HostedAuthError", {
|
|
5429
5486
|
enumerable: true,
|
|
5430
|
-
get: function () { return
|
|
5487
|
+
get: function () { return chunkVNECVPMU_cjs.HostedAuthError; }
|
|
5431
5488
|
});
|
|
5432
5489
|
Object.defineProperty(exports, "HostedAuthRequiredError", {
|
|
5433
5490
|
enumerable: true,
|
|
5434
|
-
get: function () { return
|
|
5491
|
+
get: function () { return chunkVNECVPMU_cjs.HostedAuthRequiredError; }
|
|
5435
5492
|
});
|
|
5436
5493
|
Object.defineProperty(exports, "HostedAuthStateMismatchError", {
|
|
5437
5494
|
enumerable: true,
|
|
5438
|
-
get: function () { return
|
|
5495
|
+
get: function () { return chunkVNECVPMU_cjs.HostedAuthStateMismatchError; }
|
|
5439
5496
|
});
|
|
5440
5497
|
Object.defineProperty(exports, "HttpClient", {
|
|
5441
5498
|
enumerable: true,
|
|
5442
|
-
get: function () { return
|
|
5499
|
+
get: function () { return chunkVNECVPMU_cjs.HttpClient; }
|
|
5443
5500
|
});
|
|
5444
5501
|
Object.defineProperty(exports, "LOCK_TYPES", {
|
|
5445
5502
|
enumerable: true,
|
|
5446
|
-
get: function () { return
|
|
5503
|
+
get: function () { return chunkVNECVPMU_cjs.LOCK_TYPES; }
|
|
5447
5504
|
});
|
|
5448
5505
|
Object.defineProperty(exports, "MODIFY_LOCK_TYPES", {
|
|
5449
5506
|
enumerable: true,
|
|
5450
|
-
get: function () { return
|
|
5507
|
+
get: function () { return chunkVNECVPMU_cjs.MODIFY_LOCK_TYPES; }
|
|
5451
5508
|
});
|
|
5452
5509
|
Object.defineProperty(exports, "NETWORK_CONFIG", {
|
|
5453
5510
|
enumerable: true,
|
|
5454
|
-
get: function () { return
|
|
5511
|
+
get: function () { return chunkVNECVPMU_cjs.NETWORK_CONFIG; }
|
|
5455
5512
|
});
|
|
5456
5513
|
Object.defineProperty(exports, "NetworkError", {
|
|
5457
5514
|
enumerable: true,
|
|
5458
|
-
get: function () { return
|
|
5515
|
+
get: function () { return chunkVNECVPMU_cjs.NetworkError; }
|
|
5459
5516
|
});
|
|
5460
5517
|
Object.defineProperty(exports, "PostDepositLockError", {
|
|
5461
5518
|
enumerable: true,
|
|
5462
|
-
get: function () { return
|
|
5519
|
+
get: function () { return chunkVNECVPMU_cjs.PostDepositLockError; }
|
|
5463
5520
|
});
|
|
5464
5521
|
Object.defineProperty(exports, "PrivanaClient", {
|
|
5465
5522
|
enumerable: true,
|
|
5466
|
-
get: function () { return
|
|
5523
|
+
get: function () { return chunkVNECVPMU_cjs.PrivanaClient; }
|
|
5467
5524
|
});
|
|
5468
5525
|
Object.defineProperty(exports, "PrivanaProvider", {
|
|
5469
5526
|
enumerable: true,
|
|
5470
|
-
get: function () { return
|
|
5527
|
+
get: function () { return chunkVNECVPMU_cjs.PrivanaProvider; }
|
|
5471
5528
|
});
|
|
5472
5529
|
Object.defineProperty(exports, "SUPPORTED_CHAINS", {
|
|
5473
5530
|
enumerable: true,
|
|
5474
|
-
get: function () { return
|
|
5531
|
+
get: function () { return chunkVNECVPMU_cjs.SUPPORTED_CHAINS; }
|
|
5475
5532
|
});
|
|
5476
5533
|
Object.defineProperty(exports, "SiweAuthProvider", {
|
|
5477
5534
|
enumerable: true,
|
|
5478
|
-
get: function () { return
|
|
5535
|
+
get: function () { return chunkVNECVPMU_cjs.SiweAuthProvider; }
|
|
5479
5536
|
});
|
|
5480
5537
|
Object.defineProperty(exports, "Skeleton", {
|
|
5481
5538
|
enumerable: true,
|
|
5482
|
-
get: function () { return
|
|
5539
|
+
get: function () { return chunkVNECVPMU_cjs.Skeleton; }
|
|
5483
5540
|
});
|
|
5484
5541
|
Object.defineProperty(exports, "TRANSFER_LOCKED_TYPES", {
|
|
5485
5542
|
enumerable: true,
|
|
5486
|
-
get: function () { return
|
|
5543
|
+
get: function () { return chunkVNECVPMU_cjs.TRANSFER_LOCKED_TYPES; }
|
|
5487
5544
|
});
|
|
5488
5545
|
Object.defineProperty(exports, "TRANSFER_TYPES", {
|
|
5489
5546
|
enumerable: true,
|
|
5490
|
-
get: function () { return
|
|
5547
|
+
get: function () { return chunkVNECVPMU_cjs.TRANSFER_TYPES; }
|
|
5491
5548
|
});
|
|
5492
5549
|
Object.defineProperty(exports, "ValidationError", {
|
|
5493
5550
|
enumerable: true,
|
|
5494
|
-
get: function () { return
|
|
5551
|
+
get: function () { return chunkVNECVPMU_cjs.ValidationError; }
|
|
5495
5552
|
});
|
|
5496
5553
|
Object.defineProperty(exports, "WITHDRAW_FROM_LOCK_TYPES", {
|
|
5497
5554
|
enumerable: true,
|
|
5498
|
-
get: function () { return
|
|
5555
|
+
get: function () { return chunkVNECVPMU_cjs.WITHDRAW_FROM_LOCK_TYPES; }
|
|
5499
5556
|
});
|
|
5500
5557
|
Object.defineProperty(exports, "WITHDRAW_TYPES", {
|
|
5501
5558
|
enumerable: true,
|
|
5502
|
-
get: function () { return
|
|
5559
|
+
get: function () { return chunkVNECVPMU_cjs.WITHDRAW_TYPES; }
|
|
5503
5560
|
});
|
|
5504
5561
|
Object.defineProperty(exports, "applyLockBuffer", {
|
|
5505
5562
|
enumerable: true,
|
|
5506
|
-
get: function () { return
|
|
5563
|
+
get: function () { return chunkVNECVPMU_cjs.applyLockBuffer; }
|
|
5507
5564
|
});
|
|
5508
5565
|
Object.defineProperty(exports, "applyRefreshResponse", {
|
|
5509
5566
|
enumerable: true,
|
|
5510
|
-
get: function () { return
|
|
5567
|
+
get: function () { return chunkVNECVPMU_cjs.applyRefreshResponse; }
|
|
5511
5568
|
});
|
|
5512
5569
|
Object.defineProperty(exports, "buildHostedAuthSession", {
|
|
5513
5570
|
enumerable: true,
|
|
5514
|
-
get: function () { return
|
|
5571
|
+
get: function () { return chunkVNECVPMU_cjs.buildHostedAuthSession; }
|
|
5515
5572
|
});
|
|
5516
5573
|
Object.defineProperty(exports, "buildSiweStatement", {
|
|
5517
5574
|
enumerable: true,
|
|
5518
|
-
get: function () { return
|
|
5575
|
+
get: function () { return chunkVNECVPMU_cjs.buildSiweStatement; }
|
|
5519
5576
|
});
|
|
5520
5577
|
Object.defineProperty(exports, "buttonVariants", {
|
|
5521
5578
|
enumerable: true,
|
|
5522
|
-
get: function () { return
|
|
5579
|
+
get: function () { return chunkVNECVPMU_cjs.buttonVariants; }
|
|
5523
5580
|
});
|
|
5524
5581
|
Object.defineProperty(exports, "clampLockAmount", {
|
|
5525
5582
|
enumerable: true,
|
|
5526
|
-
get: function () { return
|
|
5583
|
+
get: function () { return chunkVNECVPMU_cjs.clampLockAmount; }
|
|
5527
5584
|
});
|
|
5528
5585
|
Object.defineProperty(exports, "clearHostedAuthPendingTransaction", {
|
|
5529
5586
|
enumerable: true,
|
|
5530
|
-
get: function () { return
|
|
5587
|
+
get: function () { return chunkVNECVPMU_cjs.clearHostedAuthPendingTransaction; }
|
|
5531
5588
|
});
|
|
5532
5589
|
Object.defineProperty(exports, "clearPendingLock", {
|
|
5533
5590
|
enumerable: true,
|
|
5534
|
-
get: function () { return
|
|
5591
|
+
get: function () { return chunkVNECVPMU_cjs.clearPendingLock; }
|
|
5535
5592
|
});
|
|
5536
5593
|
Object.defineProperty(exports, "createDomain", {
|
|
5537
5594
|
enumerable: true,
|
|
5538
|
-
get: function () { return
|
|
5595
|
+
get: function () { return chunkVNECVPMU_cjs.createDomain; }
|
|
5539
5596
|
});
|
|
5540
5597
|
Object.defineProperty(exports, "createHostedAuthPendingStorageKey", {
|
|
5541
5598
|
enumerable: true,
|
|
5542
|
-
get: function () { return
|
|
5599
|
+
get: function () { return chunkVNECVPMU_cjs.createHostedAuthPendingStorageKey; }
|
|
5543
5600
|
});
|
|
5544
5601
|
Object.defineProperty(exports, "createHostedAuthState", {
|
|
5545
5602
|
enumerable: true,
|
|
5546
|
-
get: function () { return
|
|
5603
|
+
get: function () { return chunkVNECVPMU_cjs.createHostedAuthState; }
|
|
5547
5604
|
});
|
|
5548
5605
|
Object.defineProperty(exports, "createHostedAuthStorageKey", {
|
|
5549
5606
|
enumerable: true,
|
|
5550
|
-
get: function () { return
|
|
5607
|
+
get: function () { return chunkVNECVPMU_cjs.createHostedAuthStorageKey; }
|
|
5551
5608
|
});
|
|
5552
5609
|
Object.defineProperty(exports, "createLockExpiry", {
|
|
5553
5610
|
enumerable: true,
|
|
5554
|
-
get: function () { return
|
|
5611
|
+
get: function () { return chunkVNECVPMU_cjs.createLockExpiry; }
|
|
5555
5612
|
});
|
|
5556
5613
|
Object.defineProperty(exports, "createPkceChallenge", {
|
|
5557
5614
|
enumerable: true,
|
|
5558
|
-
get: function () { return
|
|
5615
|
+
get: function () { return chunkVNECVPMU_cjs.createPkceChallenge; }
|
|
5559
5616
|
});
|
|
5560
5617
|
Object.defineProperty(exports, "createPkceVerifier", {
|
|
5561
5618
|
enumerable: true,
|
|
5562
|
-
get: function () { return
|
|
5619
|
+
get: function () { return chunkVNECVPMU_cjs.createPkceVerifier; }
|
|
5563
5620
|
});
|
|
5564
5621
|
Object.defineProperty(exports, "createSignedLockRequest", {
|
|
5565
5622
|
enumerable: true,
|
|
5566
|
-
get: function () { return
|
|
5623
|
+
get: function () { return chunkVNECVPMU_cjs.createSignedLockRequest; }
|
|
5567
5624
|
});
|
|
5568
5625
|
Object.defineProperty(exports, "getAccountingContract", {
|
|
5569
5626
|
enumerable: true,
|
|
5570
|
-
get: function () { return
|
|
5627
|
+
get: function () { return chunkVNECVPMU_cjs.getAccountingContract; }
|
|
5571
5628
|
});
|
|
5572
5629
|
Object.defineProperty(exports, "getApiUrl", {
|
|
5573
5630
|
enumerable: true,
|
|
5574
|
-
get: function () { return
|
|
5631
|
+
get: function () { return chunkVNECVPMU_cjs.getApiUrl; }
|
|
5575
5632
|
});
|
|
5576
5633
|
Object.defineProperty(exports, "getChainById", {
|
|
5577
5634
|
enumerable: true,
|
|
5578
|
-
get: function () { return
|
|
5635
|
+
get: function () { return chunkVNECVPMU_cjs.getChainById; }
|
|
5579
5636
|
});
|
|
5580
5637
|
Object.defineProperty(exports, "getChainId", {
|
|
5581
5638
|
enumerable: true,
|
|
5582
|
-
get: function () { return
|
|
5639
|
+
get: function () { return chunkVNECVPMU_cjs.getChainId; }
|
|
5583
5640
|
});
|
|
5584
5641
|
Object.defineProperty(exports, "getExplorerAddressUrl", {
|
|
5585
5642
|
enumerable: true,
|
|
5586
|
-
get: function () { return
|
|
5643
|
+
get: function () { return chunkVNECVPMU_cjs.getExplorerAddressUrl; }
|
|
5587
5644
|
});
|
|
5588
5645
|
Object.defineProperty(exports, "getExplorerLabel", {
|
|
5589
5646
|
enumerable: true,
|
|
5590
|
-
get: function () { return
|
|
5647
|
+
get: function () { return chunkVNECVPMU_cjs.getExplorerLabel; }
|
|
5591
5648
|
});
|
|
5592
5649
|
Object.defineProperty(exports, "isHostedAuthRefreshActive", {
|
|
5593
5650
|
enumerable: true,
|
|
5594
|
-
get: function () { return
|
|
5651
|
+
get: function () { return chunkVNECVPMU_cjs.isHostedAuthRefreshActive; }
|
|
5595
5652
|
});
|
|
5596
5653
|
Object.defineProperty(exports, "isHostedAuthSessionActive", {
|
|
5597
5654
|
enumerable: true,
|
|
5598
|
-
get: function () { return
|
|
5655
|
+
get: function () { return chunkVNECVPMU_cjs.isHostedAuthSessionActive; }
|
|
5599
5656
|
});
|
|
5600
5657
|
Object.defineProperty(exports, "isSignedLockUsable", {
|
|
5601
5658
|
enumerable: true,
|
|
5602
|
-
get: function () { return
|
|
5659
|
+
get: function () { return chunkVNECVPMU_cjs.isSignedLockUsable; }
|
|
5603
5660
|
});
|
|
5604
5661
|
Object.defineProperty(exports, "loadPendingLock", {
|
|
5605
5662
|
enumerable: true,
|
|
5606
|
-
get: function () { return
|
|
5663
|
+
get: function () { return chunkVNECVPMU_cjs.loadPendingLock; }
|
|
5607
5664
|
});
|
|
5608
5665
|
Object.defineProperty(exports, "normalizeAddress", {
|
|
5609
5666
|
enumerable: true,
|
|
5610
|
-
get: function () { return
|
|
5667
|
+
get: function () { return chunkVNECVPMU_cjs.normalizeAddress; }
|
|
5611
5668
|
});
|
|
5612
5669
|
Object.defineProperty(exports, "normalizeHex", {
|
|
5613
5670
|
enumerable: true,
|
|
5614
|
-
get: function () { return
|
|
5671
|
+
get: function () { return chunkVNECVPMU_cjs.normalizeHex; }
|
|
5615
5672
|
});
|
|
5616
5673
|
Object.defineProperty(exports, "parseHostedAuthCallback", {
|
|
5617
5674
|
enumerable: true,
|
|
5618
|
-
get: function () { return
|
|
5675
|
+
get: function () { return chunkVNECVPMU_cjs.parseHostedAuthCallback; }
|
|
5619
5676
|
});
|
|
5620
5677
|
Object.defineProperty(exports, "persistHostedAuthPendingTransaction", {
|
|
5621
5678
|
enumerable: true,
|
|
5622
|
-
get: function () { return
|
|
5679
|
+
get: function () { return chunkVNECVPMU_cjs.persistHostedAuthPendingTransaction; }
|
|
5623
5680
|
});
|
|
5624
5681
|
Object.defineProperty(exports, "readHostedAuthPendingTransaction", {
|
|
5625
5682
|
enumerable: true,
|
|
5626
|
-
get: function () { return
|
|
5683
|
+
get: function () { return chunkVNECVPMU_cjs.readHostedAuthPendingTransaction; }
|
|
5627
5684
|
});
|
|
5628
5685
|
Object.defineProperty(exports, "readStoredHostedAuthSession", {
|
|
5629
5686
|
enumerable: true,
|
|
5630
|
-
get: function () { return
|
|
5687
|
+
get: function () { return chunkVNECVPMU_cjs.readStoredHostedAuthSession; }
|
|
5631
5688
|
});
|
|
5632
5689
|
Object.defineProperty(exports, "requireDepositLockOwner", {
|
|
5633
5690
|
enumerable: true,
|
|
5634
|
-
get: function () { return
|
|
5691
|
+
get: function () { return chunkVNECVPMU_cjs.requireDepositLockOwner; }
|
|
5635
5692
|
});
|
|
5636
5693
|
Object.defineProperty(exports, "requireServiceAddress", {
|
|
5637
5694
|
enumerable: true,
|
|
5638
|
-
get: function () { return
|
|
5695
|
+
get: function () { return chunkVNECVPMU_cjs.requireServiceAddress; }
|
|
5639
5696
|
});
|
|
5640
5697
|
Object.defineProperty(exports, "savePendingLock", {
|
|
5641
5698
|
enumerable: true,
|
|
5642
|
-
get: function () { return
|
|
5699
|
+
get: function () { return chunkVNECVPMU_cjs.savePendingLock; }
|
|
5643
5700
|
});
|
|
5644
5701
|
Object.defineProperty(exports, "signLockMessage", {
|
|
5645
5702
|
enumerable: true,
|
|
5646
|
-
get: function () { return
|
|
5703
|
+
get: function () { return chunkVNECVPMU_cjs.signLockMessage; }
|
|
5647
5704
|
});
|
|
5648
5705
|
Object.defineProperty(exports, "signModifyLockMessage", {
|
|
5649
5706
|
enumerable: true,
|
|
5650
|
-
get: function () { return
|
|
5707
|
+
get: function () { return chunkVNECVPMU_cjs.signModifyLockMessage; }
|
|
5651
5708
|
});
|
|
5652
5709
|
Object.defineProperty(exports, "signTransferLockedMessage", {
|
|
5653
5710
|
enumerable: true,
|
|
5654
|
-
get: function () { return
|
|
5711
|
+
get: function () { return chunkVNECVPMU_cjs.signTransferLockedMessage; }
|
|
5655
5712
|
});
|
|
5656
5713
|
Object.defineProperty(exports, "signTransferMessage", {
|
|
5657
5714
|
enumerable: true,
|
|
5658
|
-
get: function () { return
|
|
5715
|
+
get: function () { return chunkVNECVPMU_cjs.signTransferMessage; }
|
|
5659
5716
|
});
|
|
5660
5717
|
Object.defineProperty(exports, "signWithdrawFromLockMessage", {
|
|
5661
5718
|
enumerable: true,
|
|
5662
|
-
get: function () { return
|
|
5719
|
+
get: function () { return chunkVNECVPMU_cjs.signWithdrawFromLockMessage; }
|
|
5663
5720
|
});
|
|
5664
5721
|
Object.defineProperty(exports, "signWithdrawMessage", {
|
|
5665
5722
|
enumerable: true,
|
|
5666
|
-
get: function () { return
|
|
5723
|
+
get: function () { return chunkVNECVPMU_cjs.signWithdrawMessage; }
|
|
5667
5724
|
});
|
|
5668
5725
|
Object.defineProperty(exports, "stripHostedAuthCallbackParams", {
|
|
5669
5726
|
enumerable: true,
|
|
5670
|
-
get: function () { return
|
|
5727
|
+
get: function () { return chunkVNECVPMU_cjs.stripHostedAuthCallbackParams; }
|
|
5671
5728
|
});
|
|
5672
5729
|
Object.defineProperty(exports, "submitPendingLock", {
|
|
5673
5730
|
enumerable: true,
|
|
5674
|
-
get: function () { return
|
|
5731
|
+
get: function () { return chunkVNECVPMU_cjs.submitPendingLock; }
|
|
5675
5732
|
});
|
|
5676
5733
|
Object.defineProperty(exports, "syncHostedAuthSessionToClient", {
|
|
5677
5734
|
enumerable: true,
|
|
5678
|
-
get: function () { return
|
|
5735
|
+
get: function () { return chunkVNECVPMU_cjs.syncHostedAuthSessionToClient; }
|
|
5679
5736
|
});
|
|
5680
5737
|
Object.defineProperty(exports, "useDepositVerification", {
|
|
5681
5738
|
enumerable: true,
|
|
5682
|
-
get: function () { return
|
|
5739
|
+
get: function () { return chunkVNECVPMU_cjs.useDepositVerification; }
|
|
5683
5740
|
});
|
|
5684
5741
|
Object.defineProperty(exports, "usePrivanaContext", {
|
|
5685
5742
|
enumerable: true,
|
|
5686
|
-
get: function () { return
|
|
5743
|
+
get: function () { return chunkVNECVPMU_cjs.usePrivanaContext; }
|
|
5687
5744
|
});
|
|
5688
5745
|
Object.defineProperty(exports, "useSafeAccount", {
|
|
5689
5746
|
enumerable: true,
|
|
5690
|
-
get: function () { return
|
|
5747
|
+
get: function () { return chunkVNECVPMU_cjs.useSafeAccount; }
|
|
5691
5748
|
});
|
|
5692
5749
|
Object.defineProperty(exports, "useSafePrivanaContext", {
|
|
5693
5750
|
enumerable: true,
|
|
5694
|
-
get: function () { return
|
|
5751
|
+
get: function () { return chunkVNECVPMU_cjs.useSafePrivanaContext; }
|
|
5695
5752
|
});
|
|
5696
5753
|
Object.defineProperty(exports, "useSiweAuth", {
|
|
5697
5754
|
enumerable: true,
|
|
5698
|
-
get: function () { return
|
|
5755
|
+
get: function () { return chunkVNECVPMU_cjs.useSiweAuth; }
|
|
5699
5756
|
});
|
|
5700
5757
|
exports.DepositInlineModal = DepositInlineModal;
|
|
5701
5758
|
exports.DepositModal = DepositModal;
|
|
@@ -5705,6 +5762,7 @@ exports.WalletModal = WalletModal;
|
|
|
5705
5762
|
exports.WithdrawInlineModal = WithdrawInlineModal;
|
|
5706
5763
|
exports.WithdrawModal = WithdrawModal;
|
|
5707
5764
|
exports.getChainIcon = getChainIcon;
|
|
5765
|
+
exports.getMinDepositBaseUnits = getMinDepositBaseUnits;
|
|
5708
5766
|
exports.getTokenIcon = getTokenIcon;
|
|
5709
5767
|
exports.useBalance = useBalance;
|
|
5710
5768
|
exports.useBatchBalances = useBatchBalances;
|