@talismn/chaindata-provider 2.0.4 → 2.2.0
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 +13 -1
- package/dist/index.d.mts +503 -138
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +485 -120
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +443 -290
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +441 -292
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
# @talismn/chaindata-provider
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Networks and tokens for the Talisman wallet.
|
|
4
|
+
|
|
5
|
+
- `ChaindataProvider` fetches networks and tokens from the [chaindata](https://github.com/TalismanSociety/chaindata) repository (`CHAINDATA_PUB_FOLDER` in `src/constants.ts`) and supports custom networks and tokens.
|
|
6
|
+
- Data is kept in memory. To persist it, pass `persistedStorage` and subscribe to changes.
|
|
7
|
+
- To replace the default chaindata file, pass `chaindata$`: an object or an observable of objects in the `ChaindataFile` format. To download a file from a URL, pass `getRemoteChaindata$(url)`. The jsdelivr fallback and the bundled `initChaindata.json` apply only to the default file.
|
|
8
|
+
- The provider subscribes to `chaindata$` only while it has subscribers. Pass a replaying observable (a `BehaviorSubject`, or `shareReplay(1)` without `refCount`), else values emitted while nothing is subscribed are lost. A failed observable is resubscribed with backoff, so only a cold observable can recover.
|
|
9
|
+
- The objects that `getRemoteChaindata$` emits are shared and already validated. Treat them as immutable: to filter them, return new objects.
|
|
10
|
+
- `persistedStorage` seeds the data whichever source is used. Clear it when you switch sources.
|
|
11
|
+
- Types and guards for networks (`DotNetwork`, `EthNetwork`, `SolNetwork`) and tokens.
|
|
12
|
+
|
|
13
|
+
`src/state/initChaindata.json` is the bundled fallback. Do not edit it manually: regenerate it before each release with `pnpm chore:generate-init-data`.
|
|
14
|
+
|
|
15
|
+
To change the mini-metadata format, follow [UPDATING_CHAINDATA.md](UPDATING_CHAINDATA.md).
|