config

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load[T any](configPaths []string, envPrefix string) (*T, error)

Types

type ArbitrumBlockchain

type ArbitrumBlockchain struct {
	Enabled bool   `json:"enabled" default:"false"`
	Network string `yaml:"network" json:"network" validate:"required,oneof=mainnet testnet" default:"mainnet" example:"mainnet / testnet"`
	Node    struct {
		Address string `json:"address" yaml:"address" usage:"node address"`
	}
	Attributes struct {
		MaxGasPrice float64 `yaml:"max_gas_price" json:"max_gas_price" validate:"gte=0" default:"1" usage:"max gas price in Gwei"`
	}
}

func (ArbitrumBlockchain) GetMaxGasFee

func (s ArbitrumBlockchain) GetMaxGasFee() float64

GetMaxGassFee returns the max gas fee in Gwei

func (ArbitrumBlockchain) IsEnabled

func (s ArbitrumBlockchain) IsEnabled() bool

IsEnabled returns true if the blockchain is enabled

func (ArbitrumBlockchain) Validate

func (s ArbitrumBlockchain) Validate() error

Validate

type BinanceSmartChainBlockchain

type BinanceSmartChainBlockchain struct {
	Enabled bool   `json:"enabled" default:"false"`
	Network string `yaml:"network" json:"network" validate:"required,oneof=mainnet testnet" default:"mainnet" example:"mainnet / testnet"`
	Node    struct {
		Address string `json:"address" yaml:"address" usage:"node address"`
	}
	Attributes struct {
		MaxGasPrice float64 `yaml:"max_gas_price" json:"max_gas_price" validate:"gte=0" default:"3" usage:"max gas price in Gwei"`
	}
}

func (BinanceSmartChainBlockchain) GetMaxGasFee

func (s BinanceSmartChainBlockchain) GetMaxGasFee() float64

GetMaxGassFee returns the max gas fee in Gwei

func (BinanceSmartChainBlockchain) IsEnabled

func (s BinanceSmartChainBlockchain) IsEnabled() bool

IsEnabled returns true if the blockchain is enabled

func (BinanceSmartChainBlockchain) Validate

func (s BinanceSmartChainBlockchain) Validate() error

Validate

type BitcoinBlockchain

type BitcoinBlockchain struct {
	Enabled    bool   `json:"enabled" default:"false"`
	Network    string `yaml:"network" json:"network" validate:"required,oneof=mainnet testnet" default:"mainnet" example:"mainnet / testnet"`
	Attributes struct {
		FeePerByte    int64 `yaml:"fee_per_byte" json:"fee_per_byte" default:"7"`
		MinUTXOAmount int64 `yaml:"min_utxo_amount" json:"min_utxo_amount" default:"0" usage:"min UTXO amount in satoshi"`
	}
	Node struct {
		Address string `usage:"node address"`
		Login   string `yaml:"login" json:"login" secret:"true" usage:"node login"`
		Secret  string `secret:"true"`
		UseTLS  bool   `yaml:"use_tls" json:"use_tls" default:"true" usage:"use TLS for connection"`
	}
}

func (BitcoinBlockchain) ConvertToSDKConfig

func (s BitcoinBlockchain) ConvertToSDKConfig(identity constants.ProcessingIdentity) btc.Config

func (BitcoinBlockchain) Validate

func (s BitcoinBlockchain) Validate() error

type BitcoinCashBlockchain

type BitcoinCashBlockchain struct {
	Enabled    bool   `json:"enabled" default:"false"`
	Network    string `yaml:"network" json:"network" validate:"required,oneof=mainnet testnet" default:"mainnet" example:"mainnet / testnet"`
	Attributes struct {
		FeePerByte    int64 `yaml:"fee_per_byte" json:"fee_per_byte" default:"1"`
		MinUTXOAmount int64 `yaml:"min_utxo_amount" json:"min_utxo_amount" default:"0" usage:"min UTXO amount in satoshi"`
	}
	Node struct {
		Address string `usage:"node address"`
		Login   string `yaml:"login" json:"login" secret:"true" usage:"node login"`
		Secret  string `secret:"true"`
		UseTLS  bool   `yaml:"use_tls" json:"use_tls" default:"true" usage:"use TLS for connection"`
	}
}

