@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.cjs +586 -1472
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +215 -1294
- package/dist/index.d.ts +215 -1294
- package/dist/index.js +615 -1456
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/{thorUtils-BOhp47ZG.d.cts → thorUtils-IptLtkeL.d.cts} +1 -1
- package/dist/{thorUtils-BOhp47ZG.d.ts → thorUtils-IptLtkeL.d.ts} +1 -1
- package/dist/utils/index.d.cts +2 -2
- package/dist/utils/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23,10 +23,11 @@ var ethers = require('ethers');
|
|
|
23
23
|
var sdkCore = require('@vechain/sdk-core');
|
|
24
24
|
var viem = require('viem');
|
|
25
25
|
var zod = require('zod');
|
|
26
|
+
var bignumber_js = require('bignumber.js');
|
|
26
27
|
var wagmi = require('wagmi');
|
|
27
28
|
var rainbowKit = require('@privy-io/cross-app-connect/rainbow-kit');
|
|
28
29
|
var reactDeviceDetect = require('react-device-detect');
|
|
29
|
-
var
|
|
30
|
+
var axios = require('axios');
|
|
30
31
|
var imageCompression = require('browser-image-compression');
|
|
31
32
|
var lu = require('react-icons/lu');
|
|
32
33
|
var md = require('react-icons/md');
|
|
@@ -58,7 +59,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
58
59
|
var i18n__default = /*#__PURE__*/_interopDefault(i18n);
|
|
59
60
|
var React10__default = /*#__PURE__*/_interopDefault(React10);
|
|
60
61
|
var VeChainKitMixpanel__default = /*#__PURE__*/_interopDefault(VeChainKitMixpanel);
|
|
61
|
-
var
|
|
62
|
+
var axios__default = /*#__PURE__*/_interopDefault(axios);
|
|
62
63
|
var imageCompression__default = /*#__PURE__*/_interopDefault(imageCompression);
|
|
63
64
|
var createCache__default = /*#__PURE__*/_interopDefault(createCache);
|
|
64
65
|
|
|
@@ -4361,15 +4362,15 @@ var Analytics = {
|
|
|
4361
4362
|
loginMethod
|
|
4362
4363
|
});
|
|
4363
4364
|
},
|
|
4364
|
-
tryAgain: (
|
|
4365
|
+
tryAgain: (method7, platform) => {
|
|
4365
4366
|
Analytics.auth.trackAuth("try_again", {
|
|
4366
|
-
loginMethod:
|
|
4367
|
+
loginMethod: method7,
|
|
4367
4368
|
platform
|
|
4368
4369
|
});
|
|
4369
4370
|
},
|
|
4370
|
-
methodSelected: (
|
|
4371
|
+
methodSelected: (method7) => {
|
|
4371
4372
|
Analytics.auth.trackAuth("method_selected", {
|
|
4372
|
-
loginMethod:
|
|
4373
|
+
loginMethod: method7
|
|
4373
4374
|
});
|
|
4374
4375
|
},
|
|
4375
4376
|
completed: ({
|
|
@@ -4824,7 +4825,7 @@ var AddressDisplay = ({
|
|
|
4824
4825
|
|
|
4825
4826
|
// package.json
|
|
4826
4827
|
var package_default = {
|
|
4827
|
-
version: "2.0.0-rc.
|
|
4828
|
+
version: "2.0.0-rc.5"};
|
|
4828
4829
|
var VersionFooter = ({ ...props }) => {
|
|
4829
4830
|
const { darkMode: isDark } = useVeChainKitConfig();
|
|
4830
4831
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -6127,13 +6128,13 @@ var useUnsetDomain = ({
|
|
|
6127
6128
|
}
|
|
6128
6129
|
};
|
|
6129
6130
|
};
|
|
6130
|
-
var useTokenBalances = (
|
|
6131
|
+
var useTokenBalances = (address) => {
|
|
6131
6132
|
const { network } = useVeChainKitConfig();
|
|
6132
6133
|
const config = chunkLMX37RCG_cjs.getConfig(network.type);
|
|
6133
6134
|
const { data: vetData, isLoading: vetLoading } = useAccountBalance(address);
|
|
6134
6135
|
const { data: b3trBalance, isLoading: b3trLoading } = useGetB3trBalance(address);
|
|
6135
6136
|
const { data: vot3Balance, isLoading: vot3Loading } = useGetVot3Balance(address);
|
|
6136
|
-
const { data: veDelegateBalance, isLoading: veDelegateLoading } =
|
|
6137
|
+
const { data: veDelegateBalance, isLoading: veDelegateLoading } = useGetErc20Balance(config.veDelegateTokenContractAddress, address);
|
|
6137
6138
|
const { data: gloDollarBalance, isLoading: gloDollarLoading } = useGetErc20Balance(config.gloDollarContractAddress, address);
|
|
6138
6139
|
const customTokenBalancesQueries = useGetCustomTokenBalances(address);
|
|
6139
6140
|
const customTokenBalances = customTokenBalancesQueries.map((query) => query.data).filter(Boolean);
|
|
@@ -6206,6 +6207,36 @@ var useTokenBalances = ({ address = "" }) => {
|
|
|
6206
6207
|
isLoading
|
|
6207
6208
|
};
|
|
6208
6209
|
};
|
|
6210
|
+
var PRICE_FEED_IDS = {
|
|
6211
|
+
B3TR: "0x623374722d757364000000000000000000000000000000000000000000000000",
|
|
6212
|
+
VET: "0x7665742d75736400000000000000000000000000000000000000000000000000",
|
|
6213
|
+
VTHO: "0x7674686f2d757364000000000000000000000000000000000000000000000000",
|
|
6214
|
+
GBP: "0x6762702d75736400000000000000000000000000000000000000000000000000",
|
|
6215
|
+
EUR: "0x657572742d757364000000000000000000000000000000000000000000000000"
|
|
6216
|
+
};
|
|
6217
|
+
var getTokenUsdPrice = async (thor, token, network) => {
|
|
6218
|
+
const res = await thor.contracts.load(
|
|
6219
|
+
chunkLMX37RCG_cjs.getConfig(network).oracleContractAddress,
|
|
6220
|
+
chunk5GZ7N47F_cjs.IVechainEnergyOracleV1__factory.abi
|
|
6221
|
+
).read.getLatestValue(PRICE_FEED_IDS[token]);
|
|
6222
|
+
if (!res) throw new Error(`Failed to get price of ${token}`);
|
|
6223
|
+
return new bignumber_js.BigNumber(res[0].toString()).div(1e12).toNumber();
|
|
6224
|
+
};
|
|
6225
|
+
var getTokenUsdPriceQueryKey = (token) => [
|
|
6226
|
+
"VECHAIN_KIT_PRICE",
|
|
6227
|
+
token
|
|
6228
|
+
];
|
|
6229
|
+
var useGetTokenUsdPrice = (token) => {
|
|
6230
|
+
const thor = dappKitReact.useThor();
|
|
6231
|
+
const { network } = useVeChainKitConfig();
|
|
6232
|
+
return reactQuery.useQuery({
|
|
6233
|
+
queryKey: getTokenUsdPriceQueryKey(token),
|
|
6234
|
+
queryFn: async () => getTokenUsdPrice(thor, token, network.type),
|
|
6235
|
+
enabled: !!thor && !!network.type
|
|
6236
|
+
});
|
|
6237
|
+
};
|
|
6238
|
+
|
|
6239
|
+
// src/hooks/api/wallet/useTokenPrices.ts
|
|
6209
6240
|
var useTokenPrices = () => {
|
|
6210
6241
|
const { network } = useVeChainKitConfig();
|
|
6211
6242
|
const config = chunkLMX37RCG_cjs.getConfig(network.type);
|
|
@@ -6295,9 +6326,7 @@ var useCurrency = () => {
|
|
|
6295
6326
|
var useTokensWithValues = ({
|
|
6296
6327
|
address = ""
|
|
6297
6328
|
}) => {
|
|
6298
|
-
const { balances, isLoading: balancesLoading } = useTokenBalances(
|
|
6299
|
-
address
|
|
6300
|
-
});
|
|
6329
|
+
const { balances, isLoading: balancesLoading } = useTokenBalances(address);
|
|
6301
6330
|
const {
|
|
6302
6331
|
prices,
|
|
6303
6332
|
exchangeRates,
|
|
@@ -6366,6 +6395,60 @@ var useTotalBalance = ({ address = "" }) => {
|
|
|
6366
6395
|
hasAnyBalance: tokensWithBalance.length > 0
|
|
6367
6396
|
};
|
|
6368
6397
|
};
|
|
6398
|
+
|
|
6399
|
+
// src/hooks/api/wallet/useCurrentAllocationsRoundId.ts
|
|
6400
|
+
var abi = chunk5GZ7N47F_cjs.XAllocationVoting__factory.abi;
|
|
6401
|
+
var method = "currentRoundId";
|
|
6402
|
+
var getCurrentAllocationsRoundIdQueryKey = (address) => getCallClauseQueryKey({ abi, address, method });
|
|
6403
|
+
var useCurrentAllocationsRoundId = () => {
|
|
6404
|
+
const { network } = useVeChainKitConfig();
|
|
6405
|
+
const address = chunkLMX37RCG_cjs.getConfig(network.type).xAllocationVotingContractAddress;
|
|
6406
|
+
return useCallClause({
|
|
6407
|
+
abi,
|
|
6408
|
+
address,
|
|
6409
|
+
method,
|
|
6410
|
+
args: [],
|
|
6411
|
+
queryOptions: {
|
|
6412
|
+
select: (data) => data[0].toString()
|
|
6413
|
+
}
|
|
6414
|
+
});
|
|
6415
|
+
};
|
|
6416
|
+
var getTokenInfo = async (thor, tokenAddress) => {
|
|
6417
|
+
if (!tokenAddress) throw new Error("Token address is required");
|
|
6418
|
+
const contract = thor.contracts.load(tokenAddress, chunk5GZ7N47F_cjs.ERC20__factory.abi);
|
|
6419
|
+
const response = await thor.contracts.executeMultipleClausesCall([
|
|
6420
|
+
contract.clause.name(),
|
|
6421
|
+
contract.clause.symbol(),
|
|
6422
|
+
contract.clause.decimals()
|
|
6423
|
+
]);
|
|
6424
|
+
if (response.every((r) => r.success) === false) {
|
|
6425
|
+
throw new Error(`Failed to get token info of ${tokenAddress}`);
|
|
6426
|
+
}
|
|
6427
|
+
const [name, symbol, decimals] = response.map((res) => {
|
|
6428
|
+
return res.result.array?.[0];
|
|
6429
|
+
});
|
|
6430
|
+
return {
|
|
6431
|
+
name,
|
|
6432
|
+
address: tokenAddress,
|
|
6433
|
+
decimals,
|
|
6434
|
+
symbol
|
|
6435
|
+
};
|
|
6436
|
+
};
|
|
6437
|
+
var getCustomTokenInfo = (tokenAddress) => [
|
|
6438
|
+
"VECHAIN_KIT_CUSTOM_TOKEN_BALANCE",
|
|
6439
|
+
tokenAddress
|
|
6440
|
+
];
|
|
6441
|
+
var useGetCustomTokenInfo = (tokenAddress) => {
|
|
6442
|
+
const thor = dappKitReact.useThor();
|
|
6443
|
+
const { network } = useVeChainKitConfig();
|
|
6444
|
+
return reactQuery.useQuery({
|
|
6445
|
+
queryKey: getCustomTokenInfo(tokenAddress),
|
|
6446
|
+
queryFn: async () => getTokenInfo(thor, tokenAddress),
|
|
6447
|
+
enabled: !!thor && !!network.type && !!tokenAddress
|
|
6448
|
+
});
|
|
6449
|
+
};
|
|
6450
|
+
|
|
6451
|
+
// src/hooks/api/wallet/useCustomTokens.ts
|
|
6369
6452
|
var useCustomTokens = () => {
|
|
6370
6453
|
const [customTokens, setCustomTokens] = useLocalStorage(
|
|
6371
6454
|
"vechain_kit_custom_tokens" /* CUSTOM_TOKENS */,
|
|
@@ -6412,6 +6495,223 @@ var useCustomTokens = () => {
|
|
|
6412
6495
|
isDefaultToken
|
|
6413
6496
|
};
|
|
6414
6497
|
};
|
|
6498
|
+
var getB3trBalance = async (thor, network, address) => {
|
|
6499
|
+
const res = await thor.contracts.load(chunkLMX37RCG_cjs.getConfig(network).b3trContractAddress, chunk5GZ7N47F_cjs.B3TR__factory.abi).read.balanceOf(address);
|
|
6500
|
+
if (!res) throw new Error("Failed to get b3tr balance");
|
|
6501
|
+
const original = res[0].toString();
|
|
6502
|
+
const scaled = ethers.formatEther(original);
|
|
6503
|
+
const formatted = scaled === "0" ? "0" : chunkLMX37RCG_cjs.humanNumber(scaled);
|
|
6504
|
+
return {
|
|
6505
|
+
original,
|
|
6506
|
+
scaled,
|
|
6507
|
+
formatted
|
|
6508
|
+
};
|
|
6509
|
+
};
|
|
6510
|
+
var getB3trBalanceQueryKey = (address) => [
|
|
6511
|
+
"VEBETTERDAO_BALANCE",
|
|
6512
|
+
address,
|
|
6513
|
+
"B3TR"
|
|
6514
|
+
];
|
|
6515
|
+
var useGetB3trBalance = (address) => {
|
|
6516
|
+
const thor = dappKitReact.useThor();
|
|
6517
|
+
const { network } = useVeChainKitConfig();
|
|
6518
|
+
return reactQuery.useQuery({
|
|
6519
|
+
queryKey: getB3trBalanceQueryKey(address),
|
|
6520
|
+
queryFn: async () => getB3trBalance(thor, network.type, address),
|
|
6521
|
+
enabled: !!thor && !!address && !!network.type
|
|
6522
|
+
});
|
|
6523
|
+
};
|
|
6524
|
+
var getCustomTokenBalance = async (thor, token, address) => {
|
|
6525
|
+
const res = await thor.contracts.load(token.address, chunk5GZ7N47F_cjs.ERC20__factory.abi).read.balanceOf([address]);
|
|
6526
|
+
if (!res) throw new Error(`Failed to get balance of ${token.address}`);
|
|
6527
|
+
const original = res[0];
|
|
6528
|
+
const scaled = viem.formatEther(BigInt(original));
|
|
6529
|
+
const formatted = scaled === "0" ? "0" : chunkLMX37RCG_cjs.humanNumber(scaled);
|
|
6530
|
+
return {
|
|
6531
|
+
...token,
|
|
6532
|
+
original: original.toString(),
|
|
6533
|
+
scaled,
|
|
6534
|
+
formatted
|
|
6535
|
+
};
|
|
6536
|
+
};
|
|
6537
|
+
var getCustomTokenBalanceQueryKey = (tokenAddress, address) => ["VECHAIN_KIT_BALANCE", address, "CUSTOM_TOKEN", tokenAddress];
|
|
6538
|
+
var useGetCustomTokenBalances = (address) => {
|
|
6539
|
+
const thor = dappKitReact.useThor();
|
|
6540
|
+
const { customTokens } = useCustomTokens();
|
|
6541
|
+
return reactQuery.useQueries({
|
|
6542
|
+
queries: customTokens.map((token) => ({
|
|
6543
|
+
queryKey: getCustomTokenBalanceQueryKey(token.address, address),
|
|
6544
|
+
queryFn: async () => {
|
|
6545
|
+
return await getCustomTokenBalance(thor, token, address);
|
|
6546
|
+
}
|
|
6547
|
+
}))
|
|
6548
|
+
});
|
|
6549
|
+
};
|
|
6550
|
+
var getErc20Balance = async (thor, tokenAddress, address) => {
|
|
6551
|
+
if (!tokenAddress || !address) {
|
|
6552
|
+
throw new Error("Token address and user address are required");
|
|
6553
|
+
}
|
|
6554
|
+
const res = await thor.contracts.load(tokenAddress, chunk5GZ7N47F_cjs.IERC20__factory.abi).read.balanceOf(address);
|
|
6555
|
+
if (!res) throw new Error(`Failed to get balance of ${tokenAddress}`);
|
|
6556
|
+
const original = res[0].toString();
|
|
6557
|
+
const scaled = ethers.formatEther(original);
|
|
6558
|
+
const formatted = scaled === "0" ? "0" : chunkLMX37RCG_cjs.humanNumber(scaled);
|
|
6559
|
+
return {
|
|
6560
|
+
original,
|
|
6561
|
+
scaled,
|
|
6562
|
+
formatted
|
|
6563
|
+
};
|
|
6564
|
+
};
|
|
6565
|
+
var getErc20BalanceQueryKey = (tokenAddress, address) => ["VECHAIN_KIT", "BALANCE", "ERC20", tokenAddress, address];
|
|
6566
|
+
var useGetErc20Balance = (tokenAddress, address) => {
|
|
6567
|
+
const thor = dappKitReact.useThor();
|
|
6568
|
+
return reactQuery.useQuery({
|
|
6569
|
+
queryKey: getErc20BalanceQueryKey(tokenAddress, address),
|
|
6570
|
+
queryFn: async () => getErc20Balance(thor, tokenAddress, address),
|
|
6571
|
+
enabled: !!thor && !!address && !!tokenAddress
|
|
6572
|
+
});
|
|
6573
|
+
};
|
|
6574
|
+
var getVot3Balance = async (thor, network, address) => {
|
|
6575
|
+
const res = await thor.contracts.load(chunkLMX37RCG_cjs.getConfig(network).vot3ContractAddress, chunk5GZ7N47F_cjs.IVOT3__factory.abi).read.balanceOf(address);
|
|
6576
|
+
if (!res) throw new Error("Reverted");
|
|
6577
|
+
const original = res[0].toString();
|
|
6578
|
+
const scaled = ethers.formatEther(original);
|
|
6579
|
+
const formatted = scaled === "0" ? "0" : chunkLMX37RCG_cjs.humanNumber(scaled);
|
|
6580
|
+
return {
|
|
6581
|
+
original,
|
|
6582
|
+
scaled,
|
|
6583
|
+
formatted
|
|
6584
|
+
};
|
|
6585
|
+
};
|
|
6586
|
+
var getVot3BalanceQueryKey = (address) => [
|
|
6587
|
+
"VEBETTERDAO_BALANCE",
|
|
6588
|
+
address,
|
|
6589
|
+
"VOT3"
|
|
6590
|
+
];
|
|
6591
|
+
var useGetVot3Balance = (address) => {
|
|
6592
|
+
const thor = dappKitReact.useThor();
|
|
6593
|
+
const { network } = useVeChainKitConfig();
|
|
6594
|
+
return reactQuery.useQuery({
|
|
6595
|
+
queryKey: getVot3BalanceQueryKey(address),
|
|
6596
|
+
queryFn: async () => getVot3Balance(thor, network.type, address),
|
|
6597
|
+
enabled: !!thor && !!address && !!network.type
|
|
6598
|
+
});
|
|
6599
|
+
};
|
|
6600
|
+
|
|
6601
|
+
// src/hooks/api/wallet/useIsPerson.ts
|
|
6602
|
+
var abi2 = chunk5GZ7N47F_cjs.VeBetterPassport__factory.abi;
|
|
6603
|
+
var method2 = "isPerson";
|
|
6604
|
+
var getIsPersonQueryKey = (user, network) => {
|
|
6605
|
+
const address = chunkLMX37RCG_cjs.getConfig(network).veBetterPassportContractAddress;
|
|
6606
|
+
return getCallClauseQueryKeyWithArgs({
|
|
6607
|
+
abi: abi2,
|
|
6608
|
+
address,
|
|
6609
|
+
method: method2,
|
|
6610
|
+
args: [user]
|
|
6611
|
+
});
|
|
6612
|
+
};
|
|
6613
|
+
var useIsPerson = (user) => {
|
|
6614
|
+
const { network } = useVeChainKitConfig();
|
|
6615
|
+
const address = chunkLMX37RCG_cjs.getConfig(network.type).veBetterPassportContractAddress;
|
|
6616
|
+
return useCallClause({
|
|
6617
|
+
abi: abi2,
|
|
6618
|
+
address,
|
|
6619
|
+
method: method2,
|
|
6620
|
+
args: [user ?? "0x"],
|
|
6621
|
+
queryOptions: {
|
|
6622
|
+
enabled: !!user,
|
|
6623
|
+
select: (data) => data[0]
|
|
6624
|
+
}
|
|
6625
|
+
});
|
|
6626
|
+
};
|
|
6627
|
+
|
|
6628
|
+
// src/hooks/api/wallet/useRoundXApps.ts
|
|
6629
|
+
var abi3 = chunk5GZ7N47F_cjs.XAllocationVoting__factory.abi;
|
|
6630
|
+
var method3 = "getAppsOfRound";
|
|
6631
|
+
var getRoundXAppsQueryKey = (roundId, networkType) => getCallClauseQueryKeyWithArgs({
|
|
6632
|
+
abi: abi3,
|
|
6633
|
+
address: chunkLMX37RCG_cjs.getConfig(networkType).xAllocationVotingContractAddress,
|
|
6634
|
+
method: method3,
|
|
6635
|
+
args: [BigInt(roundId ?? 0)]
|
|
6636
|
+
});
|
|
6637
|
+
var useRoundXApps = (roundId) => {
|
|
6638
|
+
const { network } = useVeChainKitConfig();
|
|
6639
|
+
const address = chunkLMX37RCG_cjs.getConfig(network.type).xAllocationVotingContractAddress;
|
|
6640
|
+
return useCallClause({
|
|
6641
|
+
abi: abi3,
|
|
6642
|
+
address,
|
|
6643
|
+
method: method3,
|
|
6644
|
+
args: [BigInt(roundId ?? 0)],
|
|
6645
|
+
queryOptions: {
|
|
6646
|
+
enabled: !!roundId,
|
|
6647
|
+
select: (data) => data[0].map((app) => ({
|
|
6648
|
+
id: app.id.toString(),
|
|
6649
|
+
teamWalletAddress: app.teamWalletAddress,
|
|
6650
|
+
name: app.name,
|
|
6651
|
+
metadataURI: app.metadataURI,
|
|
6652
|
+
createdAtTimestamp: app.createdAtTimestamp.toString()
|
|
6653
|
+
}))
|
|
6654
|
+
}
|
|
6655
|
+
});
|
|
6656
|
+
};
|
|
6657
|
+
var abi4 = chunk5GZ7N47F_cjs.XAllocationPool__factory.abi;
|
|
6658
|
+
var method4 = "getAppShares";
|
|
6659
|
+
var getXAppsSharesQueryKey = (roundId) => [
|
|
6660
|
+
"VECHAIN_KIT",
|
|
6661
|
+
"XApps",
|
|
6662
|
+
"Shares",
|
|
6663
|
+
roundId
|
|
6664
|
+
];
|
|
6665
|
+
var useXAppsShares = (apps, roundId) => {
|
|
6666
|
+
const thor = dappKitReact.useThor();
|
|
6667
|
+
const { network } = useVeChainKitConfig();
|
|
6668
|
+
const address = chunkLMX37RCG_cjs.getConfig(network.type).xAllocationPoolContractAddress;
|
|
6669
|
+
return reactQuery.useQuery({
|
|
6670
|
+
queryKey: getXAppsSharesQueryKey(roundId),
|
|
6671
|
+
queryFn: async () => {
|
|
6672
|
+
const shares = await chunkLMX37RCG_cjs.executeMultipleClausesCall({
|
|
6673
|
+
thor,
|
|
6674
|
+
calls: apps.map(
|
|
6675
|
+
(app) => ({
|
|
6676
|
+
abi: abi4,
|
|
6677
|
+
functionName: method4,
|
|
6678
|
+
address,
|
|
6679
|
+
args: [roundId, app]
|
|
6680
|
+
})
|
|
6681
|
+
)
|
|
6682
|
+
});
|
|
6683
|
+
return shares.map((share, index) => {
|
|
6684
|
+
return {
|
|
6685
|
+
app: apps[index],
|
|
6686
|
+
share: Number(share[0] || 0) / 100,
|
|
6687
|
+
unallocatedShare: Number(share[1] || 0) / 100
|
|
6688
|
+
};
|
|
6689
|
+
});
|
|
6690
|
+
},
|
|
6691
|
+
enabled: !!roundId && !!apps.length
|
|
6692
|
+
});
|
|
6693
|
+
};
|
|
6694
|
+
|
|
6695
|
+
// src/hooks/api/wallet/useMostVotedAppsInRound.ts
|
|
6696
|
+
var useMostVotedAppsInRound = (roundId) => {
|
|
6697
|
+
const { data: apps } = useRoundXApps(roundId);
|
|
6698
|
+
const xAppsShares = useXAppsShares(
|
|
6699
|
+
apps?.map((app) => app.id) ?? [],
|
|
6700
|
+
roundId
|
|
6701
|
+
);
|
|
6702
|
+
const mostVotedApps = React10.useMemo(
|
|
6703
|
+
() => xAppsShares.data?.map((appShares) => ({
|
|
6704
|
+
percentage: appShares.share + appShares.unallocatedShare,
|
|
6705
|
+
id: apps?.find((xa) => xa.id === appShares.app)?.id ?? "",
|
|
6706
|
+
app: apps?.find((xa) => xa.id === appShares.app) ?? {}
|
|
6707
|
+
})).sort((a, b) => Number(b.percentage) - Number(a.percentage)) ?? [],
|
|
6708
|
+
[xAppsShares.data, apps]
|
|
6709
|
+
);
|
|
6710
|
+
return {
|
|
6711
|
+
data: mostVotedApps,
|
|
6712
|
+
isLoading: xAppsShares.isLoading
|
|
6713
|
+
};
|
|
6714
|
+
};
|
|
6415
6715
|
var handlePopupError = ({
|
|
6416
6716
|
error,
|
|
6417
6717
|
mobileBrowserPopupMessage = "Mobile browser blocked the window. Please try again.",
|
|
@@ -6744,170 +7044,30 @@ var useRefreshBalances = () => {
|
|
|
6744
7044
|
};
|
|
6745
7045
|
return { refresh };
|
|
6746
7046
|
};
|
|
6747
|
-
var
|
|
6748
|
-
const
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
chunk5GZ7N47F_cjs.IERC20__factory.abi
|
|
6752
|
-
);
|
|
6753
|
-
return erc20Contract.clause.balanceOf([address]);
|
|
6754
|
-
});
|
|
6755
|
-
const response = await thor.contracts.executeMultipleClausesCall(clauses);
|
|
6756
|
-
if (!response.every((r) => r.success && !!r.result.plain)) {
|
|
6757
|
-
throw new Error("Failed to get custom token balances");
|
|
6758
|
-
}
|
|
6759
|
-
return response.map((r, index) => {
|
|
6760
|
-
const token = customTokens[index];
|
|
6761
|
-
const original = r.result.plain;
|
|
6762
|
-
const scaled = ethers.formatEther(BigInt(original)) || "0";
|
|
6763
|
-
return {
|
|
6764
|
-
address: token.address,
|
|
6765
|
-
symbol: token.symbol,
|
|
6766
|
-
balance: scaled
|
|
6767
|
-
};
|
|
6768
|
-
});
|
|
6769
|
-
};
|
|
6770
|
-
var getTokenBalances = async (thor, address, network) => {
|
|
6771
|
-
const config = chunkLMX37RCG_cjs.getConfig(network);
|
|
6772
|
-
const [b3trBalance, vot3Balance, veDelegateBalance, gloDollarBalance] = await chunkLMX37RCG_cjs.executeMultipleClausesCall({
|
|
6773
|
-
thor,
|
|
6774
|
-
calls: [
|
|
6775
|
-
{
|
|
6776
|
-
abi: chunk5GZ7N47F_cjs.IB3TR__factory.abi,
|
|
6777
|
-
address: config.b3trContractAddress,
|
|
6778
|
-
functionName: "balanceOf",
|
|
6779
|
-
args: [address]
|
|
6780
|
-
},
|
|
6781
|
-
{
|
|
6782
|
-
abi: chunk5GZ7N47F_cjs.IVOT3__factory.abi,
|
|
6783
|
-
address: config.vot3ContractAddress,
|
|
6784
|
-
functionName: "balanceOf",
|
|
6785
|
-
args: [address]
|
|
6786
|
-
},
|
|
6787
|
-
{
|
|
6788
|
-
abi: chunk5GZ7N47F_cjs.IERC20__factory.abi,
|
|
6789
|
-
address: config.veDelegate,
|
|
6790
|
-
functionName: "balanceOf",
|
|
6791
|
-
args: [address]
|
|
6792
|
-
},
|
|
6793
|
-
{
|
|
6794
|
-
abi: chunk5GZ7N47F_cjs.IERC20__factory.abi,
|
|
6795
|
-
address: config.gloDollarContractAddress,
|
|
6796
|
-
functionName: "balanceOf",
|
|
6797
|
-
args: [address]
|
|
6798
|
-
}
|
|
6799
|
-
]
|
|
6800
|
-
});
|
|
6801
|
-
const { balance: vetBalance, energy: vthoBalance } = await getAccountBalance(thor, address);
|
|
6802
|
-
return [
|
|
6803
|
-
{
|
|
6804
|
-
address: "0x",
|
|
6805
|
-
symbol: "VET",
|
|
6806
|
-
balance: vetBalance
|
|
6807
|
-
},
|
|
6808
|
-
{
|
|
6809
|
-
address: config.vthoContractAddress,
|
|
6810
|
-
symbol: "VTHO",
|
|
6811
|
-
balance: vthoBalance
|
|
6812
|
-
},
|
|
6813
|
-
{
|
|
6814
|
-
address: config.b3trContractAddress,
|
|
6815
|
-
symbol: "B3TR",
|
|
6816
|
-
balance: b3trBalance
|
|
6817
|
-
},
|
|
6818
|
-
{
|
|
6819
|
-
address: config.vot3ContractAddress,
|
|
6820
|
-
symbol: "VOT3",
|
|
6821
|
-
balance: vot3Balance
|
|
6822
|
-
},
|
|
6823
|
-
{
|
|
6824
|
-
address: config.veDelegate,
|
|
6825
|
-
symbol: "veDelegate",
|
|
6826
|
-
balance: veDelegateBalance
|
|
6827
|
-
},
|
|
6828
|
-
{
|
|
6829
|
-
address: config.gloDollarContractAddress,
|
|
6830
|
-
symbol: "USDGLO",
|
|
6831
|
-
balance: gloDollarBalance
|
|
6832
|
-
}
|
|
6833
|
-
];
|
|
6834
|
-
};
|
|
6835
|
-
var useTokenBalances2 = ({ address }) => {
|
|
6836
|
-
const thor = dappKitReact.useThor();
|
|
6837
|
-
const { network } = useVeChainKitConfig();
|
|
6838
|
-
const { customTokens } = useCustomTokens();
|
|
6839
|
-
return reactQuery.useQueries({
|
|
6840
|
-
queries: [
|
|
6841
|
-
{
|
|
6842
|
-
queryKey: ["base-token-balances", address],
|
|
6843
|
-
queryFn: () => getTokenBalances(thor, address, network.type)
|
|
6844
|
-
},
|
|
6845
|
-
{
|
|
6846
|
-
queryKey: ["custom-token-balances", address],
|
|
6847
|
-
queryFn: () => getCustomTokenBalances(thor, address, customTokens)
|
|
6848
|
-
}
|
|
6849
|
-
],
|
|
6850
|
-
combine: (data) => {
|
|
6851
|
-
return {
|
|
6852
|
-
data: data.flat(),
|
|
6853
|
-
loading: data[0].isLoading || data[1].isLoading,
|
|
6854
|
-
error: data[0].error || data[1].error
|
|
6855
|
-
};
|
|
6856
|
-
}
|
|
6857
|
-
});
|
|
6858
|
-
};
|
|
6859
|
-
var getTokenPrices = async (thor, tokens2, network) => {
|
|
6860
|
-
const config = chunkLMX37RCG_cjs.getConfig(network);
|
|
6861
|
-
const oracleContract = thor.contracts.load(
|
|
6862
|
-
config.oracleContractAddress,
|
|
6863
|
-
chunk5GZ7N47F_cjs.IVechainEnergyOracleV1__factory.abi
|
|
6864
|
-
);
|
|
6865
|
-
const clauses = tokens2.map(
|
|
6866
|
-
(token) => oracleContract.clause.getLatestValue(PRICE_FEED_IDS[token])
|
|
6867
|
-
);
|
|
6868
|
-
const response = await thor.transactions.executeMultipleClausesCall(
|
|
6869
|
-
clauses
|
|
6870
|
-
);
|
|
6871
|
-
if (!response.every((r) => r.success && !!r.result.array)) {
|
|
6872
|
-
throw new Error("Failed to get token prices");
|
|
6873
|
-
}
|
|
6874
|
-
return response.map(
|
|
6875
|
-
(r) => new BigNumber__default.default((r.result.array?.[0] ?? 0).toString()).div(1e12).toNumber()
|
|
7047
|
+
var getXAppMetadata = async (uri, networkType) => {
|
|
7048
|
+
const metadata = await axios__default.default.get(
|
|
7049
|
+
chunkLMX37RCG_cjs.convertUriToUrl(uri, networkType) || "",
|
|
7050
|
+
{ timeout: 2e4 }
|
|
6876
7051
|
);
|
|
7052
|
+
return metadata.data;
|
|
6877
7053
|
};
|
|
6878
|
-
var
|
|
6879
|
-
var
|
|
7054
|
+
var abi5 = chunk5GZ7N47F_cjs.X2EarnApps__factory.abi;
|
|
7055
|
+
var useXAppMetadata = (xAppId) => {
|
|
6880
7056
|
const thor = dappKitReact.useThor();
|
|
6881
7057
|
const { network } = useVeChainKitConfig();
|
|
6882
|
-
const config = chunkLMX37RCG_cjs.getConfig(network.type);
|
|
6883
7058
|
return reactQuery.useQuery({
|
|
6884
|
-
queryKey: ["
|
|
6885
|
-
queryFn: () =>
|
|
6886
|
-
|
|
6887
|
-
const
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
[config.vthoContractAddress]: vthoUsdPrice || 0,
|
|
6897
|
-
[config.b3trContractAddress]: b3trUsdPrice || 0,
|
|
6898
|
-
[config.vot3ContractAddress]: b3trUsdPrice || 0,
|
|
6899
|
-
[config.veDelegate]: b3trUsdPrice || 0,
|
|
6900
|
-
[config.gloDollarContractAddress]: 1
|
|
6901
|
-
// GloDollar is pegged to USD
|
|
6902
|
-
};
|
|
6903
|
-
const exchangeRates = {
|
|
6904
|
-
eurUsdPrice: eurUsdPrice || 1,
|
|
6905
|
-
gbpUsdPrice: gbpUsdPrice || 1
|
|
6906
|
-
};
|
|
6907
|
-
return {
|
|
6908
|
-
prices,
|
|
6909
|
-
exchangeRates
|
|
6910
|
-
};
|
|
7059
|
+
queryKey: ["xAppMetaData", xAppId],
|
|
7060
|
+
queryFn: async () => {
|
|
7061
|
+
const address = chunkLMX37RCG_cjs.getConfig(network.type).x2EarnAppsContractAddress;
|
|
7062
|
+
const contract = thor.contracts.load(address, abi5);
|
|
7063
|
+
const [app] = await contract.read.app(xAppId);
|
|
7064
|
+
const metadataURI = app?.[3] || "";
|
|
7065
|
+
const [baseUri] = await contract.read.baseURI();
|
|
7066
|
+
const metadata = await getXAppMetadata(
|
|
7067
|
+
`${baseUri}${metadataURI}`,
|
|
7068
|
+
network.type
|
|
7069
|
+
);
|
|
7070
|
+
return metadata;
|
|
6911
7071
|
}
|
|
6912
7072
|
});
|
|
6913
7073
|
};
|
|
@@ -7626,8 +7786,8 @@ var ConnectionOptionsStack = () => {
|
|
|
7626
7786
|
showMoreLogin,
|
|
7627
7787
|
isOfficialVeChainApp
|
|
7628
7788
|
} = useLoginModalContent();
|
|
7629
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.Stack, { spacing: 4, w: "full", align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(react.Grid, { templateColumns: "repeat(4, 1fr)", gap: 2, w: "full", children: loginMethods?.map(({ method:
|
|
7630
|
-
switch (
|
|
7789
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.Stack, { spacing: 4, w: "full", align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(react.Grid, { templateColumns: "repeat(4, 1fr)", gap: 2, w: "full", children: loginMethods?.map(({ method: method7, gridColumn }) => {
|
|
7790
|
+
switch (method7) {
|
|
7631
7791
|
case "email":
|
|
7632
7792
|
return showEmailLogin && /* @__PURE__ */ jsxRuntime.jsx(EmailLoginButton, {}, "email");
|
|
7633
7793
|
case "google":
|
|
@@ -7734,7 +7894,7 @@ var MainContent = ({ setCurrentContent, onClose }) => {
|
|
|
7734
7894
|
}
|
|
7735
7895
|
}, [connection.isConnected, onClose]);
|
|
7736
7896
|
const showEcosystemButton = loginMethods?.some(
|
|
7737
|
-
({ method:
|
|
7897
|
+
({ method: method7 }) => method7 === "ecosystem"
|
|
7738
7898
|
);
|
|
7739
7899
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7740
7900
|
/* @__PURE__ */ jsxRuntime.jsxs(StickyHeaderContainer, { children: [
|
|
@@ -13022,13 +13182,13 @@ var PrivyLinkedAccounts = ({ onBack }) => {
|
|
|
13022
13182
|
} = reactAuth.usePrivy();
|
|
13023
13183
|
const canLinkWallets = React10.useMemo(() => {
|
|
13024
13184
|
const privyWallets = privy?.loginMethods?.filter(
|
|
13025
|
-
(
|
|
13185
|
+
(method7) => [
|
|
13026
13186
|
"rabby_wallet",
|
|
13027
13187
|
"coinbase_wallet",
|
|
13028
13188
|
"rainbow",
|
|
13029
13189
|
"phantom",
|
|
13030
13190
|
"metamask"
|
|
13031
|
-
].includes(
|
|
13191
|
+
].includes(method7)
|
|
13032
13192
|
) ?? [];
|
|
13033
13193
|
const dappKitWallets = dappKit?.allowedWallets ?? [];
|
|
13034
13194
|
return privyWallets.length > 0 || dappKitWallets.length > 0;
|
|
@@ -14172,17 +14332,7 @@ var ExploreEcosystemContent = ({
|
|
|
14172
14332
|
) : [];
|
|
14173
14333
|
const filteredDefaultApps = DEFAULT_APPS.filter(
|
|
14174
14334
|
(dapp) => dapp.name.toLowerCase().includes(searchQuery.toLowerCase())
|
|
14175
|
-
)
|
|
14176
|
-
if (dapp.logoComponent) {
|
|
14177
|
-
return {
|
|
14178
|
-
...dapp,
|
|
14179
|
-
logoComponent: React10__default.default.cloneElement(dapp.logoComponent, {
|
|
14180
|
-
isDark
|
|
14181
|
-
})
|
|
14182
|
-
};
|
|
14183
|
-
}
|
|
14184
|
-
return dapp;
|
|
14185
|
-
});
|
|
14335
|
+
);
|
|
14186
14336
|
const filteredAppHubApps = appHubApps?.filter(
|
|
14187
14337
|
(app) => (
|
|
14188
14338
|
// Text search filter
|
|
@@ -14269,10 +14419,7 @@ var ExploreEcosystemContent = ({
|
|
|
14269
14419
|
url: dapp.external_url,
|
|
14270
14420
|
setCurrentContent,
|
|
14271
14421
|
description: dapp.description,
|
|
14272
|
-
selectedCategory: currentCategory
|
|
14273
|
-
...dapp.logoComponent && {
|
|
14274
|
-
logoComponent: dapp.logoComponent
|
|
14275
|
-
}
|
|
14422
|
+
selectedCategory: currentCategory
|
|
14276
14423
|
}
|
|
14277
14424
|
) }, dapp.name)) }),
|
|
14278
14425
|
shouldShowVbdApps && filteredVbdApps.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: filteredVbdApps.map((dapp) => /* @__PURE__ */ jsxRuntime.jsx(react.GridItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -15021,7 +15168,7 @@ var ConnectPopover = ({
|
|
|
15021
15168
|
privyEcosystemAppIDS
|
|
15022
15169
|
} = useVeChainKitConfig();
|
|
15023
15170
|
const showEcosystemButton = loginMethods?.some(
|
|
15024
|
-
({ method:
|
|
15171
|
+
({ method: method7 }) => method7 === "ecosystem"
|
|
15025
15172
|
);
|
|
15026
15173
|
const { data: appsInfo, isLoading: isEcosystemAppsLoading } = useFetchAppInfo(privyEcosystemAppIDS);
|
|
15027
15174
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -15746,8 +15893,9 @@ var ProfileCard = ({
|
|
|
15746
15893
|
style
|
|
15747
15894
|
}) => {
|
|
15748
15895
|
const { t } = reactI18next.useTranslation();
|
|
15749
|
-
const { account } = useWallet();
|
|
15896
|
+
const { account, disconnect } = useWallet();
|
|
15750
15897
|
const { network } = useVeChainKitConfig();
|
|
15898
|
+
const { openAccountModal, closeAccountModal } = useModal();
|
|
15751
15899
|
const metadata = useWalletMetadata(address, network.type);
|
|
15752
15900
|
const headerImageSvg = chunkLMX37RCG_cjs.getPicassoImage(address);
|
|
15753
15901
|
const isConnectedAccount = address === account?.address;
|
|
@@ -15890,6 +16038,12 @@ var ProfileCard = ({
|
|
|
15890
16038
|
variant: "ghost",
|
|
15891
16039
|
leftIcon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { as: fa.FaEdit }),
|
|
15892
16040
|
onClick: onEditClick ?? (() => {
|
|
16041
|
+
openAccountModal({
|
|
16042
|
+
type: "account-customization",
|
|
16043
|
+
props: {
|
|
16044
|
+
setCurrentContent: () => closeAccountModal()
|
|
16045
|
+
}
|
|
16046
|
+
});
|
|
15893
16047
|
}),
|
|
15894
16048
|
"data-testid": "customize-button",
|
|
15895
16049
|
children: t("Customize")
|
|
@@ -15904,7 +16058,18 @@ var ProfileCard = ({
|
|
|
15904
16058
|
variant: "ghost",
|
|
15905
16059
|
leftIcon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { as: ri.RiLogoutBoxLine }),
|
|
15906
16060
|
colorScheme: "red",
|
|
15907
|
-
onClick: onLogout
|
|
16061
|
+
onClick: onLogout ?? (() => {
|
|
16062
|
+
openAccountModal({
|
|
16063
|
+
type: "disconnect-confirm",
|
|
16064
|
+
props: {
|
|
16065
|
+
onDisconnect: () => {
|
|
16066
|
+
disconnect();
|
|
16067
|
+
closeAccountModal();
|
|
16068
|
+
},
|
|
16069
|
+
onBack: () => closeAccountModal()
|
|
16070
|
+
}
|
|
16071
|
+
});
|
|
16072
|
+
}),
|
|
15908
16073
|
"data-testid": "logout-button",
|
|
15909
16074
|
children: t("Logout")
|
|
15910
16075
|
}
|
|
@@ -16564,14 +16729,14 @@ var ReceiveModalProvider = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(jsxR
|
|
|
16564
16729
|
var useLoginModalContent = () => {
|
|
16565
16730
|
const { privy, loginMethods } = useVeChainKitConfig();
|
|
16566
16731
|
const isVeChainApp = privy?.appId === chunkLMX37RCG_cjs.VECHAIN_PRIVY_APP_ID;
|
|
16567
|
-
const isLoginMethodEnabled = (
|
|
16732
|
+
const isLoginMethodEnabled = (method7) => {
|
|
16568
16733
|
if (!loginMethods) return true;
|
|
16569
|
-
if (Array.isArray(
|
|
16570
|
-
return
|
|
16734
|
+
if (Array.isArray(method7)) {
|
|
16735
|
+
return method7.some(
|
|
16571
16736
|
(m) => loginMethods.some((lm) => lm.method === m)
|
|
16572
16737
|
);
|
|
16573
16738
|
}
|
|
16574
|
-
return loginMethods.some((lm) => lm.method ===
|
|
16739
|
+
return loginMethods.some((lm) => lm.method === method7);
|
|
16575
16740
|
};
|
|
16576
16741
|
const showEcosystemLogin = React10.useMemo(() => {
|
|
16577
16742
|
if (!loginMethods) return true;
|
|
@@ -16995,24 +17160,24 @@ var getCallClauseQueryKey = ({
|
|
|
16995
17160
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16996
17161
|
abi: abi9,
|
|
16997
17162
|
address,
|
|
16998
|
-
method:
|
|
16999
|
-
}) => ["callClause", address,
|
|
17163
|
+
method: method7
|
|
17164
|
+
}) => ["callClause", address, method7];
|
|
17000
17165
|
var getCallClauseQueryKeyWithArgs = ({
|
|
17001
17166
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17002
17167
|
abi: abi9,
|
|
17003
17168
|
address,
|
|
17004
|
-
method:
|
|
17169
|
+
method: method7,
|
|
17005
17170
|
args
|
|
17006
17171
|
}) => [
|
|
17007
17172
|
"callClause",
|
|
17008
17173
|
address,
|
|
17009
|
-
|
|
17174
|
+
method7,
|
|
17010
17175
|
...args?.length ? [args] : []
|
|
17011
17176
|
];
|
|
17012
17177
|
var useCallClause = ({
|
|
17013
17178
|
address,
|
|
17014
17179
|
abi: abi9,
|
|
17015
|
-
method:
|
|
17180
|
+
method: method7,
|
|
17016
17181
|
args,
|
|
17017
17182
|
queryOptions
|
|
17018
17183
|
}) => {
|
|
@@ -17021,19 +17186,29 @@ var useCallClause = ({
|
|
|
17021
17186
|
queryKey: getCallClauseQueryKeyWithArgs({
|
|
17022
17187
|
abi: abi9,
|
|
17023
17188
|
address,
|
|
17024
|
-
method:
|
|
17189
|
+
method: method7,
|
|
17025
17190
|
args
|
|
17026
17191
|
}),
|
|
17027
17192
|
queryFn: async () => chunkLMX37RCG_cjs.executeCallClause({
|
|
17028
17193
|
thor,
|
|
17029
17194
|
contractAddress: address,
|
|
17030
17195
|
abi: abi9,
|
|
17031
|
-
method:
|
|
17196
|
+
method: method7,
|
|
17032
17197
|
args
|
|
17033
17198
|
}),
|
|
17034
17199
|
...queryOptions
|
|
17035
17200
|
});
|
|
17036
17201
|
};
|
|
17202
|
+
var useMultipleClausesCall = ({
|
|
17203
|
+
thor,
|
|
17204
|
+
calls,
|
|
17205
|
+
queryKey,
|
|
17206
|
+
enabled = true
|
|
17207
|
+
}) => reactQuery.useQuery({
|
|
17208
|
+
queryKey,
|
|
17209
|
+
queryFn: () => chunkLMX37RCG_cjs.executeMultipleClausesCall({ thor, calls }),
|
|
17210
|
+
enabled
|
|
17211
|
+
});
|
|
17037
17212
|
|
|
17038
17213
|
// src/hooks/utils/useGetNodeUrl.ts
|
|
17039
17214
|
var useGetNodeUrl = () => {
|
|
@@ -17063,89 +17238,6 @@ var useScrollToTop = () => {
|
|
|
17063
17238
|
}
|
|
17064
17239
|
}, []);
|
|
17065
17240
|
};
|
|
17066
|
-
var LocalStorageKey = /* @__PURE__ */ ((LocalStorageKey2) => {
|
|
17067
|
-
LocalStorageKey2["CUSTOM_TOKENS"] = "vechain_kit_custom_tokens";
|
|
17068
|
-
LocalStorageKey2["ECOSYSTEM_SHORTCUTS"] = "vechain-kit-ecosystem-shortcuts";
|
|
17069
|
-
LocalStorageKey2["CURRENCY"] = "vechain_kit_currency";
|
|
17070
|
-
LocalStorageKey2["NODE_URL"] = "vechain_kit_node_url";
|
|
17071
|
-
LocalStorageKey2["NETWORK"] = "vechain_kit_network";
|
|
17072
|
-
return LocalStorageKey2;
|
|
17073
|
-
})(LocalStorageKey || {});
|
|
17074
|
-
var useLocalStorage = (key, initialValue) => {
|
|
17075
|
-
const [storedValue, setStoredValue] = React10.useState(() => {
|
|
17076
|
-
try {
|
|
17077
|
-
const item = window.localStorage.getItem(key);
|
|
17078
|
-
return item ? JSON.parse(item) : initialValue;
|
|
17079
|
-
} catch (error) {
|
|
17080
|
-
console.error(error);
|
|
17081
|
-
return initialValue;
|
|
17082
|
-
}
|
|
17083
|
-
});
|
|
17084
|
-
React10.useEffect(() => {
|
|
17085
|
-
window.localStorage.setItem(key, JSON.stringify(storedValue));
|
|
17086
|
-
}, [key, storedValue]);
|
|
17087
|
-
return [storedValue, setStoredValue];
|
|
17088
|
-
};
|
|
17089
|
-
var useSyncableLocalStorage = (key, defaultValue) => {
|
|
17090
|
-
const [value, setValue] = React10.useState(() => {
|
|
17091
|
-
if (typeof window === "undefined") return defaultValue;
|
|
17092
|
-
try {
|
|
17093
|
-
const stored = window.localStorage.getItem(key);
|
|
17094
|
-
return stored ? JSON.parse(stored) : defaultValue;
|
|
17095
|
-
} catch (err) {
|
|
17096
|
-
console.error("Error loading from localStorage:", err);
|
|
17097
|
-
return defaultValue;
|
|
17098
|
-
}
|
|
17099
|
-
});
|
|
17100
|
-
React10.useEffect(() => {
|
|
17101
|
-
if (typeof window === "undefined") return;
|
|
17102
|
-
try {
|
|
17103
|
-
window.localStorage.setItem(key, JSON.stringify(value));
|
|
17104
|
-
} catch (err) {
|
|
17105
|
-
console.error("Error writing to localStorage:", err);
|
|
17106
|
-
}
|
|
17107
|
-
}, [key, value]);
|
|
17108
|
-
const sync = React10.useCallback(() => {
|
|
17109
|
-
if (typeof window === "undefined") return;
|
|
17110
|
-
try {
|
|
17111
|
-
const stored = window.localStorage.getItem(key);
|
|
17112
|
-
setValue(stored ? JSON.parse(stored) : defaultValue);
|
|
17113
|
-
} catch (err) {
|
|
17114
|
-
console.error("Error syncing localStorage:", err);
|
|
17115
|
-
}
|
|
17116
|
-
}, [key, defaultValue]);
|
|
17117
|
-
const getValue = React10.useCallback(() => {
|
|
17118
|
-
if (typeof window === "undefined") return defaultValue;
|
|
17119
|
-
const stored = window.localStorage.getItem(key);
|
|
17120
|
-
return stored ? JSON.parse(stored) : defaultValue;
|
|
17121
|
-
}, [key, defaultValue]);
|
|
17122
|
-
return [value, setValue, sync, getValue];
|
|
17123
|
-
};
|
|
17124
|
-
|
|
17125
|
-
// src/hooks/cache/useEcosystemShortcuts.ts
|
|
17126
|
-
var useEcosystemShortcuts = () => {
|
|
17127
|
-
const [shortcuts, setShortcuts] = useLocalStorage(
|
|
17128
|
-
"vechain-kit-ecosystem-shortcuts" /* ECOSYSTEM_SHORTCUTS */,
|
|
17129
|
-
[]
|
|
17130
|
-
);
|
|
17131
|
-
const addShortcut = (shortcut) => {
|
|
17132
|
-
if (!shortcuts.some((s) => s.url === shortcut.url)) {
|
|
17133
|
-
setShortcuts([...shortcuts, shortcut]);
|
|
17134
|
-
}
|
|
17135
|
-
};
|
|
17136
|
-
const removeShortcut = (url) => {
|
|
17137
|
-
setShortcuts(shortcuts.filter((s) => s.url !== url));
|
|
17138
|
-
};
|
|
17139
|
-
const isShortcut = (url) => {
|
|
17140
|
-
return shortcuts.some((s) => s.url === url);
|
|
17141
|
-
};
|
|
17142
|
-
return {
|
|
17143
|
-
shortcuts,
|
|
17144
|
-
addShortcut,
|
|
17145
|
-
removeShortcut,
|
|
17146
|
-
isShortcut
|
|
17147
|
-
};
|
|
17148
|
-
};
|
|
17149
17241
|
var getAccountBalance = async (thor, address) => {
|
|
17150
17242
|
if (!address) throw new Error("Address is required");
|
|
17151
17243
|
const account = await thor.accounts.getAccount(sdkCore.Address.of(address));
|
|
@@ -17266,9 +17358,9 @@ var useGetAccountAddress = (ownerAddress) => {
|
|
|
17266
17358
|
};
|
|
17267
17359
|
|
|
17268
17360
|
// src/hooks/thor/smartAccounts/useGetAccountVersion.ts
|
|
17269
|
-
var
|
|
17361
|
+
var abi6 = chunk5GZ7N47F_cjs.SimpleAccountFactory__factory.abi;
|
|
17270
17362
|
var getAccountVersionQueryKey = (accountAddress, ownerAddress, networkType) => getCallClauseQueryKeyWithArgs({
|
|
17271
|
-
abi,
|
|
17363
|
+
abi: abi6,
|
|
17272
17364
|
address: chunkLMX37RCG_cjs.getConfig(networkType).accountFactoryAddress,
|
|
17273
17365
|
method: "getAccountVersion",
|
|
17274
17366
|
args: [accountAddress, ownerAddress]
|
|
@@ -17277,7 +17369,7 @@ var useGetAccountVersion = (accountAddress, ownerAddress) => {
|
|
|
17277
17369
|
const { network } = useVeChainKitConfig();
|
|
17278
17370
|
return useCallClause({
|
|
17279
17371
|
address: chunkLMX37RCG_cjs.getConfig(network.type).accountFactoryAddress,
|
|
17280
|
-
abi,
|
|
17372
|
+
abi: abi6,
|
|
17281
17373
|
method: "getAccountVersion",
|
|
17282
17374
|
args: [accountAddress, ownerAddress],
|
|
17283
17375
|
queryOptions: {
|
|
@@ -17290,16 +17382,16 @@ var useGetAccountVersion = (accountAddress, ownerAddress) => {
|
|
|
17290
17382
|
}
|
|
17291
17383
|
});
|
|
17292
17384
|
};
|
|
17293
|
-
var
|
|
17294
|
-
var
|
|
17385
|
+
var abi7 = chunk5GZ7N47F_cjs.SimpleAccountFactory__factory.abi;
|
|
17386
|
+
var method5 = "hasLegacyAccount";
|
|
17295
17387
|
var getHasV1SmartAccount = async (thor, ownerAddress, networkType) => {
|
|
17296
17388
|
if (!ownerAddress) throw new Error("Owner address is required");
|
|
17297
17389
|
if (!networkType) throw new Error("Network type is required");
|
|
17298
17390
|
const [hasLegacyAccount] = await chunkLMX37RCG_cjs.executeCallClause({
|
|
17299
17391
|
thor,
|
|
17300
|
-
abi:
|
|
17392
|
+
abi: abi7,
|
|
17301
17393
|
contractAddress: chunkLMX37RCG_cjs.getConfig(networkType).accountFactoryAddress,
|
|
17302
|
-
method,
|
|
17394
|
+
method: method5,
|
|
17303
17395
|
args: [ownerAddress]
|
|
17304
17396
|
});
|
|
17305
17397
|
return hasLegacyAccount;
|
|
@@ -17510,15 +17602,15 @@ var useSmartAccount = (ownerAddress) => {
|
|
|
17510
17602
|
enabled: !!ownerAddress && !!network.type && !!thor
|
|
17511
17603
|
});
|
|
17512
17604
|
};
|
|
17513
|
-
var
|
|
17514
|
-
var
|
|
17605
|
+
var abi8 = chunk5GZ7N47F_cjs.SimpleAccountFactory__factory.abi;
|
|
17606
|
+
var method6 = "version";
|
|
17515
17607
|
var getVersion = async (thor, contractAddress) => {
|
|
17516
17608
|
if (!contractAddress) throw new Error("Contract address is required");
|
|
17517
17609
|
const [version] = await chunkLMX37RCG_cjs.executeCallClause({
|
|
17518
17610
|
thor,
|
|
17519
17611
|
contractAddress,
|
|
17520
|
-
abi:
|
|
17521
|
-
method:
|
|
17612
|
+
abi: abi8,
|
|
17613
|
+
method: method6,
|
|
17522
17614
|
args: []
|
|
17523
17615
|
});
|
|
17524
17616
|
return Number(version);
|
|
@@ -17706,1122 +17798,33 @@ var useGetChainId = () => {
|
|
|
17706
17798
|
refetchInterval: 1e4
|
|
17707
17799
|
});
|
|
17708
17800
|
};
|
|
17709
|
-
|
|
17710
|
-
|
|
17711
|
-
|
|
17712
|
-
|
|
17713
|
-
|
|
17714
|
-
|
|
17715
|
-
|
|
17716
|
-
|
|
17717
|
-
|
|
17718
|
-
|
|
17719
|
-
|
|
17720
|
-
}
|
|
17721
|
-
|
|
17722
|
-
|
|
17723
|
-
|
|
17724
|
-
|
|
17725
|
-
|
|
17726
|
-
|
|
17727
|
-
|
|
17728
|
-
|
|
17729
|
-
|
|
17730
|
-
|
|
17731
|
-
|
|
17732
|
-
|
|
17733
|
-
});
|
|
17734
|
-
};
|
|
17735
|
-
var getCustomTokenBalance = async (thor, token, address) => {
|
|
17736
|
-
const res = await thor.contracts.load(token.address, chunk5GZ7N47F_cjs.ERC20__factory.abi).read.balanceOf([address]);
|
|
17737
|
-
if (!res) throw new Error(`Failed to get balance of ${token.address}`);
|
|
17738
|
-
const original = res[0];
|
|
17739
|
-
const scaled = viem.formatEther(BigInt(original));
|
|
17740
|
-
const formatted = scaled === "0" ? "0" : chunkLMX37RCG_cjs.humanNumber(scaled);
|
|
17741
|
-
return {
|
|
17742
|
-
...token,
|
|
17743
|
-
original: original.toString(),
|
|
17744
|
-
scaled,
|
|
17745
|
-
formatted
|
|
17746
|
-
};
|
|
17747
|
-
};
|
|
17748
|
-
var getCustomTokenBalanceQueryKey = (tokenAddress, address) => ["VECHAIN_KIT_BALANCE", address, "CUSTOM_TOKEN", tokenAddress];
|
|
17749
|
-
var useGetCustomTokenBalances = (address) => {
|
|
17750
|
-
const thor = dappKitReact.useThor();
|
|
17751
|
-
const { customTokens } = useCustomTokens();
|
|
17752
|
-
return reactQuery.useQueries({
|
|
17753
|
-
queries: customTokens.map((token) => ({
|
|
17754
|
-
queryKey: getCustomTokenBalanceQueryKey(token.address, address),
|
|
17755
|
-
queryFn: async () => {
|
|
17756
|
-
return await getCustomTokenBalance(thor, token, address);
|
|
17757
|
-
}
|
|
17758
|
-
}))
|
|
17801
|
+
|
|
17802
|
+
// src/hooks/thor/logs/logUtils.ts
|
|
17803
|
+
var MAX_EVENTS_PER_QUERY = 1e3;
|
|
17804
|
+
var getEventLogs = async ({
|
|
17805
|
+
thor,
|
|
17806
|
+
order = "asc",
|
|
17807
|
+
offset = 0,
|
|
17808
|
+
limit = MAX_EVENTS_PER_QUERY,
|
|
17809
|
+
from = 0,
|
|
17810
|
+
to = thor.blocks.getHeadBlock()?.number,
|
|
17811
|
+
filterCriteria
|
|
17812
|
+
}) => {
|
|
17813
|
+
const response = await thor.logs.filterEventLogs({
|
|
17814
|
+
range: {
|
|
17815
|
+
from,
|
|
17816
|
+
to,
|
|
17817
|
+
unit: "block"
|
|
17818
|
+
},
|
|
17819
|
+
options: {
|
|
17820
|
+
offset,
|
|
17821
|
+
limit
|
|
17822
|
+
},
|
|
17823
|
+
order,
|
|
17824
|
+
criteriaSet: filterCriteria
|
|
17759
17825
|
});
|
|
17760
|
-
|
|
17761
|
-
|
|
17762
|
-
if (!tokenAddress) throw new Error("Token address is required");
|
|
17763
|
-
const contract = thor.contracts.load(tokenAddress, chunk5GZ7N47F_cjs.ERC20__factory.abi);
|
|
17764
|
-
const response = await thor.contracts.executeMultipleClausesCall([
|
|
17765
|
-
contract.clause.name(),
|
|
17766
|
-
contract.clause.symbol(),
|
|
17767
|
-
contract.clause.decimals()
|
|
17768
|
-
]);
|
|
17769
|
-
if (response.every((r) => r.success) === false) {
|
|
17770
|
-
throw new Error(`Failed to get token info of ${tokenAddress}`);
|
|
17771
|
-
}
|
|
17772
|
-
const [name, symbol, decimals] = response.map((res) => {
|
|
17773
|
-
return res.result.array?.[0];
|
|
17774
|
-
});
|
|
17775
|
-
return {
|
|
17776
|
-
name,
|
|
17777
|
-
address: tokenAddress,
|
|
17778
|
-
decimals,
|
|
17779
|
-
symbol
|
|
17780
|
-
};
|
|
17781
|
-
};
|
|
17782
|
-
var getCustomTokenInfo = (tokenAddress) => [
|
|
17783
|
-
"VECHAIN_KIT_CUSTOM_TOKEN_BALANCE",
|
|
17784
|
-
tokenAddress
|
|
17785
|
-
];
|
|
17786
|
-
var useGetCustomTokenInfo = (tokenAddress) => {
|
|
17787
|
-
const thor = dappKitReact.useThor();
|
|
17788
|
-
const { network } = useVeChainKitConfig();
|
|
17789
|
-
return reactQuery.useQuery({
|
|
17790
|
-
queryKey: getCustomTokenInfo(tokenAddress),
|
|
17791
|
-
queryFn: async () => getTokenInfo(thor, tokenAddress),
|
|
17792
|
-
enabled: !!thor && !!network.type && !!tokenAddress
|
|
17793
|
-
});
|
|
17794
|
-
};
|
|
17795
|
-
var getErc20Balance = async (thor, tokenAddress, address) => {
|
|
17796
|
-
if (!tokenAddress || !address) {
|
|
17797
|
-
throw new Error("Token address and user address are required");
|
|
17798
|
-
}
|
|
17799
|
-
const res = await thor.contracts.load(tokenAddress, chunk5GZ7N47F_cjs.IERC20__factory.abi).read.balanceOf(address);
|
|
17800
|
-
if (!res) throw new Error(`Failed to get balance of ${tokenAddress}`);
|
|
17801
|
-
const original = res[0].toString();
|
|
17802
|
-
const scaled = ethers.formatEther(original);
|
|
17803
|
-
const formatted = scaled === "0" ? "0" : chunkLMX37RCG_cjs.humanNumber(scaled);
|
|
17804
|
-
return {
|
|
17805
|
-
original,
|
|
17806
|
-
scaled,
|
|
17807
|
-
formatted
|
|
17808
|
-
};
|
|
17809
|
-
};
|
|
17810
|
-
var getErc20BalanceQueryKey = (tokenAddress, address) => ["VECHAIN_KIT", "BALANCE", "ERC20", tokenAddress, address];
|
|
17811
|
-
var useGetErc20Balance = (tokenAddress, address) => {
|
|
17812
|
-
const thor = dappKitReact.useThor();
|
|
17813
|
-
return reactQuery.useQuery({
|
|
17814
|
-
queryKey: getErc20BalanceQueryKey(tokenAddress, address),
|
|
17815
|
-
queryFn: async () => getErc20Balance(thor, tokenAddress, address),
|
|
17816
|
-
enabled: !!thor && !!address && !!tokenAddress
|
|
17817
|
-
});
|
|
17818
|
-
};
|
|
17819
|
-
var getVeDelegateBalance = async (thor, network, address) => {
|
|
17820
|
-
const res = await thor.contracts.load(
|
|
17821
|
-
chunkLMX37RCG_cjs.getConfig(network).veDelegateTokenContractAddress,
|
|
17822
|
-
chunk5GZ7N47F_cjs.IERC20__factory.abi
|
|
17823
|
-
).read.balanceOf(address);
|
|
17824
|
-
if (!res)
|
|
17825
|
-
throw new Error(`Failed to get veDelegate balance for ${address}`);
|
|
17826
|
-
const original = res[0].toString();
|
|
17827
|
-
const scaled = ethers.formatEther(original);
|
|
17828
|
-
const formatted = scaled === "0" ? "0" : chunkLMX37RCG_cjs.humanNumber(scaled);
|
|
17829
|
-
return {
|
|
17830
|
-
original,
|
|
17831
|
-
scaled,
|
|
17832
|
-
formatted
|
|
17833
|
-
};
|
|
17834
|
-
};
|
|
17835
|
-
var getVeDelegateBalanceQueryKey = (address) => [
|
|
17836
|
-
"VECHAIN_KIT_BALANCE",
|
|
17837
|
-
address,
|
|
17838
|
-
"VE_DELEGATE"
|
|
17839
|
-
];
|
|
17840
|
-
var useGetVeDelegateBalance = (address) => {
|
|
17841
|
-
const thor = dappKitReact.useThor();
|
|
17842
|
-
const { network } = useVeChainKitConfig();
|
|
17843
|
-
return reactQuery.useQuery({
|
|
17844
|
-
queryKey: getVeDelegateBalanceQueryKey(address),
|
|
17845
|
-
queryFn: async () => getVeDelegateBalance(thor, network.type, address),
|
|
17846
|
-
enabled: !!thor && !!address && !!network.type
|
|
17847
|
-
});
|
|
17848
|
-
};
|
|
17849
|
-
var getTokensInfoByOwnerQueryKey = (owner) => [
|
|
17850
|
-
"VECHAIN_KIT_GALAXY_MEMBER_TOKENS_INFO",
|
|
17851
|
-
owner
|
|
17852
|
-
];
|
|
17853
|
-
var useGalaxyMemberTokensInfo = (owner, size = 10) => {
|
|
17854
|
-
const { network } = useVeChainKitConfig();
|
|
17855
|
-
const contractAddress = chunkLMX37RCG_cjs.getConfig(network.type).galaxyMemberContractAddress;
|
|
17856
|
-
const thor = dappKitReact.useThor();
|
|
17857
|
-
const fetchTokens = async ({ pageParam = 0 }) => {
|
|
17858
|
-
const data = await thor.contracts.load(contractAddress, chunk5GZ7N47F_cjs.GalaxyMember__factory.abi).read.getTokensInfoByOwner(owner, pageParam, size);
|
|
17859
|
-
if (!data)
|
|
17860
|
-
throw new Error(
|
|
17861
|
-
`Failed to fetch tokens info for page ${pageParam}`
|
|
17862
|
-
);
|
|
17863
|
-
return { data, nextPage: pageParam + 1 };
|
|
17864
|
-
};
|
|
17865
|
-
return reactQuery.useInfiniteQuery({
|
|
17866
|
-
queryKey: getTokensInfoByOwnerQueryKey(owner),
|
|
17867
|
-
queryFn: fetchTokens,
|
|
17868
|
-
getNextPageParam: (lastPage) => lastPage.data.length === size ? lastPage.nextPage : void 0,
|
|
17869
|
-
enabled: !!owner && !!network.type,
|
|
17870
|
-
initialPageParam: 0
|
|
17871
|
-
});
|
|
17872
|
-
};
|
|
17873
|
-
|
|
17874
|
-
// src/hooks/thor/contracts/NodeManagement/useGetUserNodes.ts
|
|
17875
|
-
var contractAbi = chunk5GZ7N47F_cjs.NodeManagement__factory.abi;
|
|
17876
|
-
var method3 = "getUserNodes";
|
|
17877
|
-
var getUserNodesQueryKey = (networkType, user) => getCallClauseQueryKeyWithArgs({
|
|
17878
|
-
abi: contractAbi,
|
|
17879
|
-
address: chunkLMX37RCG_cjs.getConfig(networkType).nodeManagementContractAddress,
|
|
17880
|
-
method: method3,
|
|
17881
|
-
args: [user]
|
|
17882
|
-
});
|
|
17883
|
-
var useGetUserNodes = (userInput) => {
|
|
17884
|
-
const { network } = useVeChainKitConfig();
|
|
17885
|
-
const contractAddress = chunkLMX37RCG_cjs.getConfig(
|
|
17886
|
-
network.type
|
|
17887
|
-
).nodeManagementContractAddress;
|
|
17888
|
-
return useCallClause({
|
|
17889
|
-
address: contractAddress,
|
|
17890
|
-
abi: contractAbi,
|
|
17891
|
-
method: method3,
|
|
17892
|
-
args: [userInput],
|
|
17893
|
-
queryOptions: {
|
|
17894
|
-
enabled: !!userInput && !!network.type && !!contractAddress,
|
|
17895
|
-
select: (response) => {
|
|
17896
|
-
return response[0].map((node) => ({
|
|
17897
|
-
nodeId: node.nodeId.toString(),
|
|
17898
|
-
nodeLevel: Number(node.nodeLevel),
|
|
17899
|
-
xNodeOwner: node.xNodeOwner,
|
|
17900
|
-
isXNodeHolder: node.isXNodeHolder,
|
|
17901
|
-
isXNodeDelegated: node.isXNodeDelegated,
|
|
17902
|
-
isXNodeDelegator: node.isXNodeDelegator,
|
|
17903
|
-
isXNodeDelegatee: node.isXNodeDelegatee,
|
|
17904
|
-
delegatee: node.delegatee
|
|
17905
|
-
}));
|
|
17906
|
-
}
|
|
17907
|
-
}
|
|
17908
|
-
});
|
|
17909
|
-
};
|
|
17910
|
-
var useGetUserNode = useGetUserNodes;
|
|
17911
|
-
var PRICE_FEED_IDS = {
|
|
17912
|
-
B3TR: "0x623374722d757364000000000000000000000000000000000000000000000000",
|
|
17913
|
-
VET: "0x7665742d75736400000000000000000000000000000000000000000000000000",
|
|
17914
|
-
VTHO: "0x7674686f2d757364000000000000000000000000000000000000000000000000",
|
|
17915
|
-
GBP: "0x6762702d75736400000000000000000000000000000000000000000000000000",
|
|
17916
|
-
EUR: "0x657572742d757364000000000000000000000000000000000000000000000000"
|
|
17917
|
-
};
|
|
17918
|
-
var getTokenUsdPrice = async (thor, token, network) => {
|
|
17919
|
-
const res = await thor.contracts.load(
|
|
17920
|
-
chunkLMX37RCG_cjs.getConfig(network).oracleContractAddress,
|
|
17921
|
-
chunk5GZ7N47F_cjs.IVechainEnergyOracleV1__factory.abi
|
|
17922
|
-
).read.getLatestValue(PRICE_FEED_IDS[token]);
|
|
17923
|
-
if (!res) throw new Error(`Failed to get price of ${token}`);
|
|
17924
|
-
return new BigNumber.BigNumber(res[0].toString()).div(1e12).toNumber();
|
|
17925
|
-
};
|
|
17926
|
-
var getTokenUsdPriceQueryKey = (token) => [
|
|
17927
|
-
"VECHAIN_KIT_PRICE",
|
|
17928
|
-
token
|
|
17929
|
-
];
|
|
17930
|
-
var useGetTokenUsdPrice = (token) => {
|
|
17931
|
-
const thor = dappKitReact.useThor();
|
|
17932
|
-
const { network } = useVeChainKitConfig();
|
|
17933
|
-
return reactQuery.useQuery({
|
|
17934
|
-
queryKey: getTokenUsdPriceQueryKey(token),
|
|
17935
|
-
queryFn: async () => getTokenUsdPrice(thor, token, network.type),
|
|
17936
|
-
enabled: !!thor && !!network.type
|
|
17937
|
-
});
|
|
17938
|
-
};
|
|
17939
|
-
var getVot3Balance = async (thor, network, address) => {
|
|
17940
|
-
const res = await thor.contracts.load(chunkLMX37RCG_cjs.getConfig(network).vot3ContractAddress, chunk5GZ7N47F_cjs.VOT3__factory.abi).read.balanceOf(address);
|
|
17941
|
-
if (!res) throw new Error("Reverted");
|
|
17942
|
-
const original = res[0].toString();
|
|
17943
|
-
const scaled = ethers.formatEther(original);
|
|
17944
|
-
const formatted = scaled === "0" ? "0" : chunkLMX37RCG_cjs.humanNumber(scaled);
|
|
17945
|
-
return {
|
|
17946
|
-
original,
|
|
17947
|
-
scaled,
|
|
17948
|
-
formatted
|
|
17949
|
-
};
|
|
17950
|
-
};
|
|
17951
|
-
var getVot3BalanceQueryKey = (address) => [
|
|
17952
|
-
"VEBETTERDAO_BALANCE",
|
|
17953
|
-
address,
|
|
17954
|
-
"VOT3"
|
|
17955
|
-
];
|
|
17956
|
-
var useGetVot3Balance = (address) => {
|
|
17957
|
-
const thor = dappKitReact.useThor();
|
|
17958
|
-
const { network } = useVeChainKitConfig();
|
|
17959
|
-
return reactQuery.useQuery({
|
|
17960
|
-
queryKey: getVot3BalanceQueryKey(address || ""),
|
|
17961
|
-
queryFn: async () => getVot3Balance(thor, network.type, address),
|
|
17962
|
-
enabled: !!thor && !!address && !!network.type
|
|
17963
|
-
});
|
|
17964
|
-
};
|
|
17965
|
-
var contractAbi2 = chunk5GZ7N47F_cjs.VeBetterPassport__factory.abi;
|
|
17966
|
-
var method4 = "isPerson";
|
|
17967
|
-
var getIsPersonQueryKey = (networkType, user) => {
|
|
17968
|
-
const veBetterPassportContractAddress = chunkLMX37RCG_cjs.getConfig(networkType).veBetterPassportContractAddress;
|
|
17969
|
-
return getCallClauseQueryKeyWithArgs({
|
|
17970
|
-
abi: contractAbi2,
|
|
17971
|
-
address: veBetterPassportContractAddress,
|
|
17972
|
-
method: method4,
|
|
17973
|
-
args: [user]
|
|
17974
|
-
});
|
|
17975
|
-
};
|
|
17976
|
-
var useIsPerson = (user, customEnabled = true) => {
|
|
17977
|
-
const { network } = useVeChainKitConfig();
|
|
17978
|
-
const veBetterPassportContractAddress = chunkLMX37RCG_cjs.getConfig(
|
|
17979
|
-
network.type
|
|
17980
|
-
).veBetterPassportContractAddress;
|
|
17981
|
-
return useCallClause({
|
|
17982
|
-
abi: contractAbi2,
|
|
17983
|
-
address: veBetterPassportContractAddress,
|
|
17984
|
-
method: method4,
|
|
17985
|
-
args: [user ?? sdkCore.ZERO_ADDRESS],
|
|
17986
|
-
queryOptions: {
|
|
17987
|
-
enabled: !!user && customEnabled && !!veBetterPassportContractAddress && !!network.type,
|
|
17988
|
-
select: (data) => data[0]
|
|
17989
|
-
}
|
|
17990
|
-
});
|
|
17991
|
-
};
|
|
17992
|
-
var useIsUserPerson = (address) => {
|
|
17993
|
-
return useIsPerson(address);
|
|
17994
|
-
};
|
|
17995
|
-
var contractAbi3 = chunk5GZ7N47F_cjs.VeBetterPassport__factory.abi;
|
|
17996
|
-
var method5 = "isPersonAtTimepoint";
|
|
17997
|
-
var getIsPersonAtTimepointQueryKey = (networkType, user, timepoint) => {
|
|
17998
|
-
const veBetterPassportContractAddress = chunkLMX37RCG_cjs.getConfig(networkType).veBetterPassportContractAddress;
|
|
17999
|
-
return getCallClauseQueryKeyWithArgs({
|
|
18000
|
-
abi: contractAbi3,
|
|
18001
|
-
address: veBetterPassportContractAddress,
|
|
18002
|
-
method: method5,
|
|
18003
|
-
args: [user, Number(timepoint)]
|
|
18004
|
-
});
|
|
18005
|
-
};
|
|
18006
|
-
var useIsPersonAtTimepoint = (user, timepoint, customEnabled = true) => {
|
|
18007
|
-
const { network } = useVeChainKitConfig();
|
|
18008
|
-
const veBetterPassportContractAddress = chunkLMX37RCG_cjs.getConfig(
|
|
18009
|
-
network.type
|
|
18010
|
-
).veBetterPassportContractAddress;
|
|
18011
|
-
return useCallClause({
|
|
18012
|
-
abi: contractAbi3,
|
|
18013
|
-
address: veBetterPassportContractAddress,
|
|
18014
|
-
method: method5,
|
|
18015
|
-
args: [
|
|
18016
|
-
user ?? sdkCore.ZERO_ADDRESS,
|
|
18017
|
-
timepoint ? Number(timepoint) : 0
|
|
18018
|
-
],
|
|
18019
|
-
queryOptions: {
|
|
18020
|
-
enabled: !!user && timepoint !== void 0 && customEnabled && !!veBetterPassportContractAddress && !!network.type,
|
|
18021
|
-
select: (data) => data[0]
|
|
18022
|
-
}
|
|
18023
|
-
});
|
|
18024
|
-
};
|
|
18025
|
-
|
|
18026
|
-
// src/hooks/thor/contracts/VeBetterPassport/useUserBotSignals.ts
|
|
18027
|
-
var contractAbi4 = chunk5GZ7N47F_cjs.VeBetterPassport__factory.abi;
|
|
18028
|
-
var method6 = "signaledCounter";
|
|
18029
|
-
var getUserBotSignalsQueryKey = (networkType, userAddress) => {
|
|
18030
|
-
return getCallClauseQueryKeyWithArgs({
|
|
18031
|
-
abi: contractAbi4,
|
|
18032
|
-
address: chunkLMX37RCG_cjs.getConfig(networkType).veBetterPassportContractAddress,
|
|
18033
|
-
method: method6,
|
|
18034
|
-
args: [userAddress]
|
|
18035
|
-
});
|
|
18036
|
-
};
|
|
18037
|
-
var useUserBotSignals = (userAddressInput) => {
|
|
18038
|
-
const { network } = useVeChainKitConfig();
|
|
18039
|
-
const veBetterPassportContractAddress = chunkLMX37RCG_cjs.getConfig(
|
|
18040
|
-
network.type
|
|
18041
|
-
).veBetterPassportContractAddress;
|
|
18042
|
-
return useCallClause({
|
|
18043
|
-
address: veBetterPassportContractAddress,
|
|
18044
|
-
abi: contractAbi4,
|
|
18045
|
-
method: method6,
|
|
18046
|
-
args: [userAddressInput],
|
|
18047
|
-
queryOptions: {
|
|
18048
|
-
enabled: !!userAddressInput && !!veBetterPassportContractAddress && !!network.type,
|
|
18049
|
-
select: (res) => Number(res[0])
|
|
18050
|
-
}
|
|
18051
|
-
});
|
|
18052
|
-
};
|
|
18053
|
-
var useVotingRewards = (currentRoundId, voter) => {
|
|
18054
|
-
const thor = dappKitReact.useThor();
|
|
18055
|
-
const queryClient = reactQuery.useQueryClient();
|
|
18056
|
-
const { network } = useVeChainKitConfig();
|
|
18057
|
-
const contractAddress = chunkLMX37RCG_cjs.getConfig(network.type).voterRewardsContractAddress;
|
|
18058
|
-
const rounds = React10.useMemo(() => {
|
|
18059
|
-
return Array.from(
|
|
18060
|
-
{ length: parseInt(currentRoundId ?? "0") - 1 },
|
|
18061
|
-
(_, i) => (i + 1).toString()
|
|
18062
|
-
);
|
|
18063
|
-
}, [currentRoundId]);
|
|
18064
|
-
return reactQuery.useQuery({
|
|
18065
|
-
queryKey: getRoundRewardQueryKey("ALL", voter),
|
|
18066
|
-
enabled: !!thor && !!voter && !!currentRoundId && !!rounds.length && !!network.type,
|
|
18067
|
-
queryFn: async () => {
|
|
18068
|
-
const contract = thor.contracts.load(
|
|
18069
|
-
contractAddress,
|
|
18070
|
-
chunk5GZ7N47F_cjs.VoterRewards__factory.abi
|
|
18071
|
-
);
|
|
18072
|
-
const clauses = rounds.map(
|
|
18073
|
-
(roundId) => (
|
|
18074
|
-
// Voter Rewards getReward result type: [ 0n ]
|
|
18075
|
-
contract.clause.getReward(roundId, voter)
|
|
18076
|
-
)
|
|
18077
|
-
);
|
|
18078
|
-
const res = await thor.transactions.executeMultipleClausesCall(
|
|
18079
|
-
clauses
|
|
18080
|
-
);
|
|
18081
|
-
if (!res.every((r) => r.success))
|
|
18082
|
-
throw new Error("Failed to fetch voting rewards");
|
|
18083
|
-
let total = new BigNumber.BigNumber(0);
|
|
18084
|
-
const roundsRewards = res.map((r, index) => {
|
|
18085
|
-
const roundId = rounds[index];
|
|
18086
|
-
const rewards = r.result.plain;
|
|
18087
|
-
const formattedRewards = viem.formatEther(rewards);
|
|
18088
|
-
total = total.plus(BigNumber.BigNumber(rewards.toString()));
|
|
18089
|
-
queryClient.setQueryData(
|
|
18090
|
-
getRoundRewardQueryKey(roundId, voter),
|
|
18091
|
-
{
|
|
18092
|
-
roundId,
|
|
18093
|
-
rewards: formattedRewards
|
|
18094
|
-
}
|
|
18095
|
-
);
|
|
18096
|
-
return {
|
|
18097
|
-
roundId,
|
|
18098
|
-
rewards,
|
|
18099
|
-
formattedRewards
|
|
18100
|
-
};
|
|
18101
|
-
});
|
|
18102
|
-
const totalFormatted = viem.formatEther(BigInt(total.toFixed()));
|
|
18103
|
-
return {
|
|
18104
|
-
total: total.toFixed(),
|
|
18105
|
-
totalFormatted,
|
|
18106
|
-
roundsRewards
|
|
18107
|
-
};
|
|
18108
|
-
}
|
|
18109
|
-
});
|
|
18110
|
-
};
|
|
18111
|
-
var getRoundRewardQueryKey = (roundId, address) => [
|
|
18112
|
-
"VECHAIN_KIT",
|
|
18113
|
-
"roundReward",
|
|
18114
|
-
roundId,
|
|
18115
|
-
"voter",
|
|
18116
|
-
address
|
|
18117
|
-
];
|
|
18118
|
-
var useRoundReward = (address, roundId) => {
|
|
18119
|
-
const { network } = useVeChainKitConfig();
|
|
18120
|
-
return useCallClause({
|
|
18121
|
-
address: chunkLMX37RCG_cjs.getConfig(network.type).voterRewardsContractAddress,
|
|
18122
|
-
abi: chunk5GZ7N47F_cjs.VoterRewards__factory.abi,
|
|
18123
|
-
method: "getReward",
|
|
18124
|
-
args: [BigInt(roundId || 0), address],
|
|
18125
|
-
queryOptions: {
|
|
18126
|
-
enabled: !!address && !!roundId && !!network.type,
|
|
18127
|
-
select: (data) => ({
|
|
18128
|
-
roundId,
|
|
18129
|
-
rewards: viem.formatEther(BigInt(data[0]))
|
|
18130
|
-
})
|
|
18131
|
-
}
|
|
18132
|
-
});
|
|
18133
|
-
};
|
|
18134
|
-
|
|
18135
|
-
// src/hooks/thor/contracts/X2EarnApps/utils/getXAppMetadata.ts
|
|
18136
|
-
var getXAppMetadata = async (uri, networkType) => {
|
|
18137
|
-
const url = chunkLMX37RCG_cjs.convertUriToUrl(uri, networkType);
|
|
18138
|
-
if (!url) return void 0;
|
|
18139
|
-
const response = await fetch(url);
|
|
18140
|
-
if (!response.ok) {
|
|
18141
|
-
return void 0;
|
|
18142
|
-
}
|
|
18143
|
-
return response.json();
|
|
18144
|
-
};
|
|
18145
|
-
|
|
18146
|
-
// src/hooks/thor/contracts/X2EarnApps/utils/getXApps.ts
|
|
18147
|
-
var getXApps = async (thor, networkType) => {
|
|
18148
|
-
const contract = thor.contracts.load(
|
|
18149
|
-
chunkLMX37RCG_cjs.getConfig(networkType).x2EarnAppsContractAddress,
|
|
18150
|
-
chunk5GZ7N47F_cjs.X2EarnApps__factory.abi
|
|
18151
|
-
);
|
|
18152
|
-
const clauses = [contract.clause.unendorsedApps(), contract.clause.apps()];
|
|
18153
|
-
const res = await thor.transactions.executeMultipleClausesCall(clauses);
|
|
18154
|
-
if (!res.every((r) => r.success)) throw new Error(`Failed to fetch xApps`);
|
|
18155
|
-
const apps = res[0]?.result.plain;
|
|
18156
|
-
const unendorsedApps = res[1]?.result.plain;
|
|
18157
|
-
const allApps = {};
|
|
18158
|
-
for (const app of apps) {
|
|
18159
|
-
allApps[app.id] = {
|
|
18160
|
-
id: app.id,
|
|
18161
|
-
teamWalletAddress: app.teamWalletAddress,
|
|
18162
|
-
name: app.name,
|
|
18163
|
-
metadataURI: app.metadataURI,
|
|
18164
|
-
createdAtTimestamp: app.createdAtTimestamp.toString()
|
|
18165
|
-
};
|
|
18166
|
-
}
|
|
18167
|
-
for (const app of unendorsedApps) {
|
|
18168
|
-
allApps[app.id] = {
|
|
18169
|
-
id: app.id,
|
|
18170
|
-
teamWalletAddress: app.teamWalletAddress,
|
|
18171
|
-
name: app.name,
|
|
18172
|
-
metadataURI: app.metadataURI,
|
|
18173
|
-
createdAtTimestamp: app.createdAtTimestamp.toString(),
|
|
18174
|
-
appAvailableForAllocationVoting: app.appAvailableForAllocationVoting
|
|
18175
|
-
};
|
|
18176
|
-
}
|
|
18177
|
-
const unendorsedIds = new Set(unendorsedApps.map((app) => app.id));
|
|
18178
|
-
return {
|
|
18179
|
-
allApps: Object.values(allApps),
|
|
18180
|
-
active: apps.map((app) => ({
|
|
18181
|
-
...app,
|
|
18182
|
-
createdAtTimestamp: app.createdAtTimestamp.toString()
|
|
18183
|
-
})),
|
|
18184
|
-
unendorsed: unendorsedApps.map((app) => ({
|
|
18185
|
-
...app,
|
|
18186
|
-
createdAtTimestamp: app.createdAtTimestamp.toString()
|
|
18187
|
-
})),
|
|
18188
|
-
endorsed: apps.filter((app) => !unendorsedIds.has(app.id)).map((app) => ({
|
|
18189
|
-
...app,
|
|
18190
|
-
createdAtTimestamp: app.createdAtTimestamp.toString()
|
|
18191
|
-
}))
|
|
18192
|
-
};
|
|
18193
|
-
};
|
|
18194
|
-
var abi4 = chunk5GZ7N47F_cjs.XAllocationVoting__factory.abi;
|
|
18195
|
-
var method7 = "getAppsOfRound";
|
|
18196
|
-
var getRoundXApps = async (thor, networkType, roundId) => {
|
|
18197
|
-
if (!roundId) return [];
|
|
18198
|
-
const [xApps] = await chunkLMX37RCG_cjs.executeCallClause({
|
|
18199
|
-
thor,
|
|
18200
|
-
contractAddress: chunkLMX37RCG_cjs.getConfig(networkType).xAllocationVotingContractAddress,
|
|
18201
|
-
abi: abi4,
|
|
18202
|
-
method: method7,
|
|
18203
|
-
args: [BigInt(roundId)]
|
|
18204
|
-
});
|
|
18205
|
-
return xApps.map((app) => ({
|
|
18206
|
-
id: app.id.toString(),
|
|
18207
|
-
teamWalletAddress: app.teamWalletAddress,
|
|
18208
|
-
name: app.name,
|
|
18209
|
-
metadataURI: app.metadataURI,
|
|
18210
|
-
createdAtTimestamp: app.createdAtTimestamp.toString(),
|
|
18211
|
-
appAvailableForAllocationVoting: app.appAvailableForAllocationVoting
|
|
18212
|
-
}));
|
|
18213
|
-
};
|
|
18214
|
-
var getRoundXAppsQueryKey = (roundId) => [
|
|
18215
|
-
"VECHAIN_KIT",
|
|
18216
|
-
"round",
|
|
18217
|
-
roundId,
|
|
18218
|
-
"getXApps"
|
|
18219
|
-
];
|
|
18220
|
-
var useRoundXApps = (roundId) => {
|
|
18221
|
-
const thor = dappKitReact.useThor();
|
|
18222
|
-
const { network } = useVeChainKitConfig();
|
|
18223
|
-
return reactQuery.useQuery({
|
|
18224
|
-
queryKey: getRoundXAppsQueryKey(roundId),
|
|
18225
|
-
queryFn: async () => await getRoundXApps(thor, network.type, roundId),
|
|
18226
|
-
enabled: !!thor && !!roundId && !!network.type
|
|
18227
|
-
});
|
|
18228
|
-
};
|
|
18229
|
-
var getUserVotesInRound = async (thor, network, roundId, address) => {
|
|
18230
|
-
const xAllocationVotingContract = chunkLMX37RCG_cjs.getConfig(network).xAllocationVotingContractAddress;
|
|
18231
|
-
const eventAbi = thor.contracts.load(xAllocationVotingContract, chunk5GZ7N47F_cjs.XAllocationVoting__factory.abi).getEventAbi("AllocationVoteCast");
|
|
18232
|
-
const topics = eventAbi.encodeFilterTopicsNoNull({
|
|
18233
|
-
...address ? { voter: address } : {},
|
|
18234
|
-
...roundId ? { roundId } : {}
|
|
18235
|
-
});
|
|
18236
|
-
const filterCriteria = [
|
|
18237
|
-
{
|
|
18238
|
-
criteria: {
|
|
18239
|
-
address: xAllocationVotingContract,
|
|
18240
|
-
topic0: topics[0] ?? void 0,
|
|
18241
|
-
topic1: topics[1] ?? void 0,
|
|
18242
|
-
topic2: topics[2] ?? void 0,
|
|
18243
|
-
topic3: topics[3] ?? void 0,
|
|
18244
|
-
topic4: topics[4] ?? void 0
|
|
18245
|
-
},
|
|
18246
|
-
eventAbi
|
|
18247
|
-
}
|
|
18248
|
-
];
|
|
18249
|
-
const events = await getAllEventLogs({
|
|
18250
|
-
thor,
|
|
18251
|
-
filterCriteria,
|
|
18252
|
-
nodeUrl: chunkLMX37RCG_cjs.getConfig(network).nodeUrl
|
|
18253
|
-
});
|
|
18254
|
-
const decodedAllocatedVoteEvents = [];
|
|
18255
|
-
events.forEach((event) => {
|
|
18256
|
-
if (!event.decodedData) {
|
|
18257
|
-
throw new Error("Event data not decoded");
|
|
18258
|
-
}
|
|
18259
|
-
if (!chunkLMX37RCG_cjs.compareAddresses(event.address, xAllocationVotingContract)) {
|
|
18260
|
-
throw new Error("Event address not valid");
|
|
18261
|
-
}
|
|
18262
|
-
const [voter, roundId2, appsIds, voteWeights] = event.decodedData;
|
|
18263
|
-
decodedAllocatedVoteEvents.push({
|
|
18264
|
-
voter,
|
|
18265
|
-
roundId: roundId2,
|
|
18266
|
-
appsIds,
|
|
18267
|
-
voteWeights
|
|
18268
|
-
});
|
|
18269
|
-
});
|
|
18270
|
-
return decodedAllocatedVoteEvents;
|
|
18271
|
-
};
|
|
18272
|
-
var getUserVotesInRoundQueryKey = (roundId, address) => [
|
|
18273
|
-
"VECHAIN_KIT",
|
|
18274
|
-
"allocationsRound",
|
|
18275
|
-
roundId,
|
|
18276
|
-
"userVotes",
|
|
18277
|
-
...address ? [address] : []
|
|
18278
|
-
];
|
|
18279
|
-
var useUserVotesInRound = (roundId, address) => {
|
|
18280
|
-
const thor = dappKitReact.useThor();
|
|
18281
|
-
const { network } = useVeChainKitConfig();
|
|
18282
|
-
return reactQuery.useQuery({
|
|
18283
|
-
queryKey: getUserVotesInRoundQueryKey(roundId, address),
|
|
18284
|
-
queryFn: async () => {
|
|
18285
|
-
const votes = await getUserVotesInRound(
|
|
18286
|
-
thor,
|
|
18287
|
-
network.type,
|
|
18288
|
-
roundId,
|
|
18289
|
-
address
|
|
18290
|
-
);
|
|
18291
|
-
if (votes.length > 1) throw new Error("More than one event found");
|
|
18292
|
-
if (votes.length === 0) throw new Error("No event found");
|
|
18293
|
-
return votes[0];
|
|
18294
|
-
},
|
|
18295
|
-
enabled: !!thor && !!thor.blocks.getHeadBlock() && !!roundId && !!address && !!network.type
|
|
18296
|
-
});
|
|
18297
|
-
};
|
|
18298
|
-
var getVotesInRoundQueryKey = (roundId) => [
|
|
18299
|
-
"VECHAIN_KIT",
|
|
18300
|
-
"allocationsRound",
|
|
18301
|
-
roundId,
|
|
18302
|
-
"totalVotes"
|
|
18303
|
-
];
|
|
18304
|
-
var useVotesInRound = (roundId, enabled = true) => {
|
|
18305
|
-
const thor = dappKitReact.useThor();
|
|
18306
|
-
const { network } = useVeChainKitConfig();
|
|
18307
|
-
return reactQuery.useQuery({
|
|
18308
|
-
queryKey: getVotesInRoundQueryKey(roundId),
|
|
18309
|
-
queryFn: async () => await getUserVotesInRound(thor, network.type, roundId),
|
|
18310
|
-
enabled: !!thor && !!thor.blocks.getHeadBlock() && !!roundId && enabled && !!network.type
|
|
18311
|
-
});
|
|
18312
|
-
};
|
|
18313
|
-
var getXAppsQueryKey = () => ["VECHAIN_KIT", "getXApps"];
|
|
18314
|
-
var useXApps = () => {
|
|
18315
|
-
const thor = dappKitReact.useThor();
|
|
18316
|
-
const { network } = useVeChainKitConfig();
|
|
18317
|
-
return reactQuery.useQuery({
|
|
18318
|
-
queryKey: getXAppsQueryKey(),
|
|
18319
|
-
queryFn: async () => await getXApps(thor, network.type),
|
|
18320
|
-
enabled: !!thor && !!network.type
|
|
18321
|
-
});
|
|
18322
|
-
};
|
|
18323
|
-
|
|
18324
|
-
// src/hooks/thor/contracts/X2EarnApps/custom/useXApp.ts
|
|
18325
|
-
var useXApp = (appId) => {
|
|
18326
|
-
const { data: xApps, ...props } = useXApps();
|
|
18327
|
-
const allApps = React10.useMemo(() => [...xApps?.active ?? [], ...xApps?.unendorsed ?? []], [xApps]);
|
|
18328
|
-
const app = allApps.find((xa) => xa.id === appId);
|
|
18329
|
-
return {
|
|
18330
|
-
data: app,
|
|
18331
|
-
...props
|
|
18332
|
-
};
|
|
18333
|
-
};
|
|
18334
|
-
var getXAppMetadataQueryKey = (metadataURI) => [
|
|
18335
|
-
"VECHAIN_KIT",
|
|
18336
|
-
"xApps",
|
|
18337
|
-
metadataURI,
|
|
18338
|
-
"metadata"
|
|
18339
|
-
];
|
|
18340
|
-
var useXAppMetadata = (xAppId) => {
|
|
18341
|
-
const { data: baseUri } = useXAppsMetadataBaseUri();
|
|
18342
|
-
const { data: xApp } = useXApp(xAppId ?? "");
|
|
18343
|
-
const { network } = useVeChainKitConfig();
|
|
18344
|
-
return reactQuery.useQuery({
|
|
18345
|
-
queryKey: getXAppMetadataQueryKey(xApp?.metadataURI || ""),
|
|
18346
|
-
queryFn: async () => !(!baseUri && xApp) ? await getXAppMetadata(
|
|
18347
|
-
`${baseUri}${xApp?.metadataURI}`,
|
|
18348
|
-
network.type
|
|
18349
|
-
) : null,
|
|
18350
|
-
enabled: !!baseUri && !!xApp && !!network.type
|
|
18351
|
-
});
|
|
18352
|
-
};
|
|
18353
|
-
var getXAppsSharesQueryKey = (roundId) => [
|
|
18354
|
-
"VECHAIN_KIT",
|
|
18355
|
-
"XApps",
|
|
18356
|
-
"Shares",
|
|
18357
|
-
roundId
|
|
18358
|
-
];
|
|
18359
|
-
var useXAppsShares = (apps, roundId) => {
|
|
18360
|
-
const thor = dappKitReact.useThor();
|
|
18361
|
-
const { network } = useVeChainKitConfig();
|
|
18362
|
-
return reactQuery.useQuery({
|
|
18363
|
-
queryKey: getXAppsSharesQueryKey(roundId),
|
|
18364
|
-
queryFn: async () => {
|
|
18365
|
-
const contract = thor.contracts.load(
|
|
18366
|
-
chunkLMX37RCG_cjs.getConfig(network.type).xAllocationPoolContractAddress,
|
|
18367
|
-
chunk5GZ7N47F_cjs.XAllocationPool__factory.abi
|
|
18368
|
-
);
|
|
18369
|
-
const clauses = apps.map(
|
|
18370
|
-
(app) => contract.clause.getAppShares(roundId, app)
|
|
18371
|
-
);
|
|
18372
|
-
const res = await thor.transactions.executeMultipleClausesCall(
|
|
18373
|
-
clauses
|
|
18374
|
-
);
|
|
18375
|
-
if (!res.every((r) => r.success))
|
|
18376
|
-
throw new Error(
|
|
18377
|
-
`Failed to fetch xApps shares for ${apps} in round ${roundId}`
|
|
18378
|
-
);
|
|
18379
|
-
const shares = res.map((r, index) => {
|
|
18380
|
-
return {
|
|
18381
|
-
app: apps[index],
|
|
18382
|
-
share: Number(r.result.array?.[0] || 0) / 100,
|
|
18383
|
-
unallocatedShare: Number(r.result.array?.[1] || 0) / 100
|
|
18384
|
-
};
|
|
18385
|
-
});
|
|
18386
|
-
return shares;
|
|
18387
|
-
},
|
|
18388
|
-
enabled: !!roundId && !!apps.length
|
|
18389
|
-
});
|
|
18390
|
-
};
|
|
18391
|
-
|
|
18392
|
-
// src/hooks/thor/contracts/X2EarnApps/custom/useMostVotedAppsInRound.ts
|
|
18393
|
-
var useMostVotedAppsInRound = (roundId) => {
|
|
18394
|
-
const { data: roundXApps } = useRoundXApps(roundId);
|
|
18395
|
-
const { data: allXApps } = useXApps();
|
|
18396
|
-
const apps = roundId === "0" ? allXApps?.active : roundXApps;
|
|
18397
|
-
const xAppsShares = useXAppsShares(
|
|
18398
|
-
apps?.map((app) => app.id) ?? [],
|
|
18399
|
-
roundId
|
|
18400
|
-
);
|
|
18401
|
-
const mostVotedApps = React10.useMemo(
|
|
18402
|
-
() => xAppsShares.data?.map((appShares) => ({
|
|
18403
|
-
percentage: appShares.share + appShares.unallocatedShare,
|
|
18404
|
-
id: apps?.find((xa) => xa.id === appShares.app)?.id ?? "",
|
|
18405
|
-
app: apps?.find((xa) => xa.id === appShares.app) ?? {}
|
|
18406
|
-
})).sort((a, b) => Number(b.percentage) - Number(a.percentage)) ?? [],
|
|
18407
|
-
[xAppsShares.data, apps]
|
|
18408
|
-
);
|
|
18409
|
-
return {
|
|
18410
|
-
data: mostVotedApps,
|
|
18411
|
-
isLoading: xAppsShares.isLoading
|
|
18412
|
-
};
|
|
18413
|
-
};
|
|
18414
|
-
|
|
18415
|
-
// src/hooks/thor/contracts/X2EarnApps/useXAppsMetadataBaseUri.ts
|
|
18416
|
-
var abi5 = chunk5GZ7N47F_cjs.X2EarnApps__factory.abi;
|
|
18417
|
-
var method8 = "baseURI";
|
|
18418
|
-
var getXAppsMetadataBaseUriQueryKey = (network) => getCallClauseQueryKeyWithArgs({
|
|
18419
|
-
abi: abi5,
|
|
18420
|
-
method: method8,
|
|
18421
|
-
address: chunkLMX37RCG_cjs.getConfig(network).x2EarnAppsContractAddress,
|
|
18422
|
-
args: []
|
|
18423
|
-
});
|
|
18424
|
-
var useXAppsMetadataBaseUri = () => {
|
|
18425
|
-
const { network } = useVeChainKitConfig();
|
|
18426
|
-
return useCallClause({
|
|
18427
|
-
abi: abi5,
|
|
18428
|
-
address: chunkLMX37RCG_cjs.getConfig(network.type).x2EarnAppsContractAddress,
|
|
18429
|
-
method: method8,
|
|
18430
|
-
args: [],
|
|
18431
|
-
queryOptions: {
|
|
18432
|
-
enabled: !!network.type,
|
|
18433
|
-
staleTime: 1e3 * 60 * 60
|
|
18434
|
-
// 1 hour,
|
|
18435
|
-
}
|
|
18436
|
-
});
|
|
18437
|
-
};
|
|
18438
|
-
var getXAppRoundEarnings = async (thor, roundId, xAppId, networkType) => {
|
|
18439
|
-
const res = await thor.contracts.load(
|
|
18440
|
-
chunkLMX37RCG_cjs.getConfig(networkType).xAllocationPoolContractAddress,
|
|
18441
|
-
chunk5GZ7N47F_cjs.XAllocationPool__factory.abi
|
|
18442
|
-
).read.roundEarnings(roundId, xAppId);
|
|
18443
|
-
if (!res)
|
|
18444
|
-
throw new Error(
|
|
18445
|
-
`Failed to fetch xApp round earnings for ${xAppId} in round ${roundId}`
|
|
18446
|
-
);
|
|
18447
|
-
return { amount: viem.formatEther(BigInt(res[0] || 0)), appId: xAppId };
|
|
18448
|
-
};
|
|
18449
|
-
var getXAppRoundEarningsQueryKey = (roundId, xAppId) => [
|
|
18450
|
-
"VECHAIN_KIT",
|
|
18451
|
-
"roundEarnings",
|
|
18452
|
-
"roundId",
|
|
18453
|
-
Number(roundId),
|
|
18454
|
-
"appId",
|
|
18455
|
-
...xAppId ? [xAppId] : []
|
|
18456
|
-
];
|
|
18457
|
-
var useXAppRoundEarnings = (roundId, xAppId) => {
|
|
18458
|
-
const thor = dappKitReact.useThor();
|
|
18459
|
-
const queryClient = getOrCreateQueryClient();
|
|
18460
|
-
const { network } = useVeChainKitConfig();
|
|
18461
|
-
return reactQuery.useQuery({
|
|
18462
|
-
queryKey: getXAppRoundEarningsQueryKey(roundId, xAppId),
|
|
18463
|
-
queryFn: async () => {
|
|
18464
|
-
const data = await queryClient.ensureQueryData({
|
|
18465
|
-
queryFn: () => getRoundXApps(thor, network.type, roundId),
|
|
18466
|
-
queryKey: getRoundXAppsQueryKey(roundId)
|
|
18467
|
-
});
|
|
18468
|
-
const isXAppInRound = data.some((app) => app.id === xAppId);
|
|
18469
|
-
if (!isXAppInRound) return { amount: "0", xAppId };
|
|
18470
|
-
return await getXAppRoundEarnings(
|
|
18471
|
-
thor,
|
|
18472
|
-
roundId,
|
|
18473
|
-
xAppId,
|
|
18474
|
-
network.type
|
|
18475
|
-
);
|
|
18476
|
-
},
|
|
18477
|
-
enabled: !!thor && !!roundId && !!xAppId
|
|
18478
|
-
});
|
|
18479
|
-
};
|
|
18480
|
-
var useMultipleXAppRoundEarnings = (roundId, xAppIds) => {
|
|
18481
|
-
const thor = dappKitReact.useThor();
|
|
18482
|
-
const queryClient = getOrCreateQueryClient();
|
|
18483
|
-
const { network } = useVeChainKitConfig();
|
|
18484
|
-
return reactQuery.useQuery({
|
|
18485
|
-
queryKey: getXAppRoundEarningsQueryKey(roundId, "ALL"),
|
|
18486
|
-
queryFn: async () => {
|
|
18487
|
-
const data = await queryClient.ensureQueryData({
|
|
18488
|
-
queryFn: () => getRoundXApps(thor, network.type, roundId),
|
|
18489
|
-
queryKey: getRoundXAppsQueryKey(roundId)
|
|
18490
|
-
});
|
|
18491
|
-
const xAllocationPoolContract = chunkLMX37RCG_cjs.getConfig(
|
|
18492
|
-
network.type
|
|
18493
|
-
).xAllocationPoolContractAddress;
|
|
18494
|
-
const xAppsInRound = data.filter((app) => xAppIds.includes(app.id));
|
|
18495
|
-
const contract = thor.contracts.load(
|
|
18496
|
-
xAllocationPoolContract,
|
|
18497
|
-
chunk5GZ7N47F_cjs.XAllocationPool__factory.abi
|
|
18498
|
-
);
|
|
18499
|
-
const clauses = xAppsInRound.map(
|
|
18500
|
-
(app) => contract.clause.roundEarnings(roundId, app.id)
|
|
18501
|
-
);
|
|
18502
|
-
const res = await thor.transactions.executeMultipleClausesCall(
|
|
18503
|
-
clauses
|
|
18504
|
-
);
|
|
18505
|
-
if (!res.every((r) => r.success))
|
|
18506
|
-
throw new Error("Failed to fetch xApp round earnings");
|
|
18507
|
-
const decoded = res.map((earnings, index) => {
|
|
18508
|
-
const parsedAmount = viem.formatEther(
|
|
18509
|
-
earnings.result.plain
|
|
18510
|
-
);
|
|
18511
|
-
const appId = xAppsInRound[index]?.id;
|
|
18512
|
-
queryClient.setQueryData(
|
|
18513
|
-
getXAppRoundEarningsQueryKey(roundId, appId),
|
|
18514
|
-
{
|
|
18515
|
-
amount: parsedAmount,
|
|
18516
|
-
appId
|
|
18517
|
-
}
|
|
18518
|
-
);
|
|
18519
|
-
return { amount: parsedAmount, appId };
|
|
18520
|
-
});
|
|
18521
|
-
return decoded;
|
|
18522
|
-
},
|
|
18523
|
-
enabled: !!thor && !!roundId && !!xAppIds.length
|
|
18524
|
-
});
|
|
18525
|
-
};
|
|
18526
|
-
var getXAppTotalEarningsQueryKey = (tillRoundId, appId) => [
|
|
18527
|
-
"VECHAIN_KIT",
|
|
18528
|
-
"XAllocationPool",
|
|
18529
|
-
"xApp",
|
|
18530
|
-
appId,
|
|
18531
|
-
"totalEarningsTillRound",
|
|
18532
|
-
tillRoundId
|
|
18533
|
-
];
|
|
18534
|
-
var useXAppTotalEarnings = (roundIds, appId) => {
|
|
18535
|
-
const thor = dappKitReact.useThor();
|
|
18536
|
-
const { network } = useVeChainKitConfig();
|
|
18537
|
-
const queryClient = getOrCreateQueryClient();
|
|
18538
|
-
const lastRound = roundIds[roundIds.length - 1] ?? 0;
|
|
18539
|
-
return reactQuery.useQuery({
|
|
18540
|
-
queryKey: getXAppTotalEarningsQueryKey(lastRound, appId),
|
|
18541
|
-
queryFn: async () => {
|
|
18542
|
-
const contract = thor.contracts.load(
|
|
18543
|
-
chunkLMX37RCG_cjs.getConfig(network.type).xAllocationPoolContractAddress,
|
|
18544
|
-
chunk5GZ7N47F_cjs.XAllocationPool__factory.abi
|
|
18545
|
-
);
|
|
18546
|
-
const clauses = roundIds.map(
|
|
18547
|
-
(roundId) => contract.clause.roundEarnings(roundId, appId)
|
|
18548
|
-
);
|
|
18549
|
-
const res = await thor.transactions.executeMultipleClausesCall(
|
|
18550
|
-
clauses
|
|
18551
|
-
);
|
|
18552
|
-
if (!res.every((r) => r.success))
|
|
18553
|
-
throw new Error(
|
|
18554
|
-
`Failed to fetch xApp total earnings of ${appId}`
|
|
18555
|
-
);
|
|
18556
|
-
const decoded = res.map((r, index) => {
|
|
18557
|
-
const parsedAmount = viem.formatEther(
|
|
18558
|
-
r.result.plain || BigInt(0)
|
|
18559
|
-
);
|
|
18560
|
-
queryClient.setQueryData(
|
|
18561
|
-
getXAppRoundEarningsQueryKey(
|
|
18562
|
-
roundIds[index],
|
|
18563
|
-
appId
|
|
18564
|
-
),
|
|
18565
|
-
{
|
|
18566
|
-
amount: parsedAmount,
|
|
18567
|
-
appId
|
|
18568
|
-
}
|
|
18569
|
-
);
|
|
18570
|
-
return parsedAmount;
|
|
18571
|
-
});
|
|
18572
|
-
return decoded.reduce((acc, amount) => {
|
|
18573
|
-
return acc + Number(amount);
|
|
18574
|
-
}, 0);
|
|
18575
|
-
}
|
|
18576
|
-
});
|
|
18577
|
-
};
|
|
18578
|
-
|
|
18579
|
-
// src/hooks/thor/contracts/XAllocationVoting/useAllocationsRoundState.ts
|
|
18580
|
-
var RoundState = {
|
|
18581
|
-
0: "Active",
|
|
18582
|
-
1: "Failed",
|
|
18583
|
-
2: "Succeeded"
|
|
18584
|
-
};
|
|
18585
|
-
var abi6 = chunk5GZ7N47F_cjs.XAllocationVoting__factory.abi;
|
|
18586
|
-
var method9 = "state";
|
|
18587
|
-
var getAllocationsRoundStateQueryKey = (roundId, network) => getCallClauseQueryKeyWithArgs({
|
|
18588
|
-
abi: abi6,
|
|
18589
|
-
method: method9,
|
|
18590
|
-
address: chunkLMX37RCG_cjs.getConfig(network).xAllocationVotingContractAddress,
|
|
18591
|
-
args: [BigInt(roundId || 0)]
|
|
18592
|
-
});
|
|
18593
|
-
var useAllocationsRoundState = (roundId) => {
|
|
18594
|
-
const { network } = useVeChainKitConfig();
|
|
18595
|
-
return useCallClause({
|
|
18596
|
-
abi: abi6,
|
|
18597
|
-
address: chunkLMX37RCG_cjs.getConfig(network.type).xAllocationVotingContractAddress,
|
|
18598
|
-
method: method9,
|
|
18599
|
-
args: [BigInt(roundId || 0)],
|
|
18600
|
-
queryOptions: {
|
|
18601
|
-
enabled: !!roundId && !!network.type,
|
|
18602
|
-
select: (data) => data[0]
|
|
18603
|
-
}
|
|
18604
|
-
});
|
|
18605
|
-
};
|
|
18606
|
-
|
|
18607
|
-
// src/hooks/thor/contracts/XAllocationVoting/useCurrentAllocationsRoundId.ts
|
|
18608
|
-
var abi7 = chunk5GZ7N47F_cjs.XAllocationVoting__factory.abi;
|
|
18609
|
-
var method10 = "currentRoundId";
|
|
18610
|
-
var getCurrentAllocationsRoundIdQueryKey = (network) => getCallClauseQueryKeyWithArgs({
|
|
18611
|
-
abi: abi7,
|
|
18612
|
-
method: method10,
|
|
18613
|
-
address: chunkLMX37RCG_cjs.getConfig(network).xAllocationVotingContractAddress,
|
|
18614
|
-
args: []
|
|
18615
|
-
});
|
|
18616
|
-
var useCurrentAllocationsRoundId = () => {
|
|
18617
|
-
const { network } = useVeChainKitConfig();
|
|
18618
|
-
return useCallClause({
|
|
18619
|
-
abi: abi7,
|
|
18620
|
-
address: chunkLMX37RCG_cjs.getConfig(network.type).xAllocationVotingContractAddress,
|
|
18621
|
-
method: method10,
|
|
18622
|
-
args: [],
|
|
18623
|
-
queryOptions: {
|
|
18624
|
-
enabled: !!network.type,
|
|
18625
|
-
select: (data) => data[0].toString()
|
|
18626
|
-
}
|
|
18627
|
-
});
|
|
18628
|
-
};
|
|
18629
|
-
|
|
18630
|
-
// src/hooks/thor/contracts/XAllocationVoting/useHasVotedInRound.ts
|
|
18631
|
-
var method11 = "hasVoted";
|
|
18632
|
-
var abi8 = chunk5GZ7N47F_cjs.XAllocationVoting__factory.abi;
|
|
18633
|
-
var getHasVotedInRoundQueryKey = (roundId, address, networkType) => getCallClauseQueryKeyWithArgs({
|
|
18634
|
-
abi: abi8,
|
|
18635
|
-
address: chunkLMX37RCG_cjs.getConfig(networkType).xAllocationVotingContractAddress,
|
|
18636
|
-
method: method11,
|
|
18637
|
-
args: [BigInt(roundId || 0), address]
|
|
18638
|
-
});
|
|
18639
|
-
var useHasVotedInRound = (roundId, address) => {
|
|
18640
|
-
const { network } = useVeChainKitConfig();
|
|
18641
|
-
return useCallClause({
|
|
18642
|
-
abi: abi8,
|
|
18643
|
-
address: chunkLMX37RCG_cjs.getConfig(network.type).xAllocationVotingContractAddress,
|
|
18644
|
-
method: method11,
|
|
18645
|
-
args: [BigInt(roundId || 0), address],
|
|
18646
|
-
queryOptions: {
|
|
18647
|
-
enabled: !!roundId && !!address,
|
|
18648
|
-
select: (data) => data[0]
|
|
18649
|
-
}
|
|
18650
|
-
});
|
|
18651
|
-
};
|
|
18652
|
-
var getAllocationsRoundsEvents = async (thor, networkType) => {
|
|
18653
|
-
const xAllocationVotingContract = chunkLMX37RCG_cjs.getConfig(networkType).xAllocationVotingContractAddress;
|
|
18654
|
-
const eventAbi = thor.contracts.load(xAllocationVotingContract, chunk5GZ7N47F_cjs.XAllocationVoting__factory.abi).getEventAbi("RoundCreated");
|
|
18655
|
-
const events = await getAllEventLogs({
|
|
18656
|
-
thor,
|
|
18657
|
-
filterCriteria: [
|
|
18658
|
-
{
|
|
18659
|
-
criteria: {
|
|
18660
|
-
address: xAllocationVotingContract,
|
|
18661
|
-
topic0: eventAbi.signatureHash
|
|
18662
|
-
},
|
|
18663
|
-
eventAbi
|
|
18664
|
-
}
|
|
18665
|
-
],
|
|
18666
|
-
nodeUrl: chunkLMX37RCG_cjs.getConfig(networkType).nodeUrl
|
|
18667
|
-
});
|
|
18668
|
-
const decodedCreatedAllocationEvents = [];
|
|
18669
|
-
events.forEach((event) => {
|
|
18670
|
-
if (!event.decodedData) {
|
|
18671
|
-
throw new Error("Event data not decoded");
|
|
18672
|
-
}
|
|
18673
|
-
if (!chunkLMX37RCG_cjs.compareAddresses(event.address, xAllocationVotingContract)) {
|
|
18674
|
-
throw new Error("Event address not valid");
|
|
18675
|
-
}
|
|
18676
|
-
const [roundId, proposer, voteStart, voteEnd, appsIds] = event.decodedData;
|
|
18677
|
-
decodedCreatedAllocationEvents.push({
|
|
18678
|
-
roundId: roundId.toString(),
|
|
18679
|
-
proposer,
|
|
18680
|
-
voteStart: voteStart.toString(),
|
|
18681
|
-
voteEnd: voteEnd.toString(),
|
|
18682
|
-
appsIds: appsIds.map((appId) => appId.toString())
|
|
18683
|
-
});
|
|
18684
|
-
});
|
|
18685
|
-
return {
|
|
18686
|
-
created: decodedCreatedAllocationEvents
|
|
18687
|
-
};
|
|
18688
|
-
};
|
|
18689
|
-
var getAllocationsRoundsEventsQueryKey = () => [
|
|
18690
|
-
"VECHAIN_KIT",
|
|
18691
|
-
"allocationRoundsEvents"
|
|
18692
|
-
];
|
|
18693
|
-
var useAllocationsRoundsEvents = () => {
|
|
18694
|
-
const thor = dappKitReact.useThor();
|
|
18695
|
-
const { network } = useVeChainKitConfig();
|
|
18696
|
-
return reactQuery.useQuery({
|
|
18697
|
-
queryKey: getAllocationsRoundsEventsQueryKey(),
|
|
18698
|
-
queryFn: async () => await getAllocationsRoundsEvents(thor, network.type),
|
|
18699
|
-
enabled: !!thor && !!network.type
|
|
18700
|
-
});
|
|
18701
|
-
};
|
|
18702
|
-
|
|
18703
|
-
// src/hooks/thor/contracts/XAllocationVoting/custom/useCurrentAllocationsRound.ts
|
|
18704
|
-
var useCurrentAllocationsRound = () => {
|
|
18705
|
-
const currentRoundId = useCurrentAllocationsRoundId();
|
|
18706
|
-
const allocationsRound = useAllocationsRound(currentRoundId.data);
|
|
18707
|
-
return {
|
|
18708
|
-
...allocationsRound,
|
|
18709
|
-
isLoading: currentRoundId.isLoading || allocationsRound.isLoading,
|
|
18710
|
-
isError: currentRoundId.isError || allocationsRound.isError,
|
|
18711
|
-
error: currentRoundId.error || allocationsRound.error
|
|
18712
|
-
};
|
|
18713
|
-
};
|
|
18714
|
-
var useAllocationsRound = (roundId) => {
|
|
18715
|
-
const { data: currentBlock } = useCurrentBlock();
|
|
18716
|
-
const currentAllocationId = useCurrentAllocationsRoundId();
|
|
18717
|
-
const currentAllocationState = useAllocationsRoundState(roundId);
|
|
18718
|
-
const allocationRoundsEvents = useAllocationsRoundsEvents();
|
|
18719
|
-
const { network } = useVeChainKitConfig();
|
|
18720
|
-
const currentAllocationRound = React10.useMemo(() => {
|
|
18721
|
-
if (!currentAllocationId.data || !allocationRoundsEvents.data)
|
|
18722
|
-
return;
|
|
18723
|
-
const roundInfo = allocationRoundsEvents.data.created.find(
|
|
18724
|
-
(allocationRound) => allocationRound.roundId === roundId
|
|
18725
|
-
);
|
|
18726
|
-
if (!roundInfo) return;
|
|
18727
|
-
return {
|
|
18728
|
-
...roundInfo,
|
|
18729
|
-
state: currentAllocationState.data,
|
|
18730
|
-
isCurrent: roundId === currentAllocationId.data
|
|
18731
|
-
};
|
|
18732
|
-
}, [
|
|
18733
|
-
currentAllocationId,
|
|
18734
|
-
allocationRoundsEvents,
|
|
18735
|
-
currentAllocationState,
|
|
18736
|
-
roundId
|
|
18737
|
-
]);
|
|
18738
|
-
const isLoading = currentAllocationId.isLoading || allocationRoundsEvents.isLoading || currentAllocationState.isLoading;
|
|
18739
|
-
const isError = currentAllocationId.isError || allocationRoundsEvents.isError || currentAllocationState.isError;
|
|
18740
|
-
const error = currentAllocationId.error || allocationRoundsEvents.error || currentAllocationState.error;
|
|
18741
|
-
const blockTime = chunkLMX37RCG_cjs.getConfig(network.type).network.blockTime;
|
|
18742
|
-
const estimatedEndTime = React10.useMemo(() => {
|
|
18743
|
-
if (!currentAllocationRound) return null;
|
|
18744
|
-
const endBlock = Number(currentAllocationRound.voteEnd);
|
|
18745
|
-
if (!endBlock || !currentBlock) return null;
|
|
18746
|
-
const endBlockFromNow = endBlock - currentBlock.number;
|
|
18747
|
-
const durationLeftTimestamp = endBlockFromNow * blockTime;
|
|
18748
|
-
return Date.now() + durationLeftTimestamp;
|
|
18749
|
-
}, [currentBlock, currentAllocationRound, blockTime]);
|
|
18750
|
-
const estimatedStartTime = React10.useMemo(() => {
|
|
18751
|
-
if (!currentAllocationRound) return null;
|
|
18752
|
-
const startBlock = Number(currentAllocationRound.voteStart);
|
|
18753
|
-
if (!startBlock || !currentBlock) return null;
|
|
18754
|
-
const endBlockFromNow = startBlock - currentBlock.number;
|
|
18755
|
-
const durationLeftTimestamp = endBlockFromNow * blockTime;
|
|
18756
|
-
return Date.now() + durationLeftTimestamp;
|
|
18757
|
-
}, [currentBlock, currentAllocationRound, blockTime]);
|
|
18758
|
-
const isFirstRound = currentAllocationRound?.roundId === "1";
|
|
18759
|
-
const isLastRound = currentAllocationRound?.roundId === allocationRoundsEvents?.data?.created.length.toString();
|
|
18760
|
-
return {
|
|
18761
|
-
...allocationRoundsEvents,
|
|
18762
|
-
data: {
|
|
18763
|
-
...currentAllocationRound,
|
|
18764
|
-
voteStartTimestamp: estimatedStartTime,
|
|
18765
|
-
voteEndTimestamp: estimatedEndTime,
|
|
18766
|
-
isFirstRound,
|
|
18767
|
-
isLastRound
|
|
18768
|
-
},
|
|
18769
|
-
isLoading,
|
|
18770
|
-
isError,
|
|
18771
|
-
error
|
|
18772
|
-
};
|
|
18773
|
-
};
|
|
18774
|
-
var contractAbi5 = chunk5GZ7N47F_cjs.XAllocationVotingGovernor__factory.abi;
|
|
18775
|
-
var method12 = "getAppVotes";
|
|
18776
|
-
var getXAppVotesQueryKey = (networkType, roundId, appId) => getCallClauseQueryKeyWithArgs({
|
|
18777
|
-
abi: contractAbi5,
|
|
18778
|
-
address: chunkLMX37RCG_cjs.getConfig(networkType).xAllocationVotingContractAddress,
|
|
18779
|
-
method: method12,
|
|
18780
|
-
args: [BigInt(roundId || 0), appId]
|
|
18781
|
-
});
|
|
18782
|
-
var useXAppVotes = (roundId, appId) => {
|
|
18783
|
-
const { network } = useVeChainKitConfig();
|
|
18784
|
-
const contractAddress = chunkLMX37RCG_cjs.getConfig(
|
|
18785
|
-
network.type
|
|
18786
|
-
).xAllocationVotingContractAddress;
|
|
18787
|
-
return useCallClause({
|
|
18788
|
-
address: contractAddress,
|
|
18789
|
-
abi: contractAbi5,
|
|
18790
|
-
method: method12,
|
|
18791
|
-
args: [BigInt(roundId || 0), appId],
|
|
18792
|
-
queryOptions: {
|
|
18793
|
-
enabled: !!roundId && !!appId && !!network.type,
|
|
18794
|
-
select: (res) => viem.formatEther(BigInt(res[0]))
|
|
18795
|
-
}
|
|
18796
|
-
});
|
|
18797
|
-
};
|
|
18798
|
-
|
|
18799
|
-
// src/hooks/thor/logs/logUtils.ts
|
|
18800
|
-
var MAX_EVENTS_PER_QUERY = 1e3;
|
|
18801
|
-
var getEventLogs = async ({
|
|
18802
|
-
thor,
|
|
18803
|
-
order = "asc",
|
|
18804
|
-
offset = 0,
|
|
18805
|
-
limit = MAX_EVENTS_PER_QUERY,
|
|
18806
|
-
from = 0,
|
|
18807
|
-
to = thor.blocks.getHeadBlock()?.number,
|
|
18808
|
-
filterCriteria
|
|
18809
|
-
}) => {
|
|
18810
|
-
const response = await thor.logs.filterEventLogs({
|
|
18811
|
-
range: {
|
|
18812
|
-
from,
|
|
18813
|
-
to,
|
|
18814
|
-
unit: "block"
|
|
18815
|
-
},
|
|
18816
|
-
options: {
|
|
18817
|
-
offset,
|
|
18818
|
-
limit
|
|
18819
|
-
},
|
|
18820
|
-
order,
|
|
18821
|
-
criteriaSet: filterCriteria
|
|
18822
|
-
});
|
|
18823
|
-
if (!response) throw new Error("Failed to fetch events");
|
|
18824
|
-
return response;
|
|
17826
|
+
if (!response) throw new Error("Failed to fetch events");
|
|
17827
|
+
return response;
|
|
18825
17828
|
};
|
|
18826
17829
|
var getAllEventLogs = async ({
|
|
18827
17830
|
nodeUrl,
|
|
@@ -19204,6 +18207,164 @@ var useTxReceipt = (txId, blockTimeout = 5) => {
|
|
|
19204
18207
|
enabled: !!txId
|
|
19205
18208
|
});
|
|
19206
18209
|
};
|
|
18210
|
+
|
|
18211
|
+
// src/hooks/utils/useEvents.ts
|
|
18212
|
+
var decodeEventLog = (event, abi9) => {
|
|
18213
|
+
const decodedData = viem.decodeEventLog({
|
|
18214
|
+
abi: abi9,
|
|
18215
|
+
data: event.data.toString(),
|
|
18216
|
+
topics: event.topics.map((topic) => topic.toString())
|
|
18217
|
+
});
|
|
18218
|
+
return {
|
|
18219
|
+
meta: event.meta,
|
|
18220
|
+
decodedData
|
|
18221
|
+
};
|
|
18222
|
+
};
|
|
18223
|
+
var getEventsKey = ({
|
|
18224
|
+
eventName,
|
|
18225
|
+
filterParams
|
|
18226
|
+
}) => {
|
|
18227
|
+
return [eventName, filterParams ? JSON.stringify(filterParams) : "all"];
|
|
18228
|
+
};
|
|
18229
|
+
var useEvents = ({
|
|
18230
|
+
abi: abi9,
|
|
18231
|
+
contractAddress,
|
|
18232
|
+
eventName,
|
|
18233
|
+
filterParams,
|
|
18234
|
+
mapResponse,
|
|
18235
|
+
nodeUrl
|
|
18236
|
+
}) => {
|
|
18237
|
+
const thor = dappKitReact.useThor();
|
|
18238
|
+
const queryFn = React10.useCallback(async () => {
|
|
18239
|
+
if (!thor) return [];
|
|
18240
|
+
const eventAbi = thor.contracts.load(contractAddress, abi9).getEventAbi(eventName);
|
|
18241
|
+
const topics = eventAbi.encodeFilterTopicsNoNull(filterParams ?? {});
|
|
18242
|
+
const filterCriteria = [
|
|
18243
|
+
{
|
|
18244
|
+
criteria: {
|
|
18245
|
+
address: contractAddress,
|
|
18246
|
+
topic0: topics[0] ?? void 0,
|
|
18247
|
+
topic1: topics[1] ?? void 0,
|
|
18248
|
+
topic2: topics[2] ?? void 0,
|
|
18249
|
+
topic3: topics[3] ?? void 0,
|
|
18250
|
+
topic4: topics[4] ?? void 0
|
|
18251
|
+
},
|
|
18252
|
+
eventAbi
|
|
18253
|
+
}
|
|
18254
|
+
];
|
|
18255
|
+
const events = (await getAllEventLogs({ thor, nodeUrl, filterCriteria })).map((event) => decodeEventLog(event, abi9));
|
|
18256
|
+
if (events.some(
|
|
18257
|
+
({ decodedData }) => decodedData.eventName !== eventName
|
|
18258
|
+
))
|
|
18259
|
+
throw new Error(`Unknown event`);
|
|
18260
|
+
return events.map(
|
|
18261
|
+
(event) => mapResponse({
|
|
18262
|
+
meta: event.meta,
|
|
18263
|
+
decodedData: event.decodedData
|
|
18264
|
+
})
|
|
18265
|
+
);
|
|
18266
|
+
}, [
|
|
18267
|
+
thor,
|
|
18268
|
+
contractAddress,
|
|
18269
|
+
abi9,
|
|
18270
|
+
eventName,
|
|
18271
|
+
filterParams,
|
|
18272
|
+
mapResponse,
|
|
18273
|
+
nodeUrl
|
|
18274
|
+
]);
|
|
18275
|
+
const queryKey = React10.useMemo(
|
|
18276
|
+
() => getEventsKey({ eventName, filterParams }),
|
|
18277
|
+
[eventName, filterParams]
|
|
18278
|
+
);
|
|
18279
|
+
return reactQuery.useQuery({
|
|
18280
|
+
queryFn,
|
|
18281
|
+
queryKey,
|
|
18282
|
+
enabled: !!thor
|
|
18283
|
+
});
|
|
18284
|
+
};
|
|
18285
|
+
var LocalStorageKey = /* @__PURE__ */ ((LocalStorageKey2) => {
|
|
18286
|
+
LocalStorageKey2["CUSTOM_TOKENS"] = "vechain_kit_custom_tokens";
|
|
18287
|
+
LocalStorageKey2["ECOSYSTEM_SHORTCUTS"] = "vechain-kit-ecosystem-shortcuts";
|
|
18288
|
+
LocalStorageKey2["CURRENCY"] = "vechain_kit_currency";
|
|
18289
|
+
LocalStorageKey2["NODE_URL"] = "vechain_kit_node_url";
|
|
18290
|
+
LocalStorageKey2["NETWORK"] = "vechain_kit_network";
|
|
18291
|
+
return LocalStorageKey2;
|
|
18292
|
+
})(LocalStorageKey || {});
|
|
18293
|
+
var useLocalStorage = (key, initialValue) => {
|
|
18294
|
+
const [storedValue, setStoredValue] = React10.useState(() => {
|
|
18295
|
+
try {
|
|
18296
|
+
const item = window.localStorage.getItem(key);
|
|
18297
|
+
return item ? JSON.parse(item) : initialValue;
|
|
18298
|
+
} catch (error) {
|
|
18299
|
+
console.error(error);
|
|
18300
|
+
return initialValue;
|
|
18301
|
+
}
|
|
18302
|
+
});
|
|
18303
|
+
React10.useEffect(() => {
|
|
18304
|
+
window.localStorage.setItem(key, JSON.stringify(storedValue));
|
|
18305
|
+
}, [key, storedValue]);
|
|
18306
|
+
return [storedValue, setStoredValue];
|
|
18307
|
+
};
|
|
18308
|
+
var useSyncableLocalStorage = (key, defaultValue) => {
|
|
18309
|
+
const [value, setValue] = React10.useState(() => {
|
|
18310
|
+
if (typeof window === "undefined") return defaultValue;
|
|
18311
|
+
try {
|
|
18312
|
+
const stored = window.localStorage.getItem(key);
|
|
18313
|
+
return stored ? JSON.parse(stored) : defaultValue;
|
|
18314
|
+
} catch (err) {
|
|
18315
|
+
console.error("Error loading from localStorage:", err);
|
|
18316
|
+
return defaultValue;
|
|
18317
|
+
}
|
|
18318
|
+
});
|
|
18319
|
+
React10.useEffect(() => {
|
|
18320
|
+
if (typeof window === "undefined") return;
|
|
18321
|
+
try {
|
|
18322
|
+
window.localStorage.setItem(key, JSON.stringify(value));
|
|
18323
|
+
} catch (err) {
|
|
18324
|
+
console.error("Error writing to localStorage:", err);
|
|
18325
|
+
}
|
|
18326
|
+
}, [key, value]);
|
|
18327
|
+
const sync = React10.useCallback(() => {
|
|
18328
|
+
if (typeof window === "undefined") return;
|
|
18329
|
+
try {
|
|
18330
|
+
const stored = window.localStorage.getItem(key);
|
|
18331
|
+
setValue(stored ? JSON.parse(stored) : defaultValue);
|
|
18332
|
+
} catch (err) {
|
|
18333
|
+
console.error("Error syncing localStorage:", err);
|
|
18334
|
+
}
|
|
18335
|
+
}, [key, defaultValue]);
|
|
18336
|
+
const getValue = React10.useCallback(() => {
|
|
18337
|
+
if (typeof window === "undefined") return defaultValue;
|
|
18338
|
+
const stored = window.localStorage.getItem(key);
|
|
18339
|
+
return stored ? JSON.parse(stored) : defaultValue;
|
|
18340
|
+
}, [key, defaultValue]);
|
|
18341
|
+
return [value, setValue, sync, getValue];
|
|
18342
|
+
};
|
|
18343
|
+
|
|
18344
|
+
// src/hooks/cache/useEcosystemShortcuts.ts
|
|
18345
|
+
var useEcosystemShortcuts = () => {
|
|
18346
|
+
const [shortcuts, setShortcuts] = useLocalStorage(
|
|
18347
|
+
"vechain-kit-ecosystem-shortcuts" /* ECOSYSTEM_SHORTCUTS */,
|
|
18348
|
+
[]
|
|
18349
|
+
);
|
|
18350
|
+
const addShortcut = (shortcut) => {
|
|
18351
|
+
if (!shortcuts.some((s) => s.url === shortcut.url)) {
|
|
18352
|
+
setShortcuts([...shortcuts, shortcut]);
|
|
18353
|
+
}
|
|
18354
|
+
};
|
|
18355
|
+
const removeShortcut = (url) => {
|
|
18356
|
+
setShortcuts(shortcuts.filter((s) => s.url !== url));
|
|
18357
|
+
};
|
|
18358
|
+
const isShortcut = (url) => {
|
|
18359
|
+
return shortcuts.some((s) => s.url === url);
|
|
18360
|
+
};
|
|
18361
|
+
return {
|
|
18362
|
+
shortcuts,
|
|
18363
|
+
addShortcut,
|
|
18364
|
+
removeShortcut,
|
|
18365
|
+
isShortcut
|
|
18366
|
+
};
|
|
18367
|
+
};
|
|
19207
18368
|
var AddressDisplayCard = ({
|
|
19208
18369
|
label,
|
|
19209
18370
|
address,
|
|
@@ -19216,16 +18377,14 @@ var AddressDisplayCard = ({
|
|
|
19216
18377
|
}) => {
|
|
19217
18378
|
const { darkMode: isDark } = useVeChainKitConfig();
|
|
19218
18379
|
const { t } = reactI18next.useTranslation();
|
|
19219
|
-
const { isLoading: totalBalanceLoading } = useTotalBalance({
|
|
19220
|
-
|
|
19221
|
-
});
|
|
19222
|
-
const { tokens: tokens2, isLoading: tokensLoading } = useTokensWithValues({
|
|
18380
|
+
const { isLoading: totalBalanceLoading } = useTotalBalance({ address });
|
|
18381
|
+
const { tokens, isLoading: tokensLoading } = useTokensWithValues({
|
|
19223
18382
|
address
|
|
19224
18383
|
});
|
|
19225
18384
|
const tokenData = React10.useMemo(() => {
|
|
19226
18385
|
if (!tokenAddress) return null;
|
|
19227
|
-
return
|
|
19228
|
-
}, [
|
|
18386
|
+
return tokens.find((token) => token.address === tokenAddress);
|
|
18387
|
+
}, [tokens, tokenAddress]);
|
|
19229
18388
|
const displayBalance = React10.useMemo(() => {
|
|
19230
18389
|
if (balance !== void 0) return balance;
|
|
19231
18390
|
if (tokenData) {
|
|
@@ -20495,7 +19654,7 @@ var useVeChainKitConfig = () => {
|
|
|
20495
19654
|
var validateConfig = (props) => {
|
|
20496
19655
|
const errors = [];
|
|
20497
19656
|
const requiresFeeDelegation = props.privy !== void 0 || props.loginMethods?.some(
|
|
20498
|
-
(
|
|
19657
|
+
(method7) => method7.method === "vechain" || method7.method === "ecosystem"
|
|
20499
19658
|
);
|
|
20500
19659
|
if (requiresFeeDelegation) {
|
|
20501
19660
|
if (!props.feeDelegation) {
|
|
@@ -20523,7 +19682,7 @@ var validateConfig = (props) => {
|
|
|
20523
19682
|
if (props.loginMethods) {
|
|
20524
19683
|
if (!props.privy) {
|
|
20525
19684
|
const invalidMethods = props.loginMethods.filter(
|
|
20526
|
-
(
|
|
19685
|
+
(method7) => ["email", "google", "passkey", "more"].includes(method7.method)
|
|
20527
19686
|
);
|
|
20528
19687
|
if (invalidMethods.length > 0) {
|
|
20529
19688
|
errors.push(
|
|
@@ -20588,7 +19747,7 @@ var VeChainKitProvider = (props) => {
|
|
|
20588
19747
|
const validatedLoginMethods = loginMethods;
|
|
20589
19748
|
const allowedEcosystemApps = React10.useMemo(() => {
|
|
20590
19749
|
const userEcosystemMethods = validatedLoginMethods?.find(
|
|
20591
|
-
(
|
|
19750
|
+
(method7) => method7.method === "ecosystem"
|
|
20592
19751
|
);
|
|
20593
19752
|
return userEcosystemMethods?.allowedApps ?? chunkLMX37RCG_cjs.DEFAULT_PRIVY_ECOSYSTEM_APPS.map((app) => app.id);
|
|
20594
19753
|
}, [validatedLoginMethods]);
|
|
@@ -21265,7 +20424,6 @@ exports.ProfileModalProvider = ProfileModalProvider;
|
|
|
21265
20424
|
exports.QuickActionsSection = QuickActionsSection;
|
|
21266
20425
|
exports.ReceiveModalProvider = ReceiveModalProvider;
|
|
21267
20426
|
exports.ReceiveTokenContent = ReceiveTokenContent;
|
|
21268
|
-
exports.RoundState = RoundState;
|
|
21269
20427
|
exports.ScrollToTopWrapper = ScrollToTopWrapper;
|
|
21270
20428
|
exports.SelectTokenContent = SelectTokenContent;
|
|
21271
20429
|
exports.SendTokenContent = SendTokenContent;
|
|
@@ -21297,6 +20455,7 @@ exports.WalletButton = WalletButton;
|
|
|
21297
20455
|
exports.WalletModalProvider = WalletModalProvider;
|
|
21298
20456
|
exports.compressImages = compressImages;
|
|
21299
20457
|
exports.currentBlockQueryKey = currentBlockQueryKey;
|
|
20458
|
+
exports.decodeEventLog = decodeEventLog;
|
|
21300
20459
|
exports.fetchAppHubApps = fetchAppHubApps;
|
|
21301
20460
|
exports.fetchPrivyAppInfo = fetchPrivyAppInfo;
|
|
21302
20461
|
exports.fetchPrivyStatus = fetchPrivyStatus;
|
|
@@ -21309,9 +20468,6 @@ exports.getAccountImplementationAddress = getAccountImplementationAddress;
|
|
|
21309
20468
|
exports.getAccountImplementationAddressQueryKey = getAccountImplementationAddressQueryKey;
|
|
21310
20469
|
exports.getAccountVersionQueryKey = getAccountVersionQueryKey;
|
|
21311
20470
|
exports.getAllEventLogs = getAllEventLogs;
|
|
21312
|
-
exports.getAllocationsRoundStateQueryKey = getAllocationsRoundStateQueryKey;
|
|
21313
|
-
exports.getAllocationsRoundsEvents = getAllocationsRoundsEvents;
|
|
21314
|
-
exports.getAllocationsRoundsEventsQueryKey = getAllocationsRoundsEventsQueryKey;
|
|
21315
20471
|
exports.getAppHubAppsQueryKey = getAppHubAppsQueryKey;
|
|
21316
20472
|
exports.getAvatar = getAvatar;
|
|
21317
20473
|
exports.getAvatarLegacy = getAvatarLegacy;
|
|
@@ -21336,9 +20492,9 @@ exports.getEnsRecordExistsQueryKey = getEnsRecordExistsQueryKey;
|
|
|
21336
20492
|
exports.getErc20Balance = getErc20Balance;
|
|
21337
20493
|
exports.getErc20BalanceQueryKey = getErc20BalanceQueryKey;
|
|
21338
20494
|
exports.getEventLogs = getEventLogs;
|
|
20495
|
+
exports.getEventsKey = getEventsKey;
|
|
21339
20496
|
exports.getHasV1SmartAccount = getHasV1SmartAccount;
|
|
21340
20497
|
exports.getHasV1SmartAccountQueryKey = getHasV1SmartAccountQueryKey;
|
|
21341
|
-
exports.getHasVotedInRoundQueryKey = getHasVotedInRoundQueryKey;
|
|
21342
20498
|
exports.getIpfsImage = getIpfsImage;
|
|
21343
20499
|
exports.getIpfsImageQueryKey = getIpfsImageQueryKey;
|
|
21344
20500
|
exports.getIpfsMetadata = getIpfsMetadata;
|
|
@@ -21346,12 +20502,9 @@ exports.getIpfsMetadataQueryKey = getIpfsMetadataQueryKey;
|
|
|
21346
20502
|
exports.getIsDeployed = getIsDeployed;
|
|
21347
20503
|
exports.getIsDeployedQueryKey = getIsDeployedQueryKey;
|
|
21348
20504
|
exports.getIsDomainProtectedQueryKey = getIsDomainProtectedQueryKey;
|
|
21349
|
-
exports.getIsPersonAtTimepointQueryKey = getIsPersonAtTimepointQueryKey;
|
|
21350
20505
|
exports.getIsPersonQueryKey = getIsPersonQueryKey;
|
|
21351
20506
|
exports.getPrivyAppInfoQueryKey = getPrivyAppInfoQueryKey;
|
|
21352
20507
|
exports.getResolverAddressQueryKey = getResolverAddressQueryKey;
|
|
21353
|
-
exports.getRoundRewardQueryKey = getRoundRewardQueryKey;
|
|
21354
|
-
exports.getRoundXApps = getRoundXApps;
|
|
21355
20508
|
exports.getRoundXAppsQueryKey = getRoundXAppsQueryKey;
|
|
21356
20509
|
exports.getSmartAccount = getSmartAccount;
|
|
21357
20510
|
exports.getSmartAccountQueryKey = getSmartAccountQueryKey;
|
|
@@ -21360,32 +20513,16 @@ exports.getTextRecordsQueryKey = getTextRecordsQueryKey;
|
|
|
21360
20513
|
exports.getTokenInfo = getTokenInfo;
|
|
21361
20514
|
exports.getTokenUsdPrice = getTokenUsdPrice;
|
|
21362
20515
|
exports.getTokenUsdPriceQueryKey = getTokenUsdPriceQueryKey;
|
|
21363
|
-
exports.getTokensInfoByOwnerQueryKey = getTokensInfoByOwnerQueryKey;
|
|
21364
20516
|
exports.getUpgradeRequired = getUpgradeRequired;
|
|
21365
20517
|
exports.getUpgradeRequiredForAccount = getUpgradeRequiredForAccount;
|
|
21366
20518
|
exports.getUpgradeRequiredForAccountQueryKey = getUpgradeRequiredForAccountQueryKey;
|
|
21367
20519
|
exports.getUpgradeRequiredQueryKey = getUpgradeRequiredQueryKey;
|
|
21368
|
-
exports.getUserBotSignalsQueryKey = getUserBotSignalsQueryKey;
|
|
21369
|
-
exports.getUserNodesQueryKey = getUserNodesQueryKey;
|
|
21370
|
-
exports.getUserVotesInRound = getUserVotesInRound;
|
|
21371
|
-
exports.getUserVotesInRoundQueryKey = getUserVotesInRoundQueryKey;
|
|
21372
|
-
exports.getVeDelegateBalance = getVeDelegateBalance;
|
|
21373
|
-
exports.getVeDelegateBalanceQueryKey = getVeDelegateBalanceQueryKey;
|
|
21374
20520
|
exports.getVechainDomainQueryKey = getVechainDomainQueryKey;
|
|
21375
20521
|
exports.getVersion = getVersion;
|
|
21376
20522
|
exports.getVersionQueryKey = getVersionQueryKey;
|
|
21377
20523
|
exports.getVot3Balance = getVot3Balance;
|
|
21378
20524
|
exports.getVot3BalanceQueryKey = getVot3BalanceQueryKey;
|
|
21379
|
-
exports.getVotesInRoundQueryKey = getVotesInRoundQueryKey;
|
|
21380
20525
|
exports.getXAppMetadata = getXAppMetadata;
|
|
21381
|
-
exports.getXAppMetadataQueryKey = getXAppMetadataQueryKey;
|
|
21382
|
-
exports.getXAppRoundEarnings = getXAppRoundEarnings;
|
|
21383
|
-
exports.getXAppRoundEarningsQueryKey = getXAppRoundEarningsQueryKey;
|
|
21384
|
-
exports.getXAppTotalEarningsQueryKey = getXAppTotalEarningsQueryKey;
|
|
21385
|
-
exports.getXAppVotesQueryKey = getXAppVotesQueryKey;
|
|
21386
|
-
exports.getXApps = getXApps;
|
|
21387
|
-
exports.getXAppsMetadataBaseUriQueryKey = getXAppsMetadataBaseUriQueryKey;
|
|
21388
|
-
exports.getXAppsQueryKey = getXAppsQueryKey;
|
|
21389
20526
|
exports.getXAppsSharesQueryKey = getXAppsSharesQueryKey;
|
|
21390
20527
|
exports.imageCompressionOptions = imageCompressionOptions;
|
|
21391
20528
|
exports.txReceiptQueryKey = txReceiptQueryKey;
|
|
@@ -21394,9 +20531,6 @@ exports.useAccountBalance = useAccountBalance;
|
|
|
21394
20531
|
exports.useAccountCustomizationModal = useAccountCustomizationModal;
|
|
21395
20532
|
exports.useAccountImplementationAddress = useAccountImplementationAddress;
|
|
21396
20533
|
exports.useAccountModal = useAccountModal;
|
|
21397
|
-
exports.useAllocationsRound = useAllocationsRound;
|
|
21398
|
-
exports.useAllocationsRoundState = useAllocationsRoundState;
|
|
21399
|
-
exports.useAllocationsRoundsEvents = useAllocationsRoundsEvents;
|
|
21400
20534
|
exports.useAppHubApps = useAppHubApps;
|
|
21401
20535
|
exports.useBuildTransaction = useBuildTransaction;
|
|
21402
20536
|
exports.useCallClause = useCallClause;
|
|
@@ -21407,18 +20541,17 @@ exports.useConnectModal = useConnectModal;
|
|
|
21407
20541
|
exports.useCrossAppConnectionCache = useCrossAppConnectionCache;
|
|
21408
20542
|
exports.useCurrency = useCurrency;
|
|
21409
20543
|
exports.useCurrentAccountImplementationVersion = useCurrentAccountImplementationVersion;
|
|
21410
|
-
exports.useCurrentAllocationsRound = useCurrentAllocationsRound;
|
|
21411
20544
|
exports.useCurrentAllocationsRoundId = useCurrentAllocationsRoundId;
|
|
21412
20545
|
exports.useCurrentBlock = useCurrentBlock;
|
|
21413
20546
|
exports.useCustomTokens = useCustomTokens;
|
|
21414
20547
|
exports.useEcosystemShortcuts = useEcosystemShortcuts;
|
|
21415
20548
|
exports.useEnsRecordExists = useEnsRecordExists;
|
|
20549
|
+
exports.useEvents = useEvents;
|
|
21416
20550
|
exports.useExploreEcosystemModal = useExploreEcosystemModal;
|
|
21417
20551
|
exports.useFAQModal = useFAQModal;
|
|
21418
20552
|
exports.useFeatureAnnouncement = useFeatureAnnouncement;
|
|
21419
20553
|
exports.useFetchAppInfo = useFetchAppInfo;
|
|
21420
20554
|
exports.useFetchPrivyStatus = useFetchPrivyStatus;
|
|
21421
|
-
exports.useGalaxyMemberTokensInfo = useGalaxyMemberTokensInfo;
|
|
21422
20555
|
exports.useGetAccountAddress = useGetAccountAddress;
|
|
21423
20556
|
exports.useGetAccountVersion = useGetAccountVersion;
|
|
21424
20557
|
exports.useGetAvatar = useGetAvatar;
|
|
@@ -21434,12 +20567,8 @@ exports.useGetNodeUrl = useGetNodeUrl;
|
|
|
21434
20567
|
exports.useGetResolverAddress = useGetResolverAddress;
|
|
21435
20568
|
exports.useGetTextRecords = useGetTextRecords;
|
|
21436
20569
|
exports.useGetTokenUsdPrice = useGetTokenUsdPrice;
|
|
21437
|
-
exports.useGetUserNode = useGetUserNode;
|
|
21438
|
-
exports.useGetUserNodes = useGetUserNodes;
|
|
21439
|
-
exports.useGetVeDelegateBalance = useGetVeDelegateBalance;
|
|
21440
20570
|
exports.useGetVot3Balance = useGetVot3Balance;
|
|
21441
20571
|
exports.useHasV1SmartAccount = useHasV1SmartAccount;
|
|
21442
|
-
exports.useHasVotedInRound = useHasVotedInRound;
|
|
21443
20572
|
exports.useIpfsImage = useIpfsImage;
|
|
21444
20573
|
exports.useIpfsImageList = useIpfsImageList;
|
|
21445
20574
|
exports.useIpfsMetadata = useIpfsMetadata;
|
|
@@ -21447,9 +20576,7 @@ exports.useIpfsMetadatas = useIpfsMetadatas;
|
|
|
21447
20576
|
exports.useIsDomainProtected = useIsDomainProtected;
|
|
21448
20577
|
exports.useIsPWA = useIsPWA;
|
|
21449
20578
|
exports.useIsPerson = useIsPerson;
|
|
21450
|
-
exports.useIsPersonAtTimepoint = useIsPersonAtTimepoint;
|
|
21451
20579
|
exports.useIsSmartAccountDeployed = useIsSmartAccountDeployed;
|
|
21452
|
-
exports.useIsUserPerson = useIsUserPerson;
|
|
21453
20580
|
exports.useLegalDocuments = useLegalDocuments;
|
|
21454
20581
|
exports.useLocalStorage = useLocalStorage;
|
|
21455
20582
|
exports.useLoginModalContent = useLoginModalContent;
|
|
@@ -21457,7 +20584,7 @@ exports.useLoginWithOAuth = useLoginWithOAuth2;
|
|
|
21457
20584
|
exports.useLoginWithPasskey = useLoginWithPasskey;
|
|
21458
20585
|
exports.useLoginWithVeChain = useLoginWithVeChain;
|
|
21459
20586
|
exports.useMostVotedAppsInRound = useMostVotedAppsInRound;
|
|
21460
|
-
exports.
|
|
20587
|
+
exports.useMultipleClausesCall = useMultipleClausesCall;
|
|
21461
20588
|
exports.useNotificationAlerts = useNotificationAlerts;
|
|
21462
20589
|
exports.useNotifications = useNotifications;
|
|
21463
20590
|
exports.useNotificationsModal = useNotificationsModal;
|
|
@@ -21468,7 +20595,6 @@ exports.useRefreshBalances = useRefreshBalances;
|
|
|
21468
20595
|
exports.useRefreshFactoryQueries = useRefreshFactoryQueries;
|
|
21469
20596
|
exports.useRefreshMetadata = useRefreshMetadata;
|
|
21470
20597
|
exports.useRefreshSmartAccountQueries = useRefreshSmartAccountQueries;
|
|
21471
|
-
exports.useRoundReward = useRoundReward;
|
|
21472
20598
|
exports.useRoundXApps = useRoundXApps;
|
|
21473
20599
|
exports.useScrollToTop = useScrollToTop;
|
|
21474
20600
|
exports.useSendTokenModal = useSendTokenModal;
|
|
@@ -21480,9 +20606,7 @@ exports.useSmartAccount = useSmartAccount;
|
|
|
21480
20606
|
exports.useSmartAccountVersion = useSmartAccountVersion;
|
|
21481
20607
|
exports.useSyncableLocalStorage = useSyncableLocalStorage;
|
|
21482
20608
|
exports.useTokenBalances = useTokenBalances;
|
|
21483
|
-
exports.useTokenBalances2 = useTokenBalances2;
|
|
21484
20609
|
exports.useTokenPrices = useTokenPrices;
|
|
21485
|
-
exports.useTokenPrices2 = useTokenPrices2;
|
|
21486
20610
|
exports.useTokensWithValues = useTokensWithValues;
|
|
21487
20611
|
exports.useTotalBalance = useTotalBalance;
|
|
21488
20612
|
exports.useTransactionModal = useTransactionModal;
|
|
@@ -21497,22 +20621,12 @@ exports.useUpgradeRequiredForAccount = useUpgradeRequiredForAccount;
|
|
|
21497
20621
|
exports.useUpgradeSmartAccount = useUpgradeSmartAccount;
|
|
21498
20622
|
exports.useUpgradeSmartAccountModal = useUpgradeSmartAccountModal;
|
|
21499
20623
|
exports.useUploadImages = useUploadImages;
|
|
21500
|
-
exports.useUserBotSignals = useUserBotSignals;
|
|
21501
|
-
exports.useUserVotesInRound = useUserVotesInRound;
|
|
21502
20624
|
exports.useVeChainKitConfig = useVeChainKitConfig;
|
|
21503
20625
|
exports.useVechainDomain = useVechainDomain;
|
|
21504
|
-
exports.useVotesInRound = useVotesInRound;
|
|
21505
|
-
exports.useVotingRewards = useVotingRewards;
|
|
21506
20626
|
exports.useWallet = useWallet;
|
|
21507
20627
|
exports.useWalletMetadata = useWalletMetadata;
|
|
21508
20628
|
exports.useWalletModal = useWalletModal2;
|
|
21509
|
-
exports.useXApp = useXApp;
|
|
21510
20629
|
exports.useXAppMetadata = useXAppMetadata;
|
|
21511
|
-
exports.useXAppRoundEarnings = useXAppRoundEarnings;
|
|
21512
|
-
exports.useXAppTotalEarnings = useXAppTotalEarnings;
|
|
21513
|
-
exports.useXAppVotes = useXAppVotes;
|
|
21514
|
-
exports.useXApps = useXApps;
|
|
21515
|
-
exports.useXAppsMetadataBaseUri = useXAppsMetadataBaseUri;
|
|
21516
20630
|
exports.useXAppsShares = useXAppsShares;
|
|
21517
20631
|
//# sourceMappingURL=index.cjs.map
|
|
21518
20632
|
//# sourceMappingURL=index.cjs.map
|