types

package
v0.0.0-...-3442dc8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2023 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddressLen_ETH      = 20 //20 bytes
	AddressLen_Secp256  = 20 //20 bytes
	AddressLen_BLS12381 = 48 //48 bytes
	AddressLen_ED25519  = 32 //32 bytes
)
View Source
const (
	MainnetPrefix = "m"
	TestnetPrefix = "t"
)

Variables

View Source
var UndefAddress = Address("<empty>")

Functions

func EthAddressFromTopia

func EthAddressFromTopia(a Address) ([]byte, error)

func IsEth

func IsEth(a string) bool

func IsNativeContractAddress

func IsNativeContractAddress(contractAddr Address) bool

Types

type Address

type Address string

A Full address contains: netType(1 byte) + cryptType(1 byte) + payload(different size as different cryptType + checkSum(4 byte)

var NativeContractAddr_Account Address

func CreateNativeContractAddress

func CreateNativeContractAddress(id uint64) Address

func CreateUserContractAddress

func CreateUserContractAddress(fromAddr Address, nonce uint64) Address

func NewAddress

func NewAddress(cryptType CryptType, payload []byte) (Address, error)

func NewFromBytes

func NewFromBytes(addr []byte) Address

func NewFromString

func NewFromString(addr string) Address

func TopiaAddressFromEth

func TopiaAddressFromEth(a string) (Address, error)

func (Address) Bytes

func (a Address) Bytes() []byte

func (Address) CryptType

func (a Address) CryptType() (CryptType, error)

func (Address) HexString

func (a Address) HexString() (string, error)

func (Address) IsHexs

func (a Address) IsHexs() bool

func (Address) IsPayable

func (a Address) IsPayable() bool

func (Address) IsValid

func (a Address) IsValid(netType tpcmm.NetworkType) bool

func (Address) NetworkType

func (a Address) NetworkType() (tpcmm.NetworkType, error)

func (Address) Payload

func (a Address) Payload() ([]byte, error)

type CryptType

type CryptType byte
const (
	CryptType_Unknown CryptType = iota
	CryptType_BLS12381
	CryptType_Secp256
	CryptType_Ed25519
)

func (CryptType) String

func (c CryptType) String() string

func (CryptType) Value

func (c CryptType) Value(crypyType string) CryptType

type PrivateKey

type PrivateKey []byte

type ProtocolID

type ProtocolID byte

type PublicKey

type PublicKey []byte

type Signature

type Signature []byte

type SignatureInfo

type SignatureInfo struct {
	SignData  Signature
	PublicKey []byte
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL