Web3Swift
Web3Swift copied to clipboard
Missing convenient constructor for EthNumber
It is often needed to construct primitives like EthNumber with pure bytes.
try EthNumber(
hex: SimpleBytes(
bytes: DecodedABINumber(
abiMessage: message,
index: index
).value()
)
)
In your example initialization can be simplified to:
try EthNumber(
hex: DecodedABINumber(
abiMessage: message,
index: index
)
)
as hex and DecodedABINumber are both BytesScalar
For ABIMessage it is right but if we get it remotely then the call will be executed only when we check EthNumber.value(). Also I don't want to parse ABIMessage each time I need EthNumber value.
@biboran so what is the best way to precompute the value of DecodeABINumber to pass into EthNumber in your opinion? There are also cases when we don't want lazy computations or overuse of CachedBytes