wasm

package
v1.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeWasmMessage     = "wasm-Message"
	EventTypeWasmCallMessage = "wasm-CallMessage"

	// Attr keys for connection contract events
	EventAttrKeyMsg                  = "msg"
	EventAttrKeyTargetNetwork string = "targetNetwork"
	EventAttrKeyConnSn        string = "connSn"

	// Attr keys for xcall contract events
	EventAttrKeyReqID string = "reqId"
	EventAttrKeyData  string = "data"
	EventAttrKeyTo    string = "to"
	EventAttrKeyFrom  string = "from"
	EventAttrKeySn    string = "sn"

	EventAttrKeyContractAddress string = "_contract_address"
)

Variables

This section is empty.

Functions

func SetSDKConfigContext added in v1.2.4

func SetSDKConfigContext(prefix string) func()

Types

type Attribute

type Attribute struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func (*Client) BroadcastTx

func (c *Client) BroadcastTx(txBytes []byte) (*sdkTypes.TxResponse, error)

func (*Client) BuildTxFactory

func (c *Client) BuildTxFactory() (tx.Factory, error)

func (*Client) CreateAccount

func (c *Client) CreateAccount(uid, passphrase string) (string, string, error)

Create new AccountI

func (*Client) EstimateGas

func (c *Client) EstimateGas(txf tx.Factory, msgs ...sdkTypes.Msg) (*txTypes.SimulateResponse, uint64, error)

func (*Client) GetAccountInfo

func (c *Client) GetAccountInfo(ctx context.Context, addr string) (sdkTypes.AccountI, error)

func (*Client) GetArmor

func (c *Client) GetArmor(uid, passphrase string) (string, error)

GetPrivateKey returns private key from keyring

func (*Client) GetBalance

func (c *Client) GetBalance(ctx context.Context, addr string, denomination string) (*sdkTypes.Coin, error)

func (*Client) GetFee

func (c *Client) GetFee(ctx context.Context, addr string, queryData []byte) (uint64, error)

GetFee returns the fee set for the network

func (*Client) GetKey

func (c *Client) GetKey(uid string) (*keyring.Record, error)

GetKey returns key from keyring

func (*Client) GetKeyByAddr

func (c *Client) GetKeyByAddr(addr sdkTypes.Address) (*keyring.Record, error)

GetAccount returns account from keyring

func (*Client) GetLatestBlockHeight

func (c *Client) GetLatestBlockHeight(ctx context.Context) (uint64, error)

func (*Client) GetTransactionReceipt

func (c *Client) GetTransactionReceipt(ctx context.Context, txHash string) (*txTypes.GetTxResponse, error)

func (*Client) HTTP

func (c *Client) HTTP(rpcUrl string) (*http.HTTP, error)

func (*Client) ImportArmor

func (c *Client) ImportArmor(uid string, armor []byte, passphrase string) error

Load private key from keyring

func (*Client) IsConnected added in v1.2.0

func (c *Client) IsConnected() bool

IsConnected returns if the client is connected to the network

func (*Client) PrepareTx

func (c *Client) PrepareTx(ctx context.Context, txf tx.Factory, msgs ...sdkTypes.Msg) ([]byte, error)

func (*Client) QuerySmartContract

func (c *Client) QuerySmartContract(ctx context.Context, address string, queryData []byte) (*wasmTypes.QuerySmartContractStateResponse, error)

func (*Client) Reconnect added in v1.2.0

func (c *Client) Reconnect() error

RestartClient restarts the client

func (*Client) SetAddress

func (c *Client) SetAddress(addr sdkTypes.AccAddress) sdkTypes.AccAddress

Set the address to be used for the transactions

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, _, query string) (<-chan coretypes.ResultEvent, error)

Subscribe

func (*Client) TxSearch

func (c *Client) TxSearch(ctx context.Context, param types.TxSearchParam) (*coretypes.ResultTxSearch, error)

func (*Client) Unsubscribe

func (c *Client) Unsubscribe(ctx context.Context, _, query string) error

Unsubscribe

type Codec added in v1.2.4

type Codec struct {
	InterfaceRegistry types.InterfaceRegistry
	TxConfig          client.TxConfig
	Codec             codec.Codec
	// contains filtered or unexported fields
}

type Config added in v1.2.4

