mirror of
https://github.com/status-im/nim-ethers.git
synced 2025-01-17 02:51:37 +00:00
241ce6e8f3
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.
26 lines
636 B
Nim
26 lines
636 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:[ProviderError, SignerError]).} =
|
|
|
|
return signer.address
|
|
|
|
method sendTransaction*(
|
|
signer: MockSigner,
|
|
transaction: Transaction): Future[TransactionResponse]
|
|
{.async: (raises:[SignerError, ProviderError]).} =
|
|
|
|
signer.transactions.add(transaction)
|