@vechain/vechain-kit 2.0.0-rc.2 → 2.0.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunk5GZ7N47F_cjs = require('./chunk-5GZ7N47F.cjs');
4
- var chunkPTWGTINW_cjs = require('./chunk-PTWGTINW.cjs');
4
+ var chunkLMX37RCG_cjs = require('./chunk-LMX37RCG.cjs');
5
5
  var chunkEESC6JDT_cjs = require('./chunk-EESC6JDT.cjs');
6
6
  require('./chunk-Q7SFCCGT.cjs');
7
7
  var i18n = require('i18next');
@@ -11,6 +11,7 @@ var reactQueryDevtools = require('@tanstack/react-query-devtools');
11
11
  var dappKitReact = require('@vechain/dapp-kit-react');
12
12
  var React10 = require('react');
13
13
  var reactQuery = require('@tanstack/react-query');
14
+ var query = require('wagmi/query');
14
15
  var jsxRuntime = require('react/jsx-runtime');
15
16
  var framerMotion = require('framer-motion');
16
17
  var react = require('@chakra-ui/react');
@@ -22,10 +23,11 @@ var ethers = require('ethers');
22
23
  var sdkCore = require('@vechain/sdk-core');
23
24
  var viem = require('viem');
24
25
  var zod = require('zod');
26
+ var bignumber_js = require('bignumber.js');
25
27
  var wagmi = require('wagmi');
26
28
  var rainbowKit = require('@privy-io/cross-app-connect/rainbow-kit');
27
29
  var reactDeviceDetect = require('react-device-detect');
28
- var BigNumber = require('bignumber.js');
30
+ var axios = require('axios');
29
31
  var imageCompression = require('browser-image-compression');
30
32
  var lu = require('react-icons/lu');
31
33
  var md = require('react-icons/md');
@@ -48,6 +50,8 @@ var si = require('react-icons/si');
48
50
  var bi = require('react-icons/bi');
49
51
  var go = require('react-icons/go');
50
52
  var sdkNetwork = require('@vechain/sdk-network');
53
+ var react$1 = require('@emotion/react');
54
+ var createCache = require('@emotion/cache');
51
55
  var anatomy = require('@chakra-ui/anatomy');
52
56
 
53
57
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -55,8 +59,9 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
55
59
  var i18n__default = /*#__PURE__*/_interopDefault(i18n);
56
60
  var React10__default = /*#__PURE__*/_interopDefault(React10);
57
61
  var VeChainKitMixpanel__default = /*#__PURE__*/_interopDefault(VeChainKitMixpanel);
58
- var BigNumber__default = /*#__PURE__*/_interopDefault(BigNumber);
62
+ var axios__default = /*#__PURE__*/_interopDefault(axios);
59
63
  var imageCompression__default = /*#__PURE__*/_interopDefault(imageCompression);
64
+ var createCache__default = /*#__PURE__*/_interopDefault(createCache);
60
65
 
61
66
  // src/languages/en.json
