mirror of
https://github.com/logos-storage/nim-ethers.git
synced 2026-01-12 10:33:07 +00:00
- add comments to hashes shim - remove .catch from callback condition - derive SignerError from EthersError instead of ProviderError. This allows Providers and Signers to be separate, as Ledger does it, to isolate functionality. Some signer functions now raise both ProviderError and SignerError - Update reverts to check for SignerError - Update ERC-20 method comment
26 lines
621 B
Nim
26 lines
621 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]).} =
|
|
|
|
signer.transactions.add(transaction)
|