@openzeppelin/ui-builder-adapter-evm 0.16.0 → 1.2.0
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/README.md +1 -1
- package/dist/index.cjs +415 -351
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +123 -69
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/__tests__/adapter-parsing.test.ts +67 -1
- package/src/__tests__/mocks/mock-network-configs.ts +3 -2
- package/src/__tests__/providerSelection.test.ts +1 -1
- package/src/abi/__tests__/etherscan-v2.test.ts +1 -1
- package/src/abi/__tests__/transformer.test.ts +1 -1
- package/src/abi/comparison.ts +1 -1
- package/src/abi/etherscan-v2.ts +2 -2
- package/src/abi/etherscan.ts +2 -2
- package/src/abi/loader.ts +2 -2
- package/src/abi/sourcify.ts +2 -2
- package/src/abi/transformer.ts +2 -6
- package/src/adapter.ts +19 -2
- package/src/config.ts +1 -1
- package/src/configuration/__tests__/explorer.test.ts +1 -1
- package/src/configuration/__tests__/rpc.test.ts +4 -4
- package/src/configuration/execution.ts +2 -2
- package/src/configuration/explorer.ts +2 -6
- package/src/configuration/network-services.ts +3 -3
- package/src/configuration/rpc.ts +50 -2
- package/src/mapping/__tests__/field-generator.test.ts +1 -1
- package/src/mapping/constants.ts +26 -1
- package/src/mapping/field-generator.ts +2 -2
- package/src/mapping/type-mapper.ts +1 -1
- package/src/proxy/detection.ts +1 -1
- package/src/query/handler.ts +2 -2
- package/src/query/view-checker.ts +1 -1
- package/src/transaction/components/AdvancedInfo.tsx +1 -1
- package/src/transaction/components/CustomGasParameters.tsx +2 -2
- package/src/transaction/components/EvmRelayerOptions.tsx +1 -1
- package/src/transaction/components/SpeedSelection.tsx +1 -1
- package/src/transaction/eoa.ts +2 -2
- package/src/transaction/execution-strategy.ts +1 -1
- package/src/transaction/formatter.ts +2 -2
- package/src/transaction/relayer.ts +2 -2
- package/src/transaction/sender.ts +2 -2
- package/src/transform/input-parser.ts +2 -2
- package/src/transform/output-formatter.ts +2 -2
- package/src/types.ts +1 -1
- package/src/validation/eoa.ts +2 -2
- package/src/validation/relayer.ts +1 -1
- package/src/wallet/README.md +4 -4
- package/src/wallet/__tests__/utils.test.ts +2 -2
- package/src/wallet/components/EvmWalletUiRoot.tsx +2 -2
- package/src/wallet/components/account/AccountDisplay.tsx +4 -4
- package/src/wallet/components/connect/ConnectButton.tsx +4 -7
- package/src/wallet/components/connect/ConnectorDialog.tsx +3 -6
- package/src/wallet/components/network/NetworkSwitcher.tsx +8 -8
- package/src/wallet/evmUiKitManager.ts +2 -2
- package/src/wallet/hooks/facade-hooks.ts +1 -1
- package/src/wallet/hooks/useUiKitConfig.ts +2 -2
- package/src/wallet/implementation/wagmi-implementation.ts +3 -3
- package/src/wallet/rainbowkit/__tests__/export-service.test.ts +1 -1
- package/src/wallet/rainbowkit/componentFactory.ts +1 -1
- package/src/wallet/rainbowkit/components.tsx +3 -3
- package/src/wallet/rainbowkit/config-generator.ts +1 -1
- package/src/wallet/rainbowkit/config-service.ts +2 -2
- package/src/wallet/rainbowkit/export-service.ts +1 -1
- package/src/wallet/rainbowkit/rainbowkitAssetManager.ts +1 -1
- package/src/wallet/rainbowkit/utils.ts +2 -2
- package/src/wallet/services/configResolutionService.ts +2 -2
- package/src/wallet/types.ts +1 -1
- package/src/wallet/utils/SafeWagmiComponent.tsx +1 -1
- package/src/wallet/utils/__tests__/uiKitService.test.ts +3 -3
- package/src/wallet/utils/connection.ts +2 -2
- package/src/wallet/utils/filterWalletComponents.ts +3 -3
- package/src/wallet/utils/uiKitService.ts +2 -2
- package/src/wallet/utils/walletImplementationManager.ts +2 -2
- package/src/wallet/utils.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -39,25 +39,25 @@ __export(rainbowkitAssetManager_exports, {
|
|
|
39
39
|
});
|
|
40
40
|
async function ensureRainbowKitAssetsLoaded() {
|
|
41
41
|
if (loadedAssets) {
|
|
42
|
-
|
|
42
|
+
import_ui_utils17.logger.debug("RainbowKitAssetManager", "Assets already loaded, returning cached.");
|
|
43
43
|
return loadedAssets;
|
|
44
44
|
}
|
|
45
45
|
if (!providerPromise) {
|
|
46
46
|
providerPromise = import("@rainbow-me/rainbowkit").then((module2) => {
|
|
47
47
|
const component = module2.RainbowKitProvider;
|
|
48
|
-
|
|
48
|
+
import_ui_utils17.logger.info("RainbowKitAssetManager", "RainbowKitProvider module loaded.");
|
|
49
49
|
return component;
|
|
50
50
|
}).catch((err) => {
|
|
51
|
-
|
|
51
|
+
import_ui_utils17.logger.error("RainbowKitAssetManager", "Failed to load RainbowKitProvider module:", err);
|
|
52
52
|
return null;
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
if (!cssPromise) {
|
|
56
56
|
cssPromise = import("@rainbow-me/rainbowkit/styles.css").then(() => {
|
|
57
|
-
|
|
57
|
+
import_ui_utils17.logger.info("RainbowKitAssetManager", "RainbowKit CSS loaded successfully.");
|
|
58
58
|
return true;
|
|
59
59
|
}).catch((err) => {
|
|
60
|
-
|
|
60
|
+
import_ui_utils17.logger.error("RainbowKitAssetManager", "Failed to load RainbowKit CSS:", err);
|
|
61
61
|
return false;
|
|
62
62
|
});
|
|
63
63
|
}
|
|
@@ -65,7 +65,7 @@ async function ensureRainbowKitAssetsLoaded() {
|
|
|
65
65
|
const [ProviderComponent, cssLoadedSuccess] = await Promise.all([providerPromise, cssPromise]);
|
|
66
66
|
loadedAssets = { ProviderComponent, cssLoaded: cssLoadedSuccess };
|
|
67
67
|
if (!ProviderComponent || !cssLoadedSuccess) {
|
|
68
|
-
|
|
68
|
+
import_ui_utils17.logger.warn(
|
|
69
69
|
"RainbowKitAssetManager",
|
|
70
70
|
"One or more RainbowKit assets failed to load.",
|
|
71
71
|
loadedAssets
|
|
@@ -73,16 +73,16 @@ async function ensureRainbowKitAssetsLoaded() {
|
|
|
73
73
|
}
|
|
74
74
|
return loadedAssets;
|
|
75
75
|
} catch (error) {
|
|
76
|
-
|
|
76
|
+
import_ui_utils17.logger.error("RainbowKitAssetManager", "Error in Promise.all for asset loading:", error);
|
|
77
77
|
loadedAssets = { ProviderComponent: null, cssLoaded: false };
|
|
78
78
|
return loadedAssets;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
var
|
|
81
|
+
var import_ui_utils17, loadedAssets, providerPromise, cssPromise;
|
|
82
82
|
var init_rainbowkitAssetManager = __esm({
|
|
83
83
|
"src/wallet/rainbowkit/rainbowkitAssetManager.ts"() {
|
|
84
84
|
"use strict";
|
|
85
|
-
|
|
85
|
+
import_ui_utils17 = require("@openzeppelin/ui-utils");
|
|
86
86
|
loadedAssets = null;
|
|
87
87
|
providerPromise = null;
|
|
88
88
|
cssPromise = null;
|
|
@@ -127,10 +127,10 @@ __export(index_exports, {
|
|
|
127
127
|
module.exports = __toCommonJS(index_exports);
|
|
128
128
|
|
|
129
129
|
// src/adapter.ts
|
|
130
|
-
var
|
|
130
|
+
var import_ui_utils40 = require("@openzeppelin/ui-utils");
|
|
131
131
|
|
|
132
132
|
// src/abi/comparison.ts
|
|
133
|
-
var
|
|
133
|
+
var import_ui_utils = require("@openzeppelin/ui-utils");
|
|
134
134
|
|
|
135
135
|
// src/abi/types.ts
|
|
136
136
|
function isValidAbiArray(value) {
|
|
@@ -176,8 +176,8 @@ var AbiComparisonService = class {
|
|
|
176
176
|
}
|
|
177
177
|
const normalized1 = this.normalizeAbi(validation1.normalizedAbi);
|
|
178
178
|
const normalized2 = this.normalizeAbi(validation2.normalizedAbi);
|
|
179
|
-
const hash1 = (0,
|
|
180
|
-
const hash2 = (0,
|
|
179
|
+
const hash1 = (0, import_ui_utils.simpleHash)(JSON.stringify(normalized1));
|
|
180
|
+
const hash2 = (0, import_ui_utils.simpleHash)(JSON.stringify(normalized2));
|
|
181
181
|
if (hash1 === hash2) {
|
|
182
182
|
return {
|
|
183
183
|
identical: true,
|
|
@@ -195,7 +195,7 @@ var AbiComparisonService = class {
|
|
|
195
195
|
summary: this.generateSummary(differences)
|
|
196
196
|
};
|
|
197
197
|
} catch (error) {
|
|
198
|
-
|
|
198
|
+
import_ui_utils.logger.error("ABI comparison failed:", error.message);
|
|
199
199
|
return {
|
|
200
200
|
identical: false,
|
|
201
201
|
differences: [],
|
|
@@ -266,9 +266,9 @@ var AbiComparisonService = class {
|
|
|
266
266
|
}
|
|
267
267
|
const normalized = this.normalizeAbi(validation.normalizedAbi);
|
|
268
268
|
const normalizedString = JSON.stringify(normalized);
|
|
269
|
-
return (0,
|
|
269
|
+
return (0, import_ui_utils.simpleHash)(normalizedString);
|
|
270
270
|
} catch (error) {
|
|
271
|
-
|
|
271
|
+
import_ui_utils.logger.error("ABI hashing failed:", error.message);
|
|
272
272
|
throw new Error(`Failed to hash ABI: ${error.message}`);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
@@ -453,7 +453,7 @@ var AbiComparisonService = class {
|
|
|
453
453
|
var abiComparisonService = new AbiComparisonService();
|
|
454
454
|
|
|
455
455
|
// src/configuration/network-services.ts
|
|
456
|
-
var
|
|
456
|
+
var import_ui_utils6 = require("@openzeppelin/ui-utils");
|
|
457
457
|
|
|
458
458
|
// src/types/providers.ts
|
|
459
459
|
var EvmProviderKeys = {
|
|
@@ -469,13 +469,13 @@ function isEvmProviderKey(value) {
|
|
|
469
469
|
}
|
|
470
470
|
|
|
471
471
|
// src/configuration/explorer.ts
|
|
472
|
-
var
|
|
472
|
+
var import_ui_utils4 = require("@openzeppelin/ui-utils");
|
|
473
473
|
|
|
474
474
|
// src/abi/etherscan-v2.ts
|
|
475
|
-
var
|
|
475
|
+
var import_ui_utils3 = require("@openzeppelin/ui-utils");
|
|
476
476
|
|
|
477
477
|
// src/abi/transformer.ts
|
|
478
|
-
var
|
|
478
|
+
var import_ui_utils2 = require("@openzeppelin/ui-utils");
|
|
479
479
|
|
|
480
480
|
// src/types/artifacts.ts
|
|
481
481
|
function isEvmContractArtifacts(obj) {
|
|
@@ -537,7 +537,7 @@ var gweiToWei = (gwei) => {
|
|
|
537
537
|
|
|
538
538
|
// src/abi/transformer.ts
|
|
539
539
|
function transformAbiToSchema(abi, contractName, address) {
|
|
540
|
-
|
|
540
|
+
import_ui_utils2.logger.info("transformAbiToSchema", `Transforming ABI to ContractSchema for: ${contractName}`);
|
|
541
541
|
const functions = [];
|
|
542
542
|
for (const item of abi) {
|
|
543
543
|
if (item.type === "function") {
|
|
@@ -572,7 +572,7 @@ function transformAbiToSchema(abi, contractName, address) {
|
|
|
572
572
|
address,
|
|
573
573
|
functions
|
|
574
574
|
};
|
|
575
|
-
|
|
575
|
+
import_ui_utils2.logger.info(
|
|
576
576
|
"transformAbiToSchema",
|
|
577
577
|
`Transformation complete. Found ${contractSchema.functions.length} functions.`
|
|
578
578
|
);
|
|
@@ -663,20 +663,20 @@ async function loadAbiFromEtherscanV2(address, networkConfig) {
|
|
|
663
663
|
);
|
|
664
664
|
let response;
|
|
665
665
|
try {
|
|
666
|
-
|
|
666
|
+
import_ui_utils3.logger.info(
|
|
667
667
|
"loadAbiFromEtherscanV2",
|
|
668
668
|
`Fetching ABI from Etherscan V2 API for address: ${address} on chain ${networkConfig.chainId}`
|
|
669
669
|
);
|
|
670
670
|
response = await fetch(url);
|
|
671
671
|
} catch (networkError) {
|
|
672
|
-
|
|
672
|
+
import_ui_utils3.logger.error(
|
|
673
673
|
"loadAbiFromEtherscanV2",
|
|
674
674
|
`Network error fetching ABI from Explorer V2 API: ${networkError}`
|
|
675
675
|
);
|
|
676
676
|
throw new Error(`Network error fetching ABI: ${networkError.message}`);
|
|
677
677
|
}
|
|
678
678
|
if (!response.ok) {
|
|
679
|
-
|
|
679
|
+
import_ui_utils3.logger.error(
|
|
680
680
|
"loadAbiFromEtherscanV2",
|
|
681
681
|
`Explorer V2 API request failed with status: ${response.status}`
|
|
682
682
|
);
|
|
@@ -686,14 +686,14 @@ async function loadAbiFromEtherscanV2(address, networkConfig) {
|
|
|
686
686
|
try {
|
|
687
687
|
apiResult = await response.json();
|
|
688
688
|
} catch (jsonError) {
|
|
689
|
-
|
|
689
|
+
import_ui_utils3.logger.error(
|
|
690
690
|
"loadAbiFromEtherscanV2",
|
|
691
691
|
`Failed to parse Explorer V2 API response as JSON: ${jsonError}`
|
|
692
692
|
);
|
|
693
693
|
throw new Error("Invalid JSON response received from Explorer V2 API.");
|
|
694
694
|
}
|
|
695
695
|
if (apiResult.status !== "1") {
|
|
696
|
-
|
|
696
|
+
import_ui_utils3.logger.warn(
|
|
697
697
|
"loadAbiFromEtherscanV2",
|
|
698
698
|
`Explorer V2 API error: Status ${apiResult.status}, Message: ${apiResult.message}, Result: ${apiResult.result}`
|
|
699
699
|
);
|
|
@@ -724,13 +724,13 @@ async function loadAbiFromEtherscanV2(address, networkConfig) {
|
|
|
724
724
|
throw new Error("Parsed ABI from Explorer V2 API is not an array.");
|
|
725
725
|
}
|
|
726
726
|
} catch (error) {
|
|
727
|
-
|
|
727
|
+
import_ui_utils3.logger.error(
|
|
728
728
|
"loadAbiFromEtherscanV2",
|
|
729
729
|
`Failed to parse ABI JSON string from Explorer V2 API result: ${error}`
|
|
730
730
|
);
|
|
731
731
|
throw new Error(`Invalid ABI JSON received from Explorer V2 API: ${error.message}`);
|
|
732
732
|
}
|
|
733
|
-
|
|
733
|
+
import_ui_utils3.logger.info(
|
|
734
734
|
"loadAbiFromEtherscanV2",
|
|
735
735
|
`Successfully parsed ABI for ${networkConfig.name} with ${abi.length} items using V2 API.`
|
|
736
736
|
);
|
|
@@ -799,12 +799,12 @@ async function testEtherscanV2Connection(networkConfig, apiKey) {
|
|
|
799
799
|
// src/configuration/explorer.ts
|
|
800
800
|
function resolveExplorerConfig(networkConfig) {
|
|
801
801
|
const isV2 = networkConfig.supportsEtherscanV2 && networkConfig.primaryExplorerApiIdentifier === "etherscan-v2";
|
|
802
|
-
const globalV2ApiKey = isV2 ?
|
|
803
|
-
const appApiKey = networkConfig.primaryExplorerApiIdentifier ?
|
|
804
|
-
const rawCfg =
|
|
802
|
+
const globalV2ApiKey = isV2 ? import_ui_utils4.appConfigService.getGlobalServiceConfig("etherscanv2")?.apiKey : void 0;
|
|
803
|
+
const appApiKey = networkConfig.primaryExplorerApiIdentifier ? import_ui_utils4.appConfigService.getExplorerApiKey(networkConfig.primaryExplorerApiIdentifier) : void 0;
|
|
804
|
+
const rawCfg = import_ui_utils4.userNetworkServiceConfigService.get(networkConfig.id, "explorer");
|
|
805
805
|
if (rawCfg && typeof rawCfg === "object") {
|
|
806
806
|
const userCfg = rawCfg;
|
|
807
|
-
|
|
807
|
+
import_ui_utils4.logger.info("ExplorerConfig", `Using user-configured explorer for ${networkConfig.name}`);
|
|
808
808
|
return {
|
|
809
809
|
explorerUrl: userCfg.explorerUrl ?? networkConfig.explorerUrl,
|
|
810
810
|
apiUrl: userCfg.apiUrl ?? networkConfig.apiUrl,
|
|
@@ -814,7 +814,7 @@ function resolveExplorerConfig(networkConfig) {
|
|
|
814
814
|
};
|
|
815
815
|
}
|
|
816
816
|
if (isV2 && globalV2ApiKey) {
|
|
817
|
-
|
|
817
|
+
import_ui_utils4.logger.info("ExplorerConfig", `Using global Etherscan V2 API key for ${networkConfig.name}`);
|
|
818
818
|
return {
|
|
819
819
|
explorerUrl: networkConfig.explorerUrl,
|
|
820
820
|
apiUrl: networkConfig.apiUrl,
|
|
@@ -824,7 +824,7 @@ function resolveExplorerConfig(networkConfig) {
|
|
|
824
824
|
};
|
|
825
825
|
}
|
|
826
826
|
if (appApiKey) {
|
|
827
|
-
|
|
827
|
+
import_ui_utils4.logger.info("ExplorerConfig", `Using app-configured API key for ${networkConfig.name}`);
|
|
828
828
|
return {
|
|
829
829
|
explorerUrl: networkConfig.explorerUrl,
|
|
830
830
|
apiUrl: networkConfig.apiUrl,
|
|
@@ -833,7 +833,7 @@ function resolveExplorerConfig(networkConfig) {
|
|
|
833
833
|
isCustom: false
|
|
834
834
|
};
|
|
835
835
|
}
|
|
836
|
-
|
|
836
|
+
import_ui_utils4.logger.info(
|
|
837
837
|
"ExplorerConfig",
|
|
838
838
|
`Using default explorer for ${networkConfig.name} (no API key configured)`
|
|
839
839
|
);
|
|
@@ -946,12 +946,12 @@ async function testEvmExplorerConnection(explorerConfig, networkConfig) {
|
|
|
946
946
|
}
|
|
947
947
|
|
|
948
948
|
// src/configuration/rpc.ts
|
|
949
|
-
var
|
|
949
|
+
var import_ui_utils5 = require("@openzeppelin/ui-utils");
|
|
950
950
|
function buildRpcUrl(config) {
|
|
951
951
|
return config.url;
|
|
952
952
|
}
|
|
953
953
|
function getUserRpcUrl(networkId) {
|
|
954
|
-
const svcCfg =
|
|
954
|
+
const svcCfg = import_ui_utils5.userNetworkServiceConfigService.get(networkId, "rpc");
|
|
955
955
|
if (svcCfg && typeof svcCfg === "object" && "rpcUrl" in svcCfg) {
|
|
956
956
|
return svcCfg.rpcUrl;
|
|
957
957
|
}
|
|
@@ -963,17 +963,17 @@ function resolveRpcUrl(networkConfig) {
|
|
|
963
963
|
const userRpcUrl = getUserRpcUrl(networkId);
|
|
964
964
|
if (userRpcUrl) {
|
|
965
965
|
const userRpcUrlString = String(userRpcUrl);
|
|
966
|
-
if ((0,
|
|
967
|
-
|
|
966
|
+
if ((0, import_ui_utils5.isValidUrl)(userRpcUrlString)) {
|
|
967
|
+
import_ui_utils5.logger.info(logSystem, `Using user-configured RPC URL for network ${networkId}`);
|
|
968
968
|
return userRpcUrlString;
|
|
969
969
|
} else {
|
|
970
|
-
|
|
970
|
+
import_ui_utils5.logger.warn(
|
|
971
971
|
logSystem,
|
|
972
972
|
`User-configured RPC URL for ${networkId} is invalid: ${userRpcUrlString}. Falling back.`
|
|
973
973
|
);
|
|
974
974
|
}
|
|
975
975
|
}
|
|
976
|
-
const rpcOverrideSetting =
|
|
976
|
+
const rpcOverrideSetting = import_ui_utils5.appConfigService.getRpcEndpointOverride(networkId);
|
|
977
977
|
let rpcUrlFromOverride;
|
|
978
978
|
if (typeof rpcOverrideSetting === "string") {
|
|
979
979
|
rpcUrlFromOverride = rpcOverrideSetting;
|
|
@@ -986,27 +986,27 @@ function resolveRpcUrl(networkConfig) {
|
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
988
|
if (rpcUrlFromOverride) {
|
|
989
|
-
|
|
989
|
+
import_ui_utils5.logger.info(
|
|
990
990
|
logSystem,
|
|
991
991
|
`Using overridden RPC URL for network ${networkId}: ${rpcUrlFromOverride}`
|
|
992
992
|
);
|
|
993
|
-
if ((0,
|
|
993
|
+
if ((0, import_ui_utils5.isValidUrl)(rpcUrlFromOverride)) {
|
|
994
994
|
return rpcUrlFromOverride;
|
|
995
995
|
} else {
|
|
996
|
-
|
|
996
|
+
import_ui_utils5.logger.warn(
|
|
997
997
|
logSystem,
|
|
998
998
|
`Overridden RPC URL for ${networkId} is invalid: ${rpcUrlFromOverride}. Falling back.`
|
|
999
999
|
);
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
-
if (networkConfig.rpcUrl && (0,
|
|
1003
|
-
|
|
1002
|
+
if (networkConfig.rpcUrl && (0, import_ui_utils5.isValidUrl)(networkConfig.rpcUrl)) {
|
|
1003
|
+
import_ui_utils5.logger.debug(
|
|
1004
1004
|
logSystem,
|
|
1005
1005
|
`Using default RPC URL for network ${networkId}: ${networkConfig.rpcUrl}`
|
|
1006
1006
|
);
|
|
1007
1007
|
return networkConfig.rpcUrl;
|
|
1008
1008
|
}
|
|
1009
|
-
|
|
1009
|
+
import_ui_utils5.logger.error(
|
|
1010
1010
|
logSystem,
|
|
1011
1011
|
`No valid RPC URL could be resolved for network ${networkId}. Checked user config, override, and networkConfig.rpcUrl.`
|
|
1012
1012
|
);
|
|
@@ -1016,13 +1016,13 @@ function resolveRpcUrl(networkConfig) {
|
|
|
1016
1016
|
}
|
|
1017
1017
|
function validateEvmRpcEndpoint(rpcConfig) {
|
|
1018
1018
|
try {
|
|
1019
|
-
if (!(0,
|
|
1020
|
-
|
|
1019
|
+
if (!(0, import_ui_utils5.isValidUrl)(rpcConfig.url)) {
|
|
1020
|
+
import_ui_utils5.logger.error("validateEvmRpcEndpoint", `Invalid RPC URL format: ${rpcConfig.url}`);
|
|
1021
1021
|
return false;
|
|
1022
1022
|
}
|
|
1023
1023
|
return true;
|
|
1024
1024
|
} catch (error) {
|
|
1025
|
-
|
|
1025
|
+
import_ui_utils5.logger.error("validateEvmRpcEndpoint", "Error validating RPC endpoint:", error);
|
|
1026
1026
|
return false;
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
@@ -1057,7 +1057,7 @@ async function testEvmRpcConnection(rpcConfig, timeoutMs = 5e3) {
|
|
|
1057
1057
|
}
|
|
1058
1058
|
return { success: true, latency };
|
|
1059
1059
|
} catch (error) {
|
|
1060
|
-
|
|
1060
|
+
import_ui_utils5.logger.error("testEvmRpcConnection", "Connection test failed:", error);
|
|
1061
1061
|
if (error instanceof Error && error.name === "AbortError") {
|
|
1062
1062
|
return {
|
|
1063
1063
|
success: false,
|
|
@@ -1072,12 +1072,47 @@ async function testEvmRpcConnection(rpcConfig, timeoutMs = 5e3) {
|
|
|
1072
1072
|
clearTimeout(timeoutId);
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
|
+
async function getEvmCurrentBlock(networkConfig) {
|
|
1076
|
+
const rpcUrl = resolveRpcUrl(networkConfig);
|
|
1077
|
+
try {
|
|
1078
|
+
const response = await fetch(rpcUrl, {
|
|
1079
|
+
method: "POST",
|
|
1080
|
+
headers: { "Content-Type": "application/json" },
|
|
1081
|
+
body: JSON.stringify({
|
|
1082
|
+
jsonrpc: "2.0",
|
|
1083
|
+
method: "eth_blockNumber",
|
|
1084
|
+
params: [],
|
|
1085
|
+
id: 1
|
|
1086
|
+
})
|
|
1087
|
+
});
|
|
1088
|
+
if (!response.ok) {
|
|
1089
|
+
throw new Error(`RPC request failed with status ${response.status}`);
|
|
1090
|
+
}
|
|
1091
|
+
const data = await response.json();
|
|
1092
|
+
if (data.error) {
|
|
1093
|
+
throw new Error(data.error.message || "RPC error");
|
|
1094
|
+
}
|
|
1095
|
+
if (data.result === void 0 || data.result === null) {
|
|
1096
|
+
throw new Error("RPC response missing result field");
|
|
1097
|
+
}
|
|
1098
|
+
const blockNumber = parseInt(data.result, 16);
|
|
1099
|
+
if (isNaN(blockNumber)) {
|
|
1100
|
+
throw new Error(`Invalid block number returned: ${data.result}`);
|
|
1101
|
+
}
|
|
1102
|
+
return blockNumber;
|
|
1103
|
+
} catch (error) {
|
|
1104
|
+
import_ui_utils5.logger.error("getEvmCurrentBlock", "Failed to get current block:", error);
|
|
1105
|
+
throw new Error(
|
|
1106
|
+
`Failed to get current block: ${error instanceof Error ? error.message : String(error)}`
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1075
1110
|
|
|
1076
1111
|
// src/configuration/network-services.ts
|
|
1077
1112
|
function getEvmNetworkServiceForms(networkConfig) {
|
|
1078
|
-
const globalV2ApiKey =
|
|
1113
|
+
const globalV2ApiKey = import_ui_utils6.appConfigService.getGlobalServiceConfig("etherscanv2")?.apiKey;
|
|
1079
1114
|
const v2DefaultEnabled = Boolean(globalV2ApiKey);
|
|
1080
|
-
const savedContractDefCfg =
|
|
1115
|
+
const savedContractDefCfg = import_ui_utils6.userNetworkServiceConfigService.get(
|
|
1081
1116
|
networkConfig.id,
|
|
1082
1117
|
"contract-definitions"
|
|
1083
1118
|
);
|
|
@@ -1231,7 +1266,7 @@ function getEvmNetworkServiceForms(networkConfig) {
|
|
|
1231
1266
|
{ label: "Sourcify", value: EvmProviderKeys.Sourcify }
|
|
1232
1267
|
],
|
|
1233
1268
|
// Seed from saved user config or app-config default if present; otherwise empty
|
|
1234
|
-
defaultValue: savedDefaultProvider ||
|
|
1269
|
+
defaultValue: savedDefaultProvider || import_ui_utils6.appConfigService.getGlobalServiceParam("contractdefinition", "defaultProvider") || "",
|
|
1235
1270
|
width: "full"
|
|
1236
1271
|
},
|
|
1237
1272
|
// Apply to all networks
|
|
@@ -1298,23 +1333,23 @@ var import_core3 = require("@wagmi/core");
|
|
|
1298
1333
|
var import_chains3 = require("viem/chains");
|
|
1299
1334
|
var import_wagmi = require("wagmi");
|
|
1300
1335
|
var import_react9 = require("react");
|
|
1301
|
-
var
|
|
1336
|
+
var import_ui_utils19 = require("@openzeppelin/ui-utils");
|
|
1302
1337
|
|
|
1303
1338
|
// src/wallet/context/wagmi-context.tsx
|
|
1304
1339
|
var import_react = require("react");
|
|
1305
1340
|
var WagmiProviderInitializedContext = (0, import_react.createContext)(false);
|
|
1306
1341
|
|
|
1307
1342
|
// src/wallet/evmUiKitManager.ts
|
|
1308
|
-
var
|
|
1343
|
+
var import_ui_utils18 = require("@openzeppelin/ui-utils");
|
|
1309
1344
|
|
|
1310
1345
|
// src/wallet/utils/walletImplementationManager.ts
|
|
1311
|
-
var
|
|
1346
|
+
var import_ui_utils16 = require("@openzeppelin/ui-utils");
|
|
1312
1347
|
|
|
1313
1348
|
// src/wallet/implementation/wagmi-implementation.ts
|
|
1314
1349
|
var import_connectors = require("@wagmi/connectors");
|
|
1315
1350
|
var import_core2 = require("@wagmi/core");
|
|
1316
1351
|
var import_viem3 = require("viem");
|
|
1317
|
-
var
|
|
1352
|
+
var import_ui_utils15 = require("@openzeppelin/ui-utils");
|
|
1318
1353
|
|
|
1319
1354
|
// src/networks/mainnet.ts
|
|
1320
1355
|
var import_react2 = require("@web3icons/react");
|
|
@@ -1868,19 +1903,19 @@ var evmNetworks = [...evmMainnetNetworks, ...evmTestnetNetworks];
|
|
|
1868
1903
|
// src/wallet/rainbowkit/components.tsx
|
|
1869
1904
|
var import_lucide_react4 = require("lucide-react");
|
|
1870
1905
|
var import_react8 = require("react");
|
|
1871
|
-
var
|
|
1872
|
-
var
|
|
1906
|
+
var import_ui_components5 = require("@openzeppelin/ui-components");
|
|
1907
|
+
var import_ui_utils12 = require("@openzeppelin/ui-utils");
|
|
1873
1908
|
|
|
1874
1909
|
// src/wallet/components/connect/ConnectButton.tsx
|
|
1875
1910
|
var import_lucide_react = require("lucide-react");
|
|
1876
1911
|
var import_react7 = require("react");
|
|
1877
|
-
var
|
|
1878
|
-
var
|
|
1879
|
-
var
|
|
1912
|
+
var import_ui_components2 = require("@openzeppelin/ui-components");
|
|
1913
|
+
var import_ui_react2 = require("@openzeppelin/ui-react");
|
|
1914
|
+
var import_ui_utils9 = require("@openzeppelin/ui-utils");
|
|
1880
1915
|
|
|
1881
1916
|
// src/wallet/utils/SafeWagmiComponent.tsx
|
|
1882
1917
|
var import_react5 = require("react");
|
|
1883
|
-
var
|
|
1918
|
+
var import_ui_utils7 = require("@openzeppelin/ui-utils");
|
|
1884
1919
|
|
|
1885
1920
|
// src/wallet/hooks/useIsWagmiProviderInitialized.ts
|
|
1886
1921
|
var import_react4 = require("react");
|
|
@@ -1904,7 +1939,7 @@ var SafeWagmiComponent = ({
|
|
|
1904
1939
|
(0, import_react5.useEffect)(() => {
|
|
1905
1940
|
const handleError = (event) => {
|
|
1906
1941
|
if (event.error?.message?.includes("useConfig") || event.error?.message?.includes("WagmiProvider")) {
|
|
1907
|
-
|
|
1942
|
+
import_ui_utils7.logger.debug(
|
|
1908
1943
|
"SafeWagmiComponent",
|
|
1909
1944
|
"Caught wagmi error via window error event:",
|
|
1910
1945
|
event.error
|
|
@@ -1925,7 +1960,7 @@ var SafeWagmiComponent = ({
|
|
|
1925
1960
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
1926
1961
|
} catch (error) {
|
|
1927
1962
|
if (error instanceof Error && (error.message.includes("useConfig") || error.message.includes("WagmiProvider"))) {
|
|
1928
|
-
|
|
1963
|
+
import_ui_utils7.logger.debug("SafeWagmiComponent", "Caught wagmi error:", error);
|
|
1929
1964
|
setHasError(true);
|
|
1930
1965
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: fallback });
|
|
1931
1966
|
}
|
|
@@ -1935,11 +1970,11 @@ var SafeWagmiComponent = ({
|
|
|
1935
1970
|
|
|
1936
1971
|
// src/wallet/components/connect/ConnectorDialog.tsx
|
|
1937
1972
|
var import_react6 = require("react");
|
|
1938
|
-
var
|
|
1939
|
-
var
|
|
1973
|
+
var import_ui_components = require("@openzeppelin/ui-components");
|
|
1974
|
+
var import_ui_react = require("@openzeppelin/ui-react");
|
|
1940
1975
|
|
|
1941
1976
|
// src/wallet/hooks/useUiKitConfig.ts
|
|
1942
|
-
var
|
|
1977
|
+
var import_ui_utils8 = require("@openzeppelin/ui-utils");
|
|
1943
1978
|
var defaultConfig = {
|
|
1944
1979
|
kitName: "custom",
|
|
1945
1980
|
// Default to using our custom implementation for EVM
|
|
@@ -1950,10 +1985,10 @@ var defaultConfig = {
|
|
|
1950
1985
|
};
|
|
1951
1986
|
var uiKitConfig = { ...defaultConfig };
|
|
1952
1987
|
function loadInitialConfigFromAppService() {
|
|
1953
|
-
|
|
1954
|
-
const configObj =
|
|
1988
|
+
import_ui_utils8.logger.debug("useUiKitConfig", "Attempting to load initial config from AppConfigService...");
|
|
1989
|
+
const configObj = import_ui_utils8.appConfigService.getWalletUIConfig("evm");
|
|
1955
1990
|
if (configObj && configObj.kitName) {
|
|
1956
|
-
|
|
1991
|
+
import_ui_utils8.logger.info(
|
|
1957
1992
|
"useUiKitConfig",
|
|
1958
1993
|
`Loaded initial config from AppConfigService: kitName=${configObj.kitName}`,
|
|
1959
1994
|
configObj.kitConfig
|
|
@@ -1963,7 +1998,7 @@ function loadInitialConfigFromAppService() {
|
|
|
1963
1998
|
kitConfig: { ...defaultConfig.kitConfig, ...configObj.kitConfig || {} }
|
|
1964
1999
|
};
|
|
1965
2000
|
}
|
|
1966
|
-
|
|
2001
|
+
import_ui_utils8.logger.debug(
|
|
1967
2002
|
"useUiKitConfig",
|
|
1968
2003
|
"No initial config found in AppConfigService, using module default."
|
|
1969
2004
|
);
|
|
@@ -1979,9 +2014,9 @@ function useUiKitConfig() {
|
|
|
1979
2014
|
// src/wallet/components/connect/ConnectorDialog.tsx
|
|
1980
2015
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1981
2016
|
var ConnectorDialog = ({ open, onOpenChange }) => {
|
|
1982
|
-
const unavailableContent = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1983
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1984
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2017
|
+
const unavailableContent = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui_components.Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui_components.DialogContent, { className: "sm:max-w-[425px]", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ui_components.DialogHeader, { children: [
|
|
2018
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui_components.DialogTitle, { children: "Wallet Connection Unavailable" }),
|
|
2019
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui_components.DialogDescription, { children: "The wallet connection system is not properly initialized." })
|
|
1985
2020
|
] }) }) });
|
|
1986
2021
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SafeWagmiComponent, { fallback: unavailableContent, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ConnectorDialogContent, { open, onOpenChange }) });
|
|
1987
2022
|
};
|
|
@@ -1992,8 +2027,8 @@ var ConnectorDialogContent = ({ open, onOpenChange }) => {
|
|
|
1992
2027
|
error: connectError,
|
|
1993
2028
|
isConnecting,
|
|
1994
2029
|
pendingConnector
|
|
1995
|
-
} = (0,
|
|
1996
|
-
const { isConnected } = (0,
|
|
2030
|
+
} = (0, import_ui_react.useDerivedConnectStatus)();
|
|
2031
|
+
const { isConnected } = (0, import_ui_react.useDerivedAccountStatus)();
|
|
1997
2032
|
const [connectingId, setConnectingId] = (0, import_react6.useState)(null);
|
|
1998
2033
|
const fullConfig = useUiKitConfig();
|
|
1999
2034
|
const showInjectedConnector = isConfigEnabled("showInjectedConnector");
|
|
@@ -2006,8 +2041,8 @@ var ConnectorDialogContent = ({ open, onOpenChange }) => {
|
|
|
2006
2041
|
}
|
|
2007
2042
|
}, [isConnected, connectingId, onOpenChange]);
|
|
2008
2043
|
if (!connect2) {
|
|
2009
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2010
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui_components.Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ui_components.DialogContent, { className: "sm:max-w-[425px]", children: [
|
|
2045
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui_components.DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui_components.DialogTitle, { children: "Error" }) }),
|
|
2011
2046
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "Wallet connection function is not available." })
|
|
2012
2047
|
] }) });
|
|
2013
2048
|
}
|
|
@@ -2019,13 +2054,13 @@ var ConnectorDialogContent = ({ open, onOpenChange }) => {
|
|
|
2019
2054
|
const isInjected = connector.id === "injected";
|
|
2020
2055
|
return !(isInjected && !showInjectedConnector);
|
|
2021
2056
|
});
|
|
2022
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2023
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2024
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2025
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui_components.Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ui_components.DialogContent, { className: "sm:max-w-[425px]", children: [
|
|
2058
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ui_components.DialogHeader, { children: [
|
|
2059
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui_components.DialogTitle, { children: "Connect Wallet" }),
|
|
2060
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui_components.DialogDescription, { children: "Select a wallet provider to connect with this application." })
|
|
2026
2061
|
] }),
|
|
2027
2062
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "grid gap-4 py-4", children: filteredConnectors.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-center text-muted-foreground", children: "No wallet connectors available." }) : filteredConnectors.map((connector) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2028
|
-
|
|
2063
|
+
import_ui_components.Button,
|
|
2029
2064
|
{
|
|
2030
2065
|
onClick: () => handleConnectorSelect(connector),
|
|
2031
2066
|
disabled: isConnecting && connectingId === connector.id,
|
|
@@ -2049,7 +2084,7 @@ var CustomConnectButton = ({
|
|
|
2049
2084
|
hideWhenConnected = true
|
|
2050
2085
|
}) => {
|
|
2051
2086
|
const [dialogOpen, setDialogOpen] = (0, import_react7.useState)(false);
|
|
2052
|
-
const unavailableButton = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: (0,
|
|
2087
|
+
const unavailableButton = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: (0, import_ui_utils9.cn)("flex items-center", className), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_ui_components2.Button, { disabled: true, variant: "outline", size: "sm", className: "h-8 px-2 text-xs", children: [
|
|
2053
2088
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Wallet, { className: "size-3.5 mr-1" }),
|
|
2054
2089
|
"Wallet Unavailable"
|
|
2055
2090
|
] }) });
|
|
@@ -2064,8 +2099,8 @@ var CustomConnectButton = ({
|
|
|
2064
2099
|
) });
|
|
2065
2100
|
};
|
|
2066
2101
|
var ConnectButtonContent = ({ className, dialogOpen, setDialogOpen, hideWhenConnected }) => {
|
|
2067
|
-
const { isConnected } = (0,
|
|
2068
|
-
const { isConnecting: isHookConnecting, error: connectError } = (0,
|
|
2102
|
+
const { isConnected } = (0, import_ui_react2.useDerivedAccountStatus)();
|
|
2103
|
+
const { isConnecting: isHookConnecting, error: connectError } = (0, import_ui_react2.useDerivedConnectStatus)();
|
|
2069
2104
|
const [isManuallyInitiated, setIsManuallyInitiated] = (0, import_react7.useState)(false);
|
|
2070
2105
|
(0, import_react7.useEffect)(() => {
|
|
2071
2106
|
if (isConnected && hideWhenConnected) {
|
|
@@ -2093,9 +2128,9 @@ var ConnectButtonContent = ({ className, dialogOpen, setDialogOpen, hideWhenConn
|
|
|
2093
2128
|
return null;
|
|
2094
2129
|
}
|
|
2095
2130
|
const showButtonLoading = isHookConnecting || isManuallyInitiated;
|
|
2096
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0,
|
|
2131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0, import_ui_utils9.cn)("flex items-center", className), children: [
|
|
2097
2132
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2098
|
-
|
|
2133
|
+
import_ui_components2.Button,
|
|
2099
2134
|
{
|
|
2100
2135
|
onClick: handleConnectClick,
|
|
2101
2136
|
disabled: showButtonLoading || isConnected,
|
|
@@ -2126,26 +2161,26 @@ var ConnectButtonContent = ({ className, dialogOpen, setDialogOpen, hideWhenConn
|
|
|
2126
2161
|
|
|
2127
2162
|
// src/wallet/components/account/AccountDisplay.tsx
|
|
2128
2163
|
var import_lucide_react2 = require("lucide-react");
|
|
2129
|
-
var
|
|
2130
|
-
var
|
|
2131
|
-
var
|
|
2164
|
+
var import_ui_components3 = require("@openzeppelin/ui-components");
|
|
2165
|
+
var import_ui_react3 = require("@openzeppelin/ui-react");
|
|
2166
|
+
var import_ui_utils10 = require("@openzeppelin/ui-utils");
|
|
2132
2167
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2133
2168
|
var CustomAccountDisplay = ({ className }) => {
|
|
2134
2169
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SafeWagmiComponent, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AccountDisplayContent, { className }) });
|
|
2135
2170
|
};
|
|
2136
2171
|
var AccountDisplayContent = ({ className }) => {
|
|
2137
|
-
const { isConnected, address, chainId } = (0,
|
|
2138
|
-
const { disconnect: disconnect2 } = (0,
|
|
2172
|
+
const { isConnected, address, chainId } = (0, import_ui_react3.useDerivedAccountStatus)();
|
|
2173
|
+
const { disconnect: disconnect2 } = (0, import_ui_react3.useDerivedDisconnect)();
|
|
2139
2174
|
if (!isConnected || !address || !disconnect2) {
|
|
2140
2175
|
return null;
|
|
2141
2176
|
}
|
|
2142
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0,
|
|
2177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_ui_utils10.cn)("flex items-center gap-2", className), children: [
|
|
2143
2178
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col", children: [
|
|
2144
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-xs font-medium", children: (0,
|
|
2179
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-xs font-medium", children: (0, import_ui_utils10.truncateMiddle)(address, 4, 4) }),
|
|
2145
2180
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-[9px] text-muted-foreground -mt-0.5", children: chainId ? `Chain ID: ${chainId}` : "Chain ID: N/A" })
|
|
2146
2181
|
] }),
|
|
2147
2182
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2148
|
-
|
|
2183
|
+
import_ui_components3.Button,
|
|
2149
2184
|
{
|
|
2150
2185
|
onClick: () => disconnect2(),
|
|
2151
2186
|
variant: "ghost",
|
|
@@ -2160,17 +2195,17 @@ var AccountDisplayContent = ({ className }) => {
|
|
|
2160
2195
|
|
|
2161
2196
|
// src/wallet/components/network/NetworkSwitcher.tsx
|
|
2162
2197
|
var import_lucide_react3 = require("lucide-react");
|
|
2163
|
-
var
|
|
2164
|
-
var
|
|
2165
|
-
var
|
|
2198
|
+
var import_ui_components4 = require("@openzeppelin/ui-components");
|
|
2199
|
+
var import_ui_react4 = require("@openzeppelin/ui-react");
|
|
2200
|
+
var import_ui_utils11 = require("@openzeppelin/ui-utils");
|
|
2166
2201
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2167
2202
|
var CustomNetworkSwitcher = ({ className }) => {
|
|
2168
2203
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SafeWagmiComponent, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(NetworkSwitcherContent, { className }) });
|
|
2169
2204
|
};
|
|
2170
2205
|
var NetworkSwitcherContent = ({ className }) => {
|
|
2171
|
-
const { isConnected } = (0,
|
|
2172
|
-
const { currentChainId, availableChains: unknownChains } = (0,
|
|
2173
|
-
const { switchChain: switchChain2, isSwitching: isPending, error } = (0,
|
|
2206
|
+
const { isConnected } = (0, import_ui_react4.useDerivedAccountStatus)();
|
|
2207
|
+
const { currentChainId, availableChains: unknownChains } = (0, import_ui_react4.useDerivedChainInfo)();
|
|
2208
|
+
const { switchChain: switchChain2, isSwitching: isPending, error } = (0, import_ui_react4.useDerivedSwitchChainStatus)();
|
|
2174
2209
|
const typedAvailableChains = unknownChains;
|
|
2175
2210
|
if (!isConnected || !switchChain2 || typedAvailableChains.length === 0) {
|
|
2176
2211
|
return null;
|
|
@@ -2182,23 +2217,23 @@ var NetworkSwitcherContent = ({ className }) => {
|
|
|
2182
2217
|
};
|
|
2183
2218
|
const currentChain = typedAvailableChains.find((chain) => chain.id === currentChainId);
|
|
2184
2219
|
const currentChainName = currentChain?.name || "Network";
|
|
2185
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0,
|
|
2220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_ui_utils11.cn)("flex items-center", className), children: [
|
|
2186
2221
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2187
|
-
|
|
2222
|
+
import_ui_components4.Select,
|
|
2188
2223
|
{
|
|
2189
2224
|
value: currentChainId?.toString() ?? "",
|
|
2190
2225
|
onValueChange: (value) => handleNetworkChange(Number(value)),
|
|
2191
2226
|
disabled: isPending || typedAvailableChains.length === 0,
|
|
2192
2227
|
children: [
|
|
2193
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2228
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui_components4.SelectTrigger, { className: "h-8 text-xs px-2 min-w-[90px] max-w-[120px]", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui_components4.SelectValue, { placeholder: "Network", children: currentChainName }) }),
|
|
2194
2229
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2195
|
-
|
|
2230
|
+
import_ui_components4.SelectContent,
|
|
2196
2231
|
{
|
|
2197
2232
|
position: "popper",
|
|
2198
2233
|
sideOffset: 5,
|
|
2199
2234
|
align: "start",
|
|
2200
2235
|
className: "w-auto min-w-[160px] max-h-[300px]",
|
|
2201
|
-
children: typedAvailableChains.map((chain) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2236
|
+
children: typedAvailableChains.map((chain) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui_components4.SelectItem, { value: chain.id.toString(), className: "text-xs py-1.5", children: chain.name }, chain.id))
|
|
2202
2237
|
}
|
|
2203
2238
|
)
|
|
2204
2239
|
]
|
|
@@ -2262,7 +2297,7 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2262
2297
|
if (isMounted) {
|
|
2263
2298
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
2264
2299
|
setIsLoadingComponent(false);
|
|
2265
|
-
|
|
2300
|
+
import_ui_utils12.logger.error("RainbowKitConnectButton", "Failed to load RainbowKit ConnectButton:", err);
|
|
2266
2301
|
}
|
|
2267
2302
|
}
|
|
2268
2303
|
};
|
|
@@ -2275,12 +2310,12 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2275
2310
|
};
|
|
2276
2311
|
}, []);
|
|
2277
2312
|
const renderLoadingPlaceholder = (message) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
2278
|
-
|
|
2313
|
+
import_ui_components5.Button,
|
|
2279
2314
|
{
|
|
2280
2315
|
disabled: true,
|
|
2281
2316
|
variant: "outline",
|
|
2282
2317
|
size: "sm",
|
|
2283
|
-
className: (0,
|
|
2318
|
+
className: (0, import_ui_utils12.cn)("h-8 px-2 text-xs", props.className),
|
|
2284
2319
|
children: [
|
|
2285
2320
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.Loader2, { className: "h-3.5 w-3.5 animate-spin mr-1.5" }),
|
|
2286
2321
|
message
|
|
@@ -2288,7 +2323,7 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2288
2323
|
}
|
|
2289
2324
|
);
|
|
2290
2325
|
if (error) {
|
|
2291
|
-
|
|
2326
|
+
import_ui_utils12.logger.warn(
|
|
2292
2327
|
"RainbowKitConnectButton",
|
|
2293
2328
|
"Error loading RainbowKit ConnectButton. Displaying fallback CustomConnectButton."
|
|
2294
2329
|
);
|
|
@@ -2301,7 +2336,7 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2301
2336
|
return renderLoadingPlaceholder("Initializing Provider...");
|
|
2302
2337
|
}
|
|
2303
2338
|
if (!Component) {
|
|
2304
|
-
|
|
2339
|
+
import_ui_utils12.logger.warn("RainbowKitConnectButton", "Component is null after loading phase, falling back.");
|
|
2305
2340
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CustomConnectButton, { ...props });
|
|
2306
2341
|
}
|
|
2307
2342
|
const kitConfig = managerState.currentFullUiKitConfig?.kitConfig;
|
|
@@ -2313,7 +2348,7 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2313
2348
|
...props
|
|
2314
2349
|
// Allow props to override configuration
|
|
2315
2350
|
};
|
|
2316
|
-
|
|
2351
|
+
import_ui_utils12.logger.debug("RainbowKitConnectButton", "Rendering with configuration:", {
|
|
2317
2352
|
configFromFile: connectButtonConfig,
|
|
2318
2353
|
finalProps
|
|
2319
2354
|
});
|
|
@@ -2321,20 +2356,20 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2321
2356
|
};
|
|
2322
2357
|
|
|
2323
2358
|
// src/wallet/rainbowkit/utils.ts
|
|
2324
|
-
var
|
|
2359
|
+
var import_ui_utils13 = require("@openzeppelin/ui-utils");
|
|
2325
2360
|
function validateRainbowKitConfig(kitConfig) {
|
|
2326
|
-
|
|
2361
|
+
import_ui_utils13.logger.debug(
|
|
2327
2362
|
"validateRainbowKitConfig",
|
|
2328
2363
|
"Received kitConfig for validation:",
|
|
2329
2364
|
JSON.stringify(kitConfig)
|
|
2330
2365
|
);
|
|
2331
2366
|
if (!kitConfig) {
|
|
2332
|
-
|
|
2367
|
+
import_ui_utils13.logger.warn("validateRainbowKitConfig", "Validation failed: No kitConfig provided.");
|
|
2333
2368
|
return { isValid: false, error: "No kitConfig provided for RainbowKit" };
|
|
2334
2369
|
}
|
|
2335
2370
|
const wagmiParamsFromKitConfig = kitConfig.wagmiParams;
|
|
2336
2371
|
if (!wagmiParamsFromKitConfig || typeof wagmiParamsFromKitConfig !== "object" || wagmiParamsFromKitConfig === null) {
|
|
2337
|
-
|
|
2372
|
+
import_ui_utils13.logger.warn(
|
|
2338
2373
|
"validateRainbowKitConfig",
|
|
2339
2374
|
"Validation failed: kitConfig.wagmiParams is missing or invalid.",
|
|
2340
2375
|
{ wagmiParamsFromKitConfig }
|
|
@@ -2350,14 +2385,14 @@ function validateRainbowKitConfig(kitConfig) {
|
|
|
2350
2385
|
}
|
|
2351
2386
|
if (missingFields.length > 0) {
|
|
2352
2387
|
const errorMsg = `Missing or invalid required fields in wagmiParams: ${missingFields.join(", ")}`;
|
|
2353
|
-
|
|
2388
|
+
import_ui_utils13.logger.warn("validateRainbowKitConfig", "Validation failed:", errorMsg, { missingFields });
|
|
2354
2389
|
return {
|
|
2355
2390
|
isValid: false,
|
|
2356
2391
|
missingFields,
|
|
2357
2392
|
error: errorMsg
|
|
2358
2393
|
};
|
|
2359
2394
|
}
|
|
2360
|
-
|
|
2395
|
+
import_ui_utils13.logger.debug("validateRainbowKitConfig", "Validation successful.");
|
|
2361
2396
|
return { isValid: true };
|
|
2362
2397
|
}
|
|
2363
2398
|
|
|
@@ -2372,12 +2407,12 @@ function createRainbowKitComponents() {
|
|
|
2372
2407
|
|
|
2373
2408
|
// src/wallet/rainbowkit/config-service.ts
|
|
2374
2409
|
var import_core = require("@wagmi/core");
|
|
2375
|
-
var
|
|
2410
|
+
var import_ui_utils14 = require("@openzeppelin/ui-utils");
|
|
2376
2411
|
async function createRainbowKitWagmiConfig(userFullNativeConfig, chains, chainIdToNetworkIdMap, getRpcEndpointOverride) {
|
|
2377
2412
|
try {
|
|
2378
2413
|
const { getDefaultConfig } = await import("@rainbow-me/rainbowkit");
|
|
2379
2414
|
if (!getDefaultConfig) {
|
|
2380
|
-
|
|
2415
|
+
import_ui_utils14.logger.error(
|
|
2381
2416
|
"rainbowkit/config-service",
|
|
2382
2417
|
"Failed to import getDefaultConfig from RainbowKit"
|
|
2383
2418
|
);
|
|
@@ -2385,21 +2420,21 @@ async function createRainbowKitWagmiConfig(userFullNativeConfig, chains, chainId
|
|
|
2385
2420
|
}
|
|
2386
2421
|
const wagmiParams = userFullNativeConfig?.wagmiParams;
|
|
2387
2422
|
if (!wagmiParams) {
|
|
2388
|
-
|
|
2423
|
+
import_ui_utils14.logger.warn(
|
|
2389
2424
|
"rainbowkit/config-service",
|
|
2390
2425
|
"Resolved kitConfig does not contain a `wagmiParams` object. Cannot create RainbowKit Wagmi config."
|
|
2391
2426
|
);
|
|
2392
2427
|
return null;
|
|
2393
2428
|
}
|
|
2394
2429
|
if (typeof wagmiParams.appName !== "string" || !wagmiParams.appName) {
|
|
2395
|
-
|
|
2430
|
+
import_ui_utils14.logger.warn(
|
|
2396
2431
|
"rainbowkit/config-service",
|
|
2397
2432
|
"kitConfig.wagmiParams is missing or has invalid `appName`."
|
|
2398
2433
|
);
|
|
2399
2434
|
return null;
|
|
2400
2435
|
}
|
|
2401
2436
|
if (typeof wagmiParams.projectId !== "string" || !wagmiParams.projectId) {
|
|
2402
|
-
|
|
2437
|
+
import_ui_utils14.logger.warn(
|
|
2403
2438
|
"rainbowkit/config-service",
|
|
2404
2439
|
"kitConfig.wagmiParams is missing or has invalid `projectId`."
|
|
2405
2440
|
);
|
|
@@ -2422,7 +2457,7 @@ async function createRainbowKitWagmiConfig(userFullNativeConfig, chains, chainId
|
|
|
2422
2457
|
}
|
|
2423
2458
|
}
|
|
2424
2459
|
if (httpRpcOverride) {
|
|
2425
|
-
|
|
2460
|
+
import_ui_utils14.logger.info(
|
|
2426
2461
|
"rainbowkit/config-service",
|
|
2427
2462
|
`Using overridden RPC for chain ${chainDefinition.name}: ${httpRpcOverride}`
|
|
2428
2463
|
);
|
|
@@ -2443,20 +2478,20 @@ async function createRainbowKitWagmiConfig(userFullNativeConfig, chains, chainId
|
|
|
2443
2478
|
// Adapter controls this
|
|
2444
2479
|
};
|
|
2445
2480
|
const config = getDefaultConfig(finalConfigOptions);
|
|
2446
|
-
|
|
2481
|
+
import_ui_utils14.logger.info(
|
|
2447
2482
|
"rainbowkit/config-service",
|
|
2448
2483
|
"Successfully created RainbowKit Wagmi config object.",
|
|
2449
2484
|
config
|
|
2450
2485
|
);
|
|
2451
2486
|
return config;
|
|
2452
2487
|
} catch (error) {
|
|
2453
|
-
|
|
2488
|
+
import_ui_utils14.logger.error("rainbowkit/config-service", "Error creating RainbowKit Wagmi config:", error);
|
|
2454
2489
|
return null;
|
|
2455
2490
|
}
|
|
2456
2491
|
}
|
|
2457
2492
|
async function getWagmiConfigForRainbowKit(uiKitConfiguration, chains, chainIdToNetworkIdMap, getRpcEndpointOverride) {
|
|
2458
2493
|
if (!uiKitConfiguration || uiKitConfiguration.kitName !== "rainbowkit" || !uiKitConfiguration.kitConfig) {
|
|
2459
|
-
|
|
2494
|
+
import_ui_utils14.logger.debug(
|
|
2460
2495
|
"rainbowkit/config-service",
|
|
2461
2496
|
"Not configured for RainbowKit or kitConfig (resolved native + programmatic) is missing."
|
|
2462
2497
|
);
|
|
@@ -2476,7 +2511,7 @@ async function getWagmiConfigForRainbowKit(uiKitConfiguration, chains, chainIdTo
|
|
|
2476
2511
|
var LOG_SYSTEM = "WagmiWalletImplementation";
|
|
2477
2512
|
var getSupportedChainsFromNetworks = () => {
|
|
2478
2513
|
const chains = evmNetworks.filter((network) => network.viemChain).map((network) => network.viemChain).filter((chain, index, self) => self.findIndex((c) => c.id === chain.id) === index);
|
|
2479
|
-
|
|
2514
|
+
import_ui_utils15.logger.info(
|
|
2480
2515
|
LOG_SYSTEM,
|
|
2481
2516
|
`Generated supported chains from network configurations: ${chains.length} chains`,
|
|
2482
2517
|
chains.map((c) => ({ id: c.id, name: c.name }))
|
|
@@ -2491,7 +2526,7 @@ var getChainIdToNetworkIdMapping = () => {
|
|
|
2491
2526
|
},
|
|
2492
2527
|
{}
|
|
2493
2528
|
);
|
|
2494
|
-
|
|
2529
|
+
import_ui_utils15.logger.info(
|
|
2495
2530
|
LOG_SYSTEM,
|
|
2496
2531
|
"Generated chain ID to network ID mapping from network configurations:",
|
|
2497
2532
|
mapping
|
|
@@ -2516,13 +2551,13 @@ var WagmiWalletImplementation = class {
|
|
|
2516
2551
|
__publicField(this, "walletConnectProjectId");
|
|
2517
2552
|
__publicField(this, "rpcConfigUnsubscribe");
|
|
2518
2553
|
this.walletConnectProjectId = walletConnectProjectIdFromAppConfig;
|
|
2519
|
-
|
|
2554
|
+
import_ui_utils15.logger.info(
|
|
2520
2555
|
LOG_SYSTEM,
|
|
2521
2556
|
"Constructor called. Initial anticipated kitName:",
|
|
2522
2557
|
initialUiKitConfig?.kitName
|
|
2523
2558
|
);
|
|
2524
2559
|
this.initialized = true;
|
|
2525
|
-
|
|
2560
|
+
import_ui_utils15.logger.info(
|
|
2526
2561
|
LOG_SYSTEM,
|
|
2527
2562
|
"WagmiWalletImplementation instance initialized (Wagmi config creation deferred)."
|
|
2528
2563
|
);
|
|
@@ -2533,10 +2568,10 @@ var WagmiWalletImplementation = class {
|
|
|
2533
2568
|
* when user changes RPC settings.
|
|
2534
2569
|
*/
|
|
2535
2570
|
setupRpcConfigListener() {
|
|
2536
|
-
import("@openzeppelin/ui-
|
|
2571
|
+
import("@openzeppelin/ui-utils").then(({ userRpcConfigService }) => {
|
|
2537
2572
|
this.rpcConfigUnsubscribe = userRpcConfigService.subscribe("*", (event) => {
|
|
2538
2573
|
if (event.type === "rpc-config-changed" || event.type === "rpc-config-cleared") {
|
|
2539
|
-
|
|
2574
|
+
import_ui_utils15.logger.info(
|
|
2540
2575
|
LOG_SYSTEM,
|
|
2541
2576
|
`RPC config changed for network ${event.networkId}. Invalidating cached Wagmi config.`
|
|
2542
2577
|
);
|
|
@@ -2544,7 +2579,7 @@ var WagmiWalletImplementation = class {
|
|
|
2544
2579
|
}
|
|
2545
2580
|
});
|
|
2546
2581
|
}).catch((error) => {
|
|
2547
|
-
|
|
2582
|
+
import_ui_utils15.logger.error(LOG_SYSTEM, "Failed to setup RPC config listener:", error);
|
|
2548
2583
|
});
|
|
2549
2584
|
}
|
|
2550
2585
|
/**
|
|
@@ -2567,14 +2602,14 @@ var WagmiWalletImplementation = class {
|
|
|
2567
2602
|
* @param config - The Wagmi Config object to set as active, or null to clear it.
|
|
2568
2603
|
*/
|
|
2569
2604
|
setActiveWagmiConfig(config) {
|
|
2570
|
-
|
|
2605
|
+
import_ui_utils15.logger.info(
|
|
2571
2606
|
LOG_SYSTEM,
|
|
2572
2607
|
"setActiveWagmiConfig called with config:",
|
|
2573
2608
|
config ? "Valid Config" : "Null"
|
|
2574
2609
|
);
|
|
2575
2610
|
this.activeWagmiConfig = config;
|
|
2576
2611
|
if (this.unsubscribe) {
|
|
2577
|
-
|
|
2612
|
+
import_ui_utils15.logger.warn(
|
|
2578
2613
|
LOG_SYSTEM,
|
|
2579
2614
|
"setActiveWagmiConfig: Active WagmiConfig instance has changed. Existing direct watchAccount subscription (via onWalletConnectionChange) may be stale and operating on an old config instance."
|
|
2580
2615
|
);
|
|
@@ -2591,9 +2626,9 @@ var WagmiWalletImplementation = class {
|
|
|
2591
2626
|
const baseConnectors = [(0, import_connectors.injected)(), (0, import_connectors.metaMask)(), (0, import_connectors.safe)()];
|
|
2592
2627
|
if (this.walletConnectProjectId?.trim()) {
|
|
2593
2628
|
baseConnectors.push((0, import_connectors.walletConnect)({ projectId: this.walletConnectProjectId }));
|
|
2594
|
-
|
|
2629
|
+
import_ui_utils15.logger.info(LOG_SYSTEM, "WalletConnect connector added to DEFAULT config.");
|
|
2595
2630
|
} else {
|
|
2596
|
-
|
|
2631
|
+
import_ui_utils15.logger.warn(
|
|
2597
2632
|
LOG_SYSTEM,
|
|
2598
2633
|
"WalletConnect Project ID not provided; WC connector unavailable for DEFAULT config."
|
|
2599
2634
|
);
|
|
@@ -2605,7 +2640,7 @@ var WagmiWalletImplementation = class {
|
|
|
2605
2640
|
if (appNetworkIdString) {
|
|
2606
2641
|
let httpRpcOverride = getUserRpcUrl(appNetworkIdString);
|
|
2607
2642
|
if (!httpRpcOverride) {
|
|
2608
|
-
const rpcOverrideSetting =
|
|
2643
|
+
const rpcOverrideSetting = import_ui_utils15.appConfigService.getRpcEndpointOverride(appNetworkIdString);
|
|
2609
2644
|
if (typeof rpcOverrideSetting === "string") {
|
|
2610
2645
|
httpRpcOverride = rpcOverrideSetting;
|
|
2611
2646
|
} else if (typeof rpcOverrideSetting === "object") {
|
|
@@ -2617,7 +2652,7 @@ var WagmiWalletImplementation = class {
|
|
|
2617
2652
|
}
|
|
2618
2653
|
}
|
|
2619
2654
|
if (httpRpcOverride) {
|
|
2620
|
-
|
|
2655
|
+
import_ui_utils15.logger.info(
|
|
2621
2656
|
LOG_SYSTEM,
|
|
2622
2657
|
`Using overridden RPC for chain ${chainDefinition.name} (default config): ${httpRpcOverride}`
|
|
2623
2658
|
);
|
|
@@ -2635,10 +2670,10 @@ var WagmiWalletImplementation = class {
|
|
|
2635
2670
|
connectors: baseConnectors,
|
|
2636
2671
|
transports: transportsConfig
|
|
2637
2672
|
});
|
|
2638
|
-
|
|
2673
|
+
import_ui_utils15.logger.info(LOG_SYSTEM, "Default Wagmi config created successfully on demand.");
|
|
2639
2674
|
return defaultConfig2;
|
|
2640
2675
|
} catch (error) {
|
|
2641
|
-
|
|
2676
|
+
import_ui_utils15.logger.error(LOG_SYSTEM, "Error creating default Wagmi config on demand:", error);
|
|
2642
2677
|
return (0, import_core2.createConfig)({
|
|
2643
2678
|
chains: [defaultSupportedChains[0]],
|
|
2644
2679
|
connectors: [(0, import_connectors.injected)()],
|
|
@@ -2656,7 +2691,7 @@ var WagmiWalletImplementation = class {
|
|
|
2656
2691
|
if (userRpcUrl) {
|
|
2657
2692
|
return { http: userRpcUrl };
|
|
2658
2693
|
}
|
|
2659
|
-
const rpcOverrideSetting =
|
|
2694
|
+
const rpcOverrideSetting = import_ui_utils15.appConfigService.getRpcEndpointOverride(networkId);
|
|
2660
2695
|
if (typeof rpcOverrideSetting === "string") {
|
|
2661
2696
|
return rpcOverrideSetting;
|
|
2662
2697
|
} else if (typeof rpcOverrideSetting === "object" && rpcOverrideSetting !== null) {
|
|
@@ -2683,20 +2718,20 @@ var WagmiWalletImplementation = class {
|
|
|
2683
2718
|
*/
|
|
2684
2719
|
async getConfigForRainbowKit(currentAdapterUiKitConfig) {
|
|
2685
2720
|
if (!this.initialized) {
|
|
2686
|
-
|
|
2721
|
+
import_ui_utils15.logger.error(
|
|
2687
2722
|
LOG_SYSTEM,
|
|
2688
2723
|
"getConfigForRainbowKit called before implementation initialization."
|
|
2689
2724
|
);
|
|
2690
2725
|
return null;
|
|
2691
2726
|
}
|
|
2692
2727
|
if (currentAdapterUiKitConfig?.kitName !== "rainbowkit") {
|
|
2693
|
-
|
|
2728
|
+
import_ui_utils15.logger.warn(
|
|
2694
2729
|
LOG_SYSTEM,
|
|
2695
2730
|
"getConfigForRainbowKit called, but kitName is not rainbowkit. Returning null."
|
|
2696
2731
|
);
|
|
2697
2732
|
return null;
|
|
2698
2733
|
}
|
|
2699
|
-
|
|
2734
|
+
import_ui_utils15.logger.info(
|
|
2700
2735
|
LOG_SYSTEM,
|
|
2701
2736
|
"getConfigForRainbowKit: Kit is RainbowKit. Proceeding to create/get config. CurrentAdapterUiKitConfig:",
|
|
2702
2737
|
currentAdapterUiKitConfig
|
|
@@ -2708,10 +2743,10 @@ var WagmiWalletImplementation = class {
|
|
|
2708
2743
|
this.getRpcOverrideForRainbowKit.bind(this)
|
|
2709
2744
|
);
|
|
2710
2745
|
if (rainbowKitWagmiConfig) {
|
|
2711
|
-
|
|
2746
|
+
import_ui_utils15.logger.info(LOG_SYSTEM, "Returning RainbowKit-specific Wagmi config for provider.");
|
|
2712
2747
|
return rainbowKitWagmiConfig;
|
|
2713
2748
|
}
|
|
2714
|
-
|
|
2749
|
+
import_ui_utils15.logger.warn(LOG_SYSTEM, "RainbowKit specific Wagmi config creation failed.");
|
|
2715
2750
|
return null;
|
|
2716
2751
|
}
|
|
2717
2752
|
/**
|
|
@@ -2723,7 +2758,7 @@ var WagmiWalletImplementation = class {
|
|
|
2723
2758
|
*/
|
|
2724
2759
|
async getActiveConfigForManager(uiKitConfig2) {
|
|
2725
2760
|
if (!this.initialized) {
|
|
2726
|
-
|
|
2761
|
+
import_ui_utils15.logger.error(
|
|
2727
2762
|
LOG_SYSTEM,
|
|
2728
2763
|
"getActiveConfigForManager called before initialization! Creating fallback."
|
|
2729
2764
|
);
|
|
@@ -2735,7 +2770,7 @@ var WagmiWalletImplementation = class {
|
|
|
2735
2770
|
if (uiKitConfig2?.kitName === "rainbowkit") {
|
|
2736
2771
|
const rkConfig = await this.getConfigForRainbowKit(uiKitConfig2);
|
|
2737
2772
|
if (rkConfig) return rkConfig;
|
|
2738
|
-
|
|
2773
|
+
import_ui_utils15.logger.warn(
|
|
2739
2774
|
LOG_SYSTEM,
|
|
2740
2775
|
"getActiveConfigForManager: RainbowKit config failed, falling back to default."
|
|
2741
2776
|
);
|
|
@@ -2753,7 +2788,7 @@ var WagmiWalletImplementation = class {
|
|
|
2753
2788
|
* @returns The current default or active Wagmi Config object.
|
|
2754
2789
|
*/
|
|
2755
2790
|
getConfig() {
|
|
2756
|
-
|
|
2791
|
+
import_ui_utils15.logger.warn(
|
|
2757
2792
|
LOG_SYSTEM,
|
|
2758
2793
|
"getConfig() is deprecated. Internal calls should use activeWagmiConfig if set, or ensure default is created."
|
|
2759
2794
|
);
|
|
@@ -2771,10 +2806,10 @@ var WagmiWalletImplementation = class {
|
|
|
2771
2806
|
* @returns The current account status from Wagmi.
|
|
2772
2807
|
*/
|
|
2773
2808
|
getWalletConnectionStatus() {
|
|
2774
|
-
|
|
2809
|
+
import_ui_utils15.logger.debug(LOG_SYSTEM, "getWalletConnectionStatus called.");
|
|
2775
2810
|
const configToUse = this.activeWagmiConfig || this.defaultInstanceConfig || (this.defaultInstanceConfig = this.createDefaultConfig());
|
|
2776
2811
|
if (!configToUse) {
|
|
2777
|
-
|
|
2812
|
+
import_ui_utils15.logger.error(LOG_SYSTEM, "No config available for getWalletConnectionStatus!");
|
|
2778
2813
|
return {
|
|
2779
2814
|
isConnected: false,
|
|
2780
2815
|
isConnecting: false,
|
|
@@ -2800,17 +2835,17 @@ var WagmiWalletImplementation = class {
|
|
|
2800
2835
|
*/
|
|
2801
2836
|
onWalletConnectionChange(callback) {
|
|
2802
2837
|
if (!this.initialized) {
|
|
2803
|
-
|
|
2838
|
+
import_ui_utils15.logger.warn(LOG_SYSTEM, "onWalletConnectionChange called before initialization. No-op.");
|
|
2804
2839
|
return () => {
|
|
2805
2840
|
};
|
|
2806
2841
|
}
|
|
2807
2842
|
if (this.unsubscribe) {
|
|
2808
2843
|
this.unsubscribe();
|
|
2809
|
-
|
|
2844
|
+
import_ui_utils15.logger.debug(LOG_SYSTEM, "Previous watchAccount unsubscribed.");
|
|
2810
2845
|
}
|
|
2811
2846
|
const configToUse = this.activeWagmiConfig || this.defaultInstanceConfig || (this.defaultInstanceConfig = this.createDefaultConfig());
|
|
2812
2847
|
if (!configToUse) {
|
|
2813
|
-
|
|
2848
|
+
import_ui_utils15.logger.error(
|
|
2814
2849
|
LOG_SYSTEM,
|
|
2815
2850
|
"No config available for onWalletConnectionChange! Subscription not set."
|
|
2816
2851
|
);
|
|
@@ -2818,7 +2853,7 @@ var WagmiWalletImplementation = class {
|
|
|
2818
2853
|
};
|
|
2819
2854
|
}
|
|
2820
2855
|
this.unsubscribe = (0, import_core2.watchAccount)(configToUse, { onChange: callback });
|
|
2821
|
-
|
|
2856
|
+
import_ui_utils15.logger.info(
|
|
2822
2857
|
LOG_SYSTEM,
|
|
2823
2858
|
"watchAccount subscription established/re-established using config:",
|
|
2824
2859
|
configToUse === this.activeWagmiConfig ? "activeExternal" : "defaultInstance"
|
|
@@ -2832,7 +2867,7 @@ var WagmiWalletImplementation = class {
|
|
|
2832
2867
|
*/
|
|
2833
2868
|
async getWalletClient() {
|
|
2834
2869
|
if (!this.initialized || !this.activeWagmiConfig) {
|
|
2835
|
-
|
|
2870
|
+
import_ui_utils15.logger.warn(
|
|
2836
2871
|
LOG_SYSTEM,
|
|
2837
2872
|
"getWalletClient: Not initialized or no activeWagmiConfig. Returning null."
|
|
2838
2873
|
);
|
|
@@ -2853,7 +2888,7 @@ var WagmiWalletImplementation = class {
|
|
|
2853
2888
|
*/
|
|
2854
2889
|
async getPublicClient() {
|
|
2855
2890
|
if (!this.initialized || !this.activeWagmiConfig) {
|
|
2856
|
-
|
|
2891
|
+
import_ui_utils15.logger.warn(
|
|
2857
2892
|
LOG_SYSTEM,
|
|
2858
2893
|
"getPublicClient: Not initialized or no activeWagmiConfig. Returning null."
|
|
2859
2894
|
);
|
|
@@ -2862,7 +2897,7 @@ var WagmiWalletImplementation = class {
|
|
|
2862
2897
|
const accountStatus = (0, import_core2.getAccount)(this.activeWagmiConfig);
|
|
2863
2898
|
const currentChainId = accountStatus.chainId;
|
|
2864
2899
|
if (!currentChainId) {
|
|
2865
|
-
|
|
2900
|
+
import_ui_utils15.logger.warn(
|
|
2866
2901
|
LOG_SYSTEM,
|
|
2867
2902
|
"getPublicClient: No connected chainId available from accountStatus. Returning null."
|
|
2868
2903
|
);
|
|
@@ -2873,19 +2908,19 @@ var WagmiWalletImplementation = class {
|
|
|
2873
2908
|
chainId: currentChainId
|
|
2874
2909
|
});
|
|
2875
2910
|
if (publicClient) {
|
|
2876
|
-
|
|
2911
|
+
import_ui_utils15.logger.info(
|
|
2877
2912
|
LOG_SYSTEM,
|
|
2878
2913
|
`getPublicClient: Successfully retrieved public client for chainId ${currentChainId}.`
|
|
2879
2914
|
);
|
|
2880
2915
|
return publicClient;
|
|
2881
2916
|
}
|
|
2882
|
-
|
|
2917
|
+
import_ui_utils15.logger.warn(
|
|
2883
2918
|
LOG_SYSTEM,
|
|
2884
2919
|
`getPublicClient: getWagmiCorePublicClient returned undefined/null for chainId ${currentChainId}.`
|
|
2885
2920
|
);
|
|
2886
2921
|
return null;
|
|
2887
2922
|
} catch (error) {
|
|
2888
|
-
|
|
2923
|
+
import_ui_utils15.logger.error(LOG_SYSTEM, "Error getting public client from wagmi/core:", error);
|
|
2889
2924
|
return null;
|
|
2890
2925
|
}
|
|
2891
2926
|
}
|
|
@@ -2948,18 +2983,18 @@ async function getEvmWalletImplementation() {
|
|
|
2948
2983
|
}
|
|
2949
2984
|
walletImplementationPromise = (async () => {
|
|
2950
2985
|
try {
|
|
2951
|
-
|
|
2952
|
-
const initialUiKitConfig =
|
|
2986
|
+
import_ui_utils16.logger.info(LOG_SYSTEM2, "Initializing WagmiWalletImplementation singleton (async)... ");
|
|
2987
|
+
const initialUiKitConfig = import_ui_utils16.appConfigService.getTypedNestedConfig(
|
|
2953
2988
|
"walletui",
|
|
2954
2989
|
"config"
|
|
2955
2990
|
);
|
|
2956
|
-
const wcProjectId =
|
|
2991
|
+
const wcProjectId = import_ui_utils16.appConfigService.getGlobalServiceParam("walletconnect", "projectId");
|
|
2957
2992
|
const instance = new WagmiWalletImplementation(wcProjectId, initialUiKitConfig);
|
|
2958
|
-
|
|
2993
|
+
import_ui_utils16.logger.info(LOG_SYSTEM2, "WagmiWalletImplementation singleton created (async).");
|
|
2959
2994
|
walletImplementationInstance = instance;
|
|
2960
2995
|
return instance;
|
|
2961
2996
|
} catch (error) {
|
|
2962
|
-
|
|
2997
|
+
import_ui_utils16.logger.error(LOG_SYSTEM2, "Failed to initialize WagmiWalletImplementation (async):", error);
|
|
2963
2998
|
const fallbackInstance = new WagmiWalletImplementation();
|
|
2964
2999
|
walletImplementationInstance = fallbackInstance;
|
|
2965
3000
|
return fallbackInstance;
|
|
@@ -2969,7 +3004,7 @@ async function getEvmWalletImplementation() {
|
|
|
2969
3004
|
}
|
|
2970
3005
|
function getInitializedEvmWalletImplementation() {
|
|
2971
3006
|
if (!walletImplementationInstance) {
|
|
2972
|
-
|
|
3007
|
+
import_ui_utils16.logger.warn(
|
|
2973
3008
|
LOG_SYSTEM2,
|
|
2974
3009
|
"getInitializedEvmWalletImplementation called before instance was ready."
|
|
2975
3010
|
);
|
|
@@ -2993,7 +3028,7 @@ function notifyListeners() {
|
|
|
2993
3028
|
try {
|
|
2994
3029
|
listener();
|
|
2995
3030
|
} catch (error) {
|
|
2996
|
-
|
|
3031
|
+
import_ui_utils18.logger.error("EvmUiKitManager", "Error in listener:", error);
|
|
2997
3032
|
}
|
|
2998
3033
|
});
|
|
2999
3034
|
}
|
|
@@ -3007,7 +3042,7 @@ function getState() {
|
|
|
3007
3042
|
return { ...state };
|
|
3008
3043
|
}
|
|
3009
3044
|
async function configure(newFullUiKitConfig) {
|
|
3010
|
-
|
|
3045
|
+
import_ui_utils18.logger.info("EvmUiKitManager:configure", "Configuring UI kit. New config:", newFullUiKitConfig);
|
|
3011
3046
|
const oldKitName = state.currentFullUiKitConfig?.kitName;
|
|
3012
3047
|
const newKitName = newFullUiKitConfig.kitName;
|
|
3013
3048
|
const kitChanged = oldKitName !== newKitName;
|
|
@@ -3025,7 +3060,7 @@ async function configure(newFullUiKitConfig) {
|
|
|
3025
3060
|
try {
|
|
3026
3061
|
if (newKitName === "rainbowkit") {
|
|
3027
3062
|
if (kitChanged || !state.kitProviderComponent || !state.isKitAssetsLoaded) {
|
|
3028
|
-
|
|
3063
|
+
import_ui_utils18.logger.info("EvmUiKitManager:configure", "Ensuring RainbowKit assets are loaded...");
|
|
3029
3064
|
const { ensureRainbowKitAssetsLoaded: ensureRainbowKitAssetsLoaded2 } = await Promise.resolve().then(() => (init_rainbowkitAssetManager(), rainbowkitAssetManager_exports));
|
|
3030
3065
|
const rkAssets = await ensureRainbowKitAssetsLoaded2();
|
|
3031
3066
|
state.kitProviderComponent = rkAssets.ProviderComponent;
|
|
@@ -3035,16 +3070,16 @@ async function configure(newFullUiKitConfig) {
|
|
|
3035
3070
|
}
|
|
3036
3071
|
}
|
|
3037
3072
|
newWagmiConfigAttempt = await evmImpl.getConfigForRainbowKit(newFullUiKitConfig);
|
|
3038
|
-
|
|
3073
|
+
import_ui_utils18.logger.info("EvmUiKitManager:configure", "WagmiConfig for RainbowKit obtained.");
|
|
3039
3074
|
} else if (newKitName === "custom" || !newKitName) {
|
|
3040
3075
|
newWagmiConfigAttempt = await evmImpl.getActiveConfigForManager(newFullUiKitConfig);
|
|
3041
|
-
|
|
3076
|
+
import_ui_utils18.logger.info("EvmUiKitManager:configure", "ActiveConfig for custom/default obtained.");
|
|
3042
3077
|
if (kitChanged) {
|
|
3043
3078
|
state.kitProviderComponent = null;
|
|
3044
3079
|
state.isKitAssetsLoaded = false;
|
|
3045
3080
|
}
|
|
3046
3081
|
} else {
|
|
3047
|
-
|
|
3082
|
+
import_ui_utils18.logger.warn("EvmUiKitManager:configure", `Unsupported kitName: ${newKitName}.`);
|
|
3048
3083
|
state.kitProviderComponent = null;
|
|
3049
3084
|
state.isKitAssetsLoaded = false;
|
|
3050
3085
|
}
|
|
@@ -3053,16 +3088,16 @@ async function configure(newFullUiKitConfig) {
|
|
|
3053
3088
|
state.error = null;
|
|
3054
3089
|
if (!newWagmiConfigAttempt && newKitName && newKitName !== "none" && newKitName !== "custom") {
|
|
3055
3090
|
state.error = new Error(`Failed to obtain WagmiConfig for ${newKitName}`);
|
|
3056
|
-
|
|
3091
|
+
import_ui_utils18.logger.error("EvmUiKitManager:configure", state.error.message);
|
|
3057
3092
|
}
|
|
3058
3093
|
} catch (err) {
|
|
3059
|
-
|
|
3094
|
+
import_ui_utils18.logger.error("EvmUiKitManager:configure", "Error during UI kit configuration process:", err);
|
|
3060
3095
|
state.error = err instanceof Error ? err : new Error(String(err));
|
|
3061
3096
|
state.wagmiConfig = null;
|
|
3062
3097
|
evmImpl.setActiveWagmiConfig(null);
|
|
3063
3098
|
} finally {
|
|
3064
3099
|
state.isInitializing = false;
|
|
3065
|
-
|
|
3100
|
+
import_ui_utils18.logger.info(
|
|
3066
3101
|
"EvmUiKitManager:configure",
|
|
3067
3102
|
"Configuration attempt finished. Final wagmiConfig:",
|
|
3068
3103
|
state.wagmiConfig ? "Set" : "Null",
|
|
@@ -3123,13 +3158,13 @@ var EvmWalletUiRoot = ({ children }) => {
|
|
|
3123
3158
|
const DynKitProvider = kitProviderComponent;
|
|
3124
3159
|
const kitConfig = currentFullUiKitConfig.kitConfig || {};
|
|
3125
3160
|
const providerProps = kitConfig.providerProps || {};
|
|
3126
|
-
|
|
3161
|
+
import_ui_utils19.logger.info(
|
|
3127
3162
|
"EvmWalletUiRoot",
|
|
3128
3163
|
"Wrapping children with dynamically loaded KitProvider (RainbowKit)."
|
|
3129
3164
|
);
|
|
3130
3165
|
finalChildren = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DynKitProvider, { ...providerProps, children });
|
|
3131
3166
|
} else if (currentFullUiKitConfig?.kitName === "rainbowkit" && !isWagmiContextEffectivelyReady) {
|
|
3132
|
-
|
|
3167
|
+
import_ui_utils19.logger.info(
|
|
3133
3168
|
"EvmWalletUiRoot",
|
|
3134
3169
|
"RainbowKit configured, but context or assets not ready. Button may show its loading/error state."
|
|
3135
3170
|
);
|
|
@@ -3238,28 +3273,28 @@ function generateRainbowKitExportables(uiKitConfig2) {
|
|
|
3238
3273
|
}
|
|
3239
3274
|
|
|
3240
3275
|
// src/wallet/services/configResolutionService.ts
|
|
3241
|
-
var
|
|
3276
|
+
var import_ui_utils23 = require("@openzeppelin/ui-utils");
|
|
3242
3277
|
|
|
3243
3278
|
// src/wallet/utils.ts
|
|
3244
|
-
var
|
|
3279
|
+
var import_ui_utils22 = require("@openzeppelin/ui-utils");
|
|
3245
3280
|
|
|
3246
3281
|
// src/wallet/utils/uiKitService.ts
|
|
3247
|
-
var
|
|
3282
|
+
var import_ui_utils21 = require("@openzeppelin/ui-utils");
|
|
3248
3283
|
|
|
3249
3284
|
// src/wallet/utils/filterWalletComponents.ts
|
|
3250
|
-
var
|
|
3251
|
-
var
|
|
3285
|
+
var import_ui_types = require("@openzeppelin/ui-types");
|
|
3286
|
+
var import_ui_utils20 = require("@openzeppelin/ui-utils");
|
|
3252
3287
|
function filterWalletComponents(allPossibleComponents, exclusions, kitName = "custom") {
|
|
3253
|
-
|
|
3288
|
+
import_ui_utils20.logger.debug(
|
|
3254
3289
|
"filterWalletComponents",
|
|
3255
3290
|
`Filtering components for kit: ${kitName}. Exclusions: ${exclusions.join(", ")}.`
|
|
3256
3291
|
);
|
|
3257
3292
|
if (!allPossibleComponents || Object.keys(allPossibleComponents).length === 0) {
|
|
3258
|
-
|
|
3293
|
+
import_ui_utils20.logger.debug("filterWalletComponents", `No components provided to filter for kit: ${kitName}.`);
|
|
3259
3294
|
return void 0;
|
|
3260
3295
|
}
|
|
3261
3296
|
if (exclusions.length === 0) {
|
|
3262
|
-
|
|
3297
|
+
import_ui_utils20.logger.debug(
|
|
3263
3298
|
"filterWalletComponents",
|
|
3264
3299
|
`Providing all components for kit: ${kitName}.`,
|
|
3265
3300
|
allPossibleComponents
|
|
@@ -3278,14 +3313,14 @@ function filterWalletComponents(allPossibleComponents, exclusions, kitName = "cu
|
|
|
3278
3313
|
}
|
|
3279
3314
|
}
|
|
3280
3315
|
if (componentCount > 0) {
|
|
3281
|
-
|
|
3316
|
+
import_ui_utils20.logger.debug(
|
|
3282
3317
|
"filterWalletComponents",
|
|
3283
3318
|
`Providing filtered components for kit: ${kitName} after exclusions (${exclusions.join(", ")}).`,
|
|
3284
3319
|
filteredComponents
|
|
3285
3320
|
);
|
|
3286
3321
|
return filteredComponents;
|
|
3287
3322
|
}
|
|
3288
|
-
|
|
3323
|
+
import_ui_utils20.logger.debug("filterWalletComponents", `All components were excluded for kit: ${kitName}.`);
|
|
3289
3324
|
return void 0;
|
|
3290
3325
|
}
|
|
3291
3326
|
function getComponentExclusionsFromConfig(kitConfig) {
|
|
@@ -3293,7 +3328,7 @@ function getComponentExclusionsFromConfig(kitConfig) {
|
|
|
3293
3328
|
const componentsCfg = kitConfig.components;
|
|
3294
3329
|
if (componentsCfg && typeof componentsCfg === "object" && "exclude" in componentsCfg && Array.isArray(componentsCfg.exclude)) {
|
|
3295
3330
|
return componentsCfg.exclude.filter(
|
|
3296
|
-
(key) => typeof key === "string" &&
|
|
3331
|
+
(key) => typeof key === "string" && import_ui_types.ECOSYSTEM_WALLET_COMPONENT_KEYS.includes(key)
|
|
3297
3332
|
);
|
|
3298
3333
|
}
|
|
3299
3334
|
}
|
|
@@ -3302,21 +3337,21 @@ function getComponentExclusionsFromConfig(kitConfig) {
|
|
|
3302
3337
|
|
|
3303
3338
|
// src/wallet/utils/uiKitService.ts
|
|
3304
3339
|
function getResolvedWalletComponents(uiKitConfiguration) {
|
|
3305
|
-
|
|
3340
|
+
import_ui_utils21.logger.debug(
|
|
3306
3341
|
"uiKitService:getResolvedWalletComponents",
|
|
3307
3342
|
"Received uiKitConfiguration:",
|
|
3308
3343
|
JSON.stringify(uiKitConfiguration)
|
|
3309
3344
|
);
|
|
3310
3345
|
const currentKitName = uiKitConfiguration.kitName || "custom";
|
|
3311
3346
|
if (currentKitName === "none") {
|
|
3312
|
-
|
|
3347
|
+
import_ui_utils21.logger.info(
|
|
3313
3348
|
"uiKitService",
|
|
3314
3349
|
'UI Kit set to "none" for getResolvedWalletComponents, not providing wallet components.'
|
|
3315
3350
|
);
|
|
3316
3351
|
return void 0;
|
|
3317
3352
|
}
|
|
3318
3353
|
const exclusions = getComponentExclusionsFromConfig(uiKitConfiguration.kitConfig);
|
|
3319
|
-
|
|
3354
|
+
import_ui_utils21.logger.debug(
|
|
3320
3355
|
"uiKitService",
|
|
3321
3356
|
`Extracted component exclusions for ${currentKitName}: ${exclusions.join(", ") || "none"}.`
|
|
3322
3357
|
);
|
|
@@ -3331,17 +3366,17 @@ function getResolvedWalletComponents(uiKitConfiguration) {
|
|
|
3331
3366
|
if (currentKitName === "rainbowkit") {
|
|
3332
3367
|
const validation = validateRainbowKitConfig(uiKitConfiguration.kitConfig);
|
|
3333
3368
|
if (!validation.isValid) {
|
|
3334
|
-
|
|
3369
|
+
import_ui_utils21.logger.warn(
|
|
3335
3370
|
"uiKitService",
|
|
3336
3371
|
`Invalid RainbowKit configuration for components: ${validation.error}. No components provided.`
|
|
3337
3372
|
);
|
|
3338
3373
|
return void 0;
|
|
3339
3374
|
}
|
|
3340
3375
|
const rainbowKitComponents = createRainbowKitComponents();
|
|
3341
|
-
|
|
3376
|
+
import_ui_utils21.logger.info("uiKitService", "Providing RainbowKit components.");
|
|
3342
3377
|
return filterWalletComponents(rainbowKitComponents, exclusions, currentKitName);
|
|
3343
3378
|
}
|
|
3344
|
-
|
|
3379
|
+
import_ui_utils21.logger.warn(
|
|
3345
3380
|
"uiKitService",
|
|
3346
3381
|
`UI Kit "${currentKitName}" for getResolvedWalletComponents not explicitly supported. No components provided.`
|
|
3347
3382
|
);
|
|
@@ -3353,7 +3388,7 @@ function getResolvedWalletComponents2(uiKitConfig2) {
|
|
|
3353
3388
|
return getResolvedWalletComponents(uiKitConfig2);
|
|
3354
3389
|
}
|
|
3355
3390
|
async function resolveAndInitializeKitConfig(kitName, programmaticKitConfig, loadConfigModule) {
|
|
3356
|
-
|
|
3391
|
+
import_ui_utils22.logger.debug(
|
|
3357
3392
|
"resolveAndInitializeKitConfig",
|
|
3358
3393
|
`Resolving native config for kit: ${kitName || "none"}`,
|
|
3359
3394
|
{
|
|
@@ -3367,7 +3402,7 @@ async function resolveAndInitializeKitConfig(kitName, programmaticKitConfig, loa
|
|
|
3367
3402
|
try {
|
|
3368
3403
|
userNativeConfig = await loadConfigModule(conventionalConfigPath);
|
|
3369
3404
|
} catch (error) {
|
|
3370
|
-
|
|
3405
|
+
import_ui_utils22.logger.warn(
|
|
3371
3406
|
"resolveAndInitializeKitConfig",
|
|
3372
3407
|
`Call to load native config for ${kitName} from ${conventionalConfigPath} failed. Error:`,
|
|
3373
3408
|
error
|
|
@@ -3382,7 +3417,7 @@ async function resolveAndInitializeKitConfig(kitName, programmaticKitConfig, loa
|
|
|
3382
3417
|
} else if (programmaticKitConfig) {
|
|
3383
3418
|
return programmaticKitConfig;
|
|
3384
3419
|
}
|
|
3385
|
-
|
|
3420
|
+
import_ui_utils22.logger.debug(
|
|
3386
3421
|
"resolveAndInitializeKitConfig",
|
|
3387
3422
|
`No native or programmatic kitConfig provided for ${kitName || "none"}. Returning null.`
|
|
3388
3423
|
);
|
|
@@ -3391,7 +3426,7 @@ async function resolveAndInitializeKitConfig(kitName, programmaticKitConfig, loa
|
|
|
3391
3426
|
|
|
3392
3427
|
// src/wallet/services/configResolutionService.ts
|
|
3393
3428
|
async function resolveFullUiKitConfiguration(programmaticOverrides, initialAppServiceKitName, currentAppServiceConfig, options) {
|
|
3394
|
-
|
|
3429
|
+
import_ui_utils23.logger.debug(
|
|
3395
3430
|
"configResolutionService:resolveFullUiKitConfiguration",
|
|
3396
3431
|
"Starting resolution with:",
|
|
3397
3432
|
{
|
|
@@ -3418,7 +3453,7 @@ async function resolveFullUiKitConfiguration(programmaticOverrides, initialAppSe
|
|
|
3418
3453
|
// Pass through customCode for export purposes only
|
|
3419
3454
|
customCode: programmaticOverrides.customCode
|
|
3420
3455
|
};
|
|
3421
|
-
|
|
3456
|
+
import_ui_utils23.logger.debug(
|
|
3422
3457
|
"configResolutionService:resolveFullUiKitConfiguration",
|
|
3423
3458
|
"Resolved finalFullConfig:",
|
|
3424
3459
|
finalFullConfig
|
|
@@ -3427,19 +3462,19 @@ async function resolveFullUiKitConfiguration(programmaticOverrides, initialAppSe
|
|
|
3427
3462
|
}
|
|
3428
3463
|
|
|
3429
3464
|
// src/abi/etherscan.ts
|
|
3430
|
-
var
|
|
3465
|
+
var import_ui_utils24 = require("@openzeppelin/ui-utils");
|
|
3431
3466
|
async function loadAbiFromEtherscan(address, networkConfig) {
|
|
3432
3467
|
if (shouldUseV2Api(networkConfig)) {
|
|
3433
|
-
|
|
3468
|
+
import_ui_utils24.logger.info("loadAbiFromEtherscan", "Using V2 API for fetching ABI");
|
|
3434
3469
|
return loadAbiFromEtherscanV2(address, networkConfig);
|
|
3435
3470
|
}
|
|
3436
|
-
|
|
3471
|
+
import_ui_utils24.logger.info("loadAbiFromEtherscan", "Using V1 API for fetching ABI");
|
|
3437
3472
|
return loadAbiFromEtherscanV1(address, networkConfig);
|
|
3438
3473
|
}
|
|
3439
3474
|
async function loadAbiFromEtherscanV1(address, networkConfig) {
|
|
3440
3475
|
const explorerConfig = resolveExplorerConfig(networkConfig);
|
|
3441
3476
|
if (!explorerConfig.apiUrl) {
|
|
3442
|
-
|
|
3477
|
+
import_ui_utils24.logger.error(
|
|
3443
3478
|
"loadAbiFromEtherscanV1",
|
|
3444
3479
|
`API URL is missing for ${networkConfig.name} explorer.`
|
|
3445
3480
|
);
|
|
@@ -3454,20 +3489,20 @@ async function loadAbiFromEtherscanV1(address, networkConfig) {
|
|
|
3454
3489
|
}
|
|
3455
3490
|
let response;
|
|
3456
3491
|
try {
|
|
3457
|
-
|
|
3492
|
+
import_ui_utils24.logger.info(
|
|
3458
3493
|
"loadAbiFromEtherscanV1",
|
|
3459
3494
|
`Fetching ABI from ${explorerConfig.apiUrl} for address: ${address}`
|
|
3460
3495
|
);
|
|
3461
3496
|
response = await fetch(url);
|
|
3462
3497
|
} catch (networkError) {
|
|
3463
|
-
|
|
3498
|
+
import_ui_utils24.logger.error(
|
|
3464
3499
|
"loadAbiFromEtherscanV1",
|
|
3465
3500
|
`Network error fetching ABI from Explorer API: ${networkError}`
|
|
3466
3501
|
);
|
|
3467
3502
|
throw new Error(`Network error fetching ABI: ${networkError.message}`);
|
|
3468
3503
|
}
|
|
3469
3504
|
if (!response.ok) {
|
|
3470
|
-
|
|
3505
|
+
import_ui_utils24.logger.error(
|
|
3471
3506
|
"loadAbiFromEtherscanV1",
|
|
3472
3507
|
`Explorer API request failed with status: ${response.status}`
|
|
3473
3508
|
);
|
|
@@ -3477,14 +3512,14 @@ async function loadAbiFromEtherscanV1(address, networkConfig) {
|
|
|
3477
3512
|
try {
|
|
3478
3513
|
apiResult = await response.json();
|
|
3479
3514
|
} catch (jsonError) {
|
|
3480
|
-
|
|
3515
|
+
import_ui_utils24.logger.error(
|
|
3481
3516
|
"loadAbiFromEtherscanV1",
|
|
3482
3517
|
`Failed to parse Explorer API response as JSON: ${jsonError}`
|
|
3483
3518
|
);
|
|
3484
3519
|
throw new Error("Invalid JSON response received from Explorer API.");
|
|
3485
3520
|
}
|
|
3486
3521
|
if (apiResult.status !== "1") {
|
|
3487
|
-
|
|
3522
|
+
import_ui_utils24.logger.warn(
|
|
3488
3523
|
"loadAbiFromEtherscanV1",
|
|
3489
3524
|
`Explorer API error: Status ${apiResult.status}, Message: ${apiResult.message}, Result: ${apiResult.result}`
|
|
3490
3525
|
);
|
|
@@ -3503,13 +3538,13 @@ async function loadAbiFromEtherscanV1(address, networkConfig) {
|
|
|
3503
3538
|
throw new Error("Parsed ABI from Explorer API is not an array.");
|
|
3504
3539
|
}
|
|
3505
3540
|
} catch (error) {
|
|
3506
|
-
|
|
3541
|
+
import_ui_utils24.logger.error(
|
|
3507
3542
|
"loadAbiFromEtherscanV1",
|
|
3508
3543
|
`Failed to parse ABI JSON string from Explorer API result: ${error}`
|
|
3509
3544
|
);
|
|
3510
3545
|
throw new Error(`Invalid ABI JSON received from Explorer API: ${error.message}`);
|
|
3511
3546
|
}
|
|
3512
|
-
|
|
3547
|
+
import_ui_utils24.logger.info(
|
|
3513
3548
|
"loadAbiFromEtherscanV1",
|
|
3514
3549
|
`Successfully parsed ABI for ${networkConfig.name} with ${abi.length} items.`
|
|
3515
3550
|
);
|
|
@@ -3523,17 +3558,17 @@ async function loadAbiFromEtherscanV1(address, networkConfig) {
|
|
|
3523
3558
|
|
|
3524
3559
|
// src/abi/loader.ts
|
|
3525
3560
|
var import_viem5 = require("viem");
|
|
3526
|
-
var
|
|
3561
|
+
var import_ui_utils29 = require("@openzeppelin/ui-utils");
|
|
3527
3562
|
|
|
3528
3563
|
// src/proxy/detection.ts
|
|
3529
3564
|
var import_viem4 = require("viem");
|
|
3530
|
-
var
|
|
3565
|
+
var import_ui_utils27 = require("@openzeppelin/ui-utils");
|
|
3531
3566
|
|
|
3532
3567
|
// src/configuration/execution.ts
|
|
3533
|
-
var
|
|
3568
|
+
var import_ui_utils26 = require("@openzeppelin/ui-utils");
|
|
3534
3569
|
|
|
3535
3570
|
// src/validation/eoa.ts
|
|
3536
|
-
var
|
|
3571
|
+
var import_ui_utils25 = require("@openzeppelin/ui-utils");
|
|
3537
3572
|
var SYSTEM_LOG_TAG = "EoaValidator";
|
|
3538
3573
|
async function validateEoaConfig(config, walletStatus) {
|
|
3539
3574
|
if (!config.allowAny) {
|
|
@@ -3548,7 +3583,7 @@ async function validateEoaConfig(config, walletStatus) {
|
|
|
3548
3583
|
return `Connected wallet address (${walletStatus.address}) does not match the required specific EOA address (${config.specificAddress}). Please connect the correct wallet.`;
|
|
3549
3584
|
}
|
|
3550
3585
|
} else if (walletStatus.isConnected && !walletStatus.address) {
|
|
3551
|
-
|
|
3586
|
+
import_ui_utils25.logger.warn(
|
|
3552
3587
|
SYSTEM_LOG_TAG,
|
|
3553
3588
|
"Wallet is connected but address is unavailable for EOA validation."
|
|
3554
3589
|
);
|
|
@@ -3572,7 +3607,7 @@ async function validateRelayerConfig(config) {
|
|
|
3572
3607
|
// src/configuration/execution.ts
|
|
3573
3608
|
var SYSTEM_LOG_TAG2 = "adapter-evm-execution-config";
|
|
3574
3609
|
async function getEvmSupportedExecutionMethods() {
|
|
3575
|
-
|
|
3610
|
+
import_ui_utils26.logger.warn(
|
|
3576
3611
|
"adapter-evm-execution-config",
|
|
3577
3612
|
"getEvmSupportedExecutionMethods is using placeholder implementation."
|
|
3578
3613
|
);
|
|
@@ -3598,11 +3633,11 @@ async function getEvmSupportedExecutionMethods() {
|
|
|
3598
3633
|
]);
|
|
3599
3634
|
}
|
|
3600
3635
|
async function _validateMultisigConfig(_config, _walletStatus) {
|
|
3601
|
-
|
|
3636
|
+
import_ui_utils26.logger.info(SYSTEM_LOG_TAG2, "Multisig execution config validation: Not yet fully implemented.");
|
|
3602
3637
|
return true;
|
|
3603
3638
|
}
|
|
3604
3639
|
async function validateEvmExecutionConfig(config, walletStatus) {
|
|
3605
|
-
|
|
3640
|
+
import_ui_utils26.logger.info(SYSTEM_LOG_TAG2, "Validating EVM execution config:", { config, walletStatus });
|
|
3606
3641
|
switch (config.method) {
|
|
3607
3642
|
case "eoa":
|
|
3608
3643
|
return validateEoaConfig(config, walletStatus);
|
|
@@ -3612,7 +3647,7 @@ async function validateEvmExecutionConfig(config, walletStatus) {
|
|
|
3612
3647
|
return _validateMultisigConfig(config, walletStatus);
|
|
3613
3648
|
default: {
|
|
3614
3649
|
const unknownMethod = config.method;
|
|
3615
|
-
|
|
3650
|
+
import_ui_utils26.logger.warn(
|
|
3616
3651
|
SYSTEM_LOG_TAG2,
|
|
3617
3652
|
`Unsupported execution method type encountered: ${unknownMethod}`
|
|
3618
3653
|
);
|
|
@@ -3711,7 +3746,7 @@ function detectProxyFromAbi(abi) {
|
|
|
3711
3746
|
};
|
|
3712
3747
|
}
|
|
3713
3748
|
async function getImplementationAddress(proxyAddress, networkConfig, proxyType) {
|
|
3714
|
-
|
|
3749
|
+
import_ui_utils27.logger.info(
|
|
3715
3750
|
"getImplementationAddress",
|
|
3716
3751
|
`Resolving implementation for ${proxyType} proxy: ${proxyAddress}`
|
|
3717
3752
|
);
|
|
@@ -3728,7 +3763,7 @@ async function getImplementationAddress(proxyAddress, networkConfig, proxyType)
|
|
|
3728
3763
|
case "beacon":
|
|
3729
3764
|
return await getBeaconImplementation(proxyAddress, networkConfig);
|
|
3730
3765
|
case "diamond":
|
|
3731
|
-
|
|
3766
|
+
import_ui_utils27.logger.info("getImplementationAddress", "Diamond proxies not fully supported yet");
|
|
3732
3767
|
return null;
|
|
3733
3768
|
case "minimal":
|
|
3734
3769
|
return await getMinimalProxyImplementation(proxyAddress, networkConfig);
|
|
@@ -3736,7 +3771,7 @@ async function getImplementationAddress(proxyAddress, networkConfig, proxyType)
|
|
|
3736
3771
|
return await tryCommonImplementationMethods(proxyAddress, networkConfig);
|
|
3737
3772
|
}
|
|
3738
3773
|
} catch (error) {
|
|
3739
|
-
|
|
3774
|
+
import_ui_utils27.logger.warn("getImplementationAddress", `Failed to resolve implementation: ${error}`);
|
|
3740
3775
|
return null;
|
|
3741
3776
|
}
|
|
3742
3777
|
}
|
|
@@ -3748,7 +3783,7 @@ async function getAdminAddress(proxyAddress, networkConfig) {
|
|
|
3748
3783
|
if (legacyAdmin) return legacyAdmin;
|
|
3749
3784
|
return null;
|
|
3750
3785
|
} catch (error) {
|
|
3751
|
-
|
|
3786
|
+
import_ui_utils27.logger.warn("getAdminAddress", `Failed to resolve admin: ${error}`);
|
|
3752
3787
|
return null;
|
|
3753
3788
|
}
|
|
3754
3789
|
}
|
|
@@ -3763,20 +3798,20 @@ async function getEIP1967Admin(proxyAddress, networkConfig) {
|
|
|
3763
3798
|
async function getLegacyOZAdmin(proxyAddress, networkConfig) {
|
|
3764
3799
|
try {
|
|
3765
3800
|
const slot = (0, import_viem4.keccak256)((0, import_viem4.toHex)("org.zeppelinos.proxy.admin"));
|
|
3766
|
-
|
|
3801
|
+
import_ui_utils27.logger.info("getLegacyOZAdmin", `Trying legacy OZ admin slot: ${slot}`);
|
|
3767
3802
|
return await readStorageSlot(proxyAddress, slot, networkConfig);
|
|
3768
3803
|
} catch (error) {
|
|
3769
|
-
|
|
3804
|
+
import_ui_utils27.logger.warn("getLegacyOZAdmin", `Failed computing or reading legacy admin slot: ${error}`);
|
|
3770
3805
|
return null;
|
|
3771
3806
|
}
|
|
3772
3807
|
}
|
|
3773
3808
|
async function getLegacyOZImplementation(proxyAddress, networkConfig) {
|
|
3774
3809
|
try {
|
|
3775
3810
|
const slot = (0, import_viem4.keccak256)((0, import_viem4.toHex)("org.zeppelinos.proxy.implementation"));
|
|
3776
|
-
|
|
3811
|
+
import_ui_utils27.logger.info("getLegacyOZImplementation", `Trying legacy OZ slot: ${slot}`);
|
|
3777
3812
|
return await readStorageSlot(proxyAddress, slot, networkConfig);
|
|
3778
3813
|
} catch (error) {
|
|
3779
|
-
|
|
3814
|
+
import_ui_utils27.logger.warn("getLegacyOZImplementation", `Failed computing or reading legacy slot: ${error}`);
|
|
3780
3815
|
return null;
|
|
3781
3816
|
}
|
|
3782
3817
|
}
|
|
@@ -3800,7 +3835,7 @@ async function getMinimalProxyImplementation(proxyAddress, networkConfig) {
|
|
|
3800
3835
|
}
|
|
3801
3836
|
return null;
|
|
3802
3837
|
} catch (error) {
|
|
3803
|
-
|
|
3838
|
+
import_ui_utils27.logger.warn("getMinimalProxyImplementation", `Error reading bytecode: ${error}`);
|
|
3804
3839
|
return null;
|
|
3805
3840
|
}
|
|
3806
3841
|
}
|
|
@@ -3815,7 +3850,7 @@ async function tryCommonImplementationMethods(proxyAddress, networkConfig) {
|
|
|
3815
3850
|
try {
|
|
3816
3851
|
const result = await callContractFunction(proxyAddress, method, [], networkConfig);
|
|
3817
3852
|
if (result && result !== "0x0000000000000000000000000000000000000000") {
|
|
3818
|
-
|
|
3853
|
+
import_ui_utils27.logger.info(
|
|
3819
3854
|
"tryCommonImplementationMethods",
|
|
3820
3855
|
`Found implementation via ${method}: ${result}`
|
|
3821
3856
|
);
|
|
@@ -3841,13 +3876,13 @@ async function readStorageSlot(address, slot, networkConfig) {
|
|
|
3841
3876
|
slot
|
|
3842
3877
|
});
|
|
3843
3878
|
if (storageValue && storageValue !== "0x0000000000000000000000000000000000000000000000000000000000000000") {
|
|
3844
|
-
|
|
3879
|
+
import_ui_utils27.logger.info("readStorageSlot", `Found non-zero value at slot ${slot}: ${storageValue}`);
|
|
3845
3880
|
const implAddress = "0x" + storageValue.slice(-40);
|
|
3846
3881
|
return implAddress;
|
|
3847
3882
|
}
|
|
3848
3883
|
return null;
|
|
3849
3884
|
} catch (error) {
|
|
3850
|
-
|
|
3885
|
+
import_ui_utils27.logger.warn("readStorageSlot", `Failed to read storage slot ${slot}: ${error}`);
|
|
3851
3886
|
return null;
|
|
3852
3887
|
}
|
|
3853
3888
|
}
|
|
@@ -3868,7 +3903,7 @@ async function callContractFunction(address, signature, params, networkConfig) {
|
|
|
3868
3903
|
}
|
|
3869
3904
|
return null;
|
|
3870
3905
|
} catch (error) {
|
|
3871
|
-
|
|
3906
|
+
import_ui_utils27.logger.warn("callContractFunction", `Failed to call ${signature}: ${error}`);
|
|
3872
3907
|
return null;
|
|
3873
3908
|
}
|
|
3874
3909
|
}
|
|
@@ -3880,13 +3915,13 @@ async function getContractBytecode(address, networkConfig) {
|
|
|
3880
3915
|
});
|
|
3881
3916
|
return bytecode || null;
|
|
3882
3917
|
} catch (error) {
|
|
3883
|
-
|
|
3918
|
+
import_ui_utils27.logger.warn("getContractBytecode", `Failed to get bytecode: ${error}`);
|
|
3884
3919
|
return null;
|
|
3885
3920
|
}
|
|
3886
3921
|
}
|
|
3887
3922
|
|
|
3888
3923
|
// src/abi/sourcify.ts
|
|
3889
|
-
var
|
|
3924
|
+
var import_ui_utils28 = require("@openzeppelin/ui-utils");
|
|
3890
3925
|
var SOURCIFY_APP_BASE = "https://repo.sourcify.dev";
|
|
3891
3926
|
function getSourcifyContractAppUrl(chainId, address) {
|
|
3892
3927
|
return `${SOURCIFY_APP_BASE}/${chainId}/${address}`;
|
|
@@ -3904,7 +3939,7 @@ async function loadAbiFromSourcify(address, networkConfig, timeoutMs = 4e3) {
|
|
|
3904
3939
|
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
3905
3940
|
try {
|
|
3906
3941
|
const url = buildSourcifyApiUrl(networkConfig.chainId, address);
|
|
3907
|
-
|
|
3942
|
+
import_ui_utils28.logger.info("loadAbiFromSourcify", `Fetching contract from ${url}`);
|
|
3908
3943
|
const response = await fetch(url, { signal: controller.signal });
|
|
3909
3944
|
if (!response.ok) {
|
|
3910
3945
|
throw new Error(`Sourcify request failed: ${response.status} ${response.statusText}`);
|
|
@@ -3919,7 +3954,7 @@ async function loadAbiFromSourcify(address, networkConfig, timeoutMs = 4e3) {
|
|
|
3919
3954
|
const schema = transformAbiToSchema(abi, contractName, address);
|
|
3920
3955
|
return { schema, originalAbi: JSON.stringify(abi) };
|
|
3921
3956
|
} catch (error) {
|
|
3922
|
-
|
|
3957
|
+
import_ui_utils28.logger.warn("loadAbiFromSourcify", `Failed to fetch ABI from Sourcify: ${String(error)}`);
|
|
3923
3958
|
throw error;
|
|
3924
3959
|
} finally {
|
|
3925
3960
|
clearTimeout(timeout);
|
|
@@ -3935,10 +3970,10 @@ async function loadAbiFromJson(abiJsonString) {
|
|
|
3935
3970
|
throw new Error("Parsed JSON is not an array.");
|
|
3936
3971
|
}
|
|
3937
3972
|
} catch (error) {
|
|
3938
|
-
|
|
3973
|
+
import_ui_utils29.logger.error("loadAbiFromJson", "Failed to parse source string as JSON ABI:", error);
|
|
3939
3974
|
throw new Error(`Invalid JSON ABI provided: ${error.message}`);
|
|
3940
3975
|
}
|
|
3941
|
-
|
|
3976
|
+
import_ui_utils29.logger.info("loadAbiFromJson", `Successfully parsed JSON ABI with ${abi.length} items.`);
|
|
3942
3977
|
const contractName = "ContractFromABI";
|
|
3943
3978
|
return transformAbiToSchema(abi, contractName, void 0);
|
|
3944
3979
|
}
|
|
@@ -3957,7 +3992,7 @@ async function loadEvmContract(artifacts, networkConfig, options = {}) {
|
|
|
3957
3992
|
const trimmed = contractDefinition.trim();
|
|
3958
3993
|
const hasJsonContent = trimmed.includes("[") && trimmed.includes("]") && trimmed.includes("{");
|
|
3959
3994
|
if (hasJsonContent) {
|
|
3960
|
-
|
|
3995
|
+
import_ui_utils29.logger.info("loadEvmContract", "Manual contract definition provided. Attempting to parse...");
|
|
3961
3996
|
try {
|
|
3962
3997
|
const schema = await loadAbiFromJson(contractDefinition);
|
|
3963
3998
|
return {
|
|
@@ -3973,14 +4008,14 @@ async function loadEvmContract(artifacts, networkConfig, options = {}) {
|
|
|
3973
4008
|
// Note: No proxy detection for manual ABIs - user provides what they want
|
|
3974
4009
|
};
|
|
3975
4010
|
} catch (error) {
|
|
3976
|
-
|
|
4011
|
+
import_ui_utils29.logger.error("loadEvmContract", "Failed to parse manually provided ABI:", error);
|
|
3977
4012
|
throw new Error(`The provided ABI JSON is invalid: ${error.message}`);
|
|
3978
4013
|
}
|
|
3979
4014
|
}
|
|
3980
4015
|
}
|
|
3981
4016
|
const forcedRaw = artifacts.__forcedProvider || artifacts.service;
|
|
3982
4017
|
const forcedProvider = isEvmProviderKey(forcedRaw) ? forcedRaw : null;
|
|
3983
|
-
|
|
4018
|
+
import_ui_utils29.logger.info(
|
|
3984
4019
|
"loadEvmContract",
|
|
3985
4020
|
`No manual ABI detected. Attempting Etherscan fetch for address: ${contractAddress}...`
|
|
3986
4021
|
);
|
|
@@ -4009,7 +4044,7 @@ function buildContractResult(contractAddress, abiResult, networkConfig, sourcePr
|
|
|
4009
4044
|
contractName: abiResult.schema.name,
|
|
4010
4045
|
verificationStatus: "verified",
|
|
4011
4046
|
fetchTimestamp: /* @__PURE__ */ new Date(),
|
|
4012
|
-
definitionHash: (0,
|
|
4047
|
+
definitionHash: (0, import_ui_utils29.simpleHash)(abiResult.originalAbi)
|
|
4013
4048
|
},
|
|
4014
4049
|
proxyInfo
|
|
4015
4050
|
};
|
|
@@ -4017,13 +4052,13 @@ function buildContractResult(contractAddress, abiResult, networkConfig, sourcePr
|
|
|
4017
4052
|
async function loadImplementationAbi(_contractAddress, implementationAddress, networkConfig, _proxyType) {
|
|
4018
4053
|
try {
|
|
4019
4054
|
const implementationResult = await loadAbiFromEtherscan(implementationAddress, networkConfig);
|
|
4020
|
-
|
|
4055
|
+
import_ui_utils29.logger.info(
|
|
4021
4056
|
"loadImplementationAbi",
|
|
4022
4057
|
`Successfully fetched implementation ABI with ${implementationResult.schema.functions.length} functions`
|
|
4023
4058
|
);
|
|
4024
4059
|
return implementationResult;
|
|
4025
4060
|
} catch (implementationError) {
|
|
4026
|
-
|
|
4061
|
+
import_ui_utils29.logger.warn(
|
|
4027
4062
|
"loadImplementationAbi",
|
|
4028
4063
|
`Failed to load implementation ABI: ${implementationError}`
|
|
4029
4064
|
);
|
|
@@ -4036,7 +4071,7 @@ async function handleProxyDetection(contractAddress, initialResult, networkConfi
|
|
|
4036
4071
|
if (!proxyDetection.isProxy) {
|
|
4037
4072
|
return null;
|
|
4038
4073
|
}
|
|
4039
|
-
|
|
4074
|
+
import_ui_utils29.logger.info(
|
|
4040
4075
|
"handleProxyDetection",
|
|
4041
4076
|
`Proxy detected: ${proxyDetection.proxyType} (confidence: ${proxyDetection.confidence})`
|
|
4042
4077
|
);
|
|
@@ -4048,7 +4083,7 @@ async function handleProxyDetection(contractAddress, initialResult, networkConfi
|
|
|
4048
4083
|
);
|
|
4049
4084
|
const adminAddress = await getAdminAddress(contractAddress, networkConfig);
|
|
4050
4085
|
if (!implementationAddress) {
|
|
4051
|
-
|
|
4086
|
+
import_ui_utils29.logger.info("handleProxyDetection", "Proxy detected but implementation address not found");
|
|
4052
4087
|
return buildContractResult(contractAddress, initialResult, networkConfig, initialProvider, {
|
|
4053
4088
|
isProxy: true,
|
|
4054
4089
|
proxyType,
|
|
@@ -4056,7 +4091,7 @@ async function handleProxyDetection(contractAddress, initialResult, networkConfi
|
|
|
4056
4091
|
detectionMethod: "automatic"
|
|
4057
4092
|
});
|
|
4058
4093
|
}
|
|
4059
|
-
|
|
4094
|
+
import_ui_utils29.logger.info("handleProxyDetection", `Found implementation at: ${implementationAddress}`);
|
|
4060
4095
|
const implementationResult = await loadImplementationAbi(
|
|
4061
4096
|
contractAddress,
|
|
4062
4097
|
implementationAddress,
|
|
@@ -4092,12 +4127,12 @@ async function handleProxyDetection(contractAddress, initialResult, networkConfi
|
|
|
4092
4127
|
async function loadContractWithProxyDetection(contractAddress, networkConfig, options = {}, forcedProvider = null) {
|
|
4093
4128
|
try {
|
|
4094
4129
|
let uiDefault = null;
|
|
4095
|
-
const svcCfg =
|
|
4130
|
+
const svcCfg = import_ui_utils29.userNetworkServiceConfigService.get(networkConfig.id, "contract-definitions");
|
|
4096
4131
|
if (svcCfg && typeof svcCfg === "object" && "defaultProvider" in svcCfg) {
|
|
4097
4132
|
const raw = svcCfg.defaultProvider;
|
|
4098
4133
|
if (isEvmProviderKey(raw)) uiDefault = raw;
|
|
4099
4134
|
}
|
|
4100
|
-
const appDefaultRaw =
|
|
4135
|
+
const appDefaultRaw = import_ui_utils29.appConfigService.getGlobalServiceParam(
|
|
4101
4136
|
"contractdefinition",
|
|
4102
4137
|
"defaultProvider"
|
|
4103
4138
|
);
|
|
@@ -4116,13 +4151,13 @@ async function loadContractWithProxyDetection(contractAddress, networkConfig, op
|
|
|
4116
4151
|
const remainingOverall = Math.max(100, overallDeadline - Date.now());
|
|
4117
4152
|
const attemptTimeout = Math.min(PER_PROVIDER_TIMEOUT_MS, remainingOverall);
|
|
4118
4153
|
if (provider === EvmProviderKeys.Etherscan) {
|
|
4119
|
-
initialResult = await (0,
|
|
4154
|
+
initialResult = await (0, import_ui_utils29.withTimeout)(
|
|
4120
4155
|
loadAbiFromEtherscan(contractAddress, networkConfig),
|
|
4121
4156
|
attemptTimeout,
|
|
4122
4157
|
"etherscan"
|
|
4123
4158
|
);
|
|
4124
4159
|
} else if (provider === EvmProviderKeys.Sourcify) {
|
|
4125
|
-
initialResult = await (0,
|
|
4160
|
+
initialResult = await (0, import_ui_utils29.withTimeout)(
|
|
4126
4161
|
loadAbiFromSourcify(contractAddress, networkConfig, attemptTimeout),
|
|
4127
4162
|
attemptTimeout,
|
|
4128
4163
|
"sourcify"
|
|
@@ -4138,7 +4173,7 @@ async function loadContractWithProxyDetection(contractAddress, networkConfig, op
|
|
|
4138
4173
|
}
|
|
4139
4174
|
}
|
|
4140
4175
|
if (!initialResult) throw lastError ?? new Error("No provider succeeded");
|
|
4141
|
-
|
|
4176
|
+
import_ui_utils29.logger.info(
|
|
4142
4177
|
"loadContractWithProxyDetection",
|
|
4143
4178
|
`Successfully fetched initial ABI for ${contractAddress} with ${initialResult.schema.functions.length} functions`
|
|
4144
4179
|
);
|
|
@@ -4155,7 +4190,7 @@ async function loadContractWithProxyDetection(contractAddress, networkConfig, op
|
|
|
4155
4190
|
}
|
|
4156
4191
|
return buildContractResult(contractAddress, initialResult, networkConfig, usedProvider);
|
|
4157
4192
|
} catch (error) {
|
|
4158
|
-
|
|
4193
|
+
import_ui_utils29.logger.warn("loadContractWithProxyDetection", `Contract loading failed: ${error}`);
|
|
4159
4194
|
if (forcedProvider) {
|
|
4160
4195
|
throw error;
|
|
4161
4196
|
}
|
|
@@ -4191,6 +4226,23 @@ var EVM_TYPE_TO_FIELD_TYPE = {
|
|
|
4191
4226
|
bytes: "textarea",
|
|
4192
4227
|
bytes32: "text"
|
|
4193
4228
|
};
|
|
4229
|
+
var EVM_DYNAMIC_PATTERNS = [
|
|
4230
|
+
{ name: "array", syntax: "T[]", mapsTo: "array", description: "Dynamic array of primitives" },
|
|
4231
|
+
{ name: "fixed-array", syntax: "T[N]", mapsTo: "array", description: "Fixed-size array" },
|
|
4232
|
+
{
|
|
4233
|
+
name: "tuple-array",
|
|
4234
|
+
syntax: "tuple[]",
|
|
4235
|
+
mapsTo: "array-object",
|
|
4236
|
+
description: "Array of structs"
|
|
4237
|
+
},
|
|
4238
|
+
{ name: "tuple", syntax: "tuple", mapsTo: "object", description: "Struct/tuple type" }
|
|
4239
|
+
];
|
|
4240
|
+
function getEvmTypeMappingInfo() {
|
|
4241
|
+
return {
|
|
4242
|
+
primitives: { ...EVM_TYPE_TO_FIELD_TYPE },
|
|
4243
|
+
dynamicPatterns: EVM_DYNAMIC_PATTERNS
|
|
4244
|
+
};
|
|
4245
|
+
}
|
|
4194
4246
|
|
|
4195
4247
|
// src/mapping/type-mapper.ts
|
|
4196
4248
|
function mapEvmParamTypeToFieldType(parameterType) {
|
|
@@ -4243,7 +4295,7 @@ function getEvmCompatibleFieldTypes(parameterType) {
|
|
|
4243
4295
|
|
|
4244
4296
|
// src/mapping/field-generator.ts
|
|
4245
4297
|
var import_lodash = require("lodash");
|
|
4246
|
-
var
|
|
4298
|
+
var import_ui_utils30 = require("@openzeppelin/ui-utils");
|
|
4247
4299
|
function extractArrayElementType(parameterType) {
|
|
4248
4300
|
const arrayMatch = parameterType.match(/^(.+)\[\d*\]$/);
|
|
4249
4301
|
if (arrayMatch) {
|
|
@@ -4274,8 +4326,8 @@ function generateEvmDefaultField(parameter) {
|
|
|
4274
4326
|
type: fieldType,
|
|
4275
4327
|
placeholder: `Enter ${parameter.displayName || parameter.name || parameter.type}`,
|
|
4276
4328
|
helperText: parameter.description || "",
|
|
4277
|
-
defaultValue: (0,
|
|
4278
|
-
validation: (0,
|
|
4329
|
+
defaultValue: (0, import_ui_utils30.getDefaultValueForType)(fieldType),
|
|
4330
|
+
validation: (0, import_ui_utils30.enhanceNumericValidation)(
|
|
4279
4331
|
getDefaultValidation(),
|
|
4280
4332
|
parameter.type,
|
|
4281
4333
|
EVM_NUMERIC_BOUNDS
|
|
@@ -4291,7 +4343,7 @@ function generateEvmDefaultField(parameter) {
|
|
|
4291
4343
|
elementType: elementFieldType,
|
|
4292
4344
|
elementFieldConfig: {
|
|
4293
4345
|
type: elementFieldType,
|
|
4294
|
-
validation: (0,
|
|
4346
|
+
validation: (0, import_ui_utils30.enhanceNumericValidation)(
|
|
4295
4347
|
getDefaultValidation(),
|
|
4296
4348
|
elementType,
|
|
4297
4349
|
EVM_NUMERIC_BOUNDS
|
|
@@ -4319,11 +4371,11 @@ function isEvmViewFunction(functionDetails) {
|
|
|
4319
4371
|
|
|
4320
4372
|
// src/query/handler.ts
|
|
4321
4373
|
var import_viem7 = require("viem");
|
|
4322
|
-
var
|
|
4374
|
+
var import_ui_utils33 = require("@openzeppelin/ui-utils");
|
|
4323
4375
|
|
|
4324
4376
|
// src/transform/input-parser.ts
|
|
4325
4377
|
var import_viem6 = require("viem");
|
|
4326
|
-
var
|
|
4378
|
+
var import_ui_utils31 = require("@openzeppelin/ui-utils");
|
|
4327
4379
|
function parseEvmInput(param, rawValue, isRecursive = false) {
|
|
4328
4380
|
const { type, name } = param;
|
|
4329
4381
|
const baseType = type.replace(/\[\d*\]$/, "");
|
|
@@ -4441,7 +4493,7 @@ function parseEvmInput(param, rawValue, isRecursive = false) {
|
|
|
4441
4493
|
} else if (baseType === "string") {
|
|
4442
4494
|
return String(rawValue);
|
|
4443
4495
|
}
|
|
4444
|
-
|
|
4496
|
+
import_ui_utils31.logger.warn(
|
|
4445
4497
|
"parseEvmInput",
|
|
4446
4498
|
`Unknown EVM parameter type encountered: '${type}'. Using raw value.`
|
|
4447
4499
|
);
|
|
@@ -4454,10 +4506,10 @@ function parseEvmInput(param, rawValue, isRecursive = false) {
|
|
|
4454
4506
|
}
|
|
4455
4507
|
|
|
4456
4508
|
// src/transform/output-formatter.ts
|
|
4457
|
-
var
|
|
4509
|
+
var import_ui_utils32 = require("@openzeppelin/ui-utils");
|
|
4458
4510
|
function formatEvmFunctionResult(decodedValue, functionDetails) {
|
|
4459
4511
|
if (!functionDetails.outputs || !Array.isArray(functionDetails.outputs)) {
|
|
4460
|
-
|
|
4512
|
+
import_ui_utils32.logger.warn(
|
|
4461
4513
|
"formatEvmFunctionResult",
|
|
4462
4514
|
`Output ABI definition missing or invalid for function ${functionDetails.name}.`
|
|
4463
4515
|
);
|
|
@@ -4485,7 +4537,7 @@ function formatEvmFunctionResult(decodedValue, functionDetails) {
|
|
|
4485
4537
|
}
|
|
4486
4538
|
} catch (error) {
|
|
4487
4539
|
const errorMessage = `Error formatting result for ${functionDetails.name}: ${error.message}`;
|
|
4488
|
-
|
|
4540
|
+
import_ui_utils32.logger.error("formatEvmFunctionResult", errorMessage, {
|
|
4489
4541
|
functionName: functionDetails.name,
|
|
4490
4542
|
decodedValue,
|
|
4491
4543
|
error
|
|
@@ -4508,14 +4560,14 @@ async function getPublicClientForQuery(walletImplementation, networkConfig) {
|
|
|
4508
4560
|
if (clientFromWallet) {
|
|
4509
4561
|
return clientFromWallet;
|
|
4510
4562
|
} else {
|
|
4511
|
-
|
|
4563
|
+
import_ui_utils33.logger.warn(
|
|
4512
4564
|
"getPublicClientForQuery",
|
|
4513
4565
|
`Could not get public client from connected wallet for chain ${walletChainId}. Falling back.`
|
|
4514
4566
|
);
|
|
4515
4567
|
}
|
|
4516
4568
|
}
|
|
4517
4569
|
const resolvedRpc = resolveRpcUrl(networkConfig);
|
|
4518
|
-
|
|
4570
|
+
import_ui_utils33.logger.info(
|
|
4519
4571
|
"getPublicClientForQuery",
|
|
4520
4572
|
`Wallet not connected/on wrong chain OR failed to get wallet client. Creating dedicated public client for query on ${networkConfig.name} using RPC: ${resolvedRpc}`
|
|
4521
4573
|
);
|
|
@@ -4526,7 +4578,7 @@ function createPublicClientWithRpc(networkConfig, rpcUrl) {
|
|
|
4526
4578
|
if (networkConfig.viemChain) {
|
|
4527
4579
|
chainForViem = networkConfig.viemChain;
|
|
4528
4580
|
} else {
|
|
4529
|
-
|
|
4581
|
+
import_ui_utils33.logger.warn(
|
|
4530
4582
|
"createPublicClientWithRpc",
|
|
4531
4583
|
`Viem chain object (viemChain) not provided in EvmNetworkConfig for ${networkConfig.name} (query). Creating a minimal one.`
|
|
4532
4584
|
);
|
|
@@ -4553,7 +4605,7 @@ function createPublicClientWithRpc(networkConfig, rpcUrl) {
|
|
|
4553
4605
|
});
|
|
4554
4606
|
return publicClient;
|
|
4555
4607
|
} catch (error) {
|
|
4556
|
-
|
|
4608
|
+
import_ui_utils33.logger.error(
|
|
4557
4609
|
"createPublicClientWithRpc",
|
|
4558
4610
|
"Failed to create network-specific public client for query:",
|
|
4559
4611
|
error
|
|
@@ -4564,7 +4616,7 @@ function createPublicClientWithRpc(networkConfig, rpcUrl) {
|
|
|
4564
4616
|
}
|
|
4565
4617
|
}
|
|
4566
4618
|
async function queryEvmViewFunction(contractAddress, functionId, networkConfig, params, contractSchema, walletImplementation, loadContractFn) {
|
|
4567
|
-
|
|
4619
|
+
import_ui_utils33.logger.info(
|
|
4568
4620
|
"queryEvmViewFunction",
|
|
4569
4621
|
`Querying view function: ${functionId} on ${contractAddress} (${networkConfig.name})`,
|
|
4570
4622
|
{ params }
|
|
@@ -4595,9 +4647,9 @@ async function queryEvmViewFunction(contractAddress, functionId, networkConfig,
|
|
|
4595
4647
|
}
|
|
4596
4648
|
return parseEvmInput(inputParam, rawValue, false);
|
|
4597
4649
|
});
|
|
4598
|
-
|
|
4650
|
+
import_ui_utils33.logger.debug("queryEvmViewFunction", "Parsed Args for readContract:", args);
|
|
4599
4651
|
const functionAbiItem = createAbiFunctionItem(functionDetails);
|
|
4600
|
-
|
|
4652
|
+
import_ui_utils33.logger.debug(
|
|
4601
4653
|
"queryEvmViewFunction",
|
|
4602
4654
|
`[Query ${functionDetails.name}] Calling readContract with ABI:`,
|
|
4603
4655
|
functionAbiItem,
|
|
@@ -4613,7 +4665,7 @@ async function queryEvmViewFunction(contractAddress, functionId, networkConfig,
|
|
|
4613
4665
|
args
|
|
4614
4666
|
});
|
|
4615
4667
|
} catch (readError) {
|
|
4616
|
-
|
|
4668
|
+
import_ui_utils33.logger.error(
|
|
4617
4669
|
"queryEvmViewFunction",
|
|
4618
4670
|
`[Query ${functionDetails.name}] publicClient.readContract specific error:`,
|
|
4619
4671
|
readError
|
|
@@ -4622,7 +4674,7 @@ async function queryEvmViewFunction(contractAddress, functionId, networkConfig,
|
|
|
4622
4674
|
`Viem readContract failed for ${functionDetails.name}: ${readError.message}`
|
|
4623
4675
|
);
|
|
4624
4676
|
}
|
|
4625
|
-
|
|
4677
|
+
import_ui_utils33.logger.debug(
|
|
4626
4678
|
"queryEvmViewFunction",
|
|
4627
4679
|
`[Query ${functionDetails.name}] Raw decoded result:`,
|
|
4628
4680
|
decodedResult
|
|
@@ -4630,7 +4682,7 @@ async function queryEvmViewFunction(contractAddress, functionId, networkConfig,
|
|
|
4630
4682
|
return decodedResult;
|
|
4631
4683
|
} catch (error) {
|
|
4632
4684
|
const errorMessage = `Failed to query view function ${functionId} on network ${networkConfig.name}: ${error.message}`;
|
|
4633
|
-
|
|
4685
|
+
import_ui_utils33.logger.error("queryEvmViewFunction", errorMessage, {
|
|
4634
4686
|
contractAddress,
|
|
4635
4687
|
functionId,
|
|
4636
4688
|
params,
|
|
@@ -4644,7 +4696,7 @@ async function queryEvmViewFunction(contractAddress, functionId, networkConfig,
|
|
|
4644
4696
|
// src/transaction/relayer.ts
|
|
4645
4697
|
var import_viem8 = require("viem");
|
|
4646
4698
|
var import_relayer_sdk = require("@openzeppelin/relayer-sdk");
|
|
4647
|
-
var
|
|
4699
|
+
var import_ui_utils34 = require("@openzeppelin/ui-utils");
|
|
4648
4700
|
var RelayerExecutionStrategy = class {
|
|
4649
4701
|
async execute(transactionData, executionConfig, _walletImplementation, onStatusChange, runtimeApiKey) {
|
|
4650
4702
|
const relayerConfig = executionConfig;
|
|
@@ -4679,7 +4731,7 @@ var RelayerExecutionStrategy = class {
|
|
|
4679
4731
|
* @throws If the API call fails or returns an unsuccessful response.
|
|
4680
4732
|
*/
|
|
4681
4733
|
async getEvmRelayers(serviceUrl, accessToken, networkConfig) {
|
|
4682
|
-
|
|
4734
|
+
import_ui_utils34.logger.info(
|
|
4683
4735
|
"[Relayer] Getting relayers with access token",
|
|
4684
4736
|
accessToken.slice(0, 5).padEnd(accessToken.length, "*")
|
|
4685
4737
|
);
|
|
@@ -4727,7 +4779,7 @@ var RelayerExecutionStrategy = class {
|
|
|
4727
4779
|
* @throws If any API call fails or returns an unsuccessful response.
|
|
4728
4780
|
*/
|
|
4729
4781
|
async getEvmRelayer(serviceUrl, accessToken, relayerId, networkConfig) {
|
|
4730
|
-
|
|
4782
|
+
import_ui_utils34.logger.info("[Relayer] Getting detailed relayer info", relayerId);
|
|
4731
4783
|
const sdkConfig = new import_relayer_sdk.Configuration({
|
|
4732
4784
|
basePath: serviceUrl,
|
|
4733
4785
|
accessToken
|
|
@@ -4737,11 +4789,11 @@ var RelayerExecutionStrategy = class {
|
|
|
4737
4789
|
const [relayerResponse, balanceResponse, statusResponse] = await Promise.all([
|
|
4738
4790
|
relayersApi.getRelayer(relayerId),
|
|
4739
4791
|
relayersApi.getRelayerBalance(relayerId).catch((err) => {
|
|
4740
|
-
|
|
4792
|
+
import_ui_utils34.logger.warn("[Relayer] Failed to fetch balance", err);
|
|
4741
4793
|
return null;
|
|
4742
4794
|
}),
|
|
4743
4795
|
relayersApi.getRelayerStatus(relayerId).catch((err) => {
|
|
4744
|
-
|
|
4796
|
+
import_ui_utils34.logger.warn("[Relayer] Failed to fetch status", err);
|
|
4745
4797
|
return null;
|
|
4746
4798
|
})
|
|
4747
4799
|
]);
|
|
@@ -4764,7 +4816,7 @@ var RelayerExecutionStrategy = class {
|
|
|
4764
4816
|
const currencySymbol = networkConfig.nativeCurrency.symbol;
|
|
4765
4817
|
enhancedDetails.balance = `${balanceInEth} ${currencySymbol}`;
|
|
4766
4818
|
} catch (error) {
|
|
4767
|
-
|
|
4819
|
+
import_ui_utils34.logger.warn("[Relayer] Failed to format balance, using raw value", String(error));
|
|
4768
4820
|
enhancedDetails.balance = String(balanceResponse.data.data.balance);
|
|
4769
4821
|
}
|
|
4770
4822
|
}
|
|
@@ -4782,10 +4834,10 @@ var RelayerExecutionStrategy = class {
|
|
|
4782
4834
|
}
|
|
4783
4835
|
}
|
|
4784
4836
|
}
|
|
4785
|
-
|
|
4837
|
+
import_ui_utils34.logger.info("[Relayer] Retrieved enhanced relayer details", JSON.stringify(enhancedDetails));
|
|
4786
4838
|
return enhancedDetails;
|
|
4787
4839
|
} catch (error) {
|
|
4788
|
-
|
|
4840
|
+
import_ui_utils34.logger.error(
|
|
4789
4841
|
"[Relayer] Failed to get relayer details",
|
|
4790
4842
|
error instanceof Error ? error.message : String(error)
|
|
4791
4843
|
);
|
|
@@ -4810,7 +4862,7 @@ var RelayerExecutionStrategy = class {
|
|
|
4810
4862
|
let valueNumber = 0;
|
|
4811
4863
|
const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
4812
4864
|
if (valueBigint > MAX_SAFE) {
|
|
4813
|
-
|
|
4865
|
+
import_ui_utils34.logger.warn(
|
|
4814
4866
|
"[Relayer] Value exceeds JS safe integer. Truncating for request.",
|
|
4815
4867
|
valueBigint.toString()
|
|
4816
4868
|
);
|
|
@@ -4825,7 +4877,7 @@ var RelayerExecutionStrategy = class {
|
|
|
4825
4877
|
// If no explicit gas limit is provided, keep a conservative default but warn.
|
|
4826
4878
|
gas_limit: (() => {
|
|
4827
4879
|
if (typeof evmOptions?.gasLimit === "number") return evmOptions.gasLimit;
|
|
4828
|
-
|
|
4880
|
+
import_ui_utils34.logger.warn(
|
|
4829
4881
|
"[Relayer]",
|
|
4830
4882
|
"No gasLimit provided; using default 210000. Consider setting explicitly."
|
|
4831
4883
|
);
|
|
@@ -4897,10 +4949,10 @@ var RelayerExecutionStrategy = class {
|
|
|
4897
4949
|
};
|
|
4898
4950
|
|
|
4899
4951
|
// src/transaction/sender.ts
|
|
4900
|
-
var
|
|
4952
|
+
var import_ui_utils35 = require("@openzeppelin/ui-utils");
|
|
4901
4953
|
var SYSTEM_LOG_TAG3 = "adapter-evm-sender";
|
|
4902
4954
|
async function waitForEvmTransactionConfirmation(txHash, walletImplementation) {
|
|
4903
|
-
|
|
4955
|
+
import_ui_utils35.logger.info(SYSTEM_LOG_TAG3, `Waiting for tx: ${txHash}`);
|
|
4904
4956
|
try {
|
|
4905
4957
|
const resolvedPublicClient = await walletImplementation.getPublicClient();
|
|
4906
4958
|
if (!resolvedPublicClient) {
|
|
@@ -4909,15 +4961,15 @@ async function waitForEvmTransactionConfirmation(txHash, walletImplementation) {
|
|
|
4909
4961
|
const receipt = await resolvedPublicClient.waitForTransactionReceipt({
|
|
4910
4962
|
hash: txHash
|
|
4911
4963
|
});
|
|
4912
|
-
|
|
4964
|
+
import_ui_utils35.logger.info(SYSTEM_LOG_TAG3, "Received receipt:", receipt);
|
|
4913
4965
|
if (receipt.status === "success") {
|
|
4914
4966
|
return { status: "success", receipt };
|
|
4915
4967
|
} else {
|
|
4916
|
-
|
|
4968
|
+
import_ui_utils35.logger.error(SYSTEM_LOG_TAG3, "Transaction reverted:", receipt);
|
|
4917
4969
|
return { status: "error", receipt, error: new Error("Transaction reverted.") };
|
|
4918
4970
|
}
|
|
4919
4971
|
} catch (error) {
|
|
4920
|
-
|
|
4972
|
+
import_ui_utils35.logger.error(SYSTEM_LOG_TAG3, "Error waiting for transaction confirmation:", error);
|
|
4921
4973
|
return {
|
|
4922
4974
|
status: "error",
|
|
4923
4975
|
error: error instanceof Error ? error : new Error(String(error))
|
|
@@ -4927,9 +4979,9 @@ async function waitForEvmTransactionConfirmation(txHash, walletImplementation) {
|
|
|
4927
4979
|
|
|
4928
4980
|
// src/transaction/formatter.ts
|
|
4929
4981
|
var import_viem9 = require("viem");
|
|
4930
|
-
var
|
|
4982
|
+
var import_ui_utils36 = require("@openzeppelin/ui-utils");
|
|
4931
4983
|
function formatEvmTransactionData(contractSchema, functionId, submittedInputs, fields) {
|
|
4932
|
-
|
|
4984
|
+
import_ui_utils36.logger.info(
|
|
4933
4985
|
"formatEvmTransactionData",
|
|
4934
4986
|
`Formatting EVM transaction data for function: ${functionId}`
|
|
4935
4987
|
);
|
|
@@ -4967,7 +5019,7 @@ function formatEvmTransactionData(contractSchema, functionId, submittedInputs, f
|
|
|
4967
5019
|
const isPayable = functionDetails.stateMutability === "payable";
|
|
4968
5020
|
let transactionValue = 0n;
|
|
4969
5021
|
if (isPayable) {
|
|
4970
|
-
|
|
5022
|
+
import_ui_utils36.logger.warn(
|
|
4971
5023
|
"formatEvmTransactionData",
|
|
4972
5024
|
"Payable function detected, but sending 0 ETH. Implement value input."
|
|
4973
5025
|
);
|
|
@@ -4988,7 +5040,7 @@ function formatEvmTransactionData(contractSchema, functionId, submittedInputs, f
|
|
|
4988
5040
|
}
|
|
4989
5041
|
|
|
4990
5042
|
// src/transaction/eoa.ts
|
|
4991
|
-
var
|
|
5043
|
+
var import_ui_utils37 = require("@openzeppelin/ui-utils");
|
|
4992
5044
|
var SYSTEM_LOG_TAG4 = "EoaExecutionStrategy";
|
|
4993
5045
|
var EoaExecutionStrategy = class {
|
|
4994
5046
|
async execute(transactionData, executionConfig, walletImplementation, onStatusChange, _runtimeApiKey) {
|
|
@@ -5001,9 +5053,9 @@ var EoaExecutionStrategy = class {
|
|
|
5001
5053
|
if (validationResult !== true) {
|
|
5002
5054
|
throw new Error(validationResult);
|
|
5003
5055
|
}
|
|
5004
|
-
|
|
5056
|
+
import_ui_utils37.logger.info(SYSTEM_LOG_TAG4, "Using EOA execution strategy.");
|
|
5005
5057
|
try {
|
|
5006
|
-
|
|
5058
|
+
import_ui_utils37.logger.debug(SYSTEM_LOG_TAG4, "Calling walletClient.writeContract with:", {
|
|
5007
5059
|
account: accountStatus.address,
|
|
5008
5060
|
address: transactionData.address,
|
|
5009
5061
|
abi: transactionData.abi,
|
|
@@ -5022,10 +5074,10 @@ var EoaExecutionStrategy = class {
|
|
|
5022
5074
|
value: transactionData.value,
|
|
5023
5075
|
chain: walletClient.chain
|
|
5024
5076
|
});
|
|
5025
|
-
|
|
5077
|
+
import_ui_utils37.logger.info(SYSTEM_LOG_TAG4, "EOA Transaction initiated. Hash:", hash);
|
|
5026
5078
|
return { txHash: hash };
|
|
5027
5079
|
} catch (error) {
|
|
5028
|
-
|
|
5080
|
+
import_ui_utils37.logger.error(SYSTEM_LOG_TAG4, "Error during EOA writeContract call:", error);
|
|
5029
5081
|
const errorMessage = error instanceof Error ? error.message : "Unknown EOA transaction error";
|
|
5030
5082
|
throw new Error(`Transaction failed (EOA): ${errorMessage}`);
|
|
5031
5083
|
}
|
|
@@ -5033,12 +5085,12 @@ var EoaExecutionStrategy = class {
|
|
|
5033
5085
|
async getAuthenticatedWalletClient(walletImplementation) {
|
|
5034
5086
|
const walletClient = await walletImplementation.getWalletClient();
|
|
5035
5087
|
if (!walletClient) {
|
|
5036
|
-
|
|
5088
|
+
import_ui_utils37.logger.error(SYSTEM_LOG_TAG4, "Wallet client not available. Is wallet connected?");
|
|
5037
5089
|
throw new Error("Wallet is not connected or client is unavailable.");
|
|
5038
5090
|
}
|
|
5039
5091
|
const accountStatus = walletImplementation.getWalletConnectionStatus();
|
|
5040
5092
|
if (!accountStatus.isConnected || !accountStatus.address) {
|
|
5041
|
-
|
|
5093
|
+
import_ui_utils37.logger.error(SYSTEM_LOG_TAG4, "Account not available. Is wallet connected?");
|
|
5042
5094
|
throw new Error("Wallet is not connected or account address is unavailable.");
|
|
5043
5095
|
}
|
|
5044
5096
|
return { walletClient, accountStatus };
|
|
@@ -5047,17 +5099,17 @@ var EoaExecutionStrategy = class {
|
|
|
5047
5099
|
|
|
5048
5100
|
// src/transaction/components/EvmRelayerOptions.tsx
|
|
5049
5101
|
var import_react11 = __toESM(require("react"), 1);
|
|
5050
|
-
var
|
|
5102
|
+
var import_ui_components9 = require("@openzeppelin/ui-components");
|
|
5051
5103
|
|
|
5052
5104
|
// src/transaction/components/AdvancedInfo.tsx
|
|
5053
5105
|
var import_lucide_react5 = require("lucide-react");
|
|
5054
|
-
var
|
|
5106
|
+
var import_ui_components6 = require("@openzeppelin/ui-components");
|
|
5055
5107
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
5056
5108
|
var AdvancedInfo = ({ showAdvancedInfo, onToggle }) => {
|
|
5057
5109
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-2", children: [
|
|
5058
5110
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5059
5111
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-base font-medium", children: "Gas Pricing Strategy" }),
|
|
5060
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5112
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_ui_components6.Button, { variant: "ghost", size: "sm", onClick: onToggle, className: "text-xs", type: "button", children: [
|
|
5061
5113
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react5.Info, { className: "h-3 w-3 mr-1" }),
|
|
5062
5114
|
"API Requirements"
|
|
5063
5115
|
] })
|
|
@@ -5076,8 +5128,8 @@ var AdvancedInfo = ({ showAdvancedInfo, onToggle }) => {
|
|
|
5076
5128
|
|
|
5077
5129
|
// src/transaction/components/CustomGasParameters.tsx
|
|
5078
5130
|
var import_lucide_react6 = require("lucide-react");
|
|
5079
|
-
var
|
|
5080
|
-
var
|
|
5131
|
+
var import_ui_components7 = require("@openzeppelin/ui-components");
|
|
5132
|
+
var import_ui_utils38 = require("@openzeppelin/ui-utils");
|
|
5081
5133
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
5082
5134
|
var CustomGasParameters = ({
|
|
5083
5135
|
control,
|
|
@@ -5098,7 +5150,7 @@ var CustomGasParameters = ({
|
|
|
5098
5150
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3", children: [
|
|
5099
5151
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-muted-foreground font-medium uppercase tracking-wider", children: "Select Gas Pricing Method" }),
|
|
5100
5152
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
5101
|
-
|
|
5153
|
+
import_ui_components7.Accordion,
|
|
5102
5154
|
{
|
|
5103
5155
|
type: "single",
|
|
5104
5156
|
collapsible: true,
|
|
@@ -5107,15 +5159,15 @@ var CustomGasParameters = ({
|
|
|
5107
5159
|
className: "w-full space-y-3",
|
|
5108
5160
|
children: [
|
|
5109
5161
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
5110
|
-
|
|
5162
|
+
import_ui_components7.AccordionItem,
|
|
5111
5163
|
{
|
|
5112
5164
|
value: "eip1559",
|
|
5113
|
-
className: (0,
|
|
5165
|
+
className: (0, import_ui_utils38.cn)(
|
|
5114
5166
|
"rounded-lg border shadow-sm overflow-hidden transition-all",
|
|
5115
5167
|
gasType === "eip1559" ? "border-primary bg-primary/5" : "border-border bg-card hover:border-muted-foreground/50"
|
|
5116
5168
|
),
|
|
5117
5169
|
children: [
|
|
5118
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5170
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ui_components7.AccordionTrigger, { className: "px-4 py-3 text-sm font-medium hover:no-underline", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
|
|
5119
5171
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
5120
5172
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
|
|
5121
5173
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -5130,9 +5182,9 @@ var CustomGasParameters = ({
|
|
|
5130
5182
|
] }),
|
|
5131
5183
|
gasType === "eip1559" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs text-primary font-medium mr-2", children: "Selected" })
|
|
5132
5184
|
] }) }),
|
|
5133
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5185
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ui_components7.AccordionContent, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "px-4 pb-4 pt-4 grid gap-4 border-t bg-background/50", children: [
|
|
5134
5186
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5135
|
-
|
|
5187
|
+
import_ui_components7.NumberField,
|
|
5136
5188
|
{
|
|
5137
5189
|
id: "maxFeePerGas",
|
|
5138
5190
|
label: "Max Fee Per Gas",
|
|
@@ -5146,7 +5198,7 @@ var CustomGasParameters = ({
|
|
|
5146
5198
|
}
|
|
5147
5199
|
),
|
|
5148
5200
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5149
|
-
|
|
5201
|
+
import_ui_components7.NumberField,
|
|
5150
5202
|
{
|
|
5151
5203
|
id: "maxPriorityFeePerGas",
|
|
5152
5204
|
label: "Max Priority Fee Per Gas",
|
|
@@ -5164,15 +5216,15 @@ var CustomGasParameters = ({
|
|
|
5164
5216
|
}
|
|
5165
5217
|
),
|
|
5166
5218
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
5167
|
-
|
|
5219
|
+
import_ui_components7.AccordionItem,
|
|
5168
5220
|
{
|
|
5169
5221
|
value: "legacy",
|
|
5170
|
-
className: (0,
|
|
5222
|
+
className: (0, import_ui_utils38.cn)(
|
|
5171
5223
|
"rounded-lg border shadow-sm overflow-hidden transition-all",
|
|
5172
5224
|
gasType === "legacy" ? "border-primary bg-primary/5" : "border-border bg-card hover:border-muted-foreground/50"
|
|
5173
5225
|
),
|
|
5174
5226
|
children: [
|
|
5175
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5227
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ui_components7.AccordionTrigger, { className: "px-4 py-3 text-sm font-medium hover:no-underline", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
|
|
5176
5228
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
5177
5229
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
|
|
5178
5230
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -5187,8 +5239,8 @@ var CustomGasParameters = ({
|
|
|
5187
5239
|
] }),
|
|
5188
5240
|
gasType === "legacy" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs text-primary font-medium mr-2", children: "Selected" })
|
|
5189
5241
|
] }) }),
|
|
5190
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5191
|
-
|
|
5242
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ui_components7.AccordionContent, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "px-4 pb-4 pt-4 border-t bg-background/50", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5243
|
+
import_ui_components7.NumberField,
|
|
5192
5244
|
{
|
|
5193
5245
|
id: "gasPrice",
|
|
5194
5246
|
label: "Gas Price",
|
|
@@ -5210,7 +5262,7 @@ var CustomGasParameters = ({
|
|
|
5210
5262
|
] }),
|
|
5211
5263
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-2", children: [
|
|
5212
5264
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5213
|
-
|
|
5265
|
+
import_ui_components7.BooleanField,
|
|
5214
5266
|
{
|
|
5215
5267
|
id: "showGasLimit",
|
|
5216
5268
|
label: "Override gas limit",
|
|
@@ -5220,7 +5272,7 @@ var CustomGasParameters = ({
|
|
|
5220
5272
|
}
|
|
5221
5273
|
),
|
|
5222
5274
|
showGasLimit && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "pl-6", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5223
|
-
|
|
5275
|
+
import_ui_components7.NumberField,
|
|
5224
5276
|
{
|
|
5225
5277
|
id: "gasLimit",
|
|
5226
5278
|
label: "Gas Limit",
|
|
@@ -5238,7 +5290,7 @@ var CustomGasParameters = ({
|
|
|
5238
5290
|
|
|
5239
5291
|
// src/transaction/components/SpeedSelection.tsx
|
|
5240
5292
|
var import_relayer_sdk2 = require("@openzeppelin/relayer-sdk");
|
|
5241
|
-
var
|
|
5293
|
+
var import_ui_components8 = require("@openzeppelin/ui-components");
|
|
5242
5294
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
5243
5295
|
var speedOptions = [
|
|
5244
5296
|
{
|
|
@@ -5265,7 +5317,7 @@ var speedOptions = [
|
|
|
5265
5317
|
];
|
|
5266
5318
|
var SpeedSelection = ({ selectedSpeed, onSpeedChange }) => {
|
|
5267
5319
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5268
|
-
|
|
5320
|
+
import_ui_components8.RadioGroup,
|
|
5269
5321
|
{
|
|
5270
5322
|
value: selectedSpeed || import_relayer_sdk2.Speed.FAST,
|
|
5271
5323
|
onValueChange: (value) => onSpeedChange(value),
|
|
@@ -5278,7 +5330,7 @@ var SpeedSelection = ({ selectedSpeed, onSpeedChange }) => {
|
|
|
5278
5330
|
option.recommended && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "absolute -top-2 right-4 bg-primary text-primary-foreground text-xs px-2 py-0.5 rounded", children: "Recommended" }),
|
|
5279
5331
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-start space-x-3", children: [
|
|
5280
5332
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5281
|
-
|
|
5333
|
+
import_ui_components8.RadioGroupItem,
|
|
5282
5334
|
{
|
|
5283
5335
|
value: option.value,
|
|
5284
5336
|
id: `speed-${option.value}`,
|
|
@@ -5442,13 +5494,13 @@ var EvmRelayerOptions = ({ options, onChange }) => {
|
|
|
5442
5494
|
onToggle: () => setShowAdvancedInfo(!showAdvancedInfo)
|
|
5443
5495
|
}
|
|
5444
5496
|
),
|
|
5445
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
5446
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
5447
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5448
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5497
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_ui_components9.Tabs, { value: configMode, onValueChange: handleModeChange, children: [
|
|
5498
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_ui_components9.TabsList, { className: "grid w-full grid-cols-2", children: [
|
|
5499
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_ui_components9.TabsTrigger, { value: "speed", children: "Speed" }),
|
|
5500
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_ui_components9.TabsTrigger, { value: "custom", children: "Custom" })
|
|
5449
5501
|
] }),
|
|
5450
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5451
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5502
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_ui_components9.TabsContent, { value: "speed", className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SpeedSelection, { selectedSpeed: formValues.speed, onSpeedChange: handleSpeedChange }) }),
|
|
5503
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_ui_components9.TabsContent, { value: "custom", className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5452
5504
|
CustomGasParameters,
|
|
5453
5505
|
{
|
|
5454
5506
|
control,
|
|
@@ -5463,7 +5515,7 @@ var EvmRelayerOptions = ({ options, onChange }) => {
|
|
|
5463
5515
|
};
|
|
5464
5516
|
|
|
5465
5517
|
// src/wallet/utils/connection.ts
|
|
5466
|
-
var
|
|
5518
|
+
var import_ui_utils39 = require("@openzeppelin/ui-utils");
|
|
5467
5519
|
var LOG_SYSTEM3 = "adapter-evm-connection";
|
|
5468
5520
|
function evmSupportsWalletConnection() {
|
|
5469
5521
|
return true;
|
|
@@ -5471,7 +5523,7 @@ function evmSupportsWalletConnection() {
|
|
|
5471
5523
|
async function getEvmAvailableConnectors() {
|
|
5472
5524
|
const impl = await getEvmWalletImplementation();
|
|
5473
5525
|
if (!impl) {
|
|
5474
|
-
|
|
5526
|
+
import_ui_utils39.logger.warn(LOG_SYSTEM3, "getEvmAvailableConnectors: Wallet implementation not ready.");
|
|
5475
5527
|
return [];
|
|
5476
5528
|
}
|
|
5477
5529
|
return impl.getAvailableConnectors();
|
|
@@ -5479,7 +5531,7 @@ async function getEvmAvailableConnectors() {
|
|
|
5479
5531
|
async function connectAndEnsureCorrectNetwork(connectorId, targetChainId) {
|
|
5480
5532
|
const impl = await getEvmWalletImplementation();
|
|
5481
5533
|
if (!impl) {
|
|
5482
|
-
|
|
5534
|
+
import_ui_utils39.logger.error(LOG_SYSTEM3, "connectAndEnsureCorrectNetwork: Wallet implementation not ready.");
|
|
5483
5535
|
return { connected: false, error: "Wallet system not initialized." };
|
|
5484
5536
|
}
|
|
5485
5537
|
const connectionResult = await impl.connect(connectorId);
|
|
@@ -5487,7 +5539,7 @@ async function connectAndEnsureCorrectNetwork(connectorId, targetChainId) {
|
|
|
5487
5539
|
return { connected: false, error: connectionResult.error || "Connection failed" };
|
|
5488
5540
|
}
|
|
5489
5541
|
if (connectionResult.chainId !== targetChainId) {
|
|
5490
|
-
|
|
5542
|
+
import_ui_utils39.logger.info(
|
|
5491
5543
|
LOG_SYSTEM3,
|
|
5492
5544
|
`Connected to chain ${connectionResult.chainId}, but target is ${targetChainId}. Attempting switch.`
|
|
5493
5545
|
);
|
|
@@ -5496,23 +5548,23 @@ async function connectAndEnsureCorrectNetwork(connectorId, targetChainId) {
|
|
|
5496
5548
|
const postSwitchStatus = impl.getWalletConnectionStatus();
|
|
5497
5549
|
if (postSwitchStatus.chainId !== targetChainId) {
|
|
5498
5550
|
const switchError = `Failed to switch to target network ${targetChainId}. Current: ${postSwitchStatus.chainId}`;
|
|
5499
|
-
|
|
5551
|
+
import_ui_utils39.logger.error(LOG_SYSTEM3, switchError);
|
|
5500
5552
|
try {
|
|
5501
5553
|
await impl.disconnect();
|
|
5502
5554
|
} catch (e) {
|
|
5503
|
-
|
|
5555
|
+
import_ui_utils39.logger.warn(LOG_SYSTEM3, "Failed to disconnect after network switch failure.", e);
|
|
5504
5556
|
}
|
|
5505
5557
|
return { connected: false, error: switchError };
|
|
5506
5558
|
}
|
|
5507
|
-
|
|
5559
|
+
import_ui_utils39.logger.info(LOG_SYSTEM3, `Successfully switched to target chain ${targetChainId}.`);
|
|
5508
5560
|
return { ...connectionResult, chainId: postSwitchStatus.chainId };
|
|
5509
5561
|
} catch (error) {
|
|
5510
5562
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
5511
|
-
|
|
5563
|
+
import_ui_utils39.logger.error(LOG_SYSTEM3, "Network switch failed:", errorMessage);
|
|
5512
5564
|
try {
|
|
5513
5565
|
await impl.disconnect();
|
|
5514
5566
|
} catch (e) {
|
|
5515
|
-
|
|
5567
|
+
import_ui_utils39.logger.warn(LOG_SYSTEM3, "Failed to disconnect after network switch failure.", e);
|
|
5516
5568
|
}
|
|
5517
5569
|
return { connected: false, error: `Network switch failed: ${errorMessage}` };
|
|
5518
5570
|
}
|
|
@@ -5522,7 +5574,7 @@ async function connectAndEnsureCorrectNetwork(connectorId, targetChainId) {
|
|
|
5522
5574
|
async function disconnectEvmWallet() {
|
|
5523
5575
|
const impl = await getEvmWalletImplementation();
|
|
5524
5576
|
if (!impl) {
|
|
5525
|
-
|
|
5577
|
+
import_ui_utils39.logger.warn(LOG_SYSTEM3, "disconnectEvmWallet: Wallet implementation not ready.");
|
|
5526
5578
|
return { disconnected: false, error: "Wallet system not initialized." };
|
|
5527
5579
|
}
|
|
5528
5580
|
return impl.disconnect();
|
|
@@ -5530,7 +5582,7 @@ async function disconnectEvmWallet() {
|
|
|
5530
5582
|
function getEvmWalletConnectionStatus() {
|
|
5531
5583
|
const impl = getInitializedEvmWalletImplementation();
|
|
5532
5584
|
if (!impl) {
|
|
5533
|
-
|
|
5585
|
+
import_ui_utils39.logger.warn(
|
|
5534
5586
|
LOG_SYSTEM3,
|
|
5535
5587
|
"getEvmWalletConnectionStatus: Wallet implementation not ready. Returning default disconnected state."
|
|
5536
5588
|
);
|
|
@@ -5580,13 +5632,13 @@ var EvmAdapter = class {
|
|
|
5580
5632
|
throw new Error("EvmAdapter requires a valid EVM network configuration.");
|
|
5581
5633
|
}
|
|
5582
5634
|
this.networkConfig = networkConfig;
|
|
5583
|
-
|
|
5635
|
+
import_ui_utils40.logger.info(
|
|
5584
5636
|
"EvmAdapter",
|
|
5585
5637
|
`Adapter initialized for network: ${networkConfig.name} (ID: ${networkConfig.id})`
|
|
5586
5638
|
);
|
|
5587
5639
|
const initialGlobalConfig = loadInitialConfigFromAppService();
|
|
5588
5640
|
this.initialAppServiceKitName = initialGlobalConfig.kitName || "custom";
|
|
5589
|
-
|
|
5641
|
+
import_ui_utils40.logger.info(
|
|
5590
5642
|
"EvmAdapter:constructor",
|
|
5591
5643
|
"Initial kitName from AppConfigService noted:",
|
|
5592
5644
|
this.initialAppServiceKitName
|
|
@@ -5821,7 +5873,7 @@ var EvmAdapter = class {
|
|
|
5821
5873
|
onWalletConnectionChange(callback) {
|
|
5822
5874
|
const walletImplementation = getInitializedEvmWalletImplementation();
|
|
5823
5875
|
if (!walletImplementation) {
|
|
5824
|
-
|
|
5876
|
+
import_ui_utils40.logger.warn(
|
|
5825
5877
|
"EvmAdapter:onWalletConnectionChange",
|
|
5826
5878
|
"Wallet implementation not ready. Subscription may not work."
|
|
5827
5879
|
);
|
|
@@ -5851,6 +5903,12 @@ var EvmAdapter = class {
|
|
|
5851
5903
|
}
|
|
5852
5904
|
return null;
|
|
5853
5905
|
}
|
|
5906
|
+
/**
|
|
5907
|
+
* @inheritdoc
|
|
5908
|
+
*/
|
|
5909
|
+
async getCurrentBlock() {
|
|
5910
|
+
return getEvmCurrentBlock(this.networkConfig);
|
|
5911
|
+
}
|
|
5854
5912
|
/**
|
|
5855
5913
|
* @inheritdoc
|
|
5856
5914
|
*/
|
|
@@ -5870,7 +5928,7 @@ var EvmAdapter = class {
|
|
|
5870
5928
|
options
|
|
5871
5929
|
);
|
|
5872
5930
|
await evmUiKitManager.configure(finalFullConfig);
|
|
5873
|
-
|
|
5931
|
+
import_ui_utils40.logger.info(
|
|
5874
5932
|
"EvmAdapter:configureUiKit",
|
|
5875
5933
|
"EvmUiKitManager configuration requested with final config:",
|
|
5876
5934
|
finalFullConfig
|
|
@@ -5880,7 +5938,7 @@ var EvmAdapter = class {
|
|
|
5880
5938
|
* @inheritdoc
|
|
5881
5939
|
*/
|
|
5882
5940
|
getEcosystemReactUiContextProvider() {
|
|
5883
|
-
|
|
5941
|
+
import_ui_utils40.logger.info("EvmAdapter:getEcosystemReactUiContextProvider", "Returning EvmWalletUiRoot.");
|
|
5884
5942
|
return EvmWalletUiRoot;
|
|
5885
5943
|
}
|
|
5886
5944
|
/**
|
|
@@ -5904,7 +5962,7 @@ var EvmAdapter = class {
|
|
|
5904
5962
|
getEcosystemWalletComponents() {
|
|
5905
5963
|
const currentManagerState = evmUiKitManager.getState();
|
|
5906
5964
|
if (!currentManagerState.currentFullUiKitConfig) {
|
|
5907
|
-
|
|
5965
|
+
import_ui_utils40.logger.debug(
|
|
5908
5966
|
// Changed from warn to debug, as this can be normal during init sequence
|
|
5909
5967
|
"EvmAdapter:getEcosystemWalletComponents",
|
|
5910
5968
|
"No UI kit configuration available in manager yet. Returning undefined components."
|
|
@@ -6043,7 +6101,7 @@ Get your WalletConnect projectId from <a href="https://cloud.walletconnect.com"
|
|
|
6043
6101
|
summary: result.summary
|
|
6044
6102
|
};
|
|
6045
6103
|
} catch (error) {
|
|
6046
|
-
|
|
6104
|
+
import_ui_utils40.logger.error("EVM contract definition comparison failed:", error.message);
|
|
6047
6105
|
throw new Error(`Contract definition comparison failed: ${error.message}`);
|
|
6048
6106
|
}
|
|
6049
6107
|
}
|
|
@@ -6064,6 +6122,12 @@ Get your WalletConnect projectId from <a href="https://cloud.walletconnect.com"
|
|
|
6064
6122
|
hashContractDefinition(definition) {
|
|
6065
6123
|
return abiComparisonService.hashAbi(definition);
|
|
6066
6124
|
}
|
|
6125
|
+
/**
|
|
6126
|
+
* @inheritdoc
|
|
6127
|
+
*/
|
|
6128
|
+
getTypeMappingInfo() {
|
|
6129
|
+
return getEvmTypeMappingInfo();
|
|
6130
|
+
}
|
|
6067
6131
|
};
|
|
6068
6132
|
|
|
6069
6133
|
// src/config.ts
|