types

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrMsgInvalidDataType = "invalid data type of the message"
	ErrMsgDuplicateExpire = "invalid duplicated expire type"
)

Variables

View Source
var (
	Success           = new(0, "success")
	ErrInit           = new(101, "error initialize")
	ErrParseConfig    = new(102, "error parsing config.yaml file")
	ErrParseApp       = new(103, "error parsing app file")
	ErrContract       = new(104, "error contract")
	ErrKey            = new(105, "error key")
	ErrHaveNoAddress  = new(106, "error no contract address")
	ErrBroadcast      = new(107, "error broadcast")
	ErrTx             = new(108, "error create transaction")
	ErrQuery          = new(109, "error query")
	ErrNewMsg         = new(110, "error generate new message")
	ErrParseData      = new(111, "error parse data")
	ErrGW             = new(112, "error gateway")
	ErrHttpServer     = new(113, "error HTTP server")
	ErrInvalidRequest = new(114, "error invalid request")
)
View Source
var (
	DefaultAppName         = "xns"
	DefaultHome            = filepath.Join(os.Getenv("HOME"), ".xns")
	DefaultAppPath         = "config"
	DefaultAppFilePath     = "app.yaml"
	DefaultKeyPath         = "key"
	DefaultKeyFilePath     = "xns_gateway_key.pem"
	DefaultConfigPath      = "./config.yaml"
	DefaultContractWasmDir = "./contract/artifacts"

	XnsBaseContract      = "xns_base-aarch64.wasm"
	NftRegistrarContract = "nft_registrar-aarch64.wasm"
	RegistrarContract    = "registrar-aarch64.wasm"
	ControllerContract   = "controller-aarch64.wasm"
	ResolverContract     = "resolver-aarch64.wasm"

	ZeroAmount = "0"
)

Functions

func AppFilePath

func AppFilePath() (string, string)

func KeyFilePath

func KeyFilePath() (string, string)

func NewDefaultApp

func NewDefaultApp(home string, appFilePath string, config Config) error

func SaveAppFile

func SaveAppFile(appFilePath string, appType *App) error

Types

type App

type App struct {
	Home      string
	Config    Config
	Contracts Contracts
}

func ReadAppFile

func ReadAppFile(filePath string) (*App, error)

type Channels

type Channels struct {
	HttpServerChan chan []byte
	ErrChan        chan error
}

type Config

type Config struct {
	XnsGateway      XnsGateway      `yaml:"xns_gateway" json:"xns_gateway"`
	TargetChain     TargetChain     `yaml:"target_chain" json:"target_chain"`
	ContractsOption ContractsOption `yaml:"contracts_option" json:"contracts_option"`
	SwaggerOption   SwaggerOption   `yaml:"swagger_option" json:"swagger_option"`
}

type ContractInfo

type ContractInfo struct {
	CodeID          string `yaml:"code_id" json:"code_id"`
	ContractAddress string `yaml:"contract_address" json:"contract_address"`
}

type Contracts

type Contracts struct {
	BaseContract struct {
		CodeID string `yaml:"code_id" json:"code_id"`
	} `yaml:"base_contract,omitempty" json:"base_contract,omitempty"`
	NftRegistrarContract ContractInfo `yaml:"nft_registrar_contract,omitempty" json:"nft_registrar_contract,omitempty"`
	RegistrarContract    ContractInfo `yaml:"registrar_contract,omitempty" json:"registrar_contract,omitempty"`
	ControllerContract   ContractInfo `yaml:"controller_contract,omitempty" json:"controller_contract,omitempty"`
	ResolverContract     ContractInfo `yaml:"resolver_contract,omitempty" json:"resolver_contract,omitempty"`
}

type ContractsOption

type ContractsOption struct {
	NftRegistrar struct {
		Name   string `yaml:"name" json:"name"`
		Symbol string `yaml:"symbol" json:"symbol"`
	} `yaml:"nft_registrar" json:"nft_registrar"`

	Controller struct {
		TopPrice                      string `yaml:"top_price" json:"top_price"`
		MiddlePrice                   string `yaml:"middle_price" json:"middle_price"`
		LowPrice                      string `yaml:"low_price" json:"low_price"`
		MinRegisterDuration           string `yaml:"min_register_duration" json:"min_register_duration"`
		MaxFreeDomainRegisterDuration string `yaml:"max_free_domain_register_duration" json:"max_free_domain_register_duration"`
		TopDomain                     string `yaml:"top_domain" json:"top_domain"`
	} `yaml:"controller" json:"controller"`
}

type SwaggerOption

type SwaggerOption struct {
	ServerHostIp string `yaml:"server_host_ip"`
}

type TargetChain

type TargetChain struct {
	ChainID       string `yaml:"chain_id" json:"chain_id"`
	LcdURL        string `yaml:"lcd_url" json:"lcd_url"`
	GasAdj        string `yaml:"gas_adj" json:"gas_adj"`
	GasLimit      string `yaml:"gas_limit" json:"gas_limit"`
	BroadcastMode string `yaml:"broadcast_mode" json:"broadcast_mode"`
}

type XnsContext

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

func NewXnsContext

func NewXnsContext() *XnsContext

func (*XnsContext) GetApp

func (x *XnsContext) GetApp() App

func (*XnsContext) GetChannels

func (x *XnsContext) GetChannels() Channels

func (*XnsContext) GetViper

func (x *XnsContext) GetViper() *viper.Viper

func (*XnsContext) GetXplaClient

func (x *XnsContext) GetXplaClient() provider.XplaClient

func (*XnsContext) WithApp

func (x *XnsContext) WithApp(filePath string) error

func (*XnsContext) WithChannels

func (x *XnsContext) WithChannels() *XnsContext

func (*XnsContext) WithViper

func (x *XnsContext) WithViper(viper *viper.Viper) *XnsContext

func (*XnsContext) WithXplaClient

func (x *XnsContext) WithXplaClient(xplaClient provider.XplaClient) *XnsContext

type XnsError

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

func (XnsError) Code

func (x XnsError) Code() uint64

func (XnsError) Desc

func (x XnsError) Desc() string

type XnsGateway

type XnsGateway struct {
	TcpPort string `yaml:"tcp_port" json:"tcp_port"`
	KeyTest bool   `yaml:"key_test" json:"key_test"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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