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
Not directly related to #61, but we could also simplify with the TextMarshaler and TextUnmarshaler interface, so we don't have to deal with json.Marshal/Unmarshal in our functions for the base64 encoding/decoding.
Those text marshalers would focus solely on validating and returning a canonical representation of an address, which would be compatible with other encoding formats.
Before
func (a*Address) UnmarshalJSON(data []byte) error {
// We'll keep the checksummed string in memory so we can use it for internal representationsstr, err:=unmarshalHex(data, 20, "data")
str=ToChecksumAddress(str)
iferr!=nil {
returnerr
}
*a=Address(str)
returnnil
}
func (aAddress) MarshalJSON() ([]byte, error) {
// Seems like geth and parity both return the lower-cased string rather than the checksummed ones:=strings.ToLower(string(a))
returnjson.Marshal(&s)
}
Not directly related to #61, but we could also simplify with the
TextMarshaler
andTextUnmarshaler
interface, so we don't have to deal with json.Marshal/Unmarshal in our functions for the base64 encoding/decoding.Those text marshalers would focus solely on validating and returning a canonical representation of an address, which would be compatible with other encoding formats.
Before
After
Originally posted by @basgys in #61 (comment)
The text was updated successfully, but these errors were encountered: