@openzeppelin/ui-builder-adapter-evm 1.0.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 +375 -352
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +82 -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 +11 -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 +2 -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,
|
|
@@ -1101,7 +1101,7 @@ async function getEvmCurrentBlock(networkConfig) {
|
|
|
1101
1101
|
}
|
|
1102
1102
|
return blockNumber;
|
|
1103
1103
|
} catch (error) {
|
|
1104
|
-
|
|
1104
|
+
import_ui_utils5.logger.error("getEvmCurrentBlock", "Failed to get current block:", error);
|
|
1105
1105
|
throw new Error(
|
|
1106
1106
|
`Failed to get current block: ${error instanceof Error ? error.message : String(error)}`
|
|
1107
1107
|
);
|
|
@@ -1110,9 +1110,9 @@ async function getEvmCurrentBlock(networkConfig) {
|
|
|
1110
1110
|
|
|
1111
1111
|
// src/configuration/network-services.ts
|
|
1112
1112
|
function getEvmNetworkServiceForms(networkConfig) {
|
|
1113
|
-
const globalV2ApiKey =
|
|
1113
|
+
const globalV2ApiKey = import_ui_utils6.appConfigService.getGlobalServiceConfig("etherscanv2")?.apiKey;
|
|
1114
1114
|
const v2DefaultEnabled = Boolean(globalV2ApiKey);
|
|
1115
|
-
const savedContractDefCfg =
|
|
1115
|
+
const savedContractDefCfg = import_ui_utils6.userNetworkServiceConfigService.get(
|
|
1116
1116
|
networkConfig.id,
|
|
1117
1117
|
"contract-definitions"
|
|
1118
1118
|
);
|
|
@@ -1266,7 +1266,7 @@ function getEvmNetworkServiceForms(networkConfig) {
|
|
|
1266
1266
|
{ label: "Sourcify", value: EvmProviderKeys.Sourcify }
|
|
1267
1267
|
],
|
|
1268
1268
|
// Seed from saved user config or app-config default if present; otherwise empty
|
|
1269
|
-
defaultValue: savedDefaultProvider ||
|
|
1269
|
+
defaultValue: savedDefaultProvider || import_ui_utils6.appConfigService.getGlobalServiceParam("contractdefinition", "defaultProvider") || "",
|
|
1270
1270
|
width: "full"
|
|
1271
1271
|
},
|
|
1272
1272
|
// Apply to all networks
|
|
@@ -1333,23 +1333,23 @@ var import_core3 = require("@wagmi/core");
|
|
|
1333
1333
|
var import_chains3 = require("viem/chains");
|
|
1334
1334
|
var import_wagmi = require("wagmi");
|
|
1335
1335
|
var import_react9 = require("react");
|
|
1336
|
-
var
|
|
1336
|
+
var import_ui_utils19 = require("@openzeppelin/ui-utils");
|
|
1337
1337
|
|
|
1338
1338
|
// src/wallet/context/wagmi-context.tsx
|
|
1339
1339
|
var import_react = require("react");
|
|
1340
1340
|
var WagmiProviderInitializedContext = (0, import_react.createContext)(false);
|
|
1341
1341
|
|
|
1342
1342
|
// src/wallet/evmUiKitManager.ts
|
|
1343
|
-
var
|
|
1343
|
+
var import_ui_utils18 = require("@openzeppelin/ui-utils");
|
|
1344
1344
|
|
|
1345
1345
|
// src/wallet/utils/walletImplementationManager.ts
|
|
1346
|
-
var
|
|
1346
|
+
var import_ui_utils16 = require("@openzeppelin/ui-utils");
|
|
1347
1347
|
|
|
1348
1348
|
// src/wallet/implementation/wagmi-implementation.ts
|
|
1349
1349
|
var import_connectors = require("@wagmi/connectors");
|
|
1350
1350
|
var import_core2 = require("@wagmi/core");
|
|
1351
1351
|
var import_viem3 = require("viem");
|
|
1352
|
-
var
|
|
1352
|
+
var import_ui_utils15 = require("@openzeppelin/ui-utils");
|
|
1353
1353
|
|
|
1354
1354
|
// src/networks/mainnet.ts
|
|
1355
1355
|
var import_react2 = require("@web3icons/react");
|
|
@@ -1903,19 +1903,19 @@ var evmNetworks = [...evmMainnetNetworks, ...evmTestnetNetworks];
|
|
|
1903
1903
|
// src/wallet/rainbowkit/components.tsx
|
|
1904
1904
|
var import_lucide_react4 = require("lucide-react");
|
|
1905
1905
|
var import_react8 = require("react");
|
|
1906
|
-
var
|
|
1907
|
-
var
|
|
1906
|
+
var import_ui_components5 = require("@openzeppelin/ui-components");
|
|
1907
|
+
var import_ui_utils12 = require("@openzeppelin/ui-utils");
|
|
1908
1908
|
|
|
1909
1909
|
// src/wallet/components/connect/ConnectButton.tsx
|
|
1910
1910
|
var import_lucide_react = require("lucide-react");
|
|
1911
1911
|
var import_react7 = require("react");
|
|
1912
|
-
var
|
|
1913
|
-
var
|
|
1914
|
-
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");
|
|
1915
1915
|
|
|
1916
1916
|
// src/wallet/utils/SafeWagmiComponent.tsx
|
|
1917
1917
|
var import_react5 = require("react");
|
|
1918
|
-
var
|
|
1918
|
+
var import_ui_utils7 = require("@openzeppelin/ui-utils");
|
|
1919
1919
|
|
|
1920
1920
|
// src/wallet/hooks/useIsWagmiProviderInitialized.ts
|
|
1921
1921
|
var import_react4 = require("react");
|
|
@@ -1939,7 +1939,7 @@ var SafeWagmiComponent = ({
|
|
|
1939
1939
|
(0, import_react5.useEffect)(() => {
|
|
1940
1940
|
const handleError = (event) => {
|
|
1941
1941
|
if (event.error?.message?.includes("useConfig") || event.error?.message?.includes("WagmiProvider")) {
|
|
1942
|
-
|
|
1942
|
+
import_ui_utils7.logger.debug(
|
|
1943
1943
|
"SafeWagmiComponent",
|
|
1944
1944
|
"Caught wagmi error via window error event:",
|
|
1945
1945
|
event.error
|
|
@@ -1960,7 +1960,7 @@ var SafeWagmiComponent = ({
|
|
|
1960
1960
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
1961
1961
|
} catch (error) {
|
|
1962
1962
|
if (error instanceof Error && (error.message.includes("useConfig") || error.message.includes("WagmiProvider"))) {
|
|
1963
|
-
|
|
1963
|
+
import_ui_utils7.logger.debug("SafeWagmiComponent", "Caught wagmi error:", error);
|
|
1964
1964
|
setHasError(true);
|
|
1965
1965
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: fallback });
|
|
1966
1966
|
}
|
|
@@ -1970,11 +1970,11 @@ var SafeWagmiComponent = ({
|
|
|
1970
1970
|
|
|
1971
1971
|
// src/wallet/components/connect/ConnectorDialog.tsx
|
|
1972
1972
|
var import_react6 = require("react");
|
|
1973
|
-
var
|
|
1974
|
-
var
|
|
1973
|
+
var import_ui_components = require("@openzeppelin/ui-components");
|
|
1974
|
+
var import_ui_react = require("@openzeppelin/ui-react");
|
|
1975
1975
|
|
|
1976
1976
|
// src/wallet/hooks/useUiKitConfig.ts
|
|
1977
|
-
var
|
|
1977
|
+
var import_ui_utils8 = require("@openzeppelin/ui-utils");
|
|
1978
1978
|
var defaultConfig = {
|
|
1979
1979
|
kitName: "custom",
|
|
1980
1980
|
// Default to using our custom implementation for EVM
|
|
@@ -1985,10 +1985,10 @@ var defaultConfig = {
|
|
|
1985
1985
|
};
|
|
1986
1986
|
var uiKitConfig = { ...defaultConfig };
|
|
1987
1987
|
function loadInitialConfigFromAppService() {
|
|
1988
|
-
|
|
1989
|
-
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");
|
|
1990
1990
|
if (configObj && configObj.kitName) {
|
|
1991
|
-
|
|
1991
|
+
import_ui_utils8.logger.info(
|
|
1992
1992
|
"useUiKitConfig",
|
|
1993
1993
|
`Loaded initial config from AppConfigService: kitName=${configObj.kitName}`,
|
|
1994
1994
|
configObj.kitConfig
|
|
@@ -1998,7 +1998,7 @@ function loadInitialConfigFromAppService() {
|
|
|
1998
1998
|
kitConfig: { ...defaultConfig.kitConfig, ...configObj.kitConfig || {} }
|
|
1999
1999
|
};
|
|
2000
2000
|
}
|
|
2001
|
-
|
|
2001
|
+
import_ui_utils8.logger.debug(
|
|
2002
2002
|
"useUiKitConfig",
|
|
2003
2003
|
"No initial config found in AppConfigService, using module default."
|
|
2004
2004
|
);
|
|
@@ -2014,9 +2014,9 @@ function useUiKitConfig() {
|
|
|
2014
2014
|
// src/wallet/components/connect/ConnectorDialog.tsx
|
|
2015
2015
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
2016
2016
|
var ConnectorDialog = ({ open, onOpenChange }) => {
|
|
2017
|
-
const unavailableContent = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2018
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2019
|
-
/* @__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." })
|
|
2020
2020
|
] }) }) });
|
|
2021
2021
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SafeWagmiComponent, { fallback: unavailableContent, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ConnectorDialogContent, { open, onOpenChange }) });
|
|
2022
2022
|
};
|
|
@@ -2027,8 +2027,8 @@ var ConnectorDialogContent = ({ open, onOpenChange }) => {
|
|
|
2027
2027
|
error: connectError,
|
|
2028
2028
|
isConnecting,
|
|
2029
2029
|
pendingConnector
|
|
2030
|
-
} = (0,
|
|
2031
|
-
const { isConnected } = (0,
|
|
2030
|
+
} = (0, import_ui_react.useDerivedConnectStatus)();
|
|
2031
|
+
const { isConnected } = (0, import_ui_react.useDerivedAccountStatus)();
|
|
2032
2032
|
const [connectingId, setConnectingId] = (0, import_react6.useState)(null);
|
|
2033
2033
|
const fullConfig = useUiKitConfig();
|
|
2034
2034
|
const showInjectedConnector = isConfigEnabled("showInjectedConnector");
|
|
@@ -2041,8 +2041,8 @@ var ConnectorDialogContent = ({ open, onOpenChange }) => {
|
|
|
2041
2041
|
}
|
|
2042
2042
|
}, [isConnected, connectingId, onOpenChange]);
|
|
2043
2043
|
if (!connect2) {
|
|
2044
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2045
|
-
/* @__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" }) }),
|
|
2046
2046
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "Wallet connection function is not available." })
|
|
2047
2047
|
] }) });
|
|
2048
2048
|
}
|
|
@@ -2054,13 +2054,13 @@ var ConnectorDialogContent = ({ open, onOpenChange }) => {
|
|
|
2054
2054
|
const isInjected = connector.id === "injected";
|
|
2055
2055
|
return !(isInjected && !showInjectedConnector);
|
|
2056
2056
|
});
|
|
2057
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2058
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2059
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2060
|
-
/* @__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." })
|
|
2061
2061
|
] }),
|
|
2062
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)(
|
|
2063
|
-
|
|
2063
|
+
import_ui_components.Button,
|
|
2064
2064
|
{
|
|
2065
2065
|
onClick: () => handleConnectorSelect(connector),
|
|
2066
2066
|
disabled: isConnecting && connectingId === connector.id,
|
|
@@ -2084,7 +2084,7 @@ var CustomConnectButton = ({
|
|
|
2084
2084
|
hideWhenConnected = true
|
|
2085
2085
|
}) => {
|
|
2086
2086
|
const [dialogOpen, setDialogOpen] = (0, import_react7.useState)(false);
|
|
2087
|
-
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: [
|
|
2088
2088
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Wallet, { className: "size-3.5 mr-1" }),
|
|
2089
2089
|
"Wallet Unavailable"
|
|
2090
2090
|
] }) });
|
|
@@ -2099,8 +2099,8 @@ var CustomConnectButton = ({
|
|
|
2099
2099
|
) });
|
|
2100
2100
|
};
|
|
2101
2101
|
var ConnectButtonContent = ({ className, dialogOpen, setDialogOpen, hideWhenConnected }) => {
|
|
2102
|
-
const { isConnected } = (0,
|
|
2103
|
-
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)();
|
|
2104
2104
|
const [isManuallyInitiated, setIsManuallyInitiated] = (0, import_react7.useState)(false);
|
|
2105
2105
|
(0, import_react7.useEffect)(() => {
|
|
2106
2106
|
if (isConnected && hideWhenConnected) {
|
|
@@ -2128,9 +2128,9 @@ var ConnectButtonContent = ({ className, dialogOpen, setDialogOpen, hideWhenConn
|
|
|
2128
2128
|
return null;
|
|
2129
2129
|
}
|
|
2130
2130
|
const showButtonLoading = isHookConnecting || isManuallyInitiated;
|
|
2131
|
-
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: [
|
|
2132
2132
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2133
|
-
|
|
2133
|
+
import_ui_components2.Button,
|
|
2134
2134
|
{
|
|
2135
2135
|
onClick: handleConnectClick,
|
|
2136
2136
|
disabled: showButtonLoading || isConnected,
|
|
@@ -2161,26 +2161,26 @@ var ConnectButtonContent = ({ className, dialogOpen, setDialogOpen, hideWhenConn
|
|
|
2161
2161
|
|
|
2162
2162
|
// src/wallet/components/account/AccountDisplay.tsx
|
|
2163
2163
|
var import_lucide_react2 = require("lucide-react");
|
|
2164
|
-
var
|
|
2165
|
-
var
|
|
2166
|
-
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");
|
|
2167
2167
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2168
2168
|
var CustomAccountDisplay = ({ className }) => {
|
|
2169
2169
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SafeWagmiComponent, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AccountDisplayContent, { className }) });
|
|
2170
2170
|
};
|
|
2171
2171
|
var AccountDisplayContent = ({ className }) => {
|
|
2172
|
-
const { isConnected, address, chainId } = (0,
|
|
2173
|
-
const { disconnect: disconnect2 } = (0,
|
|
2172
|
+
const { isConnected, address, chainId } = (0, import_ui_react3.useDerivedAccountStatus)();
|
|
2173
|
+
const { disconnect: disconnect2 } = (0, import_ui_react3.useDerivedDisconnect)();
|
|
2174
2174
|
if (!isConnected || !address || !disconnect2) {
|
|
2175
2175
|
return null;
|
|
2176
2176
|
}
|
|
2177
|
-
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: [
|
|
2178
2178
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col", children: [
|
|
2179
|
-
/* @__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) }),
|
|
2180
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" })
|
|
2181
2181
|
] }),
|
|
2182
2182
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2183
|
-
|
|
2183
|
+
import_ui_components3.Button,
|
|
2184
2184
|
{
|
|
2185
2185
|
onClick: () => disconnect2(),
|
|
2186
2186
|
variant: "ghost",
|
|
@@ -2195,17 +2195,17 @@ var AccountDisplayContent = ({ className }) => {
|
|
|
2195
2195
|
|
|
2196
2196
|
// src/wallet/components/network/NetworkSwitcher.tsx
|
|
2197
2197
|
var import_lucide_react3 = require("lucide-react");
|
|
2198
|
-
var
|
|
2199
|
-
var
|
|
2200
|
-
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");
|
|
2201
2201
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2202
2202
|
var CustomNetworkSwitcher = ({ className }) => {
|
|
2203
2203
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SafeWagmiComponent, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(NetworkSwitcherContent, { className }) });
|
|
2204
2204
|
};
|
|
2205
2205
|
var NetworkSwitcherContent = ({ className }) => {
|
|
2206
|
-
const { isConnected } = (0,
|
|
2207
|
-
const { currentChainId, availableChains: unknownChains } = (0,
|
|
2208
|
-
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)();
|
|
2209
2209
|
const typedAvailableChains = unknownChains;
|
|
2210
2210
|
if (!isConnected || !switchChain2 || typedAvailableChains.length === 0) {
|
|
2211
2211
|
return null;
|
|
@@ -2217,23 +2217,23 @@ var NetworkSwitcherContent = ({ className }) => {
|
|
|
2217
2217
|
};
|
|
2218
2218
|
const currentChain = typedAvailableChains.find((chain) => chain.id === currentChainId);
|
|
2219
2219
|
const currentChainName = currentChain?.name || "Network";
|
|
2220
|
-
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: [
|
|
2221
2221
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2222
|
-
|
|
2222
|
+
import_ui_components4.Select,
|
|
2223
2223
|
{
|
|
2224
2224
|
value: currentChainId?.toString() ?? "",
|
|
2225
2225
|
onValueChange: (value) => handleNetworkChange(Number(value)),
|
|
2226
2226
|
disabled: isPending || typedAvailableChains.length === 0,
|
|
2227
2227
|
children: [
|
|
2228
|
-
/* @__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 }) }),
|
|
2229
2229
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2230
|
-
|
|
2230
|
+
import_ui_components4.SelectContent,
|
|
2231
2231
|
{
|
|
2232
2232
|
position: "popper",
|
|
2233
2233
|
sideOffset: 5,
|
|
2234
2234
|
align: "start",
|
|
2235
2235
|
className: "w-auto min-w-[160px] max-h-[300px]",
|
|
2236
|
-
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))
|
|
2237
2237
|
}
|
|
2238
2238
|
)
|
|
2239
2239
|
]
|
|
@@ -2297,7 +2297,7 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2297
2297
|
if (isMounted) {
|
|
2298
2298
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
2299
2299
|
setIsLoadingComponent(false);
|
|
2300
|
-
|
|
2300
|
+
import_ui_utils12.logger.error("RainbowKitConnectButton", "Failed to load RainbowKit ConnectButton:", err);
|
|
2301
2301
|
}
|
|
2302
2302
|
}
|
|
2303
2303
|
};
|
|
@@ -2310,12 +2310,12 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2310
2310
|
};
|
|
2311
2311
|
}, []);
|
|
2312
2312
|
const renderLoadingPlaceholder = (message) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
2313
|
-
|
|
2313
|
+
import_ui_components5.Button,
|
|
2314
2314
|
{
|
|
2315
2315
|
disabled: true,
|
|
2316
2316
|
variant: "outline",
|
|
2317
2317
|
size: "sm",
|
|
2318
|
-
className: (0,
|
|
2318
|
+
className: (0, import_ui_utils12.cn)("h-8 px-2 text-xs", props.className),
|
|
2319
2319
|
children: [
|
|
2320
2320
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.Loader2, { className: "h-3.5 w-3.5 animate-spin mr-1.5" }),
|
|
2321
2321
|
message
|
|
@@ -2323,7 +2323,7 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2323
2323
|
}
|
|
2324
2324
|
);
|
|
2325
2325
|
if (error) {
|
|
2326
|
-
|
|
2326
|
+
import_ui_utils12.logger.warn(
|
|
2327
2327
|
"RainbowKitConnectButton",
|
|
2328
2328
|
"Error loading RainbowKit ConnectButton. Displaying fallback CustomConnectButton."
|
|
2329
2329
|
);
|
|
@@ -2336,7 +2336,7 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2336
2336
|
return renderLoadingPlaceholder("Initializing Provider...");
|
|
2337
2337
|
}
|
|
2338
2338
|
if (!Component) {
|
|
2339
|
-
|
|
2339
|
+
import_ui_utils12.logger.warn("RainbowKitConnectButton", "Component is null after loading phase, falling back.");
|
|
2340
2340
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CustomConnectButton, { ...props });
|
|
2341
2341
|
}
|
|
2342
2342
|
const kitConfig = managerState.currentFullUiKitConfig?.kitConfig;
|
|
@@ -2348,7 +2348,7 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2348
2348
|
...props
|
|
2349
2349
|
// Allow props to override configuration
|
|
2350
2350
|
};
|
|
2351
|
-
|
|
2351
|
+
import_ui_utils12.logger.debug("RainbowKitConnectButton", "Rendering with configuration:", {
|
|
2352
2352
|
configFromFile: connectButtonConfig,
|
|
2353
2353
|
finalProps
|
|
2354
2354
|
});
|
|
@@ -2356,20 +2356,20 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2356
2356
|
};
|
|
2357
2357
|
|
|
2358
2358
|
// src/wallet/rainbowkit/utils.ts
|
|
2359
|
-
var
|
|
2359
|
+
var import_ui_utils13 = require("@openzeppelin/ui-utils");
|
|
2360
2360
|
function validateRainbowKitConfig(kitConfig) {
|
|
2361
|
-
|
|
2361
|
+
import_ui_utils13.logger.debug(
|
|
2362
2362
|
"validateRainbowKitConfig",
|
|
2363
2363
|
"Received kitConfig for validation:",
|
|
2364
2364
|
JSON.stringify(kitConfig)
|
|
2365
2365
|
);
|
|
2366
2366
|
if (!kitConfig) {
|
|
2367
|
-
|
|
2367
|
+
import_ui_utils13.logger.warn("validateRainbowKitConfig", "Validation failed: No kitConfig provided.");
|
|
2368
2368
|
return { isValid: false, error: "No kitConfig provided for RainbowKit" };
|
|
2369
2369
|
}
|
|
2370
2370
|
const wagmiParamsFromKitConfig = kitConfig.wagmiParams;
|
|
2371
2371
|
if (!wagmiParamsFromKitConfig || typeof wagmiParamsFromKitConfig !== "object" || wagmiParamsFromKitConfig === null) {
|
|
2372
|
-
|
|
2372
|
+
import_ui_utils13.logger.warn(
|
|
2373
2373
|
"validateRainbowKitConfig",
|
|
2374
2374
|
"Validation failed: kitConfig.wagmiParams is missing or invalid.",
|
|
2375
2375
|
{ wagmiParamsFromKitConfig }
|
|
@@ -2385,14 +2385,14 @@ function validateRainbowKitConfig(kitConfig) {
|
|
|
2385
2385
|
}
|
|
2386
2386
|
if (missingFields.length > 0) {
|
|
2387
2387
|
const errorMsg = `Missing or invalid required fields in wagmiParams: ${missingFields.join(", ")}`;
|
|
2388
|
-
|
|
2388
|
+
import_ui_utils13.logger.warn("validateRainbowKitConfig", "Validation failed:", errorMsg, { missingFields });
|
|
2389
2389
|
return {
|
|
2390
2390
|
isValid: false,
|
|
2391
2391
|
missingFields,
|
|
2392
2392
|
error: errorMsg
|
|
2393
2393
|
};
|
|
2394
2394
|
}
|
|
2395
|
-
|
|
2395
|
+
import_ui_utils13.logger.debug("validateRainbowKitConfig", "Validation successful.");
|
|
2396
2396
|
return { isValid: true };
|
|
2397
2397
|
}
|
|
2398
2398
|
|
|
@@ -2407,12 +2407,12 @@ function createRainbowKitComponents() {
|
|
|
2407
2407
|
|
|
2408
2408
|
// src/wallet/rainbowkit/config-service.ts
|
|
2409
2409
|
var import_core = require("@wagmi/core");
|
|
2410
|
-
var
|
|
2410
|
+
var import_ui_utils14 = require("@openzeppelin/ui-utils");
|
|
2411
2411
|
async function createRainbowKitWagmiConfig(userFullNativeConfig, chains, chainIdToNetworkIdMap, getRpcEndpointOverride) {
|
|
2412
2412
|
try {
|
|
2413
2413
|
const { getDefaultConfig } = await import("@rainbow-me/rainbowkit");
|
|
2414
2414
|
if (!getDefaultConfig) {
|
|
2415
|
-
|
|
2415
|
+
import_ui_utils14.logger.error(
|
|
2416
2416
|
"rainbowkit/config-service",
|
|
2417
2417
|
"Failed to import getDefaultConfig from RainbowKit"
|
|
2418
2418
|
);
|
|
@@ -2420,21 +2420,21 @@ async function createRainbowKitWagmiConfig(userFullNativeConfig, chains, chainId
|
|
|
2420
2420
|
}
|
|
2421
2421
|
const wagmiParams = userFullNativeConfig?.wagmiParams;
|
|
2422
2422
|
if (!wagmiParams) {
|
|
2423
|
-
|
|
2423
|
+
import_ui_utils14.logger.warn(
|
|
2424
2424
|
"rainbowkit/config-service",
|
|
2425
2425
|
"Resolved kitConfig does not contain a `wagmiParams` object. Cannot create RainbowKit Wagmi config."
|
|
2426
2426
|
);
|
|
2427
2427
|
return null;
|
|
2428
2428
|
}
|
|
2429
2429
|
if (typeof wagmiParams.appName !== "string" || !wagmiParams.appName) {
|
|
2430
|
-
|
|
2430
|
+
import_ui_utils14.logger.warn(
|
|
2431
2431
|
"rainbowkit/config-service",
|
|
2432
2432
|
"kitConfig.wagmiParams is missing or has invalid `appName`."
|
|
2433
2433
|
);
|
|
2434
2434
|
return null;
|
|
2435
2435
|
}
|
|
2436
2436
|
if (typeof wagmiParams.projectId !== "string" || !wagmiParams.projectId) {
|
|
2437
|
-
|
|
2437
|
+
import_ui_utils14.logger.warn(
|
|
2438
2438
|
"rainbowkit/config-service",
|
|
2439
2439
|
"kitConfig.wagmiParams is missing or has invalid `projectId`."
|
|
2440
2440
|
);
|
|
@@ -2457,7 +2457,7 @@ async function createRainbowKitWagmiConfig(userFullNativeConfig, chains, chainId
|
|
|
2457
2457
|
}
|
|
2458
2458
|
}
|
|
2459
2459
|
if (httpRpcOverride) {
|
|
2460
|
-
|
|
2460
|
+
import_ui_utils14.logger.info(
|
|
2461
2461
|
"rainbowkit/config-service",
|
|
2462
2462
|
`Using overridden RPC for chain ${chainDefinition.name}: ${httpRpcOverride}`
|
|
2463
2463
|
);
|
|
@@ -2478,20 +2478,20 @@ async function createRainbowKitWagmiConfig(userFullNativeConfig, chains, chainId
|
|
|
2478
2478
|
// Adapter controls this
|
|
2479
2479
|
};
|
|
2480
2480
|
const config = getDefaultConfig(finalConfigOptions);
|
|
2481
|
-
|
|
2481
|
+
import_ui_utils14.logger.info(
|
|
2482
2482
|
"rainbowkit/config-service",
|
|
2483
2483
|
"Successfully created RainbowKit Wagmi config object.",
|
|
2484
2484
|
config
|
|
2485
2485
|
);
|
|
2486
2486
|
return config;
|
|
2487
2487
|
} catch (error) {
|
|
2488
|
-
|
|
2488
|
+
import_ui_utils14.logger.error("rainbowkit/config-service", "Error creating RainbowKit Wagmi config:", error);
|
|
2489
2489
|
return null;
|
|
2490
2490
|
}
|
|
2491
2491
|
}
|
|
2492
2492
|
async function getWagmiConfigForRainbowKit(uiKitConfiguration, chains, chainIdToNetworkIdMap, getRpcEndpointOverride) {
|
|
2493
2493
|
if (!uiKitConfiguration || uiKitConfiguration.kitName !== "rainbowkit" || !uiKitConfiguration.kitConfig) {
|
|
2494
|
-
|
|
2494
|
+
import_ui_utils14.logger.debug(
|
|
2495
2495
|
"rainbowkit/config-service",
|
|
2496
2496
|
"Not configured for RainbowKit or kitConfig (resolved native + programmatic) is missing."
|
|
2497
2497
|
);
|
|
@@ -2511,7 +2511,7 @@ async function getWagmiConfigForRainbowKit(uiKitConfiguration, chains, chainIdTo
|
|
|
2511
2511
|
var LOG_SYSTEM = "WagmiWalletImplementation";
|
|
2512
2512
|
var getSupportedChainsFromNetworks = () => {
|
|
2513
2513
|
const chains = evmNetworks.filter((network) => network.viemChain).map((network) => network.viemChain).filter((chain, index, self) => self.findIndex((c) => c.id === chain.id) === index);
|
|
2514
|
-
|
|
2514
|
+
import_ui_utils15.logger.info(
|
|
2515
2515
|
LOG_SYSTEM,
|
|
2516
2516
|
`Generated supported chains from network configurations: ${chains.length} chains`,
|
|
2517
2517
|
chains.map((c) => ({ id: c.id, name: c.name }))
|
|
@@ -2526,7 +2526,7 @@ var getChainIdToNetworkIdMapping = () => {
|
|
|
2526
2526
|
},
|
|
2527
2527
|
{}
|
|
2528
2528
|
);
|
|
2529
|
-
|
|
2529
|
+
import_ui_utils15.logger.info(
|
|
2530
2530
|
LOG_SYSTEM,
|
|
2531
2531
|
"Generated chain ID to network ID mapping from network configurations:",
|
|
2532
2532
|
mapping
|
|
@@ -2551,13 +2551,13 @@ var WagmiWalletImplementation = class {
|
|
|
2551
2551
|
__publicField(this, "walletConnectProjectId");
|
|
2552
2552
|
__publicField(this, "rpcConfigUnsubscribe");
|
|
2553
2553
|
this.walletConnectProjectId = walletConnectProjectIdFromAppConfig;
|
|
2554
|
-
|
|
2554
|
+
import_ui_utils15.logger.info(
|
|
2555
2555
|
LOG_SYSTEM,
|
|
2556
2556
|
"Constructor called. Initial anticipated kitName:",
|
|
2557
2557
|
initialUiKitConfig?.kitName
|
|
2558
2558
|
);
|
|
2559
2559
|
this.initialized = true;
|
|
2560
|
-
|
|
2560
|
+
import_ui_utils15.logger.info(
|
|
2561
2561
|
LOG_SYSTEM,
|
|
2562
2562
|
"WagmiWalletImplementation instance initialized (Wagmi config creation deferred)."
|
|
2563
2563
|
);
|
|
@@ -2568,10 +2568,10 @@ var WagmiWalletImplementation = class {
|
|
|
2568
2568
|
* when user changes RPC settings.
|
|
2569
2569
|
*/
|
|
2570
2570
|
setupRpcConfigListener() {
|
|
2571
|
-
import("@openzeppelin/ui-
|
|
2571
|
+
import("@openzeppelin/ui-utils").then(({ userRpcConfigService }) => {
|
|
2572
2572
|
this.rpcConfigUnsubscribe = userRpcConfigService.subscribe("*", (event) => {
|
|
2573
2573
|
if (event.type === "rpc-config-changed" || event.type === "rpc-config-cleared") {
|
|
2574
|
-
|
|
2574
|
+
import_ui_utils15.logger.info(
|
|
2575
2575
|
LOG_SYSTEM,
|
|
2576
2576
|
`RPC config changed for network ${event.networkId}. Invalidating cached Wagmi config.`
|
|
2577
2577
|
);
|
|
@@ -2579,7 +2579,7 @@ var WagmiWalletImplementation = class {
|
|
|
2579
2579
|
}
|
|
2580
2580
|
});
|
|
2581
2581
|
}).catch((error) => {
|
|
2582
|
-
|
|
2582
|
+
import_ui_utils15.logger.error(LOG_SYSTEM, "Failed to setup RPC config listener:", error);
|
|
2583
2583
|
});
|
|
2584
2584
|
}
|
|
2585
2585
|
/**
|
|
@@ -2602,14 +2602,14 @@ var WagmiWalletImplementation = class {
|
|
|
2602
2602
|
* @param config - The Wagmi Config object to set as active, or null to clear it.
|
|
2603
2603
|
*/
|
|
2604
2604
|
setActiveWagmiConfig(config) {
|
|
2605
|
-
|
|
2605
|
+
import_ui_utils15.logger.info(
|
|
2606
2606
|
LOG_SYSTEM,
|
|
2607
2607
|
"setActiveWagmiConfig called with config:",
|
|
2608
2608
|
config ? "Valid Config" : "Null"
|
|
2609
2609
|
);
|
|
2610
2610
|
this.activeWagmiConfig = config;
|
|
2611
2611
|
if (this.unsubscribe) {
|
|
2612
|
-
|
|
2612
|
+
import_ui_utils15.logger.warn(
|
|
2613
2613
|
LOG_SYSTEM,
|
|
2614
2614
|
"setActiveWagmiConfig: Active WagmiConfig instance has changed. Existing direct watchAccount subscription (via onWalletConnectionChange) may be stale and operating on an old config instance."
|
|
2615
2615
|
);
|
|
@@ -2626,9 +2626,9 @@ var WagmiWalletImplementation = class {
|
|
|
2626
2626
|
const baseConnectors = [(0, import_connectors.injected)(), (0, import_connectors.metaMask)(), (0, import_connectors.safe)()];
|
|
2627
2627
|
if (this.walletConnectProjectId?.trim()) {
|
|
2628
2628
|
baseConnectors.push((0, import_connectors.walletConnect)({ projectId: this.walletConnectProjectId }));
|
|
2629
|
-
|
|
2629
|
+
import_ui_utils15.logger.info(LOG_SYSTEM, "WalletConnect connector added to DEFAULT config.");
|
|
2630
2630
|
} else {
|
|
2631
|
-
|
|
2631
|
+
import_ui_utils15.logger.warn(
|
|
2632
2632
|
LOG_SYSTEM,
|
|
2633
2633
|
"WalletConnect Project ID not provided; WC connector unavailable for DEFAULT config."
|
|
2634
2634
|
);
|
|
@@ -2640,7 +2640,7 @@ var WagmiWalletImplementation = class {
|
|
|
2640
2640
|
if (appNetworkIdString) {
|
|
2641
2641
|
let httpRpcOverride = getUserRpcUrl(appNetworkIdString);
|
|
2642
2642
|
if (!httpRpcOverride) {
|
|
2643
|
-
const rpcOverrideSetting =
|
|
2643
|
+
const rpcOverrideSetting = import_ui_utils15.appConfigService.getRpcEndpointOverride(appNetworkIdString);
|
|
2644
2644
|
if (typeof rpcOverrideSetting === "string") {
|
|
2645
2645
|
httpRpcOverride = rpcOverrideSetting;
|
|
2646
2646
|
} else if (typeof rpcOverrideSetting === "object") {
|
|
@@ -2652,7 +2652,7 @@ var WagmiWalletImplementation = class {
|
|
|
2652
2652
|
}
|
|
2653
2653
|
}
|
|
2654
2654
|
if (httpRpcOverride) {
|
|
2655
|
-
|
|
2655
|
+
import_ui_utils15.logger.info(
|
|
2656
2656
|
LOG_SYSTEM,
|
|
2657
2657
|
`Using overridden RPC for chain ${chainDefinition.name} (default config): ${httpRpcOverride}`
|
|
2658
2658
|
);
|
|
@@ -2670,10 +2670,10 @@ var WagmiWalletImplementation = class {
|
|
|
2670
2670
|
connectors: baseConnectors,
|
|
2671
2671
|
transports: transportsConfig
|
|
2672
2672
|
});
|
|
2673
|
-
|
|
2673
|
+
import_ui_utils15.logger.info(LOG_SYSTEM, "Default Wagmi config created successfully on demand.");
|
|
2674
2674
|
return defaultConfig2;
|
|
2675
2675
|
} catch (error) {
|
|
2676
|
-
|
|
2676
|
+
import_ui_utils15.logger.error(LOG_SYSTEM, "Error creating default Wagmi config on demand:", error);
|
|
2677
2677
|
return (0, import_core2.createConfig)({
|
|
2678
2678
|
chains: [defaultSupportedChains[0]],
|
|
2679
2679
|
connectors: [(0, import_connectors.injected)()],
|
|
@@ -2691,7 +2691,7 @@ var WagmiWalletImplementation = class {
|
|
|
2691
2691
|
if (userRpcUrl) {
|
|
2692
2692
|
return { http: userRpcUrl };
|
|
2693
2693
|
}
|
|
2694
|
-
const rpcOverrideSetting =
|
|
2694
|
+
const rpcOverrideSetting = import_ui_utils15.appConfigService.getRpcEndpointOverride(networkId);
|
|
2695
2695
|
if (typeof rpcOverrideSetting === "string") {
|
|
2696
2696
|
return rpcOverrideSetting;
|
|
2697
2697
|
} else if (typeof rpcOverrideSetting === "object" && rpcOverrideSetting !== null) {
|
|
@@ -2718,20 +2718,20 @@ var WagmiWalletImplementation = class {
|
|
|
2718
2718
|
*/
|
|
2719
2719
|
async getConfigForRainbowKit(currentAdapterUiKitConfig) {
|
|
2720
2720
|
if (!this.initialized) {
|
|
2721
|
-
|
|
2721
|
+
import_ui_utils15.logger.error(
|
|
2722
2722
|
LOG_SYSTEM,
|
|
2723
2723
|
"getConfigForRainbowKit called before implementation initialization."
|
|
2724
2724
|
);
|
|
2725
2725
|
return null;
|
|
2726
2726
|
}
|
|
2727
2727
|
if (currentAdapterUiKitConfig?.kitName !== "rainbowkit") {
|
|
2728
|
-
|
|
2728
|
+
import_ui_utils15.logger.warn(
|
|
2729
2729
|
LOG_SYSTEM,
|
|
2730
2730
|
"getConfigForRainbowKit called, but kitName is not rainbowkit. Returning null."
|
|
2731
2731
|
);
|
|
2732
2732
|
return null;
|
|
2733
2733
|
}
|
|
2734
|
-
|
|
2734
|
+
import_ui_utils15.logger.info(
|
|
2735
2735
|
LOG_SYSTEM,
|
|
2736
2736
|
"getConfigForRainbowKit: Kit is RainbowKit. Proceeding to create/get config. CurrentAdapterUiKitConfig:",
|
|
2737
2737
|
currentAdapterUiKitConfig
|
|
@@ -2743,10 +2743,10 @@ var WagmiWalletImplementation = class {
|
|
|
2743
2743
|
this.getRpcOverrideForRainbowKit.bind(this)
|
|
2744
2744
|
);
|
|
2745
2745
|
if (rainbowKitWagmiConfig) {
|
|
2746
|
-
|
|
2746
|
+
import_ui_utils15.logger.info(LOG_SYSTEM, "Returning RainbowKit-specific Wagmi config for provider.");
|
|
2747
2747
|
return rainbowKitWagmiConfig;
|
|
2748
2748
|
}
|
|
2749
|
-
|
|
2749
|
+
import_ui_utils15.logger.warn(LOG_SYSTEM, "RainbowKit specific Wagmi config creation failed.");
|
|
2750
2750
|
return null;
|
|
2751
2751
|
}
|
|
2752
2752
|
/**
|
|
@@ -2758,7 +2758,7 @@ var WagmiWalletImplementation = class {
|
|
|
2758
2758
|
*/
|
|
2759
2759
|
async getActiveConfigForManager(uiKitConfig2) {
|
|
2760
2760
|
if (!this.initialized) {
|
|
2761
|
-
|
|
2761
|
+
import_ui_utils15.logger.error(
|
|
2762
2762
|
LOG_SYSTEM,
|
|
2763
2763
|
"getActiveConfigForManager called before initialization! Creating fallback."
|
|
2764
2764
|
);
|
|
@@ -2770,7 +2770,7 @@ var WagmiWalletImplementation = class {
|
|
|
2770
2770
|
if (uiKitConfig2?.kitName === "rainbowkit") {
|
|
2771
2771
|
const rkConfig = await this.getConfigForRainbowKit(uiKitConfig2);
|
|
2772
2772
|
if (rkConfig) return rkConfig;
|
|
2773
|
-
|
|
2773
|
+
import_ui_utils15.logger.warn(
|
|
2774
2774
|
LOG_SYSTEM,
|
|
2775
2775
|
"getActiveConfigForManager: RainbowKit config failed, falling back to default."
|
|
2776
2776
|
);
|
|
@@ -2788,7 +2788,7 @@ var WagmiWalletImplementation = class {
|
|
|
2788
2788
|
* @returns The current default or active Wagmi Config object.
|
|
2789
2789
|
*/
|
|
2790
2790
|
getConfig() {
|
|
2791
|
-
|
|
2791
|
+
import_ui_utils15.logger.warn(
|
|
2792
2792
|
LOG_SYSTEM,
|
|
2793
2793
|
"getConfig() is deprecated. Internal calls should use activeWagmiConfig if set, or ensure default is created."
|
|
2794
2794
|
);
|
|
@@ -2806,10 +2806,10 @@ var WagmiWalletImplementation = class {
|
|
|
2806
2806
|
* @returns The current account status from Wagmi.
|
|
2807
2807
|
*/
|
|
2808
2808
|
getWalletConnectionStatus() {
|
|
2809
|
-
|
|
2809
|
+
import_ui_utils15.logger.debug(LOG_SYSTEM, "getWalletConnectionStatus called.");
|
|
2810
2810
|
const configToUse = this.activeWagmiConfig || this.defaultInstanceConfig || (this.defaultInstanceConfig = this.createDefaultConfig());
|
|
2811
2811
|
if (!configToUse) {
|
|
2812
|
-
|
|
2812
|
+
import_ui_utils15.logger.error(LOG_SYSTEM, "No config available for getWalletConnectionStatus!");
|
|
2813
2813
|
return {
|
|
2814
2814
|
isConnected: false,
|
|
2815
2815
|
isConnecting: false,
|
|
@@ -2835,17 +2835,17 @@ var WagmiWalletImplementation = class {
|
|
|
2835
2835
|
*/
|
|
2836
2836
|
onWalletConnectionChange(callback) {
|
|
2837
2837
|
if (!this.initialized) {
|
|
2838
|
-
|
|
2838
|
+
import_ui_utils15.logger.warn(LOG_SYSTEM, "onWalletConnectionChange called before initialization. No-op.");
|
|
2839
2839
|
return () => {
|
|
2840
2840
|
};
|
|
2841
2841
|
}
|
|
2842
2842
|
if (this.unsubscribe) {
|
|
2843
2843
|
this.unsubscribe();
|
|
2844
|
-
|
|
2844
|
+
import_ui_utils15.logger.debug(LOG_SYSTEM, "Previous watchAccount unsubscribed.");
|
|
2845
2845
|
}
|
|
2846
2846
|
const configToUse = this.activeWagmiConfig || this.defaultInstanceConfig || (this.defaultInstanceConfig = this.createDefaultConfig());
|
|
2847
2847
|
if (!configToUse) {
|
|
2848
|
-
|
|
2848
|
+
import_ui_utils15.logger.error(
|
|
2849
2849
|
LOG_SYSTEM,
|
|
2850
2850
|
"No config available for onWalletConnectionChange! Subscription not set."
|
|
2851
2851
|
);
|
|
@@ -2853,7 +2853,7 @@ var WagmiWalletImplementation = class {
|
|
|
2853
2853
|
};
|
|
2854
2854
|
}
|
|
2855
2855
|
this.unsubscribe = (0, import_core2.watchAccount)(configToUse, { onChange: callback });
|
|
2856
|
-
|
|
2856
|
+
import_ui_utils15.logger.info(
|
|
2857
2857
|
LOG_SYSTEM,
|
|
2858
2858
|
"watchAccount subscription established/re-established using config:",
|
|
2859
2859
|
configToUse === this.activeWagmiConfig ? "activeExternal" : "defaultInstance"
|
|
@@ -2867,7 +2867,7 @@ var WagmiWalletImplementation = class {
|
|
|
2867
2867
|
*/
|
|
2868
2868
|
async getWalletClient() {
|
|
2869
2869
|
if (!this.initialized || !this.activeWagmiConfig) {
|
|
2870
|
-
|
|
2870
|
+
import_ui_utils15.logger.warn(
|
|
2871
2871
|
LOG_SYSTEM,
|
|
2872
2872
|
"getWalletClient: Not initialized or no activeWagmiConfig. Returning null."
|
|
2873
2873
|
);
|
|
@@ -2888,7 +2888,7 @@ var WagmiWalletImplementation = class {
|
|
|
2888
2888
|
*/
|
|
2889
2889
|
async getPublicClient() {
|
|
2890
2890
|
if (!this.initialized || !this.activeWagmiConfig) {
|
|
2891
|
-
|
|
2891
|
+
import_ui_utils15.logger.warn(
|
|
2892
2892
|
LOG_SYSTEM,
|
|
2893
2893
|
"getPublicClient: Not initialized or no activeWagmiConfig. Returning null."
|
|
2894
2894
|
);
|
|
@@ -2897,7 +2897,7 @@ var WagmiWalletImplementation = class {
|
|
|
2897
2897
|
const accountStatus = (0, import_core2.getAccount)(this.activeWagmiConfig);
|
|
2898
2898
|
const currentChainId = accountStatus.chainId;
|
|
2899
2899
|
if (!currentChainId) {
|
|
2900
|
-
|
|
2900
|
+
import_ui_utils15.logger.warn(
|
|
2901
2901
|
LOG_SYSTEM,
|
|
2902
2902
|
"getPublicClient: No connected chainId available from accountStatus. Returning null."
|
|
2903
2903
|
);
|
|
@@ -2908,19 +2908,19 @@ var WagmiWalletImplementation = class {
|
|
|
2908
2908
|
chainId: currentChainId
|
|
2909
2909
|
});
|
|
2910
2910
|
if (publicClient) {
|
|
2911
|
-
|
|
2911
|
+
import_ui_utils15.logger.info(
|
|
2912
2912
|
LOG_SYSTEM,
|
|
2913
2913
|
`getPublicClient: Successfully retrieved public client for chainId ${currentChainId}.`
|
|
2914
2914
|
);
|
|
2915
2915
|
return publicClient;
|
|
2916
2916
|
}
|
|
2917
|
-
|
|
2917
|
+
import_ui_utils15.logger.warn(
|
|
2918
2918
|
LOG_SYSTEM,
|
|
2919
2919
|
`getPublicClient: getWagmiCorePublicClient returned undefined/null for chainId ${currentChainId}.`
|
|
2920
2920
|
);
|
|
2921
2921
|
return null;
|
|
2922
2922
|
} catch (error) {
|
|
2923
|
-
|
|
2923
|
+
import_ui_utils15.logger.error(LOG_SYSTEM, "Error getting public client from wagmi/core:", error);
|
|
2924
2924
|
return null;
|
|
2925
2925
|
}
|
|
2926
2926
|
}
|
|
@@ -2983,18 +2983,18 @@ async function getEvmWalletImplementation() {
|
|
|
2983
2983
|
}
|
|
2984
2984
|
walletImplementationPromise = (async () => {
|
|
2985
2985
|
try {
|
|
2986
|
-
|
|
2987
|
-
const initialUiKitConfig =
|
|
2986
|
+
import_ui_utils16.logger.info(LOG_SYSTEM2, "Initializing WagmiWalletImplementation singleton (async)... ");
|
|
2987
|
+
const initialUiKitConfig = import_ui_utils16.appConfigService.getTypedNestedConfig(
|
|
2988
2988
|
"walletui",
|
|
2989
2989
|
"config"
|
|
2990
2990
|
);
|
|
2991
|
-
const wcProjectId =
|
|
2991
|
+
const wcProjectId = import_ui_utils16.appConfigService.getGlobalServiceParam("walletconnect", "projectId");
|
|
2992
2992
|
const instance = new WagmiWalletImplementation(wcProjectId, initialUiKitConfig);
|
|
2993
|
-
|
|
2993
|
+
import_ui_utils16.logger.info(LOG_SYSTEM2, "WagmiWalletImplementation singleton created (async).");
|
|
2994
2994
|
walletImplementationInstance = instance;
|
|
2995
2995
|
return instance;
|
|
2996
2996
|
} catch (error) {
|
|
2997
|
-
|
|
2997
|
+
import_ui_utils16.logger.error(LOG_SYSTEM2, "Failed to initialize WagmiWalletImplementation (async):", error);
|
|
2998
2998
|
const fallbackInstance = new WagmiWalletImplementation();
|
|
2999
2999
|
walletImplementationInstance = fallbackInstance;
|
|
3000
3000
|
return fallbackInstance;
|
|
@@ -3004,7 +3004,7 @@ async function getEvmWalletImplementation() {
|
|
|
3004
3004
|
}
|
|
3005
3005
|
function getInitializedEvmWalletImplementation() {
|
|
3006
3006
|
if (!walletImplementationInstance) {
|
|
3007
|
-
|
|
3007
|
+
import_ui_utils16.logger.warn(
|
|
3008
3008
|
LOG_SYSTEM2,
|
|
3009
3009
|
"getInitializedEvmWalletImplementation called before instance was ready."
|
|
3010
3010
|
);
|
|
@@ -3028,7 +3028,7 @@ function notifyListeners() {
|
|
|
3028
3028
|
try {
|
|
3029
3029
|
listener();
|
|
3030
3030
|
} catch (error) {
|
|
3031
|
-
|
|
3031
|
+
import_ui_utils18.logger.error("EvmUiKitManager", "Error in listener:", error);
|
|
3032
3032
|
}
|
|
3033
3033
|
});
|
|
3034
3034
|
}
|
|
@@ -3042,7 +3042,7 @@ function getState() {
|
|
|
3042
3042
|
return { ...state };
|
|
3043
3043
|
}
|
|
3044
3044
|
async function configure(newFullUiKitConfig) {
|
|
3045
|
-
|
|
3045
|
+
import_ui_utils18.logger.info("EvmUiKitManager:configure", "Configuring UI kit. New config:", newFullUiKitConfig);
|
|
3046
3046
|
const oldKitName = state.currentFullUiKitConfig?.kitName;
|
|
3047
3047
|
const newKitName = newFullUiKitConfig.kitName;
|
|
3048
3048
|
const kitChanged = oldKitName !== newKitName;
|
|
@@ -3060,7 +3060,7 @@ async function configure(newFullUiKitConfig) {
|
|
|
3060
3060
|
try {
|
|
3061
3061
|
if (newKitName === "rainbowkit") {
|
|
3062
3062
|
if (kitChanged || !state.kitProviderComponent || !state.isKitAssetsLoaded) {
|
|
3063
|
-
|
|
3063
|
+
import_ui_utils18.logger.info("EvmUiKitManager:configure", "Ensuring RainbowKit assets are loaded...");
|
|
3064
3064
|
const { ensureRainbowKitAssetsLoaded: ensureRainbowKitAssetsLoaded2 } = await Promise.resolve().then(() => (init_rainbowkitAssetManager(), rainbowkitAssetManager_exports));
|
|
3065
3065
|
const rkAssets = await ensureRainbowKitAssetsLoaded2();
|
|
3066
3066
|
state.kitProviderComponent = rkAssets.ProviderComponent;
|
|
@@ -3070,16 +3070,16 @@ async function configure(newFullUiKitConfig) {
|
|
|
3070
3070
|
}
|
|
3071
3071
|
}
|
|
3072
3072
|
newWagmiConfigAttempt = await evmImpl.getConfigForRainbowKit(newFullUiKitConfig);
|
|
3073
|
-
|
|
3073
|
+
import_ui_utils18.logger.info("EvmUiKitManager:configure", "WagmiConfig for RainbowKit obtained.");
|
|
3074
3074
|
} else if (newKitName === "custom" || !newKitName) {
|
|
3075
3075
|
newWagmiConfigAttempt = await evmImpl.getActiveConfigForManager(newFullUiKitConfig);
|
|
3076
|
-
|
|
3076
|
+
import_ui_utils18.logger.info("EvmUiKitManager:configure", "ActiveConfig for custom/default obtained.");
|
|
3077
3077
|
if (kitChanged) {
|
|
3078
3078
|
state.kitProviderComponent = null;
|
|
3079
3079
|
state.isKitAssetsLoaded = false;
|
|
3080
3080
|
}
|
|
3081
3081
|
} else {
|
|
3082
|
-
|
|
3082
|
+
import_ui_utils18.logger.warn("EvmUiKitManager:configure", `Unsupported kitName: ${newKitName}.`);
|
|
3083
3083
|
state.kitProviderComponent = null;
|
|
3084
3084
|
state.isKitAssetsLoaded = false;
|
|
3085
3085
|
}
|
|
@@ -3088,16 +3088,16 @@ async function configure(newFullUiKitConfig) {
|
|
|
3088
3088
|
state.error = null;
|
|
3089
3089
|
if (!newWagmiConfigAttempt && newKitName && newKitName !== "none" && newKitName !== "custom") {
|
|
3090
3090
|
state.error = new Error(`Failed to obtain WagmiConfig for ${newKitName}`);
|
|
3091
|
-
|
|
3091
|
+
import_ui_utils18.logger.error("EvmUiKitManager:configure", state.error.message);
|
|
3092
3092
|
}
|
|
3093
3093
|
} catch (err) {
|
|
3094
|
-
|
|
3094
|
+
import_ui_utils18.logger.error("EvmUiKitManager:configure", "Error during UI kit configuration process:", err);
|
|
3095
3095
|
state.error = err instanceof Error ? err : new Error(String(err));
|
|
3096
3096
|
state.wagmiConfig = null;
|
|
3097
3097
|
evmImpl.setActiveWagmiConfig(null);
|
|
3098
3098
|
} finally {
|
|
3099
3099
|
state.isInitializing = false;
|
|
3100
|
-
|
|
3100
|
+
import_ui_utils18.logger.info(
|
|
3101
3101
|
"EvmUiKitManager:configure",
|
|
3102
3102
|
"Configuration attempt finished. Final wagmiConfig:",
|
|
3103
3103
|
state.wagmiConfig ? "Set" : "Null",
|
|
@@ -3158,13 +3158,13 @@ var EvmWalletUiRoot = ({ children }) => {
|
|
|
3158
3158
|
const DynKitProvider = kitProviderComponent;
|
|
3159
3159
|
const kitConfig = currentFullUiKitConfig.kitConfig || {};
|
|
3160
3160
|
const providerProps = kitConfig.providerProps || {};
|
|
3161
|
-
|
|
3161
|
+
import_ui_utils19.logger.info(
|
|
3162
3162
|
"EvmWalletUiRoot",
|
|
3163
3163
|
"Wrapping children with dynamically loaded KitProvider (RainbowKit)."
|
|
3164
3164
|
);
|
|
3165
3165
|
finalChildren = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DynKitProvider, { ...providerProps, children });
|
|
3166
3166
|
} else if (currentFullUiKitConfig?.kitName === "rainbowkit" && !isWagmiContextEffectivelyReady) {
|
|
3167
|
-
|
|
3167
|
+
import_ui_utils19.logger.info(
|
|
3168
3168
|
"EvmWalletUiRoot",
|
|
3169
3169
|
"RainbowKit configured, but context or assets not ready. Button may show its loading/error state."
|
|
3170
3170
|
);
|
|
@@ -3273,28 +3273,28 @@ function generateRainbowKitExportables(uiKitConfig2) {
|
|
|
3273
3273
|
}
|
|
3274
3274
|
|
|
3275
3275
|
// src/wallet/services/configResolutionService.ts
|
|
3276
|
-
var
|
|
3276
|
+
var import_ui_utils23 = require("@openzeppelin/ui-utils");
|
|
3277
3277
|
|
|
3278
3278
|
// src/wallet/utils.ts
|
|
3279
|
-
var
|
|
3279
|
+
var import_ui_utils22 = require("@openzeppelin/ui-utils");
|
|
3280
3280
|
|
|
3281
3281
|
// src/wallet/utils/uiKitService.ts
|
|
3282
|
-
var
|
|
3282
|
+
var import_ui_utils21 = require("@openzeppelin/ui-utils");
|
|
3283
3283
|
|
|
3284
3284
|
// src/wallet/utils/filterWalletComponents.ts
|
|
3285
|
-
var
|
|
3286
|
-
var
|
|
3285
|
+
var import_ui_types = require("@openzeppelin/ui-types");
|
|
3286
|
+
var import_ui_utils20 = require("@openzeppelin/ui-utils");
|
|
3287
3287
|
function filterWalletComponents(allPossibleComponents, exclusions, kitName = "custom") {
|
|
3288
|
-
|
|
3288
|
+
import_ui_utils20.logger.debug(
|
|
3289
3289
|
"filterWalletComponents",
|
|
3290
3290
|
`Filtering components for kit: ${kitName}. Exclusions: ${exclusions.join(", ")}.`
|
|
3291
3291
|
);
|
|
3292
3292
|
if (!allPossibleComponents || Object.keys(allPossibleComponents).length === 0) {
|
|
3293
|
-
|
|
3293
|
+
import_ui_utils20.logger.debug("filterWalletComponents", `No components provided to filter for kit: ${kitName}.`);
|
|
3294
3294
|
return void 0;
|
|
3295
3295
|
}
|
|
3296
3296
|
if (exclusions.length === 0) {
|
|
3297
|
-
|
|
3297
|
+
import_ui_utils20.logger.debug(
|
|
3298
3298
|
"filterWalletComponents",
|
|
3299
3299
|
`Providing all components for kit: ${kitName}.`,
|
|
3300
3300
|
allPossibleComponents
|
|
@@ -3313,14 +3313,14 @@ function filterWalletComponents(allPossibleComponents, exclusions, kitName = "cu
|
|
|
3313
3313
|
}
|
|
3314
3314
|
}
|
|
3315
3315
|
if (componentCount > 0) {
|
|
3316
|
-
|
|
3316
|
+
import_ui_utils20.logger.debug(
|
|
3317
3317
|
"filterWalletComponents",
|
|
3318
3318
|
`Providing filtered components for kit: ${kitName} after exclusions (${exclusions.join(", ")}).`,
|
|
3319
3319
|
filteredComponents
|
|
3320
3320
|
);
|
|
3321
3321
|
return filteredComponents;
|
|
3322
3322
|
}
|
|
3323
|
-
|
|
3323
|
+
import_ui_utils20.logger.debug("filterWalletComponents", `All components were excluded for kit: ${kitName}.`);
|
|
3324
3324
|
return void 0;
|
|
3325
3325
|
}
|
|
3326
3326
|
function getComponentExclusionsFromConfig(kitConfig) {
|
|
@@ -3328,7 +3328,7 @@ function getComponentExclusionsFromConfig(kitConfig) {
|
|
|
3328
3328
|
const componentsCfg = kitConfig.components;
|
|
3329
3329
|
if (componentsCfg && typeof componentsCfg === "object" && "exclude" in componentsCfg && Array.isArray(componentsCfg.exclude)) {
|
|
3330
3330
|
return componentsCfg.exclude.filter(
|
|
3331
|
-
(key) => typeof key === "string" &&
|
|
3331
|
+
(key) => typeof key === "string" && import_ui_types.ECOSYSTEM_WALLET_COMPONENT_KEYS.includes(key)
|
|
3332
3332
|
);
|
|
3333
3333
|
}
|
|
3334
3334
|
}
|
|
@@ -3337,21 +3337,21 @@ function getComponentExclusionsFromConfig(kitConfig) {
|
|
|
3337
3337
|
|
|
3338
3338
|
// src/wallet/utils/uiKitService.ts
|
|
3339
3339
|
function getResolvedWalletComponents(uiKitConfiguration) {
|
|
3340
|
-
|
|
3340
|
+
import_ui_utils21.logger.debug(
|
|
3341
3341
|
"uiKitService:getResolvedWalletComponents",
|
|
3342
3342
|
"Received uiKitConfiguration:",
|
|
3343
3343
|
JSON.stringify(uiKitConfiguration)
|
|
3344
3344
|
);
|
|
3345
3345
|
const currentKitName = uiKitConfiguration.kitName || "custom";
|
|
3346
3346
|
if (currentKitName === "none") {
|
|
3347
|
-
|
|
3347
|
+
import_ui_utils21.logger.info(
|
|
3348
3348
|
"uiKitService",
|
|
3349
3349
|
'UI Kit set to "none" for getResolvedWalletComponents, not providing wallet components.'
|
|
3350
3350
|
);
|
|
3351
3351
|
return void 0;
|
|
3352
3352
|
}
|
|
3353
3353
|
const exclusions = getComponentExclusionsFromConfig(uiKitConfiguration.kitConfig);
|
|
3354
|
-
|
|
3354
|
+
import_ui_utils21.logger.debug(
|
|
3355
3355
|
"uiKitService",
|
|
3356
3356
|
`Extracted component exclusions for ${currentKitName}: ${exclusions.join(", ") || "none"}.`
|
|
3357
3357
|
);
|
|
@@ -3366,17 +3366,17 @@ function getResolvedWalletComponents(uiKitConfiguration) {
|
|
|
3366
3366
|
if (currentKitName === "rainbowkit") {
|
|
3367
3367
|
const validation = validateRainbowKitConfig(uiKitConfiguration.kitConfig);
|
|
3368
3368
|
if (!validation.isValid) {
|
|
3369
|
-
|
|
3369
|
+
import_ui_utils21.logger.warn(
|
|
3370
3370
|
"uiKitService",
|
|
3371
3371
|
`Invalid RainbowKit configuration for components: ${validation.error}. No components provided.`
|
|
3372
3372
|
);
|
|
3373
3373
|
return void 0;
|
|
3374
3374
|
}
|
|
3375
3375
|
const rainbowKitComponents = createRainbowKitComponents();
|
|
3376
|
-
|
|
3376
|
+
import_ui_utils21.logger.info("uiKitService", "Providing RainbowKit components.");
|
|
3377
3377
|
return filterWalletComponents(rainbowKitComponents, exclusions, currentKitName);
|
|
3378
3378
|
}
|
|
3379
|
-
|
|
3379
|
+
import_ui_utils21.logger.warn(
|
|
3380
3380
|
"uiKitService",
|
|
3381
3381
|
`UI Kit "${currentKitName}" for getResolvedWalletComponents not explicitly supported. No components provided.`
|
|
3382
3382
|
);
|
|
@@ -3388,7 +3388,7 @@ function getResolvedWalletComponents2(uiKitConfig2) {
|
|
|
3388
3388
|
return getResolvedWalletComponents(uiKitConfig2);
|
|
3389
3389
|
}
|
|
3390
3390
|
async function resolveAndInitializeKitConfig(kitName, programmaticKitConfig, loadConfigModule) {
|
|
3391
|
-
|
|
3391
|
+
import_ui_utils22.logger.debug(
|
|
3392
3392
|
"resolveAndInitializeKitConfig",
|
|
3393
3393
|
`Resolving native config for kit: ${kitName || "none"}`,
|
|
3394
3394
|
{
|
|
@@ -3402,7 +3402,7 @@ async function resolveAndInitializeKitConfig(kitName, programmaticKitConfig, loa
|
|
|
3402
3402
|
try {
|
|
3403
3403
|
userNativeConfig = await loadConfigModule(conventionalConfigPath);
|
|
3404
3404
|
} catch (error) {
|
|
3405
|
-
|
|
3405
|
+
import_ui_utils22.logger.warn(
|
|
3406
3406
|
"resolveAndInitializeKitConfig",
|
|
3407
3407
|
`Call to load native config for ${kitName} from ${conventionalConfigPath} failed. Error:`,
|
|
3408
3408
|
error
|
|
@@ -3417,7 +3417,7 @@ async function resolveAndInitializeKitConfig(kitName, programmaticKitConfig, loa
|
|
|
3417
3417
|
} else if (programmaticKitConfig) {
|
|
3418
3418
|
return programmaticKitConfig;
|
|
3419
3419
|
}
|
|
3420
|
-
|
|
3420
|
+
import_ui_utils22.logger.debug(
|
|
3421
3421
|
"resolveAndInitializeKitConfig",
|
|
3422
3422
|
`No native or programmatic kitConfig provided for ${kitName || "none"}. Returning null.`
|
|
3423
3423
|
);
|
|
@@ -3426,7 +3426,7 @@ async function resolveAndInitializeKitConfig(kitName, programmaticKitConfig, loa
|
|
|
3426
3426
|
|
|
3427
3427
|
// src/wallet/services/configResolutionService.ts
|
|
3428
3428
|
async function resolveFullUiKitConfiguration(programmaticOverrides, initialAppServiceKitName, currentAppServiceConfig, options) {
|
|
3429
|
-
|
|
3429
|
+
import_ui_utils23.logger.debug(
|
|
3430
3430
|
"configResolutionService:resolveFullUiKitConfiguration",
|
|
3431
3431
|
"Starting resolution with:",
|
|
3432
3432
|
{
|
|
@@ -3453,7 +3453,7 @@ async function resolveFullUiKitConfiguration(programmaticOverrides, initialAppSe
|
|
|
3453
3453
|
// Pass through customCode for export purposes only
|
|
3454
3454
|
customCode: programmaticOverrides.customCode
|
|
3455
3455
|
};
|
|
3456
|
-
|
|
3456
|
+
import_ui_utils23.logger.debug(
|
|
3457
3457
|
"configResolutionService:resolveFullUiKitConfiguration",
|
|
3458
3458
|
"Resolved finalFullConfig:",
|
|
3459
3459
|
finalFullConfig
|
|
@@ -3462,19 +3462,19 @@ async function resolveFullUiKitConfiguration(programmaticOverrides, initialAppSe
|
|
|
3462
3462
|
}
|
|
3463
3463
|
|
|
3464
3464
|
// src/abi/etherscan.ts
|
|
3465
|
-
var
|
|
3465
|
+
var import_ui_utils24 = require("@openzeppelin/ui-utils");
|
|
3466
3466
|
async function loadAbiFromEtherscan(address, networkConfig) {
|
|
3467
3467
|
if (shouldUseV2Api(networkConfig)) {
|
|
3468
|
-
|
|
3468
|
+
import_ui_utils24.logger.info("loadAbiFromEtherscan", "Using V2 API for fetching ABI");
|
|
3469
3469
|
return loadAbiFromEtherscanV2(address, networkConfig);
|
|
3470
3470
|
}
|
|
3471
|
-
|
|
3471
|
+
import_ui_utils24.logger.info("loadAbiFromEtherscan", "Using V1 API for fetching ABI");
|
|
3472
3472
|
return loadAbiFromEtherscanV1(address, networkConfig);
|
|
3473
3473
|
}
|
|
3474
3474
|
async function loadAbiFromEtherscanV1(address, networkConfig) {
|
|
3475
3475
|
const explorerConfig = resolveExplorerConfig(networkConfig);
|
|
3476
3476
|
if (!explorerConfig.apiUrl) {
|
|
3477
|
-
|
|
3477
|
+
import_ui_utils24.logger.error(
|
|
3478
3478
|
"loadAbiFromEtherscanV1",
|
|
3479
3479
|
`API URL is missing for ${networkConfig.name} explorer.`
|
|
3480
3480
|
);
|
|
@@ -3489,20 +3489,20 @@ async function loadAbiFromEtherscanV1(address, networkConfig) {
|
|
|
3489
3489
|
}
|
|
3490
3490
|
let response;
|
|
3491
3491
|
try {
|
|
3492
|
-
|
|
3492
|
+
import_ui_utils24.logger.info(
|
|
3493
3493
|
"loadAbiFromEtherscanV1",
|
|
3494
3494
|
`Fetching ABI from ${explorerConfig.apiUrl} for address: ${address}`
|
|
3495
3495
|
);
|
|
3496
3496
|
response = await fetch(url);
|
|
3497
3497
|
} catch (networkError) {
|
|
3498
|
-
|
|
3498
|
+
import_ui_utils24.logger.error(
|
|
3499
3499
|
"loadAbiFromEtherscanV1",
|
|
3500
3500
|
`Network error fetching ABI from Explorer API: ${networkError}`
|
|
3501
3501
|
);
|
|
3502
3502
|
throw new Error(`Network error fetching ABI: ${networkError.message}`);
|
|
3503
3503
|
}
|
|
3504
3504
|
if (!response.ok) {
|
|
3505
|
-
|
|
3505
|
+
import_ui_utils24.logger.error(
|
|
3506
3506
|
"loadAbiFromEtherscanV1",
|
|
3507
3507
|
`Explorer API request failed with status: ${response.status}`
|
|
3508
3508
|
);
|
|
@@ -3512,14 +3512,14 @@ async function loadAbiFromEtherscanV1(address, networkConfig) {
|
|
|
3512
3512
|
try {
|
|
3513
3513
|
apiResult = await response.json();
|
|
3514
3514
|
} catch (jsonError) {
|
|
3515
|
-
|
|
3515
|
+
import_ui_utils24.logger.error(
|
|
3516
3516
|
"loadAbiFromEtherscanV1",
|
|
3517
3517
|
`Failed to parse Explorer API response as JSON: ${jsonError}`
|
|
3518
3518
|
);
|
|
3519
3519
|
throw new Error("Invalid JSON response received from Explorer API.");
|
|
3520
3520
|
}
|
|
3521
3521
|
if (apiResult.status !== "1") {
|
|
3522
|
-
|
|
3522
|
+
import_ui_utils24.logger.warn(
|
|
3523
3523
|
"loadAbiFromEtherscanV1",
|
|
3524
3524
|
`Explorer API error: Status ${apiResult.status}, Message: ${apiResult.message}, Result: ${apiResult.result}`
|
|
3525
3525
|
);
|
|
@@ -3538,13 +3538,13 @@ async function loadAbiFromEtherscanV1(address, networkConfig) {
|
|
|
3538
3538
|
throw new Error("Parsed ABI from Explorer API is not an array.");
|
|
3539
3539
|
}
|
|
3540
3540
|
} catch (error) {
|
|
3541
|
-
|
|
3541
|
+
import_ui_utils24.logger.error(
|
|
3542
3542
|
"loadAbiFromEtherscanV1",
|
|
3543
3543
|
`Failed to parse ABI JSON string from Explorer API result: ${error}`
|
|
3544
3544
|
);
|
|
3545
3545
|
throw new Error(`Invalid ABI JSON received from Explorer API: ${error.message}`);
|
|
3546
3546
|
}
|
|
3547
|
-
|
|
3547
|
+
import_ui_utils24.logger.info(
|
|
3548
3548
|
"loadAbiFromEtherscanV1",
|
|
3549
3549
|
`Successfully parsed ABI for ${networkConfig.name} with ${abi.length} items.`
|
|
3550
3550
|
);
|
|
@@ -3558,17 +3558,17 @@ async function loadAbiFromEtherscanV1(address, networkConfig) {
|
|
|
3558
3558
|
|
|
3559
3559
|
// src/abi/loader.ts
|
|
3560
3560
|
var import_viem5 = require("viem");
|
|
3561
|
-
var
|
|
3561
|
+
var import_ui_utils29 = require("@openzeppelin/ui-utils");
|
|
3562
3562
|
|
|
3563
3563
|
// src/proxy/detection.ts
|
|
3564
3564
|
var import_viem4 = require("viem");
|
|
3565
|
-
var
|
|
3565
|
+
var import_ui_utils27 = require("@openzeppelin/ui-utils");
|
|
3566
3566
|
|
|
3567
3567
|
// src/configuration/execution.ts
|
|
3568
|
-
var
|
|
3568
|
+
var import_ui_utils26 = require("@openzeppelin/ui-utils");
|
|
3569
3569
|
|
|
3570
3570
|
// src/validation/eoa.ts
|
|
3571
|
-
var
|
|
3571
|
+
var import_ui_utils25 = require("@openzeppelin/ui-utils");
|
|
3572
3572
|
var SYSTEM_LOG_TAG = "EoaValidator";
|
|
3573
3573
|
async function validateEoaConfig(config, walletStatus) {
|
|
3574
3574
|
if (!config.allowAny) {
|
|
@@ -3583,7 +3583,7 @@ async function validateEoaConfig(config, walletStatus) {
|
|
|
3583
3583
|
return `Connected wallet address (${walletStatus.address}) does not match the required specific EOA address (${config.specificAddress}). Please connect the correct wallet.`;
|
|
3584
3584
|
}
|
|
3585
3585
|
} else if (walletStatus.isConnected && !walletStatus.address) {
|
|
3586
|
-
|
|
3586
|
+
import_ui_utils25.logger.warn(
|
|
3587
3587
|
SYSTEM_LOG_TAG,
|
|
3588
3588
|
"Wallet is connected but address is unavailable for EOA validation."
|
|
3589
3589
|
);
|
|
@@ -3607,7 +3607,7 @@ async function validateRelayerConfig(config) {
|
|
|
3607
3607
|
// src/configuration/execution.ts
|
|
3608
3608
|
var SYSTEM_LOG_TAG2 = "adapter-evm-execution-config";
|
|
3609
3609
|
async function getEvmSupportedExecutionMethods() {
|
|
3610
|
-
|
|
3610
|
+
import_ui_utils26.logger.warn(
|
|
3611
3611
|
"adapter-evm-execution-config",
|
|
3612
3612
|
"getEvmSupportedExecutionMethods is using placeholder implementation."
|
|
3613
3613
|
);
|
|
@@ -3633,11 +3633,11 @@ async function getEvmSupportedExecutionMethods() {
|
|
|
3633
3633
|
]);
|
|
3634
3634
|
}
|
|
3635
3635
|
async function _validateMultisigConfig(_config, _walletStatus) {
|
|
3636
|
-
|
|
3636
|
+
import_ui_utils26.logger.info(SYSTEM_LOG_TAG2, "Multisig execution config validation: Not yet fully implemented.");
|
|
3637
3637
|
return true;
|
|
3638
3638
|
}
|
|
3639
3639
|
async function validateEvmExecutionConfig(config, walletStatus) {
|
|
3640
|
-
|
|
3640
|
+
import_ui_utils26.logger.info(SYSTEM_LOG_TAG2, "Validating EVM execution config:", { config, walletStatus });
|
|
3641
3641
|
switch (config.method) {
|
|
3642
3642
|
case "eoa":
|
|
3643
3643
|
return validateEoaConfig(config, walletStatus);
|
|
@@ -3647,7 +3647,7 @@ async function validateEvmExecutionConfig(config, walletStatus) {
|
|
|
3647
3647
|
return _validateMultisigConfig(config, walletStatus);
|
|
3648
3648
|
default: {
|
|
3649
3649
|
const unknownMethod = config.method;
|
|
3650
|
-
|
|
3650
|
+
import_ui_utils26.logger.warn(
|
|
3651
3651
|
SYSTEM_LOG_TAG2,
|
|
3652
3652
|
`Unsupported execution method type encountered: ${unknownMethod}`
|
|
3653
3653
|
);
|
|
@@ -3746,7 +3746,7 @@ function detectProxyFromAbi(abi) {
|
|
|
3746
3746
|
};
|
|
3747
3747
|
}
|
|
3748
3748
|
async function getImplementationAddress(proxyAddress, networkConfig, proxyType) {
|
|
3749
|
-
|
|
3749
|
+
import_ui_utils27.logger.info(
|
|
3750
3750
|
"getImplementationAddress",
|
|
3751
3751
|
`Resolving implementation for ${proxyType} proxy: ${proxyAddress}`
|
|
3752
3752
|
);
|
|
@@ -3763,7 +3763,7 @@ async function getImplementationAddress(proxyAddress, networkConfig, proxyType)
|
|
|
3763
3763
|
case "beacon":
|
|
3764
3764
|
return await getBeaconImplementation(proxyAddress, networkConfig);
|
|
3765
3765
|
case "diamond":
|
|
3766
|
-
|
|
3766
|
+
import_ui_utils27.logger.info("getImplementationAddress", "Diamond proxies not fully supported yet");
|
|
3767
3767
|
return null;
|
|
3768
3768
|
case "minimal":
|
|
3769
3769
|
return await getMinimalProxyImplementation(proxyAddress, networkConfig);
|
|
@@ -3771,7 +3771,7 @@ async function getImplementationAddress(proxyAddress, networkConfig, proxyType)
|
|
|
3771
3771
|
return await tryCommonImplementationMethods(proxyAddress, networkConfig);
|
|
3772
3772
|
}
|
|
3773
3773
|
} catch (error) {
|
|
3774
|
-
|
|
3774
|
+
import_ui_utils27.logger.warn("getImplementationAddress", `Failed to resolve implementation: ${error}`);
|
|
3775
3775
|
return null;
|
|
3776
3776
|
}
|
|
3777
3777
|
}
|
|
@@ -3783,7 +3783,7 @@ async function getAdminAddress(proxyAddress, networkConfig) {
|
|
|
3783
3783
|
if (legacyAdmin) return legacyAdmin;
|
|
3784
3784
|
return null;
|
|
3785
3785
|
} catch (error) {
|
|
3786
|
-
|
|
3786
|
+
import_ui_utils27.logger.warn("getAdminAddress", `Failed to resolve admin: ${error}`);
|
|
3787
3787
|
return null;
|
|
3788
3788
|
}
|
|
3789
3789
|
}
|
|
@@ -3798,20 +3798,20 @@ async function getEIP1967Admin(proxyAddress, networkConfig) {
|
|
|
3798
3798
|
async function getLegacyOZAdmin(proxyAddress, networkConfig) {
|
|
3799
3799
|
try {
|
|
3800
3800
|
const slot = (0, import_viem4.keccak256)((0, import_viem4.toHex)("org.zeppelinos.proxy.admin"));
|
|
3801
|
-
|
|
3801
|
+
import_ui_utils27.logger.info("getLegacyOZAdmin", `Trying legacy OZ admin slot: ${slot}`);
|
|
3802
3802
|
return await readStorageSlot(proxyAddress, slot, networkConfig);
|
|
3803
3803
|
} catch (error) {
|
|
3804
|
-
|
|
3804
|
+
import_ui_utils27.logger.warn("getLegacyOZAdmin", `Failed computing or reading legacy admin slot: ${error}`);
|
|
3805
3805
|
return null;
|
|
3806
3806
|
}
|
|
3807
3807
|
}
|
|
3808
3808
|
async function getLegacyOZImplementation(proxyAddress, networkConfig) {
|
|
3809
3809
|
try {
|
|
3810
3810
|
const slot = (0, import_viem4.keccak256)((0, import_viem4.toHex)("org.zeppelinos.proxy.implementation"));
|
|
3811
|
-
|
|
3811
|
+
import_ui_utils27.logger.info("getLegacyOZImplementation", `Trying legacy OZ slot: ${slot}`);
|
|
3812
3812
|
return await readStorageSlot(proxyAddress, slot, networkConfig);
|
|
3813
3813
|
} catch (error) {
|
|
3814
|
-
|
|
3814
|
+
import_ui_utils27.logger.warn("getLegacyOZImplementation", `Failed computing or reading legacy slot: ${error}`);
|
|
3815
3815
|
return null;
|
|
3816
3816
|
}
|
|
3817
3817
|
}
|
|
@@ -3835,7 +3835,7 @@ async function getMinimalProxyImplementation(proxyAddress, networkConfig) {
|
|
|
3835
3835
|
}
|
|
3836
3836
|
return null;
|
|
3837
3837
|
} catch (error) {
|
|
3838
|
-
|
|
3838
|
+
import_ui_utils27.logger.warn("getMinimalProxyImplementation", `Error reading bytecode: ${error}`);
|
|
3839
3839
|
return null;
|
|
3840
3840
|
}
|
|
3841
3841
|
}
|
|
@@ -3850,7 +3850,7 @@ async function tryCommonImplementationMethods(proxyAddress, networkConfig) {
|
|
|
3850
3850
|
try {
|
|
3851
3851
|
const result = await callContractFunction(proxyAddress, method, [], networkConfig);
|
|
3852
3852
|
if (result && result !== "0x0000000000000000000000000000000000000000") {
|
|
3853
|
-
|
|
3853
|
+
import_ui_utils27.logger.info(
|
|
3854
3854
|
"tryCommonImplementationMethods",
|
|
3855
3855
|
`Found implementation via ${method}: ${result}`
|
|
3856
3856
|
);
|
|
@@ -3876,13 +3876,13 @@ async function readStorageSlot(address, slot, networkConfig) {
|
|
|
3876
3876
|
slot
|
|
3877
3877
|
});
|
|
3878
3878
|
if (storageValue && storageValue !== "0x0000000000000000000000000000000000000000000000000000000000000000") {
|
|
3879
|
-
|
|
3879
|
+
import_ui_utils27.logger.info("readStorageSlot", `Found non-zero value at slot ${slot}: ${storageValue}`);
|
|
3880
3880
|
const implAddress = "0x" + storageValue.slice(-40);
|
|
3881
3881
|
return implAddress;
|
|
3882
3882
|
}
|
|
3883
3883
|
return null;
|
|
3884
3884
|
} catch (error) {
|
|
3885
|
-
|
|
3885
|
+
import_ui_utils27.logger.warn("readStorageSlot", `Failed to read storage slot ${slot}: ${error}`);
|
|
3886
3886
|
return null;
|
|
3887
3887
|
}
|
|
3888
3888
|
}
|
|
@@ -3903,7 +3903,7 @@ async function callContractFunction(address, signature, params, networkConfig) {
|
|
|
3903
3903
|
}
|
|
3904
3904
|
return null;
|
|
3905
3905
|
} catch (error) {
|
|
3906
|
-
|
|
3906
|
+
import_ui_utils27.logger.warn("callContractFunction", `Failed to call ${signature}: ${error}`);
|
|
3907
3907
|
return null;
|
|
3908
3908
|
}
|
|
3909
3909
|
}
|
|
@@ -3915,13 +3915,13 @@ async function getContractBytecode(address, networkConfig) {
|
|
|
3915
3915
|
});
|
|
3916
3916
|
return bytecode || null;
|
|
3917
3917
|
} catch (error) {
|
|
3918
|
-
|
|
3918
|
+
import_ui_utils27.logger.warn("getContractBytecode", `Failed to get bytecode: ${error}`);
|
|
3919
3919
|
return null;
|
|
3920
3920
|
}
|
|
3921
3921
|
}
|
|
3922
3922
|
|
|
3923
3923
|
// src/abi/sourcify.ts
|
|
3924
|
-
var
|
|
3924
|
+
var import_ui_utils28 = require("@openzeppelin/ui-utils");
|
|
3925
3925
|
var SOURCIFY_APP_BASE = "https://repo.sourcify.dev";
|
|
3926
3926
|
function getSourcifyContractAppUrl(chainId, address) {
|
|
3927
3927
|
return `${SOURCIFY_APP_BASE}/${chainId}/${address}`;
|
|
@@ -3939,7 +3939,7 @@ async function loadAbiFromSourcify(address, networkConfig, timeoutMs = 4e3) {
|
|
|
3939
3939
|
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
3940
3940
|
try {
|
|
3941
3941
|
const url = buildSourcifyApiUrl(networkConfig.chainId, address);
|
|
3942
|
-
|
|
3942
|
+
import_ui_utils28.logger.info("loadAbiFromSourcify", `Fetching contract from ${url}`);
|
|
3943
3943
|
const response = await fetch(url, { signal: controller.signal });
|
|
3944
3944
|
if (!response.ok) {
|
|
3945
3945
|
throw new Error(`Sourcify request failed: ${response.status} ${response.statusText}`);
|
|
@@ -3954,7 +3954,7 @@ async function loadAbiFromSourcify(address, networkConfig, timeoutMs = 4e3) {
|
|
|
3954
3954
|
const schema = transformAbiToSchema(abi, contractName, address);
|
|
3955
3955
|
return { schema, originalAbi: JSON.stringify(abi) };
|
|
3956
3956
|
} catch (error) {
|
|
3957
|
-
|
|
3957
|
+
import_ui_utils28.logger.warn("loadAbiFromSourcify", `Failed to fetch ABI from Sourcify: ${String(error)}`);
|
|
3958
3958
|
throw error;
|
|
3959
3959
|
} finally {
|
|
3960
3960
|
clearTimeout(timeout);
|
|
@@ -3970,10 +3970,10 @@ async function loadAbiFromJson(abiJsonString) {
|
|
|
3970
3970
|
throw new Error("Parsed JSON is not an array.");
|
|
3971
3971
|
}
|
|
3972
3972
|
} catch (error) {
|
|
3973
|
-
|
|
3973
|
+
import_ui_utils29.logger.error("loadAbiFromJson", "Failed to parse source string as JSON ABI:", error);
|
|
3974
3974
|
throw new Error(`Invalid JSON ABI provided: ${error.message}`);
|
|
3975
3975
|
}
|
|
3976
|
-
|
|
3976
|
+
import_ui_utils29.logger.info("loadAbiFromJson", `Successfully parsed JSON ABI with ${abi.length} items.`);
|
|
3977
3977
|
const contractName = "ContractFromABI";
|
|
3978
3978
|
return transformAbiToSchema(abi, contractName, void 0);
|
|
3979
3979
|
}
|
|
@@ -3992,7 +3992,7 @@ async function loadEvmContract(artifacts, networkConfig, options = {}) {
|
|
|
3992
3992
|
const trimmed = contractDefinition.trim();
|
|
3993
3993
|
const hasJsonContent = trimmed.includes("[") && trimmed.includes("]") && trimmed.includes("{");
|
|
3994
3994
|
if (hasJsonContent) {
|
|
3995
|
-
|
|
3995
|
+
import_ui_utils29.logger.info("loadEvmContract", "Manual contract definition provided. Attempting to parse...");
|
|
3996
3996
|
try {
|
|
3997
3997
|
const schema = await loadAbiFromJson(contractDefinition);
|
|
3998
3998
|
return {
|
|
@@ -4008,14 +4008,14 @@ async function loadEvmContract(artifacts, networkConfig, options = {}) {
|
|
|
4008
4008
|
// Note: No proxy detection for manual ABIs - user provides what they want
|
|
4009
4009
|
};
|
|
4010
4010
|
} catch (error) {
|
|
4011
|
-
|
|
4011
|
+
import_ui_utils29.logger.error("loadEvmContract", "Failed to parse manually provided ABI:", error);
|
|
4012
4012
|
throw new Error(`The provided ABI JSON is invalid: ${error.message}`);
|
|
4013
4013
|
}
|
|
4014
4014
|
}
|
|
4015
4015
|
}
|
|
4016
4016
|
const forcedRaw = artifacts.__forcedProvider || artifacts.service;
|
|
4017
4017
|
const forcedProvider = isEvmProviderKey(forcedRaw) ? forcedRaw : null;
|
|
4018
|
-
|
|
4018
|
+
import_ui_utils29.logger.info(
|
|
4019
4019
|
"loadEvmContract",
|
|
4020
4020
|
`No manual ABI detected. Attempting Etherscan fetch for address: ${contractAddress}...`
|
|
4021
4021
|
);
|
|
@@ -4044,7 +4044,7 @@ function buildContractResult(contractAddress, abiResult, networkConfig, sourcePr
|
|
|
4044
4044
|
contractName: abiResult.schema.name,
|
|
4045
4045
|
verificationStatus: "verified",
|
|
4046
4046
|
fetchTimestamp: /* @__PURE__ */ new Date(),
|
|
4047
|
-
definitionHash: (0,
|
|
4047
|
+
definitionHash: (0, import_ui_utils29.simpleHash)(abiResult.originalAbi)
|
|
4048
4048
|
},
|
|
4049
4049
|
proxyInfo
|
|
4050
4050
|
};
|
|
@@ -4052,13 +4052,13 @@ function buildContractResult(contractAddress, abiResult, networkConfig, sourcePr
|
|
|
4052
4052
|
async function loadImplementationAbi(_contractAddress, implementationAddress, networkConfig, _proxyType) {
|
|
4053
4053
|
try {
|
|
4054
4054
|
const implementationResult = await loadAbiFromEtherscan(implementationAddress, networkConfig);
|
|
4055
|
-
|
|
4055
|
+
import_ui_utils29.logger.info(
|
|
4056
4056
|
"loadImplementationAbi",
|
|
4057
4057
|
`Successfully fetched implementation ABI with ${implementationResult.schema.functions.length} functions`
|
|
4058
4058
|
);
|
|
4059
4059
|
return implementationResult;
|
|
4060
4060
|
} catch (implementationError) {
|
|
4061
|
-
|
|
4061
|
+
import_ui_utils29.logger.warn(
|
|
4062
4062
|
"loadImplementationAbi",
|
|
4063
4063
|
`Failed to load implementation ABI: ${implementationError}`
|
|
4064
4064
|
);
|
|
@@ -4071,7 +4071,7 @@ async function handleProxyDetection(contractAddress, initialResult, networkConfi
|
|
|
4071
4071
|
if (!proxyDetection.isProxy) {
|
|
4072
4072
|
return null;
|
|
4073
4073
|
}
|
|
4074
|
-
|
|
4074
|
+
import_ui_utils29.logger.info(
|
|
4075
4075
|
"handleProxyDetection",
|
|
4076
4076
|
`Proxy detected: ${proxyDetection.proxyType} (confidence: ${proxyDetection.confidence})`
|
|
4077
4077
|
);
|
|
@@ -4083,7 +4083,7 @@ async function handleProxyDetection(contractAddress, initialResult, networkConfi
|
|
|
4083
4083
|
);
|
|
4084
4084
|
const adminAddress = await getAdminAddress(contractAddress, networkConfig);
|
|
4085
4085
|
if (!implementationAddress) {
|
|
4086
|
-
|
|
4086
|
+
import_ui_utils29.logger.info("handleProxyDetection", "Proxy detected but implementation address not found");
|
|
4087
4087
|
return buildContractResult(contractAddress, initialResult, networkConfig, initialProvider, {
|
|
4088
4088
|
isProxy: true,
|
|
4089
4089
|
proxyType,
|
|
@@ -4091,7 +4091,7 @@ async function handleProxyDetection(contractAddress, initialResult, networkConfi
|
|
|
4091
4091
|
detectionMethod: "automatic"
|
|
4092
4092
|
});
|
|
4093
4093
|
}
|
|
4094
|
-
|
|
4094
|
+
import_ui_utils29.logger.info("handleProxyDetection", `Found implementation at: ${implementationAddress}`);
|
|
4095
4095
|
const implementationResult = await loadImplementationAbi(
|
|
4096
4096
|
contractAddress,
|
|
4097
4097
|
implementationAddress,
|
|
@@ -4127,12 +4127,12 @@ async function handleProxyDetection(contractAddress, initialResult, networkConfi
|
|
|
4127
4127
|
async function loadContractWithProxyDetection(contractAddress, networkConfig, options = {}, forcedProvider = null) {
|
|
4128
4128
|
try {
|
|
4129
4129
|
let uiDefault = null;
|
|
4130
|
-
const svcCfg =
|
|
4130
|
+
const svcCfg = import_ui_utils29.userNetworkServiceConfigService.get(networkConfig.id, "contract-definitions");
|
|
4131
4131
|
if (svcCfg && typeof svcCfg === "object" && "defaultProvider" in svcCfg) {
|
|
4132
4132
|
const raw = svcCfg.defaultProvider;
|
|
4133
4133
|
if (isEvmProviderKey(raw)) uiDefault = raw;
|
|
4134
4134
|
}
|
|
4135
|
-
const appDefaultRaw =
|
|
4135
|
+
const appDefaultRaw = import_ui_utils29.appConfigService.getGlobalServiceParam(
|
|
4136
4136
|
"contractdefinition",
|
|
4137
4137
|
"defaultProvider"
|
|
4138
4138
|
);
|
|
@@ -4151,13 +4151,13 @@ async function loadContractWithProxyDetection(contractAddress, networkConfig, op
|
|
|
4151
4151
|
const remainingOverall = Math.max(100, overallDeadline - Date.now());
|
|
4152
4152
|
const attemptTimeout = Math.min(PER_PROVIDER_TIMEOUT_MS, remainingOverall);
|
|
4153
4153
|
if (provider === EvmProviderKeys.Etherscan) {
|
|
4154
|
-
initialResult = await (0,
|
|
4154
|
+
initialResult = await (0, import_ui_utils29.withTimeout)(
|
|
4155
4155
|
loadAbiFromEtherscan(contractAddress, networkConfig),
|
|
4156
4156
|
attemptTimeout,
|
|
4157
4157
|
"etherscan"
|
|
4158
4158
|
);
|
|
4159
4159
|
} else if (provider === EvmProviderKeys.Sourcify) {
|
|
4160
|
-
initialResult = await (0,
|
|
4160
|
+
initialResult = await (0, import_ui_utils29.withTimeout)(
|
|
4161
4161
|
loadAbiFromSourcify(contractAddress, networkConfig, attemptTimeout),
|
|
4162
4162
|
attemptTimeout,
|
|
4163
4163
|
"sourcify"
|
|
@@ -4173,7 +4173,7 @@ async function loadContractWithProxyDetection(contractAddress, networkConfig, op
|
|
|
4173
4173
|
}
|
|
4174
4174
|
}
|
|
4175
4175
|
if (!initialResult) throw lastError ?? new Error("No provider succeeded");
|
|
4176
|
-
|
|
4176
|
+
import_ui_utils29.logger.info(
|
|
4177
4177
|
"loadContractWithProxyDetection",
|
|
4178
4178
|
`Successfully fetched initial ABI for ${contractAddress} with ${initialResult.schema.functions.length} functions`
|
|
4179
4179
|
);
|
|
@@ -4190,7 +4190,7 @@ async function loadContractWithProxyDetection(contractAddress, networkConfig, op
|
|
|
4190
4190
|
}
|
|
4191
4191
|
return buildContractResult(contractAddress, initialResult, networkConfig, usedProvider);
|
|
4192
4192
|
} catch (error) {
|
|
4193
|
-
|
|
4193
|
+
import_ui_utils29.logger.warn("loadContractWithProxyDetection", `Contract loading failed: ${error}`);
|
|
4194
4194
|
if (forcedProvider) {
|
|
4195
4195
|
throw error;
|
|
4196
4196
|
}
|
|
@@ -4226,6 +4226,23 @@ var EVM_TYPE_TO_FIELD_TYPE = {
|
|
|
4226
4226
|
bytes: "textarea",
|
|
4227
4227
|
bytes32: "text"
|
|
4228
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
|
+
}
|
|
4229
4246
|
|
|
4230
4247
|
// src/mapping/type-mapper.ts
|
|
4231
4248
|
function mapEvmParamTypeToFieldType(parameterType) {
|
|
@@ -4278,7 +4295,7 @@ function getEvmCompatibleFieldTypes(parameterType) {
|
|
|
4278
4295
|
|
|
4279
4296
|
// src/mapping/field-generator.ts
|
|
4280
4297
|
var import_lodash = require("lodash");
|
|
4281
|
-
var
|
|
4298
|
+
var import_ui_utils30 = require("@openzeppelin/ui-utils");
|
|
4282
4299
|
function extractArrayElementType(parameterType) {
|
|
4283
4300
|
const arrayMatch = parameterType.match(/^(.+)\[\d*\]$/);
|
|
4284
4301
|
if (arrayMatch) {
|
|
@@ -4309,8 +4326,8 @@ function generateEvmDefaultField(parameter) {
|
|
|
4309
4326
|
type: fieldType,
|
|
4310
4327
|
placeholder: `Enter ${parameter.displayName || parameter.name || parameter.type}`,
|
|
4311
4328
|
helperText: parameter.description || "",
|
|
4312
|
-
defaultValue: (0,
|
|
4313
|
-
validation: (0,
|
|
4329
|
+
defaultValue: (0, import_ui_utils30.getDefaultValueForType)(fieldType),
|
|
4330
|
+
validation: (0, import_ui_utils30.enhanceNumericValidation)(
|
|
4314
4331
|
getDefaultValidation(),
|
|
4315
4332
|
parameter.type,
|
|
4316
4333
|
EVM_NUMERIC_BOUNDS
|
|
@@ -4326,7 +4343,7 @@ function generateEvmDefaultField(parameter) {
|
|
|
4326
4343
|
elementType: elementFieldType,
|
|
4327
4344
|
elementFieldConfig: {
|
|
4328
4345
|
type: elementFieldType,
|
|
4329
|
-
validation: (0,
|
|
4346
|
+
validation: (0, import_ui_utils30.enhanceNumericValidation)(
|
|
4330
4347
|
getDefaultValidation(),
|
|
4331
4348
|
elementType,
|
|
4332
4349
|
EVM_NUMERIC_BOUNDS
|
|
@@ -4354,11 +4371,11 @@ function isEvmViewFunction(functionDetails) {
|
|
|
4354
4371
|
|
|
4355
4372
|
// src/query/handler.ts
|
|
4356
4373
|
var import_viem7 = require("viem");
|
|
4357
|
-
var
|
|
4374
|
+
var import_ui_utils33 = require("@openzeppelin/ui-utils");
|
|
4358
4375
|
|
|
4359
4376
|
// src/transform/input-parser.ts
|
|
4360
4377
|
var import_viem6 = require("viem");
|
|
4361
|
-
var
|
|
4378
|
+
var import_ui_utils31 = require("@openzeppelin/ui-utils");
|
|
4362
4379
|
function parseEvmInput(param, rawValue, isRecursive = false) {
|
|
4363
4380
|
const { type, name } = param;
|
|
4364
4381
|
const baseType = type.replace(/\[\d*\]$/, "");
|
|
@@ -4476,7 +4493,7 @@ function parseEvmInput(param, rawValue, isRecursive = false) {
|
|
|
4476
4493
|
} else if (baseType === "string") {
|
|
4477
4494
|
return String(rawValue);
|
|
4478
4495
|
}
|
|
4479
|
-
|
|
4496
|
+
import_ui_utils31.logger.warn(
|
|
4480
4497
|
"parseEvmInput",
|
|
4481
4498
|
`Unknown EVM parameter type encountered: '${type}'. Using raw value.`
|
|
4482
4499
|
);
|
|
@@ -4489,10 +4506,10 @@ function parseEvmInput(param, rawValue, isRecursive = false) {
|
|
|
4489
4506
|
}
|
|
4490
4507
|
|
|
4491
4508
|
// src/transform/output-formatter.ts
|
|
4492
|
-
var
|
|
4509
|
+
var import_ui_utils32 = require("@openzeppelin/ui-utils");
|
|
4493
4510
|
function formatEvmFunctionResult(decodedValue, functionDetails) {
|
|
4494
4511
|
if (!functionDetails.outputs || !Array.isArray(functionDetails.outputs)) {
|
|
4495
|
-
|
|
4512
|
+
import_ui_utils32.logger.warn(
|
|
4496
4513
|
"formatEvmFunctionResult",
|
|
4497
4514
|
`Output ABI definition missing or invalid for function ${functionDetails.name}.`
|
|
4498
4515
|
);
|
|
@@ -4520,7 +4537,7 @@ function formatEvmFunctionResult(decodedValue, functionDetails) {
|
|
|
4520
4537
|
}
|
|
4521
4538
|
} catch (error) {
|
|
4522
4539
|
const errorMessage = `Error formatting result for ${functionDetails.name}: ${error.message}`;
|
|
4523
|
-
|
|
4540
|
+
import_ui_utils32.logger.error("formatEvmFunctionResult", errorMessage, {
|
|
4524
4541
|
functionName: functionDetails.name,
|
|
4525
4542
|
decodedValue,
|
|
4526
4543
|
error
|
|
@@ -4543,14 +4560,14 @@ async function getPublicClientForQuery(walletImplementation, networkConfig) {
|
|
|
4543
4560
|
if (clientFromWallet) {
|
|
4544
4561
|
return clientFromWallet;
|
|
4545
4562
|
} else {
|
|
4546
|
-
|
|
4563
|
+
import_ui_utils33.logger.warn(
|
|
4547
4564
|
"getPublicClientForQuery",
|
|
4548
4565
|
`Could not get public client from connected wallet for chain ${walletChainId}. Falling back.`
|
|
4549
4566
|
);
|
|
4550
4567
|
}
|
|
4551
4568
|
}
|
|
4552
4569
|
const resolvedRpc = resolveRpcUrl(networkConfig);
|
|
4553
|
-
|
|
4570
|
+
import_ui_utils33.logger.info(
|
|
4554
4571
|
"getPublicClientForQuery",
|
|
4555
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}`
|
|
4556
4573
|
);
|
|
@@ -4561,7 +4578,7 @@ function createPublicClientWithRpc(networkConfig, rpcUrl) {
|
|
|
4561
4578
|
if (networkConfig.viemChain) {
|
|
4562
4579
|
chainForViem = networkConfig.viemChain;
|
|
4563
4580
|
} else {
|
|
4564
|
-
|
|
4581
|
+
import_ui_utils33.logger.warn(
|
|
4565
4582
|
"createPublicClientWithRpc",
|
|
4566
4583
|
`Viem chain object (viemChain) not provided in EvmNetworkConfig for ${networkConfig.name} (query). Creating a minimal one.`
|
|
4567
4584
|
);
|
|
@@ -4588,7 +4605,7 @@ function createPublicClientWithRpc(networkConfig, rpcUrl) {
|
|
|
4588
4605
|
});
|
|
4589
4606
|
return publicClient;
|
|
4590
4607
|
} catch (error) {
|
|
4591
|
-
|
|
4608
|
+
import_ui_utils33.logger.error(
|
|
4592
4609
|
"createPublicClientWithRpc",
|
|
4593
4610
|
"Failed to create network-specific public client for query:",
|
|
4594
4611
|
error
|
|
@@ -4599,7 +4616,7 @@ function createPublicClientWithRpc(networkConfig, rpcUrl) {
|
|
|
4599
4616
|
}
|
|
4600
4617
|
}
|
|
4601
4618
|
async function queryEvmViewFunction(contractAddress, functionId, networkConfig, params, contractSchema, walletImplementation, loadContractFn) {
|
|
4602
|
-
|
|
4619
|
+
import_ui_utils33.logger.info(
|
|
4603
4620
|
"queryEvmViewFunction",
|
|
4604
4621
|
`Querying view function: ${functionId} on ${contractAddress} (${networkConfig.name})`,
|
|
4605
4622
|
{ params }
|
|
@@ -4630,9 +4647,9 @@ async function queryEvmViewFunction(contractAddress, functionId, networkConfig,
|
|
|
4630
4647
|
}
|
|
4631
4648
|
return parseEvmInput(inputParam, rawValue, false);
|
|
4632
4649
|
});
|
|
4633
|
-
|
|
4650
|
+
import_ui_utils33.logger.debug("queryEvmViewFunction", "Parsed Args for readContract:", args);
|
|
4634
4651
|
const functionAbiItem = createAbiFunctionItem(functionDetails);
|
|
4635
|
-
|
|
4652
|
+
import_ui_utils33.logger.debug(
|
|
4636
4653
|
"queryEvmViewFunction",
|
|
4637
4654
|
`[Query ${functionDetails.name}] Calling readContract with ABI:`,
|
|
4638
4655
|
functionAbiItem,
|
|
@@ -4648,7 +4665,7 @@ async function queryEvmViewFunction(contractAddress, functionId, networkConfig,
|
|
|
4648
4665
|
args
|
|
4649
4666
|
});
|
|
4650
4667
|
} catch (readError) {
|
|
4651
|
-
|
|
4668
|
+
import_ui_utils33.logger.error(
|
|
4652
4669
|
"queryEvmViewFunction",
|
|
4653
4670
|
`[Query ${functionDetails.name}] publicClient.readContract specific error:`,
|
|
4654
4671
|
readError
|
|
@@ -4657,7 +4674,7 @@ async function queryEvmViewFunction(contractAddress, functionId, networkConfig,
|
|
|
4657
4674
|
`Viem readContract failed for ${functionDetails.name}: ${readError.message}`
|
|
4658
4675
|
);
|
|
4659
4676
|
}
|
|
4660
|
-
|
|
4677
|
+
import_ui_utils33.logger.debug(
|
|
4661
4678
|
"queryEvmViewFunction",
|
|
4662
4679
|
`[Query ${functionDetails.name}] Raw decoded result:`,
|
|
4663
4680
|
decodedResult
|
|
@@ -4665,7 +4682,7 @@ async function queryEvmViewFunction(contractAddress, functionId, networkConfig,
|
|
|
4665
4682
|
return decodedResult;
|
|
4666
4683
|
} catch (error) {
|
|
4667
4684
|
const errorMessage = `Failed to query view function ${functionId} on network ${networkConfig.name}: ${error.message}`;
|
|
4668
|
-
|
|
4685
|
+
import_ui_utils33.logger.error("queryEvmViewFunction", errorMessage, {
|
|
4669
4686
|
contractAddress,
|
|
4670
4687
|
functionId,
|
|
4671
4688
|
params,
|
|
@@ -4679,7 +4696,7 @@ async function queryEvmViewFunction(contractAddress, functionId, networkConfig,
|
|
|
4679
4696
|
// src/transaction/relayer.ts
|
|
4680
4697
|
var import_viem8 = require("viem");
|
|
4681
4698
|
var import_relayer_sdk = require("@openzeppelin/relayer-sdk");
|
|
4682
|
-
var
|
|
4699
|
+
var import_ui_utils34 = require("@openzeppelin/ui-utils");
|
|
4683
4700
|
var RelayerExecutionStrategy = class {
|
|
4684
4701
|
async execute(transactionData, executionConfig, _walletImplementation, onStatusChange, runtimeApiKey) {
|
|
4685
4702
|
const relayerConfig = executionConfig;
|
|
@@ -4714,7 +4731,7 @@ var RelayerExecutionStrategy = class {
|
|
|
4714
4731
|
* @throws If the API call fails or returns an unsuccessful response.
|
|
4715
4732
|
*/
|
|
4716
4733
|
async getEvmRelayers(serviceUrl, accessToken, networkConfig) {
|
|
4717
|
-
|
|
4734
|
+
import_ui_utils34.logger.info(
|
|
4718
4735
|
"[Relayer] Getting relayers with access token",
|
|
4719
4736
|
accessToken.slice(0, 5).padEnd(accessToken.length, "*")
|
|
4720
4737
|
);
|
|
@@ -4762,7 +4779,7 @@ var RelayerExecutionStrategy = class {
|
|
|
4762
4779
|
* @throws If any API call fails or returns an unsuccessful response.
|
|
4763
4780
|
*/
|
|
4764
4781
|
async getEvmRelayer(serviceUrl, accessToken, relayerId, networkConfig) {
|
|
4765
|
-
|
|
4782
|
+
import_ui_utils34.logger.info("[Relayer] Getting detailed relayer info", relayerId);
|
|
4766
4783
|
const sdkConfig = new import_relayer_sdk.Configuration({
|
|
4767
4784
|
basePath: serviceUrl,
|
|
4768
4785
|
accessToken
|
|
@@ -4772,11 +4789,11 @@ var RelayerExecutionStrategy = class {
|
|
|
4772
4789
|
const [relayerResponse, balanceResponse, statusResponse] = await Promise.all([
|
|
4773
4790
|
relayersApi.getRelayer(relayerId),
|
|
4774
4791
|
relayersApi.getRelayerBalance(relayerId).catch((err) => {
|
|
4775
|
-
|
|
4792
|
+
import_ui_utils34.logger.warn("[Relayer] Failed to fetch balance", err);
|
|
4776
4793
|
return null;
|
|
4777
4794
|
}),
|
|
4778
4795
|
relayersApi.getRelayerStatus(relayerId).catch((err) => {
|
|
4779
|
-
|
|
4796
|
+
import_ui_utils34.logger.warn("[Relayer] Failed to fetch status", err);
|
|
4780
4797
|
return null;
|
|
4781
4798
|
})
|
|
4782
4799
|
]);
|
|
@@ -4799,7 +4816,7 @@ var RelayerExecutionStrategy = class {
|
|
|
4799
4816
|
const currencySymbol = networkConfig.nativeCurrency.symbol;
|
|
4800
4817
|
enhancedDetails.balance = `${balanceInEth} ${currencySymbol}`;
|
|
4801
4818
|
} catch (error) {
|
|
4802
|
-
|
|
4819
|
+
import_ui_utils34.logger.warn("[Relayer] Failed to format balance, using raw value", String(error));
|
|
4803
4820
|
enhancedDetails.balance = String(balanceResponse.data.data.balance);
|
|
4804
4821
|
}
|
|
4805
4822
|
}
|
|
@@ -4817,10 +4834,10 @@ var RelayerExecutionStrategy = class {
|
|
|
4817
4834
|
}
|
|
4818
4835
|
}
|
|
4819
4836
|
}
|
|
4820
|
-
|
|
4837
|
+
import_ui_utils34.logger.info("[Relayer] Retrieved enhanced relayer details", JSON.stringify(enhancedDetails));
|
|
4821
4838
|
return enhancedDetails;
|
|
4822
4839
|
} catch (error) {
|
|
4823
|
-
|
|
4840
|
+
import_ui_utils34.logger.error(
|
|
4824
4841
|
"[Relayer] Failed to get relayer details",
|
|
4825
4842
|
error instanceof Error ? error.message : String(error)
|
|
4826
4843
|
);
|
|
@@ -4845,7 +4862,7 @@ var RelayerExecutionStrategy = class {
|
|
|
4845
4862
|
let valueNumber = 0;
|
|
4846
4863
|
const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
4847
4864
|
if (valueBigint > MAX_SAFE) {
|
|
4848
|
-
|
|
4865
|
+
import_ui_utils34.logger.warn(
|
|
4849
4866
|
"[Relayer] Value exceeds JS safe integer. Truncating for request.",
|
|
4850
4867
|
valueBigint.toString()
|
|
4851
4868
|
);
|
|
@@ -4860,7 +4877,7 @@ var RelayerExecutionStrategy = class {
|
|
|
4860
4877
|
// If no explicit gas limit is provided, keep a conservative default but warn.
|
|
4861
4878
|
gas_limit: (() => {
|
|
4862
4879
|
if (typeof evmOptions?.gasLimit === "number") return evmOptions.gasLimit;
|
|
4863
|
-
|
|
4880
|
+
import_ui_utils34.logger.warn(
|
|
4864
4881
|
"[Relayer]",
|
|
4865
4882
|
"No gasLimit provided; using default 210000. Consider setting explicitly."
|
|
4866
4883
|
);
|
|
@@ -4932,10 +4949,10 @@ var RelayerExecutionStrategy = class {
|
|
|
4932
4949
|
};
|
|
4933
4950
|
|
|
4934
4951
|
// src/transaction/sender.ts
|
|
4935
|
-
var
|
|
4952
|
+
var import_ui_utils35 = require("@openzeppelin/ui-utils");
|
|
4936
4953
|
var SYSTEM_LOG_TAG3 = "adapter-evm-sender";
|
|
4937
4954
|
async function waitForEvmTransactionConfirmation(txHash, walletImplementation) {
|
|
4938
|
-
|
|
4955
|
+
import_ui_utils35.logger.info(SYSTEM_LOG_TAG3, `Waiting for tx: ${txHash}`);
|
|
4939
4956
|
try {
|
|
4940
4957
|
const resolvedPublicClient = await walletImplementation.getPublicClient();
|
|
4941
4958
|
if (!resolvedPublicClient) {
|
|
@@ -4944,15 +4961,15 @@ async function waitForEvmTransactionConfirmation(txHash, walletImplementation) {
|
|
|
4944
4961
|
const receipt = await resolvedPublicClient.waitForTransactionReceipt({
|
|
4945
4962
|
hash: txHash
|
|
4946
4963
|
});
|
|
4947
|
-
|
|
4964
|
+
import_ui_utils35.logger.info(SYSTEM_LOG_TAG3, "Received receipt:", receipt);
|
|
4948
4965
|
if (receipt.status === "success") {
|
|
4949
4966
|
return { status: "success", receipt };
|
|
4950
4967
|
} else {
|
|
4951
|
-
|
|
4968
|
+
import_ui_utils35.logger.error(SYSTEM_LOG_TAG3, "Transaction reverted:", receipt);
|
|
4952
4969
|
return { status: "error", receipt, error: new Error("Transaction reverted.") };
|
|
4953
4970
|
}
|
|
4954
4971
|
} catch (error) {
|
|
4955
|
-
|
|
4972
|
+
import_ui_utils35.logger.error(SYSTEM_LOG_TAG3, "Error waiting for transaction confirmation:", error);
|
|
4956
4973
|
return {
|
|
4957
4974
|
status: "error",
|
|
4958
4975
|
error: error instanceof Error ? error : new Error(String(error))
|
|
@@ -4962,9 +4979,9 @@ async function waitForEvmTransactionConfirmation(txHash, walletImplementation) {
|
|
|
4962
4979
|
|
|
4963
4980
|
// src/transaction/formatter.ts
|
|
4964
4981
|
var import_viem9 = require("viem");
|
|
4965
|
-
var
|
|
4982
|
+
var import_ui_utils36 = require("@openzeppelin/ui-utils");
|
|
4966
4983
|
function formatEvmTransactionData(contractSchema, functionId, submittedInputs, fields) {
|
|
4967
|
-
|
|
4984
|
+
import_ui_utils36.logger.info(
|
|
4968
4985
|
"formatEvmTransactionData",
|
|
4969
4986
|
`Formatting EVM transaction data for function: ${functionId}`
|
|
4970
4987
|
);
|
|
@@ -5002,7 +5019,7 @@ function formatEvmTransactionData(contractSchema, functionId, submittedInputs, f
|
|
|
5002
5019
|
const isPayable = functionDetails.stateMutability === "payable";
|
|
5003
5020
|
let transactionValue = 0n;
|
|
5004
5021
|
if (isPayable) {
|
|
5005
|
-
|
|
5022
|
+
import_ui_utils36.logger.warn(
|
|
5006
5023
|
"formatEvmTransactionData",
|
|
5007
5024
|
"Payable function detected, but sending 0 ETH. Implement value input."
|
|
5008
5025
|
);
|
|
@@ -5023,7 +5040,7 @@ function formatEvmTransactionData(contractSchema, functionId, submittedInputs, f
|
|
|
5023
5040
|
}
|
|
5024
5041
|
|
|
5025
5042
|
// src/transaction/eoa.ts
|
|
5026
|
-
var
|
|
5043
|
+
var import_ui_utils37 = require("@openzeppelin/ui-utils");
|
|
5027
5044
|
var SYSTEM_LOG_TAG4 = "EoaExecutionStrategy";
|
|
5028
5045
|
var EoaExecutionStrategy = class {
|
|
5029
5046
|
async execute(transactionData, executionConfig, walletImplementation, onStatusChange, _runtimeApiKey) {
|
|
@@ -5036,9 +5053,9 @@ var EoaExecutionStrategy = class {
|
|
|
5036
5053
|
if (validationResult !== true) {
|
|
5037
5054
|
throw new Error(validationResult);
|
|
5038
5055
|
}
|
|
5039
|
-
|
|
5056
|
+
import_ui_utils37.logger.info(SYSTEM_LOG_TAG4, "Using EOA execution strategy.");
|
|
5040
5057
|
try {
|
|
5041
|
-
|
|
5058
|
+
import_ui_utils37.logger.debug(SYSTEM_LOG_TAG4, "Calling walletClient.writeContract with:", {
|
|
5042
5059
|
account: accountStatus.address,
|
|
5043
5060
|
address: transactionData.address,
|
|
5044
5061
|
abi: transactionData.abi,
|
|
@@ -5057,10 +5074,10 @@ var EoaExecutionStrategy = class {
|
|
|
5057
5074
|
value: transactionData.value,
|
|
5058
5075
|
chain: walletClient.chain
|
|
5059
5076
|
});
|
|
5060
|
-
|
|
5077
|
+
import_ui_utils37.logger.info(SYSTEM_LOG_TAG4, "EOA Transaction initiated. Hash:", hash);
|
|
5061
5078
|
return { txHash: hash };
|
|
5062
5079
|
} catch (error) {
|
|
5063
|
-
|
|
5080
|
+
import_ui_utils37.logger.error(SYSTEM_LOG_TAG4, "Error during EOA writeContract call:", error);
|
|
5064
5081
|
const errorMessage = error instanceof Error ? error.message : "Unknown EOA transaction error";
|
|
5065
5082
|
throw new Error(`Transaction failed (EOA): ${errorMessage}`);
|
|
5066
5083
|
}
|
|
@@ -5068,12 +5085,12 @@ var EoaExecutionStrategy = class {
|
|
|
5068
5085
|
async getAuthenticatedWalletClient(walletImplementation) {
|
|
5069
5086
|
const walletClient = await walletImplementation.getWalletClient();
|
|
5070
5087
|
if (!walletClient) {
|
|
5071
|
-
|
|
5088
|
+
import_ui_utils37.logger.error(SYSTEM_LOG_TAG4, "Wallet client not available. Is wallet connected?");
|
|
5072
5089
|
throw new Error("Wallet is not connected or client is unavailable.");
|
|
5073
5090
|
}
|
|
5074
5091
|
const accountStatus = walletImplementation.getWalletConnectionStatus();
|
|
5075
5092
|
if (!accountStatus.isConnected || !accountStatus.address) {
|
|
5076
|
-
|
|
5093
|
+
import_ui_utils37.logger.error(SYSTEM_LOG_TAG4, "Account not available. Is wallet connected?");
|
|
5077
5094
|
throw new Error("Wallet is not connected or account address is unavailable.");
|
|
5078
5095
|
}
|
|
5079
5096
|
return { walletClient, accountStatus };
|
|
@@ -5082,17 +5099,17 @@ var EoaExecutionStrategy = class {
|
|
|
5082
5099
|
|
|
5083
5100
|
// src/transaction/components/EvmRelayerOptions.tsx
|
|
5084
5101
|
var import_react11 = __toESM(require("react"), 1);
|
|
5085
|
-
var
|
|
5102
|
+
var import_ui_components9 = require("@openzeppelin/ui-components");
|
|
5086
5103
|
|
|
5087
5104
|
// src/transaction/components/AdvancedInfo.tsx
|
|
5088
5105
|
var import_lucide_react5 = require("lucide-react");
|
|
5089
|
-
var
|
|
5106
|
+
var import_ui_components6 = require("@openzeppelin/ui-components");
|
|
5090
5107
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
5091
5108
|
var AdvancedInfo = ({ showAdvancedInfo, onToggle }) => {
|
|
5092
5109
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-2", children: [
|
|
5093
5110
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5094
5111
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-base font-medium", children: "Gas Pricing Strategy" }),
|
|
5095
|
-
/* @__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: [
|
|
5096
5113
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react5.Info, { className: "h-3 w-3 mr-1" }),
|
|
5097
5114
|
"API Requirements"
|
|
5098
5115
|
] })
|
|
@@ -5111,8 +5128,8 @@ var AdvancedInfo = ({ showAdvancedInfo, onToggle }) => {
|
|
|
5111
5128
|
|
|
5112
5129
|
// src/transaction/components/CustomGasParameters.tsx
|
|
5113
5130
|
var import_lucide_react6 = require("lucide-react");
|
|
5114
|
-
var
|
|
5115
|
-
var
|
|
5131
|
+
var import_ui_components7 = require("@openzeppelin/ui-components");
|
|
5132
|
+
var import_ui_utils38 = require("@openzeppelin/ui-utils");
|
|
5116
5133
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
5117
5134
|
var CustomGasParameters = ({
|
|
5118
5135
|
control,
|
|
@@ -5133,7 +5150,7 @@ var CustomGasParameters = ({
|
|
|
5133
5150
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3", children: [
|
|
5134
5151
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-muted-foreground font-medium uppercase tracking-wider", children: "Select Gas Pricing Method" }),
|
|
5135
5152
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
5136
|
-
|
|
5153
|
+
import_ui_components7.Accordion,
|
|
5137
5154
|
{
|
|
5138
5155
|
type: "single",
|
|
5139
5156
|
collapsible: true,
|
|
@@ -5142,15 +5159,15 @@ var CustomGasParameters = ({
|
|
|
5142
5159
|
className: "w-full space-y-3",
|
|
5143
5160
|
children: [
|
|
5144
5161
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
5145
|
-
|
|
5162
|
+
import_ui_components7.AccordionItem,
|
|
5146
5163
|
{
|
|
5147
5164
|
value: "eip1559",
|
|
5148
|
-
className: (0,
|
|
5165
|
+
className: (0, import_ui_utils38.cn)(
|
|
5149
5166
|
"rounded-lg border shadow-sm overflow-hidden transition-all",
|
|
5150
5167
|
gasType === "eip1559" ? "border-primary bg-primary/5" : "border-border bg-card hover:border-muted-foreground/50"
|
|
5151
5168
|
),
|
|
5152
5169
|
children: [
|
|
5153
|
-
/* @__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: [
|
|
5154
5171
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
5155
5172
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
|
|
5156
5173
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -5165,9 +5182,9 @@ var CustomGasParameters = ({
|
|
|
5165
5182
|
] }),
|
|
5166
5183
|
gasType === "eip1559" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs text-primary font-medium mr-2", children: "Selected" })
|
|
5167
5184
|
] }) }),
|
|
5168
|
-
/* @__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: [
|
|
5169
5186
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5170
|
-
|
|
5187
|
+
import_ui_components7.NumberField,
|
|
5171
5188
|
{
|
|
5172
5189
|
id: "maxFeePerGas",
|
|
5173
5190
|
label: "Max Fee Per Gas",
|
|
@@ -5181,7 +5198,7 @@ var CustomGasParameters = ({
|
|
|
5181
5198
|
}
|
|
5182
5199
|
),
|
|
5183
5200
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5184
|
-
|
|
5201
|
+
import_ui_components7.NumberField,
|
|
5185
5202
|
{
|
|
5186
5203
|
id: "maxPriorityFeePerGas",
|
|
5187
5204
|
label: "Max Priority Fee Per Gas",
|
|
@@ -5199,15 +5216,15 @@ var CustomGasParameters = ({
|
|
|
5199
5216
|
}
|
|
5200
5217
|
),
|
|
5201
5218
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
5202
|
-
|
|
5219
|
+
import_ui_components7.AccordionItem,
|
|
5203
5220
|
{
|
|
5204
5221
|
value: "legacy",
|
|
5205
|
-
className: (0,
|
|
5222
|
+
className: (0, import_ui_utils38.cn)(
|
|
5206
5223
|
"rounded-lg border shadow-sm overflow-hidden transition-all",
|
|
5207
5224
|
gasType === "legacy" ? "border-primary bg-primary/5" : "border-border bg-card hover:border-muted-foreground/50"
|
|
5208
5225
|
),
|
|
5209
5226
|
children: [
|
|
5210
|
-
/* @__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: [
|
|
5211
5228
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
5212
5229
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
|
|
5213
5230
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -5222,8 +5239,8 @@ var CustomGasParameters = ({
|
|
|
5222
5239
|
] }),
|
|
5223
5240
|
gasType === "legacy" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs text-primary font-medium mr-2", children: "Selected" })
|
|
5224
5241
|
] }) }),
|
|
5225
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5226
|
-
|
|
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,
|
|
5227
5244
|
{
|
|
5228
5245
|
id: "gasPrice",
|
|
5229
5246
|
label: "Gas Price",
|
|
@@ -5245,7 +5262,7 @@ var CustomGasParameters = ({
|
|
|
5245
5262
|
] }),
|
|
5246
5263
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-2", children: [
|
|
5247
5264
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5248
|
-
|
|
5265
|
+
import_ui_components7.BooleanField,
|
|
5249
5266
|
{
|
|
5250
5267
|
id: "showGasLimit",
|
|
5251
5268
|
label: "Override gas limit",
|
|
@@ -5255,7 +5272,7 @@ var CustomGasParameters = ({
|
|
|
5255
5272
|
}
|
|
5256
5273
|
),
|
|
5257
5274
|
showGasLimit && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "pl-6", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5258
|
-
|
|
5275
|
+
import_ui_components7.NumberField,
|
|
5259
5276
|
{
|
|
5260
5277
|
id: "gasLimit",
|
|
5261
5278
|
label: "Gas Limit",
|
|
@@ -5273,7 +5290,7 @@ var CustomGasParameters = ({
|
|
|
5273
5290
|
|
|
5274
5291
|
// src/transaction/components/SpeedSelection.tsx
|
|
5275
5292
|
var import_relayer_sdk2 = require("@openzeppelin/relayer-sdk");
|
|
5276
|
-
var
|
|
5293
|
+
var import_ui_components8 = require("@openzeppelin/ui-components");
|
|
5277
5294
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
5278
5295
|
var speedOptions = [
|
|
5279
5296
|
{
|
|
@@ -5300,7 +5317,7 @@ var speedOptions = [
|
|
|
5300
5317
|
];
|
|
5301
5318
|
var SpeedSelection = ({ selectedSpeed, onSpeedChange }) => {
|
|
5302
5319
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5303
|
-
|
|
5320
|
+
import_ui_components8.RadioGroup,
|
|
5304
5321
|
{
|
|
5305
5322
|
value: selectedSpeed || import_relayer_sdk2.Speed.FAST,
|
|
5306
5323
|
onValueChange: (value) => onSpeedChange(value),
|
|
@@ -5313,7 +5330,7 @@ var SpeedSelection = ({ selectedSpeed, onSpeedChange }) => {
|
|
|
5313
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" }),
|
|
5314
5331
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-start space-x-3", children: [
|
|
5315
5332
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5316
|
-
|
|
5333
|
+
import_ui_components8.RadioGroupItem,
|
|
5317
5334
|
{
|
|
5318
5335
|
value: option.value,
|
|
5319
5336
|
id: `speed-${option.value}`,
|
|
@@ -5477,13 +5494,13 @@ var EvmRelayerOptions = ({ options, onChange }) => {
|
|
|
5477
5494
|
onToggle: () => setShowAdvancedInfo(!showAdvancedInfo)
|
|
5478
5495
|
}
|
|
5479
5496
|
),
|
|
5480
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
5481
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
5482
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5483
|
-
/* @__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" })
|
|
5484
5501
|
] }),
|
|
5485
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5486
|
-
/* @__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)(
|
|
5487
5504
|
CustomGasParameters,
|
|
5488
5505
|
{
|
|
5489
5506
|
control,
|
|
@@ -5498,7 +5515,7 @@ var EvmRelayerOptions = ({ options, onChange }) => {
|
|
|
5498
5515
|
};
|
|
5499
5516
|
|
|
5500
5517
|
// src/wallet/utils/connection.ts
|
|
5501
|
-
var
|
|
5518
|
+
var import_ui_utils39 = require("@openzeppelin/ui-utils");
|
|
5502
5519
|
var LOG_SYSTEM3 = "adapter-evm-connection";
|
|
5503
5520
|
function evmSupportsWalletConnection() {
|
|
5504
5521
|
return true;
|
|
@@ -5506,7 +5523,7 @@ function evmSupportsWalletConnection() {
|
|
|
5506
5523
|
async function getEvmAvailableConnectors() {
|
|
5507
5524
|
const impl = await getEvmWalletImplementation();
|
|
5508
5525
|
if (!impl) {
|
|
5509
|
-
|
|
5526
|
+
import_ui_utils39.logger.warn(LOG_SYSTEM3, "getEvmAvailableConnectors: Wallet implementation not ready.");
|
|
5510
5527
|
return [];
|
|
5511
5528
|
}
|
|
5512
5529
|
return impl.getAvailableConnectors();
|
|
@@ -5514,7 +5531,7 @@ async function getEvmAvailableConnectors() {
|
|
|
5514
5531
|
async function connectAndEnsureCorrectNetwork(connectorId, targetChainId) {
|
|
5515
5532
|
const impl = await getEvmWalletImplementation();
|
|
5516
5533
|
if (!impl) {
|
|
5517
|
-
|
|
5534
|
+
import_ui_utils39.logger.error(LOG_SYSTEM3, "connectAndEnsureCorrectNetwork: Wallet implementation not ready.");
|
|
5518
5535
|
return { connected: false, error: "Wallet system not initialized." };
|
|
5519
5536
|
}
|
|
5520
5537
|
const connectionResult = await impl.connect(connectorId);
|
|
@@ -5522,7 +5539,7 @@ async function connectAndEnsureCorrectNetwork(connectorId, targetChainId) {
|
|
|
5522
5539
|
return { connected: false, error: connectionResult.error || "Connection failed" };
|
|
5523
5540
|
}
|
|
5524
5541
|
if (connectionResult.chainId !== targetChainId) {
|
|
5525
|
-
|
|
5542
|
+
import_ui_utils39.logger.info(
|
|
5526
5543
|
LOG_SYSTEM3,
|
|
5527
5544
|
`Connected to chain ${connectionResult.chainId}, but target is ${targetChainId}. Attempting switch.`
|
|
5528
5545
|
);
|
|
@@ -5531,23 +5548,23 @@ async function connectAndEnsureCorrectNetwork(connectorId, targetChainId) {
|
|
|
5531
5548
|
const postSwitchStatus = impl.getWalletConnectionStatus();
|
|
5532
5549
|
if (postSwitchStatus.chainId !== targetChainId) {
|
|
5533
5550
|
const switchError = `Failed to switch to target network ${targetChainId}. Current: ${postSwitchStatus.chainId}`;
|
|
5534
|
-
|
|
5551
|
+
import_ui_utils39.logger.error(LOG_SYSTEM3, switchError);
|
|
5535
5552
|
try {
|
|
5536
5553
|
await impl.disconnect();
|
|
5537
5554
|
} catch (e) {
|
|
5538
|
-
|
|
5555
|
+
import_ui_utils39.logger.warn(LOG_SYSTEM3, "Failed to disconnect after network switch failure.", e);
|
|
5539
5556
|
}
|
|
5540
5557
|
return { connected: false, error: switchError };
|
|
5541
5558
|
}
|
|
5542
|
-
|
|
5559
|
+
import_ui_utils39.logger.info(LOG_SYSTEM3, `Successfully switched to target chain ${targetChainId}.`);
|
|
5543
5560
|
return { ...connectionResult, chainId: postSwitchStatus.chainId };
|
|
5544
5561
|
} catch (error) {
|
|
5545
5562
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
5546
|
-
|
|
5563
|
+
import_ui_utils39.logger.error(LOG_SYSTEM3, "Network switch failed:", errorMessage);
|
|
5547
5564
|
try {
|
|
5548
5565
|
await impl.disconnect();
|
|
5549
5566
|
} catch (e) {
|
|
5550
|
-
|
|
5567
|
+
import_ui_utils39.logger.warn(LOG_SYSTEM3, "Failed to disconnect after network switch failure.", e);
|
|
5551
5568
|
}
|
|
5552
5569
|
return { connected: false, error: `Network switch failed: ${errorMessage}` };
|
|
5553
5570
|
}
|
|
@@ -5557,7 +5574,7 @@ async function connectAndEnsureCorrectNetwork(connectorId, targetChainId) {
|
|
|
5557
5574
|
async function disconnectEvmWallet() {
|
|
5558
5575
|
const impl = await getEvmWalletImplementation();
|
|
5559
5576
|
if (!impl) {
|
|
5560
|
-
|
|
5577
|
+
import_ui_utils39.logger.warn(LOG_SYSTEM3, "disconnectEvmWallet: Wallet implementation not ready.");
|
|
5561
5578
|
return { disconnected: false, error: "Wallet system not initialized." };
|
|
5562
5579
|
}
|
|
5563
5580
|
return impl.disconnect();
|
|
@@ -5565,7 +5582,7 @@ async function disconnectEvmWallet() {
|
|
|
5565
5582
|
function getEvmWalletConnectionStatus() {
|
|
5566
5583
|
const impl = getInitializedEvmWalletImplementation();
|
|
5567
5584
|
if (!impl) {
|
|
5568
|
-
|
|
5585
|
+
import_ui_utils39.logger.warn(
|
|
5569
5586
|
LOG_SYSTEM3,
|
|
5570
5587
|
"getEvmWalletConnectionStatus: Wallet implementation not ready. Returning default disconnected state."
|
|
5571
5588
|
);
|
|
@@ -5615,13 +5632,13 @@ var EvmAdapter = class {
|
|
|
5615
5632
|
throw new Error("EvmAdapter requires a valid EVM network configuration.");
|
|
5616
5633
|
}
|
|
5617
5634
|
this.networkConfig = networkConfig;
|
|
5618
|
-
|
|
5635
|
+
import_ui_utils40.logger.info(
|
|
5619
5636
|
"EvmAdapter",
|
|
5620
5637
|
`Adapter initialized for network: ${networkConfig.name} (ID: ${networkConfig.id})`
|
|
5621
5638
|
);
|
|
5622
5639
|
const initialGlobalConfig = loadInitialConfigFromAppService();
|
|
5623
5640
|
this.initialAppServiceKitName = initialGlobalConfig.kitName || "custom";
|
|
5624
|
-
|
|
5641
|
+
import_ui_utils40.logger.info(
|
|
5625
5642
|
"EvmAdapter:constructor",
|
|
5626
5643
|
"Initial kitName from AppConfigService noted:",
|
|
5627
5644
|
this.initialAppServiceKitName
|
|
@@ -5856,7 +5873,7 @@ var EvmAdapter = class {
|
|
|
5856
5873
|
onWalletConnectionChange(callback) {
|
|
5857
5874
|
const walletImplementation = getInitializedEvmWalletImplementation();
|
|
5858
5875
|
if (!walletImplementation) {
|
|
5859
|
-
|
|
5876
|
+
import_ui_utils40.logger.warn(
|
|
5860
5877
|
"EvmAdapter:onWalletConnectionChange",
|
|
5861
5878
|
"Wallet implementation not ready. Subscription may not work."
|
|
5862
5879
|
);
|
|
@@ -5911,7 +5928,7 @@ var EvmAdapter = class {
|
|
|
5911
5928
|
options
|
|
5912
5929
|
);
|
|
5913
5930
|
await evmUiKitManager.configure(finalFullConfig);
|
|
5914
|
-
|
|
5931
|
+
import_ui_utils40.logger.info(
|
|
5915
5932
|
"EvmAdapter:configureUiKit",
|
|
5916
5933
|
"EvmUiKitManager configuration requested with final config:",
|
|
5917
5934
|
finalFullConfig
|
|
@@ -5921,7 +5938,7 @@ var EvmAdapter = class {
|
|
|
5921
5938
|
* @inheritdoc
|
|
5922
5939
|
*/
|
|
5923
5940
|
getEcosystemReactUiContextProvider() {
|
|
5924
|
-
|
|
5941
|
+
import_ui_utils40.logger.info("EvmAdapter:getEcosystemReactUiContextProvider", "Returning EvmWalletUiRoot.");
|
|
5925
5942
|
return EvmWalletUiRoot;
|
|
5926
5943
|
}
|
|
5927
5944
|
/**
|
|
@@ -5945,7 +5962,7 @@ var EvmAdapter = class {
|
|
|
5945
5962
|
getEcosystemWalletComponents() {
|
|
5946
5963
|
const currentManagerState = evmUiKitManager.getState();
|
|
5947
5964
|
if (!currentManagerState.currentFullUiKitConfig) {
|
|
5948
|
-
|
|
5965
|
+
import_ui_utils40.logger.debug(
|
|
5949
5966
|
// Changed from warn to debug, as this can be normal during init sequence
|
|
5950
5967
|
"EvmAdapter:getEcosystemWalletComponents",
|
|
5951
5968
|
"No UI kit configuration available in manager yet. Returning undefined components."
|
|
@@ -6084,7 +6101,7 @@ Get your WalletConnect projectId from <a href="https://cloud.walletconnect.com"
|
|
|
6084
6101
|
summary: result.summary
|
|
6085
6102
|
};
|
|
6086
6103
|
} catch (error) {
|
|
6087
|
-
|
|
6104
|
+
import_ui_utils40.logger.error("EVM contract definition comparison failed:", error.message);
|
|
6088
6105
|
throw new Error(`Contract definition comparison failed: ${error.message}`);
|
|
6089
6106
|
}
|
|
6090
6107
|
}
|
|
@@ -6105,6 +6122,12 @@ Get your WalletConnect projectId from <a href="https://cloud.walletconnect.com"
|
|
|
6105
6122
|
hashContractDefinition(definition) {
|
|
6106
6123
|
return abiComparisonService.hashAbi(definition);
|
|
6107
6124
|
}
|
|
6125
|
+
/**
|
|
6126
|
+
* @inheritdoc
|
|
6127
|
+
*/
|
|
6128
|
+
getTypeMappingInfo() {
|
|
6129
|
+
return getEvmTypeMappingInfo();
|
|
6130
|
+
}
|
|
6108
6131
|
};
|
|
6109
6132
|
|
|
6110
6133
|
// src/config.ts
|