Documentation
¶
Index ¶
- Constants
- Variables
- func Base64ToData(encoded string, v interface{}) ([]byte, error)
- func GetMonitorEventFilters(address string, eventsList []string) []*types.EventFilter
- 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.TransactionParamForEstimate) (*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) 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) 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) (txh *types.HexBytes, txr *types.TransactionResult, err error)
- func (c *Client) WaitTransactionResult(p *types.TransactionHashParam) (*types.TransactionResult, error)
- 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 IconProvider
- func (p *IconProvider) AddressFromKeyStore(keystorePath, password string) (string, error)
- func (p *IconProvider) ChainName() string
- func (p *IconProvider) FinalityBlock(ctx context.Context) uint64
- func (ip *IconProvider) GenerateMessage(ctx context.Context, key *providerTypes.MessageKeyWithMessageHeight) (*providerTypes.Message, error)
- func (p *IconProvider) Init(ctx context.Context, homepath string, kms kms.KMS) error
- func (icp *IconProvider) Listener(ctx context.Context, lastSavedHeight uint64, ...) error
- func (icp *IconProvider) LogFailedTx(method string, result *types.TransactionResult, err error)
- func (icp *IconProvider) LogSuccessTx(method string, result *types.TransactionResult)
- func (icp *IconProvider) MakeIconMessage(message *providerTypes.Message) (IconMessage, error)
- func (ip *IconProvider) MessageReceived(ctx context.Context, messageKey providerTypes.MessageKey) (bool, error)
- func (p *IconProvider) NID() string
- func (icp *IconProvider) NewIconMessage(msg interface{}, method string) IconMessage
- func (p *IconProvider) NewKeyStore(dir, password string) (string, error)
- func (p *IconProvider) ProviderConfig() provider.ProviderConfig
- func (ip *IconProvider) QueryBalance(ctx context.Context, addr string) (*providerTypes.Coin, error)
- func (ip *IconProvider) QueryLatestHeight(ctx context.Context) (uint64, error)
- func (icp *IconProvider) QueryTransactionReceipt(ctx context.Context, txHash string) (*providerTypes.Receipt, error)
- func (p *IconProvider) RestoreKeyStore(ctx context.Context, homePath string, client kms.KMS) error
- func (icp *IconProvider) RevertMessage(ctx context.Context, sn *big.Int) error
- func (icp *IconProvider) Route(ctx context.Context, message *providerTypes.Message, ...) error
- func (icp *IconProvider) SendTransaction(ctx context.Context, msg IconMessage) ([]byte, error)
- func (ip *IconProvider) SetAdmin(ctx context.Context, admin string) error
- func (ip *IconProvider) ShouldReceiveMessage(ctx context.Context, messagekey providerTypes.Message) (bool, error)
- func (ip *IconProvider) ShouldSendMessage(ctx context.Context, messageKey providerTypes.Message) (bool, error)
- func (icp *IconProvider) StartFromHeight(ctx context.Context, lastSavedHeight uint64) (int64, error)
- func (p *IconProvider) Type() string
- func (icp *IconProvider) WaitForTxResult(ctx context.Context, txHash []byte, messageKey providerTypes.MessageKey, ...)
- func (p *IconProvider) Wallet() (module.Wallet, error)
- type IconProviderConfig
- type OnlyAddr
- type Wallet
Constants ¶
View Source
const ( DefaultSendTransactionRetryInterval = 3 * time.Second // 3sec DefaultGetTransactionResultPollingInterval = 500 * time.Millisecond // 1.5sec JsonrpcApiVersion = 3 )
View Source
const ( HeaderKeyIconOptions = "Icon-Options" IconOptionsDebug = "debug" IconOptionsTimeout = "timeout" )
Variables ¶
View Source
var ( MethodSendMessage = "sendMessage" MethodRecvMessage = "recvMessage" MethodGetReceipts = "getReceipts" )
View Source
var EmitMessage = "Message(str,int,bytes)"
All the events
View Source
var EventNameToType = map[string]string{ EmitMessage: events.EmitMessage, }
View Source
var MonitorEventsList []string = []string{ EmitMessage, }
Functions ¶
func Base64ToData ¶
func GetMonitorEventFilters ¶
func GetMonitorEventFilters(address string, eventsList []string) []*types.EventFilter
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) 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) SendTransactionAndWait ¶
func (*Client) SignTransaction ¶
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) GetValidatorsByHash(hash common.HexHash) ([]common.Address, error) }
type IconMessage ¶
type IconMessage struct { Params interface{} Method string }
func (*IconMessage) MsgBytes ¶
func (im *IconMessage) MsgBytes() ([]byte, error)
func (*IconMessage) Type ¶
func (im *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 IconProvider ¶
type IconProvider struct { PCfg *IconProviderConfig // contains filtered or unexported fields }
func (*IconProvider) AddressFromKeyStore ¶
func (p *IconProvider) AddressFromKeyStore(keystorePath, password string) (string, error)
func (*IconProvider) ChainName ¶
func (p *IconProvider) ChainName() string
func (*IconProvider) FinalityBlock ¶
func (p *IconProvider) FinalityBlock(ctx context.Context) uint64
func (*IconProvider) GenerateMessage ¶
func (ip *IconProvider) GenerateMessage(ctx context.Context, key *providerTypes.MessageKeyWithMessageHeight) (*providerTypes.Message, error)
func (*IconProvider) Listener ¶
func (icp *IconProvider) Listener(ctx context.Context, lastSavedHeight uint64, incoming chan providerTypes.BlockInfo) error
TODO: check for balance and if the balance is low show info balance is low starting listener
func (*IconProvider) LogFailedTx ¶
func (icp *IconProvider) LogFailedTx(method string, result *types.TransactionResult, err error)
func (*IconProvider) LogSuccessTx ¶
func (icp *IconProvider) LogSuccessTx(method string, result *types.TransactionResult)
func (*IconProvider) MakeIconMessage ¶
func (icp *IconProvider) MakeIconMessage(message *providerTypes.Message) (IconMessage, error)
func (*IconProvider) MessageReceived ¶
func (ip *IconProvider) MessageReceived(ctx context.Context, messageKey providerTypes.MessageKey) (bool, error)
func (*IconProvider) NID ¶
func (p *IconProvider) NID() string
func (*IconProvider) NewIconMessage ¶
func (icp *IconProvider) NewIconMessage(msg interface{}, method string) IconMessage
func (*IconProvider) NewKeyStore ¶
func (p *IconProvider) NewKeyStore(dir, password string) (string, error)
func (*IconProvider) ProviderConfig ¶
func (p *IconProvider) ProviderConfig() provider.ProviderConfig
func (*IconProvider) QueryBalance ¶
func (ip *IconProvider) QueryBalance(ctx context.Context, addr string) (*providerTypes.Coin, error)
func (*IconProvider) QueryLatestHeight ¶
func (ip *IconProvider) QueryLatestHeight(ctx context.Context) (uint64, error)
func (*IconProvider) QueryTransactionReceipt ¶
func (icp *IconProvider) QueryTransactionReceipt(ctx context.Context, txHash string) (*providerTypes.Receipt, error)
QueryTransactionReceipt -> TxHash should be in hex string
func (*IconProvider) RestoreKeyStore ¶
func (*IconProvider) RevertMessage ¶
func (*IconProvider) Route ¶
func (icp *IconProvider) Route(ctx context.Context, message *providerTypes.Message, callback providerTypes.TxResponseFunc) error
func (*IconProvider) SendTransaction ¶
func (icp *IconProvider) SendTransaction( ctx context.Context, msg IconMessage, ) ([]byte, error)
func (*IconProvider) SetAdmin ¶
func (ip *IconProvider) SetAdmin(ctx context.Context, admin string) error
SetAdmin sets the admin address of the bridge contract
func (*IconProvider) ShouldReceiveMessage ¶
func (ip *IconProvider) ShouldReceiveMessage(ctx context.Context, messagekey providerTypes.Message) (bool, error)
func (*IconProvider) ShouldSendMessage ¶
func (ip *IconProvider) ShouldSendMessage(ctx context.Context, messageKey providerTypes.Message) (bool, error)
func (*IconProvider) StartFromHeight ¶
func (*IconProvider) Type ¶
func (p *IconProvider) Type() string
func (*IconProvider) WaitForTxResult ¶
func (icp *IconProvider) 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
type IconProviderConfig ¶
type IconProviderConfig struct { ChainName string `json:"-" yaml:"-"` RPCUrl string `json:"rpc-url" yaml:"rpc-url"` KeyStore string `json:"keystore" yaml:"keystore"` Password string `json:"password" yaml:"password"` StartHeight uint64 `json:"start-height" yaml:"start-height"` // would be of highest priority ContractAddress string `json:"contract-address" yaml:"contract-address"` NetworkID uint `json:"network-id" yaml:"network-id"` NID string `json:"nid" yaml:"nid"` }
func (*IconProviderConfig) GetWallet ¶
func (p *IconProviderConfig) GetWallet() string
func (*IconProviderConfig) NewProvider ¶
func (c *IconProviderConfig) NewProvider(log *zap.Logger, homepath string, debug bool, chainName string) (provider.ChainProvider, error)
NewProvider returns new Icon provider
func (*IconProviderConfig) SetWallet ¶
func (p *IconProviderConfig) SetWallet(addr string)
func (*IconProviderConfig) Validate ¶
func (pp *IconProviderConfig) Validate() error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.