Documentation ¶
Index ¶
- Constants
- Variables
- func GetBlockTransactions(block *ledger.Block) interface{}
- func MakeCommitTransaction(wallet vault.Wallet, sigChain []byte) (*transaction.Transaction, error)
- func MakeIssueTransaction(wallet vault.Wallet, assetID Uint256, address string, value string) (*transaction.Transaction, error)
- func MakePrepaidTransaction(wallet vault.Wallet, assetID Uint256, value, rates string) (*transaction.Transaction, error)
- func MakeRegTransaction(wallet vault.Wallet, name string, value string) (*transaction.Transaction, error)
- func MakeTransferTransaction(wallet vault.Wallet, assetID Uint256, batchOut ...BatchOut) (*transaction.Transaction, error)
- func MakeWithdrawTransaction(wallet vault.Wallet, assetID Uint256, value string) (*transaction.Transaction, error)
- func RespPacking(result interface{}, errcode ErrCode) map[string]interface{}
- func ResponsePack(errCode ErrCode) map[string]interface{}
- func VerifyAndSendTx(n protocol.Noder, txn *transaction.Transaction) errors.ErrCode
- type APIHandler
- type BatchOut
- type ErrCode
- type Handler
- type Serverer
Constants ¶
View Source
const ( BIT_JSONRPC byte = 1 BIT_WEBSOCKET byte = 2 )
Variables ¶
View Source
var ErrMessage = map[ErrCode]string{ SUCCESS: "SUCCESS", SESSION_EXPIRED: "SESSION EXPIRED", SERVICE_CEILING: "SERVICE CEILING", ILLEGAL_DATAFORMAT: "ILLEGAL DATAFORMAT", INVALID_METHOD: "INVALID METHOD", INVALID_PARAMS: "INVALID PARAMS", INVALID_TOKEN: "VERIFY TOKEN ERROR", INVALID_TRANSACTION: "INVALID TRANSACTION", INVALID_ASSET: "INVALID ASSET", INVALID_BLOCK: "INVALID BLOCK", INVALID_HASH: "INVALID HASH", INVALID_VERSION: "INVALID VERSION", UNKNOWN_TRANSACTION: "UNKNOWN TRANSACTION", UNKNOWN_ASSET: "UNKNOWN ASSET", UNKNOWN_BLOCK: "UNKNOWN BLOCK", UNKNOWN_HASH: "UNKNOWN HASH", INTERNAL_ERROR: "INTERNAL ERROR", SMARTCODE_ERROR: "SMARTCODE EXEC ERROR", ErrCode(errors.ErrDuplicateInput): "INTERNAL ERROR, ErrDuplicateInput", ErrCode(errors.ErrAssetPrecision): "INTERNAL ERROR, ErrAssetPrecision", ErrCode(errors.ErrTransactionBalance): "INTERNAL ERROR, ErrTransactionBalance", ErrCode(errors.ErrAttributeProgram): "INTERNAL ERROR, ErrAttributeProgram", ErrCode(errors.ErrTransactionContracts): "INTERNAL ERROR, ErrTransactionContracts", ErrCode(errors.ErrTransactionPayload): "INTERNAL ERROR, ErrTransactionPayload", ErrCode(errors.ErrDoubleSpend): "INTERNAL ERROR, ErrDoubleSpend", ErrCode(errors.ErrTxHashDuplicate): "INTERNAL ERROR, ErrTxHashDuplicate", ErrCode(errors.ErrStateUpdaterVaild): "INTERNAL ERROR, ErrStateUpdaterVaild", ErrCode(errors.ErrSummaryAsset): "INTERNAL ERROR, ErrSummaryAsset", ErrCode(errors.ErrXmitFail): "INTERNAL ERROR, ErrXmitFail", }
View Source
var InitialAPIHandlers = map[string]APIHandler{ "getlatestblockhash": {Handler: getLatestBlockHash, AccessCtrl: BIT_JSONRPC}, "getblock": {Handler: getBlock, AccessCtrl: BIT_JSONRPC | BIT_WEBSOCKET}, "getblockcount": {Handler: getBlockCount, AccessCtrl: BIT_JSONRPC}, "getlatestblockheight": {Handler: getLatestBlockHeight, AccessCtrl: BIT_JSONRPC | BIT_WEBSOCKET}, "getblocktxsbyheight": {Handler: getBlockTxsByHeight, AccessCtrl: BIT_JSONRPC}, "getconnectioncount": {Handler: getConnectionCount, AccessCtrl: BIT_JSONRPC | BIT_WEBSOCKET}, "getrawmempool": {Handler: getRawMemPool, AccessCtrl: BIT_JSONRPC}, "gettransaction": {Handler: getTransaction, AccessCtrl: BIT_JSONRPC | BIT_WEBSOCKET}, "sendrawtransaction": {Handler: sendRawTransaction, AccessCtrl: BIT_JSONRPC | BIT_WEBSOCKET}, "getwsaddr": {Handler: getWsAddr, AccessCtrl: BIT_JSONRPC}, "getversion": {Handler: getVersion, AccessCtrl: BIT_JSONRPC}, "getneighbor": {Handler: getNeighbor, AccessCtrl: BIT_JSONRPC}, "getnodestate": {Handler: getNodeState, AccessCtrl: BIT_JSONRPC}, "getchordringinfo": {Handler: getChordRingInfo, AccessCtrl: BIT_JSONRPC}, "getunspendoutput": {Handler: getUnspendOutput, AccessCtrl: BIT_JSONRPC}, "getbalance": {Handler: getBalance, AccessCtrl: BIT_JSONRPC}, "setdebuginfo": {Handler: setDebugInfo}, "registasset": {Handler: registAsset}, "issueasset": {Handler: issueAsset}, "sendtoaddress": {Handler: sendToAddress}, "prepaidasset": {Handler: prepaidAsset}, "withdrawasset": {Handler: withdrawAsset}, "commitpor": {Handler: commitPor}, "sigchaintest": {Handler: sigchaintest}, "gettotalissued": {Handler: getTotalIssued}, "getassetbyhash": {Handler: getAssetByHash}, "getbalancebyaddr": {Handler: getBalanceByAddr}, "getbalancebyasset": {Handler: getBalanceByAsset}, "getunspends": {Handler: getUnspends}, }
Functions ¶
func GetBlockTransactions ¶
func MakeCommitTransaction ¶
func MakeCommitTransaction(wallet vault.Wallet, sigChain []byte) (*transaction.Transaction, error)
func MakeIssueTransaction ¶
func MakeIssueTransaction(wallet vault.Wallet, assetID Uint256, address string, value string) (*transaction.Transaction, error)
func MakePrepaidTransaction ¶
func MakePrepaidTransaction(wallet vault.Wallet, assetID Uint256, value, rates string) (*transaction.Transaction, error)
func MakeRegTransaction ¶
func MakeRegTransaction(wallet vault.Wallet, name string, value string) (*transaction.Transaction, error)
func MakeTransferTransaction ¶
func MakeTransferTransaction(wallet vault.Wallet, assetID Uint256, batchOut ...BatchOut) (*transaction.Transaction, error)
func MakeWithdrawTransaction ¶
func MakeWithdrawTransaction(wallet vault.Wallet, assetID Uint256, value string) (*transaction.Transaction, error)
func RespPacking ¶
func ResponsePack ¶
func VerifyAndSendTx ¶
func VerifyAndSendTx(n protocol.Noder, txn *transaction.Transaction) errors.ErrCode
Types ¶
type APIHandler ¶
func (*APIHandler) IsAccessableByJsonrpc ¶
func (ah *APIHandler) IsAccessableByJsonrpc() bool
IsAccessableByJsonrpc return true if the handler is able to be invoked by jsonrpc
func (*APIHandler) IsAccessableByWebsocket ¶
func (ah *APIHandler) IsAccessableByWebsocket() bool
IsAccessableByWebsocket return true if the handler is able to be invoked by websocket
type ErrCode ¶
type ErrCode int64
const ( SUCCESS ErrCode = 0 SESSION_EXPIRED ErrCode = 41001 SERVICE_CEILING ErrCode = 41002 ILLEGAL_DATAFORMAT ErrCode = 41003 INVALID_METHOD ErrCode = 42001 INVALID_PARAMS ErrCode = 42002 INVALID_TOKEN ErrCode = 42003 INVALID_TRANSACTION ErrCode = 43001 INVALID_ASSET ErrCode = 43002 INVALID_BLOCK ErrCode = 43003 INVALID_HASH ErrCode = 43004 INVALID_VERSION ErrCode = 43005 UNKNOWN_TRANSACTION ErrCode = 44001 UNKNOWN_ASSET ErrCode = 44002 UNKNOWN_BLOCK ErrCode = 44003 UNKNOWN_HASH ErrCode = 44004 INTERNAL_ERROR ErrCode = 45001 SMARTCODE_ERROR ErrCode = 47001 )
Click to show internal directories.
Click to hide internal directories.