@oasisprotocol/privana-sdk 0.5.8 → 0.5.10
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-EXFISDHQ.cjs → chunk-KCXYYUUG.cjs} +7 -6
- package/dist/chunk-KCXYYUUG.cjs.map +1 -0
- package/dist/{chunk-ONXJGUOH.js → chunk-RDYNQUMV.js} +7 -6
- package/dist/chunk-RDYNQUMV.js.map +1 -0
- package/dist/index.cjs +290 -277
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +32 -19
- package/dist/index.js.map +1 -1
- package/dist/on-ramp.cjs +5 -5
- package/dist/on-ramp.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-EXFISDHQ.cjs.map +0 -1
- package/dist/chunk-ONXJGUOH.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 chunkKCXYYUUG_cjs = require('./chunk-KCXYYUUG.cjs');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var reactQuery = require('@tanstack/react-query');
|
|
7
7
|
var wagmi = require('wagmi');
|
|
@@ -35,18 +35,18 @@ var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive)
|
|
|
35
35
|
|
|
36
36
|
// src/sdk/hooks/use-privana-client.ts
|
|
37
37
|
function usePrivanaClient() {
|
|
38
|
-
const { client } =
|
|
38
|
+
const { client } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
39
39
|
return client;
|
|
40
40
|
}
|
|
41
41
|
var hostedAuthExchangeInflight = /* @__PURE__ */ new Map();
|
|
42
42
|
function normalizeHostedAuthError(error) {
|
|
43
|
-
if (error instanceof
|
|
44
|
-
return new
|
|
43
|
+
if (error instanceof chunkKCXYYUUG_cjs.AccountingApiError && error.detail) {
|
|
44
|
+
return new chunkKCXYYUUG_cjs.HostedAuthError(error.detail);
|
|
45
45
|
}
|
|
46
46
|
if (error instanceof Error) {
|
|
47
47
|
return error;
|
|
48
48
|
}
|
|
49
|
-
return new
|
|
49
|
+
return new chunkKCXYYUUG_cjs.HostedAuthError("Hosted authentication failed.");
|
|
50
50
|
}
|
|
51
51
|
function useHostedRedirectAuth() {
|
|
52
52
|
const {
|
|
@@ -57,30 +57,30 @@ function useHostedRedirectAuth() {
|
|
|
57
57
|
setHostedAuthSession,
|
|
58
58
|
clearHostedAuthSession,
|
|
59
59
|
refreshHostedAuthSession
|
|
60
|
-
} =
|
|
60
|
+
} = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
61
61
|
const [error, setError] = react.useState(null);
|
|
62
62
|
const [isLoading, setIsLoading] = react.useState(false);
|
|
63
63
|
const loginInflight = react.useRef(null);
|
|
64
64
|
const completionInflight = react.useRef(null);
|
|
65
65
|
const pendingStorageKey = react.useMemo(
|
|
66
|
-
() => hostedAuthConfig ?
|
|
66
|
+
() => hostedAuthConfig ? chunkKCXYYUUG_cjs.createHostedAuthPendingStorageKey(client.getBaseUrl(), hostedAuthConfig) : null,
|
|
67
67
|
[client, hostedAuthConfig]
|
|
68
68
|
);
|
|
69
69
|
const clearPendingLogin = react.useCallback(() => {
|
|
70
70
|
if (!pendingStorageKey || typeof window === "undefined") return;
|
|
71
|
-
|
|
71
|
+
chunkKCXYYUUG_cjs.clearHostedAuthPendingTransaction(window.sessionStorage, pendingStorageKey);
|
|
72
72
|
}, [pendingStorageKey]);
|
|
73
73
|
const login = react.useCallback(async () => {
|
|
74
74
|
if (!hostedAuthConfig) {
|
|
75
|
-
throw new
|
|
75
|
+
throw new chunkKCXYYUUG_cjs.HostedAuthRequiredError(
|
|
76
76
|
"Hosted redirect authentication is not configured for this provider."
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
if (typeof window === "undefined") {
|
|
80
|
-
throw new
|
|
80
|
+
throw new chunkKCXYYUUG_cjs.HostedAuthError("Hosted redirect authentication requires a browser environment.");
|
|
81
81
|
}
|
|
82
82
|
if (!pendingStorageKey) {
|
|
83
|
-
throw new
|
|
83
|
+
throw new chunkKCXYYUUG_cjs.HostedAuthError("Hosted redirect authentication storage is not configured.");
|
|
84
84
|
}
|
|
85
85
|
if (loginInflight.current) {
|
|
86
86
|
return loginInflight.current;
|
|
@@ -89,10 +89,10 @@ function useHostedRedirectAuth() {
|
|
|
89
89
|
setIsLoading(true);
|
|
90
90
|
setError(null);
|
|
91
91
|
try {
|
|
92
|
-
const verifier =
|
|
93
|
-
const codeChallenge = await
|
|
94
|
-
const state =
|
|
95
|
-
|
|
92
|
+
const verifier = chunkKCXYYUUG_cjs.createPkceVerifier();
|
|
93
|
+
const codeChallenge = await chunkKCXYYUUG_cjs.createPkceChallenge(verifier);
|
|
94
|
+
const state = chunkKCXYYUUG_cjs.createHostedAuthState();
|
|
95
|
+
chunkKCXYYUUG_cjs.persistHostedAuthPendingTransaction(window.sessionStorage, pendingStorageKey, {
|
|
96
96
|
codeVerifier: verifier,
|
|
97
97
|
state
|
|
98
98
|
});
|
|
@@ -121,15 +121,15 @@ function useHostedRedirectAuth() {
|
|
|
121
121
|
}, [clearPendingLogin, client, hostedAuthConfig, networkConfig.chainId, pendingStorageKey]);
|
|
122
122
|
const completeLogin = react.useCallback(async () => {
|
|
123
123
|
if (!hostedAuthConfig) {
|
|
124
|
-
throw new
|
|
124
|
+
throw new chunkKCXYYUUG_cjs.HostedAuthRequiredError(
|
|
125
125
|
"Hosted redirect authentication is not configured for this provider."
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
128
|
if (typeof window === "undefined") {
|
|
129
|
-
throw new
|
|
129
|
+
throw new chunkKCXYYUUG_cjs.HostedAuthError("Hosted redirect authentication requires a browser environment.");
|
|
130
130
|
}
|
|
131
131
|
if (!pendingStorageKey) {
|
|
132
|
-
throw new
|
|
132
|
+
throw new chunkKCXYYUUG_cjs.HostedAuthError("Hosted redirect authentication storage is not configured.");
|
|
133
133
|
}
|
|
134
134
|
if (completionInflight.current) {
|
|
135
135
|
return completionInflight.current;
|
|
@@ -139,30 +139,30 @@ function useHostedRedirectAuth() {
|
|
|
139
139
|
setError(null);
|
|
140
140
|
const callbackUrl = new URL(window.location.href);
|
|
141
141
|
const cleanupCallbackUrl = () => {
|
|
142
|
-
window.history.replaceState(null, "",
|
|
142
|
+
window.history.replaceState(null, "", chunkKCXYYUUG_cjs.stripHostedAuthCallbackParams(callbackUrl));
|
|
143
143
|
};
|
|
144
144
|
try {
|
|
145
|
-
const callback =
|
|
145
|
+
const callback = chunkKCXYYUUG_cjs.parseHostedAuthCallback(callbackUrl, hostedAuthConfig.redirectUri);
|
|
146
146
|
if (!callback) {
|
|
147
147
|
return null;
|
|
148
148
|
}
|
|
149
|
-
const pending =
|
|
149
|
+
const pending = chunkKCXYYUUG_cjs.readHostedAuthPendingTransaction(window.sessionStorage, pendingStorageKey);
|
|
150
150
|
if (!pending) {
|
|
151
151
|
clearPendingLogin();
|
|
152
152
|
cleanupCallbackUrl();
|
|
153
|
-
throw new
|
|
153
|
+
throw new chunkKCXYYUUG_cjs.HostedAuthError(
|
|
154
154
|
"Hosted authentication response could not be matched to a pending login request."
|
|
155
155
|
);
|
|
156
156
|
}
|
|
157
157
|
if (!callback.state || callback.state !== pending.state) {
|
|
158
158
|
clearPendingLogin();
|
|
159
159
|
cleanupCallbackUrl();
|
|
160
|
-
throw new
|
|
160
|
+
throw new chunkKCXYYUUG_cjs.HostedAuthStateMismatchError();
|
|
161
161
|
}
|
|
162
162
|
if ("error" in callback) {
|
|
163
163
|
clearPendingLogin();
|
|
164
164
|
cleanupCallbackUrl();
|
|
165
|
-
throw new
|
|
165
|
+
throw new chunkKCXYYUUG_cjs.HostedAuthError(
|
|
166
166
|
callback.errorDescription || callback.error || "Hosted authentication failed."
|
|
167
167
|
);
|
|
168
168
|
}
|
|
@@ -177,7 +177,7 @@ function useHostedRedirectAuth() {
|
|
|
177
177
|
client_id: hostedAuthConfig.clientId,
|
|
178
178
|
redirect_uri: hostedAuthConfig.redirectUri
|
|
179
179
|
});
|
|
180
|
-
const session =
|
|
180
|
+
const session = chunkKCXYYUUG_cjs.buildHostedAuthSession(response, hostedAuthConfig);
|
|
181
181
|
setHostedAuthSession(session);
|
|
182
182
|
clearPendingLogin();
|
|
183
183
|
cleanupCallbackUrl();
|
|
@@ -222,7 +222,7 @@ function useHostedRedirectAuth() {
|
|
|
222
222
|
try {
|
|
223
223
|
return await refreshHostedAuthSession();
|
|
224
224
|
} catch (refreshError) {
|
|
225
|
-
const normalizedError = refreshError instanceof Error ? refreshError : new
|
|
225
|
+
const normalizedError = refreshError instanceof Error ? refreshError : new chunkKCXYYUUG_cjs.HostedAuthError("Hosted authentication refresh failed.");
|
|
226
226
|
setError(normalizedError);
|
|
227
227
|
throw normalizedError;
|
|
228
228
|
} finally {
|
|
@@ -242,12 +242,12 @@ function useHostedRedirectAuth() {
|
|
|
242
242
|
}
|
|
243
243
|
function useBalance(options = {}) {
|
|
244
244
|
const queryClient = react.useContext(reactQuery.QueryClientContext);
|
|
245
|
-
const accountingContext =
|
|
245
|
+
const accountingContext = chunkKCXYYUUG_cjs.useSafePrivanaContext();
|
|
246
246
|
const hasProviders = !!queryClient && !!accountingContext;
|
|
247
247
|
const client = accountingContext?.client;
|
|
248
248
|
const defaultToken = accountingContext?.defaultToken;
|
|
249
249
|
const pollingInterval = accountingContext?.pollingInterval ?? 1e4;
|
|
250
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
250
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
251
251
|
const tokenId = options.tokenId ?? defaultToken?.id;
|
|
252
252
|
const query = reactQuery.useQuery({
|
|
253
253
|
queryKey: ["accounting-balance", ...privateReadQueryScope, tokenId],
|
|
@@ -264,7 +264,7 @@ function useBalance(options = {}) {
|
|
|
264
264
|
return {
|
|
265
265
|
balance: balanceWei,
|
|
266
266
|
balanceWei,
|
|
267
|
-
balanceFormatted:
|
|
267
|
+
balanceFormatted: chunkKCXYYUUG_cjs.formatTokenAmount(balanceWei),
|
|
268
268
|
tokenSymbol: query.data?.token_symbol ?? "",
|
|
269
269
|
chainId: query.data?.chain_id ?? "",
|
|
270
270
|
isLoading: query.isPending || query.isLoading,
|
|
@@ -274,8 +274,8 @@ function useBalance(options = {}) {
|
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
276
|
function useBatchBalances(options) {
|
|
277
|
-
const { client, pollingInterval } =
|
|
278
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
277
|
+
const { client, pollingInterval } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
278
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
279
279
|
const query = reactQuery.useQuery({
|
|
280
280
|
queryKey: ["accounting-batch-balances", ...privateReadQueryScope, options.tokenIds],
|
|
281
281
|
queryFn: async () => {
|
|
@@ -307,17 +307,17 @@ function storageKey(address) {
|
|
|
307
307
|
return `privana:pending-deposit:${address.toLowerCase()}`;
|
|
308
308
|
}
|
|
309
309
|
function savePendingDeposit(address, data) {
|
|
310
|
-
const stored =
|
|
310
|
+
const stored = chunkKCXYYUUG_cjs.setBrowserStorageItem(storageKey(address), JSON.stringify(data));
|
|
311
311
|
if (!stored && data.signedLock) {
|
|
312
312
|
throw new Error("Unable to persist pending locked deposit for recovery");
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
function loadPendingDeposit(address) {
|
|
316
316
|
try {
|
|
317
|
-
const raw =
|
|
317
|
+
const raw = chunkKCXYYUUG_cjs.getBrowserStorageItem(storageKey(address));
|
|
318
318
|
if (!raw) return null;
|
|
319
319
|
const data = JSON.parse(raw);
|
|
320
|
-
if (Date.now() - data.savedAt > STALE_MS && !(data.signedLock &&
|
|
320
|
+
if (Date.now() - data.savedAt > STALE_MS && !(data.signedLock && chunkKCXYYUUG_cjs.isSignedLockUsable(data.signedLock))) {
|
|
321
321
|
clearPendingDeposit(address);
|
|
322
322
|
return null;
|
|
323
323
|
}
|
|
@@ -329,21 +329,21 @@ function loadPendingDeposit(address) {
|
|
|
329
329
|
function clearPendingDeposit(address, onlyForTxHash) {
|
|
330
330
|
if (onlyForTxHash) {
|
|
331
331
|
try {
|
|
332
|
-
const raw =
|
|
332
|
+
const raw = chunkKCXYYUUG_cjs.getBrowserStorageItem(storageKey(address));
|
|
333
333
|
const recordTxHash = raw ? JSON.parse(raw).txHash : void 0;
|
|
334
334
|
if (recordTxHash && recordTxHash !== onlyForTxHash) return;
|
|
335
335
|
} catch {
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
|
-
|
|
338
|
+
chunkKCXYYUUG_cjs.removeBrowserStorageItem(storageKey(address));
|
|
339
339
|
}
|
|
340
340
|
function useDeposit(options = {}) {
|
|
341
341
|
const { address } = wagmi.useAccount();
|
|
342
|
-
const { client, enabledTokens, getChainById: getChainById2, networkConfig, serviceAddress } =
|
|
342
|
+
const { client, enabledTokens, getChainById: getChainById2, networkConfig, serviceAddress } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
343
343
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
344
344
|
const queryClient = reactQuery.useQueryClient();
|
|
345
345
|
const config = wagmi.useConfig();
|
|
346
|
-
const { executePrivateRead, privateReadAddress } =
|
|
346
|
+
const { executePrivateRead, privateReadAddress } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
347
347
|
const privateReadAddressRef = react.useRef(privateReadAddress);
|
|
348
348
|
privateReadAddressRef.current = privateReadAddress;
|
|
349
349
|
const [depositAddress, setDepositAddress] = react.useState(null);
|
|
@@ -382,7 +382,7 @@ function useDeposit(options = {}) {
|
|
|
382
382
|
const submitPendingLockAfterCredit = react.useCallback(
|
|
383
383
|
async (signedLock, creditedAmount) => {
|
|
384
384
|
try {
|
|
385
|
-
const result = await
|
|
385
|
+
const result = await chunkKCXYYUUG_cjs.submitPendingLock({
|
|
386
386
|
client,
|
|
387
387
|
payload: signedLock,
|
|
388
388
|
creditedAmount
|
|
@@ -393,7 +393,7 @@ function useDeposit(options = {}) {
|
|
|
393
393
|
queryClient.invalidateQueries({ queryKey: ["accounting-history"] });
|
|
394
394
|
onLockSubmittedRef.current?.(result);
|
|
395
395
|
} catch (err) {
|
|
396
|
-
const error2 = err instanceof
|
|
396
|
+
const error2 = err instanceof chunkKCXYYUUG_cjs.PostDepositLockError ? err : new chunkKCXYYUUG_cjs.PostDepositLockError(
|
|
397
397
|
err instanceof Error ? err.message : "Lock submission failed",
|
|
398
398
|
"submission-failed",
|
|
399
399
|
BigInt(signedLock.amount),
|
|
@@ -412,7 +412,7 @@ function useDeposit(options = {}) {
|
|
|
412
412
|
error: verificationError,
|
|
413
413
|
verify,
|
|
414
414
|
reset: resetVerification
|
|
415
|
-
} =
|
|
415
|
+
} = chunkKCXYYUUG_cjs.useDepositVerification({
|
|
416
416
|
pollInterval: options.pollInterval,
|
|
417
417
|
pollTimeout: options.pollTimeout,
|
|
418
418
|
onCredited: (hash, response, creditedAmount) => {
|
|
@@ -462,7 +462,7 @@ function useDeposit(options = {}) {
|
|
|
462
462
|
} = wagmi.useSendTransaction();
|
|
463
463
|
const isSendingTx = isWritingContract || isSendingNative;
|
|
464
464
|
const sendError = writeError ?? sendNativeError;
|
|
465
|
-
const { ensureCorrectChain } =
|
|
465
|
+
const { ensureCorrectChain } = chunkKCXYYUUG_cjs.useEnsureCorrectChain();
|
|
466
466
|
const invalidateGeneration = react.useCallback(() => {
|
|
467
467
|
generationRef.current++;
|
|
468
468
|
}, []);
|
|
@@ -511,16 +511,16 @@ function useDeposit(options = {}) {
|
|
|
511
511
|
const confirmations = resolveConfirmations(persisted.depositAddress, persisted.chainId);
|
|
512
512
|
let confirmed = false;
|
|
513
513
|
try {
|
|
514
|
-
const receipt = await
|
|
514
|
+
const receipt = await chunkKCXYYUUG_cjs.getTransactionReceipt(config, {
|
|
515
515
|
hash,
|
|
516
516
|
chainId: persisted.chainId
|
|
517
517
|
});
|
|
518
|
-
const blockNumber = await
|
|
518
|
+
const blockNumber = await chunkKCXYYUUG_cjs.getBlockNumber(config, { chainId: persisted.chainId });
|
|
519
519
|
confirmed = blockNumber - receipt.blockNumber + 1n >= BigInt(confirmations);
|
|
520
520
|
} catch {
|
|
521
521
|
}
|
|
522
522
|
if (!confirmed) {
|
|
523
|
-
await
|
|
523
|
+
await chunkKCXYYUUG_cjs.waitForTransactionReceipt(config, {
|
|
524
524
|
hash,
|
|
525
525
|
chainId: persisted.chainId,
|
|
526
526
|
confirmations
|
|
@@ -572,13 +572,13 @@ function useDeposit(options = {}) {
|
|
|
572
572
|
);
|
|
573
573
|
}
|
|
574
574
|
const confirmations = resolveConfirmations(addrResponse, sourceChain.id);
|
|
575
|
-
if (params.postDepositLock && !
|
|
575
|
+
if (params.postDepositLock && !chunkKCXYYUUG_cjs.canUseBrowserStorage()) {
|
|
576
576
|
throw new Error("Browser storage is required for locked deposit recovery");
|
|
577
577
|
}
|
|
578
|
-
const lockAmount =
|
|
578
|
+
const lockAmount = chunkKCXYYUUG_cjs.clampLockAmount(params.amount, params.postDepositLock?.maxAmount);
|
|
579
579
|
let signedLock;
|
|
580
580
|
if (params.postDepositLock) {
|
|
581
|
-
const lockOwner =
|
|
581
|
+
const lockOwner = chunkKCXYYUUG_cjs.requireDepositLockOwner(address, privateReadAddress);
|
|
582
582
|
setIsSwitchingChain(true);
|
|
583
583
|
try {
|
|
584
584
|
await ensureCorrectChain(networkConfig.chainId);
|
|
@@ -586,15 +586,15 @@ function useDeposit(options = {}) {
|
|
|
586
586
|
if (!isStale()) setIsSwitchingChain(false);
|
|
587
587
|
}
|
|
588
588
|
if (isStale()) return;
|
|
589
|
-
const signingWalletClient = await
|
|
589
|
+
const signingWalletClient = await chunkKCXYYUUG_cjs.getWalletClient(config, {
|
|
590
590
|
chainId: networkConfig.chainId
|
|
591
591
|
});
|
|
592
|
-
signedLock = await
|
|
592
|
+
signedLock = await chunkKCXYYUUG_cjs.createSignedLockRequest({
|
|
593
593
|
client,
|
|
594
594
|
walletClient: signingWalletClient,
|
|
595
595
|
userAddress: lockOwner,
|
|
596
596
|
networkConfig,
|
|
597
|
-
serviceAddress:
|
|
597
|
+
serviceAddress: chunkKCXYYUUG_cjs.requireServiceAddress(
|
|
598
598
|
params.postDepositLock.serviceAddress ?? serviceAddress
|
|
599
599
|
),
|
|
600
600
|
tokenId: params.tokenId,
|
|
@@ -648,7 +648,7 @@ function useDeposit(options = {}) {
|
|
|
648
648
|
try {
|
|
649
649
|
setIsWaitingForConfirmation(true);
|
|
650
650
|
try {
|
|
651
|
-
await
|
|
651
|
+
await chunkKCXYYUUG_cjs.waitForTransactionReceipt(config, {
|
|
652
652
|
hash,
|
|
653
653
|
chainId: sourceChain.id,
|
|
654
654
|
confirmations
|
|
@@ -724,10 +724,10 @@ function useDeposit(options = {}) {
|
|
|
724
724
|
}
|
|
725
725
|
function useDepositAddress(options = {}) {
|
|
726
726
|
const queryClient = react.useContext(reactQuery.QueryClientContext);
|
|
727
|
-
const accountingContext =
|
|
727
|
+
const accountingContext = chunkKCXYYUUG_cjs.useSafePrivanaContext();
|
|
728
728
|
const hasProviders = !!queryClient && !!accountingContext;
|
|
729
729
|
const client = accountingContext?.client;
|
|
730
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
730
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
731
731
|
const isReady = hasProviders && privateReadReady && !!privateReadAddress && !!client;
|
|
732
732
|
const query = reactQuery.useQuery({
|
|
733
733
|
queryKey: ["accounting-deposit-address", ...privateReadQueryScope],
|
|
@@ -751,9 +751,9 @@ function useDepositAddress(options = {}) {
|
|
|
751
751
|
function useWithdraw(options = {}) {
|
|
752
752
|
const { address } = wagmi.useAccount();
|
|
753
753
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
754
|
-
const { client, networkConfig } =
|
|
754
|
+
const { client, networkConfig } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
755
755
|
const queryClient = reactQuery.useQueryClient();
|
|
756
|
-
const { chainId, ensureCorrectChain } =
|
|
756
|
+
const { chainId, ensureCorrectChain } = chunkKCXYYUUG_cjs.useEnsureCorrectChain();
|
|
757
757
|
const pollInterval = options.pollInterval ?? 3e3;
|
|
758
758
|
const pollTimeout = options.pollTimeout ?? 18e4;
|
|
759
759
|
const [currentStep, setCurrentStep] = react.useState("idle");
|
|
@@ -809,6 +809,7 @@ function useWithdraw(options = {}) {
|
|
|
809
809
|
const isStale = () => generation !== generationRef.current;
|
|
810
810
|
try {
|
|
811
811
|
if (!address || !walletClient) throw new Error("Wallet not connected");
|
|
812
|
+
setCurrentStep("preparing");
|
|
812
813
|
const pendingResponse = await client.getPendingWithdrawals(address);
|
|
813
814
|
if (isStale()) return void 0;
|
|
814
815
|
const knownIndices = new Set(pendingResponse.pending_withdrawals.map((w) => w.index));
|
|
@@ -821,7 +822,7 @@ function useWithdraw(options = {}) {
|
|
|
821
822
|
if (isStale()) return void 0;
|
|
822
823
|
const nonce = BigInt(nonceResponse.nonce);
|
|
823
824
|
setCurrentStep("signing");
|
|
824
|
-
const signature = await
|
|
825
|
+
const signature = await chunkKCXYYUUG_cjs.signWithdrawMessage({
|
|
825
826
|
walletClient,
|
|
826
827
|
chainId: signingChainId,
|
|
827
828
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -950,7 +951,7 @@ function useWithdraw(options = {}) {
|
|
|
950
951
|
function useLockFunds(options = {}) {
|
|
951
952
|
const { address } = wagmi.useAccount();
|
|
952
953
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
953
|
-
const { client, networkConfig, serviceAddress } =
|
|
954
|
+
const { client, networkConfig, serviceAddress } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
954
955
|
const queryClient = reactQuery.useQueryClient();
|
|
955
956
|
const mutation = reactQuery.useMutation({
|
|
956
957
|
mutationFn: async (params) => {
|
|
@@ -961,7 +962,7 @@ function useLockFunds(options = {}) {
|
|
|
961
962
|
throw new Error("Service address not configured");
|
|
962
963
|
}
|
|
963
964
|
const { nonce } = await client.getLockNonce(address);
|
|
964
|
-
const signature = await
|
|
965
|
+
const signature = await chunkKCXYYUUG_cjs.signLockMessage({
|
|
965
966
|
walletClient,
|
|
966
967
|
chainId: networkConfig.chainId,
|
|
967
968
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1009,7 +1010,7 @@ function useLockFunds(options = {}) {
|
|
|
1009
1010
|
}
|
|
1010
1011
|
function useUnlockFunds(options = {}) {
|
|
1011
1012
|
const { address } = wagmi.useAccount();
|
|
1012
|
-
const { client } =
|
|
1013
|
+
const { client } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1013
1014
|
const queryClient = reactQuery.useQueryClient();
|
|
1014
1015
|
const unlockMutation = reactQuery.useMutation({
|
|
1015
1016
|
mutationFn: async (params) => {
|
|
@@ -1079,7 +1080,7 @@ function useUnlockFunds(options = {}) {
|
|
|
1079
1080
|
function useTransfer(options = {}) {
|
|
1080
1081
|
const { address } = wagmi.useAccount();
|
|
1081
1082
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
1082
|
-
const { client, networkConfig, serviceAddress } =
|
|
1083
|
+
const { client, networkConfig, serviceAddress } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1083
1084
|
const queryClient = reactQuery.useQueryClient();
|
|
1084
1085
|
const transferMutation = reactQuery.useMutation({
|
|
1085
1086
|
mutationFn: async (params) => {
|
|
@@ -1087,7 +1088,7 @@ function useTransfer(options = {}) {
|
|
|
1087
1088
|
throw new Error("Wallet not connected");
|
|
1088
1089
|
}
|
|
1089
1090
|
const { nonce } = await client.getTransferNonce(address);
|
|
1090
|
-
const signature = await
|
|
1091
|
+
const signature = await chunkKCXYYUUG_cjs.signTransferMessage({
|
|
1091
1092
|
walletClient,
|
|
1092
1093
|
chainId: networkConfig.chainId,
|
|
1093
1094
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1124,7 +1125,7 @@ function useTransfer(options = {}) {
|
|
|
1124
1125
|
throw new Error("Service address not configured");
|
|
1125
1126
|
}
|
|
1126
1127
|
const { nonce } = await client.getTransferLockedNonce(serviceAddress);
|
|
1127
|
-
const signature = await
|
|
1128
|
+
const signature = await chunkKCXYYUUG_cjs.signTransferLockedMessage({
|
|
1128
1129
|
walletClient,
|
|
1129
1130
|
chainId: networkConfig.chainId,
|
|
1130
1131
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1184,8 +1185,8 @@ function useTransfer(options = {}) {
|
|
|
1184
1185
|
};
|
|
1185
1186
|
}
|
|
1186
1187
|
function useLockedFunds(options = {}) {
|
|
1187
|
-
const { client, pollingInterval, serviceAddress } =
|
|
1188
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1188
|
+
const { client, pollingInterval, serviceAddress } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1189
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
1189
1190
|
const query = reactQuery.useQuery({
|
|
1190
1191
|
queryKey: ["accounting-locked-funds", ...privateReadQueryScope, serviceAddress ?? null],
|
|
1191
1192
|
queryFn: async () => {
|
|
@@ -1207,8 +1208,8 @@ function useLockedFunds(options = {}) {
|
|
|
1207
1208
|
};
|
|
1208
1209
|
}
|
|
1209
1210
|
function useTotalLockedBalance(options = {}) {
|
|
1210
|
-
const { client, pollingInterval, defaultToken } =
|
|
1211
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1211
|
+
const { client, pollingInterval, defaultToken } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1212
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
1212
1213
|
const tokenId = options.tokenId ?? defaultToken?.id;
|
|
1213
1214
|
const query = reactQuery.useQuery({
|
|
1214
1215
|
queryKey: ["accounting-total-locked-balance", ...privateReadQueryScope, tokenId],
|
|
@@ -1229,8 +1230,8 @@ function useTotalLockedBalance(options = {}) {
|
|
|
1229
1230
|
};
|
|
1230
1231
|
}
|
|
1231
1232
|
function useExpiredLocks(options = {}) {
|
|
1232
|
-
const { client, pollingInterval } =
|
|
1233
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1233
|
+
const { client, pollingInterval } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1234
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
1234
1235
|
const query = reactQuery.useQuery({
|
|
1235
1236
|
queryKey: ["accounting-expired-locks", ...privateReadQueryScope],
|
|
1236
1237
|
queryFn: async () => {
|
|
@@ -1251,14 +1252,14 @@ function useExpiredLocks(options = {}) {
|
|
|
1251
1252
|
};
|
|
1252
1253
|
}
|
|
1253
1254
|
function statusCodeOf(error) {
|
|
1254
|
-
return error instanceof
|
|
1255
|
+
return error instanceof chunkKCXYYUUG_cjs.AccountingApiError ? error.statusCode : void 0;
|
|
1255
1256
|
}
|
|
1256
1257
|
function usePendingDeposits(options = {}) {
|
|
1257
1258
|
const queryClient = react.useContext(reactQuery.QueryClientContext);
|
|
1258
|
-
const accountingContext =
|
|
1259
|
+
const accountingContext = chunkKCXYYUUG_cjs.useSafePrivanaContext();
|
|
1259
1260
|
const hasProviders = !!queryClient && !!accountingContext;
|
|
1260
1261
|
const client = accountingContext?.client;
|
|
1261
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1262
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
1262
1263
|
const { chainId, tokenAddress, lookbackBlocks } = options;
|
|
1263
1264
|
const query = reactQuery.useQuery({
|
|
1264
1265
|
queryKey: ["accounting-pending-deposits", ...privateReadQueryScope, chainId, tokenAddress],
|
|
@@ -1305,7 +1306,7 @@ function usePendingDeposits(options = {}) {
|
|
|
1305
1306
|
}
|
|
1306
1307
|
function usePendingWithdrawals(options = {}) {
|
|
1307
1308
|
const { address, isConnected } = wagmi.useAccount();
|
|
1308
|
-
const { client, pollingInterval } =
|
|
1309
|
+
const { client, pollingInterval } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1309
1310
|
const query = reactQuery.useQuery({
|
|
1310
1311
|
queryKey: ["accounting-pending-withdrawals", address],
|
|
1311
1312
|
queryFn: async () => {
|
|
@@ -1341,8 +1342,8 @@ function usePendingWithdrawals(options = {}) {
|
|
|
1341
1342
|
};
|
|
1342
1343
|
}
|
|
1343
1344
|
function useHistory(options = {}) {
|
|
1344
|
-
const { client, pollingInterval } =
|
|
1345
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1345
|
+
const { client, pollingInterval } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1346
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
1346
1347
|
const offset = options.offset ?? -1;
|
|
1347
1348
|
const limit = options.limit ?? 50;
|
|
1348
1349
|
const query = reactQuery.useQuery({
|
|
@@ -1366,7 +1367,7 @@ function useHistory(options = {}) {
|
|
|
1366
1367
|
};
|
|
1367
1368
|
}
|
|
1368
1369
|
function useTokenInfo(options = {}) {
|
|
1369
|
-
const { client } =
|
|
1370
|
+
const { client } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1370
1371
|
const { tokenId } = options;
|
|
1371
1372
|
const query = reactQuery.useQuery({
|
|
1372
1373
|
queryKey: ["accounting-token-info", tokenId],
|
|
@@ -1386,7 +1387,7 @@ function useTokenInfo(options = {}) {
|
|
|
1386
1387
|
};
|
|
1387
1388
|
}
|
|
1388
1389
|
function useTokenList(options = {}) {
|
|
1389
|
-
const { client } =
|
|
1390
|
+
const { client } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1390
1391
|
const query = reactQuery.useQuery({
|
|
1391
1392
|
queryKey: ["accounting-token-list"],
|
|
1392
1393
|
queryFn: () => client.listTokens(),
|
|
@@ -1404,7 +1405,7 @@ function useTokenList(options = {}) {
|
|
|
1404
1405
|
function useModifyLock(options = {}) {
|
|
1405
1406
|
const { address } = wagmi.useAccount();
|
|
1406
1407
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
1407
|
-
const { client, networkConfig } =
|
|
1408
|
+
const { client, networkConfig } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1408
1409
|
const queryClient = reactQuery.useQueryClient();
|
|
1409
1410
|
const mutation = reactQuery.useMutation({
|
|
1410
1411
|
mutationFn: async (params) => {
|
|
@@ -1412,7 +1413,7 @@ function useModifyLock(options = {}) {
|
|
|
1412
1413
|
throw new Error("Wallet not connected");
|
|
1413
1414
|
}
|
|
1414
1415
|
const { nonce } = await client.getModifyLockNonce(address);
|
|
1415
|
-
const signature = await
|
|
1416
|
+
const signature = await chunkKCXYYUUG_cjs.signModifyLockMessage({
|
|
1416
1417
|
walletClient,
|
|
1417
1418
|
chainId: networkConfig.chainId,
|
|
1418
1419
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1471,7 +1472,7 @@ function DialogOverlay({
|
|
|
1471
1472
|
{
|
|
1472
1473
|
"data-slot": "dialog-overlay",
|
|
1473
1474
|
"data-privana": true,
|
|
1474
|
-
className:
|
|
1475
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
1475
1476
|
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
1476
1477
|
className
|
|
1477
1478
|
),
|
|
@@ -1493,7 +1494,7 @@ function DialogContent({
|
|
|
1493
1494
|
{
|
|
1494
1495
|
"data-slot": "dialog-content",
|
|
1495
1496
|
"data-privana": true,
|
|
1496
|
-
className:
|
|
1497
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
1497
1498
|
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",
|
|
1498
1499
|
className
|
|
1499
1500
|
),
|
|
@@ -1521,7 +1522,7 @@ function DialogTitle({ className, ...props }) {
|
|
|
1521
1522
|
DialogPrimitive__namespace.Title,
|
|
1522
1523
|
{
|
|
1523
1524
|
"data-slot": "dialog-title",
|
|
1524
|
-
className:
|
|
1525
|
+
className: chunkKCXYYUUG_cjs.cn("text-lg leading-none font-semibold", className),
|
|
1525
1526
|
...props
|
|
1526
1527
|
}
|
|
1527
1528
|
);
|
|
@@ -1534,7 +1535,7 @@ function DialogDescription({
|
|
|
1534
1535
|
DialogPrimitive__namespace.Description,
|
|
1535
1536
|
{
|
|
1536
1537
|
"data-slot": "dialog-description",
|
|
1537
|
-
className:
|
|
1538
|
+
className: chunkKCXYYUUG_cjs.cn("text-muted-foreground text-sm", className),
|
|
1538
1539
|
...props
|
|
1539
1540
|
}
|
|
1540
1541
|
);
|
|
@@ -1576,7 +1577,7 @@ function sessionKey(owner, sessionId) {
|
|
|
1576
1577
|
return `${SESSION_PREFIX}${owner.toLowerCase()}:${sessionId}`;
|
|
1577
1578
|
}
|
|
1578
1579
|
function activeSessionId(owner) {
|
|
1579
|
-
const value =
|
|
1580
|
+
const value = chunkKCXYYUUG_cjs.getSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1580
1581
|
return value || void 0;
|
|
1581
1582
|
}
|
|
1582
1583
|
function isPositiveIntegerString(value) {
|
|
@@ -1608,7 +1609,7 @@ function isSessionRecord(value) {
|
|
|
1608
1609
|
}
|
|
1609
1610
|
function writeSessionRecord(session) {
|
|
1610
1611
|
const id = externalDepositSessionId(session.chainId, session.tokenId);
|
|
1611
|
-
return
|
|
1612
|
+
return chunkKCXYYUUG_cjs.setSharedBrowserStorageItem(sessionKey(session.owner, id), JSON.stringify(session));
|
|
1612
1613
|
}
|
|
1613
1614
|
function saveExternalDepositLockSession(session, expectedSession = null) {
|
|
1614
1615
|
if (!isSessionRecord(session)) throw new Error("Invalid external deposit lock session");
|
|
@@ -1622,12 +1623,12 @@ function saveExternalDepositLockSession(session, expectedSession = null) {
|
|
|
1622
1623
|
throw new Error("Unable to persist external deposit lock session");
|
|
1623
1624
|
}
|
|
1624
1625
|
if (previousId !== nextId) {
|
|
1625
|
-
if (!
|
|
1626
|
-
|
|
1626
|
+
if (!chunkKCXYYUUG_cjs.setSharedBrowserStorageItem(activeSessionKey(session.owner), nextId)) {
|
|
1627
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(sessionKey(session.owner, nextId));
|
|
1627
1628
|
throw new Error("Unable to persist external deposit lock session");
|
|
1628
1629
|
}
|
|
1629
1630
|
if (previousId) {
|
|
1630
|
-
|
|
1631
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(sessionKey(session.owner, previousId));
|
|
1631
1632
|
}
|
|
1632
1633
|
}
|
|
1633
1634
|
}
|
|
@@ -1636,17 +1637,17 @@ function loadExternalDepositLockSession(owner) {
|
|
|
1636
1637
|
if (!id) return void 0;
|
|
1637
1638
|
const key = sessionKey(owner, id);
|
|
1638
1639
|
try {
|
|
1639
|
-
const raw =
|
|
1640
|
+
const raw = chunkKCXYYUUG_cjs.getSharedBrowserStorageItem(key);
|
|
1640
1641
|
const parsed = raw ? JSON.parse(raw) : void 0;
|
|
1641
1642
|
if (!isSessionRecord(parsed) || parsed.owner.toLowerCase() !== owner.toLowerCase() || externalDepositSessionId(parsed.chainId, parsed.tokenId) !== id) {
|
|
1642
|
-
|
|
1643
|
-
|
|
1643
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(key);
|
|
1644
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1644
1645
|
return void 0;
|
|
1645
1646
|
}
|
|
1646
1647
|
return parsed;
|
|
1647
1648
|
} catch {
|
|
1648
|
-
|
|
1649
|
-
|
|
1649
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(key);
|
|
1650
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1650
1651
|
return void 0;
|
|
1651
1652
|
}
|
|
1652
1653
|
}
|
|
@@ -1677,8 +1678,8 @@ function clearExternalDepositLockSession(owner, expectedSessionId, expectedGener
|
|
|
1677
1678
|
const current = loadExternalDepositLockSession(owner);
|
|
1678
1679
|
if (!current || current.generation !== expectedGeneration) return;
|
|
1679
1680
|
}
|
|
1680
|
-
|
|
1681
|
-
|
|
1681
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(sessionKey(owner, id));
|
|
1682
|
+
chunkKCXYYUUG_cjs.removeSharedBrowserStorageItem(activeSessionKey(owner));
|
|
1682
1683
|
}
|
|
1683
1684
|
function isSameVerification(left, right) {
|
|
1684
1685
|
if (!left || !right) return left === right;
|
|
@@ -1731,7 +1732,7 @@ function markSubmissionAmbiguous(session, signature) {
|
|
|
1731
1732
|
return writeSessionRecord({ ...current, submissionAmbiguous: true });
|
|
1732
1733
|
}
|
|
1733
1734
|
function ambiguousSubmissionError(error) {
|
|
1734
|
-
return new
|
|
1735
|
+
return new chunkKCXYYUUG_cjs.PostDepositLockError(
|
|
1735
1736
|
"Lock submission could not be confirmed. Retry only the saved signature, or check locked funds before stopping recovery.",
|
|
1736
1737
|
error.reason,
|
|
1737
1738
|
error.signedAmount,
|
|
@@ -1744,7 +1745,7 @@ function ambiguousSubmissionError(error) {
|
|
|
1744
1745
|
}
|
|
1745
1746
|
function isDefinitiveSubmissionFailure(error) {
|
|
1746
1747
|
const cause = error.cause;
|
|
1747
|
-
return cause instanceof
|
|
1748
|
+
return cause instanceof chunkKCXYYUUG_cjs.AccountingApiError && cause.statusCode !== 408 && cause.statusCode < 500;
|
|
1748
1749
|
}
|
|
1749
1750
|
function submissionLockName(session) {
|
|
1750
1751
|
return `privana:external-deposit-lock:submit:${session.owner.toLowerCase()}:${externalDepositSessionId(session.chainId, session.tokenId)}`;
|
|
@@ -1764,7 +1765,7 @@ async function submitExternalDepositLock(client, session) {
|
|
|
1764
1765
|
return withSubmissionLock(session, async (crossTabExclusive) => {
|
|
1765
1766
|
const current = loadExternalDepositLockSession(session.owner);
|
|
1766
1767
|
if (!current || current.generation !== session.generation) {
|
|
1767
|
-
throw new
|
|
1768
|
+
throw new chunkKCXYYUUG_cjs.PostDepositLockError(
|
|
1768
1769
|
"External deposit lock session changed before submission",
|
|
1769
1770
|
"not-found",
|
|
1770
1771
|
BigInt(session.maxLockAmount),
|
|
@@ -1783,7 +1784,7 @@ async function submitExternalDepositLock(client, session) {
|
|
|
1783
1784
|
async function submitExternalDepositLockAttempt(client, session, crossTabExclusive) {
|
|
1784
1785
|
const creditedAmount = session.creditedAmount ? BigInt(session.creditedAmount) : void 0;
|
|
1785
1786
|
if (!creditedAmount) {
|
|
1786
|
-
throw new
|
|
1787
|
+
throw new chunkKCXYYUUG_cjs.PostDepositLockError(
|
|
1787
1788
|
"External deposit has not been credited",
|
|
1788
1789
|
"submission-failed",
|
|
1789
1790
|
BigInt(session.maxLockAmount)
|
|
@@ -1791,7 +1792,7 @@ async function submitExternalDepositLockAttempt(client, session, crossTabExclusi
|
|
|
1791
1792
|
}
|
|
1792
1793
|
const payload = session.payload;
|
|
1793
1794
|
if (!payload) {
|
|
1794
|
-
throw new
|
|
1795
|
+
throw new chunkKCXYYUUG_cjs.PostDepositLockError(
|
|
1795
1796
|
"No persisted signed policy found for this deposit session",
|
|
1796
1797
|
"not-found",
|
|
1797
1798
|
BigInt(session.maxLockAmount),
|
|
@@ -1799,7 +1800,7 @@ async function submitExternalDepositLockAttempt(client, session, crossTabExclusi
|
|
|
1799
1800
|
);
|
|
1800
1801
|
}
|
|
1801
1802
|
try {
|
|
1802
|
-
return await
|
|
1803
|
+
return await chunkKCXYYUUG_cjs.submitPendingLock({
|
|
1803
1804
|
client,
|
|
1804
1805
|
payload,
|
|
1805
1806
|
creditedAmount,
|
|
@@ -1810,23 +1811,23 @@ async function submitExternalDepositLockAttempt(client, session, crossTabExclusi
|
|
|
1810
1811
|
}
|
|
1811
1812
|
});
|
|
1812
1813
|
} catch (err) {
|
|
1813
|
-
if (err instanceof
|
|
1814
|
+
if (err instanceof chunkKCXYYUUG_cjs.PostDepositLockError && err.reason === "submission-failed" && crossTabExclusive && !session.submissionAmbiguous && isDefinitiveSubmissionFailure(err)) {
|
|
1814
1815
|
if (!clearSubmittedPayload(session, payload.signature, true)) {
|
|
1815
1816
|
const latest = loadExternalDepositLockSession(session.owner);
|
|
1816
1817
|
if (latest?.submissionAmbiguous) throw ambiguousSubmissionError(err);
|
|
1817
1818
|
}
|
|
1818
|
-
} else if (err instanceof
|
|
1819
|
+
} else if (err instanceof chunkKCXYYUUG_cjs.PostDepositLockError && err.reason === "submission-failed") {
|
|
1819
1820
|
const ambiguous = markSubmissionAmbiguous(session, payload.signature) || loadExternalDepositLockSession(session.owner)?.submissionAmbiguous === true;
|
|
1820
1821
|
if (ambiguous) throw ambiguousSubmissionError(err);
|
|
1821
1822
|
} else {
|
|
1822
1823
|
const current = loadExternalDepositLockSession(session.owner);
|
|
1823
1824
|
if (session.submissionAmbiguous || current?.submissionAmbiguous) {
|
|
1824
|
-
if (err instanceof
|
|
1825
|
+
if (err instanceof chunkKCXYYUUG_cjs.PostDepositLockError) throw ambiguousSubmissionError(err);
|
|
1825
1826
|
throw err;
|
|
1826
1827
|
}
|
|
1827
1828
|
if (!clearSubmittedPayload(session, payload.signature)) {
|
|
1828
1829
|
const latest = loadExternalDepositLockSession(session.owner);
|
|
1829
|
-
if (latest?.submissionAmbiguous && err instanceof
|
|
1830
|
+
if (latest?.submissionAmbiguous && err instanceof chunkKCXYYUUG_cjs.PostDepositLockError) {
|
|
1830
1831
|
throw ambiguousSubmissionError(err);
|
|
1831
1832
|
}
|
|
1832
1833
|
}
|
|
@@ -1839,12 +1840,12 @@ function useExternalDepositLock({
|
|
|
1839
1840
|
onLockSubmitted,
|
|
1840
1841
|
onLockFailed
|
|
1841
1842
|
}) {
|
|
1842
|
-
const { client, networkConfig, serviceAddress, getTokenById, tokensStatus } =
|
|
1843
|
+
const { client, networkConfig, serviceAddress, getTokenById, tokensStatus } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
1843
1844
|
const config = wagmi.useConfig();
|
|
1844
1845
|
const queryClient = reactQuery.useQueryClient();
|
|
1845
1846
|
const { address } = wagmi.useAccount();
|
|
1846
|
-
const { privateReadAddress } =
|
|
1847
|
-
const { ensureCorrectChain } =
|
|
1847
|
+
const { privateReadAddress } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
1848
|
+
const { ensureCorrectChain } = chunkKCXYYUUG_cjs.useEnsureCorrectChain();
|
|
1848
1849
|
const [isSigning, setIsSigning] = react.useState(false);
|
|
1849
1850
|
const [isSubmittingLock, setIsSubmittingLock] = react.useState(false);
|
|
1850
1851
|
const [session, setSession] = react.useState(null);
|
|
@@ -1904,7 +1905,7 @@ function useExternalDepositLock({
|
|
|
1904
1905
|
result = await submitExternalDepositLock(client, submission);
|
|
1905
1906
|
} catch (err) {
|
|
1906
1907
|
const stored = loadExternalDepositLockSession(active.owner);
|
|
1907
|
-
const error = err instanceof
|
|
1908
|
+
const error = err instanceof chunkKCXYYUUG_cjs.PostDepositLockError ? err : new chunkKCXYYUUG_cjs.PostDepositLockError(
|
|
1908
1909
|
err instanceof Error ? err.message : "Lock submission failed",
|
|
1909
1910
|
"submission-failed",
|
|
1910
1911
|
BigInt(active.maxLockAmount),
|
|
@@ -1983,7 +1984,7 @@ function useExternalDepositLock({
|
|
|
1983
1984
|
void submitSession(restored);
|
|
1984
1985
|
} else if (restored.creditedAmount) {
|
|
1985
1986
|
notifyFailure(
|
|
1986
|
-
new
|
|
1987
|
+
new chunkKCXYYUUG_cjs.PostDepositLockError(
|
|
1987
1988
|
"Deposit credited; sign a fresh policy to lock the funds",
|
|
1988
1989
|
"not-found",
|
|
1989
1990
|
BigInt(restored.maxLockAmount),
|
|
@@ -2023,10 +2024,10 @@ function useExternalDepositLock({
|
|
|
2023
2024
|
if (signingRef.current || settlingRef.current) {
|
|
2024
2025
|
throw new Error("A policy operation is already in progress");
|
|
2025
2026
|
}
|
|
2026
|
-
if (!
|
|
2027
|
+
if (!chunkKCXYYUUG_cjs.canUseSharedBrowserStorage()) {
|
|
2027
2028
|
throw new Error("Browser storage is required for locked deposit recovery");
|
|
2028
2029
|
}
|
|
2029
|
-
const owner =
|
|
2030
|
+
const owner = chunkKCXYYUUG_cjs.requireDepositLockOwner(address, privateReadAddress);
|
|
2030
2031
|
if (sessionRef.current || loadExternalDepositLockSession(owner)) {
|
|
2031
2032
|
throw new Error("Finish or cancel the active external deposit before starting another");
|
|
2032
2033
|
}
|
|
@@ -2035,26 +2036,26 @@ function useExternalDepositLock({
|
|
|
2035
2036
|
if (token.contract === viem.zeroAddress) {
|
|
2036
2037
|
throw new Error("External deposits support ERC20 tokens only");
|
|
2037
2038
|
}
|
|
2038
|
-
const targetService =
|
|
2039
|
-
const lockDuration = allowance.lockDuration ??
|
|
2039
|
+
const targetService = chunkKCXYYUUG_cjs.requireServiceAddress(serviceAddress);
|
|
2040
|
+
const lockDuration = allowance.lockDuration ?? chunkKCXYYUUG_cjs.DEFAULT_LOCK_DURATION_SECONDS;
|
|
2040
2041
|
signingRef.current = true;
|
|
2041
2042
|
setIsSigning(true);
|
|
2042
2043
|
try {
|
|
2043
2044
|
await ensureCorrectChain(networkConfig.chainId);
|
|
2044
|
-
const signingWalletClient = await
|
|
2045
|
+
const signingWalletClient = await chunkKCXYYUUG_cjs.getWalletClient(config, {
|
|
2045
2046
|
chainId: networkConfig.chainId
|
|
2046
2047
|
});
|
|
2047
|
-
const payload = await
|
|
2048
|
+
const payload = await chunkKCXYYUUG_cjs.createSignedLockRequest({
|
|
2048
2049
|
client,
|
|
2049
2050
|
walletClient: signingWalletClient,
|
|
2050
2051
|
userAddress: owner,
|
|
2051
2052
|
networkConfig,
|
|
2052
2053
|
serviceAddress: targetService,
|
|
2053
2054
|
tokenId: token.id,
|
|
2054
|
-
amount:
|
|
2055
|
+
amount: chunkKCXYYUUG_cjs.clampLockAmount(amount, BigInt(allowance.value)),
|
|
2055
2056
|
lockDuration
|
|
2056
2057
|
});
|
|
2057
|
-
const startBlock = await
|
|
2058
|
+
const startBlock = await chunkKCXYYUUG_cjs.getBlockNumber(config, { chainId: token.chainId });
|
|
2058
2059
|
if (startBlock > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
2059
2060
|
throw new Error("Source-chain block number exceeds the supported range");
|
|
2060
2061
|
}
|
|
@@ -2120,7 +2121,7 @@ function useExternalDepositLock({
|
|
|
2120
2121
|
pendingCreditedTransitionRef.current = { predecessor: active, credited };
|
|
2121
2122
|
installSession(credited);
|
|
2122
2123
|
notifyFailure(
|
|
2123
|
-
new
|
|
2124
|
+
new chunkKCXYYUUG_cjs.PostDepositLockError(
|
|
2124
2125
|
err instanceof Error ? err.message : "Unable to persist credited deposit state",
|
|
2125
2126
|
"submission-failed",
|
|
2126
2127
|
BigInt(active.maxLockAmount),
|
|
@@ -2180,7 +2181,7 @@ function useExternalDepositLock({
|
|
|
2180
2181
|
if (!token || token.chainId !== active.chainId || token.contract === viem.zeroAddress) {
|
|
2181
2182
|
throw new Error("The credited token is no longer available");
|
|
2182
2183
|
}
|
|
2183
|
-
const targetService =
|
|
2184
|
+
const targetService = chunkKCXYYUUG_cjs.requireServiceAddress(serviceAddress);
|
|
2184
2185
|
if (targetService.toLowerCase() !== active.serviceAddress.toLowerCase()) {
|
|
2185
2186
|
throw new Error("The service for this credited deposit has changed");
|
|
2186
2187
|
}
|
|
@@ -2193,17 +2194,17 @@ function useExternalDepositLock({
|
|
|
2193
2194
|
"The previous lock submission may have succeeded; a fresh signature is unsafe"
|
|
2194
2195
|
);
|
|
2195
2196
|
}
|
|
2196
|
-
const owner =
|
|
2197
|
+
const owner = chunkKCXYYUUG_cjs.requireDepositLockOwner(address, privateReadAddress);
|
|
2197
2198
|
const amount = externalDepositRetryAmount(active);
|
|
2198
2199
|
let retrySession;
|
|
2199
2200
|
signingRef.current = true;
|
|
2200
2201
|
setIsSigning(true);
|
|
2201
2202
|
try {
|
|
2202
2203
|
await ensureCorrectChain(networkConfig.chainId);
|
|
2203
|
-
const signingWalletClient = await
|
|
2204
|
+
const signingWalletClient = await chunkKCXYYUUG_cjs.getWalletClient(config, {
|
|
2204
2205
|
chainId: networkConfig.chainId
|
|
2205
2206
|
});
|
|
2206
|
-
const payload = await
|
|
2207
|
+
const payload = await chunkKCXYYUUG_cjs.createSignedLockRequest({
|
|
2207
2208
|
client,
|
|
2208
2209
|
walletClient: signingWalletClient,
|
|
2209
2210
|
userAddress: owner,
|
|
@@ -2425,7 +2426,7 @@ function getChainIcon(chainId, size) {
|
|
|
2425
2426
|
}
|
|
2426
2427
|
}
|
|
2427
2428
|
function TokenSelectorView({ selectedTokenId, onSelect }) {
|
|
2428
|
-
const { enabledTokens, getChainById: getChainById2 } =
|
|
2429
|
+
const { enabledTokens, getChainById: getChainById2 } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
2429
2430
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted flex flex-col rounded-[10px] p-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex max-h-72 flex-col gap-1 overflow-y-auto", children: [
|
|
2430
2431
|
enabledTokens.map((token) => {
|
|
2431
2432
|
const isSelected = selectedTokenId === token.id;
|
|
@@ -2435,7 +2436,7 @@ function TokenSelectorView({ selectedTokenId, onSelect }) {
|
|
|
2435
2436
|
{
|
|
2436
2437
|
type: "button",
|
|
2437
2438
|
onClick: () => onSelect(token.id),
|
|
2438
|
-
className:
|
|
2439
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
2439
2440
|
"hover:bg-secondary flex w-full cursor-pointer items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors",
|
|
2440
2441
|
isSelected && "bg-secondary"
|
|
2441
2442
|
),
|
|
@@ -2500,7 +2501,7 @@ function TransakCardWidgetView({
|
|
|
2500
2501
|
onLeave,
|
|
2501
2502
|
onUnsafeToCloseChange,
|
|
2502
2503
|
onActiveFlowChange,
|
|
2503
|
-
useOnRamp =
|
|
2504
|
+
useOnRamp = chunkKCXYYUUG_cjs.useTransakOnRamp
|
|
2504
2505
|
}) {
|
|
2505
2506
|
const [actionError, setActionError] = react.useState(null);
|
|
2506
2507
|
const [rowError, setRowError] = react.useState(null);
|
|
@@ -2518,7 +2519,7 @@ function TransakCardWidgetView({
|
|
|
2518
2519
|
);
|
|
2519
2520
|
const ownsRecord = react.useCallback(
|
|
2520
2521
|
(record) => Boolean(
|
|
2521
|
-
ownedIntentIdRef.current &&
|
|
2522
|
+
ownedIntentIdRef.current && chunkKCXYYUUG_cjs.matchesOnRampTransaction(record, ownedIntentIdRef.current)
|
|
2522
2523
|
),
|
|
2523
2524
|
[]
|
|
2524
2525
|
);
|
|
@@ -2581,13 +2582,13 @@ function TransakCardWidgetView({
|
|
|
2581
2582
|
amountBaseUnits = viem.parseUnits(amount, token.decimals);
|
|
2582
2583
|
} catch {
|
|
2583
2584
|
}
|
|
2584
|
-
const minimumTargetBaseUnits = minDepositBaseUnits === void 0 ? void 0 :
|
|
2585
|
+
const minimumTargetBaseUnits = minDepositBaseUnits === void 0 ? void 0 : chunkKCXYYUUG_cjs.getTransakMinimumTargetBaseUnits(minDepositBaseUnits);
|
|
2585
2586
|
const belowMinimum = amountBaseUnits !== void 0 && minimumTargetBaseUnits !== void 0 && amountBaseUnits < minimumTargetBaseUnits;
|
|
2586
2587
|
const minimumUnknown = minimumTargetBaseUnits === void 0;
|
|
2587
|
-
const tokenMismatch = !
|
|
2588
|
+
const tokenMismatch = !chunkKCXYYUUG_cjs.matchesFrozenOnRampToken(token, selectedToken);
|
|
2588
2589
|
const isSettling = status === "awaiting-delivery" || status === "verifying";
|
|
2589
2590
|
const lockPending = !!allowance && status === "credited" && !lockSettled && !lockError;
|
|
2590
|
-
const ownedPending = ownedIntentId ? pending.filter((record) =>
|
|
2591
|
+
const ownedPending = ownedIntentId ? pending.filter((record) => chunkKCXYYUUG_cjs.matchesOnRampTransaction(record, ownedIntentId)) : [];
|
|
2591
2592
|
const ownedFlowActive = !ownedTerminal && (Boolean(activeIntentId && activeIntentId === ownedIntentId) || ownedPending.length > 0 || lockPending);
|
|
2592
2593
|
const canOpen = Boolean(selectedToken && depositAddress && amountBaseUnits && amountBaseUnits > 0n) && !tokenMismatch && !minimumUnknown && !belowMinimum && !isLaunching && !isWidgetOpen && !isSettling && status !== "credited" && (!activeIntentId || canRecreateSession);
|
|
2593
2594
|
react.useEffect(() => {
|
|
@@ -2659,7 +2660,7 @@ function TransakCardWidgetView({
|
|
|
2659
2660
|
widget ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border bg-card overflow-hidden rounded-xl border", children: [
|
|
2660
2661
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border flex items-center justify-between border-b px-4 py-2 text-sm", children: [
|
|
2661
2662
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: "Card checkout" }),
|
|
2662
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2663
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkKCXYYUUG_cjs.Button, { type: "button", variant: "outline", size: "sm", onClick: () => void handleClose(), children: "Close" })
|
|
2663
2664
|
] }),
|
|
2664
2665
|
widget
|
|
2665
2666
|
] }) : status === "credited" && !lockPending && !lockError ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2 py-8 text-center", children: [
|
|
@@ -2670,7 +2671,7 @@ function TransakCardWidgetView({
|
|
|
2670
2671
|
token.symbol,
|
|
2671
2672
|
" deposit is now available in your balance."
|
|
2672
2673
|
] })
|
|
2673
|
-
] }) : !activeIntentId || canRecreateSession ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2674
|
+
] }) : !activeIntentId || canRecreateSession ? /* @__PURE__ */ jsxRuntime.jsxs(chunkKCXYYUUG_cjs.Button, { type: "button", disabled: !canOpen, onClick: () => void runCheckout(), children: [
|
|
2674
2675
|
isLaunching && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "animate-spin", "aria-hidden": true }),
|
|
2675
2676
|
isLaunching ? "Opening checkout\u2026" : activeIntentId ? "Reopen card checkout" : allowance ? "Sign policy and open checkout" : "Open card checkout"
|
|
2676
2677
|
] }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "This signed purchase is in recovery. Do not open another checkout for it." }),
|
|
@@ -2697,7 +2698,7 @@ function TransakCardWidgetView({
|
|
|
2697
2698
|
pending.map((record) => {
|
|
2698
2699
|
const isActivelyVerifying = record.transaction_id === activeVerificationId;
|
|
2699
2700
|
const progress = parseFinalityProgress(finalityProgress[record.transaction_id]);
|
|
2700
|
-
const showRetry =
|
|
2701
|
+
const showRetry = chunkKCXYYUUG_cjs.canRetryOnRampVerification(record, activeVerificationId);
|
|
2701
2702
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2702
2703
|
"div",
|
|
2703
2704
|
{
|
|
@@ -2709,7 +2710,7 @@ function TransakCardWidgetView({
|
|
|
2709
2710
|
] }),
|
|
2710
2711
|
rowError?.id === record.transaction_id && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-xs", children: rowError.message }),
|
|
2711
2712
|
showRetry && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2712
|
-
|
|
2713
|
+
chunkKCXYYUUG_cjs.Button,
|
|
2713
2714
|
{
|
|
2714
2715
|
type: "button",
|
|
2715
2716
|
variant: "outline",
|
|
@@ -2729,7 +2730,7 @@ function TransakCardWidgetView({
|
|
|
2729
2730
|
}
|
|
2730
2731
|
),
|
|
2731
2732
|
!record.on_chain_tx_hash && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2732
|
-
|
|
2733
|
+
chunkKCXYYUUG_cjs.Button,
|
|
2733
2734
|
{
|
|
2734
2735
|
type: "button",
|
|
2735
2736
|
variant: "outline",
|
|
@@ -2745,7 +2746,7 @@ function TransakCardWidgetView({
|
|
|
2745
2746
|
})
|
|
2746
2747
|
] }),
|
|
2747
2748
|
onLeave && ownedFlowActive && !unsafeToClose && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2748
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2749
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkKCXYYUUG_cjs.Button, { type: "button", variant: "outline", onClick: handleLeave, children: "Leave checkout" }),
|
|
2749
2750
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: "Privana will keep this signed purchase available for exact recovery." })
|
|
2750
2751
|
] }),
|
|
2751
2752
|
(actionError ?? error) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm", role: "alert", children: (actionError ?? error)?.message }),
|
|
@@ -2834,7 +2835,7 @@ function MoonPayCardWidgetView({
|
|
|
2834
2835
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: [
|
|
2835
2836
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: "Complete your purchase" }),
|
|
2836
2837
|
moonpayCurrencyCode ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2837
|
-
|
|
2838
|
+
chunkKCXYYUUG_cjs.FiatOnRampForm,
|
|
2838
2839
|
{
|
|
2839
2840
|
tokenId: token.id,
|
|
2840
2841
|
frozenToken: token,
|
|
@@ -3129,7 +3130,7 @@ function ChevronDownIcon({
|
|
|
3129
3130
|
height: "16",
|
|
3130
3131
|
viewBox: "0 0 16 16",
|
|
3131
3132
|
fill: "none",
|
|
3132
|
-
className:
|
|
3133
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
3133
3134
|
"transition-transform",
|
|
3134
3135
|
direction === "right" && "-rotate-90",
|
|
3135
3136
|
direction === "up" && "rotate-180",
|
|
@@ -3282,7 +3283,7 @@ function PolicyTermRow({
|
|
|
3282
3283
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3283
3284
|
"div",
|
|
3284
3285
|
{
|
|
3285
|
-
className:
|
|
3286
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
3286
3287
|
"mt-0.5 shrink-0",
|
|
3287
3288
|
kind === "permission" ? "text-emerald-500" : "text-orange-500"
|
|
3288
3289
|
),
|
|
@@ -3356,7 +3357,7 @@ function DepositView({
|
|
|
3356
3357
|
onSubmit,
|
|
3357
3358
|
isSubmitting = false
|
|
3358
3359
|
}) {
|
|
3359
|
-
const { getChainById: getChainById2, chains, serviceName, serviceIcon, networkConfig, hostedAuthConfig } =
|
|
3360
|
+
const { getChainById: getChainById2, chains, serviceName, serviceIcon, networkConfig, hostedAuthConfig } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
3360
3361
|
const { address, isConnected } = wagmi.useAccount();
|
|
3361
3362
|
const appName = serviceName ?? "Privana";
|
|
3362
3363
|
const chain = selectedToken ? getChainById2(selectedToken.chainId) : void 0;
|
|
@@ -3365,15 +3366,15 @@ function DepositView({
|
|
|
3365
3366
|
const isConnectedSource = source === "connected";
|
|
3366
3367
|
const isExternal = source === "external";
|
|
3367
3368
|
const isCreditCard = source === "credit-card";
|
|
3368
|
-
const isMoonPayCard = isCreditCard &&
|
|
3369
|
+
const isMoonPayCard = isCreditCard && chunkKCXYYUUG_cjs.isMoonPayProductOnRamp(onRamp);
|
|
3369
3370
|
const isTransakCard = isCreditCard && onRamp.provider === "transak";
|
|
3370
3371
|
const isNative = selectedToken?.contract === viem.zeroAddress;
|
|
3371
|
-
const { data: nativeBalanceData } = wagmi.useBalance({
|
|
3372
|
+
const { data: nativeBalanceData, isLoading: isNativeBalanceLoading } = wagmi.useBalance({
|
|
3372
3373
|
address,
|
|
3373
3374
|
chainId: targetChain?.id,
|
|
3374
3375
|
query: { enabled: isConnectedSource && !!address && !!selectedToken && isNative }
|
|
3375
3376
|
});
|
|
3376
|
-
const { data: erc20Balance } = wagmi.useReadContract({
|
|
3377
|
+
const { data: erc20Balance, isLoading: isErc20BalanceLoading } = wagmi.useReadContract({
|
|
3377
3378
|
address: selectedToken?.contract,
|
|
3378
3379
|
abi: viem.erc20Abi,
|
|
3379
3380
|
functionName: "balanceOf",
|
|
@@ -3382,7 +3383,8 @@ function DepositView({
|
|
|
3382
3383
|
query: { enabled: isConnectedSource && !!address && !!selectedToken && !isNative }
|
|
3383
3384
|
});
|
|
3384
3385
|
const walletBalance = isNative ? nativeBalanceData?.value : erc20Balance;
|
|
3385
|
-
const
|
|
3386
|
+
const isWalletBalanceLoading = isNative ? isNativeBalanceLoading : isErc20BalanceLoading;
|
|
3387
|
+
const formattedWalletBalance = walletBalance != null && selectedToken ? chunkKCXYYUUG_cjs.formatTokenAmount(walletBalance.toString(), selectedToken.decimals) : "0.00";
|
|
3386
3388
|
const {
|
|
3387
3389
|
minBuyAmount: moonpayMinBuy,
|
|
3388
3390
|
isLoading: moonpayLimitsLoading,
|
|
@@ -3395,7 +3397,7 @@ function DepositView({
|
|
|
3395
3397
|
const hasValidAmount = !!amount && parseFloat(amount) > 0;
|
|
3396
3398
|
const maxAmountDecimals = isMoonPayCard ? 2 : selectedToken?.decimals;
|
|
3397
3399
|
const tooManyDecimals = hasValidAmount && maxAmountDecimals != null && amount.includes(".") && amount.split(".")[1].length > maxAmountDecimals;
|
|
3398
|
-
const exceedsBalance = isConnectedSource && hasValidAmount && !tooManyDecimals && !!selectedToken && walletBalance != null &&
|
|
3400
|
+
const exceedsBalance = isConnectedSource && hasValidAmount && !tooManyDecimals && !!selectedToken && walletBalance != null && chunkKCXYYUUG_cjs.parseTokenAmount(amount, selectedToken.decimals) > walletBalance;
|
|
3399
3401
|
const belowMoonpayMin = isMoonPayCard && hasValidAmount && moonpayMinBuy != null && parseFloat(amount) < moonpayMinBuy;
|
|
3400
3402
|
const moonpayLimitsUnready = isMoonPayCard && !!onRamp.providerAssetCode && moonpayMinBuy == null;
|
|
3401
3403
|
const creditCardUnavailable = isCreditCard && !!onRamp.unavailableReason;
|
|
@@ -3403,13 +3405,13 @@ function DepositView({
|
|
|
3403
3405
|
const externalMinimumRequired = isExternal && !!allowance && !!selectedToken;
|
|
3404
3406
|
const externalMinimumLoading = externalMinimumRequired && externalMinimum === void 0;
|
|
3405
3407
|
const externalMinimumUnavailable = externalMinimumRequired && externalMinimum === null;
|
|
3406
|
-
const belowExternalMinimum = externalMinimumRequired && hasValidAmount && !tooManyDecimals && !!selectedToken && typeof externalMinimum === "bigint" &&
|
|
3408
|
+
const belowExternalMinimum = externalMinimumRequired && hasValidAmount && !tooManyDecimals && !!selectedToken && typeof externalMinimum === "bigint" && chunkKCXYYUUG_cjs.parseTokenAmount(amount, selectedToken.decimals) < externalMinimum;
|
|
3407
3409
|
const externalNeedsWallet = isExternal && (!!allowance || !hostedAuthConfig);
|
|
3408
3410
|
const needsConnect = (isConnectedSource || externalNeedsWallet) && !isConnected;
|
|
3409
3411
|
const canDeposit = hasValidAmount && !!selectedToken && !tooManyDecimals && !exceedsBalance && !belowMoonpayMin && !moonpayLimitsUnready && !creditCardUnavailable && !externalTokenUnavailable && !externalMinimumLoading && !externalMinimumUnavailable && !belowExternalMinimum && !needsConnect;
|
|
3410
3412
|
const handleMax = () => {
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
+
if (selectedToken && walletBalance != null && walletBalance > 0n)
|
|
3414
|
+
onAmountChange(viem.formatUnits(walletBalance, selectedToken.decimals));
|
|
3413
3415
|
};
|
|
3414
3416
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: [
|
|
3415
3417
|
isCreditCard ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
@@ -3450,17 +3452,16 @@ function DepositView({
|
|
|
3450
3452
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
3451
3453
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
3452
3454
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-muted-foreground text-sm", children: "Amount" }),
|
|
3453
|
-
isConnectedSource && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground text-sm", children: [
|
|
3454
|
-
"Available
|
|
3455
|
-
formattedWalletBalance,
|
|
3455
|
+
isConnectedSource && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground flex items-center gap-1 text-sm", children: [
|
|
3456
|
+
"Available",
|
|
3456
3457
|
" ",
|
|
3457
|
-
selectedToken?.symbol
|
|
3458
|
+
isWalletBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkKCXYYUUG_cjs.Skeleton, { className: "h-4 w-16" }) : `${formattedWalletBalance} ${selectedToken?.symbol ?? ""}`
|
|
3458
3459
|
] })
|
|
3459
3460
|
] }),
|
|
3460
3461
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3461
3462
|
"div",
|
|
3462
3463
|
{
|
|
3463
|
-
className:
|
|
3464
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
3464
3465
|
"border-border bg-input flex items-center gap-2 rounded-[10px] border",
|
|
3465
3466
|
isConnectedSource ? "py-1 pr-1 pl-3" : "px-3 py-3"
|
|
3466
3467
|
),
|
|
@@ -3485,7 +3486,8 @@ function DepositView({
|
|
|
3485
3486
|
{
|
|
3486
3487
|
type: "button",
|
|
3487
3488
|
onClick: handleMax,
|
|
3488
|
-
|
|
3489
|
+
disabled: isWalletBalanceLoading,
|
|
3490
|
+
className: "bg-secondary text-foreground hover:bg-secondary/80 cursor-pointer rounded px-3 py-2.5 text-xs font-semibold transition-colors disabled:cursor-default disabled:opacity-50",
|
|
3489
3491
|
children: "MAX"
|
|
3490
3492
|
}
|
|
3491
3493
|
) : isCreditCard ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm", children: selectedToken?.symbol ?? "USD" }) : selectedToken && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm", children: selectedToken.symbol })
|
|
@@ -3597,7 +3599,7 @@ function ExternalDepositView({
|
|
|
3597
3599
|
onDiscardLock,
|
|
3598
3600
|
lock
|
|
3599
3601
|
}) {
|
|
3600
|
-
const { getChainById: getChainById2, getTokenById, serviceName } =
|
|
3602
|
+
const { getChainById: getChainById2, getTokenById, serviceName } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
3601
3603
|
const appName = serviceName ?? "Privana";
|
|
3602
3604
|
const { depositAddress, isReady, isLoading } = depositAddressState;
|
|
3603
3605
|
const chain = token ? getChainById2(token.chainId) : void 0;
|
|
@@ -3613,7 +3615,7 @@ function ExternalDepositView({
|
|
|
3613
3615
|
const [nothingFound, setNothingFound] = react.useState(false);
|
|
3614
3616
|
const [credited, setCredited] = react.useState(null);
|
|
3615
3617
|
const [showCancelWarning, setShowCancelWarning] = react.useState(false);
|
|
3616
|
-
const verification =
|
|
3618
|
+
const verification = chunkKCXYYUUG_cjs.useDepositVerification({
|
|
3617
3619
|
onCredited: (txHash, _response, creditedAmount) => {
|
|
3618
3620
|
if (settleAfterCredit) {
|
|
3619
3621
|
void settleAfterCredit(txHash, creditedAmount);
|
|
@@ -3737,11 +3739,11 @@ function ExternalDepositView({
|
|
|
3737
3739
|
] }),
|
|
3738
3740
|
showDepositInstructions && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3739
3741
|
!scanPaused && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Send the displayed amount in one transfer. Transfers below the minimum are not combined or automatically returned." }),
|
|
3740
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-secondary flex h-50 items-center justify-center rounded-[10px]", children: !isReady ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground px-6 text-center text-sm", children: "Connect your wallet to generate a deposit address." }) : depositAddress ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-[10px] bg-white p-3", children: /* @__PURE__ */ jsxRuntime.jsx(qrcode_react.QRCodeSVG, { value: depositAddress, size: 160 }) }) : isLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3742
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-secondary flex h-50 items-center justify-center rounded-[10px]", children: !isReady ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground px-6 text-center text-sm", children: "Connect your wallet to generate a deposit address." }) : depositAddress ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-[10px] bg-white p-3", children: /* @__PURE__ */ jsxRuntime.jsx(qrcode_react.QRCodeSVG, { value: depositAddress, size: 160 }) }) : isLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkKCXYYUUG_cjs.Skeleton, { className: "h-full w-full rounded-[10px]" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm", children: "Deposit address unavailable" }) }),
|
|
3741
3743
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
3742
3744
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Deposit Address" }),
|
|
3743
3745
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
3744
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-border flex h-10 min-w-0 flex-1 items-center rounded-[10px] border px-3", children: depositAddress ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground min-w-0 flex-1 truncate text-sm", children: depositAddress }) : isReady && isLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3746
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-border flex h-10 min-w-0 flex-1 items-center rounded-[10px] border px-3", children: depositAddress ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground min-w-0 flex-1 truncate text-sm", children: depositAddress }) : isReady && isLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkKCXYYUUG_cjs.Skeleton, { className: "h-4 w-3/4" }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "\u2014" }) }),
|
|
3745
3747
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3746
3748
|
"button",
|
|
3747
3749
|
{
|
|
@@ -3796,7 +3798,7 @@ function ExternalDepositView({
|
|
|
3796
3798
|
TransactionSuccessView,
|
|
3797
3799
|
{
|
|
3798
3800
|
title: "Deposit Credited",
|
|
3799
|
-
message: `Transfer ${
|
|
3801
|
+
message: `Transfer ${chunkKCXYYUUG_cjs.shortenAddress(credited.txHash)} has been credited to your Privana balance.`,
|
|
3800
3802
|
onDone: () => {
|
|
3801
3803
|
setCredited(null);
|
|
3802
3804
|
verification.reset();
|
|
@@ -3825,7 +3827,7 @@ function ExternalDepositView({
|
|
|
3825
3827
|
{
|
|
3826
3828
|
title: "Awaiting Deposit",
|
|
3827
3829
|
subtitle: listening ? "We are listening for your incoming transaction for the next hour." : "We've stopped listening automatically. Use the button below to check for your deposit.",
|
|
3828
|
-
remaining: listening ?
|
|
3830
|
+
remaining: listening ? chunkKCXYYUUG_cjs.formatCountdown(secondsLeft) : void 0
|
|
3829
3831
|
}
|
|
3830
3832
|
),
|
|
3831
3833
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
@@ -3877,7 +3879,7 @@ function MethodTabs({
|
|
|
3877
3879
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3878
3880
|
"div",
|
|
3879
3881
|
{
|
|
3880
|
-
className:
|
|
3882
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
3881
3883
|
"bg-input absolute top-1 bottom-1 left-1 w-[calc(50%-8px)] rounded-md transition-transform duration-200",
|
|
3882
3884
|
activeTab === "credit-card" && "translate-x-[calc(100%+8px)]"
|
|
3883
3885
|
)
|
|
@@ -3888,7 +3890,7 @@ function MethodTabs({
|
|
|
3888
3890
|
{
|
|
3889
3891
|
type: "button",
|
|
3890
3892
|
onClick: () => onTabChange("crypto"),
|
|
3891
|
-
className:
|
|
3893
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
3892
3894
|
"relative z-10 flex-1 cursor-pointer rounded-md px-3 py-[9px] text-sm font-medium transition-colors",
|
|
3893
3895
|
activeTab === "crypto" ? "text-foreground" : "text-muted-foreground"
|
|
3894
3896
|
),
|
|
@@ -3900,7 +3902,7 @@ function MethodTabs({
|
|
|
3900
3902
|
{
|
|
3901
3903
|
type: "button",
|
|
3902
3904
|
onClick: () => onTabChange("credit-card"),
|
|
3903
|
-
className:
|
|
3905
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
3904
3906
|
"relative z-10 flex-1 cursor-pointer rounded-md px-3 py-[9px] text-sm font-medium transition-colors",
|
|
3905
3907
|
activeTab === "credit-card" ? "text-foreground" : "text-muted-foreground"
|
|
3906
3908
|
),
|
|
@@ -3954,9 +3956,9 @@ function DepositModalContent({
|
|
|
3954
3956
|
getTokenById,
|
|
3955
3957
|
networkConfig,
|
|
3956
3958
|
onRamp
|
|
3957
|
-
} =
|
|
3959
|
+
} = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
3958
3960
|
const { address } = wagmi.useAccount();
|
|
3959
|
-
const { privateReadQueryScope } =
|
|
3961
|
+
const { privateReadQueryScope } = chunkKCXYYUUG_cjs.usePrivateReadRequest();
|
|
3960
3962
|
const [privateReadApiUrl, accountingChainId, beneficiaryAddress] = privateReadQueryScope;
|
|
3961
3963
|
const appName = serviceName ?? "Privana";
|
|
3962
3964
|
const [activeTab, setActiveTab] = react.useState(defaultTab);
|
|
@@ -3970,7 +3972,7 @@ function DepositModalContent({
|
|
|
3970
3972
|
const nextCardFlowId = react.useRef(0);
|
|
3971
3973
|
const stateSelectedToken = enabledTokens.find((t) => t.id === selectedTokenId) ?? defaultToken;
|
|
3972
3974
|
const cardOnRamp = react.useMemo(
|
|
3973
|
-
() =>
|
|
3975
|
+
() => chunkKCXYYUUG_cjs.resolveProductOnRamp({
|
|
3974
3976
|
config: onRamp,
|
|
3975
3977
|
enabledTokens,
|
|
3976
3978
|
legacyToken: stateSelectedToken,
|
|
@@ -3987,7 +3989,7 @@ function DepositModalContent({
|
|
|
3987
3989
|
}),
|
|
3988
3990
|
[accountingChainId, beneficiaryAddress, networkConfig.accountingContract, privateReadApiUrl]
|
|
3989
3991
|
);
|
|
3990
|
-
const mountedCardFlow = cardFlow &&
|
|
3992
|
+
const mountedCardFlow = cardFlow && chunkKCXYYUUG_cjs.matchesProductOnRampScope(cardFlow.scope, cardOnRampScope) ? cardFlow : null;
|
|
3991
3993
|
const displayedCardOnRamp = view === "credit-card-widget" && mountedCardFlow ? mountedCardFlow.selection : cardOnRamp;
|
|
3992
3994
|
const selectedToken = source === "credit-card" ? displayedCardOnRamp.token : stateSelectedToken;
|
|
3993
3995
|
const externalDepositAddress = useDepositAddress({
|
|
@@ -4041,11 +4043,11 @@ function DepositModalContent({
|
|
|
4041
4043
|
setView("deposit");
|
|
4042
4044
|
}, []);
|
|
4043
4045
|
react.useEffect(() => {
|
|
4044
|
-
if (cardFlow && !
|
|
4046
|
+
if (cardFlow && !chunkKCXYYUUG_cjs.matchesProductOnRampScope(cardFlow.scope, cardOnRampScope)) {
|
|
4045
4047
|
leaveCardPurchase();
|
|
4046
4048
|
}
|
|
4047
4049
|
}, [cardFlow, cardOnRampScope, leaveCardPurchase]);
|
|
4048
|
-
const cardOutcomeCallbacks = mountedCardFlow ?
|
|
4050
|
+
const cardOutcomeCallbacks = mountedCardFlow ? chunkKCXYYUUG_cjs.createProductOnRampOutcomeCallbacks({
|
|
4049
4051
|
requiresLock: mountedCardFlow.requiresLock,
|
|
4050
4052
|
onComplete: finishCardPurchase,
|
|
4051
4053
|
onLockFailed: (err) => {
|
|
@@ -4143,7 +4145,7 @@ function DepositModalContent({
|
|
|
4143
4145
|
sonner.toast.error("External deposits support ERC20 tokens only");
|
|
4144
4146
|
return;
|
|
4145
4147
|
}
|
|
4146
|
-
const depositAmount =
|
|
4148
|
+
const depositAmount = chunkKCXYYUUG_cjs.parseTokenAmount(args.amount, token2.decimals);
|
|
4147
4149
|
if (!allowance) {
|
|
4148
4150
|
setView("external-deposit");
|
|
4149
4151
|
return;
|
|
@@ -4173,7 +4175,7 @@ function DepositModalContent({
|
|
|
4173
4175
|
}
|
|
4174
4176
|
try {
|
|
4175
4177
|
setCardFlow(
|
|
4176
|
-
|
|
4178
|
+
chunkKCXYYUUG_cjs.createProductOnRampFlowSnapshot({
|
|
4177
4179
|
id: ++nextCardFlowId.current,
|
|
4178
4180
|
selection: cardOnRamp,
|
|
4179
4181
|
amount: args.amount,
|
|
@@ -4198,7 +4200,7 @@ function DepositModalContent({
|
|
|
4198
4200
|
setCancelled(false);
|
|
4199
4201
|
deposit({
|
|
4200
4202
|
tokenId: token.id,
|
|
4201
|
-
amount:
|
|
4203
|
+
amount: chunkKCXYYUUG_cjs.parseTokenAmount(args.amount, token.decimals),
|
|
4202
4204
|
postDepositLock: allowance ? {
|
|
4203
4205
|
maxAmount: BigInt(allowance.value),
|
|
4204
4206
|
lockDuration: allowance.lockDuration
|
|
@@ -4239,7 +4241,7 @@ function DepositModalContent({
|
|
|
4239
4241
|
];
|
|
4240
4242
|
const hasExternalLockRecovery = view === "external-deposit" && !!externalLock.session?.creditedAmount;
|
|
4241
4243
|
const externalSubmissionAmbiguous = hasExternalLockRecovery && !!lockFailure?.submissionMayHaveSucceeded;
|
|
4242
|
-
const savedExternalPayloadUsable = !!externalLock.session?.payload &&
|
|
4244
|
+
const savedExternalPayloadUsable = !!externalLock.session?.payload && chunkKCXYYUUG_cjs.isSignedLockUsable(externalLock.session.payload);
|
|
4243
4245
|
const ambiguousRecoveryMustBeAbandoned = externalSubmissionAmbiguous && !savedExternalPayloadUsable;
|
|
4244
4246
|
const externalRecoveryExitLabel = externalSubmissionAmbiguous ? "Stop recovery" : "Keep funds unlocked";
|
|
4245
4247
|
const lockFailureToken = hasExternalLockRecovery && externalLock.session ? getTokenById(externalLock.session.tokenId) ?? selectedToken : selectedToken;
|
|
@@ -4323,7 +4325,7 @@ function DepositModalContent({
|
|
|
4323
4325
|
onClick: onClose,
|
|
4324
4326
|
disabled: isUnsafeToClose,
|
|
4325
4327
|
"aria-label": "Close",
|
|
4326
|
-
className:
|
|
4328
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
4327
4329
|
"absolute top-6 right-5 z-20 flex h-5 w-5 items-center justify-center transition-colors",
|
|
4328
4330
|
isUnsafeToClose ? "text-muted-foreground/40 cursor-not-allowed" : "text-muted-foreground hover:text-foreground cursor-pointer"
|
|
4329
4331
|
),
|
|
@@ -4461,6 +4463,7 @@ function DepositModalContent({
|
|
|
4461
4463
|
{
|
|
4462
4464
|
selectedTokenId: selectedToken?.id,
|
|
4463
4465
|
onSelect: (id) => {
|
|
4466
|
+
if (id !== selectedToken?.id) setAmount("");
|
|
4464
4467
|
setSelectedTokenId(id);
|
|
4465
4468
|
setView("deposit");
|
|
4466
4469
|
}
|
|
@@ -4549,7 +4552,7 @@ function DepositInlineModal({ className, ...handlers }) {
|
|
|
4549
4552
|
"div",
|
|
4550
4553
|
{
|
|
4551
4554
|
"data-privana": true,
|
|
4552
|
-
className:
|
|
4555
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
4553
4556
|
"bg-card relative flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
4554
4557
|
className
|
|
4555
4558
|
),
|
|
@@ -4565,7 +4568,7 @@ function WithdrawView({
|
|
|
4565
4568
|
onPendingChange,
|
|
4566
4569
|
onWithdrawSuccess
|
|
4567
4570
|
}) {
|
|
4568
|
-
const { chains, getChainById: getChainById2 } =
|
|
4571
|
+
const { chains, getChainById: getChainById2 } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
4569
4572
|
const { isConnected, address } = wagmi.useAccount();
|
|
4570
4573
|
const [showSuccess, setShowSuccess] = react.useState(false);
|
|
4571
4574
|
const [showTimeout, setShowTimeout] = react.useState(false);
|
|
@@ -4579,7 +4582,7 @@ function WithdrawView({
|
|
|
4579
4582
|
tokenId: selectedToken?.id,
|
|
4580
4583
|
enabled: !!selectedToken
|
|
4581
4584
|
});
|
|
4582
|
-
const formattedBalance = selectedToken ?
|
|
4585
|
+
const formattedBalance = selectedToken ? chunkKCXYYUUG_cjs.formatTokenAmount(balanceWei, selectedToken.decimals) : "0.00";
|
|
4583
4586
|
const { withdraw, isPending, currentStep, error, reset } = useWithdraw({
|
|
4584
4587
|
onProcessingSuccess: () => {
|
|
4585
4588
|
onAmountChange("");
|
|
@@ -4595,13 +4598,22 @@ function WithdrawView({
|
|
|
4595
4598
|
setShowTimeout(true);
|
|
4596
4599
|
}
|
|
4597
4600
|
});
|
|
4598
|
-
const explorerUrl = address && targetChain ?
|
|
4601
|
+
const explorerUrl = address && targetChain ? chunkKCXYYUUG_cjs.getExplorerAddressUrl(targetChain.id, address) : void 0;
|
|
4599
4602
|
const getStepStatus = (step, after) => {
|
|
4600
4603
|
if (currentStep === step) return "active";
|
|
4601
4604
|
if (after.includes(currentStep)) return "completed";
|
|
4602
4605
|
return "pending";
|
|
4603
4606
|
};
|
|
4604
4607
|
const withdrawSteps = [
|
|
4608
|
+
{
|
|
4609
|
+
label: "Preparing withdrawal",
|
|
4610
|
+
status: getStepStatus("preparing", [
|
|
4611
|
+
"switching-chain",
|
|
4612
|
+
"signing",
|
|
4613
|
+
"submitting",
|
|
4614
|
+
"processing"
|
|
4615
|
+
])
|
|
4616
|
+
},
|
|
4605
4617
|
{
|
|
4606
4618
|
label: "Switching to signing chain",
|
|
4607
4619
|
status: getStepStatus("switching-chain", ["signing", "submitting", "processing"])
|
|
@@ -4620,19 +4632,19 @@ function WithdrawView({
|
|
|
4620
4632
|
}, [isPending, cancelled, onPendingChange]);
|
|
4621
4633
|
const hasValidAmount = !!amount && parseFloat(amount) > 0;
|
|
4622
4634
|
const tooManyDecimals = !!hasValidAmount && !!selectedToken && amount.includes(".") && amount.split(".")[1].length > selectedToken.decimals;
|
|
4623
|
-
const exceedsBalance = !!hasValidAmount && !tooManyDecimals && !!selectedToken && !isBalanceLoading && !isBalanceError &&
|
|
4635
|
+
const exceedsBalance = !!hasValidAmount && !tooManyDecimals && !!selectedToken && !isBalanceLoading && !isBalanceError && chunkKCXYYUUG_cjs.parseTokenAmount(amount, selectedToken.decimals) > BigInt(balanceWei);
|
|
4624
4636
|
const canWithdraw = isConnected && hasValidAmount && !!selectedToken && !tooManyDecimals && !exceedsBalance;
|
|
4625
4637
|
const handleMax = () => {
|
|
4626
4638
|
if (!selectedToken) return;
|
|
4627
|
-
const
|
|
4628
|
-
if (
|
|
4639
|
+
const wei = BigInt(balanceWei);
|
|
4640
|
+
if (wei > 0n) onAmountChange(viem.formatUnits(wei, selectedToken.decimals));
|
|
4629
4641
|
};
|
|
4630
4642
|
const handleWithdraw = async () => {
|
|
4631
4643
|
if (!selectedToken || !canWithdraw) return;
|
|
4632
4644
|
setCancelled(false);
|
|
4633
4645
|
await withdraw({
|
|
4634
4646
|
tokenId: selectedToken.id,
|
|
4635
|
-
amount:
|
|
4647
|
+
amount: chunkKCXYYUUG_cjs.parseTokenAmount(amount, selectedToken.decimals)
|
|
4636
4648
|
});
|
|
4637
4649
|
};
|
|
4638
4650
|
const handleCancel = () => {
|
|
@@ -4652,7 +4664,7 @@ function WithdrawView({
|
|
|
4652
4664
|
title: "Withdrawal Complete",
|
|
4653
4665
|
message: `Your ${selectedToken.symbol} withdrawal has been processed. Funds should appear in your wallet shortly.`,
|
|
4654
4666
|
explorerUrl,
|
|
4655
|
-
explorerLabel: targetChain ?
|
|
4667
|
+
explorerLabel: targetChain ? chunkKCXYYUUG_cjs.getExplorerLabel(targetChain.id) : void 0,
|
|
4656
4668
|
onDone: handleDone
|
|
4657
4669
|
}
|
|
4658
4670
|
) });
|
|
@@ -4668,7 +4680,7 @@ function WithdrawView({
|
|
|
4668
4680
|
) });
|
|
4669
4681
|
}
|
|
4670
4682
|
if (isPending && !cancelled) {
|
|
4671
|
-
const canCancel = currentStep === "idle" || currentStep === "switching-chain" || currentStep === "signing";
|
|
4683
|
+
const canCancel = currentStep === "idle" || currentStep === "preparing" || currentStep === "switching-chain" || currentStep === "signing";
|
|
4672
4684
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4673
4685
|
TransactionProgressView,
|
|
4674
4686
|
{
|
|
@@ -4707,11 +4719,10 @@ function WithdrawView({
|
|
|
4707
4719
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
4708
4720
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
4709
4721
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-muted-foreground text-sm", children: "Amount" }),
|
|
4710
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground text-sm", children: [
|
|
4711
|
-
"Available
|
|
4712
|
-
formattedBalance,
|
|
4722
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground flex items-center gap-1 text-sm", children: [
|
|
4723
|
+
"Available",
|
|
4713
4724
|
" ",
|
|
4714
|
-
selectedToken?.symbol
|
|
4725
|
+
isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkKCXYYUUG_cjs.Skeleton, { className: "h-4 w-16" }) : `${formattedBalance} ${selectedToken?.symbol ?? ""}`
|
|
4715
4726
|
] })
|
|
4716
4727
|
] }),
|
|
4717
4728
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-border bg-input flex items-center gap-2 rounded-[10px] border py-1 pr-1 pl-3", children: [
|
|
@@ -4734,7 +4745,8 @@ function WithdrawView({
|
|
|
4734
4745
|
{
|
|
4735
4746
|
type: "button",
|
|
4736
4747
|
onClick: handleMax,
|
|
4737
|
-
|
|
4748
|
+
disabled: isBalanceLoading,
|
|
4749
|
+
className: "bg-secondary text-foreground hover:bg-secondary/80 cursor-pointer rounded px-3 py-2.5 text-xs font-semibold transition-colors disabled:cursor-default disabled:opacity-50",
|
|
4738
4750
|
children: "MAX"
|
|
4739
4751
|
}
|
|
4740
4752
|
)
|
|
@@ -4764,7 +4776,7 @@ function WithdrawModalContent({
|
|
|
4764
4776
|
onBack,
|
|
4765
4777
|
onWithdrawSuccess
|
|
4766
4778
|
}) {
|
|
4767
|
-
const { serviceName, enabledTokens, defaultToken, hostedAuthConfig } =
|
|
4779
|
+
const { serviceName, enabledTokens, defaultToken, hostedAuthConfig } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
4768
4780
|
const { address } = wagmi.useAccount();
|
|
4769
4781
|
const appName = serviceName ?? "Privana";
|
|
4770
4782
|
const [view, setView] = react.useState("form");
|
|
@@ -4837,6 +4849,7 @@ function WithdrawModalContent({
|
|
|
4837
4849
|
{
|
|
4838
4850
|
selectedTokenId: selectedToken?.id,
|
|
4839
4851
|
onSelect: (id) => {
|
|
4852
|
+
if (id !== selectedToken?.id) setAmount("");
|
|
4840
4853
|
setSelectedTokenId(id);
|
|
4841
4854
|
setView("form");
|
|
4842
4855
|
}
|
|
@@ -4890,7 +4903,7 @@ function WithdrawInlineModal({ className, onWithdrawSuccess }) {
|
|
|
4890
4903
|
"div",
|
|
4891
4904
|
{
|
|
4892
4905
|
"data-privana": true,
|
|
4893
|
-
className:
|
|
4906
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
4894
4907
|
"bg-card relative flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
4895
4908
|
className
|
|
4896
4909
|
),
|
|
@@ -4934,14 +4947,14 @@ function SegmentedBalanceBar({
|
|
|
4934
4947
|
showAvailable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4935
4948
|
"div",
|
|
4936
4949
|
{
|
|
4937
|
-
className:
|
|
4950
|
+
className: chunkKCXYYUUG_cjs.cn(AVAILABLE_COLOR, "rounded-l-full", !showInUse && "rounded-r-full"),
|
|
4938
4951
|
style: { flexGrow: grow(availableWei) }
|
|
4939
4952
|
}
|
|
4940
4953
|
),
|
|
4941
4954
|
showInUse && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4942
4955
|
"div",
|
|
4943
4956
|
{
|
|
4944
|
-
className:
|
|
4957
|
+
className: chunkKCXYYUUG_cjs.cn(IN_USE_COLOR, "rounded-r-full", !showAvailable && "rounded-l-full"),
|
|
4945
4958
|
style: { flexGrow: grow(inUseWei) }
|
|
4946
4959
|
}
|
|
4947
4960
|
)
|
|
@@ -4949,7 +4962,7 @@ function SegmentedBalanceBar({
|
|
|
4949
4962
|
}
|
|
4950
4963
|
function BalanceLegendItem({ color, label }) {
|
|
4951
4964
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
4952
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className:
|
|
4965
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkKCXYYUUG_cjs.cn("h-2.5 w-2.5 rounded-full", color) }),
|
|
4953
4966
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground text-sm leading-5", children: label })
|
|
4954
4967
|
] });
|
|
4955
4968
|
}
|
|
@@ -4962,7 +4975,7 @@ function WalletBalanceView({
|
|
|
4962
4975
|
onAddFunds,
|
|
4963
4976
|
onWithdraw
|
|
4964
4977
|
}) {
|
|
4965
|
-
const { serviceName, serviceIcon, defaultToken } =
|
|
4978
|
+
const { serviceName, serviceIcon, defaultToken } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
4966
4979
|
const appName = serviceName ?? "Privana";
|
|
4967
4980
|
const token = defaultToken;
|
|
4968
4981
|
const {
|
|
@@ -4975,14 +4988,14 @@ function WalletBalanceView({
|
|
|
4975
4988
|
const variant = !session ? "idle" : inUseWei === 0n ? "session-zero" : availableWei === 0n ? "fully-in-use" : "mixed";
|
|
4976
4989
|
const expiry = session?.expiry;
|
|
4977
4990
|
useNow(3e4, expiry != null);
|
|
4978
|
-
const countdown = expiry != null ?
|
|
4991
|
+
const countdown = expiry != null ? chunkKCXYYUUG_cjs.formatTimeRemaining(expiry) : null;
|
|
4979
4992
|
const decimals = token?.decimals ?? 18;
|
|
4980
|
-
const totalFormatted =
|
|
4981
|
-
const availableFormatted =
|
|
4982
|
-
const inUseFormatted =
|
|
4993
|
+
const totalFormatted = chunkKCXYYUUG_cjs.formatTokenAmount((availableWei + inUseWei).toString(), decimals);
|
|
4994
|
+
const availableFormatted = chunkKCXYYUUG_cjs.formatTokenAmount(availableWei.toString(), decimals);
|
|
4995
|
+
const inUseFormatted = chunkKCXYYUUG_cjs.formatTokenAmount(inUseWei.toString(), decimals);
|
|
4983
4996
|
const hasValidAmount = !!amount && parseFloat(amount) > 0;
|
|
4984
4997
|
const tooManyDecimals = hasValidAmount && !!token && amount.includes(".") && amount.split(".")[1].length > token.decimals;
|
|
4985
|
-
const exceedsBalance = hasValidAmount && !tooManyDecimals && !!token && !isBalanceLoading && !isBalanceError &&
|
|
4998
|
+
const exceedsBalance = hasValidAmount && !tooManyDecimals && !!token && !isBalanceLoading && !isBalanceError && chunkKCXYYUUG_cjs.parseTokenAmount(amount, token.decimals) > availableWei;
|
|
4986
4999
|
const canFundSession = hasValidAmount && !!token && !tooManyDecimals && !exceedsBalance && !isBalanceLoading && !isBalanceError;
|
|
4987
5000
|
const handleMax = () => {
|
|
4988
5001
|
const max = availableFormatted.replace(/\s/g, "");
|
|
@@ -5000,7 +5013,7 @@ function WalletBalanceView({
|
|
|
5000
5013
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm leading-[14px]", children: "Total" }),
|
|
5001
5014
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-secondary text-muted-foreground rounded-full px-2 py-[5px] text-[10px] leading-[10px] font-bold", children: token?.symbol ?? "\u2014" })
|
|
5002
5015
|
] }),
|
|
5003
|
-
isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5016
|
+
isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkKCXYYUUG_cjs.Skeleton, { className: "h-9 w-40" }) : isBalanceError ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-[32px] leading-9 font-medium", children: "\u2014" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground text-[32px] leading-9 font-medium", children: totalFormatted })
|
|
5004
5017
|
] }),
|
|
5005
5018
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
5006
5019
|
/* @__PURE__ */ jsxRuntime.jsx(SegmentedBalanceBar, { availableWei, inUseWei }),
|
|
@@ -5151,7 +5164,7 @@ function WalletModalContent({
|
|
|
5151
5164
|
onCloseBlockedChange,
|
|
5152
5165
|
...depositHandlers
|
|
5153
5166
|
}) {
|
|
5154
|
-
const { serviceName, hostedAuthConfig } =
|
|
5167
|
+
const { serviceName, hostedAuthConfig } = chunkKCXYYUUG_cjs.usePrivanaContext();
|
|
5155
5168
|
const { address } = wagmi.useAccount();
|
|
5156
5169
|
const appName = serviceName ?? "Privana";
|
|
5157
5170
|
const [view, setView] = react.useState("balance");
|
|
@@ -5255,7 +5268,7 @@ function WalletModalContent({
|
|
|
5255
5268
|
onClick: onClose,
|
|
5256
5269
|
disabled: closeBlocked,
|
|
5257
5270
|
"aria-label": "Close",
|
|
5258
|
-
className:
|
|
5271
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
5259
5272
|
"absolute top-6 right-5 z-20 flex h-5 w-5 items-center justify-center transition-colors",
|
|
5260
5273
|
closeBlocked ? "text-muted-foreground/40 cursor-not-allowed" : "text-muted-foreground hover:text-foreground cursor-pointer"
|
|
5261
5274
|
),
|
|
@@ -5383,7 +5396,7 @@ function WalletInlineModal({ className, ...handlers }) {
|
|
|
5383
5396
|
"div",
|
|
5384
5397
|
{
|
|
5385
5398
|
"data-privana": true,
|
|
5386
|
-
className:
|
|
5399
|
+
className: chunkKCXYYUUG_cjs.cn(
|
|
5387
5400
|
"bg-card relative flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
5388
5401
|
className
|
|
5389
5402
|
),
|
|
@@ -5394,295 +5407,295 @@ function WalletInlineModal({ className, ...handlers }) {
|
|
|
5394
5407
|
|
|
5395
5408
|
Object.defineProperty(exports, "AccountingApiError", {
|
|
5396
5409
|
enumerable: true,
|
|
5397
|
-
get: function () { return
|
|
5410
|
+
get: function () { return chunkKCXYYUUG_cjs.AccountingApiError; }
|
|
5398
5411
|
});
|
|
5399
5412
|
Object.defineProperty(exports, "Button", {
|
|
5400
5413
|
enumerable: true,
|
|
5401
|
-
get: function () { return
|
|
5414
|
+
get: function () { return chunkKCXYYUUG_cjs.Button; }
|
|
5402
5415
|
});
|
|
5403
5416
|
Object.defineProperty(exports, "DEFAULT_LOCK_DURATION_SECONDS", {
|
|
5404
5417
|
enumerable: true,
|
|
5405
|
-
get: function () { return
|
|
5418
|
+
get: function () { return chunkKCXYYUUG_cjs.DEFAULT_LOCK_DURATION_SECONDS; }
|
|
5406
5419
|
});
|
|
5407
5420
|
Object.defineProperty(exports, "DEFAULT_ONRAMP_LOCK_BUFFER", {
|
|
5408
5421
|
enumerable: true,
|
|
5409
|
-
get: function () { return
|
|
5422
|
+
get: function () { return chunkKCXYYUUG_cjs.DEFAULT_ONRAMP_LOCK_BUFFER; }
|
|
5410
5423
|
});
|
|
5411
5424
|
Object.defineProperty(exports, "HOSTED_AUTH_CLOCK_SKEW_MS", {
|
|
5412
5425
|
enumerable: true,
|
|
5413
|
-
get: function () { return
|
|
5426
|
+
get: function () { return chunkKCXYYUUG_cjs.HOSTED_AUTH_CLOCK_SKEW_MS; }
|
|
5414
5427
|
});
|
|
5415
5428
|
Object.defineProperty(exports, "HostedAuthError", {
|
|
5416
5429
|
enumerable: true,
|
|
5417
|
-
get: function () { return
|
|
5430
|
+
get: function () { return chunkKCXYYUUG_cjs.HostedAuthError; }
|
|
5418
5431
|
});
|
|
5419
5432
|
Object.defineProperty(exports, "HostedAuthRequiredError", {
|
|
5420
5433
|
enumerable: true,
|
|
5421
|
-
get: function () { return
|
|
5434
|
+
get: function () { return chunkKCXYYUUG_cjs.HostedAuthRequiredError; }
|
|
5422
5435
|
});
|
|
5423
5436
|
Object.defineProperty(exports, "HostedAuthStateMismatchError", {
|
|
5424
5437
|
enumerable: true,
|
|
5425
|
-
get: function () { return
|
|
5438
|
+
get: function () { return chunkKCXYYUUG_cjs.HostedAuthStateMismatchError; }
|
|
5426
5439
|
});
|
|
5427
5440
|
Object.defineProperty(exports, "HttpClient", {
|
|
5428
5441
|
enumerable: true,
|
|
5429
|
-
get: function () { return
|
|
5442
|
+
get: function () { return chunkKCXYYUUG_cjs.HttpClient; }
|
|
5430
5443
|
});
|
|
5431
5444
|
Object.defineProperty(exports, "LOCK_TYPES", {
|
|
5432
5445
|
enumerable: true,
|
|
5433
|
-
get: function () { return
|
|
5446
|
+
get: function () { return chunkKCXYYUUG_cjs.LOCK_TYPES; }
|
|
5434
5447
|
});
|
|
5435
5448
|
Object.defineProperty(exports, "MODIFY_LOCK_TYPES", {
|
|
5436
5449
|
enumerable: true,
|
|
5437
|
-
get: function () { return
|
|
5450
|
+
get: function () { return chunkKCXYYUUG_cjs.MODIFY_LOCK_TYPES; }
|
|
5438
5451
|
});
|
|
5439
5452
|
Object.defineProperty(exports, "NETWORK_CONFIG", {
|
|
5440
5453
|
enumerable: true,
|
|
5441
|
-
get: function () { return
|
|
5454
|
+
get: function () { return chunkKCXYYUUG_cjs.NETWORK_CONFIG; }
|
|
5442
5455
|
});
|
|
5443
5456
|
Object.defineProperty(exports, "NetworkError", {
|
|
5444
5457
|
enumerable: true,
|
|
5445
|
-
get: function () { return
|
|
5458
|
+
get: function () { return chunkKCXYYUUG_cjs.NetworkError; }
|
|
5446
5459
|
});
|
|
5447
5460
|
Object.defineProperty(exports, "PostDepositLockError", {
|
|
5448
5461
|
enumerable: true,
|
|
5449
|
-
get: function () { return
|
|
5462
|
+
get: function () { return chunkKCXYYUUG_cjs.PostDepositLockError; }
|
|
5450
5463
|
});
|
|
5451
5464
|
Object.defineProperty(exports, "PrivanaClient", {
|
|
5452
5465
|
enumerable: true,
|
|
5453
|
-
get: function () { return
|
|
5466
|
+
get: function () { return chunkKCXYYUUG_cjs.PrivanaClient; }
|
|
5454
5467
|
});
|
|
5455
5468
|
Object.defineProperty(exports, "PrivanaProvider", {
|
|
5456
5469
|
enumerable: true,
|
|
5457
|
-
get: function () { return
|
|
5470
|
+
get: function () { return chunkKCXYYUUG_cjs.PrivanaProvider; }
|
|
5458
5471
|
});
|
|
5459
5472
|
Object.defineProperty(exports, "SUPPORTED_CHAINS", {
|
|
5460
5473
|
enumerable: true,
|
|
5461
|
-
get: function () { return
|
|
5474
|
+
get: function () { return chunkKCXYYUUG_cjs.SUPPORTED_CHAINS; }
|
|
5462
5475
|
});
|
|
5463
5476
|
Object.defineProperty(exports, "SiweAuthProvider", {
|
|
5464
5477
|
enumerable: true,
|
|
5465
|
-
get: function () { return
|
|
5478
|
+
get: function () { return chunkKCXYYUUG_cjs.SiweAuthProvider; }
|
|
5466
5479
|
});
|
|
5467
5480
|
Object.defineProperty(exports, "Skeleton", {
|
|
5468
5481
|
enumerable: true,
|
|
5469
|
-
get: function () { return
|
|
5482
|
+
get: function () { return chunkKCXYYUUG_cjs.Skeleton; }
|
|
5470
5483
|
});
|
|
5471
5484
|
Object.defineProperty(exports, "TRANSFER_LOCKED_TYPES", {
|
|
5472
5485
|
enumerable: true,
|
|
5473
|
-
get: function () { return
|
|
5486
|
+
get: function () { return chunkKCXYYUUG_cjs.TRANSFER_LOCKED_TYPES; }
|
|
5474
5487
|
});
|
|
5475
5488
|
Object.defineProperty(exports, "TRANSFER_TYPES", {
|
|
5476
5489
|
enumerable: true,
|
|
5477
|
-
get: function () { return
|
|
5490
|
+
get: function () { return chunkKCXYYUUG_cjs.TRANSFER_TYPES; }
|
|
5478
5491
|
});
|
|
5479
5492
|
Object.defineProperty(exports, "ValidationError", {
|
|
5480
5493
|
enumerable: true,
|
|
5481
|
-
get: function () { return
|
|
5494
|
+
get: function () { return chunkKCXYYUUG_cjs.ValidationError; }
|
|
5482
5495
|
});
|
|
5483
5496
|
Object.defineProperty(exports, "WITHDRAW_FROM_LOCK_TYPES", {
|
|
5484
5497
|
enumerable: true,
|
|
5485
|
-
get: function () { return
|
|
5498
|
+
get: function () { return chunkKCXYYUUG_cjs.WITHDRAW_FROM_LOCK_TYPES; }
|
|
5486
5499
|
});
|
|
5487
5500
|
Object.defineProperty(exports, "WITHDRAW_TYPES", {
|
|
5488
5501
|
enumerable: true,
|
|
5489
|
-
get: function () { return
|
|
5502
|
+
get: function () { return chunkKCXYYUUG_cjs.WITHDRAW_TYPES; }
|
|
5490
5503
|
});
|
|
5491
5504
|
Object.defineProperty(exports, "applyLockBuffer", {
|
|
5492
5505
|
enumerable: true,
|
|
5493
|
-
get: function () { return
|
|
5506
|
+
get: function () { return chunkKCXYYUUG_cjs.applyLockBuffer; }
|
|
5494
5507
|
});
|
|
5495
5508
|
Object.defineProperty(exports, "applyRefreshResponse", {
|
|
5496
5509
|
enumerable: true,
|
|
5497
|
-
get: function () { return
|
|
5510
|
+
get: function () { return chunkKCXYYUUG_cjs.applyRefreshResponse; }
|
|
5498
5511
|
});
|
|
5499
5512
|
Object.defineProperty(exports, "buildHostedAuthSession", {
|
|
5500
5513
|
enumerable: true,
|
|
5501
|
-
get: function () { return
|
|
5514
|
+
get: function () { return chunkKCXYYUUG_cjs.buildHostedAuthSession; }
|
|
5502
5515
|
});
|
|
5503
5516
|
Object.defineProperty(exports, "buildSiweStatement", {
|
|
5504
5517
|
enumerable: true,
|
|
5505
|
-
get: function () { return
|
|
5518
|
+
get: function () { return chunkKCXYYUUG_cjs.buildSiweStatement; }
|
|
5506
5519
|
});
|
|
5507
5520
|
Object.defineProperty(exports, "buttonVariants", {
|
|
5508
5521
|
enumerable: true,
|
|
5509
|
-
get: function () { return
|
|
5522
|
+
get: function () { return chunkKCXYYUUG_cjs.buttonVariants; }
|
|
5510
5523
|
});
|
|
5511
5524
|
Object.defineProperty(exports, "clampLockAmount", {
|
|
5512
5525
|
enumerable: true,
|
|
5513
|
-
get: function () { return
|
|
5526
|
+
get: function () { return chunkKCXYYUUG_cjs.clampLockAmount; }
|
|
5514
5527
|
});
|
|
5515
5528
|
Object.defineProperty(exports, "clearHostedAuthPendingTransaction", {
|
|
5516
5529
|
enumerable: true,
|
|
5517
|
-
get: function () { return
|
|
5530
|
+
get: function () { return chunkKCXYYUUG_cjs.clearHostedAuthPendingTransaction; }
|
|
5518
5531
|
});
|
|
5519
5532
|
Object.defineProperty(exports, "clearPendingLock", {
|
|
5520
5533
|
enumerable: true,
|
|
5521
|
-
get: function () { return
|
|
5534
|
+
get: function () { return chunkKCXYYUUG_cjs.clearPendingLock; }
|
|
5522
5535
|
});
|
|
5523
5536
|
Object.defineProperty(exports, "createDomain", {
|
|
5524
5537
|
enumerable: true,
|
|
5525
|
-
get: function () { return
|
|
5538
|
+
get: function () { return chunkKCXYYUUG_cjs.createDomain; }
|
|
5526
5539
|
});
|
|
5527
5540
|
Object.defineProperty(exports, "createHostedAuthPendingStorageKey", {
|
|
5528
5541
|
enumerable: true,
|
|
5529
|
-
get: function () { return
|
|
5542
|
+
get: function () { return chunkKCXYYUUG_cjs.createHostedAuthPendingStorageKey; }
|
|
5530
5543
|
});
|
|
5531
5544
|
Object.defineProperty(exports, "createHostedAuthState", {
|
|
5532
5545
|
enumerable: true,
|
|
5533
|
-
get: function () { return
|
|
5546
|
+
get: function () { return chunkKCXYYUUG_cjs.createHostedAuthState; }
|
|
5534
5547
|
});
|
|
5535
5548
|
Object.defineProperty(exports, "createHostedAuthStorageKey", {
|
|
5536
5549
|
enumerable: true,
|
|
5537
|
-
get: function () { return
|
|
5550
|
+
get: function () { return chunkKCXYYUUG_cjs.createHostedAuthStorageKey; }
|
|
5538
5551
|
});
|
|
5539
5552
|
Object.defineProperty(exports, "createLockExpiry", {
|
|
5540
5553
|
enumerable: true,
|
|
5541
|
-
get: function () { return
|
|
5554
|
+
get: function () { return chunkKCXYYUUG_cjs.createLockExpiry; }
|
|
5542
5555
|
});
|
|
5543
5556
|
Object.defineProperty(exports, "createPkceChallenge", {
|
|
5544
5557
|
enumerable: true,
|
|
5545
|
-
get: function () { return
|
|
5558
|
+
get: function () { return chunkKCXYYUUG_cjs.createPkceChallenge; }
|
|
5546
5559
|
});
|
|
5547
5560
|
Object.defineProperty(exports, "createPkceVerifier", {
|
|
5548
5561
|
enumerable: true,
|
|
5549
|
-
get: function () { return
|
|
5562
|
+
get: function () { return chunkKCXYYUUG_cjs.createPkceVerifier; }
|
|
5550
5563
|
});
|
|
5551
5564
|
Object.defineProperty(exports, "createSignedLockRequest", {
|
|
5552
5565
|
enumerable: true,
|
|
5553
|
-
get: function () { return
|
|
5566
|
+
get: function () { return chunkKCXYYUUG_cjs.createSignedLockRequest; }
|
|
5554
5567
|
});
|
|
5555
5568
|
Object.defineProperty(exports, "getAccountingContract", {
|
|
5556
5569
|
enumerable: true,
|
|
5557
|
-
get: function () { return
|
|
5570
|
+
get: function () { return chunkKCXYYUUG_cjs.getAccountingContract; }
|
|
5558
5571
|
});
|
|
5559
5572
|
Object.defineProperty(exports, "getApiUrl", {
|
|
5560
5573
|
enumerable: true,
|
|
5561
|
-
get: function () { return
|
|
5574
|
+
get: function () { return chunkKCXYYUUG_cjs.getApiUrl; }
|
|
5562
5575
|
});
|
|
5563
5576
|
Object.defineProperty(exports, "getChainById", {
|
|
5564
5577
|
enumerable: true,
|
|
5565
|
-
get: function () { return
|
|
5578
|
+
get: function () { return chunkKCXYYUUG_cjs.getChainById; }
|
|
5566
5579
|
});
|
|
5567
5580
|
Object.defineProperty(exports, "getChainId", {
|
|
5568
5581
|
enumerable: true,
|
|
5569
|
-
get: function () { return
|
|
5582
|
+
get: function () { return chunkKCXYYUUG_cjs.getChainId; }
|
|
5570
5583
|
});
|
|
5571
5584
|
Object.defineProperty(exports, "getExplorerAddressUrl", {
|
|
5572
5585
|
enumerable: true,
|
|
5573
|
-
get: function () { return
|
|
5586
|
+
get: function () { return chunkKCXYYUUG_cjs.getExplorerAddressUrl; }
|
|
5574
5587
|
});
|
|
5575
5588
|
Object.defineProperty(exports, "getExplorerLabel", {
|
|
5576
5589
|
enumerable: true,
|
|
5577
|
-
get: function () { return
|
|
5590
|
+
get: function () { return chunkKCXYYUUG_cjs.getExplorerLabel; }
|
|
5578
5591
|
});
|
|
5579
5592
|
Object.defineProperty(exports, "isHostedAuthRefreshActive", {
|
|
5580
5593
|
enumerable: true,
|
|
5581
|
-
get: function () { return
|
|
5594
|
+
get: function () { return chunkKCXYYUUG_cjs.isHostedAuthRefreshActive; }
|
|
5582
5595
|
});
|
|
5583
5596
|
Object.defineProperty(exports, "isHostedAuthSessionActive", {
|
|
5584
5597
|
enumerable: true,
|
|
5585
|
-
get: function () { return
|
|
5598
|
+
get: function () { return chunkKCXYYUUG_cjs.isHostedAuthSessionActive; }
|
|
5586
5599
|
});
|
|
5587
5600
|
Object.defineProperty(exports, "isSignedLockUsable", {
|
|
5588
5601
|
enumerable: true,
|
|
5589
|
-
get: function () { return
|
|
5602
|
+
get: function () { return chunkKCXYYUUG_cjs.isSignedLockUsable; }
|
|
5590
5603
|
});
|
|
5591
5604
|
Object.defineProperty(exports, "loadPendingLock", {
|
|
5592
5605
|
enumerable: true,
|
|
5593
|
-
get: function () { return
|
|
5606
|
+
get: function () { return chunkKCXYYUUG_cjs.loadPendingLock; }
|
|
5594
5607
|
});
|
|
5595
5608
|
Object.defineProperty(exports, "normalizeAddress", {
|
|
5596
5609
|
enumerable: true,
|
|
5597
|
-
get: function () { return
|
|
5610
|
+
get: function () { return chunkKCXYYUUG_cjs.normalizeAddress; }
|
|
5598
5611
|
});
|
|
5599
5612
|
Object.defineProperty(exports, "normalizeHex", {
|
|
5600
5613
|
enumerable: true,
|
|
5601
|
-
get: function () { return
|
|
5614
|
+
get: function () { return chunkKCXYYUUG_cjs.normalizeHex; }
|
|
5602
5615
|
});
|
|
5603
5616
|
Object.defineProperty(exports, "parseHostedAuthCallback", {
|
|
5604
5617
|
enumerable: true,
|
|
5605
|
-
get: function () { return
|
|
5618
|
+
get: function () { return chunkKCXYYUUG_cjs.parseHostedAuthCallback; }
|
|
5606
5619
|
});
|
|
5607
5620
|
Object.defineProperty(exports, "persistHostedAuthPendingTransaction", {
|
|
5608
5621
|
enumerable: true,
|
|
5609
|
-
get: function () { return
|
|
5622
|
+
get: function () { return chunkKCXYYUUG_cjs.persistHostedAuthPendingTransaction; }
|
|
5610
5623
|
});
|
|
5611
5624
|
Object.defineProperty(exports, "readHostedAuthPendingTransaction", {
|
|
5612
5625
|
enumerable: true,
|
|
5613
|
-
get: function () { return
|
|
5626
|
+
get: function () { return chunkKCXYYUUG_cjs.readHostedAuthPendingTransaction; }
|
|
5614
5627
|
});
|
|
5615
5628
|
Object.defineProperty(exports, "readStoredHostedAuthSession", {
|
|
5616
5629
|
enumerable: true,
|
|
5617
|
-
get: function () { return
|
|
5630
|
+
get: function () { return chunkKCXYYUUG_cjs.readStoredHostedAuthSession; }
|
|
5618
5631
|
});
|
|
5619
5632
|
Object.defineProperty(exports, "requireDepositLockOwner", {
|
|
5620
5633
|
enumerable: true,
|
|
5621
|
-
get: function () { return
|
|
5634
|
+
get: function () { return chunkKCXYYUUG_cjs.requireDepositLockOwner; }
|
|
5622
5635
|
});
|
|
5623
5636
|
Object.defineProperty(exports, "requireServiceAddress", {
|
|
5624
5637
|
enumerable: true,
|
|
5625
|
-
get: function () { return
|
|
5638
|
+
get: function () { return chunkKCXYYUUG_cjs.requireServiceAddress; }
|
|
5626
5639
|
});
|
|
5627
5640
|
Object.defineProperty(exports, "savePendingLock", {
|
|
5628
5641
|
enumerable: true,
|
|
5629
|
-
get: function () { return
|
|
5642
|
+
get: function () { return chunkKCXYYUUG_cjs.savePendingLock; }
|
|
5630
5643
|
});
|
|
5631
5644
|
Object.defineProperty(exports, "signLockMessage", {
|
|
5632
5645
|
enumerable: true,
|
|
5633
|
-
get: function () { return
|
|
5646
|
+
get: function () { return chunkKCXYYUUG_cjs.signLockMessage; }
|
|
5634
5647
|
});
|
|
5635
5648
|
Object.defineProperty(exports, "signModifyLockMessage", {
|
|
5636
5649
|
enumerable: true,
|
|
5637
|
-
get: function () { return
|
|
5650
|
+
get: function () { return chunkKCXYYUUG_cjs.signModifyLockMessage; }
|
|
5638
5651
|
});
|
|
5639
5652
|
Object.defineProperty(exports, "signTransferLockedMessage", {
|
|
5640
5653
|
enumerable: true,
|
|
5641
|
-
get: function () { return
|
|
5654
|
+
get: function () { return chunkKCXYYUUG_cjs.signTransferLockedMessage; }
|
|
5642
5655
|
});
|
|
5643
5656
|
Object.defineProperty(exports, "signTransferMessage", {
|
|
5644
5657
|
enumerable: true,
|
|
5645
|
-
get: function () { return
|
|
5658
|
+
get: function () { return chunkKCXYYUUG_cjs.signTransferMessage; }
|
|
5646
5659
|
});
|
|
5647
5660
|
Object.defineProperty(exports, "signWithdrawFromLockMessage", {
|
|
5648
5661
|
enumerable: true,
|
|
5649
|
-
get: function () { return
|
|
5662
|
+
get: function () { return chunkKCXYYUUG_cjs.signWithdrawFromLockMessage; }
|
|
5650
5663
|
});
|
|
5651
5664
|
Object.defineProperty(exports, "signWithdrawMessage", {
|
|
5652
5665
|
enumerable: true,
|
|
5653
|
-
get: function () { return
|
|
5666
|
+
get: function () { return chunkKCXYYUUG_cjs.signWithdrawMessage; }
|
|
5654
5667
|
});
|
|
5655
5668
|
Object.defineProperty(exports, "stripHostedAuthCallbackParams", {
|
|
5656
5669
|
enumerable: true,
|
|
5657
|
-
get: function () { return
|
|
5670
|
+
get: function () { return chunkKCXYYUUG_cjs.stripHostedAuthCallbackParams; }
|
|
5658
5671
|
});
|
|
5659
5672
|
Object.defineProperty(exports, "submitPendingLock", {
|
|
5660
5673
|
enumerable: true,
|
|
5661
|
-
get: function () { return
|
|
5674
|
+
get: function () { return chunkKCXYYUUG_cjs.submitPendingLock; }
|
|
5662
5675
|
});
|
|
5663
5676
|
Object.defineProperty(exports, "syncHostedAuthSessionToClient", {
|
|
5664
5677
|
enumerable: true,
|
|
5665
|
-
get: function () { return
|
|
5678
|
+
get: function () { return chunkKCXYYUUG_cjs.syncHostedAuthSessionToClient; }
|
|
5666
5679
|
});
|
|
5667
5680
|
Object.defineProperty(exports, "useDepositVerification", {
|
|
5668
5681
|
enumerable: true,
|
|
5669
|
-
get: function () { return
|
|
5682
|
+
get: function () { return chunkKCXYYUUG_cjs.useDepositVerification; }
|
|
5670
5683
|
});
|
|
5671
5684
|
Object.defineProperty(exports, "usePrivanaContext", {
|
|
5672
5685
|
enumerable: true,
|
|
5673
|
-
get: function () { return
|
|
5686
|
+
get: function () { return chunkKCXYYUUG_cjs.usePrivanaContext; }
|
|
5674
5687
|
});
|
|
5675
5688
|
Object.defineProperty(exports, "useSafeAccount", {
|
|
5676
5689
|
enumerable: true,
|
|
5677
|
-
get: function () { return
|
|
5690
|
+
get: function () { return chunkKCXYYUUG_cjs.useSafeAccount; }
|
|
5678
5691
|
});
|
|
5679
5692
|
Object.defineProperty(exports, "useSafePrivanaContext", {
|
|
5680
5693
|
enumerable: true,
|
|
5681
|
-
get: function () { return
|
|
5694
|
+
get: function () { return chunkKCXYYUUG_cjs.useSafePrivanaContext; }
|
|
5682
5695
|
});
|
|
5683
5696
|
Object.defineProperty(exports, "useSiweAuth", {
|
|
5684
5697
|
enumerable: true,
|
|
5685
|
-
get: function () { return
|
|
5698
|
+
get: function () { return chunkKCXYYUUG_cjs.useSiweAuth; }
|
|
5686
5699
|
});
|
|
5687
5700
|
exports.DepositInlineModal = DepositInlineModal;
|
|
5688
5701
|
exports.DepositModal = DepositModal;
|