@toruslabs/ethereum-controllers 4.9.1 → 4.10.1
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 +14 -9
- package/dist/ethereumControllers.cjs.js.map +1 -1
- package/dist/ethereumControllers.esm.js +12 -9
- 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/Network/createJsonRpcClient.d.ts +2 -1
- package/dist/types/Preferences/PreferencesController.d.ts +1 -0
- package/dist/types/utils/interfaces.d.ts +2 -2
- package/package.json +6 -5
- package/src/Network/NetworkController.ts +1 -1
- package/src/Network/createJsonRpcClient.ts +6 -2
- package/src/Preferences/PreferencesController.ts +10 -3
- package/src/utils/interfaces.ts +2 -1
|
@@ -3369,6 +3369,7 @@ function createEthereumMiddleware(providerHandlers) {
|
|
|
3369
3369
|
|
|
3370
3370
|
|
|
3371
3371
|
|
|
3372
|
+
|
|
3372
3373
|
function createChainIdMiddleware(chainId) {
|
|
3373
3374
|
return (req, res, next, end) => {
|
|
3374
3375
|
if (req.method === "eth_chainId") {
|
|
@@ -3392,7 +3393,7 @@ function createProviderConfigMiddleware(providerConfig) {
|
|
|
3392
3393
|
return next();
|
|
3393
3394
|
};
|
|
3394
3395
|
}
|
|
3395
|
-
function createJsonRpcClient(providerConfig) {
|
|
3396
|
+
function createJsonRpcClient(providerConfig, networkConfig) {
|
|
3396
3397
|
const {
|
|
3397
3398
|
chainId,
|
|
3398
3399
|
rpcTarget
|
|
@@ -3402,9 +3403,9 @@ function createJsonRpcClient(providerConfig) {
|
|
|
3402
3403
|
});
|
|
3403
3404
|
const blockProvider = (0,openlogin_jrpc_namespaceObject.providerFromMiddleware)(fetchMiddleware);
|
|
3404
3405
|
const blockTracker = new Block_PollingBlockTracker({
|
|
3405
|
-
config: {
|
|
3406
|
+
config: objectSpread2_default()(objectSpread2_default()({}, networkConfig), {}, {
|
|
3406
3407
|
provider: blockProvider
|
|
3407
|
-
},
|
|
3408
|
+
}),
|
|
3408
3409
|
state: {}
|
|
3409
3410
|
});
|
|
3410
3411
|
const networkMiddleware = (0,openlogin_jrpc_namespaceObject.mergeMiddleware)([createChainIdMiddleware(chainId), createProviderConfigMiddleware(providerConfig),
|
|
@@ -3606,7 +3607,7 @@ class NetworkController extends base_controllers_namespaceObject.BaseController
|
|
|
3606
3607
|
this.blockTracker = blockTracker;
|
|
3607
3608
|
}
|
|
3608
3609
|
configureStandardProvider(providerConfig) {
|
|
3609
|
-
const networkClient = createJsonRpcClient(providerConfig);
|
|
3610
|
+
const networkClient = createJsonRpcClient(providerConfig, this.config);
|
|
3610
3611
|
external_loglevel_default().info("networkClient", networkClient);
|
|
3611
3612
|
this.setNetworkClient(networkClient);
|
|
3612
3613
|
}
|
|
@@ -4015,6 +4016,7 @@ class NftsController extends base_controllers_namespaceObject.BaseController {
|
|
|
4015
4016
|
|
|
4016
4017
|
|
|
4017
4018
|
|
|
4019
|
+
|
|
4018
4020
|
class PreferencesController extends base_controllers_namespaceObject.BasePreferencesController {
|
|
4019
4021
|
constructor(_ref) {
|
|
4020
4022
|
let {
|
|
@@ -4251,6 +4253,11 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
|
|
|
4251
4253
|
var _this$getAddressState6, _this$getAddressState7;
|
|
4252
4254
|
return (_this$getAddressState6 = (_this$getAddressState7 = this.getAddressState(address)) === null || _this$getAddressState7 === void 0 ? void 0 : _this$getAddressState7.customNfts) !== null && _this$getAddressState6 !== void 0 ? _this$getAddressState6 : [];
|
|
4253
4255
|
}
|
|
4256
|
+
isChainIdSupported(address, chainId) {
|
|
4257
|
+
const approveChainOptions = this.getChainOptions(address);
|
|
4258
|
+
const providerConfig = approveChainOptions.find(x => (0,util_namespaceObject.stripHexPrefix)(x.chainId) === chainId);
|
|
4259
|
+
return !!providerConfig;
|
|
4260
|
+
}
|
|
4254
4261
|
async addChain(network) {
|
|
4255
4262
|
const approveChainOptions = this.getChainOptions();
|
|
4256
4263
|
const providerConfig = approveChainOptions.find(x => x.chainId === network.chainId);
|
|
@@ -4387,12 +4394,12 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
|
|
|
4387
4394
|
}, address);
|
|
4388
4395
|
}
|
|
4389
4396
|
getChainOptions() {
|
|
4390
|
-
var _identities$
|
|
4397
|
+
var _identities$address$c, _identities$address;
|
|
4398
|
+
let address = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.state.selectedAddress;
|
|
4391
4399
|
const {
|
|
4392
|
-
selectedAddress,
|
|
4393
4400
|
identities
|
|
4394
4401
|
} = this.state;
|
|
4395
|
-
const customNetworks = (_identities$
|
|
4402
|
+
const customNetworks = (_identities$address$c = (_identities$address = identities[address]) === null || _identities$address === void 0 ? void 0 : _identities$address.customNetworks) !== null && _identities$address$c !== void 0 ? _identities$address$c : [];
|
|
4396
4403
|
const custom = Object.values(customNetworks).reduce((chains, network) => {
|
|
4397
4404
|
const networkItem = {
|
|
4398
4405
|
blockExplorerUrl: network.block_explorer_url,
|
|
@@ -5615,7 +5622,6 @@ function getFinalStates() {
|
|
|
5615
5622
|
base_controllers_namespaceObject.TransactionStatus.dropped // the tx nonce was already used
|
|
5616
5623
|
];
|
|
5617
5624
|
}
|
|
5618
|
-
|
|
5619
5625
|
function parseStandardTokenTransactionData(data) {
|
|
5620
5626
|
try {
|
|
5621
5627
|
const txDesc = erc20Interface.parseTransaction({
|
|
@@ -6078,7 +6084,6 @@ class TransactionController extends TransactionStateManager {
|
|
|
6078
6084
|
getConfirmedTransactions: this.getConfirmedTransactions.bind(this),
|
|
6079
6085
|
getPendingTransactions: this.getSubmittedTransactions.bind(this) // nonce tracker should only care about submitted transactions
|
|
6080
6086
|
});
|
|
6081
|
-
|
|
6082
6087
|
this.pendingTxTracker = new PendingTransactionTracker({
|
|
6083
6088
|
provider,
|
|
6084
6089
|
nonceTracker: this.nonceTracker,
|