@exodus/asset-sources
Provides compatibility info and metadata about asset sources. An asset source is a combination of a walletAccount and an asset.
Install
npm i @exodus/asset-sourcesUsage
This feature is designed to be used together with @exodus/headless. See using the sdk.
Play with it
- Open the playground https://exodus-hydra.pages.dev/features/asset-sources
- Try out some methods via the UI. These correspond 1:1 with the
exodus.assetSourcesAPI. - Run
await exodus.assetSources.isSupported({assetName: 'bitcoin', walletAccount: 'exodus_0'})in the Dev Tools Console.
API Side
See using the sdk for more details on how features plug into the SDK and the API interface in the type declaration .
await exodus.assetSources.isSupported({
walletAccount: 'exodus_0',
assetName: 'bitcoin',
}); // true
await exodus.assetSources.isSupported({
walletAccount: 'trezor_0_123',
assetName: 'solana',
}); // false, until Exodus adds Trezor support in our integration
await exodus.assetSources.getSupportedPurposes({
walletAccount: 'exodus_0',
assetName: 'bitcoin',
}); // [84, 86, 44]
await exodus.assetSources.getSupportedPurposes({
walletAccount: 'trezor_0_123',
assetName: 'bitcoin',
}); // [84, 49]
await exodus.assetSources.getDefaultPurpose({
walletAccount: 'exodus_0',
assetName: 'bitcoin',
}); // 84
await exodus.assetSources.getDefaultPurpose({
walletAccount: 'exodus_0',
assetName: 'cardano',
}); // 44
await exodus.assetSources.getDefaultPurpose({
walletAccount: 'trezor_0_123',
assetName: 'cardano',
}); // 1852UI Side
See using the sdk for more details on basic UI-side setup.
import { selectors } from '~/ui/flux';
const AvailableAssetsByWalletAccountDisplay = () => {
const availableAssetsByWalletAccount = useSelector(
selectors.assetSources.availableAssetNamesByWalletAccount
);
const supportedAssetsTexts = Object.entries(availableAssetsByWalletAccount).map(
([walletAccountName, supportedAssets]) => (
<Text>
{walletAccountName} ==> {Array.from(supportedAssets).join(' ')}
</Text>
)
);
return <>{supportedAssetsTexts}</>;
};