@0xsequence/provider 0.43.0 → 0.43.2

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.
@@ -1458,7 +1458,7 @@ class Web3Signer extends wallet.Signer {
1458
1458
  });
1459
1459
  }
1460
1460
  connectUnchecked() {
1461
- throw new Error('connectUnchecked is unsupported');
1461
+ return new UncheckedJsonRpcSigner(this.provider, this.defaultChainId);
1462
1462
  }
1463
1463
  async unlock(password) {
1464
1464
  const address = await this.getAddress();
@@ -1531,6 +1531,24 @@ const hexlifyTransaction = (transaction, allowExtra) => {
1531
1531
  }
1532
1532
  return result;
1533
1533
  };
1534
+ class UncheckedJsonRpcSigner extends Web3Signer {
1535
+ sendTransaction(transaction) {
1536
+ return this.sendUncheckedTransaction(transaction).then(hash => {
1537
+ return {
1538
+ chainId: 0,
1539
+ confirmations: 0,
1540
+ data: '',
1541
+ from: '',
1542
+ gasLimit: ethers.ethers.constants.Zero,
1543
+ gasPrice: ethers.ethers.constants.Zero,
1544
+ hash,
1545
+ nonce: 0,
1546
+ value: ethers.ethers.constants.Zero,
1547
+ wait: confirmations => this.provider.waitForTransaction(hash, confirmations)
1548
+ };
1549
+ });
1550
+ }
1551
+ }
1534
1552
 
1535
1553
  function messageIsExemptFromEIP191Prefix(message) {
1536
1554
  return EIP_191_PREFIX_EXCEPTIONS.some(e => e.predicate(message));
@@ -1458,7 +1458,7 @@ class Web3Signer extends wallet.Signer {
1458
1458
  });
1459
1459
  }
1460
1460
  connectUnchecked() {
1461
- throw new Error('connectUnchecked is unsupported');
1461
+ return new UncheckedJsonRpcSigner(this.provider, this.defaultChainId);
1462
1462
  }
1463
1463
  async unlock(password) {
1464
1464
  const address = await this.getAddress();
@@ -1531,6 +1531,24 @@ const hexlifyTransaction = (transaction, allowExtra) => {
1531
1531
  }
1532
1532
  return result;
1533
1533
  };
1534
+ class UncheckedJsonRpcSigner extends Web3Signer {
1535
+ sendTransaction(transaction) {
1536
+ return this.sendUncheckedTransaction(transaction).then(hash => {
1537
+ return {
1538
+ chainId: 0,
1539
+ confirmations: 0,
1540
+ data: '',
1541
+ from: '',
1542
+ gasLimit: ethers.ethers.constants.Zero,
1543
+ gasPrice: ethers.ethers.constants.Zero,
1544
+ hash,
1545
+ nonce: 0,
1546
+ value: ethers.ethers.constants.Zero,
1547
+ wait: confirmations => this.provider.waitForTransaction(hash, confirmations)
1548
+ };
1549
+ });
1550
+ }
1551
+ }
1534
1552
 
1535
1553
  function messageIsExemptFromEIP191Prefix(message) {
1536
1554
  return EIP_191_PREFIX_EXCEPTIONS.some(e => e.predicate(message));
@@ -1454,7 +1454,7 @@ class Web3Signer extends Signer {
1454
1454
  });
1455
1455
  }
1456
1456
  connectUnchecked() {
1457
- throw new Error('connectUnchecked is unsupported');
1457
+ return new UncheckedJsonRpcSigner(this.provider, this.defaultChainId);
1458
1458
  }
1459
1459
  async unlock(password) {
1460
1460
  const address = await this.getAddress();
@@ -1527,6 +1527,24 @@ const hexlifyTransaction = (transaction, allowExtra) => {
1527
1527
  }
1528
1528
  return result;
1529
1529
  };
1530
+ class UncheckedJsonRpcSigner extends Web3Signer {
1531
+ sendTransaction(transaction) {
1532
+ return this.sendUncheckedTransaction(transaction).then(hash => {
1533
+ return {
1534
+ chainId: 0,
1535
+ confirmations: 0,
1536
+ data: '',
1537
+ from: '',
1538
+ gasLimit: ethers.constants.Zero,
1539
+ gasPrice: ethers.constants.Zero,
1540
+ hash,
1541
+ nonce: 0,
1542
+ value: ethers.constants.Zero,
1543
+ wait: confirmations => this.provider.waitForTransaction(hash, confirmations)
1544
+ };
1545
+ });
1546
+ }
1547
+ }
1530
1548
 
