thorchain

package
v8.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 78 Imported by: 1

Documentation

Overview

Package thorchain provides an implementation of ibc.Chain for Thorchain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BroadcastTx

func BroadcastTx(ctx context.Context, broadcaster *Broadcaster, broadcastingUser User, msgs ...sdk.Msg) (sdk.TxResponse, error)

BroadcastTx uses the provided Broadcaster to broadcast all the provided messages which will be signed by the User provided. The sdk.TxResponse and an error are returned.

func CondenseMoniker

func CondenseMoniker(m string) string

CondenseMoniker fits a moniker into the cosmos character limit for monikers. If the moniker already fits, it is returned unmodified. Otherwise, the middle is truncated, and a hash is appended to the end in case the only unique data was in the middle.

func DefaultEncoding

func DefaultEncoding() testutil.TestEncodingConfig

func ModifyGenesis

func ModifyGenesis(genesisKV []GenesisKV) func(ibc.ChainConfig, []byte) ([]byte, error)

func NewThorchainHeighlinerChainConfig

func NewThorchainHeighlinerChainConfig(
	name string,
	binary string,
	bech32Prefix string,
	denom string,
	gasPrices string,
	gasAdjustment float64,
	trustingPeriod string,
	noHostMount bool,
) ibc.ChainConfig

func NewWallet

func NewWallet(keyname string, address []byte, mnemonic string, chainCfg ibc.ChainConfig) ibc.Wallet

func PollForBalance

func PollForBalance(ctx context.Context, chain *Thorchain, deltaBlocks int64, balance ibc.WalletAmount) error

PollForBalance polls until the balance matches.

func PollForMessage

func PollForMessage[T any](ctx context.Context, chain *Thorchain, registry codectypes.InterfaceRegistry, startHeight, maxHeight int64, fn func(found T) bool) (T, error)

PollForMessage searches every transaction for a message. Must pass a coded registry capable of decoding the cosmos transaction. fn is optional. Return true from the fn to stop polling and return the found message. If fn is nil, returns the first message to match type T.

func RangeBlockMessages

func RangeBlockMessages(ctx context.Context, interfaceRegistry codectypes.InterfaceRegistry, client blockClient, height int64, done func(sdk.Msg) bool) error

RangeBlockMessages iterates through all a block's transactions and each transaction's messages yielding to f. Return true from f to stop iteration.

func SetSDKConfig

func SetSDKConfig(bech32Prefix string) *sdk.Config

Types

type AccountRetriever

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

AccountRetriever defines the properties of a type that can be used to retrieve accounts.

func (AccountRetriever) EnsureExists

func (ar AccountRetriever) EnsureExists(clientCtx client.Context, addr sdk.AccAddress) error

EnsureExists returns an error if no account exists for the given address else nil.

func (AccountRetriever) GetAccount

func (ar AccountRetriever) GetAccount(clientCtx client.Context, addr sdk.AccAddress) (client.Account, error)

GetAccount queries for an account given an address and a block height. An error is returned if the query or decoding fails.

func (AccountRetriever) GetAccountNumberSequence

func (ar AccountRetriever) GetAccountNumberSequence(clientCtx client.Context, addr sdk.AccAddress) (uint64, uint64, error)

GetAccountNumberSequence returns sequence and account number for the given address. It returns an error if the account couldn't be retrieved from the state.

func (AccountRetriever) GetAccountWithHeight

func (ar AccountRetriever) GetAccountWithHeight(clientCtx client.Context, addr sdk.AccAddress) (client.Account, int64, error)

GetAccountWithHeight queries for an account given an address. Returns the height of the query with the account. An error is returned if the query or decoding fails.

type Balance

type Balance struct {
	Address string        `json:"address"`
	Coins   []CoinBalance `json:"coins"`
}

type BankMetaData

type BankMetaData struct {
	Metadata struct {
		Description string `json:"description"`
		DenomUnits  []struct {
			Denom    string   `json:"denom"`
			Exponent int      `json:"exponent"`
			Aliases  []string `json:"aliases"`
		} `json:"denom_units"`
		Base    string `json:"base"`
		Display string `json:"display"`
		Name    string `json:"name"`
		Symbol  string `json:"symbol"`
		URI     string `json:"uri"`
		URIHash string `json:"uri_hash"`
	} `json:"metadata"`
}

type BaseAccount

type BaseAccount struct {
	AccountNumber string `json:"account_number"`
	Address       string `json:"address"`
	PubKey        []byte `json:"pub_key"`
	Sequence      string `json:"sequence"`
}

type BinaryBuildInformation

type BinaryBuildInformation struct {
	Name             string            `json:"name"`
	ServerName       string            `json:"server_name"`
	Version          string            `json:"version"`
	Commit           string            `json:"commit"`
	BuildTags        string            `json:"build_tags"`
	Go               string            `json:"go"`
	BuildDeps        []BuildDependency `json:"build_deps"`
	CosmosSdkVersion string            `json:"cosmos_sdk_version"`
}

type Broadcaster

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

func NewBroadcaster

func NewBroadcaster(t *testing.T, chain *Thorchain) *Broadcaster

NewBroadcaster returns a instance of Broadcaster which can be used with broadcast.Tx to broadcast messages sdk messages.

func (*Broadcaster) ConfigureClientContextOptions

func (b *Broadcaster) ConfigureClientContextOptions(opts ...ClientContextOpt)

ConfigureClientContextOptions ensure the given configuration functions are run when calling GetClientContext after all default options have been applied.

func (*Broadcaster) ConfigureFactoryOptions

func (b *Broadcaster) ConfigureFactoryOptions(opts ...FactoryOpt)

ConfigureFactoryOptions ensure the given configuration functions are run when calling GetFactory after all default options have been applied.

func (*Broadcaster) GetClientContext

func (b *Broadcaster) GetClientContext(ctx context.Context, user User) (client.Context, error)

GetClientContext returns a client context that is configured with this Broadcaster's CosmosChain and the provided user. ConfigureClientContextOptions can be used to configure arbitrary options to configure the returned client.Context.

func (*Broadcaster) GetFactory

func (b *Broadcaster) GetFactory(ctx context.Context, user User) (tx.Factory, error)

GetFactory returns an instance of tx.Factory that is configured with this Broadcaster's CosmosChain and the provided user. ConfigureFactoryOptions can be used to specify arbitrary options to configure the returned factory.

func (*Broadcaster) GetTxResponseBytes

func (b *Broadcaster) GetTxResponseBytes(ctx context.Context, user User) ([]byte, error)

GetTxResponseBytes returns the sdk.TxResponse bytes which returned from broadcast.Tx.

func (*Broadcaster) UnmarshalTxResponseBytes

func (b *Broadcaster) UnmarshalTxResponseBytes(ctx context.Context, bytes []byte) (sdk.TxResponse, error)

UnmarshalTxResponseBytes accepts the sdk.TxResponse bytes and unmarshalls them into an instance of sdk.TxResponse.

type BuildDependency

type BuildDependency struct {
	Parent  string `json:"parent"`
	Version string `json:"version"`

	IsReplacement      bool   `json:"is_replacement"`
	Replacement        string `json:"replacement"`
	ReplacementVersion string `json:"replacement_version"`
}

type ChainNode

type ChainNode struct {
	VolumeName   string
	Index        int
	Chain        ibc.Chain
	Validator    bool
	NetworkID    string
	DockerClient *dockerclient.Client
	Client       rpcclient.Client
	GrpcConn     *grpc.ClientConn
	TestName     string
	Image        ibc.DockerImage

	// Env
	ValidatorMnemonic string // SIGNER_SEED_PHRASE
	NodeAccount       *NodeAccount
	KeyringCreated    bool

	// Additional processes that need to be run on a per-validator basis.
	Sidecars SidecarProcesses
	// contains filtered or unexported fields
}

