@exodus/assets-feature v8.1.2
@exodus/assets-feature
This Exodus SDK feature provides access to instances of all blockchain asset adapters supported by the wallet, and enables you to search for and add custom tokens at runtime. Added tokens persist across restarts.
Install
yarn add @exodus/assets-featureUsage
@exodus/assets-feature is bundled with @exodus/headless. It injects the assetsAtom into the IOC, which you can then reference in your feature's dependencies to get all/any particular assets.
Example:
const myModule = {
id: 'myModule',
type: 'module,
factory: ({ assetsAtom }) => {
// get all assets known at this moment
const { value: assets } = await assetsAtom.get()
assetsAtom.observe(({ value }) => {
// do something with updated assets
})
},
dependencies: ['assetsAtom']
}Play with it
- Open the playground https://exodus-hydra.pages.dev/features/assets
- Run
await exodus.assets.getAsset('bitcoin')in the Dev Tools Console. - Run
await exodus.assets.searchTokens({ lifecycleStatus: ['c', 'v'], baseAssetName: 'ethereum' })in the Dev Tools Console. - Run
await exodus.assets.addTokens({ assetIds: ['0x455e53CBB86018Ac2B8092FdCd39d8444aFFC3F6'], baseAssetName: 'ethereum', allowedStatusList: ['c', 'v'] })in the Dev Tools Console to add the Polygon Ecosystem Token token on the ethereum chain (not financial advice).
See api/index.d.ts for more details on the API and token validation/curation status.
API Side
See using the sdk for more details on how features plug into the SDK and the API interface in the type declaration.
UI Side
See using the sdk for more details on basic UI-side setup.
import selectors from '~/ui/flux/selectors'
const MyComponent = () => {
const bitcoin = useSelector(selectors.assets.createAssetByNameSelector('bitcoin'))
const tx = await bitcoin.api.signTx({
// ...,
})
}5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
8 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
10 months ago
10 months ago
10 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago