web3-onboard-monorepo
Version:
Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, mul
27 lines (20 loc) • 655 B
text/typescript
import type { MultiChain } from 'bnc-sdk'
import { configuration } from './configuration.js'
import { handleTransactionUpdates } from './notify.js'
let blocknativeSdk: MultiChain
/**
*
* @returns SDK if apikey
*/
export async function getBlocknativeSdk(): Promise<MultiChain | null> {
const { apiKey } = configuration
if (!apiKey) return null
if (!blocknativeSdk) {
const { default: Blocknative } = await import('bnc-sdk')
blocknativeSdk = Blocknative.multichain({
apiKey: configuration.apiKey
})
blocknativeSdk.transactions$.subscribe(handleTransactionUpdates)
}
return blocknativeSdk
}