func NewChainNode

func NewChainNode(log *zap.Logger, validator bool, chain *Thorchain, dockerClient *dockerclient.Client, networkID string, testName string, image ibc.DockerImage, index int) *ChainNode

func (*ChainNode) AccountKeyBech32

func (tn *ChainNode) AccountKeyBech32(ctx context.Context, name string) (string, error)

AccountKeyBech32 retrieves the named key's address in bech32 account format.

func (*ChainNode) AddBondModule

func (tn *ChainNode) AddBondModule(ctx context.Context) error

func (*ChainNode) AddGenesisAccount

func (tn *ChainNode) AddGenesisAccount(ctx context.Context, address string, genesisAmount []sdk.Coin) error

AddGenesisAccount adds a genesis account for each key.

func (*ChainNode) AddNodeAccount

func (tn *ChainNode) AddNodeAccount(ctx context.Context, nodeAccount NodeAccount) error

func (*ChainNode) BankSend

func (tn *ChainNode) BankSend(ctx context.Context, keyName string, amount ibc.WalletAmount) error

BankSend sends tokens from one account to another.

func (*ChainNode) BankSendWithNote

func (tn *ChainNode) BankSendWithNote(ctx context.Context, keyName string, amount ibc.WalletAmount, note string) (string, error)

BankSendWithNote sends tokens from one account to another with a note/memo.

func (*ChainNode) BinCommand

func (tn *ChainNode) BinCommand(command ...string) []string

BinCommand is a helper to retrieve a full command for a chain node binary. For example, if chain node binary is `gaiad`, and desired command is `gaiad keys show key1`, pass ("keys", "show", "key1") for command to return the full command. Will include additional flags for home directory and chain ID.

func (*ChainNode) Bind

func (tn *ChainNode) Bind() []string

Bind returns the home folder bind point for running the node.

func (*ChainNode) CliContext

func (tn *ChainNode) CliContext() client.Context

CliContext creates a new Cosmos SDK client context.

func (*ChainNode) ContainerID

func (tn *ChainNode) ContainerID() string

func (*ChainNode) CopyFile

func (tn *ChainNode) CopyFile(ctx context.Context, srcPath, dstPath string) error

CopyFile adds a file from the host filesystem to the docker filesystem relPath describes the location of the file in the docker volume relative to the home directory.

func (*ChainNode) CreateKey

func (tn *ChainNode) CreateKey(ctx context.Context, name string) error

CreateKey creates a key in the keyring backend test for the given node.

func (*ChainNode) CreateNodeContainer

func (tn *ChainNode) CreateNodeContainer(ctx context.Context) error

func (*ChainNode) Exec

func (tn *ChainNode) Exec(ctx context.Context, cmd []string, env []string) ([]byte, []byte, error)

func (*ChainNode) ExecBin

func (tn *ChainNode) ExecBin(ctx context.Context, backendfile bool, command ...string) ([]byte, []byte, error)

ExecBin is a helper to execute a command for a chain node binary. For example, if chain node binary is `gaiad`, and desired command is `gaiad keys show key1`, pass ("keys", "show", "key1") for command to execute the command against the node. Will include additional flags for home directory and chain ID.

func (*ChainNode) ExecQuery

func (tn *ChainNode) ExecQuery(ctx context.Context, command ...string) ([]byte, []byte, error)

ExecQuery is a helper to execute a query command. For example, if chain node binary is gaiad, and desired command is `gaiad query gov params`, pass ("gov", "params") for command to execute the query against the node. Returns response in json format.

func (*ChainNode) ExecTx

func (tn *ChainNode) ExecTx(ctx context.Context, keyName string, command ...string) (string, error)

ExecTx executes a transaction, waits for 2 blocks if successful, then returns the tx hash.

func (*ChainNode) ExportState

func (tn *ChainNode) ExportState(ctx context.Context, height int64) (string, error)

func (*ChainNode) FindTxs

func (tn *ChainNode) FindTxs(ctx context.Context, height int64) ([]blockdb.Tx, error)

FindTxs implements blockdb.BlockSaver.

func (*ChainNode) GenerateEd25519

func (tn *ChainNode) GenerateEd25519(ctx context.Context) (string, error)

func (*ChainNode) GenesisFileContent

func (tn *ChainNode) GenesisFileContent(ctx context.Context) ([]byte, error)

func (*ChainNode) GetBuildInformation

func (tn *ChainNode) GetBuildInformation(ctx context.Context) *BinaryBuildInformation

GetBuildInformation returns the build information and dependencies for the chain binary.

func (*ChainNode) GetHostAddress

func (tn *ChainNode) GetHostAddress(ctx context.Context, portID string) (string, error)

GetHostAddress returns the host-accessible url for a port in the container. This is useful for finding the url & random host port for ports exposed via ChainConfig.ExposeAdditionalPorts.

func (*ChainNode) GetNodeAccount

func (tn *ChainNode) GetNodeAccount(ctx context.Context) error

func (*ChainNode) GetNodePubKey

func (tn *ChainNode) GetNodePubKey(ctx context.Context) (string, error)

func (*ChainNode) GetTransaction

func (tn *ChainNode) GetTransaction(clientCtx client.Context, txHash string) (*sdk.TxResponse, error)

func (*ChainNode) GetValidatorConsPubKey

func (tn *ChainNode) GetValidatorConsPubKey(ctx context.Context) (string, error)

func (*ChainNode) HasCommand

func (tn *ChainNode) HasCommand(ctx context.Context, command ...string) bool

HasCommand checks if a command in the chain binary is available.

func (*ChainNode) Height

func (tn *ChainNode) Height(ctx context.Context) (int64, error)

func (*ChainNode) HomeDir

func (tn *ChainNode) HomeDir() string

func (*ChainNode) HostName

func (tn *ChainNode) HostName() string

hostname of the test node container.

func (*ChainNode) HostnameCometMock

func (tn *ChainNode) HostnameCometMock() string

hostname of the comet mock container.

func (*ChainNode) ICSVersion

func (tn *ChainNode) ICSVersion(ctx context.Context) string

ICSVersion returns the version of interchain-security the binary was built with. If it doesn't depend on interchain-security, it returns an empty string.

func (*ChainNode) InitFullNodeFiles

func (tn *ChainNode) InitFullNodeFiles(ctx context.Context) error

func (*ChainNode) InitHomeFolder

func (tn *ChainNode) InitHomeFolder(ctx context.Context) error

InitHomeFolder initializes a home folder for the given node.

func (*ChainNode) InitValidatorGenTx

func (tn *ChainNode) InitValidatorGenTx(
	ctx context.Context,
	chainType *ibc.ChainConfig,
	genesisAmounts []sdk.Coin,
	genesisSelfDelegation sdk.Coin,
) error

InitValidatorFiles creates the node files and signs a genesis transaction.

func (*ChainNode) IsAboveSDK47

func (tn *ChainNode) IsAboveSDK47(ctx context.Context) bool

func (*ChainNode) KeyBech32

func (tn *ChainNode) KeyBech32(ctx context.Context, name string, bech string) (string, error)

KeyBech32 retrieves the named key's address in bech32 format from the node. bech is the bech32 prefix (acc|val|cons). If empty, defaults to the account key (same as "acc").

func (*ChainNode) Name

func (tn *ChainNode) Name() string

Name of the test node container.

func (*ChainNode) NewClient

func (tn *ChainNode) NewClient(addr string) error

NewClient creates and assigns a new Tendermint RPC client to the ChainNode.

func (*ChainNode) NewSidecarProcess