62
67
  var en_default = {
@@ -4061,6 +4066,15 @@ var languageNames = {
4061
4066
  zh: "\u4E2D\u6587",
4062
4067
  ja: "\u65E5\u672C\u8A9E"
4063
4068
  };
4069
+ var bcp47LanguageCodes = {
4070
+ en: "en-US",
4071
+ de: "de-DE",
4072
+ it: "it-IT",
4073
+ fr: "fr-FR",
4074
+ es: "es-ES",
4075
+ zh: "zh-CN",
4076
+ ja: "ja-JP"
4077
+ };
4064
4078
  var customLanguageDetector = {
4065
4079
  lookup: (options) => {
4066
4080
  const propLanguage = options?.languages?.[0];
@@ -4130,6 +4144,7 @@ function getOrCreateQueryClient() {
4130
4144
  internalQueryClient = new reactQuery.QueryClient({
4131
4145
  defaultOptions: {
4132
4146
  queries: {
4147
+ queryKeyHashFn: query.hashFn,
4133
4148
  retry: 0,
4134
4149
  staleTime: 3e4,
4135
4150
  refetchOnWindowFocus: true,
@@ -4230,11 +4245,11 @@ var ModalBackButton = ({ onClick, ...props }) => {
4230
4245
  var APP_SOURCE = document.title || "";
4231
4246
  var PAGE_SOURCE = window?.location?.origin || "";
4232
4247
  var hasTrackingConsent = false;
4233
- if (typeof window !== "undefined" && chunkPTWGTINW_cjs.VECHAIN_KIT_MIXPANEL_PROJECT_TOKEN) {
4234
- VeChainKitMixpanel__default.default.init(chunkPTWGTINW_cjs.VECHAIN_KIT_MIXPANEL_PROJECT_TOKEN, {
4235
- debug: !chunkPTWGTINW_cjs.ENV.isProduction
4248
+ if (typeof window !== "undefined" && chunkLMX37RCG_cjs.VECHAIN_KIT_MIXPANEL_PROJECT_TOKEN) {
4249
+ VeChainKitMixpanel__default.default.init(chunkLMX37RCG_cjs.VECHAIN_KIT_MIXPANEL_PROJECT_TOKEN, {
4250
+ debug: !chunkLMX37RCG_cjs.ENV.isProduction
4236
4251
  });
4237
- if (chunkPTWGTINW_cjs.ENV.isDevelopment) {
4252
+ if (chunkLMX37RCG_cjs.ENV.isDevelopment) {
4238
4253
  console.info("Analytics initialized in DEVELOPMENT mode");
4239
4254
  }
4240
4255
  }
@@ -4276,7 +4291,7 @@ var storeUserData = (userId, properties) => {
4276
4291
  };
4277
4292
  var trackEvent = (event, properties = {}) => {
4278
4293
  try {
4279
- if (!chunkPTWGTINW_cjs.VECHAIN_KIT_MIXPANEL_PROJECT_TOKEN) {
4294
+ if (!chunkLMX37RCG_cjs.VECHAIN_KIT_MIXPANEL_PROJECT_TOKEN) {
4280
4295
  console.warn("No project token found");
4281
4296
  return;
4282
4297
  }
@@ -4347,15 +4362,15 @@ var Analytics = {
4347
4362
  loginMethod
4348
4363
  });
4349
4364
  },
4350
- tryAgain: (method13, platform) => {
4365
+ tryAgain: (method7, platform) => {
4351
4366
  Analytics.auth.trackAuth("try_again", {
4352
- loginMethod: method13,
4367
+ loginMethod: method7,
4353
4368
  platform
4354
4369
  });
4355
4370
  },
4356
- methodSelected: (method13) => {
4371
+ methodSelected: (method7) => {
4357
4372
  Analytics.auth.trackAuth("method_selected", {
4358
- loginMethod: method13
4373
+ loginMethod: method7
4359
4374
  });
4360
4375
  },
4361
4376
  completed: ({
@@ -4749,7 +4764,7 @@ var AddressDisplay = ({
4749
4764
  react.Input,
4750
4765
  {
4751
4766
  cursor: "pointer",
4752
- value: showHumanAddress ? chunkPTWGTINW_cjs.humanAddress(
4767
+ value: showHumanAddress ? chunkLMX37RCG_cjs.humanAddress(
4753
4768
  wallet.address ?? "",
4754
4769
  8,
4755
4770
  7
@@ -4782,7 +4797,7 @@ var AddressDisplay = ({
4782
4797
  react.Input,
4783
4798
  {
4784
4799
  cursor: "pointer",
4785
- value: showHumanAddress ? chunkPTWGTINW_cjs.humanAddress(wallet?.address ?? "", 6, 4) : wallet?.address,
4800
+ value: showHumanAddress ? chunkLMX37RCG_cjs.humanAddress(wallet?.address ?? "", 6, 4) : wallet?.address,
4786
4801
  readOnly: true,
4787
4802
  fontSize: "sm",
4788
4803
  fontWeight: "700",
@@ -4810,7 +4825,7 @@ var AddressDisplay = ({
4810
4825
 
4811
4826
  // package.json
4812
4827
  var package_default = {
4813
- version: "2.0.0-rc.2"};
4828
+ version: "2.0.0-rc.4"};
4814
4829
  var VersionFooter = ({ ...props }) => {
4815
4830
  const { darkMode: isDark } = useVeChainKitConfig();
4816
4831
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4981,32 +4996,28 @@ var convertToSelectedCurrency = (amountUsd, currency, exchangeRates) => {
4981
4996
  return amountUsd;
4982
4997
  }
4983
4998
  };
4984
- var formatCurrencyValue = (value, currency, options, locale = "en-US") => {
4999
+ var formatCurrencyValue = (value, lng = "en", options) => {
4985
5000
  const defaultOptions = {
4986
5001
  style: "currency",
4987
- currency,
4988
5002
  minimumFractionDigits: 2,
4989
5003
  maximumFractionDigits: 2,
5004
+ currency: options?.currency ?? "usd",
4990
5005
  ...options
4991
5006
  };
4992
- return new Intl.NumberFormat(locale, defaultOptions).format(value);
5007
+ return new Intl.NumberFormat(bcp47LanguageCodes[lng], defaultOptions).format(value);
4993
5008
  };
4994
- var formatCompactCurrency = (value, currency, locale) => {
5009
+ var formatCompactCurrency = (value, options) => {
4995
5010
  return formatCurrencyValue(
4996
5011
  value,
4997
- currency,
5012
+ i18n_default.resolvedLanguage,
4998
5013
  {
4999
5014
  notation: "compact",
5000
- compactDisplay: "short"
5001
- },
5002
- locale
5015
+ compactDisplay: "short",
5016
+ currency: options?.currency ?? "usd",
5017
+ ...options
5018
+ }
5003
5019
  );
5004
5020
  };
5005
- var amountFormatter = new Intl.NumberFormat("de-DE", {
5006
- notation: "compact",
5007
- compactDisplay: "short",
5008
- maximumFractionDigits: 2
5009
- });
5010
5021
  var AssetButton = ({
5011
5022
  symbol,
5012
5023
  amount,
@@ -5035,13 +5046,13 @@ var AssetButton = ({
5035
5046
  ...buttonProps,
5036
5047
  children: [
5037
5048
  /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { children: [
5038
- chunkPTWGTINW_cjs.TOKEN_LOGO_COMPONENTS[symbol] ? React10__default.default.cloneElement(chunkPTWGTINW_cjs.TOKEN_LOGO_COMPONENTS[symbol], {
5049
+ chunkLMX37RCG_cjs.TOKEN_LOGO_COMPONENTS[symbol] ? React10__default.default.cloneElement(chunkLMX37RCG_cjs.TOKEN_LOGO_COMPONENTS[symbol], {
5039
5050
  boxSize: "24px",
5040
5051
  borderRadius: "full"
5041
5052
  }) : /* @__PURE__ */ jsxRuntime.jsx(
5042
5053
  react.Image,
5043
5054
  {
5044
- src: chunkPTWGTINW_cjs.TOKEN_LOGOS[symbol],
5055
+ src: chunkLMX37RCG_cjs.TOKEN_LOGOS[symbol],
5045
5056
  alt: `${symbol} logo`,
5046
5057
  boxSize: "24px",
5047
5058
  borderRadius: "full",
@@ -5062,7 +5073,12 @@ var AssetButton = ({
5062
5073
  /* @__PURE__ */ jsxRuntime.jsx(react.Text, { children: symbol })
5063
5074
  ] }),
5064
5075
  /* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { align: "flex-end", spacing: 0, children: [
5065
- /* @__PURE__ */ jsxRuntime.jsx(react.Text, { children: amountFormatter.format(amount) }),
5076
+ /* @__PURE__ */ jsxRuntime.jsxs(react.Text, { children: [
5077
+ amount.toLocaleString(void 0, {
5078
+ maximumFractionDigits: 2
5079
+ }),
5080
+ " "
5081
+ ] }),
5066
5082
  /* @__PURE__ */ jsxRuntime.jsx(
5067
5083
  react.Text,
5068
5084
  {
@@ -5071,8 +5087,7 @@ var AssetButton = ({
5071
5087
  "data-testid": `${symbol}-balance`,
5072
5088
  children: formatCompactCurrency(
5073
5089
  currencyValue,
5074
- currentCurrency,
5075
- "de-DE"
5090
+ { currency: currentCurrency }
5076
5091
  )
5077
5092
  }
5078
5093
  )
@@ -5107,7 +5122,7 @@ var useFetchAppInfo = (appIds) => {
5107
5122
  return Object.fromEntries(
5108
5123
  results.map((result, index) => {
5109
5124
  const id = normalizedIds[index];
5110
- const defaultApp = chunkPTWGTINW_cjs.DEFAULT_PRIVY_ECOSYSTEM_APPS.find(
5125
+ const defaultApp = chunkLMX37RCG_cjs.DEFAULT_PRIVY_ECOSYSTEM_APPS.find(
5111
5126
  (app) => app.id === id
5112
5127
  );
5113
5128
  return [
@@ -5177,9 +5192,9 @@ var fetchVechainDomain = async (thor, networkType, addressOrDomain) => {
5177
5192
  }
5178
5193
  if (ethers.isAddress(addressOrDomain)) {
5179
5194
  try {
5180
- const res = await chunkPTWGTINW_cjs.executeCallClause({
5195
+ const res = await chunkLMX37RCG_cjs.executeCallClause({
5181
5196
  thor,
5182
- contractAddress: chunkPTWGTINW_cjs.getConfig(networkType).vnsResolverAddress,
5197
+ contractAddress: chunkLMX37RCG_cjs.getConfig(networkType).vnsResolverAddress,
5183
5198
  abi: resolverABI,
5184
5199
  method: "getNames",
5185
5200
  args: [[addressOrDomain]]
@@ -5202,9 +5217,9 @@ var fetchVechainDomain = async (thor, networkType, addressOrDomain) => {
5202
5217
  }
5203
5218
  }
5204
5219
  try {
5205
- const res = await chunkPTWGTINW_cjs.executeCallClause({
5220
+ const res = await chunkLMX37RCG_cjs.executeCallClause({
5206
5221
  thor,
5207
- contractAddress: chunkPTWGTINW_cjs.getConfig(networkType).vnsResolverAddress,
5222
+ contractAddress: chunkLMX37RCG_cjs.getConfig(networkType).vnsResolverAddress,
5208
5223
  abi: getAddressesABI,
5209
5224
  method: "getAddresses",
5210
5225
  args: [[addressOrDomain]]
@@ -5218,9 +5233,9 @@ var fetchVechainDomain = async (thor, networkType, addressOrDomain) => {
5218
5233
  isPrimaryDomain: false
5219
5234
  };
5220
5235
  }
5221
- const primaryDomainRes = await chunkPTWGTINW_cjs.executeCallClause({
5236
+ const primaryDomainRes = await chunkLMX37RCG_cjs.executeCallClause({
5222
5237
  thor,
5223
- contractAddress: chunkPTWGTINW_cjs.getConfig(networkType).vnsResolverAddress,
5238
+ contractAddress: chunkLMX37RCG_cjs.getConfig(networkType).vnsResolverAddress,
5224
5239
  abi: resolverABI,
5225
5240
  method: "getNames",
5226
5241
  args: [[domainAddress]]
@@ -5260,7 +5275,7 @@ var getEnsRecordExists = async (thor, network, name) => {
5260
5275
  const labelHash = viem.keccak256(viem.toBytes(name));
5261
5276
  const subnode = viem.keccak256(viem.concat([hashedNode, labelHash]));
5262
5277
  const res = await thor.contracts.load(
5263
- chunkPTWGTINW_cjs.getConfig(network).vetDomainsContractAddress,
5278
+ chunkLMX37RCG_cjs.getConfig(network).vetDomainsContractAddress,
5264
5279
  chunk5GZ7N47F_cjs.MockENS__factory.abi
5265
5280
  ).read.recordExists(subnode);
5266
5281
  if (!res) throw new Error(`Failed to get ENS record exists for ${name}`);
@@ -5370,10 +5385,10 @@ var useClaimVeWorldSubdomain = ({
5370
5385
  if (!subdomain) throw new Error("Invalid subdomain");
5371
5386
  const fullDomain = `${subdomain}.${domain}`;
5372
5387
  clausesArray.push({
5373
- to: chunkPTWGTINW_cjs.getConfig(network.type).vetDomainsReverseRegistrarAddress,
5388
+ to: chunkLMX37RCG_cjs.getConfig(network.type).vetDomainsReverseRegistrarAddress,
5374
5389
  value: "0x0",
5375
5390
  data: ReverseRegistrarInterface.encodeFunctionData("setName", [""]),
5376
- comment: `Unsetting your current VeChain nickname of the account ${chunkPTWGTINW_cjs.humanAddress(
5391
+ comment: `Unsetting your current VeChain nickname of the account ${chunkLMX37RCG_cjs.humanAddress(
5377
5392
  account?.address ?? "",
5378
5393
  4,
5379
5394
  4
@@ -5382,7 +5397,7 @@ var useClaimVeWorldSubdomain = ({
5382
5397
  });
5383
5398
  if (alreadyOwned) {
5384
5399
  clausesArray.push({
5385
- to: chunkPTWGTINW_cjs.getConfig(network.type).vetDomainsReverseRegistrarAddress,
5400
+ to: chunkLMX37RCG_cjs.getConfig(network.type).vetDomainsReverseRegistrarAddress,
5386
5401
  value: "0x0",
5387
5402
  data: ReverseRegistrarInterface.encodeFunctionData("setName", [
5388
5403
  fullDomain
@@ -5395,13 +5410,13 @@ var useClaimVeWorldSubdomain = ({
5395
5410
  ]);
5396
5411
  const domainNode = ethers.ethers.namehash(fullDomain);
5397
5412
  clausesArray.push({
5398
- to: chunkPTWGTINW_cjs.getConfig(network.type).vetDomainsPublicResolverAddress,
5413
+ to: chunkLMX37RCG_cjs.getConfig(network.type).vetDomainsPublicResolverAddress,
5399
5414
  value: "0x0",
5400
5415
  data: PublicResolverInterface.encodeFunctionData("setAddr", [
5401
5416
  domainNode,
5402
5417
  account?.address || ""
5403
5418
  ]),
5404
- comment: `Setting the address for ${fullDomain} to ${chunkPTWGTINW_cjs.humanAddress(
5419
+ comment: `Setting the address for ${fullDomain} to ${chunkLMX37RCG_cjs.humanAddress(
5405
5420
  account?.address ?? "",
5406
5421
  4,
5407
5422
  4
@@ -5411,26 +5426,26 @@ var useClaimVeWorldSubdomain = ({
5411
5426
  } else {
5412
5427
  if (isVeWorldDomain(domain)) {
5413
5428
  clausesArray.push({
5414
- to: chunkPTWGTINW_cjs.getConfig(network.type).veWorldSubdomainClaimerContractAddress,
5429
+ to: chunkLMX37RCG_cjs.getConfig(network.type).veWorldSubdomainClaimerContractAddress,
5415
5430
  value: "0x0",
5416
5431
  data: SubdomainClaimerInterface.encodeFunctionData(
5417
5432
  "claim",
5418
5433
  [
5419
5434
  subdomain,
5420
- chunkPTWGTINW_cjs.getConfig(network.type).vetDomainsPublicResolverAddress
5435
+ chunkLMX37RCG_cjs.getConfig(network.type).vetDomainsPublicResolverAddress
5421
5436
  ]
5422
5437
  ),
5423
5438
  comment: `Claim VeChain subdomain: ${subdomain}.${domain}`,
5424
5439
  abi: SubdomainClaimerInterface.getFunction("claim")
5425
5440
  });
5426
5441
  clausesArray.push({
5427
- to: chunkPTWGTINW_cjs.getConfig(network.type).vetDomainsReverseRegistrarAddress,
5442
+ to: chunkLMX37RCG_cjs.getConfig(network.type).vetDomainsReverseRegistrarAddress,
5428
5443
  value: "0x0",
5429
5444
  data: ReverseRegistrarInterface.encodeFunctionData(
5430
5445
  "setName",
5431
5446
  [subdomain + "." + domain]
5432
5447
  ),
5433
- comment: `Set ${subdomain}.${domain} as the VeChain nickname of the account ${chunkPTWGTINW_cjs.humanAddress(
5448
+ comment: `Set ${subdomain}.${domain} as the VeChain nickname of the account ${chunkLMX37RCG_cjs.humanAddress(
5434
5449
  account?.address ?? "",
5435
5450
  4,
5436
5451
  4
@@ -5509,7 +5524,7 @@ var useClaimVetDomain = ({
5509
5524
  if (!domain) throw new Error("Invalid domain");
5510
5525
  if (alreadyOwned) {
5511
5526
  clausesArray.push({
5512
- to: chunkPTWGTINW_cjs.getConfig(network.type).vetDomainsReverseRegistrarAddress,
5527
+ to: chunkLMX37RCG_cjs.getConfig(network.type).vetDomainsReverseRegistrarAddress,
5513
5528
  value: "0x0",
5514
5529
  data: ReverseRegistrarInterface2.encodeFunctionData("setName", [
5515
5530
  domain
@@ -5522,13 +5537,13 @@ var useClaimVetDomain = ({
5522
5537
  ]);
5523
5538
  const domainNode = ethers.ethers.namehash(domain);
5524
5539
  clausesArray.push({
5525
- to: chunkPTWGTINW_cjs.getConfig(network.type).vetDomainsPublicResolverAddress,
5540
+ to: chunkLMX37RCG_cjs.getConfig(network.type).vetDomainsPublicResolverAddress,
5526
5541
  value: "0x0",
5527
5542
  data: PublicResolverInterface.encodeFunctionData("setAddr", [
5528
5543
  domainNode,
5529
5544
  account?.address || ""
5530
5545
  ]),
5531
- comment: `Setting the address for ${domain} to ${chunkPTWGTINW_cjs.humanAddress(
5546
+ comment: `Setting the address for ${domain} to ${chunkLMX37RCG_cjs.humanAddress(
5532
5547
  account?.address ?? "",
5533
5548
  4,
5534
5549
  4
@@ -5584,7 +5599,7 @@ var getIsDomainProtectedQueryKey = (domain) => [
5584
5599
  "IS_DOMAIN_PROTECTED"
5585
5600
  ];
5586
5601
  var getIsDomainProtected = async (thor, network, domain) => {
5587
- const contractAddress = chunkPTWGTINW_cjs.getConfig(network).veWorldSubdomainClaimerContractAddress;
5602
+ const contractAddress = chunkLMX37RCG_cjs.getConfig(network).veWorldSubdomainClaimerContractAddress;
5588
5603
  const res = await thor.contracts.load(contractAddress, chunk5GZ7N47F_cjs.SubdomainClaimer__factory.abi).read.isDomainProtected(domain);
5589
5604
  return res[0];
5590
5605
  };
@@ -5605,7 +5620,7 @@ var DomainsResponseSchema = zod.z.object({
5605
5620
  });
5606
5621
  var getDomainsOfAddress = async (networkType, address, parentDomain) => {
5607
5622
  if (!address) throw new Error("Address is required");
5608
- const graphQlIndexerUrl = chunkPTWGTINW_cjs.getConfig(networkType).graphQlIndexerUrl;
5623
+ const graphQlIndexerUrl = chunkLMX37RCG_cjs.getConfig(networkType).graphQlIndexerUrl;
5609
5624
  const whereCondition = parentDomain ? `{owner: "${address.toLowerCase()}", parent_: {name: "${parentDomain}"}}` : `{owner: "${address.toLowerCase()}"}`;
5610
5625
  const query = `query Registrations {
5611
5626
  domains(
@@ -5666,7 +5681,7 @@ var getAvatarLegacy = async (networkType, nodeUrl, name) => {
5666
5681
  body: JSON.stringify({
5667
5682
  clauses: [
5668
5683
  {
5669
- to: chunkPTWGTINW_cjs.getConfig(networkType).vetDomainsContractAddress,
5684
+ to: chunkLMX37RCG_cjs.getConfig(networkType).vetDomainsContractAddress,
5670
5685
  data: nameInterface.encodeFunctionData("resolver", [
5671
5686
  node
5672
5687
  ])
@@ -5724,7 +5739,7 @@ var getAvatarLegacyQueryKey = (name, networkType) => ["VECHAIN_KIT", "VET_DOMAIN
5724
5739
  async function parseAvatarRecord(record, networkType, nodeUrl) {
5725
5740
  try {
5726
5741
  if (record.startsWith("http") || record.startsWith("ipfs://") || record.startsWith("ar://")) {
5727
- return chunkPTWGTINW_cjs.convertUriToUrl(record, networkType) || null;
5742
+ return chunkLMX37RCG_cjs.convertUriToUrl(record, networkType) || null;
5728
5743
  }
5729
5744
  const match = record.match(
5730
5745
  /eip155:(\d+)\/(?:erc721|erc1155):([^/]+)\/(\d+)/
@@ -5765,7 +5780,7 @@ async function parseAvatarRecord(record, networkType, nodeUrl) {
5765
5780
  console.error("Failed to decode avatar data:", e);
5766
5781
  tokenUri = ethers.toUtf8String(data);
5767
5782
  }
5768
- tokenUri = chunkPTWGTINW_cjs.convertUriToUrl(tokenUri, networkType) || tokenUri;
5783
+ tokenUri = chunkLMX37RCG_cjs.convertUriToUrl(tokenUri, networkType) || tokenUri;
5769
5784
  if (isErc1155) {
5770
5785
  tokenUri = tokenUri.replace(
5771
5786
  "{id}",
@@ -5783,7 +5798,7 @@ async function parseAvatarRecord(record, networkType, nodeUrl) {
5783
5798
  console.error("No image URL in metadata");
5784
5799
  return null;
5785
5800
  }
5786
- return chunkPTWGTINW_cjs.convertUriToUrl(imageUrl, networkType) || imageUrl;
5801
+ return chunkLMX37RCG_cjs.convertUriToUrl(imageUrl, networkType) || imageUrl;
5787
5802
  }
5788
5803
  return null;
5789
5804
  } catch (error) {
@@ -5793,7 +5808,7 @@ async function parseAvatarRecord(record, networkType, nodeUrl) {
5793
5808
  }
5794
5809
  var useGetAvatarLegacy = (name) => {
5795
5810
  const { network } = useVeChainKitConfig();
5796
- const nodeUrl = network.nodeUrl ?? chunkPTWGTINW_cjs.getConfig(network.type).nodeUrl;
5811
+ const nodeUrl = network.nodeUrl ?? chunkLMX37RCG_cjs.getConfig(network.type).nodeUrl;
5797
5812
  const avatarQuery = reactQuery.useQuery({
5798
5813
  queryKey: getAvatarLegacyQueryKey(name ?? "", network.type),
5799
5814
  queryFn: async () => {
@@ -5824,7 +5839,7 @@ var getAvatar = async (name, network) => {
5824
5839
  var fetchAvatar = async (name, network) => {
5825
5840
  try {
5826
5841
  const response = await fetch(
5827
- `${chunkPTWGTINW_cjs.getConfig(network.type).vetDomainAvatarUrl}/${name}`
5842
+ `${chunkLMX37RCG_cjs.getConfig(network.type).vetDomainAvatarUrl}/${name}`
5828
5843
  );
5829
5844
  if (response.ok) {
5830
5845
  return response.blob();
@@ -5835,7 +5850,7 @@ var fetchAvatar = async (name, network) => {
5835
5850
  return null;
5836
5851
  };
5837
5852
  var fetchAvatarDirectly = async (name, network) => {
5838
- const nodeUrl = network.nodeUrl ?? chunkPTWGTINW_cjs.getConfig(network.type).nodeUrl;
5853
+ const nodeUrl = network.nodeUrl ?? chunkLMX37RCG_cjs.getConfig(network.type).nodeUrl;
5839
5854
  if (!nodeUrl) return null;
5840
5855
  const avatar = await getAvatarLegacy(network.type, nodeUrl, name);
5841
5856
  if (!avatar) return null;
@@ -5876,7 +5891,7 @@ var getTextRecords = async (nodeUrl, network, domain) => {
5876
5891
  body: JSON.stringify({
5877
5892
  clauses: [
5878
5893
  {
5879
- to: chunkPTWGTINW_cjs.getConfig(network).vetDomainsContractAddress,
5894
+ to: chunkLMX37RCG_cjs.getConfig(network).vetDomainsContractAddress,
5880
5895
  data: nameInterface2.encodeFunctionData("resolver", [
5881
5896
  node
5882
5897
  ])
@@ -5898,7 +5913,7 @@ var getTextRecords = async (nodeUrl, network, domain) => {
5898
5913
  "content-type": "application/json"
5899
5914
  },
5900
5915
  body: JSON.stringify({
5901
- clauses: chunkPTWGTINW_cjs.ENS_TEXT_RECORDS.map((key) => ({
5916
+ clauses: chunkLMX37RCG_cjs.ENS_TEXT_RECORDS.map((key) => ({
5902
5917
  to: resolverAddress,
5903
5918
  data: nameInterface2.encodeFunctionData("text", [node, key])
5904
5919
  }))
@@ -5914,11 +5929,11 @@ var getTextRecords = async (nodeUrl, network, domain) => {
5914
5929
  data
5915
5930
  )[0];
5916
5931
  if (value) {
5917
- acc[chunkPTWGTINW_cjs.ENS_TEXT_RECORDS[index]] = value;
5932
+ acc[chunkLMX37RCG_cjs.ENS_TEXT_RECORDS[index]] = value;
5918
5933
  }
5919
5934
  } catch (error) {
5920
5935
  console.error(
5921
- `Failed to decode text record for ${chunkPTWGTINW_cjs.ENS_TEXT_RECORDS[index]}:`,
5936
+ `Failed to decode text record for ${chunkLMX37RCG_cjs.ENS_TEXT_RECORDS[index]}:`,
5922
5937
  error
5923
5938
  );
5924
5939
  }
@@ -5935,7 +5950,7 @@ var getTextRecords = async (nodeUrl, network, domain) => {
5935
5950
  var getTextRecordsQueryKey = (domain, network) => ["VECHAIN_KIT_TEXT_RECORDS", domain, network];
5936
5951
  var useGetTextRecords = (domain) => {
5937
5952
  const { network } = useVeChainKitConfig();
5938
- const nodeUrl = network.nodeUrl ?? chunkPTWGTINW_cjs.getConfig(network.type).nodeUrl;
5953
+ const nodeUrl = network.nodeUrl ?? chunkLMX37RCG_cjs.getConfig(network.type).nodeUrl;
5939
5954
  return reactQuery.useQuery({
5940
5955
  queryKey: getTextRecordsQueryKey(domain, network.type),
5941
5956
  queryFn: () => getTextRecords(nodeUrl, network.type, domain),
@@ -6025,7 +6040,7 @@ var getResolverAddressQueryKey = (domain) => [
6025
6040
  var useGetResolverAddress = (domain) => {
6026
6041
  const { network } = useVeChainKitConfig();
6027
6042
  return useCallClause({
6028
- address: chunkPTWGTINW_cjs.getConfig(network.type).vetDomainsContractAddress,
6043
+ address: chunkLMX37RCG_cjs.getConfig(network.type).vetDomainsContractAddress,
6029
6044
  abi: nameInterfaceAbi,
6030
6045
  method: "resolver",
6031
6046
  args: [domain ? viem.namehash(domain) : "0x"],
@@ -6048,12 +6063,12 @@ var useGetAvatarOfAddress = (address) => {
6048
6063
  return reactQuery.useQuery({
6049
6064
  queryKey: getAvatarOfAddressQueryKey(address),
6050
6065
  queryFn: async () => {
6051
- if (!address) return chunkPTWGTINW_cjs.getPicassoImage(address ?? "");
6066
+ if (!address) return chunkLMX37RCG_cjs.getPicassoImage(address ?? "");
6052
6067
  const domains = await domainsQuery.refetch();
6053
- if (!domains.data?.domain) return chunkPTWGTINW_cjs.getPicassoImage(address);
6068
+ if (!domains.data?.domain) return chunkLMX37RCG_cjs.getPicassoImage(address);
6054
6069
  if (domains.data.domain && avatarQuery.data)
6055
6070
  return avatarQuery.data;
6056
- return chunkPTWGTINW_cjs.getPicassoImage(address);
6071
+ return chunkLMX37RCG_cjs.getPicassoImage(address);
6057
6072
  },
6058
6073
  enabled: !!address && domainsQuery.isSuccess && (primaryDomain ? avatarQuery.isSuccess : true)
6059
6074
  });
@@ -6069,10 +6084,10 @@ var useUnsetDomain = ({
6069
6084
  const buildClauses = React10.useCallback(async () => {
6070
6085
  const clausesArray = [];
6071
6086
  clausesArray.push({
6072
- to: chunkPTWGTINW_cjs.getConfig(network.type).vetDomainsReverseRegistrarAddress,
6087
+ to: chunkLMX37RCG_cjs.getConfig(network.type).vetDomainsReverseRegistrarAddress,
6073
6088
  value: "0x0",
6074
6089
  data: ReverseRegistrarInterface3.encodeFunctionData("setName", [""]),
6075
- comment: `Unsetting your current VeChain nickname of the account ${chunkPTWGTINW_cjs.humanAddress(
6090
+ comment: `Unsetting your current VeChain nickname of the account ${chunkLMX37RCG_cjs.humanAddress(
6076
6091
  account?.address ?? "",
6077
6092
  4,
6078
6093
  4
@@ -6113,13 +6128,13 @@ var useUnsetDomain = ({
6113
6128
  }
6114
6129
  };
6115
6130
  };
6116
- var useTokenBalances = ({ address = "" }) => {
6131
+ var useTokenBalances = (address) => {
6117
6132
  const { network } = useVeChainKitConfig();
6118
- const config = chunkPTWGTINW_cjs.getConfig(network.type);
6133
+ const config = chunkLMX37RCG_cjs.getConfig(network.type);
6119
6134
  const { data: vetData, isLoading: vetLoading } = useAccountBalance(address);
6120
6135
  const { data: b3trBalance, isLoading: b3trLoading } = useGetB3trBalance(address);
6121
6136
  const { data: vot3Balance, isLoading: vot3Loading } = useGetVot3Balance(address);
6122
- const { data: veDelegateBalance, isLoading: veDelegateLoading } = useGetVeDelegateBalance(address);
6137
+ const { data: veDelegateBalance, isLoading: veDelegateLoading } = useGetErc20Balance(config.veDelegateTokenContractAddress, address);
6123
6138
  const { data: gloDollarBalance, isLoading: gloDollarLoading } = useGetErc20Balance(config.gloDollarContractAddress, address);
6124
6139
  const customTokenBalancesQueries = useGetCustomTokenBalances(address);
6125
6140
  const customTokenBalances = customTokenBalancesQueries.map((query) => query.data).filter(Boolean);
@@ -6192,9 +6207,39 @@ var useTokenBalances = ({ address = "" }) => {
6192
6207
  isLoading
6193
6208
  };
6194
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
6195
6240
  var useTokenPrices = () => {
6196
6241
  const { network } = useVeChainKitConfig();
6197
- const config = chunkPTWGTINW_cjs.getConfig(network.type);
6242
+ const config = chunkLMX37RCG_cjs.getConfig(network.type);
6198
6243
  const { data: vetUsdPrice, isLoading: vetUsdPriceLoading } = useGetTokenUsdPrice("VET");
6199
6244
  const { data: vthoUsdPrice, isLoading: vthoUsdPriceLoading } = useGetTokenUsdPrice("VTHO");
6200
6245
  const { data: b3trUsdPrice, isLoading: b3trUsdPriceLoading } = useGetTokenUsdPrice("B3TR");
@@ -6281,9 +6326,7 @@ var useCurrency = () => {
6281
6326
  var useTokensWithValues = ({
6282
6327
  address = ""
6283
6328
  }) => {
6284
- const { balances, isLoading: balancesLoading } = useTokenBalances({
6285
- address
6286
- });
6329
+ const { balances, isLoading: balancesLoading } = useTokenBalances(address);
6287
6330
  const {
6288
6331
  prices,
6289
6332
  exchangeRates,
@@ -6341,7 +6384,7 @@ var useTotalBalance = ({ address = "" }) => {
6341
6384
  const formattedBalance = React10.useMemo(() => {
6342
6385
  return formatCompactCurrency(
6343
6386
  totalBalanceInCurrency,
6344
- currentCurrency
6387
+ { currency: currentCurrency }
6345
6388
  );
6346
6389
  }, [totalBalanceInCurrency, currentCurrency]);
6347
6390
  return {
@@ -6352,6 +6395,60 @@ var useTotalBalance = ({ address = "" }) => {
6352
6395
  hasAnyBalance: tokensWithBalance.length > 0
6353
6396
  };
6354
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
6355
6452
  var useCustomTokens = () => {
6356
6453
  const [customTokens, setCustomTokens] = useLocalStorage(
6357
6454
  "vechain_kit_custom_tokens" /* CUSTOM_TOKENS */,
@@ -6376,17 +6473,17 @@ var useCustomTokens = () => {
6376
6473
  };
6377
6474
  const isTokenIncluded = (address) => {
6378
6475
  return customTokens.some(
6379
- (t) => chunkPTWGTINW_cjs.compareAddresses(t.address, address)
6476
+ (t) => chunkLMX37RCG_cjs.compareAddresses(t.address, address)
6380
6477
  );
6381
6478
  };
6382
6479
  const isDefaultToken = (address) => {
6383
6480
  const contractAddresses = {
6384
6481
  vet: "0x",
6385
6482
  // VET has no contract address since it's the native token
6386
- vtho: chunkPTWGTINW_cjs.getConfig(network.type).vthoContractAddress,
6387
- b3tr: chunkPTWGTINW_cjs.getConfig(network.type).b3trContractAddress,
6388
- vot3: chunkPTWGTINW_cjs.getConfig(network.type).vot3ContractAddress,
6389
- veDelegate: chunkPTWGTINW_cjs.getConfig(network.type).veDelegate
6483
+ vtho: chunkLMX37RCG_cjs.getConfig(network.type).vthoContractAddress,
6484
+ b3tr: chunkLMX37RCG_cjs.getConfig(network.type).b3trContractAddress,
6485
+ vot3: chunkLMX37RCG_cjs.getConfig(network.type).vot3ContractAddress,
6486
+ veDelegate: chunkLMX37RCG_cjs.getConfig(network.type).veDelegate
6390
6487
  };
6391
6488
  return Object.values(contractAddresses).includes(address);
6392
6489
  };
@@ -6398,6 +6495,223 @@ var useCustomTokens = () => {
6398
6495
  isDefaultToken
6399
6496
  };
6400
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
+ };
6401
6715
  var handlePopupError = ({
6402
6716
  error,
6403
6717
  mobileBrowserPopupMessage = "Mobile browser blocked the window. Please try again.",
@@ -6405,10 +6719,10 @@ var handlePopupError = ({
6405
6719
  defaultMessage = "Operation failed"
6406
6720
  }) => {
6407
6721
  const errorMsg = error?.message;
6408
- if (reactDeviceDetect.isMobile && errorMsg && !chunkPTWGTINW_cjs.isRejectionError(errorMsg)) {
6722
+ if (reactDeviceDetect.isMobile && errorMsg && !chunkLMX37RCG_cjs.isRejectionError(errorMsg)) {
6409
6723
  return new Error(mobileBrowserPopupMessage);
6410
6724
  }
6411
- if (errorMsg && chunkPTWGTINW_cjs.isRejectionError(errorMsg)) {
6725
+ if (errorMsg && chunkLMX37RCG_cjs.isRejectionError(errorMsg)) {
6412
6726
  return new Error(rejectedMessage);
6413
6727
  }
6414
6728
  return error instanceof Error ? error : new Error(defaultMessage);
@@ -6435,7 +6749,7 @@ var vechain = viem.defineChain({
6435
6749
  });
6436
6750
  var vechainConnector = () => {
6437
6751
  return rainbowKit.toPrivyWalletConnector({
6438
- id: chunkPTWGTINW_cjs.VECHAIN_PRIVY_APP_ID,
6752
+ id: chunkLMX37RCG_cjs.VECHAIN_PRIVY_APP_ID,
6439
6753
  name: "VeChain",
6440
6754
  iconUrl: "https://imagedelivery.net/oHBRUd2clqykxgDWmeAyLg/661dd77c-2f9d-40e7-baa1-f4e24fd7bf00/icon",
6441
6755
  smartWalletMode: false
@@ -6490,7 +6804,7 @@ var usePrivyCrossAppSdk = () => {
6490
6804
  setIsConnecting(true);
6491
6805
  setConnectionError(null);
6492
6806
  const connector = connectors.find(
6493
- (c) => c.id === (appID || chunkPTWGTINW_cjs.VECHAIN_PRIVY_APP_ID)
6807
+ (c) => c.id === (appID || chunkLMX37RCG_cjs.VECHAIN_PRIVY_APP_ID)
6494
6808
  );
6495
6809
  if (!connector) {
6496
6810
  throw new Error("Connector not found");
@@ -6552,7 +6866,7 @@ var useWalletMetadata = (address, networkType) => {
6552
6866
  const { data: domain, isLoading: isLoadingVechainDomain } = useVechainDomain(address ?? "");
6553
6867
  const { data: avatar, isLoading: isLoadingMetadata } = useGetAvatarOfAddress(address ?? "");
6554
6868
  const { data: textRecords, isLoading: isLoadingRecords } = useGetTextRecords(domain?.domain ?? "");
6555
- const headerUrl = textRecords?.header ? chunkPTWGTINW_cjs.convertUriToUrl(textRecords.header, networkType) : null;
6869
+ const headerUrl = textRecords?.header ? chunkLMX37RCG_cjs.convertUriToUrl(textRecords.header, networkType) : null;
6556
6870
  return {
6557
6871
  domain: domain?.domain,
6558
6872
  image: avatar,
@@ -6584,7 +6898,7 @@ var useWallet = () => {
6584
6898
  const isConnectedWithDappKit = !!dappKitAccount;
6585
6899
  const isConnectedWithSocialLogin = authenticated && !!user;
6586
6900
  const isConnectedWithPrivy = isConnectedWithSocialLogin || isConnectedWithCrossApp;
6587
- const isConnectedWithVeChain = isConnectedWithSocialLogin && privy?.appId === chunkPTWGTINW_cjs.VECHAIN_PRIVY_APP_ID || isConnectedWithCrossApp && connectionCache?.ecosystemApp?.appId === chunkPTWGTINW_cjs.VECHAIN_PRIVY_APP_ID;
6901
+ const isConnectedWithVeChain = isConnectedWithSocialLogin && privy?.appId === chunkLMX37RCG_cjs.VECHAIN_PRIVY_APP_ID || isConnectedWithCrossApp && connectionCache?.ecosystemApp?.appId === chunkLMX37RCG_cjs.VECHAIN_PRIVY_APP_ID;
6588
6902
  const isLoading = isConnectingWithCrossApp || isReconnectingWithCrossApp || isLoadingLoginOAuth || !ready;
6589
6903
  const [isConnected, setIsConnected] = React10.useState(false);
6590
6904
  const connectionSource = isConnectedWithCrossApp ? {
@@ -6649,7 +6963,7 @@ var useWallet = () => {
6649
6963
  const { data: smartAccountVersion } = useSmartAccountVersion(
6650
6964
  smartAccount?.address ?? ""
6651
6965
  );
6652
- const hasActiveSmartAccount = !!smartAccount?.address && !!account?.address && chunkPTWGTINW_cjs.compareAddresses(smartAccount?.address, account?.address);
6966
+ const hasActiveSmartAccount = !!smartAccount?.address && !!account?.address && chunkLMX37RCG_cjs.compareAddresses(smartAccount?.address, account?.address);
6653
6967
  const disconnect = React10.useCallback(async () => {
6654
6968
  try {
6655
6969
  setIsConnected(false);
@@ -6730,176 +7044,36 @@ var useRefreshBalances = () => {
6730
7044
  };
6731
7045
  return { refresh };
6732
7046
  };
6733
- var getCustomTokenBalances = async (thor, address, customTokens) => {
6734
- const clauses = customTokens.map((token) => {
6735
- const erc20Contract = thor.contracts.load(
6736
- token.address,
6737
- chunk5GZ7N47F_cjs.IERC20__factory.abi
6738
- );
6739
- return erc20Contract.clause.balanceOf([address]);
6740
- });
6741
- const response = await thor.contracts.executeMultipleClausesCall(clauses);
6742
- if (!response.every((r) => r.success && !!r.result.plain)) {
6743
- throw new Error("Failed to get custom token balances");
6744
- }
6745
- return response.map((r, index) => {
6746
- const token = customTokens[index];
6747
- const original = r.result.plain;
6748
- const scaled = ethers.formatEther(BigInt(original)) || "0";
6749
- return {
6750
- address: token.address,
6751
- symbol: token.symbol,
6752
- balance: scaled
6753
- };
6754
- });
6755
- };
6756
- var getTokenBalances = async (thor, address, network) => {
6757
- const config = chunkPTWGTINW_cjs.getConfig(network);
6758
- const [b3trBalance, vot3Balance, veDelegateBalance, gloDollarBalance] = await chunkPTWGTINW_cjs.executeMultipleClausesCall({
6759
- thor,
6760
- calls: [
6761
- {
6762
- abi: chunk5GZ7N47F_cjs.IB3TR__factory.abi,
6763
- address: config.b3trContractAddress,
6764
- functionName: "balanceOf",
6765
- args: [address]
6766
- },
6767
- {
6768
- abi: chunk5GZ7N47F_cjs.IVOT3__factory.abi,
6769
- address: config.vot3ContractAddress,
6770
- functionName: "balanceOf",
6771
- args: [address]
6772
- },
6773
- {
6774
- abi: chunk5GZ7N47F_cjs.IERC20__factory.abi,
6775
- address: config.veDelegate,
6776
- functionName: "balanceOf",
6777
- args: [address]
6778
- },
6779
- {
6780
- abi: chunk5GZ7N47F_cjs.IERC20__factory.abi,
6781
- address: config.gloDollarContractAddress,
6782
- functionName: "balanceOf",
6783
- args: [address]
6784
- }
6785
- ]
6786
- });
6787
- const { balance: vetBalance, energy: vthoBalance } = await getAccountBalance(thor, address);
6788
- return [
6789
- {
6790
- address: "0x",
6791
- symbol: "VET",
6792
- balance: vetBalance
6793
- },
6794
- {
6795
- address: config.vthoContractAddress,
6796
- symbol: "VTHO",
6797
- balance: vthoBalance
6798
- },
6799
- {
6800
- address: config.b3trContractAddress,
6801
- symbol: "B3TR",
6802
- balance: b3trBalance
6803
- },
6804
- {
6805
- address: config.vot3ContractAddress,
6806
- symbol: "VOT3",
6807
- balance: vot3Balance
6808
- },
6809
- {
6810
- address: config.veDelegate,
6811
- symbol: "veDelegate",
6812
- balance: veDelegateBalance
6813
- },
6814
- {
6815
- address: config.gloDollarContractAddress,
6816
- symbol: "USDGLO",
6817
- balance: gloDollarBalance
6818
- }
6819
- ];
6820
- };
6821
- var useTokenBalances2 = ({ address }) => {
6822
- const thor = dappKitReact.useThor();
6823
- const { network } = useVeChainKitConfig();
6824
- const { customTokens } = useCustomTokens();
6825
- return reactQuery.useQueries({
6826
- queries: [
6827
- {
6828
- queryKey: ["base-token-balances", address],
6829
- queryFn: () => getTokenBalances(thor, address, network.type)
6830
- },
6831
- {
6832
- queryKey: ["custom-token-balances", address],
6833
- queryFn: () => getCustomTokenBalances(thor, address, customTokens)
6834
- }
6835
- ],
6836
- combine: (data) => {
6837
- return {
6838
- data: data.flat(),
6839
- loading: data[0].isLoading || data[1].isLoading,
6840
- error: data[0].error || data[1].error
6841
- };
6842
- }
6843
- });
6844
- };
6845
- var getTokenPrices = async (thor, tokens2, network) => {
6846
- const config = chunkPTWGTINW_cjs.getConfig(network);
6847
- const oracleContract = thor.contracts.load(
6848
- config.oracleContractAddress,
6849
- chunk5GZ7N47F_cjs.IVechainEnergyOracleV1__factory.abi
6850
- );
6851
- const clauses = tokens2.map(
6852
- (token) => oracleContract.clause.getLatestValue(PRICE_FEED_IDS[token])
6853
- );
6854
- const response = await thor.transactions.executeMultipleClausesCall(
6855
- clauses
6856
- );
6857
- if (!response.every((r) => r.success && !!r.result.array)) {
6858
- throw new Error("Failed to get token prices");
6859
- }
6860
- return response.map(
6861
- (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 }
6862
7051
  );
7052
+ return metadata.data;
6863
7053
  };
6864
- var tokens = ["VET", "VTHO", "B3TR", "EUR", "GBP"];
6865
- var useTokenPrices2 = () => {
7054
+ var abi5 = chunk5GZ7N47F_cjs.X2EarnApps__factory.abi;
7055
+ var useXAppMetadata = (xAppId) => {
6866
7056
  const thor = dappKitReact.useThor();
6867
7057
  const { network } = useVeChainKitConfig();
6868
- const config = chunkPTWGTINW_cjs.getConfig(network.type);
6869
7058
  return reactQuery.useQuery({
6870
- queryKey: ["token-prices", network.type],
6871
- queryFn: () => getTokenPrices(thor, tokens, network.type),
6872
- select: (data) => {
6873
- const [
6874
- vetUsdPrice,
6875
- vthoUsdPrice,
6876
- b3trUsdPrice,
6877
- eurUsdPrice,
6878
- gbpUsdPrice
6879
- ] = data;
6880
- const prices = {
6881
- "0x": vetUsdPrice || 0,
6882
- [config.vthoContractAddress]: vthoUsdPrice || 0,
6883
- [config.b3trContractAddress]: b3trUsdPrice || 0,
6884
- [config.vot3ContractAddress]: b3trUsdPrice || 0,
6885
- [config.veDelegate]: b3trUsdPrice || 0,
6886
- [config.gloDollarContractAddress]: 1
6887
- // GloDollar is pegged to USD
6888
- };
6889
- const exchangeRates = {
6890
- eurUsdPrice: eurUsdPrice || 1,
6891
- gbpUsdPrice: gbpUsdPrice || 1
6892
- };
6893
- return {
6894
- prices,
6895
- exchangeRates
6896
- };
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;
6897
7071
  }
6898
7072
  });
6899
7073
  };
6900
7074
  var getIpfsMetadata = async (networkType, uri, parseJson = false) => {
6901
7075
  if (!uri) throw new Error("No URI provided");
6902
- const newUri = chunkPTWGTINW_cjs.convertUriToUrl(uri, networkType);
7076
+ const newUri = chunkLMX37RCG_cjs.convertUriToUrl(uri, networkType);
6903
7077
  if (!newUri) throw new Error("Invalid URI");
6904
7078
  const response = await fetch(newUri, {
6905
7079
  headers: {
@@ -6923,7 +7097,7 @@ var useIpfsMetadata = (ipfsUri, parseJson = false) => {
6923
7097
  var MAX_IMAGE_SIZE = 1024 * 1024 * 10;
6924
7098
  var getIpfsImage = async (networkType, uri) => {
6925
7099
  if (!uri) throw new Error("IPFS URI is required");
6926
- const response = await fetch(chunkPTWGTINW_cjs.convertUriToUrl(uri, networkType) ?? "", {
7100
+ const response = await fetch(chunkLMX37RCG_cjs.convertUriToUrl(uri, networkType) ?? "", {
6927
7101
  headers: {
6928
7102
  "X-Project-Id": "vechain-kit"
6929
7103
  }
@@ -6955,7 +7129,7 @@ var getIpfsImage = async (networkType, uri) => {
6955
7129
  resolve({
6956
7130
  image: reader.result,
6957
7131
  mime: blob.type,
6958
- mediaType: chunkPTWGTINW_cjs.resolveMediaTypeFromMimeType(blob.type)
7132
+ mediaType: chunkLMX37RCG_cjs.resolveMediaTypeFromMimeType(blob.type)
6959
7133
  });
6960
7134
  };
6961
7135
  reader.onerror = () => {
@@ -7546,7 +7720,7 @@ var DappKitButton = ({ isDark, gridColumn = 2 }) => {
7546
7720
  }
7547
7721
  );
7548
7722
  }
7549
- if (errorMsg && chunkPTWGTINW_cjs.isRejectionError(errorMsg)) {
7723
+ if (errorMsg && chunkLMX37RCG_cjs.isRejectionError(errorMsg)) {
7550
7724
  return Analytics.auth.dropOff("dappkit-view", {
7551
7725
  ...source && { source }
7552
7726
  });
@@ -7612,8 +7786,8 @@ var ConnectionOptionsStack = () => {
7612
7786
  showMoreLogin,
7613
7787
  isOfficialVeChainApp
7614
7788
  } = useLoginModalContent();
7615
- 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: method13, gridColumn }) => {
7616
- switch (method13) {
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) {
7617
7791
  case "email":
7618
7792
  return showEmailLogin && /* @__PURE__ */ jsxRuntime.jsx(EmailLoginButton, {}, "email");
7619
7793
  case "google":
@@ -7720,7 +7894,7 @@ var MainContent = ({ setCurrentContent, onClose }) => {
7720
7894
  }
7721
7895
  }, [connection.isConnected, onClose]);
7722
7896
  const showEcosystemButton = loginMethods?.some(
7723
- ({ method: method13 }) => method13 === "ecosystem"
7897
+ ({ method: method7 }) => method7 === "ecosystem"
7724
7898
  );
7725
7899
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7726
7900
  /* @__PURE__ */ jsxRuntime.jsxs(StickyHeaderContainer, { children: [
@@ -7911,7 +8085,7 @@ var AccountDetailsButton = ({
7911
8085
  wordBreak: "break-word",
7912
8086
  whiteSpace: "normal",
7913
8087
  w: "full",
7914
- children: wallet?.domain ? chunkPTWGTINW_cjs.humanDomain(wallet?.domain ?? "", 18, 0) : chunkPTWGTINW_cjs.humanAddress(wallet?.address ?? "", 6, 4)
8088
+ children: wallet?.domain ? chunkLMX37RCG_cjs.humanDomain(wallet?.domain ?? "", 18, 0) : chunkLMX37RCG_cjs.humanAddress(wallet?.address ?? "", 6, 4)
7915
8089
  }
7916
8090
  )
7917
8091
  ] }),
@@ -8049,7 +8223,7 @@ var AccountSelector = ({
8049
8223
  props: { width: 7, height: 7 }
8050
8224
  }
8051
8225
  ),
8052
- /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: size, fontWeight: "500", children: chunkPTWGTINW_cjs.humanDomain(wallet?.domain ?? "", 22, 0) || chunkPTWGTINW_cjs.humanAddress(wallet?.address ?? "", 6, 4) })
8226
+ /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: size, fontWeight: "500", children: chunkLMX37RCG_cjs.humanDomain(wallet?.domain ?? "", 22, 0) || chunkLMX37RCG_cjs.humanAddress(wallet?.address ?? "", 6, 4) })
8053
8227
  ] }),
8054
8228
  /* @__PURE__ */ jsxRuntime.jsx(
8055
8229
  react.Icon,
@@ -8113,17 +8287,17 @@ var AssetIcons = ({
8113
8287
  border: "2px solid #00000024",
8114
8288
  alignItems: "center",
8115
8289
  justifyContent: "center",
8116
- children: chunkPTWGTINW_cjs.TOKEN_LOGO_COMPONENTS[token.symbol] ? React10__default.default.cloneElement(
8117
- chunkPTWGTINW_cjs.TOKEN_LOGO_COMPONENTS[token.symbol],
8290
+ children: chunkLMX37RCG_cjs.TOKEN_LOGO_COMPONENTS[token.symbol] ? React10__default.default.cloneElement(
8291
+ chunkLMX37RCG_cjs.TOKEN_LOGO_COMPONENTS[token.symbol],
8118
8292
  {
8119
8293
  width: `${iconSize * 0.8}px`,
8120
8294
  height: `${iconSize * 0.8}px`,
8121
8295
  rounded: "full"
8122
8296
  }
8123
- ) : chunkPTWGTINW_cjs.TOKEN_LOGOS[token.symbol] ? /* @__PURE__ */ jsxRuntime.jsx(
8297
+ ) : chunkLMX37RCG_cjs.TOKEN_LOGOS[token.symbol] ? /* @__PURE__ */ jsxRuntime.jsx(
8124
8298
  react.Image,
8125
8299
  {
8126
- src: chunkPTWGTINW_cjs.TOKEN_LOGOS[token.symbol],
8300
+ src: chunkLMX37RCG_cjs.TOKEN_LOGOS[token.symbol],
8127
8301
  alt: `${token.symbol} logo`,
8128
8302
  width: `${iconSize * 0.8}px`,
8129
8303
  height: `${iconSize * 0.8}px`,
@@ -9052,7 +9226,7 @@ var NetworkInfo = () => {
9052
9226
  InfoRow,
9053
9227
  {
9054
9228
  label: t("Node URL"),
9055
- value: network.nodeUrl || chunkPTWGTINW_cjs.getConfig(network.type).nodeUrl
9229
+ value: network.nodeUrl || chunkLMX37RCG_cjs.getConfig(network.type).nodeUrl
9056
9230
  }
9057
9231
  ),
9058
9232
  connection.isConnectedWithPrivy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -9289,7 +9463,7 @@ var WalletSecuredBy = () => {
9289
9463
  var EmbeddedWalletContent = ({ setCurrentContent }) => {
9290
9464
  const { t } = reactI18next.useTranslation();
9291
9465
  const { connectedWallet, connection } = useWallet();
9292
- const walletImage = chunkPTWGTINW_cjs.getPicassoImage(connectedWallet?.address ?? "");
9466
+ const walletImage = chunkLMX37RCG_cjs.getPicassoImage(connectedWallet?.address ?? "");
9293
9467
  const { getConnectionCache } = useCrossAppConnectionCache();
9294
9468
  const connectionCache = getConnectionCache();
9295
9469
  const { darkMode: isDark } = useVeChainKitConfig();
@@ -9531,6 +9705,7 @@ var SendTokenContent = ({
9531
9705
  const { t } = reactI18next.useTranslation();
9532
9706
  const { darkMode: isDark } = useVeChainKitConfig();
9533
9707
  const { currentCurrency } = useCurrency();
9708
+ const { exchangeRates } = useTokenPrices();
9534
9709
  const [selectedToken, setSelectedToken] = React10.useState(
9535
9710
  preselectedToken ?? null
9536
9711
  );
@@ -9553,6 +9728,19 @@ var SendTokenContent = ({
9553
9728
  mode: "onChange"
9554
9729
  });
9555
9730
  const { toAddressOrDomain, amount } = watch();
9731
+ const formattedValue = React10.useMemo(() => {
9732
+ if (selectedToken) {
9733
+ return formatCompactCurrency(
9734
+ convertToSelectedCurrency(
9735
+ Number(amount) * selectedToken.priceUsd,
9736
+ currentCurrency,
9737
+ exchangeRates
9738
+ ),
9739
+ { currency: currentCurrency }
9740
+ );
9741
+ }
9742
+ return "";
9743
+ }, [amount, selectedToken, currentCurrency, exchangeRates]);
9556
9744
  React10.useEffect(() => {
9557
9745
  if (selectedToken && amount) {
9558
9746
  Analytics.send.flow("amount", {
@@ -9647,6 +9835,7 @@ var SendTokenContent = ({
9647
9835
  resolvedAddress: resolvedDomainData?.address,
9648
9836
  amount: data.amount,
9649
9837
  selectedToken,
9838
+ formattedTotalAmount: formattedValue,
9650
9839
  setCurrentContent
9651
9840
  }
9652
9841
  });
@@ -9747,8 +9936,8 @@ var SendTokenContent = ({
9747
9936
  bg: isDark ? "whiteAlpha.300" : "blackAlpha.300"
9748
9937
  },
9749
9938
  onClick: () => setIsSelectingToken(true),
9750
- leftIcon: chunkPTWGTINW_cjs.TOKEN_LOGO_COMPONENTS[selectedToken.symbol] ? React10__default.default.cloneElement(
9751
- chunkPTWGTINW_cjs.TOKEN_LOGO_COMPONENTS[selectedToken.symbol],
9939
+ leftIcon: chunkLMX37RCG_cjs.TOKEN_LOGO_COMPONENTS[selectedToken.symbol] ? React10__default.default.cloneElement(
9940
+ chunkLMX37RCG_cjs.TOKEN_LOGO_COMPONENTS[selectedToken.symbol],
9752
9941
  {
9753
9942
  boxSize: "20px",
9754
9943
  borderRadius: "full"
@@ -9756,7 +9945,7 @@ var SendTokenContent = ({
9756
9945
  ) : /* @__PURE__ */ jsxRuntime.jsx(
9757
9946
  react.Image,
9758
9947
  {
9759
- src: chunkPTWGTINW_cjs.TOKEN_LOGOS[selectedToken.symbol],
9948
+ src: chunkLMX37RCG_cjs.TOKEN_LOGOS[selectedToken.symbol],
9760
9949
  alt: `${selectedToken.symbol} logo`,
9761
9950
  boxSize: "20px",
9762
9951
  borderRadius: "full",
@@ -9815,10 +10004,7 @@ var SendTokenContent = ({
9815
10004
  /* @__PURE__ */ jsxRuntime.jsxs(react.Text, { opacity: 0.5, children: [
9816
10005
  "\u2248",
9817
10006
  " ",
9818
- formatCompactCurrency(
9819
- Number(amount) * selectedToken.priceUsd,
9820
- currentCurrency
9821
- )
10007
+ formattedValue
9822
10008
  ] }),
9823
10009
  /* @__PURE__ */ jsxRuntime.jsx(
9824
10010
  react.Text,
@@ -9937,18 +10123,14 @@ var SendTokenContent = ({
9937
10123
  ) })
9938
10124
  ] });
9939
10125
  };
9940
- var summaryFormatter = new Intl.NumberFormat("de-DE", {
9941
- notation: "standard",
9942
- minimumFractionDigits: 2,
9943
- maximumFractionDigits: 2
9944
- });
9945
10126
  var SendTokenSummaryContent = ({
9946
10127
  setCurrentContent,
9947
10128
  toAddressOrDomain,
9948
10129
  resolvedDomain,
9949
10130
  resolvedAddress,
9950
10131
  amount,
9951
- selectedToken
10132
+ selectedToken,
10133
+ formattedTotalAmount
9952
10134
  }) => {
9953
10135
  const { t } = reactI18next.useTranslation();
9954
10136
  const { account, connection, connectedWallet } = useWallet();
@@ -9960,12 +10142,11 @@ var SendTokenSummaryContent = ({
9960
10142
  3
9961
10143
  );
9962
10144
  const { open: openUpgradeSmartAccountModal } = useUpgradeSmartAccountModal();
9963
- const { currentCurrency } = useCurrency();
9964
10145
  const toImageSrc = React10.useMemo(() => {
9965
10146
  if (avatar) {
9966
10147
  return avatar;
9967
10148
  }
9968
- return chunkPTWGTINW_cjs.getPicassoImage(resolvedAddress || toAddressOrDomain);
10149
+ return chunkLMX37RCG_cjs.getPicassoImage(resolvedAddress || toAddressOrDomain);
9969
10150
  }, [avatar, network.type, resolvedAddress, toAddressOrDomain]);
9970
10151
  const handleSend = async () => {
9971
10152
  if (upgradeRequired) {
@@ -10087,7 +10268,7 @@ var SendTokenSummaryContent = ({
10087
10268
  });
10088
10269
  };
10089
10270
  const handleError = (error) => {
10090
- if (error && chunkPTWGTINW_cjs.isRejectionError(error)) {
10271
+ if (error && chunkLMX37RCG_cjs.isRejectionError(error)) {
10091
10272
  Analytics.send.flow("review", {
10092
10273
  tokenSymbol: selectedToken.symbol,
10093
10274
  amount,
@@ -10179,7 +10360,10 @@ var SendTokenSummaryContent = ({
10179
10360
  textAlign: "left",
10180
10361
  "data-testid": "send-summary-amount",
10181
10362
  children: [
10182
- summaryFormatter.format(Number(amount)),
10363
+ Number(amount).toLocaleString(void 0, {
10364
+ minimumFractionDigits: 2,
10365
+ maximumFractionDigits: 2
10366
+ }),
10183
10367
  " ",
10184
10368
  selectedToken.symbol
10185
10369
  ]
@@ -10188,10 +10372,7 @@ var SendTokenSummaryContent = ({
10188
10372
  /* @__PURE__ */ jsxRuntime.jsxs(react.Text, { opacity: 0.5, children: [
10189
10373
  "\u2248",
10190
10374
  " ",
10191
- formatCompactCurrency(
10192
- Number(amount) * selectedToken.priceUsd,
10193
- currentCurrency
10194
- )
10375
+ formattedTotalAmount
10195
10376
  ] })
10196
10377
  ] })
10197
10378
  ]
@@ -10396,7 +10577,7 @@ var DomainListItem = ({
10396
10577
  props: {
10397
10578
  width: "40px",
10398
10579
  height: "40px",
10399
- src: metadata.image ?? chunkPTWGTINW_cjs.getPicassoImage(domain.name),
10580
+ src: metadata.image ?? chunkLMX37RCG_cjs.getPicassoImage(domain.name),
10400
10581
  alt: domain.name
10401
10582
  }
10402
10583
  }
@@ -10408,7 +10589,7 @@ var DomainListItem = ({
10408
10589
  color: isDark ? "whiteAlpha.900" : "gray.700",
10409
10590
  fontSize: "md",
10410
10591
  fontWeight: "500",
10411
- children: chunkPTWGTINW_cjs.humanDomain(domain.name, 24, 0)
10592
+ children: chunkLMX37RCG_cjs.humanDomain(domain.name, 24, 0)
10412
10593
  }
10413
10594
  ),
10414
10595
  isCurrentDomain && /* @__PURE__ */ jsxRuntime.jsx(
@@ -10789,7 +10970,7 @@ var ChooseNameSummaryContent = ({
10789
10970
  );
10790
10971
  const { open: openUpgradeSmartAccountModal } = useUpgradeSmartAccountModal();
10791
10972
  const handleError = (error) => {
10792
- if (chunkPTWGTINW_cjs.isRejectionError(error)) {
10973
+ if (chunkLMX37RCG_cjs.isRejectionError(error)) {
10793
10974
  Analytics.nameSelection.dropOff("confirmation", {
10794
10975
  isError: true,
10795
10976
  name: fullDomain,
@@ -11202,7 +11383,7 @@ var CustomizationContent = ({
11202
11383
  setPreviewImageUrl(newPreviewUrl);
11203
11384
  const uploadedImage = await onUpload(file);
11204
11385
  if (!uploadedImage) throw new Error("Failed to compress image");
11205
- const ipfsHash = await chunkPTWGTINW_cjs.uploadBlobToIPFS(
11386
+ const ipfsHash = await chunkLMX37RCG_cjs.uploadBlobToIPFS(
11206
11387
  uploadedImage.file,
11207
11388
  file.name,
11208
11389
  network.type
@@ -11305,7 +11486,7 @@ var CustomizationContent = ({
11305
11486
  backgroundPosition: "center",
11306
11487
  position: "relative",
11307
11488
  h: "80px",
11308
- background: `no-repeat url('${chunkPTWGTINW_cjs.getPicassoImage(
11489
+ background: `no-repeat url('${chunkLMX37RCG_cjs.getPicassoImage(
11309
11490
  account?.address ?? ""
11310
11491
  )}')`,
11311
11492
  w: "100%",
@@ -11701,7 +11882,7 @@ var CustomizationSummaryContent = ({
11701
11882
  }
11702
11883
  },
11703
11884
  onError: (error) => {
11704
- if (error && chunkPTWGTINW_cjs.isRejectionError(error?.message ?? "")) {
11885
+ if (error && chunkLMX37RCG_cjs.isRejectionError(error?.message ?? "")) {
11705
11886
  Analytics.customization.dropOff({
11706
11887
  stage: "confirmation",
11707
11888
  reason: "wallet_rejected",
@@ -11792,14 +11973,14 @@ var CustomizationSummaryContent = ({
11792
11973
  if (changes.avatarIpfsHash) {
11793
11974
  queryClient.setQueryData(
11794
11975
  getAvatarQueryKey(domain, network.type),
11795
- chunkPTWGTINW_cjs.convertUriToUrl(
11976
+ chunkLMX37RCG_cjs.convertUriToUrl(
11796
11977
  "ipfs://" + changes.avatarIpfsHash,
11797
11978
  network.type
11798
11979
  )
11799
11980
  );
11800
11981
  queryClient.setQueryData(
11801
11982
  getAvatarOfAddressQueryKey(account?.address ?? ""),
11802
- chunkPTWGTINW_cjs.convertUriToUrl(
11983
+ chunkLMX37RCG_cjs.convertUriToUrl(
11803
11984
  "ipfs://" + changes.avatarIpfsHash,
11804
11985
  network.type
11805
11986
  )
@@ -12303,7 +12484,7 @@ var ManageCustomTokenContent = ({
12303
12484
  /* @__PURE__ */ jsxRuntime.jsx(
12304
12485
  react.Image,
12305
12486
  {
12306
- src: chunkPTWGTINW_cjs.TOKEN_LOGOS[token?.symbol],
12487
+ src: chunkLMX37RCG_cjs.TOKEN_LOGOS[token?.symbol],
12307
12488
  alt: `${token.symbol} logo`,
12308
12489
  boxSize: "20px",
12309
12490
  borderRadius: "full",
@@ -12333,7 +12514,7 @@ var ManageCustomTokenContent = ({
12333
12514
  ),
12334
12515
  /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontWeight: "medium", children: token.symbol ?? "Unknown" })
12335
12516
  ] }),
12336
- /* @__PURE__ */ jsxRuntime.jsx(react.Text, { opacity: 0.7, children: chunkPTWGTINW_cjs.humanAddress(
12517
+ /* @__PURE__ */ jsxRuntime.jsx(react.Text, { opacity: 0.7, children: chunkLMX37RCG_cjs.humanAddress(
12337
12518
  token.address ?? "",
12338
12519
  4,
12339
12520
  4
@@ -12421,7 +12602,7 @@ var ChangeCurrencyContent = ({
12421
12602
  _hover: { bg: "whiteAlpha.100" },
12422
12603
  children: [
12423
12604
  /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { spacing: 3, children: [
12424
- /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "xl", children: chunkPTWGTINW_cjs.CURRENCY_SYMBOLS[currency] }),
12605
+ /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "xl", children: chunkLMX37RCG_cjs.CURRENCY_SYMBOLS[currency] }),
12425
12606
  /* @__PURE__ */ jsxRuntime.jsx(react.Text, { children: currency.toUpperCase() })
12426
12607
  ] }),
12427
12608
  currentCurrency === currency && /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { as: bs.BsCheck, boxSize: 5, color: "blue.500" })
@@ -12788,11 +12969,11 @@ var TermsAndPrivacyAccordion = () => {
12788
12969
  const { agreements, documents } = useLegalDocuments();
12789
12970
  const agreementsByDocumentType = React10.useMemo(() => {
12790
12971
  const userAgreements = agreements?.filter(
12791
- (agreement) => chunkPTWGTINW_cjs.compareAddresses(agreement.walletAddress, account?.address)
12972
+ (agreement) => chunkLMX37RCG_cjs.compareAddresses(agreement.walletAddress, account?.address)
12792
12973
  );
12793
12974
  const vechainKitDefaultTerms = {
12794
12975
  id: "vechain-kit-terms",
12795
- ...chunkPTWGTINW_cjs.VECHAIN_KIT_TERMS_CONFIG,
12976
+ ...chunkLMX37RCG_cjs.VECHAIN_KIT_TERMS_CONFIG,
12796
12977
  documentType: "terms" /* TERMS */,
12797
12978
  documentSource: "vechain-kit" /* VECHAIN_KIT */,
12798
12979
  walletAddress: account?.address ?? "",
@@ -13001,13 +13182,13 @@ var PrivyLinkedAccounts = ({ onBack }) => {
13001
13182
  } = reactAuth.usePrivy();
13002
13183
  const canLinkWallets = React10.useMemo(() => {
13003
13184
  const privyWallets = privy?.loginMethods?.filter(
13004
- (method13) => [
13185
+ (method7) => [
13005
13186
  "rabby_wallet",
13006
13187
  "coinbase_wallet",
13007
13188
  "rainbow",
13008
13189
  "phantom",
13009
13190
  "metamask"
13010
- ].includes(method13)
13191
+ ].includes(method7)
13011
13192
  ) ?? [];
13012
13193
  const dappKitWallets = dappKit?.allowedWallets ?? [];
13013
13194
  return privyWallets.length > 0 || dappKitWallets.length > 0;
@@ -13119,7 +13300,7 @@ var PrivyLinkedAccounts = ({ onBack }) => {
13119
13300
  case "phone":
13120
13301
  return account.number;
13121
13302
  case "wallet":
13122
- return `${chunkPTWGTINW_cjs.humanAddress(account.address)} - ${account.walletClientType}`;
13303
+ return `${chunkLMX37RCG_cjs.humanAddress(account.address)} - ${account.walletClientType}`;
13123
13304
  default:
13124
13305
  return "";
13125
13306
  }
@@ -13894,7 +14075,7 @@ var SharedAppCard = ({
13894
14075
  react.Image,
13895
14076
  {
13896
14077
  src: imageUrl,
13897
- fallbackSrc: chunkPTWGTINW_cjs.notFoundImage,
14078
+ fallbackSrc: chunkLMX37RCG_cjs.notFoundImage,
13898
14079
  alt: name,
13899
14080
  height: "90px",
13900
14081
  objectFit: "contain",
@@ -14016,7 +14197,7 @@ var ShortcutsSection = ({}) => {
14016
14197
  react.Image,
14017
14198
  {
14018
14199
  src: shortcut.image,
14019
- fallbackSrc: chunkPTWGTINW_cjs.notFoundImage,
14200
+ fallbackSrc: chunkLMX37RCG_cjs.notFoundImage,
14020
14201
  alt: shortcut.name,
14021
14202
  objectFit: "contain",
14022
14203
  rounded: "full"
@@ -14074,7 +14255,8 @@ var DEFAULT_APPS = [
14074
14255
  tweets: [],
14075
14256
  ve_world: {
14076
14257
  banner: "https://i.ibb.co/cgJBj83/vbd.png"
14077
- }
14258
+ },
14259
+ categories: []
14078
14260
  },
14079
14261
  {
14080
14262
  name: "vet.domains",
@@ -14088,7 +14270,8 @@ var DEFAULT_APPS = [
14088
14270
  tweets: [],
14089
14271
  ve_world: {
14090
14272
  banner: "https://vet.domains/assets/walletconnect.png"
14091
- }
14273
+ },
14274
+ categories: []
14092
14275
  }
14093
14276
  // {
14094
14277
  // name: 'VeChain Kit',
@@ -14149,17 +14332,7 @@ var ExploreEcosystemContent = ({
14149
14332
  ) : [];
14150
14333
  const filteredDefaultApps = DEFAULT_APPS.filter(
14151
14334
  (dapp) => dapp.name.toLowerCase().includes(searchQuery.toLowerCase())
14152
- ).map((dapp) => {
14153
- if (dapp.logoComponent) {
14154
- return {
14155
- ...dapp,
14156
- logoComponent: React10__default.default.cloneElement(dapp.logoComponent, {
14157
- isDark
14158
- })
14159
- };
14160
- }
14161
- return dapp;
14162
- });
14335
+ );
14163
14336
  const filteredAppHubApps = appHubApps?.filter(
14164
14337
  (app) => (
14165
14338
  // Text search filter
@@ -14246,10 +14419,7 @@ var ExploreEcosystemContent = ({
14246
14419
  url: dapp.external_url,
14247
14420
  setCurrentContent,
14248
14421
  description: dapp.description,
14249
- selectedCategory: currentCategory,
14250
- ...dapp.logoComponent && {
14251
- logoComponent: dapp.logoComponent
14252
- }
14422
+ selectedCategory: currentCategory
14253
14423
  }
14254
14424
  ) }, dapp.name)) }),
14255
14425
  shouldShowVbdApps && filteredVbdApps.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: filteredVbdApps.map((dapp) => /* @__PURE__ */ jsxRuntime.jsx(react.GridItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -14514,7 +14684,7 @@ var TransactionModalContent = ({
14514
14684
  }
14515
14685
  };
14516
14686
  const statusConfig = getStatusConfig();
14517
- const socialDescription = `${chunkPTWGTINW_cjs.getConfig(network.type).explorerUrl}/${txReceipt?.meta.txID}`;
14687
+ const socialDescription = `${chunkLMX37RCG_cjs.getConfig(network.type).explorerUrl}/${txReceipt?.meta.txID}`;
14518
14688
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { children: [
14519
14689
  /* @__PURE__ */ jsxRuntime.jsxs(StickyHeaderContainer, { children: [
14520
14690
  /* @__PURE__ */ jsxRuntime.jsx(react.ModalHeader, { children: statusConfig.title }),
@@ -14592,7 +14762,7 @@ var TransactionModalContent = ({
14592
14762
  uiConfig?.showExplorerButton && txReceipt?.meta.txID && /* @__PURE__ */ jsxRuntime.jsx(
14593
14763
  react.Link,
14594
14764
  {
14595
- href: `${chunkPTWGTINW_cjs.getConfig(network.type).explorerUrl}/${txReceipt?.meta.txID}`,
14765
+ href: `${chunkLMX37RCG_cjs.getConfig(network.type).explorerUrl}/${txReceipt?.meta.txID}`,
14596
14766
  isExternal: true,
14597
14767
  opacity: 0.5,
14598
14768
  fontSize: "14px",
@@ -14655,7 +14825,7 @@ var SuccessfulOperationContent = ({
14655
14825
  }) => {
14656
14826
  const { t } = reactI18next.useTranslation();
14657
14827
  const { network, darkMode } = useVeChainKitConfig();
14658
- const explorerUrl = chunkPTWGTINW_cjs.getConfig(network.type).explorerUrl;
14828
+ const explorerUrl = chunkLMX37RCG_cjs.getConfig(network.type).explorerUrl;
14659
14829
  const socialDescription = `${explorerUrl}/${txId}`;
14660
14830
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { children: [
14661
14831
  /* @__PURE__ */ jsxRuntime.jsxs(StickyHeaderContainer, { children: [
@@ -14998,7 +15168,7 @@ var ConnectPopover = ({
14998
15168
  privyEcosystemAppIDS
14999
15169
  } = useVeChainKitConfig();
15000
15170
  const showEcosystemButton = loginMethods?.some(
15001
- ({ method: method13 }) => method13 === "ecosystem"
15171
+ ({ method: method7 }) => method7 === "ecosystem"
15002
15172
  );
15003
15173
  const { data: appsInfo, isLoading: isEcosystemAppsLoading } = useFetchAppInfo(privyEcosystemAppIDS);
15004
15174
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -15051,19 +15221,19 @@ var WalletDisplay = ({ variant }) => {
15051
15221
  return null;
15052
15222
  }
15053
15223
  if (variant === "iconAndDomain") {
15054
- return account.domain ? /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", children: chunkPTWGTINW_cjs.humanDomain(account?.domain ?? "", 16, 0) }) : /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", children: chunkPTWGTINW_cjs.humanAddress(account.address ?? "", 6, 4) });
15224
+ return account.domain ? /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", children: chunkLMX37RCG_cjs.humanDomain(account?.domain ?? "", 16, 0) }) : /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", children: chunkLMX37RCG_cjs.humanAddress(account.address ?? "", 6, 4) });
15055
15225
  }
15056
15226
  if (variant === "iconDomainAndAssets") {
15057
15227
  return /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { spacing: 4, children: [
15058
15228
  /* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { spacing: 0, alignItems: "flex-start", children: [
15059
- account.domain && /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", fontWeight: "bold", children: chunkPTWGTINW_cjs.humanDomain(account?.domain ?? "", 16, 0) }),
15229
+ account.domain && /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", fontWeight: "bold", children: chunkLMX37RCG_cjs.humanDomain(account?.domain ?? "", 16, 0) }),
15060
15230
  /* @__PURE__ */ jsxRuntime.jsx(
15061
15231
  react.Text,
15062
15232
  {
15063
15233
  fontSize: account.domain ? "xs" : "sm",
15064
15234
  opacity: account.domain ? 0.5 : 1,
15065
15235
  "data-testid": "trimmed-address",
15066
- children: chunkPTWGTINW_cjs.humanAddress(account.address ?? "", 4, 4)
15236
+ children: chunkLMX37RCG_cjs.humanAddress(account.address ?? "", 4, 4)
15067
15237
  }
15068
15238
  )
15069
15239
  ] }),
@@ -15071,13 +15241,13 @@ var WalletDisplay = ({ variant }) => {
15071
15241
  ] });
15072
15242
  }
15073
15243
  return /* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { spacing: 0, alignItems: "flex-start", children: [
15074
- account.domain && /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", fontWeight: "bold", children: chunkPTWGTINW_cjs.humanDomain(account?.domain ?? "", 16, 0) }),
15244
+ account.domain && /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", fontWeight: "bold", children: chunkLMX37RCG_cjs.humanDomain(account?.domain ?? "", 16, 0) }),
15075
15245
  /* @__PURE__ */ jsxRuntime.jsx(
15076
15246
  react.Text,
15077
15247
  {
15078
15248
  fontSize: account.domain ? "xs" : "sm",
15079
15249
  opacity: account.domain ? 0.5 : 1,
15080
- children: chunkPTWGTINW_cjs.humanAddress(account.address ?? "", 4, 4)
15250
+ children: chunkLMX37RCG_cjs.humanAddress(account.address ?? "", 4, 4)
15081
15251
  }
15082
15252
  )
15083
15253
  ] });
@@ -15256,7 +15426,7 @@ var TransactionToastContent = ({
15256
15426
  }) => {
15257
15427
  const { t } = reactI18next.useTranslation();
15258
15428
  const { network } = useVeChainKitConfig();
15259
- const explorerUrl = chunkPTWGTINW_cjs.getConfig(network.type).explorerUrl;
15429
+ const explorerUrl = chunkLMX37RCG_cjs.getConfig(network.type).explorerUrl;
15260
15430
  const errorMessage = React10.useMemo(() => {
15261
15431
  if (!txError) return null;
15262
15432
  return txError.reason || t("Something went wrong. Please try again.");
@@ -15585,7 +15755,7 @@ var EcosystemContent = ({ onClose, appsInfo, isLoading }) => {
15585
15755
  onClose();
15586
15756
  } catch (error) {
15587
15757
  const errorMsg = error?.message;
15588
- if (errorMsg && chunkPTWGTINW_cjs.isRejectionError(errorMsg)) {
15758
+ if (errorMsg && chunkLMX37RCG_cjs.isRejectionError(errorMsg)) {
15589
15759
  Analytics.auth.dropOff("ecosystem-app-connect", {
15590
15760
  ...appName && { appName }
15591
15761
  });
@@ -15726,7 +15896,7 @@ var ProfileCard = ({
15726
15896
  const { account } = useWallet();
15727
15897
  const { network } = useVeChainKitConfig();
15728
15898
  const metadata = useWalletMetadata(address, network.type);
15729
- const headerImageSvg = chunkPTWGTINW_cjs.getPicassoImage(address);
15899
+ const headerImageSvg = chunkLMX37RCG_cjs.getPicassoImage(address);
15730
15900
  const isConnectedAccount = address === account?.address;
15731
15901
  const hasLinks = metadata?.records?.url || metadata?.records?.["com.x"] || metadata?.records?.email;
15732
15902
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Card, { variant: "vechainKitBase", ...style?.card, children: [
@@ -15899,7 +16069,7 @@ var SuccessfulOperationContent2 = ({
15899
16069
  }) => {
15900
16070
  const { t } = reactI18next.useTranslation();
15901
16071
  const { network, darkMode } = useVeChainKitConfig();
15902
- const explorerUrl = chunkPTWGTINW_cjs.getConfig(network.type).explorerUrl;
16072
+ const explorerUrl = chunkLMX37RCG_cjs.getConfig(network.type).explorerUrl;
15903
16073
  const socialDescription = `${explorerUrl}/${txId}`;
15904
16074
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { children: [
15905
16075
  /* @__PURE__ */ jsxRuntime.jsxs(StickyHeaderContainer, { children: [
@@ -16540,15 +16710,15 @@ var useReceiveModal = () => {
16540
16710
  var ReceiveModalProvider = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
16541
16711
  var useLoginModalContent = () => {
16542
16712
  const { privy, loginMethods } = useVeChainKitConfig();
16543
- const isVeChainApp = privy?.appId === chunkPTWGTINW_cjs.VECHAIN_PRIVY_APP_ID;
16544
- const isLoginMethodEnabled = (method13) => {
16713
+ const isVeChainApp = privy?.appId === chunkLMX37RCG_cjs.VECHAIN_PRIVY_APP_ID;
16714
+ const isLoginMethodEnabled = (method7) => {
16545
16715
  if (!loginMethods) return true;
16546
- if (Array.isArray(method13)) {
16547
- return method13.some(
16716
+ if (Array.isArray(method7)) {
16717
+ return method7.some(
16548
16718
  (m) => loginMethods.some((lm) => lm.method === m)
16549
16719
  );
16550
16720
  }
16551
- return loginMethods.some((lm) => lm.method === method13);
16721
+ return loginMethods.some((lm) => lm.method === method7);
16552
16722
  };
16553
16723
  const showEcosystemLogin = React10.useMemo(() => {
16554
16724
  if (!loginMethods) return true;
@@ -16806,7 +16976,7 @@ var useLoginWithOAuth2 = () => {
16806
16976
  });
16807
16977
  } catch (error) {
16808
16978
  const errorMsg = error instanceof Error ? error.message : "Unknown error";
16809
- if (chunkPTWGTINW_cjs.isRejectionError(errorMsg)) {
16979
+ if (chunkLMX37RCG_cjs.isRejectionError(errorMsg)) {
16810
16980
  Analytics.auth.dropOff("oauth", {
16811
16981
  ...provider && { provider }
16812
16982
  });
@@ -16849,16 +17019,16 @@ var useCrossAppConnectionCache = () => {
16849
17019
  var useLoginWithVeChain = () => {
16850
17020
  const { login: loginWithVeChain } = usePrivyCrossAppSdk();
16851
17021
  const { setConnectionCache } = useCrossAppConnectionCache();
16852
- const { data: appsInfo } = useFetchAppInfo([chunkPTWGTINW_cjs.VECHAIN_PRIVY_APP_ID]);
17022
+ const { data: appsInfo } = useFetchAppInfo([chunkLMX37RCG_cjs.VECHAIN_PRIVY_APP_ID]);
16853
17023
  const { user } = reactAuth.usePrivy();
16854
17024
  const login = async () => {
16855
17025
  try {
16856
17026
  Analytics.auth.methodSelected("vechain" /* VECHAIN */);
16857
- await loginWithVeChain(chunkPTWGTINW_cjs.VECHAIN_PRIVY_APP_ID);
17027
+ await loginWithVeChain(chunkLMX37RCG_cjs.VECHAIN_PRIVY_APP_ID);
16858
17028
  setConnectionCache({
16859
17029
  name: "VeChain",
16860
- logoUrl: appsInfo?.[chunkPTWGTINW_cjs.VECHAIN_PRIVY_APP_ID]?.logo_url,
16861
- appId: chunkPTWGTINW_cjs.VECHAIN_PRIVY_APP_ID,
17030
+ logoUrl: appsInfo?.[chunkLMX37RCG_cjs.VECHAIN_PRIVY_APP_ID]?.logo_url,
17031
+ appId: chunkLMX37RCG_cjs.VECHAIN_PRIVY_APP_ID,
16862
17032
  website: "https://governance.vebetterdao.org"
16863
17033
  });
16864
17034
  Analytics.auth.completed({
@@ -16867,7 +17037,7 @@ var useLoginWithVeChain = () => {
16867
17037
  });
16868
17038
  } catch (error) {
16869
17039
  const errorMsg = error instanceof Error ? error.message : "Unknown error";
16870
- if (chunkPTWGTINW_cjs.isRejectionError(errorMsg)) {
17040
+ if (chunkLMX37RCG_cjs.isRejectionError(errorMsg)) {
16871
17041
  Analytics.auth.dropOff("vechain-approval");
16872
17042
  } else {
16873
17043
  Analytics.auth.failed("vechain" /* VECHAIN */, errorMsg);
@@ -16969,34 +17139,43 @@ var useAppHubApps = () => {
16969
17139
  });
16970
17140
  };
16971
17141
  var getCallClauseQueryKey = ({
17142
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
17143
+ abi: abi9,
17144
+ address,
17145
+ method: method7
17146
+ }) => ["callClause", address, method7];
17147
+ var getCallClauseQueryKeyWithArgs = ({
17148
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
17149
+ abi: abi9,
16972
17150
  address,
16973
- method: method13,
17151
+ method: method7,
16974
17152
  args
16975
17153
  }) => [
16976
17154
  "callClause",
16977
17155
  address,
16978
- method13,
16979
- ...args ? [args] : []
17156
+ method7,
17157
+ ...args?.length ? [args] : []
16980
17158
  ];
16981
17159
  var useCallClause = ({
16982
17160
  address,
16983
17161
  abi: abi9,
16984
- method: method13,
17162
+ method: method7,
16985
17163
  args,
16986
17164
  queryOptions
16987
17165
  }) => {
16988
17166
  const thor = dappKitReact.useThor();
16989
17167
  return reactQuery.useQuery({
16990
- queryKey: getCallClauseQueryKey({
17168
+ queryKey: getCallClauseQueryKeyWithArgs({
17169
+ abi: abi9,
16991
17170
  address,
16992
- method: method13,
17171
+ method: method7,
16993
17172
  args
16994
17173
  }),
16995
- queryFn: async () => chunkPTWGTINW_cjs.executeCallClause({
17174
+ queryFn: async () => chunkLMX37RCG_cjs.executeCallClause({
16996
17175
  thor,
16997
17176
  contractAddress: address,
16998
17177
  abi: abi9,
16999
- method: method13,
17178
+ method: method7,
17000
17179
  args
17001
17180
  }),
17002
17181
  ...queryOptions
@@ -17006,7 +17185,7 @@ var useCallClause = ({
17006
17185
  // src/hooks/utils/useGetNodeUrl.ts
17007
17186
  var useGetNodeUrl = () => {
17008
17187
  const { network } = useVeChainKitConfig();
17009
- return network.nodeUrl ?? chunkPTWGTINW_cjs.getConfig(network.type).nodeUrl;
17188
+ return network.nodeUrl ?? chunkLMX37RCG_cjs.getConfig(network.type).nodeUrl;
17010
17189
  };
17011
17190
  var useIsPWA = () => {
17012
17191
  const [isPWA, setIsPWA] = React10.useState(true);
@@ -17139,7 +17318,7 @@ var getAccountImplementationAddress = async (thor, version, networkType) => {
17139
17318
  if (!networkType) throw new Error("Network type is required");
17140
17319
  if (!version) throw new Error("Version is required");
17141
17320
  const contract = thor.contracts.load(
17142
- chunkPTWGTINW_cjs.getConfig(networkType).accountFactoryAddress,
17321
+ chunkLMX37RCG_cjs.getConfig(networkType).accountFactoryAddress,
17143
17322
  chunk5GZ7N47F_cjs.SimpleAccountFactory__factory.abi
17144
17323
  );
17145
17324
  let implementationAddressPromise;
@@ -17181,7 +17360,7 @@ var useAccountImplementationAddress = (version) => {
17181
17360
  var getCurrentAccountImplementationVersion = async (thor, networkType) => {
17182
17361
  if (!networkType) throw new Error("Network type is required");
17183
17362
  const res = await thor.contracts.load(
17184
- chunkPTWGTINW_cjs.getConfig(networkType).accountFactoryAddress,
17363
+ chunkLMX37RCG_cjs.getConfig(networkType).accountFactoryAddress,
17185
17364
  chunk5GZ7N47F_cjs.SimpleAccountFactory__factory.abi
17186
17365
  ).read.currentAccountImplementationVersion();
17187
17366
  if (!res)
@@ -17208,7 +17387,7 @@ var getAccountAddress = async (thor, ownerAddress, networkType) => {
17208
17387
  if (!ownerAddress) throw new Error("Owner address is required");
17209
17388
  if (!networkType) throw new Error("Network type is required");
17210
17389
  const res = await thor.contracts.load(
17211
- chunkPTWGTINW_cjs.getConfig(networkType).accountFactoryAddress,
17390
+ chunkLMX37RCG_cjs.getConfig(networkType).accountFactoryAddress,
17212
17391
  chunk5GZ7N47F_cjs.SimpleAccountFactory__factory.abi
17213
17392
  ).read.getAccountAddress(ownerAddress);
17214
17393
  if (!res)
@@ -17234,17 +17413,18 @@ var useGetAccountAddress = (ownerAddress) => {
17234
17413
  };
17235
17414
 
17236
17415
  // src/hooks/thor/smartAccounts/useGetAccountVersion.ts
17237
- var abi = chunk5GZ7N47F_cjs.SimpleAccountFactory__factory.abi;
17238
- var getAccountVersionQueryKey = (accountAddress, ownerAddress, networkType) => getCallClauseQueryKey({
17239
- address: chunkPTWGTINW_cjs.getConfig(networkType).accountFactoryAddress,
17416
+ var abi6 = chunk5GZ7N47F_cjs.SimpleAccountFactory__factory.abi;
17417
+ var getAccountVersionQueryKey = (accountAddress, ownerAddress, networkType) => getCallClauseQueryKeyWithArgs({
17418
+ abi: abi6,
17419
+ address: chunkLMX37RCG_cjs.getConfig(networkType).accountFactoryAddress,
17240
17420
  method: "getAccountVersion",
17241
17421
  args: [accountAddress, ownerAddress]
17242
17422
  });
17243
17423
  var useGetAccountVersion = (accountAddress, ownerAddress) => {
17244
17424
  const { network } = useVeChainKitConfig();
17245
17425
  return useCallClause({
17246
- address: chunkPTWGTINW_cjs.getConfig(network.type).accountFactoryAddress,
17247
- abi,
17426
+ address: chunkLMX37RCG_cjs.getConfig(network.type).accountFactoryAddress,
17427
+ abi: abi6,
17248
17428
  method: "getAccountVersion",
17249
17429
  args: [accountAddress, ownerAddress],
17250
17430
  queryOptions: {
@@ -17257,16 +17437,16 @@ var useGetAccountVersion = (accountAddress, ownerAddress) => {
17257
17437
  }
17258
17438
  });
17259
17439
  };
17260
- var abi2 = chunk5GZ7N47F_cjs.SimpleAccountFactory__factory.abi;
17261
- var method = "hasLegacyAccount";
17440
+ var abi7 = chunk5GZ7N47F_cjs.SimpleAccountFactory__factory.abi;
17441
+ var method5 = "hasLegacyAccount";
17262
17442
  var getHasV1SmartAccount = async (thor, ownerAddress, networkType) => {
17263
17443
  if (!ownerAddress) throw new Error("Owner address is required");
17264
17444
  if (!networkType) throw new Error("Network type is required");
17265
- const [hasLegacyAccount] = await chunkPTWGTINW_cjs.executeCallClause({
17445
+ const [hasLegacyAccount] = await chunkLMX37RCG_cjs.executeCallClause({
17266
17446
  thor,
17267
- abi: abi2,
17268
- contractAddress: chunkPTWGTINW_cjs.getConfig(networkType).accountFactoryAddress,
17269
- method,
17447
+ abi: abi7,
17448
+ contractAddress: chunkLMX37RCG_cjs.getConfig(networkType).accountFactoryAddress,
17449
+ method: method5,
17270
17450
  args: [ownerAddress]
17271
17451
  });
17272
17452
  return hasLegacyAccount;
@@ -17449,7 +17629,7 @@ var getSmartAccount = async (thor, network, ownerAddress) => {
17449
17629
  return { address: void 0 };
17450
17630
  }
17451
17631
  const res = await thor.contracts.load(
17452
- chunkPTWGTINW_cjs.getConfig(network).accountFactoryAddress,
17632
+ chunkLMX37RCG_cjs.getConfig(network).accountFactoryAddress,
17453
17633
  chunk5GZ7N47F_cjs.SimpleAccountFactory__factory.abi
17454
17634
  ).read.getAccountAddress(ownerAddress);
17455
17635
  if (!res) {
@@ -17477,15 +17657,15 @@ var useSmartAccount = (ownerAddress) => {
17477
17657
  enabled: !!ownerAddress && !!network.type && !!thor
17478
17658
  });
17479
17659
  };
17480
- var abi3 = chunk5GZ7N47F_cjs.SimpleAccountFactory__factory.abi;
17481
- var method2 = "version";
17660
+ var abi8 = chunk5GZ7N47F_cjs.SimpleAccountFactory__factory.abi;
17661
+ var method6 = "version";
17482
17662
  var getVersion = async (thor, contractAddress) => {
17483
17663
  if (!contractAddress) throw new Error("Contract address is required");
17484
- const [version] = await chunkPTWGTINW_cjs.executeCallClause({
17664
+ const [version] = await chunkLMX37RCG_cjs.executeCallClause({
17485
17665
  thor,
17486
17666
  contractAddress,
17487
- abi: abi3,
17488
- method: method2,
17667
+ abi: abi8,
17668
+ method: method6,
17489
17669
  args: []
17490
17670
  });
17491
17671
  return Number(version);
@@ -17506,12 +17686,12 @@ var useSmartAccountVersion = (contractAddress) => {
17506
17686
  };
17507
17687
  var getUpgradeRequired = async (thor, accountAddress, ownerAddress, targetVersion, networkType) => {
17508
17688
  const res = await thor.contracts.load(
17509
- chunkPTWGTINW_cjs.getConfig(networkType).accountFactoryAddress,
17689
+ chunkLMX37RCG_cjs.getConfig(networkType).accountFactoryAddress,
17510
17690
  chunk5GZ7N47F_cjs.SimpleAccountFactory__factory.abi
17511
17691
  ).read.upgradeRequired(accountAddress, ownerAddress, targetVersion);
17512
17692
  if (!res)
17513
17693
  throw new Error(
17514
- `Failed to get upgrade required of contract address ${chunkPTWGTINW_cjs.getConfig(networkType).accountFactoryAddress}`
17694
+ `Failed to get upgrade required of contract address ${chunkLMX37RCG_cjs.getConfig(networkType).accountFactoryAddress}`
17515
17695
  );
17516
17696
  return res[0];
17517
17697
  };
@@ -17547,7 +17727,7 @@ var useUpgradeRequired = (accountAddress, ownerAddress, targetVersion) => {
17547
17727
  };
17548
17728
  var getUpgradeRequiredForAccount = async (thor, contractAddress, targetVersion, networkType) => {
17549
17729
  const res = await thor.contracts.load(
17550
- chunkPTWGTINW_cjs.getConfig(networkType).accountFactoryAddress,
17730
+ chunkLMX37RCG_cjs.getConfig(networkType).accountFactoryAddress,
17551
17731
  chunk5GZ7N47F_cjs.SimpleAccountFactory__factory.abi
17552
17732
  ).read.upgradeRequiredForAccount(contractAddress, targetVersion);
17553
17733
  if (!res)
@@ -17594,7 +17774,7 @@ var useUpgradeSmartAccount = ({
17594
17774
  const { refresh: refreshSmartAccountQueries } = useRefreshSmartAccountQueries();
17595
17775
  const { data: newImplementationAddress } = useAccountImplementationAddress(targetVersion);
17596
17776
  const buildClauses = React10.useCallback(async () => {
17597
- if (!smartAccountAddress || !chunkPTWGTINW_cjs.isValidAddress(smartAccountAddress)) {
17777
+ if (!smartAccountAddress || !chunkLMX37RCG_cjs.isValidAddress(smartAccountAddress)) {
17598
17778
  throw new Error("Invalid smart account address");
17599
17779
  }
17600
17780
  if (!newImplementationAddress) {
@@ -17625,7 +17805,7 @@ var useUpgradeSmartAccount = ({
17625
17805
  const result = useSendTransaction({
17626
17806
  privyUIOptions: {
17627
17807
  title: "Upgrade Smart Account",
17628
- description: `Upgrading your account at ${chunkPTWGTINW_cjs.humanAddress(
17808
+ description: `Upgrading your account at ${chunkLMX37RCG_cjs.humanAddress(
17629
17809
  smartAccountAddress
17630
17810
  )} to version ${targetVersion}`,
17631
17811
  buttonText: "Sign to continue"
@@ -17643,7 +17823,7 @@ var useUpgradeSmartAccount = ({
17643
17823
  };
17644
17824
  };
17645
17825
  var currentBlockQueryKey = () => ["VECHAIN_KIT", "CURRENT_BLOCK"];
17646
- var REFETCH_INTERVAL = 10 * chunkPTWGTINW_cjs.TIME.SECOND;
17826
+ var REFETCH_INTERVAL = 10 * chunkLMX37RCG_cjs.TIME.SECOND;
17647
17827
  var useCurrentBlock = () => {
17648
17828
  const thor = dappKitReact.useThor();
17649
17829
  return reactQuery.useQuery({
@@ -17673,1156 +17853,76 @@ var useGetChainId = () => {
17673
17853
  refetchInterval: 1e4
17674
17854
  });
17675
17855
  };
17676
- var getB3trBalance = async (thor, network, address) => {
17677
- const res = await thor.contracts.load(chunkPTWGTINW_cjs.getConfig(network).b3trContractAddress, chunk5GZ7N47F_cjs.B3TR__factory.abi).read.balanceOf(address);
17678
- if (!res) throw new Error("Failed to get b3tr balance");
17679
- const original = res[0].toString();
17680
- const scaled = ethers.formatEther(original);
17681
- const formatted = scaled === "0" ? "0" : chunkPTWGTINW_cjs.humanNumber(scaled);
17682
- return {
17683
- original,
17684
- scaled,
17685
- formatted
17686
- };
17687
- };
17688
- var getB3trBalanceQueryKey = (address) => [
17689
- "VEBETTERDAO_BALANCE",
17690
- address,
17691
- "B3TR"
17692
- ];
17693
- var useGetB3trBalance = (address) => {
17694
- const thor = dappKitReact.useThor();
17695
- const { network } = useVeChainKitConfig();
17696
- return reactQuery.useQuery({
17697
- queryKey: getB3trBalanceQueryKey(address),
17698
- queryFn: async () => getB3trBalance(thor, network.type, address),
17699
- enabled: !!thor && !!address && !!network.type
17700
- });
17701
- };
17702
- var getCustomTokenBalance = async (thor, token, address) => {
17703
- const res = await thor.contracts.load(token.address, chunk5GZ7N47F_cjs.ERC20__factory.abi).read.balanceOf([address]);
17704
- if (!res) throw new Error(`Failed to get balance of ${token.address}`);
17705
- const original = res[0];
17706
- const scaled = viem.formatEther(BigInt(original));
17707
- const formatted = scaled === "0" ? "0" : chunkPTWGTINW_cjs.humanNumber(scaled);
17708
- return {
17709
- ...token,
17710
- original: original.toString(),
17711
- scaled,
17712
- formatted
17713
- };
17714
- };
17715
- var getCustomTokenBalanceQueryKey = (tokenAddress, address) => ["VECHAIN_KIT_BALANCE", address, "CUSTOM_TOKEN", tokenAddress];
17716
- var useGetCustomTokenBalances = (address) => {
17717
- const thor = dappKitReact.useThor();
17718
- const { customTokens } = useCustomTokens();
17719
- return reactQuery.useQueries({
17720
- queries: customTokens.map((token) => ({
17721
- queryKey: getCustomTokenBalanceQueryKey(token.address, address),
17722
- queryFn: async () => {
17723
- return await getCustomTokenBalance(thor, token, address);
17724
- }
17725
- }))
17856
+
17857
+ // src/hooks/thor/logs/logUtils.ts
17858
+ var MAX_EVENTS_PER_QUERY = 1e3;
17859
+ var getEventLogs = async ({
17860
+ thor,
17861
+ order = "asc",
17862
+ offset = 0,
17863
+ limit = MAX_EVENTS_PER_QUERY,
17864
+ from = 0,
17865
+ to = thor.blocks.getHeadBlock()?.number,
17866
+ filterCriteria
17867
+ }) => {
17868
+ const response = await thor.logs.filterEventLogs({
17869
+ range: {
17870
+ from,
17871
+ to,
17872
+ unit: "block"
17873
+ },
17874
+ options: {
17875
+ offset,
17876
+ limit
17877
+ },
17878
+ order,
17879
+ criteriaSet: filterCriteria
17726
17880
  });
17881
+ if (!response) throw new Error("Failed to fetch events");
17882
+ return response;
17727
17883
  };
17728
- var getTokenInfo = async (thor, tokenAddress) => {
17729
- if (!tokenAddress) throw new Error("Token address is required");
17730
- const contract = thor.contracts.load(tokenAddress, chunk5GZ7N47F_cjs.ERC20__factory.abi);
17731
- const response = await thor.contracts.executeMultipleClausesCall([
17732
- contract.clause.name(),
17733
- contract.clause.symbol(),
17734
- contract.clause.decimals()
17735
- ]);
17736
- if (response.every((r) => r.success) === false) {
17737
- throw new Error(`Failed to get token info of ${tokenAddress}`);
17884
+ var getAllEventLogs = async ({
17885
+ nodeUrl,
17886
+ thor,
17887
+ order = "asc",
17888
+ from = 0,
17889
+ to,
17890
+ filterCriteria
17891
+ }) => {
17892
+ const allEvents = [];
17893
+ let offset = 0;
17894
+ while (true) {
17895
+ const events = await getEventLogs({
17896
+ thor,
17897
+ filterCriteria,
17898
+ from,
17899
+ to: to ?? Number.MAX_SAFE_INTEGER,
17900
+ limit: MAX_EVENTS_PER_QUERY,
17901
+ order,
17902
+ offset
17903
+ });
17904
+ allEvents.push(...events);
17905
+ if (events.length < MAX_EVENTS_PER_QUERY) {
17906
+ return allEvents;
17907
+ }
17908
+ offset += MAX_EVENTS_PER_QUERY;
17738
17909
  }
17739
- const [name, symbol, decimals] = response.map((res) => {
17740
- return res.result.array?.[0];
17741
- });
17742
- return {
17743
- name,
17744
- address: tokenAddress,
17745
- decimals,
17746
- symbol
17747
- };
17748
- };
17749
- var getCustomTokenInfo = (tokenAddress) => [
17750
- "VECHAIN_KIT_CUSTOM_TOKEN_BALANCE",
17751
- tokenAddress
17752
- ];
17753
- var useGetCustomTokenInfo = (tokenAddress) => {
17754
- const thor = dappKitReact.useThor();
17755
- const { network } = useVeChainKitConfig();
17756
- return reactQuery.useQuery({
17757
- queryKey: getCustomTokenInfo(tokenAddress),
17758
- queryFn: async () => getTokenInfo(thor, tokenAddress),
17759
- enabled: !!thor && !!network.type && !!tokenAddress
17760
- });
17761
17910
  };
17762
- var getErc20Balance = async (thor, tokenAddress, address) => {
17763
- if (!tokenAddress || !address) {
17764
- throw new Error("Token address and user address are required");
17765
- }
17766
- const res = await thor.contracts.load(tokenAddress, chunk5GZ7N47F_cjs.IERC20__factory.abi).read.balanceOf(address);
17767
- if (!res) throw new Error(`Failed to get balance of ${tokenAddress}`);
17768
- const original = res[0].toString();
17769
- const scaled = ethers.formatEther(original);
17770
- const formatted = scaled === "0" ? "0" : chunkPTWGTINW_cjs.humanNumber(scaled);
17771
- return {
17772
- original,
17773
- scaled,
17774
- formatted
17775
- };
17911
+
17912
+ // src/hooks/thor/transactions/transactionUtils.ts
17913
+ var estimateTxGas = async (thor, clauses, caller) => {
17914
+ const response = await thor.transactions.estimateGas(clauses, caller);
17915
+ if (response.reverted) throw new Error("Failed to estimate gas");
17916
+ return response.totalGas;
17776
17917
  };
17777
- var getErc20BalanceQueryKey = (tokenAddress, address) => ["VECHAIN_KIT", "BALANCE", "ERC20", tokenAddress, address];
17778
- var useGetErc20Balance = (tokenAddress, address) => {
17779
- const thor = dappKitReact.useThor();
17780
- return reactQuery.useQuery({
17781
- queryKey: getErc20BalanceQueryKey(tokenAddress, address),
17782
- queryFn: async () => getErc20Balance(thor, tokenAddress, address),
17783
- enabled: !!thor && !!address && !!tokenAddress
17784
- });
17785
- };
17786
- var getVeDelegateBalance = async (thor, network, address) => {
17787
- const res = await thor.contracts.load(
17788
- chunkPTWGTINW_cjs.getConfig(network).veDelegateTokenContractAddress,
17789
- chunk5GZ7N47F_cjs.IERC20__factory.abi
17790
- ).read.balanceOf(address);
17791
- if (!res)
17792
- throw new Error(`Failed to get veDelegate balance for ${address}`);
17793
- const original = res[0].toString();
17794
- const scaled = ethers.formatEther(original);
17795
- const formatted = scaled === "0" ? "0" : chunkPTWGTINW_cjs.humanNumber(scaled);
17796
- return {
17797
- original,
17798
- scaled,
17799
- formatted
17800
- };
17801
- };
17802
- var getVeDelegateBalanceQueryKey = (address) => [
17803
- "VECHAIN_KIT_BALANCE",
17804
- address,
17805
- "VE_DELEGATE"
17806
- ];
17807
- var useGetVeDelegateBalance = (address) => {
17808
- const thor = dappKitReact.useThor();
17809
- const { network } = useVeChainKitConfig();
17810
- return reactQuery.useQuery({
17811
- queryKey: getVeDelegateBalanceQueryKey(address),
17812
- queryFn: async () => getVeDelegateBalance(thor, network.type, address),
17813
- enabled: !!thor && !!address && !!network.type
17814
- });
17815
- };
17816
- var getTokensInfoByOwnerQueryKey = (owner) => [
17817
- "VECHAIN_KIT_GALAXY_MEMBER_TOKENS_INFO",
17818
- owner
17819
- ];
17820
- var useGalaxyMemberTokensInfo = (owner, size = 10) => {
17821
- const { network } = useVeChainKitConfig();
17822
- const contractAddress = chunkPTWGTINW_cjs.getConfig(network.type).galaxyMemberContractAddress;
17823
- const thor = dappKitReact.useThor();
17824
- const fetchTokens = async ({ pageParam = 0 }) => {
17825
- const data = await thor.contracts.load(contractAddress, chunk5GZ7N47F_cjs.GalaxyMember__factory.abi).read.getTokensInfoByOwner(owner, pageParam, size);
17826
- if (!data)
17827
- throw new Error(
17828
- `Failed to fetch tokens info for page ${pageParam}`
17829
- );
17830
- return { data, nextPage: pageParam + 1 };
17831
- };
17832
- return reactQuery.useInfiniteQuery({
17833
- queryKey: getTokensInfoByOwnerQueryKey(owner),
17834
- queryFn: fetchTokens,
17835
- getNextPageParam: (lastPage) => lastPage.data.length === size ? lastPage.nextPage : void 0,
17836
- enabled: !!owner && !!network.type,
17837
- initialPageParam: 0
17838
- });
17839
- };
17840
-
17841
- // src/hooks/thor/contracts/NodeManagement/useGetUserNodes.ts
17842
- var contractAbi = chunk5GZ7N47F_cjs.NodeManagement__factory.abi;
17843
- var method3 = "getUserNodes";
17844
- var getUserNodesQueryKey = (networkType, user) => getCallClauseQueryKey({
17845
- address: chunkPTWGTINW_cjs.getConfig(networkType).nodeManagementContractAddress,
17846
- method: method3,
17847
- args: [user]
17848
- });
17849
- var useGetUserNodes = (userInput) => {
17850
- const { network } = useVeChainKitConfig();
17851
- const contractAddress = chunkPTWGTINW_cjs.getConfig(
17852
- network.type
17853
- ).nodeManagementContractAddress;
17854
- return useCallClause({
17855
- address: contractAddress,
17856
- abi: contractAbi,
17857
- method: method3,
17858
- args: [userInput],
17859
- queryOptions: {
17860
- enabled: !!userInput && !!network.type && !!contractAddress,
17861
- select: (response) => {
17862
- return response[0].map((node) => ({
17863
- nodeId: node.nodeId.toString(),
17864
- nodeLevel: Number(node.nodeLevel),
17865
- xNodeOwner: node.xNodeOwner,
17866
- isXNodeHolder: node.isXNodeHolder,
17867
- isXNodeDelegated: node.isXNodeDelegated,
17868
- isXNodeDelegator: node.isXNodeDelegator,
17869
- isXNodeDelegatee: node.isXNodeDelegatee,
17870
- delegatee: node.delegatee
17871
- }));
17872
- }
17873
- }
17874
- });
17875
- };
17876
- var useGetUserNode = useGetUserNodes;
17877
- var PRICE_FEED_IDS = {
17878
- B3TR: "0x623374722d757364000000000000000000000000000000000000000000000000",
17879
- VET: "0x7665742d75736400000000000000000000000000000000000000000000000000",
17880
- VTHO: "0x7674686f2d757364000000000000000000000000000000000000000000000000",
17881
- GBP: "0x6762702d75736400000000000000000000000000000000000000000000000000",
17882
- EUR: "0x657572742d757364000000000000000000000000000000000000000000000000"
17883
- };
17884
- var getTokenUsdPrice = async (thor, token, network) => {
17885
- const res = await thor.contracts.load(
17886
- chunkPTWGTINW_cjs.getConfig(network).oracleContractAddress,
17887
- chunk5GZ7N47F_cjs.IVechainEnergyOracleV1__factory.abi
17888
- ).read.getLatestValue(PRICE_FEED_IDS[token]);
17889
- if (!res) throw new Error(`Failed to get price of ${token}`);
17890
- return new BigNumber.BigNumber(res[0].toString()).div(1e12).toNumber();
17891
- };
17892
- var getTokenUsdPriceQueryKey = (token) => [
17893
- "VECHAIN_KIT_PRICE",
17894
- token
17895
- ];
17896
- var useGetTokenUsdPrice = (token) => {
17897
- const thor = dappKitReact.useThor();
17898
- const { network } = useVeChainKitConfig();
17899
- return reactQuery.useQuery({
17900
- queryKey: getTokenUsdPriceQueryKey(token),
17901
- queryFn: async () => getTokenUsdPrice(thor, token, network.type),
17902
- enabled: !!thor && !!network.type
17903
- });
17904
- };
17905
- var getVot3Balance = async (thor, network, address) => {
17906
- const res = await thor.contracts.load(chunkPTWGTINW_cjs.getConfig(network).vot3ContractAddress, chunk5GZ7N47F_cjs.IVOT3__factory.abi).read.balanceOf(address);
17907
- if (!res) throw new Error("Reverted");
17908
- const original = res[0].toString();
17909
- const scaled = ethers.formatEther(original);
17910
- const formatted = scaled === "0" ? "0" : chunkPTWGTINW_cjs.humanNumber(scaled);
17911
- return {
17912
- original,
17913
- scaled,
17914
- formatted
17915
- };
17916
- };
17917
- var getVot3BalanceQueryKey = (address) => [
17918
- "VEBETTERDAO_BALANCE",
17919
- address,
17920
- "VOT3"
17921
- ];
17922
- var useGetVot3Balance = (address) => {
17923
- const thor = dappKitReact.useThor();
17924
- const { network } = useVeChainKitConfig();
17925
- return reactQuery.useQuery({
17926
- queryKey: getVot3BalanceQueryKey(address),
17927
- queryFn: async () => getVot3Balance(thor, network.type, address),
17928
- enabled: !!thor && !!address && !!network.type
17929
- });
17930
- };
17931
- var contractAbi2 = chunk5GZ7N47F_cjs.VeBetterPassport__factory.abi;
17932
- var method4 = "isPerson";
17933
- var getIsPersonQueryKey = (networkType, user) => {
17934
- const veBetterPassportContractAddress = chunkPTWGTINW_cjs.getConfig(networkType).veBetterPassportContractAddress;
17935
- return getCallClauseQueryKey({
17936
- address: veBetterPassportContractAddress,
17937
- method: method4,
17938
- args: [user]
17939
- });
17940
- };
17941
- var useIsPerson = (user, customEnabled = true) => {
17942
- const { network } = useVeChainKitConfig();
17943
- const veBetterPassportContractAddress = chunkPTWGTINW_cjs.getConfig(
17944
- network.type
17945
- ).veBetterPassportContractAddress;
17946
- return useCallClause({
17947
- abi: contractAbi2,
17948
- address: veBetterPassportContractAddress,
17949
- method: method4,
17950
- args: [user ?? sdkCore.ZERO_ADDRESS],
17951
- queryOptions: {
17952
- enabled: !!user && customEnabled && !!veBetterPassportContractAddress && !!network.type,
17953
- select: (data) => data[0]
17954
- }
17955
- });
17956
- };
17957
- var useIsUserPerson = (address) => {
17958
- return useIsPerson(address);
17959
- };
17960
- var contractAbi3 = chunk5GZ7N47F_cjs.VeBetterPassport__factory.abi;
17961
- var method5 = "isPersonAtTimepoint";
17962
- var getIsPersonAtTimepointQueryKey = (networkType, user, timepoint) => {
17963
- const veBetterPassportContractAddress = chunkPTWGTINW_cjs.getConfig(networkType).veBetterPassportContractAddress;
17964
- return getCallClauseQueryKey({
17965
- address: veBetterPassportContractAddress,
17966
- method: method5,
17967
- args: [user, Number(timepoint)]
17968
- });
17969
- };
17970
- var useIsPersonAtTimepoint = (user, timepoint, customEnabled = true) => {
17971
- const { network } = useVeChainKitConfig();
17972
- const veBetterPassportContractAddress = chunkPTWGTINW_cjs.getConfig(
17973
- network.type
17974
- ).veBetterPassportContractAddress;
17975
- return useCallClause({
17976
- abi: contractAbi3,
17977
- address: veBetterPassportContractAddress,
17978
- method: method5,
17979
- args: [
17980
- user ?? sdkCore.ZERO_ADDRESS,
17981
- timepoint ? Number(timepoint) : 0
17982
- ],
17983
- queryOptions: {
17984
- enabled: !!user && timepoint !== void 0 && customEnabled && !!veBetterPassportContractAddress && !!network.type,
17985
- select: (data) => data[0]
17986
- }
17987
- });
17988
- };
17989
-
17990
- // src/hooks/thor/contracts/VeBetterPassport/useUserBotSignals.ts
17991
- var contractAbi4 = chunk5GZ7N47F_cjs.VeBetterPassport__factory.abi;
17992
- var method6 = "signaledCounter";
17993
- var getUserBotSignalsQueryKey = (networkType, userAddress) => {
17994
- return getCallClauseQueryKey({
17995
- address: chunkPTWGTINW_cjs.getConfig(networkType).veBetterPassportContractAddress,
17996
- method: method6,
17997
- args: [userAddress]
17998
- });
17999
- };
18000
- var useUserBotSignals = (userAddressInput) => {
18001
- const { network } = useVeChainKitConfig();
18002
- const veBetterPassportContractAddress = chunkPTWGTINW_cjs.getConfig(
18003
- network.type
18004
- ).veBetterPassportContractAddress;
18005
- return useCallClause({
18006
- address: veBetterPassportContractAddress,
18007
- abi: contractAbi4,
18008
- method: method6,
18009
- args: [userAddressInput],
18010
- queryOptions: {
18011
- enabled: !!userAddressInput && !!veBetterPassportContractAddress && !!network.type,
18012
- select: (res) => Number(res[0])
18013
- }
18014
- });
18015
- };
18016
- var useVotingRewards = (currentRoundId, voter) => {
18017
- const thor = dappKitReact.useThor();
18018
- const queryClient = reactQuery.useQueryClient();
18019
- const { network } = useVeChainKitConfig();
18020
- const contractAddress = chunkPTWGTINW_cjs.getConfig(network.type).voterRewardsContractAddress;
18021
- const rounds = React10.useMemo(() => {
18022
- return Array.from(
18023
- { length: parseInt(currentRoundId ?? "0") - 1 },
18024
- (_, i) => (i + 1).toString()
18025
- );
18026
- }, [currentRoundId]);
18027
- return reactQuery.useQuery({
18028
- queryKey: getRoundRewardQueryKey("ALL", voter),
18029
- enabled: !!thor && !!voter && !!currentRoundId && !!rounds.length && !!network.type,
18030
- queryFn: async () => {
18031
- const contract = thor.contracts.load(
18032
- contractAddress,
18033
- chunk5GZ7N47F_cjs.VoterRewards__factory.abi
18034
- );
18035
- const clauses = rounds.map(
18036
- (roundId) => (
18037
- // Voter Rewards getReward result type: [ 0n ]
18038
- contract.clause.getReward(roundId, voter)
18039
- )
18040
- );
18041
- const res = await thor.transactions.executeMultipleClausesCall(
18042
- clauses
18043
- );
18044
- if (!res.every((r) => r.success))
18045
- throw new Error("Failed to fetch voting rewards");
18046
- let total = new BigNumber.BigNumber(0);
18047
- const roundsRewards = res.map((r, index) => {
18048
- const roundId = rounds[index];
18049
- const rewards = r.result.plain;
18050
- const formattedRewards = viem.formatEther(rewards);
18051
- total = total.plus(BigNumber.BigNumber(rewards.toString()));
18052
- queryClient.setQueryData(
18053
- getRoundRewardQueryKey(roundId, voter),
18054
- {
18055
- roundId,
18056
- rewards: formattedRewards
18057
- }
18058
- );
18059
- return {
18060
- roundId,
18061
- rewards,
18062
- formattedRewards
18063
- };
18064
- });
18065
- const totalFormatted = viem.formatEther(BigInt(total.toFixed()));
18066
- return {
18067
- total: total.toFixed(),
18068
- totalFormatted,
18069
- roundsRewards
18070
- };
18071
- }
18072
- });
18073
- };
18074
- var getRoundRewardQueryKey = (roundId, address) => [
18075
- "VECHAIN_KIT",
18076
- "roundReward",
18077
- roundId,
18078
- "voter",
18079
- address
18080
- ];
18081
- var useRoundReward = (address, roundId) => {
18082
- const { network } = useVeChainKitConfig();
18083
- return useCallClause({
18084
- address: chunkPTWGTINW_cjs.getConfig(network.type).voterRewardsContractAddress,
18085
- abi: chunk5GZ7N47F_cjs.VoterRewards__factory.abi,
18086
- method: "getReward",
18087
- args: [BigInt(roundId || 0), address],
18088
- queryOptions: {
18089
- enabled: !!address && !!roundId && !!network.type,
18090
- select: (data) => ({
18091
- roundId,
18092
- rewards: viem.formatEther(data[0])
18093
- })
18094
- }
18095
- });
18096
- };
18097
-
18098
- // src/hooks/thor/contracts/X2EarnApps/utils/getXAppMetadata.ts
18099
- var getXAppMetadata = async (uri, networkType) => {
18100
- const url = chunkPTWGTINW_cjs.convertUriToUrl(uri, networkType);
18101
- if (!url) return void 0;
18102
- const response = await fetch(url);
18103
- if (!response.ok) {
18104
- return void 0;
18105
- }
18106
- return response.json();
18107
- };
18108
-
18109
- // src/hooks/thor/contracts/X2EarnApps/utils/getXApps.ts
18110
- var getXApps = async (thor, networkType) => {
18111
- const contract = thor.contracts.load(
18112
- chunkPTWGTINW_cjs.getConfig(networkType).x2EarnAppsContractAddress,
18113
- chunk5GZ7N47F_cjs.X2EarnApps__factory.abi
18114
- );
18115
- const clauses = [contract.clause.unendorsedApps(), contract.clause.apps()];
18116
- const res = await thor.transactions.executeMultipleClausesCall(clauses);
18117
- if (!res.every((r) => r.success)) throw new Error(`Failed to fetch xApps`);
18118
- const apps = res[0]?.result.plain;
18119
- const unendorsedApps = res[1]?.result.plain;
18120
- const allApps = {};
18121
- for (const app of apps) {
18122
- allApps[app.id] = {
18123
- id: app.id,
18124
- teamWalletAddress: app.teamWalletAddress,
18125
- name: app.name,
18126
- metadataURI: app.metadataURI,
18127
- createdAtTimestamp: app.createdAtTimestamp.toString()
18128
- };
18129
- }
18130
- for (const app of unendorsedApps) {
18131
- allApps[app.id] = {
18132
- id: app.id,
18133
- teamWalletAddress: app.teamWalletAddress,
18134
- name: app.name,
18135
- metadataURI: app.metadataURI,
18136
- createdAtTimestamp: app.createdAtTimestamp.toString(),
18137
- appAvailableForAllocationVoting: app.appAvailableForAllocationVoting
18138
- };
18139
- }
18140
- const unendorsedIds = new Set(unendorsedApps.map((app) => app.id));
18141
- return {
18142
- allApps: Object.values(allApps),
18143
- active: apps.map((app) => ({
18144
- ...app,
18145
- createdAtTimestamp: app.createdAtTimestamp.toString()
18146
- })),
18147
- unendorsed: unendorsedApps.map((app) => ({
18148
- ...app,
18149
- createdAtTimestamp: app.createdAtTimestamp.toString()
18150
- })),
18151
- endorsed: apps.filter((app) => !unendorsedIds.has(app.id)).map((app) => ({
18152
- ...app,
18153
- createdAtTimestamp: app.createdAtTimestamp.toString()
18154
- }))
18155
- };
18156
- };
18157
- var abi4 = chunk5GZ7N47F_cjs.XAllocationVoting__factory.abi;
18158
- var method7 = "getAppsOfRound";
18159
- var getRoundXApps = async (thor, networkType, roundId) => {
18160
- if (!roundId) return [];
18161
- const [xApps] = await chunkPTWGTINW_cjs.executeCallClause({
18162
- thor,
18163
- contractAddress: chunkPTWGTINW_cjs.getConfig(networkType).xAllocationVotingContractAddress,
18164
- abi: abi4,
18165
- method: method7,
18166
- args: [BigInt(roundId)]
18167
- });
18168
- return xApps.map((app) => ({
18169
- id: app.id.toString(),
18170
- teamWalletAddress: app.teamWalletAddress,
18171
- name: app.name,
18172
- metadataURI: app.metadataURI,
18173
- createdAtTimestamp: app.createdAtTimestamp.toString(),
18174
- appAvailableForAllocationVoting: app.appAvailableForAllocationVoting
18175
- }));
18176
- };
18177
- var getRoundXAppsQueryKey = (roundId) => [
18178
- "VECHAIN_KIT",
18179
- "round",
18180
- roundId,
18181
- "getXApps"
18182
- ];
18183
- var useRoundXApps = (roundId) => {
18184
- const thor = dappKitReact.useThor();
18185
- const { network } = useVeChainKitConfig();
18186
- return reactQuery.useQuery({
18187
- queryKey: getRoundXAppsQueryKey(roundId),
18188
- queryFn: async () => await getRoundXApps(thor, network.type, roundId),
18189
- enabled: !!thor && !!roundId && !!network.type
18190
- });
18191
- };
18192
- var getUserVotesInRound = async (thor, network, roundId, address) => {
18193
- const xAllocationVotingContract = chunkPTWGTINW_cjs.getConfig(network).xAllocationVotingContractAddress;
18194
- const eventAbi = thor.contracts.load(xAllocationVotingContract, chunk5GZ7N47F_cjs.XAllocationVoting__factory.abi).getEventAbi("AllocationVoteCast");
18195
- const topics = eventAbi.encodeFilterTopicsNoNull({
18196
- ...address ? { voter: address } : {},
18197
- ...roundId ? { roundId } : {}
18198
- });
18199
- const filterCriteria = [
18200
- {
18201
- criteria: {
18202
- address: xAllocationVotingContract,
18203
- topic0: topics[0] ?? void 0,
18204
- topic1: topics[1] ?? void 0,
18205
- topic2: topics[2] ?? void 0,
18206
- topic3: topics[3] ?? void 0,
18207
- topic4: topics[4] ?? void 0
18208
- },
18209
- eventAbi
18210
- }
18211
- ];
18212
- const events = await getAllEventLogs({
18213
- thor,
18214
- filterCriteria,
18215
- nodeUrl: chunkPTWGTINW_cjs.getConfig(network).nodeUrl
18216
- });
18217
- const decodedAllocatedVoteEvents = [];
18218
- events.forEach((event) => {
18219
- if (!event.decodedData) {
18220
- throw new Error("Event data not decoded");
18221
- }
18222
- if (!chunkPTWGTINW_cjs.compareAddresses(event.address, xAllocationVotingContract)) {
18223
- throw new Error("Event address not valid");
18224
- }
18225
- const [voter, roundId2, appsIds, voteWeights] = event.decodedData;
18226
- decodedAllocatedVoteEvents.push({
18227
- voter,
18228
- roundId: roundId2,
18229
- appsIds,
18230
- voteWeights
18231
- });
18232
- });
18233
- return decodedAllocatedVoteEvents;
18234
- };
18235
- var getUserVotesInRoundQueryKey = (roundId, address) => [
18236
- "VECHAIN_KIT",
18237
- "allocationsRound",
18238
- roundId,
18239
- "userVotes",
18240
- ...address ? [address] : []
18241
- ];
18242
- var useUserVotesInRound = (roundId, address) => {
18243
- const thor = dappKitReact.useThor();
18244
- const { network } = useVeChainKitConfig();
18245
- return reactQuery.useQuery({
18246
- queryKey: getUserVotesInRoundQueryKey(roundId, address),
18247
- queryFn: async () => {
18248
- const votes = await getUserVotesInRound(
18249
- thor,
18250
- network.type,
18251
- roundId,
18252
- address
18253
- );
18254
- if (votes.length > 1) throw new Error("More than one event found");
18255
- if (votes.length === 0) throw new Error("No event found");
18256
- return votes[0];
18257
- },
18258
- enabled: !!thor && !!thor.blocks.getHeadBlock() && !!roundId && !!address && !!network.type
18259
- });
18260
- };
18261
- var getVotesInRoundQueryKey = (roundId) => [
18262
- "VECHAIN_KIT",
18263
- "allocationsRound",
18264
- roundId,
18265
- "totalVotes"
18266
- ];
18267
- var useVotesInRound = (roundId, enabled = true) => {
18268
- const thor = dappKitReact.useThor();
18269
- const { network } = useVeChainKitConfig();
18270
- return reactQuery.useQuery({
18271
- queryKey: getVotesInRoundQueryKey(roundId),
18272
- queryFn: async () => await getUserVotesInRound(thor, network.type, roundId),
18273
- enabled: !!thor && !!thor.blocks.getHeadBlock() && !!roundId && enabled && !!network.type
18274
- });
18275
- };
18276
- var getXAppsQueryKey = () => ["VECHAIN_KIT", "getXApps"];
18277
- var useXApps = () => {
18278
- const thor = dappKitReact.useThor();
18279
- const { network } = useVeChainKitConfig();
18280
- return reactQuery.useQuery({
18281
- queryKey: getXAppsQueryKey(),
18282
- queryFn: async () => await getXApps(thor, network.type),
18283
- enabled: !!thor && !!network.type
18284
- });
18285
- };
18286
-
18287
- // src/hooks/thor/contracts/X2EarnApps/custom/useXApp.ts
18288
- var useXApp = (appId) => {
18289
- const { data: xApps, ...props } = useXApps();
18290
- const allApps = React10.useMemo(() => [...xApps?.active ?? [], ...xApps?.unendorsed ?? []], [xApps]);
18291
- const app = allApps.find((xa) => xa.id === appId);
18292
- return {
18293
- data: app,
18294
- ...props
18295
- };
18296
- };
18297
- var getXAppMetadataQueryKey = (metadataURI) => [
18298
- "VECHAIN_KIT",
18299
- "xApps",
18300
- metadataURI,
18301
- "metadata"
18302
- ];
18303
- var useXAppMetadata = (xAppId) => {
18304
- const { data: baseUri } = useXAppsMetadataBaseUri();
18305
- const { data: xApp } = useXApp(xAppId ?? "");
18306
- const { network } = useVeChainKitConfig();
18307
- return reactQuery.useQuery({
18308
- queryKey: getXAppMetadataQueryKey(xApp?.metadataURI || ""),
18309
- queryFn: async () => !(!baseUri && xApp) ? await getXAppMetadata(
18310
- `${baseUri}${xApp?.metadataURI}`,
18311
- network.type
18312
- ) : null,
18313
- enabled: !!baseUri && !!xApp && !!network.type
18314
- });
18315
- };
18316
- var getXAppsSharesQueryKey = (roundId) => [
18317
- "VECHAIN_KIT",
18318
- "XApps",
18319
- "Shares",
18320
- roundId
18321
- ];
18322
- var useXAppsShares = (apps, roundId) => {
18323
- const thor = dappKitReact.useThor();
18324
- const { network } = useVeChainKitConfig();
18325
- return reactQuery.useQuery({
18326
- queryKey: getXAppsSharesQueryKey(roundId),
18327
- queryFn: async () => {
18328
- const contract = thor.contracts.load(
18329
- chunkPTWGTINW_cjs.getConfig(network.type).xAllocationPoolContractAddress,
18330
- chunk5GZ7N47F_cjs.XAllocationPool__factory.abi
18331
- );
18332
- const clauses = apps.map(
18333
- (app) => contract.clause.getAppShares(roundId, app)
18334
- );
18335
- const res = await thor.transactions.executeMultipleClausesCall(
18336
- clauses
18337
- );
18338
- if (!res.every((r) => r.success))
18339
- throw new Error(
18340
- `Failed to fetch xApps shares for ${apps} in round ${roundId}`
18341
- );
18342
- const shares = res.map((r, index) => {
18343
- return {
18344
- app: apps[index],
18345
- share: Number(r.result.array?.[0] || 0) / 100,
18346
- unallocatedShare: Number(r.result.array?.[1] || 0) / 100
18347
- };
18348
- });
18349
- return shares;
18350
- },
18351
- enabled: !!roundId && !!apps.length
18352
- });
18353
- };
18354
-
18355
- // src/hooks/thor/contracts/X2EarnApps/custom/useMostVotedAppsInRound.ts
18356
- var useMostVotedAppsInRound = (roundId) => {
18357
- const { data: roundXApps } = useRoundXApps(roundId);
18358
- const { data: allXApps } = useXApps();
18359
- const apps = roundId === "0" ? allXApps?.active : roundXApps;
18360
- const xAppsShares = useXAppsShares(
18361
- apps?.map((app) => app.id) ?? [],
18362
- roundId
18363
- );
18364
- const mostVotedApps = React10.useMemo(
18365
- () => xAppsShares.data?.map((appShares) => ({
18366
- percentage: appShares.share + appShares.unallocatedShare,
18367
- id: apps?.find((xa) => xa.id === appShares.app)?.id ?? "",
18368
- app: apps?.find((xa) => xa.id === appShares.app) ?? {}
18369
- })).sort((a, b) => Number(b.percentage) - Number(a.percentage)) ?? [],
18370
- [xAppsShares.data, apps]
18371
- );
18372
- return {
18373
- data: mostVotedApps,
18374
- isLoading: xAppsShares.isLoading
18375
- };
18376
- };
18377
-
18378
- // src/hooks/thor/contracts/X2EarnApps/useXAppsMetadataBaseUri.ts
18379
- var abi5 = chunk5GZ7N47F_cjs.X2EarnApps__factory.abi;
18380
- var method8 = "baseURI";
18381
- var getXAppsMetadataBaseUriQueryKey = (network) => getCallClauseQueryKey({
18382
- method: method8,
18383
- address: chunkPTWGTINW_cjs.getConfig(network).x2EarnAppsContractAddress,
18384
- args: []
18385
- });
18386
- var useXAppsMetadataBaseUri = () => {
18387
- const { network } = useVeChainKitConfig();
18388
- return useCallClause({
18389
- abi: abi5,
18390
- address: chunkPTWGTINW_cjs.getConfig(network.type).x2EarnAppsContractAddress,
18391
- method: method8,
18392
- args: [],
18393
- queryOptions: {
18394
- enabled: !!network.type,
18395
- staleTime: 1e3 * 60 * 60
18396
- // 1 hour,
18397
- }
18398
- });
18399
- };
18400
- var getXAppRoundEarnings = async (thor, roundId, xAppId, networkType) => {
18401
- const res = await thor.contracts.load(
18402
- chunkPTWGTINW_cjs.getConfig(networkType).xAllocationPoolContractAddress,
18403
- chunk5GZ7N47F_cjs.XAllocationPool__factory.abi
18404
- ).read.roundEarnings(roundId, xAppId);
18405
- if (!res)
18406
- throw new Error(
18407
- `Failed to fetch xApp round earnings for ${xAppId} in round ${roundId}`
18408
- );
18409
- return { amount: viem.formatEther(BigInt(res[0] || 0)), appId: xAppId };
18410
- };
18411
- var getXAppRoundEarningsQueryKey = (roundId, xAppId) => [
18412
- "VECHAIN_KIT",
18413
- "roundEarnings",
18414
- "roundId",
18415
- Number(roundId),
18416
- "appId",
18417
- ...xAppId ? [xAppId] : []
18418
- ];
18419
- var useXAppRoundEarnings = (roundId, xAppId) => {
18420
- const thor = dappKitReact.useThor();
18421
- const queryClient = getOrCreateQueryClient();
18422
- const { network } = useVeChainKitConfig();
18423
- return reactQuery.useQuery({
18424
- queryKey: getXAppRoundEarningsQueryKey(roundId, xAppId),
18425
- queryFn: async () => {
18426
- const data = await queryClient.ensureQueryData({
18427
- queryFn: () => getRoundXApps(thor, network.type, roundId),
18428
- queryKey: getRoundXAppsQueryKey(roundId)
18429
- });
18430
- const isXAppInRound = data.some((app) => app.id === xAppId);
18431
- if (!isXAppInRound) return { amount: "0", xAppId };
18432
- return await getXAppRoundEarnings(
18433
- thor,
18434
- roundId,
18435
- xAppId,
18436
- network.type
18437
- );
18438
- },
18439
- enabled: !!thor && !!roundId && !!xAppId
18440
- });
18441
- };
18442
- var useMultipleXAppRoundEarnings = (roundId, xAppIds) => {
18443
- const thor = dappKitReact.useThor();
18444
- const queryClient = getOrCreateQueryClient();
18445
- const { network } = useVeChainKitConfig();
18446
- return reactQuery.useQuery({
18447
- queryKey: getXAppRoundEarningsQueryKey(roundId, "ALL"),
18448
- queryFn: async () => {
18449
- const data = await queryClient.ensureQueryData({
18450
- queryFn: () => getRoundXApps(thor, network.type, roundId),
18451
- queryKey: getRoundXAppsQueryKey(roundId)
18452
- });
18453
- const xAllocationPoolContract = chunkPTWGTINW_cjs.getConfig(
18454
- network.type
18455
- ).xAllocationPoolContractAddress;
18456
- const xAppsInRound = data.filter((app) => xAppIds.includes(app.id));
18457
- const contract = thor.contracts.load(
18458
- xAllocationPoolContract,
18459
- chunk5GZ7N47F_cjs.XAllocationPool__factory.abi
18460
- );
18461
- const clauses = xAppsInRound.map(
18462
- (app) => contract.clause.roundEarnings(roundId, app.id)
18463
- );
18464
- const res = await thor.transactions.executeMultipleClausesCall(
18465
- clauses
18466
- );
18467
- if (!res.every((r) => r.success))
18468
- throw new Error("Failed to fetch xApp round earnings");
18469
- const decoded = res.map((earnings, index) => {
18470
- const parsedAmount = viem.formatEther(
18471
- earnings.result.plain
18472
- );
18473
- const appId = xAppsInRound[index]?.id;
18474
- queryClient.setQueryData(
18475
- getXAppRoundEarningsQueryKey(roundId, appId),
18476
- {
18477
- amount: parsedAmount,
18478
- appId
18479
- }
18480
- );
18481
- return { amount: parsedAmount, appId };
18482
- });
18483
- return decoded;
18484
- },
18485
- enabled: !!thor && !!roundId && !!xAppIds.length
18486
- });
18487
- };
18488
- var getXAppTotalEarningsQueryKey = (tillRoundId, appId) => [
18489
- "VECHAIN_KIT",
18490
- "XAllocationPool",
18491
- "xApp",
18492
- appId,
18493
- "totalEarningsTillRound",
18494
- tillRoundId
18495
- ];
18496
- var useXAppTotalEarnings = (roundIds, appId) => {
18497
- const thor = dappKitReact.useThor();
18498
- const { network } = useVeChainKitConfig();
18499
- const queryClient = getOrCreateQueryClient();
18500
- const lastRound = roundIds[roundIds.length - 1] ?? 0;
18501
- return reactQuery.useQuery({
18502
- queryKey: getXAppTotalEarningsQueryKey(lastRound, appId),
18503
- queryFn: async () => {
18504
- const contract = thor.contracts.load(
18505
- chunkPTWGTINW_cjs.getConfig(network.type).xAllocationPoolContractAddress,
18506
- chunk5GZ7N47F_cjs.XAllocationPool__factory.abi
18507
- );
18508
- const clauses = roundIds.map(
18509
- (roundId) => contract.clause.roundEarnings(roundId, appId)
18510
- );
18511
- const res = await thor.transactions.executeMultipleClausesCall(
18512
- clauses
18513
- );
18514
- if (!res.every((r) => r.success))
18515
- throw new Error(
18516
- `Failed to fetch xApp total earnings of ${appId}`
18517
- );
18518
- const decoded = res.map((r, index) => {
18519
- const parsedAmount = viem.formatEther(
18520
- r.result.plain || BigInt(0)
18521
- );
18522
- queryClient.setQueryData(
18523
- getXAppRoundEarningsQueryKey(
18524
- roundIds[index],
18525
- appId
18526
- ),
18527
- {
18528
- amount: parsedAmount,
18529
- appId
18530
- }
18531
- );
18532
- return parsedAmount;
18533
- });
18534
- return decoded.reduce((acc, amount) => {
18535
- return acc + Number(amount);
18536
- }, 0);
18537
- }
18538
- });
18539
- };
18540
-
18541
- // src/hooks/thor/contracts/XAllocationVoting/useAllocationsRoundState.ts
18542
- var RoundState = {
18543
- 0: "Active",
18544
- 1: "Failed",
18545
- 2: "Succeeded"
18546
- };
18547
- var abi6 = chunk5GZ7N47F_cjs.XAllocationVoting__factory.abi;
18548
- var method9 = "state";
18549
- var getAllocationsRoundStateQueryKey = (roundId, network) => getCallClauseQueryKey({
18550
- method: method9,
18551
- address: chunkPTWGTINW_cjs.getConfig(network).xAllocationVotingContractAddress,
18552
- args: [BigInt(roundId || 0)]
18553
- });
18554
- var useAllocationsRoundState = (roundId) => {
18555
- const { network } = useVeChainKitConfig();
18556
- return useCallClause({
18557
- abi: abi6,
18558
- address: chunkPTWGTINW_cjs.getConfig(network.type).xAllocationVotingContractAddress,
18559
- method: method9,
18560
- args: [BigInt(roundId || 0)],
18561
- queryOptions: {
18562
- enabled: !!roundId && !!network.type,
18563
- select: (data) => data[0]
18564
- }
18565
- });
18566
- };
18567
-
18568
- // src/hooks/thor/contracts/XAllocationVoting/useCurrentAllocationsRoundId.ts
18569
- var abi7 = chunk5GZ7N47F_cjs.XAllocationVoting__factory.abi;
18570
- var method10 = "currentRoundId";
18571
- var getCurrentAllocationsRoundIdQueryKey = (network) => getCallClauseQueryKey({
18572
- method: method10,
18573
- address: chunkPTWGTINW_cjs.getConfig(network).xAllocationVotingContractAddress,
18574
- args: []
18575
- });
18576
- var useCurrentAllocationsRoundId = () => {
18577
- const { network } = useVeChainKitConfig();
18578
- return useCallClause({
18579
- abi: abi7,
18580
- address: chunkPTWGTINW_cjs.getConfig(network.type).xAllocationVotingContractAddress,
18581
- method: method10,
18582
- args: [],
18583
- queryOptions: {
18584
- enabled: !!network.type,
18585
- select: (data) => data[0].toString()
18586
- }
18587
- });
18588
- };
18589
-
18590
- // src/hooks/thor/contracts/XAllocationVoting/useHasVotedInRound.ts
18591
- var method11 = "hasVoted";
18592
- var abi8 = chunk5GZ7N47F_cjs.XAllocationVoting__factory.abi;
18593
- var getHasVotedInRoundQueryKey = (roundId, address, networkType) => getCallClauseQueryKey({
18594
- address: chunkPTWGTINW_cjs.getConfig(networkType).xAllocationVotingContractAddress,
18595
- method: method11,
18596
- args: [BigInt(roundId || 0), address]
18597
- });
18598
- var useHasVotedInRound = (roundId, address) => {
18599
- const { network } = useVeChainKitConfig();
18600
- return useCallClause({
18601
- abi: abi8,
18602
- address: chunkPTWGTINW_cjs.getConfig(network.type).xAllocationVotingContractAddress,
18603
- method: method11,
18604
- args: [BigInt(roundId || 0), address],
18605
- queryOptions: {
18606
- enabled: !!roundId && !!address,
18607
- select: (data) => data[0]
18608
- }
18609
- });
18610
- };
18611
- var getAllocationsRoundsEvents = async (thor, networkType) => {
18612
- const xAllocationVotingContract = chunkPTWGTINW_cjs.getConfig(networkType).xAllocationVotingContractAddress;
18613
- const eventAbi = thor.contracts.load(xAllocationVotingContract, chunk5GZ7N47F_cjs.XAllocationVoting__factory.abi).getEventAbi("RoundCreated");
18614
- const events = await getAllEventLogs({
18615
- thor,
18616
- filterCriteria: [
18617
- {
18618
- criteria: {
18619
- address: xAllocationVotingContract,
18620
- topic0: eventAbi.signatureHash
18621
- },
18622
- eventAbi
18623
- }
18624
- ],
18625
- nodeUrl: chunkPTWGTINW_cjs.getConfig(networkType).nodeUrl
18626
- });
18627
- const decodedCreatedAllocationEvents = [];
18628
- events.forEach((event) => {
18629
- if (!event.decodedData) {
18630
- throw new Error("Event data not decoded");
18631
- }
18632
- if (!chunkPTWGTINW_cjs.compareAddresses(event.address, xAllocationVotingContract)) {
18633
- throw new Error("Event address not valid");
18634
- }
18635
- const [roundId, proposer, voteStart, voteEnd, appsIds] = event.decodedData;
18636
- decodedCreatedAllocationEvents.push({
18637
- roundId: roundId.toString(),
18638
- proposer,
18639
- voteStart: voteStart.toString(),
18640
- voteEnd: voteEnd.toString(),
18641
- appsIds: appsIds.map((appId) => appId.toString())
18642
- });
18643
- });
18644
- return {
18645
- created: decodedCreatedAllocationEvents
18646
- };
18647
- };
18648
- var getAllocationsRoundsEventsQueryKey = () => [
18649
- "VECHAIN_KIT",
18650
- "allocationRoundsEvents"
18651
- ];
18652
- var useAllocationsRoundsEvents = () => {
18653
- const thor = dappKitReact.useThor();
18654
- const { network } = useVeChainKitConfig();
18655
- return reactQuery.useQuery({
18656
- queryKey: getAllocationsRoundsEventsQueryKey(),
18657
- queryFn: async () => await getAllocationsRoundsEvents(thor, network.type),
18658
- enabled: !!thor && !!network.type
18659
- });
18660
- };
18661
-
18662
- // src/hooks/thor/contracts/XAllocationVoting/custom/useCurrentAllocationsRound.ts
18663
- var useCurrentAllocationsRound = () => {
18664
- const currentRoundId = useCurrentAllocationsRoundId();
18665
- const allocationsRound = useAllocationsRound(currentRoundId.data);
18666
- return {
18667
- ...allocationsRound,
18668
- isLoading: currentRoundId.isLoading || allocationsRound.isLoading,
18669
- isError: currentRoundId.isError || allocationsRound.isError,
18670
- error: currentRoundId.error || allocationsRound.error
18671
- };
18672
- };
18673
- var useAllocationsRound = (roundId) => {
18674
- const { data: currentBlock } = useCurrentBlock();
18675
- const currentAllocationId = useCurrentAllocationsRoundId();
18676
- const currentAllocationState = useAllocationsRoundState(roundId);
18677
- const allocationRoundsEvents = useAllocationsRoundsEvents();
18678
- const { network } = useVeChainKitConfig();
18679
- const currentAllocationRound = React10.useMemo(() => {
18680
- if (!currentAllocationId.data || !allocationRoundsEvents.data)
18681
- return;
18682
- const roundInfo = allocationRoundsEvents.data.created.find(
18683
- (allocationRound) => allocationRound.roundId === roundId
18684
- );
18685
- if (!roundInfo) return;
18686
- return {
18687
- ...roundInfo,
18688
- state: currentAllocationState.data,
18689
- isCurrent: roundId === currentAllocationId.data
18690
- };
18691
- }, [
18692
- currentAllocationId,
18693
- allocationRoundsEvents,
18694
- currentAllocationState,
18695
- roundId
18696
- ]);
18697
- const isLoading = currentAllocationId.isLoading || allocationRoundsEvents.isLoading || currentAllocationState.isLoading;
18698
- const isError = currentAllocationId.isError || allocationRoundsEvents.isError || currentAllocationState.isError;
18699
- const error = currentAllocationId.error || allocationRoundsEvents.error || currentAllocationState.error;
18700
- const blockTime = chunkPTWGTINW_cjs.getConfig(network.type).network.blockTime;
18701
- const estimatedEndTime = React10.useMemo(() => {
18702
- if (!currentAllocationRound) return null;
18703
- const endBlock = Number(currentAllocationRound.voteEnd);
18704
- if (!endBlock || !currentBlock) return null;
18705
- const endBlockFromNow = endBlock - currentBlock.number;
18706
- const durationLeftTimestamp = endBlockFromNow * blockTime;
18707
- return Date.now() + durationLeftTimestamp;
18708
- }, [currentBlock, currentAllocationRound, blockTime]);
18709
- const estimatedStartTime = React10.useMemo(() => {
18710
- if (!currentAllocationRound) return null;
18711
- const startBlock = Number(currentAllocationRound.voteStart);
18712
- if (!startBlock || !currentBlock) return null;
18713
- const endBlockFromNow = startBlock - currentBlock.number;
18714
- const durationLeftTimestamp = endBlockFromNow * blockTime;
18715
- return Date.now() + durationLeftTimestamp;
18716
- }, [currentBlock, currentAllocationRound, blockTime]);
18717
- const isFirstRound = currentAllocationRound?.roundId === "1";
18718
- const isLastRound = currentAllocationRound?.roundId === allocationRoundsEvents?.data?.created.length.toString();
18719
- return {
18720
- ...allocationRoundsEvents,
18721
- data: {
18722
- ...currentAllocationRound,
18723
- voteStartTimestamp: estimatedStartTime,
18724
- voteEndTimestamp: estimatedEndTime,
18725
- isFirstRound,
18726
- isLastRound
18727
- },
18728
- isLoading,
18729
- isError,
18730
- error
18731
- };
18732
- };
18733
- var contractAbi5 = chunk5GZ7N47F_cjs.XAllocationVotingGovernor__factory.abi;
18734
- var method12 = "getAppVotes";
18735
- var getXAppVotesQueryKey = (networkType, roundId, appId) => getCallClauseQueryKey({
18736
- address: chunkPTWGTINW_cjs.getConfig(networkType).xAllocationVotingContractAddress,
18737
- method: method12,
18738
- args: [BigInt(roundId || 0), appId]
18739
- });
18740
- var useXAppVotes = (roundId, appId) => {
18741
- const { network } = useVeChainKitConfig();
18742
- const contractAddress = chunkPTWGTINW_cjs.getConfig(
18743
- network.type
18744
- ).xAllocationVotingContractAddress;
18745
- return useCallClause({
18746
- address: contractAddress,
18747
- abi: contractAbi5,
18748
- method: method12,
18749
- args: [BigInt(roundId || 0), appId],
18750
- queryOptions: {
18751
- enabled: !!roundId && !!appId && !!network.type,
18752
- select: (res) => viem.formatEther(res[0])
18753
- }
18754
- });
18755
- };
18756
-
18757
- // src/hooks/thor/logs/logUtils.ts
18758
- var MAX_EVENTS_PER_QUERY = 1e3;
18759
- var getEventLogs = async ({
18760
- thor,
18761
- order = "asc",
18762
- offset = 0,
18763
- limit = MAX_EVENTS_PER_QUERY,
18764
- from = 0,
18765
- to = thor.blocks.getHeadBlock()?.number,
18766
- filterCriteria
18767
- }) => {
18768
- const response = await thor.logs.filterEventLogs({
18769
- range: {
18770
- from,
18771
- to,
18772
- unit: "block"
18773
- },
18774
- options: {
18775
- offset,
18776
- limit
18777
- },
18778
- order,
18779
- criteriaSet: filterCriteria
18780
- });
18781
- if (!response) throw new Error("Failed to fetch events");
18782
- return response;
18783
- };
18784
- var getAllEventLogs = async ({
18785
- nodeUrl,
18786
- thor,
18787
- order = "asc",
18788
- from = 0,
18789
- to,
18790
- filterCriteria
18791
- }) => {
18792
- const allEvents = [];
18793
- let offset = 0;
18794
- while (true) {
18795
- const events = await getEventLogs({
18796
- thor,
18797
- filterCriteria,
18798
- from,
18799
- to: to ?? Number.MAX_SAFE_INTEGER,
18800
- limit: MAX_EVENTS_PER_QUERY,
18801
- order,
18802
- offset
18803
- });
18804
- allEvents.push(...events);
18805
- if (events.length < MAX_EVENTS_PER_QUERY) {
18806
- return allEvents;
18807
- }
18808
- offset += MAX_EVENTS_PER_QUERY;
18809
- }
18810
- };
18811
-
18812
- // src/hooks/thor/transactions/transactionUtils.ts
18813
- var estimateTxGas = async (thor, clauses, caller) => {
18814
- const response = await thor.transactions.estimateGas(clauses, caller);
18815
- if (response.reverted) throw new Error("Failed to estimate gas");
18816
- return response.totalGas;
18817
- };
18818
- var useSendTransaction = ({
18819
- signerAccountAddress,
18820
- clauses,
18821
- onTxConfirmed,
18822
- onTxFailedOrCancelled,
18823
- suggestedMaxGas,
18824
- privyUIOptions
18825
- }) => {
17918
+ var useSendTransaction = ({
17919
+ signerAccountAddress,
17920
+ clauses,
17921
+ onTxConfirmed,
17922
+ onTxFailedOrCancelled,
17923
+ suggestedMaxGas,
17924
+ privyUIOptions
17925
+ }) => {
18826
17926
  const thor = dappKitReact.useThor();
18827
17927
  const { signer } = dappKitReact.useWallet();
18828
17928
  const { connection } = useWallet();
@@ -19012,7 +18112,7 @@ var useTransferERC20 = ({
19012
18112
  const queryClient = reactQuery.useQueryClient();
19013
18113
  const { refresh } = useRefreshBalances();
19014
18114
  const buildClauses = React10.useCallback(async () => {
19015
- if (!receiverAddress || !amount || !chunkPTWGTINW_cjs.isValidAddress(receiverAddress))
18115
+ if (!receiverAddress || !amount || !chunkLMX37RCG_cjs.isValidAddress(receiverAddress))
19016
18116
  throw new Error("Invalid receiver address or amount");
19017
18117
  const clausesArray = [];
19018
18118
  clausesArray.push({
@@ -19035,7 +18135,7 @@ var useTransferERC20 = ({
19035
18135
  signerAccountAddress: fromAddress,
19036
18136
  privyUIOptions: {
19037
18137
  title: "Confirm Transfer",
19038
- description: `Transfer ${amount} ${tokenName} to ${chunkPTWGTINW_cjs.humanAddress(
18138
+ description: `Transfer ${amount} ${tokenName} to ${chunkLMX37RCG_cjs.humanAddress(
19039
18139
  receiverAddress
19040
18140
  )}`,
19041
18141
  buttonText: "Sign to continue"
@@ -19061,7 +18161,7 @@ var useTransferVET = ({
19061
18161
  }) => {
19062
18162
  const { refresh } = useRefreshBalances();
19063
18163
  const buildClauses = React10.useCallback(async () => {
19064
- if (!receiverAddress || !amount || !chunkPTWGTINW_cjs.isValidAddress(receiverAddress))
18164
+ if (!receiverAddress || !amount || !chunkLMX37RCG_cjs.isValidAddress(receiverAddress))
19065
18165
  throw new Error("Invalid receiver address or amount");
19066
18166
  if (isNaN(Number(amount))) {
19067
18167
  throw new Error("Invalid amount");
@@ -19085,7 +18185,7 @@ var useTransferVET = ({
19085
18185
  signerAccountAddress: fromAddress,
19086
18186
  privyUIOptions: {
19087
18187
  title: "Confirm Transfer",
19088
- description: `Transfer ${amount} VET to ${chunkPTWGTINW_cjs.humanAddress(
18188
+ description: `Transfer ${amount} VET to ${chunkLMX37RCG_cjs.humanAddress(
19089
18189
  receiverAddress
19090
18190
  )}`,
19091
18191
  buttonText: "Sign to continue"
@@ -19142,7 +18242,7 @@ var useBuildTransaction = ({
19142
18242
  );
19143
18243
  return { ...result, sendTransaction };
19144
18244
  };
19145
- var BLOCK_GENERATION_INTERVAL = 10 * chunkPTWGTINW_cjs.TIME.SECOND;
18245
+ var BLOCK_GENERATION_INTERVAL = 10 * chunkLMX37RCG_cjs.TIME.SECOND;
19146
18246
  var txReceiptQueryKey = (txId) => [
19147
18247
  "VECHAIN_KIT",
19148
18248
  "TX_RECEIPT",
@@ -19174,16 +18274,14 @@ var AddressDisplayCard = ({
19174
18274
  }) => {
19175
18275
  const { darkMode: isDark } = useVeChainKitConfig();
19176
18276
  const { t } = reactI18next.useTranslation();
19177
- const { isLoading: totalBalanceLoading } = useTotalBalance({
19178
- address
19179
- });
19180
- const { tokens: tokens2, isLoading: tokensLoading } = useTokensWithValues({
18277
+ const { isLoading: totalBalanceLoading } = useTotalBalance({ address });
18278
+ const { tokens, isLoading: tokensLoading } = useTokensWithValues({
19181
18279
  address
19182
18280
  });
19183
18281
  const tokenData = React10.useMemo(() => {
19184
18282
  if (!tokenAddress) return null;
19185
- return tokens2.find((token) => token.address === tokenAddress);
19186
- }, [tokens2, tokenAddress]);
18283
+ return tokens.find((token) => token.address === tokenAddress);
18284
+ }, [tokens, tokenAddress]);
19187
18285
  const displayBalance = React10.useMemo(() => {
19188
18286
  if (balance !== void 0) return balance;
19189
18287
  if (tokenData) {
@@ -19231,7 +18329,7 @@ var AddressDisplayCard = ({
19231
18329
  fontSize: "xs",
19232
18330
  opacity: 0.5,
19233
18331
  "data-testid": `${label.toLowerCase()}-address`,
19234
- children: chunkPTWGTINW_cjs.humanAddress(address, 6, 4)
18332
+ children: chunkLMX37RCG_cjs.humanAddress(address, 6, 4)
19235
18333
  }
19236
18334
  )
19237
18335
  ] }) : /* @__PURE__ */ jsxRuntime.jsx(
@@ -19240,7 +18338,7 @@ var AddressDisplayCard = ({
19240
18338
  fontWeight: "medium",
19241
18339
  fontSize: "sm",
19242
18340
  "data-testid": `${label.toLowerCase()}-address`,
19243
- children: chunkPTWGTINW_cjs.humanAddress(address, 6, 4)
18341
+ children: chunkLMX37RCG_cjs.humanAddress(address, 6, 4)
19244
18342
  }
19245
18343
  ) })
19246
18344
  ] }),
@@ -19382,7 +18480,7 @@ var TransactionButtonAndStatus = ({
19382
18480
  color: isDark ? "whiteAlpha.600" : "blackAlpha.600",
19383
18481
  textAlign: "center",
19384
18482
  width: "full",
19385
- href: `${chunkPTWGTINW_cjs.getConfig(network.type).explorerUrl}/${txReceipt?.meta.txID}`,
18483
+ href: `${chunkLMX37RCG_cjs.getConfig(network.type).explorerUrl}/${txReceipt?.meta.txID}`,
19386
18484
  target: "_blank",
19387
18485
  rel: "noopener noreferrer",
19388
18486
  children: t("View transaction on the explorer")
@@ -19895,7 +18993,7 @@ var LegalDocumentsProvider = ({ children }) => {
19895
18993
  const isDocumentRejectedByUser = React10.useCallback(
19896
18994
  (doc, walletAddress) => {
19897
18995
  return optionalRejected.some(
19898
- (rejected) => chunkPTWGTINW_cjs.compareAddresses(rejected.walletAddress, walletAddress) && rejected.id === doc.id
18996
+ (rejected) => chunkLMX37RCG_cjs.compareAddresses(rejected.walletAddress, walletAddress) && rejected.id === doc.id
19899
18997
  );
19900
18998
  },
19901
18999
  [optionalRejected]
@@ -19930,7 +19028,7 @@ var LegalDocumentsProvider = ({ children }) => {
19930
19028
  );
19931
19029
  if (isAnalyticsAllowed) {
19932
19030
  allDocs.push({
19933
- ...chunkPTWGTINW_cjs.VECHAIN_KIT_COOKIES_CONFIG,
19031
+ ...chunkLMX37RCG_cjs.VECHAIN_KIT_COOKIES_CONFIG,
19934
19032
  documentType: "cookies" /* COOKIES */,
19935
19033
  documentSource: "vechain-kit" /* VECHAIN_KIT */
19936
19034
  });
@@ -19943,14 +19041,14 @@ var LegalDocumentsProvider = ({ children }) => {
19943
19041
  if (!account?.address) return [];
19944
19042
  return documents.filter((document2) => {
19945
19043
  const isAgreed = storedAgreements.some(
19946
- (agreement) => chunkPTWGTINW_cjs.compareAddresses(
19044
+ (agreement) => chunkLMX37RCG_cjs.compareAddresses(
19947
19045
  agreement.walletAddress,
19948
19046
  account.address
19949
19047
  ) && agreement.id === document2.id
19950
19048
  );
19951
19049
  if (isAgreed) return false;
19952
19050
  const isRejected = optionalRejected.some(
19953
- (rejection) => chunkPTWGTINW_cjs.compareAddresses(
19051
+ (rejection) => chunkLMX37RCG_cjs.compareAddresses(
19954
19052
  rejection.walletAddress,
19955
19053
  account.address
19956
19054
  ) && rejection.id === document2.id
@@ -19962,7 +19060,7 @@ var LegalDocumentsProvider = ({ children }) => {
19962
19060
  if (!requiredDocuments.length || !account?.address) return true;
19963
19061
  return requiredDocuments.every(
19964
19062
  (document2) => storedAgreements.some(
19965
- (saved) => chunkPTWGTINW_cjs.compareAddresses(saved.walletAddress, account.address) && saved.id === document2.id
19063
+ (saved) => chunkLMX37RCG_cjs.compareAddresses(saved.walletAddress, account.address) && saved.id === document2.id
19966
19064
  )
19967
19065
  );
19968
19066
  }, [requiredDocuments, storedAgreements, account?.address]);
@@ -20015,7 +19113,7 @@ var LegalDocumentsProvider = ({ children }) => {
20015
19113
  walletAddress
20016
19114
  );
20017
19115
  const filteredAgreements = storedAgreements.filter(
20018
- (saved) => !chunkPTWGTINW_cjs.compareAddresses(saved.walletAddress, walletAddress) || !documentsArray.some((term) => term.id === saved.id)
19116
+ (saved) => !chunkLMX37RCG_cjs.compareAddresses(saved.walletAddress, walletAddress) || !documentsArray.some((term) => term.id === saved.id)
20019
19117
  );
20020
19118
  const updated = [...filteredAgreements, ...newAgreements];
20021
19119
  setStoredAgreements(updated);
@@ -20241,7 +19339,7 @@ var PrivyWalletProvider = ({
20241
19339
  clauses.push(
20242
19340
  sdkCore.Clause.callFunction(
20243
19341
  sdkCore.Address.of(
20244
- chunkPTWGTINW_cjs.getConfig(network.type).accountFactoryAddress
19342
+ chunkLMX37RCG_cjs.getConfig(network.type).accountFactoryAddress
20245
19343
  ),
20246
19344
  sdkCore.ABIContract.ofAbi(chunkEESC6JDT_cjs.SimpleAccountFactoryABI).getFunction(
20247
19345
  "createAccount"
@@ -20316,7 +19414,7 @@ var PrivyWalletProvider = ({
20316
19414
  clauses.push(
20317
19415
  sdkCore.Clause.callFunction(
20318
19416
  sdkCore.Address.of(
20319
- chunkPTWGTINW_cjs.getConfig(network.type).accountFactoryAddress
19417
+ chunkLMX37RCG_cjs.getConfig(network.type).accountFactoryAddress
20320
19418
  ),
20321
19419
  sdkCore.ABIContract.ofAbi(chunkEESC6JDT_cjs.SimpleAccountFactoryABI).getFunction(
20322
19420
  "createAccount"
@@ -20365,10 +19463,10 @@ var PrivyWalletProvider = ({
20365
19463
  [
20366
19464
  {
20367
19465
  privateKey: Buffer.from(
20368
- chunkPTWGTINW_cjs.randomTransactionUser.privateKey.slice(2),
19466
+ chunkLMX37RCG_cjs.randomTransactionUser.privateKey.slice(2),
20369
19467
  "hex"
20370
19468
  ),
20371
- address: chunkPTWGTINW_cjs.randomTransactionUser.address
19469
+ address: chunkLMX37RCG_cjs.randomTransactionUser.address
20372
19470
  }
20373
19471
  ],
20374
19472
  { gasPayer: { gasPayerServiceUrl: delegatorUrl } }
@@ -20379,11 +19477,11 @@ var PrivyWalletProvider = ({
20379
19477
  true
20380
19478
  );
20381
19479
  const signer = await providerWithDelegationEnabled.getSigner(
20382
- chunkPTWGTINW_cjs.randomTransactionUser.address
19480
+ chunkLMX37RCG_cjs.randomTransactionUser.address
20383
19481
  );
20384
19482
  const txInput = sdkNetwork.signerUtils.transactionBodyToTransactionRequestInput(
20385
19483
  txBody,
20386
- chunkPTWGTINW_cjs.randomTransactionUser.address
19484
+ chunkLMX37RCG_cjs.randomTransactionUser.address
20387
19485
  );
20388
19486
  const rawDelegateSigned = await signer.signTransaction(txInput);
20389
19487
  const { id } = await fetch(`${nodeUrl}/transactions`, {
@@ -20422,7 +19520,7 @@ var PrivyWalletProvider = ({
20422
19520
  PrivyWalletProviderContext.Provider,
20423
19521
  {
20424
19522
  value: {
20425
- accountFactory: chunkPTWGTINW_cjs.getConfig(network.type).accountFactoryAddress,
19523
+ accountFactory: chunkLMX37RCG_cjs.getConfig(network.type).accountFactoryAddress,
20426
19524
  sendTransaction,
20427
19525
  signMessage,
20428
19526
  signTypedData,
@@ -20453,7 +19551,7 @@ var useVeChainKitConfig = () => {
20453
19551
  var validateConfig = (props) => {
20454
19552
  const errors = [];
20455
19553
  const requiresFeeDelegation = props.privy !== void 0 || props.loginMethods?.some(
20456
- (method13) => method13.method === "vechain" || method13.method === "ecosystem"
19554
+ (method7) => method7.method === "vechain" || method7.method === "ecosystem"
20457
19555
  );
20458
19556
  if (requiresFeeDelegation) {
20459
19557
  if (!props.feeDelegation) {
@@ -20481,7 +19579,7 @@ var validateConfig = (props) => {
20481
19579
  if (props.loginMethods) {
20482
19580
  if (!props.privy) {
20483
19581
  const invalidMethods = props.loginMethods.filter(
20484
- (method13) => ["email", "google", "passkey", "more"].includes(method13.method)
19582
+ (method7) => ["email", "google", "passkey", "more"].includes(method7.method)
20485
19583
  );
20486
19584
  if (invalidMethods.length > 0) {
20487
19585
  errors.push(
@@ -20493,7 +19591,7 @@ var validateConfig = (props) => {
20493
19591
  if (props?.legalDocuments) {
20494
19592
  if (props.legalDocuments.termsAndConditions) {
20495
19593
  props.legalDocuments.termsAndConditions.forEach((term) => {
20496
- if (!chunkPTWGTINW_cjs.isValidUrl(term.url)) {
19594
+ if (!chunkLMX37RCG_cjs.isValidUrl(term.url)) {
20497
19595
  errors.push(
20498
19596
  `legalDocuments.termsAndConditions.url is invalid: ${term.url}`
20499
19597
  );
@@ -20502,7 +19600,7 @@ var validateConfig = (props) => {
20502
19600
  }
20503
19601
  if (props.legalDocuments.privacyPolicy) {
20504
19602
  props.legalDocuments.privacyPolicy.forEach((term) => {
20505
- if (!chunkPTWGTINW_cjs.isValidUrl(term.url)) {
19603
+ if (!chunkLMX37RCG_cjs.isValidUrl(term.url)) {
20506
19604
  errors.push(
20507
19605
  `legalDocuments.privacyPolicy.url is invalid: ${term.url}`
20508
19606
  );
@@ -20511,7 +19609,7 @@ var validateConfig = (props) => {
20511
19609
  }
20512
19610
  if (props.legalDocuments.cookiePolicy) {
20513
19611
  props.legalDocuments.cookiePolicy.forEach((term) => {
20514
- if (!chunkPTWGTINW_cjs.isValidUrl(term.url)) {
19612
+ if (!chunkLMX37RCG_cjs.isValidUrl(term.url)) {
20515
19613
  errors.push(
20516
19614
  `legalDocuments.cookiePolicy.url is invalid: ${term.url}`
20517
19615
  );
@@ -20546,9 +19644,9 @@ var VeChainKitProvider = (props) => {
20546
19644
  const validatedLoginMethods = loginMethods;
20547
19645
  const allowedEcosystemApps = React10.useMemo(() => {
20548
19646
  const userEcosystemMethods = validatedLoginMethods?.find(
20549
- (method13) => method13.method === "ecosystem"
19647
+ (method7) => method7.method === "ecosystem"
20550
19648
  );
20551
- return userEcosystemMethods?.allowedApps ?? chunkPTWGTINW_cjs.DEFAULT_PRIVY_ECOSYSTEM_APPS.map((app) => app.id);
19649
+ return userEcosystemMethods?.allowedApps ?? chunkLMX37RCG_cjs.DEFAULT_PRIVY_ECOSYSTEM_APPS.map((app) => app.id);
20552
19650
  }, [validatedLoginMethods]);
20553
19651
  let privyAppId, privyClientId;
20554
19652
  if (!privy) {
@@ -20576,7 +19674,7 @@ var VeChainKitProvider = (props) => {
20576
19674
  }
20577
19675
  }, [language, i18nConfig]);
20578
19676
  React10.useEffect(() => {
20579
- localStorage.setItem(chunkPTWGTINW_cjs.VECHAIN_KIT_STORAGE_KEYS.NETWORK, network.type);
19677
+ localStorage.setItem(chunkLMX37RCG_cjs.VECHAIN_KIT_STORAGE_KEYS.NETWORK, network.type);
20580
19678
  }, [network]);
20581
19679
  return /* @__PURE__ */ jsxRuntime.jsxs(EnsureQueryClient, { children: [
20582
19680
  /* @__PURE__ */ jsxRuntime.jsx(reactQueryDevtools.ReactQueryDevtools, { initialIsOpen: false }),
@@ -20630,7 +19728,7 @@ var VeChainKitProvider = (props) => {
20630
19728
  children: /* @__PURE__ */ jsxRuntime.jsx(
20631
19729
  dappKitReact.DAppKitProvider,
20632
19730
  {
20633
- node: network.nodeUrl ?? chunkPTWGTINW_cjs.getConfig(network.type).nodeUrl,
19731
+ node: network.nodeUrl ?? chunkLMX37RCG_cjs.getConfig(network.type).nodeUrl,
20634
19732
  i18n: i18nConfig,
20635
19733
  language,
20636
19734
  logLevel: dappKit.logLevel,
@@ -20656,8 +19754,8 @@ var VeChainKitProvider = (props) => {
20656
19754
  "--vdk-color-light-primary-hover": "#f8f8f8",
20657
19755
  "--vdk-color-light-primary-active": "#f0f0f0",
20658
19756
  "--vdk-color-light-secondary": "white",
20659
- // Font settings
20660
- "--vdk-font-family": "var(--chakra-fonts-body)",
19757
+ // Font settings - using system fonts instead of Chakra variables
19758
+ "--vdk-font-family": 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
20661
19759
  "--vdk-font-size-medium": "14px",
20662
19760
  "--vdk-font-size-large": "16px",
20663
19761
  "--vdk-font-weight-medium": "500"
@@ -20665,7 +19763,7 @@ var VeChainKitProvider = (props) => {
20665
19763
  children: /* @__PURE__ */ jsxRuntime.jsx(
20666
19764
  PrivyWalletProvider,
20667
19765
  {
20668
- nodeUrl: network.nodeUrl ?? chunkPTWGTINW_cjs.getConfig(network.type).nodeUrl,
19766
+ nodeUrl: network.nodeUrl ?? chunkLMX37RCG_cjs.getConfig(network.type).nodeUrl,
20669
19767
  delegatorUrl: feeDelegation?.delegatorUrl ?? "",
20670
19768
  delegateAllTransactions: feeDelegation?.delegateAllTransactions ?? false,
20671
19769
  children: /* @__PURE__ */ jsxRuntime.jsx(ModalProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(LegalDocumentsProvider, { children }) })
@@ -20962,25 +20060,89 @@ var themeConfig = {
20962
20060
  Button: buttonTheme,
20963
20061
  Popover: popoverTheme
20964
20062
  },
20965
- cssVarPrefix: "vechainKit"
20063
+ cssVarPrefix: "vechain-kit",
20064
+ // consistent naming across all components
20065
+ // COMPLETELY disable global styles to prevent any conflicts
20066
+ styles: {
20067
+ global: () => ({})
20068
+ // empty object = no global styles injected
20069
+ },
20070
+ // only defining the semantic tokens we need, scoped to our components
20071
+ semanticTokens: {
20072
+ colors: {
20073
+ "chakra-body-text": {
20074
+ _light: "#1A202C",
20075
+ _dark: "#F7FAFC"
20076
+ },
20077
+ "chakra-body-bg": {
20078
+ _light: "#FFFFFF",
20079
+ _dark: "#1A202C"
20080
+ },
20081
+ "chakra-border-color": {
20082
+ _light: "#E2E8F0",
20083
+ _dark: "#2D3748"
20084
+ },
20085
+ "chakra-placeholder-color": {
20086
+ _light: "#A0AEC0",
20087
+ _dark: "#718096"
20088
+ }
20089
+ }
20090
+ },
20091
+ // minimal foundations to prevent global style injection
20092
+ fonts: react.theme.fonts,
20093
+ colors: react.theme.colors,
20094
+ space: react.theme.space
20966
20095
  };
20967
20096
  var VechainKitTheme = react.extendTheme(themeConfig);
20097
+ VechainKitTheme.styles.global = () => ({});
20098
+ if (VechainKitTheme.__cssVars) {
20099
+ VechainKitTheme.__cssVars.global = () => ({});
20100
+ }
20968
20101
  var { ToastContainer } = react.createStandaloneToast();
20102
+ var createVeChainKitCache = () => {
20103
+ return createCache__default.default({
20104
+ key: "vechain-kit",
20105
+ // consistent with our layer and class names
20106
+ prepend: true
20107
+ // CSS layers will be handled via Global component injection
20108
+ });
20109
+ };
20110
+ var LayerSetup = () => {
20111
+ return /* @__PURE__ */ jsxRuntime.jsx(
20112
+ react$1.Global,
20113
+ {
20114
+ styles: react$1.css`
20115
+ /* define CSS layers with proper priority order */
20116
+ @layer vechain-kit, host-app;
20117
+
20118
+ /* All vechain-kit styles go in the vechain-kit layer */
20119
+ @layer vechain-kit {
20120
+ /* scope all Chakra styles to vechain-kit-root */
20121
+ .vechain-kit-root {
20122
+ /* vechain-kit styles are contained here */
20123
+ }
20124
+ }
20125
+ `
20126
+ }
20127
+ );
20128
+ };
20969
20129
  var EnsureChakraProvider = ({
20970
20130
  children,
20971
20131
  theme
20972
20132
  }) => {
20973
- try {
20974
- const chakraVars = document.documentElement.style.getPropertyValue(
20975
- "--chakra-colors-transparent"
20976
- );
20977
- if (chakraVars) {
20978
- return /* @__PURE__ */ jsxRuntime.jsx(react.ChakraProvider, { theme, resetCSS: false, children });
20979
- }
20980
- } catch (e) {
20981
- console.error(e);
20982
- }
20983
- return /* @__PURE__ */ jsxRuntime.jsx(react.ChakraProvider, { theme, resetCSS: true, children });
20133
+ const cache = React10.useMemo(() => createVeChainKitCache(), []);
20134
+ return /* @__PURE__ */ jsxRuntime.jsxs(react$1.CacheProvider, { value: cache, children: [
20135
+ /* @__PURE__ */ jsxRuntime.jsx(LayerSetup, {}),
20136
+ /* @__PURE__ */ jsxRuntime.jsx(
20137
+ react.ChakraProvider,
20138
+ {
20139
+ theme,
20140
+ resetCSS: false,
20141
+ portalZIndex: void 0,
20142
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "vechain-kit-root", children })
20143
+ }
20144
+ )
20145
+ ] });
20984
20146
  };
20985
20147
  var EnsureColorModeScript = ({ darkMode }) => {
20986
20148
  try {
@@ -21016,50 +20178,45 @@ var VechainKitThemeProvider = ({
21016
20178
  ] });
21017
20179
  };
21018
20180
 
21019
- // src/index.ts
21020
- BigInt.prototype.toJSON = function() {
21021
- return { $bigint: this.toString() };
21022
- };
21023
-
21024
20181
  Object.defineProperty(exports, "CURRENCY_SYMBOLS", {
21025
20182
  enumerable: true,
21026
- get: function () { return chunkPTWGTINW_cjs.CURRENCY_SYMBOLS; }
20183
+ get: function () { return chunkLMX37RCG_cjs.CURRENCY_SYMBOLS; }
21027
20184
  });
21028
20185
  Object.defineProperty(exports, "ENS_TEXT_RECORDS", {
21029
20186
  enumerable: true,
21030
- get: function () { return chunkPTWGTINW_cjs.ENS_TEXT_RECORDS; }
20187
+ get: function () { return chunkLMX37RCG_cjs.ENS_TEXT_RECORDS; }
21031
20188
  });
21032
20189
  Object.defineProperty(exports, "LegalDocumentSource", {
21033
20190
  enumerable: true,
21034
- get: function () { return chunkPTWGTINW_cjs.LegalDocumentSource; }
20191
+ get: function () { return chunkLMX37RCG_cjs.LegalDocumentSource; }
21035
20192
  });
21036
20193
  Object.defineProperty(exports, "LegalDocumentType", {
21037
20194
  enumerable: true,
21038
- get: function () { return chunkPTWGTINW_cjs.LegalDocumentType; }
20195
+ get: function () { return chunkLMX37RCG_cjs.LegalDocumentType; }
21039
20196
  });
21040
20197
  Object.defineProperty(exports, "NFTMediaType", {
21041
20198
  enumerable: true,
21042
- get: function () { return chunkPTWGTINW_cjs.NFTMediaType; }
20199
+ get: function () { return chunkLMX37RCG_cjs.NFTMediaType; }
21043
20200
  });
21044
20201
  Object.defineProperty(exports, "VePassportUserStatus", {
21045
20202
  enumerable: true,
21046
- get: function () { return chunkPTWGTINW_cjs.VePassportUserStatus; }
20203
+ get: function () { return chunkLMX37RCG_cjs.VePassportUserStatus; }
21047
20204
  });
21048
20205
  Object.defineProperty(exports, "buildCallClauses", {
21049
20206
  enumerable: true,
21050
- get: function () { return chunkPTWGTINW_cjs.buildCallClauses; }
20207
+ get: function () { return chunkLMX37RCG_cjs.buildCallClauses; }
21051
20208
  });
21052
20209
  Object.defineProperty(exports, "executeCallClause", {
21053
20210
  enumerable: true,
21054
- get: function () { return chunkPTWGTINW_cjs.executeCallClause; }
20211
+ get: function () { return chunkLMX37RCG_cjs.executeCallClause; }
21055
20212
  });
21056
20213
  Object.defineProperty(exports, "executeMultipleClausesCall", {
21057
20214
  enumerable: true,
21058
- get: function () { return chunkPTWGTINW_cjs.executeMultipleClausesCall; }
20215
+ get: function () { return chunkLMX37RCG_cjs.executeMultipleClausesCall; }
21059
20216
  });
21060
20217
  Object.defineProperty(exports, "getConfig", {
21061
20218
  enumerable: true,
21062
- get: function () { return chunkPTWGTINW_cjs.getConfig; }
20219
+ get: function () { return chunkLMX37RCG_cjs.getConfig; }
21063
20220
  });
21064
20221
  Object.defineProperty(exports, "useMfaEnrollment", {
21065
20222
  enumerable: true,
@@ -21164,7 +20321,6 @@ exports.ProfileModalProvider = ProfileModalProvider;
21164
20321
  exports.QuickActionsSection = QuickActionsSection;
21165
20322
  exports.ReceiveModalProvider = ReceiveModalProvider;
21166
20323
  exports.ReceiveTokenContent = ReceiveTokenContent;
21167
- exports.RoundState = RoundState;
21168
20324
  exports.ScrollToTopWrapper = ScrollToTopWrapper;
21169
20325
  exports.SelectTokenContent = SelectTokenContent;
21170
20326
  exports.SendTokenContent = SendTokenContent;
@@ -21208,9 +20364,6 @@ exports.getAccountImplementationAddress = getAccountImplementationAddress;
21208
20364
  exports.getAccountImplementationAddressQueryKey = getAccountImplementationAddressQueryKey;
21209
20365
  exports.getAccountVersionQueryKey = getAccountVersionQueryKey;
21210
20366
  exports.getAllEventLogs = getAllEventLogs;
21211
- exports.getAllocationsRoundStateQueryKey = getAllocationsRoundStateQueryKey;
21212
- exports.getAllocationsRoundsEvents = getAllocationsRoundsEvents;
21213
- exports.getAllocationsRoundsEventsQueryKey = getAllocationsRoundsEventsQueryKey;
21214
20367
  exports.getAppHubAppsQueryKey = getAppHubAppsQueryKey;
21215
20368
  exports.getAvatar = getAvatar;
21216
20369
  exports.getAvatarLegacy = getAvatarLegacy;
@@ -21220,6 +20373,7 @@ exports.getAvatarQueryKey = getAvatarQueryKey;
21220
20373
  exports.getB3trBalance = getB3trBalance;
21221
20374
  exports.getB3trBalanceQueryKey = getB3trBalanceQueryKey;
21222
20375
  exports.getCallClauseQueryKey = getCallClauseQueryKey;
20376
+ exports.getCallClauseQueryKeyWithArgs = getCallClauseQueryKeyWithArgs;
21223
20377
  exports.getChainId = getChainId;
21224
20378
  exports.getChainIdQueryKey = getChainIdQueryKey;
21225
20379
  exports.getCurrentAccountImplementationVersion = getCurrentAccountImplementationVersion;
@@ -21236,7 +20390,6 @@ exports.getErc20BalanceQueryKey = getErc20BalanceQueryKey;
21236
20390
  exports.getEventLogs = getEventLogs;
21237
20391
  exports.getHasV1SmartAccount = getHasV1SmartAccount;
21238
20392
  exports.getHasV1SmartAccountQueryKey = getHasV1SmartAccountQueryKey;
21239
- exports.getHasVotedInRoundQueryKey = getHasVotedInRoundQueryKey;
21240
20393
  exports.getIpfsImage = getIpfsImage;
21241
20394
  exports.getIpfsImageQueryKey = getIpfsImageQueryKey;
21242
20395
  exports.getIpfsMetadata = getIpfsMetadata;
@@ -21244,12 +20397,9 @@ exports.getIpfsMetadataQueryKey = getIpfsMetadataQueryKey;
21244
20397
  exports.getIsDeployed = getIsDeployed;
21245
20398
  exports.getIsDeployedQueryKey = getIsDeployedQueryKey;
21246
20399
  exports.getIsDomainProtectedQueryKey = getIsDomainProtectedQueryKey;
21247
- exports.getIsPersonAtTimepointQueryKey = getIsPersonAtTimepointQueryKey;
21248
20400
  exports.getIsPersonQueryKey = getIsPersonQueryKey;
21249
20401
  exports.getPrivyAppInfoQueryKey = getPrivyAppInfoQueryKey;
21250
20402
  exports.getResolverAddressQueryKey = getResolverAddressQueryKey;
21251
- exports.getRoundRewardQueryKey = getRoundRewardQueryKey;
21252
- exports.getRoundXApps = getRoundXApps;
21253
20403
  exports.getRoundXAppsQueryKey = getRoundXAppsQueryKey;
21254
20404
  exports.getSmartAccount = getSmartAccount;
21255
20405
  exports.getSmartAccountQueryKey = getSmartAccountQueryKey;
@@ -21258,32 +20408,16 @@ exports.getTextRecordsQueryKey = getTextRecordsQueryKey;
21258
20408
  exports.getTokenInfo = getTokenInfo;
21259
20409
  exports.getTokenUsdPrice = getTokenUsdPrice;
21260
20410
  exports.getTokenUsdPriceQueryKey = getTokenUsdPriceQueryKey;
21261
- exports.getTokensInfoByOwnerQueryKey = getTokensInfoByOwnerQueryKey;
21262
20411
  exports.getUpgradeRequired = getUpgradeRequired;
21263
20412
  exports.getUpgradeRequiredForAccount = getUpgradeRequiredForAccount;
21264
20413
  exports.getUpgradeRequiredForAccountQueryKey = getUpgradeRequiredForAccountQueryKey;
21265
20414
  exports.getUpgradeRequiredQueryKey = getUpgradeRequiredQueryKey;
21266
- exports.getUserBotSignalsQueryKey = getUserBotSignalsQueryKey;
21267
- exports.getUserNodesQueryKey = getUserNodesQueryKey;
21268
- exports.getUserVotesInRound = getUserVotesInRound;
21269
- exports.getUserVotesInRoundQueryKey = getUserVotesInRoundQueryKey;
21270
- exports.getVeDelegateBalance = getVeDelegateBalance;
21271
- exports.getVeDelegateBalanceQueryKey = getVeDelegateBalanceQueryKey;
21272
20415
  exports.getVechainDomainQueryKey = getVechainDomainQueryKey;
21273
20416
  exports.getVersion = getVersion;
21274
20417
  exports.getVersionQueryKey = getVersionQueryKey;
21275
20418
  exports.getVot3Balance = getVot3Balance;
21276
20419
  exports.getVot3BalanceQueryKey = getVot3BalanceQueryKey;
21277
- exports.getVotesInRoundQueryKey = getVotesInRoundQueryKey;
21278
20420
  exports.getXAppMetadata = getXAppMetadata;
21279
- exports.getXAppMetadataQueryKey = getXAppMetadataQueryKey;
21280
- exports.getXAppRoundEarnings = getXAppRoundEarnings;
21281
- exports.getXAppRoundEarningsQueryKey = getXAppRoundEarningsQueryKey;
21282
- exports.getXAppTotalEarningsQueryKey = getXAppTotalEarningsQueryKey;
21283
- exports.getXAppVotesQueryKey = getXAppVotesQueryKey;
21284
- exports.getXApps = getXApps;
21285
- exports.getXAppsMetadataBaseUriQueryKey = getXAppsMetadataBaseUriQueryKey;
21286
- exports.getXAppsQueryKey = getXAppsQueryKey;
21287
20421
  exports.getXAppsSharesQueryKey = getXAppsSharesQueryKey;
21288
20422
  exports.imageCompressionOptions = imageCompressionOptions;
21289
20423
  exports.txReceiptQueryKey = txReceiptQueryKey;
@@ -21292,9 +20426,6 @@ exports.useAccountBalance = useAccountBalance;
21292
20426
  exports.useAccountCustomizationModal = useAccountCustomizationModal;
21293
20427
  exports.useAccountImplementationAddress = useAccountImplementationAddress;
21294
20428
  exports.useAccountModal = useAccountModal;
21295
- exports.useAllocationsRound = useAllocationsRound;
21296
- exports.useAllocationsRoundState = useAllocationsRoundState;
21297
- exports.useAllocationsRoundsEvents = useAllocationsRoundsEvents;
21298
20429
  exports.useAppHubApps = useAppHubApps;
21299
20430
  exports.useBuildTransaction = useBuildTransaction;
21300
20431
  exports.useCallClause = useCallClause;
@@ -21305,7 +20436,6 @@ exports.useConnectModal = useConnectModal;
21305
20436
  exports.useCrossAppConnectionCache = useCrossAppConnectionCache;
21306
20437
  exports.useCurrency = useCurrency;
21307
20438
  exports.useCurrentAccountImplementationVersion = useCurrentAccountImplementationVersion;
21308
- exports.useCurrentAllocationsRound = useCurrentAllocationsRound;
21309
20439
  exports.useCurrentAllocationsRoundId = useCurrentAllocationsRoundId;
21310
20440
  exports.useCurrentBlock = useCurrentBlock;
21311
20441
  exports.useCustomTokens = useCustomTokens;
@@ -21316,7 +20446,6 @@ exports.useFAQModal = useFAQModal;
21316
20446
  exports.useFeatureAnnouncement = useFeatureAnnouncement;
21317
20447
  exports.useFetchAppInfo = useFetchAppInfo;
21318
20448
  exports.useFetchPrivyStatus = useFetchPrivyStatus;
21319
- exports.useGalaxyMemberTokensInfo = useGalaxyMemberTokensInfo;
21320
20449
  exports.useGetAccountAddress = useGetAccountAddress;
21321
20450
  exports.useGetAccountVersion = useGetAccountVersion;
21322
20451
  exports.useGetAvatar = useGetAvatar;
@@ -21332,12 +20461,8 @@ exports.useGetNodeUrl = useGetNodeUrl;
21332
20461
  exports.useGetResolverAddress = useGetResolverAddress;
21333
20462
  exports.useGetTextRecords = useGetTextRecords;
21334
20463
  exports.useGetTokenUsdPrice = useGetTokenUsdPrice;
21335
- exports.useGetUserNode = useGetUserNode;
21336
- exports.useGetUserNodes = useGetUserNodes;
21337
- exports.useGetVeDelegateBalance = useGetVeDelegateBalance;
21338
20464
  exports.useGetVot3Balance = useGetVot3Balance;
21339
20465
  exports.useHasV1SmartAccount = useHasV1SmartAccount;
21340
- exports.useHasVotedInRound = useHasVotedInRound;
21341
20466
  exports.useIpfsImage = useIpfsImage;
21342
20467
  exports.useIpfsImageList = useIpfsImageList;
21343
20468
  exports.useIpfsMetadata = useIpfsMetadata;
@@ -21345,9 +20470,7 @@ exports.useIpfsMetadatas = useIpfsMetadatas;
21345
20470
  exports.useIsDomainProtected = useIsDomainProtected;
21346
20471
  exports.useIsPWA = useIsPWA;
21347
20472
  exports.useIsPerson = useIsPerson;
21348
- exports.useIsPersonAtTimepoint = useIsPersonAtTimepoint;
21349
20473
  exports.useIsSmartAccountDeployed = useIsSmartAccountDeployed;
21350
- exports.useIsUserPerson = useIsUserPerson;
21351
20474
  exports.useLegalDocuments = useLegalDocuments;
21352
20475
  exports.useLocalStorage = useLocalStorage;
21353
20476
  exports.useLoginModalContent = useLoginModalContent;
@@ -21355,7 +20478,6 @@ exports.useLoginWithOAuth = useLoginWithOAuth2;
21355
20478
  exports.useLoginWithPasskey = useLoginWithPasskey;
21356
20479
  exports.useLoginWithVeChain = useLoginWithVeChain;
21357
20480
  exports.useMostVotedAppsInRound = useMostVotedAppsInRound;
21358
- exports.useMultipleXAppRoundEarnings = useMultipleXAppRoundEarnings;
21359
20481
  exports.useNotificationAlerts = useNotificationAlerts;
21360
20482
  exports.useNotifications = useNotifications;
21361
20483
  exports.useNotificationsModal = useNotificationsModal;
@@ -21366,7 +20488,6 @@ exports.useRefreshBalances = useRefreshBalances;
21366
20488
  exports.useRefreshFactoryQueries = useRefreshFactoryQueries;
21367
20489
  exports.useRefreshMetadata = useRefreshMetadata;
21368
20490
  exports.useRefreshSmartAccountQueries = useRefreshSmartAccountQueries;
21369
- exports.useRoundReward = useRoundReward;
21370
20491
  exports.useRoundXApps = useRoundXApps;
21371
20492
  exports.useScrollToTop = useScrollToTop;
21372
20493
  exports.useSendTokenModal = useSendTokenModal;
@@ -21378,9 +20499,7 @@ exports.useSmartAccount = useSmartAccount;
21378
20499
  exports.useSmartAccountVersion = useSmartAccountVersion;
21379
20500
  exports.useSyncableLocalStorage = useSyncableLocalStorage;
21380
20501
  exports.useTokenBalances = useTokenBalances;
21381
- exports.useTokenBalances2 = useTokenBalances2;
21382
20502
  exports.useTokenPrices = useTokenPrices;
21383
- exports.useTokenPrices2 = useTokenPrices2;
21384
20503
  exports.useTokensWithValues = useTokensWithValues;
21385
20504
  exports.useTotalBalance = useTotalBalance;
21386
20505
  exports.useTransactionModal = useTransactionModal;
@@ -21395,22 +20514,12 @@ exports.useUpgradeRequiredForAccount = useUpgradeRequiredForAccount;
21395
20514
  exports.useUpgradeSmartAccount = useUpgradeSmartAccount;
21396
20515
  exports.useUpgradeSmartAccountModal = useUpgradeSmartAccountModal;
21397
20516
  exports.useUploadImages = useUploadImages;
21398
- exports.useUserBotSignals = useUserBotSignals;
21399
- exports.useUserVotesInRound = useUserVotesInRound;
21400
20517
  exports.useVeChainKitConfig = useVeChainKitConfig;
21401
20518
  exports.useVechainDomain = useVechainDomain;
21402
- exports.useVotesInRound = useVotesInRound;
21403
- exports.useVotingRewards = useVotingRewards;
21404
20519
  exports.useWallet = useWallet;
21405
20520
  exports.useWalletMetadata = useWalletMetadata;
21406
20521
  exports.useWalletModal = useWalletModal2;
21407
- exports.useXApp = useXApp;
21408
20522
  exports.useXAppMetadata = useXAppMetadata;
21409
- exports.useXAppRoundEarnings = useXAppRoundEarnings;
21410
- exports.useXAppTotalEarnings = useXAppTotalEarnings;
21411
- exports.useXAppVotes = useXAppVotes;
21412
- exports.useXApps = useXApps;
21413
- exports.useXAppsMetadataBaseUri = useXAppsMetadataBaseUri;
21414
20523
  exports.useXAppsShares = useXAppsShares;
21415
20524
  //# sourceMappingURL=index.cjs.map
21416
20525
  //# sourceMappingURL=index.cjs.map