Skip to content

Commit

Permalink
fix: allow external image uris
Browse files Browse the repository at this point in the history
  • Loading branch information
ALPAC-4 committed Mar 28, 2024
1 parent 32ee1f9 commit 341d1ac
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 63 deletions.
2 changes: 1 addition & 1 deletion _package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@initia/initia-registry-types",
"version": "0.0.10",
"version": "0.0.11",
"description": "The package provides TypeScript type definitions and Zod integration for initia-registry.",
"types": "./dist/types/index.d.ts",
"exports": {
Expand Down
24 changes: 4 additions & 20 deletions _package/src/zods/AssetList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,19 +207,11 @@ export const AssetListSchema = z
.object({
png: z
.string()
.regex(
new RegExp(
"^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.png$"
)
)
.regex(new RegExp("^https://.+\\.png$"))
.optional(),
svg: z
.string()
.regex(
new RegExp(
"^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.svg$"
)
)
.regex(new RegExp("^https://.+\\.svg$"))
.optional(),
})
.strict()
Expand Down Expand Up @@ -249,19 +241,11 @@ export const AssetListSchema = z
.optional(),
png: z
.string()
.regex(
new RegExp(
"^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.png$"
)
)
.regex(new RegExp("^https://.+\\.png$"))
.optional(),
svg: z
.string()
.regex(
new RegExp(
"^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.svg$"
)
)
.regex(new RegExp("^https://.+\\.svg$"))
.optional(),
theme: z
.object({
Expand Down
36 changes: 4 additions & 32 deletions _package/src/zods/Chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,22 +262,8 @@ export const ChainSchema = z
"The (primary) key used to identify an object within the Chain Registry."
)
.optional(),
png: z
.string()
.regex(
new RegExp(
"^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.png$"
)
)
.optional(),
svg: z
.string()
.regex(
new RegExp(
"^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.svg$"
)
)
.optional(),
png: z.string().regex(new RegExp("^https://.+\\.png$")).optional(),
svg: z.string().regex(new RegExp("^https://.+\\.svg$")).optional(),
theme: z
.object({
primary_color_hex: z
Expand Down Expand Up @@ -308,22 +294,8 @@ export const ChainSchema = z
.optional(),
logo_URIs: z
.object({
png: z
.string()
.regex(
new RegExp(
"^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.png$"
)
)
.optional(),
svg: z
.string()
.regex(
new RegExp(
"^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.svg$"
)
)
.optional(),
png: z.string().regex(new RegExp("^https://.+\\.png$")).optional(),
svg: z.string().regex(new RegExp("^https://.+\\.svg$")).optional(),
})
.strict()
.optional(),
Expand Down
9 changes: 4 additions & 5 deletions assetlist.schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"$id": "https://osmosis.zone/assetlists.schema.json",
"$schema": "https://json-schema.org/draft-07/schema",
"title": "Asset Lists",
"description": "Asset lists are a similar mechanism to allow frontends and other UIs to fetch metadata associated with Cosmos SDK denoms, especially for assets sent over IBC.",
Expand Down Expand Up @@ -106,12 +105,12 @@
"png": {
"type": "string",
"format": "uri-reference",
"pattern": "^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.png$"
"pattern": "^https://.+\\.png$"
},
"svg": {
"type": "string",
"format": "uri-reference",
"pattern": "^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.svg$"
"pattern": "^https://.+\\.svg$"
}
},
"additionalProperties": false
Expand All @@ -127,12 +126,12 @@
"png": {
"type": "string",
"format": "uri-reference",
"pattern": "^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.png$"
"pattern": "^https://.+\\.png$"
},
"svg": {
"type": "string",
"format": "uri-reference",
"pattern": "^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.svg$"
"pattern": "^https://.+\\.svg$"
},
"theme": {
"type": "object",
Expand Down
9 changes: 4 additions & 5 deletions chain.schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"$id": "https://sikka.tech/chain.schema.json",
"$schema": "https://json-schema.org/draft-07/schema",
"title": "Cosmos Chain",
"description": "Cosmos Chain.json is a metadata file that contains information about a cosmos sdk based chain.",
Expand Down Expand Up @@ -425,12 +424,12 @@
"png": {
"type": "string",
"format": "uri-reference",
"pattern": "^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.png$"
"pattern": "^https://.+\\.png$"
},
"svg": {
"type": "string",
"format": "uri-reference",
"pattern": "^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.svg$"
"pattern": "^https://.+\\.svg$"
},
"theme": {
"type": "object",
Expand Down Expand Up @@ -486,12 +485,12 @@
"png": {
"type": "string",
"format": "uri-reference",
"pattern": "^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.png$"
"pattern": "^https://.+\\.png$"
},
"svg": {
"type": "string",
"format": "uri-reference",
"pattern": "^https://raw\\.githubusercontent\\.com/initia-labs/initia-registry/.+\\.svg$"
"pattern": "^https://.+\\.svg$"
}
},
"additionalProperties": false
Expand Down

0 comments on commit 341d1ac

Please sign in to comment.