import { NativeModules, Platform } from 'react-native'; interface FulaNativeModule { registerLifecycleListener: () => Promise; initFula: ( identity: string, //Private key of did identity storePath: string, //You can leave empty bloxAddr: string, //Blox multiadddr needs to be manually entered now exchange: string, //set to 'noope' for testing autoFlush: boolean, //set to false always unless you know what you are doing. This is to write actions to disk explicitly after each write rootCid: string | null, //if you have the latest rootCid you can send it and it generates the private_ref for filesystem useRelay: boolean | null, // if true it forces the use of relay refresh: boolean // if true it forces to refresh the fula object ) => Promise<{ peerId: string; rootCid: string }>; newClient: ( identity: string, //Private key of did identity storePath: string, //You can leave empty bloxAddr: string, //Blox multiadddr needs to be manually entered now exchange: string, //set to 'noope' for testing autoFlush: boolean, //set to false always unless you know what you are doing. This is to write actions to disk explicitly after each write useRelay: boolean | null, // if true it forces the use of relay refresh: boolean // if true it forces to refresh the fula object ) => Promise; isReady: (filesystemCheck: boolean) => Promise; logout: (identity: string, storePath: string) => Promise; checkConnection: (timeout: number) => Promise; ping: (timeout: number) => Promise; shutdown: () => Promise; //Blockchain related functions createAccount: (seed: string) => Promise; checkAccountExists: (account: string) => Promise; accountFund: (account: string) => Promise; createPool: (seed: string, poolName: string) => Promise; listPools: () => Promise; joinPool: (poolID: string) => Promise; leavePool: (poolID: string) => Promise; joinPoolWithChain: (poolID: string, chainName: string) => Promise; leavePoolWithChain: (poolID: string, chainName: string) => Promise; cancelPoolJoin: (poolID: string) => Promise; listPoolJoinRequests: (poolID: string) => Promise; votePoolJoinRequest: ( seed: string, poolID: number, account: string, accept: boolean ) => Promise; batchUploadManifest: ( cid: string[], poolID: string, replicationFactor: string ) => Promise; replicateInPool: ( cid: string[], account: string, poolID: string ) => Promise; newStoreRequest: ( seed: string, poolID: number, uploader: string, cid: string ) => Promise; listAvailableReplicationRequests: (poolID: string) => Promise; removeReplicationRequest: ( seed: string, poolID: number, cid: string ) => Promise; removeStorer: ( seed: string, storer: string, poolID: number, cid: string ) => Promise; removeStoredReplication: ( seed: string, uploader: string, poolID: number, cid: string ) => Promise; //On Blox calls for chain //Hardware assetsBalance: ( account: string, assetId: string, classId: string ) => Promise; transferToFula: ( amount: string, wallet: string, chain: string ) => Promise; getAccount: () => Promise; //Hardware eraseBlData: () => Promise; fetchContainerLogs: ( containerName: string, tailCount: string ) => Promise; findBestAndTargetInLogs: ( containerName: string, tailCount: string ) => Promise; getFolderSize: (folderPath: string) => Promise; getDatastoreSize: () => Promise; bloxFreeSpace: () => Promise; wifiRemoveall: () => Promise; reboot: () => Promise; partition: () => Promise; getDockerImageBuildDates: () => Promise; getClusterInfo: () => Promise; // Plugin related functions listPlugins: () => Promise; listActivePlugins: () => Promise; installPlugin: (pluginName: string, params: string) => Promise; uninstallPlugin: (pluginName: string) => Promise; showPluginStatus: (pluginName: string, lines: number) => Promise; getInstallOutput: (pluginName: string, params: string) => Promise; getInstallStatus: (pluginName: string) => Promise; updatePlugin: (pluginName: string) => Promise; //AI chatWithAI: (aiModel: string, userMessage: string) => Promise; getChatChunk: (streamID: string) => Promise; streamChunks: (streamID: string) => Promise; // Auto-pin autoPinPair: (token: string, endpoint: string) => Promise; autoPinRefresh: (token: string) => Promise; autoPinUnpair: () => Promise; } const LINKING_ERROR = `The package 'react-native-fula/Fula' doesn't seem to be linked. Make sure: \n\n` + Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n'; const Fula = NativeModules.FulaModule ? NativeModules.FulaModule : new Proxy( {}, { get() { throw new Error(LINKING_ERROR); }, } ); export default Fula as FulaNativeModule;