Skip to content

Commit c5d24d1

Browse files
authored
refactor: add apis to chain-registry (#4466)
* refactor: add apis to chain-registry * uris * updates
1 parent 6933525 commit c5d24d1

File tree

1 file changed

+47
-5
lines changed

1 file changed

+47
-5
lines changed

ignite/services/scaffolder/chain_registry.go

+47-5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ type chainJSON struct {
5353
Staking staking `json:"staking"`
5454
Codebase codebase `json:"codebase"`
5555
Description string `json:"description"`
56+
Apis apis `json:"apis"`
5657
}
5758

5859
type staking struct {
@@ -110,6 +111,17 @@ type feeToken struct {
110111
HighGasPrice float64 `json:"high_gas_price"`
111112
}
112113

114+
type apis struct {
115+
RPC []apiProvider `json:"rpc"`
116+
Rest []apiProvider `json:"rest"`
117+
Grpc []apiProvider `json:"grpc"`
118+
}
119+
120+
type apiProvider struct {
121+
Address string `json:"address"`
122+
Provider string `json:"provider"`
123+
}
124+
113125
// SaveJSON saves the chainJSON to the given out directory.
114126
func (c chainJSON) SaveJSON(out string) error {
115127
bz, err := json.MarshalIndent(c, "", " ")
@@ -134,6 +146,7 @@ type asset struct {
134146
Name string `json:"name"`
135147
Display string `json:"display"`
136148
Symbol string `json:"symbol"`
149+
LogoURIs logoURIs `json:"logo_URIs"`
137150
CoingeckoID string `json:"coingecko_id,omitempty"`
138151
Socials socials `json:"socials,omitempty"`
139152
TypeAsset string `json:"type_asset"`
@@ -149,6 +162,11 @@ type socials struct {
149162
Twitter string `json:"twitter"`
150163
}
151164

165+
type logoURIs struct {
166+
Png string `json:"png"`
167+
Svg string `json:"svg"`
168+
}
169+
152170
// SaveJSON saves the assetList to the given out directory.
153171
func (c assetListJSON) SaveJSON(out string) error {
154172
bz, err := json.MarshalIndent(c, "", " ")
@@ -226,7 +244,7 @@ func (s Scaffolder) AddChainRegistryFiles(chain *chain.Chain, cfg *chainconfig.C
226244
NetworkType: DefaultNetworkType,
227245
Website: "https://example.com",
228246
ChainID: chainID,
229-
Bech32Prefix: "",
247+
Bech32Prefix: "cosmos",
230248
DaemonName: binaryName,
231249
NodeHome: chainHome,
232250
KeyAlgos: []string{"secp256k1"},
@@ -261,6 +279,26 @@ func (s Scaffolder) AddChainRegistryFiles(chain *chain.Chain, cfg *chainconfig.C
261279
Ibc: ibc,
262280
Cosmwasm: cosmwasm,
263281
},
282+
Apis: apis{
283+
RPC: []apiProvider{
284+
{
285+
Address: "http://localhost:26657",
286+
Provider: "localhost",
287+
},
288+
},
289+
Rest: []apiProvider{
290+
{
291+
Address: "http://localhost:1317",
292+
Provider: "localhost",
293+
},
294+
},
295+
Grpc: []apiProvider{
296+
{
297+
Address: "localhost:9090",
298+
Provider: "localhost",
299+
},
300+
},
301+
},
264302
}
265303

266304
assetListData := assetListJSON{
@@ -274,12 +312,16 @@ func (s Scaffolder) AddChainRegistryFiles(chain *chain.Chain, cfg *chainconfig.C
274312
Exponent: 0,
275313
},
276314
},
277-
Base: defaultDenom,
278-
Name: chainData.ChainName,
279-
Symbol: strings.ToUpper(defaultDenom),
315+
Base: defaultDenom,
316+
Name: chainData.ChainName,
317+
Symbol: strings.ToUpper(defaultDenom),
318+
LogoURIs: logoURIs{
319+
Png: "https://ignite.com/favicon.ico",
320+
Svg: "https://ignite.com/favicon.ico",
321+
},
280322
TypeAsset: "sdk.coin",
281323
Socials: socials{
282-
Website: "https://example.com",
324+
Website: "https://ignite.com",
283325
Twitter: "https://x.com/ignite",
284326
},
285327
},

0 commit comments

Comments
 (0)