func (tn *ChainNode) NewSidecarProcess(
	ctx context.Context,
	preStart bool,
	processName string,
	cli *dockerclient.Client,
	networkID string,
	image ibc.DockerImage,
	homeDir string,
	ports []string,
	startCmd []string,
	env []string,
) error

func (*ChainNode) NodeCommand

func (tn *ChainNode) NodeCommand(command ...string) []string

NodeCommand is a helper to retrieve a full command for a chain node binary. when interactions with the RPC endpoint are necessary. For example, if chain node binary is `gaiad`, and desired command is `gaiad keys show key1`, pass ("keys", "show", "key1") for command to return the full command. Will include additional flags for node URL, home directory, and chain ID.

func (*ChainNode) NodeID

func (tn *ChainNode) NodeID(ctx context.Context) (string, error)

NodeID returns the persistent ID of a given node.

func (*ChainNode) NodeType

func (tn *ChainNode) NodeType() string

func (*ChainNode) OverwriteGenesisFile

func (tn *ChainNode) OverwriteGenesisFile(ctx context.Context, content []byte) error

func (*ChainNode) OverwritePrivValFile

func (tn *ChainNode) OverwritePrivValFile(ctx context.Context, content []byte) error

func (*ChainNode) PauseContainer

func (tn *ChainNode) PauseContainer(ctx context.Context) error

func (*ChainNode) PrivValFileContent

func (tn *ChainNode) PrivValFileContent(ctx context.Context) ([]byte, error)

func (*ChainNode) QueryBankMetadata

func (tn *ChainNode) QueryBankMetadata(ctx context.Context, denom string) (*BankMetaData, error)

QueryBankMetadata returns the bank metadata of a token denomination.

func (*ChainNode) QueryCommand

func (tn *ChainNode) QueryCommand(command ...string) []string

QueryCommand is a helper to retrieve the full query command. For example, if chain node binary is gaiad, and desired command is `gaiad query gov params`, pass ("gov", "params") for command to return the full command with all necessary flags to query the specific node.

func (*ChainNode) QueryICA

func (tn *ChainNode) QueryICA(ctx context.Context, connectionID, address string) (string, error)

QueryICA will query for an interchain account controlled by the specified address on the counterparty chain.

func (*ChainNode) QueryParam

func (tn *ChainNode) QueryParam(ctx context.Context, subspace, key string) (*ParamChange, error)

QueryParam returns the state and details of a subspace param.

func (*ChainNode) ReadFile

func (tn *ChainNode) ReadFile(ctx context.Context, relPath string) ([]byte, error)

ReadFile reads the contents of a single file at the specified path in the docker filesystem. relPath describes the location of the file in the docker volume relative to the home directory.

func (*ChainNode) RecoverKey

func (tn *ChainNode) RecoverKey(ctx context.Context, keyName, mnemonic string) error

RecoverKey restores a key from a given mnemonic.

func (*ChainNode) RemoveContainer

func (tn *ChainNode) RemoveContainer(ctx context.Context) error

func (*ChainNode) SendFunds deprecated

func (tn *ChainNode) SendFunds(ctx context.Context, keyName string, amount ibc.WalletAmount) error

Deprecated: use BankSend instead.

func (*ChainNode) SetPeers

func (tn *ChainNode) SetPeers(ctx context.Context, peers string) error

SetPeers modifies the config persistent_peers for a node.

func (*ChainNode) SetTestConfig

func (tn *ChainNode) SetTestConfig(ctx context.Context) error

SetTestConfig modifies the config to reasonable values for use within interchaintest.

func (*ChainNode) StartContainer

func (tn *ChainNode) StartContainer(ctx context.Context) error

func (*ChainNode) StopContainer

func (tn *ChainNode) StopContainer(ctx context.Context) error

func (*ChainNode) TxCommand

func (tn *ChainNode) TxCommand(keyName string, command ...string) []string

TxCommand is a helper to retrieve a full command for broadcasting a tx with the chain node binary.

func (*ChainNode) TxHashToResponse

func (tn *ChainNode) TxHashToResponse(ctx context.Context, txHash string) (*sdk.TxResponse, error)

TxHashToResponse returns the sdk transaction response struct for a given transaction hash.

func (*ChainNode) UnpauseContainer

func (tn *ChainNode) UnpauseContainer(ctx context.Context) error

func (*ChainNode) UnsafeResetAll

func (tn *ChainNode) UnsafeResetAll(ctx context.Context) error

func (*ChainNode) Version

func (tn *ChainNode) Version(ctx context.Context) (string, error)

func (*ChainNode) WithPreStartNode

func (tn *ChainNode) WithPreStartNode(preStartNode func(*ChainNode)) *ChainNode

WithPreStartNode sets the preStartNode function for the ChainNode.

func (*ChainNode) WriteFile

func (tn *ChainNode) WriteFile(ctx context.Context, content []byte, relPath string) error

WriteFile accepts file contents in a byte slice and writes the contents to the docker filesystem. relPath describes the location of the file in the docker volume relative to the home directory.

type ChainNodes

type ChainNodes []*ChainNode

ChainNodes is a collection of ChainNode.

func (ChainNodes) LogGenesisHashes

func (nodes ChainNodes) LogGenesisHashes(ctx context.Context) error

LogGenesisHashes logs the genesis hashes for the various nodes.

func (ChainNodes) PeerString

func (nodes ChainNodes) PeerString(ctx context.Context) string

PeerString returns the string for connecting the nodes passed in.

func (ChainNodes) SidecarBifrostPeers

func (nodes ChainNodes) SidecarBifrostPeers() string

type ClientContextOpt

type ClientContextOpt func(clientContext client.Context) client.Context

type Coin

type Coin struct {
	Asset    string `json:"asset"`
	Amount   string `json:"amount"`
	Decimals *int64 `json:"decimals,omitempty"`
}

Coin struct for Coin.

type CoinBalance

type CoinBalance struct {
	Denom  string `json:"denom"`
	Amount string `json:"amount"`
}

type CosmosTx

type CosmosTx struct {
	TxHash string `json:"txhash"`
	Code   int    `json:"code"`
	RawLog string `json:"raw_log"`
}

type CosmosWallet

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

func (*CosmosWallet) Address

func (w *CosmosWallet) Address() []byte

Get Address with chain's prefix.

func (*CosmosWallet) FormattedAddress

func (w *CosmosWallet) FormattedAddress() string

Get formatted address, passing in a prefix.

func (*CosmosWallet) FormattedAddressWithPrefix

func (w *CosmosWallet) FormattedAddressWithPrefix(prefix string) string

func (*CosmosWallet) KeyName

func (w *CosmosWallet) KeyName() string

func (*CosmosWallet) Mnemonic

func (w *CosmosWallet) Mnemonic() string

Get mnemonic, only used for relayer wallets.

type DenomAuthorityMetadata

type DenomAuthorityMetadata struct {
	// Can be empty for no admin, or a valid address
	Admin string `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty" yaml:"admin"`
}

type FactoryOpt

type FactoryOpt func(factory tx.Factory) tx.Factory

type GenesisFile

type GenesisFile struct {
	AppState struct {
		Thorchain struct {
			NodeAccounts []NodeAccount `json:"node_accounts"`
		} `json:"thorchain"`
	} `json:"app_state"`
}

type GenesisKV

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

func NewGenesisKV

func NewGenesisKV(key string, value interface{}) GenesisKV

type GenesisValidatorPubKey

type GenesisValidatorPubKey struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type InboundAddress

