@talismn/chaindata-provider
v2.3.1
Published
Networks and tokens supported by the Talisman wallet, synced from the chaindata repository
Readme
@talismn/chaindata-provider
Networks and tokens for the Talisman wallet.
ChaindataProviderfetches networks and tokens from the chaindata repository (CHAINDATA_PUB_FOLDERinsrc/constants.ts) and supports custom networks and tokens.- Data is kept in memory. To persist it, pass
persistedStorageand subscribe to changes. - To replace the default chaindata file, pass
chaindata$: an object or an observable of objects in theChaindataFileformat. To download a file from a URL, passgetRemoteChaindata$(url). The jsdelivr fallback and the bundledinitChaindata.jsonapply only to the default file.- The provider subscribes to
chaindata$only while it has subscribers. Pass a replaying observable (aBehaviorSubject, orshareReplay(1)withoutrefCount), else values emitted while nothing is subscribed are lost. A failed observable is resubscribed with backoff, so only a cold observable can recover. - The objects that
getRemoteChaindata$emits are shared and already validated. Treat them as immutable: to filter them, return new objects. persistedStorageseeds the data whichever source is used. Clear it when you switch sources.
- The provider subscribes to
- Types and guards for networks (
DotNetwork,EthNetwork,SolNetwork) and tokens.
src/state/initChaindata.json is the bundled fallback. Do not edit it manually: regenerate it before each release with pnpm chore:generate-init-data.
To change the mini-metadata format, follow UPDATING_CHAINDATA.md.
