Documentation ¶
Index ¶
- Constants
- Variables
- func MakeCodec() *codec.ProtoCodec
- 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
- func RegisterInterfaces(registry codectypes.InterfaceRegistry)
- type DebugTrace
- type IconLocalnet
- func (c *IconLocalnet) Acknowledgements(ctx context.Context, height uint64) ([]ibc.PacketAcknowledgement, error)
- func (c *IconLocalnet) BackupConfig() ([]byte, 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) (ibc.Wallet, error)
- func (c *IconLocalnet) CheckForKeyStore(ctx context.Context, keyName string) ibc.Wallet
- func (c *IconLocalnet) CheckForTimeout(ctx context.Context, target chains.Chain, params map[string]interface{}, ...) (context.Context, error)
- 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, keyName 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 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 uint64, from, to, sn string) (string, string, error)
- func (c *IconLocalnet) FindCallResponse(ctx context.Context, startHeight uint64, sn string) (string, error)
- func (c *IconLocalnet) FindEvent(ctx context.Context, startHeight uint64, contract, signature string, ...) (*icontypes.EventNotification, error)
- func (c *IconLocalnet) FindTargetXCallMessage(ctx context.Context, target chains.Chain, height uint64, to string) (*chains.XCallResponse, 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) GetChannel(ctx context.Context, channelSuffix int, portID string) (*chantypes.Channel, error)
- func (c *IconLocalnet) GetClientName(suffix int) string
- func (c *IconLocalnet) GetClientState(ctx context.Context, clientSuffix int) (any, error)
- func (c *IconLocalnet) GetClientsCount(ctx context.Context) (int, error)
- func (c *IconLocalnet) GetConnectionState(ctx context.Context, clientSuffix int) (*conntypes.ConnectionEnd, error)
- 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) GetNextChannelSequence(ctx context.Context) (int, error)
- func (c *IconLocalnet) GetNextConnectionSequence(ctx context.Context) (int, error)
- func (c *IconLocalnet) GetQueryParam(method string, params map[string]interface{}) Query
- func (c *IconLocalnet) GetRPCAddress() string
- func (c *IconLocalnet) Height(ctx context.Context) (uint64, error)
- func (c *IconLocalnet) HomeDir() string
- func (c *IconLocalnet) InitEventListener(ctx context.Context, contract string) chains.EventListener
- func (c *IconLocalnet) Initialize(ctx context.Context, testName string, cli *client.Client, networkID string) error
- func (c *IconLocalnet) IsPacketReceived(ctx context.Context, params map[string]interface{}, order ibc.Order) bool
- 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) PauseNode(ctx context.Context) error
- func (c *IconLocalnet) PreGenesis() error
- func (c *IconLocalnet) QueryContract(ctx context.Context, contractAddress, methodName string, ...) (context.Context, error)
- func (c *IconLocalnet) RecoverKey(ctx context.Context, name string, mnemonic string) error
- func (c *IconLocalnet) RestoreConfig(backup []byte) 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) SendPacketMockDApp(ctx context.Context, targetChain chains.Chain, keyName string, ...) (chains.PacketTransferResponse, error)
- func (c *IconLocalnet) SendPacketXCall(ctx context.Context, keyName, _to string, data, rollback []byte) (context.Context, 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) UnpauseNode(ctx context.Context) 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, ...) (*chains.XCallResponse, error)
- type IconNode
- func (in *IconNode) BinCommand(command ...string) []string
- func (in *IconNode) Bind() []string
- func (in *IconNode) CopyConfig(ctx context.Context, err error, cc container.CreateResponse)
- func (tn *IconNode) CopyFile(ctx context.Context, srcPath, dstPath string) error
- func (in *IconNode) CopyFileToContainer(ctx context.Context, content []byte, containerID, target string) error
- func (in *IconNode) CreateNodeContainer(ctx context.Context, additionalGenesisWallets ...ibc.WalletAmount) 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) GetDebugTrace(ctx context.Context, hash icontypes.HexBytes) (*DebugTrace, 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) ([]byte, error)
- func (in *IconNode) RestoreKeystore(ctx context.Context, ks []byte, keyName 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
- type Query
- type Value
- type WebSocketListener
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 MakeCodec ¶
func MakeCodec() *codec.ProtoCodec
func NewIconChain ¶
func NewIconLocalnet ¶
func RegisterInterfaces ¶
func RegisterInterfaces(registry codectypes.InterfaceRegistry)
Types ¶
type DebugTrace ¶
type IconLocalnet ¶
type IconLocalnet struct { FullNodes IconNodes IBCAddresses map[string]string `json:"addresses"` Wallets map[string]ibc.Wallet `json:"wallets"` // 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) BackupConfig ¶
func (c *IconLocalnet) BackupConfig() ([]byte, error)
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 (*IconLocalnet) CheckForKeyStore ¶
func (*IconLocalnet) CheckForTimeout ¶
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, keyName string) error
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 (*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 uint64, contract, signature string, index []*string) (*icontypes.EventNotification, error)
func (*IconLocalnet) FindTargetXCallMessage ¶
func (c *IconLocalnet) FindTargetXCallMessage(ctx context.Context, target chains.Chain, height uint64, to string) (*chains.XCallResponse, error)
FindTargetXCallMessage returns the request id and the data of the message sent to the target chain
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) GetChannel ¶
func (*IconLocalnet) GetClientName ¶
func (c *IconLocalnet) GetClientName(suffix int) string
func (*IconLocalnet) GetClientState ¶
func (*IconLocalnet) GetClientsCount ¶
func (c *IconLocalnet) GetClientsCount(ctx context.Context) (int, error)
GetClientsCount returns the next sequence number for the client
func (*IconLocalnet) GetConnectionState ¶
func (c *IconLocalnet) GetConnectionState(ctx context.Context, clientSuffix int) (*conntypes.ConnectionEnd, error)
GetConnectionState returns the next sequence number for the client
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) GetNextChannelSequence ¶
func (c *IconLocalnet) GetNextChannelSequence(ctx context.Context) (int, error)
GetNextChannelSequence returns the next sequence number for the client
func (*IconLocalnet) GetNextConnectionSequence ¶
func (c *IconLocalnet) GetNextConnectionSequence(ctx context.Context) (int, error)
GetNextConnectionSequence returns the next sequence number for the client
func (*IconLocalnet) GetQueryParam ¶
func (c *IconLocalnet) GetQueryParam(method string, params map[string]interface{}) Query
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) InitEventListener ¶
func (c *IconLocalnet) InitEventListener(ctx context.Context, contract string) chains.EventListener
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) IsPacketReceived ¶
func (c *IconLocalnet) IsPacketReceived(ctx context.Context, params map[string]interface{}, order ibc.Order) bool
HasPacketReceipt returns the receipt of the packet sent to the target chain
func (*IconLocalnet) NewChainNode ¶
func (*IconLocalnet) OverrideConfig ¶
func (c *IconLocalnet) OverrideConfig(key string, value any)
func (*IconLocalnet) PauseNode ¶
func (c *IconLocalnet) PauseNode(ctx context.Context) error
PauseNode pauses the node
func (*IconLocalnet) PreGenesis ¶
func (c *IconLocalnet) PreGenesis() error
func (*IconLocalnet) QueryContract ¶
func (c *IconLocalnet) QueryContract(ctx context.Context, contractAddress, methodName string, params map[string]interface{}) (context.Context, error)
QueryContract implements chains.Chain
func (*IconLocalnet) RecoverKey ¶
RecoverKey recovers an existing user from a given mnemonic.
func (*IconLocalnet) RestoreConfig ¶
func (c *IconLocalnet) RestoreConfig(backup []byte) error
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) SendPacketMockDApp ¶
func (c *IconLocalnet) SendPacketMockDApp(ctx context.Context, targetChain chains.Chain, keyName string, params map[string]interface{}) (chains.PacketTransferResponse, error)
func (*IconLocalnet) SendPacketXCall ¶
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) UnpauseNode ¶
func (c *IconLocalnet) UnpauseNode(ctx context.Context) error
UnpauseNode starts the paused node
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) CopyConfig ¶ added in v1.1.0
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) CopyFileToContainer ¶
func (*IconNode) CreateNodeContainer ¶
func (in *IconNode) CreateNodeContainer(ctx context.Context, additionalGenesisWallets ...ibc.WalletAmount) error
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) GetDebugTrace ¶
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) RestoreKeystore ¶
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
type WebSocketListener ¶
type WebSocketListener struct { Shutdown chan struct{} Events []map[string][]string // contains filtered or unexported fields }
func NewIconEventListener ¶
func NewIconEventListener(c *IconLocalnet, contract string) *WebSocketListener
func (*WebSocketListener) Start ¶
func (w *WebSocketListener) Start()
func (*WebSocketListener) Stop ¶
func (w *WebSocketListener) Stop()