mirror of
https://github.com/logos-storage/nim-ethers.git
synced 2026-01-10 17:43:06 +00:00
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.
25 lines
604 B
Nim
25 lines
604 B
Nim
import pkg/ethers
|
|
|
|
type MockSigner* = ref object of Signer
|
|
provider: Provider
|
|
address*: Address
|
|
transactions*: seq[Transaction]
|
|
|
|
func new*(_: type MockSigner, provider: Provider): MockSigner =
|
|
MockSigner(provider: provider)
|
|
|
|
method provider*(signer: MockSigner): Provider =
|
|
signer.provider
|
|
|
|
method getAddress*(
|
|
signer: MockSigner): Future[Address] {.async: (raises:[SignerError]).} =
|
|
|
|
return signer.address
|
|
|
|
method sendTransaction*(
|
|
signer: MockSigner,
|
|
transaction: Transaction): Future[TransactionResponse]
|
|
{.async: (raises:[SignerError]).} =
|
|
|
|
signer.transactions.add(transaction)
|