mirror of
https://github.com/status-im/nim-ethers.git
synced 2025-01-16 02:25:04 +00:00
sendTransaction raises ProviderError instead of SignerError
Allows it to contain error data. It is not the signing that fails, so it makes sense to use an error type that indicates that the provider failed.
This commit is contained in:
parent
1ce9824738
commit
241ce6e8f3
@ -324,9 +324,9 @@ method signMessage*(
|
|||||||
method sendTransaction*(
|
method sendTransaction*(
|
||||||
signer: JsonRpcSigner,
|
signer: JsonRpcSigner,
|
||||||
transaction: Transaction): Future[TransactionResponse]
|
transaction: Transaction): Future[TransactionResponse]
|
||||||
{.async: (raises:[SignerError]).} =
|
{.async: (raises:[SignerError, ProviderError]).} =
|
||||||
|
|
||||||
convertSignerError:
|
convertError:
|
||||||
if nonce =? transaction.nonce:
|
if nonce =? transaction.nonce:
|
||||||
signer.updateNonce(nonce)
|
signer.updateNonce(nonce)
|
||||||
let
|
let
|
||||||
|
@ -43,7 +43,7 @@ method signMessage*(
|
|||||||
method sendTransaction*(
|
method sendTransaction*(
|
||||||
signer: Signer,
|
signer: Signer,
|
||||||
transaction: Transaction): Future[TransactionResponse]
|
transaction: Transaction): Future[TransactionResponse]
|
||||||
{.base, async: (raises:[SignerError]).} =
|
{.base, async: (raises:[SignerError, ProviderError]).} =
|
||||||
|
|
||||||
doAssert false, "not implemented"
|
doAssert false, "not implemented"
|
||||||
|
|
||||||
|
@ -83,9 +83,8 @@ proc signTransaction*(wallet: Wallet,
|
|||||||
method sendTransaction*(
|
method sendTransaction*(
|
||||||
wallet: Wallet,
|
wallet: Wallet,
|
||||||
transaction: Transaction): Future[TransactionResponse]
|
transaction: Transaction): Future[TransactionResponse]
|
||||||
{.async: (raises:[SignerError]).} =
|
{.async: (raises:[SignerError, ProviderError]).} =
|
||||||
|
|
||||||
convertError:
|
|
||||||
let signed = await signTransaction(wallet, transaction)
|
let signed = await signTransaction(wallet, transaction)
|
||||||
if nonce =? transaction.nonce:
|
if nonce =? transaction.nonce:
|
||||||
wallet.updateNonce(nonce)
|
wallet.updateNonce(nonce)
|
||||||
|
@ -20,6 +20,6 @@ method getAddress*(
|
|||||||
method sendTransaction*(
|
method sendTransaction*(
|
||||||
signer: MockSigner,
|
signer: MockSigner,
|
||||||
transaction: Transaction): Future[TransactionResponse]
|
transaction: Transaction): Future[TransactionResponse]
|
||||||
{.async: (raises:[SignerError]).} =
|
{.async: (raises:[SignerError, ProviderError]).} =
|
||||||
|
|
||||||
signer.transactions.add(transaction)
|
signer.transactions.add(transaction)
|
||||||
|
@ -97,7 +97,7 @@ for url in ["ws://localhost:8545", "http://localhost:8545"]:
|
|||||||
discard await provider.getBlock(BlockTag.latest)
|
discard await provider.getBlock(BlockTag.latest)
|
||||||
expect JsonRpcProviderError:
|
expect JsonRpcProviderError:
|
||||||
discard await provider.subscribe(proc(_: Block) = discard)
|
discard await provider.subscribe(proc(_: Block) = discard)
|
||||||
expect JsonRpcSignerError:
|
expect JsonRpcProviderError:
|
||||||
discard await provider.getSigner().sendTransaction(Transaction.example)
|
discard await provider.getSigner().sendTransaction(Transaction.example)
|
||||||
|
|
||||||
test "syncing":
|
test "syncing":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user