Documentation ¶
Index ¶
- Constants
- Variables
- func EVMIntToHashBytes(i *Int) [hashLength]byte
- func FromHex(s string) ([]byte, error)
- func GetDataFrom(src []byte, offset uint64, size uint64) []byte
- func Has0xPrefix(str string) bool
- func Keccak256(data []byte) []byte
- func LeftPadBytes(slice []byte, l int) []byte
- func LeftPaddingSlice(src []byte, toSize int) []byte
- func MarshalPublicKey(pk crypto.PublicKey) (pkBytes []byte, err error)
- func MinI(i, j int64) int64
- func RightPaddingSlice(src []byte, toSize int) []byte
- type Address
- type Int
- func BytesDataToEVMIntHash(data []byte) *Int
- func EthHashBytesToEVMInt(hash [hashLength]byte) (*Int, error)
- func FromBigInt(i *big.Int) *Int
- func FromDecimalString(s string) *Int
- func FromHexString(s string) *Int
- func FromString(ss string) *Int
- func HashBytesToEVMInt(hash []byte) (*Int, error)
- func MakeAddress(data []byte) *Int
- func MakeAddressFromHex(str string) (*Int, error)
- func MakeAddressFromString(str string) (*Int, error)
- func MinInt(i, j *Int) *Int
- func New(i int64) *Int
- func (i *Int) Add(y *Int) *Int
- func (i *Int) AddMod(y *Int, m *Int) *Int
- func (i *Int) And(y *Int) *Int
- func (i *Int) AsStringKey() string
- func (i *Int) ByteAt(n int) byte
- func (i Int) Clone() *Int
- func (i *Int) Div(y *Int) *Int
- func (i *Int) EQ(y *Int) bool
- func (i *Int) Exp(e *Int) *Int
- func (i *Int) GT(y *Int) bool
- func (i *Int) GetSigned() *Int
- func (i *Int) IsZero() bool
- func (i *Int) LT(y *Int) bool
- func (i *Int) Mod(m *Int) *Int
- func (i *Int) Mul(y *Int) *Int
- func (i *Int) MulMod(y *Int, m *Int) *Int
- func (i *Int) Not(y *Int) *Int
- func (i *Int) Or(y *Int) *Int
- func (i *Int) SAR(n uint64) *Int
- func (i *Int) SDiv(y *Int) *Int
- func (i *Int) SGT(y *Int) bool
- func (i *Int) SHL(n uint64) *Int
- func (i *Int) SHR(n uint64) *Int
- func (i *Int) SLT(y *Int) bool
- func (i *Int) SMod(m *Int) *Int
- func (i *Int) SignExtend(baseBytes *Int) *Int
- func (i *Int) Sub(y *Int) *Int
- func (i *Int) XOr(y *Int) *Int
Constants ¶
const (
AddressLength = 20
)
Variables ¶
var ( BlankHash = make([]byte, hashLength) ZeroHash = Keccak256(nil) )
Functions ¶
func EVMIntToHashBytes ¶
EVMIntToHashBytes returns the absolute value of x as a big-endian fixed length byte slice.
func Has0xPrefix ¶
func LeftPadBytes ¶
LeftPadBytes zero-pads slice to the left up to length l.
func LeftPaddingSlice ¶
func MarshalPublicKey ¶
MarshalPublicKey serialize pk to bytes
func RightPaddingSlice ¶
Types ¶
type Address ¶
type Address [AddressLength]byte
func BytesToAddress ¶
BytesToAddress any byte set to an evm address
func HexToAddress ¶
HexToAddress direct convert hex to an evm address,直接将十六进制字符串转换为Address类型
func MakeHexToAddress ¶
MakeHexToAddress 基于十六进制数据,经过Hash计算获得一个EVM地址 @param s @return Address @return error
func StringToAddress ¶
StringToAddress any string make an evm address
type Int ¶
func BytesDataToEVMIntHash ¶
BytesDataToEVMIntHash fixed length bytes
func EthHashBytesToEVMInt ¶
EthHashBytesToEVMInt EVMIntToHashBytes reverse
func FromBigInt ¶
func FromDecimalString ¶
FromString from fmt data Int.String()
func FromHexString ¶
FromString from fmt data hex.encodeToString([]byte(Int.AsStringKey))
func HashBytesToEVMInt ¶
HashBytesToEVMInt byte to bigInt
func MakeAddressFromHex ¶
MakeAddressFromHex any hex str make an evm.Int
func MakeAddressFromString ¶
MakeAddressFromString any str make an evm.Int