Documentation ¶
Index ¶
- Constants
- func CreateRawTransaction(from string, txhash []crypto.HashType, vout []uint32, to []string, ...) (*types.Transaction, error)
- func DoCall(conn *grpc.ClientConn, from, to, data string, height, timeout uint32, ...) (interface{}, error)
- func FetchUtxos(conn *grpc.ClientConn, addr string, amount uint64, tHashStr string, ...) ([]*rpcpb.Utxo, error)
- func GetBalance(conn *grpc.ClientConn, addresses []string) ([]uint64, error)
- func GetBlock(conn *grpc.ClientConn, hash string) (*types.Block, error)
- func GetBlockCount(conn *grpc.ClientConn) (uint32, error)
- func GetBlockHash(conn *grpc.ClientConn, height uint32) (string, error)
- func GetBlockHeader(conn *grpc.ClientConn, hash string) (*types.BlockHeader, error)
- func GetFeePrice(conn *grpc.ClientConn) (uint64, error)
- func GetGRPCConn(peerAddr string) (*grpc.ClientConn, error)
- func GetRawTransaction(conn *grpc.ClientConn, hash []byte) (*types.Transaction, error)
- func GetTokenBalance(conn *grpc.ClientConn, addresses []string, tokenHash string, tokenIndex uint32) ([]uint64, error)
- func MakeUnsignedCombineTokenTx(wa service.WalletAgent, from string, tid *types.TokenID, gasUsed uint64) (*types.Transaction, []*rpcpb.Utxo, error)
- func MakeUnsignedCombineTx(wa service.WalletAgent, from string, gasUsed uint64) (*types.Transaction, []*rpcpb.Utxo, error)
- func MakeUnsignedContractCallTx(wa service.WalletAgent, from string, amount, gasLimit, gasPrice, nonce uint64, ...) (*types.Transaction, []*rpcpb.Utxo, error)
- func MakeUnsignedContractDeployTx(wa service.WalletAgent, from string, amount, gasLimit, gasPrice, nonce uint64, ...) (*types.Transaction, []*rpcpb.Utxo, error)
- func MakeUnsignedSplitAddrTx(wa service.WalletAgent, from string, addrs []string, weights []uint64, ...) (*types.Transaction, []*rpcpb.Utxo, error)
- func MakeUnsignedTokenIssueTx(wa service.WalletAgent, issuer, owner string, tag *rpcpb.TokenTag, ...) (*types.Transaction, uint32, []*rpcpb.Utxo, error)
- func MakeUnsignedTokenTransferTx(wa service.WalletAgent, from string, to []string, amounts []uint64, ...) (*types.Transaction, []*rpcpb.Utxo, error)
- func MakeUnsignedTx(wa service.WalletAgent, from string, to []string, amounts []uint64, ...) (*types.Transaction, []*rpcpb.Utxo, error)
- func NewContractCallTx(acc *acc.Account, to string, gasPrice, gasLimit, nonce uint64, code []byte, ...) (*types.Transaction, error)
- func NewContractDeployTx(acc *acc.Account, gasPrice, gasLimit, nonce uint64, code []byte, ...) (*types.Transaction, string, error)
- func NewERC20TransferFromContractTxs(acc *acc.Account, contractAddr string, count int, ...) ([]*types.Transaction, error)
- func NewIssueTokenTx(acc *acc.Account, to string, tag *rpcpb.TokenTag, conn *grpc.ClientConn) (*types.Transaction, *types.TokenID, *rpcpb.Utxo, error)
- func NewSplitAddrTxWithFee(acc *acc.Account, addrs []string, weights []uint64, gasUsed uint64, ...) (tx *types.Transaction, change *rpcpb.Utxo, err error)
- func NewTokenTx(acc *acc.Account, toAddrs []string, amounts []uint64, tHashStr string, ...) (*types.Transaction, *rpcpb.Utxo, *rpcpb.Utxo, error)
- func NewTokenTxs(acc *acc.Account, toAddr string, amountT uint64, count int, tHashStr string, ...) ([]*types.Transaction, error)
- func NewTx(fromAcc *acc.Account, toAddrs []string, amounts []uint64, ...) (tx *types.Transaction, change *rpcpb.Utxo, fee uint64, err error)
- func NewTxWithFee(fromAcc *acc.Account, toAddrs []string, amounts []uint64, fee uint64, ...) (tx *types.Transaction, change *rpcpb.Utxo, err error)
- func NewTxs(fromAcc *acc.Account, toAddr string, count int, conn *grpc.ClientConn) (txss [][]*types.Transaction, transfer, totalFee uint64, num int, err error)
- func SendTransaction(conn *grpc.ClientConn, tx *types.Transaction) (string, error)
- func SetDebugLevel(conn *grpc.ClientConn, level string) error
- func ToPbLogs(logs []*types.Log) []*rpcpb.Logs_LogDetail
- func UpdateNetworkID(conn *grpc.ClientConn, id uint32) error
- type BlockEndpoint
- type Endpoint
- type LogEndpoint
Constants ¶
const ( BlockEp = "block_endpoint" LogEp = "log_endpoint" )
Key to endpoints.
Variables ¶
This section is empty.
Functions ¶
func CreateRawTransaction ¶ added in v0.5.0
func CreateRawTransaction( from string, txhash []crypto.HashType, vout []uint32, to []string, amounts []uint64, height uint32, ) (*types.Transaction, error)
CreateRawTransaction create a tx without signature,it returns a tx and utxo
func DoCall ¶ added in v0.5.0
func DoCall(conn *grpc.ClientConn, from, to, data string, height, timeout uint32, abidata []byte) (interface{}, error)
DoCall executes a message call transaction, which is directly executed in the VM of the node, but never mined into the blockchain.
blockNumber selects the block height at which the call runs. It can be nil, in which case the code is taken from the latest known block. Note that state from very old blocks might not be available.
func FetchUtxos ¶
func FetchUtxos( conn *grpc.ClientConn, addr string, amount uint64, tHashStr string, tIdx uint32, ) ([]*rpcpb.Utxo, error)
FetchUtxos fetch utxos from chain
func GetBalance ¶
func GetBalance(conn *grpc.ClientConn, addresses []string) ([]uint64, error)
GetBalance returns total amount of an address
func GetBlockCount ¶
func GetBlockCount(conn *grpc.ClientConn) (uint32, error)
GetBlockCount query chain height
func GetBlockHash ¶
func GetBlockHash(conn *grpc.ClientConn, height uint32) (string, error)
GetBlockHash returns block hash of a height
func GetBlockHeader ¶
func GetBlockHeader(conn *grpc.ClientConn, hash string) (*types.BlockHeader, error)
GetBlockHeader returns header info of a block
func GetFeePrice ¶
func GetFeePrice(conn *grpc.ClientConn) (uint64, error)
GetFeePrice gets the recommended mining fee price according to recent packed transactions
func GetGRPCConn ¶
func GetGRPCConn(peerAddr string) (*grpc.ClientConn, error)
GetGRPCConn returns a conn with peer addr
func GetRawTransaction ¶
func GetRawTransaction(conn *grpc.ClientConn, hash []byte) (*types.Transaction, error)
GetRawTransaction get the transaction info of given hash
func GetTokenBalance ¶
func GetTokenBalance( conn *grpc.ClientConn, addresses []string, tokenHash string, tokenIndex uint32, ) ([]uint64, error)
GetTokenBalance returns total amount of an address with specified token id
func MakeUnsignedCombineTokenTx ¶ added in v0.5.0
func MakeUnsignedCombineTokenTx( wa service.WalletAgent, from string, tid *types.TokenID, gasUsed uint64, ) (*types.Transaction, []*rpcpb.Utxo, error)
MakeUnsignedCombineTokenTx make a combine tx without signature
func MakeUnsignedCombineTx ¶ added in v0.5.0
func MakeUnsignedCombineTx( wa service.WalletAgent, from string, gasUsed uint64, ) (*types.Transaction, []*rpcpb.Utxo, error)
MakeUnsignedCombineTx make a combine tx without signature
func MakeUnsignedContractCallTx ¶ added in v0.5.0
func MakeUnsignedContractCallTx( wa service.WalletAgent, from string, amount, gasLimit, gasPrice, nonce uint64, contractAddr string, byteCode []byte, ) (*types.Transaction, []*rpcpb.Utxo, error)
MakeUnsignedContractCallTx call a contract tx without a signature
func MakeUnsignedContractDeployTx ¶ added in v0.5.0
func MakeUnsignedContractDeployTx( wa service.WalletAgent, from string, amount, gasLimit, gasPrice, nonce uint64, byteCode []byte, ) (*types.Transaction, []*rpcpb.Utxo, error)
MakeUnsignedContractDeployTx make a tx without a signature
func MakeUnsignedSplitAddrTx ¶
func MakeUnsignedSplitAddrTx( wa service.WalletAgent, from string, addrs []string, weights []uint64, gasUsed uint64, ) (*types.Transaction, []*rpcpb.Utxo, error)
MakeUnsignedSplitAddrTx news tx to make split addr without signature it returns a tx, split addr, a change
func MakeUnsignedTokenIssueTx ¶
func MakeUnsignedTokenIssueTx( wa service.WalletAgent, issuer, owner string, tag *rpcpb.TokenTag, gasUsed uint64, ) (*types.Transaction, uint32, []*rpcpb.Utxo, error)
MakeUnsignedTokenIssueTx news tx to issue token without signature
func MakeUnsignedTokenTransferTx ¶
func MakeUnsignedTokenTransferTx( wa service.WalletAgent, from string, to []string, amounts []uint64, tid *types.TokenID, gasUsed uint64, ) (*types.Transaction, []*rpcpb.Utxo, error)
MakeUnsignedTokenTransferTx news tx to transfer token without signature
func MakeUnsignedTx ¶
func MakeUnsignedTx( wa service.WalletAgent, from string, to []string, amounts []uint64, gasUsed uint64, ) (*types.Transaction, []*rpcpb.Utxo, error)
MakeUnsignedTx make a tx without signature
func NewContractCallTx ¶ added in v0.5.0
func NewContractCallTx( acc *acc.Account, to string, gasPrice, gasLimit, nonce uint64, code []byte, conn *grpc.ClientConn, ) (*types.Transaction, error)
NewContractCallTx new a call contract transaction
func NewContractDeployTx ¶ added in v0.5.0
func NewContractDeployTx( acc *acc.Account, gasPrice, gasLimit, nonce uint64, code []byte, conn *grpc.ClientConn, ) (*types.Transaction, string, error)
NewContractDeployTx new a deploy contract transaction
func NewERC20TransferFromContractTxs ¶ added in v0.5.0
func NewERC20TransferFromContractTxs( acc *acc.Account, contractAddr string, count int, gasPrice, gasLimit, startNonce uint64, code []byte, conn *grpc.ClientConn, ) ([]*types.Transaction, error)
NewERC20TransferFromContractTxs new a contract transferFrom tx
func NewIssueTokenTx ¶
func NewIssueTokenTx( acc *acc.Account, to string, tag *rpcpb.TokenTag, conn *grpc.ClientConn, ) (*types.Transaction, *types.TokenID, *rpcpb.Utxo, error)
NewIssueTokenTx new a issue token transaction
func NewSplitAddrTxWithFee ¶
func NewSplitAddrTxWithFee( acc *acc.Account, addrs []string, weights []uint64, gasUsed uint64, conn *grpc.ClientConn, ) (tx *types.Transaction, change *rpcpb.Utxo, err error)
NewSplitAddrTxWithFee new split address tx
func NewTokenTx ¶
func NewTokenTx( acc *acc.Account, toAddrs []string, amounts []uint64, tHashStr string, tIdx uint32, conn *grpc.ClientConn, ) (*types.Transaction, *rpcpb.Utxo, *rpcpb.Utxo, error)
NewTokenTx new a token tx
func NewTokenTxs ¶
func NewTokenTxs( acc *acc.Account, toAddr string, amountT uint64, count int, tHashStr string, tIdx uint32, conn *grpc.ClientConn, ) ([]*types.Transaction, error)
NewTokenTxs new a token tx
func NewTx ¶
func NewTx(fromAcc *acc.Account, toAddrs []string, amounts []uint64, conn *grpc.ClientConn) (tx *types.Transaction, change *rpcpb.Utxo, fee uint64, err error)
NewTx new a tx and return change utxo
func NewTxWithFee ¶
func NewTxWithFee( fromAcc *acc.Account, toAddrs []string, amounts []uint64, fee uint64, conn *grpc.ClientConn, ) (tx *types.Transaction, change *rpcpb.Utxo, err error)
NewTxWithFee new a tx and return change utxo
func NewTxs ¶
func NewTxs( fromAcc *acc.Account, toAddr string, count int, conn *grpc.ClientConn, ) (txss [][]*types.Transaction, transfer, totalFee uint64, num int, err error)
NewTxs construct some transactions
func SendTransaction ¶
func SendTransaction(conn *grpc.ClientConn, tx *types.Transaction) (string, error)
SendTransaction sends an signed transaction to node server through grpc connection
func SetDebugLevel ¶
func SetDebugLevel(conn *grpc.ClientConn, level string) error
SetDebugLevel calls the DebugLevel gRPC methods.
func ToPbLogs ¶ added in v0.5.0
func ToPbLogs(logs []*types.Log) []*rpcpb.Logs_LogDetail
ToPbLogs convert []*types.Log to []*rpcpb.Logs_LogDetail.
func UpdateNetworkID ¶
func UpdateNetworkID(conn *grpc.ClientConn, id uint32) error
UpdateNetworkID calls the UpdateNetworkID gRPC methods.
Types ¶
type BlockEndpoint ¶ added in v0.5.0
type BlockEndpoint struct {
// contains filtered or unexported fields
}
BlockEndpoint is an endpoint to push new blocks.
func NewBlockEndpoint ¶ added in v0.5.0
func NewBlockEndpoint(bus eventbus.Bus) *BlockEndpoint
NewBlockEndpoint return a new block endpoint.
func (*BlockEndpoint) GetEventMutex ¶ added in v0.5.0
func (bep *BlockEndpoint) GetEventMutex() *sync.RWMutex
GetEventMutex return eventMtx.
func (*BlockEndpoint) GetQueue ¶ added in v0.5.0
func (bep *BlockEndpoint) GetQueue() *list.List
GetQueue return blocks caching list.
func (*BlockEndpoint) Subscribe ¶ added in v0.5.0
func (bep *BlockEndpoint) Subscribe(...string) error
Subscribe subscribe the topic of new blocks.
func (*BlockEndpoint) Unsubscribe ¶ added in v0.5.0
func (bep *BlockEndpoint) Unsubscribe(...string) error
Unsubscribe unsubscribe the topic of new blocks.
type Endpoint ¶ added in v0.5.0
type Endpoint interface { GetQueue() *list.List GetEventMutex() *sync.RWMutex Subscribe(...string) error Unsubscribe(...string) error }
Endpoint is an interface for websocket endpoint.
type LogEndpoint ¶ added in v0.5.0
type LogEndpoint struct {
// contains filtered or unexported fields
}
LogEndpoint is an endpoint to push logs.
func NewLogEndpoint ¶ added in v0.5.0
func NewLogEndpoint(bus eventbus.Bus) *LogEndpoint
NewLogEndpoint return a new log endpoint.
func (*LogEndpoint) GetEventMutex ¶ added in v0.5.0
func (lep *LogEndpoint) GetEventMutex() *sync.RWMutex
GetEventMutex return eventMtx.
func (*LogEndpoint) GetQueue ¶ added in v0.5.0
func (lep *LogEndpoint) GetQueue() *list.List
GetQueue return logs caching list.
func (*LogEndpoint) Subscribe ¶ added in v0.5.0
func (lep *LogEndpoint) Subscribe(addrs ...string) error
Subscribe subscribe the topic of new logs.
func (*LogEndpoint) Unsubscribe ¶ added in v0.5.0
func (lep *LogEndpoint) Unsubscribe(addrs ...string) error
Unsubscribe unsubscribe the topic of new logs.