Files
evm/utils/json/uint8.go
zeekay b1e9579a46 Completely remove node dependency from EVM
- Copied utils/formatting and utils/json packages
- Updated all imports to use local copies
- Removed node from go.mod entirely
- EVM now depends ONLY on geth, no node packages

Clean architecture: EVM → geth (no node!)
2025-12-04 15:30:47 -08:00

28 lines
583 B
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package json
import "strconv"
type Uint8 uint8
func (u Uint8) MarshalJSON() ([]byte, error) {
return []byte(`"` + strconv.FormatUint(uint64(u), 10) + `"`), nil
}
func (u *Uint8) UnmarshalJSON(b []byte) error {
str := string(b)
if str == Null {
return nil
}
if len(str) >= 2 {
if lastIndex := len(str) - 1; str[0] == '"' && str[lastIndex] == '"' {
str = str[1:lastIndex]
}
}
val, err := strconv.ParseUint(str, 10, 8)
*u = Uint8(val)
return err
}