Documentation ¶
Index ¶
- Constants
- func GetNai(coin string) string
- func GetPrecision(coin string) uint8
- func RemoveFillChar(nai string) string
- type Amount
- type AmountJson
- type Extension
- type OpType
- type Operation
- type RawAmount
- type RawOperation
- type RawTransaction
- type RawTransferOperation
- type Signature
- type Transaction
- type TransferJson
- type TransferOperation
- type TxEncoder
Constants ¶
View Source
const ( NAI_STEEM = "STEEM" NAI_SDB = "SDB" NAI_TESTS = "TESTS" NAI_VESTS = "VESTS" NAI_HDB = "HDB" NAI_TDB = "TBD" NAI_HIVE = "HIVE" )
Variables ¶
This section is empty.
Functions ¶
func GetPrecision ¶
func RemoveFillChar ¶
Types ¶
type AmountJson ¶
type Operation ¶
type Operation interface {
InitData(data *RawOperation) error
}
func NewOperation ¶
type RawAmount ¶
type RawAmount struct { Amount uint64 `json:"amount"` Precision uint8 `json:"precision"` Nai string `json:"nai"` }
func CreateAmount ¶
func (*RawAmount) ParseToBroadcastJson ¶
func (a *RawAmount) ParseToBroadcastJson() interface{}
{ "amount": "10", "precision": 3, "nai": "@@000000021" }
type RawOperation ¶
type RawOperation interface { OpType() OpType ParseToBroadcastJson() interface{} }
func NewRawOperation ¶
func NewRawOperation(opType OpType) RawOperation
type RawTransaction ¶
type RawTransaction struct { RefBlockNum uint16 `json:"ref_block_num"` // 参考的区块号 RefBlockPrefix uint32 `json:"ref_block_prefix"` // 参考区块id Expiration time.Time `json:"expiration"` // 交易到期时间 Operations *[]RawOperation `json:"operations"` // 交易操作 Extensions *[]Extension `json:"extensions"` // 交易扩展 Signatures *[]string `json:"signatures"` // 交易签名 }
func (*RawTransaction) Decoder ¶
func (rt *RawTransaction) Decoder(data []byte) error
func (*RawTransaction) Encode ¶
func (rt *RawTransaction) Encode() (*Transaction, error)
func (*RawTransaction) ParseToBroadcastJson ¶
func (rt *RawTransaction) ParseToBroadcastJson() interface{}
type RawTransferOperation ¶
type RawTransferOperation struct { Type OpType `json:",omitempty"` From string `json:",omitempty"` To string `json:",omitempty"` Amount RawAmount `json:",omitempty"` Memo string `json:",omitempty"` }
func (*RawTransferOperation) OpType ¶
func (txOp *RawTransferOperation) OpType() OpType
func (*RawTransferOperation) ParseToBroadcastJson ¶
func (txOp *RawTransferOperation) ParseToBroadcastJson() interface{}
[
"transfer", { "from": "hiveio", "to": "alice", "amount": { "amount": "10", "precision": 3, "nai": "@@000000021" }, "memo": "Thanks for all the fish." }
]
type Transaction ¶
type Transaction struct { RefBlockNum []byte // 2 byte, 当前区块号 & 0xFFFF 获取一个参考的区块 RefBlockPrefix []byte // 4 byte, 当前区块id的第四个字节开始取4个字节长度的值进行小端转换作为参考值 Expiration []byte // 4 byte, 时间戳 Operations *[]Operation // 交易的操作 Extensions *[]Extension // 扩展 Signatures *[]Signature // 签名 }
func (*Transaction) DecodeRaw ¶
func (tx *Transaction) DecodeRaw() interface{}
func (*Transaction) Encode ¶
func (tx *Transaction) Encode() *[]byte
func (*Transaction) EncodeForSign ¶
func (tx *Transaction) EncodeForSign() *[]byte
type TransferJson ¶
type TransferOperation ¶
type TransferOperation struct { Type byte // 1 byte From []byte // data len To []byte // data len Amount *Amount Memo []byte // data len }
func (*TransferOperation) Decode ¶
func (txOp *TransferOperation) Decode(offset int, data []byte) (int, error)
func (*TransferOperation) DecodeRaw ¶
func (txOp *TransferOperation) DecodeRaw() interface{}
func (*TransferOperation) Encode ¶
func (txOp *TransferOperation) Encode() *[]byte
func (*TransferOperation) InitData ¶
func (txOp *TransferOperation) InitData(data *RawOperation) error
Click to show internal directories.
Click to hide internal directories.