@ixily/activ
Version:
Alpha Capture Trade Idea Verification. Blockchain ownership proven trade ideas and strategies.
32 lines (27 loc) • 789 B
text/typescript
import { CHAIN_IDS_OPTS, IContract, ISupportedBlockchainNetwork } from '../..'
export interface IBlockchainNetwork {
name: string
contracts: {
[key: string]: IContract
}
errorKeywords?: {
tooFewGasUnits?: string[]
tooMuchGasUnits?: string[]
}
}
export type IWalletNetworkChain = keyof typeof CHAIN_IDS_OPTS
export const WALLET_NETWORK_CHAIN_IDS = (
index: ISupportedBlockchainNetwork,
): number => {
const nIndex = CHAIN_IDS_OPTS[index]
if (nIndex === undefined) throw new Error('Unsupported Blockchain')
return nIndex
}
export const WALLET_NETWORK_CHAIN_NAME = (
index: number,
): IWalletNetworkChain => {
const name = Object.keys(CHAIN_IDS_OPTS).find(
(key) => CHAIN_IDS_OPTS[key as IWalletNetworkChain] === Number(index),
)
return name as IWalletNetworkChain
}