Documentation
¶
Index ¶
- type App
- func (a *App) AddChainConfig(chainName string, filePath string) error
- func (a *App) AddKeyByMnemonic(chainName string, keyName string, mnemonic string, coinType uint32, ...) (*chainstypes.Key, error)
- func (a *App) AddKeyByPrivateKey(chainName string, keyName string, privateKey string) (*chainstypes.Key, error)
- func (a *App) DeleteChainConfig(chainName string) error
- func (a *App) DeleteKey(chainName string, keyName string) error
- func (a *App) ExportKey(chainName string, keyName string) (string, error)
- func (a *App) GetChainConfig(chainName string) (chains.ChainProviderConfig, error)
- func (a *App) Init(ctx context.Context) error
- func (a *App) ListKeys(chainName string) ([]*chainstypes.Key, error)
- func (a *App) QueryBalance(ctx context.Context, chainName string, keyName string) (*big.Int, error)
- func (a *App) QueryTunnelInfo(ctx context.Context, tunnelID uint64) (*types.Tunnel, error)
- func (a *App) QueryTunnelPacketInfo(ctx context.Context, tunnelID uint64, sequence uint64) (*bandtypes.Packet, error)
- func (a *App) Relay(ctx context.Context, tunnelID uint64) error
- func (a *App) SaveConfig(cfg *config.Config) error
- func (a *App) SavePassphrase(passphrase string) error
- func (a *App) ShowKey(chainName string, keyName string) (string, error)
- func (a *App) Start(ctx context.Context, tunnelIDs []uint64) error
- type Scheduler
- type Task
- type TunnelRelayer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
Log *zap.Logger
Debug bool
Config *config.Config
Store store.Store
TargetChains chains.ChainProviders
BandClient band.Client
Passphrase string
}
App is the main application struct.
func NewApp ¶
func NewApp( log *zap.Logger, debug bool, config *config.Config, passphrase string, store store.Store, ) *App
NewApp creates a new App instance.
func (*App) AddChainConfig ¶
AddChainConfig adds a new chain configuration to the config file.
func (*App) AddKeyByMnemonic ¶
func (a *App) AddKeyByMnemonic( chainName string, keyName string, mnemonic string, coinType uint32, account uint, index uint, ) (*chainstypes.Key, error)
AddKeyByMnemonic adds a new key to the chain provider using a mnemonic phrase.
func (*App) AddKeyByPrivateKey ¶
func (a *App) AddKeyByPrivateKey(chainName string, keyName string, privateKey string) (*chainstypes.Key, error)
AddKeyByPrivateKey adds a new key to the chain provider using a private key.
func (*App) DeleteChainConfig ¶
DeleteChainConfig deletes the chain configuration from the config file.
func (*App) GetChainConfig ¶
func (a *App) GetChainConfig(chainName string) (chains.ChainProviderConfig, error)
GetChainConfig retrieves the chain configuration by given chain name.
func (*App) ListKeys ¶
func (a *App) ListKeys(chainName string) ([]*chainstypes.Key, error)
ListKeys retrieves the list of keys from the chain provider.
func (*App) QueryBalance ¶
QueryBalance retrieves the balance of the key from the chain provider.
func (*App) QueryTunnelInfo ¶
QueryTunnelInfo queries tunnel information by given tunnel ID
func (*App) QueryTunnelPacketInfo ¶
func (a *App) QueryTunnelPacketInfo(ctx context.Context, tunnelID uint64, sequence uint64) (*bandtypes.Packet, error)
QueryTunnelPacketInfo queries tunnel packet information by given tunnel ID
func (*App) SaveConfig ¶
SaveConfig saves the configuration into the application's store.
func (*App) SavePassphrase ¶
SavePassphrase hash the provided passphrase and save it into the application's store.
type Scheduler ¶
type Scheduler struct {
Log *zap.Logger
CheckingPacketInterval time.Duration
SyncTunnelsInterval time.Duration
PenaltySkipRounds uint
BandClient band.Client
ChainProviders chains.ChainProviders
// contains filtered or unexported fields
}
Scheduler is a struct to manage all tunnel relayers
func NewScheduler ¶
func NewScheduler( log *zap.Logger, checkingPacketInterval time.Duration, syncTunnelsInterval time.Duration, penaltySkipRounds uint, bandClient band.Client, chainProviders chains.ChainProviders, ) *Scheduler
NewScheduler creates a new Scheduler
func (*Scheduler) SyncTunnels ¶
SyncTunnels synchronizes the Bandchain's tunnels with the latest tunnels.
type TunnelRelayer ¶
type TunnelRelayer struct {
Log *zap.Logger
TunnelID uint64
CheckingPacketInterval time.Duration
BandClient band.Client
TargetChainProvider chains.ChainProvider
// contains filtered or unexported fields
}
TunnelRelayer is a relayer that listens to the tunnel and relays the packet
func NewTunnelRelayer ¶
func NewTunnelRelayer( log *zap.Logger, tunnelID uint64, checkingPacketInterval time.Duration, bandClient band.Client, targetChainProvider chains.ChainProvider, ) TunnelRelayer
NewTunnelRelayer creates a new TunnelRelayer
func (*TunnelRelayer) CheckAndRelay ¶
func (t *TunnelRelayer) CheckAndRelay(ctx context.Context) (isExecuting bool, err error)
CheckAndRelay checks the tunnel and relays the packet