mirror of
https://github.com/status-im/nim-ethers.git
synced 2025-02-04 11:33:30 +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)
|
# begin Nimble config (version 1)
|
||||||
when fileExists("nimble.paths"):
|
when fileExists("nimble.paths"):
|
||||||
include "nimble.paths"
|
include "nimble.paths"
|
||||||
|
@ -37,7 +37,7 @@ func fitsInIndexedField(T: type): bool {.compileTime.} =
|
|||||||
solidityType(T) in supportedTypes
|
solidityType(T) in supportedTypes
|
||||||
|
|
||||||
func decode*[E: Event](_: type E, data: seq[byte], topics: seq[Topic]): ?!E =
|
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
|
var i = 1
|
||||||
for field in event.fields:
|
for field in event.fields:
|
||||||
if field.hasCustomPragma(indexed):
|
if field.hasCustomPragma(indexed):
|
||||||
|
@ -129,7 +129,7 @@ method call*(provider: JsonRpcProvider,
|
|||||||
method getGasPrice*(provider: JsonRpcProvider): Future[UInt256] {.async.} =
|
method getGasPrice*(provider: JsonRpcProvider): Future[UInt256] {.async.} =
|
||||||
convertError:
|
convertError:
|
||||||
let client = await provider.client
|
let client = await provider.client
|
||||||
return await client.eth_gasprice()
|
return await client.eth_gasPrice()
|
||||||
|
|
||||||
method getTransactionCount*(provider: JsonRpcProvider,
|
method getTransactionCount*(provider: JsonRpcProvider,
|
||||||
address: Address,
|
address: Address,
|
||||||
|
@ -3,7 +3,7 @@ import eth/rlp
|
|||||||
import eth/common
|
import eth/common
|
||||||
import eth/common/transaction as ct
|
import eth/common/transaction as ct
|
||||||
import ./provider
|
import ./provider
|
||||||
import ./transaction
|
import ./transaction as tx
|
||||||
import ./signer
|
import ./signer
|
||||||
|
|
||||||
export keys
|
export keys
|
||||||
@ -64,7 +64,7 @@ proc signTransaction(tr: var SignableTransaction, pk: PrivateKey) =
|
|||||||
let r = toRaw(s)
|
let r = toRaw(s)
|
||||||
let v = r[64]
|
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))
|
tr.S = fromBytesBE(UInt256, r.toOpenArray(32, 63))
|
||||||
|
|
||||||
case tr.txType:
|
case tr.txType:
|
||||||
@ -76,7 +76,7 @@ proc signTransaction(tr: var SignableTransaction, pk: PrivateKey) =
|
|||||||
else:
|
else:
|
||||||
raise newException(WalletError, "Transaction type not supported")
|
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:
|
if sender =? tx.sender and sender != wallet.address:
|
||||||
raise newException(WalletError, "from address mismatch")
|
raise newException(WalletError, "from address mismatch")
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ proc signTransaction*(wallet: Wallet, tx: transaction.Transaction): Future[seq[b
|
|||||||
|
|
||||||
return rlp.encode(s)
|
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)
|
let rawTX = await signTransaction(wallet, tx)
|
||||||
return await provider(wallet).sendTransaction(rawTX)
|
return await provider(wallet).sendTransaction(rawTX)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user