Documentation ¶
Index ¶
- Constants
- Variables
- func AddressToPublicKey(address string) (string, error)
- func BalanceTransfer(method, to string, amount uint64) ([]byte, error)
- func BalanceTransferAll(method, to, keepAlive string) ([]byte, error)
- func BytesToCompactBytes(bytes []byte) (res []byte)
- func CompactLength(data uint32) int
- func Encode(data uint64) string
- func ExtendLEBytes(input []byte, length int) []byte
- func GetEra(height uint64, calPeriod uint64) []byte
- func PubKeyToAddress(publicKey []byte, prefix []byte) (address string, err error)
- func SignTx(tx TxStruct, txType int32, privateKey string) (string, error)
- func SignTx2(tx TxStruct2, signature []byte) (string, error)
- func ValidateAddress(addr string) bool
- type TxStruct
- type TxStruct2
- type UnSignedTx
Constants ¶
View Source
const ( Transfer = 1 // balances-transfer balances-transfer_keep_alive TransferAll = 2 // balances-transfer_all )
Variables ¶
View Source
var ( SubstratePrefix = []byte{0x2a} PolkadotPrefix = []byte{0x00} KsmPrefix = []byte{0x02} DarwiniaPrefix = []byte{0x12} EdgewarePrefix = []byte{0x07} CentrifugePrefix = []byte{0x24} PlasmPrefix = []byte{0x05} StafiPrefix = []byte{0x14} KulupuPrefix = []byte{0x10} BifrostPrefix = []byte{0x06} KaruraPrefix = []byte{0x08} ReynoldsPrefix = []byte{0x09} AcalaPrefix = []byte{0x0a} LaminarPrefix = []byte{0x0b} PolymathPrefix = []byte{0x0c} RobonomicsPrefix = []byte{0x20} ChainxPrefix = []byte{0x2c} SSPrefix = []byte{0x53, 0x53, 0x35, 0x38, 0x50, 0x52, 0x45} )
Functions ¶
func AddressToPublicKey ¶
func BalanceTransfer ¶
BalanceTransfer balances-transfer_keep_alive
func BalanceTransferAll ¶
BalanceTransferAll false: keepAlive 00
func BytesToCompactBytes ¶
func CompactLength ¶
func ExtendLEBytes ¶
func PubKeyToAddress ¶
func ValidateAddress ¶
Types ¶
type TxStruct ¶
type TxStruct struct { ModuleMethod string `json:"module_method"` Version string `json:"version"` From string `json:"from"` To string `json:"to"` Amount uint64 `json:"amount"` Nonce uint64 `json:"nonce"` Tip uint64 `json:"tip"` BlockHeight uint64 `json:"block_height"` BlockHash string `json:"block_hash"` GenesisHash string `json:"genesis_hash"` SpecVersion uint32 `json:"spec_version"` TxVersion uint32 `json:"tx_version"` KeepAlive string `json:"keep_alive"` EraHeight uint64 `json:"era_height"` }
type TxStruct2 ¶
type TxStruct2 struct { ModuleMethod string `json:"module_method"` Version string `json:"version"` From string `json:"from"` To string `json:"to"` Amount uint64 `json:"amount"` Nonce uint64 `json:"nonce"` Tip uint64 `json:"tip"` BlockHash string `json:"block_hash"` GenesisHash string `json:"genesis_hash"` SpecVersion string `json:"spec_version"` TxVersion string `json:"tx_version"` Era string `json:"era"` }
type UnSignedTx ¶
type UnSignedTx struct { Method []byte Era []byte Nonce []byte Tip []byte SpecVersion []byte GenesisHash []byte BlockHash []byte TxVersion []byte }
func UnSignedTxFromTxStruct ¶
func UnSignedTxFromTxStruct(tx TxStruct, txType int32) (UnSignedTx, error)
func UnSignedTxFromTxStruct2 ¶
func UnSignedTxFromTxStruct2(tx TxStruct2) (UnSignedTx, error)
func (*UnSignedTx) ToBytesString ¶
func (t *UnSignedTx) ToBytesString() string
Click to show internal directories.
Click to hide internal directories.