Documentation ¶
Index ¶
- Constants
- Variables
- func AuthHandler(handler http.Handler, accessTokens *accesstoken.CredentialStore, ...) http.Handler
- func RedirectHandler(next http.Handler) http.Handler
- type API
- type AccountFilter
- type AccountInfo
- type AccountPubkey
- type AddressReq
- type AddressResp
- type BlockReq
- type BlockTx
- type BuildRequest
- type CheckPasswordResp
- type CoinbaseArbitrary
- type CreateAccountReq
- type CreateKeyReq
- type CreateKeyResp
- type DecodeProgResp
- type GetBlockHeaderResp
- type GetBlockResp
- type GetMerkleBlockResp
- type GetRawBlockResp
- type ListUtxosReq
- type MerkleBlockReq
- type NetInfo
- type NetSync
- type PubKeyInfo
- type RawTx
- type ResetPasswordResp
- type Response
- type SignMsgResp
- type SortByIndex
- type SubmitBlockReq
- type VerifyMsgResp
- type VersionInfo
- type VoteInfo
- type WalletImage
- type WalletInfo
Constants ¶
const ( // SUCCESS indicates the rpc calling is successful. SUCCESS = "success" // FAIL indicated the rpc calling is failed. FAIL = "fail" )
Variables ¶
var ( ErrCompileContract = errors.New("compile contract failed") ErrInstContract = errors.New("instantiate contract failed") )
pre-define contract error types
var ( ErrBadActionType = errors.New("bad action type") ErrBadAction = errors.New("bad action object") ErrBadActionConstruction = errors.New("bad action construction") )
action error
var ( // ErrDefault is default Bytom API Error ErrDefault = errors.New("Bytom API Error") )
Functions ¶
func AuthHandler ¶
func AuthHandler(handler http.Handler, accessTokens *accesstoken.CredentialStore, authDisable bool) http.Handler
AuthHandler access token auth Handler
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is the scheduling center for server
func NewAPI ¶
func NewAPI(sync NetSync, wallet *wallet.Wallet, blockProposer *blockproposer.BlockProposer, chain *protocol.Chain, config *cfg.Config, token *accesstoken.CredentialStore, dispatcher *event.Dispatcher, notificationMgr *websocket.WSNotificationManager) *API
NewAPI create and initialize the API
type AccountFilter ¶ added in v1.0.2
type AccountInfo ¶
type AccountInfo struct {
Info string `json:"account_info"`
}
AccountInfo is request struct for deleteAccount
type AccountPubkey ¶
type AccountPubkey struct { RootXPub chainkd.XPub `json:"root_xpub"` PubKeyInfos []PubKeyInfo `json:"pubkey_infos"` }
AccountPubkey is detail of account pubkey info
type AddressReq ¶ added in v1.0.2
type AddressResp ¶ added in v1.0.2
type BlockReq ¶
type BlockReq struct { BlockHeight uint64 `json:"block_height"` BlockHash chainjson.HexBytes `json:"block_hash"` }
BlockReq is used to handle getBlock req
type BlockTx ¶
type BlockTx struct { ID bc.Hash `json:"id"` Version uint64 `json:"version"` Size uint64 `json:"size"` TimeRange uint64 `json:"time_range"` Inputs []*query.AnnotatedInput `json:"inputs"` Outputs []*query.AnnotatedOutput `json:"outputs"` StatusFail bool `json:"status_fail"` MuxID bc.Hash `json:"mux_id"` }
BlockTx is the tx struct for getBlock func
type BuildRequest ¶
type BuildRequest struct { Tx *types.TxData `json:"base_transaction"` Actions []map[string]interface{} `json:"actions"` TTL json.Duration `json:"ttl"` TimeRange uint64 `json:"time_range"` }
BuildRequest is main struct when building transactions
type CheckPasswordResp ¶
type CheckPasswordResp struct {
CheckResult bool `json:"check_result"`
}
CheckPasswordResp is response for check key password
type CoinbaseArbitrary ¶
type CreateAccountReq ¶ added in v1.0.2
type CreateKeyReq ¶ added in v1.0.2
type CreateKeyResp ¶ added in v1.0.2
type DecodeProgResp ¶
type DecodeProgResp struct {
Instructions string `json:"instructions"`
}
DecodeProgResp is response for decode program
type GetBlockHeaderResp ¶
type GetBlockHeaderResp struct { BlockHeader *types.BlockHeader `json:"block_header"` Reward uint64 `json:"reward"` }
GetBlockHeaderResp is resp struct for getBlockHeader API
type GetBlockResp ¶
type GetBlockResp struct { Hash *bc.Hash `json:"hash"` Size uint64 `json:"size"` Version uint64 `json:"version"` Height uint64 `json:"height"` PreviousBlockHash *bc.Hash `json:"previous_block_hash"` Timestamp uint64 `json:"timestamp"` Witness []chainjson.HexBytes `json:"witness"` Blocker string `json:"blocker"` TransactionsMerkleRoot *bc.Hash `json:"transaction_merkle_root"` TransactionStatusHash *bc.Hash `json:"transaction_status_hash"` Transactions []*BlockTx `json:"transactions"` }
GetBlockResp is the resp for getBlock api
type GetMerkleBlockResp ¶
type GetMerkleBlockResp struct { BlockHeader types.BlockHeader `json:"block_header"` TxHashes []*bc.Hash `json:"tx_hashes"` StatusHashes []*bc.Hash `json:"status_hashes"` Flags []uint32 `json:"flags"` MatchedTxIDs []*bc.Hash `json:"matched_tx_ids"` }
GetMerkleBlockResp is resp struct for GetTxOutProof API
type GetRawBlockResp ¶
type GetRawBlockResp struct { RawBlock *types.Block `json:"raw_block"` TransactionStatus *bc.TransactionStatus `json:"transaction_status"` }
GetRawBlockResp is resp struct for getRawBlock API
type ListUtxosReq ¶ added in v1.0.2
type MerkleBlockReq ¶
type MerkleBlockReq struct { TxIDs []chainjson.HexBytes `json:"tx_ids"` BlockHash chainjson.HexBytes `json:"block_hash"` }
MerkleBlockReq is used to handle getTxOutProof req
type NetInfo ¶
type NetInfo struct { Listening bool `json:"listening"` Syncing bool `json:"syncing"` Mining bool `json:"mining"` NodeXPub string `json:"node_xpub"` FedAddress string `json:"federation_address"` PeerCount int `json:"peer_count"` CurrentBlock uint64 `json:"current_block"` HighestBlock uint64 `json:"highest_block"` NetWorkID string `json:"network_id"` Version *VersionInfo `json:"version_info"` }
NetInfo indicate net information
type PubKeyInfo ¶
type PubKeyInfo struct { Pubkey string `json:"pubkey"` Path []chainjson.HexBytes `json:"derivation_path"` }
PubKeyInfo is structure of pubkey info
type RawTx ¶
type RawTx struct { ID bc.Hash `json:"tx_id"` Version uint64 `json:"version"` Size uint64 `json:"size"` TimeRange uint64 `json:"time_range"` Inputs []*query.AnnotatedInput `json:"inputs"` Outputs []*query.AnnotatedOutput `json:"outputs"` Fee uint64 `json:"fee"` }
RawTx is the tx struct for getRawTransaction
type ResetPasswordResp ¶
type ResetPasswordResp struct {
Changed bool `json:"changed"`
}
ResetPasswordResp is response for reset key password
type Response ¶
type Response struct { Status string `json:"status,omitempty"` Code string `json:"code,omitempty"` Msg string `json:"msg,omitempty"` ErrorDetail string `json:"error_detail,omitempty"` Data interface{} `json:"data,omitempty"` }
Response describes the response standard.
func FormatErrResp ¶
FormatErrResp format error response
func NewSuccessResponse ¶
func NewSuccessResponse(data interface{}) Response
NewSuccessResponse success response
type SignMsgResp ¶
type SignMsgResp struct { Signature string `json:"signature"` DerivedXPub chainkd.XPub `json:"derived_xpub"` }
SignMsgResp is response for sign message
type SortByIndex ¶
type SortByIndex []AddressResp
SortByIndex implements sort.Interface for addressResp slices
func (SortByIndex) Len ¶
func (a SortByIndex) Len() int
func (SortByIndex) Less ¶
func (a SortByIndex) Less(i, j int) bool
func (SortByIndex) Swap ¶
func (a SortByIndex) Swap(i, j int)
type SubmitBlockReq ¶
SubmitBlockReq is req struct for submit-block API
type VerifyMsgResp ¶
type VerifyMsgResp struct {
VerifyResult bool `json:"result"`
}
VerifyMsgResp is response for verify message
type VersionInfo ¶
type WalletImage ¶
type WalletImage struct { AccountImage *account.Image `json:"account_image"` KeyImages *pseudohsm.KeyImage `json:"key_images"` }
WalletImage hold the ziped wallet data
type WalletInfo ¶
type WalletInfo struct { BestBlockHeight uint64 `json:"best_block_height"` WalletHeight uint64 `json:"wallet_height"` }
WalletInfo return wallet information