@vechain/vechain-kit 2.0.0-rc.3 → 2.0.0-rc.5

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/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { SubdomainClaimer__factory, IReverseRegistrar__factory, SimpleAccountFactory__factory, SimpleAccount__factory, NodeManagement__factory, VeBetterPassport__factory, XAllocationVoting__factory, X2EarnApps__factory, XAllocationVotingGovernor__factory, ERC20__factory, B3TR__factory, IERC20__factory, IVechainEnergyOracleV1__factory, VOT3__factory, VoterRewards__factory, XAllocationPool__factory, GalaxyMember__factory, MockENS__factory, IB3TR__factory, IVOT3__factory } from './chunk-FOSPSOWT.js';
2
- import { VECHAIN_KIT_MIXPANEL_PROJECT_TOKEN, ENV, TIME, humanAddress, TOKEN_LOGO_COMPONENTS, TOKEN_LOGOS, DEFAULT_PRIVY_ECOSYSTEM_APPS, executeCallClause, getConfig, convertUriToUrl, ENS_TEXT_RECORDS, getPicassoImage, VECHAIN_PRIVY_APP_ID, compareAddresses, resolveMediaTypeFromMimeType, humanDomain, isRejectionError, isValidAddress, humanNumber, VECHAIN_KIT_COOKIES_CONFIG, VECHAIN_KIT_STORAGE_KEYS, CURRENCY_SYMBOLS, uploadBlobToIPFS, randomTransactionUser, executeMultipleClausesCall, VECHAIN_KIT_TERMS_CONFIG, isValidUrl, notFoundImage } from './chunk-SNDIAFF7.js';
1
+ import { SubdomainClaimer__factory, IReverseRegistrar__factory, XAllocationVoting__factory, VeBetterPassport__factory, XAllocationPool__factory, X2EarnApps__factory, SimpleAccountFactory__factory, SimpleAccount__factory, ERC20__factory, IVechainEnergyOracleV1__factory, B3TR__factory, IERC20__factory, IVOT3__factory, MockENS__factory } from './chunk-FOSPSOWT.js';
2
+ import { VECHAIN_KIT_MIXPANEL_PROJECT_TOKEN, ENV, TIME, humanAddress, TOKEN_LOGO_COMPONENTS, TOKEN_LOGOS, DEFAULT_PRIVY_ECOSYSTEM_APPS, executeCallClause, getConfig, convertUriToUrl, ENS_TEXT_RECORDS, getPicassoImage, humanNumber, executeMultipleClausesCall, VECHAIN_PRIVY_APP_ID, compareAddresses, resolveMediaTypeFromMimeType, humanDomain, isRejectionError, isValidAddress, VECHAIN_KIT_COOKIES_CONFIG, VECHAIN_KIT_STORAGE_KEYS, CURRENCY_SYMBOLS, uploadBlobToIPFS, randomTransactionUser, VECHAIN_KIT_TERMS_CONFIG, isValidUrl, notFoundImage } from './chunk-SNDIAFF7.js';
3
3
  export { CURRENCY_SYMBOLS, ENS_TEXT_RECORDS, LegalDocumentSource, LegalDocumentType, NFTMediaType, VePassportUserStatus, buildCallClauses, executeCallClause, executeMultipleClausesCall, getConfig } from './chunk-SNDIAFF7.js';
4
4
  import { VechainLogo, VechainLogoLight, VechainLogoDark, VeWorldLogoLight, VeWorldLogoDark, VechainEnergy, SimpleAccountFactoryABI, SimpleAccountABI, PrivyLogo } from './chunk-Z4FE6MMP.js';
5
5
  import './chunk-PZ5AY32C.js';
@@ -11,7 +11,7 @@ import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
11
11
  import { useThor, useWallet as useWallet$1, useWalletModal, DAppKitProvider } from '@vechain/dapp-kit-react';
12
12
  export { WalletButton as DAppKitWalletButton, useWallet as useDAppKitWallet, useWalletModal as useDAppKitWalletModal, useThor } from '@vechain/dapp-kit-react';
13
13
  import React10, { createContext, useEffect, useState, useRef, useCallback, useMemo, useContext, Fragment as Fragment$1 } from 'react';
14
- import { useQuery, useQueryClient, useQueries, useInfiniteQuery, QueryClient, QueryClientContext, QueryClientProvider } from '@tanstack/react-query';
14
+ import { useQuery, useQueryClient, useQueries, QueryClientContext, QueryClientProvider, QueryClient } from '@tanstack/react-query';
15
15
  import { hashFn } from 'wagmi/query';
16
16
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
17
17
  import { motion } from 'framer-motion';
@@ -20,14 +20,15 @@ import { IoChevronBack, IoCheckmarkOutline, IoCopyOutline, IoWalletOutline, IoCl
20
20
  import { FaRegAddressCard, FaExternalLinkAlt, FaGlobe, FaEnvelope, FaArrowRight, FaTelegramPlane, FaChevronDown, FaEdit, FaGoogle, FaTwitter, FaPhone, FaSpotify, FaApple, FaInstagram, FaTiktok, FaGithub, FaLinkedin, FaTelegram, FaDiscord as FaDiscord$1, FaWallet, FaPlus } from 'react-icons/fa';
21
21
  import { HiOutlineWallet, HiOutlineShieldCheck } from 'react-icons/hi2';
22
22
  import VeChainKitMixpanel from 'mixpanel-browser';
23
- import { Interface, isAddress, ethers, namehash, toUtf8String, zeroPadValue, toBeHex, formatEther as formatEther$1, parseEther as parseEther$1 } from 'ethers';
23
+ import { Interface, isAddress, ethers, namehash, toUtf8String, zeroPadValue, toBeHex, formatEther, parseEther as parseEther$1 } from 'ethers';
24
24
  import { ZERO_ADDRESS, Address, Clause, ABIContract } from '@vechain/sdk-core';
25
- import { defineChain, namehash as namehash$1, formatEther, parseEther, keccak256, toBytes, concat, encodeFunctionData } from 'viem';
25
+ import { defineChain, namehash as namehash$1, formatEther as formatEther$1, parseEther, decodeEventLog as decodeEventLog$1, keccak256, toBytes, concat, encodeFunctionData } from 'viem';
26
26
  import { z } from 'zod';
27
+ import { BigNumber } from 'bignumber.js';
27
28
  import { useAccount, useConnect, useSignTypedData, useSignMessage, useDisconnect, createConfig, http, WagmiProvider } from 'wagmi';
28
29
  import { toPrivyWalletConnector } from '@privy-io/cross-app-connect/rainbow-kit';
29
30
  import { isMobile } from 'react-device-detect';
30
- import BigNumber$1, { BigNumber } from 'bignumber.js';
31
+ import axios from 'axios';
31
32
  import imageCompression from 'browser-image-compression';
32
33
  import { LuMail, LuArrowDownToLine } from 'react-icons/lu';
33
34
  import { MdOutlineNavigateNext, MdSwapHoriz, MdOutlineSettingsBackupRestore, MdPhotoCamera, MdCurrencyExchange, MdPrivacyTip, MdOutlineRefresh, MdOutlineErrorOutline, MdEmail, MdGavel, MdCheck } from 'react-icons/md';
@@ -4354,15 +4355,15 @@ var Analytics = {
4354
4355
  loginMethod
4355
4356
  });
4356
4357
  },
