mukan-ignite/ignite/pkg/chainregistry/asset.go
Mukan Erkin Törük 26b204bd04
Some checks are pending
Docs Deploy / build_and_deploy (push) Waiting to run
Generate Docs / cli (push) Waiting to run
Generate Config Doc / cli (push) Waiting to run
Go formatting / go-formatting (push) Waiting to run
Check links / markdown-link-check (push) Waiting to run
Integration / pre-test (push) Waiting to run
Integration / test on (push) Blocked by required conditions
Integration / status (push) Blocked by required conditions
Lint / Lint Go code (push) Waiting to run
Test / test (ubuntu-latest) (push) Waiting to run
feat: fork Ignite CLI v29 as Mukan Ignite — remove cosmos-sdk restrictions
2026-05-11 03:31:37 +03:00

52 lines
1.3 KiB
Go

package chainregistry
import (
"encoding/json"
"os"
)
// AssetList represents the assetlist.json file from the chain registry.
// https://raw.githubusercontent.com/cosmos/chain-registry/master/assetlist.schema.json
// https://github.com/cosmos/chain-registry?tab=readme-ov-file#assetlists
type AssetList struct {
ChainName string `json:"chain_name"`
Assets []Asset `json:"assets"`
}
type Asset struct {
Description string `json:"description"`
DenomUnits []DenomUnit `json:"denom_units"`
Base string `json:"base"`
Name string `json:"name"`
Display string `json:"display"`
Symbol string `json:"symbol"`
LogoURIs LogoURIs `json:"logo_URIs"`
CoingeckoID string `json:"coingecko_id,omitempty"`
Socials Socials `json:"socials,omitempty"`
TypeAsset string `json:"type_asset"`
}
type DenomUnit struct {
Denom string `json:"denom"`
Exponent int `json:"exponent"`
}
type LogoURIs struct {
Png string `json:"png"`
Svg string `json:"svg"`
}
type Socials struct {
Website string `json:"website"`
Twitter string `json:"twitter"`
}
// SaveJSON saves the assetlist.json to the given out directory.
func (c AssetList) SaveJSON(out string) error {
bz, err := json.MarshalIndent(c, "", " ")
if err != nil {
return err
}
return os.WriteFile(out, bz, 0o600)
}