Documentation
¶
Index ¶
- Constants
- func FindRootPath() (string, error)
- func GitHubImageToLocal(githubURL string) string
- func IsGitHubImage(maybeGitHub *string) bool
- func IsLocalImage(maybeLocal *string) bool
- func LocalImageToGitHub(local string) string
- func ParseOfficialSaveBz(tokens []TokenOfficial) ([]byte, error)
- func PointImagesToCosmosChainRegistry(assetListJson []byte) (out []byte)
- type AssetImage
- type AssetList
- type Counterparty
- type DenomUnit
- type ImageSync
- type ImageTheme
- type LogoURIs
- type PriceInfo
- type SocialLinks
- type Token
- type TokenOfficial
- type Trace
- type TraceChainInfo
- type TraceType
- type TypeAsset
Constants ¶
const ( SAVE_PATH_OFFICIAL_ERC20S = "token-registry/official_erc20s.json" SAVE_PATH_OFFICIAL_BANK_COINS = "token-registry/official_bank_coins.json" )
Variables ¶
This section is empty.
Functions ¶
func FindRootPath ¶ added in v2.2.0
FindRootPath returns the absolute path of the repository root This is retrievable with: go list -m -f {{.Dir}}
func GitHubImageToLocal ¶ added in v2.2.0
GitHubImageToLocal converts a GitHub raw image URL into a local image path.
func IsGitHubImage ¶ added in v2.2.0
IsGitHubImage returns true if an image URI is a GitHub raw URL from the NibiruChain/nibiru repository.
func IsLocalImage ¶ added in v2.2.0
IsLocalImage returns true if an image URI is meant for a local file in the "token-registry/img" directory.
func LocalImageToGitHub ¶ added in v2.2.0
LocalImageToGitHub converts a path to a local image into a GitHub download link in the NibiruChain/nibiru repository.
func ParseOfficialSaveBz ¶ added in v2.2.0
func ParseOfficialSaveBz(tokens []TokenOfficial) ([]byte, error)
Types ¶
type AssetImage ¶
type AssetImage struct {
Png *string `json:"png,omitempty"`
Svg *string `json:"svg,omitempty"`
Theme *ImageTheme `json:"theme,omitempty"`
ImageSync *ImageSync `json:"image_sync,omitempty"`
}
func (AssetImage) GitHubify ¶
func (ai AssetImage) GitHubify() AssetImage
GitHubify replaces local image paths with GitHub raw URLs.
Example: "./img/token.png" → "https://raw.githubusercontent.com/NibiruChain/nibiru/main/token-registry/img/token.png"
func (AssetImage) GitHubifyReverse ¶ added in v2.2.0
func (ai AssetImage) GitHubifyReverse() AssetImage
GitHubifyReverse replaces GitHub raw URLs with local image paths.
Example: "https://raw.githubusercontent.com/NibiruChain/nibiru/main/token-registry/img/token.png" → "./img/token.png"
type AssetList ¶
type AssetList struct {
Schema string `json:"$schema"`
ChainName string `json:"chain_name"`
Assets []Token `json:"assets"`
}
func NibiruAssetList ¶
func NibiruAssetList() AssetList
type Counterparty ¶
type Counterparty struct {
// Name of the counterparty chain
ChainName string `json:"chain_name"`
// Base denomination on the counterparty chain
BaseDenom string `json:"base_denom"`
// Channel ID used for communication (optional)
ChannelID *string `json:"channel_id,omitempty"`
}
Counterparty represents the counterparty information for an asset trace.
type ImageSync ¶
type ImageSync struct {
// Name of the chain associated with the image
ChainName string `json:"chain_name"`
// Base denomination of the synced asset
BaseDenom string `json:"base_denom"`
}
ImageSync represents synchronization details for cross-chain assets.
type ImageTheme ¶
type ImageTheme struct {
// Whether the image should appear in a circular format (optional)
Circle *bool `json:"circle,omitempty"`
// Primary color in hexadecimal format (optional)
PrimaryColorHex *string `json:"primary_color_hex,omitempty"`
}
ImageTheme represents theme customization for an image.
type LogoURIs ¶
func (LogoURIs) GitHubify ¶
GitHubify replaces local image paths with GitHub raw URLs.
Example: "./img/token.png" → "https://raw.githubusercontent.com/NibiruChain/nibiru/main/token-registry/img/token.png"
func (LogoURIs) GitHubifyReverse ¶ added in v2.2.0
GitHubifyReverse replaces GitHub raw URLs with local image paths.
Example: "https://raw.githubusercontent.com/NibiruChain/nibiru/main/token-registry/img/token.png" → "./img/token.png"
type SocialLinks ¶
type Token ¶
type Token struct {
// The human-readable name of the asset
Name string `json:"name"`
// A short description of the asset
Description string `json:"description"`
// Contract address for the token. Required for [TypeAsset] "erc20" and "cw20".
Address *string `json:"address,omitempty"`
// An extended, detailed description of the asset (optional)
ExtendedDescription *string `json:"extended_description,omitempty"`
// Links to social platforms and official websites (optional)
Socials *SocialLinks `json:"socials,omitempty"`
// Units of denomination for the asset
DenomUnits []DenomUnit `json:"denom_units"`
// The base denomination for the asset (canonical name)
Base string `json:"base"`
// The display name or symbol used in UI for the asset
Display string `json:"display"`
// The ticker or symbol of the asset
Symbol string `json:"symbol"`
// URIs for the asset's logo in different formats (optional)
LogoURIs *LogoURIs `json:"logo_URIs,omitempty"`
// Unique identifier for the asset on Coingecko (optional)
CoingeckoID *string `json:"coingecko_id,omitempty"`
// An array of image representations for the asset (optional)
Images []AssetImage `json:"images,omitempty"`
// Type of the asset (e.g., "sdk.coin", "ics20", "erc20")
TypeAsset TypeAsset `json:"type_asset"`
// Trace data for the asset (optional, for cross-chain or liquid staking assets)
Traces []Trace `json:"traces,omitempty"`
}
func (Token) GitHubify ¶
GitHubify replaces local image paths with GitHub raw URLs.
Example: "./img/token.png" → "https://raw.githubusercontent.com/NibiruChain/nibiru/main/token-registry/img/token.png"
func (Token) GitHubifyReverse ¶ added in v2.2.0
GitHubifyReverse replaces GitHub raw URLs with local image paths.
Example: "https://raw.githubusercontent.com/NibiruChain/nibiru/main/token-registry/img/token.png" → "./img/token.png"
type TokenOfficial ¶ added in v2.2.0
type TokenOfficial struct {
ContractAddr string `json:"contractAddr"`
DisplayName string `json:"displayName"`
Symbol string `json:"symbol"`
LogoSrc string `json:"logoSrc"`
PriceInfo *PriceInfo `json:"priceInfo,omitempty"`
}
func LoadBankCoins ¶ added in v2.5.0
func LoadBankCoins() ([]TokenOfficial, error)
func LoadERC20s ¶ added in v2.5.0
func LoadERC20s() (tokens []TokenOfficial, err error)
func (*TokenOfficial) GitHubify ¶ added in v2.2.0
func (to *TokenOfficial) GitHubify() *TokenOfficial
type Trace ¶
type Trace struct {
// Type of trace (e.g., "ibc", "liquid-stake", "wrapped", "bridge")
Type TraceType `json:"type"`
// Counterparty information for the trace
Counterparty Counterparty `json:"counterparty"`
// Provider of the asset for liquid staking or cross-chain trace (optional)
Provider *string `json:"provider,omitempty"`
// Additional chain-level details (optional)
Chain *TraceChainInfo `json:"chain,omitempty"`
}
Trace represents trace data for cross-chain or liquid staking assets.
type TraceChainInfo ¶
type TraceChainInfo struct {
// Channel ID on the chain
ChannelID string `json:"channel_id"`
// Path used for asset transfer on the chain
Path string `json:"path"`
}
TraceChainInfo represents additional chain-level details for an asset trace.
type TraceType ¶
type TraceType string
TraceType is an enum type for "trace.type" (e.g. "ibc", "liquid-stake", "wrapped", "bridge")