@openzeppelin/ui-builder-adapter-evm 1.0.0 → 1.3.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 +473 -375
- 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 +192 -100
- 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 +33 -14
- package/src/wallet/components/connect/ConnectButton.tsx +31 -17
- package/src/wallet/components/connect/ConnectorDialog.tsx +3 -6
- package/src/wallet/components/network/NetworkSwitcher.tsx +48 -16
- 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 +9 -7
- 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,
|
|
@@ -2081,27 +2081,44 @@ var ConnectorDialogContent = ({ open, onOpenChange }) => {
|
|
|
2081
2081
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2082
2082
|
var CustomConnectButton = ({
|
|
2083
2083
|
className,
|
|
2084
|
+
size,
|
|
2085
|
+
variant,
|
|
2086
|
+
fullWidth,
|
|
2084
2087
|
hideWhenConnected = true
|
|
2085
2088
|
}) => {
|
|
2086
2089
|
const [dialogOpen, setDialogOpen] = (0, import_react7.useState)(false);
|
|
2087
|
-
const
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2090
|
+
const sizeProps = (0, import_ui_utils9.getWalletButtonSizeProps)(size);
|
|
2091
|
+
const unavailableButton = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: (0, import_ui_utils9.cn)("flex items-center", fullWidth && "w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2092
|
+
import_ui_components2.Button,
|
|
2093
|
+
{
|
|
2094
|
+
disabled: true,
|
|
2095
|
+
variant: variant || "outline",
|
|
2096
|
+
size: sizeProps.size,
|
|
2097
|
+
className: (0, import_ui_utils9.cn)(sizeProps.className, fullWidth && "w-full"),
|
|
2098
|
+
children: [
|
|
2099
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Wallet, { className: (0, import_ui_utils9.cn)(sizeProps.iconSize, "mr-1") }),
|
|
2100
|
+
"Wallet Unavailable"
|
|
2101
|
+
]
|
|
2102
|
+
}
|
|
2103
|
+
) });
|
|
2091
2104
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SafeWagmiComponent, { fallback: unavailableButton, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2092
2105
|
ConnectButtonContent,
|
|
2093
2106
|
{
|
|
2094
2107
|
className,
|
|
2108
|
+
size,
|
|
2109
|
+
variant,
|
|
2110
|
+
fullWidth,
|
|
2095
2111
|
dialogOpen,
|
|
2096
2112
|
setDialogOpen,
|
|
2097
2113
|
hideWhenConnected
|
|
2098
2114
|
}
|
|
2099
2115
|
) });
|
|
2100
2116
|
};
|
|
2101
|
-
var ConnectButtonContent = ({ className, dialogOpen, setDialogOpen, hideWhenConnected }) => {
|
|
2102
|
-
const { isConnected } = (0,
|
|
2103
|
-
const { isConnecting: isHookConnecting, error: connectError } = (0,
|
|
2117
|
+
var ConnectButtonContent = ({ className, size, variant, fullWidth, dialogOpen, setDialogOpen, hideWhenConnected }) => {
|
|
2118
|
+
const { isConnected } = (0, import_ui_react2.useDerivedAccountStatus)();
|
|
2119
|
+
const { isConnecting: isHookConnecting, error: connectError } = (0, import_ui_react2.useDerivedConnectStatus)();
|
|
2104
2120
|
const [isManuallyInitiated, setIsManuallyInitiated] = (0, import_react7.useState)(false);
|
|
2121
|
+
const sizeProps = (0, import_ui_utils9.getWalletButtonSizeProps)(size);
|
|
2105
2122
|
(0, import_react7.useEffect)(() => {
|
|
2106
2123
|
if (isConnected && hideWhenConnected) {
|
|
2107
2124
|
setDialogOpen(false);
|
|
@@ -2128,18 +2145,18 @@ var ConnectButtonContent = ({ className, dialogOpen, setDialogOpen, hideWhenConn
|
|
|
2128
2145
|
return null;
|
|
2129
2146
|
}
|
|
2130
2147
|
const showButtonLoading = isHookConnecting || isManuallyInitiated;
|
|
2131
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0,
|
|
2148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0, import_ui_utils9.cn)("flex items-center", fullWidth && "w-full", className), children: [
|
|
2132
2149
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2133
|
-
|
|
2150
|
+
import_ui_components2.Button,
|
|
2134
2151
|
{
|
|
2135
2152
|
onClick: handleConnectClick,
|
|
2136
2153
|
disabled: showButtonLoading || isConnected,
|
|
2137
|
-
variant: "outline",
|
|
2138
|
-
size:
|
|
2139
|
-
className:
|
|
2154
|
+
variant: variant || "outline",
|
|
2155
|
+
size: sizeProps.size,
|
|
2156
|
+
className: (0, import_ui_utils9.cn)(sizeProps.className, fullWidth && "w-full"),
|
|
2140
2157
|
title: isConnected ? "Connected" : connectError?.message || "Connect Wallet",
|
|
2141
2158
|
children: [
|
|
2142
|
-
showButtonLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Loader2, { className:
|
|
2159
|
+
showButtonLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Loader2, { className: (0, import_ui_utils9.cn)(sizeProps.iconSize, "animate-spin mr-1") }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Wallet, { className: (0, import_ui_utils9.cn)(sizeProps.iconSize, "mr-1") }),
|
|
2143
2160
|
showButtonLoading ? "Connecting..." : "Connect Wallet"
|
|
2144
2161
|
]
|
|
2145
2162
|
}
|
|
@@ -2161,33 +2178,52 @@ var ConnectButtonContent = ({ className, dialogOpen, setDialogOpen, hideWhenConn
|
|
|
2161
2178
|
|
|
2162
2179
|
// src/wallet/components/account/AccountDisplay.tsx
|
|
2163
2180
|
var import_lucide_react2 = require("lucide-react");
|
|
2164
|
-
var
|
|
2165
|
-
var
|
|
2166
|
-
var
|
|
2181
|
+
var import_ui_components3 = require("@openzeppelin/ui-components");
|
|
2182
|
+
var import_ui_react3 = require("@openzeppelin/ui-react");
|
|
2183
|
+
var import_ui_utils10 = require("@openzeppelin/ui-utils");
|
|
2167
2184
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2168
|
-
var CustomAccountDisplay = ({
|
|
2169
|
-
|
|
2185
|
+
var CustomAccountDisplay = ({
|
|
2186
|
+
className,
|
|
2187
|
+
size,
|
|
2188
|
+
variant,
|
|
2189
|
+
fullWidth
|
|
2190
|
+
}) => {
|
|
2191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SafeWagmiComponent, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2192
|
+
AccountDisplayContent,
|
|
2193
|
+
{
|
|
2194
|
+
className,
|
|
2195
|
+
size,
|
|
2196
|
+
variant,
|
|
2197
|
+
fullWidth
|
|
2198
|
+
}
|
|
2199
|
+
) });
|
|
2170
2200
|
};
|
|
2171
|
-
var AccountDisplayContent = ({
|
|
2172
|
-
|
|
2173
|
-
|
|
2201
|
+
var AccountDisplayContent = ({
|
|
2202
|
+
className,
|
|
2203
|
+
size,
|
|
2204
|
+
variant,
|
|
2205
|
+
fullWidth
|
|
2206
|
+
}) => {
|
|
2207
|
+
const { isConnected, address, chainId } = (0, import_ui_react3.useDerivedAccountStatus)();
|
|
2208
|
+
const { disconnect: disconnect2 } = (0, import_ui_react3.useDerivedDisconnect)();
|
|
2209
|
+
const sizeProps = (0, import_ui_utils10.getWalletAccountDisplaySizeProps)(size);
|
|
2174
2210
|
if (!isConnected || !address || !disconnect2) {
|
|
2175
2211
|
return null;
|
|
2176
2212
|
}
|
|
2177
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0,
|
|
2178
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col", children: [
|
|
2179
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "
|
|
2180
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-
|
|
2213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_ui_utils10.cn)("flex items-center gap-2", fullWidth && "w-full", className), children: [
|
|
2214
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_ui_utils10.cn)("flex flex-col", fullWidth && "flex-1"), children: [
|
|
2215
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: (0, import_ui_utils10.cn)(sizeProps.textSize, "font-medium"), children: (0, import_ui_utils10.truncateMiddle)(address, 4, 4) }),
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: (0, import_ui_utils10.cn)(sizeProps.subTextSize, "text-muted-foreground -mt-0.5"), children: chainId ? `Chain ID: ${chainId}` : "Chain ID: N/A" })
|
|
2181
2217
|
] }),
|
|
2182
2218
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2183
|
-
|
|
2219
|
+
import_ui_components3.Button,
|
|
2184
2220
|
{
|
|
2185
2221
|
onClick: () => disconnect2(),
|
|
2186
|
-
variant: "ghost",
|
|
2222
|
+
variant: variant || "ghost",
|
|
2187
2223
|
size: "icon",
|
|
2188
|
-
className: "
|
|
2224
|
+
className: (0, import_ui_utils10.cn)(sizeProps.iconButtonSize, "p-0"),
|
|
2189
2225
|
title: "Disconnect wallet",
|
|
2190
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.LogOut, { className:
|
|
2226
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react2.LogOut, { className: sizeProps.iconSize })
|
|
2191
2227
|
}
|
|
2192
2228
|
)
|
|
2193
2229
|
] });
|
|
@@ -2195,17 +2231,37 @@ var AccountDisplayContent = ({ className }) => {
|
|
|
2195
2231
|
|
|
2196
2232
|
// src/wallet/components/network/NetworkSwitcher.tsx
|
|
2197
2233
|
var import_lucide_react3 = require("lucide-react");
|
|
2198
|
-
var
|
|
2199
|
-
var
|
|
2200
|
-
var
|
|
2234
|
+
var import_ui_components4 = require("@openzeppelin/ui-components");
|
|
2235
|
+
var import_ui_react4 = require("@openzeppelin/ui-react");
|
|
2236
|
+
var import_ui_utils11 = require("@openzeppelin/ui-utils");
|
|
2201
2237
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2202
|
-
var CustomNetworkSwitcher = ({
|
|
2203
|
-
|
|
2238
|
+
var CustomNetworkSwitcher = ({
|
|
2239
|
+
className,
|
|
2240
|
+
size,
|
|
2241
|
+
variant,
|
|
2242
|
+
fullWidth
|
|
2243
|
+
}) => {
|
|
2244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SafeWagmiComponent, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2245
|
+
NetworkSwitcherContent,
|
|
2246
|
+
{
|
|
2247
|
+
className,
|
|
2248
|
+
size,
|
|
2249
|
+
variant,
|
|
2250
|
+
fullWidth
|
|
2251
|
+
}
|
|
2252
|
+
) });
|
|
2204
2253
|
};
|
|
2205
|
-
var NetworkSwitcherContent = ({
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2254
|
+
var NetworkSwitcherContent = ({
|
|
2255
|
+
className,
|
|
2256
|
+
size,
|
|
2257
|
+
variant,
|
|
2258
|
+
fullWidth
|
|
2259
|
+
}) => {
|
|
2260
|
+
const { isConnected } = (0, import_ui_react4.useDerivedAccountStatus)();
|
|
2261
|
+
const { currentChainId, availableChains: unknownChains } = (0, import_ui_react4.useDerivedChainInfo)();
|
|
2262
|
+
const { switchChain: switchChain2, isSwitching: isPending, error } = (0, import_ui_react4.useDerivedSwitchChainStatus)();
|
|
2263
|
+
const sizeProps = (0, import_ui_utils11.getWalletNetworkSwitcherSizeProps)(size);
|
|
2264
|
+
const variantClassName = (0, import_ui_utils11.getWalletNetworkSwitcherVariantClassName)(variant);
|
|
2209
2265
|
const typedAvailableChains = unknownChains;
|
|
2210
2266
|
if (!isConnected || !switchChain2 || typedAvailableChains.length === 0) {
|
|
2211
2267
|
return null;
|
|
@@ -2217,29 +2273,47 @@ var NetworkSwitcherContent = ({ className }) => {
|
|
|
2217
2273
|
};
|
|
2218
2274
|
const currentChain = typedAvailableChains.find((chain) => chain.id === currentChainId);
|
|
2219
2275
|
const currentChainName = currentChain?.name || "Network";
|
|
2220
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0,
|
|
2276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_ui_utils11.cn)("flex items-center", fullWidth && "w-full", className), children: [
|
|
2221
2277
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2222
|
-
|
|
2278
|
+
import_ui_components4.Select,
|
|
2223
2279
|
{
|
|
2224
2280
|
value: currentChainId?.toString() ?? "",
|
|
2225
2281
|
onValueChange: (value) => handleNetworkChange(Number(value)),
|
|
2226
2282
|
disabled: isPending || typedAvailableChains.length === 0,
|
|
2227
2283
|
children: [
|
|
2228
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui_builder_ui4.SelectTrigger, { className: "h-8 text-xs px-2 min-w-[90px] max-w-[120px]", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui_builder_ui4.SelectValue, { placeholder: "Network", children: currentChainName }) }),
|
|
2229
2284
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2230
|
-
|
|
2285
|
+
import_ui_components4.SelectTrigger,
|
|
2286
|
+
{
|
|
2287
|
+
className: (0, import_ui_utils11.cn)(
|
|
2288
|
+
sizeProps.triggerClassName,
|
|
2289
|
+
variantClassName,
|
|
2290
|
+
fullWidth && "w-full max-w-none"
|
|
2291
|
+
),
|
|
2292
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui_components4.SelectValue, { placeholder: "Network", children: currentChainName })
|
|
2293
|
+
}
|
|
2294
|
+
),
|
|
2295
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2296
|
+
import_ui_components4.SelectContent,
|
|
2231
2297
|
{
|
|
2232
2298
|
position: "popper",
|
|
2233
2299
|
sideOffset: 5,
|
|
2234
2300
|
align: "start",
|
|
2235
2301
|
className: "w-auto min-w-[160px] max-h-[300px]",
|
|
2236
|
-
children: typedAvailableChains.map((chain) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2302
|
+
children: typedAvailableChains.map((chain) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2303
|
+
import_ui_components4.SelectItem,
|
|
2304
|
+
{
|
|
2305
|
+
value: chain.id.toString(),
|
|
2306
|
+
className: sizeProps.itemClassName,
|
|
2307
|
+
children: chain.name
|
|
2308
|
+
},
|
|
2309
|
+
chain.id
|
|
2310
|
+
))
|
|
2237
2311
|
}
|
|
2238
2312
|
)
|
|
2239
2313
|
]
|
|
2240
2314
|
}
|
|
2241
2315
|
),
|
|
2242
|
-
isPending && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-
|
|
2316
|
+
isPending && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-muted-foreground ml-2", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.Loader2, { className: (0, import_ui_utils11.cn)(sizeProps.loaderSize, "animate-spin") }) }),
|
|
2243
2317
|
error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-xs text-red-500 ml-2", children: "!" })
|
|
2244
2318
|
] });
|
|
2245
2319
|
};
|
|
@@ -2297,7 +2371,7 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2297
2371
|
if (isMounted) {
|
|
2298
2372
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
2299
2373
|
setIsLoadingComponent(false);
|
|
2300
|
-
|
|
2374
|
+
import_ui_utils12.logger.error("RainbowKitConnectButton", "Failed to load RainbowKit ConnectButton:", err);
|
|
2301
2375
|
}
|
|
2302
2376
|
}
|
|
2303
2377
|
};
|
|
@@ -2309,21 +2383,22 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2309
2383
|
}
|
|
2310
2384
|
};
|
|
2311
2385
|
}, []);
|
|
2386
|
+
const sizeProps = (0, import_ui_utils12.getWalletButtonSizeProps)(props.size);
|
|
2312
2387
|
const renderLoadingPlaceholder = (message) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
2313
|
-
|
|
2388
|
+
import_ui_components5.Button,
|
|
2314
2389
|
{
|
|
2315
2390
|
disabled: true,
|
|
2316
|
-
variant: "outline",
|
|
2317
|
-
size:
|
|
2318
|
-
className: (0,
|
|
2391
|
+
variant: props.variant || "outline",
|
|
2392
|
+
size: sizeProps.size,
|
|
2393
|
+
className: (0, import_ui_utils12.cn)(sizeProps.className, props.fullWidth && "w-full", props.className),
|
|
2319
2394
|
children: [
|
|
2320
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.Loader2, { className:
|
|
2395
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.Loader2, { className: (0, import_ui_utils12.cn)(sizeProps.iconSize, "animate-spin mr-1.5") }),
|
|
2321
2396
|
message
|
|
2322
2397
|
]
|
|
2323
2398
|
}
|
|
2324
2399
|
);
|
|
2325
2400
|
if (error) {
|
|
2326
|
-
|
|
2401
|
+
import_ui_utils12.logger.warn(
|
|
2327
2402
|
"RainbowKitConnectButton",
|
|
2328
2403
|
"Error loading RainbowKit ConnectButton. Displaying fallback CustomConnectButton."
|
|
2329
2404
|
);
|
|
@@ -2336,7 +2411,7 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2336
2411
|
return renderLoadingPlaceholder("Initializing Provider...");
|
|
2337
2412
|
}
|
|
2338
2413
|
if (!Component) {
|
|
2339
|
-
|
|
2414
|
+
import_ui_utils12.logger.warn("RainbowKitConnectButton", "Component is null after loading phase, falling back.");
|
|
2340
2415
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CustomConnectButton, { ...props });
|
|
2341
2416
|
}
|
|
2342
2417
|
const kitConfig = managerState.currentFullUiKitConfig?.kitConfig;
|
|
@@ -2348,7 +2423,7 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2348
2423
|
...props
|
|
2349
2424
|
// Allow props to override configuration
|
|
2350
2425
|
};
|
|
2351
|
-
|
|
2426
|
+
import_ui_utils12.logger.debug("RainbowKitConnectButton", "Rendering with configuration:", {
|
|
2352
2427
|
configFromFile: connectButtonConfig,
|
|
2353
2428
|
finalProps
|
|
2354
2429
|
});
|
|
@@ -2356,20 +2431,20 @@ var RainbowKitConnectButton = (props) => {
|
|
|
2356
2431
|
};
|
|
2357
2432
|
|
|
2358
2433
|
// src/wallet/rainbowkit/utils.ts
|
|
2359
|
-
var
|
|
2434
|
+
var import_ui_utils13 = require("@openzeppelin/ui-utils");
|
|
2360
2435
|
function validateRainbowKitConfig(kitConfig) {
|
|
2361
|
-
|
|
2436
|
+
import_ui_utils13.logger.debug(
|
|
2362
2437
|
"validateRainbowKitConfig",
|
|
2363
2438
|
"Received kitConfig for validation:",
|
|
2364
2439
|
JSON.stringify(kitConfig)
|
|
2365
2440
|
);
|
|
2366
2441
|
if (!kitConfig) {
|
|
2367
|
-
|
|
2442
|
+
import_ui_utils13.logger.warn("validateRainbowKitConfig", "Validation failed: No kitConfig provided.");
|
|
2368
2443
|
return { isValid: false, error: "No kitConfig provided for RainbowKit" };
|
|
2369
2444
|
}
|
|
2370
2445
|
const wagmiParamsFromKitConfig = kitConfig.wagmiParams;
|
|
2371
2446
|
if (!wagmiParamsFromKitConfig || typeof wagmiParamsFromKitConfig !== "object" || wagmiParamsFromKitConfig === null) {
|
|
2372
|
-
|
|
2447
|
+
import_ui_utils13.logger.warn(
|
|
2373
2448
|
"validateRainbowKitConfig",
|
|
2374
2449
|
"Validation failed: kitConfig.wagmiParams is missing or invalid.",
|
|
2375
2450
|
{ wagmiParamsFromKitConfig }
|
|
@@ -2385,14 +2460,14 @@ function validateRainbowKitConfig(kitConfig) {
|
|
|
2385
2460
|
}
|
|
2386
2461
|
if (missingFields.length > 0) {
|
|
2387
2462
|
const errorMsg = `Missing or invalid required fields in wagmiParams: ${missingFields.join(", ")}`;
|
|
2388
|
-
|
|
2463
|
+
import_ui_utils13.logger.warn("validateRainbowKitConfig", "Validation failed:", errorMsg, { missingFields });
|
|
2389
2464
|
return {
|
|
2390
2465
|
isValid: false,
|
|
2391
2466
|
missingFields,
|
|
2392
2467
|
error: errorMsg
|
|
2393
2468
|
};
|
|
2394
2469
|
}
|
|
2395
|
-
|
|
2470
|
+
import_ui_utils13.logger.debug("validateRainbowKitConfig", "Validation successful.");
|
|
2396
2471
|
return { isValid: true };
|
|
2397
2472
|
}
|
|
2398
2473
|
|
|
@@ -2407,12 +2482,12 @@ function createRainbowKitComponents() {
|
|
|
2407
2482
|
|
|
2408
2483
|
// src/wallet/rainbowkit/config-service.ts
|
|
2409
2484
|
var import_core = require("@wagmi/core");
|
|
2410
|
-
var
|
|
2485
|
+
var import_ui_utils14 = require("@openzeppelin/ui-utils");
|
|
2411
2486
|
async function createRainbowKitWagmiConfig(userFullNativeConfig, chains, chainIdToNetworkIdMap, getRpcEndpointOverride) {
|
|
2412
2487
|
try {
|
|
2413
2488
|
const { getDefaultConfig } = await import("@rainbow-me/rainbowkit");
|
|
2414
2489
|
if (!getDefaultConfig) {
|
|
2415
|
-
|
|
2490
|
+
import_ui_utils14.logger.error(
|
|
2416
2491
|
"rainbowkit/config-service",
|
|
2417
2492
|
"Failed to import getDefaultConfig from RainbowKit"
|
|
2418
2493
|
);
|
|
@@ -2420,21 +2495,21 @@ async function createRainbowKitWagmiConfig(userFullNativeConfig, chains, chainId
|
|
|
2420
2495
|
}
|
|
2421
2496
|
const wagmiParams = userFullNativeConfig?.wagmiParams;
|
|
2422
2497
|
if (!wagmiParams) {
|
|
2423
|
-
|
|
2498
|
+
import_ui_utils14.logger.warn(
|
|
2424
2499
|
"rainbowkit/config-service",
|
|
2425
2500
|
"Resolved kitConfig does not contain a `wagmiParams` object. Cannot create RainbowKit Wagmi config."
|
|
2426
2501
|
);
|
|
2427
2502
|
return null;
|
|
2428
2503
|
}
|
|
2429
2504
|
if (typeof wagmiParams.appName !== "string" || !wagmiParams.appName) {
|
|
2430
|
-
|
|
2505
|
+
import_ui_utils14.logger.warn(
|
|
2431
2506
|
"rainbowkit/config-service",
|
|
2432
2507
|
"kitConfig.wagmiParams is missing or has invalid `appName`."
|
|
2433
2508
|
);
|
|
2434
2509
|
return null;
|
|
2435
2510
|
}
|
|
2436
2511
|
if (typeof wagmiParams.projectId !== "string" || !wagmiParams.projectId) {
|
|
2437
|
-
|
|
2512
|
+
import_ui_utils14.logger.warn(
|
|
2438
2513
|
"rainbowkit/config-service",
|
|
2439
2514
|
"kitConfig.wagmiParams is missing or has invalid `projectId`."
|
|
2440
2515
|
);
|
|
@@ -2457,7 +2532,7 @@ async function createRainbowKitWagmiConfig(userFullNativeConfig, chains, chainId
|
|
|
2457
2532
|
}
|
|
2458
2533
|
}
|
|
2459
2534
|
if (httpRpcOverride) {
|
|
2460
|
-
|
|
2535
|
+
import_ui_utils14.logger.info(
|
|
2461
2536
|
"rainbowkit/config-service",
|
|
2462
2537
|
`Using overridden RPC for chain ${chainDefinition.name}: ${httpRpcOverride}`
|
|
2463
2538
|
);
|
|
@@ -2478,20 +2553,20 @@ async function createRainbowKitWagmiConfig(userFullNativeConfig, chains, chainId
|
|
|
2478
2553
|
// Adapter controls this
|
|
2479
2554
|
};
|
|
2480
2555
|
const config = getDefaultConfig(finalConfigOptions);
|
|
2481
|
-
|
|
2556
|
+
import_ui_utils14.logger.info(
|
|
2482
2557
|
"rainbowkit/config-service",
|
|
2483
2558
|
"Successfully created RainbowKit Wagmi config object.",
|
|
2484
2559
|
config
|
|
2485
2560
|
);
|
|
2486
2561
|
return config;
|
|
2487
2562
|
} catch (error) {
|
|
2488
|
-
|
|
2563
|
+
import_ui_utils14.logger.error("rainbowkit/config-service", "Error creating RainbowKit Wagmi config:", error);
|
|
2489
2564
|
return null;
|
|
2490
2565
|
}
|
|
2491
2566
|
}
|
|
2492
2567
|
async function getWagmiConfigForRainbowKit(uiKitConfiguration, chains, chainIdToNetworkIdMap, getRpcEndpointOverride) {
|
|
2493
2568
|
if (!uiKitConfiguration || uiKitConfiguration.kitName !== "rainbowkit" || !uiKitConfiguration.kitConfig) {
|
|
2494
|
-
|
|
2569
|
+
import_ui_utils14.logger.debug(
|
|
2495
2570
|
"rainbowkit/config-service",
|
|
2496
2571
|
"Not configured for RainbowKit or kitConfig (resolved native + programmatic) is missing."
|
|
2497
2572
|
);
|
|
@@ -2511,7 +2586,7 @@ async function getWagmiConfigForRainbowKit(uiKitConfiguration, chains, chainIdTo
|
|
|
2511
2586
|
var LOG_SYSTEM = "WagmiWalletImplementation";
|
|
2512
2587
|
var getSupportedChainsFromNetworks = () => {
|
|
2513
2588
|
const chains = evmNetworks.filter((network) => network.viemChain).map((network) => network.viemChain).filter((chain, index, self) => self.findIndex((c) => c.id === chain.id) === index);
|
|
2514
|
-
|
|
2589
|
+
import_ui_utils15.logger.info(
|
|
2515
2590
|
LOG_SYSTEM,
|
|
2516
2591
|
`Generated supported chains from network configurations: ${chains.length} chains`,
|
|
2517
2592
|
chains.map((c) => ({ id: c.id, name: c.name }))
|
|
@@ -2526,7 +2601,7 @@ var getChainIdToNetworkIdMapping = () => {
|
|
|
2526
2601
|
},
|
|
2527
2602
|
{}
|
|
2528
2603
|
);
|
|
2529
|
-
|
|
2604
|
+
import_ui_utils15.logger.info(
|
|
2530
2605
|
LOG_SYSTEM,
|
|
2531
2606
|
"Generated chain ID to network ID mapping from network configurations:",
|
|
2532
2607
|
mapping
|
|
@@ -2551,13 +2626,13 @@ var WagmiWalletImplementation = class {
|
|
|
2551
2626
|
__publicField(this, "walletConnectProjectId");
|
|
2552
2627
|
__publicField(this, "rpcConfigUnsubscribe");
|
|
2553
2628
|
this.walletConnectProjectId = walletConnectProjectIdFromAppConfig;
|
|
2554
|
-
|
|
2629
|
+
import_ui_utils15.logger.info(
|
|
2555
2630
|
LOG_SYSTEM,
|
|
2556
2631
|
"Constructor called. Initial anticipated kitName:",
|
|
2557
2632
|
initialUiKitConfig?.kitName
|
|
2558
2633
|
);
|
|
2559
2634
|
this.initialized = true;
|
|
2560
|
-
|
|
2635
|
+
import_ui_utils15.logger.info(
|
|
2561
2636
|
LOG_SYSTEM,
|
|
2562
2637
|
"WagmiWalletImplementation instance initialized (Wagmi config creation deferred)."
|
|
2563
2638
|
);
|
|
@@ -2568,10 +2643,10 @@ var WagmiWalletImplementation = class {
|
|
|
2568
2643
|
* when user changes RPC settings.
|
|
2569
2644
|
*/
|
|
2570
2645
|
setupRpcConfigListener() {
|
|
2571
|
-
import("@openzeppelin/ui-
|
|
2646
|
+
import("@openzeppelin/ui-utils").then(({ userRpcConfigService }) => {
|
|
2572
2647
|
this.rpcConfigUnsubscribe = userRpcConfigService.subscribe("*", (event) => {
|
|
2573
2648
|
if (event.type === "rpc-config-changed" || event.type === "rpc-config-cleared") {
|
|
2574
|
-
|
|
2649
|
+
import_ui_utils15.logger.info(
|
|
2575
2650
|
LOG_SYSTEM,
|
|
2576
2651
|
`RPC config changed for network ${event.networkId}. Invalidating cached Wagmi config.`
|
|
2577
2652
|
);
|
|
@@ -2579,7 +2654,7 @@ var WagmiWalletImplementation = class {
|
|
|
2579
2654
|
}
|
|
2580
2655
|
});
|
|
2581
2656
|
}).catch((error) => {
|
|
2582
|
-
|
|
2657
|
+
import_ui_utils15.logger.error(LOG_SYSTEM, "Failed to setup RPC config listener:", error);
|
|
2583
2658
|
});
|
|
2584
2659
|
}
|
|
2585
2660
|
/**
|
|
@@ -2602,14 +2677,14 @@ var WagmiWalletImplementation = class {
|
|
|
2602
2677
|
* @param config - The Wagmi Config object to set as active, or null to clear it.
|
|
2603
2678
|
*/
|
|
2604
2679
|
setActiveWagmiConfig(config) {
|
|
2605
|
-
|
|
2680
|
+
import_ui_utils15.logger.info(
|
|
2606
2681
|
LOG_SYSTEM,
|
|
2607
2682
|
"setActiveWagmiConfig called with config:",
|
|
2608
2683
|
config ? "Valid Config" : "Null"
|
|
2609
2684
|
);
|
|
2610
2685
|
this.activeWagmiConfig = config;
|
|
2611
2686
|
if (this.unsubscribe) {
|
|
2612
|
-
|
|
2687
|
+
import_ui_utils15.logger.warn(
|
|
2613
2688
|
LOG_SYSTEM,
|
|
2614
2689
|
"setActiveWagmiConfig: Active WagmiConfig instance has changed. Existing direct watchAccount subscription (via onWalletConnectionChange) may be stale and operating on an old config instance."
|
|
2615
2690
|
);
|
|
@@ -2626,9 +2701,9 @@ var WagmiWalletImplementation = class {
|
|
|
2626
2701
|
const baseConnectors = [(0, import_connectors.injected)(), (0, import_connectors.metaMask)(), (0, import_connectors.safe)()];
|
|
2627
2702
|
if (this.walletConnectProjectId?.trim()) {
|
|
2628
2703
|
baseConnectors.push((0, import_connectors.walletConnect)({ projectId: this.walletConnectProjectId }));
|
|
2629
|
-
|
|
2704
|
+
import_ui_utils15.logger.info(LOG_SYSTEM, "WalletConnect connector added to DEFAULT config.");
|
|
2630
2705
|
} else {
|
|
2631
|
-
|
|
2706
|
+
import_ui_utils15.logger.warn(
|
|
2632
2707
|
LOG_SYSTEM,
|
|
2633
2708
|
"WalletConnect Project ID not provided; WC connector unavailable for DEFAULT config."
|
|
2634
2709
|
);
|
|
@@ -2640,7 +2715,7 @@ var WagmiWalletImplementation = class {
|
|
|
2640
2715
|
if (appNetworkIdString) {
|
|
2641
2716
|
let httpRpcOverride = getUserRpcUrl(appNetworkIdString);
|
|
2642
2717
|
if (!httpRpcOverride) {
|
|
2643
|
-
const rpcOverrideSetting =
|
|
2718
|
+
const rpcOverrideSetting = import_ui_utils15.appConfigService.getRpcEndpointOverride(appNetworkIdString);
|
|
2644
2719
|
if (typeof rpcOverrideSetting === "string") {
|
|
2645
2720
|
httpRpcOverride = rpcOverrideSetting;
|
|
2646
2721
|
} else if (typeof rpcOverrideSetting === "object") {
|
|
@@ -2652,7 +2727,7 @@ var WagmiWalletImplementation = class {
|
|
|
2652
2727
|
}
|
|
2653
2728
|
}
|
|
2654
2729
|
if (httpRpcOverride) {
|
|
2655
|
-
|
|
2730
|
+
import_ui_utils15.logger.info(
|
|
2656
2731
|
LOG_SYSTEM,
|
|
2657
2732
|
`Using overridden RPC for chain ${chainDefinition.name} (default config): ${httpRpcOverride}`
|
|
2658
2733
|
);
|
|
@@ -2670,10 +2745,10 @@ var WagmiWalletImplementation = class {
|
|
|
2670
2745
|
connectors: baseConnectors,
|
|
2671
2746
|
transports: transportsConfig
|
|
2672
2747
|
});
|
|
2673
|
-
|
|
2748
|
+
import_ui_utils15.logger.info(LOG_SYSTEM, "Default Wagmi config created successfully on demand.");
|
|
2674
2749
|
return defaultConfig2;
|
|
2675
2750
|
} catch (error) {
|
|
2676
|
-
|
|
2751
|
+
import_ui_utils15.logger.error(LOG_SYSTEM, "Error creating default Wagmi config on demand:", error);
|
|
2677
2752
|
return (0, import_core2.createConfig)({
|
|
2678
2753
|
chains: [defaultSupportedChains[0]],
|
|
2679
2754
|
connectors: [(0, import_connectors.injected)()],
|
|
@@ -2691,7 +2766,7 @@ var WagmiWalletImplementation = class {
|
|
|
2691
2766
|
if (userRpcUrl) {
|
|
2692
2767
|
return { http: userRpcUrl };
|
|
2693
2768
|
}
|
|
2694
|
-
const rpcOverrideSetting =
|
|
2769
|
+
const rpcOverrideSetting = import_ui_utils15.appConfigService.getRpcEndpointOverride(networkId);
|
|
2695
2770
|
if (typeof rpcOverrideSetting === "string") {
|
|
2696
2771
|
return rpcOverrideSetting;
|
|
2697
2772
|
} else if (typeof rpcOverrideSetting === "object" && rpcOverrideSetting !== null) {
|
|
@@ -2718,20 +2793,20 @@ var WagmiWalletImplementation = class {
|
|
|
2718
2793
|
*/
|
|
2719
2794
|
async getConfigForRainbowKit(currentAdapterUiKitConfig) {
|
|
2720
2795
|
if (!this.initialized) {
|
|
2721
|
-
|
|
2796
|
+
import_ui_utils15.logger.error(
|
|
2722
2797
|
LOG_SYSTEM,
|
|
2723
2798
|
"getConfigForRainbowKit called before implementation initialization."
|
|
2724
2799
|
);
|
|
2725
2800
|
return null;
|
|
2726
2801
|
}
|
|
2727
2802
|
if (currentAdapterUiKitConfig?.kitName !== "rainbowkit") {
|
|
2728
|
-
|
|
2803
|
+
import_ui_utils15.logger.warn(
|
|
2729
2804
|
LOG_SYSTEM,
|
|
2730
2805
|
"getConfigForRainbowKit called, but kitName is not rainbowkit. Returning null."
|
|
2731
2806
|
);
|
|
2732
2807
|
return null;
|
|
2733
2808
|
}
|
|
2734
|
-
|
|
2809
|
+
import_ui_utils15.logger.info(
|
|
2735
2810
|
LOG_SYSTEM,
|
|
2736
2811
|
"getConfigForRainbowKit: Kit is RainbowKit. Proceeding to create/get config. CurrentAdapterUiKitConfig:",
|
|
2737
2812
|
currentAdapterUiKitConfig
|
|
@@ -2743,10 +2818,10 @@ var WagmiWalletImplementation = class {
|
|
|
2743
2818
|
this.getRpcOverrideForRainbowKit.bind(this)
|
|
2744
2819
|
);
|
|
2745
2820
|
if (rainbowKitWagmiConfig) {
|
|
2746
|
-
|
|
2821
|
+
import_ui_utils15.logger.info(LOG_SYSTEM, "Returning RainbowKit-specific Wagmi config for provider.");
|
|
2747
2822
|
return rainbowKitWagmiConfig;
|
|
2748
2823
|
}
|
|
2749
|
-
|
|
2824
|
+
import_ui_utils15.logger.warn(LOG_SYSTEM, "RainbowKit specific Wagmi config creation failed.");
|
|
2750
2825
|
return null;
|
|
2751
2826
|
}
|
|
2752
2827
|
/**
|
|
@@ -2758,7 +2833,7 @@ var WagmiWalletImplementation = class {
|
|
|
2758
2833
|
*/
|
|
2759
2834
|
async getActiveConfigForManager(uiKitConfig2) {
|
|
2760
2835
|
if (!this.initialized) {
|
|
2761
|
-
|
|
2836
|
+
import_ui_utils15.logger.error(
|
|
2762
2837
|
LOG_SYSTEM,
|
|
2763
2838
|
"getActiveConfigForManager called before initialization! Creating fallback."
|
|
2764
2839
|
);
|
|
@@ -2770,7 +2845,7 @@ var WagmiWalletImplementation = class {
|
|
|
2770
2845
|
if (uiKitConfig2?.kitName === "rainbowkit") {
|
|
2771
2846
|
const rkConfig = await this.getConfigForRainbowKit(uiKitConfig2);
|
|
2772
2847
|
if (rkConfig) return rkConfig;
|
|
2773
|
-
|
|
2848
|
+
import_ui_utils15.logger.warn(
|
|
2774
2849
|
LOG_SYSTEM,
|
|
2775
2850
|
"getActiveConfigForManager: RainbowKit config failed, falling back to default."
|
|
2776
2851
|
);
|
|
@@ -2788,7 +2863,7 @@ var WagmiWalletImplementation = class {
|
|
|
2788
2863
|
* @returns The current default or active Wagmi Config object.
|
|
2789
2864
|
*/
|
|
2790
2865
|
getConfig() {
|
|
2791
|
-
|
|
2866
|
+
import_ui_utils15.logger.warn(
|
|
2792
2867
|
LOG_SYSTEM,
|
|
2793
2868
|
"getConfig() is deprecated. Internal calls should use activeWagmiConfig if set, or ensure default is created."
|
|
2794
2869
|
);
|
|
@@ -2806,10 +2881,10 @@ var WagmiWalletImplementation = class {
|
|
|
2806
2881
|
* @returns The current account status from Wagmi.
|
|
2807
2882
|
*/
|
|
2808
2883
|
getWalletConnectionStatus() {
|
|
2809
|
-
|
|
2884
|
+
import_ui_utils15.logger.debug(LOG_SYSTEM, "getWalletConnectionStatus called.");
|
|
2810
2885
|
const configToUse = this.activeWagmiConfig || this.defaultInstanceConfig || (this.defaultInstanceConfig = this.createDefaultConfig());
|
|
2811
2886
|
if (!configToUse) {
|
|
2812
|
-
|
|
2887
|
+
import_ui_utils15.logger.error(LOG_SYSTEM, "No config available for getWalletConnectionStatus!");
|
|
2813
2888
|
return {
|
|
2814
2889
|
isConnected: false,
|
|
2815
2890
|
isConnecting: false,
|
|
@@ -2835,17 +2910,17 @@ var WagmiWalletImplementation = class {
|
|
|
2835
2910
|
*/
|
|
2836
2911
|
onWalletConnectionChange(callback) {
|
|
2837
2912
|
if (!this.initialized) {
|
|
2838
|
-
|
|
2913
|
+
import_ui_utils15.logger.warn(LOG_SYSTEM, "onWalletConnectionChange called before initialization. No-op.");
|
|
2839
2914
|
return () => {
|
|
2840
2915
|
};
|
|
2841
2916
|
}
|
|
2842
2917
|
if (this.unsubscribe) {
|
|
2843
2918
|
this.unsubscribe();
|
|
2844
|
-
|
|
2919
|
+
import_ui_utils15.logger.debug(LOG_SYSTEM, "Previous watchAccount unsubscribed.");
|
|
2845
2920
|
}
|
|
2846
2921
|
const configToUse = this.activeWagmiConfig || this.defaultInstanceConfig || (this.defaultInstanceConfig = this.createDefaultConfig());
|
|
2847
2922
|
if (!configToUse) {
|
|
2848
|
-
|
|
2923
|
+
import_ui_utils15.logger.error(
|
|
2849
2924
|
LOG_SYSTEM,
|
|
2850
2925
|
"No config available for onWalletConnectionChange! Subscription not set."
|
|
2851
2926
|
);
|
|
@@ -2853,7 +2928,7 @@ var WagmiWalletImplementation = class {
|
|
|
2853
2928
|
};
|
|
2854
2929
|
}
|
|
2855
2930
|
this.unsubscribe = (0, import_core2.watchAccount)(configToUse, { onChange: callback });
|
|
2856
|
-
|
|
2931
|
+
import_ui_utils15.logger.info(
|
|
2857
2932
|
LOG_SYSTEM,
|
|
2858
2933
|
"watchAccount subscription established/re-established using config:",
|
|
2859
2934
|
configToUse === this.activeWagmiConfig ? "activeExternal" : "defaultInstance"
|
|
@@ -2867,7 +2942,7 @@ var WagmiWalletImplementation = class {
|
|
|
2867
2942
|
*/
|
|
2868
2943
|
async getWalletClient() {
|
|
2869
2944
|
if (!this.initialized || !this.activeWagmiConfig) {
|
|
2870
|
-
|
|
2945
|
+
import_ui_utils15.logger.warn(
|
|
2871
2946
|
LOG_SYSTEM,
|
|
2872
2947
|
"getWalletClient: Not initialized or no activeWagmiConfig. Returning null."
|
|
2873
2948
|
);
|
|
@@ -2888,7 +2963,7 @@ var WagmiWalletImplementation = class {
|
|
|
2888
2963
|
*/
|
|
2889
2964
|
async getPublicClient() {
|
|
2890
2965
|
if (!this.initialized || !this.activeWagmiConfig) {
|
|
2891
|
-
|
|
2966
|
+
import_ui_utils15.logger.warn(
|
|
2892
2967
|
LOG_SYSTEM,
|
|
2893
2968
|
"getPublicClient: Not initialized or no activeWagmiConfig. Returning null."
|
|
2894
2969
|
);
|
|
@@ -2897,7 +2972,7 @@ var WagmiWalletImplementation = class {
|
|
|
2897
2972
|
const accountStatus = (0, import_core2.getAccount)(this.activeWagmiConfig);
|
|
2898
2973
|
const currentChainId = accountStatus.chainId;
|
|
2899
2974
|
if (!currentChainId) {
|
|
2900
|
-
|
|
2975
|
+
import_ui_utils15.logger.warn(
|
|
2901
2976
|
LOG_SYSTEM,
|
|
2902
2977
|
"getPublicClient: No connected chainId available from accountStatus. Returning null."
|
|
2903
2978
|
);
|
|
@@ -2908,19 +2983,19 @@ var WagmiWalletImplementation = class {
|
|
|
2908
2983
|
chainId: currentChainId
|
|
2909
2984
|
});
|
|
2910
2985
|
if (publicClient) {
|
|
2911
|
-
|
|
2986
|
+
import_ui_utils15.logger.info(
|
|
2912
2987
|
LOG_SYSTEM,
|
|
2913
2988
|
`getPublicClient: Successfully retrieved public client for chainId ${currentChainId}.`
|
|
2914
2989
|
);
|
|
2915
2990
|
return publicClient;
|
|
2916
2991
|
}
|
|
2917
|
-
|
|
2992
|
+
import_ui_utils15.logger.warn(
|
|
2918
2993
|
LOG_SYSTEM,
|
|
2919
2994
|
`getPublicClient: getWagmiCorePublicClient returned undefined/null for chainId ${currentChainId}.`
|
|
2920
2995
|
);
|
|
2921
2996
|
return null;
|
|
2922
2997
|
} catch (error) {
|
|
2923
|
-
|
|
2998
|
+
import_ui_utils15.logger.error(LOG_SYSTEM, "Error getting public client from wagmi/core:", error);
|
|
2924
2999
|
return null;
|
|
2925
3000
|
}
|
|
2926
3001
|
}
|
|
@@ -2983,18 +3058,18 @@ async function getEvmWalletImplementation() {
|
|
|
2983
3058
|
}
|
|
2984
3059
|
walletImplementationPromise = (async () => {
|
|
2985
3060
|
try {
|
|
2986
|
-
|
|
2987
|
-
const initialUiKitConfig =
|
|
3061
|
+
import_ui_utils16.logger.info(LOG_SYSTEM2, "Initializing WagmiWalletImplementation singleton (async)... ");
|
|
3062
|
+
const initialUiKitConfig = import_ui_utils16.appConfigService.getTypedNestedConfig(
|
|
2988
3063
|
"walletui",
|
|
2989
3064
|
"config"
|
|
2990
3065
|
);
|
|
2991
|
-
const wcProjectId =
|
|
3066
|
+
const wcProjectId = import_ui_utils16.appConfigService.getGlobalServiceParam("walletconnect", "projectId");
|
|
2992
3067
|
const instance = new WagmiWalletImplementation(wcProjectId, initialUiKitConfig);
|
|
2993
|
-
|
|
3068
|
+
import_ui_utils16.logger.info(LOG_SYSTEM2, "WagmiWalletImplementation singleton created (async).");
|
|
2994
3069
|
walletImplementationInstance = instance;
|
|
2995
3070
|
return instance;
|
|
2996
3071
|
} catch (error) {
|
|
2997
|
-
|
|
3072
|
+
import_ui_utils16.logger.error(LOG_SYSTEM2, "Failed to initialize WagmiWalletImplementation (async):", error);
|
|
2998
3073
|
const fallbackInstance = new WagmiWalletImplementation();
|
|
2999
3074
|
walletImplementationInstance = fallbackInstance;
|
|
3000
3075
|
return fallbackInstance;
|
|
@@ -3004,7 +3079,7 @@ async function getEvmWalletImplementation() {
|
|
|
3004
3079
|
}
|
|
3005
3080
|
function getInitializedEvmWalletImplementation() {
|
|
3006
3081
|
if (!walletImplementationInstance) {
|
|
3007
|
-
|
|
3082
|
+
import_ui_utils16.logger.warn(
|
|
3008
3083
|
LOG_SYSTEM2,
|
|
3009
3084
|
"getInitializedEvmWalletImplementation called before instance was ready."
|
|
3010
3085
|
);
|
|
@@ -3028,7 +3103,7 @@ function notifyListeners() {
|
|
|
3028
3103
|
try {
|
|
3029
3104
|
listener();
|
|
3030
3105
|
} catch (error) {
|
|
3031
|
-
|
|
3106
|
+
import_ui_utils18.logger.error("EvmUiKitManager", "Error in listener:", error);
|
|
3032
3107
|
}
|
|
3033
3108
|
});
|
|
3034
3109
|
}
|
|
@@ -3042,7 +3117,7 @@ function getState() {
|
|
|
3042
3117
|
return { ...state };
|
|
3043
3118
|
}
|
|
3044
3119
|
async function configure(newFullUiKitConfig) {
|
|
3045
|
-
|
|
3120
|
+
import_ui_utils18.logger.info("EvmUiKitManager:configure", "Configuring UI kit. New config:", newFullUiKitConfig);
|
|
3046
3121
|
const oldKitName = state.currentFullUiKitConfig?.kitName;
|
|
3047
3122
|
const newKitName = newFullUiKitConfig.kitName;
|
|
3048
3123
|
const kitChanged = oldKitName !== newKitName;
|
|
@@ -3060,7 +3135,7 @@ async function configure(newFullUiKitConfig) {
|
|
|
3060
3135
|
try {
|
|
3061
3136
|
if (newKitName === "rainbowkit") {
|
|
3062
3137
|
if (kitChanged || !state.kitProviderComponent || !state.isKitAssetsLoaded) {
|
|
3063
|
-
|
|
3138
|
+
import_ui_utils18.logger.info("EvmUiKitManager:configure", "Ensuring RainbowKit assets are loaded...");
|
|
3064
3139
|
const { ensureRainbowKitAssetsLoaded: ensureRainbowKitAssetsLoaded2 } = await Promise.resolve().then(() => (init_rainbowkitAssetManager(), rainbowkitAssetManager_exports));
|
|
3065
3140
|
const rkAssets = await ensureRainbowKitAssetsLoaded2();
|
|
3066
3141
|
state.kitProviderComponent = rkAssets.ProviderComponent;
|
|
@@ -3070,16 +3145,16 @@ async function configure(newFullUiKitConfig) {
|
|
|
3070
3145
|
}
|
|
3071
3146
|
}
|
|
3072
3147
|
newWagmiConfigAttempt = await evmImpl.getConfigForRainbowKit(newFullUiKitConfig);
|
|
3073
|
-
|
|
3148
|
+
import_ui_utils18.logger.info("EvmUiKitManager:configure", "WagmiConfig for RainbowKit obtained.");
|
|
3074
3149
|
} else if (newKitName === "custom" || !newKitName) {
|
|
3075
3150
|
newWagmiConfigAttempt = await evmImpl.getActiveConfigForManager(newFullUiKitConfig);
|
|
3076
|
-
|
|
3151
|
+
import_ui_utils18.logger.info("EvmUiKitManager:configure", "ActiveConfig for custom/default obtained.");
|
|
3077
3152
|
if (kitChanged) {
|
|
3078
3153
|
state.kitProviderComponent = null;
|
|
3079
3154
|
state.isKitAssetsLoaded = false;
|
|
3080
3155
|
}
|
|
3081
3156
|
} else {
|
|
3082
|
-
|
|
3157
|
+
import_ui_utils18.logger.warn("EvmUiKitManager:configure", `Unsupported kitName: ${newKitName}.`);
|
|
3083
3158
|
state.kitProviderComponent = null;
|
|
3084
3159
|
state.isKitAssetsLoaded = false;
|
|
3085
3160
|
}
|
|
@@ -3088,16 +3163,16 @@ async function configure(newFullUiKitConfig) {
|
|
|
3088
3163
|
state.error = null;
|
|
3089
3164
|
if (!newWagmiConfigAttempt && newKitName && newKitName !== "none" && newKitName !== "custom") {
|
|
3090
3165
|
state.error = new Error(`Failed to obtain WagmiConfig for ${newKitName}`);
|
|
3091
|
-
|
|
3166
|
+
import_ui_utils18.logger.error("EvmUiKitManager:configure", state.error.message);
|
|
3092
3167
|
}
|
|
3093
3168
|
} catch (err) {
|
|
3094
|
-
|
|
3169
|
+
import_ui_utils18.logger.error("EvmUiKitManager:configure", "Error during UI kit configuration process:", err);
|
|
3095
3170
|
state.error = err instanceof Error ? err : new Error(String(err));
|
|
3096
3171
|
state.wagmiConfig = null;
|
|
3097
3172
|
evmImpl.setActiveWagmiConfig(null);
|
|
3098
3173
|
} finally {
|
|
3099
3174
|
state.isInitializing = false;
|
|
3100
|
-
|
|
3175
|
+
import_ui_utils18.logger.info(
|
|
3101
3176
|
"EvmUiKitManager:configure",
|
|
3102
3177
|
"Configuration attempt finished. Final wagmiConfig:",
|
|
3103
3178
|
state.wagmiConfig ? "Set" : "Null",
|
|
@@ -3158,13 +3233,13 @@ var EvmWalletUiRoot = ({ children }) => {
|
|
|
3158
3233
|
const DynKitProvider = kitProviderComponent;
|
|
3159
3234
|
const kitConfig = currentFullUiKitConfig.kitConfig || {};
|
|
3160
3235
|
const providerProps = kitConfig.providerProps || {};
|
|
3161
|
-
|
|
3236
|
+
import_ui_utils19.logger.info(
|
|
3162
3237
|
"EvmWalletUiRoot",
|
|
3163
3238
|
"Wrapping children with dynamically loaded KitProvider (RainbowKit)."
|
|
3164
3239
|
);
|
|
3165
3240
|
finalChildren = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DynKitProvider, { ...providerProps, children });
|
|
3166
3241
|
} else if (currentFullUiKitConfig?.kitName === "rainbowkit" && !isWagmiContextEffectivelyReady) {
|
|
3167
|
-
|
|
3242
|
+
import_ui_utils19.logger.info(
|
|
3168
3243
|
"EvmWalletUiRoot",
|
|
3169
3244
|
"RainbowKit configured, but context or assets not ready. Button may show its loading/error state."
|
|
3170
3245
|
);
|
|
@@ -3273,28 +3348,28 @@ function generateRainbowKitExportables(uiKitConfig2) {
|
|
|
3273
3348
|
}
|
|
3274
3349
|
|
|
3275
3350
|
// src/wallet/services/configResolutionService.ts
|
|
3276
|
-
var
|
|
3351
|
+
var import_ui_utils23 = require("@openzeppelin/ui-utils");
|
|
3277
3352
|
|
|
3278
3353
|
// src/wallet/utils.ts
|
|
3279
|
-
var
|
|
3354
|
+
var import_ui_utils22 = require("@openzeppelin/ui-utils");
|
|
3280
3355
|
|
|
3281
3356
|
// src/wallet/utils/uiKitService.ts
|
|
3282
|
-
var
|
|
3357
|
+
var import_ui_utils21 = require("@openzeppelin/ui-utils");
|
|
3283
3358
|
|
|
3284
3359
|
// src/wallet/utils/filterWalletComponents.ts
|
|
3285
|
-
var
|
|
3286
|
-
var
|
|
3360
|
+
var import_ui_types = require("@openzeppelin/ui-types");
|
|
3361
|
+
var import_ui_utils20 = require("@openzeppelin/ui-utils");
|
|
3287
3362
|
function filterWalletComponents(allPossibleComponents, exclusions, kitName = "custom") {
|
|
3288
|
-
|
|
3363
|
+
import_ui_utils20.logger.debug(
|
|
3289
3364
|
"filterWalletComponents",
|
|
3290
3365
|
`Filtering components for kit: ${kitName}. Exclusions: ${exclusions.join(", ")}.`
|
|
3291
3366
|
);
|
|
3292
3367
|
if (!allPossibleComponents || Object.keys(allPossibleComponents).length === 0) {
|
|
3293
|
-
|
|
3368
|
+
import_ui_utils20.logger.debug("filterWalletComponents", `No components provided to filter for kit: ${kitName}.`);
|
|
3294
3369
|
return void 0;
|
|
3295
3370
|
}
|
|
3296
3371
|
if (exclusions.length === 0) {
|
|
3297
|
-
|
|
3372
|
+
import_ui_utils20.logger.debug(
|
|
3298
3373
|
"filterWalletComponents",
|
|
3299
3374
|
`Providing all components for kit: ${kitName}.`,
|
|
3300
3375
|
allPossibleComponents
|
|
@@ -3313,14 +3388,14 @@ function filterWalletComponents(allPossibleComponents, exclusions, kitName = "cu
|
|
|
3313
3388
|
}
|
|
3314
3389
|
}
|
|
3315
3390
|
if (componentCount > 0) {
|
|
3316
|
-
|
|
3391
|
+
import_ui_utils20.logger.debug(
|
|
3317
3392
|
"filterWalletComponents",
|
|
3318
3393
|
`Providing filtered components for kit: ${kitName} after exclusions (${exclusions.join(", ")}).`,
|
|
3319
3394
|
filteredComponents
|
|
3320
3395
|
);
|
|
3321
3396
|
return filteredComponents;
|
|
3322
3397
|
}
|
|
3323
|
-
|
|
3398
|
+
import_ui_utils20.logger.debug("filterWalletComponents", `All components were excluded for kit: ${kitName}.`);
|
|
3324
3399
|
return void 0;
|
|
3325
3400
|
}
|
|
3326
3401
|
function getComponentExclusionsFromConfig(kitConfig) {
|
|
@@ -3328,7 +3403,7 @@ function getComponentExclusionsFromConfig(kitConfig) {
|
|
|
3328
3403
|
const componentsCfg = kitConfig.components;
|
|
3329
3404
|
if (componentsCfg && typeof componentsCfg === "object" && "exclude" in componentsCfg && Array.isArray(componentsCfg.exclude)) {
|
|
3330
3405
|
return componentsCfg.exclude.filter(
|
|
3331
|
-
(key) => typeof key === "string" &&
|
|
3406
|
+
(key) => typeof key === "string" && import_ui_types.ECOSYSTEM_WALLET_COMPONENT_KEYS.includes(key)
|
|
3332
3407
|
);
|
|
3333
3408
|
}
|
|
3334
3409
|
}
|
|
@@ -3337,21 +3412,21 @@ function getComponentExclusionsFromConfig(kitConfig) {
|
|
|
3337
3412
|
|
|
3338
3413
|
// src/wallet/utils/uiKitService.ts
|
|
3339
3414
|
function getResolvedWalletComponents(uiKitConfiguration) {
|
|
3340
|
-
|
|
3415
|
+
import_ui_utils21.logger.debug(
|
|
3341
3416
|
"uiKitService:getResolvedWalletComponents",
|
|
3342
3417
|
"Received uiKitConfiguration:",
|
|
3343
3418
|
JSON.stringify(uiKitConfiguration)
|
|
3344
3419
|
);
|
|
3345
3420
|
const currentKitName = uiKitConfiguration.kitName || "custom";
|
|
3346
3421
|
if (currentKitName === "none") {
|
|
3347
|
-
|
|
3422
|
+
import_ui_utils21.logger.info(
|
|
3348
3423
|
"uiKitService",
|
|
3349
3424
|
'UI Kit set to "none" for getResolvedWalletComponents, not providing wallet components.'
|
|
3350
3425
|
);
|
|
3351
3426
|
return void 0;
|
|
3352
3427
|
}
|
|
3353
3428
|
const exclusions = getComponentExclusionsFromConfig(uiKitConfiguration.kitConfig);
|
|
3354
|
-
|
|
3429
|
+
import_ui_utils21.logger.debug(
|
|
3355
3430
|
"uiKitService",
|
|
3356
3431
|
`Extracted component exclusions for ${currentKitName}: ${exclusions.join(", ") || "none"}.`
|
|
3357
3432
|
);
|
|
@@ -3366,17 +3441,17 @@ function getResolvedWalletComponents(uiKitConfiguration) {
|
|
|
3366
3441
|
if (currentKitName === "rainbowkit") {
|
|
3367
3442
|
const validation = validateRainbowKitConfig(uiKitConfiguration.kitConfig);
|
|
3368
3443
|
if (!validation.isValid) {
|
|
3369
|
-
|
|
3444
|
+
import_ui_utils21.logger.warn(
|
|
3370
3445
|
"uiKitService",
|
|
3371
3446
|
`Invalid RainbowKit configuration for components: ${validation.error}. No components provided.`
|
|
3372
3447
|
);
|
|
3373
3448
|
return void 0;
|
|
3374
3449
|
}
|
|
3375
3450
|
const rainbowKitComponents = createRainbowKitComponents();
|
|
3376
|
-
|
|
3451
|
+
import_ui_utils21.logger.info("uiKitService", "Providing RainbowKit components.");
|
|
3377
3452
|
return filterWalletComponents(rainbowKitComponents, exclusions, currentKitName);
|
|
3378
3453
|
}
|
|
3379
|
-
|
|
3454
|
+
import_ui_utils21.logger.warn(
|
|
3380
3455
|
"uiKitService",
|
|
3381
3456
|
`UI Kit "${currentKitName}" for getResolvedWalletComponents not explicitly supported. No components provided.`
|
|
3382
3457
|
);
|
|
@@ -3388,7 +3463,7 @@ function getResolvedWalletComponents2(uiKitConfig2) {
|
|
|
3388
3463
|
return getResolvedWalletComponents(uiKitConfig2);
|
|
3389
3464
|
}
|
|
3390
3465
|
async function resolveAndInitializeKitConfig(kitName, programmaticKitConfig, loadConfigModule) {
|
|
3391
|
-
|
|
3466
|
+
import_ui_utils22.logger.debug(
|
|
3392
3467
|
"resolveAndInitializeKitConfig",
|
|
3393
3468
|
`Resolving native config for kit: ${kitName || "none"}`,
|
|
3394
3469
|
{
|
|
@@ -3402,7 +3477,7 @@ async function resolveAndInitializeKitConfig(kitName, programmaticKitConfig, loa
|
|
|
3402
3477
|
try {
|
|
3403
3478
|
userNativeConfig = await loadConfigModule(conventionalConfigPath);
|
|
3404
3479
|
} catch (error) {
|
|
3405
|
-
|
|
3480
|
+
import_ui_utils22.logger.warn(
|
|
3406
3481
|
"resolveAndInitializeKitConfig",
|
|
3407
3482
|
`Call to load native config for ${kitName} from ${conventionalConfigPath} failed. Error:`,
|
|
3408
3483
|
error
|
|
@@ -3417,7 +3492,7 @@ async function resolveAndInitializeKitConfig(kitName, programmaticKitConfig, loa
|
|
|
3417
3492
|
} else if (programmaticKitConfig) {
|
|
3418
3493
|
return programmaticKitConfig;
|
|
3419
3494
|
}
|
|
3420
|
-
|
|
3495
|
+
import_ui_utils22.logger.debug(
|
|
3421
3496
|
"resolveAndInitializeKitConfig",
|
|
3422
3497
|
`No native or programmatic kitConfig provided for ${kitName || "none"}. Returning null.`
|
|
3423
3498
|
);
|
|
@@ -3426,7 +3501,7 @@ async function resolveAndInitializeKitConfig(kitName, programmaticKitConfig, loa
|
|
|
3426
3501
|
|
|
3427
3502
|
// src/wallet/services/configResolutionService.ts
|
|
3428
3503
|
async function resolveFullUiKitConfiguration(programmaticOverrides, initialAppServiceKitName, currentAppServiceConfig, options) {
|
|
3429
|
-
|
|
3504
|
+
import_ui_utils23.logger.debug(
|
|
3430
3505
|
"configResolutionService:resolveFullUiKitConfiguration",
|
|
3431
3506
|
"Starting resolution with:",
|
|
3432
3507
|
{
|
|
@@ -3453,7 +3528,7 @@ async function resolveFullUiKitConfiguration(programmaticOverrides, initialAppSe
|
|
|
3453
3528
|
// Pass through customCode for export purposes only
|
|
3454
3529
|
customCode: programmaticOverrides.customCode
|
|
3455
3530
|
};
|
|
3456
|
-
|
|
3531
|
+
import_ui_utils23.logger.debug(
|
|
3457
3532
|
"configResolutionService:resolveFullUiKitConfiguration",
|
|
3458
3533
|
"Resolved finalFullConfig:",
|
|
3459
3534
|
finalFullConfig
|
|
@@ -3462,19 +3537,19 @@ async function resolveFullUiKitConfiguration(programmaticOverrides, initialAppSe
|
|
|
3462
3537
|
}
|
|
3463
3538
|
|
|
3464
3539
|
// src/abi/etherscan.ts
|
|
3465
|
-
var
|
|
3540
|
+
var import_ui_utils24 = require("@openzeppelin/ui-utils");
|
|
3466
3541
|
async function loadAbiFromEtherscan(address, networkConfig) {
|
|
3467
3542
|
if (shouldUseV2Api(networkConfig)) {
|
|
3468
|
-
|
|
3543
|
+
import_ui_utils24.logger.info("loadAbiFromEtherscan", "Using V2 API for fetching ABI");
|
|
3469
3544
|
return loadAbiFromEtherscanV2(address, networkConfig);
|
|
3470
3545
|
}
|
|
3471
|
-
|
|
3546
|
+
import_ui_utils24.logger.info("loadAbiFromEtherscan", "Using V1 API for fetching ABI");
|
|
3472
3547
|
return loadAbiFromEtherscanV1(address, networkConfig);
|
|
3473
3548
|
}
|
|
3474
3549
|
async function loadAbiFromEtherscanV1(address, networkConfig) {
|
|
3475
3550
|
const explorerConfig = resolveExplorerConfig(networkConfig);
|
|
3476
3551
|
if (!explorerConfig.apiUrl) {
|
|
3477
|
-
|
|
3552
|
+
import_ui_utils24.logger.error(
|
|
3478
3553
|
"loadAbiFromEtherscanV1",
|
|
3479
3554
|
`API URL is missing for ${networkConfig.name} explorer.`
|
|
3480
3555
|
);
|
|
@@ -3489,20 +3564,20 @@ async function loadAbiFromEtherscanV1(address, networkConfig) {
|
|
|
3489
3564
|
}
|
|
3490
3565
|
let response;
|
|
3491
3566
|
try {
|
|
3492
|
-
|
|
3567
|
+
import_ui_utils24.logger.info(
|
|
3493
3568
|
"loadAbiFromEtherscanV1",
|
|
3494
3569
|
`Fetching ABI from ${explorerConfig.apiUrl} for address: ${address}`
|
|
3495
3570
|
);
|
|
3496
3571
|
response = await fetch(url);
|
|
3497
3572
|
} catch (networkError) {
|
|
3498
|
-
|
|
3573
|
+
import_ui_utils24.logger.error(
|
|
3499
3574
|
"loadAbiFromEtherscanV1",
|
|
3500
3575
|
`Network error fetching ABI from Explorer API: ${networkError}`
|
|
3501
3576
|
);
|
|
3502
3577
|
throw new Error(`Network error fetching ABI: ${networkError.message}`);
|
|
3503
3578
|
}
|
|
3504
3579
|
if (!response.ok) {
|
|
3505
|
-
|
|
3580
|
+
import_ui_utils24.logger.error(
|
|
3506
3581
|
"loadAbiFromEtherscanV1",
|
|
3507
3582
|
`Explorer API request failed with status: ${response.status}`
|
|
3508
3583
|
);
|
|
@@ -3512,14 +3587,14 @@ async function loadAbiFromEtherscanV1(address, networkConfig) {
|
|
|
3512
3587
|
try {
|
|
3513
3588
|
apiResult = await response.json();
|
|
3514
3589
|
} catch (jsonError) {
|
|
3515
|
-
|
|
3590
|
+
import_ui_utils24.logger.error(
|
|
3516
3591
|
"loadAbiFromEtherscanV1",
|
|
3517
3592
|
`Failed to parse Explorer API response as JSON: ${jsonError}`
|
|
3518
3593
|
);
|
|
3519
3594
|
throw new Error("Invalid JSON response received from Explorer API.");
|
|
3520
3595
|
}
|
|
3521
3596
|
if (apiResult.status !== "1") {
|
|
3522
|
-
|
|
3597
|
+
import_ui_utils24.logger.warn(
|
|
3523
3598
|
"loadAbiFromEtherscanV1",
|
|
3524
3599
|
`Explorer API error: Status ${apiResult.status}, Message: ${apiResult.message}, Result: ${apiResult.result}`
|
|
3525
3600
|
);
|
|
@@ -3538,13 +3613,13 @@ async function loadAbiFromEtherscanV1(address, networkConfig) {
|
|
|
3538
3613
|
throw new Error("Parsed ABI from Explorer API is not an array.");
|
|
3539
3614
|
}
|
|
3540
3615
|
} catch (error) {
|
|
3541
|
-
|
|
3616
|
+
import_ui_utils24.logger.error(
|
|
3542
3617
|
"loadAbiFromEtherscanV1",
|
|
3543
3618
|
`Failed to parse ABI JSON string from Explorer API result: ${error}`
|
|
3544
3619
|
);
|
|
3545
3620
|
throw new Error(`Invalid ABI JSON received from Explorer API: ${error.message}`);
|
|
3546
3621
|
}
|
|
3547
|
-
|
|
3622
|
+
import_ui_utils24.logger.info(
|
|
3548
3623
|
"loadAbiFromEtherscanV1",
|
|
3549
3624
|
`Successfully parsed ABI for ${networkConfig.name} with ${abi.length} items.`
|
|
3550
3625
|
);
|
|
@@ -3558,17 +3633,17 @@ async function loadAbiFromEtherscanV1(address, networkConfig) {
|
|
|
3558
3633
|
|
|
3559
3634
|
// src/abi/loader.ts
|
|
3560
3635
|
var import_viem5 = require("viem");
|
|
3561
|
-
var
|
|
3636
|
+
var import_ui_utils29 = require("@openzeppelin/ui-utils");
|
|
3562
3637
|
|
|
3563
3638
|
// src/proxy/detection.ts
|
|
3564
3639
|
var import_viem4 = require("viem");
|
|
3565
|
-
var
|
|
3640
|
+
var import_ui_utils27 = require("@openzeppelin/ui-utils");
|
|
3566
3641
|
|
|
3567
3642
|
// src/configuration/execution.ts
|
|
3568
|
-
var
|
|
3643
|
+
var import_ui_utils26 = require("@openzeppelin/ui-utils");
|
|
3569
3644
|
|
|
3570
3645
|
// src/validation/eoa.ts
|
|
3571
|
-
var
|
|
3646
|
+
var import_ui_utils25 = require("@openzeppelin/ui-utils");
|
|
3572
3647
|
var SYSTEM_LOG_TAG = "EoaValidator";
|
|
3573
3648
|
async function validateEoaConfig(config, walletStatus) {
|
|
3574
3649
|
if (!config.allowAny) {
|
|
@@ -3583,7 +3658,7 @@ async function validateEoaConfig(config, walletStatus) {
|
|
|
3583
3658
|
return `Connected wallet address (${walletStatus.address}) does not match the required specific EOA address (${config.specificAddress}). Please connect the correct wallet.`;
|
|
3584
3659
|
}
|
|
3585
3660
|
} else if (walletStatus.isConnected && !walletStatus.address) {
|
|
3586
|
-
|
|
3661
|
+
import_ui_utils25.logger.warn(
|
|
3587
3662
|
SYSTEM_LOG_TAG,
|
|
3588
3663
|
"Wallet is connected but address is unavailable for EOA validation."
|
|
3589
3664
|
);
|
|
@@ -3607,7 +3682,7 @@ async function validateRelayerConfig(config) {
|
|
|
3607
3682
|
// src/configuration/execution.ts
|
|
3608
3683
|
var SYSTEM_LOG_TAG2 = "adapter-evm-execution-config";
|
|
3609
3684
|
async function getEvmSupportedExecutionMethods() {
|
|
3610
|
-
|
|
3685
|
+
import_ui_utils26.logger.warn(
|
|
3611
3686
|
"adapter-evm-execution-config",
|
|
3612
3687
|
"getEvmSupportedExecutionMethods is using placeholder implementation."
|
|
3613
3688
|
);
|
|
@@ -3633,11 +3708,11 @@ async function getEvmSupportedExecutionMethods() {
|
|
|
3633
3708
|
]);
|
|
3634
3709
|
}
|
|
3635
3710
|
async function _validateMultisigConfig(_config, _walletStatus) {
|
|
3636
|
-
|
|
3711
|
+
import_ui_utils26.logger.info(SYSTEM_LOG_TAG2, "Multisig execution config validation: Not yet fully implemented.");
|
|
3637
3712
|
return true;
|
|
3638
3713
|
}
|
|
3639
3714
|
async function validateEvmExecutionConfig(config, walletStatus) {
|
|
3640
|
-
|
|
3715
|
+
import_ui_utils26.logger.info(SYSTEM_LOG_TAG2, "Validating EVM execution config:", { config, walletStatus });
|
|
3641
3716
|
switch (config.method) {
|
|
3642
3717
|
case "eoa":
|
|
3643
3718
|
return validateEoaConfig(config, walletStatus);
|
|
@@ -3647,7 +3722,7 @@ async function validateEvmExecutionConfig(config, walletStatus) {
|
|
|
3647
3722
|
return _validateMultisigConfig(config, walletStatus);
|
|
3648
3723
|
default: {
|
|
3649
3724
|
const unknownMethod = config.method;
|
|
3650
|
-
|
|
3725
|
+
import_ui_utils26.logger.warn(
|
|
3651
3726
|
SYSTEM_LOG_TAG2,
|
|
3652
3727
|
`Unsupported execution method type encountered: ${unknownMethod}`
|
|
3653
3728
|
);
|
|
@@ -3746,7 +3821,7 @@ function detectProxyFromAbi(abi) {
|
|
|
3746
3821
|
};
|
|
3747
3822
|
}
|
|
3748
3823
|
async function getImplementationAddress(proxyAddress, networkConfig, proxyType) {
|
|
3749
|
-
|
|
3824
|
+
import_ui_utils27.logger.info(
|
|
3750
3825
|
"getImplementationAddress",
|
|
3751
3826
|
`Resolving implementation for ${proxyType} proxy: ${proxyAddress}`
|
|
3752
3827
|
);
|
|
@@ -3763,7 +3838,7 @@ async function getImplementationAddress(proxyAddress, networkConfig, proxyType)
|
|
|
3763
3838
|
case "beacon":
|
|
3764
3839
|
return await getBeaconImplementation(proxyAddress, networkConfig);
|
|
3765
3840
|
case "diamond":
|
|
3766
|
-
|
|
3841
|
+
import_ui_utils27.logger.info("getImplementationAddress", "Diamond proxies not fully supported yet");
|
|
3767
3842
|
return null;
|
|
3768
3843
|
case "minimal":
|
|
3769
3844
|
return await getMinimalProxyImplementation(proxyAddress, networkConfig);
|
|
@@ -3771,7 +3846,7 @@ async function getImplementationAddress(proxyAddress, networkConfig, proxyType)
|
|
|
3771
3846
|
return await tryCommonImplementationMethods(proxyAddress, networkConfig);
|
|
3772
3847
|
}
|
|
3773
3848
|
} catch (error) {
|
|
3774
|
-
|
|
3849
|
+
import_ui_utils27.logger.warn("getImplementationAddress", `Failed to resolve implementation: ${error}`);
|
|
3775
3850
|
return null;
|
|
3776
3851
|
}
|
|
3777
3852
|
}
|
|
@@ -3783,7 +3858,7 @@ async function getAdminAddress(proxyAddress, networkConfig) {
|
|
|
3783
3858
|
if (legacyAdmin) return legacyAdmin;
|
|
3784
3859
|
return null;
|
|
3785
3860
|
} catch (error) {
|
|
3786
|
-
|
|
3861
|
+
import_ui_utils27.logger.warn("getAdminAddress", `Failed to resolve admin: ${error}`);
|
|
3787
3862
|
return null;
|
|
3788
3863
|
}
|
|
3789
3864
|
}
|
|
@@ -3798,20 +3873,20 @@ async function getEIP1967Admin(proxyAddress, networkConfig) {
|
|
|
3798
3873
|
async function getLegacyOZAdmin(proxyAddress, networkConfig) {
|
|
3799
3874
|
try {
|
|
3800
3875
|
const slot = (0, import_viem4.keccak256)((0, import_viem4.toHex)("org.zeppelinos.proxy.admin"));
|
|
3801
|
-
|
|
3876
|
+
import_ui_utils27.logger.info("getLegacyOZAdmin", `Trying legacy OZ admin slot: ${slot}`);
|
|
3802
3877
|
return await readStorageSlot(proxyAddress, slot, networkConfig);
|
|
3803
3878
|
} catch (error) {
|
|
3804
|
-
|
|
3879
|
+
import_ui_utils27.logger.warn("getLegacyOZAdmin", `Failed computing or reading legacy admin slot: ${error}`);
|
|
3805
3880
|
return null;
|
|
3806
3881
|
}
|
|
3807
3882
|
}
|
|
3808
3883
|
async function getLegacyOZImplementation(proxyAddress, networkConfig) {
|
|
3809
3884
|
try {
|
|
3810
3885
|
const slot = (0, import_viem4.keccak256)((0, import_viem4.toHex)("org.zeppelinos.proxy.implementation"));
|
|
3811
|
-
|
|
3886
|
+
import_ui_utils27.logger.info("getLegacyOZImplementation", `Trying legacy OZ slot: ${slot}`);
|
|
3812
3887
|
return await readStorageSlot(proxyAddress, slot, networkConfig);
|
|
3813
3888
|
} catch (error) {
|
|
3814
|
-
|
|
3889
|
+
import_ui_utils27.logger.warn("getLegacyOZImplementation", `Failed computing or reading legacy slot: ${error}`);
|
|
3815
3890
|
return null;
|
|
3816
3891
|
}
|
|
3817
3892
|
}
|
|
@@ -3835,7 +3910,7 @@ async function getMinimalProxyImplementation(proxyAddress, networkConfig) {
|
|
|
3835
3910
|
}
|
|
3836
3911
|
return null;
|
|
3837
3912
|
} catch (error) {
|
|
3838
|
-
|
|
3913
|
+
import_ui_utils27.logger.warn("getMinimalProxyImplementation", `Error reading bytecode: ${error}`);
|
|
3839
3914
|
return null;
|
|
3840
3915
|
}
|
|
3841
3916
|
}
|
|
@@ -3850,7 +3925,7 @@ async function tryCommonImplementationMethods(proxyAddress, networkConfig) {
|
|
|
3850
3925
|
try {
|
|
3851
3926
|
const result = await callContractFunction(proxyAddress, method, [], networkConfig);
|
|
3852
3927
|
if (result && result !== "0x0000000000000000000000000000000000000000") {
|
|
3853
|
-
|
|
3928
|
+
import_ui_utils27.logger.info(
|
|
3854
3929
|
"tryCommonImplementationMethods",
|
|
3855
3930
|
`Found implementation via ${method}: ${result}`
|
|
3856
3931
|
);
|
|
@@ -3876,13 +3951,13 @@ async function readStorageSlot(address, slot, networkConfig) {
|
|
|
3876
3951
|
slot
|
|
3877
3952
|
});
|
|
3878
3953
|
if (storageValue && storageValue !== "0x0000000000000000000000000000000000000000000000000000000000000000") {
|
|
3879
|
-
|
|
3954
|
+
import_ui_utils27.logger.info("readStorageSlot", `Found non-zero value at slot ${slot}: ${storageValue}`);
|
|
3880
3955
|
const implAddress = "0x" + storageValue.slice(-40);
|
|
3881
3956
|
return implAddress;
|
|
3882
3957
|
}
|
|
3883
3958
|
return null;
|
|
3884
3959
|
} catch (error) {
|
|
3885
|
-
|
|
3960
|
+
import_ui_utils27.logger.warn("readStorageSlot", `Failed to read storage slot ${slot}: ${error}`);
|
|
3886
3961
|
return null;
|
|
3887
3962
|
}
|
|
3888
3963
|
}
|
|
@@ -3903,7 +3978,7 @@ async function callContractFunction(address, signature, params, networkConfig) {
|
|
|
3903
3978
|
}
|
|
3904
3979
|
return null;
|
|
3905
3980
|
} catch (error) {
|
|
3906
|
-
|
|
3981
|
+
import_ui_utils27.logger.warn("callContractFunction", `Failed to call ${signature}: ${error}`);
|
|
3907
3982
|
return null;
|
|
3908
3983
|
}
|
|
3909
3984
|
}
|
|
@@ -3915,13 +3990,13 @@ async function getContractBytecode(address, networkConfig) {
|
|
|
3915
3990
|
});
|
|
3916
3991
|
return bytecode || null;
|
|
3917
3992
|
} catch (error) {
|
|
3918
|
-
|
|
3993
|
+
import_ui_utils27.logger.warn("getContractBytecode", `Failed to get bytecode: ${error}`);
|
|
3919
3994
|
return null;
|
|
3920
3995
|
}
|
|
3921
3996
|
}
|
|
3922
3997
|
|
|
3923
3998
|
// src/abi/sourcify.ts
|
|
3924
|
-
var
|
|
3999
|
+
var import_ui_utils28 = require("@openzeppelin/ui-utils");
|
|
3925
4000
|
var SOURCIFY_APP_BASE = "https://repo.sourcify.dev";
|
|
3926
4001
|
function getSourcifyContractAppUrl(chainId, address) {
|
|
3927
4002
|
return `${SOURCIFY_APP_BASE}/${chainId}/${address}`;
|
|
@@ -3939,7 +4014,7 @@ async function loadAbiFromSourcify(address, networkConfig, timeoutMs = 4e3) {
|
|
|
3939
4014
|
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
3940
4015
|
try {
|
|
3941
4016
|
const url = buildSourcifyApiUrl(networkConfig.chainId, address);
|
|
3942
|
-
|
|
4017
|
+
import_ui_utils28.logger.info("loadAbiFromSourcify", `Fetching contract from ${url}`);
|
|
3943
4018
|
const response = await fetch(url, { signal: controller.signal });
|
|
3944
4019
|
if (!response.ok) {
|
|
3945
4020
|
throw new Error(`Sourcify request failed: ${response.status} ${response.statusText}`);
|
|
@@ -3954,7 +4029,7 @@ async function loadAbiFromSourcify(address, networkConfig, timeoutMs = 4e3) {
|
|
|
3954
4029
|
const schema = transformAbiToSchema(abi, contractName, address);
|
|
3955
4030
|
return { schema, originalAbi: JSON.stringify(abi) };
|
|
3956
4031
|
} catch (error) {
|
|
3957
|
-
|
|
4032
|
+
import_ui_utils28.logger.warn("loadAbiFromSourcify", `Failed to fetch ABI from Sourcify: ${String(error)}`);
|
|
3958
4033
|
throw error;
|
|
3959
4034
|
} finally {
|
|
3960
4035
|
clearTimeout(timeout);
|
|
@@ -3970,10 +4045,10 @@ async function loadAbiFromJson(abiJsonString) {
|
|
|
3970
4045
|
throw new Error("Parsed JSON is not an array.");
|
|
3971
4046
|
}
|
|
3972
4047
|
} catch (error) {
|
|
3973
|
-
|
|
4048
|
+
import_ui_utils29.logger.error("loadAbiFromJson", "Failed to parse source string as JSON ABI:", error);
|
|
3974
4049
|
throw new Error(`Invalid JSON ABI provided: ${error.message}`);
|
|
3975
4050
|
}
|
|
3976
|
-
|
|
4051
|
+
import_ui_utils29.logger.info("loadAbiFromJson", `Successfully parsed JSON ABI with ${abi.length} items.`);
|
|
3977
4052
|
const contractName = "ContractFromABI";
|
|
3978
4053
|
return transformAbiToSchema(abi, contractName, void 0);
|
|
3979
4054
|
}
|
|
@@ -3992,7 +4067,7 @@ async function loadEvmContract(artifacts, networkConfig, options = {}) {
|
|
|
3992
4067
|
const trimmed = contractDefinition.trim();
|
|
3993
4068
|
const hasJsonContent = trimmed.includes("[") && trimmed.includes("]") && trimmed.includes("{");
|
|
3994
4069
|
if (hasJsonContent) {
|
|
3995
|
-
|
|
4070
|
+
import_ui_utils29.logger.info("loadEvmContract", "Manual contract definition provided. Attempting to parse...");
|
|
3996
4071
|
try {
|
|
3997
4072
|
const schema = await loadAbiFromJson(contractDefinition);
|
|
3998
4073
|
return {
|
|
@@ -4008,14 +4083,14 @@ async function loadEvmContract(artifacts, networkConfig, options = {}) {
|
|
|
4008
4083
|
// Note: No proxy detection for manual ABIs - user provides what they want
|
|
4009
4084
|
};
|
|
4010
4085
|
} catch (error) {
|
|
4011
|
-
|
|
4086
|
+
import_ui_utils29.logger.error("loadEvmContract", "Failed to parse manually provided ABI:", error);
|
|
4012
4087
|
throw new Error(`The provided ABI JSON is invalid: ${error.message}`);
|
|
4013
4088
|
}
|
|
4014
4089
|
}
|
|
4015
4090
|
}
|
|
4016
4091
|
const forcedRaw = artifacts.__forcedProvider || artifacts.service;
|
|
4017
4092
|
const forcedProvider = isEvmProviderKey(forcedRaw) ? forcedRaw : null;
|
|
4018
|
-
|
|
4093
|
+
import_ui_utils29.logger.info(
|
|
4019
4094
|
"loadEvmContract",
|
|
4020
4095
|
`No manual ABI detected. Attempting Etherscan fetch for address: ${contractAddress}...`
|
|
4021
4096
|
);
|
|
@@ -4044,7 +4119,7 @@ function buildContractResult(contractAddress, abiResult, networkConfig, sourcePr
|
|
|
4044
4119
|
contractName: abiResult.schema.name,
|
|
4045
4120
|
verificationStatus: "verified",
|
|
4046
4121
|
fetchTimestamp: /* @__PURE__ */ new Date(),
|
|
4047
|
-
definitionHash: (0,
|
|
4122
|
+
definitionHash: (0, import_ui_utils29.simpleHash)(abiResult.originalAbi)
|
|
4048
4123
|
},
|
|
4049
4124
|
proxyInfo
|
|
4050
4125
|
};
|
|
@@ -4052,13 +4127,13 @@ function buildContractResult(contractAddress, abiResult, networkConfig, sourcePr
|
|
|
4052
4127
|
async function loadImplementationAbi(_contractAddress, implementationAddress, networkConfig, _proxyType) {
|
|
4053
4128
|
try {
|
|
4054
4129
|
const implementationResult = await loadAbiFromEtherscan(implementationAddress, networkConfig);
|
|
4055
|
-
|
|
4130
|
+
import_ui_utils29.logger.info(
|
|
4056
4131
|
"loadImplementationAbi",
|
|
4057
4132
|
`Successfully fetched implementation ABI with ${implementationResult.schema.functions.length} functions`
|
|
4058
4133
|
);
|
|
4059
4134
|
return implementationResult;
|
|
4060
4135
|
} catch (implementationError) {
|
|
4061
|
-
|
|
4136
|
+
import_ui_utils29.logger.warn(
|
|
4062
4137
|
"loadImplementationAbi",
|
|
4063
4138
|
`Failed to load implementation ABI: ${implementationError}`
|
|
4064
4139
|
);
|
|
@@ -4071,7 +4146,7 @@ async function handleProxyDetection(contractAddress, initialResult, networkConfi
|
|
|
4071
4146
|
if (!proxyDetection.isProxy) {
|
|
4072
4147
|
return null;
|
|
4073
4148
|
}
|
|
4074
|
-
|
|
4149
|
+
import_ui_utils29.logger.info(
|
|
4075
4150
|
"handleProxyDetection",
|
|
4076
4151
|
`Proxy detected: ${proxyDetection.proxyType} (confidence: ${proxyDetection.confidence})`
|
|
4077
4152
|
);
|
|
@@ -4083,7 +4158,7 @@ async function handleProxyDetection(contractAddress, initialResult, networkConfi
|
|
|
4083
4158
|
);
|
|
4084
4159
|
const adminAddress = await getAdminAddress(contractAddress, networkConfig);
|
|
4085
4160
|
if (!implementationAddress) {
|
|
4086
|
-
|
|
4161
|
+
import_ui_utils29.logger.info("handleProxyDetection", "Proxy detected but implementation address not found");
|
|
4087
4162
|
return buildContractResult(contractAddress, initialResult, networkConfig, initialProvider, {
|
|
4088
4163
|
isProxy: true,
|
|
4089
4164
|
proxyType,
|
|
@@ -4091,7 +4166,7 @@ async function handleProxyDetection(contractAddress, initialResult, networkConfi
|
|
|
4091
4166
|
detectionMethod: "automatic"
|
|
4092
4167
|
});
|
|
4093
4168
|
}
|
|
4094
|
-
|
|
4169
|
+
import_ui_utils29.logger.info("handleProxyDetection", `Found implementation at: ${implementationAddress}`);
|
|
4095
4170
|
const implementationResult = await loadImplementationAbi(
|
|
4096
4171
|
contractAddress,
|
|
4097
4172
|
implementationAddress,
|
|
@@ -4127,12 +4202,12 @@ async function handleProxyDetection(contractAddress, initialResult, networkConfi
|
|
|
4127
4202
|
async function loadContractWithProxyDetection(contractAddress, networkConfig, options = {}, forcedProvider = null) {
|
|
4128
4203
|
try {
|
|
4129
4204
|
let uiDefault = null;
|
|
4130
|
-
const svcCfg =
|
|
4205
|
+
const svcCfg = import_ui_utils29.userNetworkServiceConfigService.get(networkConfig.id, "contract-definitions");
|
|
4131
4206
|
if (svcCfg && typeof svcCfg === "object" && "defaultProvider" in svcCfg) {
|
|
4132
4207
|
const raw = svcCfg.defaultProvider;
|
|
4133
4208
|
if (isEvmProviderKey(raw)) uiDefault = raw;
|
|
4134
4209
|
}
|
|
4135
|
-
const appDefaultRaw =
|
|
4210
|
+
const appDefaultRaw = import_ui_utils29.appConfigService.getGlobalServiceParam(
|
|
4136
4211
|
"contractdefinition",
|
|
4137
4212
|
"defaultProvider"
|
|
4138
4213
|
);
|
|
@@ -4151,13 +4226,13 @@ async function loadContractWithProxyDetection(contractAddress, networkConfig, op
|
|
|
4151
4226
|
const remainingOverall = Math.max(100, overallDeadline - Date.now());
|
|
4152
4227
|
const attemptTimeout = Math.min(PER_PROVIDER_TIMEOUT_MS, remainingOverall);
|
|
4153
4228
|
if (provider === EvmProviderKeys.Etherscan) {
|
|
4154
|
-
initialResult = await (0,
|
|
4229
|
+
initialResult = await (0, import_ui_utils29.withTimeout)(
|
|
4155
4230
|
loadAbiFromEtherscan(contractAddress, networkConfig),
|
|
4156
4231
|
attemptTimeout,
|
|
4157
4232
|
"etherscan"
|
|
4158
4233
|
);
|
|
4159
4234
|
} else if (provider === EvmProviderKeys.Sourcify) {
|
|
4160
|
-
initialResult = await (0,
|
|
4235
|
+
initialResult = await (0, import_ui_utils29.withTimeout)(
|
|
4161
4236
|
loadAbiFromSourcify(contractAddress, networkConfig, attemptTimeout),
|
|
4162
4237
|
attemptTimeout,
|
|
4163
4238
|
"sourcify"
|
|
@@ -4173,7 +4248,7 @@ async function loadContractWithProxyDetection(contractAddress, networkConfig, op
|
|
|
4173
4248
|
}
|
|
4174
4249
|
}
|
|
4175
4250
|
if (!initialResult) throw lastError ?? new Error("No provider succeeded");
|
|
4176
|
-
|
|
4251
|
+
import_ui_utils29.logger.info(
|
|
4177
4252
|
"loadContractWithProxyDetection",
|
|
4178
4253
|
`Successfully fetched initial ABI for ${contractAddress} with ${initialResult.schema.functions.length} functions`
|
|
4179
4254
|
);
|
|
@@ -4190,7 +4265,7 @@ async function loadContractWithProxyDetection(contractAddress, networkConfig, op
|
|
|
4190
4265
|
}
|
|
4191
4266
|
return buildContractResult(contractAddress, initialResult, networkConfig, usedProvider);
|
|
4192
4267
|
} catch (error) {
|
|
4193
|
-
|
|
4268
|
+
import_ui_utils29.logger.warn("loadContractWithProxyDetection", `Contract loading failed: ${error}`);
|
|
4194
4269
|
if (forcedProvider) {
|
|
4195
4270
|
throw error;
|
|
4196
4271
|
}
|
|
@@ -4226,6 +4301,23 @@ var EVM_TYPE_TO_FIELD_TYPE = {
|
|
|
4226
4301
|
bytes: "textarea",
|
|
4227
4302
|
bytes32: "text"
|
|
4228
4303
|
};
|
|
4304
|
+
var EVM_DYNAMIC_PATTERNS = [
|
|
4305
|
+
{ name: "array", syntax: "T[]", mapsTo: "array", description: "Dynamic array of primitives" },
|
|
4306
|
+
{ name: "fixed-array", syntax: "T[N]", mapsTo: "array", description: "Fixed-size array" },
|
|
4307
|
+
{
|
|
4308
|
+
name: "tuple-array",
|
|
4309
|
+
syntax: "tuple[]",
|
|
4310
|
+
mapsTo: "array-object",
|
|
4311
|
+
description: "Array of structs"
|
|
4312
|
+
},
|
|
4313
|
+
{ name: "tuple", syntax: "tuple", mapsTo: "object", description: "Struct/tuple type" }
|
|
4314
|
+
];
|
|
4315
|
+
function getEvmTypeMappingInfo() {
|
|
4316
|
+
return {
|
|
4317
|
+
primitives: { ...EVM_TYPE_TO_FIELD_TYPE },
|
|
4318
|
+
dynamicPatterns: EVM_DYNAMIC_PATTERNS
|
|
4319
|
+
};
|
|
4320
|
+
}
|
|
4229
4321
|
|
|
4230
4322
|
// src/mapping/type-mapper.ts
|
|
4231
4323
|
function mapEvmParamTypeToFieldType(parameterType) {
|
|
@@ -4278,7 +4370,7 @@ function getEvmCompatibleFieldTypes(parameterType) {
|
|
|
4278
4370
|
|
|
4279
4371
|
// src/mapping/field-generator.ts
|
|
4280
4372
|
var import_lodash = require("lodash");
|
|
4281
|
-
var
|
|
4373
|
+
var import_ui_utils30 = require("@openzeppelin/ui-utils");
|
|
4282
4374
|
function extractArrayElementType(parameterType) {
|
|
4283
4375
|
const arrayMatch = parameterType.match(/^(.+)\[\d*\]$/);
|
|
4284
4376
|
if (arrayMatch) {
|
|
@@ -4309,8 +4401,8 @@ function generateEvmDefaultField(parameter) {
|
|
|
4309
4401
|
type: fieldType,
|
|
4310
4402
|
placeholder: `Enter ${parameter.displayName || parameter.name || parameter.type}`,
|
|
4311
4403
|
helperText: parameter.description || "",
|
|
4312
|
-
defaultValue: (0,
|
|
4313
|
-
validation: (0,
|
|
4404
|
+
defaultValue: (0, import_ui_utils30.getDefaultValueForType)(fieldType),
|
|
4405
|
+
validation: (0, import_ui_utils30.enhanceNumericValidation)(
|
|
4314
4406
|
getDefaultValidation(),
|
|
4315
4407
|
parameter.type,
|
|
4316
4408
|
EVM_NUMERIC_BOUNDS
|
|
@@ -4326,7 +4418,7 @@ function generateEvmDefaultField(parameter) {
|
|
|
4326
4418
|
elementType: elementFieldType,
|
|
4327
4419
|
elementFieldConfig: {
|
|
4328
4420
|
type: elementFieldType,
|
|
4329
|
-
validation: (0,
|
|
4421
|
+
validation: (0, import_ui_utils30.enhanceNumericValidation)(
|
|
4330
4422
|
getDefaultValidation(),
|
|
4331
4423
|
elementType,
|
|
4332
4424
|
EVM_NUMERIC_BOUNDS
|
|
@@ -4354,11 +4446,11 @@ function isEvmViewFunction(functionDetails) {
|
|
|
4354
4446
|
|
|
4355
4447
|
// src/query/handler.ts
|
|
4356
4448
|
var import_viem7 = require("viem");
|
|
4357
|
-
var
|
|
4449
|
+
var import_ui_utils33 = require("@openzeppelin/ui-utils");
|
|
4358
4450
|
|
|
4359
4451
|
// src/transform/input-parser.ts
|
|
4360
4452
|
var import_viem6 = require("viem");
|
|
4361
|
-
var
|
|
4453
|
+
var import_ui_utils31 = require("@openzeppelin/ui-utils");
|
|
4362
4454
|
function parseEvmInput(param, rawValue, isRecursive = false) {
|
|
4363
4455
|
const { type, name } = param;
|
|
4364
4456
|
const baseType = type.replace(/\[\d*\]$/, "");
|
|
@@ -4476,7 +4568,7 @@ function parseEvmInput(param, rawValue, isRecursive = false) {
|
|
|
4476
4568
|
} else if (baseType === "string") {
|
|
4477
4569
|
return String(rawValue);
|
|
4478
4570
|
}
|
|
4479
|
-
|
|
4571
|
+
import_ui_utils31.logger.warn(
|
|
4480
4572
|
"parseEvmInput",
|
|
4481
4573
|
`Unknown EVM parameter type encountered: '${type}'. Using raw value.`
|
|
4482
4574
|
);
|
|
@@ -4489,10 +4581,10 @@ function parseEvmInput(param, rawValue, isRecursive = false) {
|
|
|
4489
4581
|
}
|
|
4490
4582
|
|
|
4491
4583
|
// src/transform/output-formatter.ts
|
|
4492
|
-
var
|
|
4584
|
+
var import_ui_utils32 = require("@openzeppelin/ui-utils");
|
|
4493
4585
|
function formatEvmFunctionResult(decodedValue, functionDetails) {
|
|
4494
4586
|
if (!functionDetails.outputs || !Array.isArray(functionDetails.outputs)) {
|
|
4495
|
-
|
|
4587
|
+
import_ui_utils32.logger.warn(
|
|
4496
4588
|
"formatEvmFunctionResult",
|
|
4497
4589
|
`Output ABI definition missing or invalid for function ${functionDetails.name}.`
|
|
4498
4590
|
);
|
|
@@ -4520,7 +4612,7 @@ function formatEvmFunctionResult(decodedValue, functionDetails) {
|
|
|
4520
4612
|
}
|
|
4521
4613
|
} catch (error) {
|
|
4522
4614
|
const errorMessage = `Error formatting result for ${functionDetails.name}: ${error.message}`;
|
|
4523
|
-
|
|
4615
|
+
import_ui_utils32.logger.error("formatEvmFunctionResult", errorMessage, {
|
|
4524
4616
|
functionName: functionDetails.name,
|
|
4525
4617
|
decodedValue,
|
|
4526
4618
|
error
|
|
@@ -4543,14 +4635,14 @@ async function getPublicClientForQuery(walletImplementation, networkConfig) {
|
|
|
4543
4635
|
if (clientFromWallet) {
|
|
4544
4636
|
return clientFromWallet;
|
|
4545
4637
|
} else {
|
|
4546
|
-
|
|
4638
|
+
import_ui_utils33.logger.warn(
|
|
4547
4639
|
"getPublicClientForQuery",
|
|
4548
4640
|
`Could not get public client from connected wallet for chain ${walletChainId}. Falling back.`
|
|
4549
4641
|
);
|
|
4550
4642
|
}
|
|
4551
4643
|
}
|
|
4552
4644
|
const resolvedRpc = resolveRpcUrl(networkConfig);
|
|
4553
|
-
|
|
4645
|
+
import_ui_utils33.logger.info(
|
|
4554
4646
|
"getPublicClientForQuery",
|
|
4555
4647
|
`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
4648
|
);
|
|
@@ -4561,7 +4653,7 @@ function createPublicClientWithRpc(networkConfig, rpcUrl) {
|
|
|
4561
4653
|
if (networkConfig.viemChain) {
|
|
4562
4654
|
chainForViem = networkConfig.viemChain;
|
|
4563
4655
|
} else {
|
|
4564
|
-
|
|
4656
|
+
import_ui_utils33.logger.warn(
|
|
4565
4657
|
"createPublicClientWithRpc",
|
|
4566
4658
|
`Viem chain object (viemChain) not provided in EvmNetworkConfig for ${networkConfig.name} (query). Creating a minimal one.`
|
|
4567
4659
|
);
|
|
@@ -4588,7 +4680,7 @@ function createPublicClientWithRpc(networkConfig, rpcUrl) {
|
|
|
4588
4680
|
});
|
|
4589
4681
|
return publicClient;
|
|
4590
4682
|
} catch (error) {
|
|
4591
|
-
|
|
4683
|
+
import_ui_utils33.logger.error(
|
|
4592
4684
|
"createPublicClientWithRpc",
|
|
4593
4685
|
"Failed to create network-specific public client for query:",
|
|
4594
4686
|
error
|
|
@@ -4599,7 +4691,7 @@ function createPublicClientWithRpc(networkConfig, rpcUrl) {
|
|
|
4599
4691
|
}
|
|
4600
4692
|
}
|
|
4601
4693
|
async function queryEvmViewFunction(contractAddress, functionId, networkConfig, params, contractSchema, walletImplementation, loadContractFn) {
|
|
4602
|
-
|
|
4694
|
+
import_ui_utils33.logger.info(
|
|
4603
4695
|
"queryEvmViewFunction",
|
|
4604
4696
|
`Querying view function: ${functionId} on ${contractAddress} (${networkConfig.name})`,
|
|
4605
4697
|
{ params }
|
|
@@ -4630,9 +4722,9 @@ async function queryEvmViewFunction(contractAddress, functionId, networkConfig,
|
|
|
4630
4722
|
}
|
|
4631
4723
|
return parseEvmInput(inputParam, rawValue, false);
|
|
4632
4724
|
});
|
|
4633
|
-
|
|
4725
|
+
import_ui_utils33.logger.debug("queryEvmViewFunction", "Parsed Args for readContract:", args);
|
|
4634
4726
|
const functionAbiItem = createAbiFunctionItem(functionDetails);
|
|
4635
|
-
|
|
4727
|
+
import_ui_utils33.logger.debug(
|
|
4636
4728
|
"queryEvmViewFunction",
|
|
4637
4729
|
`[Query ${functionDetails.name}] Calling readContract with ABI:`,
|
|
4638
4730
|
functionAbiItem,
|
|
@@ -4648,7 +4740,7 @@ async function queryEvmViewFunction(contractAddress, functionId, networkConfig,
|
|
|
4648
4740
|
args
|
|
4649
4741
|
});
|
|
4650
4742
|
} catch (readError) {
|
|
4651
|
-
|
|
4743
|
+
import_ui_utils33.logger.error(
|
|
4652
4744
|
"queryEvmViewFunction",
|
|
4653
4745
|
`[Query ${functionDetails.name}] publicClient.readContract specific error:`,
|
|
4654
4746
|
readError
|
|
@@ -4657,7 +4749,7 @@ async function queryEvmViewFunction(contractAddress, functionId, networkConfig,
|
|
|
4657
4749
|
`Viem readContract failed for ${functionDetails.name}: ${readError.message}`
|
|
4658
4750
|
);
|
|
4659
4751
|
}
|
|
4660
|
-
|
|
4752
|
+
import_ui_utils33.logger.debug(
|
|
4661
4753
|
"queryEvmViewFunction",
|
|
4662
4754
|
`[Query ${functionDetails.name}] Raw decoded result:`,
|
|
4663
4755
|
decodedResult
|
|
@@ -4665,7 +4757,7 @@ async function queryEvmViewFunction(contractAddress, functionId, networkConfig,
|
|
|
4665
4757
|
return decodedResult;
|
|
4666
4758
|
} catch (error) {
|
|
4667
4759
|
const errorMessage = `Failed to query view function ${functionId} on network ${networkConfig.name}: ${error.message}`;
|
|
4668
|
-
|
|
4760
|
+
import_ui_utils33.logger.error("queryEvmViewFunction", errorMessage, {
|
|
4669
4761
|
contractAddress,
|
|
4670
4762
|
functionId,
|
|
4671
4763
|
params,
|
|
@@ -4679,7 +4771,7 @@ async function queryEvmViewFunction(contractAddress, functionId, networkConfig,
|
|
|
4679
4771
|
// src/transaction/relayer.ts
|
|
4680
4772
|
var import_viem8 = require("viem");
|
|
4681
4773
|
var import_relayer_sdk = require("@openzeppelin/relayer-sdk");
|
|
4682
|
-
var
|
|
4774
|
+
var import_ui_utils34 = require("@openzeppelin/ui-utils");
|
|
4683
4775
|
var RelayerExecutionStrategy = class {
|
|
4684
4776
|
async execute(transactionData, executionConfig, _walletImplementation, onStatusChange, runtimeApiKey) {
|
|
4685
4777
|
const relayerConfig = executionConfig;
|
|
@@ -4714,7 +4806,7 @@ var RelayerExecutionStrategy = class {
|
|
|
4714
4806
|
* @throws If the API call fails or returns an unsuccessful response.
|
|
4715
4807
|
*/
|
|
4716
4808
|
async getEvmRelayers(serviceUrl, accessToken, networkConfig) {
|
|
4717
|
-
|
|
4809
|
+
import_ui_utils34.logger.info(
|
|
4718
4810
|
"[Relayer] Getting relayers with access token",
|
|
4719
4811
|
accessToken.slice(0, 5).padEnd(accessToken.length, "*")
|
|
4720
4812
|
);
|
|
@@ -4762,7 +4854,7 @@ var RelayerExecutionStrategy = class {
|
|
|
4762
4854
|
* @throws If any API call fails or returns an unsuccessful response.
|
|
4763
4855
|
*/
|
|
4764
4856
|
async getEvmRelayer(serviceUrl, accessToken, relayerId, networkConfig) {
|
|
4765
|
-
|
|
4857
|
+
import_ui_utils34.logger.info("[Relayer] Getting detailed relayer info", relayerId);
|
|
4766
4858
|
const sdkConfig = new import_relayer_sdk.Configuration({
|
|
4767
4859
|
basePath: serviceUrl,
|
|
4768
4860
|
accessToken
|
|
@@ -4772,11 +4864,11 @@ var RelayerExecutionStrategy = class {
|
|
|
4772
4864
|
const [relayerResponse, balanceResponse, statusResponse] = await Promise.all([
|
|
4773
4865
|
relayersApi.getRelayer(relayerId),
|
|
4774
4866
|
relayersApi.getRelayerBalance(relayerId).catch((err) => {
|
|
4775
|
-
|
|
4867
|
+
import_ui_utils34.logger.warn("[Relayer] Failed to fetch balance", err);
|
|
4776
4868
|
return null;
|
|
4777
4869
|
}),
|
|
4778
4870
|
relayersApi.getRelayerStatus(relayerId).catch((err) => {
|
|
4779
|
-
|
|
4871
|
+
import_ui_utils34.logger.warn("[Relayer] Failed to fetch status", err);
|
|
4780
4872
|
return null;
|
|
4781
4873
|
})
|
|
4782
4874
|
]);
|
|
@@ -4799,7 +4891,7 @@ var RelayerExecutionStrategy = class {
|
|
|
4799
4891
|
const currencySymbol = networkConfig.nativeCurrency.symbol;
|
|
4800
4892
|
enhancedDetails.balance = `${balanceInEth} ${currencySymbol}`;
|
|
4801
4893
|
} catch (error) {
|
|
4802
|
-
|
|
4894
|
+
import_ui_utils34.logger.warn("[Relayer] Failed to format balance, using raw value", String(error));
|
|
4803
4895
|
enhancedDetails.balance = String(balanceResponse.data.data.balance);
|
|
4804
4896
|
}
|
|
4805
4897
|
}
|
|
@@ -4817,10 +4909,10 @@ var RelayerExecutionStrategy = class {
|
|
|
4817
4909
|
}
|
|
4818
4910
|
}
|
|
4819
4911
|
}
|
|
4820
|
-
|
|
4912
|
+
import_ui_utils34.logger.info("[Relayer] Retrieved enhanced relayer details", JSON.stringify(enhancedDetails));
|
|
4821
4913
|
return enhancedDetails;
|
|
4822
4914
|
} catch (error) {
|
|
4823
|
-
|
|
4915
|
+
import_ui_utils34.logger.error(
|
|
4824
4916
|
"[Relayer] Failed to get relayer details",
|
|
4825
4917
|
error instanceof Error ? error.message : String(error)
|
|
4826
4918
|
);
|
|
@@ -4845,7 +4937,7 @@ var RelayerExecutionStrategy = class {
|
|
|
4845
4937
|
let valueNumber = 0;
|
|
4846
4938
|
const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
4847
4939
|
if (valueBigint > MAX_SAFE) {
|
|
4848
|
-
|
|
4940
|
+
import_ui_utils34.logger.warn(
|
|
4849
4941
|
"[Relayer] Value exceeds JS safe integer. Truncating for request.",
|
|
4850
4942
|
valueBigint.toString()
|
|
4851
4943
|
);
|
|
@@ -4860,7 +4952,7 @@ var RelayerExecutionStrategy = class {
|
|
|
4860
4952
|
// If no explicit gas limit is provided, keep a conservative default but warn.
|
|
4861
4953
|
gas_limit: (() => {
|
|
4862
4954
|
if (typeof evmOptions?.gasLimit === "number") return evmOptions.gasLimit;
|
|
4863
|
-
|
|
4955
|
+
import_ui_utils34.logger.warn(
|
|
4864
4956
|
"[Relayer]",
|
|
4865
4957
|
"No gasLimit provided; using default 210000. Consider setting explicitly."
|
|
4866
4958
|
);
|
|
@@ -4932,10 +5024,10 @@ var RelayerExecutionStrategy = class {
|
|
|
4932
5024
|
};
|
|
4933
5025
|
|
|
4934
5026
|
// src/transaction/sender.ts
|
|
4935
|
-
var
|
|
5027
|
+
var import_ui_utils35 = require("@openzeppelin/ui-utils");
|
|
4936
5028
|
var SYSTEM_LOG_TAG3 = "adapter-evm-sender";
|
|
4937
5029
|
async function waitForEvmTransactionConfirmation(txHash, walletImplementation) {
|
|
4938
|
-
|
|
5030
|
+
import_ui_utils35.logger.info(SYSTEM_LOG_TAG3, `Waiting for tx: ${txHash}`);
|
|
4939
5031
|
try {
|
|
4940
5032
|
const resolvedPublicClient = await walletImplementation.getPublicClient();
|
|
4941
5033
|
if (!resolvedPublicClient) {
|
|
@@ -4944,15 +5036,15 @@ async function waitForEvmTransactionConfirmation(txHash, walletImplementation) {
|
|
|
4944
5036
|
const receipt = await resolvedPublicClient.waitForTransactionReceipt({
|
|
4945
5037
|
hash: txHash
|
|
4946
5038
|
});
|
|
4947
|
-
|
|
5039
|
+
import_ui_utils35.logger.info(SYSTEM_LOG_TAG3, "Received receipt:", receipt);
|
|
4948
5040
|
if (receipt.status === "success") {
|
|
4949
5041
|
return { status: "success", receipt };
|
|
4950
5042
|
} else {
|
|
4951
|
-
|
|
5043
|
+
import_ui_utils35.logger.error(SYSTEM_LOG_TAG3, "Transaction reverted:", receipt);
|
|
4952
5044
|
return { status: "error", receipt, error: new Error("Transaction reverted.") };
|
|
4953
5045
|
}
|
|
4954
5046
|
} catch (error) {
|
|
4955
|
-
|
|
5047
|
+
import_ui_utils35.logger.error(SYSTEM_LOG_TAG3, "Error waiting for transaction confirmation:", error);
|
|
4956
5048
|
return {
|
|
4957
5049
|
status: "error",
|
|
4958
5050
|
error: error instanceof Error ? error : new Error(String(error))
|
|
@@ -4962,9 +5054,9 @@ async function waitForEvmTransactionConfirmation(txHash, walletImplementation) {
|
|
|
4962
5054
|
|
|
4963
5055
|
// src/transaction/formatter.ts
|
|
4964
5056
|
var import_viem9 = require("viem");
|
|
4965
|
-
var
|
|
5057
|
+
var import_ui_utils36 = require("@openzeppelin/ui-utils");
|
|
4966
5058
|
function formatEvmTransactionData(contractSchema, functionId, submittedInputs, fields) {
|
|
4967
|
-
|
|
5059
|
+
import_ui_utils36.logger.info(
|
|
4968
5060
|
"formatEvmTransactionData",
|
|
4969
5061
|
`Formatting EVM transaction data for function: ${functionId}`
|
|
4970
5062
|
);
|
|
@@ -5002,7 +5094,7 @@ function formatEvmTransactionData(contractSchema, functionId, submittedInputs, f
|
|
|
5002
5094
|
const isPayable = functionDetails.stateMutability === "payable";
|
|
5003
5095
|
let transactionValue = 0n;
|
|
5004
5096
|
if (isPayable) {
|
|
5005
|
-
|
|
5097
|
+
import_ui_utils36.logger.warn(
|
|
5006
5098
|
"formatEvmTransactionData",
|
|
5007
5099
|
"Payable function detected, but sending 0 ETH. Implement value input."
|
|
5008
5100
|
);
|
|
@@ -5023,7 +5115,7 @@ function formatEvmTransactionData(contractSchema, functionId, submittedInputs, f
|
|
|
5023
5115
|
}
|
|
5024
5116
|
|
|
5025
5117
|
// src/transaction/eoa.ts
|
|
5026
|
-
var
|
|
5118
|
+
var import_ui_utils37 = require("@openzeppelin/ui-utils");
|
|
5027
5119
|
var SYSTEM_LOG_TAG4 = "EoaExecutionStrategy";
|
|
5028
5120
|
var EoaExecutionStrategy = class {
|
|
5029
5121
|
async execute(transactionData, executionConfig, walletImplementation, onStatusChange, _runtimeApiKey) {
|
|
@@ -5036,9 +5128,9 @@ var EoaExecutionStrategy = class {
|
|
|
5036
5128
|
if (validationResult !== true) {
|
|
5037
5129
|
throw new Error(validationResult);
|
|
5038
5130
|
}
|
|
5039
|
-
|
|
5131
|
+
import_ui_utils37.logger.info(SYSTEM_LOG_TAG4, "Using EOA execution strategy.");
|
|
5040
5132
|
try {
|
|
5041
|
-
|
|
5133
|
+
import_ui_utils37.logger.debug(SYSTEM_LOG_TAG4, "Calling walletClient.writeContract with:", {
|
|
5042
5134
|
account: accountStatus.address,
|
|
5043
5135
|
address: transactionData.address,
|
|
5044
5136
|
abi: transactionData.abi,
|
|
@@ -5057,10 +5149,10 @@ var EoaExecutionStrategy = class {
|
|
|
5057
5149
|
value: transactionData.value,
|
|
5058
5150
|
chain: walletClient.chain
|
|
5059
5151
|
});
|
|
5060
|
-
|
|
5152
|
+
import_ui_utils37.logger.info(SYSTEM_LOG_TAG4, "EOA Transaction initiated. Hash:", hash);
|
|
5061
5153
|
return { txHash: hash };
|
|
5062
5154
|
} catch (error) {
|
|
5063
|
-
|
|
5155
|
+
import_ui_utils37.logger.error(SYSTEM_LOG_TAG4, "Error during EOA writeContract call:", error);
|
|
5064
5156
|
const errorMessage = error instanceof Error ? error.message : "Unknown EOA transaction error";
|
|
5065
5157
|
throw new Error(`Transaction failed (EOA): ${errorMessage}`);
|
|
5066
5158
|
}
|
|
@@ -5068,12 +5160,12 @@ var EoaExecutionStrategy = class {
|
|
|
5068
5160
|
async getAuthenticatedWalletClient(walletImplementation) {
|
|
5069
5161
|
const walletClient = await walletImplementation.getWalletClient();
|
|
5070
5162
|
if (!walletClient) {
|
|
5071
|
-
|
|
5163
|
+
import_ui_utils37.logger.error(SYSTEM_LOG_TAG4, "Wallet client not available. Is wallet connected?");
|
|
5072
5164
|
throw new Error("Wallet is not connected or client is unavailable.");
|
|
5073
5165
|
}
|
|
5074
5166
|
const accountStatus = walletImplementation.getWalletConnectionStatus();
|
|
5075
5167
|
if (!accountStatus.isConnected || !accountStatus.address) {
|
|
5076
|
-
|
|
5168
|
+
import_ui_utils37.logger.error(SYSTEM_LOG_TAG4, "Account not available. Is wallet connected?");
|
|
5077
5169
|
throw new Error("Wallet is not connected or account address is unavailable.");
|
|
5078
5170
|
}
|
|
5079
5171
|
return { walletClient, accountStatus };
|
|
@@ -5082,17 +5174,17 @@ var EoaExecutionStrategy = class {
|
|
|
5082
5174
|
|
|
5083
5175
|
// src/transaction/components/EvmRelayerOptions.tsx
|
|
5084
5176
|
var import_react11 = __toESM(require("react"), 1);
|
|
5085
|
-
var
|
|
5177
|
+
var import_ui_components9 = require("@openzeppelin/ui-components");
|
|
5086
5178
|
|
|
5087
5179
|
// src/transaction/components/AdvancedInfo.tsx
|
|
5088
5180
|
var import_lucide_react5 = require("lucide-react");
|
|
5089
|
-
var
|
|
5181
|
+
var import_ui_components6 = require("@openzeppelin/ui-components");
|
|
5090
5182
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
5091
5183
|
var AdvancedInfo = ({ showAdvancedInfo, onToggle }) => {
|
|
5092
5184
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-2", children: [
|
|
5093
5185
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5094
5186
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: "text-base font-medium", children: "Gas Pricing Strategy" }),
|
|
5095
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5187
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_ui_components6.Button, { variant: "ghost", size: "sm", onClick: onToggle, className: "text-xs", type: "button", children: [
|
|
5096
5188
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react5.Info, { className: "h-3 w-3 mr-1" }),
|
|
5097
5189
|
"API Requirements"
|
|
5098
5190
|
] })
|
|
@@ -5111,8 +5203,8 @@ var AdvancedInfo = ({ showAdvancedInfo, onToggle }) => {
|
|
|
5111
5203
|
|
|
5112
5204
|
// src/transaction/components/CustomGasParameters.tsx
|
|
5113
5205
|
var import_lucide_react6 = require("lucide-react");
|
|
5114
|
-
var
|
|
5115
|
-
var
|
|
5206
|
+
var import_ui_components7 = require("@openzeppelin/ui-components");
|
|
5207
|
+
var import_ui_utils38 = require("@openzeppelin/ui-utils");
|
|
5116
5208
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
5117
5209
|
var CustomGasParameters = ({
|
|
5118
5210
|
control,
|
|
@@ -5133,7 +5225,7 @@ var CustomGasParameters = ({
|
|
|
5133
5225
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-3", children: [
|
|
5134
5226
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-xs text-muted-foreground font-medium uppercase tracking-wider", children: "Select Gas Pricing Method" }),
|
|
5135
5227
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
5136
|
-
|
|
5228
|
+
import_ui_components7.Accordion,
|
|
5137
5229
|
{
|
|
5138
5230
|
type: "single",
|
|
5139
5231
|
collapsible: true,
|
|
@@ -5142,15 +5234,15 @@ var CustomGasParameters = ({
|
|
|
5142
5234
|
className: "w-full space-y-3",
|
|
5143
5235
|
children: [
|
|
5144
5236
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
5145
|
-
|
|
5237
|
+
import_ui_components7.AccordionItem,
|
|
5146
5238
|
{
|
|
5147
5239
|
value: "eip1559",
|
|
5148
|
-
className: (0,
|
|
5240
|
+
className: (0, import_ui_utils38.cn)(
|
|
5149
5241
|
"rounded-lg border shadow-sm overflow-hidden transition-all",
|
|
5150
5242
|
gasType === "eip1559" ? "border-primary bg-primary/5" : "border-border bg-card hover:border-muted-foreground/50"
|
|
5151
5243
|
),
|
|
5152
5244
|
children: [
|
|
5153
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5245
|
+
/* @__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
5246
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
5155
5247
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
|
|
5156
5248
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -5165,9 +5257,9 @@ var CustomGasParameters = ({
|
|
|
5165
5257
|
] }),
|
|
5166
5258
|
gasType === "eip1559" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs text-primary font-medium mr-2", children: "Selected" })
|
|
5167
5259
|
] }) }),
|
|
5168
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5260
|
+
/* @__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
5261
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5170
|
-
|
|
5262
|
+
import_ui_components7.NumberField,
|
|
5171
5263
|
{
|
|
5172
5264
|
id: "maxFeePerGas",
|
|
5173
5265
|
label: "Max Fee Per Gas",
|
|
@@ -5181,7 +5273,7 @@ var CustomGasParameters = ({
|
|
|
5181
5273
|
}
|
|
5182
5274
|
),
|
|
5183
5275
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5184
|
-
|
|
5276
|
+
import_ui_components7.NumberField,
|
|
5185
5277
|
{
|
|
5186
5278
|
id: "maxPriorityFeePerGas",
|
|
5187
5279
|
label: "Max Priority Fee Per Gas",
|
|
@@ -5199,15 +5291,15 @@ var CustomGasParameters = ({
|
|
|
5199
5291
|
}
|
|
5200
5292
|
),
|
|
5201
5293
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
5202
|
-
|
|
5294
|
+
import_ui_components7.AccordionItem,
|
|
5203
5295
|
{
|
|
5204
5296
|
value: "legacy",
|
|
5205
|
-
className: (0,
|
|
5297
|
+
className: (0, import_ui_utils38.cn)(
|
|
5206
5298
|
"rounded-lg border shadow-sm overflow-hidden transition-all",
|
|
5207
5299
|
gasType === "legacy" ? "border-primary bg-primary/5" : "border-border bg-card hover:border-muted-foreground/50"
|
|
5208
5300
|
),
|
|
5209
5301
|
children: [
|
|
5210
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5302
|
+
/* @__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
5303
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
5212
5304
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative", children: [
|
|
5213
5305
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -5222,8 +5314,8 @@ var CustomGasParameters = ({
|
|
|
5222
5314
|
] }),
|
|
5223
5315
|
gasType === "legacy" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs text-primary font-medium mr-2", children: "Selected" })
|
|
5224
5316
|
] }) }),
|
|
5225
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5226
|
-
|
|
5317
|
+
/* @__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)(
|
|
5318
|
+
import_ui_components7.NumberField,
|
|
5227
5319
|
{
|
|
5228
5320
|
id: "gasPrice",
|
|
5229
5321
|
label: "Gas Price",
|
|
@@ -5245,7 +5337,7 @@ var CustomGasParameters = ({
|
|
|
5245
5337
|
] }),
|
|
5246
5338
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-2", children: [
|
|
5247
5339
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5248
|
-
|
|
5340
|
+
import_ui_components7.BooleanField,
|
|
5249
5341
|
{
|
|
5250
5342
|
id: "showGasLimit",
|
|
5251
5343
|
label: "Override gas limit",
|
|
@@ -5255,7 +5347,7 @@ var CustomGasParameters = ({
|
|
|
5255
5347
|
}
|
|
5256
5348
|
),
|
|
5257
5349
|
showGasLimit && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "pl-6", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5258
|
-
|
|
5350
|
+
import_ui_components7.NumberField,
|
|
5259
5351
|
{
|
|
5260
5352
|
id: "gasLimit",
|
|
5261
5353
|
label: "Gas Limit",
|
|
@@ -5273,7 +5365,7 @@ var CustomGasParameters = ({
|
|
|
5273
5365
|
|
|
5274
5366
|
// src/transaction/components/SpeedSelection.tsx
|
|
5275
5367
|
var import_relayer_sdk2 = require("@openzeppelin/relayer-sdk");
|
|
5276
|
-
var
|
|
5368
|
+
var import_ui_components8 = require("@openzeppelin/ui-components");
|
|
5277
5369
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
5278
5370
|
var speedOptions = [
|
|
5279
5371
|
{
|
|
@@ -5300,7 +5392,7 @@ var speedOptions = [
|
|
|
5300
5392
|
];
|
|
5301
5393
|
var SpeedSelection = ({ selectedSpeed, onSpeedChange }) => {
|
|
5302
5394
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5303
|
-
|
|
5395
|
+
import_ui_components8.RadioGroup,
|
|
5304
5396
|
{
|
|
5305
5397
|
value: selectedSpeed || import_relayer_sdk2.Speed.FAST,
|
|
5306
5398
|
onValueChange: (value) => onSpeedChange(value),
|
|
@@ -5313,7 +5405,7 @@ var SpeedSelection = ({ selectedSpeed, onSpeedChange }) => {
|
|
|
5313
5405
|
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
5406
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-start space-x-3", children: [
|
|
5315
5407
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5316
|
-
|
|
5408
|
+
import_ui_components8.RadioGroupItem,
|
|
5317
5409
|
{
|
|
5318
5410
|
value: option.value,
|
|
5319
5411
|
id: `speed-${option.value}`,
|
|
@@ -5477,13 +5569,13 @@ var EvmRelayerOptions = ({ options, onChange }) => {
|
|
|
5477
5569
|
onToggle: () => setShowAdvancedInfo(!showAdvancedInfo)
|
|
5478
5570
|
}
|
|
5479
5571
|
),
|
|
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)(
|
|
5572
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_ui_components9.Tabs, { value: configMode, onValueChange: handleModeChange, children: [
|
|
5573
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_ui_components9.TabsList, { className: "grid w-full grid-cols-2", children: [
|
|
5574
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_ui_components9.TabsTrigger, { value: "speed", children: "Speed" }),
|
|
5575
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_ui_components9.TabsTrigger, { value: "custom", children: "Custom" })
|
|
5484
5576
|
] }),
|
|
5485
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5486
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5577
|
+
/* @__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 }) }),
|
|
5578
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_ui_components9.TabsContent, { value: "custom", className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
5487
5579
|
CustomGasParameters,
|
|
5488
5580
|
{
|
|
5489
5581
|
control,
|
|
@@ -5498,7 +5590,7 @@ var EvmRelayerOptions = ({ options, onChange }) => {
|
|
|
5498
5590
|
};
|
|
5499
5591
|
|
|
5500
5592
|
// src/wallet/utils/connection.ts
|
|
5501
|
-
var
|
|
5593
|
+
var import_ui_utils39 = require("@openzeppelin/ui-utils");
|
|
5502
5594
|
var LOG_SYSTEM3 = "adapter-evm-connection";
|
|
5503
5595
|
function evmSupportsWalletConnection() {
|
|
5504
5596
|
return true;
|
|
@@ -5506,7 +5598,7 @@ function evmSupportsWalletConnection() {
|
|
|
5506
5598
|
async function getEvmAvailableConnectors() {
|
|
5507
5599
|
const impl = await getEvmWalletImplementation();
|
|
5508
5600
|
if (!impl) {
|
|
5509
|
-
|
|
5601
|
+
import_ui_utils39.logger.warn(LOG_SYSTEM3, "getEvmAvailableConnectors: Wallet implementation not ready.");
|
|
5510
5602
|
return [];
|
|
5511
5603
|
}
|
|
5512
5604
|
return impl.getAvailableConnectors();
|
|
@@ -5514,7 +5606,7 @@ async function getEvmAvailableConnectors() {
|
|
|
5514
5606
|
async function connectAndEnsureCorrectNetwork(connectorId, targetChainId) {
|
|
5515
5607
|
const impl = await getEvmWalletImplementation();
|
|
5516
5608
|
if (!impl) {
|
|
5517
|
-
|
|
5609
|
+
import_ui_utils39.logger.error(LOG_SYSTEM3, "connectAndEnsureCorrectNetwork: Wallet implementation not ready.");
|
|
5518
5610
|
return { connected: false, error: "Wallet system not initialized." };
|
|
5519
5611
|
}
|
|
5520
5612
|
const connectionResult = await impl.connect(connectorId);
|
|
@@ -5522,7 +5614,7 @@ async function connectAndEnsureCorrectNetwork(connectorId, targetChainId) {
|
|
|
5522
5614
|
return { connected: false, error: connectionResult.error || "Connection failed" };
|
|
5523
5615
|
}
|
|
5524
5616
|
if (connectionResult.chainId !== targetChainId) {
|
|
5525
|
-
|
|
5617
|
+
import_ui_utils39.logger.info(
|
|
5526
5618
|
LOG_SYSTEM3,
|
|
5527
5619
|
`Connected to chain ${connectionResult.chainId}, but target is ${targetChainId}. Attempting switch.`
|
|
5528
5620
|
);
|
|
@@ -5531,23 +5623,23 @@ async function connectAndEnsureCorrectNetwork(connectorId, targetChainId) {
|
|
|
5531
5623
|
const postSwitchStatus = impl.getWalletConnectionStatus();
|
|
5532
5624
|
if (postSwitchStatus.chainId !== targetChainId) {
|
|
5533
5625
|
const switchError = `Failed to switch to target network ${targetChainId}. Current: ${postSwitchStatus.chainId}`;
|
|
5534
|
-
|
|
5626
|
+
import_ui_utils39.logger.error(LOG_SYSTEM3, switchError);
|
|
5535
5627
|
try {
|
|
5536
5628
|
await impl.disconnect();
|
|
5537
5629
|
} catch (e) {
|
|
5538
|
-
|
|
5630
|
+
import_ui_utils39.logger.warn(LOG_SYSTEM3, "Failed to disconnect after network switch failure.", e);
|
|
5539
5631
|
}
|
|
5540
5632
|
return { connected: false, error: switchError };
|
|
5541
5633
|
}
|
|
5542
|
-
|
|
5634
|
+
import_ui_utils39.logger.info(LOG_SYSTEM3, `Successfully switched to target chain ${targetChainId}.`);
|
|
5543
5635
|
return { ...connectionResult, chainId: postSwitchStatus.chainId };
|
|
5544
5636
|
} catch (error) {
|
|
5545
5637
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
5546
|
-
|
|
5638
|
+
import_ui_utils39.logger.error(LOG_SYSTEM3, "Network switch failed:", errorMessage);
|
|
5547
5639
|
try {
|
|
5548
5640
|
await impl.disconnect();
|
|
5549
5641
|
} catch (e) {
|
|
5550
|
-
|
|
5642
|
+
import_ui_utils39.logger.warn(LOG_SYSTEM3, "Failed to disconnect after network switch failure.", e);
|
|
5551
5643
|
}
|
|
5552
5644
|
return { connected: false, error: `Network switch failed: ${errorMessage}` };
|
|
5553
5645
|
}
|
|
@@ -5557,7 +5649,7 @@ async function connectAndEnsureCorrectNetwork(connectorId, targetChainId) {
|
|
|
5557
5649
|
async function disconnectEvmWallet() {
|
|
5558
5650
|
const impl = await getEvmWalletImplementation();
|
|
5559
5651
|
if (!impl) {
|
|
5560
|
-
|
|
5652
|
+
import_ui_utils39.logger.warn(LOG_SYSTEM3, "disconnectEvmWallet: Wallet implementation not ready.");
|
|
5561
5653
|
return { disconnected: false, error: "Wallet system not initialized." };
|
|
5562
5654
|
}
|
|
5563
5655
|
return impl.disconnect();
|
|
@@ -5565,7 +5657,7 @@ async function disconnectEvmWallet() {
|
|
|
5565
5657
|
function getEvmWalletConnectionStatus() {
|
|
5566
5658
|
const impl = getInitializedEvmWalletImplementation();
|
|
5567
5659
|
if (!impl) {
|
|
5568
|
-
|
|
5660
|
+
import_ui_utils39.logger.warn(
|
|
5569
5661
|
LOG_SYSTEM3,
|
|
5570
5662
|
"getEvmWalletConnectionStatus: Wallet implementation not ready. Returning default disconnected state."
|
|
5571
5663
|
);
|
|
@@ -5615,13 +5707,13 @@ var EvmAdapter = class {
|
|
|
5615
5707
|
throw new Error("EvmAdapter requires a valid EVM network configuration.");
|
|
5616
5708
|
}
|
|
5617
5709
|
this.networkConfig = networkConfig;
|
|
5618
|
-
|
|
5710
|
+
import_ui_utils40.logger.info(
|
|
5619
5711
|
"EvmAdapter",
|
|
5620
5712
|
`Adapter initialized for network: ${networkConfig.name} (ID: ${networkConfig.id})`
|
|
5621
5713
|
);
|
|
5622
5714
|
const initialGlobalConfig = loadInitialConfigFromAppService();
|
|
5623
5715
|
this.initialAppServiceKitName = initialGlobalConfig.kitName || "custom";
|
|
5624
|
-
|
|
5716
|
+
import_ui_utils40.logger.info(
|
|
5625
5717
|
"EvmAdapter:constructor",
|
|
5626
5718
|
"Initial kitName from AppConfigService noted:",
|
|
5627
5719
|
this.initialAppServiceKitName
|
|
@@ -5856,7 +5948,7 @@ var EvmAdapter = class {
|
|
|
5856
5948
|
onWalletConnectionChange(callback) {
|
|
5857
5949
|
const walletImplementation = getInitializedEvmWalletImplementation();
|
|
5858
5950
|
if (!walletImplementation) {
|
|
5859
|
-
|
|
5951
|
+
import_ui_utils40.logger.warn(
|
|
5860
5952
|
"EvmAdapter:onWalletConnectionChange",
|
|
5861
5953
|
"Wallet implementation not ready. Subscription may not work."
|
|
5862
5954
|
);
|
|
@@ -5911,7 +6003,7 @@ var EvmAdapter = class {
|
|
|
5911
6003
|
options
|
|
5912
6004
|
);
|
|
5913
6005
|
await evmUiKitManager.configure(finalFullConfig);
|
|
5914
|
-
|
|
6006
|
+
import_ui_utils40.logger.info(
|
|
5915
6007
|
"EvmAdapter:configureUiKit",
|
|
5916
6008
|
"EvmUiKitManager configuration requested with final config:",
|
|
5917
6009
|
finalFullConfig
|
|
@@ -5921,7 +6013,7 @@ var EvmAdapter = class {
|
|
|
5921
6013
|
* @inheritdoc
|
|
5922
6014
|
*/
|
|
5923
6015
|
getEcosystemReactUiContextProvider() {
|
|
5924
|
-
|
|
6016
|
+
import_ui_utils40.logger.info("EvmAdapter:getEcosystemReactUiContextProvider", "Returning EvmWalletUiRoot.");
|
|
5925
6017
|
return EvmWalletUiRoot;
|
|
5926
6018
|
}
|
|
5927
6019
|
/**
|
|
@@ -5945,7 +6037,7 @@ var EvmAdapter = class {
|
|
|
5945
6037
|
getEcosystemWalletComponents() {
|
|
5946
6038
|
const currentManagerState = evmUiKitManager.getState();
|
|
5947
6039
|
if (!currentManagerState.currentFullUiKitConfig) {
|
|
5948
|
-
|
|
6040
|
+
import_ui_utils40.logger.debug(
|
|
5949
6041
|
// Changed from warn to debug, as this can be normal during init sequence
|
|
5950
6042
|
"EvmAdapter:getEcosystemWalletComponents",
|
|
5951
6043
|
"No UI kit configuration available in manager yet. Returning undefined components."
|
|
@@ -6084,7 +6176,7 @@ Get your WalletConnect projectId from <a href="https://cloud.walletconnect.com"
|
|
|
6084
6176
|
summary: result.summary
|
|
6085
6177
|
};
|
|
6086
6178
|
} catch (error) {
|
|
6087
|
-
|
|
6179
|
+
import_ui_utils40.logger.error("EVM contract definition comparison failed:", error.message);
|
|
6088
6180
|
throw new Error(`Contract definition comparison failed: ${error.message}`);
|
|
6089
6181
|
}
|
|
6090
6182
|
}
|
|
@@ -6105,6 +6197,12 @@ Get your WalletConnect projectId from <a href="https://cloud.walletconnect.com"
|
|
|
6105
6197
|
hashContractDefinition(definition) {
|
|
6106
6198
|
return abiComparisonService.hashAbi(definition);
|
|
6107
6199
|
}
|
|
6200
|
+
/**
|
|
6201
|
+
* @inheritdoc
|
|
6202
|
+
*/
|
|
6203
|
+
getTypeMappingInfo() {
|
|
6204
|
+
return getEvmTypeMappingInfo();
|
|
6205
|
+
}
|
|
6108
6206
|
};
|
|
6109
6207
|
|
|
6110
6208
|
// src/config.ts
|