@0xsequence/provider 0.39.2 → 0.39.5

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.
@@ -1312,6 +1312,10 @@ class Web3Provider extends providers.Web3Provider {
1312
1312
  return this._sender.send(method, params, chainId);
1313
1313
  }
1314
1314
 
1315
+ request(request) {
1316
+ return this.send(request.method, request.params || [], request.chainId);
1317
+ }
1318
+
1315
1319
  getSigner() {
1316
1320
  return new Web3Signer(this, this._defaultChainId);
1317
1321
  }
@@ -3748,8 +3752,10 @@ class Wallet {
3748
3752
  if (!this.config.networks && !this.config.networkRpcUrl) {
3749
3753
  this.networks = networks;
3750
3754
  return;
3751
- } // combine custom network config with networks in the session
3755
+ } // init networks
3756
+
3752
3757
 
3758
+ this.networks = networks; // combine custom network config with networks in the session
3753
3759
 
3754
3760
  if (this.config.networks) {
3755
3761
  this.networks = networks.map(n => _extends({}, n)); // copy
@@ -3764,7 +3770,11 @@ class Wallet {
3764
3770
 
3765
3771
 
3766
3772
  if (this.config.networkRpcUrl) {
3767
- this.networks.find(network => network.isDefaultChain).rpcUrl = this.config.networkRpcUrl;
3773
+ const network = this.networks.find(network => network.isDefaultChain);
3774
+
3775
+ if (network) {
3776
+ network.rpcUrl = this.config.networkRpcUrl;
3777
+ }
3768
3778
  }
3769
3779
  }
3770
3780
 
@@ -1312,6 +1312,10 @@ class Web3Provider extends providers.Web3Provider {
1312
1312
  return this._sender.send(method, params, chainId);
1313
1313
  }
1314
1314
 
1315
+ request(request) {
1316
+ return this.send(request.method, request.params || [], request.chainId);
1317
+ }
1318
+
1315
1319
  getSigner() {
1316
1320
  return new Web3Signer(this, this._defaultChainId);
1317
1321
  }
@@ -3748,8 +3752,10 @@ class Wallet {
3748
3752
  if (!this.config.networks && !this.config.networkRpcUrl) {
3749
3753
  this.networks = networks;
3750
3754
  return;
3751
- } // combine custom network config with networks in the session
3755
+ } // init networks
3756
+
3752
3757
 
3758
+ this.networks = networks; // combine custom network config with networks in the session
3753
3759
 
3754
3760
  if (this.config.networks) {
3755
3761
  this.networks = networks.map(n => _extends({}, n)); // copy
@@ -3764,7 +3770,11 @@ class Wallet {
3764
3770
 
3765
3771
 
3766
3772
  if (this.config.networkRpcUrl) {
3767
- this.networks.find(network => network.isDefaultChain).rpcUrl = this.config.networkRpcUrl;
3773
+ const network = this.networks.find(network => network.isDefaultChain);
3774
+
3775
+ if (network) {
3776
+ network.rpcUrl = this.config.networkRpcUrl;
3777
+ }
3768
3778
  }
3769
3779
  }
3770
3780
 
@@ -1308,6 +1308,10 @@ class Web3Provider extends Web3Provider$1 {
1308
1308
  return this._sender.send(method, params, chainId);
1309
1309
  }
1310
1310
 
1311
+ request(request) {
1312
+ return this.send(request.method, request.params || [], request.chainId);
1313
+ }
1314
+
1311
1315
  getSigner() {
1312
1316
  return new Web3Signer(this, this._defaultChainId);
1313
1317
  }
@@ -3744,8 +3748,10 @@ class Wallet {
3744
3748
  if (!this.config.networks && !this.config.networkRpcUrl) {
3745
3749
  this.networks = networks;
3746
3750
  return;
3747
- } // combine custom network config with networks in the session
3751
+ } // init networks
3752
+
3748
3753
 
3754
+ this.networks = networks; // combine custom network config with networks in the session
3749
3755
 
3750
3756
  if (this.config.networks) {
3751
3757
  this.networks = networks.map(n => _extends({}, n)); // copy
@@ -3760,7 +3766,11 @@ class Wallet {
3760
3766
 
3761
3767
 
3762
3768
  if (this.config.networkRpcUrl) {
3763
- this.networks.find(network => network.isDefaultChain).rpcUrl = this.config.networkRpcUrl;
3769
+ const network = this.networks.find(network => network.isDefaultChain);
3770
+
3771
+ if (network) {
3772
+ network.rpcUrl = this.config.networkRpcUrl;
3773
+ }
3764
3774
  }
3765
3775
  }
3766
3776
 
@@ -16,6 +16,11 @@ export declare class Web3Provider extends EthersWeb3Provider implements JsonRpcH
16
16
  constructor(provider: JsonRpcProvider | JsonRpcHandler | JsonRpcFetchFunc, defaultChainId?: ChainIdLike);
17
17
  sendAsync(request: JsonRpcRequest, callback: JsonRpcResponseCallback | ((error: any, response: any) => void), chainId?: number): void;
18
18
  send(method: string, params: Array<any>, chainId?: number): Promise<any>;
19
+ request(request: {
20
+ method: string;
21
+ params?: Array<any>;
22
+ chainId?: number;
23
+ }): Promise<any>;
19
24
  getSigner(): Web3Signer;
20
25
  getChainId(): Promise<number>;
21
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/provider",
3
- "version": "0.39.2",
3
+ "version": "0.39.5",
4
4
  "description": "provider sub-package for Sequence",
5
5
  "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
6
6
  "source": "src/index.ts",
@@ -13,13 +13,13 @@
13
13
  "typecheck": "tsc --noEmit"
14
14
  },
15
15
  "dependencies": {
16
- "@0xsequence/abi": "^0.39.2",
17
- "@0xsequence/auth": "^0.39.2",
18
- "@0xsequence/config": "^0.39.2",
19
- "@0xsequence/network": "^0.39.2",
20
- "@0xsequence/transactions": "^0.39.2",
21
- "@0xsequence/utils": "^0.39.2",
22
- "@0xsequence/wallet": "^0.39.2",
16
+ "@0xsequence/abi": "^0.39.5",
17
+ "@0xsequence/auth": "^0.39.5",
18
+ "@0xsequence/config": "^0.39.5",
19
+ "@0xsequence/network": "^0.39.5",
20
+ "@0xsequence/transactions": "^0.39.5",
21
+ "@0xsequence/utils": "^0.39.5",
22
+ "@0xsequence/wallet": "^0.39.5",
23
23
  "@ethersproject/abstract-signer": "^5.5.0",
24
24
  "@ethersproject/hash": "^5.5.0",
25
25
  "@ethersproject/providers": "^5.5.1",
package/src/provider.ts CHANGED
@@ -66,6 +66,10 @@ export class Web3Provider extends EthersWeb3Provider implements JsonRpcHandler {
66
66
  return this._sender.send(method, params, chainId)
67
67
  }
68
68
 
69
+ request(request: { method: string; params?: Array<any>, chainId?: number }): Promise<any> {
70
+ return this.send(request.method, request.params || [], request.chainId)
71
+ }
72
+
69
73
  getSigner(): Web3Signer {
70
74
  return new Web3Signer(this, this._defaultChainId)
71
75
  }
package/src/wallet.ts CHANGED
@@ -619,6 +619,9 @@ export class Wallet implements WalletProvider {
619
619
  return
620
620
  }
621
621
 
622
+ // init networks
623
+ this.networks = networks
624
+
622
625
  // combine custom network config with networks in the session
623
626
  if (this.config.networks) {
624
627
  this.networks = networks.map(n => ({ ...n })) // copy
@@ -632,7 +635,10 @@ export class Wallet implements WalletProvider {
632
635
 
633
636
  // an extra override for convenience
634
637
  if (this.config.networkRpcUrl) {
635
- this.networks.find(network => network.isDefaultChain)!.rpcUrl = this.config.networkRpcUrl
638
+ const network = this.networks.find(network => network.isDefaultChain)
639
+ if (network) {
640
+ network.rpcUrl = this.config.networkRpcUrl
641
+ }
636
642
  }
637
643
  }
638
644