@sodax/skills 2.0.0-rc.16 → 2.0.0-rc.17
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/package.json
CHANGED
|
@@ -60,6 +60,41 @@ import {
|
|
|
60
60
|
|
|
61
61
|
---
|
|
62
62
|
|
|
63
|
+
## Chain metadata (`baseChainInfo`)
|
|
64
|
+
|
|
65
|
+
`baseChainInfo` (exported from `@sodax/sdk`, re-exported from `@sodax/types`) maps every `ChainKey` to a static `BaseChainInfo` record:
|
|
66
|
+
|
|
67
|
+
| Field | Type | Notes |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| `name` | `string` | Human-readable chain name. |
|
|
70
|
+
| `key` | `ChainKey` | The chain key (equals the map key). |
|
|
71
|
+
| `chainId` | `string \| number` | Native chain id — number for EVM, string for non-EVM. |
|
|
72
|
+
| `type` | `ChainType` | Chain family — same value as `getChainType(key)`. |
|
|
73
|
+
| `mainnet` | `boolean` | Whether the entry is a mainnet chain. |
|
|
74
|
+
| `logo` | `string` | Default chain logo URL (see below). |
|
|
75
|
+
| `explorer` | `{ baseUrl; txUrl; addressUrl; contractUrl }` | Block-explorer URL templates. |
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import { baseChainInfo, ChainKeys } from '@sodax/sdk';
|
|
79
|
+
|
|
80
|
+
const { name, logo, explorer } = baseChainInfo[ChainKeys.BASE_MAINNET];
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Chain logos
|
|
84
|
+
|
|
85
|
+
Each entry's `logo` is a default logo URL — **read `baseChainInfo[key].logo` for chain icons; never hardcode icon paths.** The URL is built from the exported `CHAIN_LOGO_BASE_URL` as `${CHAIN_LOGO_BASE_URL}/${key}.png`:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
import { baseChainInfo, CHAIN_LOGO_BASE_URL, ChainKeys } from '@sodax/sdk';
|
|
89
|
+
|
|
90
|
+
baseChainInfo[ChainKeys.SONIC_MAINNET].logo;
|
|
91
|
+
// → `${CHAIN_LOGO_BASE_URL}/sonic.png`
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The PNGs are hosted in the repo's `@sodax/assets` package and served from `main` via `raw.githubusercontent.com` — so a newly added logo only resolves once merged to `main`. They are not bundled into the SDK.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
63
98
|
|
|
64
99
|
## Cross-references
|
|
65
100
|
|
|
@@ -26,6 +26,9 @@ import {
|
|
|
26
26
|
type SpokeChainKey,
|
|
27
27
|
type HubChainKey,
|
|
28
28
|
type EvmChainKey,
|
|
29
|
+
baseChainInfo, // per-chain static metadata (name, key, logo, explorer, …)
|
|
30
|
+
type BaseChainInfo,
|
|
31
|
+
CHAIN_LOGO_BASE_URL, // base URL for default chain logos — baseChainInfo[key].logo
|
|
29
32
|
getChainType,
|
|
30
33
|
isEvmChainKeyType,
|
|
31
34
|
isSolanaChainKeyType,
|