Documentation ¶
Overview ¶
* Copyright (C) 2019 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.
* Copyright (C) 2019 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.
Index ¶
- type Data
- type Init
- type Payment
- type Provider
- func (provider *Provider) CreateTransaction(payload TransactionPayload) (*jsonrpc.RPCResponse, error)
- func (provider *Provider) CreateTransactionBatch(payloads [][]TransactionPayload) (jsonrpc.RPCResponses, error)
- func (provider *Provider) CreateTransactionRaw(payload []byte) (*jsonrpc.RPCResponse, error)
- func (provider *Provider) DSBlockListing(ds_block_listing int) (*core.BlockList, error)
- func (provider *Provider) GetBalance(user_address string) (*core.BalanceAndNonce, error)
- func (provider *Provider) GetBlockchainInfo() (*core.BlockchainInfo, error)
- func (provider *Provider) GetContractAddressFromTransactionID(transaction_id string) (string, error)
- func (provider *Provider) GetCurrentDSEpoch() (string, error)
- func (provider *Provider) GetCurrentMiniEpoch() (string, error)
- func (provider *Provider) GetDSBlockRate() (float64, error)
- func (provider *Provider) GetDsBlock(block_number string) (*core.DSBlock, error)
- func (provider *Provider) GetLatestDsBlock() (*core.DSBlock, error)
- func (provider *Provider) GetLatestTxBlock() (*core.TxBlock, error)
- func (provider *Provider) GetMinerInfo(dsNumber string) (*core.MinerInfo, error)
- func (provider *Provider) GetMinimumGasPrice() (string, error)
- func (provider *Provider) GetNetworkId() (string, error)
- func (provider *Provider) GetNumDSBlocks() (string, error)
- func (provider *Provider) GetNumTransactions() (string, error)
- func (provider *Provider) GetNumTxBlocks() (string, error)
- func (provider *Provider) GetNumTxnsDSEpoch() (string, error)
- func (provider *Provider) GetNumTxnsTxEpoch() (string, error)
- func (provider *Provider) GetPendingTxn(tx string) (*core.PendingTxnResult, error)
- func (provider *Provider) GetPendingTxns() (*core.PendingTxns, error)
- func (provider *Provider) GetPrevDSDifficulty() (int64, error)
- func (provider *Provider) GetPrevDifficulty() (int64, error)
- func (provider *Provider) GetRecentTransactions() (*core.Transactions, error)
- func (provider *Provider) GetShardingStructure() (*core.ShardingStructure, error)
- func (provider *Provider) GetSmartContractCode(contract_address string) (string, error)
- func (provider *Provider) GetSmartContractInit(contract_address string) ([]core.ContractValue, error)
- func (provider *Provider) GetSmartContractState(contract_address string) (*jsonrpc.RPCResponse, error)
- func (provider *Provider) GetSmartContractSubState(contractAddress string, params ...interface{}) (string, error)
- func (provider *Provider) GetSmartContracts(user_address string) (*jsonrpc.RPCResponse, error)
- func (provider *Provider) GetTotalCoinSupply() (string, error)
- func (provider *Provider) GetTransaction(transaction_hash string) (*core.Transaction, error)
- func (provider *Provider) GetTransactionBatch(transactionHashes []string) ([]*core.Transaction, error)
- func (provider *Provider) GetTransactionRate() (float64, error)
- func (provider *Provider) GetTransactionsForTxBlock(tx_block_number string) ([][]string, error)
- func (provider *Provider) GetTxBlock(tx_block string) (*core.TxBlock, error)
- func (provider *Provider) GetTxBlockRate() (float64, error)
- func (provider *Provider) GetTxnBodiesForTxBlock(tx_block_number string) ([]core.Transaction, error)
- func (provider *Provider) TxBlockListing(page int) (*core.BlockList, error)
- type TransactionPayload
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Init ¶
type Init struct { Version int `json:"version"` Nonce int `json:"nonce"` ToAddr string `json:"toAddr"` Amount int64 `json:"amount"` PubKey string `json:"pubKey"` GasPrice int64 `json:"gasPrice"` GasLimit int64 `json:"gasLimit"` Code string `json:"code"` Data []interface{} `json:"data"` Signature string `json:"signature"` }
type Payment ¶
type Payment struct { Version int `json:"version"` Nonce int `json:"nonce"` ToAddr string `json:"toAddr"` Amount int64 `json:"amount"` PubKey string `json:"pubKey"` GasPrice int64 `json:"gasPrice"` GasLimit int64 `json:"gasLimit"` Code string `json:"code"` Data string `json:"data"` Signature string `json:"signature"` }
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func NewProvider ¶
func (*Provider) CreateTransaction ¶
func (provider *Provider) CreateTransaction(payload TransactionPayload) (*jsonrpc.RPCResponse, error)
Create a new Transaction object and send it to the network to be process.
func (*Provider) CreateTransactionBatch ¶
func (provider *Provider) CreateTransactionBatch(payloads [][]TransactionPayload) (jsonrpc.RPCResponses, error)
func (*Provider) CreateTransactionRaw ¶
func (provider *Provider) CreateTransactionRaw(payload []byte) (*jsonrpc.RPCResponse, error)
func (*Provider) DSBlockListing ¶
Returns a paginated list of up to 10 Directory Service (DS) blocks and their block hashes for a specified page. The maxPages variable that specifies the maximum number of pages available is also returned.
func (*Provider) GetBalance ¶
func (provider *Provider) GetBalance(user_address string) (*core.BalanceAndNonce, error)
Returns the current balance of an account, measured in the smallest accounting unit Qa (or 10^-12 Zil). This is represented as a String Returns the current nonce of an account. This is represented as an Number.
func (*Provider) GetBlockchainInfo ¶
func (provider *Provider) GetBlockchainInfo() (*core.BlockchainInfo, error)
Returns the current network statistics for the specified network.
func (*Provider) GetContractAddressFromTransactionID ¶
func (provider *Provider) GetContractAddressFromTransactionID(transaction_id string) (string, error)
Returns a smart contract address of 20 bytes. This is represented as a String. NOTE: This only works for contract deployment transactions.
func (*Provider) GetCurrentDSEpoch ¶
Returns the current number of DS blocks in the network. This is represented as a String.
func (*Provider) GetCurrentMiniEpoch ¶
Returns the current TX block number of the network. This is represented as a String.
func (*Provider) GetDSBlockRate ¶
Returns the current Directory Service blockrate per second.
func (*Provider) GetDsBlock ¶
Returns the details of a specified Directory Service block.
func (*Provider) GetLatestDsBlock ¶
Returns the details of the most recent Directory Service block.
func (*Provider) GetLatestTxBlock ¶
Returns the details of the most recent Transaction block.
func (*Provider) GetMinerInfo ¶
Returns the mining nodes (i.e., the members of the DS committee and shards) at the specified DS block. Notes: 1. Nodes owned by Zilliqa Research are omitted. 2. dscommittee has no size field since the DS committee size is fixed for a given chain. 3. For the Zilliqa Mainnet, this API is only available from DS block 5500 onwards.
func (*Provider) GetMinimumGasPrice ¶
Returns the minimum gas price for this DS epoch, measured in the smallest price unit Qa (or 10^-12 Zil) in Zilliqa. This is represented as a String.
func (*Provider) GetNetworkId ¶
Returns the CHAIN_ID of the specified network. This is represented as a String.
func (*Provider) GetNumDSBlocks ¶
Returns the current number of validated Directory Service blocks in the network. This is represented as a String.
func (*Provider) GetNumTransactions ¶
Returns the current number of validated Transactions in the network. This is represented as a String.
func (*Provider) GetNumTxBlocks ¶
Returns the current number of Transaction blocks in the network. This is represented as a String.
func (*Provider) GetNumTxnsDSEpoch ¶
Returns the number of validated transactions included in this DS epoch. This is represented as String.
func (*Provider) GetNumTxnsTxEpoch ¶
Returns the number of validated transactions included in this Transaction epoch. This is represented as String.
func (*Provider) GetPendingTxn ¶
func (provider *Provider) GetPendingTxn(tx string) (*core.PendingTxnResult, error)
Returns the pending status of a specified Transaction.
func (*Provider) GetPendingTxns ¶
func (provider *Provider) GetPendingTxns() (*core.PendingTxns, error)
Returns the pending status of all unvalidated Transactions.
func (*Provider) GetPrevDSDifficulty ¶
Returns the minimum DS difficulty of the previous block. This is represented as an Number.
func (*Provider) GetPrevDifficulty ¶
Returns the minimum shard difficulty of the previous block. This is represented as an Number.
func (*Provider) GetRecentTransactions ¶
func (provider *Provider) GetRecentTransactions() (*core.Transactions, error)
Returns the most recent 100 transactions that are validated by the Zilliqa network.
func (*Provider) GetShardingStructure ¶
func (provider *Provider) GetShardingStructure() (*core.ShardingStructure, error)
func (*Provider) GetSmartContractCode ¶
Returns the Scilla code associated with a smart contract address. This is represented as a String.
func (*Provider) GetSmartContractInit ¶
func (provider *Provider) GetSmartContractInit(contract_address string) ([]core.ContractValue, error)
Returns the initialization (immutable) parameters of a given smart contract, represented in a JSON format.
func (*Provider) GetSmartContractState ¶
func (provider *Provider) GetSmartContractState(contract_address string) (*jsonrpc.RPCResponse, error)
Returns the state (mutable) variables of a smart contract address, represented in a JSON format.
func (*Provider) GetSmartContractSubState ¶
func (provider *Provider) GetSmartContractSubState(contractAddress string, params ...interface{}) (string, error)
Returns the state (or a part specified) of a smart contract address, represented in a JSON format.
func (*Provider) GetSmartContracts ¶
func (provider *Provider) GetSmartContracts(user_address string) (*jsonrpc.RPCResponse, error)
Returns the list of smart contract addresses created by an User's account and the contracts' latest states.
func (*Provider) GetTotalCoinSupply ¶
Returns the total supply (ZIL) of coins in the network. This is represented as a String.
func (*Provider) GetTransaction ¶
func (provider *Provider) GetTransaction(transaction_hash string) (*core.Transaction, error)
Returns the details of a specified Transaction. Note: If the transaction had an data field or code field, it will be displayed
func (*Provider) GetTransactionBatch ¶
func (provider *Provider) GetTransactionBatch(transactionHashes []string) ([]*core.Transaction, error)
func (*Provider) GetTransactionRate ¶
Returns the current Transaction rate per second (TPS) of the network. This is represented as an Number.
func (*Provider) GetTransactionsForTxBlock ¶
Returns the validated transactions included within a specfied final transaction block as an array of length i, where i is the number of shards plus the DS committee. The transactions are grouped based on the group that processed the transaction. The first element of the array refers to the first shard. The last element of the array at index, i, refers to the transactions processed by the DS Committee.
func (*Provider) GetTxBlock ¶
Returns the details of a specified Transaction block.
func (*Provider) GetTxBlockRate ¶
Returns the current Transaction blockrate per second for the network.
func (*Provider) GetTxnBodiesForTxBlock ¶
func (provider *Provider) GetTxnBodiesForTxBlock(tx_block_number string) ([]core.Transaction, error)
func (*Provider) TxBlockListing ¶
Returns a paginated list of up to 10 Transaction blocks and their block hashes for a specified page. The maxPages variable that specifies the maximum number of pages available is also returned.
type TransactionPayload ¶
type TransactionPayload struct { Version int `json:"version"` Nonce int `json:"nonce"` ToAddr string `json:"toAddr"` Amount string `json:"amount"` PubKey string `json:"pubKey"` GasPrice string `json:"gasPrice"` GasLimit string `json:"gasLimit"` Code string `json:"code"` Data string `json:"data"` Signature string `json:"signature"` Priority bool `json:"priority"` }
func NewFromJson ¶
func NewFromJson(data []byte) (*TransactionPayload, error)
some data fields don't match, so we need middle map see the unit test
func NewFromMap ¶
func NewFromMap(middle map[string]interface{}) (*TransactionPayload, error)
func (*TransactionPayload) ToJson ¶
func (pl *TransactionPayload) ToJson() ([]byte, error)