type Config struct {
	RpcUrl                 string                          `json:"rpc-url" yaml:"rpc-url"`
	GrpcUrl                string                          `json:"grpc-url" yaml:"grpc-url"`
	ChainID                string                          `json:"chain-id" yaml:"chain-id"`
	NID                    string                          `json:"nid" yaml:"nid"`
	HomeDir                string                          `json:"home-dir" yaml:"home-dir"`
	KeyringBackend         string                          `json:"keyring-backend" yaml:"keyring-backend"`
	KeyringDir             string                          `json:"keyring-dir" yaml:"keyring-dir"`
	AccountPrefix          string                          `json:"account-prefix" yaml:"account-prefix"`
	Contracts              providerTypes.ContractConfigMap `json:"contracts" yaml:"contracts"`
	Address                string                          `json:"address" yaml:"address"`
	Denomination           string                          `json:"denomination" yaml:"denomination"`
	GasPrices              string                          `json:"gas-prices" yaml:"gas-prices"`
	GasAdjustment          float64                         `json:"gas-adjustment" yaml:"gas-adjustment"`
	MinGasAmount           uint64                          `json:"min-gas-amount" yaml:"min-gas-amount"`
	MaxGasAmount           uint64                          `json:"max-gas-amount" yaml:"max-gas-amount"`
	TxConfirmationInterval time.Duration                   `json:"tx-confirmation-interval" yaml:"tx-confirmation-interval"`
	BroadcastMode          string                          `json:"broadcast-mode" yaml:"broadcast-mode"` // sync, async and block. Recommended: sync
	SignModeStr            string                          `json:"sign-mode" yaml:"sign-mode"`
	Simulate               bool                            `json:"simulate" yaml:"simulate"`
	StartHeight            uint64                          `json:"start-height" yaml:"start-height"`
	FinalityBlock          uint64                          `json:"finality-block" yaml:"finality-block"`
	Disabled               bool                            `json:"disabled" yaml:"disabled"`
	ExtraCodec             string                          `json:"extra-codecs" yaml:"extra-codecs"`
	ChainName              string                          `json:"-" yaml:"-"`
}

func (*Config) Enabled added in v1.2.4

func (c *Config) Enabled() bool

func (*Config) GetMonitorEventFilters added in v1.2.4

func (p *Config) GetMonitorEventFilters(eventMap map[string]relayerTypes.EventMap) []sdkTypes.Event

func (*Config) GetWallet added in v1.2.4

func (pc *Config) GetWallet() string

func (*Config) MakeCodec added in v1.2.4

func (c *Config) MakeCodec(moduleBasics []module.AppModuleBasic, extraCodecs ...string) *Codec

func (*Config) NewProvider added in v1.2.4

func (pc *Config) NewProvider(ctx context.Context, log *zap.Logger, homePath string, _ bool, chainName string) (provider.ChainProvider, error)

func (*Config) SetWallet added in v1.2.4

func (pc *Config) SetWallet(addr string)

func (*Config) Validate added in v1.2.4

func (pc *Config) Validate() error

type Event

type Event struct {
	Type       string      `json:"type"`
	Attributes []Attribute `json:"attributes"`
}

type EventsList

type EventsList struct {
	Events []Event `json:"events"`
}

type IClient

type IClient interface {
	HTTP(rpcUrl string) (*http.HTTP, error)
	IsConnected() bool
	Reconnect() error
	GetLatestBlockHeight(ctx context.Context) (uint64, error)
	GetTransactionReceipt(ctx context.Context, txHash string) (*txTypes.GetTxResponse, error)
	GetBalance(ctx context.Context, addr string, denomination string) (*sdkTypes.Coin, error)
	BuildTxFactory() (tx.Factory, error)
	EstimateGas(txf tx.Factory, msgs ...sdkTypes.Msg) (*txTypes.SimulateResponse, uint64, error)
	PrepareTx(ctx context.Context, txf tx.Factory, msgs ...sdkTypes.Msg) ([]byte, error)
	BroadcastTx(txBytes []byte) (*sdkTypes.TxResponse, error)
	TxSearch(ctx context.Context, param types.TxSearchParam) (*coretypes.ResultTxSearch, error)
	GetAccountInfo(ctx context.Context, addr string) (sdkTypes.AccountI, error)
	QuerySmartContract(ctx context.Context, address string, queryData []byte) (*wasmTypes.QuerySmartContractStateResponse, error)
	CreateAccount(name, pass string) (string, string, error)
	ImportArmor(uid string, armor []byte, passphrase string) error
	GetArmor(uid, passphrase string) (string, error)
	GetKey(uid string) (*keyring.Record, error)
	GetKeyByAddr(addr sdkTypes.Address) (*keyring.Record, error)
	SetAddress(account sdkTypes.AccAddress) sdkTypes.AccAddress
	Subscribe(ctx context.Context, _, query string) (<-chan coretypes.ResultEvent, error)
	Unsubscribe(ctx context.Context, _, query string) error
	GetFee(ctx context.Context, addr string, queryData []byte) (uint64, error)
}

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func (*Provider) ClaimFee

