@ethernauta/chain 0.0.25 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/chain/shared.js.map +1 -1
- package/dist/index.d.ts +1974 -1974
- package/dist/index.js +1974 -1974
- package/package.json +2 -2
- package/src/chain/eip155/index.ts +1974 -1974
- package/src/chain/shared.ts +1 -1
- package/src/indexer.ts +1 -1
package/README.md
CHANGED
|
@@ -22,13 +22,13 @@ This module aims to be an un-opinionated representation of the defined:
|
|
|
22
22
|
## API
|
|
23
23
|
|
|
24
24
|
```tsx
|
|
25
|
-
import { eip155_1,
|
|
26
|
-
const
|
|
25
|
+
import { eip155_1, encode_chain_id, decode_chain_id } from "@ethernauta/chain"
|
|
26
|
+
const chain_id = encode_chain_id({
|
|
27
27
|
namespace: "eip155",
|
|
28
28
|
reference: eip155_1.chainId,
|
|
29
29
|
})
|
|
30
|
-
console.log(
|
|
31
|
-
const { namespace, reference } =
|
|
30
|
+
console.log(chain_id)// eip155:11155111
|
|
31
|
+
const { namespace, reference } = decode_chain_id(chain_id)
|
|
32
32
|
console.log(namespace)// eip155
|
|
33
33
|
console.log(reference)// 11155111
|
|
34
34
|
```
|
package/dist/chain/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","names":["input: unknown"],"sources":["../../src/chain/shared.ts"],"sourcesContent":["import type { InferOutput } from \"valibot\"\nimport {\n array,\n literal,\n number,\n object,\n optional,\n
|
|
1
|
+
{"version":3,"file":"shared.js","names":["input: unknown"],"sources":["../../src/chain/shared.ts"],"sourcesContent":["import type { InferOutput } from \"valibot\"\nimport {\n array,\n custom,\n literal,\n number,\n object,\n optional,\n string,\n} from \"valibot\"\n\nconst featureSchema = object({\n name: string(),\n})\nexport type Feature = InferOutput<typeof featureSchema>\n\nconst nativeCurrencySchema = object({\n name: string(),\n symbol: string(),\n decimals: number(),\n})\nexport type NativeCurrency = InferOutput<\n typeof nativeCurrencySchema\n>\n\nconst explorerSchema = object({\n name: string(),\n url: string(),\n standard: string(),\n})\nexport type Explorer = InferOutput<typeof explorerSchema>\n\nconst bridgeSchema = object({\n url: string(),\n})\nexport type Bridge = InferOutput<typeof bridgeSchema>\n\nconst parentSchema = object({\n type: string(),\n chain: string(),\n bridges: optional(array(bridgeSchema)),\n})\nexport type Parent = InferOutput<typeof parentSchema>\n\nconst ensRegistrySchema = object({\n registry: string(),\n})\nexport type EnsRegistry = InferOutput<\n typeof ensRegistrySchema\n>\n\nfunction isShortName(input: unknown): boolean {\n return (\n typeof input === \"string\" &&\n /^[A-Za-z0-9-_]{1,64}$/.test(input)\n )\n}\nexport const shortNameSchema = custom<string>(isShortName)\nexport type ShortName = InferOutput<typeof shortNameSchema>\n\nconst redFlagSchema = literal(\"reusedChainId\")\nexport type RedFlagSchema = InferOutput<\n typeof redFlagSchema\n>\n\nexport const chainSchema = object({\n name: string(),\n shortName: shortNameSchema,\n title: optional(string()),\n chain: string(),\n icon: optional(string()),\n rpc: array(string()),\n faucets: array(string()),\n features: optional(array(featureSchema)),\n nativeCurrency: nativeCurrencySchema,\n infoURL: string(),\n chainId: number(),\n networkId: number(),\n slip44: optional(number()),\n ens: optional(ensRegistrySchema),\n explorers: optional(array(explorerSchema)),\n parent: optional(parentSchema),\n status: optional(string()),\n redFlags: optional(array(redFlagSchema)),\n})\nexport type Chain = InferOutput<typeof chainSchema>\n"],"mappings":";;;AAWA,MAAM,gBAAgB,OAAO,EAC3B,MAAM,QAAQ,CACf,EAAC;AAGF,MAAM,uBAAuB,OAAO;CAClC,MAAM,QAAQ;CACd,QAAQ,QAAQ;CAChB,UAAU,QAAQ;AACnB,EAAC;AAKF,MAAM,iBAAiB,OAAO;CAC5B,MAAM,QAAQ;CACd,KAAK,QAAQ;CACb,UAAU,QAAQ;AACnB,EAAC;AAGF,MAAM,eAAe,OAAO,EAC1B,KAAK,QAAQ,CACd,EAAC;AAGF,MAAM,eAA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