type InboundAddress struct {
	Chain   *string `json:"chain,omitempty"`
	PubKey  *string `json:"pub_key,omitempty"`
	Address *string `json:"address,omitempty"`
	Router  *string `json:"router,omitempty"`
	// Returns true if trading is unavailable for this chain, either because trading is halted globally or specifically for this chain
	Halted bool `json:"halted"`
	// Returns true if trading is paused globally
	GlobalTradingPaused *bool `json:"global_trading_paused,omitempty"`
	// Returns true if trading is paused for this chain
	ChainTradingPaused *bool `json:"chain_trading_paused,omitempty"`
	// Returns true if LP actions are paused for this chain
	ChainLpActionsPaused *bool `json:"chain_lp_actions_paused,omitempty"`
	// The minimum fee rate used by vaults to send outbound TXs. The actual fee rate may be higher. For EVM chains this is returned in gwei (1e9).
	GasRate *string `json:"gas_rate,omitempty"`
	// Units of the gas_rate.
	GasRateUnits *string `json:"gas_rate_units,omitempty"`
	// Avg size of outbound TXs on each chain. For UTXO chains it may be larger than average, as it takes into account vault consolidation txs, which can have many vouts
	OutboundTxSize *string `json:"outbound_tx_size,omitempty"`
	// The total outbound fee charged to the user for outbound txs in the gas asset of the chain.
	OutboundFee *string `json:"outbound_fee,omitempty"`
	// Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transactions with asset amounts lower than the dust_threshold are ignored.
	DustThreshold *string `json:"dust_threshold,omitempty"`
}

InboundAddress struct for InboundAddress.

type InboundConfirmationCountedStage

type InboundConfirmationCountedStage struct {
	// the THORChain block height when confirmation counting began
	CountingStartHeight *int64 `json:"counting_start_height,omitempty"`
	// the external source chain for which confirmation counting takes place
	Chain *string `json:"chain,omitempty"`
	// the block height on the external source chain when the transaction was observed
	ExternalObservedHeight *int64 `json:"external_observed_height,omitempty"`
	// the block height on the external source chain when confirmation counting will be complete
	ExternalConfirmationDelayHeight *int64 `json:"external_confirmation_delay_height,omitempty"`
	// the estimated remaining seconds before confirmation counting completes
	RemainingConfirmationSeconds *int64 `json:"remaining_confirmation_seconds,omitempty"`
	// returns true if no transaction confirmation counting remains to be done
	Completed bool `json:"completed"`
}

InboundConfirmationCountedStage struct for InboundConfirmationCountedStage.

type InboundFinalisedStage

type InboundFinalisedStage struct {
	// returns true if the inbound transaction has been finalised (THORChain agreeing it exists)
	Completed bool `json:"completed"`
}

InboundFinalisedStage struct for InboundFinalisedStage.

type InboundObservedStage

type InboundObservedStage struct {
	// returns true if any nodes have observed the transaction (to be deprecated in favour of counts)
	Started *bool `json:"started,omitempty"`
	// number of signers for pre-confirmation-counting observations
	PreConfirmationCount *int64 `json:"pre_confirmation_count,omitempty"`
	// number of signers for final observations, after any confirmation counting complete
	FinalCount int64 `json:"final_count"`
	// returns true if no transaction observation remains to be done
	Completed bool `json:"completed"`
}

InboundObservedStage struct for InboundObservedStage.

type LiquidityProvider

type LiquidityProvider struct {
	Asset              string  `json:"asset"`
	RuneAddress        *string `json:"rune_address,omitempty"`
	AssetAddress       *string `json:"asset_address,omitempty"`
	LastAddHeight      *int64  `json:"last_add_height,omitempty"`
	LastWithdrawHeight *int64  `json:"last_withdraw_height,omitempty"`
	Units              string  `json:"units"`
	PendingRune        string  `json:"pending_rune"`
	PendingAsset       string  `json:"pending_asset"`
	PendingTxID        *string `json:"pending_tx_id,omitempty"`
	RuneDepositValue   string  `json:"rune_deposit_value"`
	AssetDepositValue  string  `json:"asset_deposit_value"`
	RuneRedeemValue    *string `json:"rune_redeem_value,omitempty"`
	AssetRedeemValue   *string `json:"asset_redeem_value,omitempty"`
	LuviDepositValue   *string `json:"luvi_deposit_value,omitempty"`
	LuviRedeemValue    *string `json:"luvi_redeem_value,omitempty"`
	LuviGrowthPct      *string `json:"luvi_growth_pct,omitempty"`
}

LiquidityProvider struct for LiquidityProvider.

type ModuleAccount

type ModuleAccount struct {
	Type        string      `json:"@type"`
	BaseAccount BaseAccount `json:"base_account"`
	Name        string      `json:"name"`
	Permissions []string    `json:"permissions"`
}

type NodeAccount

type NodeAccount struct {
	NodeAddress         string               `json:"node_address"`
	Version             string               `json:"version"`
	IPAddress           string               `json:"ip_address"`
	Status              string               `json:"status"`
	Bond                string               `json:"bond"`
	BondUInt            uint64               `json:"-"`
	ActiveBlockHeight   string               `json:"active_block_height"`
	BondAddress         string               `json:"bond_address"`
	SignerMembership    []string             `json:"signer_membership"`
	ValidatorConsPubKey string               `json:"validator_cons_pub_key"`
	PubKeySet           NodeAccountPubKeySet `json:"pub_key_set"`
}

type NodeAccountPubKeySet

type NodeAccountPubKeySet struct {
	Secp256k1 string `json:"secp256k1"`
	Ed25519   string `json:"ed25519"`
}

type ObservedTx

type ObservedTx struct {
	Tx             Tx      `json:"tx"`
	ObservedPubKey *string `json:"observed_pub_key,omitempty"`
	// the block height on the external source chain when the transaction was observed, not provided if chain is THOR
	ExternalObservedHeight *int64 `json:"external_observed_height,omitempty"`
	// the block height on the external source chain when confirmation counting will be complete, not provided if chain is THOR
	ExternalConfirmationDelayHeight *int64 `json:"external_confirmation_delay_height,omitempty"`
	// the outbound aggregator to use, will also match a suffix
	Aggregator *string `json:"aggregator,omitempty"`
	// the aggregator target asset provided to transferOutAndCall
	AggregatorTarget *string `json:"aggregator_target,omitempty"`
	// the aggregator target asset limit provided to transferOutAndCall
	AggregatorTargetLimit *string  `json:"aggregator_target_limit,omitempty"`
	Signers               []string `json:"signers,omitempty"`
	KeysignMs             *int64   `json:"keysign_ms,omitempty"`
	OutHashes             []string `json:"out_hashes,omitempty"`
	Status                *string  `json:"status,omitempty"`
}

ObservedTx struct for ObservedTx.

type OutboundDelayStage

type OutboundDelayStage struct {
	// the number of remaining THORChain blocks the outbound will be delayed
	RemainingDelayBlocks *int64 `json:"remaining_delay_blocks,omitempty"`
	// the estimated remaining seconds of the outbound delay before it will be sent
	RemainingDelaySeconds *int64 `json:"remaining_delay_seconds,omitempty"`
	// returns true if no transaction outbound delay remains
	Completed bool `json:"completed"`
}

OutboundDelayStage struct for OutboundDelayStage.

type OutboundSignedStage

type OutboundSignedStage struct {
	// THORChain height for which the external outbound is scheduled
	ScheduledOutboundHeight *int64 `json:"scheduled_outbound_height,omitempty"`
	// THORChain blocks since the scheduled outbound height
	BlocksSinceScheduled *int64 `json:"blocks_since_scheduled,omitempty"`
	// returns true if an external transaction has been signed and broadcast (and observed in its mempool)
	Completed bool `json:"completed"`
}

OutboundSignedStage struct for OutboundSignedStage.

type ParamChange

type ParamChange struct {
	Subspace string `json:"subspace"`
	Key      string `json:"key"`
	Value    any    `json:"value"`
}

type Pool

type Pool struct {
	Asset               string  `json:"asset"`
	ShortCode           *string `json:"short_code,omitempty"`
	Status              string  `json:"status"`
	Decimals            *int64  `json:"decimals,omitempty"`
	PendingInboundAsset string  `json:"pending_inbound_asset"`
	PendingInboundRune  string  `json:"pending_inbound_rune"`
	BalanceAsset        string  `json:"balance_asset"`
	BalanceRune         string  `json:"balance_rune"`
	// the USD (TOR) price of the asset in 1e8
	AssetTorPrice string `json:"asset_tor_price"`
	// the total pool units, this is the sum of LP and synth units
	PoolUnits string `json:"pool_units"`
	// the total pool liquidity provider units
	LPUnits string `json:"LP_units"`
	// the total synth units in the pool
	SynthUnits string `json:"synth_units"`
	// the total supply of synths for the asset
	SynthSupply string `json:"synth_supply"`
	// the balance of L1 asset deposited into the Savers Vault
	SaversDepth string `json:"savers_depth"`
	// the number of units owned by Savers
	SaversUnits string `json:"savers_units"`
	// the filled savers capacity in basis points, 4500/10000 = 45%
	SaversFillBps string `json:"savers_fill_bps"`
	// amount of remaining capacity in asset
	SaversCapacityRemaining string `json:"savers_capacity_remaining"`
	// whether additional synths cannot be minted
	SynthMintPaused bool `json:"synth_mint_paused"`
	// the amount of synth supply remaining before the current max supply is reached
	SynthSupplyRemaining string `json:"synth_supply_remaining"`
	// the amount of collateral collects for loans
	LoanCollateral string `json:"loan_collateral"`
	// the amount of remaining collateral collects for loans
	LoanCollateralRemaining string `json:"loan_collateral_remaining"`
	// the current loan collateralization ratio
	LoanCr string `json:"loan_cr"`
	// the depth of the derived virtual pool relative to L1 pool (in basis points)
	DerivedDepthBps string `json:"derived_depth_bps"`
}

Pool struct for Pool.

type PrivValidatorKey

type PrivValidatorKey struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type PrivValidatorKeyFile

type PrivValidatorKeyFile struct {
	Address string           `json:"address"`
	PubKey  PrivValidatorKey `json:"pub_key"`
	PrivKey PrivValidatorKey `json:"priv_key"`
}

type ProtoMessage

type ProtoMessage interface {
	Reset()
	String() string
	ProtoMessage()
}

ProtoMessage is implemented by generated protocol buffer messages. Pulled from github.com/cosmos/gogoproto/proto.

type QueryDenomAuthorityMetadataResponse

type QueryDenomAuthorityMetadataResponse struct {
	AuthorityMetadata DenomAuthorityMetadata `` /* 128-byte string literal not displayed */
}

type QuoteFees

type QuoteFees struct {
	// the target asset used for all fees
	Asset string `json:"asset"`
	// affiliate fee in the target asset
	Affiliate *string `json:"affiliate,omitempty"`
	// outbound fee in the target asset
	Outbound *string `json:"outbound,omitempty"`
	// liquidity fees paid to pools in the target asset
	Liquidity string `json:"liquidity"`
	// total fees in the target asset
	Total string `json:"total"`
	// the swap slippage in basis points
	SlippageBps int64 `json:"slippage_bps"`
	// total basis points in fees relative to amount out
	TotalBps int64 `json:"total_bps"`
}

QuoteFees struct for QuoteFees.

type QuoteSaverDepositResponse

type QuoteSaverDepositResponse struct {
	// the inbound address for the transaction on the source chain
	InboundAddress string `json:"inbound_address"`
	// the approximate number of source chain blocks required before processing
	InboundConfirmationBlocks *int64 `json:"inbound_confirmation_blocks,omitempty"`
	// the approximate seconds for block confirmations required before processing
	InboundConfirmationSeconds *int64 `json:"inbound_confirmation_seconds,omitempty"`
	// the number of thorchain blocks the outbound will be delayed
	OutboundDelayBlocks *int64 `json:"outbound_delay_blocks,omitempty"`
	// the approximate seconds for the outbound delay before it will be sent
	OutboundDelaySeconds *int64    `json:"outbound_delay_seconds,omitempty"`
	Fees                 QuoteFees `json:"fees"`
	// the EVM chain router contract address
	Router *string `json:"router,omitempty"`
	// expiration timestamp in unix seconds
	Expiry int64 `json:"expiry"`
	// static warning message
	Warning string `json:"warning"`
	// chain specific quote notes
	Notes string `json:"notes"`
	// Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transactions with asset amounts lower than the dust_threshold are ignored.
	DustThreshold *string `json:"dust_threshold,omitempty"`
	// The recommended minimum inbound amount for this transaction type & inbound asset. Sending less than this amount could result in failed refunds.
	RecommendedMinAmountIn *string `json:"recommended_min_amount_in,omitempty"`
	// the recommended gas rate to use for the inbound to ensure timely confirmation
	RecommendedGasRate string `json:"recommended_gas_rate"`
	// the units of the recommended gas rate
	GasRateUnits string `json:"gas_rate_units"`
	// generated memo for the deposit
	Memo string `json:"memo"`
	// same as expected_amount_deposit, to be deprecated in favour of expected_amount_deposit
	ExpectedAmountOut *string `json:"expected_amount_out,omitempty"`
	// the amount of the target asset the user can expect to deposit after fees
	ExpectedAmountDeposit string `json:"expected_amount_deposit"`
}

QuoteSaverDepositResponse struct for QuoteSaverDepositResponse.

type QuoteSwapResponse

type QuoteSwapResponse struct {
	// the inbound address for the transaction on the source chain
	InboundAddress *string `json:"inbound_address,omitempty"`
	// the approximate number of source chain blocks required before processing
	InboundConfirmationBlocks *int64 `json:"inbound_confirmation_blocks,omitempty"`
	// the approximate seconds for block confirmations required before processing
	InboundConfirmationSeconds *int64 `json:"inbound_confirmation_seconds,omitempty"`
	// the number of thorchain blocks the outbound will be delayed
	OutboundDelayBlocks int64 `json:"outbound_delay_blocks"`
	// the approximate seconds for the outbound delay before it will be sent
	OutboundDelaySeconds int64     `json:"outbound_delay_seconds"`
	Fees                 QuoteFees `json:"fees"`
	// the EVM chain router contract address
	Router *string `json:"router,omitempty"`
	// expiration timestamp in unix seconds
	Expiry int64 `json:"expiry"`
	// static warning message
	Warning string `json:"warning"`
	// chain specific quote notes
	Notes string `json:"notes"`
	// Defines the minimum transaction size for the chain in base units (sats, wei, uatom). Transactions with asset amounts lower than the dust_threshold are ignored.
	DustThreshold *string `json:"dust_threshold,omitempty"`
	// The recommended minimum inbound amount for this transaction type & inbound asset. Sending less than this amount could result in failed refunds.
	RecommendedMinAmountIn *string `json:"recommended_min_amount_in,omitempty"`
	// the recommended gas rate to use for the inbound to ensure timely confirmation
	RecommendedGasRate *string `json:"recommended_gas_rate,omitempty"`
	// the units of the recommended gas rate
	GasRateUnits *string `json:"gas_rate_units,omitempty"`
	// generated memo for the swap
	Memo *string `json:"memo,omitempty"`
	// the amount of the target asset the user can expect to receive after fees
	ExpectedAmountOut string `json:"expected_amount_out"`
	// the maximum amount of trades a streaming swap can do for a trade
	MaxStreamingQuantity *int64 `json:"max_streaming_quantity,omitempty"`
	// the number of blocks the streaming swap will execute over
	StreamingSwapBlocks *int64 `json:"streaming_swap_blocks,omitempty"`
	// approx the number of seconds the streaming swap will execute over
	StreamingSwapSeconds *int64 `json:"streaming_swap_seconds,omitempty"`
	// total number of seconds a swap is expected to take (inbound conf + streaming swap + outbound delay)
	TotalSwapSeconds *int64 `json:"total_swap_seconds,omitempty"`
}

