@oasisprotocol/privana-sdk 0.4.2 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{chunk-CRJNDCDT.cjs → chunk-NMRIKUDN.cjs} +15 -13
- package/dist/chunk-NMRIKUDN.cjs.map +1 -0
- package/dist/{chunk-ZXFQJ5MG.js → chunk-WV6CGHEF.js} +15 -14
- package/dist/chunk-WV6CGHEF.js.map +1 -0
- package/dist/index.cjs +151 -147
- package/dist/index.d.cts +10 -8
- package/dist/index.d.ts +10 -8
- package/dist/index.js +2 -2
- package/dist/{on-ramp-DIAOtdeU.d.cts → on-ramp-CdXqJjmm.d.cts} +1 -1
- package/dist/{on-ramp-DIAOtdeU.d.ts → on-ramp-CdXqJjmm.d.ts} +1 -1
- package/dist/on-ramp.cjs +7 -7
- package/dist/on-ramp.d.cts +2 -2
- package/dist/on-ramp.d.ts +2 -2
- package/dist/on-ramp.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-CRJNDCDT.cjs.map +0 -1
- package/dist/chunk-ZXFQJ5MG.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 chunkNMRIKUDN_cjs = require('./chunk-NMRIKUDN.cjs');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var reactQuery = require('@tanstack/react-query');
|
|
7
7
|
var wagmi = require('wagmi');
|
|
@@ -229,18 +229,18 @@ async function signWithdrawFromLockMessage({
|
|
|
229
229
|
|
|
230
230
|
// src/sdk/hooks/use-privana-client.ts
|
|
231
231
|
function usePrivanaClient() {
|
|
232
|
-
const { client } =
|
|
232
|
+
const { client } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
233
233
|
return client;
|
|
234
234
|
}
|
|
235
235
|
var hostedAuthExchangeInflight = /* @__PURE__ */ new Map();
|
|
236
236
|
function normalizeHostedAuthError(error) {
|
|
237
|
-
if (error instanceof
|
|
238
|
-
return new
|
|
237
|
+
if (error instanceof chunkNMRIKUDN_cjs.AccountingApiError && error.detail) {
|
|
238
|
+
return new chunkNMRIKUDN_cjs.HostedAuthError(error.detail);
|
|
239
239
|
}
|
|
240
240
|
if (error instanceof Error) {
|
|
241
241
|
return error;
|
|
242
242
|
}
|
|
243
|
-
return new
|
|
243
|
+
return new chunkNMRIKUDN_cjs.HostedAuthError("Hosted authentication failed.");
|
|
244
244
|
}
|
|
245
245
|
function useHostedRedirectAuth() {
|
|
246
246
|
const {
|
|
@@ -251,30 +251,30 @@ function useHostedRedirectAuth() {
|
|
|
251
251
|
setHostedAuthSession,
|
|
252
252
|
clearHostedAuthSession,
|
|
253
253
|
refreshHostedAuthSession
|
|
254
|
-
} =
|
|
254
|
+
} = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
255
255
|
const [error, setError] = react.useState(null);
|
|
256
256
|
const [isLoading, setIsLoading] = react.useState(false);
|
|
257
257
|
const loginInflight = react.useRef(null);
|
|
258
258
|
const completionInflight = react.useRef(null);
|
|
259
259
|
const pendingStorageKey = react.useMemo(
|
|
260
|
-
() => hostedAuthConfig ?
|
|
260
|
+
() => hostedAuthConfig ? chunkNMRIKUDN_cjs.createHostedAuthPendingStorageKey(client.getBaseUrl(), hostedAuthConfig) : null,
|
|
261
261
|
[client, hostedAuthConfig]
|
|
262
262
|
);
|
|
263
263
|
const clearPendingLogin = react.useCallback(() => {
|
|
264
264
|
if (!pendingStorageKey || typeof window === "undefined") return;
|
|
265
|
-
|
|
265
|
+
chunkNMRIKUDN_cjs.clearHostedAuthPendingTransaction(window.sessionStorage, pendingStorageKey);
|
|
266
266
|
}, [pendingStorageKey]);
|
|
267
267
|
const login = react.useCallback(async () => {
|
|
268
268
|
if (!hostedAuthConfig) {
|
|
269
|
-
throw new
|
|
269
|
+
throw new chunkNMRIKUDN_cjs.HostedAuthRequiredError(
|
|
270
270
|
"Hosted redirect authentication is not configured for this provider."
|
|
271
271
|
);
|
|
272
272
|
}
|
|
273
273
|
if (typeof window === "undefined") {
|
|
274
|
-
throw new
|
|
274
|
+
throw new chunkNMRIKUDN_cjs.HostedAuthError("Hosted redirect authentication requires a browser environment.");
|
|
275
275
|
}
|
|
276
276
|
if (!pendingStorageKey) {
|
|
277
|
-
throw new
|
|
277
|
+
throw new chunkNMRIKUDN_cjs.HostedAuthError("Hosted redirect authentication storage is not configured.");
|
|
278
278
|
}
|
|
279
279
|
if (loginInflight.current) {
|
|
280
280
|
return loginInflight.current;
|
|
@@ -283,10 +283,10 @@ function useHostedRedirectAuth() {
|
|
|
283
283
|
setIsLoading(true);
|
|
284
284
|
setError(null);
|
|
285
285
|
try {
|
|
286
|
-
const verifier =
|
|
287
|
-
const codeChallenge = await
|
|
288
|
-
const state =
|
|
289
|
-
|
|
286
|
+
const verifier = chunkNMRIKUDN_cjs.createPkceVerifier();
|
|
287
|
+
const codeChallenge = await chunkNMRIKUDN_cjs.createPkceChallenge(verifier);
|
|
288
|
+
const state = chunkNMRIKUDN_cjs.createHostedAuthState();
|
|
289
|
+
chunkNMRIKUDN_cjs.persistHostedAuthPendingTransaction(window.sessionStorage, pendingStorageKey, {
|
|
290
290
|
codeVerifier: verifier,
|
|
291
291
|
state
|
|
292
292
|
});
|
|
@@ -315,15 +315,15 @@ function useHostedRedirectAuth() {
|
|
|
315
315
|
}, [clearPendingLogin, client, hostedAuthConfig, networkConfig.chainId, pendingStorageKey]);
|
|
316
316
|
const completeLogin = react.useCallback(async () => {
|
|
317
317
|
if (!hostedAuthConfig) {
|
|
318
|
-
throw new
|
|
318
|
+
throw new chunkNMRIKUDN_cjs.HostedAuthRequiredError(
|
|
319
319
|
"Hosted redirect authentication is not configured for this provider."
|
|
320
320
|
);
|
|
321
321
|
}
|
|
322
322
|
if (typeof window === "undefined") {
|
|
323
|
-
throw new
|
|
323
|
+
throw new chunkNMRIKUDN_cjs.HostedAuthError("Hosted redirect authentication requires a browser environment.");
|
|
324
324
|
}
|
|
325
325
|
if (!pendingStorageKey) {
|
|
326
|
-
throw new
|
|
326
|
+
throw new chunkNMRIKUDN_cjs.HostedAuthError("Hosted redirect authentication storage is not configured.");
|
|
327
327
|
}
|
|
328
328
|
if (completionInflight.current) {
|
|
329
329
|
return completionInflight.current;
|
|
@@ -333,30 +333,30 @@ function useHostedRedirectAuth() {
|
|
|
333
333
|
setError(null);
|
|
334
334
|
const callbackUrl = new URL(window.location.href);
|
|
335
335
|
const cleanupCallbackUrl = () => {
|
|
336
|
-
window.history.replaceState(null, "",
|
|
336
|
+
window.history.replaceState(null, "", chunkNMRIKUDN_cjs.stripHostedAuthCallbackParams(callbackUrl));
|
|
337
337
|
};
|
|
338
338
|
try {
|
|
339
|
-
const callback =
|
|
339
|
+
const callback = chunkNMRIKUDN_cjs.parseHostedAuthCallback(callbackUrl, hostedAuthConfig.redirectUri);
|
|
340
340
|
if (!callback) {
|
|
341
341
|
return null;
|
|
342
342
|
}
|
|
343
|
-
const pending =
|
|
343
|
+
const pending = chunkNMRIKUDN_cjs.readHostedAuthPendingTransaction(window.sessionStorage, pendingStorageKey);
|
|
344
344
|
if (!pending) {
|
|
345
345
|
clearPendingLogin();
|
|
346
346
|
cleanupCallbackUrl();
|
|
347
|
-
throw new
|
|
347
|
+
throw new chunkNMRIKUDN_cjs.HostedAuthError(
|
|
348
348
|
"Hosted authentication response could not be matched to a pending login request."
|
|
349
349
|
);
|
|
350
350
|
}
|
|
351
351
|
if (!callback.state || callback.state !== pending.state) {
|
|
352
352
|
clearPendingLogin();
|
|
353
353
|
cleanupCallbackUrl();
|
|
354
|
-
throw new
|
|
354
|
+
throw new chunkNMRIKUDN_cjs.HostedAuthStateMismatchError();
|
|
355
355
|
}
|
|
356
356
|
if ("error" in callback) {
|
|
357
357
|
clearPendingLogin();
|
|
358
358
|
cleanupCallbackUrl();
|
|
359
|
-
throw new
|
|
359
|
+
throw new chunkNMRIKUDN_cjs.HostedAuthError(
|
|
360
360
|
callback.errorDescription || callback.error || "Hosted authentication failed."
|
|
361
361
|
);
|
|
362
362
|
}
|
|
@@ -371,7 +371,7 @@ function useHostedRedirectAuth() {
|
|
|
371
371
|
client_id: hostedAuthConfig.clientId,
|
|
372
372
|
redirect_uri: hostedAuthConfig.redirectUri
|
|
373
373
|
});
|
|
374
|
-
const session =
|
|
374
|
+
const session = chunkNMRIKUDN_cjs.buildHostedAuthSession(response, hostedAuthConfig);
|
|
375
375
|
setHostedAuthSession(session);
|
|
376
376
|
clearPendingLogin();
|
|
377
377
|
cleanupCallbackUrl();
|
|
@@ -416,7 +416,7 @@ function useHostedRedirectAuth() {
|
|
|
416
416
|
try {
|
|
417
417
|
return await refreshHostedAuthSession();
|
|
418
418
|
} catch (refreshError) {
|
|
419
|
-
const normalizedError = refreshError instanceof Error ? refreshError : new
|
|
419
|
+
const normalizedError = refreshError instanceof Error ? refreshError : new chunkNMRIKUDN_cjs.HostedAuthError("Hosted authentication refresh failed.");
|
|
420
420
|
setError(normalizedError);
|
|
421
421
|
throw normalizedError;
|
|
422
422
|
} finally {
|
|
@@ -436,12 +436,12 @@ function useHostedRedirectAuth() {
|
|
|
436
436
|
}
|
|
437
437
|
function useBalance(options = {}) {
|
|
438
438
|
const queryClient = react.useContext(reactQuery.QueryClientContext);
|
|
439
|
-
const accountingContext =
|
|
439
|
+
const accountingContext = chunkNMRIKUDN_cjs.useSafePrivanaContext();
|
|
440
440
|
const hasProviders = !!queryClient && !!accountingContext;
|
|
441
441
|
const client = accountingContext?.client;
|
|
442
442
|
const defaultToken = accountingContext?.defaultToken;
|
|
443
443
|
const pollingInterval = accountingContext?.pollingInterval ?? 1e4;
|
|
444
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
444
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkNMRIKUDN_cjs.usePrivateReadRequest();
|
|
445
445
|
const tokenId = options.tokenId ?? defaultToken?.id;
|
|
446
446
|
const query = reactQuery.useQuery({
|
|
447
447
|
queryKey: ["accounting-balance", ...privateReadQueryScope, tokenId],
|
|
@@ -458,7 +458,7 @@ function useBalance(options = {}) {
|
|
|
458
458
|
return {
|
|
459
459
|
balance: balanceWei,
|
|
460
460
|
balanceWei,
|
|
461
|
-
balanceFormatted:
|
|
461
|
+
balanceFormatted: chunkNMRIKUDN_cjs.formatTokenAmount(balanceWei),
|
|
462
462
|
tokenSymbol: query.data?.token_symbol ?? "",
|
|
463
463
|
chainId: query.data?.chain_id ?? "",
|
|
464
464
|
isLoading: query.isPending || query.isLoading,
|
|
@@ -468,8 +468,8 @@ function useBalance(options = {}) {
|
|
|
468
468
|
};
|
|
469
469
|
}
|
|
470
470
|
function useBatchBalances(options) {
|
|
471
|
-
const { client, pollingInterval } =
|
|
472
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
471
|
+
const { client, pollingInterval } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
472
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkNMRIKUDN_cjs.usePrivateReadRequest();
|
|
473
473
|
const query = reactQuery.useQuery({
|
|
474
474
|
queryKey: ["accounting-batch-balances", ...privateReadQueryScope, options.tokenIds],
|
|
475
475
|
queryFn: async () => {
|
|
@@ -495,7 +495,7 @@ function useEnsureCorrectChain() {
|
|
|
495
495
|
async (expectedChainId, timeoutMs, pollIntervalMs = 250) => {
|
|
496
496
|
const startedAt = Date.now();
|
|
497
497
|
while (Date.now() - startedAt < timeoutMs) {
|
|
498
|
-
const currentChainId =
|
|
498
|
+
const currentChainId = chunkNMRIKUDN_cjs.getChainId2(config);
|
|
499
499
|
if (currentChainId === expectedChainId) return true;
|
|
500
500
|
await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
501
501
|
}
|
|
@@ -505,7 +505,7 @@ function useEnsureCorrectChain() {
|
|
|
505
505
|
);
|
|
506
506
|
const ensureCorrectChain = react.useCallback(
|
|
507
507
|
async (targetChainId) => {
|
|
508
|
-
const currentChainId =
|
|
508
|
+
const currentChainId = chunkNMRIKUDN_cjs.getChainId2(config);
|
|
509
509
|
if (currentChainId === targetChainId) return false;
|
|
510
510
|
let switchErrorMessage;
|
|
511
511
|
try {
|
|
@@ -572,11 +572,11 @@ function clearPendingDeposit(address) {
|
|
|
572
572
|
}
|
|
573
573
|
function useDeposit(options = {}) {
|
|
574
574
|
const { address } = wagmi.useAccount();
|
|
575
|
-
const { client, enabledTokens, getChainById: getChainById2 } =
|
|
575
|
+
const { client, enabledTokens, getChainById: getChainById2 } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
576
576
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
577
577
|
const queryClient = reactQuery.useQueryClient();
|
|
578
578
|
const config = wagmi.useConfig();
|
|
579
|
-
const { executePrivateRead } =
|
|
579
|
+
const { executePrivateRead } = chunkNMRIKUDN_cjs.usePrivateReadRequest();
|
|
580
580
|
const confirmations = options.confirmations ?? 15;
|
|
581
581
|
const [depositAddress, setDepositAddress] = react.useState(null);
|
|
582
582
|
const [txHash, setTxHash] = react.useState();
|
|
@@ -611,7 +611,7 @@ function useDeposit(options = {}) {
|
|
|
611
611
|
error: verificationError,
|
|
612
612
|
verify,
|
|
613
613
|
reset: resetVerification
|
|
614
|
-
} =
|
|
614
|
+
} = chunkNMRIKUDN_cjs.useDepositVerification({
|
|
615
615
|
pollInterval: options.pollInterval,
|
|
616
616
|
pollTimeout: options.pollTimeout,
|
|
617
617
|
onCredited: (hash, response) => {
|
|
@@ -699,12 +699,12 @@ function useDeposit(options = {}) {
|
|
|
699
699
|
try {
|
|
700
700
|
let confirmed = false;
|
|
701
701
|
try {
|
|
702
|
-
await
|
|
702
|
+
await chunkNMRIKUDN_cjs.getTransactionReceipt(config, { hash, chainId: persisted.chainId });
|
|
703
703
|
confirmed = true;
|
|
704
704
|
} catch {
|
|
705
705
|
}
|
|
706
706
|
if (!confirmed) {
|
|
707
|
-
await
|
|
707
|
+
await chunkNMRIKUDN_cjs.waitForTransactionReceipt(config, {
|
|
708
708
|
hash,
|
|
709
709
|
chainId: persisted.chainId,
|
|
710
710
|
confirmations
|
|
@@ -791,7 +791,7 @@ function useDeposit(options = {}) {
|
|
|
791
791
|
try {
|
|
792
792
|
setIsWaitingForConfirmation(true);
|
|
793
793
|
try {
|
|
794
|
-
await
|
|
794
|
+
await chunkNMRIKUDN_cjs.waitForTransactionReceipt(config, {
|
|
795
795
|
hash,
|
|
796
796
|
chainId: sourceChain.id,
|
|
797
797
|
confirmations
|
|
@@ -865,7 +865,7 @@ function useDeposit(options = {}) {
|
|
|
865
865
|
function useWithdraw(options = {}) {
|
|
866
866
|
const { address } = wagmi.useAccount();
|
|
867
867
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
868
|
-
const { client, networkConfig } =
|
|
868
|
+
const { client, networkConfig } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
869
869
|
const queryClient = reactQuery.useQueryClient();
|
|
870
870
|
const { chainId, ensureCorrectChain } = useEnsureCorrectChain();
|
|
871
871
|
const pollInterval = options.pollInterval ?? 3e3;
|
|
@@ -1064,7 +1064,7 @@ function useWithdraw(options = {}) {
|
|
|
1064
1064
|
function useLockFunds(options = {}) {
|
|
1065
1065
|
const { address } = wagmi.useAccount();
|
|
1066
1066
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
1067
|
-
const { client, networkConfig, serviceAddress } =
|
|
1067
|
+
const { client, networkConfig, serviceAddress } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
1068
1068
|
const queryClient = reactQuery.useQueryClient();
|
|
1069
1069
|
const mutation = reactQuery.useMutation({
|
|
1070
1070
|
mutationFn: async (params) => {
|
|
@@ -1123,7 +1123,7 @@ function useLockFunds(options = {}) {
|
|
|
1123
1123
|
}
|
|
1124
1124
|
function useUnlockFunds(options = {}) {
|
|
1125
1125
|
const { address } = wagmi.useAccount();
|
|
1126
|
-
const { client } =
|
|
1126
|
+
const { client } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
1127
1127
|
const queryClient = reactQuery.useQueryClient();
|
|
1128
1128
|
const unlockMutation = reactQuery.useMutation({
|
|
1129
1129
|
mutationFn: async (params) => {
|
|
@@ -1193,7 +1193,7 @@ function useUnlockFunds(options = {}) {
|
|
|
1193
1193
|
function useTransfer(options = {}) {
|
|
1194
1194
|
const { address } = wagmi.useAccount();
|
|
1195
1195
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
1196
|
-
const { client, networkConfig, serviceAddress } =
|
|
1196
|
+
const { client, networkConfig, serviceAddress } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
1197
1197
|
const queryClient = reactQuery.useQueryClient();
|
|
1198
1198
|
const transferMutation = reactQuery.useMutation({
|
|
1199
1199
|
mutationFn: async (params) => {
|
|
@@ -1298,8 +1298,8 @@ function useTransfer(options = {}) {
|
|
|
1298
1298
|
};
|
|
1299
1299
|
}
|
|
1300
1300
|
function useLockedFunds(options = {}) {
|
|
1301
|
-
const { client, pollingInterval, serviceAddress } =
|
|
1302
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1301
|
+
const { client, pollingInterval, serviceAddress } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
1302
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkNMRIKUDN_cjs.usePrivateReadRequest();
|
|
1303
1303
|
const query = reactQuery.useQuery({
|
|
1304
1304
|
queryKey: ["accounting-locked-funds", ...privateReadQueryScope, serviceAddress ?? null],
|
|
1305
1305
|
queryFn: async () => {
|
|
@@ -1321,8 +1321,8 @@ function useLockedFunds(options = {}) {
|
|
|
1321
1321
|
};
|
|
1322
1322
|
}
|
|
1323
1323
|
function useTotalLockedBalance(options = {}) {
|
|
1324
|
-
const { client, pollingInterval, defaultToken } =
|
|
1325
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1324
|
+
const { client, pollingInterval, defaultToken } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
1325
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkNMRIKUDN_cjs.usePrivateReadRequest();
|
|
1326
1326
|
const tokenId = options.tokenId ?? defaultToken?.id;
|
|
1327
1327
|
const query = reactQuery.useQuery({
|
|
1328
1328
|
queryKey: ["accounting-total-locked-balance", ...privateReadQueryScope, tokenId],
|
|
@@ -1343,8 +1343,8 @@ function useTotalLockedBalance(options = {}) {
|
|
|
1343
1343
|
};
|
|
1344
1344
|
}
|
|
1345
1345
|
function useExpiredLocks(options = {}) {
|
|
1346
|
-
const { client, pollingInterval } =
|
|
1347
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1346
|
+
const { client, pollingInterval } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
1347
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkNMRIKUDN_cjs.usePrivateReadRequest();
|
|
1348
1348
|
const query = reactQuery.useQuery({
|
|
1349
1349
|
queryKey: ["accounting-expired-locks", ...privateReadQueryScope],
|
|
1350
1350
|
queryFn: async () => {
|
|
@@ -1366,7 +1366,7 @@ function useExpiredLocks(options = {}) {
|
|
|
1366
1366
|
}
|
|
1367
1367
|
function usePendingWithdrawals(options = {}) {
|
|
1368
1368
|
const { address, isConnected } = wagmi.useAccount();
|
|
1369
|
-
const { client, pollingInterval } =
|
|
1369
|
+
const { client, pollingInterval } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
1370
1370
|
const query = reactQuery.useQuery({
|
|
1371
1371
|
queryKey: ["accounting-pending-withdrawals", address],
|
|
1372
1372
|
queryFn: async () => {
|
|
@@ -1402,8 +1402,8 @@ function usePendingWithdrawals(options = {}) {
|
|
|
1402
1402
|
};
|
|
1403
1403
|
}
|
|
1404
1404
|
function useHistory(options = {}) {
|
|
1405
|
-
const { client, pollingInterval } =
|
|
1406
|
-
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } =
|
|
1405
|
+
const { client, pollingInterval } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
1406
|
+
const { executePrivateRead, privateReadAddress, privateReadQueryScope, privateReadReady } = chunkNMRIKUDN_cjs.usePrivateReadRequest();
|
|
1407
1407
|
const offset = options.offset ?? -1;
|
|
1408
1408
|
const limit = options.limit ?? 50;
|
|
1409
1409
|
const query = reactQuery.useQuery({
|
|
@@ -1427,7 +1427,7 @@ function useHistory(options = {}) {
|
|
|
1427
1427
|
};
|
|
1428
1428
|
}
|
|
1429
1429
|
function useTokenInfo(options = {}) {
|
|
1430
|
-
const { client } =
|
|
1430
|
+
const { client } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
1431
1431
|
const { tokenId } = options;
|
|
1432
1432
|
const query = reactQuery.useQuery({
|
|
1433
1433
|
queryKey: ["accounting-token-info", tokenId],
|
|
@@ -1447,7 +1447,7 @@ function useTokenInfo(options = {}) {
|
|
|
1447
1447
|
};
|
|
1448
1448
|
}
|
|
1449
1449
|
function useTokenList(options = {}) {
|
|
1450
|
-
const { client } =
|
|
1450
|
+
const { client } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
1451
1451
|
const query = reactQuery.useQuery({
|
|
1452
1452
|
queryKey: ["accounting-token-list"],
|
|
1453
1453
|
queryFn: () => client.listTokens(),
|
|
@@ -1465,7 +1465,7 @@ function useTokenList(options = {}) {
|
|
|
1465
1465
|
function useModifyLock(options = {}) {
|
|
1466
1466
|
const { address } = wagmi.useAccount();
|
|
1467
1467
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
1468
|
-
const { client, networkConfig } =
|
|
1468
|
+
const { client, networkConfig } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
1469
1469
|
const queryClient = reactQuery.useQueryClient();
|
|
1470
1470
|
const mutation = reactQuery.useMutation({
|
|
1471
1471
|
mutationFn: async (params) => {
|
|
@@ -1532,7 +1532,7 @@ function DialogOverlay({
|
|
|
1532
1532
|
{
|
|
1533
1533
|
"data-slot": "dialog-overlay",
|
|
1534
1534
|
"data-privana": true,
|
|
1535
|
-
className:
|
|
1535
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
1536
1536
|
"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",
|
|
1537
1537
|
className
|
|
1538
1538
|
),
|
|
@@ -1554,7 +1554,7 @@ function DialogContent({
|
|
|
1554
1554
|
{
|
|
1555
1555
|
"data-slot": "dialog-content",
|
|
1556
1556
|
"data-privana": true,
|
|
1557
|
-
className:
|
|
1557
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
1558
1558
|
"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",
|
|
1559
1559
|
className
|
|
1560
1560
|
),
|
|
@@ -1582,7 +1582,7 @@ function DialogHeader({ className, ...props }) {
|
|
|
1582
1582
|
"div",
|
|
1583
1583
|
{
|
|
1584
1584
|
"data-slot": "dialog-header",
|
|
1585
|
-
className:
|
|
1585
|
+
className: chunkNMRIKUDN_cjs.cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
1586
1586
|
...props
|
|
1587
1587
|
}
|
|
1588
1588
|
);
|
|
@@ -1592,7 +1592,7 @@ function DialogTitle({ className, ...props }) {
|
|
|
1592
1592
|
DialogPrimitive__namespace.Title,
|
|
1593
1593
|
{
|
|
1594
1594
|
"data-slot": "dialog-title",
|
|
1595
|
-
className:
|
|
1595
|
+
className: chunkNMRIKUDN_cjs.cn("text-lg leading-none font-semibold", className),
|
|
1596
1596
|
...props
|
|
1597
1597
|
}
|
|
1598
1598
|
);
|
|
@@ -1605,7 +1605,7 @@ function DialogDescription({
|
|
|
1605
1605
|
DialogPrimitive__namespace.Description,
|
|
1606
1606
|
{
|
|
1607
1607
|
"data-slot": "dialog-description",
|
|
1608
|
-
className:
|
|
1608
|
+
className: chunkNMRIKUDN_cjs.cn("text-muted-foreground text-sm", className),
|
|
1609
1609
|
...props
|
|
1610
1610
|
}
|
|
1611
1611
|
);
|
|
@@ -1960,7 +1960,7 @@ function DepositForm({
|
|
|
1960
1960
|
onSuccess
|
|
1961
1961
|
}) {
|
|
1962
1962
|
const { isConnected, address } = wagmi.useAccount();
|
|
1963
|
-
const { chains, getChainById: getChainById2 } =
|
|
1963
|
+
const { chains, getChainById: getChainById2 } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
1964
1964
|
const [amount, setAmount] = react.useState("");
|
|
1965
1965
|
const [showSuccess, setShowSuccess] = react.useState(false);
|
|
1966
1966
|
const [showTimeout, setShowTimeout] = react.useState(false);
|
|
@@ -1985,7 +1985,7 @@ function DepositForm({
|
|
|
1985
1985
|
}
|
|
1986
1986
|
});
|
|
1987
1987
|
const walletBalance = isNative ? nativeBalanceData?.value : erc20Balance;
|
|
1988
|
-
const formattedWalletBalance = walletBalance ?
|
|
1988
|
+
const formattedWalletBalance = walletBalance ? chunkNMRIKUDN_cjs.formatTokenAmount(walletBalance.toString(), selectedToken.decimals) : "0.00";
|
|
1989
1989
|
const handleMaxClick = () => {
|
|
1990
1990
|
if (formattedWalletBalance && parseFloat(formattedWalletBalance) > 0) {
|
|
1991
1991
|
setAmount(formattedWalletBalance.replace(/[\s\u2009]/g, ""));
|
|
@@ -1993,7 +1993,7 @@ function DepositForm({
|
|
|
1993
1993
|
};
|
|
1994
1994
|
const hasValidAmount = amount && parseFloat(amount) > 0;
|
|
1995
1995
|
const tooManyDecimals = hasValidAmount && amount.includes(".") && amount.split(".")[1].length > selectedToken.decimals;
|
|
1996
|
-
const exceedsBalance = hasValidAmount && !tooManyDecimals && walletBalance != null &&
|
|
1996
|
+
const exceedsBalance = hasValidAmount && !tooManyDecimals && walletBalance != null && chunkNMRIKUDN_cjs.parseTokenAmount(amount, selectedToken.decimals) > walletBalance;
|
|
1997
1997
|
const {
|
|
1998
1998
|
txHash,
|
|
1999
1999
|
isGettingAddress,
|
|
@@ -2078,7 +2078,7 @@ function DepositForm({
|
|
|
2078
2078
|
const handleSubmit = async () => {
|
|
2079
2079
|
if (!amount || !selectedToken || exceedsBalance) return;
|
|
2080
2080
|
setCancelled(false);
|
|
2081
|
-
const amountInWei =
|
|
2081
|
+
const amountInWei = chunkNMRIKUDN_cjs.parseTokenAmount(amount, selectedToken.decimals);
|
|
2082
2082
|
await deposit({
|
|
2083
2083
|
tokenId: selectedToken.id,
|
|
2084
2084
|
amount: amountInWei
|
|
@@ -2181,7 +2181,7 @@ function DepositForm({
|
|
|
2181
2181
|
setAmount(value);
|
|
2182
2182
|
}
|
|
2183
2183
|
},
|
|
2184
|
-
className:
|
|
2184
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
2185
2185
|
"text-foreground flex-1 bg-transparent text-sm outline-none",
|
|
2186
2186
|
"placeholder:text-muted-foreground/50"
|
|
2187
2187
|
)
|
|
@@ -2208,7 +2208,7 @@ function DepositForm({
|
|
|
2208
2208
|
{
|
|
2209
2209
|
onClick: handleSubmit,
|
|
2210
2210
|
disabled: !isConnected || !hasValidAmount || tooManyDecimals || !!exceedsBalance || isPending,
|
|
2211
|
-
className:
|
|
2211
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
2212
2212
|
"flex h-10 w-full cursor-pointer items-center justify-center rounded-[10px] px-3 py-2 text-sm font-medium transition-colors",
|
|
2213
2213
|
"bg-primary text-primary-foreground hover:bg-primary/90",
|
|
2214
2214
|
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
@@ -2225,7 +2225,7 @@ function WithdrawForm({
|
|
|
2225
2225
|
onUnsafeToCloseChange
|
|
2226
2226
|
}) {
|
|
2227
2227
|
const { isConnected, address } = wagmi.useAccount();
|
|
2228
|
-
const { chains, getChainById: getChainById2 } =
|
|
2228
|
+
const { chains, getChainById: getChainById2 } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
2229
2229
|
const [amount, setAmount] = react.useState("");
|
|
2230
2230
|
const [showSuccess, setShowSuccess] = react.useState(false);
|
|
2231
2231
|
const [showTimeout, setShowTimeout] = react.useState(false);
|
|
@@ -2238,7 +2238,7 @@ function WithdrawForm({
|
|
|
2238
2238
|
} = useBalance({
|
|
2239
2239
|
tokenId: selectedToken.id
|
|
2240
2240
|
});
|
|
2241
|
-
const formattedBalance =
|
|
2241
|
+
const formattedBalance = chunkNMRIKUDN_cjs.formatTokenAmount(balanceWei, selectedToken.decimals);
|
|
2242
2242
|
const { withdraw, isPending, currentStep, error, reset } = useWithdraw({
|
|
2243
2243
|
onProcessingSuccess: () => {
|
|
2244
2244
|
setAmount("");
|
|
@@ -2249,7 +2249,7 @@ function WithdrawForm({
|
|
|
2249
2249
|
setShowTimeout(true);
|
|
2250
2250
|
}
|
|
2251
2251
|
});
|
|
2252
|
-
const explorerUrl = address && targetChain ?
|
|
2252
|
+
const explorerUrl = address && targetChain ? chunkNMRIKUDN_cjs.getExplorerAddressUrl(targetChain.id, address) : void 0;
|
|
2253
2253
|
const getStepStatus = (step, after) => {
|
|
2254
2254
|
if (currentStep === step) return "active";
|
|
2255
2255
|
if (after.includes(currentStep)) return "completed";
|
|
@@ -2293,7 +2293,7 @@ function WithdrawForm({
|
|
|
2293
2293
|
const handleWithdraw = async () => {
|
|
2294
2294
|
if (!amount || !selectedToken || exceedsBalance) return;
|
|
2295
2295
|
setCancelled(false);
|
|
2296
|
-
const amountInWei =
|
|
2296
|
+
const amountInWei = chunkNMRIKUDN_cjs.parseTokenAmount(amount, selectedToken.decimals);
|
|
2297
2297
|
await withdraw({
|
|
2298
2298
|
tokenId: selectedToken.id,
|
|
2299
2299
|
amount: amountInWei
|
|
@@ -2306,7 +2306,7 @@ function WithdrawForm({
|
|
|
2306
2306
|
};
|
|
2307
2307
|
const hasValidAmount = amount && parseFloat(amount) > 0;
|
|
2308
2308
|
const tooManyDecimals = hasValidAmount && amount.includes(".") && amount.split(".")[1].length > selectedToken.decimals;
|
|
2309
|
-
const exceedsBalance = hasValidAmount && !tooManyDecimals && !isBalanceLoading && !isBalanceError &&
|
|
2309
|
+
const exceedsBalance = hasValidAmount && !tooManyDecimals && !isBalanceLoading && !isBalanceError && chunkNMRIKUDN_cjs.parseTokenAmount(amount, selectedToken.decimals) > BigInt(balanceWei);
|
|
2310
2310
|
const getButtonText = () => {
|
|
2311
2311
|
if (!isConnected) return "Connect Wallet";
|
|
2312
2312
|
return "Withdraw";
|
|
@@ -2389,7 +2389,7 @@ function WithdrawForm({
|
|
|
2389
2389
|
setAmount(value);
|
|
2390
2390
|
}
|
|
2391
2391
|
},
|
|
2392
|
-
className:
|
|
2392
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
2393
2393
|
"text-foreground flex-1 bg-transparent text-sm outline-none",
|
|
2394
2394
|
"placeholder:text-muted-foreground/50"
|
|
2395
2395
|
)
|
|
@@ -2416,7 +2416,7 @@ function WithdrawForm({
|
|
|
2416
2416
|
{
|
|
2417
2417
|
onClick: handleWithdraw,
|
|
2418
2418
|
disabled: !isConnected || !hasValidAmount || tooManyDecimals || !!exceedsBalance || isPending,
|
|
2419
|
-
className:
|
|
2419
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
2420
2420
|
"flex h-10 w-full cursor-pointer items-center justify-center rounded-[10px] px-3 py-2 text-sm font-medium transition-colors",
|
|
2421
2421
|
"bg-primary text-primary-foreground hover:bg-primary/90",
|
|
2422
2422
|
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
@@ -2471,7 +2471,7 @@ function ChevronDown({ collapsed }) {
|
|
|
2471
2471
|
width: "12",
|
|
2472
2472
|
height: "6",
|
|
2473
2473
|
viewBox: "0 0 12 6",
|
|
2474
|
-
className:
|
|
2474
|
+
className: chunkNMRIKUDN_cjs.cn("transition-transform", collapsed && "-rotate-90"),
|
|
2475
2475
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2476
2476
|
"path",
|
|
2477
2477
|
{
|
|
@@ -2497,15 +2497,15 @@ function BalanceCards({
|
|
|
2497
2497
|
tokenId: selectedToken.id
|
|
2498
2498
|
});
|
|
2499
2499
|
const { totalLocked, isLoading: lockedLoading } = useLockedFunds({ enabled: showLockedFunds });
|
|
2500
|
-
const formattedBalance =
|
|
2501
|
-
const formattedLocked = showLockedFunds ?
|
|
2502
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
2500
|
+
const formattedBalance = chunkNMRIKUDN_cjs.formatTokenAmount(balanceWei, selectedToken.decimals);
|
|
2501
|
+
const formattedLocked = showLockedFunds ? chunkNMRIKUDN_cjs.formatTokenAmount(String(totalLocked), selectedToken.decimals) : "0.00";
|
|
2502
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkNMRIKUDN_cjs.cn("flex gap-2", disabled && "opacity-50"), children: [
|
|
2503
2503
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2504
2504
|
"button",
|
|
2505
2505
|
{
|
|
2506
2506
|
onClick: onBalanceClick,
|
|
2507
2507
|
disabled,
|
|
2508
|
-
className:
|
|
2508
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
2509
2509
|
"bg-muted flex flex-1 flex-col gap-2 rounded-[10px] p-5 text-left transition-colors",
|
|
2510
2510
|
disabled ? "cursor-not-allowed" : "hover:bg-muted/80 cursor-pointer"
|
|
2511
2511
|
),
|
|
@@ -2526,7 +2526,7 @@ function BalanceCards({
|
|
|
2526
2526
|
{
|
|
2527
2527
|
onClick: onLockedFundsClick,
|
|
2528
2528
|
disabled,
|
|
2529
|
-
className:
|
|
2529
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
2530
2530
|
"bg-muted flex flex-1 flex-col gap-2 rounded-[10px] p-5 text-left transition-colors",
|
|
2531
2531
|
disabled ? "cursor-not-allowed" : "hover:bg-muted/80 cursor-pointer"
|
|
2532
2532
|
),
|
|
@@ -2552,7 +2552,7 @@ function Tabs({
|
|
|
2552
2552
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2553
2553
|
"div",
|
|
2554
2554
|
{
|
|
2555
|
-
className:
|
|
2555
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
2556
2556
|
"bg-muted relative flex gap-2 overflow-hidden rounded-[10px] p-1",
|
|
2557
2557
|
disabled && "opacity-50"
|
|
2558
2558
|
),
|
|
@@ -2560,7 +2560,7 @@ function Tabs({
|
|
|
2560
2560
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2561
2561
|
"div",
|
|
2562
2562
|
{
|
|
2563
|
-
className:
|
|
2563
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
2564
2564
|
"bg-input absolute top-1 bottom-1 left-1 w-[calc(50%-8px)] rounded-md transition-transform duration-200",
|
|
2565
2565
|
activeTab === "withdraw" && "translate-x-[calc(100%+8px)]"
|
|
2566
2566
|
)
|
|
@@ -2571,7 +2571,7 @@ function Tabs({
|
|
|
2571
2571
|
{
|
|
2572
2572
|
onClick: () => !disabled && onTabChange("deposit"),
|
|
2573
2573
|
disabled,
|
|
2574
|
-
className:
|
|
2574
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
2575
2575
|
"relative z-10 flex-1 rounded-md px-3 py-[9px] text-sm transition-colors",
|
|
2576
2576
|
activeTab === "deposit" ? "text-foreground" : "text-muted-foreground",
|
|
2577
2577
|
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
@@ -2584,7 +2584,7 @@ function Tabs({
|
|
|
2584
2584
|
{
|
|
2585
2585
|
onClick: () => !disabled && onTabChange("withdraw"),
|
|
2586
2586
|
disabled,
|
|
2587
|
-
className:
|
|
2587
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
2588
2588
|
"relative z-10 flex-1 rounded-md px-3 py-[9px] text-sm transition-colors",
|
|
2589
2589
|
activeTab === "withdraw" ? "text-foreground" : "text-muted-foreground",
|
|
2590
2590
|
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
@@ -2597,14 +2597,14 @@ function Tabs({
|
|
|
2597
2597
|
);
|
|
2598
2598
|
}
|
|
2599
2599
|
function LockedFundsView({ onBack }) {
|
|
2600
|
-
const { getTokenById } =
|
|
2600
|
+
const { getTokenById } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
2601
2601
|
const { locks, isLoading } = useLockedFunds();
|
|
2602
2602
|
const { unlockFunds, unlockAllExpired, isPending } = useUnlockFunds();
|
|
2603
2603
|
const [collapsedSections, setCollapsedSections] = react.useState({});
|
|
2604
2604
|
const sections = react.useMemo(() => {
|
|
2605
2605
|
const sectionMap = {};
|
|
2606
2606
|
locks.forEach((lock) => {
|
|
2607
|
-
const serviceName =
|
|
2607
|
+
const serviceName = chunkNMRIKUDN_cjs.shortenAddress(lock.service_address);
|
|
2608
2608
|
if (!sectionMap[lock.service_address]) {
|
|
2609
2609
|
sectionMap[lock.service_address] = {
|
|
2610
2610
|
title: `Service ${serviceName}`,
|
|
@@ -2613,9 +2613,9 @@ function LockedFundsView({ onBack }) {
|
|
|
2613
2613
|
}
|
|
2614
2614
|
sectionMap[lock.service_address].items.push({
|
|
2615
2615
|
lockId: lock.lock_id,
|
|
2616
|
-
amount:
|
|
2616
|
+
amount: chunkNMRIKUDN_cjs.formatTokenAmount(String(lock.amount), getTokenById(lock.token_id)?.decimals ?? 18),
|
|
2617
2617
|
serviceAddress: lock.service_address,
|
|
2618
|
-
time: lock.is_expired ? "Click to unlock" :
|
|
2618
|
+
time: lock.is_expired ? "Click to unlock" : chunkNMRIKUDN_cjs.formatTimeRemaining(lock.expiry),
|
|
2619
2619
|
isExpired: lock.is_expired
|
|
2620
2620
|
});
|
|
2621
2621
|
});
|
|
@@ -2662,7 +2662,7 @@ function LockedFundsView({ onBack }) {
|
|
|
2662
2662
|
!collapsedSections[section.title] && section.items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2663
2663
|
"div",
|
|
2664
2664
|
{
|
|
2665
|
-
className:
|
|
2665
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
2666
2666
|
"flex items-center justify-between gap-3 rounded-lg p-3",
|
|
2667
2667
|
item.isExpired && "bg-secondary"
|
|
2668
2668
|
),
|
|
@@ -2676,7 +2676,7 @@ function LockedFundsView({ onBack }) {
|
|
|
2676
2676
|
] }),
|
|
2677
2677
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground text-xs", children: [
|
|
2678
2678
|
"Service: ",
|
|
2679
|
-
|
|
2679
|
+
chunkNMRIKUDN_cjs.shortenAddress(item.serviceAddress)
|
|
2680
2680
|
] })
|
|
2681
2681
|
] })
|
|
2682
2682
|
] }),
|
|
@@ -2717,7 +2717,7 @@ function BalanceTokenRow({ token }) {
|
|
|
2717
2717
|
const { balanceWei, isLoading } = useBalance({
|
|
2718
2718
|
tokenId: token.id
|
|
2719
2719
|
});
|
|
2720
|
-
const formattedBalance =
|
|
2720
|
+
const formattedBalance = chunkNMRIKUDN_cjs.formatTokenAmount(balanceWei, token.decimals);
|
|
2721
2721
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center gap-2 rounded-lg px-3 py-2.5", children: [
|
|
2722
2722
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[18px] w-[18px] overflow-hidden rounded-full", children: getTokenIcon(token.symbol, 18) }),
|
|
2723
2723
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground flex-1 text-sm", children: token.symbol }),
|
|
@@ -2725,7 +2725,7 @@ function BalanceTokenRow({ token }) {
|
|
|
2725
2725
|
] });
|
|
2726
2726
|
}
|
|
2727
2727
|
function BalanceDetailsView({ onBack }) {
|
|
2728
|
-
const { enabledTokens, chains } =
|
|
2728
|
+
const { enabledTokens, chains } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
2729
2729
|
const [selectedChainId, setSelectedChainId] = react.useState(chains[0]?.id ?? 84532);
|
|
2730
2730
|
const chainTokens = react.useMemo(() => {
|
|
2731
2731
|
return enabledTokens.filter((t) => t.chainId === selectedChainId);
|
|
@@ -2751,7 +2751,7 @@ function BalanceDetailsView({ onBack }) {
|
|
|
2751
2751
|
"button",
|
|
2752
2752
|
{
|
|
2753
2753
|
onClick: () => setSelectedChainId(chain.id),
|
|
2754
|
-
className:
|
|
2754
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
2755
2755
|
"hover:bg-secondary flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors",
|
|
2756
2756
|
isSelected && "bg-secondary"
|
|
2757
2757
|
),
|
|
@@ -2792,12 +2792,12 @@ function TokenRow({
|
|
|
2792
2792
|
query: { enabled: !!address && !isNative }
|
|
2793
2793
|
});
|
|
2794
2794
|
const walletBalance = isNative ? nativeBalanceData?.value : erc20Balance;
|
|
2795
|
-
const formattedBalance = walletBalance ?
|
|
2795
|
+
const formattedBalance = walletBalance ? chunkNMRIKUDN_cjs.formatTokenAmount(walletBalance.toString(), token.decimals) : "0.00";
|
|
2796
2796
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2797
2797
|
"button",
|
|
2798
2798
|
{
|
|
2799
2799
|
onClick,
|
|
2800
|
-
className:
|
|
2800
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
2801
2801
|
"hover:bg-secondary flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors",
|
|
2802
2802
|
isSelected && "bg-secondary"
|
|
2803
2803
|
),
|
|
@@ -2814,7 +2814,7 @@ function TokenSelectorView({
|
|
|
2814
2814
|
onSelect,
|
|
2815
2815
|
selectedTokenId
|
|
2816
2816
|
}) {
|
|
2817
|
-
const { enabledTokens, chains } =
|
|
2817
|
+
const { enabledTokens, chains } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
2818
2818
|
const [selectedChainId, setSelectedChainId] = react.useState(chains[0]?.id ?? 84532);
|
|
2819
2819
|
const chainTokens = react.useMemo(() => {
|
|
2820
2820
|
return enabledTokens.filter((t) => t.chainId === selectedChainId);
|
|
@@ -2844,7 +2844,7 @@ function TokenSelectorView({
|
|
|
2844
2844
|
"button",
|
|
2845
2845
|
{
|
|
2846
2846
|
onClick: () => setSelectedChainId(chain.id),
|
|
2847
|
-
className:
|
|
2847
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
2848
2848
|
"hover:bg-secondary flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors",
|
|
2849
2849
|
isSelected && "bg-secondary"
|
|
2850
2850
|
),
|
|
@@ -2879,7 +2879,7 @@ function ModalBody({
|
|
|
2879
2879
|
defaultTab = "deposit",
|
|
2880
2880
|
onDepositSuccess
|
|
2881
2881
|
}) {
|
|
2882
|
-
const { defaultToken, tokensStatus } =
|
|
2882
|
+
const { defaultToken, tokensStatus } = chunkNMRIKUDN_cjs.usePrivanaContext();
|
|
2883
2883
|
const [selectedToken, setSelectedToken] = react.useState(defaultToken);
|
|
2884
2884
|
const [activeTab, setActiveTab] = react.useState(defaultTab);
|
|
2885
2885
|
const [currentView, setCurrentView] = react.useState("main");
|
|
@@ -2937,7 +2937,7 @@ function ModalBody({
|
|
|
2937
2937
|
);
|
|
2938
2938
|
}
|
|
2939
2939
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 pb-4", children: [
|
|
2940
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
2940
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkNMRIKUDN_cjs.cn(isInteractionPending && "pointer-events-none"), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2941
2941
|
BalanceCards,
|
|
2942
2942
|
{
|
|
2943
2943
|
selectedToken,
|
|
@@ -2947,7 +2947,7 @@ function ModalBody({
|
|
|
2947
2947
|
disabled: isInteractionPending
|
|
2948
2948
|
}
|
|
2949
2949
|
) }),
|
|
2950
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
2950
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkNMRIKUDN_cjs.cn(isInteractionPending && "pointer-events-none"), children: /* @__PURE__ */ jsxRuntime.jsx(Tabs, { activeTab, onTabChange: setActiveTab, disabled: isInteractionPending }) }),
|
|
2951
2951
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted rounded-[10px] p-5", children: activeTab === "deposit" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2952
2952
|
DepositForm,
|
|
2953
2953
|
{
|
|
@@ -3008,7 +3008,7 @@ function PrivanaModal({
|
|
|
3008
3008
|
onClick: handleClose,
|
|
3009
3009
|
disabled: isCloseBlocked,
|
|
3010
3010
|
"aria-label": "Close",
|
|
3011
|
-
className:
|
|
3011
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
3012
3012
|
"absolute top-6 right-5 z-20 flex h-6 w-6 items-center justify-center transition-colors",
|
|
3013
3013
|
isCloseBlocked ? "text-muted-foreground/40 cursor-not-allowed" : "text-muted-foreground hover:text-foreground cursor-pointer"
|
|
3014
3014
|
),
|
|
@@ -3064,7 +3064,7 @@ function PrivanaInlineModal({
|
|
|
3064
3064
|
"div",
|
|
3065
3065
|
{
|
|
3066
3066
|
"data-privana": true,
|
|
3067
|
-
className:
|
|
3067
|
+
className: chunkNMRIKUDN_cjs.cn(
|
|
3068
3068
|
"bg-card flex w-[560px] max-w-full flex-col gap-2 overflow-hidden rounded-2xl p-2 shadow-lg",
|
|
3069
3069
|
className
|
|
3070
3070
|
),
|
|
@@ -3099,12 +3099,12 @@ function PrivanaButton({
|
|
|
3099
3099
|
}
|
|
3100
3100
|
const handleClick = () => setModalOpen(true);
|
|
3101
3101
|
const buttonElement = renderButton ? renderButton({ onClick: handleClick, isOpen: modalOpen }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3102
|
-
|
|
3102
|
+
chunkNMRIKUDN_cjs.Button,
|
|
3103
3103
|
{
|
|
3104
3104
|
variant,
|
|
3105
3105
|
size,
|
|
3106
3106
|
asChild,
|
|
3107
|
-
className:
|
|
3107
|
+
className: chunkNMRIKUDN_cjs.cn(className),
|
|
3108
3108
|
onClick: handleClick,
|
|
3109
3109
|
disabled: !isConnected,
|
|
3110
3110
|
...buttonProps,
|
|
@@ -3128,179 +3128,183 @@ function PrivanaButton({
|
|
|
3128
3128
|
|
|
3129
3129
|
Object.defineProperty(exports, "AccountingApiError", {
|
|
3130
3130
|
enumerable: true,
|
|
3131
|
-
get: function () { return
|
|
3131
|
+
get: function () { return chunkNMRIKUDN_cjs.AccountingApiError; }
|
|
3132
3132
|
});
|
|
3133
3133
|
Object.defineProperty(exports, "Button", {
|
|
3134
3134
|
enumerable: true,
|
|
3135
|
-
get: function () { return
|
|
3135
|
+
get: function () { return chunkNMRIKUDN_cjs.Button; }
|
|
3136
3136
|
});
|
|
3137
3137
|
Object.defineProperty(exports, "HOSTED_AUTH_CLOCK_SKEW_MS", {
|
|
3138
3138
|
enumerable: true,
|
|
3139
|
-
get: function () { return
|
|
3139
|
+
get: function () { return chunkNMRIKUDN_cjs.HOSTED_AUTH_CLOCK_SKEW_MS; }
|
|
3140
3140
|
});
|
|
3141
3141
|
Object.defineProperty(exports, "HostedAuthError", {
|
|
3142
3142
|
enumerable: true,
|
|
3143
|
-
get: function () { return
|
|
3143
|
+
get: function () { return chunkNMRIKUDN_cjs.HostedAuthError; }
|
|
3144
3144
|
});
|
|
3145
3145
|
Object.defineProperty(exports, "HostedAuthRequiredError", {
|
|
3146
3146
|
enumerable: true,
|
|
3147
|
-
get: function () { return
|
|
3147
|
+
get: function () { return chunkNMRIKUDN_cjs.HostedAuthRequiredError; }
|
|
3148
3148
|
});
|
|
3149
3149
|
Object.defineProperty(exports, "HostedAuthStateMismatchError", {
|
|
3150
3150
|
enumerable: true,
|
|
3151
|
-
get: function () { return
|
|
3151
|
+
get: function () { return chunkNMRIKUDN_cjs.HostedAuthStateMismatchError; }
|
|
3152
3152
|
});
|
|
3153
3153
|
Object.defineProperty(exports, "HttpClient", {
|
|
3154
3154
|
enumerable: true,
|
|
3155
|
-
get: function () { return
|
|
3155
|
+
get: function () { return chunkNMRIKUDN_cjs.HttpClient; }
|
|
3156
3156
|
});
|
|
3157
3157
|
Object.defineProperty(exports, "NETWORK_CONFIG", {
|
|
3158
3158
|
enumerable: true,
|
|
3159
|
-
get: function () { return
|
|
3159
|
+
get: function () { return chunkNMRIKUDN_cjs.NETWORK_CONFIG; }
|
|
3160
3160
|
});
|
|
3161
3161
|
Object.defineProperty(exports, "NetworkError", {
|
|
3162
3162
|
enumerable: true,
|
|
3163
|
-
get: function () { return
|
|
3163
|
+
get: function () { return chunkNMRIKUDN_cjs.NetworkError; }
|
|
3164
3164
|
});
|
|
3165
3165
|
Object.defineProperty(exports, "PrivanaClient", {
|
|
3166
3166
|
enumerable: true,
|
|
3167
|
-
get: function () { return
|
|
3167
|
+
get: function () { return chunkNMRIKUDN_cjs.PrivanaClient; }
|
|
3168
3168
|
});
|
|
3169
3169
|
Object.defineProperty(exports, "PrivanaProvider", {
|
|
3170
3170
|
enumerable: true,
|
|
3171
|
-
get: function () { return
|
|
3171
|
+
get: function () { return chunkNMRIKUDN_cjs.PrivanaProvider; }
|
|
3172
3172
|
});
|
|
3173
3173
|
Object.defineProperty(exports, "SUPPORTED_CHAINS", {
|
|
3174
3174
|
enumerable: true,
|
|
3175
|
-
get: function () { return
|
|
3175
|
+
get: function () { return chunkNMRIKUDN_cjs.SUPPORTED_CHAINS; }
|
|
3176
3176
|
});
|
|
3177
3177
|
Object.defineProperty(exports, "SiweAuthProvider", {
|
|
3178
3178
|
enumerable: true,
|
|
3179
|
-
get: function () { return
|
|
3179
|
+
get: function () { return chunkNMRIKUDN_cjs.SiweAuthProvider; }
|
|
3180
3180
|
});
|
|
3181
3181
|
Object.defineProperty(exports, "Skeleton", {
|
|
3182
3182
|
enumerable: true,
|
|
3183
|
-
get: function () { return
|
|
3183
|
+
get: function () { return chunkNMRIKUDN_cjs.Skeleton; }
|
|
3184
3184
|
});
|
|
3185
3185
|
Object.defineProperty(exports, "ValidationError", {
|
|
3186
3186
|
enumerable: true,
|
|
3187
|
-
get: function () { return
|
|
3187
|
+
get: function () { return chunkNMRIKUDN_cjs.ValidationError; }
|
|
3188
3188
|
});
|
|
3189
3189
|
Object.defineProperty(exports, "applyRefreshResponse", {
|
|
3190
3190
|
enumerable: true,
|
|
3191
|
-
get: function () { return
|
|
3191
|
+
get: function () { return chunkNMRIKUDN_cjs.applyRefreshResponse; }
|
|
3192
3192
|
});
|
|
3193
3193
|
Object.defineProperty(exports, "buildHostedAuthSession", {
|
|
3194
3194
|
enumerable: true,
|
|
3195
|
-
get: function () { return
|
|
3195
|
+
get: function () { return chunkNMRIKUDN_cjs.buildHostedAuthSession; }
|
|
3196
|
+
});
|
|
3197
|
+
Object.defineProperty(exports, "buildSiweStatement", {
|
|
3198
|
+
enumerable: true,
|
|
3199
|
+
get: function () { return chunkNMRIKUDN_cjs.buildSiweStatement; }
|
|
3196
3200
|
});
|
|
3197
3201
|
Object.defineProperty(exports, "buttonVariants", {
|
|
3198
3202
|
enumerable: true,
|
|
3199
|
-
get: function () { return
|
|
3203
|
+
get: function () { return chunkNMRIKUDN_cjs.buttonVariants; }
|
|
3200
3204
|
});
|
|
3201
3205
|
Object.defineProperty(exports, "clearHostedAuthPendingTransaction", {
|
|
3202
3206
|
enumerable: true,
|
|
3203
|
-
get: function () { return
|
|
3207
|
+
get: function () { return chunkNMRIKUDN_cjs.clearHostedAuthPendingTransaction; }
|
|
3204
3208
|
});
|
|
3205
3209
|
Object.defineProperty(exports, "createHostedAuthPendingStorageKey", {
|
|
3206
3210
|
enumerable: true,
|
|
3207
|
-
get: function () { return
|
|
3211
|
+
get: function () { return chunkNMRIKUDN_cjs.createHostedAuthPendingStorageKey; }
|
|
3208
3212
|
});
|
|
3209
3213
|
Object.defineProperty(exports, "createHostedAuthState", {
|
|
3210
3214
|
enumerable: true,
|
|
3211
|
-
get: function () { return
|
|
3215
|
+
get: function () { return chunkNMRIKUDN_cjs.createHostedAuthState; }
|
|
3212
3216
|
});
|
|
3213
3217
|
Object.defineProperty(exports, "createHostedAuthStorageKey", {
|
|
3214
3218
|
enumerable: true,
|
|
3215
|
-
get: function () { return
|
|
3219
|
+
get: function () { return chunkNMRIKUDN_cjs.createHostedAuthStorageKey; }
|
|
3216
3220
|
});
|
|
3217
3221
|
Object.defineProperty(exports, "createPkceChallenge", {
|
|
3218
3222
|
enumerable: true,
|
|
3219
|
-
get: function () { return
|
|
3223
|
+
get: function () { return chunkNMRIKUDN_cjs.createPkceChallenge; }
|
|
3220
3224
|
});
|
|
3221
3225
|
Object.defineProperty(exports, "createPkceVerifier", {
|
|
3222
3226
|
enumerable: true,
|
|
3223
|
-
get: function () { return
|
|
3227
|
+
get: function () { return chunkNMRIKUDN_cjs.createPkceVerifier; }
|
|
3224
3228
|
});
|
|
3225
3229
|
Object.defineProperty(exports, "getAccountingContract", {
|
|
3226
3230
|
enumerable: true,
|
|
3227
|
-
get: function () { return
|
|
3231
|
+
get: function () { return chunkNMRIKUDN_cjs.getAccountingContract; }
|
|
3228
3232
|
});
|
|
3229
3233
|
Object.defineProperty(exports, "getApiUrl", {
|
|
3230
3234
|
enumerable: true,
|
|
3231
|
-
get: function () { return
|
|
3235
|
+
get: function () { return chunkNMRIKUDN_cjs.getApiUrl; }
|
|
3232
3236
|
});
|
|
3233
3237
|
Object.defineProperty(exports, "getChainById", {
|
|
3234
3238
|
enumerable: true,
|
|
3235
|
-
get: function () { return
|
|
3239
|
+
get: function () { return chunkNMRIKUDN_cjs.getChainById; }
|
|
3236
3240
|
});
|
|
3237
3241
|
Object.defineProperty(exports, "getChainId", {
|
|
3238
3242
|
enumerable: true,
|
|
3239
|
-
get: function () { return
|
|
3243
|
+
get: function () { return chunkNMRIKUDN_cjs.getChainId; }
|
|
3240
3244
|
});
|
|
3241
3245
|
Object.defineProperty(exports, "getExplorerAddressUrl", {
|
|
3242
3246
|
enumerable: true,
|
|
3243
|
-
get: function () { return
|
|
3247
|
+
get: function () { return chunkNMRIKUDN_cjs.getExplorerAddressUrl; }
|
|
3244
3248
|
});
|
|
3245
3249
|
Object.defineProperty(exports, "isHostedAuthRefreshActive", {
|
|
3246
3250
|
enumerable: true,
|
|
3247
|
-
get: function () { return
|
|
3251
|
+
get: function () { return chunkNMRIKUDN_cjs.isHostedAuthRefreshActive; }
|
|
3248
3252
|
});
|
|
3249
3253
|
Object.defineProperty(exports, "isHostedAuthSessionActive", {
|
|
3250
3254
|
enumerable: true,
|
|
3251
|
-
get: function () { return
|
|
3255
|
+
get: function () { return chunkNMRIKUDN_cjs.isHostedAuthSessionActive; }
|
|
3252
3256
|
});
|
|
3253
3257
|
Object.defineProperty(exports, "normalizeAddress", {
|
|
3254
3258
|
enumerable: true,
|
|
3255
|
-
get: function () { return
|
|
3259
|
+
get: function () { return chunkNMRIKUDN_cjs.normalizeAddress; }
|
|
3256
3260
|
});
|
|
3257
3261
|
Object.defineProperty(exports, "normalizeHex", {
|
|
3258
3262
|
enumerable: true,
|
|
3259
|
-
get: function () { return
|
|
3263
|
+
get: function () { return chunkNMRIKUDN_cjs.normalizeHex; }
|
|
3260
3264
|
});
|
|
3261
3265
|
Object.defineProperty(exports, "parseHostedAuthCallback", {
|
|
3262
3266
|
enumerable: true,
|
|
3263
|
-
get: function () { return
|
|
3267
|
+
get: function () { return chunkNMRIKUDN_cjs.parseHostedAuthCallback; }
|
|
3264
3268
|
});
|
|
3265
3269
|
Object.defineProperty(exports, "persistHostedAuthPendingTransaction", {
|
|
3266
3270
|
enumerable: true,
|
|
3267
|
-
get: function () { return
|
|
3271
|
+
get: function () { return chunkNMRIKUDN_cjs.persistHostedAuthPendingTransaction; }
|
|
3268
3272
|
});
|
|
3269
3273
|
Object.defineProperty(exports, "readHostedAuthPendingTransaction", {
|
|
3270
3274
|
enumerable: true,
|
|
3271
|
-
get: function () { return
|
|
3275
|
+
get: function () { return chunkNMRIKUDN_cjs.readHostedAuthPendingTransaction; }
|
|
3272
3276
|
});
|
|
3273
3277
|
Object.defineProperty(exports, "readStoredHostedAuthSession", {
|
|
3274
3278
|
enumerable: true,
|
|
3275
|
-
get: function () { return
|
|
3279
|
+
get: function () { return chunkNMRIKUDN_cjs.readStoredHostedAuthSession; }
|
|
3276
3280
|
});
|
|
3277
3281
|
Object.defineProperty(exports, "stripHostedAuthCallbackParams", {
|
|
3278
3282
|
enumerable: true,
|
|
3279
|
-
get: function () { return
|
|
3283
|
+
get: function () { return chunkNMRIKUDN_cjs.stripHostedAuthCallbackParams; }
|
|
3280
3284
|
});
|
|
3281
3285
|
Object.defineProperty(exports, "syncHostedAuthSessionToClient", {
|
|
3282
3286
|
enumerable: true,
|
|
3283
|
-
get: function () { return
|
|
3287
|
+
get: function () { return chunkNMRIKUDN_cjs.syncHostedAuthSessionToClient; }
|
|
3284
3288
|
});
|
|
3285
3289
|
Object.defineProperty(exports, "useDepositVerification", {
|
|
3286
3290
|
enumerable: true,
|
|
3287
|
-
get: function () { return
|
|
3291
|
+
get: function () { return chunkNMRIKUDN_cjs.useDepositVerification; }
|
|
3288
3292
|
});
|
|
3289
3293
|
Object.defineProperty(exports, "usePrivanaContext", {
|
|
3290
3294
|
enumerable: true,
|
|
3291
|
-
get: function () { return
|
|
3295
|
+
get: function () { return chunkNMRIKUDN_cjs.usePrivanaContext; }
|
|
3292
3296
|
});
|
|
3293
3297
|
Object.defineProperty(exports, "useSafeAccount", {
|
|
3294
3298
|
enumerable: true,
|
|
3295
|
-
get: function () { return
|
|
3299
|
+
get: function () { return chunkNMRIKUDN_cjs.useSafeAccount; }
|
|
3296
3300
|
});
|
|
3297
3301
|
Object.defineProperty(exports, "useSafePrivanaContext", {
|
|
3298
3302
|
enumerable: true,
|
|
3299
|
-
get: function () { return
|
|
3303
|
+
get: function () { return chunkNMRIKUDN_cjs.useSafePrivanaContext; }
|
|
3300
3304
|
});
|
|
3301
3305
|
Object.defineProperty(exports, "useSiweAuth", {
|
|
3302
3306
|
enumerable: true,
|
|
3303
|
-
get: function () { return
|
|
3307
|
+
get: function () { return chunkNMRIKUDN_cjs.useSiweAuth; }
|
|
3304
3308
|
});
|
|
3305
3309
|
exports.LOCK_TYPES = LOCK_TYPES;
|
|
3306
3310
|
exports.MODIFY_LOCK_TYPES = MODIFY_LOCK_TYPES;
|