Documentation ¶
Index ¶
- Constants
- Variables
- func NewReceiver(src, dst chain.BTPAddress, urls []string, rawOpts json.RawMessage, ...) (chain.Receiver, error)
- func NewRevertError(code int) error
- func NewSender(src, dst chain.BTPAddress, urls []string, w wallet.Wallet, ...) (chain.Sender, error)
- func SerializeJSON(s []byte, in map[string]bool, exclude map[string]bool) ([]byte, error)
- func SerializeMap(d map[string]interface{}, i map[string]bool, e map[string]bool) ([]byte, error)
- type BlockHeaderResult
- type Client
- func (c *Client) Call(p *types.CallParam, r interface{}) error
- func (c *Client) CloseAllMonitor()
- func (c *Client) CloseMonitor(conn *websocket.Conn)
- func (c *Client) GetBalance(param *types.AddressParam) (*big.Int, error)
- func (c *Client) GetBlockByHeight(p *types.BlockHeightParam) (*types.Block, error)
- func (c *Client) GetBlockHeaderByHeight(height int64) (*types.BlockHeader, error)
- func (c *Client) GetBlockHeaderBytesByHeight(p *types.BlockHeightParam) ([]byte, error)
- func (c *Client) GetCommitVoteListByHeight(height int64) (*types.CommitVoteList, error)
- func (c *Client) GetDataByHash(p *types.DataHashParam) ([]byte, error)
- func (c *Client) GetLastBlock() (*types.Block, error)
- func (c *Client) GetProofForEvents(p *types.ProofEventsParam) ([][][]byte, error)
- func (c *Client) GetProofForResult(p *types.ProofResultParam) ([][]byte, error)
- func (c *Client) GetTransactionResult(p *types.TransactionHashParam) (*types.TransactionResult, error)
- func (c *Client) GetValidatorsByHash(hash common.HexHash) ([]common.Address, error)
- func (c *Client) GetVotesByHeight(p *types.BlockHeightParam) ([]byte, error)
- func (c *Client) Monitor(ctx context.Context, reqUrl string, reqPtr, respPtr interface{}, ...) error
- func (c *Client) MonitorBlock(ctx context.Context, p *types.BlockRequest, ...) error
- func (c *Client) MonitorEvent(ctx context.Context, p *types.EventRequest, ...) error
- func (c *Client) SendTransaction(p *types.TransactionParam) (*types.HexBytes, error)
- func (c *Client) SendTransactionAndGetResult(p *types.TransactionParam) (*types.HexBytes, *types.TransactionResult, error)
- func (c *Client) SendTransactionAndWait(p *types.TransactionParam) (*types.HexBytes, error)
- func (c *Client) SignTransaction(w Wallet, p *types.TransactionParam) error
- func (c *Client) WaitForResults(ctx context.Context, thp *types.TransactionHashParam) (txh *types.HexBytes, txr *types.TransactionResult, err error)
- func (c *Client) WaitTransactionResult(p *types.TransactionHashParam) (*types.TransactionResult, error)
- type IClient
- type IVerifier
- type IconOptions
- func (opts IconOptions) Del(key string)
- func (opts IconOptions) Get(key string) string
- func (opts IconOptions) GetBool(key string) (bool, error)
- func (opts IconOptions) GetInt(key string) (int64, error)
- func (opts IconOptions) Set(key, value string)
- func (opts IconOptions) SetBool(key string, value bool)
- func (opts IconOptions) SetInt(key string, v int64)
- func (opts IconOptions) ToHeaderValue() string
- type Receiver
- type ReceiverCore
- type ReceiverOptions
- type SerializeError
- type TxResult
- type Verifier
- func (vr *Verifier) Next() int64
- func (vr *Verifier) Update(blockHeader *types.BlockHeader, nextValidators []common.Address) (err error)
- func (vr *Verifier) Validators(nextValidatorsHash common.HexBytes) []common.Address
- func (vr *Verifier) Verify(blockHeader *types.BlockHeader, votes []byte) (ok bool, err error)
- type Wallet
Constants ¶
View Source
const ( DefaultSendTransactionRetryInterval = 3 * time.Second //3sec DefaultGetTransactionResultPollingInterval = 1500 * time.Millisecond //1.5sec )
View Source
const ( HeaderKeyIconOptions = "Icon-Options" IconOptionsDebug = "debug" IconOptionsTimeout = "timeout" )
View Source
const ( CodeBTP errors.Code = 0 CodeBMC errors.Code = 10 CodeBMV errors.Code = 25 CodeBSH errors.Code = 40 CodeReserved errors.Code = 55 )
View Source
const ( BMCRevert = CodeBMC + iota BMCRevertInvalidSN BMCRevertAlreadyExistsBMV BMCRevertNotExistsBMV BMCRevertAlreadyExistsBSH BMCRevertNotExistsBSH BMCRevertAlreadyExistsLink BMCRevertNotExistsLink BMCRevertUnreachable BMCRevertNotExistsPermission )
View Source
const ( BMVRevert = CodeBMV + iota BMVRevertInvalidMPT BMVRevertInvalidVotes BMVRevertInvalidSequence BMVRevertInvalidBlockUpdate BMVRevertInvalidBlockProof BMVRevertInvalidBlockWitness BMVRevertInvalidSequenceHigher BMVRevertInvalidBlockUpdateHigher BMVRevertInvalidBlockUpdateLower BMVRevertInvalidBlockProofHigher BMVRevertInvalidBlockWitnessOld )
View Source
const ( EventSignature = "Message(str,int,bytes)" EventIndexSignature = 0 EventIndexNext = 1 EventIndexSequence = 2 RPCCallRetry = 5 )
View Source
const ( VoteTypePrevote types.VoteType = iota VoteTypePrecommit )
View Source
const (
MonitorBlockMaxConcurrency = 300
)
View Source
const RECONNECT_ON_UNEXPECTED_HEIGHT = "Unexpected Block Height. Should Reconnect"
Variables ¶
View Source
var ( ErrConnectFail = fmt.Errorf("fail to connect") ErrSendFailByExpired = fmt.Errorf("reject by expired") ErrSendFailByFuture = fmt.Errorf("reject by future") ErrSendFailByOverflow = fmt.Errorf("reject by overflow") ErrGetResultFailByPending = fmt.Errorf("fail to getresult by pending") )
View Source
var ( BMCRevertCodeNames = map[errors.Code]string{ BMCRevert: "BMCRevert", BMCRevertUnauthorized: "BMCRevertUnauthorized", BMCRevertInvalidSN: "BMCRevertInvalidSN", BMCRevertAlreadyExistsBMV: "BMCRevertAlreadyExistsBMV", BMCRevertNotExistsBMV: "BMCRevertNotExistsBMV", BMCRevertAlreadyExistsBSH: "BMCRevertAlreadyExistsBSH", BMCRevertNotExistsBSH: "BMCRevertNotExistsBSH", BMCRevertAlreadyExistsLink: "BMCRevertAlreadyExistsLink", BMCRevertNotExistsLink: "BMCRevertNotExistsLink", BMCRevertUnreachable: "BMCRevertUnreachable", BMCRevertNotExistsPermission: "BMCRevertNotExistsPermission", } )
View Source
var ( BMVRevertCodeNames = map[errors.Code]string{ BMVRevert: "BMVRevert", BMVRevertInvalidMPT: "BMVRevertInvalidMPT", BMVRevertInvalidVotes: "BMVRevertInvalidVotes", BMVRevertInvalidSequence: "BMVRevertInvalidSequence", BMVRevertInvalidBlockUpdate: "BMVRevertInvalidBlockUpdate", BMVRevertInvalidBlockProof: "BMVRevertInvalidBlockProof", BMVRevertInvalidBlockWitness: "BMVRevertInvalidBlockWitness", BMVRevertInvalidSequenceHigher: "BMVRevertInvalidSequenceHigher", BMVRevertInvalidBlockUpdateHigher: "BMVRevertInvalidBlockUpdateHigher", BMVRevertInvalidBlockUpdateLower: "BMVRevertInvalidBlockUpdateLower", BMVRevertInvalidBlockProofHigher: "BMVRevertInvalidBlockProofHigher", BMVRevertInvalidBlockWitnessOld: "BMVRevertInvalidBlockWitnessOld", } )
Functions ¶
func NewReceiver ¶
func NewReceiver(src, dst chain.BTPAddress, urls []string, rawOpts json.RawMessage, l log.Logger) (chain.Receiver, error)
func NewRevertError ¶
func NewSender ¶
func NewSender( src, dst chain.BTPAddress, urls []string, w wallet.Wallet, rawOpts json.RawMessage, l log.Logger) (chain.Sender, error)
NewSender ... returns a new sender client for icon
func SerializeJSON ¶
Types ¶
type BlockHeaderResult ¶
type Client ¶
func (*Client) CloseAllMonitor ¶
func (c *Client) CloseAllMonitor()
func (*Client) CloseMonitor ¶
func (*Client) GetBalance ¶
func (*Client) GetBlockByHeight ¶
func (*Client) GetBlockHeaderByHeight ¶
func (c *Client) GetBlockHeaderByHeight(height int64) (*types.BlockHeader, error)
func (*Client) GetBlockHeaderBytesByHeight ¶
func (c *Client) GetBlockHeaderBytesByHeight(p *types.BlockHeightParam) ([]byte, error)
func (*Client) GetCommitVoteListByHeight ¶
func (c *Client) GetCommitVoteListByHeight(height int64) (*types.CommitVoteList, error)
func (*Client) GetDataByHash ¶
func (c *Client) GetDataByHash(p *types.DataHashParam) ([]byte, error)
func (*Client) GetProofForEvents ¶
func (c *Client) GetProofForEvents(p *types.ProofEventsParam) ([][][]byte, error)
func (*Client) GetProofForResult ¶
func (c *Client) GetProofForResult(p *types.ProofResultParam) ([][]byte, error)
func (*Client) GetTransactionResult ¶
func (c *Client) GetTransactionResult(p *types.TransactionHashParam) (*types.TransactionResult, error)
func (*Client) GetValidatorsByHash ¶
func (*Client) GetVotesByHeight ¶
func (c *Client) GetVotesByHeight(p *types.BlockHeightParam) ([]byte, error)
func (*Client) MonitorBlock ¶
func (*Client) MonitorEvent ¶
func (*Client) SendTransaction ¶
func (*Client) SendTransactionAndGetResult ¶
func (c *Client) SendTransactionAndGetResult(p *types.TransactionParam) (*types.HexBytes, *types.TransactionResult, error)
func (*Client) SendTransactionAndWait ¶
func (*Client) SignTransaction ¶
func (c *Client) SignTransaction(w Wallet, p *types.TransactionParam) error
func (*Client) WaitForResults ¶
func (c *Client) WaitForResults(ctx context.Context, thp *types.TransactionHashParam) (txh *types.HexBytes, txr *types.TransactionResult, err error)
func (*Client) WaitTransactionResult ¶
func (c *Client) WaitTransactionResult(p *types.TransactionHashParam) (*types.TransactionResult, error)
type IClient ¶
type IClient interface { Call(p *types.CallParam, r interface{}) error GetBalance(param *types.AddressParam) (*big.Int, error) GetBlockByHeight(p *types.BlockHeightParam) (*types.Block, error) GetBlockHeaderBytesByHeight(p *types.BlockHeightParam) ([]byte, error) GetVotesByHeight(p *types.BlockHeightParam) ([]byte, error) GetDataByHash(p *types.DataHashParam) ([]byte, error) GetProofForResult(p *types.ProofResultParam) ([][]byte, error) GetProofForEvents(p *types.ProofEventsParam) ([][][]byte, error) MonitorBlock(ctx context.Context, p *types.BlockRequest, cb func(conn *websocket.Conn, v *types.BlockNotification) error, scb func(conn *websocket.Conn), errCb func(*websocket.Conn, error)) error MonitorEvent(ctx context.Context, p *types.EventRequest, cb func(conn *websocket.Conn, v *types.EventNotification) error, errCb func(*websocket.Conn, error)) error Monitor(ctx context.Context, reqUrl string, reqPtr, respPtr interface{}, cb types.WsReadCallback) error CloseAllMonitor() CloseMonitor(conn *websocket.Conn) GetLastBlock() (*types.Block, error) GetBlockHeaderByHeight(height int64) (*types.BlockHeader, error) GetCommitVoteListByHeight(height int64) (*types.CommitVoteList, error) GetValidatorsByHash(hash common.HexHash) ([]common.Address, error) }
type IconOptions ¶
func NewIconOptionsByHeader ¶
func NewIconOptionsByHeader(h http.Header) IconOptions
func (IconOptions) Del ¶
func (opts IconOptions) Del(key string)
func (IconOptions) Get ¶
func (opts IconOptions) Get(key string) string
func (IconOptions) Set ¶
func (opts IconOptions) Set(key, value string)
func (IconOptions) SetBool ¶
func (opts IconOptions) SetBool(key string, value bool)
func (IconOptions) SetInt ¶
func (opts IconOptions) SetInt(key string, v int64)
func (IconOptions) ToHeaderValue ¶
func (opts IconOptions) ToHeaderValue() string
type ReceiverCore ¶
type ReceiverCore struct { Log log.Logger Cl *Client Opts ReceiverOptions BlockReq types.BlockRequest }
func (*ReceiverCore) ReceiveLoop ¶
type ReceiverOptions ¶
type ReceiverOptions struct { SyncConcurrency uint64 `json:"syncConcurrency"` Verifier *types.VerifierOptions `json:"verifier"` }
type SerializeError ¶
type SerializeError struct {
// contains filtered or unexported fields
}
func (*SerializeError) Error ¶
func (s *SerializeError) Error() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.