@oasisprotocol/privana-sdk 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-4IW4V7YJ.cjs → chunk-UHXVYWTF.cjs} +9 -2
- package/dist/chunk-UHXVYWTF.cjs.map +1 -0
- package/dist/{chunk-SAJ7K5WT.js → chunk-ZVUMV4NR.js} +10 -4
- package/dist/chunk-ZVUMV4NR.js.map +1 -0
- package/dist/index.cjs +351 -271
- 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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +115 -35
- package/dist/index.js.map +1 -1
- package/dist/on-ramp.cjs +3 -3
- package/dist/on-ramp.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4IW4V7YJ.cjs.map +0 -1
- package/dist/chunk-SAJ7K5WT.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 chunkUHXVYWTF_cjs = require('./chunk-UHXVYWTF.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 } = chunkUHXVYWTF_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 chunkUHXVYWTF_cjs.AccountingApiError && error.detail) {
|
|
44
|
+
return new chunkUHXVYWTF_cjs.HostedAuthError(error.detail);
|
|
45
45
|
}
|
|
46
46
|
if (error instanceof Error) {
|
|
47
47
|
return error;
|
|
48
48
|
}
|
|
49
|
-
return new
|
|
49
|
+
return new chunkUHXVYWTF_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
|
+
} = chunkUHXVYWTF_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 ? chunkUHXVYWTF_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
|
+
chunkUHXVYWTF_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 chunkUHXVYWTF_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 chunkUHXVYWTF_cjs.HostedAuthError("Hosted redirect authentication requires a browser environment.");
|
|
81
81
|
}
|
|
82
82
|
if (!pendingStorageKey) {
|
|
83
|
-
throw new
|
|
83
|
+
throw new chunkUHXVYWTF_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 = chunkUHXVYWTF_cjs.createPkceVerifier();
|
|
93
|
+
const codeChallenge = await chunkUHXVYWTF_cjs.createPkceChallenge(verifier);
|
|
94
|
+
const state = chunkUHXVYWTF_cjs.createHostedAuthState();
|
|
95
|
+
chunkUHXVYWTF_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 chunkUHXVYWTF_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 chunkUHXVYWTF_cjs.HostedAuthError("Hosted redirect authentication requires a browser environment.");
|
|
130
130
|
}
|
|
131
131
|
if (!pendingStorageKey) {
|
|
132
|
-
throw new
|
|
132
|
+
throw new chunkUHXVYWTF_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, "", chunkUHXVYWTF_cjs.stripHostedAuthCallbackParams(callbackUrl));
|
|
143
143
|
};
|
|
144
144
|
try {
|
|
145
|
-
const callback =
|
|
145
|
+
const callback = chunkUHXVYWTF_cjs.parseHostedAuthCallback(callbackUrl, hostedAuthConfig.redirectUri);
|
|
146
146
|
if (!callback) {
|
|
147
147
|
return null;
|
|
148
148
|
}
|
|
149
|
-
const pending =
|
|
149
|
+
const pending = chunkUHXVYWTF_cjs.readHostedAuthPendingTransaction(window.sessionStorage, pendingStorageKey);
|
|
150
150
|
if (!pending) {
|
|
151
151
|
clearPendingLogin();
|
|
152
152
|
cleanupCallbackUrl();
|
|
153
|
-
throw new
|
|
153
|
+
throw new chunkUHXVYWTF_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 chunkUHXVYWTF_cjs.HostedAuthStateMismatchError();
|
|
161
161
|
}
|
|
162
162
|
if ("error" in callback) {
|
|
163
163
|
clearPendingLogin();
|
|
164
164
|
cleanupCallbackUrl();
|
|
165
|
-
throw new
|
|
165
|
+
throw new chunkUHXVYWTF_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 = chunkUHXVYWTF_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 chunkUHXVYWTF_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 = chunkUHXVYWTF_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 } = chunkUHXVYWTF_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: chunkUHXVYWTF_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 } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
278
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkUHXVYWTF_cjs.usePrivateReadRequest();
|
|
279
279
|
const query = reactQuery.useQuery({
|
|
280
280
|
queryKey: ["accounting-batch-balances", ...privateReadQueryScope, options.tokenIds],
|
|
281
281
|
queryFn: async () => {
|
|
@@ -298,17 +298,17 @@ function storageKey(address) {
|
|
|
298
298
|
return `privana:pending-deposit:${address.toLowerCase()}`;
|
|
299
299
|
}
|
|
300
300
|
function savePendingDeposit(address, data) {
|
|
301
|
-
const stored =
|
|
301
|
+
const stored = chunkUHXVYWTF_cjs.setBrowserStorageItem(storageKey(address), JSON.stringify(data));
|
|
302
302
|
if (!stored && data.signedLock) {
|
|
303
303
|
throw new Error("Unable to persist pending locked deposit for recovery");
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
306
|
function loadPendingDeposit(address) {
|
|
307
307
|
try {
|
|
308
|
-
const raw =
|
|
308
|
+
const raw = chunkUHXVYWTF_cjs.getBrowserStorageItem(storageKey(address));
|
|
309
309
|
if (!raw) return null;
|
|
310
310
|
const data = JSON.parse(raw);
|
|
311
|
-
if (Date.now() - data.savedAt > STALE_MS && !(data.signedLock &&
|
|
311
|
+
if (Date.now() - data.savedAt > STALE_MS && !(data.signedLock && chunkUHXVYWTF_cjs.isSignedLockUsable(data.signedLock))) {
|
|
312
312
|
clearPendingDeposit(address);
|
|
313
313
|
return null;
|
|
314
314
|
}
|
|
@@ -320,21 +320,21 @@ function loadPendingDeposit(address) {
|
|
|
320
320
|
function clearPendingDeposit(address, onlyForTxHash) {
|
|
321
321
|
if (onlyForTxHash) {
|
|
322
322
|
try {
|
|
323
|
-
const raw =
|
|
323
|
+
const raw = chunkUHXVYWTF_cjs.getBrowserStorageItem(storageKey(address));
|
|
324
324
|
const recordTxHash = raw ? JSON.parse(raw).txHash : void 0;
|
|
325
325
|
if (recordTxHash && recordTxHash !== onlyForTxHash) return;
|
|
326
326
|
} catch {
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
|
|
329
|
+
chunkUHXVYWTF_cjs.removeBrowserStorageItem(storageKey(address));
|
|
330
330
|
}
|
|
331
331
|
function useDeposit(options = {}) {
|
|
332
332
|
const { address } = wagmi.useAccount();
|
|
333
|
-
const { client, enabledTokens, getChainById: getChainById2, networkConfig, serviceAddress } =
|
|
333
|
+
const { client, enabledTokens, getChainById: getChainById2, networkConfig, serviceAddress } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
334
334
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
335
335
|
const queryClient = reactQuery.useQueryClient();
|
|
336
336
|
const config = wagmi.useConfig();
|
|
337
|
-
const { executePrivateRead } =
|
|
337
|
+
const { executePrivateRead } = chunkUHXVYWTF_cjs.usePrivateReadRequest();
|
|
338
338
|
const confirmations = options.confirmations ?? 15;
|
|
339
339
|
const [depositAddress, setDepositAddress] = react.useState(null);
|
|
340
340
|
const [txHash, setTxHash] = react.useState();
|
|
@@ -372,7 +372,7 @@ function useDeposit(options = {}) {
|
|
|
372
372
|
const submitPendingLockAfterCredit = react.useCallback(
|
|
373
373
|
async (signedLock, response) => {
|
|
374
374
|
try {
|
|
375
|
-
const result = await
|
|
375
|
+
const result = await chunkUHXVYWTF_cjs.submitPendingLock({
|
|
376
376
|
client,
|
|
377
377
|
payload: signedLock,
|
|
378
378
|
creditedAmount: response.amount != null ? BigInt(response.amount) : void 0
|
|
@@ -383,7 +383,7 @@ function useDeposit(options = {}) {
|
|
|
383
383
|
queryClient.invalidateQueries({ queryKey: ["accounting-history"] });
|
|
384
384
|
onLockSubmittedRef.current?.(result);
|
|
385
385
|
} catch (err) {
|
|
386
|
-
const error2 = err instanceof
|
|
386
|
+
const error2 = err instanceof chunkUHXVYWTF_cjs.PostDepositLockError ? err : new chunkUHXVYWTF_cjs.PostDepositLockError(
|
|
387
387
|
err instanceof Error ? err.message : "Lock submission failed",
|
|
388
388
|
"submission-failed",
|
|
389
389
|
BigInt(signedLock.amount),
|
|
@@ -402,7 +402,7 @@ function useDeposit(options = {}) {
|
|
|
402
402
|
error: verificationError,
|
|
403
403
|
verify,
|
|
404
404
|
reset: resetVerification
|
|
405
|
-
} =
|
|
405
|
+
} = chunkUHXVYWTF_cjs.useDepositVerification({
|
|
406
406
|
pollInterval: options.pollInterval,
|
|
407
407
|
pollTimeout: options.pollTimeout,
|
|
408
408
|
onCredited: (hash, response) => {
|
|
@@ -452,7 +452,7 @@ function useDeposit(options = {}) {
|
|
|
452
452
|
} = wagmi.useSendTransaction();
|
|
453
453
|
const isSendingTx = isWritingContract || isSendingNative;
|
|
454
454
|
const sendError = writeError ?? sendNativeError;
|
|
455
|
-
const { ensureCorrectChain } =
|
|
455
|
+
const { ensureCorrectChain } = chunkUHXVYWTF_cjs.useEnsureCorrectChain();
|
|
456
456
|
const invalidateGeneration = react.useCallback(() => {
|
|
457
457
|
generationRef.current++;
|
|
458
458
|
}, []);
|
|
@@ -500,12 +500,16 @@ function useDeposit(options = {}) {
|
|
|
500
500
|
try {
|
|
501
501
|
let confirmed = false;
|
|
502
502
|
try {
|
|
503
|
-
await
|
|
504
|
-
|
|
503
|
+
const receipt = await chunkUHXVYWTF_cjs.getTransactionReceipt(config, {
|
|
504
|
+
hash,
|
|
505
|
+
chainId: persisted.chainId
|
|
506
|
+
});
|
|
507
|
+
const blockNumber = await chunkUHXVYWTF_cjs.getBlockNumber(config, { chainId: persisted.chainId });
|
|
508
|
+
confirmed = blockNumber - receipt.blockNumber + 1n >= BigInt(confirmations);
|
|
505
509
|
} catch {
|
|
506
510
|
}
|
|
507
511
|
if (!confirmed) {
|
|
508
|
-
await
|
|
512
|
+
await chunkUHXVYWTF_cjs.waitForTransactionReceipt(config, {
|
|
509
513
|
hash,
|
|
510
514
|
chainId: persisted.chainId,
|
|
511
515
|
confirmations
|
|
@@ -556,10 +560,10 @@ function useDeposit(options = {}) {
|
|
|
556
560
|
`Amount is below the minimum deposit (${minAmountStr}) for ${isNative ? "native" : "ERC-20"} on chain ${sourceChain.id}`
|
|
557
561
|
);
|
|
558
562
|
}
|
|
559
|
-
if (params.postDepositLock && !
|
|
563
|
+
if (params.postDepositLock && !chunkUHXVYWTF_cjs.canUseBrowserStorage()) {
|
|
560
564
|
throw new Error("Browser storage is required for locked deposit recovery");
|
|
561
565
|
}
|
|
562
|
-
const lockAmount =
|
|
566
|
+
const lockAmount = chunkUHXVYWTF_cjs.clampLockAmount(params.amount, params.postDepositLock?.maxAmount);
|
|
563
567
|
let signedLock;
|
|
564
568
|
if (params.postDepositLock) {
|
|
565
569
|
setIsSwitchingChain(true);
|
|
@@ -569,10 +573,10 @@ function useDeposit(options = {}) {
|
|
|
569
573
|
if (!isStale()) setIsSwitchingChain(false);
|
|
570
574
|
}
|
|
571
575
|
if (isStale()) return;
|
|
572
|
-
const signingWalletClient = await
|
|
576
|
+
const signingWalletClient = await chunkUHXVYWTF_cjs.getWalletClient(config, {
|
|
573
577
|
chainId: networkConfig.chainId
|
|
574
578
|
});
|
|
575
|
-
signedLock = await
|
|
579
|
+
signedLock = await chunkUHXVYWTF_cjs.createSignedLockRequest({
|
|
576
580
|
client,
|
|
577
581
|
walletClient: signingWalletClient,
|
|
578
582
|
userAddress: address,
|
|
@@ -628,7 +632,7 @@ function useDeposit(options = {}) {
|
|
|
628
632
|
try {
|
|
629
633
|
setIsWaitingForConfirmation(true);
|
|
630
634
|
try {
|
|
631
|
-
await
|
|
635
|
+
await chunkUHXVYWTF_cjs.waitForTransactionReceipt(config, {
|
|
632
636
|
hash,
|
|
633
637
|
chainId: sourceChain.id,
|
|
634
638
|
confirmations
|
|
@@ -710,10 +714,10 @@ function requireServiceAddress(serviceAddress) {
|
|
|
710
714
|
}
|
|
711
715
|
function useDepositAddress(options = {}) {
|
|
712
716
|
const queryClient = react.useContext(reactQuery.QueryClientContext);
|
|
713
|
-
const accountingContext =
|
|
717
|
+
const accountingContext = chunkUHXVYWTF_cjs.useSafePrivanaContext();
|
|
714
718
|
const hasProviders = !!queryClient && !!accountingContext;
|
|
715
719
|
const client = accountingContext?.client;
|
|
716
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
720
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkUHXVYWTF_cjs.usePrivateReadRequest();
|
|
717
721
|
const isReady = hasProviders && privateReadReady && !!privateReadAddress && !!client;
|
|
718
722
|
const query = reactQuery.useQuery({
|
|
719
723
|
queryKey: ["accounting-deposit-address", ...privateReadQueryScope],
|
|
@@ -736,9 +740,9 @@ function useDepositAddress(options = {}) {
|
|
|
736
740
|
function useWithdraw(options = {}) {
|
|
737
741
|
const { address } = wagmi.useAccount();
|
|
738
742
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
739
|
-
const { client, networkConfig } =
|
|
743
|
+
const { client, networkConfig } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
740
744
|
const queryClient = reactQuery.useQueryClient();
|
|
741
|
-
const { chainId, ensureCorrectChain } =
|
|
745
|
+
const { chainId, ensureCorrectChain } = chunkUHXVYWTF_cjs.useEnsureCorrectChain();
|
|
742
746
|
const pollInterval = options.pollInterval ?? 3e3;
|
|
743
747
|
const pollTimeout = options.pollTimeout ?? 18e4;
|
|
744
748
|
const [currentStep, setCurrentStep] = react.useState("idle");
|
|
@@ -806,7 +810,7 @@ function useWithdraw(options = {}) {
|
|
|
806
810
|
if (isStale()) return void 0;
|
|
807
811
|
const nonce = BigInt(nonceResponse.nonce);
|
|
808
812
|
setCurrentStep("signing");
|
|
809
|
-
const signature = await
|
|
813
|
+
const signature = await chunkUHXVYWTF_cjs.signWithdrawMessage({
|
|
810
814
|
walletClient,
|
|
811
815
|
chainId: signingChainId,
|
|
812
816
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -935,7 +939,7 @@ function useWithdraw(options = {}) {
|
|
|
935
939
|
function useLockFunds(options = {}) {
|
|
936
940
|
const { address } = wagmi.useAccount();
|
|
937
941
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
938
|
-
const { client, networkConfig, serviceAddress } =
|
|
942
|
+
const { client, networkConfig, serviceAddress } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
939
943
|
const queryClient = reactQuery.useQueryClient();
|
|
940
944
|
const mutation = reactQuery.useMutation({
|
|
941
945
|
mutationFn: async (params) => {
|
|
@@ -946,7 +950,7 @@ function useLockFunds(options = {}) {
|
|
|
946
950
|
throw new Error("Service address not configured");
|
|
947
951
|
}
|
|
948
952
|
const { nonce } = await client.getLockNonce(address);
|
|
949
|
-
const signature = await
|
|
953
|
+
const signature = await chunkUHXVYWTF_cjs.signLockMessage({
|
|
950
954
|
walletClient,
|
|
951
955
|
chainId: networkConfig.chainId,
|
|
952
956
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -994,7 +998,7 @@ function useLockFunds(options = {}) {
|
|
|
994
998
|
}
|
|
995
999
|
function useUnlockFunds(options = {}) {
|
|
996
1000
|
const { address } = wagmi.useAccount();
|
|
997
|
-
const { client } =
|
|
1001
|
+
const { client } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
998
1002
|
const queryClient = reactQuery.useQueryClient();
|
|
999
1003
|
const unlockMutation = reactQuery.useMutation({
|
|
1000
1004
|
mutationFn: async (params) => {
|
|
@@ -1064,7 +1068,7 @@ function useUnlockFunds(options = {}) {
|
|
|
1064
1068
|
function useTransfer(options = {}) {
|
|
1065
1069
|
const { address } = wagmi.useAccount();
|
|
1066
1070
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
1067
|
-
const { client, networkConfig, serviceAddress } =
|
|
1071
|
+
const { client, networkConfig, serviceAddress } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
1068
1072
|
const queryClient = reactQuery.useQueryClient();
|
|
1069
1073
|
const transferMutation = reactQuery.useMutation({
|
|
1070
1074
|
mutationFn: async (params) => {
|
|
@@ -1072,7 +1076,7 @@ function useTransfer(options = {}) {
|
|
|
1072
1076
|
throw new Error("Wallet not connected");
|
|
1073
1077
|
}
|
|
1074
1078
|
const { nonce } = await client.getTransferNonce(address);
|
|
1075
|
-
const signature = await
|
|
1079
|
+
const signature = await chunkUHXVYWTF_cjs.signTransferMessage({
|
|
1076
1080
|
walletClient,
|
|
1077
1081
|
chainId: networkConfig.chainId,
|
|
1078
1082
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1109,7 +1113,7 @@ function useTransfer(options = {}) {
|
|
|
1109
1113
|
throw new Error("Service address not configured");
|
|
1110
1114
|
}
|
|
1111
1115
|
const { nonce } = await client.getTransferLockedNonce(serviceAddress);
|
|
1112
|
-
const signature = await
|
|
1116
|
+
const signature = await chunkUHXVYWTF_cjs.signTransferLockedMessage({
|
|
1113
1117
|
walletClient,
|
|
1114
1118
|
chainId: networkConfig.chainId,
|
|
1115
1119
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1169,8 +1173,8 @@ function useTransfer(options = {}) {
|
|
|
1169
1173
|
};
|
|
1170
1174
|
}
|
|
1171
1175
|
function useLockedFunds(options = {}) {
|
|
1172
|
-
const { client, pollingInterval, serviceAddress } =
|
|
1173
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1176
|
+
const { client, pollingInterval, serviceAddress } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
1177
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkUHXVYWTF_cjs.usePrivateReadRequest();
|
|
1174
1178
|
const query = reactQuery.useQuery({
|
|
1175
1179
|
queryKey: ["accounting-locked-funds", ...privateReadQueryScope, serviceAddress ?? null],
|
|
1176
1180
|
queryFn: async () => {
|
|
@@ -1192,8 +1196,8 @@ function useLockedFunds(options = {}) {
|
|
|
1192
1196
|
};
|
|
1193
1197
|
}
|
|
1194
1198
|
function useTotalLockedBalance(options = {}) {
|
|
1195
|
-
const { client, pollingInterval, defaultToken } =
|
|
1196
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1199
|
+
const { client, pollingInterval, defaultToken } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
1200
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkUHXVYWTF_cjs.usePrivateReadRequest();
|
|
1197
1201
|
const tokenId = options.tokenId ?? defaultToken?.id;
|
|
1198
1202
|
const query = reactQuery.useQuery({
|
|
1199
1203
|
queryKey: ["accounting-total-locked-balance", ...privateReadQueryScope, tokenId],
|
|
@@ -1214,8 +1218,8 @@ function useTotalLockedBalance(options = {}) {
|
|
|
1214
1218
|
};
|
|
1215
1219
|
}
|
|
1216
1220
|
function useExpiredLocks(options = {}) {
|
|
1217
|
-
const { client, pollingInterval } =
|
|
1218
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1221
|
+
const { client, pollingInterval } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
1222
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkUHXVYWTF_cjs.usePrivateReadRequest();
|
|
1219
1223
|
const query = reactQuery.useQuery({
|
|
1220
1224
|
queryKey: ["accounting-expired-locks", ...privateReadQueryScope],
|
|
1221
1225
|
queryFn: async () => {
|
|
@@ -1236,14 +1240,14 @@ function useExpiredLocks(options = {}) {
|
|
|
1236
1240
|
};
|
|
1237
1241
|
}
|
|
1238
1242
|
function statusCodeOf(error) {
|
|
1239
|
-
return error instanceof
|
|
1243
|
+
return error instanceof chunkUHXVYWTF_cjs.AccountingApiError ? error.statusCode : void 0;
|
|
1240
1244
|
}
|
|
1241
1245
|
function usePendingDeposits(options = {}) {
|
|
1242
1246
|
const queryClient = react.useContext(reactQuery.QueryClientContext);
|
|
1243
|
-
const accountingContext =
|
|
1247
|
+
const accountingContext = chunkUHXVYWTF_cjs.useSafePrivanaContext();
|
|
1244
1248
|
const hasProviders = !!queryClient && !!accountingContext;
|
|
1245
1249
|
const client = accountingContext?.client;
|
|
1246
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1250
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkUHXVYWTF_cjs.usePrivateReadRequest();
|
|
1247
1251
|
const { chainId, tokenAddress, lookbackBlocks } = options;
|
|
1248
1252
|
const query = reactQuery.useQuery({
|
|
1249
1253
|
queryKey: ["accounting-pending-deposits", ...privateReadQueryScope, chainId, tokenAddress],
|
|
@@ -1290,7 +1294,7 @@ function usePendingDeposits(options = {}) {
|
|
|
1290
1294
|
}
|
|
1291
1295
|
function usePendingWithdrawals(options = {}) {
|
|
1292
1296
|
const { address, isConnected } = wagmi.useAccount();
|
|
1293
|
-
const { client, pollingInterval } =
|
|
1297
|
+
const { client, pollingInterval } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
1294
1298
|
const query = reactQuery.useQuery({
|
|
1295
1299
|
queryKey: ["accounting-pending-withdrawals", address],
|
|
1296
1300
|
queryFn: async () => {
|
|
@@ -1326,8 +1330,8 @@ function usePendingWithdrawals(options = {}) {
|
|
|
1326
1330
|
};
|
|
1327
1331
|
}
|
|
1328
1332
|
function useHistory(options = {}) {
|
|
1329
|
-
const { client, pollingInterval } =
|
|
1330
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1333
|
+
const { client, pollingInterval } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
1334
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkUHXVYWTF_cjs.usePrivateReadRequest();
|
|
1331
1335
|
const offset = options.offset ?? -1;
|
|
1332
1336
|
const limit = options.limit ?? 50;
|
|
1333
1337
|
const query = reactQuery.useQuery({
|
|
@@ -1351,7 +1355,7 @@ function useHistory(options = {}) {
|
|
|
1351
1355
|
};
|
|
1352
1356
|
}
|
|
1353
1357
|
function useTokenInfo(options = {}) {
|
|
1354
|
-
const { client } =
|
|
1358
|
+
const { client } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
1355
1359
|
const { tokenId } = options;
|
|
1356
1360
|
const query = reactQuery.useQuery({
|
|
1357
1361
|
queryKey: ["accounting-token-info", tokenId],
|
|
@@ -1371,7 +1375,7 @@ function useTokenInfo(options = {}) {
|
|
|
1371
1375
|
};
|
|
1372
1376
|
}
|
|
1373
1377
|
function useTokenList(options = {}) {
|
|
1374
|
-
const { client } =
|
|
1378
|
+
const { client } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
1375
1379
|
const query = reactQuery.useQuery({
|
|
1376
1380
|
queryKey: ["accounting-token-list"],
|
|
1377
1381
|
queryFn: () => client.listTokens(),
|
|
@@ -1389,7 +1393,7 @@ function useTokenList(options = {}) {
|
|
|
1389
1393
|
function useModifyLock(options = {}) {
|
|
1390
1394
|
const { address } = wagmi.useAccount();
|
|
1391
1395
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
1392
|
-
const { client, networkConfig } =
|
|
1396
|
+
const { client, networkConfig } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
1393
1397
|
const queryClient = reactQuery.useQueryClient();
|
|
1394
1398
|
const mutation = reactQuery.useMutation({
|
|
1395
1399
|
mutationFn: async (params) => {
|
|
@@ -1397,7 +1401,7 @@ function useModifyLock(options = {}) {
|
|
|
1397
1401
|
throw new Error("Wallet not connected");
|
|
1398
1402
|
}
|
|
1399
1403
|
const { nonce } = await client.getModifyLockNonce(address);
|
|
1400
|
-
const signature = await
|
|
1404
|
+
const signature = await chunkUHXVYWTF_cjs.signModifyLockMessage({
|
|
1401
1405
|
walletClient,
|
|
1402
1406
|
chainId: networkConfig.chainId,
|
|
1403
1407
|
verifyingContract: networkConfig.accountingContract,
|
|
@@ -1456,7 +1460,7 @@ function DialogOverlay({
|
|
|
1456
1460
|
{
|
|
1457
1461
|
"data-slot": "dialog-overlay",
|
|
1458
1462
|
"data-privana": true,
|
|
1459
|
-
className:
|
|
1463
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
1460
1464
|
"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",
|
|
1461
1465
|
className
|
|
1462
1466
|
),
|
|
@@ -1478,7 +1482,7 @@ function DialogContent({
|
|
|
1478
1482
|
{
|
|
1479
1483
|
"data-slot": "dialog-content",
|
|
1480
1484
|
"data-privana": true,
|
|
1481
|
-
className:
|
|
1485
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
1482
1486
|
"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",
|
|
1483
1487
|
className
|
|
1484
1488
|
),
|
|
@@ -1506,7 +1510,7 @@ function DialogHeader({ className, ...props }) {
|
|
|
1506
1510
|
"div",
|
|
1507
1511
|
{
|
|
1508
1512
|
"data-slot": "dialog-header",
|
|
1509
|
-
className:
|
|
1513
|
+
className: chunkUHXVYWTF_cjs.cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
1510
1514
|
...props
|
|
1511
1515
|
}
|
|
1512
1516
|
);
|
|
@@ -1516,7 +1520,7 @@ function DialogTitle({ className, ...props }) {
|
|
|
1516
1520
|
DialogPrimitive__namespace.Title,
|
|
1517
1521
|
{
|
|
1518
1522
|
"data-slot": "dialog-title",
|
|
1519
|
-
className:
|
|
1523
|
+
className: chunkUHXVYWTF_cjs.cn("text-lg leading-none font-semibold", className),
|
|
1520
1524
|
...props
|
|
1521
1525
|
}
|
|
1522
1526
|
);
|
|
@@ -1529,7 +1533,7 @@ function DialogDescription({
|
|
|
1529
1533
|
DialogPrimitive__namespace.Description,
|
|
1530
1534
|
{
|
|
1531
1535
|
"data-slot": "dialog-description",
|
|
1532
|
-
className:
|
|
1536
|
+
className: chunkUHXVYWTF_cjs.cn("text-muted-foreground text-sm", className),
|
|
1533
1537
|
...props
|
|
1534
1538
|
}
|
|
1535
1539
|
);
|
|
@@ -1724,7 +1728,7 @@ function ChevronDownIcon({
|
|
|
1724
1728
|
height: "16",
|
|
1725
1729
|
viewBox: "0 0 16 16",
|
|
1726
1730
|
fill: "none",
|
|
1727
|
-
className:
|
|
1731
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
1728
1732
|
"transition-transform",
|
|
1729
1733
|
direction === "right" && "-rotate-90",
|
|
1730
1734
|
direction === "up" && "rotate-180",
|
|
@@ -1947,7 +1951,8 @@ function TransactionErrorView({
|
|
|
1947
1951
|
explorerLabel,
|
|
1948
1952
|
onRetry,
|
|
1949
1953
|
onDismiss,
|
|
1950
|
-
isRetrying
|
|
1954
|
+
isRetrying,
|
|
1955
|
+
retryLabel = "Retry Verification"
|
|
1951
1956
|
}) {
|
|
1952
1957
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-col gap-4", children: [
|
|
1953
1958
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
@@ -1986,7 +1991,7 @@ function TransactionErrorView({
|
|
|
1986
1991
|
onClick: onRetry,
|
|
1987
1992
|
disabled: isRetrying,
|
|
1988
1993
|
className: "bg-primary text-primary-foreground hover:bg-primary/90 flex h-10 flex-1 cursor-pointer items-center justify-center rounded-[10px] px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",
|
|
1989
|
-
children: isRetrying ? "Retrying..." :
|
|
1994
|
+
children: isRetrying ? "Retrying..." : retryLabel
|
|
1990
1995
|
}
|
|
1991
1996
|
)
|
|
1992
1997
|
] })
|
|
@@ -2000,7 +2005,7 @@ function DepositForm({
|
|
|
2000
2005
|
onSuccess
|
|
2001
2006
|
}) {
|
|
2002
2007
|
const { isConnected, address } = wagmi.useAccount();
|
|
2003
|
-
const { chains, getChainById: getChainById2 } =
|
|
2008
|
+
const { chains, getChainById: getChainById2 } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
2004
2009
|
const [amount, setAmount] = react.useState("");
|
|
2005
2010
|
const [showSuccess, setShowSuccess] = react.useState(false);
|
|
2006
2011
|
const [showTimeout, setShowTimeout] = react.useState(false);
|
|
@@ -2025,7 +2030,7 @@ function DepositForm({
|
|
|
2025
2030
|
}
|
|
2026
2031
|
});
|
|
2027
2032
|
const walletBalance = isNative ? nativeBalanceData?.value : erc20Balance;
|
|
2028
|
-
const formattedWalletBalance = walletBalance ?
|
|
2033
|
+
const formattedWalletBalance = walletBalance ? chunkUHXVYWTF_cjs.formatTokenAmount(walletBalance.toString(), selectedToken.decimals) : "0.00";
|
|
2029
2034
|
const handleMaxClick = () => {
|
|
2030
2035
|
if (formattedWalletBalance && parseFloat(formattedWalletBalance) > 0) {
|
|
2031
2036
|
setAmount(formattedWalletBalance.replace(/[\s\u2009]/g, ""));
|
|
@@ -2033,7 +2038,7 @@ function DepositForm({
|
|
|
2033
2038
|
};
|
|
2034
2039
|
const hasValidAmount = amount && parseFloat(amount) > 0;
|
|
2035
2040
|
const tooManyDecimals = hasValidAmount && amount.includes(".") && amount.split(".")[1].length > selectedToken.decimals;
|
|
2036
|
-
const exceedsBalance = hasValidAmount && !tooManyDecimals && walletBalance != null &&
|
|
2041
|
+
const exceedsBalance = hasValidAmount && !tooManyDecimals && walletBalance != null && chunkUHXVYWTF_cjs.parseTokenAmount(amount, selectedToken.decimals) > walletBalance;
|
|
2037
2042
|
const {
|
|
2038
2043
|
txHash,
|
|
2039
2044
|
isGettingAddress,
|
|
@@ -2118,7 +2123,7 @@ function DepositForm({
|
|
|
2118
2123
|
const handleSubmit = async () => {
|
|
2119
2124
|
if (!amount || !selectedToken || exceedsBalance) return;
|
|
2120
2125
|
setCancelled(false);
|
|
2121
|
-
const amountInWei =
|
|
2126
|
+
const amountInWei = chunkUHXVYWTF_cjs.parseTokenAmount(amount, selectedToken.decimals);
|
|
2122
2127
|
await deposit({
|
|
2123
2128
|
tokenId: selectedToken.id,
|
|
2124
2129
|
amount: amountInWei
|
|
@@ -2221,7 +2226,7 @@ function DepositForm({
|
|
|
2221
2226
|
setAmount(value);
|
|
2222
2227
|
}
|
|
2223
2228
|
},
|
|
2224
|
-
className:
|
|
2229
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
2225
2230
|
"text-foreground flex-1 bg-transparent text-sm outline-none",
|
|
2226
2231
|
"placeholder:text-muted-foreground/50"
|
|
2227
2232
|
)
|
|
@@ -2248,7 +2253,7 @@ function DepositForm({
|
|
|
2248
2253
|
{
|
|
2249
2254
|
onClick: handleSubmit,
|
|
2250
2255
|
disabled: !isConnected || !hasValidAmount || tooManyDecimals || !!exceedsBalance || isPending,
|
|
2251
|
-
className:
|
|
2256
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
2252
2257
|
"flex h-10 w-full cursor-pointer items-center justify-center rounded-[10px] px-3 py-2 text-sm font-medium transition-colors",
|
|
2253
2258
|
"bg-primary text-primary-foreground hover:bg-primary/90",
|
|
2254
2259
|
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
@@ -2265,7 +2270,7 @@ function WithdrawForm({
|
|
|
2265
2270
|
onUnsafeToCloseChange
|
|
2266
2271
|
}) {
|
|
2267
2272
|
const { isConnected, address } = wagmi.useAccount();
|
|
2268
|
-
const { chains, getChainById: getChainById2 } =
|
|
2273
|
+
const { chains, getChainById: getChainById2 } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
2269
2274
|
const [amount, setAmount] = react.useState("");
|
|
2270
2275
|
const [showSuccess, setShowSuccess] = react.useState(false);
|
|
2271
2276
|
const [showTimeout, setShowTimeout] = react.useState(false);
|
|
@@ -2278,7 +2283,7 @@ function WithdrawForm({
|
|
|
2278
2283
|
} = useBalance({
|
|
2279
2284
|
tokenId: selectedToken.id
|
|
2280
2285
|
});
|
|
2281
|
-
const formattedBalance =
|
|
2286
|
+
const formattedBalance = chunkUHXVYWTF_cjs.formatTokenAmount(balanceWei, selectedToken.decimals);
|
|
2282
2287
|
const { withdraw, isPending, currentStep, error, reset } = useWithdraw({
|
|
2283
2288
|
onProcessingSuccess: () => {
|
|
2284
2289
|
setAmount("");
|
|
@@ -2289,7 +2294,7 @@ function WithdrawForm({
|
|
|
2289
2294
|
setShowTimeout(true);
|
|
2290
2295
|
}
|
|
2291
2296
|
});
|
|
2292
|
-
const explorerUrl = address && targetChain ?
|
|
2297
|
+
const explorerUrl = address && targetChain ? chunkUHXVYWTF_cjs.getExplorerAddressUrl(targetChain.id, address) : void 0;
|
|
2293
2298
|
const getStepStatus = (step, after) => {
|
|
2294
2299
|
if (currentStep === step) return "active";
|
|
2295
2300
|
if (after.includes(currentStep)) return "completed";
|
|
@@ -2333,7 +2338,7 @@ function WithdrawForm({
|
|
|
2333
2338
|
const handleWithdraw = async () => {
|
|
2334
2339
|
if (!amount || !selectedToken || exceedsBalance) return;
|
|
2335
2340
|
setCancelled(false);
|
|
2336
|
-
const amountInWei =
|
|
2341
|
+
const amountInWei = chunkUHXVYWTF_cjs.parseTokenAmount(amount, selectedToken.decimals);
|
|
2337
2342
|
await withdraw({
|
|
2338
2343
|
tokenId: selectedToken.id,
|
|
2339
2344
|
amount: amountInWei
|
|
@@ -2346,7 +2351,7 @@ function WithdrawForm({
|
|
|
2346
2351
|
};
|
|
2347
2352
|
const hasValidAmount = amount && parseFloat(amount) > 0;
|
|
2348
2353
|
const tooManyDecimals = hasValidAmount && amount.includes(".") && amount.split(".")[1].length > selectedToken.decimals;
|
|
2349
|
-
const exceedsBalance = hasValidAmount && !tooManyDecimals && !isBalanceLoading && !isBalanceError &&
|
|
2354
|
+
const exceedsBalance = hasValidAmount && !tooManyDecimals && !isBalanceLoading && !isBalanceError && chunkUHXVYWTF_cjs.parseTokenAmount(amount, selectedToken.decimals) > BigInt(balanceWei);
|
|
2350
2355
|
const getButtonText = () => {
|
|
2351
2356
|
if (!isConnected) return "Connect Wallet";
|
|
2352
2357
|
return "Withdraw";
|
|
@@ -2358,7 +2363,7 @@ function WithdrawForm({
|
|
|
2358
2363
|
title: "Withdrawal Complete",
|
|
2359
2364
|
message: `Your ${selectedToken.symbol} withdrawal has been processed. Funds should appear in your wallet shortly.`,
|
|
2360
2365
|
explorerUrl,
|
|
2361
|
-
explorerLabel: targetChain ?
|
|
2366
|
+
explorerLabel: targetChain ? chunkUHXVYWTF_cjs.getExplorerLabel(targetChain.id) : void 0,
|
|
2362
2367
|
onDone: handleDone
|
|
2363
2368
|
}
|
|
2364
2369
|
);
|
|
@@ -2429,7 +2434,7 @@ function WithdrawForm({
|
|
|
2429
2434
|
setAmount(value);
|
|
2430
2435
|
}
|
|
2431
2436
|
},
|
|
2432
|
-
className:
|
|
2437
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
2433
2438
|
"text-foreground flex-1 bg-transparent text-sm outline-none",
|
|
2434
2439
|
"placeholder:text-muted-foreground/50"
|
|
2435
2440
|
)
|
|
@@ -2456,7 +2461,7 @@ function WithdrawForm({
|
|
|
2456
2461
|
{
|
|
2457
2462
|
onClick: handleWithdraw,
|
|
2458
2463
|
disabled: !isConnected || !hasValidAmount || tooManyDecimals || !!exceedsBalance || isPending,
|
|
2459
|
-
className:
|
|
2464
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
2460
2465
|
"flex h-10 w-full cursor-pointer items-center justify-center rounded-[10px] px-3 py-2 text-sm font-medium transition-colors",
|
|
2461
2466
|
"bg-primary text-primary-foreground hover:bg-primary/90",
|
|
2462
2467
|
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
@@ -2477,15 +2482,15 @@ function BalanceCards({
|
|
|
2477
2482
|
tokenId: selectedToken.id
|
|
2478
2483
|
});
|
|
2479
2484
|
const { totalLocked, isLoading: lockedLoading } = useLockedFunds({ enabled: showLockedFunds });
|
|
2480
|
-
const formattedBalance =
|
|
2481
|
-
const formattedLocked = showLockedFunds ?
|
|
2482
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
2485
|
+
const formattedBalance = chunkUHXVYWTF_cjs.formatTokenAmount(balanceWei, selectedToken.decimals);
|
|
2486
|
+
const formattedLocked = showLockedFunds ? chunkUHXVYWTF_cjs.formatTokenAmount(String(totalLocked), selectedToken.decimals) : "0.00";
|
|
2487
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkUHXVYWTF_cjs.cn("flex gap-2", disabled && "opacity-50"), children: [
|
|
2483
2488
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2484
2489
|
"button",
|
|
2485
2490
|
{
|
|
2486
2491
|
onClick: onBalanceClick,
|
|
2487
2492
|
disabled,
|
|
2488
|
-
className:
|
|
2493
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
2489
2494
|
"bg-muted flex flex-1 flex-col gap-2 rounded-[10px] p-5 text-left transition-colors",
|
|
2490
2495
|
disabled ? "cursor-not-allowed" : "hover:bg-muted/80 cursor-pointer"
|
|
2491
2496
|
),
|
|
@@ -2506,7 +2511,7 @@ function BalanceCards({
|
|
|
2506
2511
|
{
|
|
2507
2512
|
onClick: onLockedFundsClick,
|
|
2508
2513
|
disabled,
|
|
2509
|
-
className:
|
|
2514
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
2510
2515
|
"bg-muted flex flex-1 flex-col gap-2 rounded-[10px] p-5 text-left transition-colors",
|
|
2511
2516
|
disabled ? "cursor-not-allowed" : "hover:bg-muted/80 cursor-pointer"
|
|
2512
2517
|
),
|
|
@@ -2532,7 +2537,7 @@ function Tabs({
|
|
|
2532
2537
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2533
2538
|
"div",
|
|
2534
2539
|
{
|
|
2535
|
-
className:
|
|
2540
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
2536
2541
|
"bg-muted relative flex gap-2 overflow-hidden rounded-[10px] p-1",
|
|
2537
2542
|
disabled && "opacity-50"
|
|
2538
2543
|
),
|
|
@@ -2540,7 +2545,7 @@ function Tabs({
|
|
|
2540
2545
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2541
2546
|
"div",
|
|
2542
2547
|
{
|
|
2543
|
-
className:
|
|
2548
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
2544
2549
|
"bg-input absolute top-1 bottom-1 left-1 w-[calc(50%-8px)] rounded-md transition-transform duration-200",
|
|
2545
2550
|
activeTab === "withdraw" && "translate-x-[calc(100%+8px)]"
|
|
2546
2551
|
)
|
|
@@ -2551,7 +2556,7 @@ function Tabs({
|
|
|
2551
2556
|
{
|
|
2552
2557
|
onClick: () => !disabled && onTabChange("deposit"),
|
|
2553
2558
|
disabled,
|
|
2554
|
-
className:
|
|
2559
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
2555
2560
|
"relative z-10 flex-1 rounded-md px-3 py-[9px] text-sm transition-colors",
|
|
2556
2561
|
activeTab === "deposit" ? "text-foreground" : "text-muted-foreground",
|
|
2557
2562
|
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
@@ -2564,7 +2569,7 @@ function Tabs({
|
|
|
2564
2569
|
{
|
|
2565
2570
|
onClick: () => !disabled && onTabChange("withdraw"),
|
|
2566
2571
|
disabled,
|
|
2567
|
-
className:
|
|
2572
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
2568
2573
|
"relative z-10 flex-1 rounded-md px-3 py-[9px] text-sm transition-colors",
|
|
2569
2574
|
activeTab === "withdraw" ? "text-foreground" : "text-muted-foreground",
|
|
2570
2575
|
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
@@ -2577,14 +2582,14 @@ function Tabs({
|
|
|
2577
2582
|
);
|
|
2578
2583
|
}
|
|
2579
2584
|
function LockedFundsView({ onBack }) {
|
|
2580
|
-
const { getTokenById } =
|
|
2585
|
+
const { getTokenById } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
2581
2586
|
const { locks, isLoading } = useLockedFunds();
|
|
2582
2587
|
const { unlockFunds, unlockAllExpired, isPending } = useUnlockFunds();
|
|
2583
2588
|
const [collapsedSections, setCollapsedSections] = react.useState({});
|
|
2584
2589
|
const sections = react.useMemo(() => {
|
|
2585
2590
|
const sectionMap = {};
|
|
2586
2591
|
locks.forEach((lock) => {
|
|
2587
|
-
const serviceName =
|
|
2592
|
+
const serviceName = chunkUHXVYWTF_cjs.shortenAddress(lock.service_address);
|
|
2588
2593
|
if (!sectionMap[lock.service_address]) {
|
|
2589
2594
|
sectionMap[lock.service_address] = {
|
|
2590
2595
|
title: `Service ${serviceName}`,
|
|
@@ -2593,9 +2598,9 @@ function LockedFundsView({ onBack }) {
|
|
|
2593
2598
|
}
|
|
2594
2599
|
sectionMap[lock.service_address].items.push({
|
|
2595
2600
|
lockId: lock.lock_id,
|
|
2596
|
-
amount:
|
|
2601
|
+
amount: chunkUHXVYWTF_cjs.formatTokenAmount(String(lock.amount), getTokenById(lock.token_id)?.decimals ?? 18),
|
|
2597
2602
|
serviceAddress: lock.service_address,
|
|
2598
|
-
time: lock.is_expired ? "Click to unlock" :
|
|
2603
|
+
time: lock.is_expired ? "Click to unlock" : chunkUHXVYWTF_cjs.formatTimeRemaining(lock.expiry),
|
|
2599
2604
|
isExpired: lock.is_expired
|
|
2600
2605
|
});
|
|
2601
2606
|
});
|
|
@@ -2647,7 +2652,7 @@ function LockedFundsView({ onBack }) {
|
|
|
2647
2652
|
!collapsedSections[section.title] && section.items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2648
2653
|
"div",
|
|
2649
2654
|
{
|
|
2650
|
-
className:
|
|
2655
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
2651
2656
|
"flex items-center justify-between gap-3 rounded-lg p-3",
|
|
2652
2657
|
item.isExpired && "bg-secondary"
|
|
2653
2658
|
),
|
|
@@ -2661,7 +2666,7 @@ function LockedFundsView({ onBack }) {
|
|
|
2661
2666
|
] }),
|
|
2662
2667
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground text-xs", children: [
|
|
2663
2668
|
"Service: ",
|
|
2664
|
-
|
|
2669
|
+
chunkUHXVYWTF_cjs.shortenAddress(item.serviceAddress)
|
|
2665
2670
|
] })
|
|
2666
2671
|
] })
|
|
2667
2672
|
] }),
|
|
@@ -2702,7 +2707,7 @@ function BalanceTokenRow({ token }) {
|
|
|
2702
2707
|
const { balanceWei, isLoading } = useBalance({
|
|
2703
2708
|
tokenId: token.id
|
|
2704
2709
|
});
|
|
2705
|
-
const formattedBalance =
|
|
2710
|
+
const formattedBalance = chunkUHXVYWTF_cjs.formatTokenAmount(balanceWei, token.decimals);
|
|
2706
2711
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center gap-2 rounded-lg px-3 py-2.5", children: [
|
|
2707
2712
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[18px] w-[18px] overflow-hidden rounded-full", children: getTokenIcon(token.symbol, 18) }),
|
|
2708
2713
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground flex-1 text-sm", children: token.symbol }),
|
|
@@ -2710,7 +2715,7 @@ function BalanceTokenRow({ token }) {
|
|
|
2710
2715
|
] });
|
|
2711
2716
|
}
|
|
2712
2717
|
function BalanceDetailsView({ onBack }) {
|
|
2713
|
-
const { enabledTokens, chains } =
|
|
2718
|
+
const { enabledTokens, chains } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
2714
2719
|
const [selectedChainId, setSelectedChainId] = react.useState(chains[0]?.id ?? 84532);
|
|
2715
2720
|
const chainTokens = react.useMemo(() => {
|
|
2716
2721
|
return enabledTokens.filter((t) => t.chainId === selectedChainId);
|
|
@@ -2736,7 +2741,7 @@ function BalanceDetailsView({ onBack }) {
|
|
|
2736
2741
|
"button",
|
|
2737
2742
|
{
|
|
2738
2743
|
onClick: () => setSelectedChainId(chain.id),
|
|
2739
|
-
className:
|
|
2744
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
2740
2745
|
"hover:bg-secondary flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors",
|
|
2741
2746
|
isSelected && "bg-secondary"
|
|
2742
2747
|
),
|
|
@@ -2777,12 +2782,12 @@ function TokenRow({
|
|
|
2777
2782
|
query: { enabled: !!address && !isNative }
|
|
2778
2783
|
});
|
|
2779
2784
|
const walletBalance = isNative ? nativeBalanceData?.value : erc20Balance;
|
|
2780
|
-
const formattedBalance = walletBalance ?
|
|
2785
|
+
const formattedBalance = walletBalance ? chunkUHXVYWTF_cjs.formatTokenAmount(walletBalance.toString(), token.decimals) : "0.00";
|
|
2781
2786
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2782
2787
|
"button",
|
|
2783
2788
|
{
|
|
2784
2789
|
onClick,
|
|
2785
|
-
className:
|
|
2790
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
2786
2791
|
"hover:bg-secondary flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors",
|
|
2787
2792
|
isSelected && "bg-secondary"
|
|
2788
2793
|
),
|
|
@@ -2799,7 +2804,7 @@ function TokenSelectorView({
|
|
|
2799
2804
|
onSelect,
|
|
2800
2805
|
selectedTokenId
|
|
2801
2806
|
}) {
|
|
2802
|
-
const { enabledTokens, chains } =
|
|
2807
|
+
const { enabledTokens, chains } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
2803
2808
|
const [selectedChainId, setSelectedChainId] = react.useState(chains[0]?.id ?? 84532);
|
|
2804
2809
|
const chainTokens = react.useMemo(() => {
|
|
2805
2810
|
return enabledTokens.filter((t) => t.chainId === selectedChainId);
|
|
@@ -2829,7 +2834,7 @@ function TokenSelectorView({
|
|
|
2829
2834
|
"button",
|
|
2830
2835
|
{
|
|
2831
2836
|
onClick: () => setSelectedChainId(chain.id),
|
|
2832
|
-
className:
|
|
2837
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
2833
2838
|
"hover:bg-secondary flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors",
|
|
2834
2839
|
isSelected && "bg-secondary"
|
|
2835
2840
|
),
|
|
@@ -2864,7 +2869,7 @@ function ModalBody({
|
|
|
2864
2869
|
defaultTab = "deposit",
|
|
2865
2870
|
onDepositSuccess
|
|
2866
2871
|
}) {
|
|
2867
|
-
const { defaultToken, tokensStatus } =
|
|
2872
|
+
const { defaultToken, tokensStatus } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
2868
2873
|
const [selectedToken, setSelectedToken] = react.useState(defaultToken);
|
|
2869
2874
|
const [activeTab, setActiveTab] = react.useState(defaultTab);
|
|
2870
2875
|
const [currentView, setCurrentView] = react.useState("main");
|
|
@@ -2922,7 +2927,7 @@ function ModalBody({
|
|
|
2922
2927
|
);
|
|
2923
2928
|
}
|
|
2924
2929
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 pb-4", children: [
|
|
2925
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
2930
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUHXVYWTF_cjs.cn(isInteractionPending && "pointer-events-none"), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2926
2931
|
BalanceCards,
|
|
2927
2932
|
{
|
|
2928
2933
|
selectedToken,
|
|
@@ -2932,7 +2937,7 @@ function ModalBody({
|
|
|
2932
2937
|
disabled: isInteractionPending
|
|
2933
2938
|
}
|
|
2934
2939
|
) }),
|
|
2935
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
2940
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUHXVYWTF_cjs.cn(isInteractionPending && "pointer-events-none"), children: /* @__PURE__ */ jsxRuntime.jsx(Tabs, { activeTab, onTabChange: setActiveTab, disabled: isInteractionPending }) }),
|
|
2936
2941
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted rounded-[10px] p-5", children: activeTab === "deposit" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2937
2942
|
DepositForm,
|
|
2938
2943
|
{
|
|
@@ -2993,7 +2998,7 @@ function PrivanaModal({
|
|
|
2993
2998
|
onClick: handleClose,
|
|
2994
2999
|
disabled: isCloseBlocked,
|
|
2995
3000
|
"aria-label": "Close",
|
|
2996
|
-
className:
|
|
3001
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
2997
3002
|
"absolute top-6 right-5 z-20 flex h-6 w-6 items-center justify-center transition-colors",
|
|
2998
3003
|
isCloseBlocked ? "text-muted-foreground/40 cursor-not-allowed" : "text-muted-foreground hover:text-foreground cursor-pointer"
|
|
2999
3004
|
),
|
|
@@ -3049,7 +3054,7 @@ function PrivanaInlineModal({
|
|
|
3049
3054
|
"div",
|
|
3050
3055
|
{
|
|
3051
3056
|
"data-privana": true,
|
|
3052
|
-
className:
|
|
3057
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
3053
3058
|
"bg-card flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
3054
3059
|
className
|
|
3055
3060
|
),
|
|
@@ -3084,12 +3089,12 @@ function PrivanaButton({
|
|
|
3084
3089
|
}
|
|
3085
3090
|
const handleClick = () => setModalOpen(true);
|
|
3086
3091
|
const buttonElement = renderButton ? renderButton({ onClick: handleClick, isOpen: modalOpen }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3087
|
-
|
|
3092
|
+
chunkUHXVYWTF_cjs.Button,
|
|
3088
3093
|
{
|
|
3089
3094
|
variant,
|
|
3090
3095
|
size,
|
|
3091
3096
|
asChild,
|
|
3092
|
-
className:
|
|
3097
|
+
className: chunkUHXVYWTF_cjs.cn(className),
|
|
3093
3098
|
onClick: handleClick,
|
|
3094
3099
|
disabled: !isConnected,
|
|
3095
3100
|
...buttonProps,
|
|
@@ -3153,7 +3158,7 @@ function useMoonpayLimits({
|
|
|
3153
3158
|
};
|
|
3154
3159
|
}
|
|
3155
3160
|
function TokenSelectorView2({ selectedTokenId, onSelect }) {
|
|
3156
|
-
const { enabledTokens } =
|
|
3161
|
+
const { enabledTokens } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
3157
3162
|
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: [
|
|
3158
3163
|
enabledTokens.map((token) => {
|
|
3159
3164
|
const isSelected = selectedTokenId === token.id;
|
|
@@ -3162,7 +3167,7 @@ function TokenSelectorView2({ selectedTokenId, onSelect }) {
|
|
|
3162
3167
|
{
|
|
3163
3168
|
type: "button",
|
|
3164
3169
|
onClick: () => onSelect(token.id),
|
|
3165
|
-
className:
|
|
3170
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
3166
3171
|
"hover:bg-secondary flex w-full cursor-pointer items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors",
|
|
3167
3172
|
isSelected && "bg-secondary"
|
|
3168
3173
|
),
|
|
@@ -3217,7 +3222,7 @@ function CreditCardWidgetView({
|
|
|
3217
3222
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: [
|
|
3218
3223
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-foreground text-[28px] leading-8 font-medium", children: "Complete your purchase" }),
|
|
3219
3224
|
token && moonpayCurrencyCode ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3220
|
-
|
|
3225
|
+
chunkUHXVYWTF_cjs.FiatOnRampForm,
|
|
3221
3226
|
{
|
|
3222
3227
|
tokenId: token.id,
|
|
3223
3228
|
currencyCode: moonpayCurrencyCode,
|
|
@@ -3277,7 +3282,7 @@ function PolicyTermRow({
|
|
|
3277
3282
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3278
3283
|
"div",
|
|
3279
3284
|
{
|
|
3280
|
-
className:
|
|
3285
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
3281
3286
|
"mt-0.5 shrink-0",
|
|
3282
3287
|
kind === "permission" ? "text-emerald-500" : "text-orange-500"
|
|
3283
3288
|
),
|
|
@@ -3339,7 +3344,7 @@ function AllowancePolicySection({
|
|
|
3339
3344
|
] });
|
|
3340
3345
|
}
|
|
3341
3346
|
function MoonPayGate({ enabled, children }) {
|
|
3342
|
-
const { networkConfig } =
|
|
3347
|
+
const { networkConfig } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
3343
3348
|
const apiKey = networkConfig.moonpayApiKey;
|
|
3344
3349
|
if (!enabled || !apiKey) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
3345
3350
|
return /* @__PURE__ */ jsxRuntime.jsx(moonpayReact.MoonPayProvider, { apiKey, children });
|
|
@@ -3352,7 +3357,7 @@ function MethodTabs({
|
|
|
3352
3357
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3353
3358
|
"div",
|
|
3354
3359
|
{
|
|
3355
|
-
className:
|
|
3360
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
3356
3361
|
"bg-input absolute top-1 bottom-1 left-1 w-[calc(50%-8px)] rounded-md transition-transform duration-200",
|
|
3357
3362
|
activeTab === "credit-card" && "translate-x-[calc(100%+8px)]"
|
|
3358
3363
|
)
|
|
@@ -3363,7 +3368,7 @@ function MethodTabs({
|
|
|
3363
3368
|
{
|
|
3364
3369
|
type: "button",
|
|
3365
3370
|
onClick: () => onTabChange("crypto"),
|
|
3366
|
-
className:
|
|
3371
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
3367
3372
|
"relative z-10 flex-1 cursor-pointer rounded-md px-3 py-[9px] text-sm font-medium transition-colors",
|
|
3368
3373
|
activeTab === "crypto" ? "text-foreground" : "text-muted-foreground"
|
|
3369
3374
|
),
|
|
@@ -3375,7 +3380,7 @@ function MethodTabs({
|
|
|
3375
3380
|
{
|
|
3376
3381
|
type: "button",
|
|
3377
3382
|
onClick: () => onTabChange("credit-card"),
|
|
3378
|
-
className:
|
|
3383
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
3379
3384
|
"relative z-10 flex-1 cursor-pointer rounded-md px-3 py-[9px] text-sm font-medium transition-colors",
|
|
3380
3385
|
activeTab === "credit-card" ? "text-foreground" : "text-muted-foreground"
|
|
3381
3386
|
),
|
|
@@ -3416,7 +3421,7 @@ function DepositView({
|
|
|
3416
3421
|
onSubmit,
|
|
3417
3422
|
isSubmitting = false
|
|
3418
3423
|
}) {
|
|
3419
|
-
const { getChainById: getChainById2, chains, serviceName, serviceIcon, networkConfig } =
|
|
3424
|
+
const { getChainById: getChainById2, chains, serviceName, serviceIcon, networkConfig } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
3420
3425
|
const { address, isConnected } = wagmi.useAccount();
|
|
3421
3426
|
const appName = serviceName ?? "Privana";
|
|
3422
3427
|
const chain = selectedToken ? getChainById2(selectedToken.chainId) : void 0;
|
|
@@ -3439,7 +3444,7 @@ function DepositView({
|
|
|
3439
3444
|
query: { enabled: isConnectedSource && !!address && !!selectedToken && !isNative }
|
|
3440
3445
|
});
|
|
3441
3446
|
const walletBalance = isNative ? nativeBalanceData?.value : erc20Balance;
|
|
3442
|
-
const formattedWalletBalance = walletBalance != null && selectedToken ?
|
|
3447
|
+
const formattedWalletBalance = walletBalance != null && selectedToken ? chunkUHXVYWTF_cjs.formatTokenAmount(walletBalance.toString(), selectedToken.decimals) : "0.00";
|
|
3443
3448
|
const {
|
|
3444
3449
|
minBuyAmount: moonpayMinBuy,
|
|
3445
3450
|
isLoading: moonpayLimitsLoading,
|
|
@@ -3452,7 +3457,7 @@ function DepositView({
|
|
|
3452
3457
|
const hasValidAmount = !!amount && parseFloat(amount) > 0;
|
|
3453
3458
|
const maxAmountDecimals = isCreditCard ? 2 : selectedToken?.decimals;
|
|
3454
3459
|
const tooManyDecimals = hasValidAmount && maxAmountDecimals != null && amount.includes(".") && amount.split(".")[1].length > maxAmountDecimals;
|
|
3455
|
-
const exceedsBalance = isConnectedSource && hasValidAmount && !tooManyDecimals && !!selectedToken && walletBalance != null &&
|
|
3460
|
+
const exceedsBalance = isConnectedSource && hasValidAmount && !tooManyDecimals && !!selectedToken && walletBalance != null && chunkUHXVYWTF_cjs.parseTokenAmount(amount, selectedToken.decimals) > walletBalance;
|
|
3456
3461
|
const belowMoonpayMin = isCreditCard && hasValidAmount && moonpayMinBuy != null && parseFloat(amount) < moonpayMinBuy;
|
|
3457
3462
|
const moonpayLimitsUnready = isCreditCard && !!selectedToken?.moonpayCurrencyCode && moonpayMinBuy == null;
|
|
3458
3463
|
const creditCardUnavailable = isCreditCard && !!selectedToken && !selectedToken.moonpayCurrencyCode;
|
|
@@ -3507,7 +3512,7 @@ function DepositView({
|
|
|
3507
3512
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3508
3513
|
"div",
|
|
3509
3514
|
{
|
|
3510
|
-
className:
|
|
3515
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
3511
3516
|
"border-border bg-input flex items-center gap-2 rounded-[10px] border",
|
|
3512
3517
|
isConnectedSource ? "py-1 pr-1 pl-3" : "px-3 py-3"
|
|
3513
3518
|
),
|
|
@@ -3630,7 +3635,7 @@ function ExternalDepositView({
|
|
|
3630
3635
|
amount,
|
|
3631
3636
|
onCredited
|
|
3632
3637
|
}) {
|
|
3633
|
-
const { getChainById: getChainById2 } =
|
|
3638
|
+
const { getChainById: getChainById2 } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
3634
3639
|
const { depositAddress, isReady, isLoading } = useDepositAddress();
|
|
3635
3640
|
const chain = token ? getChainById2(token.chainId) : void 0;
|
|
3636
3641
|
const [copied, setCopied] = react.useState(false);
|
|
@@ -3639,7 +3644,7 @@ function ExternalDepositView({
|
|
|
3639
3644
|
const listening = secondsLeft > 0;
|
|
3640
3645
|
const [nothingFound, setNothingFound] = react.useState(false);
|
|
3641
3646
|
const [credited, setCredited] = react.useState(null);
|
|
3642
|
-
const verification =
|
|
3647
|
+
const verification = chunkUHXVYWTF_cjs.useDepositVerification({
|
|
3643
3648
|
onCredited: (txHash) => {
|
|
3644
3649
|
if (onCredited) {
|
|
3645
3650
|
onCredited();
|
|
@@ -3705,11 +3710,11 @@ function ExternalDepositView({
|
|
|
3705
3710
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-border h-px w-full" }),
|
|
3706
3711
|
/* @__PURE__ */ jsxRuntime.jsx(SummaryRow, { value: amount || "\u2014", label: "Value" })
|
|
3707
3712
|
] }),
|
|
3708
|
-
/* @__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(
|
|
3713
|
+
/* @__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(chunkUHXVYWTF_cjs.Skeleton, { className: "h-full w-full rounded-[10px]" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm", children: "Deposit address unavailable" }) }),
|
|
3709
3714
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
3710
3715
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "Deposit Address" }),
|
|
3711
3716
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
3712
|
-
/* @__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(
|
|
3717
|
+
/* @__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(chunkUHXVYWTF_cjs.Skeleton, { className: "h-4 w-3/4" }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: "\u2014" }) }),
|
|
3713
3718
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3714
3719
|
"button",
|
|
3715
3720
|
{
|
|
@@ -3729,7 +3734,7 @@ function ExternalDepositView({
|
|
|
3729
3734
|
TransactionSuccessView,
|
|
3730
3735
|
{
|
|
3731
3736
|
title: "Deposit Credited",
|
|
3732
|
-
message: `Transfer ${
|
|
3737
|
+
message: `Transfer ${chunkUHXVYWTF_cjs.shortenAddress(credited.txHash)} has been credited to your Privana balance.`,
|
|
3733
3738
|
onDone: () => {
|
|
3734
3739
|
setCredited(null);
|
|
3735
3740
|
verification.reset();
|
|
@@ -3757,7 +3762,7 @@ function ExternalDepositView({
|
|
|
3757
3762
|
{
|
|
3758
3763
|
title: "Awaiting Deposit",
|
|
3759
3764
|
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.",
|
|
3760
|
-
remaining: listening ?
|
|
3765
|
+
remaining: listening ? chunkUHXVYWTF_cjs.formatCountdown(secondsLeft) : void 0
|
|
3761
3766
|
}
|
|
3762
3767
|
),
|
|
3763
3768
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
@@ -3790,7 +3795,7 @@ function DepositModalContent({
|
|
|
3790
3795
|
onCloseBlockedChange,
|
|
3791
3796
|
onExit
|
|
3792
3797
|
}) {
|
|
3793
|
-
const { serviceName, enabledTokens, defaultToken, hostedAuthConfig, getChainById: getChainById2 } =
|
|
3798
|
+
const { serviceName, enabledTokens, defaultToken, hostedAuthConfig, getChainById: getChainById2 } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
3794
3799
|
const { address } = wagmi.useAccount();
|
|
3795
3800
|
const appName = serviceName ?? "Privana";
|
|
3796
3801
|
const [activeTab, setActiveTab] = react.useState(defaultTab);
|
|
@@ -3896,7 +3901,7 @@ function DepositModalContent({
|
|
|
3896
3901
|
setCancelled(false);
|
|
3897
3902
|
deposit({
|
|
3898
3903
|
tokenId: token.id,
|
|
3899
|
-
amount:
|
|
3904
|
+
amount: chunkUHXVYWTF_cjs.parseTokenAmount(args.amount, token.decimals),
|
|
3900
3905
|
postDepositLock: allowance ? {
|
|
3901
3906
|
maxAmount: BigInt(allowance.value),
|
|
3902
3907
|
lockDuration: allowance.lockDuration
|
|
@@ -3978,7 +3983,7 @@ function DepositModalContent({
|
|
|
3978
3983
|
onClick: onClose,
|
|
3979
3984
|
disabled: isUnsafeToClose,
|
|
3980
3985
|
"aria-label": "Close",
|
|
3981
|
-
className:
|
|
3986
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
3982
3987
|
"absolute top-6 right-5 z-20 flex h-5 w-5 items-center justify-center transition-colors",
|
|
3983
3988
|
isUnsafeToClose ? "text-muted-foreground/40 cursor-not-allowed" : "text-muted-foreground hover:text-foreground cursor-pointer"
|
|
3984
3989
|
),
|
|
@@ -4177,7 +4182,7 @@ function DepositInlineModal({ className, ...handlers }) {
|
|
|
4177
4182
|
"div",
|
|
4178
4183
|
{
|
|
4179
4184
|
"data-privana": true,
|
|
4180
|
-
className:
|
|
4185
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
4181
4186
|
"bg-card relative flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
4182
4187
|
className
|
|
4183
4188
|
),
|
|
@@ -4192,7 +4197,7 @@ function WithdrawView({
|
|
|
4192
4197
|
onSelectToken,
|
|
4193
4198
|
onPendingChange
|
|
4194
4199
|
}) {
|
|
4195
|
-
const { chains, getChainById: getChainById2 } =
|
|
4200
|
+
const { chains, getChainById: getChainById2 } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
4196
4201
|
const { isConnected, address } = wagmi.useAccount();
|
|
4197
4202
|
const [showSuccess, setShowSuccess] = react.useState(false);
|
|
4198
4203
|
const [showTimeout, setShowTimeout] = react.useState(false);
|
|
@@ -4206,7 +4211,7 @@ function WithdrawView({
|
|
|
4206
4211
|
tokenId: selectedToken?.id,
|
|
4207
4212
|
enabled: !!selectedToken
|
|
4208
4213
|
});
|
|
4209
|
-
const formattedBalance = selectedToken ?
|
|
4214
|
+
const formattedBalance = selectedToken ? chunkUHXVYWTF_cjs.formatTokenAmount(balanceWei, selectedToken.decimals) : "0.00";
|
|
4210
4215
|
const { withdraw, isPending, currentStep, error, reset } = useWithdraw({
|
|
4211
4216
|
onProcessingSuccess: () => {
|
|
4212
4217
|
onAmountChange("");
|
|
@@ -4217,7 +4222,7 @@ function WithdrawView({
|
|
|
4217
4222
|
setShowTimeout(true);
|
|
4218
4223
|
}
|
|
4219
4224
|
});
|
|
4220
|
-
const explorerUrl = address && targetChain ?
|
|
4225
|
+
const explorerUrl = address && targetChain ? chunkUHXVYWTF_cjs.getExplorerAddressUrl(targetChain.id, address) : void 0;
|
|
4221
4226
|
const getStepStatus = (step, after) => {
|
|
4222
4227
|
if (currentStep === step) return "active";
|
|
4223
4228
|
if (after.includes(currentStep)) return "completed";
|
|
@@ -4242,7 +4247,7 @@ function WithdrawView({
|
|
|
4242
4247
|
}, [isPending, cancelled, onPendingChange]);
|
|
4243
4248
|
const hasValidAmount = !!amount && parseFloat(amount) > 0;
|
|
4244
4249
|
const tooManyDecimals = !!hasValidAmount && !!selectedToken && amount.includes(".") && amount.split(".")[1].length > selectedToken.decimals;
|
|
4245
|
-
const exceedsBalance = !!hasValidAmount && !tooManyDecimals && !!selectedToken && !isBalanceLoading && !isBalanceError &&
|
|
4250
|
+
const exceedsBalance = !!hasValidAmount && !tooManyDecimals && !!selectedToken && !isBalanceLoading && !isBalanceError && chunkUHXVYWTF_cjs.parseTokenAmount(amount, selectedToken.decimals) > BigInt(balanceWei);
|
|
4246
4251
|
const canWithdraw = isConnected && hasValidAmount && !!selectedToken && !tooManyDecimals && !exceedsBalance;
|
|
4247
4252
|
const handleMax = () => {
|
|
4248
4253
|
if (!selectedToken) return;
|
|
@@ -4254,7 +4259,7 @@ function WithdrawView({
|
|
|
4254
4259
|
setCancelled(false);
|
|
4255
4260
|
await withdraw({
|
|
4256
4261
|
tokenId: selectedToken.id,
|
|
4257
|
-
amount:
|
|
4262
|
+
amount: chunkUHXVYWTF_cjs.parseTokenAmount(amount, selectedToken.decimals)
|
|
4258
4263
|
});
|
|
4259
4264
|
};
|
|
4260
4265
|
const handleCancel = () => {
|
|
@@ -4274,7 +4279,7 @@ function WithdrawView({
|
|
|
4274
4279
|
title: "Withdrawal Complete",
|
|
4275
4280
|
message: `Your ${selectedToken.symbol} withdrawal has been processed. Funds should appear in your wallet shortly.`,
|
|
4276
4281
|
explorerUrl,
|
|
4277
|
-
explorerLabel: targetChain ?
|
|
4282
|
+
explorerLabel: targetChain ? chunkUHXVYWTF_cjs.getExplorerLabel(targetChain.id) : void 0,
|
|
4278
4283
|
onDone: handleDone
|
|
4279
4284
|
}
|
|
4280
4285
|
) });
|
|
@@ -4385,7 +4390,7 @@ function WithdrawModalContent({
|
|
|
4385
4390
|
onPendingChange,
|
|
4386
4391
|
onBack
|
|
4387
4392
|
}) {
|
|
4388
|
-
const { serviceName, enabledTokens, defaultToken, hostedAuthConfig } =
|
|
4393
|
+
const { serviceName, enabledTokens, defaultToken, hostedAuthConfig } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
4389
4394
|
const { address } = wagmi.useAccount();
|
|
4390
4395
|
const appName = serviceName ?? "Privana";
|
|
4391
4396
|
const [view, setView] = react.useState("form");
|
|
@@ -4503,7 +4508,7 @@ function WithdrawInlineModal({ className }) {
|
|
|
4503
4508
|
"div",
|
|
4504
4509
|
{
|
|
4505
4510
|
"data-privana": true,
|
|
4506
|
-
className:
|
|
4511
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
4507
4512
|
"bg-card relative flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
4508
4513
|
className
|
|
4509
4514
|
),
|
|
@@ -4547,14 +4552,14 @@ function SegmentedBalanceBar({
|
|
|
4547
4552
|
showAvailable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4548
4553
|
"div",
|
|
4549
4554
|
{
|
|
4550
|
-
className:
|
|
4555
|
+
className: chunkUHXVYWTF_cjs.cn(AVAILABLE_COLOR, "rounded-l-full", !showInUse && "rounded-r-full"),
|
|
4551
4556
|
style: { flexGrow: grow(availableWei) }
|
|
4552
4557
|
}
|
|
4553
4558
|
),
|
|
4554
4559
|
showInUse && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4555
4560
|
"div",
|
|
4556
4561
|
{
|
|
4557
|
-
className:
|
|
4562
|
+
className: chunkUHXVYWTF_cjs.cn(IN_USE_COLOR, "rounded-r-full", !showAvailable && "rounded-l-full"),
|
|
4558
4563
|
style: { flexGrow: grow(inUseWei) }
|
|
4559
4564
|
}
|
|
4560
4565
|
)
|
|
@@ -4562,7 +4567,7 @@ function SegmentedBalanceBar({
|
|
|
4562
4567
|
}
|
|
4563
4568
|
function BalanceLegendItem({ color, label }) {
|
|
4564
4569
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
4565
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className:
|
|
4570
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkUHXVYWTF_cjs.cn("h-2.5 w-2.5 rounded-full", color) }),
|
|
4566
4571
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground text-sm leading-5", children: label })
|
|
4567
4572
|
] });
|
|
4568
4573
|
}
|
|
@@ -4571,11 +4576,11 @@ function WalletBalanceView({
|
|
|
4571
4576
|
allowance,
|
|
4572
4577
|
amount,
|
|
4573
4578
|
onAmountChange,
|
|
4574
|
-
|
|
4579
|
+
onFundSession,
|
|
4575
4580
|
onAddFunds,
|
|
4576
4581
|
onWithdraw
|
|
4577
4582
|
}) {
|
|
4578
|
-
const { serviceName, serviceIcon, defaultToken } =
|
|
4583
|
+
const { serviceName, serviceIcon, defaultToken } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
4579
4584
|
const appName = serviceName ?? "Privana";
|
|
4580
4585
|
const token = defaultToken;
|
|
4581
4586
|
const {
|
|
@@ -4588,33 +4593,32 @@ function WalletBalanceView({
|
|
|
4588
4593
|
const variant = !session ? "idle" : inUseWei === 0n ? "session-zero" : availableWei === 0n ? "fully-in-use" : "mixed";
|
|
4589
4594
|
const expiry = session?.expiry;
|
|
4590
4595
|
useNow(3e4, expiry != null);
|
|
4591
|
-
const countdown = expiry != null ?
|
|
4596
|
+
const countdown = expiry != null ? chunkUHXVYWTF_cjs.formatTimeRemaining(expiry) : null;
|
|
4592
4597
|
const decimals = token?.decimals ?? 18;
|
|
4593
|
-
const totalFormatted =
|
|
4594
|
-
const availableFormatted =
|
|
4595
|
-
const inUseFormatted =
|
|
4598
|
+
const totalFormatted = chunkUHXVYWTF_cjs.formatTokenAmount((availableWei + inUseWei).toString(), decimals);
|
|
4599
|
+
const availableFormatted = chunkUHXVYWTF_cjs.formatTokenAmount(availableWei.toString(), decimals);
|
|
4600
|
+
const inUseFormatted = chunkUHXVYWTF_cjs.formatTokenAmount(inUseWei.toString(), decimals);
|
|
4596
4601
|
const hasValidAmount = !!amount && parseFloat(amount) > 0;
|
|
4597
4602
|
const tooManyDecimals = hasValidAmount && !!token && amount.includes(".") && amount.split(".")[1].length > token.decimals;
|
|
4598
|
-
const exceedsBalance = hasValidAmount && !tooManyDecimals && !!token && !isBalanceLoading && !isBalanceError &&
|
|
4599
|
-
const
|
|
4603
|
+
const exceedsBalance = hasValidAmount && !tooManyDecimals && !!token && !isBalanceLoading && !isBalanceError && chunkUHXVYWTF_cjs.parseTokenAmount(amount, token.decimals) > availableWei;
|
|
4604
|
+
const canFundSession = hasValidAmount && !!token && !tooManyDecimals && !exceedsBalance && !isBalanceLoading && !isBalanceError;
|
|
4600
4605
|
const handleMax = () => {
|
|
4601
4606
|
const max = availableFormatted.replace(/\s/g, "");
|
|
4602
4607
|
if (parseFloat(max) > 0) onAmountChange(max);
|
|
4603
4608
|
};
|
|
4604
|
-
const
|
|
4605
|
-
if (!token || !
|
|
4606
|
-
|
|
4607
|
-
onAmountChange("");
|
|
4609
|
+
const handleFundSession = () => {
|
|
4610
|
+
if (!token || !canFundSession || !onFundSession) return;
|
|
4611
|
+
onFundSession({ tokenId: token.id, amount });
|
|
4608
4612
|
};
|
|
4609
4613
|
const showInput = variant !== "fully-in-use";
|
|
4610
|
-
const
|
|
4614
|
+
const showInlineFund = variant === "session-zero" || variant === "mixed";
|
|
4611
4615
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: [
|
|
4612
4616
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
4613
4617
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
4614
4618
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-sm leading-[14px]", children: "Total" }),
|
|
4615
4619
|
/* @__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" })
|
|
4616
4620
|
] }),
|
|
4617
|
-
isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4621
|
+
isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkUHXVYWTF_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 })
|
|
4618
4622
|
] }),
|
|
4619
4623
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
4620
4624
|
/* @__PURE__ */ jsxRuntime.jsx(SegmentedBalanceBar, { availableWei, inUseWei }),
|
|
@@ -4659,14 +4663,14 @@ function WalletBalanceView({
|
|
|
4659
4663
|
}
|
|
4660
4664
|
)
|
|
4661
4665
|
] }),
|
|
4662
|
-
|
|
4666
|
+
showInlineFund && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4663
4667
|
"button",
|
|
4664
4668
|
{
|
|
4665
4669
|
type: "button",
|
|
4666
|
-
disabled: !
|
|
4667
|
-
onClick:
|
|
4670
|
+
disabled: !onFundSession || !canFundSession,
|
|
4671
|
+
onClick: handleFundSession,
|
|
4668
4672
|
className: "border-border flex h-10 min-w-20 cursor-pointer items-center justify-center rounded-[10px] border px-3 text-sm font-medium text-[#4fc77f] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50",
|
|
4669
|
-
children: "
|
|
4673
|
+
children: "Fund session"
|
|
4670
4674
|
}
|
|
4671
4675
|
)
|
|
4672
4676
|
] }),
|
|
@@ -4690,10 +4694,10 @@ function WalletBalanceView({
|
|
|
4690
4694
|
"button",
|
|
4691
4695
|
{
|
|
4692
4696
|
type: "button",
|
|
4693
|
-
disabled: !
|
|
4694
|
-
onClick:
|
|
4697
|
+
disabled: !onFundSession || !canFundSession,
|
|
4698
|
+
onClick: handleFundSession,
|
|
4695
4699
|
className: "bg-primary text-primary-foreground hover:bg-primary/90 flex h-10 flex-1 cursor-pointer items-center justify-center rounded-[10px] px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",
|
|
4696
|
-
children: "
|
|
4700
|
+
children: "Fund session"
|
|
4697
4701
|
}
|
|
4698
4702
|
),
|
|
4699
4703
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4730,17 +4734,41 @@ function WalletBalanceView({
|
|
|
4730
4734
|
] }) })
|
|
4731
4735
|
] });
|
|
4732
4736
|
}
|
|
4737
|
+
function invokeGuarded(runRef, invoke, handlers) {
|
|
4738
|
+
const run = ++runRef.current;
|
|
4739
|
+
const isCurrent = () => runRef.current === run;
|
|
4740
|
+
let result;
|
|
4741
|
+
try {
|
|
4742
|
+
result = invoke();
|
|
4743
|
+
} catch (err) {
|
|
4744
|
+
if (isCurrent()) handlers.onError(err);
|
|
4745
|
+
return;
|
|
4746
|
+
}
|
|
4747
|
+
if (result == null || typeof result.then !== "function") {
|
|
4748
|
+
handlers.onSyncResult();
|
|
4749
|
+
return;
|
|
4750
|
+
}
|
|
4751
|
+
handlers.onAsyncStart();
|
|
4752
|
+
result.then(
|
|
4753
|
+
() => {
|
|
4754
|
+
if (isCurrent()) handlers.onSuccess();
|
|
4755
|
+
},
|
|
4756
|
+
(err) => {
|
|
4757
|
+
if (isCurrent()) handlers.onError(err);
|
|
4758
|
+
}
|
|
4759
|
+
);
|
|
4760
|
+
}
|
|
4733
4761
|
function WalletModalContent({
|
|
4734
4762
|
session,
|
|
4735
4763
|
allowance,
|
|
4736
|
-
|
|
4764
|
+
onFundSession,
|
|
4737
4765
|
onEndSession,
|
|
4738
4766
|
onDepositSuccess,
|
|
4739
4767
|
onClose,
|
|
4740
4768
|
onCloseBlockedChange,
|
|
4741
4769
|
...depositHandlers
|
|
4742
4770
|
}) {
|
|
4743
|
-
const { serviceName, hostedAuthConfig } =
|
|
4771
|
+
const { serviceName, hostedAuthConfig } = chunkUHXVYWTF_cjs.usePrivanaContext();
|
|
4744
4772
|
const { address } = wagmi.useAccount();
|
|
4745
4773
|
const appName = serviceName ?? "Privana";
|
|
4746
4774
|
const [view, setView] = react.useState("balance");
|
|
@@ -4748,7 +4776,10 @@ function WalletModalContent({
|
|
|
4748
4776
|
const [depositBlocked, setDepositBlocked] = react.useState(false);
|
|
4749
4777
|
const [withdrawPending, setWithdrawPending] = react.useState(false);
|
|
4750
4778
|
const [endSessionError, setEndSessionError] = react.useState(null);
|
|
4779
|
+
const [fundSessionError, setFundSessionError] = react.useState(null);
|
|
4751
4780
|
const endSessionRunRef = react.useRef(0);
|
|
4781
|
+
const fundSessionRunRef = react.useRef(0);
|
|
4782
|
+
const [pendingFundSession, setPendingFundSession] = react.useState(null);
|
|
4752
4783
|
const prevAddressRef = react.useRef(address);
|
|
4753
4784
|
react.useEffect(() => {
|
|
4754
4785
|
const prev = prevAddressRef.current;
|
|
@@ -4760,10 +4791,13 @@ function WalletModalContent({
|
|
|
4760
4791
|
setDepositBlocked(false);
|
|
4761
4792
|
setWithdrawPending(false);
|
|
4762
4793
|
setEndSessionError(null);
|
|
4794
|
+
setFundSessionError(null);
|
|
4795
|
+
setPendingFundSession(null);
|
|
4763
4796
|
endSessionRunRef.current++;
|
|
4797
|
+
fundSessionRunRef.current++;
|
|
4764
4798
|
}
|
|
4765
4799
|
}, [address, hostedAuthConfig]);
|
|
4766
|
-
const closeBlocked = depositBlocked || withdrawPending || view === "ending-session";
|
|
4800
|
+
const closeBlocked = depositBlocked || withdrawPending || view === "funding-session" || view === "ending-session";
|
|
4767
4801
|
react.useEffect(() => {
|
|
4768
4802
|
onCloseBlockedChange?.(closeBlocked);
|
|
4769
4803
|
}, [closeBlocked, onCloseBlockedChange]);
|
|
@@ -4777,20 +4811,16 @@ function WalletModalContent({
|
|
|
4777
4811
|
};
|
|
4778
4812
|
const startEndSession = () => {
|
|
4779
4813
|
if (!onEndSession) return;
|
|
4780
|
-
const run = ++endSessionRunRef.current;
|
|
4781
4814
|
setEndSessionError(null);
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
() =>
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
},
|
|
4788
|
-
(err) => {
|
|
4789
|
-
if (endSessionRunRef.current !== run) return;
|
|
4815
|
+
invokeGuarded(endSessionRunRef, () => onEndSession(), {
|
|
4816
|
+
onSyncResult: () => setView("withdraw"),
|
|
4817
|
+
onAsyncStart: () => setView("ending-session"),
|
|
4818
|
+
onSuccess: () => setView("withdraw"),
|
|
4819
|
+
onError: (err) => {
|
|
4790
4820
|
setEndSessionError(err instanceof Error ? err.message : null);
|
|
4791
4821
|
setView("end-session-error");
|
|
4792
4822
|
}
|
|
4793
|
-
);
|
|
4823
|
+
});
|
|
4794
4824
|
};
|
|
4795
4825
|
const handleWithdraw = () => {
|
|
4796
4826
|
if (session && onEndSession) {
|
|
@@ -4804,6 +4834,36 @@ function WalletModalContent({
|
|
|
4804
4834
|
setEndSessionError(null);
|
|
4805
4835
|
setView("balance");
|
|
4806
4836
|
};
|
|
4837
|
+
const fundSession = (args) => {
|
|
4838
|
+
if (!onFundSession) return;
|
|
4839
|
+
setFundSessionError(null);
|
|
4840
|
+
setPendingFundSession(args);
|
|
4841
|
+
setAmount("");
|
|
4842
|
+
invokeGuarded(fundSessionRunRef, () => onFundSession(args), {
|
|
4843
|
+
onSyncResult: () => {
|
|
4844
|
+
setPendingFundSession(null);
|
|
4845
|
+
setView("balance");
|
|
4846
|
+
},
|
|
4847
|
+
onAsyncStart: () => setView("funding-session"),
|
|
4848
|
+
onSuccess: () => {
|
|
4849
|
+
setPendingFundSession(null);
|
|
4850
|
+
setView("balance");
|
|
4851
|
+
},
|
|
4852
|
+
onError: (err) => {
|
|
4853
|
+
setFundSessionError(err instanceof Error ? err.message : null);
|
|
4854
|
+
setView("fund-session-error");
|
|
4855
|
+
}
|
|
4856
|
+
});
|
|
4857
|
+
};
|
|
4858
|
+
const dismissFundSessionError = () => {
|
|
4859
|
+
fundSessionRunRef.current++;
|
|
4860
|
+
setFundSessionError(null);
|
|
4861
|
+
if (pendingFundSession) {
|
|
4862
|
+
setAmount(pendingFundSession.amount);
|
|
4863
|
+
setPendingFundSession(null);
|
|
4864
|
+
}
|
|
4865
|
+
setView("balance");
|
|
4866
|
+
};
|
|
4807
4867
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4808
4868
|
onClose && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4809
4869
|
"button",
|
|
@@ -4812,14 +4872,14 @@ function WalletModalContent({
|
|
|
4812
4872
|
onClick: onClose,
|
|
4813
4873
|
disabled: closeBlocked,
|
|
4814
4874
|
"aria-label": "Close",
|
|
4815
|
-
className:
|
|
4875
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
4816
4876
|
"absolute top-6 right-5 z-20 flex h-5 w-5 items-center justify-center transition-colors",
|
|
4817
4877
|
closeBlocked ? "text-muted-foreground/40 cursor-not-allowed" : "text-muted-foreground hover:text-foreground cursor-pointer"
|
|
4818
4878
|
),
|
|
4819
4879
|
children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {})
|
|
4820
4880
|
}
|
|
4821
4881
|
),
|
|
4822
|
-
(view === "balance" || view === "ending-session" || view === "end-session-error") && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center px-5 py-4", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground text-xl leading-5 font-medium", children: appName }) }),
|
|
4882
|
+
(view === "balance" || view === "funding-session" || view === "fund-session-error" || view === "ending-session" || view === "end-session-error") && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center px-5 py-4", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground text-xl leading-5 font-medium", children: appName }) }),
|
|
4823
4883
|
view === "balance" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4824
4884
|
WalletBalanceView,
|
|
4825
4885
|
{
|
|
@@ -4827,11 +4887,30 @@ function WalletModalContent({
|
|
|
4827
4887
|
allowance,
|
|
4828
4888
|
amount,
|
|
4829
4889
|
onAmountChange: setAmount,
|
|
4830
|
-
|
|
4890
|
+
onFundSession: onFundSession ? fundSession : void 0,
|
|
4831
4891
|
onAddFunds: () => setView("deposit"),
|
|
4832
4892
|
onWithdraw: handleWithdraw
|
|
4833
4893
|
}
|
|
4834
4894
|
),
|
|
4895
|
+
view === "funding-session" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4896
|
+
TransactionProgressView,
|
|
4897
|
+
{
|
|
4898
|
+
title: "Funding session...",
|
|
4899
|
+
steps: [{ label: "Waiting for the session to be funded", status: "active" }]
|
|
4900
|
+
}
|
|
4901
|
+
) }),
|
|
4902
|
+
view === "fund-session-error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4903
|
+
TransactionErrorView,
|
|
4904
|
+
{
|
|
4905
|
+
title: "Could not fund session",
|
|
4906
|
+
message: fundSessionError ? `Your session could not be funded. (${fundSessionError})` : "Your session could not be funded.",
|
|
4907
|
+
onRetry: () => {
|
|
4908
|
+
if (pendingFundSession) fundSession(pendingFundSession);
|
|
4909
|
+
},
|
|
4910
|
+
onDismiss: dismissFundSessionError,
|
|
4911
|
+
retryLabel: "Try again"
|
|
4912
|
+
}
|
|
4913
|
+
) }),
|
|
4835
4914
|
view === "ending-session" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted flex flex-col gap-6 rounded-[10px] p-5", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4836
4915
|
TransactionProgressView,
|
|
4837
4916
|
{
|
|
@@ -4845,7 +4924,8 @@ function WalletModalContent({
|
|
|
4845
4924
|
title: "Could not end session",
|
|
4846
4925
|
message: endSessionError ? `Your game session could not be ended, so the funds committed to it are not available to withdraw yet. (${endSessionError})` : "Your game session could not be ended, so the funds committed to it are not available to withdraw yet.",
|
|
4847
4926
|
onRetry: startEndSession,
|
|
4848
|
-
onDismiss: dismissEndSessionError
|
|
4927
|
+
onDismiss: dismissEndSessionError,
|
|
4928
|
+
retryLabel: "Try again"
|
|
4849
4929
|
}
|
|
4850
4930
|
) }),
|
|
4851
4931
|
view === "withdraw" && /* @__PURE__ */ jsxRuntime.jsx(WithdrawModalContent, { onBack: exitWithdraw, onPendingChange: setWithdrawPending }),
|
|
@@ -4910,7 +4990,7 @@ function WalletInlineModal({ className, ...handlers }) {
|
|
|
4910
4990
|
"div",
|
|
4911
4991
|
{
|
|
4912
4992
|
"data-privana": true,
|
|
4913
|
-
className:
|
|
4993
|
+
className: chunkUHXVYWTF_cjs.cn(
|
|
4914
4994
|
"bg-card relative flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
4915
4995
|
className
|
|
4916
4996
|
),
|
|
@@ -4921,287 +5001,287 @@ function WalletInlineModal({ className, ...handlers }) {
|
|
|
4921
5001
|
|
|
4922
5002
|
Object.defineProperty(exports, "AccountingApiError", {
|
|
4923
5003
|
enumerable: true,
|
|
4924
|
-
get: function () { return
|
|
5004
|
+
get: function () { return chunkUHXVYWTF_cjs.AccountingApiError; }
|
|
4925
5005
|
});
|
|
4926
5006
|
Object.defineProperty(exports, "Button", {
|
|
4927
5007
|
enumerable: true,
|
|
4928
|
-
get: function () { return
|
|
5008
|
+
get: function () { return chunkUHXVYWTF_cjs.Button; }
|
|
4929
5009
|
});
|
|
4930
5010
|
Object.defineProperty(exports, "DEFAULT_LOCK_DURATION_SECONDS", {
|
|
4931
5011
|
enumerable: true,
|
|
4932
|
-
get: function () { return
|
|
5012
|
+
get: function () { return chunkUHXVYWTF_cjs.DEFAULT_LOCK_DURATION_SECONDS; }
|
|
4933
5013
|
});
|
|
4934
5014
|
Object.defineProperty(exports, "DEFAULT_ONRAMP_LOCK_BUFFER", {
|
|
4935
5015
|
enumerable: true,
|
|
4936
|
-
get: function () { return
|
|
5016
|
+
get: function () { return chunkUHXVYWTF_cjs.DEFAULT_ONRAMP_LOCK_BUFFER; }
|
|
4937
5017
|
});
|
|
4938
5018
|
Object.defineProperty(exports, "HOSTED_AUTH_CLOCK_SKEW_MS", {
|
|
4939
5019
|
enumerable: true,
|
|
4940
|
-
get: function () { return
|
|
5020
|
+
get: function () { return chunkUHXVYWTF_cjs.HOSTED_AUTH_CLOCK_SKEW_MS; }
|
|
4941
5021
|
});
|
|
4942
5022
|
Object.defineProperty(exports, "HostedAuthError", {
|
|
4943
5023
|
enumerable: true,
|
|
4944
|
-
get: function () { return
|
|
5024
|
+
get: function () { return chunkUHXVYWTF_cjs.HostedAuthError; }
|
|
4945
5025
|
});
|
|
4946
5026
|
Object.defineProperty(exports, "HostedAuthRequiredError", {
|
|
4947
5027
|
enumerable: true,
|
|
4948
|
-
get: function () { return
|
|
5028
|
+
get: function () { return chunkUHXVYWTF_cjs.HostedAuthRequiredError; }
|
|
4949
5029
|
});
|
|
4950
5030
|
Object.defineProperty(exports, "HostedAuthStateMismatchError", {
|
|
4951
5031
|
enumerable: true,
|
|
4952
|
-
get: function () { return
|
|
5032
|
+
get: function () { return chunkUHXVYWTF_cjs.HostedAuthStateMismatchError; }
|
|
4953
5033
|
});
|
|
4954
5034
|
Object.defineProperty(exports, "HttpClient", {
|
|
4955
5035
|
enumerable: true,
|
|
4956
|
-
get: function () { return
|
|
5036
|
+
get: function () { return chunkUHXVYWTF_cjs.HttpClient; }
|
|
4957
5037
|
});
|
|
4958
5038
|
Object.defineProperty(exports, "LOCK_TYPES", {
|
|
4959
5039
|
enumerable: true,
|
|
4960
|
-
get: function () { return
|
|
5040
|
+
get: function () { return chunkUHXVYWTF_cjs.LOCK_TYPES; }
|
|
4961
5041
|
});
|
|
4962
5042
|
Object.defineProperty(exports, "MODIFY_LOCK_TYPES", {
|
|
4963
5043
|
enumerable: true,
|
|
4964
|
-
get: function () { return
|
|
5044
|
+
get: function () { return chunkUHXVYWTF_cjs.MODIFY_LOCK_TYPES; }
|
|
4965
5045
|
});
|
|
4966
5046
|
Object.defineProperty(exports, "NETWORK_CONFIG", {
|
|
4967
5047
|
enumerable: true,
|
|
4968
|
-
get: function () { return
|
|
5048
|
+
get: function () { return chunkUHXVYWTF_cjs.NETWORK_CONFIG; }
|
|
4969
5049
|
});
|
|
4970
5050
|
Object.defineProperty(exports, "NetworkError", {
|
|
4971
5051
|
enumerable: true,
|
|
4972
|
-
get: function () { return
|
|
5052
|
+
get: function () { return chunkUHXVYWTF_cjs.NetworkError; }
|
|
4973
5053
|
});
|
|
4974
5054
|
Object.defineProperty(exports, "PostDepositLockError", {
|
|
4975
5055
|
enumerable: true,
|
|
4976
|
-
get: function () { return
|
|
5056
|
+
get: function () { return chunkUHXVYWTF_cjs.PostDepositLockError; }
|
|
4977
5057
|
});
|
|
4978
5058
|
Object.defineProperty(exports, "PrivanaClient", {
|
|
4979
5059
|
enumerable: true,
|
|
4980
|
-
get: function () { return
|
|
5060
|
+
get: function () { return chunkUHXVYWTF_cjs.PrivanaClient; }
|
|
4981
5061
|
});
|
|
4982
5062
|
Object.defineProperty(exports, "PrivanaProvider", {
|
|
4983
5063
|
enumerable: true,
|
|
4984
|
-
get: function () { return
|
|
5064
|
+
get: function () { return chunkUHXVYWTF_cjs.PrivanaProvider; }
|
|
4985
5065
|
});
|
|
4986
5066
|
Object.defineProperty(exports, "SUPPORTED_CHAINS", {
|
|
4987
5067
|
enumerable: true,
|
|
4988
|
-
get: function () { return
|
|
5068
|
+
get: function () { return chunkUHXVYWTF_cjs.SUPPORTED_CHAINS; }
|
|
4989
5069
|
});
|
|
4990
5070
|
Object.defineProperty(exports, "SiweAuthProvider", {
|
|
4991
5071
|
enumerable: true,
|
|
4992
|
-
get: function () { return
|
|
5072
|
+
get: function () { return chunkUHXVYWTF_cjs.SiweAuthProvider; }
|
|
4993
5073
|
});
|
|
4994
5074
|
Object.defineProperty(exports, "Skeleton", {
|
|
4995
5075
|
enumerable: true,
|
|
4996
|
-
get: function () { return
|
|
5076
|
+
get: function () { return chunkUHXVYWTF_cjs.Skeleton; }
|
|
4997
5077
|
});
|
|
4998
5078
|
Object.defineProperty(exports, "TRANSFER_LOCKED_TYPES", {
|
|
4999
5079
|
enumerable: true,
|
|
5000
|
-
get: function () { return
|
|
5080
|
+
get: function () { return chunkUHXVYWTF_cjs.TRANSFER_LOCKED_TYPES; }
|
|
5001
5081
|
});
|
|
5002
5082
|
Object.defineProperty(exports, "TRANSFER_TYPES", {
|
|
5003
5083
|
enumerable: true,
|
|
5004
|
-
get: function () { return
|
|
5084
|
+
get: function () { return chunkUHXVYWTF_cjs.TRANSFER_TYPES; }
|
|
5005
5085
|
});
|
|
5006
5086
|
Object.defineProperty(exports, "ValidationError", {
|
|
5007
5087
|
enumerable: true,
|
|
5008
|
-
get: function () { return
|
|
5088
|
+
get: function () { return chunkUHXVYWTF_cjs.ValidationError; }
|
|
5009
5089
|
});
|
|
5010
5090
|
Object.defineProperty(exports, "WITHDRAW_FROM_LOCK_TYPES", {
|
|
5011
5091
|
enumerable: true,
|
|
5012
|
-
get: function () { return
|
|
5092
|
+
get: function () { return chunkUHXVYWTF_cjs.WITHDRAW_FROM_LOCK_TYPES; }
|
|
5013
5093
|
});
|
|
5014
5094
|
Object.defineProperty(exports, "WITHDRAW_TYPES", {
|
|
5015
5095
|
enumerable: true,
|
|
5016
|
-
get: function () { return
|
|
5096
|
+
get: function () { return chunkUHXVYWTF_cjs.WITHDRAW_TYPES; }
|
|
5017
5097
|
});
|
|
5018
5098
|
Object.defineProperty(exports, "applyLockBuffer", {
|
|
5019
5099
|
enumerable: true,
|
|
5020
|
-
get: function () { return
|
|
5100
|
+
get: function () { return chunkUHXVYWTF_cjs.applyLockBuffer; }
|
|
5021
5101
|
});
|
|
5022
5102
|
Object.defineProperty(exports, "applyRefreshResponse", {
|
|
5023
5103
|
enumerable: true,
|
|
5024
|
-
get: function () { return
|
|
5104
|
+
get: function () { return chunkUHXVYWTF_cjs.applyRefreshResponse; }
|
|
5025
5105
|
});
|
|
5026
5106
|
Object.defineProperty(exports, "buildHostedAuthSession", {
|
|
5027
5107
|
enumerable: true,
|
|
5028
|
-
get: function () { return
|
|
5108
|
+
get: function () { return chunkUHXVYWTF_cjs.buildHostedAuthSession; }
|
|
5029
5109
|
});
|
|
5030
5110
|
Object.defineProperty(exports, "buildSiweStatement", {
|
|
5031
5111
|
enumerable: true,
|
|
5032
|
-
get: function () { return
|
|
5112
|
+
get: function () { return chunkUHXVYWTF_cjs.buildSiweStatement; }
|
|
5033
5113
|
});
|
|
5034
5114
|
Object.defineProperty(exports, "buttonVariants", {
|
|
5035
5115
|
enumerable: true,
|
|
5036
|
-
get: function () { return
|
|
5116
|
+
get: function () { return chunkUHXVYWTF_cjs.buttonVariants; }
|
|
5037
5117
|
});
|
|
5038
5118
|
Object.defineProperty(exports, "clampLockAmount", {
|
|
5039
5119
|
enumerable: true,
|
|
5040
|
-
get: function () { return
|
|
5120
|
+
get: function () { return chunkUHXVYWTF_cjs.clampLockAmount; }
|
|
5041
5121
|
});
|
|
5042
5122
|
Object.defineProperty(exports, "clearHostedAuthPendingTransaction", {
|
|
5043
5123
|
enumerable: true,
|
|
5044
|
-
get: function () { return
|
|
5124
|
+
get: function () { return chunkUHXVYWTF_cjs.clearHostedAuthPendingTransaction; }
|
|
5045
5125
|
});
|
|
5046
5126
|
Object.defineProperty(exports, "clearPendingLock", {
|
|
5047
5127
|
enumerable: true,
|
|
5048
|
-
get: function () { return
|
|
5128
|
+
get: function () { return chunkUHXVYWTF_cjs.clearPendingLock; }
|
|
5049
5129
|
});
|
|
5050
5130
|
Object.defineProperty(exports, "createDomain", {
|
|
5051
5131
|
enumerable: true,
|
|
5052
|
-
get: function () { return
|
|
5132
|
+
get: function () { return chunkUHXVYWTF_cjs.createDomain; }
|
|
5053
5133
|
});
|
|
5054
5134
|
Object.defineProperty(exports, "createHostedAuthPendingStorageKey", {
|
|
5055
5135
|
enumerable: true,
|
|
5056
|
-
get: function () { return
|
|
5136
|
+
get: function () { return chunkUHXVYWTF_cjs.createHostedAuthPendingStorageKey; }
|
|
5057
5137
|
});
|
|
5058
5138
|
Object.defineProperty(exports, "createHostedAuthState", {
|
|
5059
5139
|
enumerable: true,
|
|
5060
|
-
get: function () { return
|
|
5140
|
+
get: function () { return chunkUHXVYWTF_cjs.createHostedAuthState; }
|
|
5061
5141
|
});
|
|
5062
5142
|
Object.defineProperty(exports, "createHostedAuthStorageKey", {
|
|
5063
5143
|
enumerable: true,
|
|
5064
|
-
get: function () { return
|
|
5144
|
+
get: function () { return chunkUHXVYWTF_cjs.createHostedAuthStorageKey; }
|
|
5065
5145
|
});
|
|
5066
5146
|
Object.defineProperty(exports, "createLockExpiry", {
|
|
5067
5147
|
enumerable: true,
|
|
5068
|
-
get: function () { return
|
|
5148
|
+
get: function () { return chunkUHXVYWTF_cjs.createLockExpiry; }
|
|
5069
5149
|
});
|
|
5070
5150
|
Object.defineProperty(exports, "createPkceChallenge", {
|
|
5071
5151
|
enumerable: true,
|
|
5072
|
-
get: function () { return
|
|
5152
|
+
get: function () { return chunkUHXVYWTF_cjs.createPkceChallenge; }
|
|
5073
5153
|
});
|
|
5074
5154
|
Object.defineProperty(exports, "createPkceVerifier", {
|
|
5075
5155
|
enumerable: true,
|
|
5076
|
-
get: function () { return
|
|
5156
|
+
get: function () { return chunkUHXVYWTF_cjs.createPkceVerifier; }
|
|
5077
5157
|
});
|
|
5078
5158
|
Object.defineProperty(exports, "createSignedLockRequest", {
|
|
5079
5159
|
enumerable: true,
|
|
5080
|
-
get: function () { return
|
|
5160
|
+
get: function () { return chunkUHXVYWTF_cjs.createSignedLockRequest; }
|
|
5081
5161
|
});
|
|
5082
5162
|
Object.defineProperty(exports, "getAccountingContract", {
|
|
5083
5163
|
enumerable: true,
|
|
5084
|
-
get: function () { return
|
|
5164
|
+
get: function () { return chunkUHXVYWTF_cjs.getAccountingContract; }
|
|
5085
5165
|
});
|
|
5086
5166
|
Object.defineProperty(exports, "getApiUrl", {
|
|
5087
5167
|
enumerable: true,
|
|
5088
|
-
get: function () { return
|
|
5168
|
+
get: function () { return chunkUHXVYWTF_cjs.getApiUrl; }
|
|
5089
5169
|
});
|
|
5090
5170
|
Object.defineProperty(exports, "getChainById", {
|
|
5091
5171
|
enumerable: true,
|
|
5092
|
-
get: function () { return
|
|
5172
|
+
get: function () { return chunkUHXVYWTF_cjs.getChainById; }
|
|
5093
5173
|
});
|
|
5094
5174
|
Object.defineProperty(exports, "getChainId", {
|
|
5095
5175
|
enumerable: true,
|
|
5096
|
-
get: function () { return
|
|
5176
|
+
get: function () { return chunkUHXVYWTF_cjs.getChainId; }
|
|
5097
5177
|
});
|
|
5098
5178
|
Object.defineProperty(exports, "getExplorerAddressUrl", {
|
|
5099
5179
|
enumerable: true,
|
|
5100
|
-
get: function () { return
|
|
5180
|
+
get: function () { return chunkUHXVYWTF_cjs.getExplorerAddressUrl; }
|
|
5101
5181
|
});
|
|
5102
5182
|
Object.defineProperty(exports, "getExplorerLabel", {
|
|
5103
5183
|
enumerable: true,
|
|
5104
|
-
get: function () { return
|
|
5184
|
+
get: function () { return chunkUHXVYWTF_cjs.getExplorerLabel; }
|
|
5105
5185
|
});
|
|
5106
5186
|
Object.defineProperty(exports, "isHostedAuthRefreshActive", {
|
|
5107
5187
|
enumerable: true,
|
|
5108
|
-
get: function () { return
|
|
5188
|
+
get: function () { return chunkUHXVYWTF_cjs.isHostedAuthRefreshActive; }
|
|
5109
5189
|
});
|
|
5110
5190
|
Object.defineProperty(exports, "isHostedAuthSessionActive", {
|
|
5111
5191
|
enumerable: true,
|
|
5112
|
-
get: function () { return
|
|
5192
|
+
get: function () { return chunkUHXVYWTF_cjs.isHostedAuthSessionActive; }
|
|
5113
5193
|
});
|
|
5114
5194
|
Object.defineProperty(exports, "isSignedLockUsable", {
|
|
5115
5195
|
enumerable: true,
|
|
5116
|
-
get: function () { return
|
|
5196
|
+
get: function () { return chunkUHXVYWTF_cjs.isSignedLockUsable; }
|
|
5117
5197
|
});
|
|
5118
5198
|
Object.defineProperty(exports, "loadPendingLock", {
|
|
5119
5199
|
enumerable: true,
|
|
5120
|
-
get: function () { return
|
|
5200
|
+
get: function () { return chunkUHXVYWTF_cjs.loadPendingLock; }
|
|
5121
5201
|
});
|
|
5122
5202
|
Object.defineProperty(exports, "normalizeAddress", {
|
|
5123
5203
|
enumerable: true,
|
|
5124
|
-
get: function () { return
|
|
5204
|
+
get: function () { return chunkUHXVYWTF_cjs.normalizeAddress; }
|
|
5125
5205
|
});
|
|
5126
5206
|
Object.defineProperty(exports, "normalizeHex", {
|
|
5127
5207
|
enumerable: true,
|
|
5128
|
-
get: function () { return
|
|
5208
|
+
get: function () { return chunkUHXVYWTF_cjs.normalizeHex; }
|
|
5129
5209
|
});
|
|
5130
5210
|
Object.defineProperty(exports, "parseHostedAuthCallback", {
|
|
5131
5211
|
enumerable: true,
|
|
5132
|
-
get: function () { return
|
|
5212
|
+
get: function () { return chunkUHXVYWTF_cjs.parseHostedAuthCallback; }
|
|
5133
5213
|
});
|
|
5134
5214
|
Object.defineProperty(exports, "persistHostedAuthPendingTransaction", {
|
|
5135
5215
|
enumerable: true,
|
|
5136
|
-
get: function () { return
|
|
5216
|
+
get: function () { return chunkUHXVYWTF_cjs.persistHostedAuthPendingTransaction; }
|
|
5137
5217
|
});
|
|
5138
5218
|
Object.defineProperty(exports, "readHostedAuthPendingTransaction", {
|
|
5139
5219
|
enumerable: true,
|
|
5140
|
-
get: function () { return
|
|
5220
|
+
get: function () { return chunkUHXVYWTF_cjs.readHostedAuthPendingTransaction; }
|
|
5141
5221
|
});
|
|
5142
5222
|
Object.defineProperty(exports, "readStoredHostedAuthSession", {
|
|
5143
5223
|
enumerable: true,
|
|
5144
|
-
get: function () { return
|
|
5224
|
+
get: function () { return chunkUHXVYWTF_cjs.readStoredHostedAuthSession; }
|
|
5145
5225
|
});
|
|
5146
5226
|
Object.defineProperty(exports, "savePendingLock", {
|
|
5147
5227
|
enumerable: true,
|
|
5148
|
-
get: function () { return
|
|
5228
|
+
get: function () { return chunkUHXVYWTF_cjs.savePendingLock; }
|
|
5149
5229
|
});
|
|
5150
5230
|
Object.defineProperty(exports, "signLockMessage", {
|
|
5151
5231
|
enumerable: true,
|
|
5152
|
-
get: function () { return
|
|
5232
|
+
get: function () { return chunkUHXVYWTF_cjs.signLockMessage; }
|
|
5153
5233
|
});
|
|
5154
5234
|
Object.defineProperty(exports, "signModifyLockMessage", {
|
|
5155
5235
|
enumerable: true,
|
|
5156
|
-
get: function () { return
|
|
5236
|
+
get: function () { return chunkUHXVYWTF_cjs.signModifyLockMessage; }
|
|
5157
5237
|
});
|
|
5158
5238
|
Object.defineProperty(exports, "signTransferLockedMessage", {
|
|
5159
5239
|
enumerable: true,
|
|
5160
|
-
get: function () { return
|
|
5240
|
+
get: function () { return chunkUHXVYWTF_cjs.signTransferLockedMessage; }
|
|
5161
5241
|
});
|
|
5162
5242
|
Object.defineProperty(exports, "signTransferMessage", {
|
|
5163
5243
|
enumerable: true,
|
|
5164
|
-
get: function () { return
|
|
5244
|
+
get: function () { return chunkUHXVYWTF_cjs.signTransferMessage; }
|
|
5165
5245
|
});
|
|
5166
5246
|
Object.defineProperty(exports, "signWithdrawFromLockMessage", {
|
|
5167
5247
|
enumerable: true,
|
|
5168
|
-
get: function () { return
|
|
5248
|
+
get: function () { return chunkUHXVYWTF_cjs.signWithdrawFromLockMessage; }
|
|
5169
5249
|
});
|
|
5170
5250
|
Object.defineProperty(exports, "signWithdrawMessage", {
|
|
5171
5251
|
enumerable: true,
|
|
5172
|
-
get: function () { return
|
|
5252
|
+
get: function () { return chunkUHXVYWTF_cjs.signWithdrawMessage; }
|
|
5173
5253
|
});
|
|
5174
5254
|
Object.defineProperty(exports, "stripHostedAuthCallbackParams", {
|
|
5175
5255
|
enumerable: true,
|
|
5176
|
-
get: function () { return
|
|
5256
|
+
get: function () { return chunkUHXVYWTF_cjs.stripHostedAuthCallbackParams; }
|
|
5177
5257
|
});
|
|
5178
5258
|
Object.defineProperty(exports, "submitPendingLock", {
|
|
5179
5259
|
enumerable: true,
|
|
5180
|
-
get: function () { return
|
|
5260
|
+
get: function () { return chunkUHXVYWTF_cjs.submitPendingLock; }
|
|
5181
5261
|
});
|
|
5182
5262
|
Object.defineProperty(exports, "syncHostedAuthSessionToClient", {
|
|
5183
5263
|
enumerable: true,
|
|
5184
|
-
get: function () { return
|
|
5264
|
+
get: function () { return chunkUHXVYWTF_cjs.syncHostedAuthSessionToClient; }
|
|
5185
5265
|
});
|
|
5186
5266
|
Object.defineProperty(exports, "useDepositVerification", {
|
|
5187
5267
|
enumerable: true,
|
|
5188
|
-
get: function () { return
|
|
5268
|
+
get: function () { return chunkUHXVYWTF_cjs.useDepositVerification; }
|
|
5189
5269
|
});
|
|
5190
5270
|
Object.defineProperty(exports, "usePrivanaContext", {
|
|
5191
5271
|
enumerable: true,
|
|
5192
|
-
get: function () { return
|
|
5272
|
+
get: function () { return chunkUHXVYWTF_cjs.usePrivanaContext; }
|
|
5193
5273
|
});
|
|
5194
5274
|
Object.defineProperty(exports, "useSafeAccount", {
|
|
5195
5275
|
enumerable: true,
|
|
5196
|
-
get: function () { return
|
|
5276
|
+
get: function () { return chunkUHXVYWTF_cjs.useSafeAccount; }
|
|
5197
5277
|
});
|
|
5198
5278
|
Object.defineProperty(exports, "useSafePrivanaContext", {
|
|
5199
5279
|
enumerable: true,
|
|
5200
|
-
get: function () { return
|
|
5280
|
+
get: function () { return chunkUHXVYWTF_cjs.useSafePrivanaContext; }
|
|
5201
5281
|
});
|
|
5202
5282
|
Object.defineProperty(exports, "useSiweAuth", {
|
|
5203
5283
|
enumerable: true,
|
|
5204
|
-
get: function () { return
|
|
5284
|
+
get: function () { return chunkUHXVYWTF_cjs.useSiweAuth; }
|
|
5205
5285
|
});
|
|
5206
5286
|
exports.DepositInlineModal = DepositInlineModal;
|
|
5207
5287
|
exports.DepositModal = DepositModal;
|