func (BitcoinCashBlockchain) ConvertToSDKConfig

func (BitcoinCashBlockchain) Validate

func (s BitcoinCashBlockchain) Validate() error

type Blockchain

type Blockchain struct {
	// Tron
	Tron TronBlockchain

	// EVM
	Ethereum          EthereumBlockchain
	BinanceSmartChain BinanceSmartChainBlockchain `yaml:"bsc"` //nolint:tagliatelle
	Polygon           PolygonBlockchain
	Arbitrum          ArbitrumBlockchain
	Optimism          OptimismBlockchain
	Linea             LineaBlockchain

	// BTC Like
	Bitcoin     BitcoinBlockchain
	Litecoin    LitecoinBlockchain
	BitcoinCash BitcoinCashBlockchain `yaml:"bitcoin_cash"`
	Dogecoin    DogecoinBlockchain    `yaml:"dogecoin"`
}

func (Blockchain) Available

func (b Blockchain) Available() []wconstants.BlockchainType

Available blockchains

func (Blockchain) GetEVMByBlockchainType

func (s Blockchain) GetEVMByBlockchainType(blockchainType wconstants.BlockchainType) (IEVMConfig, error)

type Config

type Config struct {
	Log             logger.Config
	Ops             ops.Config
	Postgres        postgres.Config
	Grpc            connectrpc_transport.Config
	ExplorerProxy   connectrpc_client.Config `yaml:"explorer_proxy"`
	Blockchain      Blockchain
	ResourceManager ResourceManager `yaml:"resource_manager"`
	Watcher         Watcher         `yaml:"watcher"`
	Webhooks        struct {
		Sender struct {
			Enabled  bool  `json:"enabled" yaml:"enabled" usage:"allows to enable and disable webhook sender" default:"true" example:"true / false"`
			Quantity int32 `` /* 145-byte string literal not displayed */
		}
		Cleanup struct {
			Enabled bool          `` /* 127-byte string literal not displayed */
			Cron    string        `` /* 136-byte string literal not displayed */
			MaxAge  time.Duration `` /* 142-byte string literal not displayed */
		}
		RemoveAfterSent bool `` /* 159-byte string literal not displayed */
	}
	Interceptors struct {
		DisableCheckingSign bool `` /* 147-byte string literal not displayed */
	}
	Transfers struct {
		Enabled bool `yaml:"enabled" json:"enabled" usage:"allows to enable transfers service" default:"true" example:"true / false"`
	}
	UseCacheForWallets bool          `` /* 164-byte string literal not displayed */
	MerchantAdmin      MerchantAdmin `yaml:"merchant_admin"`
	Updater            Updater       `yaml:"updater"`
}

func (Config) IsEnabledSeedEncryption

func (c Config) IsEnabledSeedEncryption() bool

IsEnabledSeedEncryption always returns true. It uses for removing this kostyl in future.

func (*Config) SetDefaults

func (c *Config) SetDefaults()

type DogecoinBlockchain

type DogecoinBlockchain struct {
	Enabled    bool   `json:"enabled" default:"false"`
	Network    string `yaml:"network" json:"network" validate:"required,oneof=mainnet testnet" default:"mainnet" example:"mainnet / testnet"`
	Attributes struct {
		FeePerByte    int64 `yaml:"fee_per_byte" json:"fee_per_byte" default:"50000"`
		MinUTXOAmount int64 `yaml:"min_utxo_amount" json:"min_utxo_amount" default:"0" usage:"min UTXO amount in satoshi"`
	}
	Node struct {
		Address string `usage:"node address"`
		Login   string `yaml:"login" json:"login" secret:"" usage:"node login"`
		Secret  string `secret:""`
		UseTLS  bool   `yaml:"use_tls" json:"use_tls" default:"true" usage:"use TLS for connection"`
	}
}

func (DogecoinBlockchain) ConvertToSDKConfig

func (s DogecoinBlockchain) ConvertToSDKConfig(identity constants.ProcessingIdentity) doge.Config

func (DogecoinBlockchain) Validate

func (s DogecoinBlockchain) Validate() error

type EthereumBlockchain

type EthereumBlockchain struct {
	Enabled bool   `json:"enabled" default:"false"`
	Network string `yaml:"network" json:"network" validate:"required,oneof=mainnet testnet" default:"mainnet" example:"mainnet / testnet"`
	Node    struct {
		Address string `json:"address" yaml:"address" usage:"node address"`
	}
	Attributes struct {
		MaxGasPrice float64 `yaml:"max_gas_price" json:"max_gas_price" validate:"gte=0" default:"8" usage:"max gas price in Gwei"`
	}
}

func (EthereumBlockchain) GetMaxGasFee

func (s EthereumBlockchain) GetMaxGasFee() float64

GetMaxGassFee returns the max gas fee in Gwei

func (EthereumBlockchain) IsEnabled

func (s EthereumBlockchain) IsEnabled() bool

IsEnabled returns true if the blockchain is enabled

func (EthereumBlockchain) Validate

func (s EthereumBlockchain) Validate() error

Validate

type IEVMConfig

type IEVMConfig interface {
	GetMaxGasFee() float64
	IsEnabled() bool
}

type LineaBlockchain

type LineaBlockchain struct {
	Enabled bool   `json:"enabled" default:"false"`
	Network string `yaml:"network" json:"network" validate:"required,oneof=mainnet testnet" default:"mainnet" example:"mainnet / testnet"`
	Node    struct {
		Address string `json:"address" yaml:"address" usage:"node address"`
	}
	Attributes struct {
		MaxGasPrice float64 `yaml:"max_gas_price" json:"max_gas_price" validate:"gte=0" default:"1" usage:"max gas price in Gwei"`
	}
}

func (LineaBlockchain) GetMaxGasFee

func (s LineaBlockchain) GetMaxGasFee() float64

GetMaxGassFee returns the max gas fee in Gwei

func (LineaBlockchain) IsEnabled

func (s LineaBlockchain) IsEnabled() bool

IsEnabled returns true if the blockchain is enabled

func (LineaBlockchain) Validate

func (s LineaBlockchain) Validate() error

Validate

type LitecoinBlockchain

type LitecoinBlockchain struct {
	Enabled    bool   `json:"enabled" default:"false"`
	Network    string `yaml:"network" json:"network" validate:"required,oneof=mainnet testnet" default:"mainnet" example:"mainnet / testnet"`
	Attributes struct {
		FeePerByte    int64 `yaml:"fee_per_byte" json:"fee_per_byte" default:"10"`
		MinUTXOAmount int64 `yaml:"min_utxo_amount" json:"min_utxo_amount" default:"0" usage:"min UTXO amount in satoshi"`
	}
	Node struct {
		Address string `usage:"node address"`
		Login   string `yaml:"login" json:"login" secret:"" usage:"node login"`
		Secret  string `secret:""`
		UseTLS  bool   `yaml:"use_tls" json:"use_tls" default:"true" usage:"use TLS for connection"`
	}
}

func (LitecoinBlockchain) ConvertToSDKConfig

func (s LitecoinBlockchain) ConvertToSDKConfig(identity constants.ProcessingIdentity) ltc.Config

func (LitecoinBlockchain) Validate

func (s LitecoinBlockchain) Validate() error

type MerchantAdmin

type MerchantAdmin struct {
	BaseURL string `` /* 143-byte string literal not displayed */
}

type OptimismBlockchain

