@exodus/address-provider
This module is a gateway that delegates to registered address providers based on WalletAccount source.
flowchart LR
A[Wallet] -->|getReceiveAddress\ngetChangeAddress\n...| B(AddressProvider)
B --> C{Pick by \nsource}
C -->|trezor| D[TrezorAddressProvider]
C -->|exodus| E[SeedAddressProvider]
C -->|ftx| F[FtxAddressProvider]
Install
yarn add @exodus/address-provider
Usage
import addressProviderDefinition from '@exodus/address-provider'
ioc.registerMultiple([
{
id: 'getAddressProvider',
factory:
({ seedAddressProvider }) =>
({ walletAccount }) => {
if (walletAccount.source === WalletAccount.EXODUS_SRC) {
return seedAddressProvider
}
throw new Error(
`No address provider available for wallet account source ${walletAccount.source}`
)
},
},
addressProviderDefinition,
])
const { addressProvider } = ioc.getAll()
const defaultAddress = await addressProvider.getAddress({
purpose,
assetName,
walletAccount: walletAccountInstance,
chainIndex: 0,
addressIndex: 0,
})