Documentation ¶
Index ¶
- Constants
- Variables
- func Base64ToData(encoded string, v interface{}) ([]byte, error)
- func MptProve(key types.HexInt, proofs [][]byte, hash []byte) ([]byte, error)
- type CallParamOption
- 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) EstimateStep(param types.TransactionParam) (*types.HexInt, error)
- 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) GetDataByHash(p *types.DataHashParam) ([]byte, error)
- func (c *Client) GetLastBlock() (*types.Block, error)
- func (c *Client) GetNetworkInfo() (*types.NetworkInfo, 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) 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) SendTransactionAndWait(p *types.TransactionParam) (*types.HexBytes, error)
- func (c *Client) SignTransaction(w module.Wallet, p *types.TransactionParam) error
- func (c *Client) WaitForResults(ctx context.Context, thp *types.TransactionHashParam) (*types.TransactionResult, error)
- func (c *Client) WaitTransactionResult(p *types.TransactionHashParam) (*types.TransactionResult, error)
- type Config
- type IClient
- type IconMessage
- 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 Provider
- func (p *Provider) ClaimFee(ctx context.Context) error
- func (p *Provider) Config() provider.Config
- func (p *Provider) ExecuteRollback(ctx context.Context, sn uint64) error
- func (p *Provider) FinalityBlock(ctx context.Context) uint64
- func (p *Provider) GenerateMessages(ctx context.Context, key *providerTypes.MessageKeyWithMessageHeight) ([]*providerTypes.Message, error)
- func (p *Provider) GetAddressByEventType(eventType string) types.Address
- func (p *Provider) GetEventName(sig string) string
- func (p *Provider) GetFee(ctx context.Context, networkID string, responseFee bool) (uint64, error)
- func (p *Provider) GetLastSavedBlockHeight() uint64
- func (p *Provider) GetMonitorEventFilters() []*types.EventFilter
- func (p *Provider) ImportKeystore(ctx context.Context, keyPath, passphrase string) (string, error)
- func (p *Provider) Init(ctx context.Context, homepath string, kms kms.KMS) error
- func (p *Provider) Listener(ctx context.Context, lastSavedHeight uint64, ...) error
- func (p *Provider) LogFailedTx(method string, result *types.TransactionResult, err error)
- func (p *Provider) LogSuccessTx(method string, result *types.TransactionResult)
- func (p *Provider) MakeIconMessage(message *providerTypes.Message) (*IconMessage, error)
- func (p *Provider) MessageReceived(ctx context.Context, messageKey *providerTypes.MessageKey) (bool, error)
- func (p *Provider) NID() string
- func (p *Provider) Name() string
- func (p *Provider) NetworkID() types.HexInt
- func (p *Provider) NewIconMessage(address types.Address, msg interface{}, method string) *IconMessage
- func (p *Provider) NewKeystore(password string) (string, error)
- func (ip *Provider) QueryBalance(ctx context.Context, addr string) (*providerTypes.Coin, error)
- func (ip *Provider) QueryLatestHeight(ctx context.Context) (uint64, error)
- func (p *Provider) QueryTransactionReceipt(ctx context.Context, txHash string) (*providerTypes.Receipt, error)
- func (p *Provider) RestoreKeystore(ctx context.Context) error
- func (p *Provider) RevertMessage(ctx context.Context, sn *big.Int) error
- func (p *Provider) Route(ctx context.Context, message *providerTypes.Message, ...) error
- func (p *Provider) SendTransaction(ctx context.Context, msg *IconMessage) ([]byte, error)
- func (p *Provider) SetAdmin(ctx context.Context, admin string) error
- func (p *Provider) SetFee(ctx context.Context, networkID string, msgFee, resFee *big.Int) error
- func (p *Provider) SetLastSavedHeightFunc(f func() uint64)
- func (ip *Provider) ShouldReceiveMessage(ctx context.Context, messagekey *providerTypes.Message) (bool, error)
- func (ip *Provider) ShouldSendMessage(ctx context.Context, messageKey *providerTypes.Message) (bool, error)
- func (p *Provider) StartFromHeight(ctx context.Context, lastSavedHeight uint64) (int64, error)
- func (p *Provider) Type() string
- func (p *Provider) WaitForTxResult(ctx context.Context, txHash []byte, messageKey *providerTypes.MessageKey, ...)
- func (p *Provider) Wallet() (module.Wallet, error)
- type Wallet
Constants ¶
View Source
const ( DefaultRetryPollingRetires = 10 DefaultGetTransactionResultPollingInterval = 3 * time.Second JsonrpcApiVersion = 3 )
View Source
const ( HeaderKeyIconOptions = "Icon-Options" IconOptionsDebug = "debug" IconOptionsTimeout = "timeout" )
View Source
const ( EmitMessage = "Message(str,int,bytes)" CallMessage = "CallMessage(str,str,int,int,bytes)" )
All the events
Variables ¶
View Source
var ( // Connection Methods MethodSendMessage = "sendMessage" MethodRecvMessage = "recvMessage" MethodGetReceipts = "getReceipts" MethodSetAdmin = "setAdmin" MethodRevertMessage = "revertMessage" MethodGetFee = "getFee" MethodSetFee = "setFee" MethodClaimFees = "claimFees" // XCALL Methods MethodExecuteCall = "executeCall" MethodExecuteRollback = "executeRollback" )
Functions ¶
func Base64ToData ¶
Types ¶
type CallParamOption ¶
type Client ¶
type Client struct { *client.JsonRpcClient DebugEndPoint string // contains filtered or unexported fields }
func (*Client) CloseAllMonitor ¶
func (c *Client) CloseAllMonitor()
func (*Client) CloseMonitor ¶
func (*Client) EstimateStep ¶
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) GetDataByHash ¶
func (c *Client) GetDataByHash(p *types.DataHashParam) ([]byte, error)
func (*Client) GetNetworkInfo ¶ added in v1.2.9
func (c *Client) GetNetworkInfo() (*types.NetworkInfo, 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) MonitorBlock ¶
func (*Client) MonitorEvent ¶
func (*Client) SendTransaction ¶
func (*Client) SendTransactionAndWait ¶
func (*Client) SignTransaction ¶
func (*Client) WaitForResults ¶
func (c *Client) WaitForResults(ctx context.Context, thp *types.TransactionHashParam) (*types.TransactionResult, error)
func (*Client) WaitTransactionResult ¶
func (c *Client) WaitTransactionResult(p *types.TransactionHashParam) (*types.TransactionResult, error)
type Config ¶ added in v1.1.0
type Config struct { provider.CommonConfig `json:",inline" yaml:",inline"` StepMin int64 `json:"step-min" yaml:"step-min"` StepLimit int64 `json:"step-limit" yaml:"step-limit"` StepAdjustment int64 `json:"step-adjustment" yaml:"step-adjustment"` }
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) EstimateStep(param *types.TransactionParam) (*types.HexInt, error) GetNetworkInfo() (*types.NetworkInfo, 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) GetValidatorsByHash(hash common.HexHash) ([]common.Address, error) }
type IconMessage ¶
func (*IconMessage) MsgBytes ¶
func (m *IconMessage) MsgBytes() ([]byte, error)
func (*IconMessage) Type ¶
func (m *IconMessage) Type() string
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 Provider ¶ added in v1.1.0
type Provider struct { LastSavedHeightFunc func() uint64 // contains filtered or unexported fields }
func (*Provider) ExecuteRollback ¶ added in v1.1.0
ExecuteRollback
func (*Provider) FinalityBlock ¶ added in v1.1.0
func (*Provider) GenerateMessages ¶ added in v1.1.0
func (p *Provider) GenerateMessages(ctx context.Context, key *providerTypes.MessageKeyWithMessageHeight) ([]*providerTypes.Message, error)
func (*Provider) GetAddressByEventType ¶ added in v1.1.0
GetAddressNyEventType returns the address of the contract by event type
func (*Provider) GetEventName ¶ added in v1.1.0
func (*Provider) GetLastSavedBlockHeight ¶ added in v1.2.6
GetLastSavedBlockHeight returns the last saved block height
func (*Provider) GetMonitorEventFilters ¶ added in v1.1.0
func (p *Provider) GetMonitorEventFilters() []*types.EventFilter
func (*Provider) ImportKeystore ¶ added in v1.1.0
func (*Provider) LogFailedTx ¶ added in v1.1.0
func (p *Provider) LogFailedTx(method string, result *types.TransactionResult, err error)
func (*Provider) LogSuccessTx ¶ added in v1.1.0
func (p *Provider) LogSuccessTx(method string, result *types.TransactionResult)
func (*Provider) MakeIconMessage ¶ added in v1.1.0
func (p *Provider) MakeIconMessage(message *providerTypes.Message) (*IconMessage, error)
func (*Provider) MessageReceived ¶ added in v1.1.0
func (p *Provider) MessageReceived(ctx context.Context, messageKey *providerTypes.MessageKey) (bool, error)
MessageReceived checks if the message is received
func (*Provider) NewIconMessage ¶ added in v1.1.0
func (p *Provider) NewIconMessage(address types.Address, msg interface{}, method string) *IconMessage
func (*Provider) NewKeystore ¶ added in v1.1.0
func (*Provider) QueryBalance ¶ added in v1.1.0
func (*Provider) QueryLatestHeight ¶ added in v1.1.0
func (*Provider) QueryTransactionReceipt ¶ added in v1.1.0
func (p *Provider) QueryTransactionReceipt(ctx context.Context, txHash string) (*providerTypes.Receipt, error)
QueryTransactionReceipt -> TxHash should be in hex string
func (*Provider) RestoreKeystore ¶ added in v1.1.0
func (*Provider) RevertMessage ¶ added in v1.1.0
ReverseMessage reverts a message
func (*Provider) Route ¶ added in v1.1.0
func (p *Provider) Route(ctx context.Context, message *providerTypes.Message, callback providerTypes.TxResponseFunc) error
func (*Provider) SendTransaction ¶ added in v1.1.0
func (*Provider) SetLastSavedHeightFunc ¶ added in v1.2.6
SetLastSavedBlockHeightFunc sets the function to save the last saved block height
func (*Provider) ShouldReceiveMessage ¶ added in v1.1.0
func (*Provider) ShouldSendMessage ¶ added in v1.1.0
func (*Provider) StartFromHeight ¶ added in v1.1.0
func (*Provider) WaitForTxResult ¶ added in v1.1.0
func (p *Provider) WaitForTxResult( ctx context.Context, txHash []byte, messageKey *providerTypes.MessageKey, method string, callback providerTypes.TxResponseFunc, )
TODO: review try to remove wait for Tx from packet-transfer and only use this for client and connection creation
Source Files ¶
Click to show internal directories.
Click to hide internal directories.