type OptimismBlockchain struct {
	Enabled bool   `json:"enabled" default:"false"`
	Network string `yaml:"network" json:"network" validate:"required,oneof=mainnet testnet" default:"mainnet" example:"mainnet / testnet"`
	Node    struct {
		Address string `json:"address" yaml:"address" usage:"node address"`
	}
	Attributes struct {
		MaxGasPrice float64 `yaml:"max_gas_price" json:"max_gas_price" validate:"gte=0" default:"0.001" usage:"max gas price in Gwei"`
	}
}

func (OptimismBlockchain) GetMaxGasFee

func (s OptimismBlockchain) GetMaxGasFee() float64

GetMaxGassFee returns the max gas fee in Gwei

func (OptimismBlockchain) IsEnabled

func (s OptimismBlockchain) IsEnabled() bool

IsEnabled returns true if the blockchain is enabled

func (OptimismBlockchain) Validate

func (s OptimismBlockchain) Validate() error

Validate

type PolygonBlockchain

type PolygonBlockchain struct {
	Enabled bool   `json:"enabled" default:"false"`
	Network string `yaml:"network" json:"network" validate:"required,oneof=mainnet testnet" default:"mainnet" example:"mainnet / testnet"`
	Node    struct {
		Address string `json:"address" yaml:"address" usage:"node address"`
	}
	Attributes struct {
		MaxGasPrice float64 `yaml:"max_gas_price" json:"max_gas_price" validate:"gte=0" default:"130" usage:"max gas price in Gwei"`
	}
}

func (PolygonBlockchain) GetMaxGasFee

func (s PolygonBlockchain) GetMaxGasFee() float64

GetMaxGassFee returns the max gas fee in Gwei

func (PolygonBlockchain) IsEnabled

func (s PolygonBlockchain) IsEnabled() bool

IsEnabled returns true if the blockchain is enabled

func (PolygonBlockchain) Validate

func (s PolygonBlockchain) Validate() error

Validate

type ResourceManager

type ResourceManager struct {
	Enabled              bool                     `yaml:"enabled" default:"false"`
	Connect              connectrpc_client.Config `yaml:"connect" default:"test"`
	UseActivatorContract bool                     `yaml:"use_activator_contract" default:"true"`
	DelegationDuration   time.Duration            `yaml:"delegation_duration" default:"15s" example:"60s/1m/1h" validate:"gte=15s"`
}

func (*ResourceManager) Validate

func (o *ResourceManager) Validate() error

type TronBlockchain

type TronBlockchain struct {
	Enabled                   bool `json:"enabled" default:"false"`
	Node                      TronNode
	ActivationContractAddress string `json:"activation_contract_address" yaml:"activation_contract_address" default:"TQuCVz7ZXMwcuT2ERcBYCZzLeNAZofcTgY"`
	UseBurnTRXActivation      bool   `json:"use_burn_trx_activation" yaml:"use_burn_trx_activation" default:"true"`
}

func (TronBlockchain) ConvertToSDKConfig

func (s TronBlockchain) ConvertToSDKConfig(identity constants.ProcessingIdentity) tron.Config

func (TronBlockchain) Validate

func (s TronBlockchain) Validate() error

type TronNode

type TronNode struct {
	GrpcAddress string `json:"grpc_address" yaml:"grpc_address" usage:"node address"`
	UseTLS      bool   `json:"use_tls" yaml:"use_tls" usage:"use tls" default:"false"`
}

type Updater

type Updater struct {
	BaseURL string `` /* 142-byte string literal not displayed */
}

type Watcher

type Watcher struct {
	ClientSecret          string                   `yaml:"client_secret"`
	GrpcReconnectionDelay time.Duration            `yaml:"grpc_reconnection_delay" default:"1s" example:"1s"`
	Enabled               bool                     `yaml:"enabled" default:"false"`
	Connect               connectrpc_client.Config `yaml:"connect" default:"test"`
}

func (*Watcher) Validate

func (w *Watcher) Validate() error

Jump to

Keyboard shortcuts

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