pkg

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NetworkNameXplaChain    = "xpla"
	NetworkNameAsiAlliance  = "fetchhub"
	NetworkNameTerraClassic = "terra"
	NetworkNameTerra2       = "terra2"
)
View Source
const (
	IBC_PREFIX                 = "ibc/"
	IBC_DEFAULT_TOKEN_DECIMALS = 6
)
View Source
const NodeQueryTimeout = 5 * time.Second

Variables

View Source
var (
	ErrUnsupportedNetwork         = errors.New("unsupported network")
	ErrUnregisteredFactoryAddress = errors.New("unregistered factory address")
)

Functions

func GetAndUnmarshal

func GetAndUnmarshal[T types.Unmarshalable](c *http.Client, url string) (*T, error)

func NewDecFromStrWithTruncate

func NewDecFromStrWithTruncate(input string) (math.LegacyDec, error)

Types

type Client

type Client interface {
	VerifiedCw20s() (*types.TokensRes, error)
	VerifiedIbcs() (*types.IbcsRes, error)
	VerifiedErc20s() (*types.TokensRes, error)
}

type ERC20Meta added in v1.0.3

type ERC20Meta struct {
	Name     string
	Symbol   string
	Decimals uint8
}

type EthClient added in v1.0.3

type EthClient interface {
	QueryErc20Info(ctx context.Context, contractAddr string) (ERC20Meta, error)
}

func NewEthClient added in v1.0.3

func NewEthClient(rpcURL string) (EthClient, error)

type GrpcClient

type GrpcClient interface {
	SyncedHeight() (uint64, error)
	QueryContract(addr string, query []byte, height uint64) ([]byte, error)
	QueryIbcDenomTrace(hash string) (*ibc_types.Denom, error)
}

func NewGrpcClient

func NewGrpcClient(target string, useTls bool) (GrpcClient, error)

type NetworkMetadata

type NetworkMetadata struct {
	NetworkName NetworkName

	BlockSecond           uint8
	LatestHeightIndicator uint64
	// contains filtered or unexported fields
}

func GetNetworkMetadata

func GetNetworkMetadata(chainId string) (NetworkMetadata, error)

func NewNetworkMetadata

func NewNetworkMetadata(
	networkName NetworkName, mainnetPrefix string, testnetPrefix string, addrPrefix string, tokenPrefixes map[types.TokenType]string, blockSecond uint8, latestHeightIndicator uint64,
	mainnetFactoryAddress, testnetFactoryAddress string) NetworkMetadata

func (NetworkMetadata) GetFactoryAddress added in v1.0.5

func (i NetworkMetadata) GetFactoryAddress(chainId string) (string, error)

func (NetworkMetadata) IsCw20

func (i NetworkMetadata) IsCw20(addr string) bool

func (NetworkMetadata) IsErc20 added in v1.0.3

func (i NetworkMetadata) IsErc20(addr string) bool

func (NetworkMetadata) IsIbcToken

func (i NetworkMetadata) IsIbcToken(addr string) bool

func (NetworkMetadata) IsMainnet

func (i NetworkMetadata) IsMainnet(chainId string) bool

func (NetworkMetadata) IsMainnetOrTestnet

func (i NetworkMetadata) IsMainnetOrTestnet(chainId string) bool

func (NetworkMetadata) IsTestnet

func (i NetworkMetadata) IsTestnet(chainId string) bool

func (NetworkMetadata) PrependErc20Prefix added in v1.0.3

func (i NetworkMetadata) PrependErc20Prefix(addr string) string

func (NetworkMetadata) TrimDenomPrefix added in v1.0.3

func (i NetworkMetadata) TrimDenomPrefix(addr string) string

type NetworkName

type NetworkName string

NetworkName depends on https://github.com/cosmos/chain-registry

Directories

Path Synopsis
db
api

Jump to

Keyboard shortcuts

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