Skip to content

Commit

Permalink
Feat/const bech32 prefix (#134)
Browse files Browse the repository at this point in the history
* feat: allow only init bech32 prefix

* feat: allow only init bech32 prefix
  • Loading branch information
ALPAC-4 authored Jun 27, 2024
1 parent 418e29b commit b820337
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion _packages/initia-registry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@initia/initia-registry",
"version": "0.1.10",
"version": "0.1.11",
"description": "Initia chain registry",
"main": "main/index.js",
"module": "esm/index.js",
Expand Down
8 changes: 8 additions & 0 deletions _packages/initia-registry/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,11 @@ const chainPaths = glob(`${__dirname}/../../../*/*/chain.json`).filter((a) => {
const index = a.indexOf(spliter);
const splitedDirs = [a.slice(0, index), a.slice(index + spliter.length)];
let dir = splitedDirs.pop();

if (dir.includes("devnets")) {
return false;
}

dir = path.basename(path.dirname(dir));
return !NON_INFO_DIRS.includes(dir);
});
Expand All @@ -417,6 +422,9 @@ const paths = glob(`${__dirname}/../../../*/*/*.json`).filter((a) => {
const splitedDirs = [a.slice(0, index), a.slice(index + spliter.length)];
console.log(splitedDirs);
const filePath = splitedDirs.pop();
if (filePath.includes("devnets")) {
return false;
}
const dir = path.basename(path.dirname(filePath));
return (
!NON_INFO_DIRS.includes(dir) && path.basename(filePath) !== "chain.json"
Expand Down
4 changes: 2 additions & 2 deletions _packages/initia-registry/src/testnet/blackwing/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ const info: Chain = {
rpc: [
{
address:
"https://maze-rpc-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ue1-prod.newmetric.xyz",
"https://maze-rpc-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ase1-prod.newmetric.xyz",
},
],
rest: [
{
address:
"https://maze-rest-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ue1-prod.newmetric.xyz",
"https://maze-rest-18bdff44-3aa4-425e-9bc0-06a2afa40af8.ase1-prod.newmetric.xyz",
},
],
grpc: [
Expand Down
2 changes: 1 addition & 1 deletion _packages/initia-registry/src/testnet/civitia/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const info: Chain = {
$schema: "../../chain.schema.json",
chain_name: "civitia",
chain_id: "landlord-1",
website: "https://www.civitia.xyz/",
website: "https://civitia.org/",
pretty_name: "Civitia",
status: "live",
network_type: "testnet",
Expand Down
2 changes: 1 addition & 1 deletion _packages/initia-registry/src/testnet/initia/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const info: Chain = {
],
grpc: [
{
address: "grpc://35.247.153.122:9090",
address: "grpc.initiation-1.initia.xyz:9090",
provider: "Foundation",
},
],
Expand Down
2 changes: 1 addition & 1 deletion _packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@initia/initia-registry-types",
"version": "0.0.17",
"version": "0.0.18",
"description": "The package provides TypeScript type definitions and Zod integration for initia-registry.",
"types": "./dist/types/index.d.ts",
"exports": {
Expand Down
6 changes: 3 additions & 3 deletions _packages/types/src/types/Chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export interface Chain {
website?: string;
update_link?: string;
status?: "live" | "upcoming" | "killed";
network_type?: "mainnet" | "testnet" | "devnet";
network_type: "mainnet" | "testnet" | "devnet";
/**
* The default prefix for the human-readable part of addresses that identifies the coin type. Must be registered with SLIP-0173. E.g., 'cosmos'
* The default prefix for the human-readable part of addresses that identifies the coin type.
*/
bech32_prefix: string;
bech32_prefix: "init";
/**
* Used to override the bech32_prefix for specific uses.
*/
Expand Down
6 changes: 3 additions & 3 deletions _packages/types/src/zods/Chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export const ChainSchema = z
website: z.string().url().optional(),
update_link: z.string().url().optional(),
status: z.enum(["live", "upcoming", "killed"]).optional(),
network_type: z.enum(["mainnet", "testnet", "devnet"]).optional(),
network_type: z.enum(["mainnet", "testnet", "devnet"]),
bech32_prefix: z
.string()
.literal("init")
.describe(
"The default prefix for the human-readable part of addresses that identifies the coin type. Must be registered with SLIP-0173. E.g., 'cosmos'"
"The default prefix for the human-readable part of addresses that identifies the coin type."
),
bech32_config: z
.object({
Expand Down
4 changes: 2 additions & 2 deletions chain.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"enum": ["mainnet", "testnet", "devnet"]
},
"bech32_prefix": {
"type": "string",
"description": "The default prefix for the human-readable part of addresses that identifies the coin type. Must be registered with SLIP-0173. E.g., 'cosmos'"
"const": "init",
"description": "The default prefix for the human-readable part of addresses that identifies the coin type."
},
"bech32_config": {
"type": "object",
Expand Down

0 comments on commit b820337

Please sign in to comment.