@vechain/vechain-kit 1.9.4 → 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 +388 -279
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -2
- package/dist/index.d.ts +65 -2
- package/dist/index.js +147 -40
- 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 +2 -2
- 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");
|
|
@@ -9074,34 +9080,13 @@ var useTokenPrices = () => {
|
|
|
9074
9080
|
var STORAGE_KEY = "vechain_kit_currency";
|
|
9075
9081
|
var allCurrencies = ["usd", "eur", "gbp"];
|
|
9076
9082
|
var useCurrency = () => {
|
|
9077
|
-
const {
|
|
9078
|
-
const [currentCurrency, setCurrentCurrency] = React10.useState(() => {
|
|
9079
|
-
try {
|
|
9080
|
-
const stored = window.localStorage.getItem(STORAGE_KEY);
|
|
9081
|
-
return stored || defaultCurrency;
|
|
9082
|
-
} catch (error) {
|
|
9083
|
-
console.error(error);
|
|
9084
|
-
return defaultCurrency;
|
|
9085
|
-
}
|
|
9086
|
-
});
|
|
9083
|
+
const { currentCurrency, setCurrency } = useVeChainKitConfig();
|
|
9087
9084
|
React10.useEffect(() => {
|
|
9088
|
-
|
|
9089
|
-
window.localStorage.setItem(STORAGE_KEY, currentCurrency);
|
|
9090
|
-
} catch (error) {
|
|
9091
|
-
console.error("Failed to store currency preference:", error);
|
|
9092
|
-
}
|
|
9085
|
+
chunk2EYSG3VY_cjs.setLocalStorageItem(STORAGE_KEY, currentCurrency);
|
|
9093
9086
|
}, [currentCurrency]);
|
|
9094
|
-
const changeCurrency = (newCurrency) => {
|
|
9095
|
-
if (!allCurrencies.includes(newCurrency)) {
|
|
9096
|
-
console.error(`Invalid currency: ${newCurrency}`);
|
|
9097
|
-
return;
|
|
9098
|
-
}
|
|
9099
|
-
setCurrentCurrency(newCurrency);
|
|
9100
|
-
};
|
|
9101
9087
|
return {
|
|
9102
9088
|
currentCurrency,
|
|
9103
|
-
allCurrencies
|
|
9104
|
-
changeCurrency
|
|
9089
|
+
allCurrencies
|
|
9105
9090
|
};
|
|
9106
9091
|
};
|
|
9107
9092
|
|
|
@@ -9228,7 +9213,7 @@ var vechain = viem.defineChain({
|
|
|
9228
9213
|
});
|
|
9229
9214
|
var vechainConnector = () => {
|
|
9230
9215
|
return rainbowKit.toPrivyWalletConnector({
|
|
9231
|
-
id:
|
|
9216
|
+
id: chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID,
|
|
9232
9217
|
name: "VeChain",
|
|
9233
9218
|
iconUrl: "https://imagedelivery.net/oHBRUd2clqykxgDWmeAyLg/661dd77c-2f9d-40e7-baa1-f4e24fd7bf00/icon",
|
|
9234
9219
|
smartWalletMode: false
|
|
@@ -9283,7 +9268,7 @@ var usePrivyCrossAppSdk = () => {
|
|
|
9283
9268
|
setIsConnecting(true);
|
|
9284
9269
|
setConnectionError(null);
|
|
9285
9270
|
const connector = connectors.find(
|
|
9286
|
-
(c) => c.id === (appID ||
|
|
9271
|
+
(c) => c.id === (appID || chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID)
|
|
9287
9272
|
);
|
|
9288
9273
|
if (!connector) {
|
|
9289
9274
|
throw new Error("Connector not found");
|
|
@@ -9345,7 +9330,7 @@ var useWalletMetadata = (address, networkType) => {
|
|
|
9345
9330
|
const { data: domain, isLoading: isLoadingVechainDomain } = useVechainDomain(address ?? "");
|
|
9346
9331
|
const { data: avatar, isLoading: isLoadingMetadata } = useGetAvatarOfAddress(address ?? "");
|
|
9347
9332
|
const { data: textRecords, isLoading: isLoadingRecords } = useGetTextRecords(domain?.domain ?? "");
|
|
9348
|
-
const headerUrl = textRecords?.header ?
|
|
9333
|
+
const headerUrl = textRecords?.header ? chunk2EYSG3VY_cjs.convertUriToUrl(textRecords.header, networkType) : null;
|
|
9349
9334
|
return {
|
|
9350
9335
|
domain: domain?.domain,
|
|
9351
9336
|
image: avatar,
|
|
@@ -9377,7 +9362,7 @@ var useWallet = () => {
|
|
|
9377
9362
|
const isConnectedWithDappKit = !!dappKitAccount;
|
|
9378
9363
|
const isConnectedWithSocialLogin = authenticated && !!user;
|
|
9379
9364
|
const isConnectedWithPrivy = isConnectedWithSocialLogin || isConnectedWithCrossApp;
|
|
9380
|
-
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;
|
|
9381
9366
|
const isLoading = isConnectingWithCrossApp || isReconnectingWithCrossApp || isLoadingLoginOAuth || !ready;
|
|
9382
9367
|
const [isConnected, setIsConnected] = React10.useState(false);
|
|
9383
9368
|
const connectionSource = isConnectedWithCrossApp ? {
|
|
@@ -9442,7 +9427,7 @@ var useWallet = () => {
|
|
|
9442
9427
|
const { data: smartAccountVersion } = useSmartAccountVersion(
|
|
9443
9428
|
smartAccount?.address ?? ""
|
|
9444
9429
|
);
|
|
9445
|
-
const hasActiveSmartAccount = !!smartAccount?.address && !!account?.address &&
|
|
9430
|
+
const hasActiveSmartAccount = !!smartAccount?.address && !!account?.address && chunk2EYSG3VY_cjs.compareAddresses(smartAccount?.address, account?.address);
|
|
9446
9431
|
const disconnect = React10.useCallback(async () => {
|
|
9447
9432
|
try {
|
|
9448
9433
|
setIsConnected(false);
|
|
@@ -9566,17 +9551,17 @@ var useCustomTokens = () => {
|
|
|
9566
9551
|
};
|
|
9567
9552
|
const isTokenIncluded = (address) => {
|
|
9568
9553
|
return customTokens.some(
|
|
9569
|
-
(t) =>
|
|
9554
|
+
(t) => chunk2EYSG3VY_cjs.compareAddresses(t.address, address)
|
|
9570
9555
|
);
|
|
9571
9556
|
};
|
|
9572
9557
|
const isDefaultToken = (address) => {
|
|
9573
9558
|
const contractAddresses = {
|
|
9574
9559
|
vet: "0x",
|
|
9575
9560
|
// VET has no contract address since it's the native token
|
|
9576
|
-
vtho:
|
|
9577
|
-
b3tr:
|
|
9578
|
-
vot3:
|
|
9579
|
-
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
|
|
9580
9565
|
};
|
|
9581
9566
|
return Object.values(contractAddresses).includes(address);
|
|
9582
9567
|
};
|
|
@@ -9671,15 +9656,33 @@ var useAccountBalance = (address) => {
|
|
|
9671
9656
|
return reactQuery.useQuery({
|
|
9672
9657
|
queryKey: getAccountBalanceQueryKey(address),
|
|
9673
9658
|
queryFn: () => getAccountBalance(thor, address),
|
|
9674
|
-
enabled: !!address &&
|
|
9659
|
+
enabled: !!address && chunk2EYSG3VY_cjs.isValidAddress(address),
|
|
9675
9660
|
refetchInterval: 1e4
|
|
9676
9661
|
});
|
|
9677
9662
|
};
|
|
9678
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
|
+
|
|
9679
9682
|
// src/hooks/api/utility/useGetNodeUrl.ts
|
|
9680
9683
|
var useGetNodeUrl = () => {
|
|
9681
9684
|
const { network } = useVeChainKitConfig();
|
|
9682
|
-
return network.nodeUrl ??
|
|
9685
|
+
return network.nodeUrl ?? chunk2EYSG3VY_cjs.getConfig(network.type).nodeUrl;
|
|
9683
9686
|
};
|
|
9684
9687
|
|
|
9685
9688
|
// src/hooks/api/utility/useGetChainId.ts
|
|
@@ -9707,7 +9710,7 @@ var getCustomTokenBalance = async (thor, token, address) => {
|
|
|
9707
9710
|
if (res.reverted) throw new Error("Reverted");
|
|
9708
9711
|
const original = res.decoded[0];
|
|
9709
9712
|
const scaled = viem.formatEther(original);
|
|
9710
|
-
const formatted = scaled === "0" ? "0" :
|
|
9713
|
+
const formatted = scaled === "0" ? "0" : chunk2EYSG3VY_cjs.humanNumber(scaled);
|
|
9711
9714
|
return {
|
|
9712
9715
|
...token,
|
|
9713
9716
|
original,
|
|
@@ -9943,7 +9946,7 @@ var useAppHubApps = () => {
|
|
|
9943
9946
|
};
|
|
9944
9947
|
var getNFTMetadataUri = async (networkType, thor, tokenID) => {
|
|
9945
9948
|
if (!tokenID) return Promise.reject(new Error("tokenID not provided"));
|
|
9946
|
-
const galaxyMemberContract =
|
|
9949
|
+
const galaxyMemberContract = chunk2EYSG3VY_cjs.getConfig(networkType).galaxyMemberContractAddress;
|
|
9947
9950
|
const functionFragment2 = chunk5GZ7N47F_cjs.GalaxyMember__factory.createInterface().getFunction("tokenURI").format("json");
|
|
9948
9951
|
const res = await thor.account(galaxyMemberContract).method(JSON.parse(functionFragment2)).call(tokenID);
|
|
9949
9952
|
if (res.vmError) return Promise.reject(new Error(res.vmError));
|
|
@@ -10007,7 +10010,7 @@ var getAccountAddress = async (thor, ownerAddress, networkType) => {
|
|
|
10007
10010
|
const functionFragment2 = SimpleAccountFactoryInterface.getFunction("getAccountAddress").format(
|
|
10008
10011
|
"json"
|
|
10009
10012
|
);
|
|
10010
|
-
const res = await thor.account(
|
|
10013
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).accountFactoryAddress).method(JSON.parse(functionFragment2)).call(ownerAddress);
|
|
10011
10014
|
if (res.reverted) throw new Error("Reverted");
|
|
10012
10015
|
return res.decoded[0];
|
|
10013
10016
|
};
|
|
@@ -10033,7 +10036,7 @@ var getUpgradeRequiredForAccount = async (thor, contractAddress, targetVersion,
|
|
|
10033
10036
|
const functionFragment2 = SimpleAccountFactoryInterface2.getFunction(
|
|
10034
10037
|
"upgradeRequiredForAccount"
|
|
10035
10038
|
).format("json");
|
|
10036
|
-
const res = await thor.account(
|
|
10039
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).accountFactoryAddress).method(JSON.parse(functionFragment2)).call(contractAddress, targetVersion);
|
|
10037
10040
|
if (res.reverted) throw new Error("Reverted");
|
|
10038
10041
|
return res.decoded[0];
|
|
10039
10042
|
};
|
|
@@ -10088,7 +10091,7 @@ var getAccountImplementationAddress = async (thor, version, networkType) => {
|
|
|
10088
10091
|
default:
|
|
10089
10092
|
throw new Error("Invalid version, must be between 1 and 3");
|
|
10090
10093
|
}
|
|
10091
|
-
const res = await thor.account(
|
|
10094
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).accountFactoryAddress).method(JSON.parse(functionFragment2)).call();
|
|
10092
10095
|
if (res.reverted) throw new Error("Reverted");
|
|
10093
10096
|
return res.decoded[0];
|
|
10094
10097
|
};
|
|
@@ -10119,7 +10122,7 @@ var getHasV1SmartAccount = async (thor, ownerAddress, networkType) => {
|
|
|
10119
10122
|
const functionFragment2 = SimpleAccountFactoryInterface4.getFunction("hasLegacyAccount").format(
|
|
10120
10123
|
"json"
|
|
10121
10124
|
);
|
|
10122
|
-
const res = await thor.account(
|
|
10125
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).accountFactoryAddress).method(JSON.parse(functionFragment2)).call(ownerAddress);
|
|
10123
10126
|
if (res.reverted) throw new Error("Reverted");
|
|
10124
10127
|
return res.decoded[0];
|
|
10125
10128
|
};
|
|
@@ -10144,7 +10147,7 @@ var getUpgradeRequired = async (thor, accountAddress, ownerAddress, targetVersio
|
|
|
10144
10147
|
const functionFragment2 = SimpleAccountFactoryInterface5.getFunction("upgradeRequired").format(
|
|
10145
10148
|
"json"
|
|
10146
10149
|
);
|
|
10147
|
-
const res = await thor.account(
|
|
10150
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).accountFactoryAddress).method(JSON.parse(functionFragment2)).call(accountAddress, ownerAddress, targetVersion);
|
|
10148
10151
|
if (res.reverted) throw new Error("Reverted");
|
|
10149
10152
|
return res.decoded[0];
|
|
10150
10153
|
};
|
|
@@ -10183,7 +10186,7 @@ var getAccountVersion = async (thor, accountAddress, ownerAddress, networkType)
|
|
|
10183
10186
|
const functionFragment2 = SimpleAccountFactoryInterface6.getFunction("getAccountVersion").format(
|
|
10184
10187
|
"json"
|
|
10185
10188
|
);
|
|
10186
|
-
const res = await thor.account(
|
|
10189
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).accountFactoryAddress).method(JSON.parse(functionFragment2)).call(accountAddress, ownerAddress);
|
|
10187
10190
|
if (res.reverted) throw new Error("Reverted");
|
|
10188
10191
|
return {
|
|
10189
10192
|
version: res.decoded[0],
|
|
@@ -10218,7 +10221,7 @@ var getCurrentAccountImplementationVersion = async (thor, networkType) => {
|
|
|
10218
10221
|
const functionFragment2 = SimpleAccountFactoryInterface7.getFunction(
|
|
10219
10222
|
"currentAccountImplementationVersion"
|
|
10220
10223
|
).format("json");
|
|
10221
|
-
const res = await thor.account(
|
|
10224
|
+
const res = await thor.account(chunk2EYSG3VY_cjs.getConfig(networkType).accountFactoryAddress).method(JSON.parse(functionFragment2)).call();
|
|
10222
10225
|
if (res.reverted) throw new Error("Reverted");
|
|
10223
10226
|
return parseInt(res.decoded[0]);
|
|
10224
10227
|
};
|
|
@@ -10243,7 +10246,7 @@ var getSmartAccount = async (thor, network, ownerAddress) => {
|
|
|
10243
10246
|
return { address: void 0 };
|
|
10244
10247
|
}
|
|
10245
10248
|
const account = await thor.contracts.executeCall(
|
|
10246
|
-
|
|
10249
|
+
chunk2EYSG3VY_cjs.getConfig(network).accountFactoryAddress,
|
|
10247
10250
|
sdkCore.ABIContract.ofAbi(chunkEESC6JDT_cjs.SimpleAccountFactoryABI).getFunction(
|
|
10248
10251
|
"getAccountAddress"
|
|
10249
10252
|
),
|
|
@@ -10461,7 +10464,7 @@ var useUpgradeSmartAccount = ({
|
|
|
10461
10464
|
const { refresh: refreshSmartAccountQueries } = useRefreshSmartAccountQueries();
|
|
10462
10465
|
const { data: newImplementationAddress } = useAccountImplementationAddress(targetVersion);
|
|
10463
10466
|
const buildClauses = React10.useCallback(async () => {
|
|
10464
|
-
if (!smartAccountAddress || !
|
|
10467
|
+
if (!smartAccountAddress || !chunk2EYSG3VY_cjs.isValidAddress(smartAccountAddress)) {
|
|
10465
10468
|
throw new Error("Invalid smart account address");
|
|
10466
10469
|
}
|
|
10467
10470
|
if (!newImplementationAddress) {
|
|
@@ -10492,7 +10495,7 @@ var useUpgradeSmartAccount = ({
|
|
|
10492
10495
|
const result = useSendTransaction({
|
|
10493
10496
|
privyUIOptions: {
|
|
10494
10497
|
title: "Upgrade Smart Account",
|
|
10495
|
-
description: `Upgrading your account at ${
|
|
10498
|
+
description: `Upgrading your account at ${chunk2EYSG3VY_cjs.humanAddress(
|
|
10496
10499
|
smartAccountAddress
|
|
10497
10500
|
)} to version ${targetVersion}`,
|
|
10498
10501
|
buttonText: "Sign to continue"
|
|
@@ -10518,7 +10521,7 @@ var getErc20Balance = async (thor, tokenAddress, address) => {
|
|
|
10518
10521
|
if (res.reverted) throw new Error("Reverted");
|
|
10519
10522
|
const original = res.decoded[0];
|
|
10520
10523
|
const scaled = ethers.formatEther(original);
|
|
10521
|
-
const formatted = scaled === "0" ? "0" :
|
|
10524
|
+
const formatted = scaled === "0" ? "0" : chunk2EYSG3VY_cjs.humanNumber(scaled);
|
|
10522
10525
|
return {
|
|
10523
10526
|
original,
|
|
10524
10527
|
scaled,
|
|
@@ -11398,7 +11401,7 @@ var AccountDetailsButton = ({
|
|
|
11398
11401
|
wordBreak: "break-word",
|
|
11399
11402
|
whiteSpace: "normal",
|
|
11400
11403
|
w: "full",
|
|
11401
|
-
children: wallet?.domain ?
|
|
11404
|
+
children: wallet?.domain ? chunk2EYSG3VY_cjs.humanDomain(wallet?.domain ?? "", 18, 0) : chunk2EYSG3VY_cjs.humanAddress(wallet?.address ?? "", 6, 4)
|
|
11402
11405
|
}
|
|
11403
11406
|
)
|
|
11404
11407
|
] }),
|
|
@@ -11545,7 +11548,7 @@ var AccountSelector = ({
|
|
|
11545
11548
|
props: { width: 7, height: 7 }
|
|
11546
11549
|
}
|
|
11547
11550
|
),
|
|
11548
|
-
/* @__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) })
|
|
11549
11552
|
] }),
|
|
11550
11553
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11551
11554
|
react.Icon,
|
|
@@ -11628,17 +11631,17 @@ var AssetIcons = ({
|
|
|
11628
11631
|
border: "2px solid #00000024",
|
|
11629
11632
|
alignItems: "center",
|
|
11630
11633
|
justifyContent: "center",
|
|
11631
|
-
children:
|
|
11632
|
-
|
|
11634
|
+
children: chunk2EYSG3VY_cjs.TOKEN_LOGO_COMPONENTS[token.symbol] ? React10__default.default.cloneElement(
|
|
11635
|
+
chunk2EYSG3VY_cjs.TOKEN_LOGO_COMPONENTS[token.symbol],
|
|
11633
11636
|
{
|
|
11634
11637
|
width: `${iconSize * 0.8}px`,
|
|
11635
11638
|
height: `${iconSize * 0.8}px`,
|
|
11636
11639
|
rounded: "full"
|
|
11637
11640
|
}
|
|
11638
|
-
) :
|
|
11641
|
+
) : chunk2EYSG3VY_cjs.TOKEN_LOGOS[token.symbol] ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11639
11642
|
react.Image,
|
|
11640
11643
|
{
|
|
11641
|
-
src:
|
|
11644
|
+
src: chunk2EYSG3VY_cjs.TOKEN_LOGOS[token.symbol],
|
|
11642
11645
|
alt: `${token.symbol} logo`,
|
|
11643
11646
|
width: `${iconSize * 0.8}px`,
|
|
11644
11647
|
height: `${iconSize * 0.8}px`,
|
|
@@ -12511,7 +12514,7 @@ var NetworkInfo = () => {
|
|
|
12511
12514
|
InfoRow,
|
|
12512
12515
|
{
|
|
12513
12516
|
label: t("Node URL"),
|
|
12514
|
-
value: network.nodeUrl ||
|
|
12517
|
+
value: network.nodeUrl || chunk2EYSG3VY_cjs.getConfig(network.type).nodeUrl
|
|
12515
12518
|
}
|
|
12516
12519
|
),
|
|
12517
12520
|
connection.isConnectedWithPrivy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -12748,7 +12751,7 @@ var WalletSecuredBy = () => {
|
|
|
12748
12751
|
var EmbeddedWalletContent = ({ setCurrentContent }) => {
|
|
12749
12752
|
const { t } = reactI18next.useTranslation();
|
|
12750
12753
|
const { connectedWallet, connection } = useWallet();
|
|
12751
|
-
const walletImage =
|
|
12754
|
+
const walletImage = chunk2EYSG3VY_cjs.getPicassoImage(connectedWallet?.address ?? "");
|
|
12752
12755
|
const { getConnectionCache } = useCrossAppConnectionCache();
|
|
12753
12756
|
const connectionCache = getConnectionCache();
|
|
12754
12757
|
const { darkMode: isDark } = useVeChainKitConfig();
|
|
@@ -13206,8 +13209,8 @@ var SendTokenContent = ({
|
|
|
13206
13209
|
bg: isDark ? "whiteAlpha.300" : "blackAlpha.300"
|
|
13207
13210
|
},
|
|
13208
13211
|
onClick: () => setIsSelectingToken(true),
|
|
13209
|
-
leftIcon:
|
|
13210
|
-
|
|
13212
|
+
leftIcon: chunk2EYSG3VY_cjs.TOKEN_LOGO_COMPONENTS[selectedToken.symbol] ? React10__default.default.cloneElement(
|
|
13213
|
+
chunk2EYSG3VY_cjs.TOKEN_LOGO_COMPONENTS[selectedToken.symbol],
|
|
13211
13214
|
{
|
|
13212
13215
|
boxSize: "20px",
|
|
13213
13216
|
borderRadius: "full"
|
|
@@ -13215,7 +13218,7 @@ var SendTokenContent = ({
|
|
|
13215
13218
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
13216
13219
|
react.Image,
|
|
13217
13220
|
{
|
|
13218
|
-
src:
|
|
13221
|
+
src: chunk2EYSG3VY_cjs.TOKEN_LOGOS[selectedToken.symbol],
|
|
13219
13222
|
alt: `${selectedToken.symbol} logo`,
|
|
13220
13223
|
boxSize: "20px",
|
|
13221
13224
|
borderRadius: "full",
|
|
@@ -13423,7 +13426,7 @@ var SendTokenSummaryContent = ({
|
|
|
13423
13426
|
if (avatar) {
|
|
13424
13427
|
return avatar;
|
|
13425
13428
|
}
|
|
13426
|
-
return
|
|
13429
|
+
return chunk2EYSG3VY_cjs.getPicassoImage(resolvedAddress || toAddressOrDomain);
|
|
13427
13430
|
}, [avatar, network.type, resolvedAddress, toAddressOrDomain]);
|
|
13428
13431
|
const handleSend = async () => {
|
|
13429
13432
|
if (upgradeRequired) {
|
|
@@ -13854,7 +13857,7 @@ var DomainListItem = ({
|
|
|
13854
13857
|
props: {
|
|
13855
13858
|
width: "40px",
|
|
13856
13859
|
height: "40px",
|
|
13857
|
-
src: metadata.image ??
|
|
13860
|
+
src: metadata.image ?? chunk2EYSG3VY_cjs.getPicassoImage(domain.name),
|
|
13858
13861
|
alt: domain.name
|
|
13859
13862
|
}
|
|
13860
13863
|
}
|
|
@@ -13866,7 +13869,7 @@ var DomainListItem = ({
|
|
|
13866
13869
|
color: isDark ? "whiteAlpha.900" : "gray.700",
|
|
13867
13870
|
fontSize: "md",
|
|
13868
13871
|
fontWeight: "500",
|
|
13869
|
-
children:
|
|
13872
|
+
children: chunk2EYSG3VY_cjs.humanDomain(domain.name, 24, 0)
|
|
13870
13873
|
}
|
|
13871
13874
|
),
|
|
13872
13875
|
isCurrentDomain && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -14651,7 +14654,7 @@ var CustomizationContent = ({
|
|
|
14651
14654
|
setPreviewImageUrl(newPreviewUrl);
|
|
14652
14655
|
const uploadedImage = await onUpload(file);
|
|
14653
14656
|
if (!uploadedImage) throw new Error("Failed to compress image");
|
|
14654
|
-
const ipfsHash = await
|
|
14657
|
+
const ipfsHash = await chunk2EYSG3VY_cjs.uploadBlobToIPFS(
|
|
14655
14658
|
uploadedImage.file,
|
|
14656
14659
|
file.name,
|
|
14657
14660
|
network.type
|
|
@@ -14754,7 +14757,7 @@ var CustomizationContent = ({
|
|
|
14754
14757
|
backgroundPosition: "center",
|
|
14755
14758
|
position: "relative",
|
|
14756
14759
|
h: "80px",
|
|
14757
|
-
background: `no-repeat url('${
|
|
14760
|
+
background: `no-repeat url('${chunk2EYSG3VY_cjs.getPicassoImage(
|
|
14758
14761
|
account?.address ?? ""
|
|
14759
14762
|
)}')`,
|
|
14760
14763
|
w: "100%",
|
|
@@ -15241,14 +15244,14 @@ var CustomizationSummaryContent = ({
|
|
|
15241
15244
|
if (changes.avatarIpfsHash) {
|
|
15242
15245
|
queryClient.setQueryData(
|
|
15243
15246
|
getAvatarQueryKey(domain, network.type),
|
|
15244
|
-
|
|
15247
|
+
chunk2EYSG3VY_cjs.convertUriToUrl(
|
|
15245
15248
|
"ipfs://" + changes.avatarIpfsHash,
|
|
15246
15249
|
network.type
|
|
15247
15250
|
)
|
|
15248
15251
|
);
|
|
15249
15252
|
queryClient.setQueryData(
|
|
15250
15253
|
getAvatarOfAddressQueryKey(account?.address ?? ""),
|
|
15251
|
-
|
|
15254
|
+
chunk2EYSG3VY_cjs.convertUriToUrl(
|
|
15252
15255
|
"ipfs://" + changes.avatarIpfsHash,
|
|
15253
15256
|
network.type
|
|
15254
15257
|
)
|
|
@@ -15752,7 +15755,7 @@ var ManageCustomTokenContent = ({
|
|
|
15752
15755
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15753
15756
|
react.Image,
|
|
15754
15757
|
{
|
|
15755
|
-
src:
|
|
15758
|
+
src: chunk2EYSG3VY_cjs.TOKEN_LOGOS[token?.symbol],
|
|
15756
15759
|
alt: `${token.symbol} logo`,
|
|
15757
15760
|
boxSize: "20px",
|
|
15758
15761
|
borderRadius: "full",
|
|
@@ -15782,7 +15785,7 @@ var ManageCustomTokenContent = ({
|
|
|
15782
15785
|
),
|
|
15783
15786
|
/* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontWeight: "medium", children: token.symbol ?? "Unknown" })
|
|
15784
15787
|
] }),
|
|
15785
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.Text, { opacity: 0.7, children:
|
|
15788
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Text, { opacity: 0.7, children: chunk2EYSG3VY_cjs.humanAddress(
|
|
15786
15789
|
token.address ?? "",
|
|
15787
15790
|
4,
|
|
15788
15791
|
4
|
|
@@ -15854,7 +15857,8 @@ var ChangeCurrencyContent = ({
|
|
|
15854
15857
|
setCurrentContent
|
|
15855
15858
|
}) => {
|
|
15856
15859
|
const { t } = reactI18next.useTranslation();
|
|
15857
|
-
const { currentCurrency,
|
|
15860
|
+
const { currentCurrency, setCurrency } = useCurrentCurrency();
|
|
15861
|
+
const { allCurrencies: allCurrencies2 } = useCurrency();
|
|
15858
15862
|
React10.useEffect(() => {
|
|
15859
15863
|
localStorage.setItem("settings-currency-visited", "true");
|
|
15860
15864
|
}, []);
|
|
@@ -15864,13 +15868,13 @@ var ChangeCurrencyContent = ({
|
|
|
15864
15868
|
w: "full",
|
|
15865
15869
|
variant: "ghost",
|
|
15866
15870
|
justifyContent: "space-between",
|
|
15867
|
-
onClick: () =>
|
|
15871
|
+
onClick: () => setCurrency(currency),
|
|
15868
15872
|
py: 6,
|
|
15869
15873
|
px: 4,
|
|
15870
15874
|
_hover: { bg: "whiteAlpha.100" },
|
|
15871
15875
|
children: [
|
|
15872
15876
|
/* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { spacing: 3, children: [
|
|
15873
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "xl", children:
|
|
15877
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Text, { fontSize: "xl", children: chunk2EYSG3VY_cjs.CURRENCY_SYMBOLS[currency] }),
|
|
15874
15878
|
/* @__PURE__ */ jsxRuntime.jsx(react.Text, { children: currency.toUpperCase() })
|
|
15875
15879
|
] }),
|
|
15876
15880
|
currentCurrency === currency && /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { as: bs.BsCheck, boxSize: 5, color: "blue.500" })
|
|
@@ -16237,11 +16241,11 @@ var TermsAndPrivacyAccordion = () => {
|
|
|
16237
16241
|
const { agreements, documents } = useLegalDocuments();
|
|
16238
16242
|
const agreementsByDocumentType = React10.useMemo(() => {
|
|
16239
16243
|
const userAgreements = agreements?.filter(
|
|
16240
|
-
(agreement) =>
|
|
16244
|
+
(agreement) => chunk2EYSG3VY_cjs.compareAddresses(agreement.walletAddress, account?.address)
|
|
16241
16245
|
);
|
|
16242
16246
|
const vechainKitDefaultTerms = {
|
|
16243
16247
|
id: "vechain-kit-terms",
|
|
16244
|
-
...
|
|
16248
|
+
...chunk2EYSG3VY_cjs.VECHAIN_KIT_TERMS_CONFIG,
|
|
16245
16249
|
documentType: "terms" /* TERMS */,
|
|
16246
16250
|
documentSource: "vechain-kit" /* VECHAIN_KIT */,
|
|
16247
16251
|
walletAddress: account?.address ?? "",
|
|
@@ -16568,7 +16572,7 @@ var PrivyLinkedAccounts = ({ onBack }) => {
|
|
|
16568
16572
|
case "phone":
|
|
16569
16573
|
return account.number;
|
|
16570
16574
|
case "wallet":
|
|
16571
|
-
return `${
|
|
16575
|
+
return `${chunk2EYSG3VY_cjs.humanAddress(account.address)} - ${account.walletClientType}`;
|
|
16572
16576
|
default:
|
|
16573
16577
|
return "";
|
|
16574
16578
|
}
|
|
@@ -17343,7 +17347,7 @@ var SharedAppCard = ({
|
|
|
17343
17347
|
react.Image,
|
|
17344
17348
|
{
|
|
17345
17349
|
src: imageUrl,
|
|
17346
|
-
fallbackSrc:
|
|
17350
|
+
fallbackSrc: chunk2EYSG3VY_cjs.notFoundImage,
|
|
17347
17351
|
alt: name,
|
|
17348
17352
|
height: "90px",
|
|
17349
17353
|
objectFit: "contain",
|
|
@@ -17465,7 +17469,7 @@ var ShortcutsSection = ({}) => {
|
|
|
17465
17469
|
react.Image,
|
|
17466
17470
|
{
|
|
17467
17471
|
src: shortcut.image,
|
|
17468
|
-
fallbackSrc:
|
|
17472
|
+
fallbackSrc: chunk2EYSG3VY_cjs.notFoundImage,
|
|
17469
17473
|
alt: shortcut.name,
|
|
17470
17474
|
objectFit: "contain",
|
|
17471
17475
|
rounded: "full"
|
|
@@ -17963,7 +17967,7 @@ var TransactionModalContent = ({
|
|
|
17963
17967
|
}
|
|
17964
17968
|
};
|
|
17965
17969
|
const statusConfig = getStatusConfig();
|
|
17966
|
-
const socialDescription = `${
|
|
17970
|
+
const socialDescription = `${chunk2EYSG3VY_cjs.getConfig(network.type).explorerUrl}/${txReceipt?.meta.txID}`;
|
|
17967
17971
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { children: [
|
|
17968
17972
|
/* @__PURE__ */ jsxRuntime.jsxs(StickyHeaderContainer, { children: [
|
|
17969
17973
|
/* @__PURE__ */ jsxRuntime.jsx(react.ModalHeader, { children: statusConfig.title }),
|
|
@@ -18041,7 +18045,7 @@ var TransactionModalContent = ({
|
|
|
18041
18045
|
uiConfig?.showExplorerButton && txReceipt?.meta.txID && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18042
18046
|
react.Link,
|
|
18043
18047
|
{
|
|
18044
|
-
href: `${
|
|
18048
|
+
href: `${chunk2EYSG3VY_cjs.getConfig(network.type).explorerUrl}/${txReceipt?.meta.txID}`,
|
|
18045
18049
|
isExternal: true,
|
|
18046
18050
|
opacity: 0.5,
|
|
18047
18051
|
fontSize: "14px",
|
|
@@ -18104,7 +18108,7 @@ var SuccessfulOperationContent = ({
|
|
|
18104
18108
|
}) => {
|
|
18105
18109
|
const { t } = reactI18next.useTranslation();
|
|
18106
18110
|
const { network, darkMode } = useVeChainKitConfig();
|
|
18107
|
-
const explorerUrl =
|
|
18111
|
+
const explorerUrl = chunk2EYSG3VY_cjs.getConfig(network.type).explorerUrl;
|
|
18108
18112
|
const socialDescription = `${explorerUrl}/${txId}`;
|
|
18109
18113
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { children: [
|
|
18110
18114
|
/* @__PURE__ */ jsxRuntime.jsxs(StickyHeaderContainer, { children: [
|
|
@@ -18500,19 +18504,19 @@ var WalletDisplay = ({ variant }) => {
|
|
|
18500
18504
|
return null;
|
|
18501
18505
|
}
|
|
18502
18506
|
if (variant === "iconAndDomain") {
|
|
18503
|
-
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) });
|
|
18504
18508
|
}
|
|
18505
18509
|
if (variant === "iconDomainAndAssets") {
|
|
18506
18510
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { spacing: 4, children: [
|
|
18507
18511
|
/* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { spacing: 0, alignItems: "flex-start", children: [
|
|
18508
|
-
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) }),
|
|
18509
18513
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18510
18514
|
react.Text,
|
|
18511
18515
|
{
|
|
18512
18516
|
fontSize: account.domain ? "xs" : "sm",
|
|
18513
18517
|
opacity: account.domain ? 0.5 : 1,
|
|
18514
18518
|
"data-testid": "trimmed-address",
|
|
18515
|
-
children:
|
|
18519
|
+
children: chunk2EYSG3VY_cjs.humanAddress(account.address ?? "", 4, 4)
|
|
18516
18520
|
}
|
|
18517
18521
|
)
|
|
18518
18522
|
] }),
|
|
@@ -18520,13 +18524,13 @@ var WalletDisplay = ({ variant }) => {
|
|
|
18520
18524
|
] });
|
|
18521
18525
|
}
|
|
18522
18526
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { spacing: 0, alignItems: "flex-start", children: [
|
|
18523
|
-
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) }),
|
|
18524
18528
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18525
18529
|
react.Text,
|
|
18526
18530
|
{
|
|
18527
18531
|
fontSize: account.domain ? "xs" : "sm",
|
|
18528
18532
|
opacity: account.domain ? 0.5 : 1,
|
|
18529
|
-
children:
|
|
18533
|
+
children: chunk2EYSG3VY_cjs.humanAddress(account.address ?? "", 4, 4)
|
|
18530
18534
|
}
|
|
18531
18535
|
)
|
|
18532
18536
|
] });
|
|
@@ -18705,7 +18709,7 @@ var TransactionToastContent = ({
|
|
|
18705
18709
|
}) => {
|
|
18706
18710
|
const { t } = reactI18next.useTranslation();
|
|
18707
18711
|
const { network } = useVeChainKitConfig();
|
|
18708
|
-
const explorerUrl =
|
|
18712
|
+
const explorerUrl = chunk2EYSG3VY_cjs.getConfig(network.type).explorerUrl;
|
|
18709
18713
|
const errorMessage = React10.useMemo(() => {
|
|
18710
18714
|
if (!txError) return null;
|
|
18711
18715
|
return txError.reason || t("Something went wrong. Please try again.");
|
|
@@ -19169,7 +19173,7 @@ var ProfileCard = ({
|
|
|
19169
19173
|
const { account } = useWallet();
|
|
19170
19174
|
const { network } = useVeChainKitConfig();
|
|
19171
19175
|
const metadata = useWalletMetadata(address, network.type);
|
|
19172
|
-
const headerImageSvg =
|
|
19176
|
+
const headerImageSvg = chunk2EYSG3VY_cjs.getPicassoImage(address);
|
|
19173
19177
|
const isConnectedAccount = address === account?.address;
|
|
19174
19178
|
const hasLinks = metadata?.records?.url || metadata?.records?.["com.x"] || metadata?.records?.email;
|
|
19175
19179
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Card, { variant: "vechainKitBase", ...style?.card, children: [
|
|
@@ -19342,7 +19346,7 @@ var SuccessfulOperationContent2 = ({
|
|
|
19342
19346
|
}) => {
|
|
19343
19347
|
const { t } = reactI18next.useTranslation();
|
|
19344
19348
|
const { network, darkMode } = useVeChainKitConfig();
|
|
19345
|
-
const explorerUrl =
|
|
19349
|
+
const explorerUrl = chunk2EYSG3VY_cjs.getConfig(network.type).explorerUrl;
|
|
19346
19350
|
const socialDescription = `${explorerUrl}/${txId}`;
|
|
19347
19351
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { children: [
|
|
19348
19352
|
/* @__PURE__ */ jsxRuntime.jsxs(StickyHeaderContainer, { children: [
|
|
@@ -19983,7 +19987,7 @@ var useReceiveModal = () => {
|
|
|
19983
19987
|
var ReceiveModalProvider = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
19984
19988
|
var useLoginModalContent = () => {
|
|
19985
19989
|
const { privy, loginMethods } = useVeChainKitConfig();
|
|
19986
|
-
const isVeChainApp = privy?.appId ===
|
|
19990
|
+
const isVeChainApp = privy?.appId === chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID;
|
|
19987
19991
|
const isLoginMethodEnabled = (method35) => {
|
|
19988
19992
|
if (!loginMethods) return true;
|
|
19989
19993
|
if (Array.isArray(method35)) {
|
|
@@ -20089,7 +20093,7 @@ var useTransferERC20 = ({
|
|
|
20089
20093
|
const queryClient = reactQuery.useQueryClient();
|
|
20090
20094
|
const { refresh } = useRefreshBalances();
|
|
20091
20095
|
const buildClauses = React10.useCallback(async () => {
|
|
20092
|
-
if (!receiverAddress || !amount || !
|
|
20096
|
+
if (!receiverAddress || !amount || !chunk2EYSG3VY_cjs.isValidAddress(receiverAddress))
|
|
20093
20097
|
throw new Error("Invalid receiver address or amount");
|
|
20094
20098
|
const clausesArray = [];
|
|
20095
20099
|
clausesArray.push({
|
|
@@ -20112,7 +20116,7 @@ var useTransferERC20 = ({
|
|
|
20112
20116
|
signerAccountAddress: fromAddress,
|
|
20113
20117
|
privyUIOptions: {
|
|
20114
20118
|
title: "Confirm Transfer",
|
|
20115
|
-
description: `Transfer ${amount} ${tokenName} to ${
|
|
20119
|
+
description: `Transfer ${amount} ${tokenName} to ${chunk2EYSG3VY_cjs.humanAddress(
|
|
20116
20120
|
receiverAddress
|
|
20117
20121
|
)}`,
|
|
20118
20122
|
buttonText: "Sign to continue"
|
|
@@ -20138,7 +20142,7 @@ var useTransferVET = ({
|
|
|
20138
20142
|
}) => {
|
|
20139
20143
|
const { refresh } = useRefreshBalances();
|
|
20140
20144
|
const buildClauses = React10.useCallback(async () => {
|
|
20141
|
-
if (!receiverAddress || !amount || !
|
|
20145
|
+
if (!receiverAddress || !amount || !chunk2EYSG3VY_cjs.isValidAddress(receiverAddress))
|
|
20142
20146
|
throw new Error("Invalid receiver address or amount");
|
|
20143
20147
|
if (isNaN(Number(amount))) {
|
|
20144
20148
|
throw new Error("Invalid amount");
|
|
@@ -20162,7 +20166,7 @@ var useTransferVET = ({
|
|
|
20162
20166
|
signerAccountAddress: fromAddress,
|
|
20163
20167
|
privyUIOptions: {
|
|
20164
20168
|
title: "Confirm Transfer",
|
|
20165
|
-
description: `Transfer ${amount} VET to ${
|
|
20169
|
+
description: `Transfer ${amount} VET to ${chunk2EYSG3VY_cjs.humanAddress(
|
|
20166
20170
|
receiverAddress
|
|
20167
20171
|
)}`,
|
|
20168
20172
|
buttonText: "Sign to continue"
|
|
@@ -20427,16 +20431,16 @@ var useCrossAppConnectionCache = () => {
|
|
|
20427
20431
|
var useLoginWithVeChain = () => {
|
|
20428
20432
|
const { login: loginWithVeChain } = usePrivyCrossAppSdk();
|
|
20429
20433
|
const { setConnectionCache } = useCrossAppConnectionCache();
|
|
20430
|
-
const { data: appsInfo } = useFetchAppInfo([
|
|
20434
|
+
const { data: appsInfo } = useFetchAppInfo([chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID]);
|
|
20431
20435
|
const { user } = reactAuth.usePrivy();
|
|
20432
20436
|
const login = async () => {
|
|
20433
20437
|
try {
|
|
20434
20438
|
Analytics.auth.methodSelected("vechain" /* VECHAIN */);
|
|
20435
|
-
await loginWithVeChain(
|
|
20439
|
+
await loginWithVeChain(chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID);
|
|
20436
20440
|
setConnectionCache({
|
|
20437
20441
|
name: "VeChain",
|
|
20438
|
-
logoUrl: appsInfo?.[
|
|
20439
|
-
appId:
|
|
20442
|
+
logoUrl: appsInfo?.[chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID]?.logo_url,
|
|
20443
|
+
appId: chunk2EYSG3VY_cjs.VECHAIN_PRIVY_APP_ID,
|
|
20440
20444
|
website: "https://governance.vebetterdao.org"
|
|
20441
20445
|
});
|
|
20442
20446
|
Analytics.auth.completed({
|
|
@@ -20671,7 +20675,7 @@ var AddressDisplayCard = ({
|
|
|
20671
20675
|
fontSize: "xs",
|
|
20672
20676
|
opacity: 0.5,
|
|
20673
20677
|
"data-testid": `${label.toLowerCase()}-address`,
|
|
20674
|
-
children:
|
|
20678
|
+
children: chunk2EYSG3VY_cjs.humanAddress(address, 6, 4)
|
|
20675
20679
|
}
|
|
20676
20680
|
)
|
|
20677
20681
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -20680,7 +20684,7 @@ var AddressDisplayCard = ({
|
|
|
20680
20684
|
fontWeight: "medium",
|
|
20681
20685
|
fontSize: "sm",
|
|
20682
20686
|
"data-testid": `${label.toLowerCase()}-address`,
|
|
20683
|
-
children:
|
|
20687
|
+
children: chunk2EYSG3VY_cjs.humanAddress(address, 6, 4)
|
|
20684
20688
|
}
|
|
20685
20689
|
) })
|
|
20686
20690
|
] }),
|
|
@@ -20813,7 +20817,7 @@ var TransactionButtonAndStatus = ({
|
|
|
20813
20817
|
color: isDark ? "whiteAlpha.600" : "blackAlpha.600",
|
|
20814
20818
|
textAlign: "center",
|
|
20815
20819
|
width: "full",
|
|
20816
|
-
href: `${
|
|
20820
|
+
href: `${chunk2EYSG3VY_cjs.getConfig(network.type).explorerUrl}/${txReceipt?.meta.txID}`,
|
|
20817
20821
|
target: "_blank",
|
|
20818
20822
|
rel: "noopener noreferrer",
|
|
20819
20823
|
children: t("View transaction on the explorer")
|
|
@@ -21311,9 +21315,13 @@ var LegalDocumentsContext = React10.createContext(void 0);
|
|
|
21311
21315
|
var useLegalDocuments = () => {
|
|
21312
21316
|
const context = React10.useContext(LegalDocumentsContext);
|
|
21313
21317
|
if (!context) {
|
|
21314
|
-
|
|
21315
|
-
|
|
21316
|
-
|
|
21318
|
+
return {
|
|
21319
|
+
hasAgreedToRequiredDocuments: true,
|
|
21320
|
+
agreements: [],
|
|
21321
|
+
walletAddress: void 0,
|
|
21322
|
+
documents: [],
|
|
21323
|
+
documentsNotAgreed: []
|
|
21324
|
+
};
|
|
21317
21325
|
}
|
|
21318
21326
|
return context;
|
|
21319
21327
|
};
|
|
@@ -21326,7 +21334,7 @@ var LegalDocumentsProvider = ({ children }) => {
|
|
|
21326
21334
|
const isDocumentRejectedByUser = React10.useCallback(
|
|
21327
21335
|
(doc, walletAddress) => {
|
|
21328
21336
|
return optionalRejected.some(
|
|
21329
|
-
(rejected) =>
|
|
21337
|
+
(rejected) => chunk2EYSG3VY_cjs.compareAddresses(rejected.walletAddress, walletAddress) && rejected.id === doc.id
|
|
21330
21338
|
);
|
|
21331
21339
|
},
|
|
21332
21340
|
[optionalRejected]
|
|
@@ -21361,7 +21369,7 @@ var LegalDocumentsProvider = ({ children }) => {
|
|
|
21361
21369
|
);
|
|
21362
21370
|
if (isAnalyticsAllowed) {
|
|
21363
21371
|
allDocs.push({
|
|
21364
|
-
...
|
|
21372
|
+
...chunk2EYSG3VY_cjs.VECHAIN_KIT_COOKIES_CONFIG,
|
|
21365
21373
|
documentType: "cookies" /* COOKIES */,
|
|
21366
21374
|
documentSource: "vechain-kit" /* VECHAIN_KIT */
|
|
21367
21375
|
});
|
|
@@ -21374,14 +21382,14 @@ var LegalDocumentsProvider = ({ children }) => {
|
|
|
21374
21382
|
if (!account?.address) return [];
|
|
21375
21383
|
return documents.filter((document2) => {
|
|
21376
21384
|
const isAgreed = storedAgreements.some(
|
|
21377
|
-
(agreement) =>
|
|
21385
|
+
(agreement) => chunk2EYSG3VY_cjs.compareAddresses(
|
|
21378
21386
|
agreement.walletAddress,
|
|
21379
21387
|
account.address
|
|
21380
21388
|
) && agreement.id === document2.id
|
|
21381
21389
|
);
|
|
21382
21390
|
if (isAgreed) return false;
|
|
21383
21391
|
const isRejected = optionalRejected.some(
|
|
21384
|
-
(rejection) =>
|
|
21392
|
+
(rejection) => chunk2EYSG3VY_cjs.compareAddresses(
|
|
21385
21393
|
rejection.walletAddress,
|
|
21386
21394
|
account.address
|
|
21387
21395
|
) && rejection.id === document2.id
|
|
@@ -21393,7 +21401,7 @@ var LegalDocumentsProvider = ({ children }) => {
|
|
|
21393
21401
|
if (!requiredDocuments.length || !account?.address) return true;
|
|
21394
21402
|
return requiredDocuments.every(
|
|
21395
21403
|
(document2) => storedAgreements.some(
|
|
21396
|
-
(saved) =>
|
|
21404
|
+
(saved) => chunk2EYSG3VY_cjs.compareAddresses(saved.walletAddress, account.address) && saved.id === document2.id
|
|
21397
21405
|
)
|
|
21398
21406
|
);
|
|
21399
21407
|
}, [requiredDocuments, storedAgreements, account?.address]);
|
|
@@ -21446,7 +21454,7 @@ var LegalDocumentsProvider = ({ children }) => {
|
|
|
21446
21454
|
walletAddress
|
|
21447
21455
|
);
|
|
21448
21456
|
const filteredAgreements = storedAgreements.filter(
|
|
21449
|
-
(saved) => !
|
|
21457
|
+
(saved) => !chunk2EYSG3VY_cjs.compareAddresses(saved.walletAddress, walletAddress) || !documentsArray.some((term) => term.id === saved.id)
|
|
21450
21458
|
);
|
|
21451
21459
|
const updated = [...filteredAgreements, ...newAgreements];
|
|
21452
21460
|
setStoredAgreements(updated);
|
|
@@ -21672,7 +21680,7 @@ var PrivyWalletProvider = ({
|
|
|
21672
21680
|
clauses.push(
|
|
21673
21681
|
sdkCore.Clause.callFunction(
|
|
21674
21682
|
sdkCore.Address.of(
|
|
21675
|
-
|
|
21683
|
+
chunk2EYSG3VY_cjs.getConfig(network.type).accountFactoryAddress
|
|
21676
21684
|
),
|
|
21677
21685
|
sdkCore.ABIContract.ofAbi(chunkEESC6JDT_cjs.SimpleAccountFactoryABI).getFunction(
|
|
21678
21686
|
"createAccount"
|
|
@@ -21747,7 +21755,7 @@ var PrivyWalletProvider = ({
|
|
|
21747
21755
|
clauses.push(
|
|
21748
21756
|
sdkCore.Clause.callFunction(
|
|
21749
21757
|
sdkCore.Address.of(
|
|
21750
|
-
|
|
21758
|
+
chunk2EYSG3VY_cjs.getConfig(network.type).accountFactoryAddress
|
|
21751
21759
|
),
|
|
21752
21760
|
sdkCore.ABIContract.ofAbi(chunkEESC6JDT_cjs.SimpleAccountFactoryABI).getFunction(
|
|
21753
21761
|
"createAccount"
|
|
@@ -21796,10 +21804,10 @@ var PrivyWalletProvider = ({
|
|
|
21796
21804
|
[
|
|
21797
21805
|
{
|
|
21798
21806
|
privateKey: Buffer.from(
|
|
21799
|
-
|
|
21807
|
+
chunk2EYSG3VY_cjs.randomTransactionUser.privateKey.slice(2),
|
|
21800
21808
|
"hex"
|
|
21801
21809
|
),
|
|
21802
|
-
address:
|
|
21810
|
+
address: chunk2EYSG3VY_cjs.randomTransactionUser.address
|
|
21803
21811
|
}
|
|
21804
21812
|
],
|
|
21805
21813
|
{ gasPayer: { gasPayerServiceUrl: delegatorUrl } }
|
|
@@ -21810,11 +21818,11 @@ var PrivyWalletProvider = ({
|
|
|
21810
21818
|
true
|
|
21811
21819
|
);
|
|
21812
21820
|
const signer = await providerWithDelegationEnabled.getSigner(
|
|
21813
|
-
|
|
21821
|
+
chunk2EYSG3VY_cjs.randomTransactionUser.address
|
|
21814
21822
|
);
|
|
21815
21823
|
const txInput = sdkNetwork.signerUtils.transactionBodyToTransactionRequestInput(
|
|
21816
21824
|
txBody,
|
|
21817
|
-
|
|
21825
|
+
chunk2EYSG3VY_cjs.randomTransactionUser.address
|
|
21818
21826
|
);
|
|
21819
21827
|
const rawDelegateSigned = await signer.signTransaction(txInput);
|
|
21820
21828
|
const { id } = await fetch(`${nodeUrl}/transactions`, {
|
|
@@ -21853,7 +21861,7 @@ var PrivyWalletProvider = ({
|
|
|
21853
21861
|
PrivyWalletProviderContext.Provider,
|
|
21854
21862
|
{
|
|
21855
21863
|
value: {
|
|
21856
|
-
accountFactory:
|
|
21864
|
+
accountFactory: chunk2EYSG3VY_cjs.getConfig(network.type).accountFactoryAddress,
|
|
21857
21865
|
sendTransaction,
|
|
21858
21866
|
signMessage,
|
|
21859
21867
|
signTypedData,
|
|
@@ -21924,7 +21932,7 @@ var validateConfig = (props) => {
|
|
|
21924
21932
|
if (props?.legalDocuments) {
|
|
21925
21933
|
if (props.legalDocuments.termsAndConditions) {
|
|
21926
21934
|
props.legalDocuments.termsAndConditions.forEach((term) => {
|
|
21927
|
-
if (!
|
|
21935
|
+
if (!chunk2EYSG3VY_cjs.isValidUrl(term.url)) {
|
|
21928
21936
|
errors.push(
|
|
21929
21937
|
`legalDocuments.termsAndConditions.url is invalid: ${term.url}`
|
|
21930
21938
|
);
|
|
@@ -21933,7 +21941,7 @@ var validateConfig = (props) => {
|
|
|
21933
21941
|
}
|
|
21934
21942
|
if (props.legalDocuments.privacyPolicy) {
|
|
21935
21943
|
props.legalDocuments.privacyPolicy.forEach((term) => {
|
|
21936
|
-
if (!
|
|
21944
|
+
if (!chunk2EYSG3VY_cjs.isValidUrl(term.url)) {
|
|
21937
21945
|
errors.push(
|
|
21938
21946
|
`legalDocuments.privacyPolicy.url is invalid: ${term.url}`
|
|
21939
21947
|
);
|
|
@@ -21942,7 +21950,7 @@ var validateConfig = (props) => {
|
|
|
21942
21950
|
}
|
|
21943
21951
|
if (props.legalDocuments.cookiePolicy) {
|
|
21944
21952
|
props.legalDocuments.cookiePolicy.forEach((term) => {
|
|
21945
|
-
if (!
|
|
21953
|
+
if (!chunk2EYSG3VY_cjs.isValidUrl(term.url)) {
|
|
21946
21954
|
errors.push(
|
|
21947
21955
|
`legalDocuments.cookiePolicy.url is invalid: ${term.url}`
|
|
21948
21956
|
);
|
|
@@ -21972,14 +21980,35 @@ var VeChainKitProvider = (props) => {
|
|
|
21972
21980
|
network,
|
|
21973
21981
|
allowCustomTokens,
|
|
21974
21982
|
legalDocuments,
|
|
21975
|
-
defaultCurrency = "usd"
|
|
21983
|
+
defaultCurrency = "usd",
|
|
21984
|
+
onLanguageChange,
|
|
21985
|
+
onCurrencyChange
|
|
21976
21986
|
} = validatedProps;
|
|
21977
21987
|
const validatedLoginMethods = loginMethods;
|
|
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;
|
|
21993
|
+
}
|
|
21994
|
+
return language || "en";
|
|
21995
|
+
});
|
|
21996
|
+
const [currentCurrency, setCurrentCurrencyState] = React10.useState(
|
|
21997
|
+
() => {
|
|
21998
|
+
const stored = chunk2EYSG3VY_cjs.getLocalStorageItem(CURRENCY_STORAGE_KEY);
|
|
21999
|
+
if (stored && ["usd", "eur", "gbp"].includes(stored)) {
|
|
22000
|
+
return stored;
|
|
22001
|
+
}
|
|
22002
|
+
return defaultCurrency;
|
|
22003
|
+
}
|
|
22004
|
+
);
|
|
22005
|
+
const isUpdatingFromPropRef = React10.useRef(false);
|
|
22006
|
+
const isUpdatingCurrencyFromPropRef = React10.useRef(false);
|
|
21978
22007
|
const allowedEcosystemApps = React10.useMemo(() => {
|
|
21979
22008
|
const userEcosystemMethods = validatedLoginMethods?.find(
|
|
21980
22009
|
(method35) => method35.method === "ecosystem"
|
|
21981
22010
|
);
|
|
21982
|
-
return userEcosystemMethods?.allowedApps ??
|
|
22011
|
+
return userEcosystemMethods?.allowedApps ?? chunk2EYSG3VY_cjs.DEFAULT_PRIVY_ECOSYSTEM_APPS.map((app) => app.id);
|
|
21983
22012
|
}, [validatedLoginMethods]);
|
|
21984
22013
|
let privyAppId, privyClientId;
|
|
21985
22014
|
if (!privy) {
|
|
@@ -21991,9 +22020,6 @@ var VeChainKitProvider = (props) => {
|
|
|
21991
22020
|
}
|
|
21992
22021
|
React10.useEffect(() => {
|
|
21993
22022
|
initializeI18n(i18n_default);
|
|
21994
|
-
if (language) {
|
|
21995
|
-
i18n_default.changeLanguage(language);
|
|
21996
|
-
}
|
|
21997
22023
|
if (i18nConfig) {
|
|
21998
22024
|
Object.keys(i18nConfig).forEach((lang) => {
|
|
21999
22025
|
i18n_default.addResourceBundle(
|
|
@@ -22005,9 +22031,86 @@ var VeChainKitProvider = (props) => {
|
|
|
22005
22031
|
);
|
|
22006
22032
|
});
|
|
22007
22033
|
}
|
|
22008
|
-
|
|
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]);
|
|
22054
|
+
React10.useEffect(() => {
|
|
22055
|
+
const handleLanguageChanged = (lng) => {
|
|
22056
|
+
if (!isUpdatingFromPropRef.current && lng !== currentLanguage) {
|
|
22057
|
+
setCurrentLanguageState(lng);
|
|
22058
|
+
onLanguageChange?.(lng);
|
|
22059
|
+
}
|
|
22060
|
+
};
|
|
22061
|
+
i18n_default.on("languageChanged", handleLanguageChanged);
|
|
22062
|
+
return () => {
|
|
22063
|
+
i18n_default.off("languageChanged", handleLanguageChanged);
|
|
22064
|
+
};
|
|
22065
|
+
}, [currentLanguage, onLanguageChange]);
|
|
22009
22066
|
React10.useEffect(() => {
|
|
22010
|
-
|
|
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
|
+
};
|
|
22112
|
+
React10.useEffect(() => {
|
|
22113
|
+
localStorage.setItem(chunk2EYSG3VY_cjs.VECHAIN_KIT_STORAGE_KEYS.NETWORK, network.type);
|
|
22011
22114
|
}, [network]);
|
|
22012
22115
|
return /* @__PURE__ */ jsxRuntime.jsxs(EnsureQueryClient, { children: [
|
|
22013
22116
|
/* @__PURE__ */ jsxRuntime.jsx(reactQueryDevtools.ReactQueryDevtools, { initialIsOpen: false }),
|
|
@@ -22024,10 +22127,14 @@ var VeChainKitProvider = (props) => {
|
|
|
22024
22127
|
darkMode,
|
|
22025
22128
|
i18n: i18nConfig,
|
|
22026
22129
|
language,
|
|
22130
|
+
currentLanguage,
|
|
22027
22131
|
network,
|
|
22028
22132
|
allowCustomTokens,
|
|
22029
22133
|
legalDocuments,
|
|
22030
|
-
defaultCurrency
|
|
22134
|
+
defaultCurrency,
|
|
22135
|
+
currentCurrency,
|
|
22136
|
+
setLanguage,
|
|
22137
|
+
setCurrency
|
|
22031
22138
|
},
|
|
22032
22139
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
22033
22140
|
reactAuth.PrivyProvider,
|
|
@@ -22061,13 +22168,13 @@ var VeChainKitProvider = (props) => {
|
|
|
22061
22168
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
22062
22169
|
dappKitReact.DAppKitProvider,
|
|
22063
22170
|
{
|
|
22064
|
-
nodeUrl: network.nodeUrl ??
|
|
22171
|
+
nodeUrl: network.nodeUrl ?? chunk2EYSG3VY_cjs.getConfig(network.type).nodeUrl,
|
|
22065
22172
|
genesis: network.genesisId ? {
|
|
22066
|
-
...
|
|
22173
|
+
...chunk2EYSG3VY_cjs.getConfig(network.type).network.genesis,
|
|
22067
22174
|
id: network.genesisId
|
|
22068
|
-
} :
|
|
22175
|
+
} : chunk2EYSG3VY_cjs.getConfig(network.type).network.genesis,
|
|
22069
22176
|
i18n: i18nConfig,
|
|
22070
|
-
language,
|
|
22177
|
+
language: currentLanguage,
|
|
22071
22178
|
logLevel: dappKit.logLevel,
|
|
22072
22179
|
modalParent: dappKit.modalParent,
|
|
22073
22180
|
onSourceClick: dappKit.onSourceClick,
|
|
@@ -22100,7 +22207,7 @@ var VeChainKitProvider = (props) => {
|
|
|
22100
22207
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
22101
22208
|
PrivyWalletProvider,
|
|
22102
22209
|
{
|
|
22103
|
-
nodeUrl: network.nodeUrl ??
|
|
22210
|
+
nodeUrl: network.nodeUrl ?? chunk2EYSG3VY_cjs.getConfig(network.type).nodeUrl,
|
|
22104
22211
|
delegatorUrl: feeDelegation?.delegatorUrl ?? "",
|
|
22105
22212
|
delegateAllTransactions: feeDelegation?.delegateAllTransactions ?? false,
|
|
22106
22213
|
children: /* @__PURE__ */ jsxRuntime.jsx(ModalProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(LegalDocumentsProvider, { children }) })
|
|
@@ -22457,31 +22564,31 @@ var VechainKitThemeProvider = ({
|
|
|
22457
22564
|
|
|
22458
22565
|
Object.defineProperty(exports, "CURRENCY_SYMBOLS", {
|
|
22459
22566
|
enumerable: true,
|
|
22460
|
-
get: function () { return
|
|
22567
|
+
get: function () { return chunk2EYSG3VY_cjs.CURRENCY_SYMBOLS; }
|
|
22461
22568
|
});
|
|
22462
22569
|
Object.defineProperty(exports, "ENS_TEXT_RECORDS", {
|
|
22463
22570
|
enumerable: true,
|
|
22464
|
-
get: function () { return
|
|
22571
|
+
get: function () { return chunk2EYSG3VY_cjs.ENS_TEXT_RECORDS; }
|
|
22465
22572
|
});
|
|
22466
22573
|
Object.defineProperty(exports, "LegalDocumentSource", {
|
|
22467
22574
|
enumerable: true,
|
|
22468
|
-
get: function () { return
|
|
22575
|
+
get: function () { return chunk2EYSG3VY_cjs.LegalDocumentSource; }
|
|
22469
22576
|
});
|
|
22470
22577
|
Object.defineProperty(exports, "LegalDocumentType", {
|
|
22471
22578
|
enumerable: true,
|
|
22472
|
-
get: function () { return
|
|
22579
|
+
get: function () { return chunk2EYSG3VY_cjs.LegalDocumentType; }
|
|
22473
22580
|
});
|
|
22474
22581
|
Object.defineProperty(exports, "NFTMediaType", {
|
|
22475
22582
|
enumerable: true,
|
|
22476
|
-
get: function () { return
|
|
22583
|
+
get: function () { return chunk2EYSG3VY_cjs.NFTMediaType; }
|
|
22477
22584
|
});
|
|
22478
22585
|
Object.defineProperty(exports, "VePassportUserStatus", {
|
|
22479
22586
|
enumerable: true,
|
|
22480
|
-
get: function () { return
|
|
22587
|
+
get: function () { return chunk2EYSG3VY_cjs.VePassportUserStatus; }
|
|
22481
22588
|
});
|
|
22482
22589
|
Object.defineProperty(exports, "getConfig", {
|
|
22483
22590
|
enumerable: true,
|
|
22484
|
-
get: function () { return
|
|
22591
|
+
get: function () { return chunk2EYSG3VY_cjs.getConfig; }
|
|
22485
22592
|
});
|
|
22486
22593
|
Object.defineProperty(exports, "useMfaEnrollment", {
|
|
22487
22594
|
enumerable: true,
|
|
@@ -22800,6 +22907,8 @@ exports.useCurrentAccountImplementationVersion = useCurrentAccountImplementation
|
|
|
22800
22907
|
exports.useCurrentAllocationsRound = useCurrentAllocationsRound;
|
|
22801
22908
|
exports.useCurrentAllocationsRoundId = useCurrentAllocationsRoundId;
|
|
22802
22909
|
exports.useCurrentBlock = useCurrentBlock;
|
|
22910
|
+
exports.useCurrentCurrency = useCurrentCurrency;
|
|
22911
|
+
exports.useCurrentLanguage = useCurrentLanguage;
|
|
22803
22912
|
exports.useDecodeFunctionSignature = useDecodeFunctionSignature;
|
|
22804
22913
|
exports.useEcosystemShortcuts = useEcosystemShortcuts;
|
|
22805
22914
|
exports.useEnsRecordExists = useEnsRecordExists;
|