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*(
|
||||
signer: JsonRpcSigner,
|
||||
transaction: Transaction): Future[TransactionResponse]
|
||||
{.async: (raises:[SignerError]).} =
|
||||
{.async: (raises:[SignerError, ProviderError]).} =
|
||||
|
||||
convertSignerError:
|
||||
convertError:
|
||||
if nonce =? transaction.nonce:
|
||||
signer.updateNonce(nonce)
|
||||
let
|
||||
|
|
|
@ -43,7 +43,7 @@ method signMessage*(
|
|||
method sendTransaction*(
|
||||
signer: Signer,
|
||||
transaction: Transaction): Future[TransactionResponse]
|
||||
{.base, async: (raises:[SignerError]).} =
|
||||
{.base, async: (raises:[SignerError, ProviderError]).} =
|
||||
|
||||
doAssert false, "not implemented"
|
||||
|
||||
|
|
|
@ -83,10 +83,9 @@ proc signTransaction*(wallet: Wallet,
|
|||
method sendTransaction*(
|
||||
wallet: Wallet,
|
||||
transaction: Transaction): Future[TransactionResponse]
|
||||
{.async: (raises:[SignerError]).} =
|
||||
{.async: (raises:[SignerError, ProviderError]).} =
|
||||
|
||||
convertError:
|
||||
let signed = await signTransaction(wallet, transaction)
|
||||
if nonce =? transaction.nonce:
|
||||
wallet.updateNonce(nonce)
|
||||
return await provider(wallet).sendTransaction(signed)
|
||||
let signed = await signTransaction(wallet, transaction)
|
||||
if nonce =? transaction.nonce:
|
||||
wallet.updateNonce(nonce)
|
||||
return await provider(wallet).sendTransaction(signed)
|
||||
|
|
|
@ -20,6 +20,6 @@ method getAddress*(
|
|||
method sendTransaction*(
|
||||
signer: MockSigner,
|
||||
transaction: Transaction): Future[TransactionResponse]
|
||||
{.async: (raises:[SignerError]).} =
|
||||
{.async: (raises:[SignerError, ProviderError]).} =
|
||||
|
||||
signer.transactions.add(transaction)
|
||||
|
|
|
@ -97,7 +97,7 @@ for url in ["ws://localhost:8545", "http://localhost:8545"]:
|
|||
discard await provider.getBlock(BlockTag.latest)
|
||||
expect JsonRpcProviderError:
|
||||
discard await provider.subscribe(proc(_: Block) = discard)
|
||||
expect JsonRpcSignerError:
|
||||
expect JsonRpcProviderError:
|
||||
discard await provider.getSigner().sendTransaction(Transaction.example)
|
||||
|
||||
test "syncing":
|
||||
|
|
Loading…
Reference in New Issue