func (p *Provider) ClaimFee(ctx context.Context) error

ClaimFee

func (*Provider) Config

func (p *Provider) Config() provider.Config

func (*Provider) ExecuteRollback

func (p *Provider) ExecuteRollback(ctx context.Context, sn *big.Int) error

ExecuteRollback

func (*Provider) FinalityBlock

func (p *Provider) FinalityBlock(ctx context.Context) uint64

func (*Provider) GenerateMessages

func (p *Provider) GenerateMessages(ctx context.Context, messageKey *relayTypes.MessageKeyWithMessageHeight) ([]*relayTypes.Message, error)

func (*Provider) GetAddressByEventType

func (p *Provider) GetAddressByEventType(eventType string) string

GetAddressNyEventType returns the address of the contract by event type

func (*Provider) GetEventName

func (p *Provider) GetEventName(addr string) string

func (*Provider) GetFee

func (p *Provider) GetFee(ctx context.Context, networkID string, responseFee bool) (uint64, error)

GetFee returns the fee for the given networkID responseFee is used to determine if the fee should be returned

func (*Provider) ImportKeystore

func (p *Provider) ImportKeystore(ctx context.Context, keyPath, passphrase string) (string, error)

ImportKeystore imports a keystore from a file

func (*Provider) Init

func (p *Provider) Init(ctx context.Context, homePath string, kms kms.KMS) error

func (*Provider) Listener

func (p *Provider) Listener(ctx context.Context, lastSavedHeight uint64, blockInfoChan chan *relayTypes.BlockInfo) error

func (*Provider) MessageReceived

func (p *Provider) MessageReceived(ctx context.Context, key *relayTypes.MessageKey) (bool, error)

func (*Provider) NID

func (p *Provider) NID() string

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) NewKeystore

func (p *Provider) NewKeystore(passphrase string) (string, error)

func (*Provider) ParseMessageFromEvents

func (p *Provider) ParseMessageFromEvents(eventsList []Event) ([]*relayerTypes.Message, error)

func (*Provider) QueryBalance

func (p *Provider) QueryBalance(ctx context.Context, addr string) (*relayTypes.Coin, error)

func (*Provider) QueryLatestHeight

func (p *Provider) QueryLatestHeight(ctx context.Context) (uint64, error)

func (*Provider) QueryTransactionReceipt

func (p *Provider) QueryTransactionReceipt(ctx context.Context, txHash string) (*relayTypes.Receipt, error)

func (*Provider) RestoreKeystore

func (p *Provider) RestoreKeystore(ctx context.Context) error

func (*Provider) RevertMessage

func (p *Provider) RevertMessage(ctx context.Context, sn *big.Int) error

func (*Provider) Route

func (p *Provider) Route(ctx context.Context, message *relayTypes.Message, callback relayTypes.TxResponseFunc) error

func (*Provider) SetAdmin

func (p *Provider) SetAdmin(ctx context.Context, address string) error

func (*Provider) SetFee

func (p *Provider) SetFee(ctx context.Context, networkdID string, msgFee, resFee uint64) error

SetFee

func (*Provider) SetSDKContext added in v1.2.4

func (c *Provider) SetSDKContext() func()

func (*Provider) ShouldReceiveMessage

func (p *Provider) ShouldReceiveMessage(ctx context.Context, message *relayTypes.Message) (bool, error)

func (*Provider) ShouldSendMessage

func (p *Provider) ShouldSendMessage(ctx context.Context, message *relayTypes.Message) (bool, error)

func (*Provider) SubscribeMessageEvents

func (p *Provider) SubscribeMessageEvents(ctx context.Context, blockInfoChan chan *relayTypes.BlockInfo, opts *types.SubscribeOpts) error

SubscribeMessageEvents subscribes to the message events Expermental: Allows to subscribe to the message events realtime without fully syncing the chain

func (*Provider) Type

func (p *Provider) Type() string

func (*Provider) Wallet

func (p *Provider) Wallet() sdkTypes.AccAddress

Wallet returns the wallet of the provider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL