Documentation
¶
Index ¶
- Variables
- func ConvOutPoint(op *types.OutPoint) *corepb.OutPoint
- func ConvPbOutPoint(op *corepb.OutPoint) *types.OutPoint
- func DecodeOutPoint(id string) (*corepb.OutPoint, error)
- func EncodeOutPoint(op *corepb.OutPoint) string
- func IsCoinBaseTxIn(txIn *types.TxIn) bool
- func MakeIssueTokenScript(addr string, tag *rpcpb.TokenTag) ([]byte, error)
- func MakeIssueTokenVout(addr string, tag *rpcpb.TokenTag) (*corepb.TxOut, error)
- func MakePbUtxo(op *types.OutPoint, uw *types.UtxoWrap) *rpcpb.Utxo
- func MakePbVin(utxo *rpcpb.Utxo, seq uint32) *corepb.TxIn
- func MakeSplitAddr(addrs []string, weights []uint64) (string, error)
- func MakeSplitAddrPubkey(addrs []string, weights []uint64) []byte
- func MakeSplitAddrVout(addrs []string, weights []uint64) *corepb.TxOut
- func MakeTokenVout(addr string, tokenID *TokenID, amount uint64) (*corepb.TxOut, error)
- func MakeUnsignedSplitAddrTx(from string, addrs []string, weights []uint64, changeAmt uint64, ...) (*types.Transaction, string, error)
- func MakeUnsignedTokenIssueTx(issuer string, issuee string, tag *rpcpb.TokenTag, changeAmt uint64, ...) (*types.Transaction, uint32, error)
- func MakeUnsignedTokenTransferTx(from string, to []string, amounts []uint64, tid *TokenID, changeAmt uint64, ...) (*types.Transaction, uint64, error)
- func MakeUnsignedTx(from string, to []string, amounts []uint64, changeAmt uint64, ...) (*types.Transaction, error)
- func MakeVin(utxo *rpcpb.Utxo, seq uint32) *types.TxIn
- func MakeVout(addr string, amount uint64) *corepb.TxOut
- func MakeVoutWithSPk(amount uint64, scriptPk []byte) *corepb.TxOut
- func NewCoinBaseTxIn() *types.TxIn
- func NewIssueTokenUtxoWrap(addr string, tag *rpcpb.TokenTag, height uint32) (*types.UtxoWrap, error)
- func NewPbOutPoint(hash *crypto.HashType, index uint32) *corepb.OutPoint
- func NewSplitAddrTxWithUtxos(acc *acc.Account, addrs []string, weights []uint64, utxos []*rpcpb.Utxo, ...) (tx *types.Transaction, splitAddr string, change *rpcpb.Utxo, err error)
- func NewTokenTag(name, sym string, decimal uint32, supply uint64) *rpcpb.TokenTag
- func NewTokenTransferTxWithUtxos(fromAcc *acc.Account, to []string, amounts []uint64, tid *TokenID, ...) (*types.Transaction, *rpcpb.Utxo, *rpcpb.Utxo, error)
- func NewTokenUtxoWrap(addr string, tid *TokenID, height uint32, value uint64) (*types.UtxoWrap, error)
- func NewTxWithUtxos(fromAcc *acc.Account, utxos []*rpcpb.Utxo, toAddrs []string, amounts []uint64, ...) (*types.Transaction, *rpcpb.Utxo, error)
- func NewUtxoWrap(addr string, height uint32, value uint64) *types.UtxoWrap
- func ParseTokenAmount(spk []byte) (uint64, error)
- func SignTxWithUtxos(tx *types.Transaction, utxos []*rpcpb.Utxo, acc *acc.Account) error
- type SortByTokenUTXOValue
- type SortByUTXOValue
- type TokenID
Constants ¶
This section is empty.
Variables ¶
var ( ErrInsufficientBalance = errors.New("insufficient account balance") ErrInvalidArguments = errors.New("invalid arguments") )
Functions ¶
func ConvOutPoint ¶
ConvOutPoint constructs a protobuf OutPoint
func ConvPbOutPoint ¶
ConvPbOutPoint constructs a types OutPoint
func DecodeOutPoint ¶ added in v0.3.1
DecodeOutPoint string token id to TokenID
func EncodeOutPoint ¶ added in v0.3.1
func EncodeOutPoint(op *corepb.OutPoint) string
EncodeOutPoint encode token to string
func IsCoinBaseTxIn ¶
IsCoinBaseTxIn check whether tx in is coin base tx in
func MakeIssueTokenScript ¶
MakeIssueTokenScript make issue token script for addr with supply and tokent ag
func MakeIssueTokenVout ¶
MakeIssueTokenVout make issue token vout
func MakePbUtxo ¶
MakePbUtxo make pb.Utxo from Op and utxo wrap
func MakeSplitAddr ¶
MakeSplitAddr make split addr
func MakeSplitAddrPubkey ¶
MakeSplitAddrPubkey make split addr
func MakeSplitAddrVout ¶
MakeSplitAddrVout make split addr vout
func MakeTokenVout ¶
MakeTokenVout make token tx vout
func MakeUnsignedSplitAddrTx ¶
func MakeUnsignedSplitAddrTx( from string, addrs []string, weights []uint64, changeAmt uint64, utxos ...*rpcpb.Utxo, ) (*types.Transaction, string, error)
MakeUnsignedSplitAddrTx make unsigned split addr tx
func MakeUnsignedTokenIssueTx ¶
func MakeUnsignedTokenIssueTx( issuer string, issuee string, tag *rpcpb.TokenTag, changeAmt uint64, utxos ...*rpcpb.Utxo, ) (*types.Transaction, uint32, error)
MakeUnsignedTokenIssueTx make unsigned token issue tx
func MakeUnsignedTokenTransferTx ¶
func MakeUnsignedTokenTransferTx( from string, to []string, amounts []uint64, tid *TokenID, changeAmt uint64, utxos ...*rpcpb.Utxo, ) (*types.Transaction, uint64, error)
MakeUnsignedTokenTransferTx make unsigned token transfer tx
func MakeUnsignedTx ¶
func MakeUnsignedTx( from string, to []string, amounts []uint64, changeAmt uint64, utxos ...*rpcpb.Utxo, ) (*types.Transaction, error)
MakeUnsignedTx make a tx without signature
func MakeVoutWithSPk ¶
MakeVoutWithSPk makes txOut
func NewIssueTokenUtxoWrap ¶
func NewIssueTokenUtxoWrap( addr string, tag *rpcpb.TokenTag, height uint32, ) (*types.UtxoWrap, error)
NewIssueTokenUtxoWrap makes a UtxoWrap
func NewPbOutPoint ¶
NewPbOutPoint constructs a OutPoint
func NewSplitAddrTxWithUtxos ¶
func NewSplitAddrTxWithUtxos( acc *acc.Account, addrs []string, weights []uint64, utxos []*rpcpb.Utxo, fee uint64, ) (tx *types.Transaction, splitAddr string, change *rpcpb.Utxo, err error)
NewSplitAddrTxWithUtxos new split address tx
func NewTokenTag ¶
NewTokenTag news a TokenTag
func NewTokenTransferTxWithUtxos ¶
func NewTokenTransferTxWithUtxos( fromAcc *acc.Account, to []string, amounts []uint64, tid *TokenID, changeAmt uint64, utxos ...*rpcpb.Utxo, ) (*types.Transaction, *rpcpb.Utxo, *rpcpb.Utxo, error)
NewTokenTransferTxWithUtxos new token Transfer tx with utxos it returns tx, box change and token change
func NewTokenUtxoWrap ¶
func NewTokenUtxoWrap( addr string, tid *TokenID, height uint32, value uint64, ) (*types.UtxoWrap, error)
NewTokenUtxoWrap makes a UtxoWrap
func NewTxWithUtxos ¶
func NewTxWithUtxos( fromAcc *acc.Account, utxos []*rpcpb.Utxo, toAddrs []string, amounts []uint64, changeAmt uint64, ) (*types.Transaction, *rpcpb.Utxo, error)
NewTxWithUtxos new a transaction
func NewUtxoWrap ¶
NewUtxoWrap makes a UtxoWrap
func ParseTokenAmount ¶
ParseTokenAmount parse token amount from script pubkey
func SignTxWithUtxos ¶
func SignTxWithUtxos( tx *types.Transaction, utxos []*rpcpb.Utxo, acc *acc.Account, ) error
SignTxWithUtxos sign tx with utxo
Types ¶
type SortByTokenUTXOValue ¶
type SortByTokenUTXOValue []*rpcpb.Utxo
SortByTokenUTXOValue defines a type suited for sort
func (SortByTokenUTXOValue) Len ¶
func (x SortByTokenUTXOValue) Len() int
func (SortByTokenUTXOValue) Less ¶
func (x SortByTokenUTXOValue) Less(i, j int) bool
func (SortByTokenUTXOValue) Swap ¶
func (x SortByTokenUTXOValue) Swap(i, j int)
type SortByUTXOValue ¶
type SortByUTXOValue []*rpcpb.Utxo
SortByUTXOValue defines a type suited for sort
func (SortByUTXOValue) Len ¶
func (x SortByUTXOValue) Len() int
func (SortByUTXOValue) Less ¶
func (x SortByUTXOValue) Less(i, j int) bool
func (SortByUTXOValue) Swap ¶
func (x SortByUTXOValue) Swap(i, j int)
type TokenID ¶
TokenID defines token id
func NewTokenID ¶
NewTokenID constructs a token id
func NewTokenIssueTxWithUtxos ¶
func NewTokenIssueTxWithUtxos( fromAcc *acc.Account, to string, tag *rpcpb.TokenTag, changeAmt uint64, utxos ...*rpcpb.Utxo, ) (*types.Transaction, *TokenID, *rpcpb.Utxo, error)
NewTokenIssueTxWithUtxos new token issue tx with utxos
func ParseUtxoAmount ¶
ParseUtxoAmount parse amount from utxo and return amount, is token