QuoteSwapResponse struct for QuoteSwapResponse.

type Saver

type Saver struct {
	Asset              string `json:"asset"`
	AssetAddress       string `json:"asset_address"`
	LastAddHeight      *int64 `json:"last_add_height,omitempty"`
	LastWithdrawHeight *int64 `json:"last_withdraw_height,omitempty"`
	Units              string `json:"units"`
	AssetDepositValue  string `json:"asset_deposit_value"`
	AssetRedeemValue   string `json:"asset_redeem_value"`
	GrowthPct          string `json:"growth_pct"`
}

Saver struct for Saver.

type SidecarProcess

type SidecarProcess struct {
	Index int
	Chain ibc.Chain

	ProcessName string
	TestName    string

	// Env
	Peers string // PEER

	VolumeName   string
	DockerClient *dockerclient.Client
	NetworkID    string
	Image        ibc.DockerImage
	// contains filtered or unexported fields
}

SidecarProcess represents a companion process that may be required on a per chain or per validator basis.

func NewSidecar

func NewSidecar(
	log *zap.Logger,
	validatorProcess bool,
	preStart bool,
	chain ibc.Chain,
	dockerClient *dockerclient.Client,
	networkID, processName, testName string,
	image ibc.DockerImage,
	homeDir string,
	index int,
	ports []string,
	startCmd []string,
	env []string,
) *SidecarProcess

NewSidecar instantiates a new SidecarProcess.

func (*SidecarProcess) Bind

func (s *SidecarProcess) Bind() []string

Bind returns the home folder bind point for running the process.

func (*SidecarProcess) CopyFile

func (s *SidecarProcess) CopyFile(ctx context.Context, srcPath, dstPath string) error

CopyFile adds a file from the host filesystem to the docker filesystem relPath describes the location of the file in the docker volume relative to the home directory.

func (*SidecarProcess) CreateContainer

func (s *SidecarProcess) CreateContainer(ctx context.Context, nodeVolume []string) error

func (*SidecarProcess) Exec

func (s *SidecarProcess) Exec(ctx context.Context, cmd []string, env []string) ([]byte, []byte, error)

Exec enables the execution of arbitrary CLI cmds against the process.

func (*SidecarProcess) GetHostPorts

func (s *SidecarProcess) GetHostPorts(ctx context.Context, portIDs ...string) ([]string, error)

func (*SidecarProcess) HomeDir

func (s *SidecarProcess) HomeDir() string

HomeDir returns the path name where any configuration files will be written to the Docker filesystem.

func (*SidecarProcess) HostName

func (s *SidecarProcess) HostName() string

func (*SidecarProcess) Name

func (s *SidecarProcess) Name() string

Name returns a string identifier based on if this process is configured to run on a chain level or on a per validator level.

func (*SidecarProcess) PauseContainer

func (s *SidecarProcess) PauseContainer(ctx context.Context) error

func (*SidecarProcess) ReadFile

func (s *SidecarProcess) ReadFile(ctx context.Context, relPath string) ([]byte, error)

ReadFile reads the contents of a single file at the specified path in the docker filesystem. relPath describes the location of the file in the docker volume relative to the home directory.

func (*SidecarProcess) RemoveContainer

func (s *SidecarProcess) RemoveContainer(ctx context.Context) error

func (*SidecarProcess) StartContainer

func (s *SidecarProcess) StartContainer(ctx context.Context) error

func (*SidecarProcess) StopContainer

func (s *SidecarProcess) StopContainer(ctx context.Context) error

func (*SidecarProcess) UnpauseContainer

func (s *SidecarProcess) UnpauseContainer(ctx context.Context) error

func (*SidecarProcess) WriteFile

func (s *SidecarProcess) WriteFile(ctx context.Context, content []byte, relPath string) error

WriteFile accepts file contents in a byte slice and writes the contents to the docker filesystem. relPath describes the location of the file in the docker volume relative to the home directory.

type SidecarProcesses

type SidecarProcesses []*SidecarProcess

type State

type State struct {
	Accounts []ModuleAccount `json:"accounts"`
}

type StreamingStatus

type StreamingStatus struct {
	// how often each swap is made, in blocks
	Interval int64 `json:"interval"`
	// the total number of swaps in a streaming swaps
	Quantity int64 `json:"quantity"`
	// the amount of swap attempts so far
	Count int64 `json:"count"`
}

StreamingStatus struct for StreamingStatus.

type SwapFinalisedStage

type SwapFinalisedStage struct {
	// (to be deprecated in favor of swap_status) returns true if an inbound transaction's swap (successful or refunded) is no longer pending
	Completed bool `json:"completed"`
}

SwapFinalisedStage struct for SwapFinalisedStage.

type SwapStatus

type SwapStatus struct {
	// true when awaiting a swap
	Pending   bool             `json:"pending"`
	Streaming *StreamingStatus `json:"streaming,omitempty"`
}

SwapStatus struct for SwapStatus.

type Thorchain

type Thorchain struct {
	NumValidators int

	Validators ChainNodes
	FullNodes  ChainNodes

	// Additional processes that need to be run on a per-chain basis.
	Sidecars SidecarProcesses
	// contains filtered or unexported fields
}

func NewThorchain

func NewThorchain(testName string, chainConfig ibc.ChainConfig, numValidators int, numFullNodes int, log *zap.Logger) *Thorchain

func (*Thorchain) APIGetBalances added in v8.8.0

func (c *Thorchain) APIGetBalances(ctx context.Context, addr string) (common.Coins, error)

func (*Thorchain) APIGetInboundAddress added in v8.8.0

func (c *Thorchain) APIGetInboundAddress(ctx context.Context, chain string) (address string, router *string, err error)

func (*Thorchain) APIGetLiquidityProviders added in v8.8.0

func (c *Thorchain) APIGetLiquidityProviders(ctx context.Context, asset common.Asset) ([]LiquidityProvider, error)

func (*Thorchain) APIGetMimirs added in v8.8.0

func (c *Thorchain) APIGetMimirs(ctx context.Context) (map[string]int64, error)

func (*Thorchain) APIGetPool added in v8.8.0

func (c *Thorchain) APIGetPool(ctx context.Context, asset common.Asset) (Pool, error)

func (*Thorchain) APIGetPools added in v8.8.0

func (c *Thorchain) APIGetPools(ctx context.Context) ([]Pool, error)

func (*Thorchain) APIGetRouterAddress added in v8.8.0

func (c *Thorchain) APIGetRouterAddress(ctx context.Context, chain string) (string, error)

func (*Thorchain) APIGetSaverDepositQuote added in v8.8.0

func (c *Thorchain) APIGetSaverDepositQuote(ctx context.Context, asset common.Asset, amount sdkmath.Uint) (QuoteSaverDepositResponse, error)

func (*Thorchain) APIGetSavers added in v8.8.0

func (c *Thorchain) APIGetSavers(ctx context.Context, asset common.Asset) ([]Saver, error)

func (*Thorchain) APIGetSwapQuote added in v8.8.0

func (c *Thorchain) APIGetSwapQuote(ctx context.Context, from, to common.Asset, amount sdkmath.Uint) (QuoteSwapResponse, error)

