This module provides simplified access to remote config values
yarn add @exodus/remote-config
This feature is designed to be used together with @exodus/headless
. See using the sdk.
- Open the playground https://exodus-hydra.pages.dev/features/remote-config
- Try out the some methods via the UI. These corresponds 1:1 with the
exodus.remoteConfig
API. - Run
await exodus.remoteConfig.get('assets.algorand.blockExplorer')
in the Dev Tools Console.
See using the sdk for more details on how features plug into the SDK and the API interface in the type declaration.
const { addressUrl, txUrl } = await exodus.remoteConfig.get('core.wallet.sunsetAssets')
const config = await exodus.remoteConfig.getAll()
If you're building a feature that requires values from the remote config, you can use remote-config-atoms to subscribe to slices of the remote config. The following example demonstrates how to use remote config atoms to create an atom that subscribes to the core.exchange.preferSameNetworkUsdThreshold
value:
import { createRemoteConfigAtomFactory } from '@exodus/atoms'
// below definition can be shipped with a feature and depended on by other nodes by specifying 'sameNetworkUsdThresholdAtom' as dependency
const sameNetworkUsdThresholdAtom = {
id: 'sameNetworkUsdThresholdAtom',
factory({ remoteConfig }) {
const createRemoteConfigAtom = createRemoteConfigAtomFactory({ remoteConfig })
const atom = createRemoteConfigAtom({
path: 'core.exchange.preferSameNetworkUsdThreshold',
defaultValue: 42,
})
return atom
},
dependencies: ['remoteConfig'],
}
See using the sdk for more details on basic UI-side setup.
import { selectors } from '~/ui/flux'
const MyComponent = () => {
const preferSameNetworkUsdThreshold = useSelector(
selectors.remoteConfig.get('core.exchange.preferSameNetworkUsdThreshold')
)
}