4357
- tryAgain: (method13, platform) => {
4358
+ tryAgain: (method7, platform) => {
4358
4359
  Analytics.auth.trackAuth("try_again", {
4359
- loginMethod: method13,
4360
+ loginMethod: method7,
4360
4361
  platform
4361
4362
  });
4362
4363
  },
4363
- methodSelected: (method13) => {
4364
+ methodSelected: (method7) => {
4364
4365
  Analytics.auth.trackAuth("method_selected", {
4365
- loginMethod: method13
4366
+ loginMethod: method7
4366
4367
  });
4367
4368
  },
4368
4369
  completed: ({
@@ -4817,7 +4818,7 @@ var AddressDisplay = ({
4817
4818
 
4818
4819
  // package.json
4819
4820
  var package_default = {
4820
- version: "2.0.0-rc.3"};
4821
+ version: "2.0.0-rc.5"};
4821
4822
  var VersionFooter = ({ ...props }) => {
4822
4823
  const { darkMode: isDark } = useVeChainKitConfig();
4823
4824
  return /* @__PURE__ */ jsxs(
@@ -6120,13 +6121,13 @@ var useUnsetDomain = ({
6120
6121
  }
6121
6122
  };
6122
6123
  };
6123
- var useTokenBalances = ({ address = "" }) => {
6124
+ var useTokenBalances = (address) => {
6124
6125
  const { network } = useVeChainKitConfig();
6125
6126
  const config = getConfig(network.type);
6126
6127
  const { data: vetData, isLoading: vetLoading } = useAccountBalance(address);
6127
6128
  const { data: b3trBalance, isLoading: b3trLoading } = useGetB3trBalance(address);
6128
6129
  const { data: vot3Balance, isLoading: vot3Loading } = useGetVot3Balance(address);
6129
- const { data: veDelegateBalance, isLoading: veDelegateLoading } = useGetVeDelegateBalance(address);
6130
+ const { data: veDelegateBalance, isLoading: veDelegateLoading } = useGetErc20Balance(config.veDelegateTokenContractAddress, address);
6130
6131
  const { data: gloDollarBalance, isLoading: gloDollarLoading } = useGetErc20Balance(config.gloDollarContractAddress, address);
6131
6132
  const customTokenBalancesQueries = useGetCustomTokenBalances(address);
6132
6133
  const customTokenBalances = customTokenBalancesQueries.map((query) => query.data).filter(Boolean);
@@ -6199,6 +6200,36 @@ var useTokenBalances = ({ address = "" }) => {
6199
6200
  isLoading
6200
6201
  };
6201
6202
  };
6203
+ var PRICE_FEED_IDS = {
6204
+ B3TR: "0x623374722d757364000000000000000000000000000000000000000000000000",
6205
+ VET: "0x7665742d75736400000000000000000000000000000000000000000000000000",
6206
+ VTHO: "0x7674686f2d757364000000000000000000000000000000000000000000000000",
6207
+ GBP: "0x6762702d75736400000000000000000000000000000000000000000000000000",
6208
+ EUR: "0x657572742d757364000000000000000000000000000000000000000000000000"
6209
+ };
6210
+ var getTokenUsdPrice = async (thor, token, network) => {
6211
+ const res = await thor.contracts.load(
6212
+ getConfig(network).oracleContractAddress,
6213
+ IVechainEnergyOracleV1__factory.abi
6214
+ ).read.getLatestValue(PRICE_FEED_IDS[token]);
6215
+ if (!res) throw new Error(`Failed to get price of ${token}`);
6216
+ return new BigNumber(res[0].toString()).div(1e12).toNumber();
6217
+ };
6218
+ var getTokenUsdPriceQueryKey = (token) => [
6219
+ "VECHAIN_KIT_PRICE",
6220
+ token
6221
+ ];
6222
+ var useGetTokenUsdPrice = (token) => {
6223
+ const thor = useThor();
6224
+ const { network } = useVeChainKitConfig();
6225
+ return useQuery({
6226
+ queryKey: getTokenUsdPriceQueryKey(token),
6227
+ queryFn: async () => getTokenUsdPrice(thor, token, network.type),
6228
+ enabled: !!thor && !!network.type
6229
+ });
6230
+ };
6231
+
6232
+ // src/hooks/api/wallet/useTokenPrices.ts
6202
6233
  var useTokenPrices = () => {
6203
6234
  const { network } = useVeChainKitConfig();
6204
6235
  const config = getConfig(network.type);
@@ -6288,9 +6319,7 @@ var useCurrency = () => {
6288
6319
  var useTokensWithValues = ({
6289
6320
  address = ""
6290
6321
  }) => {
6291
- const { balances, isLoading: balancesLoading } = useTokenBalances({
6292
- address
6293
- });
6322
+ const { balances, isLoading: balancesLoading } = useTokenBalances(address);
6294
6323
  const {
6295
6324
  prices,
6296
6325
  exchangeRates,
@@ -6359,6 +6388,60 @@ var useTotalBalance = ({ address = "" }) => {
6359
6388
  hasAnyBalance: tokensWithBalance.length > 0
6360
6389
  };
6361
6390
  };
6391
+
6392
+ // src/hooks/api/wallet/useCurrentAllocationsRoundId.ts
6393
+ var abi = XAllocationVoting__factory.abi;
6394
+ var method = "currentRoundId";
6395
+ var getCurrentAllocationsRoundIdQueryKey = (address) => getCallClauseQueryKey({ abi, address, method });
6396
+ var useCurrentAllocationsRoundId = () => {
6397
+ const { network } = useVeChainKitConfig();
6398
+ const address = getConfig(network.type).xAllocationVotingContractAddress;
6399
+ return useCallClause({
6400
+ abi,
6401
+ address,
6402
+ method,
6403
+ args: [],
6404
+ queryOptions: {
6405
+ select: (data) => data[0].toString()
6406
+ }
6407
+ });
6408
+ };
6409
+ var getTokenInfo = async (thor, tokenAddress) => {
6410
+ if (!tokenAddress) throw new Error("Token address is required");
6411
+ const contract = thor.contracts.load(tokenAddress, ERC20__factory.abi);
6412
+ const response = await thor.contracts.executeMultipleClausesCall([
6413
+ contract.clause.name(),
6414
+ contract.clause.symbol(),
6415
+ contract.clause.decimals()
6416
+ ]);
6417
+ if (response.every((r) => r.success) === false) {
6418
+ throw new Error(`Failed to get token info of ${tokenAddress}`);
6419
+ }
6420
+ const [name, symbol, decimals] = response.map((res) => {
6421
+ return res.result.array?.[0];
6422
+ });
6423
+ return {
6424
+ name,
6425
+ address: tokenAddress,
6426
+ decimals,
6427
+ symbol
6428
+ };
6429
+ };
6430
+ var getCustomTokenInfo = (tokenAddress) => [
6431
+ "VECHAIN_KIT_CUSTOM_TOKEN_BALANCE",
6432
+ tokenAddress
6433
+ ];
6434
+ var useGetCustomTokenInfo = (tokenAddress) => {
6435
+ const thor = useThor();
6436
+ const { network } = useVeChainKitConfig();
6437
+ return useQuery({
6438
+ queryKey: getCustomTokenInfo(tokenAddress),
6439
+ queryFn: async () => getTokenInfo(thor, tokenAddress),
6440
+ enabled: !!thor && !!network.type && !!tokenAddress
6441
+ });
6442
+ };
6443
+
6444
+ // src/hooks/api/wallet/useCustomTokens.ts
6362
6445
  var useCustomTokens = () => {
6363
6446
  const [customTokens, setCustomTokens] = useLocalStorage(
6364
6447
  "vechain_kit_custom_tokens" /* CUSTOM_TOKENS */,
@@ -6405,6 +6488,223 @@ var useCustomTokens = () => {
6405
6488
  isDefaultToken
6406
6489
  };
6407
6490
  };
6491
+ var getB3trBalance = async (thor, network, address) => {
6492
+ const res = await thor.contracts.load(getConfig(network).b3trContractAddress, B3TR__factory.abi).read.balanceOf(address);
6493
+ if (!res) throw new Error("Failed to get b3tr balance");
6494
+ const original = res[0].toString();
6495
+ const scaled = formatEther(original);
6496
+ const formatted = scaled === "0" ? "0" : humanNumber(scaled);
6497
+ return {
6498
+ original,
6499
+ scaled,
6500
+ formatted
6501
+ };
6502
+ };
6503
+ var getB3trBalanceQueryKey = (address) => [
6504
+ "VEBETTERDAO_BALANCE",
6505
+ address,
6506
+ "B3TR"
6507
+ ];
6508
+ var useGetB3trBalance = (address) => {
6509
+ const thor = useThor();
6510
+ const { network } = useVeChainKitConfig();
6511
+ return useQuery({
6512
+ queryKey: getB3trBalanceQueryKey(address),
6513
+ queryFn: async () => getB3trBalance(thor, network.type, address),
6514
+ enabled: !!thor && !!address && !!network.type
6515
+ });
6516
+ };
6517
+ var getCustomTokenBalance = async (thor, token, address) => {
6518
+ const res = await thor.contracts.load(token.address, ERC20__factory.abi).read.balanceOf([address]);
6519
+ if (!res) throw new Error(`Failed to get balance of ${token.address}`);
6520
+ const original = res[0];
6521
+ const scaled = formatEther$1(BigInt(original));
6522
+ const formatted = scaled === "0" ? "0" : humanNumber(scaled);
6523
+ return {
6524
+ ...token,
6525
+ original: original.toString(),
6526
+ scaled,
6527
+ formatted
6528
+ };
6529
+ };
6530
+ var getCustomTokenBalanceQueryKey = (tokenAddress, address) => ["VECHAIN_KIT_BALANCE", address, "CUSTOM_TOKEN", tokenAddress];
6531
+ var useGetCustomTokenBalances = (address) => {
6532
+ const thor = useThor();
6533
+ const { customTokens } = useCustomTokens();
6534
+ return useQueries({
6535
+ queries: customTokens.map((token) => ({
6536
+ queryKey: getCustomTokenBalanceQueryKey(token.address, address),
6537
+ queryFn: async () => {
6538
+ return await getCustomTokenBalance(thor, token, address);
6539
+ }
6540
+ }))
6541
+ });
6542
+ };
6543
+ var getErc20Balance = async (thor, tokenAddress, address) => {
6544
+ if (!tokenAddress || !address) {
6545
+ throw new Error("Token address and user address are required");
6546
+ }
6547
+ const res = await thor.contracts.load(tokenAddress, IERC20__factory.abi).read.balanceOf(address);
6548
+ if (!res) throw new Error(`Failed to get balance of ${tokenAddress}`);
6549
+ const original = res[0].toString();
6550
+ const scaled = formatEther(original);
6551
+ const formatted = scaled === "0" ? "0" : humanNumber(scaled);
6552
+ return {
6553
+ original,
6554
+ scaled,
6555
+ formatted
6556
+ };
6557
+ };
6558
+ var getErc20BalanceQueryKey = (tokenAddress, address) => ["VECHAIN_KIT", "BALANCE", "ERC20", tokenAddress, address];
6559
+ var useGetErc20Balance = (tokenAddress, address) => {
6560
+ const thor = useThor();
6561
+ return useQuery({
6562
+ queryKey: getErc20BalanceQueryKey(tokenAddress, address),
6563
+ queryFn: async () => getErc20Balance(thor, tokenAddress, address),
6564
+ enabled: !!thor && !!address && !!tokenAddress
6565
+ });
6566
+ };
6567
+ var getVot3Balance = async (thor, network, address) => {
6568
+ const res = await thor.contracts.load(getConfig(network).vot3ContractAddress, IVOT3__factory.abi).read.balanceOf(address);
6569
+ if (!res) throw new Error("Reverted");
6570
+ const original = res[0].toString();
6571
+ const scaled = formatEther(original);
6572
+ const formatted = scaled === "0" ? "0" : humanNumber(scaled);
6573
+ return {
6574
+ original,
6575
+ scaled,
6576
+ formatted
6577
+ };
6578
+ };
6579
+ var getVot3BalanceQueryKey = (address) => [
6580
+ "VEBETTERDAO_BALANCE",
6581
+ address,
6582
+ "VOT3"
6583
+ ];
6584
+ var useGetVot3Balance = (address) => {
6585
+ const thor = useThor();
6586
+ const { network } = useVeChainKitConfig();
6587
+ return useQuery({
6588
+ queryKey: getVot3BalanceQueryKey(address),
6589
+ queryFn: async () => getVot3Balance(thor, network.type, address),
6590
+ enabled: !!thor && !!address && !!network.type
6591
+ });
6592
+ };
6593
+
6594
+ // src/hooks/api/wallet/useIsPerson.ts
6595
+ var abi2 = VeBetterPassport__factory.abi;
6596
+ var method2 = "isPerson";
6597
+ var getIsPersonQueryKey = (user, network) => {
6598
+ const address = getConfig(network).veBetterPassportContractAddress;
6599
+ return getCallClauseQueryKeyWithArgs({
6600
+ abi: abi2,
6601
+ address,
6602
+ method: method2,
6603
+ args: [user]
6604
+ });
6605
+ };
6606
+ var useIsPerson = (user) => {
6607
+ const { network } = useVeChainKitConfig();
6608
+ const address = getConfig(network.type).veBetterPassportContractAddress;
6609
+ return useCallClause({
6610
+ abi: abi2,
6611
+ address,
6612
+ method: method2,
6613
+ args: [user ?? "0x"],
6614
+ queryOptions: {
6615
+ enabled: !!user,
6616
+ select: (data) => data[0]
6617
+ }
6618
+ });
6619
+ };
6620
+
6621
+ // src/hooks/api/wallet/useRoundXApps.ts
6622
+ var abi3 = XAllocationVoting__factory.abi;
6623
+ var method3 = "getAppsOfRound";
6624
+ var getRoundXAppsQueryKey = (roundId, networkType) => getCallClauseQueryKeyWithArgs({
6625
+ abi: abi3,
6626
+ address: getConfig(networkType).xAllocationVotingContractAddress,
6627
+ method: method3,
6628
+ args: [BigInt(roundId ?? 0)]
6629
+ });
6630
+ var useRoundXApps = (roundId) => {
6631
+ const { network } = useVeChainKitConfig();
6632
+ const address = getConfig(network.type).xAllocationVotingContractAddress;
6633
+ return useCallClause({
6634
+ abi: abi3,
6635
+ address,
6636
+ method: method3,
6637
+ args: [BigInt(roundId ?? 0)],
6638
+ queryOptions: {
6639
+ enabled: !!roundId,
6640
+ select: (data) => data[0].map((app) => ({
6641
+ id: app.id.toString(),
6642
+ teamWalletAddress: app.teamWalletAddress,
6643
+ name: app.name,
6644
+ metadataURI: app.metadataURI,
6645
+ createdAtTimestamp: app.createdAtTimestamp.toString()
6646
+ }))
6647
+ }
6648
+ });
6649
+ };
6650
+ var abi4 = XAllocationPool__factory.abi;
6651
+ var method4 = "getAppShares";
6652
+ var getXAppsSharesQueryKey = (roundId) => [
6653
+ "VECHAIN_KIT",
6654
+ "XApps",
6655
+ "Shares",
6656
+ roundId
6657
+ ];
6658
+ var useXAppsShares = (apps, roundId) => {
6659
+ const thor = useThor();
6660
+ const { network } = useVeChainKitConfig();
6661
+ const address = getConfig(network.type).xAllocationPoolContractAddress;
6662
+ return useQuery({
6663
+ queryKey: getXAppsSharesQueryKey(roundId),
6664
+ queryFn: async () => {
6665
+ const shares = await executeMultipleClausesCall({
6666
+ thor,
6667
+ calls: apps.map(
6668
+ (app) => ({
6669
+ abi: abi4,
6670
+ functionName: method4,
6671
+ address,
6672
+ args: [roundId, app]
6673
+ })
6674
+ )
6675
+ });
6676
+ return shares.map((share, index) => {
6677
+ return {
6678
+ app: apps[index],
6679
+ share: Number(share[0] || 0) / 100,
6680
+ unallocatedShare: Number(share[1] || 0) / 100
6681
+ };
6682
+ });
6683
+ },
6684
+ enabled: !!roundId && !!apps.length
6685
+ });
6686
+ };
6687
+
6688
+ // src/hooks/api/wallet/useMostVotedAppsInRound.ts
6689
+ var useMostVotedAppsInRound = (roundId) => {
6690
+ const { data: apps } = useRoundXApps(roundId);
6691
+ const xAppsShares = useXAppsShares(
6692
+ apps?.map((app) => app.id) ?? [],
6693
+ roundId
6694
+ );
6695
+ const mostVotedApps = useMemo(
6696
+ () => xAppsShares.data?.map((appShares) => ({
6697
+ percentage: appShares.share + appShares.unallocatedShare,
6698
+ id: apps?.find((xa) => xa.id === appShares.app)?.id ?? "",
6699
+ app: apps?.find((xa) => xa.id === appShares.app) ?? {}
6700
+ })).sort((a, b) => Number(b.percentage) - Number(a.percentage)) ?? [],
6701
+ [xAppsShares.data, apps]
6702
+ );
6703
+ return {
6704
+ data: mostVotedApps,
6705
+ isLoading: xAppsShares.isLoading
6706
+ };
6707
+ };
6408
6708
  var handlePopupError = ({
6409
6709
  error,
6410
6710
  mobileBrowserPopupMessage = "Mobile browser blocked the window. Please try again.",
@@ -6737,170 +7037,30 @@ var useRefreshBalances = () => {
6737
7037
  };
6738
7038
  return { refresh };
6739
7039
  };
6740
- var getCustomTokenBalances = async (thor, address, customTokens) => {
6741
- const clauses = customTokens.map((token) => {
6742
- const erc20Contract = thor.contracts.load(
6743
- token.address,
6744
- IERC20__factory.abi
6745
- );
6746
- return erc20Contract.clause.balanceOf([address]);
6747
- });
6748
- const response = await thor.contracts.executeMultipleClausesCall(clauses);
6749
- if (!response.every((r) => r.success && !!r.result.plain)) {
6750
- throw new Error("Failed to get custom token balances");
6751
- }
6752
- return response.map((r, index) => {
6753
- const token = customTokens[index];
6754
- const original = r.result.plain;
6755
- const scaled = formatEther$1(BigInt(original)) || "0";
6756
- return {
6757
- address: token.address,
6758
- symbol: token.symbol,
6759
- balance: scaled
6760
- };
6761
- });
6762
- };
6763
- var getTokenBalances = async (thor, address, network) => {
6764
- const config = getConfig(network);
6765
- const [b3trBalance, vot3Balance, veDelegateBalance, gloDollarBalance] = await executeMultipleClausesCall({
6766
- thor,
6767
- calls: [
6768
- {
6769
- abi: IB3TR__factory.abi,
6770
- address: config.b3trContractAddress,
6771
- functionName: "balanceOf",
6772
- args: [address]
6773
- },
6774
- {
6775
- abi: IVOT3__factory.abi,
6776
- address: config.vot3ContractAddress,
6777
- functionName: "balanceOf",
6778
- args: [address]
6779
- },
6780
- {
6781
- abi: IERC20__factory.abi,
6782
- address: config.veDelegate,
6783
- functionName: "balanceOf",
6784
- args: [address]
6785
- },
6786
- {
6787
- abi: IERC20__factory.abi,
6788
- address: config.gloDollarContractAddress,
6789
- functionName: "balanceOf",
6790
- args: [address]
6791
- }
6792
- ]
6793
- });
6794
- const { balance: vetBalance, energy: vthoBalance } = await getAccountBalance(thor, address);
6795
- return [
6796
- {
6797
- address: "0x",
6798
- symbol: "VET",
6799
- balance: vetBalance
6800
- },
6801
- {
6802
- address: config.vthoContractAddress,
6803
- symbol: "VTHO",
6804
- balance: vthoBalance
6805
- },
6806
- {
6807
- address: config.b3trContractAddress,
6808
- symbol: "B3TR",
6809
- balance: b3trBalance
6810
- },
6811
- {
6812
- address: config.vot3ContractAddress,
6813
- symbol: "VOT3",
6814
- balance: vot3Balance
6815
- },
6816
- {
6817
- address: config.veDelegate,
6818
- symbol: "veDelegate",
6819
- balance: veDelegateBalance
6820
- },
6821
- {
6822
- address: config.gloDollarContractAddress,
6823
- symbol: "USDGLO",
6824
- balance: gloDollarBalance
6825
- }
6826
- ];
6827
- };
6828
- var useTokenBalances2 = ({ address }) => {
6829
- const thor = useThor();
6830
- const { network } = useVeChainKitConfig();
6831
- const { customTokens } = useCustomTokens();
6832
- return useQueries({
6833
- queries: [
6834
- {
6835
- queryKey: ["base-token-balances", address],
6836
- queryFn: () => getTokenBalances(thor, address, network.type)
6837
- },
6838
- {
6839
- queryKey: ["custom-token-balances", address],
6840
- queryFn: () => getCustomTokenBalances(thor, address, customTokens)
6841
- }
6842
- ],
6843
- combine: (data) => {
6844
- return {
6845
- data: data.flat(),
6846
- loading: data[0].isLoading || data[1].isLoading,
6847
- error: data[0].error || data[1].error
6848
- };
6849
- }
6850
- });
6851
- };
6852
- var getTokenPrices = async (thor, tokens2, network) => {
6853
- const config = getConfig(network);
6854
- const oracleContract = thor.contracts.load(
6855
- config.oracleContractAddress,
6856
- IVechainEnergyOracleV1__factory.abi
6857
- );
6858
- const clauses = tokens2.map(
6859
- (token) => oracleContract.clause.getLatestValue(PRICE_FEED_IDS[token])
6860
- );
6861
- const response = await thor.transactions.executeMultipleClausesCall(
6862
- clauses
6863
- );
6864
- if (!response.every((r) => r.success && !!r.result.array)) {
6865
- throw new Error("Failed to get token prices");
6866
- }
6867
- return response.map(
6868
- (r) => new BigNumber$1((r.result.array?.[0] ?? 0).toString()).div(1e12).toNumber()
7040
+ var getXAppMetadata = async (uri, networkType) => {
7041
+ const metadata = await axios.get(
7042
+ convertUriToUrl(uri, networkType) || "",
7043
+ { timeout: 2e4 }
6869
7044
  );
7045
+ return metadata.data;
6870
7046
  };
6871
- var tokens = ["VET", "VTHO", "B3TR", "EUR", "GBP"];
6872
- var useTokenPrices2 = () => {
7047
+ var abi5 = X2EarnApps__factory.abi;
7048
+ var useXAppMetadata = (xAppId) => {
6873
7049
  const thor = useThor();
6874
7050
  const { network } = useVeChainKitConfig();
6875
- const config = getConfig(network.type);
6876
7051
  return useQuery({
6877
- queryKey: ["token-prices", network.type],
6878
- queryFn: () => getTokenPrices(thor, tokens, network.type),
6879
- select: (data) => {
6880
- const [
6881
- vetUsdPrice,
6882
- vthoUsdPrice,
6883
- b3trUsdPrice,
6884
- eurUsdPrice,
6885
- gbpUsdPrice
6886
- ] = data;
6887
- const prices = {
6888
- "0x": vetUsdPrice || 0,
6889
- [config.vthoContractAddress]: vthoUsdPrice || 0,
6890
- [config.b3trContractAddress]: b3trUsdPrice || 0,
6891
- [config.vot3ContractAddress]: b3trUsdPrice || 0,
6892
- [config.veDelegate]: b3trUsdPrice || 0,
6893
- [config.gloDollarContractAddress]: 1
6894
- // GloDollar is pegged to USD
6895
- };
6896
- const exchangeRates = {
6897
- eurUsdPrice: eurUsdPrice || 1,
6898
- gbpUsdPrice: gbpUsdPrice || 1
6899
- };
6900
- return {
6901
- prices,
6902
- exchangeRates
6903
- };
7052
+ queryKey: ["xAppMetaData", xAppId],
7053
+ queryFn: async () => {
7054
+ const address = getConfig(network.type).x2EarnAppsContractAddress;
7055
+ const contract = thor.contracts.load(address, abi5);
7056
+ const [app] = await contract.read.app(xAppId);
7057
+ const metadataURI = app?.[3] || "";
7058
+ const [baseUri] = await contract.read.baseURI();
7059
+ const metadata = await getXAppMetadata(
7060
+ `${baseUri}${metadataURI}`,
7061
+ network.type
7062
+ );
7063
+ return metadata;
6904
7064
  }
6905
7065
  });
6906
7066
  };
@@ -7619,8 +7779,8 @@ var ConnectionOptionsStack = () => {
7619
7779
  showMoreLogin,
7620
7780
  isOfficialVeChainApp
7621
7781
  } = useLoginModalContent();
7622
- return /* @__PURE__ */ jsx(Stack, { spacing: 4, w: "full", align: "center", children: /* @__PURE__ */ jsx(Grid, { templateColumns: "repeat(4, 1fr)", gap: 2, w: "full", children: loginMethods?.map(({ method: method13, gridColumn }) => {
7623
- switch (method13) {
7782
+ return /* @__PURE__ */ jsx(Stack, { spacing: 4, w: "full", align: "center", children: /* @__PURE__ */ jsx(Grid, { templateColumns: "repeat(4, 1fr)", gap: 2, w: "full", children: loginMethods?.map(({ method: method7, gridColumn }) => {
7783
+ switch (method7) {
7624
7784
  case "email":
7625
7785
  return showEmailLogin && /* @__PURE__ */ jsx(EmailLoginButton, {}, "email");
7626
7786
  case "google":
@@ -7727,7 +7887,7 @@ var MainContent = ({ setCurrentContent, onClose }) => {
7727
7887
  }
7728
7888
  }, [connection.isConnected, onClose]);
7729
7889
  const showEcosystemButton = loginMethods?.some(
7730
- ({ method: method13 }) => method13 === "ecosystem"
7890
+ ({ method: method7 }) => method7 === "ecosystem"
7731
7891
  );
7732
7892
  return /* @__PURE__ */ jsxs(Fragment, { children: [
7733
7893
  /* @__PURE__ */ jsxs(StickyHeaderContainer, { children: [
@@ -13015,13 +13175,13 @@ var PrivyLinkedAccounts = ({ onBack }) => {
13015
13175
  } = usePrivy();
13016
13176
  const canLinkWallets = useMemo(() => {
13017
13177
  const privyWallets = privy?.loginMethods?.filter(
13018
- (method13) => [
13178
+ (method7) => [
13019
13179
  "rabby_wallet",
13020
13180
  "coinbase_wallet",
13021
13181
  "rainbow",
13022
13182
  "phantom",
13023
13183
  "metamask"
13024
- ].includes(method13)
13184
+ ].includes(method7)
13025
13185
  ) ?? [];
13026
13186
  const dappKitWallets = dappKit?.allowedWallets ?? [];
13027
13187
  return privyWallets.length > 0 || dappKitWallets.length > 0;
@@ -14165,17 +14325,7 @@ var ExploreEcosystemContent = ({
14165
14325
  ) : [];
14166
14326
  const filteredDefaultApps = DEFAULT_APPS.filter(
14167
14327
  (dapp) => dapp.name.toLowerCase().includes(searchQuery.toLowerCase())
14168
- ).map((dapp) => {
14169
- if (dapp.logoComponent) {
14170
- return {
14171
- ...dapp,
14172
- logoComponent: React10.cloneElement(dapp.logoComponent, {
14173
- isDark
14174
- })
14175
- };
14176
- }
14177
- return dapp;
14178
- });
14328
+ );
14179
14329
  const filteredAppHubApps = appHubApps?.filter(
14180
14330
  (app) => (
14181
14331
  // Text search filter
@@ -14262,10 +14412,7 @@ var ExploreEcosystemContent = ({
14262
14412
  url: dapp.external_url,
14263
14413
  setCurrentContent,
14264
14414
  description: dapp.description,
14265
- selectedCategory: currentCategory,
14266
- ...dapp.logoComponent && {
14267
- logoComponent: dapp.logoComponent
14268
- }
14415
+ selectedCategory: currentCategory
14269
14416
  }
14270
14417
  ) }, dapp.name)) }),
14271
14418
  shouldShowVbdApps && filteredVbdApps.length > 0 && /* @__PURE__ */ jsx(Fragment, { children: filteredVbdApps.map((dapp) => /* @__PURE__ */ jsx(GridItem, { children: /* @__PURE__ */ jsx(
@@ -15014,7 +15161,7 @@ var ConnectPopover = ({
15014
15161
  privyEcosystemAppIDS
15015
15162
  } = useVeChainKitConfig();
15016
15163
  const showEcosystemButton = loginMethods?.some(
15017
- ({ method: method13 }) => method13 === "ecosystem"
15164
+ ({ method: method7 }) => method7 === "ecosystem"
15018
15165
  );
15019
15166
  const { data: appsInfo, isLoading: isEcosystemAppsLoading } = useFetchAppInfo(privyEcosystemAppIDS);
15020
15167
  return /* @__PURE__ */ jsx(
@@ -15739,8 +15886,9 @@ var ProfileCard = ({
15739
15886
  style
15740
15887
  }) => {
15741
15888
  const { t } = useTranslation();
15742
- const { account } = useWallet();
15889
+ const { account, disconnect } = useWallet();
15743
15890
  const { network } = useVeChainKitConfig();
15891
+ const { openAccountModal, closeAccountModal } = useModal();
15744
15892
  const metadata = useWalletMetadata(address, network.type);
15745
15893
  const headerImageSvg = getPicassoImage(address);
15746
15894
  const isConnectedAccount = address === account?.address;
@@ -15883,6 +16031,12 @@ var ProfileCard = ({
15883
16031
  variant: "ghost",
15884
16032
  leftIcon: /* @__PURE__ */ jsx(Icon, { as: FaEdit }),
15885
16033
  onClick: onEditClick ?? (() => {
16034
+ openAccountModal({
16035
+ type: "account-customization",
16036
+ props: {
16037
+ setCurrentContent: () => closeAccountModal()
16038
+ }
16039
+ });
15886
16040
  }),
15887
16041
  "data-testid": "customize-button",
15888
16042
  children: t("Customize")
@@ -15897,7 +16051,18 @@ var ProfileCard = ({
15897
16051
  variant: "ghost",
15898
16052
  leftIcon: /* @__PURE__ */ jsx(Icon, { as: RiLogoutBoxLine }),
15899
16053
  colorScheme: "red",
15900
- onClick: onLogout,
16054
+ onClick: onLogout ?? (() => {
16055
+ openAccountModal({
16056
+ type: "disconnect-confirm",
16057
+ props: {
16058
+ onDisconnect: () => {
16059
+ disconnect();
16060
+ closeAccountModal();
16061
+ },
16062
+ onBack: () => closeAccountModal()
16063
+ }
16064
+ });
16065
+ }),
15901
16066
  "data-testid": "logout-button",
15902
16067
  children: t("Logout")
15903
16068
  }
@@ -16557,14 +16722,14 @@ var ReceiveModalProvider = ({ children }) => /* @__PURE__ */ jsx(Fragment, { chi
16557
16722
  var useLoginModalContent = () => {
16558
16723
  const { privy, loginMethods } = useVeChainKitConfig();
16559
16724
  const isVeChainApp = privy?.appId === VECHAIN_PRIVY_APP_ID;
16560
- const isLoginMethodEnabled = (method13) => {
16725
+ const isLoginMethodEnabled = (method7) => {
16561
16726
  if (!loginMethods) return true;
16562
- if (Array.isArray(method13)) {
16563
- return method13.some(
16727
+ if (Array.isArray(method7)) {
16728
+ return method7.some(
16564
16729
  (m) => loginMethods.some((lm) => lm.method === m)
16565
16730
  );
16566
16731
  }
16567
- return loginMethods.some((lm) => lm.method === method13);
16732
+ return loginMethods.some((lm) => lm.method === method7);
16568
16733
  };
16569
16734
  const showEcosystemLogin = useMemo(() => {
16570
16735
  if (!loginMethods) return true;
@@ -16988,24 +17153,24 @@ var getCallClauseQueryKey = ({
16988
17153
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
16989
17154
  abi: abi9,
16990
17155
  address,
16991
- method: method13
16992
- }) => ["callClause", address, method13];
17156
+ method: method7
17157
+ }) => ["callClause", address, method7];
16993
17158
  var getCallClauseQueryKeyWithArgs = ({
16994
17159
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
16995
17160
  abi: abi9,
16996
17161
  address,
16997
- method: method13,
17162
+ method: method7,
16998
17163
  args
16999
17164
  }) => [
17000
17165
  "callClause",
17001
17166
  address,
17002
- method13,
17167
+ method7,
17003
17168
  ...args?.length ? [args] : []
17004
17169
  ];
17005
17170
  var useCallClause = ({
17006
17171
  address,
17007
17172
  abi: abi9,
17008
- method: method13,
17173
+ method: method7,
17009
17174
  args,
17010
17175
  queryOptions
17011
17176
  }) => {
@@ -17014,19 +17179,29 @@ var useCallClause = ({
17014
17179
  queryKey: getCallClauseQueryKeyWithArgs({
17015
17180
  abi: abi9,
17016
17181
  address,
17017
- method: method13,
17182
+ method: method7,
17018
17183
  args
17019
17184
  }),
17020
17185
  queryFn: async () => executeCallClause({
17021
17186
  thor,
17022
17187
  contractAddress: address,
17023
17188
  abi: abi9,
17024
- method: method13,
17189
+ method: method7,
17025
17190
  args
17026
17191
  }),
17027
17192
  ...queryOptions
17028
17193
  });
17029
17194
  };
17195
+ var useMultipleClausesCall = ({
17196
+ thor,
17197
+ calls,
17198
+ queryKey,
17199
+ enabled = true
17200
+ }) => useQuery({
17201
+ queryKey,
17202
+ queryFn: () => executeMultipleClausesCall({ thor, calls }),
17203
+ enabled
17204
+ });
17030
17205
 
17031
17206
  // src/hooks/utils/useGetNodeUrl.ts
17032
17207
  var useGetNodeUrl = () => {
@@ -17056,95 +17231,12 @@ var useScrollToTop = () => {
17056
17231
  }
17057
17232
  }, []);
17058
17233
  };
17059
- var LocalStorageKey = /* @__PURE__ */ ((LocalStorageKey2) => {
17060
- LocalStorageKey2["CUSTOM_TOKENS"] = "vechain_kit_custom_tokens";
17061
- LocalStorageKey2["ECOSYSTEM_SHORTCUTS"] = "vechain-kit-ecosystem-shortcuts";
17062
- LocalStorageKey2["CURRENCY"] = "vechain_kit_currency";
17063
- LocalStorageKey2["NODE_URL"] = "vechain_kit_node_url";
17064
- LocalStorageKey2["NETWORK"] = "vechain_kit_network";
17065
- return LocalStorageKey2;
17066
- })(LocalStorageKey || {});
17067
- var useLocalStorage = (key, initialValue) => {
17068
- const [storedValue, setStoredValue] = useState(() => {
17069
- try {
17070
- const item = window.localStorage.getItem(key);
17071
- return item ? JSON.parse(item) : initialValue;
17072
- } catch (error) {
17073
- console.error(error);
17074
- return initialValue;
17075
- }
17076
- });
17077
- useEffect(() => {
17078
- window.localStorage.setItem(key, JSON.stringify(storedValue));
17079
- }, [key, storedValue]);
17080
- return [storedValue, setStoredValue];
17081
- };
17082
- var useSyncableLocalStorage = (key, defaultValue) => {
17083
- const [value, setValue] = useState(() => {
17084
- if (typeof window === "undefined") return defaultValue;
17085
- try {
17086
- const stored = window.localStorage.getItem(key);
17087
- return stored ? JSON.parse(stored) : defaultValue;
17088
- } catch (err) {
17089
- console.error("Error loading from localStorage:", err);
17090
- return defaultValue;
17091
- }
17092
- });
17093
- useEffect(() => {
17094
- if (typeof window === "undefined") return;
17095
- try {
17096
- window.localStorage.setItem(key, JSON.stringify(value));
17097
- } catch (err) {
17098
- console.error("Error writing to localStorage:", err);
17099
- }
17100
- }, [key, value]);
17101
- const sync = useCallback(() => {
17102
- if (typeof window === "undefined") return;
17103
- try {
17104
- const stored = window.localStorage.getItem(key);
17105
- setValue(stored ? JSON.parse(stored) : defaultValue);
17106
- } catch (err) {
17107
- console.error("Error syncing localStorage:", err);
17108
- }
17109
- }, [key, defaultValue]);
17110
- const getValue = useCallback(() => {
17111
- if (typeof window === "undefined") return defaultValue;
17112
- const stored = window.localStorage.getItem(key);
17113
- return stored ? JSON.parse(stored) : defaultValue;
17114
- }, [key, defaultValue]);
17115
- return [value, setValue, sync, getValue];
17116
- };
17117
-
17118
- // src/hooks/cache/useEcosystemShortcuts.ts
17119
- var useEcosystemShortcuts = () => {
17120
- const [shortcuts, setShortcuts] = useLocalStorage(
17121
- "vechain-kit-ecosystem-shortcuts" /* ECOSYSTEM_SHORTCUTS */,
17122
- []
17123
- );
17124
- const addShortcut = (shortcut) => {
17125
- if (!shortcuts.some((s) => s.url === shortcut.url)) {
17126
- setShortcuts([...shortcuts, shortcut]);
17127
- }
17128
- };
17129
- const removeShortcut = (url) => {
17130
- setShortcuts(shortcuts.filter((s) => s.url !== url));
17131
- };
17132
- const isShortcut = (url) => {
17133
- return shortcuts.some((s) => s.url === url);
17134
- };
17135
- return {
17136
- shortcuts,
17137
- addShortcut,
17138
- removeShortcut,
17139
- isShortcut
17140
- };
17141
- };
17142
17234
  var getAccountBalance = async (thor, address) => {
17143
17235
  if (!address) throw new Error("Address is required");
17144
17236
  const account = await thor.accounts.getAccount(Address.of(address));
17145
17237
  return {
17146
- balance: formatEther(BigInt(account.balance)).toString(),
17147
- energy: formatEther(BigInt(account.energy)).toString()
17238
+ balance: formatEther$1(BigInt(account.balance)).toString(),
17239
+ energy: formatEther$1(BigInt(account.energy)).toString()
17148
17240
  };
17149
17241
  };
17150
17242
  var getAccountBalanceQueryKey = (address) => [
@@ -17259,9 +17351,9 @@ var useGetAccountAddress = (ownerAddress) => {
17259
17351
  };
17260
17352
 
17261
17353
  // src/hooks/thor/smartAccounts/useGetAccountVersion.ts
17262
- var abi = SimpleAccountFactory__factory.abi;
17354
+ var abi6 = SimpleAccountFactory__factory.abi;
17263
17355
  var getAccountVersionQueryKey = (accountAddress, ownerAddress, networkType) => getCallClauseQueryKeyWithArgs({
17264
- abi,
17356
+ abi: abi6,
17265
17357
  address: getConfig(networkType).accountFactoryAddress,
17266
17358
  method: "getAccountVersion",
17267
17359
  args: [accountAddress, ownerAddress]
@@ -17270,7 +17362,7 @@ var useGetAccountVersion = (accountAddress, ownerAddress) => {
17270
17362
  const { network } = useVeChainKitConfig();
17271
17363
  return useCallClause({
17272
17364
  address: getConfig(network.type).accountFactoryAddress,
17273
- abi,
17365
+ abi: abi6,
17274
17366
  method: "getAccountVersion",
17275
17367
  args: [accountAddress, ownerAddress],
17276
17368
  queryOptions: {
@@ -17283,16 +17375,16 @@ var useGetAccountVersion = (accountAddress, ownerAddress) => {
17283
17375
  }
17284
17376
  });
17285
17377
  };
17286
- var abi2 = SimpleAccountFactory__factory.abi;
17287
- var method = "hasLegacyAccount";
17378
+ var abi7 = SimpleAccountFactory__factory.abi;
17379
+ var method5 = "hasLegacyAccount";
17288
17380
  var getHasV1SmartAccount = async (thor, ownerAddress, networkType) => {
17289
17381
  if (!ownerAddress) throw new Error("Owner address is required");
17290
17382
  if (!networkType) throw new Error("Network type is required");
17291
17383
  const [hasLegacyAccount] = await executeCallClause({
17292
17384
  thor,
17293
- abi: abi2,
17385
+ abi: abi7,
17294
17386
  contractAddress: getConfig(networkType).accountFactoryAddress,
17295
- method,
17387
+ method: method5,
17296
17388
  args: [ownerAddress]
17297
17389
  });
17298
17390
  return hasLegacyAccount;
@@ -17503,15 +17595,15 @@ var useSmartAccount = (ownerAddress) => {
17503
17595
  enabled: !!ownerAddress && !!network.type && !!thor
17504
17596
  });
17505
17597
  };
17506
- var abi3 = SimpleAccountFactory__factory.abi;
17507
- var method2 = "version";
17598
+ var abi8 = SimpleAccountFactory__factory.abi;
17599
+ var method6 = "version";
17508
17600
  var getVersion = async (thor, contractAddress) => {
17509
17601
  if (!contractAddress) throw new Error("Contract address is required");
17510
17602
  const [version] = await executeCallClause({
17511
17603
  thor,
17512
17604
  contractAddress,
17513
- abi: abi3,
17514
- method: method2,
17605
+ abi: abi8,
17606
+ method: method6,
17515
17607
  args: []
17516
17608
  });
17517
17609
  return Number(version);
@@ -17699,1149 +17791,60 @@ var useGetChainId = () => {
17699
17791
  refetchInterval: 1e4
17700
17792
  });
17701
17793
  };
17702
- var getB3trBalance = async (thor, network, address) => {
17703
- const res = await thor.contracts.load(getConfig(network).b3trContractAddress, B3TR__factory.abi).read.balanceOf(address);
17704
- if (!res) throw new Error("Failed to get b3tr balance");
17705
- const original = res[0].toString();
17706
- const scaled = formatEther$1(original);
17707
- const formatted = scaled === "0" ? "0" : humanNumber(scaled);
17708
- return {
17709
- original,
17710
- scaled,
17711
- formatted
17712
- };
17713
- };
17714
- var getB3trBalanceQueryKey = (address) => [
17715
- "VEBETTERDAO_BALANCE",
17716
- address,
17717
- "B3TR"
17718
- ];
17719
- var useGetB3trBalance = (address) => {
17720
- const thor = useThor();
17721
- const { network } = useVeChainKitConfig();
17722
- return useQuery({
17723
- queryKey: getB3trBalanceQueryKey(address),
17724
- queryFn: async () => getB3trBalance(thor, network.type, address),
17725
- enabled: !!thor && !!address && !!network.type
17794
+
17795
+ // src/hooks/thor/logs/logUtils.ts
17796
+ var MAX_EVENTS_PER_QUERY = 1e3;
17797
+ var getEventLogs = async ({
17798
+ thor,
17799
+ order = "asc",
17800
+ offset = 0,
17801
+ limit = MAX_EVENTS_PER_QUERY,
17802
+ from = 0,
17803
+ to = thor.blocks.getHeadBlock()?.number,
17804
+ filterCriteria
17805
+ }) => {
17806
+ const response = await thor.logs.filterEventLogs({
17807
+ range: {
17808
+ from,
17809
+ to,
17810
+ unit: "block"
17811
+ },
17812
+ options: {
17813
+ offset,
17814
+ limit
17815
+ },
17816
+ order,
17817
+ criteriaSet: filterCriteria
17726
17818
  });
17819
+ if (!response) throw new Error("Failed to fetch events");
17820
+ return response;
17727
17821
  };
17728
- var getCustomTokenBalance = async (thor, token, address) => {
17729
- const res = await thor.contracts.load(token.address, ERC20__factory.abi).read.balanceOf([address]);
17730
- if (!res) throw new Error(`Failed to get balance of ${token.address}`);
17731
- const original = res[0];
17732
- const scaled = formatEther(BigInt(original));
17733
- const formatted = scaled === "0" ? "0" : humanNumber(scaled);
17734
- return {
17735
- ...token,
17736
- original: original.toString(),
17737
- scaled,
17738
- formatted
17739
- };
17740
- };
17741
- var getCustomTokenBalanceQueryKey = (tokenAddress, address) => ["VECHAIN_KIT_BALANCE", address, "CUSTOM_TOKEN", tokenAddress];
17742
- var useGetCustomTokenBalances = (address) => {
17743
- const thor = useThor();
17744
- const { customTokens } = useCustomTokens();
17745
- return useQueries({
17746
- queries: customTokens.map((token) => ({
17747
- queryKey: getCustomTokenBalanceQueryKey(token.address, address),
17748
- queryFn: async () => {
17749
- return await getCustomTokenBalance(thor, token, address);
17750
- }
17751
- }))
17752
- });
17753
- };
17754
- var getTokenInfo = async (thor, tokenAddress) => {
17755
- if (!tokenAddress) throw new Error("Token address is required");
17756
- const contract = thor.contracts.load(tokenAddress, ERC20__factory.abi);
17757
- const response = await thor.contracts.executeMultipleClausesCall([
17758
- contract.clause.name(),
17759
- contract.clause.symbol(),
17760
- contract.clause.decimals()
17761
- ]);
17762
- if (response.every((r) => r.success) === false) {
17763
- throw new Error(`Failed to get token info of ${tokenAddress}`);
17764
- }
17765
- const [name, symbol, decimals] = response.map((res) => {
17766
- return res.result.array?.[0];
17767
- });
17768
- return {
17769
- name,
17770
- address: tokenAddress,
17771
- decimals,
17772
- symbol
17773
- };
17774
- };
17775
- var getCustomTokenInfo = (tokenAddress) => [
17776
- "VECHAIN_KIT_CUSTOM_TOKEN_BALANCE",
17777
- tokenAddress
17778
- ];
17779
- var useGetCustomTokenInfo = (tokenAddress) => {
17780
- const thor = useThor();
17781
- const { network } = useVeChainKitConfig();
17782
- return useQuery({
17783
- queryKey: getCustomTokenInfo(tokenAddress),
17784
- queryFn: async () => getTokenInfo(thor, tokenAddress),
17785
- enabled: !!thor && !!network.type && !!tokenAddress
17786
- });
17787
- };
17788
- var getErc20Balance = async (thor, tokenAddress, address) => {
17789
- if (!tokenAddress || !address) {
17790
- throw new Error("Token address and user address are required");
17791
- }
17792
- const res = await thor.contracts.load(tokenAddress, IERC20__factory.abi).read.balanceOf(address);
17793
- if (!res) throw new Error(`Failed to get balance of ${tokenAddress}`);
17794
- const original = res[0].toString();
17795
- const scaled = formatEther$1(original);
17796
- const formatted = scaled === "0" ? "0" : humanNumber(scaled);
17797
- return {
17798
- original,
17799
- scaled,
17800
- formatted
17801
- };
17802
- };
17803
- var getErc20BalanceQueryKey = (tokenAddress, address) => ["VECHAIN_KIT", "BALANCE", "ERC20", tokenAddress, address];
17804
- var useGetErc20Balance = (tokenAddress, address) => {
17805
- const thor = useThor();
17806
- return useQuery({
17807
- queryKey: getErc20BalanceQueryKey(tokenAddress, address),
17808
- queryFn: async () => getErc20Balance(thor, tokenAddress, address),
17809
- enabled: !!thor && !!address && !!tokenAddress
17810
- });
17811
- };
17812
- var getVeDelegateBalance = async (thor, network, address) => {
17813
- const res = await thor.contracts.load(
17814
- getConfig(network).veDelegateTokenContractAddress,
17815
- IERC20__factory.abi
17816
- ).read.balanceOf(address);
17817
- if (!res)
17818
- throw new Error(`Failed to get veDelegate balance for ${address}`);
17819
- const original = res[0].toString();
17820
- const scaled = formatEther$1(original);
17821
- const formatted = scaled === "0" ? "0" : humanNumber(scaled);
17822
- return {
17823
- original,
17824
- scaled,
17825
- formatted
17826
- };
17827
- };
17828
- var getVeDelegateBalanceQueryKey = (address) => [
17829
- "VECHAIN_KIT_BALANCE",
17830
- address,
17831
- "VE_DELEGATE"
17832
- ];
17833
- var useGetVeDelegateBalance = (address) => {
17834
- const thor = useThor();
17835
- const { network } = useVeChainKitConfig();
17836
- return useQuery({
17837
- queryKey: getVeDelegateBalanceQueryKey(address),
17838
- queryFn: async () => getVeDelegateBalance(thor, network.type, address),
17839
- enabled: !!thor && !!address && !!network.type
17840
- });
17841
- };
17842
- var getTokensInfoByOwnerQueryKey = (owner) => [
17843
- "VECHAIN_KIT_GALAXY_MEMBER_TOKENS_INFO",
17844
- owner
17845
- ];
17846
- var useGalaxyMemberTokensInfo = (owner, size = 10) => {
17847
- const { network } = useVeChainKitConfig();
17848
- const contractAddress = getConfig(network.type).galaxyMemberContractAddress;
17849
- const thor = useThor();
17850
- const fetchTokens = async ({ pageParam = 0 }) => {
17851
- const data = await thor.contracts.load(contractAddress, GalaxyMember__factory.abi).read.getTokensInfoByOwner(owner, pageParam, size);
17852
- if (!data)
17853
- throw new Error(
17854
- `Failed to fetch tokens info for page ${pageParam}`
17855
- );
17856
- return { data, nextPage: pageParam + 1 };
17857
- };
17858
- return useInfiniteQuery({
17859
- queryKey: getTokensInfoByOwnerQueryKey(owner),
17860
- queryFn: fetchTokens,
17861
- getNextPageParam: (lastPage) => lastPage.data.length === size ? lastPage.nextPage : void 0,
17862
- enabled: !!owner && !!network.type,
17863
- initialPageParam: 0
17864
- });
17865
- };
17866
-
17867
- // src/hooks/thor/contracts/NodeManagement/useGetUserNodes.ts
17868
- var contractAbi = NodeManagement__factory.abi;
17869
- var method3 = "getUserNodes";
17870
- var getUserNodesQueryKey = (networkType, user) => getCallClauseQueryKeyWithArgs({
17871
- abi: contractAbi,
17872
- address: getConfig(networkType).nodeManagementContractAddress,
17873
- method: method3,
17874
- args: [user]
17875
- });
17876
- var useGetUserNodes = (userInput) => {
17877
- const { network } = useVeChainKitConfig();
17878
- const contractAddress = getConfig(
17879
- network.type
17880
- ).nodeManagementContractAddress;
17881
- return useCallClause({
17882
- address: contractAddress,
17883
- abi: contractAbi,
17884
- method: method3,
17885
- args: [userInput],
17886
- queryOptions: {
17887
- enabled: !!userInput && !!network.type && !!contractAddress,
17888
- select: (response) => {
17889
- return response[0].map((node) => ({
17890
- nodeId: node.nodeId.toString(),
17891
- nodeLevel: Number(node.nodeLevel),
17892
- xNodeOwner: node.xNodeOwner,
17893
- isXNodeHolder: node.isXNodeHolder,
17894
- isXNodeDelegated: node.isXNodeDelegated,
17895
- isXNodeDelegator: node.isXNodeDelegator,
17896
- isXNodeDelegatee: node.isXNodeDelegatee,
17897
- delegatee: node.delegatee
17898
- }));
17899
- }
17900
- }
17901
- });
17902
- };
17903
- var useGetUserNode = useGetUserNodes;
17904
- var PRICE_FEED_IDS = {
17905
- B3TR: "0x623374722d757364000000000000000000000000000000000000000000000000",
17906
- VET: "0x7665742d75736400000000000000000000000000000000000000000000000000",
17907
- VTHO: "0x7674686f2d757364000000000000000000000000000000000000000000000000",
17908
- GBP: "0x6762702d75736400000000000000000000000000000000000000000000000000",
17909
- EUR: "0x657572742d757364000000000000000000000000000000000000000000000000"
17910
- };
17911
- var getTokenUsdPrice = async (thor, token, network) => {
17912
- const res = await thor.contracts.load(
17913
- getConfig(network).oracleContractAddress,
17914
- IVechainEnergyOracleV1__factory.abi
17915
- ).read.getLatestValue(PRICE_FEED_IDS[token]);
17916
- if (!res) throw new Error(`Failed to get price of ${token}`);
17917
- return new BigNumber(res[0].toString()).div(1e12).toNumber();
17918
- };
17919
- var getTokenUsdPriceQueryKey = (token) => [
17920
- "VECHAIN_KIT_PRICE",
17921
- token
17922
- ];
17923
- var useGetTokenUsdPrice = (token) => {
17924
- const thor = useThor();
17925
- const { network } = useVeChainKitConfig();
17926
- return useQuery({
17927
- queryKey: getTokenUsdPriceQueryKey(token),
17928
- queryFn: async () => getTokenUsdPrice(thor, token, network.type),
17929
- enabled: !!thor && !!network.type
17930
- });
17931
- };
17932
- var getVot3Balance = async (thor, network, address) => {
17933
- const res = await thor.contracts.load(getConfig(network).vot3ContractAddress, VOT3__factory.abi).read.balanceOf(address);
17934
- if (!res) throw new Error("Reverted");
17935
- const original = res[0].toString();
17936
- const scaled = formatEther$1(original);
17937
- const formatted = scaled === "0" ? "0" : humanNumber(scaled);
17938
- return {
17939
- original,
17940
- scaled,
17941
- formatted
17942
- };
17943
- };
17944
- var getVot3BalanceQueryKey = (address) => [
17945
- "VEBETTERDAO_BALANCE",
17946
- address,
17947
- "VOT3"
17948
- ];
17949
- var useGetVot3Balance = (address) => {
17950
- const thor = useThor();
17951
- const { network } = useVeChainKitConfig();
17952
- return useQuery({
17953
- queryKey: getVot3BalanceQueryKey(address || ""),
17954
- queryFn: async () => getVot3Balance(thor, network.type, address),
17955
- enabled: !!thor && !!address && !!network.type
17956
- });
17957
- };
17958
- var contractAbi2 = VeBetterPassport__factory.abi;
17959
- var method4 = "isPerson";
17960
- var getIsPersonQueryKey = (networkType, user) => {
17961
- const veBetterPassportContractAddress = getConfig(networkType).veBetterPassportContractAddress;
17962
- return getCallClauseQueryKeyWithArgs({
17963
- abi: contractAbi2,
17964
- address: veBetterPassportContractAddress,
17965
- method: method4,
17966
- args: [user]
17967
- });
17968
- };
17969
- var useIsPerson = (user, customEnabled = true) => {
17970
- const { network } = useVeChainKitConfig();
17971
- const veBetterPassportContractAddress = getConfig(
17972
- network.type
17973
- ).veBetterPassportContractAddress;
17974
- return useCallClause({
17975
- abi: contractAbi2,
17976
- address: veBetterPassportContractAddress,
17977
- method: method4,
17978
- args: [user ?? ZERO_ADDRESS],
17979
- queryOptions: {
17980
- enabled: !!user && customEnabled && !!veBetterPassportContractAddress && !!network.type,
17981
- select: (data) => data[0]
17982
- }
17983
- });
17984
- };
17985
- var useIsUserPerson = (address) => {
17986
- return useIsPerson(address);
17987
- };
17988
- var contractAbi3 = VeBetterPassport__factory.abi;
17989
- var method5 = "isPersonAtTimepoint";
17990
- var getIsPersonAtTimepointQueryKey = (networkType, user, timepoint) => {
17991
- const veBetterPassportContractAddress = getConfig(networkType).veBetterPassportContractAddress;
17992
- return getCallClauseQueryKeyWithArgs({
17993
- abi: contractAbi3,
17994
- address: veBetterPassportContractAddress,
17995
- method: method5,
17996
- args: [user, Number(timepoint)]
17997
- });
17998
- };
17999
- var useIsPersonAtTimepoint = (user, timepoint, customEnabled = true) => {
18000
- const { network } = useVeChainKitConfig();
18001
- const veBetterPassportContractAddress = getConfig(
18002
- network.type
18003
- ).veBetterPassportContractAddress;
18004
- return useCallClause({
18005
- abi: contractAbi3,
18006
- address: veBetterPassportContractAddress,
18007
- method: method5,
18008
- args: [
18009
- user ?? ZERO_ADDRESS,
18010
- timepoint ? Number(timepoint) : 0
18011
- ],
18012
- queryOptions: {
18013
- enabled: !!user && timepoint !== void 0 && customEnabled && !!veBetterPassportContractAddress && !!network.type,
18014
- select: (data) => data[0]
18015
- }
18016
- });
18017
- };
18018
-
18019
- // src/hooks/thor/contracts/VeBetterPassport/useUserBotSignals.ts
18020
- var contractAbi4 = VeBetterPassport__factory.abi;
18021
- var method6 = "signaledCounter";
18022
- var getUserBotSignalsQueryKey = (networkType, userAddress) => {
18023
- return getCallClauseQueryKeyWithArgs({
18024
- abi: contractAbi4,
18025
- address: getConfig(networkType).veBetterPassportContractAddress,
18026
- method: method6,
18027
- args: [userAddress]
18028
- });
18029
- };
18030
- var useUserBotSignals = (userAddressInput) => {
18031
- const { network } = useVeChainKitConfig();
18032
- const veBetterPassportContractAddress = getConfig(
18033
- network.type
18034
- ).veBetterPassportContractAddress;
18035
- return useCallClause({
18036
- address: veBetterPassportContractAddress,
18037
- abi: contractAbi4,
18038
- method: method6,
18039
- args: [userAddressInput],
18040
- queryOptions: {
18041
- enabled: !!userAddressInput && !!veBetterPassportContractAddress && !!network.type,
18042
- select: (res) => Number(res[0])
18043
- }
18044
- });
18045
- };
18046
- var useVotingRewards = (currentRoundId, voter) => {
18047
- const thor = useThor();
18048
- const queryClient = useQueryClient();
18049
- const { network } = useVeChainKitConfig();
18050
- const contractAddress = getConfig(network.type).voterRewardsContractAddress;
18051
- const rounds = useMemo(() => {
18052
- return Array.from(
18053
- { length: parseInt(currentRoundId ?? "0") - 1 },
18054
- (_, i) => (i + 1).toString()
18055
- );
18056
- }, [currentRoundId]);
18057
- return useQuery({
18058
- queryKey: getRoundRewardQueryKey("ALL", voter),
18059
- enabled: !!thor && !!voter && !!currentRoundId && !!rounds.length && !!network.type,
18060
- queryFn: async () => {
18061
- const contract = thor.contracts.load(
18062
- contractAddress,
18063
- VoterRewards__factory.abi
18064
- );
18065
- const clauses = rounds.map(
18066
- (roundId) => (
18067
- // Voter Rewards getReward result type: [ 0n ]
18068
- contract.clause.getReward(roundId, voter)
18069
- )
18070
- );
18071
- const res = await thor.transactions.executeMultipleClausesCall(
18072
- clauses
18073
- );
18074
- if (!res.every((r) => r.success))
18075
- throw new Error("Failed to fetch voting rewards");
18076
- let total = new BigNumber(0);
18077
- const roundsRewards = res.map((r, index) => {
18078
- const roundId = rounds[index];
18079
- const rewards = r.result.plain;
18080
- const formattedRewards = formatEther(rewards);
18081
- total = total.plus(BigNumber(rewards.toString()));
18082
- queryClient.setQueryData(
18083
- getRoundRewardQueryKey(roundId, voter),
18084
- {
18085
- roundId,
18086
- rewards: formattedRewards
18087
- }
18088
- );
18089
- return {
18090
- roundId,
18091
- rewards,
18092
- formattedRewards
18093
- };
18094
- });
18095
- const totalFormatted = formatEther(BigInt(total.toFixed()));
18096
- return {
18097
- total: total.toFixed(),
18098
- totalFormatted,
18099
- roundsRewards
18100
- };
18101
- }
18102
- });
18103
- };
18104
- var getRoundRewardQueryKey = (roundId, address) => [
18105
- "VECHAIN_KIT",
18106
- "roundReward",
18107
- roundId,
18108
- "voter",
18109
- address
18110
- ];
18111
- var useRoundReward = (address, roundId) => {
18112
- const { network } = useVeChainKitConfig();
18113
- return useCallClause({
18114
- address: getConfig(network.type).voterRewardsContractAddress,
18115
- abi: VoterRewards__factory.abi,
18116
- method: "getReward",
18117
- args: [BigInt(roundId || 0), address],
18118
- queryOptions: {
18119
- enabled: !!address && !!roundId && !!network.type,
18120
- select: (data) => ({
18121
- roundId,
18122
- rewards: formatEther(BigInt(data[0]))
18123
- })
18124
- }
18125
- });
18126
- };
18127
-
18128
- // src/hooks/thor/contracts/X2EarnApps/utils/getXAppMetadata.ts
18129
- var getXAppMetadata = async (uri, networkType) => {
18130
- const url = convertUriToUrl(uri, networkType);
18131
- if (!url) return void 0;
18132
- const response = await fetch(url);
18133
- if (!response.ok) {
18134
- return void 0;
18135
- }
18136
- return response.json();
18137
- };
18138
-
18139
- // src/hooks/thor/contracts/X2EarnApps/utils/getXApps.ts
18140
- var getXApps = async (thor, networkType) => {
18141
- const contract = thor.contracts.load(
18142
- getConfig(networkType).x2EarnAppsContractAddress,
18143
- X2EarnApps__factory.abi
18144
- );
18145
- const clauses = [contract.clause.unendorsedApps(), contract.clause.apps()];
18146
- const res = await thor.transactions.executeMultipleClausesCall(clauses);
18147
- if (!res.every((r) => r.success)) throw new Error(`Failed to fetch xApps`);
18148
- const apps = res[0]?.result.plain;
18149
- const unendorsedApps = res[1]?.result.plain;
18150
- const allApps = {};
18151
- for (const app of apps) {
18152
- allApps[app.id] = {
18153
- id: app.id,
18154
- teamWalletAddress: app.teamWalletAddress,
18155
- name: app.name,
18156
- metadataURI: app.metadataURI,
18157
- createdAtTimestamp: app.createdAtTimestamp.toString()
18158
- };
18159
- }
18160
- for (const app of unendorsedApps) {
18161
- allApps[app.id] = {
18162
- id: app.id,
18163
- teamWalletAddress: app.teamWalletAddress,
18164
- name: app.name,
18165
- metadataURI: app.metadataURI,
18166
- createdAtTimestamp: app.createdAtTimestamp.toString(),
18167
- appAvailableForAllocationVoting: app.appAvailableForAllocationVoting
18168
- };
18169
- }
18170
- const unendorsedIds = new Set(unendorsedApps.map((app) => app.id));
18171
- return {
18172
- allApps: Object.values(allApps),
18173
- active: apps.map((app) => ({
18174
- ...app,
18175
- createdAtTimestamp: app.createdAtTimestamp.toString()
18176
- })),
18177
- unendorsed: unendorsedApps.map((app) => ({
18178
- ...app,
18179
- createdAtTimestamp: app.createdAtTimestamp.toString()
18180
- })),
18181
- endorsed: apps.filter((app) => !unendorsedIds.has(app.id)).map((app) => ({
18182
- ...app,
18183
- createdAtTimestamp: app.createdAtTimestamp.toString()
18184
- }))
18185
- };
18186
- };
18187
- var abi4 = XAllocationVoting__factory.abi;
18188
- var method7 = "getAppsOfRound";
18189
- var getRoundXApps = async (thor, networkType, roundId) => {
18190
- if (!roundId) return [];
18191
- const [xApps] = await executeCallClause({
18192
- thor,
18193
- contractAddress: getConfig(networkType).xAllocationVotingContractAddress,
18194
- abi: abi4,
18195
- method: method7,
18196
- args: [BigInt(roundId)]
18197
- });
18198
- return xApps.map((app) => ({
18199
- id: app.id.toString(),
18200
- teamWalletAddress: app.teamWalletAddress,
18201
- name: app.name,
18202
- metadataURI: app.metadataURI,
18203
- createdAtTimestamp: app.createdAtTimestamp.toString(),
18204
- appAvailableForAllocationVoting: app.appAvailableForAllocationVoting
18205
- }));
18206
- };
18207
- var getRoundXAppsQueryKey = (roundId) => [
18208
- "VECHAIN_KIT",
18209
- "round",
18210
- roundId,
18211
- "getXApps"
18212
- ];
18213
- var useRoundXApps = (roundId) => {
18214
- const thor = useThor();
18215
- const { network } = useVeChainKitConfig();
18216
- return useQuery({
18217
- queryKey: getRoundXAppsQueryKey(roundId),
18218
- queryFn: async () => await getRoundXApps(thor, network.type, roundId),
18219
- enabled: !!thor && !!roundId && !!network.type
18220
- });
18221
- };
18222
- var getUserVotesInRound = async (thor, network, roundId, address) => {
18223
- const xAllocationVotingContract = getConfig(network).xAllocationVotingContractAddress;
18224
- const eventAbi = thor.contracts.load(xAllocationVotingContract, XAllocationVoting__factory.abi).getEventAbi("AllocationVoteCast");
18225
- const topics = eventAbi.encodeFilterTopicsNoNull({
18226
- ...address ? { voter: address } : {},
18227
- ...roundId ? { roundId } : {}
18228
- });
18229
- const filterCriteria = [
18230
- {
18231
- criteria: {
18232
- address: xAllocationVotingContract,
18233
- topic0: topics[0] ?? void 0,
18234
- topic1: topics[1] ?? void 0,
18235
- topic2: topics[2] ?? void 0,
18236
- topic3: topics[3] ?? void 0,
18237
- topic4: topics[4] ?? void 0
18238
- },
18239
- eventAbi
18240
- }
18241
- ];
18242
- const events = await getAllEventLogs({
18243
- thor,
18244
- filterCriteria,
18245
- nodeUrl: getConfig(network).nodeUrl
18246
- });
18247
- const decodedAllocatedVoteEvents = [];
18248
- events.forEach((event) => {
18249
- if (!event.decodedData) {
18250
- throw new Error("Event data not decoded");
18251
- }
18252
- if (!compareAddresses(event.address, xAllocationVotingContract)) {
18253
- throw new Error("Event address not valid");
18254
- }
18255
- const [voter, roundId2, appsIds, voteWeights] = event.decodedData;
18256
- decodedAllocatedVoteEvents.push({
18257
- voter,
18258
- roundId: roundId2,
18259
- appsIds,
18260
- voteWeights
18261
- });
18262
- });
18263
- return decodedAllocatedVoteEvents;
18264
- };
18265
- var getUserVotesInRoundQueryKey = (roundId, address) => [
18266
- "VECHAIN_KIT",
18267
- "allocationsRound",
18268
- roundId,
18269
- "userVotes",
18270
- ...address ? [address] : []
18271
- ];
18272
- var useUserVotesInRound = (roundId, address) => {
18273
- const thor = useThor();
18274
- const { network } = useVeChainKitConfig();
18275
- return useQuery({
18276
- queryKey: getUserVotesInRoundQueryKey(roundId, address),
18277
- queryFn: async () => {
18278
- const votes = await getUserVotesInRound(
18279
- thor,
18280
- network.type,
18281
- roundId,
18282
- address
18283
- );
18284
- if (votes.length > 1) throw new Error("More than one event found");
18285
- if (votes.length === 0) throw new Error("No event found");
18286
- return votes[0];
18287
- },
18288
- enabled: !!thor && !!thor.blocks.getHeadBlock() && !!roundId && !!address && !!network.type
18289
- });
18290
- };
18291
- var getVotesInRoundQueryKey = (roundId) => [
18292
- "VECHAIN_KIT",
18293
- "allocationsRound",
18294
- roundId,
18295
- "totalVotes"
18296
- ];
18297
- var useVotesInRound = (roundId, enabled = true) => {
18298
- const thor = useThor();
18299
- const { network } = useVeChainKitConfig();
18300
- return useQuery({
18301
- queryKey: getVotesInRoundQueryKey(roundId),
18302
- queryFn: async () => await getUserVotesInRound(thor, network.type, roundId),
18303
- enabled: !!thor && !!thor.blocks.getHeadBlock() && !!roundId && enabled && !!network.type
18304
- });
18305
- };
18306
- var getXAppsQueryKey = () => ["VECHAIN_KIT", "getXApps"];
18307
- var useXApps = () => {
18308
- const thor = useThor();
18309
- const { network } = useVeChainKitConfig();
18310
- return useQuery({
18311
- queryKey: getXAppsQueryKey(),
18312
- queryFn: async () => await getXApps(thor, network.type),
18313
- enabled: !!thor && !!network.type
18314
- });
18315
- };
18316
-
18317
- // src/hooks/thor/contracts/X2EarnApps/custom/useXApp.ts
18318
- var useXApp = (appId) => {
18319
- const { data: xApps, ...props } = useXApps();
18320
- const allApps = useMemo(() => [...xApps?.active ?? [], ...xApps?.unendorsed ?? []], [xApps]);
18321
- const app = allApps.find((xa) => xa.id === appId);
18322
- return {
18323
- data: app,
18324
- ...props
18325
- };
18326
- };
18327
- var getXAppMetadataQueryKey = (metadataURI) => [
18328
- "VECHAIN_KIT",
18329
- "xApps",
18330
- metadataURI,
18331
- "metadata"
18332
- ];
18333
- var useXAppMetadata = (xAppId) => {
18334
- const { data: baseUri } = useXAppsMetadataBaseUri();
18335
- const { data: xApp } = useXApp(xAppId ?? "");
18336
- const { network } = useVeChainKitConfig();
18337
- return useQuery({
18338
- queryKey: getXAppMetadataQueryKey(xApp?.metadataURI || ""),
18339
- queryFn: async () => !(!baseUri && xApp) ? await getXAppMetadata(
18340
- `${baseUri}${xApp?.metadataURI}`,
18341
- network.type
18342
- ) : null,
18343
- enabled: !!baseUri && !!xApp && !!network.type
18344
- });
18345
- };
18346
- var getXAppsSharesQueryKey = (roundId) => [
18347
- "VECHAIN_KIT",
18348
- "XApps",
18349
- "Shares",
18350
- roundId
18351
- ];
18352
- var useXAppsShares = (apps, roundId) => {
18353
- const thor = useThor();
18354
- const { network } = useVeChainKitConfig();
18355
- return useQuery({
18356
- queryKey: getXAppsSharesQueryKey(roundId),
18357
- queryFn: async () => {
18358
- const contract = thor.contracts.load(
18359
- getConfig(network.type).xAllocationPoolContractAddress,
18360
- XAllocationPool__factory.abi
18361
- );
18362
- const clauses = apps.map(
18363
- (app) => contract.clause.getAppShares(roundId, app)
18364
- );
18365
- const res = await thor.transactions.executeMultipleClausesCall(
18366
- clauses
18367
- );
18368
- if (!res.every((r) => r.success))
18369
- throw new Error(
18370
- `Failed to fetch xApps shares for ${apps} in round ${roundId}`
18371
- );
18372
- const shares = res.map((r, index) => {
18373
- return {
18374
- app: apps[index],
18375
- share: Number(r.result.array?.[0] || 0) / 100,
18376
- unallocatedShare: Number(r.result.array?.[1] || 0) / 100
18377
- };
18378
- });
18379
- return shares;
18380
- },
18381
- enabled: !!roundId && !!apps.length
18382
- });
18383
- };
18384
-
18385
- // src/hooks/thor/contracts/X2EarnApps/custom/useMostVotedAppsInRound.ts
18386
- var useMostVotedAppsInRound = (roundId) => {
18387
- const { data: roundXApps } = useRoundXApps(roundId);
18388
- const { data: allXApps } = useXApps();
18389
- const apps = roundId === "0" ? allXApps?.active : roundXApps;
18390
- const xAppsShares = useXAppsShares(
18391
- apps?.map((app) => app.id) ?? [],
18392
- roundId
18393
- );
18394
- const mostVotedApps = useMemo(
18395
- () => xAppsShares.data?.map((appShares) => ({
18396
- percentage: appShares.share + appShares.unallocatedShare,
18397
- id: apps?.find((xa) => xa.id === appShares.app)?.id ?? "",
18398
- app: apps?.find((xa) => xa.id === appShares.app) ?? {}
18399
- })).sort((a, b) => Number(b.percentage) - Number(a.percentage)) ?? [],
18400
- [xAppsShares.data, apps]
18401
- );
18402
- return {
18403
- data: mostVotedApps,
18404
- isLoading: xAppsShares.isLoading
18405
- };
18406
- };
18407
-
18408
- // src/hooks/thor/contracts/X2EarnApps/useXAppsMetadataBaseUri.ts
18409
- var abi5 = X2EarnApps__factory.abi;
18410
- var method8 = "baseURI";
18411
- var getXAppsMetadataBaseUriQueryKey = (network) => getCallClauseQueryKeyWithArgs({
18412
- abi: abi5,
18413
- method: method8,
18414
- address: getConfig(network).x2EarnAppsContractAddress,
18415
- args: []
18416
- });
18417
- var useXAppsMetadataBaseUri = () => {
18418
- const { network } = useVeChainKitConfig();
18419
- return useCallClause({
18420
- abi: abi5,
18421
- address: getConfig(network.type).x2EarnAppsContractAddress,
18422
- method: method8,
18423
- args: [],
18424
- queryOptions: {
18425
- enabled: !!network.type,
18426
- staleTime: 1e3 * 60 * 60
18427
- // 1 hour,
18428
- }
18429
- });
18430
- };
18431
- var getXAppRoundEarnings = async (thor, roundId, xAppId, networkType) => {
18432
- const res = await thor.contracts.load(
18433
- getConfig(networkType).xAllocationPoolContractAddress,
18434
- XAllocationPool__factory.abi
18435
- ).read.roundEarnings(roundId, xAppId);
18436
- if (!res)
18437
- throw new Error(
18438
- `Failed to fetch xApp round earnings for ${xAppId} in round ${roundId}`
18439
- );
18440
- return { amount: formatEther(BigInt(res[0] || 0)), appId: xAppId };
18441
- };
18442
- var getXAppRoundEarningsQueryKey = (roundId, xAppId) => [
18443
- "VECHAIN_KIT",
18444
- "roundEarnings",
18445
- "roundId",
18446
- Number(roundId),
18447
- "appId",
18448
- ...xAppId ? [xAppId] : []
18449
- ];
18450
- var useXAppRoundEarnings = (roundId, xAppId) => {
18451
- const thor = useThor();
18452
- const queryClient = getOrCreateQueryClient();
18453
- const { network } = useVeChainKitConfig();
18454
- return useQuery({
18455
- queryKey: getXAppRoundEarningsQueryKey(roundId, xAppId),
18456
- queryFn: async () => {
18457
- const data = await queryClient.ensureQueryData({
18458
- queryFn: () => getRoundXApps(thor, network.type, roundId),
18459
- queryKey: getRoundXAppsQueryKey(roundId)
18460
- });
18461
- const isXAppInRound = data.some((app) => app.id === xAppId);
18462
- if (!isXAppInRound) return { amount: "0", xAppId };
18463
- return await getXAppRoundEarnings(
18464
- thor,
18465
- roundId,
18466
- xAppId,
18467
- network.type
18468
- );
18469
- },
18470
- enabled: !!thor && !!roundId && !!xAppId
18471
- });
18472
- };
18473
- var useMultipleXAppRoundEarnings = (roundId, xAppIds) => {
18474
- const thor = useThor();
18475
- const queryClient = getOrCreateQueryClient();
18476
- const { network } = useVeChainKitConfig();
18477
- return useQuery({
18478
- queryKey: getXAppRoundEarningsQueryKey(roundId, "ALL"),
18479
- queryFn: async () => {
18480
- const data = await queryClient.ensureQueryData({
18481
- queryFn: () => getRoundXApps(thor, network.type, roundId),
18482
- queryKey: getRoundXAppsQueryKey(roundId)
18483
- });
18484
- const xAllocationPoolContract = getConfig(
18485
- network.type
18486
- ).xAllocationPoolContractAddress;
18487
- const xAppsInRound = data.filter((app) => xAppIds.includes(app.id));
18488
- const contract = thor.contracts.load(
18489
- xAllocationPoolContract,
18490
- XAllocationPool__factory.abi
18491
- );
18492
- const clauses = xAppsInRound.map(
18493
- (app) => contract.clause.roundEarnings(roundId, app.id)
18494
- );
18495
- const res = await thor.transactions.executeMultipleClausesCall(
18496
- clauses
18497
- );
18498
- if (!res.every((r) => r.success))
18499
- throw new Error("Failed to fetch xApp round earnings");
18500
- const decoded = res.map((earnings, index) => {
18501
- const parsedAmount = formatEther(
18502
- earnings.result.plain
18503
- );
18504
- const appId = xAppsInRound[index]?.id;
18505
- queryClient.setQueryData(
18506
- getXAppRoundEarningsQueryKey(roundId, appId),
18507
- {
18508
- amount: parsedAmount,
18509
- appId
18510
- }
18511
- );
18512
- return { amount: parsedAmount, appId };
18513
- });
18514
- return decoded;
18515
- },
18516
- enabled: !!thor && !!roundId && !!xAppIds.length
18517
- });
18518
- };
18519
- var getXAppTotalEarningsQueryKey = (tillRoundId, appId) => [
18520
- "VECHAIN_KIT",
18521
- "XAllocationPool",
18522
- "xApp",
18523
- appId,
18524
- "totalEarningsTillRound",
18525
- tillRoundId
18526
- ];
18527
- var useXAppTotalEarnings = (roundIds, appId) => {
18528
- const thor = useThor();
18529
- const { network } = useVeChainKitConfig();
18530
- const queryClient = getOrCreateQueryClient();
18531
- const lastRound = roundIds[roundIds.length - 1] ?? 0;
18532
- return useQuery({
18533
- queryKey: getXAppTotalEarningsQueryKey(lastRound, appId),
18534
- queryFn: async () => {
18535
- const contract = thor.contracts.load(
18536
- getConfig(network.type).xAllocationPoolContractAddress,
18537
- XAllocationPool__factory.abi
18538
- );
18539
- const clauses = roundIds.map(
18540
- (roundId) => contract.clause.roundEarnings(roundId, appId)
18541
- );
18542
- const res = await thor.transactions.executeMultipleClausesCall(
18543
- clauses
18544
- );
18545
- if (!res.every((r) => r.success))
18546
- throw new Error(
18547
- `Failed to fetch xApp total earnings of ${appId}`
18548
- );
18549
- const decoded = res.map((r, index) => {
18550
- const parsedAmount = formatEther(
18551
- r.result.plain || BigInt(0)
18552
- );
18553
- queryClient.setQueryData(
18554
- getXAppRoundEarningsQueryKey(
18555
- roundIds[index],
18556
- appId
18557
- ),
18558
- {
18559
- amount: parsedAmount,
18560
- appId
18561
- }
18562
- );
18563
- return parsedAmount;
18564
- });
18565
- return decoded.reduce((acc, amount) => {
18566
- return acc + Number(amount);
18567
- }, 0);
18568
- }
18569
- });
18570
- };
18571
-
18572
- // src/hooks/thor/contracts/XAllocationVoting/useAllocationsRoundState.ts
18573
- var RoundState = {
18574
- 0: "Active",
18575
- 1: "Failed",
18576
- 2: "Succeeded"
18577
- };
18578
- var abi6 = XAllocationVoting__factory.abi;
18579
- var method9 = "state";
18580
- var getAllocationsRoundStateQueryKey = (roundId, network) => getCallClauseQueryKeyWithArgs({
18581
- abi: abi6,
18582
- method: method9,
18583
- address: getConfig(network).xAllocationVotingContractAddress,
18584
- args: [BigInt(roundId || 0)]
18585
- });
18586
- var useAllocationsRoundState = (roundId) => {
18587
- const { network } = useVeChainKitConfig();
18588
- return useCallClause({
18589
- abi: abi6,
18590
- address: getConfig(network.type).xAllocationVotingContractAddress,
18591
- method: method9,
18592
- args: [BigInt(roundId || 0)],
18593
- queryOptions: {
18594
- enabled: !!roundId && !!network.type,
18595
- select: (data) => data[0]
18596
- }
18597
- });
18598
- };
18599
-
18600
- // src/hooks/thor/contracts/XAllocationVoting/useCurrentAllocationsRoundId.ts
18601
- var abi7 = XAllocationVoting__factory.abi;
18602
- var method10 = "currentRoundId";
18603
- var getCurrentAllocationsRoundIdQueryKey = (network) => getCallClauseQueryKeyWithArgs({
18604
- abi: abi7,
18605
- method: method10,
18606
- address: getConfig(network).xAllocationVotingContractAddress,
18607
- args: []
18608
- });
18609
- var useCurrentAllocationsRoundId = () => {
18610
- const { network } = useVeChainKitConfig();
18611
- return useCallClause({
18612
- abi: abi7,
18613
- address: getConfig(network.type).xAllocationVotingContractAddress,
18614
- method: method10,
18615
- args: [],
18616
- queryOptions: {
18617
- enabled: !!network.type,
18618
- select: (data) => data[0].toString()
18619
- }
18620
- });
18621
- };
18622
-
18623
- // src/hooks/thor/contracts/XAllocationVoting/useHasVotedInRound.ts
18624
- var method11 = "hasVoted";
18625
- var abi8 = XAllocationVoting__factory.abi;
18626
- var getHasVotedInRoundQueryKey = (roundId, address, networkType) => getCallClauseQueryKeyWithArgs({
18627
- abi: abi8,
18628
- address: getConfig(networkType).xAllocationVotingContractAddress,
18629
- method: method11,
18630
- args: [BigInt(roundId || 0), address]
18631
- });
18632
- var useHasVotedInRound = (roundId, address) => {
18633
- const { network } = useVeChainKitConfig();
18634
- return useCallClause({
18635
- abi: abi8,
18636
- address: getConfig(network.type).xAllocationVotingContractAddress,
18637
- method: method11,
18638
- args: [BigInt(roundId || 0), address],
18639
- queryOptions: {
18640
- enabled: !!roundId && !!address,
18641
- select: (data) => data[0]
18642
- }
18643
- });
18644
- };
18645
- var getAllocationsRoundsEvents = async (thor, networkType) => {
18646
- const xAllocationVotingContract = getConfig(networkType).xAllocationVotingContractAddress;
18647
- const eventAbi = thor.contracts.load(xAllocationVotingContract, XAllocationVoting__factory.abi).getEventAbi("RoundCreated");
18648
- const events = await getAllEventLogs({
18649
- thor,
18650
- filterCriteria: [
18651
- {
18652
- criteria: {
18653
- address: xAllocationVotingContract,
18654
- topic0: eventAbi.signatureHash
18655
- },
18656
- eventAbi
18657
- }
18658
- ],
18659
- nodeUrl: getConfig(networkType).nodeUrl
18660
- });
18661
- const decodedCreatedAllocationEvents = [];
18662
- events.forEach((event) => {
18663
- if (!event.decodedData) {
18664
- throw new Error("Event data not decoded");
18665
- }
18666
- if (!compareAddresses(event.address, xAllocationVotingContract)) {
18667
- throw new Error("Event address not valid");
18668
- }
18669
- const [roundId, proposer, voteStart, voteEnd, appsIds] = event.decodedData;
18670
- decodedCreatedAllocationEvents.push({
18671
- roundId: roundId.toString(),
18672
- proposer,
18673
- voteStart: voteStart.toString(),
18674
- voteEnd: voteEnd.toString(),
18675
- appsIds: appsIds.map((appId) => appId.toString())
18676
- });
18677
- });
18678
- return {
18679
- created: decodedCreatedAllocationEvents
18680
- };
18681
- };
18682
- var getAllocationsRoundsEventsQueryKey = () => [
18683
- "VECHAIN_KIT",
18684
- "allocationRoundsEvents"
18685
- ];
18686
- var useAllocationsRoundsEvents = () => {
18687
- const thor = useThor();
18688
- const { network } = useVeChainKitConfig();
18689
- return useQuery({
18690
- queryKey: getAllocationsRoundsEventsQueryKey(),
18691
- queryFn: async () => await getAllocationsRoundsEvents(thor, network.type),
18692
- enabled: !!thor && !!network.type
18693
- });
18694
- };
18695
-
18696
- // src/hooks/thor/contracts/XAllocationVoting/custom/useCurrentAllocationsRound.ts
18697
- var useCurrentAllocationsRound = () => {
18698
- const currentRoundId = useCurrentAllocationsRoundId();
18699
- const allocationsRound = useAllocationsRound(currentRoundId.data);
18700
- return {
18701
- ...allocationsRound,
18702
- isLoading: currentRoundId.isLoading || allocationsRound.isLoading,
18703
- isError: currentRoundId.isError || allocationsRound.isError,
18704
- error: currentRoundId.error || allocationsRound.error
18705
- };
18706
- };
18707
- var useAllocationsRound = (roundId) => {
18708
- const { data: currentBlock } = useCurrentBlock();
18709
- const currentAllocationId = useCurrentAllocationsRoundId();
18710
- const currentAllocationState = useAllocationsRoundState(roundId);
18711
- const allocationRoundsEvents = useAllocationsRoundsEvents();
18712
- const { network } = useVeChainKitConfig();
18713
- const currentAllocationRound = useMemo(() => {
18714
- if (!currentAllocationId.data || !allocationRoundsEvents.data)
18715
- return;
18716
- const roundInfo = allocationRoundsEvents.data.created.find(
18717
- (allocationRound) => allocationRound.roundId === roundId
18718
- );
18719
- if (!roundInfo) return;
18720
- return {
18721
- ...roundInfo,
18722
- state: currentAllocationState.data,
18723
- isCurrent: roundId === currentAllocationId.data
18724
- };
18725
- }, [
18726
- currentAllocationId,
18727
- allocationRoundsEvents,
18728
- currentAllocationState,
18729
- roundId
18730
- ]);
18731
- const isLoading = currentAllocationId.isLoading || allocationRoundsEvents.isLoading || currentAllocationState.isLoading;
18732
- const isError = currentAllocationId.isError || allocationRoundsEvents.isError || currentAllocationState.isError;
18733
- const error = currentAllocationId.error || allocationRoundsEvents.error || currentAllocationState.error;
18734
- const blockTime = getConfig(network.type).network.blockTime;
18735
- const estimatedEndTime = useMemo(() => {
18736
- if (!currentAllocationRound) return null;
18737
- const endBlock = Number(currentAllocationRound.voteEnd);
18738
- if (!endBlock || !currentBlock) return null;
18739
- const endBlockFromNow = endBlock - currentBlock.number;
18740
- const durationLeftTimestamp = endBlockFromNow * blockTime;
18741
- return Date.now() + durationLeftTimestamp;
18742
- }, [currentBlock, currentAllocationRound, blockTime]);
18743
- const estimatedStartTime = useMemo(() => {
18744
- if (!currentAllocationRound) return null;
18745
- const startBlock = Number(currentAllocationRound.voteStart);
18746
- if (!startBlock || !currentBlock) return null;
18747
- const endBlockFromNow = startBlock - currentBlock.number;
18748
- const durationLeftTimestamp = endBlockFromNow * blockTime;
18749
- return Date.now() + durationLeftTimestamp;
18750
- }, [currentBlock, currentAllocationRound, blockTime]);
18751
- const isFirstRound = currentAllocationRound?.roundId === "1";
18752
- const isLastRound = currentAllocationRound?.roundId === allocationRoundsEvents?.data?.created.length.toString();
18753
- return {
18754
- ...allocationRoundsEvents,
18755
- data: {
18756
- ...currentAllocationRound,
18757
- voteStartTimestamp: estimatedStartTime,
18758
- voteEndTimestamp: estimatedEndTime,
18759
- isFirstRound,
18760
- isLastRound
18761
- },
18762
- isLoading,
18763
- isError,
18764
- error
18765
- };
18766
- };
18767
- var contractAbi5 = XAllocationVotingGovernor__factory.abi;
18768
- var method12 = "getAppVotes";
18769
- var getXAppVotesQueryKey = (networkType, roundId, appId) => getCallClauseQueryKeyWithArgs({
18770
- abi: contractAbi5,
18771
- address: getConfig(networkType).xAllocationVotingContractAddress,
18772
- method: method12,
18773
- args: [BigInt(roundId || 0), appId]
18774
- });
18775
- var useXAppVotes = (roundId, appId) => {
18776
- const { network } = useVeChainKitConfig();
18777
- const contractAddress = getConfig(
18778
- network.type
18779
- ).xAllocationVotingContractAddress;
18780
- return useCallClause({
18781
- address: contractAddress,
18782
- abi: contractAbi5,
18783
- method: method12,
18784
- args: [BigInt(roundId || 0), appId],
18785
- queryOptions: {
18786
- enabled: !!roundId && !!appId && !!network.type,
18787
- select: (res) => formatEther(BigInt(res[0]))
18788
- }
18789
- });
18790
- };
18791
-
18792
- // src/hooks/thor/logs/logUtils.ts
18793
- var MAX_EVENTS_PER_QUERY = 1e3;
18794
- var getEventLogs = async ({
18795
- thor,
18796
- order = "asc",
18797
- offset = 0,
18798
- limit = MAX_EVENTS_PER_QUERY,
18799
- from = 0,
18800
- to = thor.blocks.getHeadBlock()?.number,
18801
- filterCriteria
18802
- }) => {
18803
- const response = await thor.logs.filterEventLogs({
18804
- range: {
18805
- from,
18806
- to,
18807
- unit: "block"
18808
- },
18809
- options: {
18810
- offset,
18811
- limit
18812
- },
18813
- order,
18814
- criteriaSet: filterCriteria
18815
- });
18816
- if (!response) throw new Error("Failed to fetch events");
18817
- return response;
18818
- };
18819
- var getAllEventLogs = async ({
18820
- nodeUrl,
18821
- thor,
18822
- order = "asc",
18823
- from = 0,
18824
- to,
18825
- filterCriteria
18826
- }) => {
18827
- const allEvents = [];
18828
- let offset = 0;
18829
- while (true) {
18830
- const events = await getEventLogs({
18831
- thor,
18832
- filterCriteria,
18833
- from,
18834
- to: to ?? Number.MAX_SAFE_INTEGER,
18835
- limit: MAX_EVENTS_PER_QUERY,
18836
- order,
18837
- offset
18838
- });
18839
- allEvents.push(...events);
18840
- if (events.length < MAX_EVENTS_PER_QUERY) {
18841
- return allEvents;
18842
- }
18843
- offset += MAX_EVENTS_PER_QUERY;
18844
- }
17822
+ var getAllEventLogs = async ({
17823
+ nodeUrl,
17824
+ thor,
17825
+ order = "asc",
17826
+ from = 0,
17827
+ to,
17828
+ filterCriteria
17829
+ }) => {
17830
+ const allEvents = [];
17831
+ let offset = 0;
17832
+ while (true) {
17833
+ const events = await getEventLogs({
17834
+ thor,
17835
+ filterCriteria,
17836
+ from,
17837
+ to: to ?? Number.MAX_SAFE_INTEGER,
17838
+ limit: MAX_EVENTS_PER_QUERY,
17839
+ order,
17840
+ offset
17841
+ });
17842
+ allEvents.push(...events);
17843
+ if (events.length < MAX_EVENTS_PER_QUERY) {
17844
+ return allEvents;
17845
+ }
17846
+ offset += MAX_EVENTS_PER_QUERY;
17847
+ }
18845
17848
  };
18846
17849
 
18847
17850
  // src/hooks/thor/transactions/transactionUtils.ts
@@ -19197,6 +18200,164 @@ var useTxReceipt = (txId, blockTimeout = 5) => {
19197
18200
  enabled: !!txId
19198
18201
  });
19199
18202
  };
18203
+
18204
+ // src/hooks/utils/useEvents.ts
18205
+ var decodeEventLog = (event, abi9) => {
18206
+ const decodedData = decodeEventLog$1({
18207
+ abi: abi9,
18208
+ data: event.data.toString(),
18209
+ topics: event.topics.map((topic) => topic.toString())
18210
+ });
18211
+ return {
18212
+ meta: event.meta,
18213
+ decodedData
18214
+ };
18215
+ };
18216
+ var getEventsKey = ({
18217
+ eventName,
18218
+ filterParams
18219
+ }) => {
18220
+ return [eventName, filterParams ? JSON.stringify(filterParams) : "all"];
18221
+ };
18222
+ var useEvents = ({
18223
+ abi: abi9,
18224
+ contractAddress,
18225
+ eventName,
18226
+ filterParams,
18227
+ mapResponse,
18228
+ nodeUrl
18229
+ }) => {
18230
+ const thor = useThor();
18231
+ const queryFn = useCallback(async () => {
18232
+ if (!thor) return [];
18233
+ const eventAbi = thor.contracts.load(contractAddress, abi9).getEventAbi(eventName);
18234
+ const topics = eventAbi.encodeFilterTopicsNoNull(filterParams ?? {});
18235
+ const filterCriteria = [
18236
+ {
18237
+ criteria: {
18238
+ address: contractAddress,
18239
+ topic0: topics[0] ?? void 0,
18240
+ topic1: topics[1] ?? void 0,
18241
+ topic2: topics[2] ?? void 0,
18242
+ topic3: topics[3] ?? void 0,
18243
+ topic4: topics[4] ?? void 0
18244
+ },
18245
+ eventAbi
18246
+ }
18247
+ ];
18248
+ const events = (await getAllEventLogs({ thor, nodeUrl, filterCriteria })).map((event) => decodeEventLog(event, abi9));
18249
+ if (events.some(
18250
+ ({ decodedData }) => decodedData.eventName !== eventName
18251
+ ))
18252
+ throw new Error(`Unknown event`);
18253
+ return events.map(
18254
+ (event) => mapResponse({
18255
+ meta: event.meta,
18256
+ decodedData: event.decodedData
18257
+ })
18258
+ );
18259
+ }, [
18260
+ thor,
18261
+ contractAddress,
18262
+ abi9,
18263
+ eventName,
18264
+ filterParams,
18265
+ mapResponse,
18266
+ nodeUrl
18267
+ ]);
18268
+ const queryKey = useMemo(
18269
+ () => getEventsKey({ eventName, filterParams }),
18270
+ [eventName, filterParams]
18271
+ );
18272
+ return useQuery({
18273
+ queryFn,
18274
+ queryKey,
18275
+ enabled: !!thor
18276
+ });
18277
+ };
18278
+ var LocalStorageKey = /* @__PURE__ */ ((LocalStorageKey2) => {
18279
+ LocalStorageKey2["CUSTOM_TOKENS"] = "vechain_kit_custom_tokens";
18280
+ LocalStorageKey2["ECOSYSTEM_SHORTCUTS"] = "vechain-kit-ecosystem-shortcuts";
18281
+ LocalStorageKey2["CURRENCY"] = "vechain_kit_currency";
18282
+ LocalStorageKey2["NODE_URL"] = "vechain_kit_node_url";
18283
+ LocalStorageKey2["NETWORK"] = "vechain_kit_network";
18284
+ return LocalStorageKey2;
18285
+ })(LocalStorageKey || {});
18286
+ var useLocalStorage = (key, initialValue) => {
18287
+ const [storedValue, setStoredValue] = useState(() => {
18288
+ try {
18289
+ const item = window.localStorage.getItem(key);
18290
+ return item ? JSON.parse(item) : initialValue;
18291
+ } catch (error) {
18292
+ console.error(error);
18293
+ return initialValue;
18294
+ }
18295
+ });
18296
+ useEffect(() => {
18297
+ window.localStorage.setItem(key, JSON.stringify(storedValue));
18298
+ }, [key, storedValue]);
18299
+ return [storedValue, setStoredValue];
18300
+ };
18301
+ var useSyncableLocalStorage = (key, defaultValue) => {
18302
+ const [value, setValue] = useState(() => {
18303
+ if (typeof window === "undefined") return defaultValue;
18304
+ try {
18305
+ const stored = window.localStorage.getItem(key);
18306
+ return stored ? JSON.parse(stored) : defaultValue;
18307
+ } catch (err) {
18308
+ console.error("Error loading from localStorage:", err);
18309
+ return defaultValue;
18310
+ }
18311
+ });
18312
+ useEffect(() => {
18313
+ if (typeof window === "undefined") return;
18314
+ try {
18315
+ window.localStorage.setItem(key, JSON.stringify(value));
18316
+ } catch (err) {
18317
+ console.error("Error writing to localStorage:", err);
18318
+ }
18319
+ }, [key, value]);
18320
+ const sync = useCallback(() => {
18321
+ if (typeof window === "undefined") return;
18322
+ try {
18323
+ const stored = window.localStorage.getItem(key);
18324
+ setValue(stored ? JSON.parse(stored) : defaultValue);
18325
+ } catch (err) {
18326
+ console.error("Error syncing localStorage:", err);
18327
+ }
18328
+ }, [key, defaultValue]);
18329
+ const getValue = useCallback(() => {
18330
+ if (typeof window === "undefined") return defaultValue;
18331
+ const stored = window.localStorage.getItem(key);
18332
+ return stored ? JSON.parse(stored) : defaultValue;
18333
+ }, [key, defaultValue]);
18334
+ return [value, setValue, sync, getValue];
18335
+ };
18336
+
18337
+ // src/hooks/cache/useEcosystemShortcuts.ts
18338
+ var useEcosystemShortcuts = () => {
18339
+ const [shortcuts, setShortcuts] = useLocalStorage(
18340
+ "vechain-kit-ecosystem-shortcuts" /* ECOSYSTEM_SHORTCUTS */,
18341
+ []
18342
+ );
18343
+ const addShortcut = (shortcut) => {
18344
+ if (!shortcuts.some((s) => s.url === shortcut.url)) {
18345
+ setShortcuts([...shortcuts, shortcut]);
18346
+ }
18347
+ };
18348
+ const removeShortcut = (url) => {
18349
+ setShortcuts(shortcuts.filter((s) => s.url !== url));
18350
+ };
18351
+ const isShortcut = (url) => {
18352
+ return shortcuts.some((s) => s.url === url);
18353
+ };
18354
+ return {
18355
+ shortcuts,
18356
+ addShortcut,
18357
+ removeShortcut,
18358
+ isShortcut
18359
+ };
18360
+ };
19200
18361
  var AddressDisplayCard = ({
19201
18362
  label,
19202
18363
  address,
@@ -19209,16 +18370,14 @@ var AddressDisplayCard = ({
19209
18370
  }) => {
19210
18371
  const { darkMode: isDark } = useVeChainKitConfig();
19211
18372
  const { t } = useTranslation();
19212
- const { isLoading: totalBalanceLoading } = useTotalBalance({
19213
- address
19214
- });
19215
- const { tokens: tokens2, isLoading: tokensLoading } = useTokensWithValues({
18373
+ const { isLoading: totalBalanceLoading } = useTotalBalance({ address });
18374
+ const { tokens, isLoading: tokensLoading } = useTokensWithValues({
19216
18375
  address
19217
18376
  });
19218
18377
  const tokenData = useMemo(() => {
19219
18378
  if (!tokenAddress) return null;
19220
- return tokens2.find((token) => token.address === tokenAddress);
19221
- }, [tokens2, tokenAddress]);
18379
+ return tokens.find((token) => token.address === tokenAddress);
18380
+ }, [tokens, tokenAddress]);
19222
18381
  const displayBalance = useMemo(() => {
19223
18382
  if (balance !== void 0) return balance;
19224
18383
  if (tokenData) {
@@ -20488,7 +19647,7 @@ var useVeChainKitConfig = () => {
20488
19647
  var validateConfig = (props) => {
20489
19648
  const errors = [];
20490
19649
  const requiresFeeDelegation = props.privy !== void 0 || props.loginMethods?.some(
20491
- (method13) => method13.method === "vechain" || method13.method === "ecosystem"
19650
+ (method7) => method7.method === "vechain" || method7.method === "ecosystem"
20492
19651
  );
20493
19652
  if (requiresFeeDelegation) {
20494
19653
  if (!props.feeDelegation) {
@@ -20516,7 +19675,7 @@ var validateConfig = (props) => {
20516
19675
  if (props.loginMethods) {
20517
19676
  if (!props.privy) {
20518
19677
  const invalidMethods = props.loginMethods.filter(
20519
- (method13) => ["email", "google", "passkey", "more"].includes(method13.method)
19678
+ (method7) => ["email", "google", "passkey", "more"].includes(method7.method)
20520
19679
  );
20521
19680
  if (invalidMethods.length > 0) {
20522
19681
  errors.push(
@@ -20581,7 +19740,7 @@ var VeChainKitProvider = (props) => {
20581
19740
  const validatedLoginMethods = loginMethods;
20582
19741
  const allowedEcosystemApps = useMemo(() => {
20583
19742
  const userEcosystemMethods = validatedLoginMethods?.find(
20584
- (method13) => method13.method === "ecosystem"
19743
+ (method7) => method7.method === "ecosystem"
20585
19744
  );
20586
19745
  return userEcosystemMethods?.allowedApps ?? DEFAULT_PRIVY_ECOSYSTEM_APPS.map((app) => app.id);
20587
19746
  }, [validatedLoginMethods]);
@@ -21115,6 +20274,6 @@ var VechainKitThemeProvider = ({
21115
20274
  ] });
21116
20275
  };
21117
20276
 
21118
- export { AccessAndSecurityContent, AccessAndSecurityModalProvider, AccountAvatar, AccountCustomizationModalProvider, AccountDetailsButton, AccountMainContent, AccountModal, AccountModalProvider, AccountSelector, ActionButton, AddressDisplay, AddressDisplayCard, AppearanceSettingsContent, AssetButton, AssetsContent, BalanceSection, BaseModal, BridgeContent, ChangeCurrencyContent, ChooseNameContent, ChooseNameModalProvider, ChooseNameSearchContent, ChooseNameSummaryContent, ConnectModal, ConnectModalProvider, ConnectPopover, ConnectionButton, CrossAppConnectionSecurityCard, CustomizationContent, CustomizationSummaryContent, DappKitButton, DisconnectConfirmContent, DomainRequiredAlert, EcosystemButton, EcosystemModal, EmailLoginButton, EmbeddedWalletContent, ExchangeWarningAlert, ExploreEcosystemModalProvider, FAQContent, FAQModalProvider, FadeInView, FadeInViewFromBottom, FadeInViewFromLeft, FadeInViewFromRight, FeatureAnnouncementCard, GeneralSettingsContent, LanguageSettingsContent, LegalDocumentItem, LegalDocumentsModal, LegalDocumentsProvider, LocalStorageKey, LoginLoadingModal, LoginWithGoogleButton, MAX_IMAGE_SIZE, MainContent, ManageCustomTokenContent, ModalBackButton, ModalFAQButton, ModalNotificationButton, NotificationsModalProvider, PRICE_FEED_IDS, PasskeyLoginButton, PrivyButton, PrivyWalletProvider, ProfileCard, ProfileContent, ProfileModalProvider, QuickActionsSection, ReceiveModalProvider, ReceiveTokenContent, RoundState, ScrollToTopWrapper, SelectTokenContent, SendTokenContent, SendTokenModalProvider, SendTokenSummaryContent, SettingsContent, ShareButtons, SocialIcons, StickyFooterContainer, StickyHeaderContainer, SwapTokenContent, TermsAndPrivacyContent, TransactionButtonAndStatus, TransactionModal, TransactionModalContent, TransactionModalProvider, TransactionToast, TransactionToastProvider, UpgradeSmartAccountContent, UpgradeSmartAccountModal, UpgradeSmartAccountModalProvider, VeChainKitContext, VeChainKitProvider, VeChainLoginButton, VeChainWithPrivyLoginButton, VechainKitThemeProvider, VersionFooter, WalletButton, WalletModalProvider, compressImages, currentBlockQueryKey, fetchAppHubApps, fetchPrivyAppInfo, fetchPrivyStatus, fetchVechainDomain, getAccountAddress, getAccountAddressQueryKey, getAccountBalance, getAccountBalanceQueryKey, getAccountImplementationAddress, getAccountImplementationAddressQueryKey, getAccountVersionQueryKey, getAllEventLogs, getAllocationsRoundStateQueryKey, getAllocationsRoundsEvents, getAllocationsRoundsEventsQueryKey, getAppHubAppsQueryKey, getAvatar, getAvatarLegacy, getAvatarLegacyQueryKey, getAvatarOfAddressQueryKey, getAvatarQueryKey, getB3trBalance, getB3trBalanceQueryKey, getCallClauseQueryKey, getCallClauseQueryKeyWithArgs, getChainId, getChainIdQueryKey, getCurrentAccountImplementationVersion, getCurrentAccountImplementationVersionQueryKey, getCurrentAllocationsRoundIdQueryKey, getCustomTokenBalance, getCustomTokenBalanceQueryKey, getCustomTokenInfo, getDomainsOfAddress, getDomainsOfAddressQueryKey, getEnsRecordExistsQueryKey, getErc20Balance, getErc20BalanceQueryKey, getEventLogs, getHasV1SmartAccount, getHasV1SmartAccountQueryKey, getHasVotedInRoundQueryKey, getIpfsImage, getIpfsImageQueryKey, getIpfsMetadata, getIpfsMetadataQueryKey, getIsDeployed, getIsDeployedQueryKey, getIsDomainProtectedQueryKey, getIsPersonAtTimepointQueryKey, getIsPersonQueryKey, getPrivyAppInfoQueryKey, getResolverAddressQueryKey, getRoundRewardQueryKey, getRoundXApps, getRoundXAppsQueryKey, getSmartAccount, getSmartAccountQueryKey, getTextRecords, getTextRecordsQueryKey, getTokenInfo, getTokenUsdPrice, getTokenUsdPriceQueryKey, getTokensInfoByOwnerQueryKey, getUpgradeRequired, getUpgradeRequiredForAccount, getUpgradeRequiredForAccountQueryKey, getUpgradeRequiredQueryKey, getUserBotSignalsQueryKey, getUserNodesQueryKey, getUserVotesInRound, getUserVotesInRoundQueryKey, getVeDelegateBalance, getVeDelegateBalanceQueryKey, getVechainDomainQueryKey, getVersion, getVersionQueryKey, getVot3Balance, getVot3BalanceQueryKey, getVotesInRoundQueryKey, getXAppMetadata, getXAppMetadataQueryKey, getXAppRoundEarnings, getXAppRoundEarningsQueryKey, getXAppTotalEarningsQueryKey, getXAppVotesQueryKey, getXApps, getXAppsMetadataBaseUriQueryKey, getXAppsQueryKey, getXAppsSharesQueryKey, imageCompressionOptions, txReceiptQueryKey, useAccessAndSecurityModal, useAccountBalance, useAccountCustomizationModal, useAccountImplementationAddress, useAccountModal, useAllocationsRound, useAllocationsRoundState, useAllocationsRoundsEvents, useAppHubApps, useBuildTransaction, useCallClause, useChooseNameModal, useClaimVeWorldSubdomain, useClaimVetDomain, useConnectModal, useCrossAppConnectionCache, useCurrency, useCurrentAccountImplementationVersion, useCurrentAllocationsRound, useCurrentAllocationsRoundId, useCurrentBlock, useCustomTokens, useEcosystemShortcuts, useEnsRecordExists, useExploreEcosystemModal, useFAQModal, useFeatureAnnouncement, useFetchAppInfo, useFetchPrivyStatus, useGalaxyMemberTokensInfo, useGetAccountAddress, useGetAccountVersion, useGetAvatar, useGetAvatarLegacy, useGetAvatarOfAddress, useGetB3trBalance, useGetChainId, useGetCustomTokenBalances, useGetCustomTokenInfo, useGetDomainsOfAddress, useGetErc20Balance, useGetNodeUrl, useGetResolverAddress, useGetTextRecords, useGetTokenUsdPrice, useGetUserNode, useGetUserNodes, useGetVeDelegateBalance, useGetVot3Balance, useHasV1SmartAccount, useHasVotedInRound, useIpfsImage, useIpfsImageList, useIpfsMetadata, useIpfsMetadatas, useIsDomainProtected, useIsPWA, useIsPerson, useIsPersonAtTimepoint, useIsSmartAccountDeployed, useIsUserPerson, useLegalDocuments, useLocalStorage, useLoginModalContent, useLoginWithOAuth2 as useLoginWithOAuth, useLoginWithPasskey, useLoginWithVeChain, useMostVotedAppsInRound, useMultipleXAppRoundEarnings, useNotificationAlerts, useNotifications, useNotificationsModal, usePrivyWalletProvider, useProfileModal, useReceiveModal, useRefreshBalances, useRefreshFactoryQueries, useRefreshMetadata, useRefreshSmartAccountQueries, useRoundReward, useRoundXApps, useScrollToTop, useSendTokenModal, useSendTransaction, useSignMessage2 as useSignMessage, useSignTypedData2 as useSignTypedData, useSingleImageUpload, useSmartAccount, useSmartAccountVersion, useSyncableLocalStorage, useTokenBalances, useTokenBalances2, useTokenPrices, useTokenPrices2, useTokensWithValues, useTotalBalance, useTransactionModal, useTransactionToast, useTransferERC20, useTransferVET, useTxReceipt, useUnsetDomain, useUpdateTextRecord, useUpgradeRequired, useUpgradeRequiredForAccount, useUpgradeSmartAccount, useUpgradeSmartAccountModal, useUploadImages, useUserBotSignals, useUserVotesInRound, useVeChainKitConfig, useVechainDomain, useVotesInRound, useVotingRewards, useWallet, useWalletMetadata, useWalletModal2 as useWalletModal, useXApp, useXAppMetadata, useXAppRoundEarnings, useXAppTotalEarnings, useXAppVotes, useXApps, useXAppsMetadataBaseUri, useXAppsShares };
20277
+ export { AccessAndSecurityContent, AccessAndSecurityModalProvider, AccountAvatar, AccountCustomizationModalProvider, AccountDetailsButton, AccountMainContent, AccountModal, AccountModalProvider, AccountSelector, ActionButton, AddressDisplay, AddressDisplayCard, AppearanceSettingsContent, AssetButton, AssetsContent, BalanceSection, BaseModal, BridgeContent, ChangeCurrencyContent, ChooseNameContent, ChooseNameModalProvider, ChooseNameSearchContent, ChooseNameSummaryContent, ConnectModal, ConnectModalProvider, ConnectPopover, ConnectionButton, CrossAppConnectionSecurityCard, CustomizationContent, CustomizationSummaryContent, DappKitButton, DisconnectConfirmContent, DomainRequiredAlert, EcosystemButton, EcosystemModal, EmailLoginButton, EmbeddedWalletContent, ExchangeWarningAlert, ExploreEcosystemModalProvider, FAQContent, FAQModalProvider, FadeInView, FadeInViewFromBottom, FadeInViewFromLeft, FadeInViewFromRight, FeatureAnnouncementCard, GeneralSettingsContent, LanguageSettingsContent, LegalDocumentItem, LegalDocumentsModal, LegalDocumentsProvider, LocalStorageKey, LoginLoadingModal, LoginWithGoogleButton, MAX_IMAGE_SIZE, MainContent, ManageCustomTokenContent, ModalBackButton, ModalFAQButton, ModalNotificationButton, NotificationsModalProvider, PRICE_FEED_IDS, PasskeyLoginButton, PrivyButton, PrivyWalletProvider, ProfileCard, ProfileContent, ProfileModalProvider, QuickActionsSection, ReceiveModalProvider, ReceiveTokenContent, ScrollToTopWrapper, SelectTokenContent, SendTokenContent, SendTokenModalProvider, SendTokenSummaryContent, SettingsContent, ShareButtons, SocialIcons, StickyFooterContainer, StickyHeaderContainer, SwapTokenContent, TermsAndPrivacyContent, TransactionButtonAndStatus, TransactionModal, TransactionModalContent, TransactionModalProvider, TransactionToast, TransactionToastProvider, UpgradeSmartAccountContent, UpgradeSmartAccountModal, UpgradeSmartAccountModalProvider, VeChainKitContext, VeChainKitProvider, VeChainLoginButton, VeChainWithPrivyLoginButton, VechainKitThemeProvider, VersionFooter, WalletButton, WalletModalProvider, compressImages, currentBlockQueryKey, decodeEventLog, fetchAppHubApps, fetchPrivyAppInfo, fetchPrivyStatus, fetchVechainDomain, getAccountAddress, getAccountAddressQueryKey, getAccountBalance, getAccountBalanceQueryKey, getAccountImplementationAddress, getAccountImplementationAddressQueryKey, getAccountVersionQueryKey, getAllEventLogs, getAppHubAppsQueryKey, getAvatar, getAvatarLegacy, getAvatarLegacyQueryKey, getAvatarOfAddressQueryKey, getAvatarQueryKey, getB3trBalance, getB3trBalanceQueryKey, getCallClauseQueryKey, getCallClauseQueryKeyWithArgs, getChainId, getChainIdQueryKey, getCurrentAccountImplementationVersion, getCurrentAccountImplementationVersionQueryKey, getCurrentAllocationsRoundIdQueryKey, getCustomTokenBalance, getCustomTokenBalanceQueryKey, getCustomTokenInfo, getDomainsOfAddress, getDomainsOfAddressQueryKey, getEnsRecordExistsQueryKey, getErc20Balance, getErc20BalanceQueryKey, getEventLogs, getEventsKey, getHasV1SmartAccount, getHasV1SmartAccountQueryKey, getIpfsImage, getIpfsImageQueryKey, getIpfsMetadata, getIpfsMetadataQueryKey, getIsDeployed, getIsDeployedQueryKey, getIsDomainProtectedQueryKey, getIsPersonQueryKey, getPrivyAppInfoQueryKey, getResolverAddressQueryKey, getRoundXAppsQueryKey, getSmartAccount, getSmartAccountQueryKey, getTextRecords, getTextRecordsQueryKey, getTokenInfo, getTokenUsdPrice, getTokenUsdPriceQueryKey, getUpgradeRequired, getUpgradeRequiredForAccount, getUpgradeRequiredForAccountQueryKey, getUpgradeRequiredQueryKey, getVechainDomainQueryKey, getVersion, getVersionQueryKey, getVot3Balance, getVot3BalanceQueryKey, getXAppMetadata, getXAppsSharesQueryKey, imageCompressionOptions, txReceiptQueryKey, useAccessAndSecurityModal, useAccountBalance, useAccountCustomizationModal, useAccountImplementationAddress, useAccountModal, useAppHubApps, useBuildTransaction, useCallClause, useChooseNameModal, useClaimVeWorldSubdomain, useClaimVetDomain, useConnectModal, useCrossAppConnectionCache, useCurrency, useCurrentAccountImplementationVersion, useCurrentAllocationsRoundId, useCurrentBlock, useCustomTokens, useEcosystemShortcuts, useEnsRecordExists, useEvents, useExploreEcosystemModal, useFAQModal, useFeatureAnnouncement, useFetchAppInfo, useFetchPrivyStatus, useGetAccountAddress, useGetAccountVersion, useGetAvatar, useGetAvatarLegacy, useGetAvatarOfAddress, useGetB3trBalance, useGetChainId, useGetCustomTokenBalances, useGetCustomTokenInfo, useGetDomainsOfAddress, useGetErc20Balance, useGetNodeUrl, useGetResolverAddress, useGetTextRecords, useGetTokenUsdPrice, useGetVot3Balance, useHasV1SmartAccount, useIpfsImage, useIpfsImageList, useIpfsMetadata, useIpfsMetadatas, useIsDomainProtected, useIsPWA, useIsPerson, useIsSmartAccountDeployed, useLegalDocuments, useLocalStorage, useLoginModalContent, useLoginWithOAuth2 as useLoginWithOAuth, useLoginWithPasskey, useLoginWithVeChain, useMostVotedAppsInRound, useMultipleClausesCall, useNotificationAlerts, useNotifications, useNotificationsModal, usePrivyWalletProvider, useProfileModal, useReceiveModal, useRefreshBalances, useRefreshFactoryQueries, useRefreshMetadata, useRefreshSmartAccountQueries, useRoundXApps, useScrollToTop, useSendTokenModal, useSendTransaction, useSignMessage2 as useSignMessage, useSignTypedData2 as useSignTypedData, useSingleImageUpload, useSmartAccount, useSmartAccountVersion, useSyncableLocalStorage, useTokenBalances, useTokenPrices, useTokensWithValues, useTotalBalance, useTransactionModal, useTransactionToast, useTransferERC20, useTransferVET, useTxReceipt, useUnsetDomain, useUpdateTextRecord, useUpgradeRequired, useUpgradeRequiredForAccount, useUpgradeSmartAccount, useUpgradeSmartAccountModal, useUploadImages, useVeChainKitConfig, useVechainDomain, useWallet, useWalletMetadata, useWalletModal2 as useWalletModal, useXAppMetadata, useXAppsShares };
21119
20278
  //# sourceMappingURL=index.js.map
21120
20279
  //# sourceMappingURL=index.js.map