func (*Thorchain) APIGetTxDetails added in v8.8.0

func (c *Thorchain) APIGetTxDetails(ctx context.Context, txid string) (TxDetailsResponse, error)

func (*Thorchain) APIGetTxStages added in v8.8.0

func (c *Thorchain) APIGetTxStages(ctx context.Context, txid string) (TxStagesResponse, error)

func (*Thorchain) AccAddressFromBech32

func (c *Thorchain) AccAddressFromBech32(address string) (addr sdk.AccAddress, err error)

AccAddressFromBech32 creates an AccAddress from a Bech32 string. https://github.com/cosmos/cosmos-sdk/blob/v0.50.2/types/address.go#L193-L212

func (*Thorchain) AccAddressToBech32

func (c *Thorchain) AccAddressToBech32(addr sdk.AccAddress) (string, error)

func (*Thorchain) Acknowledgements

func (c *Thorchain) Acknowledgements(ctx context.Context, height int64) ([]ibc.PacketAcknowledgement, error)

Acknowledgements implements ibc.Chain, returning all acknowledgments in block at height.

func (*Thorchain) AddFullNodes

func (c *Thorchain) AddFullNodes(ctx context.Context, configFileOverrides map[string]any, inc int) error

AddFullNodes adds new fullnodes to the network, peering with the existing nodes.

func (*Thorchain) BankQueryAllBalances

func (c *Thorchain) BankQueryAllBalances(ctx context.Context, address string) (types.Coins, error)

AllBalances fetches an account address's balance for all denoms it holds.

func (*Thorchain) BankQueryBalance

func (c *Thorchain) BankQueryBalance(ctx context.Context, address string, denom string) (sdkmath.Int, error)

BankGetBalance is an alias for GetBalance.

func (*Thorchain) BankQueryDenomMetadata

func (c *Thorchain) BankQueryDenomMetadata(ctx context.Context, denom string) (*banktypes.Metadata, error)

BankDenomMetadata fetches the metadata of a specific coin denomination.

func (*Thorchain) BankQueryDenomMetadataByQueryString

func (c *Thorchain) BankQueryDenomMetadataByQueryString(ctx context.Context, denom string) (*banktypes.Metadata, error)

func (*Thorchain) BankQueryDenomOwners

func (c *Thorchain) BankQueryDenomOwners(ctx context.Context, denom string) ([]*banktypes.DenomOwner, error)

func (*Thorchain) BankQueryDenomsMetadata

func (c *Thorchain) BankQueryDenomsMetadata(ctx context.Context) ([]banktypes.Metadata, error)

func (*Thorchain) BankQueryParams

func (c *Thorchain) BankQueryParams(ctx context.Context) (*banktypes.Params, error)

func (*Thorchain) BankQuerySendEnabled

func (c *Thorchain) BankQuerySendEnabled(ctx context.Context, denoms []string) ([]*banktypes.SendEnabled, error)

func (*Thorchain) BankQuerySpendableBalance

func (c *Thorchain) BankQuerySpendableBalance(ctx context.Context, address, denom string) (*types.Coin, error)

func (*Thorchain) BankQuerySpendableBalances

func (c *Thorchain) BankQuerySpendableBalances(ctx context.Context, address string) (*types.Coins, error)

func (*Thorchain) BankQueryTotalSupply

func (c *Thorchain) BankQueryTotalSupply(ctx context.Context) (*types.Coins, error)

func (*Thorchain) BankQueryTotalSupplyOf

func (c *Thorchain) BankQueryTotalSupplyOf(ctx context.Context, address string) (*types.Coin, error)

func (*Thorchain) BuildRelayerWallet

func (c *Thorchain) BuildRelayerWallet(ctx context.Context, keyName string) (ibc.Wallet, error)

BuildRelayerWallet will return a Cosmos wallet populated with the mnemonic so that the wallet can be restored in the relayer node using the mnemonic. After it is built, that address is included in genesis with some funds.

func (*Thorchain) BuildWallet

func (c *Thorchain) BuildWallet(ctx context.Context, keyName string, mnemonic string) (ibc.Wallet, error)

BuildWallet will return a Cosmos wallet If mnemonic != "", it will restore using that mnemonic If mnemonic == "", it will create a new key.

func (*Thorchain) Config

func (c *Thorchain) Config() ibc.ChainConfig

Implements Chain interface.

func (*Thorchain) ConvertAssetAmount

func (c *Thorchain) ConvertAssetAmount(ctx context.Context, coin Coin, asset string) (sdkmath.Uint, error)

ConvertAssetAmount converts the given coin to the target asset and returns the amount.

func (*Thorchain) CreateKey

func (c *Thorchain) CreateKey(ctx context.Context, keyName string) error

Implements Chain interface.

func (*Thorchain) Deposit

func (c *Thorchain) Deposit(ctx context.Context, keyName string, amount math.Int, denom string, memo string) error

func (*Thorchain) Exec

func (c *Thorchain) Exec(ctx context.Context, cmd []string, env []string) (stdout, stderr []byte, err error)

Exec implements ibc.Chain.

func (*Thorchain) ExportState

func (c *Thorchain) ExportState(ctx context.Context, height int64) (string, error)

ExportState exports the chain state at specific height. Implements Chain interface.

func (*Thorchain) FindTxs

func (c *Thorchain) FindTxs(ctx context.Context, height int64) ([]blockdb.Tx, error)

FindTxs implements blockdb.BlockSaver.

func (*Thorchain) GetAPIAddress

func (c *Thorchain) GetAPIAddress() string

Implements Chain interface.

func (*Thorchain) GetAddress

func (c *Thorchain) GetAddress(ctx context.Context, keyName string) ([]byte, error)

Implements Chain interface.

func (*Thorchain) GetBalance

func (c *Thorchain) GetBalance(ctx context.Context, address string, denom string) (sdkmath.Int, error)

GetBalance fetches the current balance for a specific account address and denom. Implements Chain interface.

func (*Thorchain) GetCodec

func (c *Thorchain) GetCodec() *codec.ProtoCodec

GetCodec returns the codec for the chain.

func (*Thorchain) GetGRPCAddress

func (c *Thorchain) GetGRPCAddress() string

Implements Chain interface.

func (*Thorchain) GetGasFeesInNativeDenom

func (c *Thorchain) GetGasFeesInNativeDenom(gasPaid int64) int64

func (*Thorchain) GetHostAPIAddress

func (c *Thorchain) GetHostAPIAddress() string

GetHostAPIAddress returns the address of the REST API server accessible by the host. This will not return a valid address until the chain has been started.

func (*Thorchain) GetHostGRPCAddress

func (c *Thorchain) GetHostGRPCAddress() string

GetHostGRPCAddress returns the address of the gRPC server accessible by the host. This will not return a valid address until the chain has been started.

func (*Thorchain) GetHostPeerAddress

func (c *Thorchain) GetHostPeerAddress() string

GetHostP2PAddress returns the address of the P2P server accessible by the host. This will not return a valid address until the chain has been started.

func (*Thorchain) GetHostRPCAddress

func (c *Thorchain) GetHostRPCAddress() string

GetHostRPCAddress returns the address of the RPC server accessible by the host. This will not return a valid address until the chain has been started.

func (*Thorchain) GetNode

func (c *Thorchain) GetNode() *ChainNode

func (*Thorchain) GetRPCAddress

func (c *Thorchain) GetRPCAddress() string

Implements Chain interface.

func (*Thorchain) GetTimeoutHeight

func (c *Thorchain) GetTimeoutHeight(ctx context.Context) (clienttypes.Height, error)

GetTimeoutHeight returns a timeout height of 1000 blocks above the current block height. This function should be used when the timeout is never expected to be reached.

func (*Thorchain) GetTransaction

func (c *Thorchain) GetTransaction(txhash string) (*types.TxResponse, error)

func (*Thorchain) Height

func (c *Thorchain) Height(ctx context.Context) (int64, error)

Height implements ibc.Chain.

func (*Thorchain) HomeDir

func (c *Thorchain) HomeDir() string

HomeDir implements ibc.Chain.

func (*Thorchain) Initialize

func (c *Thorchain) Initialize(ctx context.Context, testName string, cli *client.Client, networkID string) error

Implements Chain interface.

func (*Thorchain) NewChainNode

func (c *Thorchain) NewChainNode(
	ctx context.Context,
	testName string,
	cli *client.Client,
	networkID string,
	image ibc.DockerImage,
	validator bool,
	index int,
) (*ChainNode, error)

NewChainNode constructs a new cosmos chain node with a docker volume.

func (*Thorchain) NewSidecarProcess

func (c *Thorchain) NewSidecarProcess(
	ctx context.Context,
	preStart bool,
	processName string,
	testName string,
	cli *client.Client,
	networkID string,
	image ibc.DockerImage,
	homeDir string,
	index int,
	ports []string,
	startCmd []string,
	env []string,
) error

NewSidecarProcess constructs a new sidecar process with a docker volume.

func (*Thorchain) Nodes

func (c *Thorchain) Nodes() ChainNodes

Nodes returns all nodes, including validators and fullnodes.

func (*Thorchain) QueryBankMetadata

func (c *Thorchain) QueryBankMetadata(ctx context.Context, denom string) (*BankMetaData, error)

QueryBankMetadata returns the metadata of a given token denomination.

func (*Thorchain) QueryParam

func (c *Thorchain) QueryParam(ctx context.Context, subspace, key string) (*ParamChange, error)

QueryParam returns the param state of a given key.

func (*Thorchain) RecoverKey

func (c *Thorchain) RecoverKey(ctx context.Context, keyName, mnemonic string) error

Implements Chain interface.

func (*Thorchain) SendFunds

func (c *Thorchain) SendFunds(ctx context.Context, keyName string, amount ibc.WalletAmount) error

Implements Chain interface.

func (*Thorchain) SendFundsWithNote

func (c *Thorchain) SendFundsWithNote(ctx context.Context, keyName string, amount ibc.WalletAmount, note string) (string, error)

Implements Chain interface.

func (*Thorchain) SendIBCTransfer

func (c *Thorchain) SendIBCTransfer(
	ctx context.Context,
	channelID string,
	keyName string,
	amount ibc.WalletAmount,
	options ibc.TransferOptions,
) (tx ibc.Tx, _ error)

Implements Chain interface.

func (*Thorchain) SetMimir

func (c *Thorchain) SetMimir(ctx context.Context, keyName string, key string, value string) error

func (*Thorchain) Start

func (c *Thorchain) Start(testName string, ctx context.Context, additionalGenesisWallets ...ibc.WalletAmount) error

Bootstraps the chain and starts it from genesis.

func (*Thorchain) StartAllNodes

func (c *Thorchain) StartAllNodes(ctx context.Context) error

StartAllNodes creates and starts new containers for each node. Should only be used if the chain has previously been started with .Start.

func (*Thorchain) StartAllSidecars

func (c *Thorchain) StartAllSidecars(ctx context.Context) error

StartAllSidecars creates and starts new containers for each sidecar process. Should only be used if the chain has previously been started with .Start.

func (*Thorchain) StartAllValSidecars

func (c *Thorchain) StartAllValSidecars(ctx context.Context) error

StartAllValSidecars creates and starts new containers for each validator sidecar process. Should only be used if the chain has previously been started with .Start.

func (*Thorchain) StopAllNodes

func (c *Thorchain) StopAllNodes(ctx context.Context) error

StopAllNodes stops and removes all long running containers (validators and full nodes).

func (*Thorchain) StopAllSidecars

func (c *Thorchain) StopAllSidecars(ctx context.Context) error

StopAllSidecars stops and removes all long-running containers for sidecar processes.

func (*Thorchain) Timeouts

func (c *Thorchain) Timeouts(ctx context.Context, height int64) ([]ibc.PacketTimeout, error)

Timeouts implements ibc.Chain, returning all timeouts in block at height.

func (*Thorchain) WithPreStartNodes

func (c *Thorchain) WithPreStartNodes(preStartNodes func(*Thorchain))

WithPreStartNodes sets the preStartNodes function.

type Tx

type Tx struct {
	ID          *string `json:"id,omitempty"`
	Chain       *string `json:"chain,omitempty"`
	FromAddress *string `json:"from_address,omitempty"`
	ToAddress   *string `json:"to_address,omitempty"`
	Coins       []Coin  `json:"coins"`
	Gas         []Coin  `json:"gas"`
	Memo        *string `json:"memo,omitempty"`
}

Tx struct for Tx.

type TxDetailsResponse

type TxDetailsResponse struct {
	TxID    *string      `json:"tx_id,omitempty"`
	Tx      ObservedTx   `json:"tx"`
	Txs     []ObservedTx `json:"txs"`
	Actions []TxOutItem  `json:"actions"`
	OutTxs  []Tx         `json:"out_txs"`
	// the thorchain height at which the inbound reached consensus
	ConsensusHeight *int64 `json:"consensus_height,omitempty"`
	// the thorchain height at which the outbound was finalised
	FinalisedHeight *int64 `json:"finalised_height,omitempty"`
	UpdatedVault    *bool  `json:"updated_vault,omitempty"`
	Reverted        *bool  `json:"reverted,omitempty"`
	// the thorchain height for which the outbound was scheduled
	OutboundHeight *int64 `json:"outbound_height,omitempty"`
}

TxDetailsResponse struct for TxDetailsResponse.

type TxOutItem

type TxOutItem struct {
	Chain       string  `json:"chain"`
	ToAddress   string  `json:"to_address"`
	VaultPubKey *string `json:"vault_pub_key,omitempty"`
	Coin        Coin    `json:"coin"`
	Memo        *string `json:"memo,omitempty"`
	MaxGas      []Coin  `json:"max_gas"`
	GasRate     *int64  `json:"gas_rate,omitempty"`
	InHash      *string `json:"in_hash,omitempty"`
	OutHash     *string `json:"out_hash,omitempty"`
	Height      *int64  `json:"height,omitempty"`
	// clout spent in RUNE for the outbound
	CloutSpent *string `json:"clout_spent,omitempty"`
}

TxOutItem struct for TxOutItem.

type TxStagesResponse

type TxStagesResponse struct {
	InboundObserved            InboundObservedStage             `json:"inbound_observed"`
	InboundConfirmationCounted *InboundConfirmationCountedStage `json:"inbound_confirmation_counted,omitempty"`
	InboundFinalised           *InboundFinalisedStage           `json:"inbound_finalised,omitempty"`
	SwapStatus                 *SwapStatus                      `json:"swap_status,omitempty"`
	SwapFinalised              *SwapFinalisedStage              `json:"swap_finalised,omitempty"`
	OutboundDelay              *OutboundDelayStage              `json:"outbound_delay,omitempty"`
	OutboundSigned             *OutboundSignedStage             `json:"outbound_signed,omitempty"`
}

TxStagesResponse struct for TxStagesResponse.

type User

type User interface {
	KeyName() string
	FormattedAddress() string
}

type ValidatorWithIntPower

type ValidatorWithIntPower struct {
	Address string
	Power   int64
	PubKey  string
}

type VersionOutput

type VersionOutput struct {
	Version string `json:"version"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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