@0xsequence/provider 0.41.3 → 0.42.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.
@@ -669,7 +669,14 @@ class WalletRequestHandler {
669
669
  case 'eth_sendTransaction':
670
670
  {
671
671
  // https://eth.wiki/json-rpc/API#eth_sendtransaction
672
- const [transactionParams] = request.params;
672
+ const [transactionParams] = request.params; // eth_sendTransaction uses 'gas'
673
+ // ethers and sequence use 'gasLimit'
674
+
675
+ if ('gas' in transactionParams && transactionParams.gasLimit === undefined) {
676
+ transactionParams.gasLimit = transactionParams.gas;
677
+ delete transactionParams.gas;
678
+ }
679
+
673
680
  let txnHash = '';
674
681
 
675
682
  if (_this.prompter === null) {
@@ -880,13 +887,6 @@ class WalletRequestHandler {
880
887
  }
881
888
  // relayer method
882
889
 
883
- case 'sequence_estimateGasLimits':
884
- {
885
- // TODO
886
- break;
887
- }
888
- // relayer method
889
-
890
890
  case 'sequence_gasRefundOptions':
891
891
  {
892
892
  // TODO
@@ -1418,7 +1418,6 @@ class Web3Signer extends wallet.Signer {
1418
1418
 
1419
1419
  getRelayer(chainId) {
1420
1420
  // TODO: JsonRpcRelayer ......? or, Web3Relayer.. or SequenceRelayer?
1421
- // sequence_estimateGasLimits
1422
1421
  // sequence_gasRefundOptions
1423
1422
  // sequence_getNonce
1424
1423
  // sequence_relay
@@ -1680,17 +1679,19 @@ const hexlifyTransaction = (transaction, allowExtra) => {
1680
1679
  const result = {} // Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros.
1681
1680
  ;
1682
1681
  ['gasLimit', 'gasPrice', 'nonce', 'value'].forEach(key => {
1683
- if (!transaction[key]) {
1682
+ const value = transaction[key];
1683
+
1684
+ if (value === null || value === undefined) {
1684
1685
  return;
1685
1686
  }
1686
1687
 
1687
- const value = ethers.ethers.utils.hexValue(transaction[key]);
1688
+ const hexValue = ethers.ethers.utils.hexValue(value);
1688
1689
 
1689
1690
  if (key === 'gasLimit') {
1690
1691
  key = 'gas';
1691
1692
  }
1692
1693
 
1693
- result[key] = value;
1694
+ result[key] = hexValue;
1694
1695
  });
1695
1696
  ['from', 'to', 'data'].forEach(key => {
1696
1697
  if (!transaction[key]) {
@@ -669,7 +669,14 @@ class WalletRequestHandler {
669
669
  case 'eth_sendTransaction':
670
670
  {
671
671
  // https://eth.wiki/json-rpc/API#eth_sendtransaction
672
- const [transactionParams] = request.params;
672
+ const [transactionParams] = request.params; // eth_sendTransaction uses 'gas'
673
+ // ethers and sequence use 'gasLimit'
674
+
675
+ if ('gas' in transactionParams && transactionParams.gasLimit === undefined) {
676
+ transactionParams.gasLimit = transactionParams.gas;
677
+ delete transactionParams.gas;
678
+ }
679
+
673
680
  let txnHash = '';
674
681
 
675
682
  if (_this.prompter === null) {
@@ -880,13 +887,6 @@ class WalletRequestHandler {
880
887
  }
881
888
  // relayer method
882
889
 
883
- case 'sequence_estimateGasLimits':
884
- {
885
- // TODO
886
- break;
887
- }
888
- // relayer method
889
-
890
890
  case 'sequence_gasRefundOptions':
891
891
  {
892
892
  // TODO
@@ -1418,7 +1418,6 @@ class Web3Signer extends wallet.Signer {
1418
1418
 
1419
1419
  getRelayer(chainId) {
1420
1420
  // TODO: JsonRpcRelayer ......? or, Web3Relayer.. or SequenceRelayer?
1421
- // sequence_estimateGasLimits
1422
1421
  // sequence_gasRefundOptions
1423
1422
  // sequence_getNonce
1424
1423
  // sequence_relay
@@ -1680,17 +1679,19 @@ const hexlifyTransaction = (transaction, allowExtra) => {
1680
1679
  const result = {} // Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros.
1681
1680
  ;
1682
1681
  ['gasLimit', 'gasPrice', 'nonce', 'value'].forEach(key => {
1683
- if (!transaction[key]) {
1682
+ const value = transaction[key];
1683
+
1684
+ if (value === null || value === undefined) {
1684
1685
  return;
1685
1686
  }
1686
1687
 
1687
- const value = ethers.ethers.utils.hexValue(transaction[key]);
1688
+ const hexValue = ethers.ethers.utils.hexValue(value);
1688
1689
 
1689
1690
  if (key === 'gasLimit') {
1690
1691
  key = 'gas';
1691
1692
  }
1692
1693
 
1693
- result[key] = value;
1694
+ result[key] = hexValue;
1694
1695
  });
1695
1696
  ['from', 'to', 'data'].forEach(key => {
1696
1697
  if (!transaction[key]) {
@@ -665,7 +665,14 @@ class WalletRequestHandler {
665
665
  case 'eth_sendTransaction':
666
666
  {
667
667
  // https://eth.wiki/json-rpc/API#eth_sendtransaction
668
- const [transactionParams] = request.params;
668
+ const [transactionParams] = request.params; // eth_sendTransaction uses 'gas'
669
+ // ethers and sequence use 'gasLimit'
670
+
671
+ if ('gas' in transactionParams && transactionParams.gasLimit === undefined) {
672
+ transactionParams.gasLimit = transactionParams.gas;
673
+ delete transactionParams.gas;
674
+ }
675
+
669
676
  let txnHash = '';
670
677
 
671
678
  if (_this.prompter === null) {
@@ -876,13 +883,6 @@ class WalletRequestHandler {
876
883
  }
877
884
  // relayer method
878
885
 
879
- case 'sequence_estimateGasLimits':
880
- {
881
- // TODO
882
- break;
883
- }
884
- // relayer method
885
-
886
886
  case 'sequence_gasRefundOptions':
887
887
  {
888
888
  // TODO
@@ -1414,7 +1414,6 @@ class Web3Signer extends Signer {
1414
1414
 
1415
1415
  getRelayer(chainId) {
1416
1416
  // TODO: JsonRpcRelayer ......? or, Web3Relayer.. or SequenceRelayer?
1417
- // sequence_estimateGasLimits
1418
1417
  // sequence_gasRefundOptions
1419
1418
  // sequence_getNonce
1420
1419
  // sequence_relay
@@ -1676,17 +1675,19 @@ const hexlifyTransaction = (transaction, allowExtra) => {
1676
1675
  const result = {} // Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros.
1677
1676
  ;
1678
1677
  ['gasLimit', 'gasPrice', 'nonce', 'value'].forEach(key => {
1679
- if (!transaction[key]) {
1678
+ const value = transaction[key];
1679
+
1680
+ if (value === null || value === undefined) {
1680
1681
  return;
1681
1682
  }
1682
1683
 
1683
- const value = ethers.utils.hexValue(transaction[key]);
1684
+ const hexValue = ethers.utils.hexValue(value);
1684
1685
 
1685
1686
  if (key === 'gasLimit') {
1686
1687
  key = 'gas';
1687
1688
  }
1688
1689
 
1689
- result[key] = value;
1690
+ result[key] = hexValue;
1690
1691
  });
1691
1692
  ['from', 'to', 'data'].forEach(key => {
1692
1693
  if (!transaction[key]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/provider",
3
- "version": "0.41.3",
3
+ "version": "0.42.0",
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.41.3",
17
- "@0xsequence/auth": "^0.41.3",
18
- "@0xsequence/config": "^0.41.3",
19
- "@0xsequence/network": "^0.41.3",
20
- "@0xsequence/transactions": "^0.41.3",
21
- "@0xsequence/utils": "^0.41.3",
22
- "@0xsequence/wallet": "^0.41.3",
16
+ "@0xsequence/abi": "^0.42.0",
17
+ "@0xsequence/auth": "^0.42.0",
18
+ "@0xsequence/config": "^0.42.0",
19
+ "@0xsequence/network": "^0.42.0",
20
+ "@0xsequence/transactions": "^0.42.0",
21
+ "@0xsequence/utils": "^0.42.0",
22
+ "@0xsequence/wallet": "^0.42.0",
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
@@ -173,7 +173,6 @@ export class Web3Signer extends Signer implements TypedDataSigner {
173
173
 
174
174
  getRelayer(chainId?: number): Promise<Relayer | undefined> {
175
175
  // TODO: JsonRpcRelayer ......? or, Web3Relayer.. or SequenceRelayer?
176
- // sequence_estimateGasLimits
177
176
  // sequence_gasRefundOptions
178
177
  // sequence_getNonce
179
178
  // sequence_relay
@@ -483,14 +482,15 @@ const hexlifyTransaction = (
483
482
 
484
483
  // Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros.
485
484
  ;['gasLimit', 'gasPrice', 'nonce', 'value'].forEach(key => {
486
- if (!(<any>transaction)[key]) {
485
+ const value = (transaction as any)[key]
486
+ if (value === null || value === undefined) {
487
487
  return
488
488
  }
489
- const value = ethers.utils.hexValue((<any>transaction)[key])
489
+ const hexValue = ethers.utils.hexValue(value)
490
490
  if (key === 'gasLimit') {
491
491
  key = 'gas'
492
492
  }
493
- result[key] = value
493
+ result[key] = hexValue
494
494
  })
495
495
  ;['from', 'to', 'data'].forEach(key => {
496
496
  if (!(<any>transaction)[key]) {
@@ -367,6 +367,13 @@ export class WalletRequestHandler implements ExternalProvider, JsonRpcHandler, P
367
367
  // https://eth.wiki/json-rpc/API#eth_sendtransaction
368
368
  const [transactionParams] = request.params!
369
369
 
370
+ // eth_sendTransaction uses 'gas'
371
+ // ethers and sequence use 'gasLimit'
372
+ if ('gas' in transactionParams && transactionParams.gasLimit === undefined) {
373
+ transactionParams.gasLimit = transactionParams.gas
374
+ delete transactionParams.gas
375
+ }
376
+
370
377
  let txnHash = ''
371
378
  if (this.prompter === null) {
372
379
  // prompter is null, so we'll send from here
@@ -549,12 +556,6 @@ export class WalletRequestHandler implements ExternalProvider, JsonRpcHandler, P
549
556
  break
550
557
  }
551
558
 
552
- // relayer method
553
- case 'sequence_estimateGasLimits': {
554
- // TODO
555
- break
556
- }
557
-
558
559
  // relayer method
559
560
  case 'sequence_gasRefundOptions': {
560
561
  // TODO