You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, EVMAddress is constructed from a 20 byte array ([UInt8; 20]) which is handled as a different type than a variable length array. This can present difficulty when working with the struct, especially when deserializing an address hex string to an EVMAddress.
Proposed Solution
Implement serialization & deserialization methods in the EVMAddress struct. Consider something like
access(all) structEVMAddress {
// .../// Returns the EVM address as a hex stringaccess(all) view funtoString():String// ...
}
/// Returns an EVMAddress from the given string or nil if it is not a valid addressaccess(all) view fungetEVMAddress(fromhex: String):EVMAddress?
These are importantly view methods as the values are helpful to include in events and pre- and post-conditions.
Definition of Done
A developer can deserialize an EVMAddress from a string & back
Context
This functionality has impacts for things like running transactions & scripts via CLI. For example, given the simple task of querying an EVM address's balance, a developer would have to create custom serialization (lots of boilerplate, efforts, and error-prone), pass an EVMAddress (not easy to do using CLI), or pass a byte array (not user friendly).
The text was updated successfully, but these errors were encountered:
Problem Definition
Currently, EVMAddress is constructed from a 20 byte array (
[UInt8; 20]
) which is handled as a different type than a variable length array. This can present difficulty when working with the struct, especially when deserializing an address hex string to an EVMAddress.Proposed Solution
Implement serialization & deserialization methods in the EVMAddress struct. Consider something like
These are importantly
view
methods as the values are helpful to include in events and pre- and post-conditions.Definition of Done
A developer can deserialize an EVMAddress from a string & back
Context
This functionality has impacts for things like running transactions & scripts via CLI. For example, given the simple task of querying an EVM address's balance, a developer would have to create custom serialization (lots of boilerplate, efforts, and error-prone), pass an
EVMAddress
(not easy to do using CLI), or pass a byte array (not user friendly).The text was updated successfully, but these errors were encountered: