Documentation ¶
Index ¶
- Constants
- Variables
- func NewIconChain(t *testing.T, ctx context.Context, environment string, ...) (chains.Chain, error)
- func NewIconLocalnet(testName string, log *zap.Logger, chainConfig ibc.ChainConfig, ...) chains.Chain
- func NewWallet(keyname string, address []byte, mnemonic string, chainCfg ibc.ChainConfig) ibc.Wallet
- type IconLocalnet
- func (c *IconLocalnet) Acknowledgements(ctx context.Context, height uint64) ([]ibc.PacketAcknowledgement, error)
- func (c *IconLocalnet) BuildRelayerWallet(ctx context.Context, keyName string) (ibc.Wallet, error)
- func (c *IconLocalnet) BuildWallet(ctx context.Context, keyName string, mnemonic string) (ibc.Wallet, error)
- func (c *IconLocalnet) BuildWallets(ctx context.Context, keyName string) error
- func (c *IconLocalnet) CheckForKeyStore(ctx context.Context, keyName string) string
- func (c *IconLocalnet) Config() ibc.ChainConfig
- func (c *IconLocalnet) ConfigureBaseConnection(ctx context.Context, connection chains.XCallConnection) (context.Context, error)
- func (c *IconLocalnet) CreateKey(ctx context.Context, password string) error
- func (c *IconLocalnet) DeployContract(ctx context.Context, keyName string) (context.Context, error)
- func (c *IconLocalnet) DeployXCallMockApp(ctx context.Context, connection chains.XCallConnection) error
- func (c *IconLocalnet) EOAXCall(ctx context.Context, targetChain chains.Chain, keyName, _to string, ...) (string, string, string, error)
- func (c *IconLocalnet) Exec(ctx context.Context, cmd []string, env []string) (stdout []byte, stderr []byte, err error)
- func (c *IconLocalnet) ExecuteCall(ctx context.Context, reqId, data string) (context.Context, error)
- func (c *IconLocalnet) ExecuteContract(ctx context.Context, contractAddress, keyName, methodName, param string) (context.Context, error)
- func (c *IconLocalnet) ExecuteRollback(ctx context.Context, sn string) (context.Context, error)
- func (c *IconLocalnet) ExportState(ctx context.Context, height int64) (string, error)
- func (c *IconLocalnet) FindCallMessage(ctx context.Context, startHeight int64, from, to, sn string) (string, string, error)
- func (c *IconLocalnet) FindCallResponse(ctx context.Context, startHeight int64, sn string) (string, string, error)
- func (c *IconLocalnet) FindEvent(ctx context.Context, startHeight int64, contract, signature string, ...) (*icontypes.EventNotification, error)
- func (c *IconLocalnet) FindTxs(ctx context.Context, height uint64) ([]blockdb.Tx, error)
- func (c *IconLocalnet) GetAddress(ctx context.Context, keyName string) ([]byte, error)
- func (c *IconLocalnet) GetBalance(ctx context.Context, address string, denom string) (int64, error)
- func (c *IconLocalnet) GetBlockByHeight(ctx context.Context) (context.Context, error)
- func (c *IconLocalnet) GetExecuteParam(ctx context.Context, methodName, params string) (context.Context, string, string)
- func (c *IconLocalnet) GetGRPCAddress() string
- func (c *IconLocalnet) GetGasFeesInNativeDenom(gasPaid int64) int64
- func (c *IconLocalnet) GetHostGRPCAddress() string
- func (c *IconLocalnet) GetHostRPCAddress() string
- func (c *IconLocalnet) GetIBCAddress(key string) string
- func (c *IconLocalnet) GetLastBlock(ctx context.Context) (context.Context, error)
- func (c *IconLocalnet) GetQueryParam(methodName string) string
- func (c *IconLocalnet) GetRPCAddress() string
- func (c *IconLocalnet) Height(ctx context.Context) (uint64, error)
- func (c *IconLocalnet) HomeDir() string
- func (c *IconLocalnet) Initialize(ctx context.Context, testName string, cli *client.Client, networkID string) error
- func (c *IconLocalnet) NewChainNode(ctx context.Context, testName string, cli *client.Client, networkID string, ...) (*IconNode, error)
- func (c *IconLocalnet) OverrideConfig(key string, value any)
- func (c *IconLocalnet) QueryContract(ctx context.Context, contractAddress, methodName, params string) (context.Context, error)
- func (c *IconLocalnet) RecoverKey(ctx context.Context, name string, mnemonic string) error
- func (c *IconLocalnet) SendFunds(ctx context.Context, keyName string, amount ibc.WalletAmount) error
- func (c *IconLocalnet) SendIBCTransfer(ctx context.Context, channelID string, keyName string, amount ibc.WalletAmount, ...) (ibc.Tx, error)
- func (c *IconLocalnet) SetAdminParams(ctx context.Context, methodaName, keyName string) (context.Context, string, string)
- func (c *IconLocalnet) SetupIBC(ctx context.Context, keyName string) (context.Context, error)
- func (c *IconLocalnet) SetupXCall(ctx context.Context, portId string, keyName string) error
- func (c *IconLocalnet) Start(testName string, ctx context.Context, ...) error
- func (c *IconLocalnet) Timeouts(ctx context.Context, height uint64) ([]ibc.PacketTimeout, error)
- func (c *IconLocalnet) UpdateAdminParams(ctx context.Context, methodaName, keyName string) (context.Context, string, string)
- func (c *IconLocalnet) XCall(ctx context.Context, targetChain chains.Chain, keyName, _to string, ...) (string, string, string, error)
- type IconNode
- func (in *IconNode) BinCommand(command ...string) []string
- func (in *IconNode) Bind() []string
- func (tn *IconNode) CopyFile(ctx context.Context, srcPath, dstPath string) error
- func (in *IconNode) CreateKey(ctx context.Context, password string) error
- func (in *IconNode) CreateNodeContainer(ctx context.Context) error
- func (in *IconNode) DeployContract(ctx context.Context, scorePath, keystorePath, initMessage string) (string, error)
- func (in *IconNode) Exec(ctx context.Context, cmd []string, env []string) ([]byte, []byte, error)
- func (in *IconNode) ExecBin(ctx context.Context, command ...string) ([]byte, []byte, error)
- func (in *IconNode) ExecCallTx(ctx context.Context, scoreAddress, methodName, keystorePath, params string) (string, error)
- func (in *IconNode) ExecCallTxCommand(ctx context.Context, scoreAddress, methodName, keystorePath, params string) []string
- func (in *IconNode) ExecTx(ctx context.Context, initMessage string, filePath string, keystorePath string, ...) (string, error)
- func (in *IconNode) ExecuteContract(ctx context.Context, scoreAddress, methodName, keyStorePath, params string) (string, error)
- func (in *IconNode) FindTxs(ctx context.Context, height uint64) ([]blockdb.Tx, error)
- func (in *IconNode) GetBalance(ctx context.Context, address string) (int64, error)
- func (in *IconNode) GetBlockByHeight(ctx context.Context, height int64) (string, error)
- func (in *IconNode) Height(ctx context.Context) (uint64, error)
- func (in *IconNode) HomeDir() string
- func (in *IconNode) HostName() string
- func (in *IconNode) Name() string
- func (in *IconNode) NodeCommand(command ...string) []string
- func (in *IconNode) QueryContract(ctx context.Context, scoreAddress, methodName, params string) (string, error)
- func (in *IconNode) StartContainer(ctx context.Context) error
- func (in *IconNode) TransactionResult(ctx context.Context, hash string) (icontypes.TransactionResult, error)
- func (in *IconNode) TxCommand(ctx context.Context, initMessage, filePath, keystorePath string, ...) []string
- func (tn *IconNode) WriteFile(ctx context.Context, content []byte, relPath string) error
- type IconNodes
- type IconWallet
Constants ¶
const ( GOLOOP_IMAGE_ENV = "GOLOOP_IMAGE" GOLOOP_IMAGE = "iconloop/goloop-icon" GOLOOP_IMAGE_TAG_ENV = "GOLOOP_IMAGE_TAG" GOLOOP_IMAGE_TAG = "latest" )
Variables ¶
var ContainerEnvs = [9]string{
"GOCHAIN_CONFIG=/goloop/data/config.json",
"GOCHAIN_GENESIS=/goloop/data/genesis.json",
"GOCHAIN_DATA=/goloop/chain/iconee",
"GOCHAIN_LOGFILE=/goloop/chain/iconee.log",
"GOCHAIN_DB_TYPE=rocksdb",
"GOCHAIN_CLEAN_DATA=true",
"JAVAEE_BIN=/goloop/execman/bin/execman",
"PYEE_VERIFY_PACKAGE=true",
"ICON_CONFIG=/goloop/data/icon_config.json",
}
Functions ¶
func NewIconChain ¶
func NewIconLocalnet ¶
Types ¶
type IconLocalnet ¶
type IconLocalnet struct { FullNodes IconNodes IBCAddresses map[string]string // contains filtered or unexported fields }
func (*IconLocalnet) Acknowledgements ¶
func (c *IconLocalnet) Acknowledgements(ctx context.Context, height uint64) ([]ibc.PacketAcknowledgement, error)
Acknowledgements returns all acknowledgements in a block at height.
func (*IconLocalnet) BuildRelayerWallet ¶
BuildRelayerWallet will return a chain-specific 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 (*IconLocalnet) BuildWallet ¶
func (*IconLocalnet) BuildWallets ¶
func (c *IconLocalnet) BuildWallets(ctx context.Context, keyName string) error
func (*IconLocalnet) CheckForKeyStore ¶
func (c *IconLocalnet) CheckForKeyStore(ctx context.Context, keyName string) string
func (*IconLocalnet) Config ¶
func (c *IconLocalnet) Config() ibc.ChainConfig
Config fetches the chain configuration.
func (*IconLocalnet) ConfigureBaseConnection ¶
func (c *IconLocalnet) ConfigureBaseConnection(ctx context.Context, connection chains.XCallConnection) (context.Context, error)
func (*IconLocalnet) CreateKey ¶
func (c *IconLocalnet) CreateKey(ctx context.Context, password string) error
CreateKey creates a test key in the "user" node (either the first fullnode or the first validator if no fullnodes).
func (*IconLocalnet) DeployContract ¶
DeployContract implements chains.Chain
func (*IconLocalnet) DeployXCallMockApp ¶
func (c *IconLocalnet) DeployXCallMockApp(ctx context.Context, connection chains.XCallConnection) error
func (*IconLocalnet) Exec ¶
func (c *IconLocalnet) Exec(ctx context.Context, cmd []string, env []string) (stdout []byte, stderr []byte, err error)
Exec runs an arbitrary command using Chain's docker environment. Whether the invoked command is run in a one-off container or execing into an already running container is up to the chain implementation.
"env" are environment variables in the format "MY_ENV_VAR=value"
func (*IconLocalnet) ExecuteCall ¶
func (*IconLocalnet) ExecuteContract ¶
func (c *IconLocalnet) ExecuteContract(ctx context.Context, contractAddress, keyName, methodName, param string) (context.Context, error)
ExecuteContract implements chains.Chain
func (*IconLocalnet) ExecuteRollback ¶
func (*IconLocalnet) ExportState ¶
ExportState exports the chain state at specific height.
func (*IconLocalnet) FindCallMessage ¶
func (*IconLocalnet) FindCallResponse ¶
func (*IconLocalnet) FindEvent ¶
func (c *IconLocalnet) FindEvent(ctx context.Context, startHeight int64, contract, signature string, index []*string) (*icontypes.EventNotification, error)
func (*IconLocalnet) GetAddress ¶
GetAddress fetches the bech32 address for a test key on the "user" node (either the first fullnode or the first validator if no fullnodes).
func (*IconLocalnet) GetBalance ¶
GetBalance fetches the current balance for a specific account address and denom.
func (*IconLocalnet) GetBlockByHeight ¶
GetBlockByHeight implements chains.Chain
func (*IconLocalnet) GetExecuteParam ¶
func (*IconLocalnet) GetGRPCAddress ¶
func (c *IconLocalnet) GetGRPCAddress() string
GetGRPCAddress retrieves the grpc address that can be reached by other containers in the docker network. Not Applicable for Icon
func (*IconLocalnet) GetGasFeesInNativeDenom ¶
func (c *IconLocalnet) GetGasFeesInNativeDenom(gasPaid int64) int64
GetGasFeesInNativeDenom gets the fees in native denom for an amount of spent gas.
func (*IconLocalnet) GetHostGRPCAddress ¶
func (c *IconLocalnet) GetHostGRPCAddress() string
GetHostGRPCAddress returns the grpc address that can be reached by processes on the host machine. Note that this will not return a valid value until after Start returns. Not applicable for Icon
func (*IconLocalnet) GetHostRPCAddress ¶
func (c *IconLocalnet) GetHostRPCAddress() string
GetHostRPCAddress returns the rpc address that can be reached by processes on the host machine. Note that this will not return a valid value until after Start returns.
func (*IconLocalnet) GetIBCAddress ¶
func (c *IconLocalnet) GetIBCAddress(key string) string
func (*IconLocalnet) GetLastBlock ¶
GetLastBlock implements chains.Chain
func (*IconLocalnet) GetQueryParam ¶
func (c *IconLocalnet) GetQueryParam(methodName string) string
func (*IconLocalnet) GetRPCAddress ¶
func (c *IconLocalnet) GetRPCAddress() string
GetRPCAddress retrieves the rpc address that can be reached by other containers in the docker network.
func (*IconLocalnet) Height ¶
func (c *IconLocalnet) Height(ctx context.Context) (uint64, error)
Height returns the current block height or an error if unable to get current height.
func (*IconLocalnet) HomeDir ¶
func (c *IconLocalnet) HomeDir() string
HomeDir is the home directory of a node running in a docker container. Therefore, this maps to the container's filesystem (not the host).
func (*IconLocalnet) Initialize ¶
func (c *IconLocalnet) Initialize(ctx context.Context, testName string, cli *client.Client, networkID string) error
Initialize initializes node structs so that things like initializing keys can be done before starting the chain
func (*IconLocalnet) NewChainNode ¶
func (*IconLocalnet) OverrideConfig ¶
func (c *IconLocalnet) OverrideConfig(key string, value any)
func (*IconLocalnet) QueryContract ¶
func (c *IconLocalnet) QueryContract(ctx context.Context, contractAddress, methodName, params string) (context.Context, error)
QueryContract implements chains.Chain
func (*IconLocalnet) RecoverKey ¶
RecoverKey recovers an existing user from a given mnemonic.
func (*IconLocalnet) SendFunds ¶
func (c *IconLocalnet) SendFunds(ctx context.Context, keyName string, amount ibc.WalletAmount) error
SendFunds sends funds to a wallet from a user account.
func (*IconLocalnet) SendIBCTransfer ¶
func (c *IconLocalnet) SendIBCTransfer(ctx context.Context, channelID string, keyName string, amount ibc.WalletAmount, options ibc.TransferOptions) (ibc.Tx, error)
SendIBCTransfer sends an IBC transfer returning a transaction or an error if the transfer failed.
func (*IconLocalnet) SetAdminParams ¶
func (*IconLocalnet) SetupXCall ¶
func (*IconLocalnet) Start ¶
func (c *IconLocalnet) Start(testName string, ctx context.Context, additionalGenesisWallets ...ibc.WalletAmount) error
Start sets up everything needed (validators, gentx, fullnodes, peering, additional accounts) for chain to start from genesis.
func (*IconLocalnet) Timeouts ¶
func (c *IconLocalnet) Timeouts(ctx context.Context, height uint64) ([]ibc.PacketTimeout, error)
Timeouts returns all timeouts in a block at height.
func (*IconLocalnet) UpdateAdminParams ¶
type IconNode ¶
type IconNode struct { VolumeName string Index int Chain ibc.Chain NetworkID string DockerClient *dockerclient.Client Client iconclient.Client TestName string Image ibc.DockerImage ContainerID string // Ports set during StartContainer. HostRPCPort string Validator bool Address string // contains filtered or unexported fields }
func (*IconNode) BinCommand ¶
func (*IconNode) CopyFile ¶
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 (*IconNode) CreateNodeContainer ¶
Create Node Container with ports exposed and published for host to communicate with
func (*IconNode) DeployContract ¶
func (*IconNode) ExecCallTx ¶
func (*IconNode) ExecCallTxCommand ¶
func (*IconNode) ExecTx ¶
func (in *IconNode) ExecTx(ctx context.Context, initMessage string, filePath string, keystorePath string, command ...string) (string, error)
ExecTx executes a transaction, waits for 2 blocks if successful, then returns the tx hash.
func (*IconNode) ExecuteContract ¶
func (*IconNode) GetBalance ¶
func (*IconNode) GetBlockByHeight ¶
func (*IconNode) NodeCommand ¶
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 (*IconNode) QueryContract ¶
func (*IconNode) TransactionResult ¶
func (in *IconNode) TransactionResult(ctx context.Context, hash string) (icontypes.TransactionResult, error)
Get Transaction result when hash is provided after executing a transaction
func (*IconNode) TxCommand ¶
func (in *IconNode) TxCommand(ctx context.Context, initMessage, filePath, keystorePath string, command ...string) []string
TxCommand is a helper to retrieve a full command for broadcasting a tx with the chain node binary.
type IconWallet ¶
type IconWallet struct {
// contains filtered or unexported fields
}
func (*IconWallet) FormattedAddress ¶
func (w *IconWallet) FormattedAddress() string
Get formatted address, passing in a prefix
func (*IconWallet) FormattedAddressWithPrefix ¶
func (w *IconWallet) FormattedAddressWithPrefix(prefix string) string
func (*IconWallet) KeyName ¶
func (w *IconWallet) KeyName() string
func (*IconWallet) Mnemonic ¶
func (w *IconWallet) Mnemonic() string
Get mnemonic, only used for relayer wallets