1531
1549
  function messageIsExemptFromEIP191Prefix(message) {
1532
1550
  return EIP_191_PREFIX_EXCEPTIONS.some(e => e.predicate(message));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/provider",
3
- "version": "0.43.0",
3
+ "version": "0.43.2",
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",
@@ -14,13 +14,13 @@
14
14
  "typecheck": "tsc --noEmit"
15
15
  },
16
16
  "dependencies": {
17
- "@0xsequence/abi": "^0.43.0",
18
- "@0xsequence/auth": "^0.43.0",
19
- "@0xsequence/config": "^0.43.0",
20
- "@0xsequence/network": "^0.43.0",
21
- "@0xsequence/transactions": "^0.43.0",
22
- "@0xsequence/utils": "^0.43.0",
23
- "@0xsequence/wallet": "^0.43.0",
17
+ "@0xsequence/abi": "^0.43.2",
18
+ "@0xsequence/auth": "^0.43.2",
19
+ "@0xsequence/config": "^0.43.2",
20
+ "@0xsequence/network": "^0.43.2",
21
+ "@0xsequence/transactions": "^0.43.2",
22
+ "@0xsequence/utils": "^0.43.2",
23
+ "@0xsequence/wallet": "^0.43.2",
24
24
  "eventemitter2": "^6.4.5",
25
25
  "webextension-polyfill-ts": "^0.26.0"
26
26
  },
package/src/provider.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ethers, BytesLike, Bytes, providers, TypedDataDomain, TypedDataField } from 'ethers'
1
+ import { ethers, BytesLike, Bytes, providers, TypedDataDomain, TypedDataField, BigNumber } from 'ethers'
2
2
  import {
3
3
  NetworkConfig,
4
4
  WalletContext,
@@ -14,11 +14,7 @@ import { resolveArrayProperties, Signer } from '@0xsequence/wallet'
14
14
  import { WalletConfig, WalletState } from '@0xsequence/config'
15
15
  import { Relayer } from '@0xsequence/relayer'
16
16
  import { Deferrable, shallowCopy, resolveProperties, Forbid } from '@0xsequence/utils'
17
- import {
18
- TransactionRequest,
19
- TransactionResponse,
20
- SignedTransactions
21
- } from '@0xsequence/transactions'
17
+ import { TransactionRequest, TransactionResponse, SignedTransactions } from '@0xsequence/transactions'
22
18
  import { WalletRequestHandler } from './transports/wallet-request-handler'
23
19
 
24
20
  export class Web3Provider extends providers.Web3Provider implements JsonRpcHandler {
@@ -92,7 +88,11 @@ export class LocalWeb3Provider extends Web3Provider {
92
88
 
93
89
  // TODO: in the future with ethers v6 we can remove/change this type name
94
90
  interface TypedDataSigner {
95
- _signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
91
+ _signTypedData(
92
+ domain: TypedDataDomain,
93
+ types: Record<string, Array<TypedDataField>>,
94
+ value: Record<string, any>
95
+ ): Promise<string>
96
96
  }
97
97
 
98
98
  export class Web3Signer extends Signer implements TypedDataSigner {
@@ -431,7 +431,7 @@ export class Web3Signer extends Signer implements TypedDataSigner {
431
431
  }
432
432
 
433
433
  connectUnchecked(): ethers.providers.JsonRpcSigner {
434
- throw new Error('connectUnchecked is unsupported')
434
+ return new UncheckedJsonRpcSigner(this.provider, this.defaultChainId)
435
435
  }
436
436
 
437
437
  async unlock(password: string): Promise<boolean> {
@@ -511,3 +511,22 @@ const hexlifyTransaction = (
511
511
 
512
512
  return result
513
513
  }
514
+
515
+ class UncheckedJsonRpcSigner extends Web3Signer {
516
+ sendTransaction(transaction: Deferrable<TransactionRequest>): Promise<TransactionResponse> {
517
+ return this.sendUncheckedTransaction(transaction).then(hash => {
518
+ return <TransactionResponse>{
519
+ chainId: 0,
520
+ confirmations: 0,
521
+ data: '',
522
+ from: '',
523
+ gasLimit: ethers.constants.Zero,
524
+ gasPrice: ethers.constants.Zero,
525
+ hash,
526
+ nonce: 0,
527
+ value: ethers.constants.Zero,
528
+ wait: (confirmations?: number) => this.provider.waitForTransaction(hash, confirmations)
529
+ }
530
+ })
531
+ }
532
+ }