@toruslabs/ethereum-controllers 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ethereumControllers.cjs.js +26 -11
- package/dist/ethereumControllers.cjs.js.map +1 -1
- package/dist/ethereumControllers.esm.js +26 -11
- package/dist/ethereumControllers.esm.js.map +1 -1
- package/dist/ethereumControllers.umd.min.js +1 -1
- package/dist/ethereumControllers.umd.min.js.map +1 -1
- package/dist/types/Preferences/PreferencesController.d.ts +5 -0
- package/dist/types/utils/interfaces.d.ts +0 -1
- package/package.json +3 -3
- package/src/Preferences/PreferencesController.ts +17 -4
- package/src/utils/constants.ts +7 -7
- package/src/utils/interfaces.ts +0 -1
- package/dist/types/utils/abiDecoder.d.ts +0 -17
- package/src/utils/abiDecoder.ts +0 -195
|
@@ -628,7 +628,7 @@ const SUPPORTED_NETWORKS = {
|
|
|
628
628
|
rpcTarget: `https://goerli.infura.io/v3/${process.env.VITE_APP_INFURA_PROJECT_KEY}`,
|
|
629
629
|
ticker: "ETH",
|
|
630
630
|
tickerName: "Ethereum",
|
|
631
|
-
|
|
631
|
+
isTestnet: true
|
|
632
632
|
},
|
|
633
633
|
[SEPOLIA_CHAIN_ID]: {
|
|
634
634
|
blockExplorerUrl: "https://sepolia.etherscan.io",
|
|
@@ -638,7 +638,7 @@ const SUPPORTED_NETWORKS = {
|
|
|
638
638
|
rpcTarget: `https://sepolia.infura.io/v3/${process.env.VITE_APP_INFURA_PROJECT_KEY}`,
|
|
639
639
|
ticker: "ETH",
|
|
640
640
|
tickerName: "Ethereum",
|
|
641
|
-
|
|
641
|
+
isTestnet: true
|
|
642
642
|
},
|
|
643
643
|
[POLYGON_MUMBAI_CHAIN_ID]: {
|
|
644
644
|
blockExplorerUrl: "https://mumbai.polygonscan.com",
|
|
@@ -648,7 +648,7 @@ const SUPPORTED_NETWORKS = {
|
|
|
648
648
|
rpcTarget: `https://polygon-mumbai.infura.io/v3/${process.env.VITE_APP_INFURA_PROJECT_KEY}`,
|
|
649
649
|
ticker: "MATIC",
|
|
650
650
|
tickerName: "Matic Network Token",
|
|
651
|
-
|
|
651
|
+
isTestnet: true
|
|
652
652
|
},
|
|
653
653
|
[BSC_TESTNET_CHAIN_ID]: {
|
|
654
654
|
blockExplorerUrl: "https://testnet.bscscan.com",
|
|
@@ -658,7 +658,7 @@ const SUPPORTED_NETWORKS = {
|
|
|
658
658
|
rpcTarget: `https://data-seed-prebsc-1-s1.binance.org:8545`,
|
|
659
659
|
ticker: "BNB",
|
|
660
660
|
tickerName: "Binance Coin",
|
|
661
|
-
|
|
661
|
+
isTestnet: true
|
|
662
662
|
},
|
|
663
663
|
[AVALANCHE_TESTNET_CHAIN_ID]: {
|
|
664
664
|
blockExplorerUrl: "https://testnet.snowtrace.io",
|
|
@@ -668,7 +668,7 @@ const SUPPORTED_NETWORKS = {
|
|
|
668
668
|
rpcTarget: `https://api.avax-test.network/ext/bc/C/rpc`,
|
|
669
669
|
ticker: "AVAX",
|
|
670
670
|
tickerName: "Avalanche",
|
|
671
|
-
|
|
671
|
+
isTestnet: true
|
|
672
672
|
},
|
|
673
673
|
[ARBITRUM_TESTNET_CHAIN_ID]: {
|
|
674
674
|
blockExplorerUrl: "https://testnet.arbiscan.io",
|
|
@@ -678,7 +678,7 @@ const SUPPORTED_NETWORKS = {
|
|
|
678
678
|
rpcTarget: `https://arbitrum-rinkeby.infura.io/v3/${process.env.VITE_APP_INFURA_PROJECT_KEY}`,
|
|
679
679
|
ticker: "ETH",
|
|
680
680
|
tickerName: "Ethereum",
|
|
681
|
-
|
|
681
|
+
isTestnet: true
|
|
682
682
|
},
|
|
683
683
|
[OPTIMISM_TESTNET_CHAIN_ID]: {
|
|
684
684
|
blockExplorerUrl: "https://goerli-optimism.etherscan.io",
|
|
@@ -688,7 +688,7 @@ const SUPPORTED_NETWORKS = {
|
|
|
688
688
|
rpcTarget: `https://optimism-goerli.infura.io/v3/${process.env.VITE_APP_INFURA_PROJECT_KEY}`,
|
|
689
689
|
ticker: "ETH",
|
|
690
690
|
tickerName: "Ethereum",
|
|
691
|
-
|
|
691
|
+
isTestnet: true
|
|
692
692
|
}
|
|
693
693
|
};
|
|
694
694
|
const METHOD_TYPES = {
|
|
@@ -3280,9 +3280,13 @@ class PreferencesController extends BasePreferencesController {
|
|
|
3280
3280
|
calledFromEmbed,
|
|
3281
3281
|
userInfo,
|
|
3282
3282
|
rehydrate,
|
|
3283
|
-
locale = "en-US"
|
|
3283
|
+
locale = "en-US",
|
|
3284
|
+
type
|
|
3284
3285
|
} = params;
|
|
3285
|
-
await super.init(address, userInfo, jwtToken
|
|
3286
|
+
await super.init(address, userInfo, jwtToken, {
|
|
3287
|
+
type,
|
|
3288
|
+
email: userInfo.email
|
|
3289
|
+
});
|
|
3286
3290
|
const {
|
|
3287
3291
|
aggregateVerifier,
|
|
3288
3292
|
verifier,
|
|
@@ -3405,6 +3409,17 @@ class PreferencesController extends BasePreferencesController {
|
|
|
3405
3409
|
const selectedAddress = address || this.state.selectedAddress;
|
|
3406
3410
|
if ((_this$getAddressState3 = this.getAddressState(selectedAddress)) !== null && _this$getAddressState3 !== void 0 && _this$getAddressState3.jwtToken) ;
|
|
3407
3411
|
}
|
|
3412
|
+
async fetchEtherscanTx(parameters) {
|
|
3413
|
+
try {
|
|
3414
|
+
const url = new URL(`${this.config.api}/etherscan`);
|
|
3415
|
+
Object.keys(parameters).forEach(key => url.searchParams.append(key, parameters[key]));
|
|
3416
|
+
const response = await get(url.href, this.headers(parameters.selectedAddress));
|
|
3417
|
+
return response.success ? response.data : [];
|
|
3418
|
+
} catch (error) {
|
|
3419
|
+
log.error("unable to fetch etherscan tx", error);
|
|
3420
|
+
return [];
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3408
3423
|
async getEtherScanTokens(address, chainId) {
|
|
3409
3424
|
const selectedAddress = address;
|
|
3410
3425
|
const apiUrl = new URL(this.config.api);
|
|
@@ -3450,7 +3465,7 @@ class PreferencesController extends BasePreferencesController {
|
|
|
3450
3465
|
chain_id: network.chainId,
|
|
3451
3466
|
symbol: network.ticker,
|
|
3452
3467
|
block_explorer_url: network.blockExplorerUrl || undefined,
|
|
3453
|
-
is_test_net: network.
|
|
3468
|
+
is_test_net: network.isTestnet || false
|
|
3454
3469
|
};
|
|
3455
3470
|
const res = await post(apiUrl.href, payload, this.headers(selectedAddress), {
|
|
3456
3471
|
useAPIKey: true
|
|
@@ -3496,7 +3511,7 @@ class PreferencesController extends BasePreferencesController {
|
|
|
3496
3511
|
chain_id: network.chainId,
|
|
3497
3512
|
symbol: network.ticker || undefined,
|
|
3498
3513
|
block_explorer_url: network.blockExplorerUrl || undefined,
|
|
3499
|
-
is_test_net: network.
|
|
3514
|
+
is_test_net: network.isTestnet || false
|
|
3500
3515
|
};
|
|
3501
3516
|
await patch(apiUrl.href, payload, this.headers(selectedAddress), {
|
|
3502
3517
|
useAPIKey: true
|