[provider] Rename sendRawTransaction -> sendTransaction

To be consistent with ethers.js
This commit is contained in:
Mark Spanbroek 2022-07-14 11:45:37 +02:00 committed by markspanbroek
parent cd5165efd0
commit 0483e1676a
4 changed files with 8 additions and 6 deletions

View File

@ -75,6 +75,11 @@ method getTransactionReceipt*(provider: Provider,
Future[?TransactionReceipt] {.base.} = Future[?TransactionReceipt] {.base.} =
doAssert false, "not implemented" doAssert false, "not implemented"
method sendTransaction*(provider: Provider,
rawTransaction: seq[byte]):
Future[TransactionResponse] {.base.} =
doAssert false, "not implemented"
method estimateGas*(provider: Provider, method estimateGas*(provider: Provider,
transaction: Transaction): Future[UInt256] {.base.} = transaction: Transaction): Future[UInt256] {.base.} =
doAssert false, "not implemented" doAssert false, "not implemented"
@ -82,9 +87,6 @@ method estimateGas*(provider: Provider,
method getChainId*(provider: Provider): Future[UInt256] {.base.} = method getChainId*(provider: Provider): Future[UInt256] {.base.} =
doAssert false, "not implemented" doAssert false, "not implemented"
method sendRawTransaction*(provider: Provider, rawTransaction: seq[byte]): Future[TransactionResponse] {.base, async.} =
doAssert false, "not implemented"
method subscribe*(provider: Provider, method subscribe*(provider: Provider,
filter: Filter, filter: Filter,
callback: LogHandler): callback: LogHandler):

View File

@ -151,7 +151,7 @@ method getChainId*(provider: JsonRpcProvider): Future[UInt256] {.async.} =
except CatchableError: except CatchableError:
return parse(await client.net_version(), UInt256) return parse(await client.net_version(), UInt256)
method sendRawTransaction*(provider: JsonRpcProvider, rawTransaction: seq[byte]): Future[TransactionResponse] {.async.} = method sendTransaction*(provider: JsonRpcProvider, rawTransaction: seq[byte]): Future[TransactionResponse] {.async.} =
convertError: convertError:
let let
client = await provider.client client = await provider.client

View File

@ -108,7 +108,7 @@ proc signTransaction*(wallet: Wallet, tx: transaction.Transaction): Future[seq[b
method sendTransaction*(wallet: Wallet, tx: transaction.Transaction): Future[TransactionResponse] {.async.} = method sendTransaction*(wallet: Wallet, tx: transaction.Transaction): Future[TransactionResponse] {.async.} =
let rawTX = await signTransaction(wallet, tx) let rawTX = await signTransaction(wallet, tx)
return await wallet.provider.get.sendRawTransaction(rawTX) return await wallet.provider.get.sendTransaction(rawTX)
#TODO add functionality to sign messages #TODO add functionality to sign messages

View File

@ -101,7 +101,7 @@ suite "Wallet":
gasLimit: some 21_000.u256, gasLimit: some 21_000.u256,
) )
let signedTx = await wallet.signTransaction(tx) let signedTx = await wallet.signTransaction(tx)
let txHash = await provider.sendRawTransaction(signedTx) let txHash = await provider.sendTransaction(signedTx)
check txHash.hash == TransactionHash([167.byte, 105, 79, 222, 144, 123, 214, 138, 4, 199, 124, 181, 35, 236, 79, 93, 84, 4, 85, 172, 40, 50, 189, 187, 219, 6, 172, 98, 243, 196, 93, 64]) check txHash.hash == TransactionHash([167.byte, 105, 79, 222, 144, 123, 214, 138, 4, 199, 124, 181, 35, 236, 79, 93, 84, 4, 85, 172, 40, 50, 189, 187, 219, 6, 172, 98, 243, 196, 93, 64])
test "Can call state-changing function automatically": test "Can call state-changing function automatically":