mirror of
https://github.com/logos-storage/nim-ethers.git
synced 2026-01-09 09:03:08 +00:00
fix: specify raises for getAddress and sendTransaction
Fixes issue where getAddress and sendTransaction could not be found for MockSigner in tests. The problem was that the async: raises update had not been applied to the MockSigner.
This commit is contained in:
parent
502457633d
commit
69f90a3d67
@ -301,7 +301,7 @@ method provider*(signer: JsonRpcSigner): Provider {.gcsafe, raises: [SignerError
|
||||
signer.provider
|
||||
|
||||
method getAddress*(
|
||||
signer: JsonRpcSigner): Future[Address] {.async.} =
|
||||
signer: JsonRpcSigner): Future[Address] {.async: (raises:[SignerError]).} =
|
||||
|
||||
if address =? signer.address:
|
||||
return address
|
||||
@ -324,7 +324,8 @@ method signMessage*(
|
||||
|
||||
method sendTransaction*(
|
||||
signer: JsonRpcSigner,
|
||||
transaction: Transaction): Future[TransactionResponse] {.async.} =
|
||||
transaction: Transaction): Future[TransactionResponse]
|
||||
{.async: (raises:[SignerError]).} =
|
||||
|
||||
convertSignerError:
|
||||
if nonce =? transaction.nonce:
|
||||
|
||||
@ -40,7 +40,7 @@ method provider*(
|
||||
doAssert false, "not implemented"
|
||||
|
||||
method getAddress*(
|
||||
signer: Signer): Future[Address] {.base, async.} =
|
||||
signer: Signer): Future[Address] {.base, async: (raises:[SignerError]).} =
|
||||
|
||||
doAssert false, "not implemented"
|
||||
|
||||
@ -53,7 +53,7 @@ method signMessage*(
|
||||
method sendTransaction*(
|
||||
signer: Signer,
|
||||
transaction: Transaction): Future[TransactionResponse]
|
||||
{.base, async.} =
|
||||
{.base, async: (raises:[SignerError]).} =
|
||||
|
||||
doAssert false, "not implemented"
|
||||
|
||||
|
||||
@ -67,7 +67,9 @@ method provider*(wallet: Wallet): Provider {.gcsafe, raises: [SignerError].} =
|
||||
raiseWalletError "Wallet has no provider"
|
||||
provider
|
||||
|
||||
method getAddress*(wallet: Wallet): Future[Address] {.async.} =
|
||||
method getAddress*(
|
||||
wallet: Wallet): Future[Address] {.async: (raises:[SignerError]).} =
|
||||
|
||||
return wallet.address
|
||||
|
||||
proc signTransaction*(wallet: Wallet,
|
||||
@ -79,7 +81,8 @@ proc signTransaction*(wallet: Wallet,
|
||||
|
||||
method sendTransaction*(
|
||||
wallet: Wallet,
|
||||
transaction: Transaction): Future[TransactionResponse] {.async.} =
|
||||
transaction: Transaction): Future[TransactionResponse]
|
||||
{.async: (raises:[SignerError]).} =
|
||||
|
||||
convertError:
|
||||
let signed = await signTransaction(wallet, transaction)
|
||||
|
||||
@ -11,10 +11,14 @@ func new*(_: type MockSigner, provider: Provider): MockSigner =
|
||||
method provider*(signer: MockSigner): Provider =
|
||||
signer.provider
|
||||
|
||||
method getAddress*(signer: MockSigner): Future[Address] {.async.} =
|
||||
method getAddress*(
|
||||
signer: MockSigner): Future[Address] {.async: (raises:[SignerError]).} =
|
||||
|
||||
return signer.address
|
||||
|
||||
method sendTransaction*(signer: MockSigner,
|
||||
transaction: Transaction):
|
||||
Future[TransactionResponse] {.async.} =
|
||||
method sendTransaction*(
|
||||
signer: MockSigner,
|
||||
transaction: Transaction): Future[TransactionResponse]
|
||||
{.async: (raises:[SignerError]).} =
|
||||
|
||||
signer.transactions.add(transaction)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user