diff --git a/ethers/providers/jsonrpc.nim b/ethers/providers/jsonrpc.nim index 2cc37b5..3e097db 100644 --- a/ethers/providers/jsonrpc.nim +++ b/ethers/providers/jsonrpc.nim @@ -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: diff --git a/ethers/signer.nim b/ethers/signer.nim index df05eba..3a70dc7 100644 --- a/ethers/signer.nim +++ b/ethers/signer.nim @@ -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" diff --git a/ethers/signers/wallet.nim b/ethers/signers/wallet.nim index c622c21..d757b62 100644 --- a/ethers/signers/wallet.nim +++ b/ethers/signers/wallet.nim @@ -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) diff --git a/testmodule/mocks.nim b/testmodule/mocks.nim index 30584e1..7e3d877 100644 --- a/testmodule/mocks.nim +++ b/testmodule/mocks.nim @@ -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)