@toruslabs/ethereum-controllers 4.10.0 → 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 +9 -3
- package/dist/ethereumControllers.cjs.js.map +1 -1
- package/dist/ethereumControllers.esm.js +8 -3
- 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 +1 -0
- package/package.json +5 -4
- package/src/Preferences/PreferencesController.ts +10 -3
|
@@ -4016,6 +4016,7 @@ class NftsController extends base_controllers_namespaceObject.BaseController {
|
|
|
4016
4016
|
|
|
4017
4017
|
|
|
4018
4018
|
|
|
4019
|
+
|
|
4019
4020
|
class PreferencesController extends base_controllers_namespaceObject.BasePreferencesController {
|
|
4020
4021
|
constructor(_ref) {
|
|
4021
4022
|
let {
|
|
@@ -4252,6 +4253,11 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
|
|
|
4252
4253
|
var _this$getAddressState6, _this$getAddressState7;
|
|
4253
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 : [];
|
|
4254
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
|
+
}
|
|
4255
4261
|
async addChain(network) {
|
|
4256
4262
|
const approveChainOptions = this.getChainOptions();
|
|
4257
4263
|
const providerConfig = approveChainOptions.find(x => x.chainId === network.chainId);
|
|
@@ -4388,12 +4394,12 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
|
|
|
4388
4394
|
}, address);
|
|
4389
4395
|
}
|
|
4390
4396
|
getChainOptions() {
|
|
4391
|
-
var _identities$
|
|
4397
|
+
var _identities$address$c, _identities$address;
|
|
4398
|
+
let address = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.state.selectedAddress;
|
|
4392
4399
|
const {
|
|
4393
|
-
selectedAddress,
|
|
4394
4400
|
identities
|
|
4395
4401
|
} = this.state;
|
|
4396
|
-
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 : [];
|
|
4397
4403
|
const custom = Object.values(customNetworks).reduce((chains, network) => {
|
|
4398
4404
|
const networkItem = {
|
|
4399
4405
|
blockExplorerUrl: network.block_explorer_url,
|