export type CoinType = 'ethereum' | 'cosmos'; import { NativeModules } from 'react-native'; type WalletCoreType = { createWallet: ( strength: 128 | 256, passphrase?: string ) => { mnemonic: string; seed: string; entropy: string }; importWalletFromMnemonic: (options: { mnemonic: string; passphrase?: string; promptTitle?: string; promptSubtitle?: string; useBiometrics?: boolean; // default: false }) => { mnemonic: string; seed: string }; importWalletFromEntropy: (options: { entropy: string; passphrase?: string; promptTitle?: string; promptSubtitle?: string; useBiometrics?: boolean; // default: false }) => { mnemonic: string; seed: string }; getAddressForCoin: (coinName: CoinType) => string; getAccount: ( coinType: CoinType, derivationPath: string ) => { address: string; publicKey: string }; signTransactionForCoin: (coinType: CoinType, transaction: string) => string; signData: ( coinType: CoinType, payload: string, derivationPath?: string ) => string; loadWalletFromStorage: (options: { passphrase?: string; promptTitle?: string; promptSubtitle?: string; useBiometrics?: boolean; // default: false }) => boolean; getCurrentWalletMnemonic: () => string; deleteWallet: () => void; cleanUp: () => void; getBiometricsState: () => 'available' | 'available_locked' | 'unavailable'; transferEntropyToBiometricsStorage: (options?: { promptTitle?: string; promptSubtitle?: string; }) => void; transferEntropyToNormalStorage: (options?: { promptTitle?: string; promptSubtitle?: string; }) => void; }; declare global { const WalletCore: WalletCoreType; } // @ts-ignore export const { WalletCore }: { WalletCore: WalletCoreType } = global; export function isLoaded() { return !!WalletCore; } if (!isLoaded()) { const result = NativeModules.WalletCore.install(); if (!result) throw new Error('JSI bindings are not installed for WalletCore'); } export default WalletCore;