[provider] Rename sendRawTransaction -> sendTransaction
To be consistent with ethers.js
This commit is contained in:
parent
cd5165efd0
commit
0483e1676a
|
@ -75,6 +75,11 @@ method getTransactionReceipt*(provider: Provider,
|
|||
Future[?TransactionReceipt] {.base.} =
|
||||
doAssert false, "not implemented"
|
||||
|
||||
method sendTransaction*(provider: Provider,
|
||||
rawTransaction: seq[byte]):
|
||||
Future[TransactionResponse] {.base.} =
|
||||
doAssert false, "not implemented"
|
||||
|
||||
method estimateGas*(provider: Provider,
|
||||
transaction: Transaction): Future[UInt256] {.base.} =
|
||||
doAssert false, "not implemented"
|
||||
|
@ -82,9 +87,6 @@ method estimateGas*(provider: Provider,
|
|||
method getChainId*(provider: Provider): Future[UInt256] {.base.} =
|
||||
doAssert false, "not implemented"
|
||||
|
||||
method sendRawTransaction*(provider: Provider, rawTransaction: seq[byte]): Future[TransactionResponse] {.base, async.} =
|
||||
doAssert false, "not implemented"
|
||||
|
||||
method subscribe*(provider: Provider,
|
||||
filter: Filter,
|
||||
callback: LogHandler):
|
||||
|
|
|
@ -151,7 +151,7 @@ method getChainId*(provider: JsonRpcProvider): Future[UInt256] {.async.} =
|
|||
except CatchableError:
|
||||
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:
|
||||
let
|
||||
client = await provider.client
|
||||
|
|
|
@ -108,7 +108,7 @@ proc signTransaction*(wallet: Wallet, tx: transaction.Transaction): Future[seq[b
|
|||
|
||||
method sendTransaction*(wallet: Wallet, tx: transaction.Transaction): Future[TransactionResponse] {.async.} =
|
||||
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
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ suite "Wallet":
|
|||
gasLimit: some 21_000.u256,
|
||||
)
|
||||
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])
|
||||
|
||||
test "Can call state-changing function automatically":
|
||||
|
|
Loading…
Reference in New Issue