Add new method to wallet

This commit is contained in:
Jackie 2022-07-12 21:13:34 +02:00 committed by markspanbroek
parent 4c047fd997
commit ac7785dd04
1 changed files with 6 additions and 0 deletions

View File

@ -45,6 +45,12 @@ proc createRandom*(_: type Wallet, provider: JsonRpcProvider): Wallet =
result.address = Address.init(result.publicKey.toCanonicalAddress())
result.provider = some provider
method provider*(wallet: Wallet): Provider =
if wallet.provider.isSome:
return wallet.provider.get
else:
raise newException(WalletError, "Wallet has no provider")
method populateTransaction*(wallet: Wallet, tx: transaction.Transaction): Future[transaction.Transaction] {.async.} =
var populated = tx
if tx.nonce.isNone: