@vechain/vechain-kit 1.9.5 → 1.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ZZOAVX47.cjs → chunk-2EYSG3VY.cjs} +27 -2
- package/dist/chunk-2EYSG3VY.cjs.map +1 -0
- package/dist/{chunk-3SI2CCB5.js → chunk-563OFP3K.js} +26 -3
- package/dist/chunk-563OFP3K.js.map +1 -0
- package/dist/index.cjs +366 -300
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +63 -3
- package/dist/index.d.ts +63 -3
- package/dist/index.js +125 -61
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/utils/index.cjs +47 -39
- package/dist/utils/index.d.cts +18 -1
- package/dist/utils/index.d.ts +18 -1
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3SI2CCB5.js.map +0 -1
- package/dist/chunk-ZZOAVX47.cjs.map +0 -1
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
|
|
4
|
+
var chunk2EYSG3VY_cjs = require('./chunk-2EYSG3VY.cjs');
|
|
5
5
|
var chunkEESC6JDT_cjs = require('./chunk-EESC6JDT.cjs');
|
|
6
6
|
require('./chunk-Q7SFCCGT.cjs');
|
|
7
7
|
var i18n = require('i18next');
|
|
@@ -4063,6 +4063,12 @@ var languageNames = {
|
|
|
4063
4063
|
};
|
|
4064
4064
|
var customLanguageDetector = {
|
|
4065
4065
|
lookup: (options) => {
|
|
4066
|
+
if (typeof window !== "undefined") {
|
|
4067
|
+
const storedLanguage = localStorage.getItem("i18nextLng");
|
|
4068
|
+
if (storedLanguage && supportedLanguages.includes(storedLanguage)) {
|
|
4069
|
+
return storedLanguage;
|
|
4070
|
+
}
|
|
4071
|
+
}
|
|
4066
4072
|
const propLanguage = options?.languages?.[0];
|
|
4067
4073
|
if (propLanguage && supportedLanguages.includes(propLanguage)) {
|
|
4068
4074
|
return propLanguage;
|
|
@@ -4230,11 +4236,11 @@ var ModalBackButton = ({ onClick, ...props }) => {
|
|
|
4230
4236
|
var APP_SOURCE = document.title || "";
|
|
4231
4237
|
var PAGE_SOURCE = window?.location?.origin || "";
|
|
4232
4238
|
var hasTrackingConsent = false;
|
|
4233
|
-
if (typeof window !== "undefined" &&
|
|
4234
|
-
VeChainKitMixpanel__default.default.init(
|
|
4235
|
-
debug: !
|
|
4239
|
+
if (typeof window !== "undefined" && chunk2EYSG3VY_cjs.VECHAIN_KIT_MIXPANEL_PROJECT_TOKEN) {
|
|
4240
|
+
VeChainKitMixpanel__default.default.init(chunk2EYSG3VY_cjs.VECHAIN_KIT_MIXPANEL_PROJECT_TOKEN, {
|
|
4241
|
+
debug: !chunk2EYSG3VY_cjs.ENV.isProduction
|
|
4236
4242
|
});
|
|
4237
|
-
if (
|
|
4243
|
+
if (chunk2EYSG3VY_cjs.ENV.isDevelopment) {
|
|
4238
4244
|
console.info("Analytics initialized in DEVELOPMENT mode");
|
|
4239
4245
|
}
|
|
4240
4246
|
}
|
|
@@ -4276,7 +4282,7 @@ var storeUserData = (userId, properties) => {
|
|
|
4276
4282
|
};
|
|
4277
4283
|
var trackEvent = (event, properties = {}) => {
|
|
4278
4284
|
try {
|
|
4279
|
-
if (!
|
|
4285
|
+
if (!chunk2EYSG3VY_cjs.VECHAIN_KIT_MIXPANEL_PROJECT_TOKEN) {
|
|
4280
4286
|
console.warn("No project token found");
|
|
4281
4287
|
return;
|
|
4282
4288
|
}
|
|
@@ -4749,7 +4755,7 @@ var AddressDisplay = ({
|
|
|
4749
4755
|
react.Input,
|
|
4750
4756
|
{
|
|
4751
4757
|
cursor: "pointer",
|
|
4752
|
-
value: showHumanAddress ?
|
|
4758
|
+
value: showHumanAddress ? chunk2EYSG3VY_cjs.humanAddress(
|
|
4753
4759
|
wallet.address ?? "",
|
|
4754
4760
|
8,
|
|
4755
4761
|
7
|
|
@@ -4782,7 +4788,7 @@ var AddressDisplay = ({
|
|
|
4782
4788
|
react.Input,
|
|
4783
4789
|
{
|
|
4784
4790
|
cursor: "pointer",
|
|
4785
|
-
value: showHumanAddress ?
|
|
4791
|
+
value: showHumanAddress ? chunk2EYSG3VY_cjs.humanAddress(wallet?.address ?? "", 6, 4) : wallet?.address,
|
|
4786
4792
|
readOnly: true,
|
|
4787
4793
|
fontSize: "sm",
|
|
4788
4794
|
fontWeight: "700",
|
|
@@ -4810,7 +4816,7 @@ var AddressDisplay = ({
|
|
|
4810
4816
|
|
|
4811
4817
|
// package.json
|
|
4812
4818
|
var package_default = {
|
|
4813
|
-
version: "1.9.
|
|
4819
|
+
version: "1.9.5"};
|
|
4814
4820
|
var VersionFooter = ({ ...props }) => {
|
|
4815
4821
|
const { darkMode: isDark } = useVeChainKitConfig();
|
|
4816
4822
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -5037,13 +5043,13 @@ var AssetButton = ({
|
|
|
5037
5043
|
...buttonProps,
|
|
5038
5044
|
children: [
|
|
5039
5045
|
/* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { children: [
|
|
5040
|
-
|
|
5046
|
+
chunk2EYSG3VY_cjs.TOKEN_LOGO_COMPONENTS[symbol] ? React10__default.default.cloneElement(chunk2EYSG3VY_cjs.TOKEN_LOGO_COMPONENTS[symbol], {
|
|
5041
5047
|
boxSize: "24px",
|
|
5042
5048
|
borderRadius: "full"
|
|
5043
5049
|
}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
5044
5050
|
react.Image,
|
|
5045
5051
|
{
|
|
5046
|
-
src:
|
|
5052
|
+
src: chunk2EYSG3VY_cjs.TOKEN_LOGOS[symbol],
|
|
5047
5053
|
alt: `${symbol} logo`,
|
|
5048
5054
|
boxSize: "24px",
|
|
5049
5055
|
borderRadius: "full",
|
|
@@ -5093,7 +5099,7 @@ var PRICE_FEED_IDS = {
|
|
|
5093
5099
|
};
|
|
5094
5100
|
var getTokenUsdPrice = async (thor, token, network) => {
|
|
5095
5101
|
const functionFragment2 = OracleInterface.getFunction("getLatestValue").format("json");
|
|
5096
|
-
const res = await thor.account(
|
|
5102
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(network).oracleContractAddress).method(JSON.parse(functionFragment2)).call(PRICE_FEED_IDS[token]);
|
|
5097
5103
|
if (res.reverted) throw new Error("Reverted");
|
|
5098
5104
|
return new bignumber_js.BigNumber(res.decoded[0]).div(1e12).toNumber();
|
|
5099
5105
|
};
|
|
@@ -5112,11 +5118,11 @@ var useGetTokenUsdPrice = (token) => {
|
|
|
5112
5118
|
var B3TRInterface = chunk5GZ7N47F_cjs.IB3TR__factory.createInterface();
|
|
5113
5119
|
var getB3trBalance = async (thor, network, address) => {
|
|
5114
5120
|
const functionFragment2 = B3TRInterface.getFunction("balanceOf").format("json");
|
|
5115
|
-
const res = await thor.account(
|
|
5121
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(network).b3trContractAddress).method(JSON.parse(functionFragment2)).call(address);
|
|
5116
5122
|
if (res.reverted) throw new Error("Reverted");
|
|
5117
5123
|
const original = res.decoded[0];
|
|
5118
5124
|
const scaled = viem.formatEther(original);
|
|
5119
|
-
const formatted = scaled === "0" ? "0" :
|
|
5125
|
+
const formatted = scaled === "0" ? "0" : chunk2EYSG3VY_cjs.humanNumber(scaled);
|
|
5120
5126
|
return {
|
|
5121
5127
|
original,
|
|
5122
5128
|
scaled,
|
|
@@ -5139,11 +5145,11 @@ var useGetB3trBalance = (address) => {
|
|
|
5139
5145
|
var VOT3Interface = chunk5GZ7N47F_cjs.IVOT3__factory.createInterface();
|
|
5140
5146
|
var getVot3Balance = async (thor, network, address) => {
|
|
5141
5147
|
const functionFragment2 = VOT3Interface.getFunction("balanceOf").format("json");
|
|
5142
|
-
const res = await thor.account(
|
|
5148
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(network).vot3ContractAddress).method(JSON.parse(functionFragment2)).call(address);
|
|
5143
5149
|
if (res.reverted) throw new Error("Reverted");
|
|
5144
5150
|
const original = res.decoded[0];
|
|
5145
5151
|
const scaled = viem.formatEther(original);
|
|
5146
|
-
const formatted = scaled === "0" ? "0" :
|
|
5152
|
+
const formatted = scaled === "0" ? "0" : chunk2EYSG3VY_cjs.humanNumber(scaled);
|
|
5147
5153
|
return {
|
|
5148
5154
|
original,
|
|
5149
5155
|
scaled,
|
|
@@ -5169,7 +5175,7 @@ var contractInterface = chunk5GZ7N47F_cjs.GalaxyMember__factory.createInterface(
|
|
|
5169
5175
|
var method = "getIdAttachedToNode";
|
|
5170
5176
|
var useGetTokenIdAttachedToNode = (nodeId, enabled = true) => {
|
|
5171
5177
|
const { network } = useVeChainKitConfig();
|
|
5172
|
-
const contractAddress =
|
|
5178
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(network.type).galaxyMemberContractAddress;
|
|
5173
5179
|
return useCall({
|
|
5174
5180
|
contractInterface,
|
|
5175
5181
|
contractAddress,
|
|
@@ -5185,7 +5191,7 @@ var method2 = "getUserNodes";
|
|
|
5185
5191
|
var getUserNodesQueryKey = (user) => getCallKey({ method: method2, keyArgs: [user] });
|
|
5186
5192
|
var useGetUserNodes = (user) => {
|
|
5187
5193
|
const { network } = useVeChainKitConfig();
|
|
5188
|
-
const contractAddress =
|
|
5194
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
5189
5195
|
network.type
|
|
5190
5196
|
).nodeManagementContractAddress;
|
|
5191
5197
|
return useCall({
|
|
@@ -5216,7 +5222,7 @@ var method3 = "checkCooldown";
|
|
|
5216
5222
|
var getNodeCheckCooldownQueryKey = (nodeId) => getCallKey({ method: method3, keyArgs: [nodeId] });
|
|
5217
5223
|
var useXNodeCheckCooldown = (nodeId) => {
|
|
5218
5224
|
const { network } = useVeChainKitConfig();
|
|
5219
|
-
const contractAddress =
|
|
5225
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
5220
5226
|
network.type
|
|
5221
5227
|
).nodeManagementContractAddress;
|
|
5222
5228
|
return useCall({
|
|
@@ -5237,11 +5243,11 @@ var useXNode = (address) => {
|
|
|
5237
5243
|
const xNode = firstNode ? {
|
|
5238
5244
|
id: firstNode.nodeId,
|
|
5239
5245
|
level: Number(firstNode.nodeLevel),
|
|
5240
|
-
image:
|
|
5241
|
-
name:
|
|
5246
|
+
image: chunk2EYSG3VY_cjs.NodeStrengthLevelToImage[Number(firstNode.nodeLevel)],
|
|
5247
|
+
name: chunk2EYSG3VY_cjs.allNodeStrengthLevelToName[Number(firstNode.nodeLevel)]
|
|
5242
5248
|
} : void 0;
|
|
5243
5249
|
const xNodeName = xNode?.name ?? t("Not available");
|
|
5244
|
-
const xNodeImage = xNode?.image ??
|
|
5250
|
+
const xNodeImage = xNode?.image ?? chunk2EYSG3VY_cjs.notFoundImage;
|
|
5245
5251
|
const xNodeLevel = xNode?.level ?? 0;
|
|
5246
5252
|
const nodeType = Number(xNodeLevel) >= 4 ? "XNODE" : "ECONOMIC NODE";
|
|
5247
5253
|
const {
|
|
@@ -5282,7 +5288,7 @@ var getNodeIdsAbi = new thorDevkit.abi.Function(JSON.parse(getNodeIdsFragment));
|
|
|
5282
5288
|
var getNodeLevelsAbi = new thorDevkit.abi.Function(JSON.parse(getNodeLevelsFragment));
|
|
5283
5289
|
var getUserXNodes = async (thor, networkType, user) => {
|
|
5284
5290
|
if (!user) throw new Error("User address is required");
|
|
5285
|
-
const contractAddress =
|
|
5291
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(networkType).nodeManagementContractAddress;
|
|
5286
5292
|
const clauses = [
|
|
5287
5293
|
{
|
|
5288
5294
|
to: contractAddress,
|
|
@@ -5308,8 +5314,8 @@ var getUserXNodes = async (thor, networkType, user) => {
|
|
|
5308
5314
|
return {
|
|
5309
5315
|
id,
|
|
5310
5316
|
level: Number(levels[index]),
|
|
5311
|
-
image:
|
|
5312
|
-
name:
|
|
5317
|
+
image: chunk2EYSG3VY_cjs.NodeStrengthLevelToImage[Number(levels[index])],
|
|
5318
|
+
name: chunk2EYSG3VY_cjs.allNodeStrengthLevelToName[Number(levels[index])]
|
|
5313
5319
|
};
|
|
5314
5320
|
});
|
|
5315
5321
|
};
|
|
@@ -5336,7 +5342,7 @@ var getIsNodeHolderQueryKey = (address) => [
|
|
|
5336
5342
|
];
|
|
5337
5343
|
var getIsNodeHolder = async (thor, networkType, address) => {
|
|
5338
5344
|
if (!address) return Promise.reject(new Error("Address not provided"));
|
|
5339
|
-
const contractAddress =
|
|
5345
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(networkType).nodeManagementContractAddress;
|
|
5340
5346
|
const functionAbi2 = contractInterface4.getFunction(method4);
|
|
5341
5347
|
const res = await thor.account(contractAddress).method(functionAbi2).call(address);
|
|
5342
5348
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
@@ -5352,7 +5358,7 @@ var useIsNodeHolder = (address) => {
|
|
|
5352
5358
|
});
|
|
5353
5359
|
};
|
|
5354
5360
|
var getAppAdmin = async (thor, appId, networkType) => {
|
|
5355
|
-
const X2EARNAPPS_CONTRACT =
|
|
5361
|
+
const X2EARNAPPS_CONTRACT = chunk2EYSG3VY_cjs.getConfig(networkType).x2EarnAppsContractAddress;
|
|
5356
5362
|
const functionFragment2 = chunk5GZ7N47F_cjs.X2EarnApps__factory.createInterface().getFunction("appAdmin").format("json");
|
|
5357
5363
|
const res = await thor.account(X2EARNAPPS_CONTRACT).method(JSON.parse(functionFragment2)).call(appId);
|
|
5358
5364
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
@@ -5380,7 +5386,7 @@ var method5 = "appExists";
|
|
|
5380
5386
|
var getAppExistsQueryKey = (appId) => getCallKey({ method: method5, keyArgs: [appId] });
|
|
5381
5387
|
var useAppExists = (appId) => {
|
|
5382
5388
|
const { network } = useVeChainKitConfig();
|
|
5383
|
-
const contractAddress =
|
|
5389
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(network.type).x2EarnAppsContractAddress;
|
|
5384
5390
|
return useCall({
|
|
5385
5391
|
contractInterface: contractInterface5,
|
|
5386
5392
|
contractAddress,
|
|
@@ -5390,7 +5396,7 @@ var useAppExists = (appId) => {
|
|
|
5390
5396
|
});
|
|
5391
5397
|
};
|
|
5392
5398
|
var getAppsEligibleInNextRound = async (thor, networkType) => {
|
|
5393
|
-
const X2EARNAPPS_CONTRACT =
|
|
5399
|
+
const X2EARNAPPS_CONTRACT = chunk2EYSG3VY_cjs.getConfig(networkType).x2EarnAppsContractAddress;
|
|
5394
5400
|
const functionFragment2 = chunk5GZ7N47F_cjs.X2EarnApps__factory.createInterface().getFunction("allEligibleApps").format("json");
|
|
5395
5401
|
const res = await thor.account(X2EARNAPPS_CONTRACT).method(JSON.parse(functionFragment2)).call();
|
|
5396
5402
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
@@ -5411,7 +5417,7 @@ var useAppsEligibleInNextRound = () => {
|
|
|
5411
5417
|
};
|
|
5412
5418
|
var getRoundXApps = async (thor, networkType, roundId) => {
|
|
5413
5419
|
if (!roundId) return [];
|
|
5414
|
-
const xAllocationVotingContract =
|
|
5420
|
+
const xAllocationVotingContract = chunk2EYSG3VY_cjs.getConfig(networkType).xAllocationVotingContractAddress;
|
|
5415
5421
|
const functionFragment2 = chunk5GZ7N47F_cjs.XAllocationVoting__factory.createInterface().getFunction("getAppsOfRound").format("json");
|
|
5416
5422
|
const res = await thor.account(xAllocationVotingContract).method(JSON.parse(functionFragment2)).call(roundId);
|
|
5417
5423
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
@@ -5442,7 +5448,7 @@ var useRoundXApps = (roundId) => {
|
|
|
5442
5448
|
var currentBlockQueryKey = () => ["VECHAIN_KIT", "CURRENT_BLOCK"];
|
|
5443
5449
|
var useCurrentBlock = () => {
|
|
5444
5450
|
const { network } = useVeChainKitConfig();
|
|
5445
|
-
const nodeUrl = network.nodeUrl ??
|
|
5451
|
+
const nodeUrl = network.nodeUrl ?? chunk2EYSG3VY_cjs.getConfig(network.type).nodeUrl;
|
|
5446
5452
|
return reactQuery.useQuery({
|
|
5447
5453
|
queryKey: currentBlockQueryKey(),
|
|
5448
5454
|
queryFn: async () => {
|
|
@@ -5570,7 +5576,7 @@ var useTxReceipt = (txId, blockTimeout) => {
|
|
|
5570
5576
|
// src/hooks/api/vebetterdao/xApps/hooks/useUserVotesInRound.ts
|
|
5571
5577
|
var XAllocationVotingInterface = chunk5GZ7N47F_cjs.XAllocationVoting__factory.createInterface();
|
|
5572
5578
|
var getUserVotesInRound = async (thor, network, roundId, address) => {
|
|
5573
|
-
const xAllocationVotingContract =
|
|
5579
|
+
const xAllocationVotingContract = chunk2EYSG3VY_cjs.getConfig(network).xAllocationVotingContractAddress;
|
|
5574
5580
|
const eventFragment = XAllocationVotingInterface.getEvent("AllocationVoteCast").format(
|
|
5575
5581
|
"json"
|
|
5576
5582
|
);
|
|
@@ -5594,7 +5600,7 @@ var getUserVotesInRound = async (thor, network, roundId, address) => {
|
|
|
5594
5600
|
const events = await getAllEvents({
|
|
5595
5601
|
thor,
|
|
5596
5602
|
filterCriteria,
|
|
5597
|
-
nodeUrl:
|
|
5603
|
+
nodeUrl: chunk2EYSG3VY_cjs.getConfig(network).nodeUrl
|
|
5598
5604
|
});
|
|
5599
5605
|
const decodedAllocatedVoteEvents = [];
|
|
5600
5606
|
events.forEach((event) => {
|
|
@@ -5665,7 +5671,7 @@ var unendorsedAppsAbi = new thorDevkit.abi.Function(JSON.parse(unendorsedAppsFra
|
|
|
5665
5671
|
var allAppsFragment = chunk5GZ7N47F_cjs.X2EarnApps__factory.createInterface().getFunction("apps").format("json");
|
|
5666
5672
|
var allAppsAbi = new thorDevkit.abi.Function(JSON.parse(allAppsFragment));
|
|
5667
5673
|
var getXApps = async (thor, networkType) => {
|
|
5668
|
-
const x2EarnAppsContract =
|
|
5674
|
+
const x2EarnAppsContract = chunk2EYSG3VY_cjs.getConfig(networkType).x2EarnAppsContractAddress;
|
|
5669
5675
|
const clauses = [
|
|
5670
5676
|
{
|
|
5671
5677
|
to: x2EarnAppsContract,
|
|
@@ -5748,7 +5754,7 @@ var useXApp = (appId) => {
|
|
|
5748
5754
|
|
|
5749
5755
|
// src/hooks/api/vebetterdao/xApps/getXAppsMetadataBaseUri.ts
|
|
5750
5756
|
var getXAppsMetadataBaseUri = async (thor, networkType) => {
|
|
5751
|
-
const X2EARNAPPS_CONTRACT =
|
|
5757
|
+
const X2EARNAPPS_CONTRACT = chunk2EYSG3VY_cjs.getConfig(networkType).x2EarnAppsContractAddress;
|
|
5752
5758
|
const functionFragment2 = chunk5GZ7N47F_cjs.X2EarnApps__factory.createInterface().getFunction("baseURI").format("json");
|
|
5753
5759
|
const res = await thor.account(X2EARNAPPS_CONTRACT).method(JSON.parse(functionFragment2)).call();
|
|
5754
5760
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
@@ -5776,7 +5782,7 @@ var useXAppsMetadataBaseUri = () => {
|
|
|
5776
5782
|
|
|
5777
5783
|
// src/hooks/api/vebetterdao/xApps/getXAppMetadata.ts
|
|
5778
5784
|
var getXAppMetadata = async (uri, networkType) => {
|
|
5779
|
-
const url =
|
|
5785
|
+
const url = chunk2EYSG3VY_cjs.convertUriToUrl(uri, networkType);
|
|
5780
5786
|
if (!url) return void 0;
|
|
5781
5787
|
const response = await fetch(url);
|
|
5782
5788
|
if (!response.ok) {
|
|
@@ -5808,7 +5814,7 @@ var useXAppMetadata = (xAppId) => {
|
|
|
5808
5814
|
var allocationVotingInterface = chunk5GZ7N47F_cjs.XAllocationVotingGovernor__factory.createInterface();
|
|
5809
5815
|
var method6 = "getAppVotes";
|
|
5810
5816
|
var getXAppVotes = async (thor, networkType, roundId, xAppId) => {
|
|
5811
|
-
const ALLOCATION_VOTING_CONTRACT =
|
|
5817
|
+
const ALLOCATION_VOTING_CONTRACT = chunk2EYSG3VY_cjs.getConfig(networkType).xAllocationVotingContractAddress;
|
|
5812
5818
|
const functionFragment2 = allocationVotingInterface.getFunction(method6).format("json");
|
|
5813
5819
|
const res = await thor.account(ALLOCATION_VOTING_CONTRACT).method(JSON.parse(functionFragment2)).call(roundId, xAppId);
|
|
5814
5820
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
@@ -5819,7 +5825,7 @@ var useXAppVotes = (roundId, appId) => {
|
|
|
5819
5825
|
const { network } = useVeChainKitConfig();
|
|
5820
5826
|
return useCall({
|
|
5821
5827
|
contractInterface: allocationVotingInterface,
|
|
5822
|
-
contractAddress:
|
|
5828
|
+
contractAddress: chunk2EYSG3VY_cjs.getConfig(network.type).xAllocationVotingContractAddress,
|
|
5823
5829
|
method: method6,
|
|
5824
5830
|
args: [roundId, appId],
|
|
5825
5831
|
enabled: !!roundId && !!appId && !!network.type
|
|
@@ -5830,7 +5836,7 @@ var useXAppVotes = (roundId, appId) => {
|
|
|
5830
5836
|
// src/hooks/api/vebetterdao/xApps/hooks/useXAppVotesQf.ts
|
|
5831
5837
|
var allocationVotingInterface2 = chunk5GZ7N47F_cjs.XAllocationVotingGovernor__factory.createInterface();
|
|
5832
5838
|
var getXAppVotesQf = async (thor, networkType, roundId, xAppId) => {
|
|
5833
|
-
const ALLOCATION_VOTING_CONTRACT =
|
|
5839
|
+
const ALLOCATION_VOTING_CONTRACT = chunk2EYSG3VY_cjs.getConfig(networkType).xAllocationVotingContractAddress;
|
|
5834
5840
|
const functionFragment2 = allocationVotingInterface2.getFunction("getAppVotesQF").format("json");
|
|
5835
5841
|
const res = await thor.account(ALLOCATION_VOTING_CONTRACT).method(JSON.parse(functionFragment2)).call(roundId, xAppId);
|
|
5836
5842
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
@@ -5844,7 +5850,7 @@ var useXAppVotesQf = (roundId, appId) => {
|
|
|
5844
5850
|
const { network } = useVeChainKitConfig();
|
|
5845
5851
|
return useCall({
|
|
5846
5852
|
contractInterface: allocationVotingInterface2,
|
|
5847
|
-
contractAddress:
|
|
5853
|
+
contractAddress: chunk2EYSG3VY_cjs.getConfig(network.type).xAllocationVotingContractAddress,
|
|
5848
5854
|
method: "getAppVotesQF",
|
|
5849
5855
|
args: [roundId, appId],
|
|
5850
5856
|
enabled: !!roundId && !!appId && !!network.type
|
|
@@ -5918,7 +5924,7 @@ var method7 = "getAppShares";
|
|
|
5918
5924
|
var functionFragment = allocationPoolInterface.getFunction(method7).format("json");
|
|
5919
5925
|
var functionAbi = new thorDevkit.abi.Function(JSON.parse(functionFragment));
|
|
5920
5926
|
var getAppsShareClauses = (networkType, apps, roundId) => {
|
|
5921
|
-
const allocationPoolContract =
|
|
5927
|
+
const allocationPoolContract = chunk2EYSG3VY_cjs.getConfig(networkType).xAllocationPoolContractAddress;
|
|
5922
5928
|
const clauses = apps.map((app) => ({
|
|
5923
5929
|
to: allocationPoolContract,
|
|
5924
5930
|
value: 0,
|
|
@@ -5975,7 +5981,7 @@ var useMostVotedAppsInRound = (roundId) => {
|
|
|
5975
5981
|
};
|
|
5976
5982
|
var getParticipatedInGovernance = async (networkType, thor, address) => {
|
|
5977
5983
|
if (!address) return Promise.reject(new Error("Address not provided"));
|
|
5978
|
-
const galaxyMemberContract =
|
|
5984
|
+
const galaxyMemberContract = chunk2EYSG3VY_cjs.getConfig(networkType).galaxyMemberContractAddress;
|
|
5979
5985
|
const functionFragment2 = chunk5GZ7N47F_cjs.GalaxyMember__factory.createInterface().getFunction("participatedInGovernance").format("json");
|
|
5980
5986
|
const res = await thor.account(galaxyMemberContract).method(JSON.parse(functionFragment2)).call(address);
|
|
5981
5987
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
@@ -5998,7 +6004,7 @@ var useParticipatedInGovernance = (address) => {
|
|
|
5998
6004
|
};
|
|
5999
6005
|
var getBalanceOf = async (thor, network, address) => {
|
|
6000
6006
|
if (!address) return Promise.reject(new Error("Address not provided"));
|
|
6001
|
-
const contractAddress =
|
|
6007
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(network).galaxyMemberContractAddress;
|
|
6002
6008
|
const functionFragment2 = chunk5GZ7N47F_cjs.GalaxyMember__factory.createInterface().getFunction("balanceOf").format("json");
|
|
6003
6009
|
const res = await thor.account(contractAddress).method(JSON.parse(functionFragment2)).call(address);
|
|
6004
6010
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
@@ -6030,7 +6036,7 @@ var useIsGMclaimable = (address) => {
|
|
|
6030
6036
|
};
|
|
6031
6037
|
var getTokenIdByAccount = async (thor, networkType, address, index) => {
|
|
6032
6038
|
if (!address) return Promise.reject(new Error("Address not provided"));
|
|
6033
|
-
const contractAddress =
|
|
6039
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(networkType).galaxyMemberContractAddress;
|
|
6034
6040
|
const functionFragment2 = chunk5GZ7N47F_cjs.GalaxyMember__factory.createInterface().getFunction("tokenOfOwnerByIndex").format("json");
|
|
6035
6041
|
const res = await thor.account(contractAddress).method(JSON.parse(functionFragment2)).call(address, index);
|
|
6036
6042
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
@@ -6057,7 +6063,7 @@ var contractInterface6 = chunk5GZ7N47F_cjs.GalaxyMember__factory.createInterface
|
|
|
6057
6063
|
var method8 = "getSelectedTokenId";
|
|
6058
6064
|
var useSelectedTokenId = (address, enabled = true) => {
|
|
6059
6065
|
const { network } = useVeChainKitConfig();
|
|
6060
|
-
const contractAddress =
|
|
6066
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(network.type).galaxyMemberContractAddress;
|
|
6061
6067
|
return useCall({
|
|
6062
6068
|
contractInterface: contractInterface6,
|
|
6063
6069
|
contractAddress,
|
|
@@ -6068,7 +6074,7 @@ var useSelectedTokenId = (address, enabled = true) => {
|
|
|
6068
6074
|
};
|
|
6069
6075
|
var getIpfsMetadata = async (networkType, uri, parseJson = false) => {
|
|
6070
6076
|
if (!uri) throw new Error("No URI provided");
|
|
6071
|
-
const newUri =
|
|
6077
|
+
const newUri = chunk2EYSG3VY_cjs.convertUriToUrl(uri, networkType);
|
|
6072
6078
|
if (!newUri) throw new Error("Invalid URI");
|
|
6073
6079
|
const response = await fetch(newUri, {
|
|
6074
6080
|
headers: {
|
|
@@ -6092,7 +6098,7 @@ var useIpfsMetadata = (ipfsUri, parseJson = false) => {
|
|
|
6092
6098
|
var MAX_IMAGE_SIZE = 1024 * 1024 * 10;
|
|
6093
6099
|
var getIpfsImage = async (networkType, uri) => {
|
|
6094
6100
|
if (!uri) throw new Error("IPFS URI is required");
|
|
6095
|
-
const response = await fetch(
|
|
6101
|
+
const response = await fetch(chunk2EYSG3VY_cjs.convertUriToUrl(uri, networkType) ?? "", {
|
|
6096
6102
|
headers: {
|
|
6097
6103
|
"X-Project-Id": "vechain-kit"
|
|
6098
6104
|
}
|
|
@@ -6124,7 +6130,7 @@ var getIpfsImage = async (networkType, uri) => {
|
|
|
6124
6130
|
resolve({
|
|
6125
6131
|
image: reader.result,
|
|
6126
6132
|
mime: blob.type,
|
|
6127
|
-
mediaType:
|
|
6133
|
+
mediaType: chunk2EYSG3VY_cjs.resolveMediaTypeFromMimeType(blob.type)
|
|
6128
6134
|
});
|
|
6129
6135
|
};
|
|
6130
6136
|
reader.onerror = () => {
|
|
@@ -6280,7 +6286,7 @@ var method9 = "levelOf";
|
|
|
6280
6286
|
var getLevelOfTokenQueryKey = (tokenId) => getCallKey({ method: method9, keyArgs: [tokenId] });
|
|
6281
6287
|
var useLevelOfToken = (tokenId, enabled = true) => {
|
|
6282
6288
|
const { network } = useVeChainKitConfig();
|
|
6283
|
-
const contractAddress =
|
|
6289
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(network.type).galaxyMemberContractAddress;
|
|
6284
6290
|
return useCall({
|
|
6285
6291
|
contractInterface: contractInterface7,
|
|
6286
6292
|
contractAddress,
|
|
@@ -6297,7 +6303,7 @@ var getLevelMultiplierQueryKey = (level) => getCallKey({ method: method10, keyAr
|
|
|
6297
6303
|
var percentageToMultiplier = (percentage) => 1 + percentage / 100;
|
|
6298
6304
|
var useLevelMultiplier = (level, enabled = true) => {
|
|
6299
6305
|
const { network } = useVeChainKitConfig();
|
|
6300
|
-
const contractAddress =
|
|
6306
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(network.type).voterRewardsContractAddress;
|
|
6301
6307
|
return useCall({
|
|
6302
6308
|
contractInterface: contractInterface8,
|
|
6303
6309
|
contractAddress,
|
|
@@ -6313,7 +6319,7 @@ var contractInterface9 = chunk5GZ7N47F_cjs.GalaxyMember__factory.createInterface
|
|
|
6313
6319
|
var method11 = "getNodeIdAttached";
|
|
6314
6320
|
var useGetNodeIdAttached = (tokenId) => {
|
|
6315
6321
|
const { network } = useVeChainKitConfig();
|
|
6316
|
-
const contractAddress =
|
|
6322
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(network.type).galaxyMemberContractAddress;
|
|
6317
6323
|
return useCall({
|
|
6318
6324
|
contractInterface: contractInterface9,
|
|
6319
6325
|
contractAddress,
|
|
@@ -6328,7 +6334,7 @@ var contractInterface10 = chunk5GZ7N47F_cjs.GalaxyMember__factory.createInterfac
|
|
|
6328
6334
|
var method12 = "MAX_LEVEL";
|
|
6329
6335
|
var useGMMaxLevel = (enabled = true) => {
|
|
6330
6336
|
const { network } = useVeChainKitConfig();
|
|
6331
|
-
const contractAddress =
|
|
6337
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(network.type).galaxyMemberContractAddress;
|
|
6332
6338
|
return useCall({
|
|
6333
6339
|
contractInterface: contractInterface10,
|
|
6334
6340
|
contractAddress,
|
|
@@ -6412,8 +6418,8 @@ var useSelectedGmNft = (userAddress) => {
|
|
|
6412
6418
|
const { xNodeId } = useXNode(userAddress);
|
|
6413
6419
|
const isXNodeAttachedToGM = attachedNodeId === xNodeId;
|
|
6414
6420
|
const isMaxGmLevelReached = !!maxGmLevel && !!gmLevel && Number(gmLevel) === Number(maxGmLevel);
|
|
6415
|
-
const gmImage = gmNftImage?.image || imageData?.image ||
|
|
6416
|
-
const nftName = nftMetadata?.name ||
|
|
6421
|
+
const gmImage = gmNftImage?.image || imageData?.image || chunk2EYSG3VY_cjs.gmNfts[Number(gmLevel) - 1]?.image || chunk2EYSG3VY_cjs.notFoundImage;
|
|
6422
|
+
const nftName = nftMetadata?.name || chunk2EYSG3VY_cjs.gmNfts[Number(gmLevel) - 1]?.name;
|
|
6417
6423
|
const gmName = `${nftName} #${tokenID}`;
|
|
6418
6424
|
return {
|
|
6419
6425
|
gmId: selectedTokenId,
|
|
@@ -6441,7 +6447,7 @@ var method13 = "getB3TRtoUpgrade";
|
|
|
6441
6447
|
var getB3trToUpgradeQueryKey = (tokenId) => getCallKey({ method: method13, keyArgs: [tokenId] });
|
|
6442
6448
|
var useB3trToUpgrade = (tokenId, enabled = true) => {
|
|
6443
6449
|
const { network } = useVeChainKitConfig();
|
|
6444
|
-
const contractAddress =
|
|
6450
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(network.type).galaxyMemberContractAddress;
|
|
6445
6451
|
return useCall({
|
|
6446
6452
|
contractInterface: contractInterface11,
|
|
6447
6453
|
contractAddress,
|
|
@@ -6456,7 +6462,7 @@ var method14 = "getTokensInfoByOwner";
|
|
|
6456
6462
|
var getTokensInfoByOwnerQueryKey = (owner) => getCallKey({ method: method14, keyArgs: [owner] });
|
|
6457
6463
|
var useGetTokensInfoByOwner = (owner, size = 10) => {
|
|
6458
6464
|
const { network } = useVeChainKitConfig();
|
|
6459
|
-
const contractAddress =
|
|
6465
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(network.type).galaxyMemberContractAddress;
|
|
6460
6466
|
const { thor } = dappKitReact.useConnex();
|
|
6461
6467
|
const fetchTokens = async ({ pageParam = 0 }) => {
|
|
6462
6468
|
const functionFragment2 = contractInterface12.getFunction(method14)?.format("json");
|
|
@@ -6488,7 +6494,7 @@ var method15 = "getB3TRdonated";
|
|
|
6488
6494
|
var getB3trDonatedQueryKey = (tokenId) => getCallKey({ method: method15, keyArgs: [tokenId] });
|
|
6489
6495
|
var useB3trDonated = (tokenId, enabled = true) => {
|
|
6490
6496
|
const { network } = useVeChainKitConfig();
|
|
6491
|
-
const contractAddress =
|
|
6497
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(network.type).galaxyMemberContractAddress;
|
|
6492
6498
|
return useCall({
|
|
6493
6499
|
contractInterface: contractInterface13,
|
|
6494
6500
|
contractAddress,
|
|
@@ -6505,7 +6511,7 @@ var method16 = "baseURI";
|
|
|
6505
6511
|
var getGMBaseUriQueryKey = () => getCallKey({ method: "getGMBaseUri", keyArgs: [] });
|
|
6506
6512
|
var useGMBaseUri = () => {
|
|
6507
6513
|
const { network } = useVeChainKitConfig();
|
|
6508
|
-
const contractAddress =
|
|
6514
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(network.type).galaxyMemberContractAddress;
|
|
6509
6515
|
return useCall({
|
|
6510
6516
|
contractInterface: contractInterface14,
|
|
6511
6517
|
contractAddress,
|
|
@@ -6537,7 +6543,7 @@ var getGMLevel = (startingLevel, b3trDonated) => {
|
|
|
6537
6543
|
if (!Number.isInteger(startingLevel) || startingLevel <= 0) {
|
|
6538
6544
|
throw new Error("Starting level must be a positive integer");
|
|
6539
6545
|
}
|
|
6540
|
-
const gmLevelMap = new Map(
|
|
6546
|
+
const gmLevelMap = new Map(chunk2EYSG3VY_cjs.gmNfts.map((gm) => [Number(gm.level), gm]));
|
|
6541
6547
|
const startingGM = gmLevelMap.get(startingLevel);
|
|
6542
6548
|
if (!startingGM) return null;
|
|
6543
6549
|
let finalLevel = startingLevel;
|
|
@@ -6558,7 +6564,7 @@ var xAllocationVotingInterface = chunk5GZ7N47F_cjs.XAllocationVoting__factory.cr
|
|
|
6558
6564
|
var getCurrentAllocationsRoundId = async (thor, networkType) => {
|
|
6559
6565
|
const currentRoundAbi = xAllocationVotingInterface.getFunction("currentRoundId");
|
|
6560
6566
|
if (!currentRoundAbi) throw new Error("currentRoundId function not found");
|
|
6561
|
-
const res = await thor.account(
|
|
6567
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).xAllocationVotingContractAddress).method(currentRoundAbi).call();
|
|
6562
6568
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
6563
6569
|
return res.decoded[0];
|
|
6564
6570
|
};
|
|
@@ -6576,7 +6582,7 @@ var useCurrentAllocationsRoundId = () => {
|
|
|
6576
6582
|
});
|
|
6577
6583
|
};
|
|
6578
6584
|
var getAllocationAmount = async (thor, networkType, roundId) => {
|
|
6579
|
-
const emissionsContract =
|
|
6585
|
+
const emissionsContract = chunk2EYSG3VY_cjs.getConfig(networkType).emissionsContractAddress;
|
|
6580
6586
|
const emissionsInterface = chunk5GZ7N47F_cjs.Emissions__factory.createInterface();
|
|
6581
6587
|
const functionFragmentTreasuryAmount = emissionsInterface.getFunction("getTreasuryAmount").format("json");
|
|
6582
6588
|
const functionFragmentVoteX2EarnAmount = emissionsInterface.getFunction("getVote2EarnAmount").format("json");
|
|
@@ -6614,7 +6620,7 @@ var useAllocationAmount = (roundId) => {
|
|
|
6614
6620
|
});
|
|
6615
6621
|
};
|
|
6616
6622
|
var getHasVotedInRound = async (thor, networkType, roundId, address) => {
|
|
6617
|
-
const xAllocationVotingContract =
|
|
6623
|
+
const xAllocationVotingContract = chunk2EYSG3VY_cjs.getConfig(networkType).xAllocationVotingContractAddress;
|
|
6618
6624
|
const functionFragment2 = chunk5GZ7N47F_cjs.XAllocationVoting__factory.createInterface().getFunction("hasVoted").format("json");
|
|
6619
6625
|
const res = await thor.account(xAllocationVotingContract).method(JSON.parse(functionFragment2)).call(roundId, address);
|
|
6620
6626
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
@@ -6638,7 +6644,7 @@ var RoundState = {
|
|
|
6638
6644
|
};
|
|
6639
6645
|
var getAllocationsRoundState = async (thor, networkType, roundId) => {
|
|
6640
6646
|
if (!roundId) return Promise.reject(new Error("roundId is required"));
|
|
6641
|
-
const xAllocationVotingContract =
|
|
6647
|
+
const xAllocationVotingContract = chunk2EYSG3VY_cjs.getConfig(networkType).xAllocationVotingContractAddress;
|
|
6642
6648
|
const functionFragment2 = xAllocationVotingInterface2.getFunction("state").format("json");
|
|
6643
6649
|
const res = await thor.account(xAllocationVotingContract).method(JSON.parse(functionFragment2)).call(roundId);
|
|
6644
6650
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
@@ -6659,7 +6665,7 @@ var useAllocationsRoundState = (roundId) => {
|
|
|
6659
6665
|
});
|
|
6660
6666
|
};
|
|
6661
6667
|
var getAllocationsRoundsEvents = async (thor, networkType) => {
|
|
6662
|
-
const xAllocationVotingContract =
|
|
6668
|
+
const xAllocationVotingContract = chunk2EYSG3VY_cjs.getConfig(networkType).xAllocationVotingContractAddress;
|
|
6663
6669
|
const allocationCreatedAbi = chunk5GZ7N47F_cjs.XAllocationVoting__factory.createInterface().getEvent("RoundCreated");
|
|
6664
6670
|
if (!allocationCreatedAbi) throw new Error("RoundCreated event not found");
|
|
6665
6671
|
const allocationCreatedEvent = new thorDevkit.abi.Event(
|
|
@@ -6674,7 +6680,7 @@ var getAllocationsRoundsEvents = async (thor, networkType) => {
|
|
|
6674
6680
|
const events = await getAllEvents({
|
|
6675
6681
|
thor,
|
|
6676
6682
|
filterCriteria,
|
|
6677
|
-
nodeUrl:
|
|
6683
|
+
nodeUrl: chunk2EYSG3VY_cjs.getConfig(networkType).nodeUrl
|
|
6678
6684
|
});
|
|
6679
6685
|
const decodedCreatedAllocationEvents = [];
|
|
6680
6686
|
events.forEach((event) => {
|
|
@@ -6744,7 +6750,7 @@ var useAllocationsRound = (roundId) => {
|
|
|
6744
6750
|
const isLoading = currentAllocationId.isLoading || allocationRoundsEvents.isLoading || currentAllocationState.isLoading;
|
|
6745
6751
|
const isError = currentAllocationId.isError || allocationRoundsEvents.isError || currentAllocationState.isError;
|
|
6746
6752
|
const error = currentAllocationId.error || allocationRoundsEvents.error || currentAllocationState.error;
|
|
6747
|
-
const blockTime =
|
|
6753
|
+
const blockTime = chunk2EYSG3VY_cjs.getConfig(network.type).network.blockTime;
|
|
6748
6754
|
const estimatedEndTime = React10.useMemo(() => {
|
|
6749
6755
|
if (!currentAllocationRound) return null;
|
|
6750
6756
|
const endBlock = Number(currentAllocationRound.voteEnd);
|
|
@@ -6792,7 +6798,7 @@ var useCurrentAllocationsRound = () => {
|
|
|
6792
6798
|
var roundEarningsFragment = chunk5GZ7N47F_cjs.XAllocationPool__factory.createInterface().getFunction("roundEarnings").format("json");
|
|
6793
6799
|
var roundEarningsAbi = new thorDevkit.abi.Function(JSON.parse(roundEarningsFragment));
|
|
6794
6800
|
var getXAppRoundEarnings = async (thor, roundId, xAppId, networkType) => {
|
|
6795
|
-
const xAllocationPoolContract =
|
|
6801
|
+
const xAllocationPoolContract = chunk2EYSG3VY_cjs.getConfig(networkType).xAllocationPoolContractAddress;
|
|
6796
6802
|
const functionFragment2 = chunk5GZ7N47F_cjs.XAllocationPool__factory.createInterface().getFunction("roundEarnings").format("json");
|
|
6797
6803
|
const res = await thor.account(xAllocationPoolContract).method(JSON.parse(functionFragment2)).call(roundId, xAppId);
|
|
6798
6804
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
@@ -6840,7 +6846,7 @@ var useMultipleXAppRoundEarnings = (roundId, xAppIds) => {
|
|
|
6840
6846
|
queryFn: () => getRoundXApps(thor, network.type, roundId),
|
|
6841
6847
|
queryKey: getRoundXAppsQueryKey(roundId)
|
|
6842
6848
|
});
|
|
6843
|
-
const xAllocationPoolContract =
|
|
6849
|
+
const xAllocationPoolContract = chunk2EYSG3VY_cjs.getConfig(
|
|
6844
6850
|
network.type
|
|
6845
6851
|
).xAllocationPoolContractAddress;
|
|
6846
6852
|
const xAppsInRound = data.filter((app) => xAppIds.includes(app.id));
|
|
@@ -6876,7 +6882,7 @@ var roundEarningsFragment2 = chunk5GZ7N47F_cjs.XAllocationPool__factory.createIn
|
|
|
6876
6882
|
var roundEarningsAbi2 = new thorDevkit.abi.Function(JSON.parse(roundEarningsFragment2));
|
|
6877
6883
|
var getXAppTotalEarningsClauses = (roundIds, app, networkType) => {
|
|
6878
6884
|
const clauses = roundIds.map((roundId) => ({
|
|
6879
|
-
to:
|
|
6885
|
+
to: chunk2EYSG3VY_cjs.getConfig(networkType).xAllocationPoolContractAddress,
|
|
6880
6886
|
value: 0,
|
|
6881
6887
|
data: roundEarningsAbi2.encode(roundId, app)
|
|
6882
6888
|
}));
|
|
@@ -6947,7 +6953,7 @@ var getAppBalance = async (thor, xAppId, x2EarnRewardsPoolContract) => {
|
|
|
6947
6953
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
6948
6954
|
const original = res.decoded[0];
|
|
6949
6955
|
const scaled = viem.formatEther(original);
|
|
6950
|
-
const formatted = scaled === "0" ? "0" :
|
|
6956
|
+
const formatted = scaled === "0" ? "0" : chunk2EYSG3VY_cjs.humanNumber(scaled);
|
|
6951
6957
|
return {
|
|
6952
6958
|
original,
|
|
6953
6959
|
scaled,
|
|
@@ -6963,7 +6969,7 @@ var getAppBalanceQueryKey = (xAppId) => [
|
|
|
6963
6969
|
var useAppBalance = (xAppId) => {
|
|
6964
6970
|
const { thor } = dappKitReact.useConnex();
|
|
6965
6971
|
const { network } = useVeChainKitConfig();
|
|
6966
|
-
const x2EarnRewardsPoolContract =
|
|
6972
|
+
const x2EarnRewardsPoolContract = chunk2EYSG3VY_cjs.getConfig(
|
|
6967
6973
|
network.type
|
|
6968
6974
|
).x2EarnRewardsPoolContractAddress;
|
|
6969
6975
|
return reactQuery.useQuery({
|
|
@@ -6980,7 +6986,7 @@ var getIsPersonQueryKey = (user) => {
|
|
|
6980
6986
|
};
|
|
6981
6987
|
var useIsPerson = (user) => {
|
|
6982
6988
|
const { network } = useVeChainKitConfig();
|
|
6983
|
-
const veBetterPassportContractAddress =
|
|
6989
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
6984
6990
|
network.type
|
|
6985
6991
|
).veBetterPassportContractAddress;
|
|
6986
6992
|
return useCall({
|
|
@@ -7002,7 +7008,7 @@ var getUserRoundScoreQueryKey = (user, round) => {
|
|
|
7002
7008
|
};
|
|
7003
7009
|
var useUserRoundScore = (address, round) => {
|
|
7004
7010
|
const { network } = useVeChainKitConfig();
|
|
7005
|
-
const veBetterPassportContractAddress =
|
|
7011
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7006
7012
|
network.type
|
|
7007
7013
|
).veBetterPassportContractAddress;
|
|
7008
7014
|
return useCall({
|
|
@@ -7022,7 +7028,7 @@ var getThresholdParticipationScoreQueryKey = () => {
|
|
|
7022
7028
|
};
|
|
7023
7029
|
var useThresholdParticipationScore = () => {
|
|
7024
7030
|
const { network } = useVeChainKitConfig();
|
|
7025
|
-
const veBetterPassportContractAddress =
|
|
7031
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7026
7032
|
network.type
|
|
7027
7033
|
).veBetterPassportContractAddress;
|
|
7028
7034
|
return useCall({
|
|
@@ -7042,7 +7048,7 @@ var getPassportToggleQueryKey = (checkName) => {
|
|
|
7042
7048
|
};
|
|
7043
7049
|
var useIsPassportCheckEnabled = (checkName) => {
|
|
7044
7050
|
const { network } = useVeChainKitConfig();
|
|
7045
|
-
const veBetterPassportContractAddress =
|
|
7051
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7046
7052
|
network.type
|
|
7047
7053
|
).veBetterPassportContractAddress;
|
|
7048
7054
|
return useCall({
|
|
@@ -7062,7 +7068,7 @@ var getParticipationScoreThresholdQueryKey = () => {
|
|
|
7062
7068
|
};
|
|
7063
7069
|
var useParticipationScoreThreshold = () => {
|
|
7064
7070
|
const { network } = useVeChainKitConfig();
|
|
7065
|
-
const veBetterPassportContractAddress =
|
|
7071
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7066
7072
|
network.type
|
|
7067
7073
|
).veBetterPassportContractAddress;
|
|
7068
7074
|
return useCall({
|
|
@@ -7083,7 +7089,7 @@ var getAppSecurityLevelQueryKey = (appId) => {
|
|
|
7083
7089
|
};
|
|
7084
7090
|
var useAppSecurityLevel = (appId) => {
|
|
7085
7091
|
const { network } = useVeChainKitConfig();
|
|
7086
|
-
const contractAddress =
|
|
7092
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7087
7093
|
network.type
|
|
7088
7094
|
).veBetterPassportContractAddress;
|
|
7089
7095
|
return useCall({
|
|
@@ -7127,7 +7133,7 @@ var getIsBlacklistedQueryKey = (address) => {
|
|
|
7127
7133
|
};
|
|
7128
7134
|
var useIsBlacklisted = (address) => {
|
|
7129
7135
|
const { network } = useVeChainKitConfig();
|
|
7130
|
-
const veBetterPassportContractAddress =
|
|
7136
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7131
7137
|
network.type
|
|
7132
7138
|
).veBetterPassportContractAddress;
|
|
7133
7139
|
return useCall({
|
|
@@ -7147,7 +7153,7 @@ var getIsWhitelistedQueryKey = (address) => {
|
|
|
7147
7153
|
};
|
|
7148
7154
|
var useIsWhitelisted = (address) => {
|
|
7149
7155
|
const { network } = useVeChainKitConfig();
|
|
7150
|
-
const veBetterPassportContractAddress =
|
|
7156
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7151
7157
|
network.type
|
|
7152
7158
|
).veBetterPassportContractAddress;
|
|
7153
7159
|
return useCall({
|
|
@@ -7184,7 +7190,7 @@ var getUserBotSignalsQueryKey = (address) => {
|
|
|
7184
7190
|
};
|
|
7185
7191
|
var useUserBotSignals = (address) => {
|
|
7186
7192
|
const { network } = useVeChainKitConfig();
|
|
7187
|
-
const veBetterPassportContractAddress =
|
|
7193
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7188
7194
|
network.type
|
|
7189
7195
|
).veBetterPassportContractAddress;
|
|
7190
7196
|
return useCall({
|
|
@@ -7206,7 +7212,7 @@ var getGetCumulativeScoreWithDecayQueryKey = (user, round) => {
|
|
|
7206
7212
|
};
|
|
7207
7213
|
var useGetCumulativeScoreWithDecay = (user, round) => {
|
|
7208
7214
|
const { network } = useVeChainKitConfig();
|
|
7209
|
-
const veBetterPassportContractAddress =
|
|
7215
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7210
7216
|
network.type
|
|
7211
7217
|
).veBetterPassportContractAddress;
|
|
7212
7218
|
return useCall({
|
|
@@ -7233,7 +7239,7 @@ var getSecurityMultiplierQueryKey = (securityLevel) => {
|
|
|
7233
7239
|
};
|
|
7234
7240
|
var useSecurityMultiplier = (securityLevel) => {
|
|
7235
7241
|
const { network } = useVeChainKitConfig();
|
|
7236
|
-
const veBetterPassportContractAddress =
|
|
7242
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7237
7243
|
network.type
|
|
7238
7244
|
).veBetterPassportContractAddress;
|
|
7239
7245
|
return useCall({
|
|
@@ -7250,7 +7256,7 @@ var getDelegateeQueryKey = (delegator) => {
|
|
|
7250
7256
|
};
|
|
7251
7257
|
var useGetDelegatee = (delegator) => {
|
|
7252
7258
|
const { network } = useVeChainKitConfig();
|
|
7253
|
-
const veBetterPassportContractAddress =
|
|
7259
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7254
7260
|
network.type
|
|
7255
7261
|
).veBetterPassportContractAddress;
|
|
7256
7262
|
return useCall({
|
|
@@ -7272,7 +7278,7 @@ var getDelegatorQueryKey = (delegator) => {
|
|
|
7272
7278
|
};
|
|
7273
7279
|
var useGetDelegator = (delegator) => {
|
|
7274
7280
|
const { network } = useVeChainKitConfig();
|
|
7275
|
-
const veBetterPassportContractAddress =
|
|
7281
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7276
7282
|
network.type
|
|
7277
7283
|
).veBetterPassportContractAddress;
|
|
7278
7284
|
return useCall({
|
|
@@ -7282,7 +7288,7 @@ var useGetDelegator = (delegator) => {
|
|
|
7282
7288
|
args: [delegator],
|
|
7283
7289
|
mapResponse: (response) => {
|
|
7284
7290
|
const delegator2 = response.decoded[0];
|
|
7285
|
-
if (
|
|
7291
|
+
if (chunk2EYSG3VY_cjs.compareAddresses(delegator2, viem.zeroAddress)) return null;
|
|
7286
7292
|
return delegator2;
|
|
7287
7293
|
},
|
|
7288
7294
|
enabled: !!delegator
|
|
@@ -7297,7 +7303,7 @@ var getPendingDelegationsQueryKeyDelegateePOV = (delegatee) => {
|
|
|
7297
7303
|
};
|
|
7298
7304
|
var useGetPendingDelegationsDelegateePOV = (delegatee) => {
|
|
7299
7305
|
const { network } = useVeChainKitConfig();
|
|
7300
|
-
const veBetterPassportContractAddress =
|
|
7306
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7301
7307
|
network.type
|
|
7302
7308
|
).veBetterPassportContractAddress;
|
|
7303
7309
|
return useCall({
|
|
@@ -7319,7 +7325,7 @@ var getPendingDelegationsQueryKeyDelegatorPOV = (delegator) => {
|
|
|
7319
7325
|
};
|
|
7320
7326
|
var useGetPendingDelegationsDelegatorPOV = (delegator) => {
|
|
7321
7327
|
const { network } = useVeChainKitConfig();
|
|
7322
|
-
const veBetterPassportContractAddress =
|
|
7328
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7323
7329
|
network.type
|
|
7324
7330
|
).veBetterPassportContractAddress;
|
|
7325
7331
|
return useCall({
|
|
@@ -7341,7 +7347,7 @@ var getPendingLinkingsQueryKey = (user) => {
|
|
|
7341
7347
|
};
|
|
7342
7348
|
var useGetPendingLinkings = (user) => {
|
|
7343
7349
|
const { network } = useVeChainKitConfig();
|
|
7344
|
-
const veBetterPassportContractAddress =
|
|
7350
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7345
7351
|
network.type
|
|
7346
7352
|
).veBetterPassportContractAddress;
|
|
7347
7353
|
return useCall({
|
|
@@ -7368,7 +7374,7 @@ var getEntitiesLinkedToPassportQueryKey = (passport) => {
|
|
|
7368
7374
|
};
|
|
7369
7375
|
var useGetEntitiesLinkedToPassport = (passport) => {
|
|
7370
7376
|
const { network } = useVeChainKitConfig();
|
|
7371
|
-
const veBetterPassportContractAddress =
|
|
7377
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7372
7378
|
network.type
|
|
7373
7379
|
).veBetterPassportContractAddress;
|
|
7374
7380
|
return useCall({
|
|
@@ -7391,7 +7397,7 @@ var getPassportForEntityQueryKey = (entity) => {
|
|
|
7391
7397
|
};
|
|
7392
7398
|
var useGetPassportForEntity = (entity) => {
|
|
7393
7399
|
const { network } = useVeChainKitConfig();
|
|
7394
|
-
const veBetterPassportContractAddress =
|
|
7400
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7395
7401
|
network.type
|
|
7396
7402
|
).veBetterPassportContractAddress;
|
|
7397
7403
|
return useCall({
|
|
@@ -7415,7 +7421,7 @@ var getIsEntityQueryKey = (address) => {
|
|
|
7415
7421
|
};
|
|
7416
7422
|
var useIsEntity = (address) => {
|
|
7417
7423
|
const { network } = useVeChainKitConfig();
|
|
7418
|
-
const veBetterPassportContractAddress =
|
|
7424
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7419
7425
|
network.type
|
|
7420
7426
|
).veBetterPassportContractAddress;
|
|
7421
7427
|
return useCall({
|
|
@@ -7468,7 +7474,7 @@ var getIsPassportQueryKey = (address) => {
|
|
|
7468
7474
|
};
|
|
7469
7475
|
var useIsPassport = (address) => {
|
|
7470
7476
|
const { network } = useVeChainKitConfig();
|
|
7471
|
-
const veBetterPassportContractAddress =
|
|
7477
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7472
7478
|
network.type
|
|
7473
7479
|
).veBetterPassportContractAddress;
|
|
7474
7480
|
return useCall({
|
|
@@ -7504,7 +7510,7 @@ var getThresholdParticipationScoreAtTimepointQueryKey = (blockNumber) => {
|
|
|
7504
7510
|
};
|
|
7505
7511
|
var useThresholdParticipationScoreAtTimepoint = (blockNumber) => {
|
|
7506
7512
|
const { network } = useVeChainKitConfig();
|
|
7507
|
-
const veBetterPassportContractAddress =
|
|
7513
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7508
7514
|
network.type
|
|
7509
7515
|
).veBetterPassportContractAddress;
|
|
7510
7516
|
return useCall({
|
|
@@ -7526,7 +7532,7 @@ var getIsPersonAtTimepointQueryKey = (user, blockNumber) => {
|
|
|
7526
7532
|
};
|
|
7527
7533
|
var useIsPersonAtTimepoint = (user, blockNumber) => {
|
|
7528
7534
|
const { network } = useVeChainKitConfig();
|
|
7529
|
-
const veBetterPassportContractAddress =
|
|
7535
|
+
const veBetterPassportContractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7530
7536
|
network.type
|
|
7531
7537
|
).veBetterPassportContractAddress;
|
|
7532
7538
|
return useCall({
|
|
@@ -7539,7 +7545,7 @@ var useIsPersonAtTimepoint = (user, blockNumber) => {
|
|
|
7539
7545
|
};
|
|
7540
7546
|
var getRoundReward = async (thor, networkType, address, roundId) => {
|
|
7541
7547
|
const functionFragment2 = chunk5GZ7N47F_cjs.VoterRewards__factory.createInterface().getFunction("getReward").format("json");
|
|
7542
|
-
const contractAddress =
|
|
7548
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(networkType).voterRewardsContractAddress;
|
|
7543
7549
|
const res = await thor.account(contractAddress).method(JSON.parse(functionFragment2)).call(roundId, address);
|
|
7544
7550
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
7545
7551
|
const reward = viem.formatEther(res.decoded[0]);
|
|
@@ -7571,7 +7577,7 @@ var useVotingRewards = (currentRoundId, voter) => {
|
|
|
7571
7577
|
const { thor } = dappKitReact.useConnex();
|
|
7572
7578
|
const queryClient = reactQuery.useQueryClient();
|
|
7573
7579
|
const { network } = useVeChainKitConfig();
|
|
7574
|
-
const contractAddress =
|
|
7580
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(network.type).voterRewardsContractAddress;
|
|
7575
7581
|
const rounds = React10.useMemo(() => {
|
|
7576
7582
|
return Array.from(
|
|
7577
7583
|
{ length: parseInt(currentRoundId ?? "0") - 1 },
|
|
@@ -7626,7 +7632,7 @@ var useVotingRewards = (currentRoundId, voter) => {
|
|
|
7626
7632
|
var voterRewardsInterface2 = chunk5GZ7N47F_cjs.VoterRewards__factory.createInterface();
|
|
7627
7633
|
var buildClaimRoundReward = (roundId, address, networkType) => {
|
|
7628
7634
|
const clause = {
|
|
7629
|
-
to:
|
|
7635
|
+
to: chunk2EYSG3VY_cjs.getConfig(networkType).voterRewardsContractAddress,
|
|
7630
7636
|
value: 0,
|
|
7631
7637
|
data: voterRewardsInterface2.encodeFunctionData("claimReward", [
|
|
7632
7638
|
roundId,
|
|
@@ -7661,7 +7667,7 @@ var method33 = "getNodeManager";
|
|
|
7661
7667
|
var getNodeManagerQueryKey = (nodeId) => getCallKey({ method: method33, keyArgs: [nodeId] });
|
|
7662
7668
|
var useGetNodeManager = (nodeId) => {
|
|
7663
7669
|
const { network } = useVeChainKitConfig();
|
|
7664
|
-
const contractAddress =
|
|
7670
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
7665
7671
|
network.type
|
|
7666
7672
|
).nodeManagementContractAddress;
|
|
7667
7673
|
return useCall({
|
|
@@ -7675,11 +7681,11 @@ var useGetNodeManager = (nodeId) => {
|
|
|
7675
7681
|
var ERC20Interface = chunk5GZ7N47F_cjs.IERC20__factory.createInterface();
|
|
7676
7682
|
var getVeDelegateBalance = async (thor, network, address) => {
|
|
7677
7683
|
const functionFragment2 = ERC20Interface.getFunction("balanceOf").format("json");
|
|
7678
|
-
const res = await thor.account(
|
|
7684
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(network).veDelegateTokenContractAddress).method(JSON.parse(functionFragment2)).call(address);
|
|
7679
7685
|
if (res.reverted) throw new Error("Reverted");
|
|
7680
7686
|
const original = res.decoded[0];
|
|
7681
7687
|
const scaled = ethers.formatEther(original);
|
|
7682
|
-
const formatted = scaled === "0" ? "0" :
|
|
7688
|
+
const formatted = scaled === "0" ? "0" : chunk2EYSG3VY_cjs.humanNumber(scaled);
|
|
7683
7689
|
return {
|
|
7684
7690
|
original,
|
|
7685
7691
|
scaled,
|
|
@@ -7725,7 +7731,7 @@ var useFetchAppInfo = (appIds) => {
|
|
|
7725
7731
|
return Object.fromEntries(
|
|
7726
7732
|
results.map((result, index) => {
|
|
7727
7733
|
const id = normalizedIds[index];
|
|
7728
|
-
const defaultApp =
|
|
7734
|
+
const defaultApp = chunk2EYSG3VY_cjs.DEFAULT_PRIVY_ECOSYSTEM_APPS.find(
|
|
7729
7735
|
(app) => app.id === id
|
|
7730
7736
|
);
|
|
7731
7737
|
return [
|
|
@@ -7789,7 +7795,7 @@ var fetchVechainDomain = async (thor, networkType, addressOrDomain) => {
|
|
|
7789
7795
|
}
|
|
7790
7796
|
if (ethers.isAddress(addressOrDomain)) {
|
|
7791
7797
|
try {
|
|
7792
|
-
const res = await thor.account(
|
|
7798
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).vnsResolverAddress).method(getNamesABI).call([addressOrDomain]);
|
|
7793
7799
|
const domainName = res.decoded.names?.[0];
|
|
7794
7800
|
return {
|
|
7795
7801
|
address: addressOrDomain,
|
|
@@ -7808,7 +7814,7 @@ var fetchVechainDomain = async (thor, networkType, addressOrDomain) => {
|
|
|
7808
7814
|
}
|
|
7809
7815
|
}
|
|
7810
7816
|
try {
|
|
7811
|
-
const res = await thor.account(
|
|
7817
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).vnsResolverAddress).method(getAddressesABI).call([addressOrDomain]);
|
|
7812
7818
|
const domainAddress = res.decoded.addresses?.[0];
|
|
7813
7819
|
if (domainAddress === "0x0000000000000000000000000000000000000000") {
|
|
7814
7820
|
return {
|
|
@@ -7818,7 +7824,7 @@ var fetchVechainDomain = async (thor, networkType, addressOrDomain) => {
|
|
|
7818
7824
|
isPrimaryDomain: false
|
|
7819
7825
|
};
|
|
7820
7826
|
}
|
|
7821
|
-
const primaryDomainRes = await thor.account(
|
|
7827
|
+
const primaryDomainRes = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).vnsResolverAddress).method(getNamesABI).call([domainAddress]);
|
|
7822
7828
|
const primaryDomain = primaryDomainRes.decoded.names?.[0];
|
|
7823
7829
|
return {
|
|
7824
7830
|
address: domainAddress,
|
|
@@ -7855,7 +7861,7 @@ var getEnsRecordExists = async (thor, network, name) => {
|
|
|
7855
7861
|
const labelHash = viem.keccak256(viem.toBytes(name));
|
|
7856
7862
|
const subnode = viem.keccak256(viem.concat([hashedNode, labelHash]));
|
|
7857
7863
|
const functionFragment2 = MockENSInterface.getFunction("recordExists").format("json");
|
|
7858
|
-
const res = await thor.account(
|
|
7864
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(network).vetDomainsContractAddress).method(JSON.parse(functionFragment2)).call(subnode);
|
|
7859
7865
|
if (res.reverted) throw new Error("Reverted");
|
|
7860
7866
|
return res.decoded[0];
|
|
7861
7867
|
};
|
|
@@ -7970,10 +7976,10 @@ var useClaimVeWorldSubdomain = ({
|
|
|
7970
7976
|
if (!subdomain) throw new Error("Invalid subdomain");
|
|
7971
7977
|
const fullDomain = `${subdomain}.${domain}`;
|
|
7972
7978
|
clausesArray.push({
|
|
7973
|
-
to:
|
|
7979
|
+
to: chunk2EYSG3VY_cjs.getConfig(network.type).vetDomainsReverseRegistrarAddress,
|
|
7974
7980
|
value: "0x0",
|
|
7975
7981
|
data: ReverseRegistrarInterface.encodeFunctionData("setName", [""]),
|
|
7976
|
-
comment: `Unsetting your current VeChain nickname of the account ${
|
|
7982
|
+
comment: `Unsetting your current VeChain nickname of the account ${chunk2EYSG3VY_cjs.humanAddress(
|
|
7977
7983
|
account?.address ?? "",
|
|
7978
7984
|
4,
|
|
7979
7985
|
4
|
|
@@ -7982,7 +7988,7 @@ var useClaimVeWorldSubdomain = ({
|
|
|
7982
7988
|
});
|
|
7983
7989
|
if (alreadyOwned) {
|
|
7984
7990
|
clausesArray.push({
|
|
7985
|
-
to:
|
|
7991
|
+
to: chunk2EYSG3VY_cjs.getConfig(network.type).vetDomainsReverseRegistrarAddress,
|
|
7986
7992
|
value: "0x0",
|
|
7987
7993
|
data: ReverseRegistrarInterface.encodeFunctionData("setName", [
|
|
7988
7994
|
fullDomain
|
|
@@ -7995,13 +8001,13 @@ var useClaimVeWorldSubdomain = ({
|
|
|
7995
8001
|
]);
|
|
7996
8002
|
const domainNode = ethers.ethers.namehash(fullDomain);
|
|
7997
8003
|
clausesArray.push({
|
|
7998
|
-
to:
|
|
8004
|
+
to: chunk2EYSG3VY_cjs.getConfig(network.type).vetDomainsPublicResolverAddress,
|
|
7999
8005
|
value: "0x0",
|
|
8000
8006
|
data: PublicResolverInterface.encodeFunctionData("setAddr", [
|
|
8001
8007
|
domainNode,
|
|
8002
8008
|
account?.address || ""
|
|
8003
8009
|
]),
|
|
8004
|
-
comment: `Setting the address for ${fullDomain} to ${
|
|
8010
|
+
comment: `Setting the address for ${fullDomain} to ${chunk2EYSG3VY_cjs.humanAddress(
|
|
8005
8011
|
account?.address ?? "",
|
|
8006
8012
|
4,
|
|
8007
8013
|
4
|
|
@@ -8011,26 +8017,26 @@ var useClaimVeWorldSubdomain = ({
|
|
|
8011
8017
|
} else {
|
|
8012
8018
|
if (isVeWorldDomain(domain)) {
|
|
8013
8019
|
clausesArray.push({
|
|
8014
|
-
to:
|
|
8020
|
+
to: chunk2EYSG3VY_cjs.getConfig(network.type).veWorldSubdomainClaimerContractAddress,
|
|
8015
8021
|
value: "0x0",
|
|
8016
8022
|
data: SubdomainClaimerInterface.encodeFunctionData(
|
|
8017
8023
|
"claim",
|
|
8018
8024
|
[
|
|
8019
8025
|
subdomain,
|
|
8020
|
-
|
|
8026
|
+
chunk2EYSG3VY_cjs.getConfig(network.type).vetDomainsPublicResolverAddress
|
|
8021
8027
|
]
|
|
8022
8028
|
),
|
|
8023
8029
|
comment: `Claim VeChain subdomain: ${subdomain}.${domain}`,
|
|
8024
8030
|
abi: SubdomainClaimerInterface.getFunction("claim")
|
|
8025
8031
|
});
|
|
8026
8032
|
clausesArray.push({
|
|
8027
|
-
to:
|
|
8033
|
+
to: chunk2EYSG3VY_cjs.getConfig(network.type).vetDomainsReverseRegistrarAddress,
|
|
8028
8034
|
value: "0x0",
|
|
8029
8035
|
data: ReverseRegistrarInterface.encodeFunctionData(
|
|
8030
8036
|
"setName",
|
|
8031
8037
|
[subdomain + "." + domain]
|
|
8032
8038
|
),
|
|
8033
|
-
comment: `Set ${subdomain}.${domain} as the VeChain nickname of the account ${
|
|
8039
|
+
comment: `Set ${subdomain}.${domain} as the VeChain nickname of the account ${chunk2EYSG3VY_cjs.humanAddress(
|
|
8034
8040
|
account?.address ?? "",
|
|
8035
8041
|
4,
|
|
8036
8042
|
4
|
|
@@ -8109,7 +8115,7 @@ var useClaimVetDomain = ({
|
|
|
8109
8115
|
if (!domain) throw new Error("Invalid domain");
|
|
8110
8116
|
if (alreadyOwned) {
|
|
8111
8117
|
clausesArray.push({
|
|
8112
|
-
to:
|
|
8118
|
+
to: chunk2EYSG3VY_cjs.getConfig(network.type).vetDomainsReverseRegistrarAddress,
|
|
8113
8119
|
value: "0x0",
|
|
8114
8120
|
data: ReverseRegistrarInterface2.encodeFunctionData("setName", [
|
|
8115
8121
|
domain
|
|
@@ -8122,13 +8128,13 @@ var useClaimVetDomain = ({
|
|
|
8122
8128
|
]);
|
|
8123
8129
|
const domainNode = ethers.ethers.namehash(domain);
|
|
8124
8130
|
clausesArray.push({
|
|
8125
|
-
to:
|
|
8131
|
+
to: chunk2EYSG3VY_cjs.getConfig(network.type).vetDomainsPublicResolverAddress,
|
|
8126
8132
|
value: "0x0",
|
|
8127
8133
|
data: PublicResolverInterface.encodeFunctionData("setAddr", [
|
|
8128
8134
|
domainNode,
|
|
8129
8135
|
account?.address || ""
|
|
8130
8136
|
]),
|
|
8131
|
-
comment: `Setting the address for ${domain} to ${
|
|
8137
|
+
comment: `Setting the address for ${domain} to ${chunk2EYSG3VY_cjs.humanAddress(
|
|
8132
8138
|
account?.address ?? "",
|
|
8133
8139
|
4,
|
|
8134
8140
|
4
|
|
@@ -8185,7 +8191,7 @@ var method34 = "isDomainProtected";
|
|
|
8185
8191
|
var getIsDomainProtectedQueryKey = (domain) => getCallKey({ method: method34, keyArgs: [domain] });
|
|
8186
8192
|
var useIsDomainProtected = (domain, enabled = true) => {
|
|
8187
8193
|
const { network } = useVeChainKitConfig();
|
|
8188
|
-
const contractAddress =
|
|
8194
|
+
const contractAddress = chunk2EYSG3VY_cjs.getConfig(
|
|
8189
8195
|
network.type
|
|
8190
8196
|
).veWorldSubdomainClaimerContractAddress;
|
|
8191
8197
|
return useCall({
|
|
@@ -8205,7 +8211,7 @@ var DomainsResponseSchema = zod.z.object({
|
|
|
8205
8211
|
});
|
|
8206
8212
|
var getDomainsOfAddress = async (networkType, address, parentDomain) => {
|
|
8207
8213
|
if (!address) throw new Error("Address is required");
|
|
8208
|
-
const graphQlIndexerUrl =
|
|
8214
|
+
const graphQlIndexerUrl = chunk2EYSG3VY_cjs.getConfig(networkType).graphQlIndexerUrl;
|
|
8209
8215
|
const whereCondition = parentDomain ? `{owner: "${address.toLowerCase()}", parent_: {name: "${parentDomain}"}}` : `{owner: "${address.toLowerCase()}"}`;
|
|
8210
8216
|
const query = `query Registrations {
|
|
8211
8217
|
domains(
|
|
@@ -8266,7 +8272,7 @@ var getAvatarLegacy = async (networkType, nodeUrl, name) => {
|
|
|
8266
8272
|
body: JSON.stringify({
|
|
8267
8273
|
clauses: [
|
|
8268
8274
|
{
|
|
8269
|
-
to:
|
|
8275
|
+
to: chunk2EYSG3VY_cjs.getConfig(networkType).vetDomainsContractAddress,
|
|
8270
8276
|
data: nameInterface.encodeFunctionData("resolver", [
|
|
8271
8277
|
node
|
|
8272
8278
|
])
|
|
@@ -8324,7 +8330,7 @@ var getAvatarLegacyQueryKey = (name, networkType) => ["VECHAIN_KIT", "VET_DOMAIN
|
|
|
8324
8330
|
async function parseAvatarRecord(record, networkType, nodeUrl) {
|
|
8325
8331
|
try {
|
|
8326
8332
|
if (record.startsWith("http") || record.startsWith("ipfs://") || record.startsWith("ar://")) {
|
|
8327
|
-
return
|
|
8333
|
+
return chunk2EYSG3VY_cjs.convertUriToUrl(record, networkType) || null;
|
|
8328
8334
|
}
|
|
8329
8335
|
const match = record.match(
|
|
8330
8336
|
/eip155:(\d+)\/(?:erc721|erc1155):([^/]+)\/(\d+)/
|
|
@@ -8365,7 +8371,7 @@ async function parseAvatarRecord(record, networkType, nodeUrl) {
|
|
|
8365
8371
|
console.error("Failed to decode avatar data:", e);
|
|
8366
8372
|
tokenUri = ethers.toUtf8String(data);
|
|
8367
8373
|
}
|
|
8368
|
-
tokenUri =
|
|
8374
|
+
tokenUri = chunk2EYSG3VY_cjs.convertUriToUrl(tokenUri, networkType) || tokenUri;
|
|
8369
8375
|
if (isErc1155) {
|
|
8370
8376
|
tokenUri = tokenUri.replace(
|
|
8371
8377
|
"{id}",
|
|
@@ -8383,7 +8389,7 @@ async function parseAvatarRecord(record, networkType, nodeUrl) {
|
|
|
8383
8389
|
console.error("No image URL in metadata");
|
|
8384
8390
|
return null;
|
|
8385
8391
|
}
|
|
8386
|
-
return
|
|
8392
|
+
return chunk2EYSG3VY_cjs.convertUriToUrl(imageUrl, networkType) || imageUrl;
|
|
8387
8393
|
}
|
|
8388
8394
|
return null;
|
|
8389
8395
|
} catch (error) {
|
|
@@ -8393,7 +8399,7 @@ async function parseAvatarRecord(record, networkType, nodeUrl) {
|
|
|
8393
8399
|
}
|
|
8394
8400
|
var useGetAvatarLegacy = (name) => {
|
|
8395
8401
|
const { network } = useVeChainKitConfig();
|
|
8396
|
-
const nodeUrl = network.nodeUrl ??
|
|
8402
|
+
const nodeUrl = network.nodeUrl ?? chunk2EYSG3VY_cjs.getConfig(network.type).nodeUrl;
|
|
8397
8403
|
const avatarQuery = reactQuery.useQuery({
|
|
8398
8404
|
queryKey: getAvatarLegacyQueryKey(name ?? "", network.type),
|
|
8399
8405
|
queryFn: async () => {
|
|
@@ -8424,7 +8430,7 @@ var getAvatar = async (name, network) => {
|
|
|
8424
8430
|
var fetchAvatar = async (name, network) => {
|
|
8425
8431
|
try {
|
|
8426
8432
|
const response = await fetch(
|
|
8427
|
-
`${
|
|
8433
|
+
`${chunk2EYSG3VY_cjs.getConfig(network.type).vetDomainAvatarUrl}/${name}`
|
|
8428
8434
|
);
|
|
8429
8435
|
if (response.ok) {
|
|
8430
8436
|
return response.blob();
|
|
@@ -8435,7 +8441,7 @@ var fetchAvatar = async (name, network) => {
|
|
|
8435
8441
|
return null;
|
|
8436
8442
|
};
|
|
8437
8443
|
var fetchAvatarDirectly = async (name, network) => {
|
|
8438
|
-
const nodeUrl = network.nodeUrl ??
|
|
8444
|
+
const nodeUrl = network.nodeUrl ?? chunk2EYSG3VY_cjs.getConfig(network.type).nodeUrl;
|
|
8439
8445
|
if (!nodeUrl) return null;
|
|
8440
8446
|
const avatar = await getAvatarLegacy(network.type, nodeUrl, name);
|
|
8441
8447
|
if (!avatar) return null;
|
|
@@ -8476,7 +8482,7 @@ var getTextRecords = async (nodeUrl, network, domain) => {
|
|
|
8476
8482
|
body: JSON.stringify({
|
|
8477
8483
|
clauses: [
|
|
8478
8484
|
{
|
|
8479
|
-
to:
|
|
8485
|
+
to: chunk2EYSG3VY_cjs.getConfig(network).vetDomainsContractAddress,
|
|
8480
8486
|
data: nameInterface2.encodeFunctionData("resolver", [
|
|
8481
8487
|
node
|
|
8482
8488
|
])
|
|
@@ -8498,7 +8504,7 @@ var getTextRecords = async (nodeUrl, network, domain) => {
|
|
|
8498
8504
|
"content-type": "application/json"
|
|
8499
8505
|
},
|
|
8500
8506
|
body: JSON.stringify({
|
|
8501
|
-
clauses:
|
|
8507
|
+
clauses: chunk2EYSG3VY_cjs.ENS_TEXT_RECORDS.map((key) => ({
|
|
8502
8508
|
to: resolverAddress,
|
|
8503
8509
|
data: nameInterface2.encodeFunctionData("text", [node, key])
|
|
8504
8510
|
}))
|
|
@@ -8514,11 +8520,11 @@ var getTextRecords = async (nodeUrl, network, domain) => {
|
|
|
8514
8520
|
data
|
|
8515
8521
|
)[0];
|
|
8516
8522
|
if (value) {
|
|
8517
|
-
acc[
|
|
8523
|
+
acc[chunk2EYSG3VY_cjs.ENS_TEXT_RECORDS[index]] = value;
|
|
8518
8524
|
}
|
|
8519
8525
|
} catch (error) {
|
|
8520
8526
|
console.error(
|
|
8521
|
-
`Failed to decode text record for ${
|
|
8527
|
+
`Failed to decode text record for ${chunk2EYSG3VY_cjs.ENS_TEXT_RECORDS[index]}:`,
|
|
8522
8528
|
error
|
|
8523
8529
|
);
|
|
8524
8530
|
}
|
|
@@ -8535,7 +8541,7 @@ var getTextRecords = async (nodeUrl, network, domain) => {
|
|
|
8535
8541
|
var getTextRecordsQueryKey = (domain, network) => ["VECHAIN_KIT_TEXT_RECORDS", domain, network];
|
|
8536
8542
|
var useGetTextRecords = (domain) => {
|
|
8537
8543
|
const { network } = useVeChainKitConfig();
|
|
8538
|
-
const nodeUrl = network.nodeUrl ??
|
|
8544
|
+
const nodeUrl = network.nodeUrl ?? chunk2EYSG3VY_cjs.getConfig(network.type).nodeUrl;
|
|
8539
8545
|
return reactQuery.useQuery({
|
|
8540
8546
|
queryKey: getTextRecordsQueryKey(domain, network.type),
|
|
8541
8547
|
queryFn: () => getTextRecords(nodeUrl, network.type, domain),
|
|
@@ -8835,7 +8841,7 @@ var getResolverAddress = async (nodeUrl, network, domain) => {
|
|
|
8835
8841
|
body: JSON.stringify({
|
|
8836
8842
|
clauses: [
|
|
8837
8843
|
{
|
|
8838
|
-
to:
|
|
8844
|
+
to: chunk2EYSG3VY_cjs.getConfig(network).vetDomainsContractAddress,
|
|
8839
8845
|
data: nameInterface4.encodeFunctionData("resolver", [node])
|
|
8840
8846
|
}
|
|
8841
8847
|
]
|
|
@@ -8856,7 +8862,7 @@ var getResolverAddressQueryKey = (domain) => [
|
|
|
8856
8862
|
];
|
|
8857
8863
|
var useGetResolverAddress = (domain) => {
|
|
8858
8864
|
const { network } = useVeChainKitConfig();
|
|
8859
|
-
const nodeUrl = network.nodeUrl ??
|
|
8865
|
+
const nodeUrl = network.nodeUrl ?? chunk2EYSG3VY_cjs.getConfig(network.type).nodeUrl;
|
|
8860
8866
|
return reactQuery.useQuery({
|
|
8861
8867
|
queryKey: getResolverAddressQueryKey(domain),
|
|
8862
8868
|
queryFn: () => getResolverAddress(nodeUrl, network.type, domain),
|
|
@@ -8876,12 +8882,12 @@ var useGetAvatarOfAddress = (address) => {
|
|
|
8876
8882
|
return reactQuery.useQuery({
|
|
8877
8883
|
queryKey: getAvatarOfAddressQueryKey(address),
|
|
8878
8884
|
queryFn: async () => {
|
|
8879
|
-
if (!address) return
|
|
8885
|
+
if (!address) return chunk2EYSG3VY_cjs.getPicassoImage(address ?? "");
|
|
8880
8886
|
const domains = await domainsQuery.refetch();
|
|
8881
|
-
if (!domains.data?.domain) return
|
|
8887
|
+
if (!domains.data?.domain) return chunk2EYSG3VY_cjs.getPicassoImage(address);
|
|
8882
8888
|
if (domains.data.domain && avatarQuery.data)
|
|
8883
8889
|
return avatarQuery.data;
|
|
8884
|
-
return
|
|
8890
|
+
return chunk2EYSG3VY_cjs.getPicassoImage(address);
|
|
8885
8891
|
},
|
|
8886
8892
|
enabled: !!address && domainsQuery.isSuccess && (primaryDomain ? avatarQuery.isSuccess : true)
|
|
8887
8893
|
});
|
|
@@ -8897,10 +8903,10 @@ var useUnsetDomain = ({
|
|
|
8897
8903
|
const buildClauses = React10.useCallback(async () => {
|
|
8898
8904
|
const clausesArray = [];
|
|
8899
8905
|
clausesArray.push({
|
|
8900
|
-
to:
|
|
8906
|
+
to: chunk2EYSG3VY_cjs.getConfig(network.type).vetDomainsReverseRegistrarAddress,
|
|
8901
8907
|
value: "0x0",
|
|
8902
8908
|
data: ReverseRegistrarInterface3.encodeFunctionData("setName", [""]),
|
|
8903
|
-
comment: `Unsetting your current VeChain nickname of the account ${
|
|
8909
|
+
comment: `Unsetting your current VeChain nickname of the account ${chunk2EYSG3VY_cjs.humanAddress(
|
|
8904
8910
|
account?.address ?? "",
|
|
8905
8911
|
4,
|
|
8906
8912
|
4
|
|
@@ -8943,7 +8949,7 @@ var useUnsetDomain = ({
|
|
|
8943
8949
|
};
|
|
8944
8950
|
var useTokenBalances = ({ address = "" }) => {
|
|
8945
8951
|
const { network } = useVeChainKitConfig();
|
|
8946
|
-
const config =
|
|
8952
|
+
const config = chunk2EYSG3VY_cjs.getConfig(network.type);
|
|
8947
8953
|
const { data: vetData, isLoading: vetLoading } = useAccountBalance(address);
|
|
8948
8954
|
const { data: b3trBalance, isLoading: b3trLoading } = useGetB3trBalance(address);
|
|
8949
8955
|
const { data: vot3Balance, isLoading: vot3Loading } = useGetVot3Balance(address);
|
|
@@ -9022,7 +9028,7 @@ var useTokenBalances = ({ address = "" }) => {
|
|
|
9022
9028
|
};
|
|
9023
9029
|
var useTokenPrices = () => {
|
|
9024
9030
|
const { network } = useVeChainKitConfig();
|
|
9025
|
-
const config =
|
|
9031
|
+
const config = chunk2EYSG3VY_cjs.getConfig(network.type);
|
|
9026
9032
|
const { data: vetUsdPrice, isLoading: vetUsdPriceLoading } = useGetTokenUsdPrice("VET");
|
|
9027
9033
|
const { data: vthoUsdPrice, isLoading: vthoUsdPriceLoading } = useGetTokenUsdPrice("VTHO");
|
|
9028
9034
|
const { data: b3trUsdPrice, isLoading: b3trUsdPriceLoading } = useGetTokenUsdPrice("B3TR");
|
|
@@ -9071,22 +9077,16 @@ var useTokenPrices = () => {
|
|
|
9071
9077
|
isLoading
|
|
9072
9078
|
};
|
|
9073
9079
|
};
|
|
9074
|
-
|
|
9075
|
-
// src/hooks/api/wallet/useCurrency.ts
|
|
9080
|
+
var STORAGE_KEY = "vechain_kit_currency";
|
|
9076
9081
|
var allCurrencies = ["usd", "eur", "gbp"];
|
|
9077
9082
|
var useCurrency = () => {
|
|
9078
|
-
const { currentCurrency,
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
return;
|
|
9083
|
-
}
|
|
9084
|
-
setCurrentCurrency(newCurrency);
|
|
9085
|
-
};
|
|
9083
|
+
const { currentCurrency, setCurrency } = useVeChainKitConfig();
|
|
9084
|
+
React10.useEffect(() => {
|
|
9085
|
+
chunk2EYSG3VY_cjs.setLocalStorageItem(STORAGE_KEY, currentCurrency);
|
|
9086
|
+
}, [currentCurrency]);
|
|
9086
9087
|
return {
|
|
9087
9088
|
currentCurrency,
|
|
9088
|
-
allCurrencies
|
|
9089
|
-
changeCurrency
|
|
9089
|
+
allCurrencies
|
|
9090
9090
|
};
|
|
9091
9091
|
};
|
|
9092
9092
|
|
|
@@ -9213,7 +9213,7 @@ var vechain = viem.defineChain({
|
|
|
9213
9213
|
});
|
|
9214
9214
|
var vechainConnector = () => {
|
|
9215
9215
|
return rainbowKit.toPrivyWalletConnector({
|
|
9216
|
-
id:
|
|
9216
|
+
id: chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID,
|
|
9217
9217
|
name: "VeChain",
|
|
9218
9218
|
iconUrl: "https://imagedelivery.net/oHBRUd2clqykxgDWmeAyLg/661dd77c-2f9d-40e7-baa1-f4e24fd7bf00/icon",
|
|
9219
9219
|
smartWalletMode: false
|
|
@@ -9268,7 +9268,7 @@ var usePrivyCrossAppSdk = () => {
|
|
|
9268
9268
|
setIsConnecting(true);
|
|
9269
9269
|
setConnectionError(null);
|
|
9270
9270
|
const connector = connectors.find(
|
|
9271
|
-
(c) => c.id === (appID ||
|
|
9271
|
+
(c) => c.id === (appID || chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID)
|
|
9272
9272
|
);
|
|
9273
9273
|
if (!connector) {
|
|
9274
9274
|
throw new Error("Connector not found");
|
|
@@ -9330,7 +9330,7 @@ var useWalletMetadata = (address, networkType) => {
|
|
|
9330
9330
|
const { data: domain, isLoading: isLoadingVechainDomain } = useVechainDomain(address ?? "");
|
|
9331
9331
|
const { data: avatar, isLoading: isLoadingMetadata } = useGetAvatarOfAddress(address ?? "");
|
|
9332
9332
|
const { data: textRecords, isLoading: isLoadingRecords } = useGetTextRecords(domain?.domain ?? "");
|
|
9333
|
-
const headerUrl = textRecords?.header ?
|
|
9333
|
+
const headerUrl = textRecords?.header ? chunk2EYSG3VY_cjs.convertUriToUrl(textRecords.header, networkType) : null;
|
|
9334
9334
|
return {
|
|
9335
9335
|
domain: domain?.domain,
|
|
9336
9336
|
image: avatar,
|
|
@@ -9362,7 +9362,7 @@ var useWallet = () => {
|
|
|
9362
9362
|
const isConnectedWithDappKit = !!dappKitAccount;
|
|
9363
9363
|
const isConnectedWithSocialLogin = authenticated && !!user;
|
|
9364
9364
|
const isConnectedWithPrivy = isConnectedWithSocialLogin || isConnectedWithCrossApp;
|
|
9365
|
-
const isConnectedWithVeChain = isConnectedWithSocialLogin && privy?.appId ===
|
|
9365
|
+
const isConnectedWithVeChain = isConnectedWithSocialLogin && privy?.appId === chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID || isConnectedWithCrossApp && connectionCache?.ecosystemApp?.appId === chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID;
|
|
9366
9366
|
const isLoading = isConnectingWithCrossApp || isReconnectingWithCrossApp || isLoadingLoginOAuth || !ready;
|
|
9367
9367
|
const [isConnected, setIsConnected] = React10.useState(false);
|
|
9368
9368
|
const connectionSource = isConnectedWithCrossApp ? {
|
|
@@ -9427,7 +9427,7 @@ var useWallet = () => {
|
|
|
9427
9427
|
const { data: smartAccountVersion } = useSmartAccountVersion(
|
|
9428
9428
|
smartAccount?.address ?? ""
|
|
9429
9429
|
);
|
|
9430
|
-
const hasActiveSmartAccount = !!smartAccount?.address && !!account?.address &&
|
|
9430
|
+
const hasActiveSmartAccount = !!smartAccount?.address && !!account?.address && chunk2EYSG3VY_cjs.compareAddresses(smartAccount?.address, account?.address);
|
|
9431
9431
|
const disconnect = React10.useCallback(async () => {
|
|
9432
9432
|
try {
|
|
9433
9433
|
setIsConnected(false);
|
|
@@ -9551,17 +9551,17 @@ var useCustomTokens = () => {
|
|
|
9551
9551
|
};
|
|
9552
9552
|
const isTokenIncluded = (address) => {
|
|
9553
9553
|
return customTokens.some(
|
|
9554
|
-
(t) =>
|
|
9554
|
+
(t) => chunk2EYSG3VY_cjs.compareAddresses(t.address, address)
|
|
9555
9555
|
);
|
|
9556
9556
|
};
|
|
9557
9557
|
const isDefaultToken = (address) => {
|
|
9558
9558
|
const contractAddresses = {
|
|
9559
9559
|
vet: "0x",
|
|
9560
9560
|
// VET has no contract address since it's the native token
|
|
9561
|
-
vtho:
|
|
9562
|
-
b3tr:
|
|
9563
|
-
vot3:
|
|
9564
|
-
veDelegate:
|
|
9561
|
+
vtho: chunk2EYSG3VY_cjs.getConfig(network.type).vthoContractAddress,
|
|
9562
|
+
b3tr: chunk2EYSG3VY_cjs.getConfig(network.type).b3trContractAddress,
|
|
9563
|
+
vot3: chunk2EYSG3VY_cjs.getConfig(network.type).vot3ContractAddress,
|
|
9564
|
+
veDelegate: chunk2EYSG3VY_cjs.getConfig(network.type).veDelegate
|
|
9565
9565
|
};
|
|
9566
9566
|
return Object.values(contractAddresses).includes(address);
|
|
9567
9567
|
};
|
|
@@ -9656,15 +9656,33 @@ var useAccountBalance = (address) => {
|
|
|
9656
9656
|
return reactQuery.useQuery({
|
|
9657
9657
|
queryKey: getAccountBalanceQueryKey(address),
|
|
9658
9658
|
queryFn: () => getAccountBalance(thor, address),
|
|
9659
|
-
enabled: !!address &&
|
|
9659
|
+
enabled: !!address && chunk2EYSG3VY_cjs.isValidAddress(address),
|
|
9660
9660
|
refetchInterval: 1e4
|
|
9661
9661
|
});
|
|
9662
9662
|
};
|
|
9663
9663
|
|
|
9664
|
+
// src/hooks/api/wallet/useCurrentLanguage.ts
|
|
9665
|
+
var useCurrentLanguage = () => {
|
|
9666
|
+
const { currentLanguage, setLanguage } = useVeChainKitConfig();
|
|
9667
|
+
return {
|
|
9668
|
+
currentLanguage,
|
|
9669
|
+
setLanguage
|
|
9670
|
+
};
|
|
9671
|
+
};
|
|
9672
|
+
|
|
9673
|
+
// src/hooks/api/wallet/useCurrentCurrency.ts
|
|
9674
|
+
var useCurrentCurrency = () => {
|
|
9675
|
+
const { currentCurrency, setCurrency } = useVeChainKitConfig();
|
|
9676
|
+
return {
|
|
9677
|
+
currentCurrency,
|
|
9678
|
+
setCurrency
|
|
9679
|
+
};
|
|
9680
|
+
};
|
|
9681
|
+
|
|
9664
9682
|
// src/hooks/api/utility/useGetNodeUrl.ts
|
|
9665
9683
|
var useGetNodeUrl = () => {
|
|
9666
9684
|
const { network } = useVeChainKitConfig();
|
|
9667
|
-
return network.nodeUrl ??
|
|
9685
|
+
return network.nodeUrl ?? chunk2EYSG3VY_cjs.getConfig(network.type).nodeUrl;
|
|
9668
9686
|
};
|
|
9669
9687
|
|
|
9670
9688
|
// src/hooks/api/utility/useGetChainId.ts
|
|
@@ -9692,7 +9710,7 @@ var getCustomTokenBalance = async (thor, token, address) => {
|
|
|
9692
9710
|
if (res.reverted) throw new Error("Reverted");
|
|
9693
9711
|
const original = res.decoded[0];
|
|
9694
9712
|
const scaled = viem.formatEther(original);
|
|
9695
|
-
const formatted = scaled === "0" ? "0" :
|
|
9713
|
+
const formatted = scaled === "0" ? "0" : chunk2EYSG3VY_cjs.humanNumber(scaled);
|
|
9696
9714
|
return {
|
|
9697
9715
|
...token,
|
|
9698
9716
|
original,
|
|
@@ -9928,7 +9946,7 @@ var useAppHubApps = () => {
|
|
|
9928
9946
|
};
|
|
9929
9947
|
var getNFTMetadataUri = async (networkType, thor, tokenID) => {
|
|
9930
9948
|
if (!tokenID) return Promise.reject(new Error("tokenID not provided"));
|
|
9931
|
-
const galaxyMemberContract =
|
|
9949
|
+
const galaxyMemberContract = chunk2EYSG3VY_cjs.getConfig(networkType).galaxyMemberContractAddress;
|
|
9932
9950
|
const functionFragment2 = chunk5GZ7N47F_cjs.GalaxyMember__factory.createInterface().getFunction("tokenURI").format("json");
|
|
9933
9951
|
const res = await thor.account(galaxyMemberContract).method(JSON.parse(functionFragment2)).call(tokenID);
|
|
9934
9952
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
@@ -9992,7 +10010,7 @@ var getAccountAddress = async (thor, ownerAddress, networkType) => {
|
|
|
9992
10010
|
const functionFragment2 = SimpleAccountFactoryInterface.getFunction("getAccountAddress").format(
|
|
9993
10011
|
"json"
|
|
9994
10012
|
);
|
|
9995
|
-
const res = await thor.account(
|
|
10013
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).accountFactoryAddress).method(JSON.parse(functionFragment2)).call(ownerAddress);
|
|
9996
10014
|
if (res.reverted) throw new Error("Reverted");
|
|
9997
10015
|
return res.decoded[0];
|
|
9998
10016
|
};
|
|
@@ -10018,7 +10036,7 @@ var getUpgradeRequiredForAccount = async (thor, contractAddress, targetVersion,
|
|
|
10018
10036
|
const functionFragment2 = SimpleAccountFactoryInterface2.getFunction(
|
|
10019
10037
|
"upgradeRequiredForAccount"
|
|
10020
10038
|
).format("json");
|
|
10021
|
-
const res = await thor.account(
|
|
10039
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).accountFactoryAddress).method(JSON.parse(functionFragment2)).call(contractAddress, targetVersion);
|
|
10022
10040
|
if (res.reverted) throw new Error("Reverted");
|
|
10023
10041
|
return res.decoded[0];
|
|
10024
10042
|
};
|
|
@@ -10073,7 +10091,7 @@ var getAccountImplementationAddress = async (thor, version, networkType) => {
|
|
|
10073
10091
|
default:
|
|
10074
10092
|
throw new Error("Invalid version, must be between 1 and 3");
|
|
10075
10093
|
}
|
|
10076
|
-
const res = await thor.account(
|
|
10094
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).accountFactoryAddress).method(JSON.parse(functionFragment2)).call();
|
|
10077
10095
|
if (res.reverted) throw new Error("Reverted");
|
|
10078
10096
|
return res.decoded[0];
|
|
10079
10097
|
};
|
|
@@ -10104,7 +10122,7 @@ var getHasV1SmartAccount = async (thor, ownerAddress, networkType) => {
|
|
|
10104
10122
|
const functionFragment2 = SimpleAccountFactoryInterface4.getFunction("hasLegacyAccount").format(
|
|
10105
10123
|
"json"
|
|
10106
10124
|
);
|
|
10107
|
-
const res = await thor.account(
|
|
10125
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).accountFactoryAddress).method(JSON.parse(functionFragment2)).call(ownerAddress);
|
|
10108
10126
|
if (res.reverted) throw new Error("Reverted");
|
|
10109
10127
|
return res.decoded[0];
|
|
10110
10128
|
};
|
|
@@ -10129,7 +10147,7 @@ var getUpgradeRequired = async (thor, accountAddress, ownerAddress, targetVersio
|
|
|
10129
10147
|
const functionFragment2 = SimpleAccountFactoryInterface5.getFunction("upgradeRequired").format(
|
|
10130
10148
|
"json"
|
|
10131
10149
|
);
|
|
10132
|
-
const res = await thor.account(
|
|
10150
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).accountFactoryAddress).method(JSON.parse(functionFragment2)).call(accountAddress, ownerAddress, targetVersion);
|
|
10133
10151
|
if (res.reverted) throw new Error("Reverted");
|
|
10134
10152
|
return res.decoded[0];
|
|
10135
10153
|
};
|
|
@@ -10168,7 +10186,7 @@ var getAccountVersion = async (thor, accountAddress, ownerAddress, networkType)
|
|
|
10168
10186
|
const functionFragment2 = SimpleAccountFactoryInterface6.getFunction("getAccountVersion").format(
|
|
10169
10187
|
"json"
|
|
10170
10188
|
);
|
|
10171
|
-
const res = await thor.account(
|
|
10189
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).accountFactoryAddress).method(JSON.parse(functionFragment2)).call(accountAddress, ownerAddress);
|
|
10172
10190
|
if (res.reverted) throw new Error("Reverted");
|
|
10173
10191
|
return {
|
|
10174
10192
|
version: res.decoded[0],
|
|
@@ -10203,7 +10221,7 @@ var getCurrentAccountImplementationVersion = async (thor, networkType) => {
|
|
|
10203
10221
|
const functionFragment2 = SimpleAccountFactoryInterface7.getFunction(
|
|
10204
10222
|
"currentAccountImplementationVersion"
|
|
10205
10223
|
).format("json");
|
|
10206
|
-
const res = await thor.account(
|
|
10224
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).accountFactoryAddress).method(JSON.parse(functionFragment2)).call();
|
|
10207
10225
|
if (res.reverted) throw new Error("Reverted");
|
|
10208
10226
|
return parseInt(res.decoded[0]);
|
|
10209
10227
|
};
|
|
@@ -10228,7 +10246,7 @@ var getSmartAccount = async (thor, network, ownerAddress) => {
|
|
|
10228
10246
|
return { address: void 0 };
|
|
10229
10247
|
}
|
|
10230
10248
|
const account = await thor.contracts.executeCall(
|
|
10231
|
-
|
|
10249
|
+
chunk2EYSG3VY_cjs.getConfig(network).accountFactoryAddress,
|
|
10232
10250
|
sdkCore.ABIContract.ofAbi(chunkEESC6JDT_cjs.SimpleAccountFactoryABI).getFunction(
|
|
10233
10251
|
"getAccountAddress"
|
|
10234
10252
|
),
|
|
@@ -10446,7 +10464,7 @@ var useUpgradeSmartAccount = ({
|
|
|
10446
10464
|
const { refresh: refreshSmartAccountQueries } = useRefreshSmartAccountQueries();
|
|
10447
10465
|
const { data: newImplementationAddress } = useAccountImplementationAddress(targetVersion);
|
|
10448
10466
|
const buildClauses = React10.useCallback(async () => {
|
|
10449
|
-
if (!smartAccountAddress || !
|
|
10467
|
+
if (!smartAccountAddress || !chunk2EYSG3VY_cjs.isValidAddress(smartAccountAddress)) {
|
|
10450
10468
|
throw new Error("Invalid smart account address");
|
|
10451
10469
|
}
|
|
10452
10470
|
if (!newImplementationAddress) {
|
|
@@ -10477,7 +10495,7 @@ var useUpgradeSmartAccount = ({
|
|
|
10477
10495
|
const result = useSendTransaction({
|
|
10478
10496
|
privyUIOptions: {
|
|
10479
10497
|
title: "Upgrade Smart Account",
|
|
10480
|
-
description: `Upgrading your account at ${
|
|
10498
|
+
description: `Upgrading your account at ${chunk2EYSG3VY_cjs.humanAddress(
|
|
10481
10499
|
smartAccountAddress
|
|
10482
10500
|
)} to version ${targetVersion}`,
|
|
10483
10501
|
buttonText: "Sign to continue"
|
|
@@ -10503,7 +10521,7 @@ var getErc20Balance = async (thor, tokenAddress, address) => {
|
|
|
10503
10521
|
if (res.reverted) throw new Error("Reverted");
|
|
10504
10522
|
const original = res.decoded[0];
|
|
10505
10523
|
const scaled = ethers.formatEther(original);
|
|
10506
|
-
const formatted = scaled === "0" ? "0" :
|
|
10524
|
+
const formatted = scaled === "0" ? "0" : chunk2EYSG3VY_cjs.humanNumber(scaled);
|
|
10507
10525
|
return {
|
|
10508
10526
|
original,
|
|
10509
10527
|
scaled,
|
|
@@ -11383,7 +11401,7 @@ var AccountDetailsButton = ({
|
|
|
11383
11401
|
wordBreak: "break-word",
|
|
11384
11402
|
whiteSpace: "normal",
|
|
11385
11403
|
w: "full",
|
|
11386
|
-
children: wallet?.domain ?
|
|
11404
|
+
children: wallet?.domain ? chunk2EYSG3VY_cjs.humanDomain(wallet?.domain ?? "", 18, 0) : chunk2EYSG3VY_cjs.humanAddress(wallet?.address ?? "", 6, 4)
|
|
11387
11405
|
}
|
|
11388
11406
|
)
|
|
11389
11407
|
] }),
|
|
@@ -11530,7 +11548,7 @@ var AccountSelector = ({
|
|
|
11530
11548
|
props: { width: 7, height: 7 }
|
|
11531
11549
|
}
|
|
11532
11550
|
),
|
|
11533
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: size, fontWeight: "500", children:
|
|
11551
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: size, fontWeight: "500", children: chunk2EYSG3VY_cjs.humanDomain(wallet?.domain ?? "", 22, 0) || chunk2EYSG3VY_cjs.humanAddress(wallet?.address ?? "", 6, 4) })
|
|
11534
11552
|
] }),
|
|
11535
11553
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11536
11554
|
react.Icon,
|
|
@@ -11613,17 +11631,17 @@ var AssetIcons = ({
|
|
|
11613
11631
|
border: "2px solid #00000024",
|
|
11614
11632
|
alignItems: "center",
|
|
11615
11633
|
justifyContent: "center",
|
|
11616
|
-
children:
|
|
11617
|
-
|
|
11634
|
+
children: chunk2EYSG3VY_cjs.TOKEN_LOGO_COMPONENTS[token.symbol] ? React10__default.default.cloneElement(
|
|
11635
|
+
chunk2EYSG3VY_cjs.TOKEN_LOGO_COMPONENTS[token.symbol],
|
|
11618
11636
|
{
|
|
11619
11637
|
width: `${iconSize * 0.8}px`,
|
|
11620
11638
|
height: `${iconSize * 0.8}px`,
|
|
11621
11639
|
rounded: "full"
|
|
11622
11640
|
}
|
|
11623
|
-
) :
|
|
11641
|
+
) : chunk2EYSG3VY_cjs.TOKEN_LOGOS[token.symbol] ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11624
11642
|
react.Image,
|
|
11625
11643
|
{
|
|
11626
|
-
src:
|
|
11644
|
+
src: chunk2EYSG3VY_cjs.TOKEN_LOGOS[token.symbol],
|
|
11627
11645
|
alt: `${token.symbol} logo`,
|
|
11628
11646
|
width: `${iconSize * 0.8}px`,
|
|
11629
11647
|
height: `${iconSize * 0.8}px`,
|
|
@@ -12496,7 +12514,7 @@ var NetworkInfo = () => {
|
|
|
12496
12514
|
InfoRow,
|
|
12497
12515
|
{
|
|
12498
12516
|
label: t("Node URL"),
|
|
12499
|
-
value: network.nodeUrl ||
|
|
12517
|
+
value: network.nodeUrl || chunk2EYSG3VY_cjs.getConfig(network.type).nodeUrl
|
|
12500
12518
|
}
|
|
12501
12519
|
),
|
|
12502
12520
|
connection.isConnectedWithPrivy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -12733,7 +12751,7 @@ var WalletSecuredBy = () => {
|
|
|
12733
12751
|
var EmbeddedWalletContent = ({ setCurrentContent }) => {
|
|
12734
12752
|
const { t } = reactI18next.useTranslation();
|
|
12735
12753
|
const { connectedWallet, connection } = useWallet();
|
|
12736
|
-
const walletImage =
|
|
12754
|
+
const walletImage = chunk2EYSG3VY_cjs.getPicassoImage(connectedWallet?.address ?? "");
|
|
12737
12755
|
const { getConnectionCache } = useCrossAppConnectionCache();
|
|
12738
12756
|
const connectionCache = getConnectionCache();
|
|
12739
12757
|
const { darkMode: isDark } = useVeChainKitConfig();
|
|
@@ -13191,8 +13209,8 @@ var SendTokenContent = ({
|
|
|
13191
13209
|
bg: isDark ? "whiteAlpha.300" : "blackAlpha.300"
|
|
13192
13210
|
},
|
|
13193
13211
|
onClick: () => setIsSelectingToken(true),
|
|
13194
|
-
leftIcon:
|
|
13195
|
-
|
|
13212
|
+
leftIcon: chunk2EYSG3VY_cjs.TOKEN_LOGO_COMPONENTS[selectedToken.symbol] ? React10__default.default.cloneElement(
|
|
13213
|
+
chunk2EYSG3VY_cjs.TOKEN_LOGO_COMPONENTS[selectedToken.symbol],
|
|
13196
13214
|
{
|
|
13197
13215
|
boxSize: "20px",
|
|
13198
13216
|
borderRadius: "full"
|
|
@@ -13200,7 +13218,7 @@ var SendTokenContent = ({
|
|
|
13200
13218
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
13201
13219
|
react.Image,
|
|
13202
13220
|
{
|
|
13203
|
-
src:
|
|
13221
|
+
src: chunk2EYSG3VY_cjs.TOKEN_LOGOS[selectedToken.symbol],
|
|
13204
13222
|
alt: `${selectedToken.symbol} logo`,
|
|
13205
13223
|
boxSize: "20px",
|
|
13206
13224
|
borderRadius: "full",
|
|
@@ -13408,7 +13426,7 @@ var SendTokenSummaryContent = ({
|
|
|
13408
13426
|
if (avatar) {
|
|
13409
13427
|
return avatar;
|
|
13410
13428
|
}
|
|
13411
|
-
return
|
|
13429
|
+
return chunk2EYSG3VY_cjs.getPicassoImage(resolvedAddress || toAddressOrDomain);
|
|
13412
13430
|
}, [avatar, network.type, resolvedAddress, toAddressOrDomain]);
|
|
13413
13431
|
const handleSend = async () => {
|
|
13414
13432
|
if (upgradeRequired) {
|
|
@@ -13839,7 +13857,7 @@ var DomainListItem = ({
|
|
|
13839
13857
|
props: {
|
|
13840
13858
|
width: "40px",
|
|
13841
13859
|
height: "40px",
|
|
13842
|
-
src: metadata.image ??
|
|
13860
|
+
src: metadata.image ?? chunk2EYSG3VY_cjs.getPicassoImage(domain.name),
|
|
13843
13861
|
alt: domain.name
|
|
13844
13862
|
}
|
|
13845
13863
|
}
|
|
@@ -13851,7 +13869,7 @@ var DomainListItem = ({
|
|
|
13851
13869
|
color: isDark ? "whiteAlpha.900" : "gray.700",
|
|
13852
13870
|
fontSize: "md",
|
|
13853
13871
|
fontWeight: "500",
|
|
13854
|
-
children:
|
|
13872
|
+
children: chunk2EYSG3VY_cjs.humanDomain(domain.name, 24, 0)
|
|
13855
13873
|
}
|
|
13856
13874
|
),
|
|
13857
13875
|
isCurrentDomain && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -14636,7 +14654,7 @@ var CustomizationContent = ({
|
|
|
14636
14654
|
setPreviewImageUrl(newPreviewUrl);
|
|
14637
14655
|
const uploadedImage = await onUpload(file);
|
|
14638
14656
|
if (!uploadedImage) throw new Error("Failed to compress image");
|
|
14639
|
-
const ipfsHash = await
|
|
14657
|
+
const ipfsHash = await chunk2EYSG3VY_cjs.uploadBlobToIPFS(
|
|
14640
14658
|
uploadedImage.file,
|
|
14641
14659
|
file.name,
|
|
14642
14660
|
network.type
|
|
@@ -14739,7 +14757,7 @@ var CustomizationContent = ({
|
|
|
14739
14757
|
backgroundPosition: "center",
|
|
14740
14758
|
position: "relative",
|
|
14741
14759
|
h: "80px",
|
|
14742
|
-
background: `no-repeat url('${
|
|
14760
|
+
background: `no-repeat url('${chunk2EYSG3VY_cjs.getPicassoImage(
|
|
14743
14761
|
account?.address ?? ""
|
|
14744
14762
|
)}')`,
|
|
14745
14763
|
w: "100%",
|
|
@@ -15226,14 +15244,14 @@ var CustomizationSummaryContent = ({
|
|
|
15226
15244
|
if (changes.avatarIpfsHash) {
|
|
15227
15245
|
queryClient.setQueryData(
|
|
15228
15246
|
getAvatarQueryKey(domain, network.type),
|
|
15229
|
-
|
|
15247
|
+
chunk2EYSG3VY_cjs.convertUriToUrl(
|
|
15230
15248
|
"ipfs://" + changes.avatarIpfsHash,
|
|
15231
15249
|
network.type
|
|
15232
15250
|
)
|
|
15233
15251
|
);
|
|
15234
15252
|
queryClient.setQueryData(
|
|
15235
15253
|
getAvatarOfAddressQueryKey(account?.address ?? ""),
|
|
15236
|
-
|
|
15254
|
+
chunk2EYSG3VY_cjs.convertUriToUrl(
|
|
15237
15255
|
"ipfs://" + changes.avatarIpfsHash,
|
|
15238
15256
|
network.type
|
|
15239
15257
|
)
|
|
@@ -15737,7 +15755,7 @@ var ManageCustomTokenContent = ({
|
|
|
15737
15755
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15738
15756
|
react.Image,
|
|
15739
15757
|
{
|
|
15740
|
-
src:
|
|
15758
|
+
src: chunk2EYSG3VY_cjs.TOKEN_LOGOS[token?.symbol],
|
|
15741
15759
|
alt: `${token.symbol} logo`,
|
|
15742
15760
|
boxSize: "20px",
|
|
15743
15761
|
borderRadius: "full",
|
|
@@ -15767,7 +15785,7 @@ var ManageCustomTokenContent = ({
|
|
|
15767
15785
|
),
|
|
15768
15786
|
/* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontWeight: "medium", children: token.symbol ?? "Unknown" })
|
|
15769
15787
|
] }),
|
|
15770
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.Text, { opacity: 0.7, children:
|
|
15788
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Text, { opacity: 0.7, children: chunk2EYSG3VY_cjs.humanAddress(
|
|
15771
15789
|
token.address ?? "",
|
|
15772
15790
|
4,
|
|
15773
15791
|
4
|
|
@@ -15839,7 +15857,8 @@ var ChangeCurrencyContent = ({
|
|
|
15839
15857
|
setCurrentContent
|
|
15840
15858
|
}) => {
|
|
15841
15859
|
const { t } = reactI18next.useTranslation();
|
|
15842
|
-
const { currentCurrency,
|
|
15860
|
+
const { currentCurrency, setCurrency } = useCurrentCurrency();
|
|
15861
|
+
const { allCurrencies: allCurrencies2 } = useCurrency();
|
|
15843
15862
|
React10.useEffect(() => {
|
|
15844
15863
|
localStorage.setItem("settings-currency-visited", "true");
|
|
15845
15864
|
}, []);
|
|
@@ -15849,13 +15868,13 @@ var ChangeCurrencyContent = ({
|
|
|
15849
15868
|
w: "full",
|
|
15850
15869
|
variant: "ghost",
|
|
15851
15870
|
justifyContent: "space-between",
|
|
15852
|
-
onClick: () =>
|
|
15871
|
+
onClick: () => setCurrency(currency),
|
|
15853
15872
|
py: 6,
|
|
15854
15873
|
px: 4,
|
|
15855
15874
|
_hover: { bg: "whiteAlpha.100" },
|
|
15856
15875
|
children: [
|
|
15857
15876
|
/* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { spacing: 3, children: [
|
|
15858
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "xl", children:
|
|
15877
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "xl", children: chunk2EYSG3VY_cjs.CURRENCY_SYMBOLS[currency] }),
|
|
15859
15878
|
/* @__PURE__ */ jsxRuntime.jsx(react.Text, { children: currency.toUpperCase() })
|
|
15860
15879
|
] }),
|
|
15861
15880
|
currentCurrency === currency && /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { as: bs.BsCheck, boxSize: 5, color: "blue.500" })
|
|
@@ -16222,11 +16241,11 @@ var TermsAndPrivacyAccordion = () => {
|
|
|
16222
16241
|
const { agreements, documents } = useLegalDocuments();
|
|
16223
16242
|
const agreementsByDocumentType = React10.useMemo(() => {
|
|
16224
16243
|
const userAgreements = agreements?.filter(
|
|
16225
|
-
(agreement) =>
|
|
16244
|
+
(agreement) => chunk2EYSG3VY_cjs.compareAddresses(agreement.walletAddress, account?.address)
|
|
16226
16245
|
);
|
|
16227
16246
|
const vechainKitDefaultTerms = {
|
|
16228
16247
|
id: "vechain-kit-terms",
|
|
16229
|
-
...
|
|
16248
|
+
...chunk2EYSG3VY_cjs.VECHAIN_KIT_TERMS_CONFIG,
|
|
16230
16249
|
documentType: "terms" /* TERMS */,
|
|
16231
16250
|
documentSource: "vechain-kit" /* VECHAIN_KIT */,
|
|
16232
16251
|
walletAddress: account?.address ?? "",
|
|
@@ -16553,7 +16572,7 @@ var PrivyLinkedAccounts = ({ onBack }) => {
|
|
|
16553
16572
|
case "phone":
|
|
16554
16573
|
return account.number;
|
|
16555
16574
|
case "wallet":
|
|
16556
|
-
return `${
|
|
16575
|
+
return `${chunk2EYSG3VY_cjs.humanAddress(account.address)} - ${account.walletClientType}`;
|
|
16557
16576
|
default:
|
|
16558
16577
|
return "";
|
|
16559
16578
|
}
|
|
@@ -17328,7 +17347,7 @@ var SharedAppCard = ({
|
|
|
17328
17347
|
react.Image,
|
|
17329
17348
|
{
|
|
17330
17349
|
src: imageUrl,
|
|
17331
|
-
fallbackSrc:
|
|
17350
|
+
fallbackSrc: chunk2EYSG3VY_cjs.notFoundImage,
|
|
17332
17351
|
alt: name,
|
|
17333
17352
|
height: "90px",
|
|
17334
17353
|
objectFit: "contain",
|
|
@@ -17450,7 +17469,7 @@ var ShortcutsSection = ({}) => {
|
|
|
17450
17469
|
react.Image,
|
|
17451
17470
|
{
|
|
17452
17471
|
src: shortcut.image,
|
|
17453
|
-
fallbackSrc:
|
|
17472
|
+
fallbackSrc: chunk2EYSG3VY_cjs.notFoundImage,
|
|
17454
17473
|
alt: shortcut.name,
|
|
17455
17474
|
objectFit: "contain",
|
|
17456
17475
|
rounded: "full"
|
|
@@ -17948,7 +17967,7 @@ var TransactionModalContent = ({
|
|
|
17948
17967
|
}
|
|
17949
17968
|
};
|
|
17950
17969
|
const statusConfig = getStatusConfig();
|
|
17951
|
-
const socialDescription = `${
|
|
17970
|
+
const socialDescription = `${chunk2EYSG3VY_cjs.getConfig(network.type).explorerUrl}/${txReceipt?.meta.txID}`;
|
|
17952
17971
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { children: [
|
|
17953
17972
|
/* @__PURE__ */ jsxRuntime.jsxs(StickyHeaderContainer, { children: [
|
|
17954
17973
|
/* @__PURE__ */ jsxRuntime.jsx(react.ModalHeader, { children: statusConfig.title }),
|
|
@@ -18026,7 +18045,7 @@ var TransactionModalContent = ({
|
|
|
18026
18045
|
uiConfig?.showExplorerButton && txReceipt?.meta.txID && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18027
18046
|
react.Link,
|
|
18028
18047
|
{
|
|
18029
|
-
href: `${
|
|
18048
|
+
href: `${chunk2EYSG3VY_cjs.getConfig(network.type).explorerUrl}/${txReceipt?.meta.txID}`,
|
|
18030
18049
|
isExternal: true,
|
|
18031
18050
|
opacity: 0.5,
|
|
18032
18051
|
fontSize: "14px",
|
|
@@ -18089,7 +18108,7 @@ var SuccessfulOperationContent = ({
|
|
|
18089
18108
|
}) => {
|
|
18090
18109
|
const { t } = reactI18next.useTranslation();
|
|
18091
18110
|
const { network, darkMode } = useVeChainKitConfig();
|
|
18092
|
-
const explorerUrl =
|
|
18111
|
+
const explorerUrl = chunk2EYSG3VY_cjs.getConfig(network.type).explorerUrl;
|
|
18093
18112
|
const socialDescription = `${explorerUrl}/${txId}`;
|
|
18094
18113
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { children: [
|
|
18095
18114
|
/* @__PURE__ */ jsxRuntime.jsxs(StickyHeaderContainer, { children: [
|
|
@@ -18485,19 +18504,19 @@ var WalletDisplay = ({ variant }) => {
|
|
|
18485
18504
|
return null;
|
|
18486
18505
|
}
|
|
18487
18506
|
if (variant === "iconAndDomain") {
|
|
18488
|
-
return account.domain ? /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", children:
|
|
18507
|
+
return account.domain ? /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", children: chunk2EYSG3VY_cjs.humanDomain(account?.domain ?? "", 16, 0) }) : /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", children: chunk2EYSG3VY_cjs.humanAddress(account.address ?? "", 6, 4) });
|
|
18489
18508
|
}
|
|
18490
18509
|
if (variant === "iconDomainAndAssets") {
|
|
18491
18510
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { spacing: 4, children: [
|
|
18492
18511
|
/* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { spacing: 0, alignItems: "flex-start", children: [
|
|
18493
|
-
account.domain && /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", fontWeight: "bold", children:
|
|
18512
|
+
account.domain && /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", fontWeight: "bold", children: chunk2EYSG3VY_cjs.humanDomain(account?.domain ?? "", 16, 0) }),
|
|
18494
18513
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18495
18514
|
react.Text,
|
|
18496
18515
|
{
|
|
18497
18516
|
fontSize: account.domain ? "xs" : "sm",
|
|
18498
18517
|
opacity: account.domain ? 0.5 : 1,
|
|
18499
18518
|
"data-testid": "trimmed-address",
|
|
18500
|
-
children:
|
|
18519
|
+
children: chunk2EYSG3VY_cjs.humanAddress(account.address ?? "", 4, 4)
|
|
18501
18520
|
}
|
|
18502
18521
|
)
|
|
18503
18522
|
] }),
|
|
@@ -18505,13 +18524,13 @@ var WalletDisplay = ({ variant }) => {
|
|
|
18505
18524
|
] });
|
|
18506
18525
|
}
|
|
18507
18526
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { spacing: 0, alignItems: "flex-start", children: [
|
|
18508
|
-
account.domain && /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", fontWeight: "bold", children:
|
|
18527
|
+
account.domain && /* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "sm", fontWeight: "bold", children: chunk2EYSG3VY_cjs.humanDomain(account?.domain ?? "", 16, 0) }),
|
|
18509
18528
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18510
18529
|
react.Text,
|
|
18511
18530
|
{
|
|
18512
18531
|
fontSize: account.domain ? "xs" : "sm",
|
|
18513
18532
|
opacity: account.domain ? 0.5 : 1,
|
|
18514
|
-
children:
|
|
18533
|
+
children: chunk2EYSG3VY_cjs.humanAddress(account.address ?? "", 4, 4)
|
|
18515
18534
|
}
|
|
18516
18535
|
)
|
|
18517
18536
|
] });
|
|
@@ -18690,7 +18709,7 @@ var TransactionToastContent = ({
|
|
|
18690
18709
|
}) => {
|
|
18691
18710
|
const { t } = reactI18next.useTranslation();
|
|
18692
18711
|
const { network } = useVeChainKitConfig();
|
|
18693
|
-
const explorerUrl =
|
|
18712
|
+
const explorerUrl = chunk2EYSG3VY_cjs.getConfig(network.type).explorerUrl;
|
|
18694
18713
|
const errorMessage = React10.useMemo(() => {
|
|
18695
18714
|
if (!txError) return null;
|
|
18696
18715
|
return txError.reason || t("Something went wrong. Please try again.");
|
|
@@ -19154,7 +19173,7 @@ var ProfileCard = ({
|
|
|
19154
19173
|
const { account } = useWallet();
|
|
19155
19174
|
const { network } = useVeChainKitConfig();
|
|
19156
19175
|
const metadata = useWalletMetadata(address, network.type);
|
|
19157
|
-
const headerImageSvg =
|
|
19176
|
+
const headerImageSvg = chunk2EYSG3VY_cjs.getPicassoImage(address);
|
|
19158
19177
|
const isConnectedAccount = address === account?.address;
|
|
19159
19178
|
const hasLinks = metadata?.records?.url || metadata?.records?.["com.x"] || metadata?.records?.email;
|
|
19160
19179
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Card, { variant: "vechainKitBase", ...style?.card, children: [
|
|
@@ -19327,7 +19346,7 @@ var SuccessfulOperationContent2 = ({
|
|
|
19327
19346
|
}) => {
|
|
19328
19347
|
const { t } = reactI18next.useTranslation();
|
|
19329
19348
|
const { network, darkMode } = useVeChainKitConfig();
|
|
19330
|
-
const explorerUrl =
|
|
19349
|
+
const explorerUrl = chunk2EYSG3VY_cjs.getConfig(network.type).explorerUrl;
|
|
19331
19350
|
const socialDescription = `${explorerUrl}/${txId}`;
|
|
19332
19351
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { children: [
|
|
19333
19352
|
/* @__PURE__ */ jsxRuntime.jsxs(StickyHeaderContainer, { children: [
|
|
@@ -19968,7 +19987,7 @@ var useReceiveModal = () => {
|
|
|
19968
19987
|
var ReceiveModalProvider = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
19969
19988
|
var useLoginModalContent = () => {
|
|
19970
19989
|
const { privy, loginMethods } = useVeChainKitConfig();
|
|
19971
|
-
const isVeChainApp = privy?.appId ===
|
|
19990
|
+
const isVeChainApp = privy?.appId === chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID;
|
|
19972
19991
|
const isLoginMethodEnabled = (method35) => {
|
|
19973
19992
|
if (!loginMethods) return true;
|
|
19974
19993
|
if (Array.isArray(method35)) {
|
|
@@ -20074,7 +20093,7 @@ var useTransferERC20 = ({
|
|
|
20074
20093
|
const queryClient = reactQuery.useQueryClient();
|
|
20075
20094
|
const { refresh } = useRefreshBalances();
|
|
20076
20095
|
const buildClauses = React10.useCallback(async () => {
|
|
20077
|
-
if (!receiverAddress || !amount || !
|
|
20096
|
+
if (!receiverAddress || !amount || !chunk2EYSG3VY_cjs.isValidAddress(receiverAddress))
|
|
20078
20097
|
throw new Error("Invalid receiver address or amount");
|
|
20079
20098
|
const clausesArray = [];
|
|
20080
20099
|
clausesArray.push({
|
|
@@ -20097,7 +20116,7 @@ var useTransferERC20 = ({
|
|
|
20097
20116
|
signerAccountAddress: fromAddress,
|
|
20098
20117
|
privyUIOptions: {
|
|
20099
20118
|
title: "Confirm Transfer",
|
|
20100
|
-
description: `Transfer ${amount} ${tokenName} to ${
|
|
20119
|
+
description: `Transfer ${amount} ${tokenName} to ${chunk2EYSG3VY_cjs.humanAddress(
|
|
20101
20120
|
receiverAddress
|
|
20102
20121
|
)}`,
|
|
20103
20122
|
buttonText: "Sign to continue"
|
|
@@ -20123,7 +20142,7 @@ var useTransferVET = ({
|
|
|
20123
20142
|
}) => {
|
|
20124
20143
|
const { refresh } = useRefreshBalances();
|
|
20125
20144
|
const buildClauses = React10.useCallback(async () => {
|
|
20126
|
-
if (!receiverAddress || !amount || !
|
|
20145
|
+
if (!receiverAddress || !amount || !chunk2EYSG3VY_cjs.isValidAddress(receiverAddress))
|
|
20127
20146
|
throw new Error("Invalid receiver address or amount");
|
|
20128
20147
|
if (isNaN(Number(amount))) {
|
|
20129
20148
|
throw new Error("Invalid amount");
|
|
@@ -20147,7 +20166,7 @@ var useTransferVET = ({
|
|
|
20147
20166
|
signerAccountAddress: fromAddress,
|
|
20148
20167
|
privyUIOptions: {
|
|
20149
20168
|
title: "Confirm Transfer",
|
|
20150
|
-
description: `Transfer ${amount} VET to ${
|
|
20169
|
+
description: `Transfer ${amount} VET to ${chunk2EYSG3VY_cjs.humanAddress(
|
|
20151
20170
|
receiverAddress
|
|
20152
20171
|
)}`,
|
|
20153
20172
|
buttonText: "Sign to continue"
|
|
@@ -20412,16 +20431,16 @@ var useCrossAppConnectionCache = () => {
|
|
|
20412
20431
|
var useLoginWithVeChain = () => {
|
|
20413
20432
|
const { login: loginWithVeChain } = usePrivyCrossAppSdk();
|
|
20414
20433
|
const { setConnectionCache } = useCrossAppConnectionCache();
|
|
20415
|
-
const { data: appsInfo } = useFetchAppInfo([
|
|
20434
|
+
const { data: appsInfo } = useFetchAppInfo([chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID]);
|
|
20416
20435
|
const { user } = reactAuth.usePrivy();
|
|
20417
20436
|
const login = async () => {
|
|
20418
20437
|
try {
|
|
20419
20438
|
Analytics.auth.methodSelected("vechain" /* VECHAIN */);
|
|
20420
|
-
await loginWithVeChain(
|
|
20439
|
+
await loginWithVeChain(chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID);
|
|
20421
20440
|
setConnectionCache({
|
|
20422
20441
|
name: "VeChain",
|
|
20423
|
-
logoUrl: appsInfo?.[
|
|
20424
|
-
appId:
|
|
20442
|
+
logoUrl: appsInfo?.[chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID]?.logo_url,
|
|
20443
|
+
appId: chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID,
|
|
20425
20444
|
website: "https://governance.vebetterdao.org"
|
|
20426
20445
|
});
|
|
20427
20446
|
Analytics.auth.completed({
|
|
@@ -20656,7 +20675,7 @@ var AddressDisplayCard = ({
|
|
|
20656
20675
|
fontSize: "xs",
|
|
20657
20676
|
opacity: 0.5,
|
|
20658
20677
|
"data-testid": `${label.toLowerCase()}-address`,
|
|
20659
|
-
children:
|
|
20678
|
+
children: chunk2EYSG3VY_cjs.humanAddress(address, 6, 4)
|
|
20660
20679
|
}
|
|
20661
20680
|
)
|
|
20662
20681
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -20665,7 +20684,7 @@ var AddressDisplayCard = ({
|
|
|
20665
20684
|
fontWeight: "medium",
|
|
20666
20685
|
fontSize: "sm",
|
|
20667
20686
|
"data-testid": `${label.toLowerCase()}-address`,
|
|
20668
|
-
children:
|
|
20687
|
+
children: chunk2EYSG3VY_cjs.humanAddress(address, 6, 4)
|
|
20669
20688
|
}
|
|
20670
20689
|
) })
|
|
20671
20690
|
] }),
|
|
@@ -20798,7 +20817,7 @@ var TransactionButtonAndStatus = ({
|
|
|
20798
20817
|
color: isDark ? "whiteAlpha.600" : "blackAlpha.600",
|
|
20799
20818
|
textAlign: "center",
|
|
20800
20819
|
width: "full",
|
|
20801
|
-
href: `${
|
|
20820
|
+
href: `${chunk2EYSG3VY_cjs.getConfig(network.type).explorerUrl}/${txReceipt?.meta.txID}`,
|
|
20802
20821
|
target: "_blank",
|
|
20803
20822
|
rel: "noopener noreferrer",
|
|
20804
20823
|
children: t("View transaction on the explorer")
|
|
@@ -21315,7 +21334,7 @@ var LegalDocumentsProvider = ({ children }) => {
|
|
|
21315
21334
|
const isDocumentRejectedByUser = React10.useCallback(
|
|
21316
21335
|
(doc, walletAddress) => {
|
|
21317
21336
|
return optionalRejected.some(
|
|
21318
|
-
(rejected) =>
|
|
21337
|
+
(rejected) => chunk2EYSG3VY_cjs.compareAddresses(rejected.walletAddress, walletAddress) && rejected.id === doc.id
|
|
21319
21338
|
);
|
|
21320
21339
|
},
|
|
21321
21340
|
[optionalRejected]
|
|
@@ -21350,7 +21369,7 @@ var LegalDocumentsProvider = ({ children }) => {
|
|
|
21350
21369
|
);
|
|
21351
21370
|
if (isAnalyticsAllowed) {
|
|
21352
21371
|
allDocs.push({
|
|
21353
|
-
...
|
|
21372
|
+
...chunk2EYSG3VY_cjs.VECHAIN_KIT_COOKIES_CONFIG,
|
|
21354
21373
|
documentType: "cookies" /* COOKIES */,
|
|
21355
21374
|
documentSource: "vechain-kit" /* VECHAIN_KIT */
|
|
21356
21375
|
});
|
|
@@ -21363,14 +21382,14 @@ var LegalDocumentsProvider = ({ children }) => {
|
|
|
21363
21382
|
if (!account?.address) return [];
|
|
21364
21383
|
return documents.filter((document2) => {
|
|
21365
21384
|
const isAgreed = storedAgreements.some(
|
|
21366
|
-
(agreement) =>
|
|
21385
|
+
(agreement) => chunk2EYSG3VY_cjs.compareAddresses(
|
|
21367
21386
|
agreement.walletAddress,
|
|
21368
21387
|
account.address
|
|
21369
21388
|
) && agreement.id === document2.id
|
|
21370
21389
|
);
|
|
21371
21390
|
if (isAgreed) return false;
|
|
21372
21391
|
const isRejected = optionalRejected.some(
|
|
21373
|
-
(rejection) =>
|
|
21392
|
+
(rejection) => chunk2EYSG3VY_cjs.compareAddresses(
|
|
21374
21393
|
rejection.walletAddress,
|
|
21375
21394
|
account.address
|
|
21376
21395
|
) && rejection.id === document2.id
|
|
@@ -21382,7 +21401,7 @@ var LegalDocumentsProvider = ({ children }) => {
|
|
|
21382
21401
|
if (!requiredDocuments.length || !account?.address) return true;
|
|
21383
21402
|
return requiredDocuments.every(
|
|
21384
21403
|
(document2) => storedAgreements.some(
|
|
21385
|
-
(saved) =>
|
|
21404
|
+
(saved) => chunk2EYSG3VY_cjs.compareAddresses(saved.walletAddress, account.address) && saved.id === document2.id
|
|
21386
21405
|
)
|
|
21387
21406
|
);
|
|
21388
21407
|
}, [requiredDocuments, storedAgreements, account?.address]);
|
|
@@ -21435,7 +21454,7 @@ var LegalDocumentsProvider = ({ children }) => {
|
|
|
21435
21454
|
walletAddress
|
|
21436
21455
|
);
|
|
21437
21456
|
const filteredAgreements = storedAgreements.filter(
|
|
21438
|
-
(saved) => !
|
|
21457
|
+
(saved) => !chunk2EYSG3VY_cjs.compareAddresses(saved.walletAddress, walletAddress) || !documentsArray.some((term) => term.id === saved.id)
|
|
21439
21458
|
);
|
|
21440
21459
|
const updated = [...filteredAgreements, ...newAgreements];
|
|
21441
21460
|
setStoredAgreements(updated);
|
|
@@ -21661,7 +21680,7 @@ var PrivyWalletProvider = ({
|
|
|
21661
21680
|
clauses.push(
|
|
21662
21681
|
sdkCore.Clause.callFunction(
|
|
21663
21682
|
sdkCore.Address.of(
|
|
21664
|
-
|
|
21683
|
+
chunk2EYSG3VY_cjs.getConfig(network.type).accountFactoryAddress
|
|
21665
21684
|
),
|
|
21666
21685
|
sdkCore.ABIContract.ofAbi(chunkEESC6JDT_cjs.SimpleAccountFactoryABI).getFunction(
|
|
21667
21686
|
"createAccount"
|
|
@@ -21736,7 +21755,7 @@ var PrivyWalletProvider = ({
|
|
|
21736
21755
|
clauses.push(
|
|
21737
21756
|
sdkCore.Clause.callFunction(
|
|
21738
21757
|
sdkCore.Address.of(
|
|
21739
|
-
|
|
21758
|
+
chunk2EYSG3VY_cjs.getConfig(network.type).accountFactoryAddress
|
|
21740
21759
|
),
|
|
21741
21760
|
sdkCore.ABIContract.ofAbi(chunkEESC6JDT_cjs.SimpleAccountFactoryABI).getFunction(
|
|
21742
21761
|
"createAccount"
|
|
@@ -21785,10 +21804,10 @@ var PrivyWalletProvider = ({
|
|
|
21785
21804
|
[
|
|
21786
21805
|
{
|
|
21787
21806
|
privateKey: Buffer.from(
|
|
21788
|
-
|
|
21807
|
+
chunk2EYSG3VY_cjs.randomTransactionUser.privateKey.slice(2),
|
|
21789
21808
|
"hex"
|
|
21790
21809
|
),
|
|
21791
|
-
address:
|
|
21810
|
+
address: chunk2EYSG3VY_cjs.randomTransactionUser.address
|
|
21792
21811
|
}
|
|
21793
21812
|
],
|
|
21794
21813
|
{ gasPayer: { gasPayerServiceUrl: delegatorUrl } }
|
|
@@ -21799,11 +21818,11 @@ var PrivyWalletProvider = ({
|
|
|
21799
21818
|
true
|
|
21800
21819
|
);
|
|
21801
21820
|
const signer = await providerWithDelegationEnabled.getSigner(
|
|
21802
|
-
|
|
21821
|
+
chunk2EYSG3VY_cjs.randomTransactionUser.address
|
|
21803
21822
|
);
|
|
21804
21823
|
const txInput = sdkNetwork.signerUtils.transactionBodyToTransactionRequestInput(
|
|
21805
21824
|
txBody,
|
|
21806
|
-
|
|
21825
|
+
chunk2EYSG3VY_cjs.randomTransactionUser.address
|
|
21807
21826
|
);
|
|
21808
21827
|
const rawDelegateSigned = await signer.signTransaction(txInput);
|
|
21809
21828
|
const { id } = await fetch(`${nodeUrl}/transactions`, {
|
|
@@ -21842,7 +21861,7 @@ var PrivyWalletProvider = ({
|
|
|
21842
21861
|
PrivyWalletProviderContext.Provider,
|
|
21843
21862
|
{
|
|
21844
21863
|
value: {
|
|
21845
|
-
accountFactory:
|
|
21864
|
+
accountFactory: chunk2EYSG3VY_cjs.getConfig(network.type).accountFactoryAddress,
|
|
21846
21865
|
sendTransaction,
|
|
21847
21866
|
signMessage,
|
|
21848
21867
|
signTypedData,
|
|
@@ -21913,7 +21932,7 @@ var validateConfig = (props) => {
|
|
|
21913
21932
|
if (props?.legalDocuments) {
|
|
21914
21933
|
if (props.legalDocuments.termsAndConditions) {
|
|
21915
21934
|
props.legalDocuments.termsAndConditions.forEach((term) => {
|
|
21916
|
-
if (!
|
|
21935
|
+
if (!chunk2EYSG3VY_cjs.isValidUrl(term.url)) {
|
|
21917
21936
|
errors.push(
|
|
21918
21937
|
`legalDocuments.termsAndConditions.url is invalid: ${term.url}`
|
|
21919
21938
|
);
|
|
@@ -21922,7 +21941,7 @@ var validateConfig = (props) => {
|
|
|
21922
21941
|
}
|
|
21923
21942
|
if (props.legalDocuments.privacyPolicy) {
|
|
21924
21943
|
props.legalDocuments.privacyPolicy.forEach((term) => {
|
|
21925
|
-
if (!
|
|
21944
|
+
if (!chunk2EYSG3VY_cjs.isValidUrl(term.url)) {
|
|
21926
21945
|
errors.push(
|
|
21927
21946
|
`legalDocuments.privacyPolicy.url is invalid: ${term.url}`
|
|
21928
21947
|
);
|
|
@@ -21931,7 +21950,7 @@ var validateConfig = (props) => {
|
|
|
21931
21950
|
}
|
|
21932
21951
|
if (props.legalDocuments.cookiePolicy) {
|
|
21933
21952
|
props.legalDocuments.cookiePolicy.forEach((term) => {
|
|
21934
|
-
if (!
|
|
21953
|
+
if (!chunk2EYSG3VY_cjs.isValidUrl(term.url)) {
|
|
21935
21954
|
errors.push(
|
|
21936
21955
|
`legalDocuments.cookiePolicy.url is invalid: ${term.url}`
|
|
21937
21956
|
);
|
|
@@ -21961,52 +21980,35 @@ var VeChainKitProvider = (props) => {
|
|
|
21961
21980
|
network,
|
|
21962
21981
|
allowCustomTokens,
|
|
21963
21982
|
legalDocuments,
|
|
21964
|
-
defaultCurrency = "usd"
|
|
21983
|
+
defaultCurrency = "usd",
|
|
21984
|
+
onLanguageChange,
|
|
21985
|
+
onCurrencyChange
|
|
21965
21986
|
} = validatedProps;
|
|
21966
21987
|
const validatedLoginMethods = loginMethods;
|
|
21967
|
-
const
|
|
21968
|
-
|
|
21969
|
-
|
|
21970
|
-
|
|
21971
|
-
|
|
21972
|
-
}
|
|
21988
|
+
const CURRENCY_STORAGE_KEY = "vechain_kit_currency";
|
|
21989
|
+
const [currentLanguage, setCurrentLanguageState] = React10.useState(() => {
|
|
21990
|
+
const stored = chunk2EYSG3VY_cjs.getLocalStorageItem("i18nextLng");
|
|
21991
|
+
if (stored && supportedLanguages.includes(stored)) {
|
|
21992
|
+
return stored;
|
|
21973
21993
|
}
|
|
21974
|
-
return
|
|
21994
|
+
return language || "en";
|
|
21975
21995
|
});
|
|
21976
|
-
const CURRENCY_STORAGE_KEY = "vechain_kit_currency";
|
|
21977
21996
|
const [currentCurrency, setCurrentCurrencyState] = React10.useState(
|
|
21978
21997
|
() => {
|
|
21979
|
-
|
|
21980
|
-
|
|
21981
|
-
|
|
21982
|
-
if (stored && ["usd", "eur", "gbp"].includes(stored)) {
|
|
21983
|
-
return stored;
|
|
21984
|
-
}
|
|
21985
|
-
} catch (error) {
|
|
21986
|
-
console.error(
|
|
21987
|
-
"Failed to read currency from localStorage:",
|
|
21988
|
-
error
|
|
21989
|
-
);
|
|
21990
|
-
}
|
|
21998
|
+
const stored = chunk2EYSG3VY_cjs.getLocalStorageItem(CURRENCY_STORAGE_KEY);
|
|
21999
|
+
if (stored && ["usd", "eur", "gbp"].includes(stored)) {
|
|
22000
|
+
return stored;
|
|
21991
22001
|
}
|
|
21992
22002
|
return defaultCurrency;
|
|
21993
22003
|
}
|
|
21994
22004
|
);
|
|
21995
|
-
const
|
|
21996
|
-
|
|
21997
|
-
if (typeof window !== "undefined") {
|
|
21998
|
-
try {
|
|
21999
|
-
localStorage.setItem(CURRENCY_STORAGE_KEY, newCurrency);
|
|
22000
|
-
} catch (error) {
|
|
22001
|
-
console.error("Failed to store currency preference:", error);
|
|
22002
|
-
}
|
|
22003
|
-
}
|
|
22004
|
-
};
|
|
22005
|
+
const isUpdatingFromPropRef = React10.useRef(false);
|
|
22006
|
+
const isUpdatingCurrencyFromPropRef = React10.useRef(false);
|
|
22005
22007
|
const allowedEcosystemApps = React10.useMemo(() => {
|
|
22006
22008
|
const userEcosystemMethods = validatedLoginMethods?.find(
|
|
22007
22009
|
(method35) => method35.method === "ecosystem"
|
|
22008
22010
|
);
|
|
22009
|
-
return userEcosystemMethods?.allowedApps ??
|
|
22011
|
+
return userEcosystemMethods?.allowedApps ?? chunk2EYSG3VY_cjs.DEFAULT_PRIVY_ECOSYSTEM_APPS.map((app) => app.id);
|
|
22010
22012
|
}, [validatedLoginMethods]);
|
|
22011
22013
|
let privyAppId, privyClientId;
|
|
22012
22014
|
if (!privy) {
|
|
@@ -22018,9 +22020,6 @@ var VeChainKitProvider = (props) => {
|
|
|
22018
22020
|
}
|
|
22019
22021
|
React10.useEffect(() => {
|
|
22020
22022
|
initializeI18n(i18n_default);
|
|
22021
|
-
if (language) {
|
|
22022
|
-
i18n_default.changeLanguage(language);
|
|
22023
|
-
}
|
|
22024
22023
|
if (i18nConfig) {
|
|
22025
22024
|
Object.keys(i18nConfig).forEach((lang) => {
|
|
22026
22025
|
i18n_default.addResourceBundle(
|
|
@@ -22032,22 +22031,86 @@ var VeChainKitProvider = (props) => {
|
|
|
22032
22031
|
);
|
|
22033
22032
|
});
|
|
22034
22033
|
}
|
|
22035
|
-
|
|
22034
|
+
const storedLanguage = chunk2EYSG3VY_cjs.getLocalStorageItem("i18nextLng");
|
|
22035
|
+
const initialLanguage = storedLanguage || currentLanguage;
|
|
22036
|
+
if (initialLanguage && i18n_default.language !== initialLanguage) {
|
|
22037
|
+
isUpdatingFromPropRef.current = true;
|
|
22038
|
+
i18n_default.changeLanguage(initialLanguage);
|
|
22039
|
+
if (initialLanguage !== currentLanguage) {
|
|
22040
|
+
setCurrentLanguageState(initialLanguage);
|
|
22041
|
+
}
|
|
22042
|
+
isUpdatingFromPropRef.current = false;
|
|
22043
|
+
}
|
|
22044
|
+
}, []);
|
|
22045
|
+
React10.useEffect(() => {
|
|
22046
|
+
const storedLanguage = chunk2EYSG3VY_cjs.getLocalStorageItem("i18nextLng");
|
|
22047
|
+
if (language && !storedLanguage && language !== currentLanguage) {
|
|
22048
|
+
isUpdatingFromPropRef.current = true;
|
|
22049
|
+
i18n_default.changeLanguage(language);
|
|
22050
|
+
setCurrentLanguageState(language);
|
|
22051
|
+
isUpdatingFromPropRef.current = false;
|
|
22052
|
+
}
|
|
22053
|
+
}, [language, currentLanguage]);
|
|
22036
22054
|
React10.useEffect(() => {
|
|
22037
22055
|
const handleLanguageChanged = (lng) => {
|
|
22038
|
-
|
|
22056
|
+
if (!isUpdatingFromPropRef.current && lng !== currentLanguage) {
|
|
22057
|
+
setCurrentLanguageState(lng);
|
|
22058
|
+
onLanguageChange?.(lng);
|
|
22059
|
+
}
|
|
22039
22060
|
};
|
|
22040
22061
|
i18n_default.on("languageChanged", handleLanguageChanged);
|
|
22041
|
-
const initialLanguage = i18n_default.language || language || "en";
|
|
22042
|
-
if (initialLanguage !== currentLanguage) {
|
|
22043
|
-
setCurrentLanguage(initialLanguage);
|
|
22044
|
-
}
|
|
22045
22062
|
return () => {
|
|
22046
22063
|
i18n_default.off("languageChanged", handleLanguageChanged);
|
|
22047
22064
|
};
|
|
22048
|
-
}, [
|
|
22065
|
+
}, [currentLanguage, onLanguageChange]);
|
|
22066
|
+
React10.useEffect(() => {
|
|
22067
|
+
const stored = chunk2EYSG3VY_cjs.getLocalStorageItem(CURRENCY_STORAGE_KEY);
|
|
22068
|
+
if (defaultCurrency && !stored && defaultCurrency !== currentCurrency) {
|
|
22069
|
+
isUpdatingCurrencyFromPropRef.current = true;
|
|
22070
|
+
setCurrentCurrencyState(defaultCurrency);
|
|
22071
|
+
chunk2EYSG3VY_cjs.setLocalStorageItem(CURRENCY_STORAGE_KEY, defaultCurrency);
|
|
22072
|
+
isUpdatingCurrencyFromPropRef.current = false;
|
|
22073
|
+
}
|
|
22074
|
+
}, [defaultCurrency, currentCurrency]);
|
|
22075
|
+
React10.useEffect(() => {
|
|
22076
|
+
const checkCurrencyChange = () => {
|
|
22077
|
+
try {
|
|
22078
|
+
const stored = chunk2EYSG3VY_cjs.getLocalStorageItem(CURRENCY_STORAGE_KEY);
|
|
22079
|
+
if (stored && stored !== currentCurrency && !isUpdatingCurrencyFromPropRef.current) {
|
|
22080
|
+
const newCurrency = stored;
|
|
22081
|
+
setCurrentCurrencyState(newCurrency);
|
|
22082
|
+
onCurrencyChange?.(newCurrency);
|
|
22083
|
+
}
|
|
22084
|
+
} catch {
|
|
22085
|
+
}
|
|
22086
|
+
};
|
|
22087
|
+
checkCurrencyChange();
|
|
22088
|
+
const handleStorageChange = (e) => {
|
|
22089
|
+
if (e.key === CURRENCY_STORAGE_KEY && e.newValue) {
|
|
22090
|
+
checkCurrencyChange();
|
|
22091
|
+
}
|
|
22092
|
+
};
|
|
22093
|
+
window.addEventListener("storage", handleStorageChange);
|
|
22094
|
+
const interval = setInterval(checkCurrencyChange, 500);
|
|
22095
|
+
return () => {
|
|
22096
|
+
window.removeEventListener("storage", handleStorageChange);
|
|
22097
|
+
clearInterval(interval);
|
|
22098
|
+
};
|
|
22099
|
+
}, [currentCurrency, onCurrencyChange]);
|
|
22100
|
+
const setLanguage = (lang) => {
|
|
22101
|
+
isUpdatingFromPropRef.current = true;
|
|
22102
|
+
i18n_default.changeLanguage(lang);
|
|
22103
|
+
setCurrentLanguageState(lang);
|
|
22104
|
+
isUpdatingFromPropRef.current = false;
|
|
22105
|
+
};
|
|
22106
|
+
const setCurrency = (currency) => {
|
|
22107
|
+
isUpdatingCurrencyFromPropRef.current = true;
|
|
22108
|
+
setCurrentCurrencyState(currency);
|
|
22109
|
+
chunk2EYSG3VY_cjs.setLocalStorageItem(CURRENCY_STORAGE_KEY, currency);
|
|
22110
|
+
isUpdatingCurrencyFromPropRef.current = false;
|
|
22111
|
+
};
|
|
22049
22112
|
React10.useEffect(() => {
|
|
22050
|
-
localStorage.setItem(
|
|
22113
|
+
localStorage.setItem(chunk2EYSG3VY_cjs.VECHAIN_KIT_STORAGE_KEYS.NETWORK, network.type);
|
|
22051
22114
|
}, [network]);
|
|
22052
22115
|
return /* @__PURE__ */ jsxRuntime.jsxs(EnsureQueryClient, { children: [
|
|
22053
22116
|
/* @__PURE__ */ jsxRuntime.jsx(reactQueryDevtools.ReactQueryDevtools, { initialIsOpen: false }),
|
|
@@ -22070,7 +22133,8 @@ var VeChainKitProvider = (props) => {
|
|
|
22070
22133
|
legalDocuments,
|
|
22071
22134
|
defaultCurrency,
|
|
22072
22135
|
currentCurrency,
|
|
22073
|
-
|
|
22136
|
+
setLanguage,
|
|
22137
|
+
setCurrency
|
|
22074
22138
|
},
|
|
22075
22139
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
22076
22140
|
reactAuth.PrivyProvider,
|
|
@@ -22104,13 +22168,13 @@ var VeChainKitProvider = (props) => {
|
|
|
22104
22168
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
22105
22169
|
dappKitReact.DAppKitProvider,
|
|
22106
22170
|
{
|
|
22107
|
-
nodeUrl: network.nodeUrl ??
|
|
22171
|
+
nodeUrl: network.nodeUrl ?? chunk2EYSG3VY_cjs.getConfig(network.type).nodeUrl,
|
|
22108
22172
|
genesis: network.genesisId ? {
|
|
22109
|
-
...
|
|
22173
|
+
...chunk2EYSG3VY_cjs.getConfig(network.type).network.genesis,
|
|
22110
22174
|
id: network.genesisId
|
|
22111
|
-
} :
|
|
22175
|
+
} : chunk2EYSG3VY_cjs.getConfig(network.type).network.genesis,
|
|
22112
22176
|
i18n: i18nConfig,
|
|
22113
|
-
language,
|
|
22177
|
+
language: currentLanguage,
|
|
22114
22178
|
logLevel: dappKit.logLevel,
|
|
22115
22179
|
modalParent: dappKit.modalParent,
|
|
22116
22180
|
onSourceClick: dappKit.onSourceClick,
|
|
@@ -22143,7 +22207,7 @@ var VeChainKitProvider = (props) => {
|
|
|
22143
22207
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
22144
22208
|
PrivyWalletProvider,
|
|
22145
22209
|
{
|
|
22146
|
-
nodeUrl: network.nodeUrl ??
|
|
22210
|
+
nodeUrl: network.nodeUrl ?? chunk2EYSG3VY_cjs.getConfig(network.type).nodeUrl,
|
|
22147
22211
|
delegatorUrl: feeDelegation?.delegatorUrl ?? "",
|
|
22148
22212
|
delegateAllTransactions: feeDelegation?.delegateAllTransactions ?? false,
|
|
22149
22213
|
children: /* @__PURE__ */ jsxRuntime.jsx(ModalProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(LegalDocumentsProvider, { children }) })
|
|
@@ -22500,31 +22564,31 @@ var VechainKitThemeProvider = ({
|
|
|
22500
22564
|
|
|
22501
22565
|
Object.defineProperty(exports, "CURRENCY_SYMBOLS", {
|
|
22502
22566
|
enumerable: true,
|
|
22503
|
-
get: function () { return
|
|
22567
|
+
get: function () { return chunk2EYSG3VY_cjs.CURRENCY_SYMBOLS; }
|
|
22504
22568
|
});
|
|
22505
22569
|
Object.defineProperty(exports, "ENS_TEXT_RECORDS", {
|
|
22506
22570
|
enumerable: true,
|
|
22507
|
-
get: function () { return
|
|
22571
|
+
get: function () { return chunk2EYSG3VY_cjs.ENS_TEXT_RECORDS; }
|
|
22508
22572
|
});
|
|
22509
22573
|
Object.defineProperty(exports, "LegalDocumentSource", {
|
|
22510
22574
|
enumerable: true,
|
|
22511
|
-
get: function () { return
|
|
22575
|
+
get: function () { return chunk2EYSG3VY_cjs.LegalDocumentSource; }
|
|
22512
22576
|
});
|
|
22513
22577
|
Object.defineProperty(exports, "LegalDocumentType", {
|
|
22514
22578
|
enumerable: true,
|
|
22515
|
-
get: function () { return
|
|
22579
|
+
get: function () { return chunk2EYSG3VY_cjs.LegalDocumentType; }
|
|
22516
22580
|
});
|
|
22517
22581
|
Object.defineProperty(exports, "NFTMediaType", {
|
|
22518
22582
|
enumerable: true,
|
|
22519
|
-
get: function () { return
|
|
22583
|
+
get: function () { return chunk2EYSG3VY_cjs.NFTMediaType; }
|
|
22520
22584
|
});
|
|
22521
22585
|
Object.defineProperty(exports, "VePassportUserStatus", {
|
|
22522
22586
|
enumerable: true,
|
|
22523
|
-
get: function () { return
|
|
22587
|
+
get: function () { return chunk2EYSG3VY_cjs.VePassportUserStatus; }
|
|
22524
22588
|
});
|
|
22525
22589
|
Object.defineProperty(exports, "getConfig", {
|
|
22526
22590
|
enumerable: true,
|
|
22527
|
-
get: function () { return
|
|
22591
|
+
get: function () { return chunk2EYSG3VY_cjs.getConfig; }
|
|
22528
22592
|
});
|
|
22529
22593
|
Object.defineProperty(exports, "useMfaEnrollment", {
|
|
22530
22594
|
enumerable: true,
|
|
@@ -22843,6 +22907,8 @@ exports.useCurrentAccountImplementationVersion = useCurrentAccountImplementation
|
|
|
22843
22907
|
exports.useCurrentAllocationsRound = useCurrentAllocationsRound;
|
|
22844
22908
|
exports.useCurrentAllocationsRoundId = useCurrentAllocationsRoundId;
|
|
22845
22909
|
exports.useCurrentBlock = useCurrentBlock;
|
|
22910
|
+
exports.useCurrentCurrency = useCurrentCurrency;
|
|
22911
|
+
exports.useCurrentLanguage = useCurrentLanguage;
|
|
22846
22912
|
exports.useDecodeFunctionSignature = useDecodeFunctionSignature;
|
|
22847
22913
|
exports.useEcosystemShortcuts = useEcosystemShortcuts;
|
|
22848
22914
|
exports.useEnsRecordExists = useEnsRecordExists;
|