Documentation ¶
Index ¶
- Constants
- Variables
- func CheckValidity(_bytes []byte, _type Address_Type) bool
- func IsAptosChain(chid uint64) bool
- func IsFlowChain(chid uint64) bool
- func IsHexAddress(s string) bool
- type Address
- func (a *Address) Bytes() []byte
- func (a *Address) ConvertReceiver(chid uint64) *Address
- func (a *Address) ConvertSender(chid uint64) *Address
- func (a *Address) Copy(expected *Address) *Address
- func (*Address) Descriptor() ([]byte, []int)
- func (this *Address) Equal(that interface{}) bool
- func (m *Address) GetData() []byte
- func (a *Address) GetEthAddress() eth.Addr
- func (a *Address) GetFixedHexAddr() string
- func (m *Address) GetType() Address_Type
- func (a *Address) Hex() string
- func (a *Address) IsValid() bool
- func (a *Address) Length() uint16
- func (m *Address) Marshal() (dAtA []byte, err error)
- func (m *Address) MarshalTo(dAtA []byte) (int, error)
- func (m *Address) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Address) ProtoMessage()
- func (m *Address) Reset()
- func (a Address) SetBytes(_bytes []byte) *Address
- func (a *Address) SetBytes20Address(addr eth.Addr) *Address
- func (a *Address) SetBytes32Address(aptosAddr [32]byte) *Address
- func (a *Address) SetBytes8Address(flowAddr [8]byte) *Address
- func (a *Address) SetBytesByChainId(_bytes []byte, _chainId uint64) *Address
- func (a *Address) SetBytesByType(_bytes []byte, _type Address_Type) *Address
- func (a *Address) SetDefaultAddress(data []byte) *Address
- func (a *Address) SetStrAddress(addrStr string) *Address
- func (a *Address) SetString(addrStr string) *Address
- func (a *Address) SetStringByChainId(_addrStr string, _chainId uint64) *Address
- func (m *Address) Size() (n int)
- func (a *Address) String() string
- func (m *Address) Unmarshal(dAtA []byte) error
- func (m *Address) XXX_DiscardUnknown()
- func (m *Address) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Address) XXX_Merge(src proto.Message)
- func (m *Address) XXX_Size() int
- func (m *Address) XXX_Unmarshal(b []byte) error
- type Address_Type
- type ContractInfo
- func (*ContractInfo) Descriptor() ([]byte, []int)
- func (this *ContractInfo) Equal(that interface{}) bool
- func (m *ContractInfo) GetAddress() string
- func (m *ContractInfo) GetChainId() uint64
- func (m *ContractInfo) Marshal() (dAtA []byte, err error)
- func (m *ContractInfo) MarshalTo(dAtA []byte) (int, error)
- func (m *ContractInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ContractInfo) ProtoMessage()
- func (m *ContractInfo) Reset()
- func (m *ContractInfo) Size() (n int)
- func (m *ContractInfo) String() string
- func (m *ContractInfo) Unmarshal(dAtA []byte) error
- func (m *ContractInfo) XXX_DiscardUnknown()
- func (m *ContractInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ContractInfo) XXX_Merge(src proto.Message)
- func (m *ContractInfo) XXX_Size() int
- func (m *ContractInfo) XXX_Unmarshal(b []byte) error
- type ERC20Token
- func (*ERC20Token) Descriptor() ([]byte, []int)
- func (this *ERC20Token) Equal(that interface{}) bool
- func (m *ERC20Token) GetAddress() string
- func (m *ERC20Token) GetChainId() uint64
- func (m *ERC20Token) GetDecimals() uint32
- func (m *ERC20Token) GetSymbol() string
- func (m *ERC20Token) Marshal() (dAtA []byte, err error)
- func (m *ERC20Token) MarshalTo(dAtA []byte) (int, error)
- func (m *ERC20Token) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ERC20Token) ProtoMessage()
- func (m *ERC20Token) Reset()
- func (m *ERC20Token) Size() (n int)
- func (m *ERC20Token) String() string
- func (m *ERC20Token) Unmarshal(dAtA []byte) error
- func (m *ERC20Token) XXX_DiscardUnknown()
- func (m *ERC20Token) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ERC20Token) XXX_Merge(src proto.Message)
- func (m *ERC20Token) XXX_Size() int
- func (m *ERC20Token) XXX_Unmarshal(b []byte) error
- type EventLog
- func (*EventLog) Descriptor() ([]byte, []int)
- func (this *EventLog) Equal(that interface{}) bool
- func (m *EventLog) GetAddress() *Address
- func (m *EventLog) GetBlockNumber() uint64
- func (m *EventLog) GetEvent() []byte
- func (m *EventLog) GetIndex() uint32
- func (m *EventLog) GetSpare() []byte
- func (m *EventLog) GetTxHash() []byte
- func (m *EventLog) Marshal() (dAtA []byte, err error)
- func (m *EventLog) MarshalTo(dAtA []byte) (int, error)
- func (m *EventLog) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*EventLog) ProtoMessage()
- func (m *EventLog) Reset()
- func (m *EventLog) Size() (n int)
- func (evl *EventLog) String() string
- func (m *EventLog) Unmarshal(dAtA []byte) error
- func (m *EventLog) XXX_DiscardUnknown()
- func (m *EventLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *EventLog) XXX_Merge(src proto.Message)
- func (m *EventLog) XXX_Size() int
- func (m *EventLog) XXX_Unmarshal(b []byte) error
- type NonEvmChainID
- type Signature
- func (*Signature) Descriptor() ([]byte, []int)
- func (this *Signature) Equal(that interface{}) bool
- func (m *Signature) GetSigBytes() []byte
- func (m *Signature) GetSigner() string
- func (m *Signature) Marshal() (dAtA []byte, err error)
- func (m *Signature) MarshalTo(dAtA []byte) (int, error)
- func (m *Signature) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Signature) ProtoMessage()
- func (m *Signature) Reset()
- func (m *Signature) Size() (n int)
- func (m *Signature) String() string
- func (m *Signature) Unmarshal(dAtA []byte) error
- func (m *Signature) XXX_DiscardUnknown()
- func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Signature) XXX_Merge(src proto.Message)
- func (m *Signature) XXX_Size() int
- func (m *Signature) XXX_Unmarshal(b []byte) error
- type Supplement
- func (*Supplement) Descriptor() ([]byte, []int)
- func (this *Supplement) Equal(that interface{}) bool
- func (m *Supplement) GetData() []byte
- func (m *Supplement) GetType() Supplement_Type
- func (m *Supplement) Marshal() (dAtA []byte, err error)
- func (m *Supplement) MarshalTo(dAtA []byte) (int, error)
- func (m *Supplement) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Supplement) ProtoMessage()
- func (m *Supplement) Reset()
- func (m *Supplement) Size() (n int)
- func (m *Supplement) String() string
- func (m *Supplement) Unmarshal(dAtA []byte) error
- func (m *Supplement) XXX_DiscardUnknown()
- func (m *Supplement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Supplement) XXX_Merge(src proto.Message)
- func (m *Supplement) XXX_Size() int
- func (m *Supplement) XXX_Unmarshal(b []byte) error
- type Supplement_Type
Constants ¶
const ( Address_Length_20 = uint16(20) Address_Length_8 = uint16(8) Address_Max_Length = uint16(1 << 8) Address_Length_32 = uint16(32) )
Variables ¶
var ( ErrInvalidLengthCommon = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowCommon = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupCommon = fmt.Errorf("proto: unexpected end of group") )
var AddressTypeLength = map[Address_Type]uint16{ Address_Bytes20: Address_Length_20, Address_Bytes8: Address_Length_8, Address_Hex: Address_Max_Length, Address_String: Address_Max_Length, Address_Bytes32: Address_Length_32, }
var Address_Type_name = map[int32]string{
0: "Hex",
1: "String",
2: "Bytes20",
3: "Bytes8",
4: "Bytes32",
}
var Address_Type_value = map[string]int32{
"Hex": 0,
"String": 1,
"Bytes20": 2,
"Bytes8": 3,
"Bytes32": 4,
}
var NonEvmChainID_name = map[int32]string{
0: "UNDEFINED",
12340001: "FLOW_MAINNET",
12340002: "FLOW_TEST",
12340003: "FLOW_EMULATOR",
12350001: "SOLANA_MAINNET",
12350002: "SOLANA_TEST",
12350003: "SOLANA_EMULATOR",
12360001: "APTOS_MAINNET",
12360002: "APTOS_TEST",
12360003: "APTOS_LOCAL",
}
var NonEvmChainID_value = map[string]int32{
"UNDEFINED": 0,
"FLOW_MAINNET": 12340001,
"FLOW_TEST": 12340002,
"FLOW_EMULATOR": 12340003,
"SOLANA_MAINNET": 12350001,
"SOLANA_TEST": 12350002,
"SOLANA_EMULATOR": 12350003,
"APTOS_MAINNET": 12360001,
"APTOS_TEST": 12360002,
"APTOS_LOCAL": 12360003,
}
var Supplement_Type_name = map[int32]string{
0: "Address",
}
var Supplement_Type_value = map[string]int32{
"Address": 0,
}
Functions ¶
func CheckValidity ¶
func CheckValidity(_bytes []byte, _type Address_Type) bool
func IsAptosChain ¶
func IsFlowChain ¶
func IsHexAddress ¶
IsHexAddress verifies whether a string can represent a valid hex-encoded address or not.
Types ¶
type Address ¶
type Address struct { // data defines the address data Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // type defines the address type Type Address_Type `protobuf:"varint,2,opt,name=type,proto3,enum=sgn.common.v1.Address_Type" json:"type,omitempty"` }
Address describes a common type of address processed in sgn, and has no relation with sgn native address
func GetZeroAddrByChainId ¶
func (*Address) ConvertReceiver ¶
func (*Address) ConvertSender ¶
func (*Address) Descriptor ¶
func (*Address) GetEthAddress ¶
GetEthAddress would return the corresponding eth address of Address if its type is evm or (len=20)hexadecimal, else return the zero eth address.
func (*Address) GetFixedHexAddr ¶
GetFixedHexAddr For some other server such as gateway, sentinel, im-scan, addr in db need it.
func (*Address) GetType ¶
func (m *Address) GetType() Address_Type
func (*Address) MarshalToSizedBuffer ¶
func (*Address) ProtoMessage ¶
func (*Address) ProtoMessage()
func (Address) SetBytes ¶
SetBytes return an Address defined by _bytes with auto length match. Address_String is not applicable. It is very dangerous to apply SetBytes with an unknown byte slice, especially when there are string-like addresses.
func (*Address) SetBytes32Address ¶
func (*Address) SetBytes8Address ¶
func (*Address) SetBytesByChainId ¶
SetBytesByChainId return an Address defined by _bytes and _chainId. Some chain has hex type account address and string type token address. While only one type is matched by a chainId, we recommend only use SetBytesByChainId to new an account address.
func (*Address) SetBytesByType ¶
func (a *Address) SetBytesByType(_bytes []byte, _type Address_Type) *Address
SetBytesByType return an Address defined by _bytes and _type.
func (*Address) SetDefaultAddress ¶
SetDefaultAddress sets data to hexadecimal Address
func (*Address) SetStrAddress ¶
func (*Address) SetStringByChainId ¶
SetStringByChainId is a helper func based on SetBytesByChainId.
func (*Address) XXX_DiscardUnknown ¶
func (m *Address) XXX_DiscardUnknown()
func (*Address) XXX_Marshal ¶
func (*Address) XXX_Unmarshal ¶
type Address_Type ¶
type Address_Type int32
const ( Address_Hex Address_Type = 0 Address_String Address_Type = 1 Address_Bytes20 Address_Type = 2 Address_Bytes8 Address_Type = 3 Address_Bytes32 Address_Type = 4 )
func GetAddrTypeByChainId ¶
func GetAddrTypeByChainId(chid uint64) Address_Type
func (Address_Type) EnumDescriptor ¶
func (Address_Type) EnumDescriptor() ([]byte, []int)
func (Address_Type) String ¶
func (x Address_Type) String() string
type ContractInfo ¶
type ContractInfo struct { // chain_id defines the chain ID of the contract ChainId uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` // address defines the address of the contract. Note for non-evm chains, // address format is different Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` }
func (*ContractInfo) Descriptor ¶
func (*ContractInfo) Descriptor() ([]byte, []int)
func (*ContractInfo) Equal ¶
func (this *ContractInfo) Equal(that interface{}) bool
func (*ContractInfo) GetAddress ¶
func (m *ContractInfo) GetAddress() string
func (*ContractInfo) GetChainId ¶
func (m *ContractInfo) GetChainId() uint64
func (*ContractInfo) Marshal ¶
func (m *ContractInfo) Marshal() (dAtA []byte, err error)
func (*ContractInfo) MarshalToSizedBuffer ¶
func (m *ContractInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ContractInfo) ProtoMessage ¶
func (*ContractInfo) ProtoMessage()
func (*ContractInfo) Reset ¶
func (m *ContractInfo) Reset()
func (*ContractInfo) Size ¶
func (m *ContractInfo) Size() (n int)
func (*ContractInfo) String ¶
func (m *ContractInfo) String() string
func (*ContractInfo) Unmarshal ¶
func (m *ContractInfo) Unmarshal(dAtA []byte) error
func (*ContractInfo) XXX_DiscardUnknown ¶
func (m *ContractInfo) XXX_DiscardUnknown()
func (*ContractInfo) XXX_Marshal ¶
func (m *ContractInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ContractInfo) XXX_Merge ¶
func (m *ContractInfo) XXX_Merge(src proto.Message)
func (*ContractInfo) XXX_Size ¶
func (m *ContractInfo) XXX_Size() int
func (*ContractInfo) XXX_Unmarshal ¶
func (m *ContractInfo) XXX_Unmarshal(b []byte) error
type ERC20Token ¶
type ERC20Token struct { // chain_id defines the chain ID ChainId uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty" yaml:"chain_id"` // symbol defines the ERC20 token symbol Symbol string `protobuf:"bytes,2,opt,name=symbol,proto3" json:"symbol,omitempty" yaml:"symbol"` // address defines the token contract address Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` // decimals defines the token decimals Decimals uint32 `protobuf:"varint,4,opt,name=decimals,proto3" json:"decimals,omitempty" yaml:"decimals"` }
ERC20Token describes an ERC20 token on a specific EVM-compatible chain Or a similar fungible token on non-evm chains.
func (*ERC20Token) Descriptor ¶
func (*ERC20Token) Descriptor() ([]byte, []int)
func (*ERC20Token) Equal ¶
func (this *ERC20Token) Equal(that interface{}) bool
func (*ERC20Token) GetAddress ¶
func (m *ERC20Token) GetAddress() string
func (*ERC20Token) GetChainId ¶
func (m *ERC20Token) GetChainId() uint64
func (*ERC20Token) GetDecimals ¶
func (m *ERC20Token) GetDecimals() uint32
func (*ERC20Token) GetSymbol ¶
func (m *ERC20Token) GetSymbol() string
func (*ERC20Token) Marshal ¶
func (m *ERC20Token) Marshal() (dAtA []byte, err error)
func (*ERC20Token) MarshalToSizedBuffer ¶
func (m *ERC20Token) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ERC20Token) ProtoMessage ¶
func (*ERC20Token) ProtoMessage()
func (*ERC20Token) Reset ¶
func (m *ERC20Token) Reset()
func (*ERC20Token) Size ¶
func (m *ERC20Token) Size() (n int)
func (*ERC20Token) String ¶
func (m *ERC20Token) String() string
func (*ERC20Token) Unmarshal ¶
func (m *ERC20Token) Unmarshal(dAtA []byte) error
func (*ERC20Token) XXX_DiscardUnknown ¶
func (m *ERC20Token) XXX_DiscardUnknown()
func (*ERC20Token) XXX_Marshal ¶
func (m *ERC20Token) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ERC20Token) XXX_Merge ¶
func (m *ERC20Token) XXX_Merge(src proto.Message)
func (*ERC20Token) XXX_Size ¶
func (m *ERC20Token) XXX_Size() int
func (*ERC20Token) XXX_Unmarshal ¶
func (m *ERC20Token) XXX_Unmarshal(b []byte) error
type EventLog ¶
type EventLog struct { Address *Address `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` TxHash []byte `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` BlockNumber uint64 `protobuf:"varint,3,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` Index uint32 `protobuf:"varint,4,opt,name=index,proto3" json:"index,omitempty"` Event []byte `protobuf:"bytes,5,opt,name=event,proto3" json:"event,omitempty"` Spare []byte `protobuf:"bytes,6,opt,name=spare,proto3" json:"spare,omitempty"` }
EventLog describes a generic event log for all kinds of chain.
func (*EventLog) Descriptor ¶
func (*EventLog) GetAddress ¶
func (*EventLog) GetBlockNumber ¶
func (*EventLog) MarshalToSizedBuffer ¶
func (*EventLog) ProtoMessage ¶
func (*EventLog) ProtoMessage()
func (*EventLog) XXX_DiscardUnknown ¶
func (m *EventLog) XXX_DiscardUnknown()
func (*EventLog) XXX_Marshal ¶
func (*EventLog) XXX_Unmarshal ¶
type NonEvmChainID ¶
type NonEvmChainID int32
to make sure no chain id conflict within sgn system there is no way to guarantee the chain id we choose here will NEVER be used by another real evm chain in the future. we just do our best choosing an unlikely range. also value should be smaller than max int32 corresponding value also needs to be coded in non-evm chain smart contracts
const ( NonEvmChainID_UNDEFINED NonEvmChainID = 0 NonEvmChainID_FLOW_MAINNET NonEvmChainID = 12340001 NonEvmChainID_FLOW_TEST NonEvmChainID = 12340002 NonEvmChainID_FLOW_EMULATOR NonEvmChainID = 12340003 NonEvmChainID_SOLANA_MAINNET NonEvmChainID = 12350001 NonEvmChainID_SOLANA_TEST NonEvmChainID = 12350002 NonEvmChainID_SOLANA_EMULATOR NonEvmChainID = 12350003 NonEvmChainID_APTOS_MAINNET NonEvmChainID = 12360001 NonEvmChainID_APTOS_TEST NonEvmChainID = 12360002 NonEvmChainID_APTOS_LOCAL NonEvmChainID = 12360003 )
func (NonEvmChainID) EnumDescriptor ¶
func (NonEvmChainID) EnumDescriptor() ([]byte, []int)
func (NonEvmChainID) String ¶
func (x NonEvmChainID) String() string
type Signature ¶
type Signature struct { // signer defines the Ethereum address of the signer. Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty" yaml:"signer"` // sig_bytes defines the signature bytes. SigBytes []byte `protobuf:"bytes,2,opt,name=sig_bytes,json=sigBytes,proto3" json:"sig_bytes,omitempty" yaml:"sig_bytes"` }
Signature is the structure representing an Ethereum ECDSA signature.
func (*Signature) Descriptor ¶
func (*Signature) GetSigBytes ¶
func (*Signature) MarshalToSizedBuffer ¶
func (*Signature) ProtoMessage ¶
func (*Signature) ProtoMessage()
func (*Signature) XXX_DiscardUnknown ¶
func (m *Signature) XXX_DiscardUnknown()
func (*Signature) XXX_Marshal ¶
func (*Signature) XXX_Unmarshal ¶
type Supplement ¶
type Supplement struct { Type Supplement_Type `protobuf:"varint,1,opt,name=type,proto3,enum=sgn.common.v1.Supplement_Type" json:"type,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` }
Supplement describes a piece of supplementary data, which gonna be used to store arbitrary data.
func (*Supplement) Descriptor ¶
func (*Supplement) Descriptor() ([]byte, []int)
func (*Supplement) Equal ¶
func (this *Supplement) Equal(that interface{}) bool
func (*Supplement) GetData ¶
func (m *Supplement) GetData() []byte
func (*Supplement) GetType ¶
func (m *Supplement) GetType() Supplement_Type
func (*Supplement) Marshal ¶
func (m *Supplement) Marshal() (dAtA []byte, err error)
func (*Supplement) MarshalToSizedBuffer ¶
func (m *Supplement) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*Supplement) ProtoMessage ¶
func (*Supplement) ProtoMessage()
func (*Supplement) Reset ¶
func (m *Supplement) Reset()
func (*Supplement) Size ¶
func (m *Supplement) Size() (n int)
func (*Supplement) String ¶
func (m *Supplement) String() string
func (*Supplement) Unmarshal ¶
func (m *Supplement) Unmarshal(dAtA []byte) error
func (*Supplement) XXX_DiscardUnknown ¶
func (m *Supplement) XXX_DiscardUnknown()
func (*Supplement) XXX_Marshal ¶
func (m *Supplement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*Supplement) XXX_Merge ¶
func (m *Supplement) XXX_Merge(src proto.Message)
func (*Supplement) XXX_Size ¶
func (m *Supplement) XXX_Size() int
func (*Supplement) XXX_Unmarshal ¶
func (m *Supplement) XXX_Unmarshal(b []byte) error
type Supplement_Type ¶
type Supplement_Type int32
const (
Supplement_Address Supplement_Type = 0
)
func (Supplement_Type) EnumDescriptor ¶
func (Supplement_Type) EnumDescriptor() ([]byte, []int)
func (Supplement_Type) String ¶
func (x Supplement_Type) String() string