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 GetContractVout(tx *types.Transaction) *corepb.TxOut
- func HasContractSpend(tx *types.Transaction) bool
- func HasContractVout(tx *types.Transaction) bool
- func MakeContractCallVout(from, to *types.AddressHash, amount uint64, gas, gasPrice, nonce uint64, ...) (*corepb.TxOut, error)
- func MakeContractCreationVout(from *types.AddressHash, amount, gas, gasPrice, nonce uint64, code []byte) (*corepb.TxOut, error)
- func MakeContractVin(op *types.OutPoint, seq uint32) *types.TxIn
- 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(op *corepb.OutPoint, seq uint32) *corepb.TxIn
- func MakeSplitAddrVout(addrs []types.Address, weights []uint64) *corepb.TxOut
- func MakeSplitAddress(txHash *crypto.HashType, idx uint32, addrs []types.Address, weights []uint64) types.Address
- func MakeTokenVout(addr string, tokenID *types.TokenID, amount uint64) (*corepb.TxOut, error)
- func MakeUnsignedContractCallTx(from string, amount, changeAmt, gasLimit, gasPrice, nonce uint64, to string, ...) (*types.Transaction, error)
- func MakeUnsignedContractDeployTx(from string, amount, changeAmt, gasLimit, gasPrice, nonce uint64, ...) (*types.Transaction, error)
- func MakeUnsignedSplitAddrTx(from string, addrs []string, weights []uint64, changeAmt uint64, ...) (*types.Transaction, error)
- func MakeUnsignedTokenIssueTx(issuer string, Owner string, tag *rpcpb.TokenTag, changeAmt uint64, ...) (*types.Transaction, uint32, error)
- func MakeUnsignedTokenTransferTx(from string, to []string, amounts []uint64, tid *types.TokenID, ...) (*types.Transaction, uint64, error)
- func MakeUnsignedTx(from string, to []string, amounts []uint64, changeAmt uint64, ...) (*types.Transaction, error)
- func MakeVin(op *types.OutPoint, seq uint32) *types.TxIn
- func MakeVinForTest(tx *types.Transaction, index uint32) []*types.TxIn
- func MakeVout(addr string, amount uint64) *corepb.TxOut
- func MakeVoutWithSPk(amount uint64, scriptPk []byte) *corepb.TxOut
- func NewContractTxWithUtxos(fromAcc *acc.Account, contractAddr string, ...) (*types.Transaction, *rpcpb.Utxo, error)
- 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, change *rpcpb.Utxo, err error)
- func NewTokenID(hash *crypto.HashType, index uint32) *types.TokenID
- func NewTokenIssueTxWithUtxos(fromAcc *acc.Account, to string, tag *rpcpb.TokenTag, changeAmt uint64, ...) (*types.Transaction, *types.TokenID, *rpcpb.Utxo, error)
- func NewTokenTag(name, sym string, decimal uint32, supply uint64) *rpcpb.TokenTag
- func NewTokenTransferTxWithUtxos(fromAcc *acc.Account, to []string, amounts []uint64, tid *types.TokenID, ...) (*types.Transaction, *rpcpb.Utxo, *rpcpb.Utxo, error)
- func NewTokenUtxoWrap(addr string, tid *types.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 ParseUtxoAmount(utxo *rpcpb.Utxo) (uint64, *types.TokenID, error)
- func SignTx(tx *types.Transaction, privKey *crypto.PrivateKey, pubKey *crypto.PublicKey) error
- func SignTxWithUtxos(tx *types.Transaction, utxos []*rpcpb.Utxo, acc *acc.Account) error
- type SortByTokenUTXOValue
- type SortByUTXOValue
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
EncodeOutPoint encode token to string
func GetContractVout ¶ added in v0.5.0
func GetContractVout(tx *types.Transaction) *corepb.TxOut
GetContractVout return contract out if tx has a vout with contract creation or call
func HasContractSpend ¶ added in v0.5.0
func HasContractSpend(tx *types.Transaction) bool
HasContractSpend return true if tx has a vin with Op Spend script sig
func HasContractVout ¶ added in v0.5.0
func HasContractVout(tx *types.Transaction) bool
HasContractVout return true if tx has a vout with contract creation or call
func MakeContractCallVout ¶ added in v0.5.0
func MakeContractCallVout( from, to *types.AddressHash, amount uint64, gas, gasPrice, nonce uint64, code []byte, ) (*corepb.TxOut, error)
MakeContractCallVout makes txOut
func MakeContractCreationVout ¶ added in v0.5.0
func MakeContractCreationVout( from *types.AddressHash, amount, gas, gasPrice, nonce uint64, code []byte, ) (*corepb.TxOut, error)
MakeContractCreationVout makes txOut
func MakeContractVin ¶ added in v0.5.0
MakeContractVin makes txIn
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 MakeSplitAddrVout ¶
MakeSplitAddrVout make split addr vout
func MakeSplitAddress ¶ added in v0.5.0
func MakeSplitAddress( txHash *crypto.HashType, idx uint32, addrs []types.Address, weights []uint64, ) types.Address
MakeSplitAddress make split addr
func MakeTokenVout ¶
MakeTokenVout make token tx vout
func MakeUnsignedContractCallTx ¶ added in v0.5.0
func MakeUnsignedContractCallTx( from string, amount, changeAmt, gasLimit, gasPrice, nonce uint64, to string, byteCode []byte, utxos ...*rpcpb.Utxo, ) (*types.Transaction, error)
MakeUnsignedContractCallTx call a contract tx without signature
func MakeUnsignedContractDeployTx ¶ added in v0.5.0
func MakeUnsignedContractDeployTx( from string, amount, changeAmt, gasLimit, gasPrice, nonce uint64, byteCode []byte, utxos ...*rpcpb.Utxo, ) (*types.Transaction, error)
MakeUnsignedContractDeployTx make a contract tx without signature
func MakeUnsignedSplitAddrTx ¶
func MakeUnsignedSplitAddrTx( from string, addrs []string, weights []uint64, changeAmt uint64, utxos ...*rpcpb.Utxo, ) (*types.Transaction, error)
MakeUnsignedSplitAddrTx make unsigned split addr tx
func MakeUnsignedTokenIssueTx ¶
func MakeUnsignedTokenIssueTx( issuer string, Owner 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 *types.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 MakeVinForTest ¶ added in v0.5.0
func MakeVinForTest(tx *types.Transaction, index uint32) []*types.TxIn
MakeVinForTest use for testcase
func MakeVoutWithSPk ¶
MakeVoutWithSPk makes txOut
func NewContractTxWithUtxos ¶ added in v0.5.0
func NewContractTxWithUtxos( fromAcc *acc.Account, contractAddr string, amount, changeAmt, gasPrice, gasLimit, nonce uint64, byteCode []byte, utxos ...*rpcpb.Utxo, ) (*types.Transaction, *rpcpb.Utxo, error)
NewContractTxWithUtxos new a contract transaction
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, change *rpcpb.Utxo, err error)
NewSplitAddrTxWithUtxos new split address tx
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, *types.TokenID, *rpcpb.Utxo, error)
NewTokenIssueTxWithUtxos new token issue tx with utxos
func NewTokenTag ¶
NewTokenTag news a TokenTag
func NewTokenTransferTxWithUtxos ¶
func NewTokenTransferTxWithUtxos( fromAcc *acc.Account, to []string, amounts []uint64, tid *types.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 *types.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 ParseUtxoAmount ¶
ParseUtxoAmount parse amount from utxo and return amount, is token
func SignTx ¶ added in v0.5.0
func SignTx(tx *types.Transaction, privKey *crypto.PrivateKey, pubKey *crypto.PublicKey) error
SignTx use for testcase
func SignTxWithUtxos ¶
SignTxWithUtxos sign tx with utxo
Types ¶
type SortByTokenUTXOValue ¶
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 ¶
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)