mirror of
https://github.com/codex-storage/nim-ethers.git
synced 2025-01-09 19:05:46 +00:00
enables stylecheck (#36)
* enables stylecheck * applies style check * Applying style check * uses alias to fix ambiguity
This commit is contained in:
parent
e462649aec
commit
577e02b8a2
@ -1,3 +1,6 @@
|
||||
--styleCheck:usages
|
||||
--styleCheck:error
|
||||
|
||||
# begin Nimble config (version 1)
|
||||
when fileExists("nimble.paths"):
|
||||
include "nimble.paths"
|
||||
|
@ -37,7 +37,7 @@ func fitsInIndexedField(T: type): bool {.compileTime.} =
|
||||
solidityType(T) in supportedTypes
|
||||
|
||||
func decode*[E: Event](_: type E, data: seq[byte], topics: seq[Topic]): ?!E =
|
||||
var event = ?Abidecoder.decode(data, E)
|
||||
var event = ?AbiDecoder.decode(data, E)
|
||||
var i = 1
|
||||
for field in event.fields:
|
||||
if field.hasCustomPragma(indexed):
|
||||
|
@ -129,7 +129,7 @@ method call*(provider: JsonRpcProvider,
|
||||
method getGasPrice*(provider: JsonRpcProvider): Future[UInt256] {.async.} =
|
||||
convertError:
|
||||
let client = await provider.client
|
||||
return await client.eth_gasprice()
|
||||
return await client.eth_gasPrice()
|
||||
|
||||
method getTransactionCount*(provider: JsonRpcProvider,
|
||||
address: Address,
|
||||
|
@ -3,7 +3,7 @@ import eth/rlp
|
||||
import eth/common
|
||||
import eth/common/transaction as ct
|
||||
import ./provider
|
||||
import ./transaction
|
||||
import ./transaction as tx
|
||||
import ./signer
|
||||
|
||||
export keys
|
||||
@ -64,7 +64,7 @@ proc signTransaction(tr: var SignableTransaction, pk: PrivateKey) =
|
||||
let r = toRaw(s)
|
||||
let v = r[64]
|
||||
|
||||
tr.R = fromBytesBe(UInt256, r.toOpenArray(0, 31))
|
||||
tr.R = fromBytesBE(UInt256, r.toOpenArray(0, 31))
|
||||
tr.S = fromBytesBE(UInt256, r.toOpenArray(32, 63))
|
||||
|
||||
case tr.txType:
|
||||
@ -76,7 +76,7 @@ proc signTransaction(tr: var SignableTransaction, pk: PrivateKey) =
|
||||
else:
|
||||
raise newException(WalletError, "Transaction type not supported")
|
||||
|
||||
proc signTransaction*(wallet: Wallet, tx: transaction.Transaction): Future[seq[byte]] {.async.} =
|
||||
proc signTransaction*(wallet: Wallet, tx: tx.Transaction): Future[seq[byte]] {.async.} =
|
||||
if sender =? tx.sender and sender != wallet.address:
|
||||
raise newException(WalletError, "from address mismatch")
|
||||
|
||||
@ -101,10 +101,10 @@ proc signTransaction*(wallet: Wallet, tx: transaction.Transaction): Future[seq[b
|
||||
s.to = some EthAddress(tx.to)
|
||||
s.payload = tx.data
|
||||
signTransaction(s, wallet.privateKey)
|
||||
|
||||
|
||||
return rlp.encode(s)
|
||||
|
||||
method sendTransaction*(wallet: Wallet, tx: transaction.Transaction): Future[TransactionResponse] {.async.} =
|
||||
method sendTransaction*(wallet: Wallet, tx: tx.Transaction): Future[TransactionResponse] {.async.} =
|
||||
let rawTX = await signTransaction(wallet, tx)
|
||||
return await provider(wallet).sendTransaction(rawTX)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user