@functionland/react-native-fula 1.2.1001 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
  2. package/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
  3. package/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
  4. package/android/.gradle/7.5.1/fileHashes/fileHashes.bin +0 -0
  5. package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
  6. package/android/.gradle/7.5.1/fileHashes/resourceHashesCache.bin +0 -0
  7. package/android/.gradle/7.6/checksums/checksums.lock +0 -0
  8. package/android/.gradle/7.6/checksums/md5-checksums.bin +0 -0
  9. package/android/.gradle/7.6/checksums/sha1-checksums.bin +0 -0
  10. package/android/.gradle/7.6/dependencies-accessors/dependencies-accessors.lock +0 -0
  11. package/android/.gradle/7.6/dependencies-accessors/gc.properties +0 -0
  12. package/android/.gradle/7.6/executionHistory/executionHistory.bin +0 -0
  13. package/android/.gradle/7.6/executionHistory/executionHistory.lock +0 -0
  14. package/android/.gradle/7.6/fileChanges/last-build.bin +0 -0
  15. package/android/.gradle/7.6/fileHashes/fileHashes.bin +0 -0
  16. package/android/.gradle/7.6/fileHashes/fileHashes.lock +0 -0
  17. package/android/.gradle/7.6/fileHashes/resourceHashesCache.bin +0 -0
  18. package/android/.gradle/7.6/gc.properties +0 -0
  19. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  20. package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
  21. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  22. package/android/.gradle/file-system.probe +0 -0
  23. package/android/build.gradle +69 -69
  24. package/android/src/main/java/land/fx/fula/Cryptography.java +60 -47
  25. package/android/src/main/java/land/fx/fula/FulaModule.java +1384 -1297
  26. package/lib/commonjs/index.js +3 -1
  27. package/lib/commonjs/index.js.map +1 -1
  28. package/lib/commonjs/interfaces/fulaNativeModule.js.map +1 -1
  29. package/lib/commonjs/protocols/blockchain.js +12 -12
  30. package/lib/commonjs/protocols/blockchain.js.map +1 -1
  31. package/lib/commonjs/protocols/fxblox.js +52 -0
  32. package/lib/commonjs/protocols/fxblox.js.map +1 -0
  33. package/lib/commonjs/types/fxblox.js +2 -0
  34. package/lib/commonjs/types/fxblox.js.map +1 -0
  35. package/lib/module/index.js +2 -0
  36. package/lib/module/index.js.map +1 -1
  37. package/lib/module/interfaces/fulaNativeModule.js.map +1 -1
  38. package/lib/module/protocols/blockchain.js +12 -12
  39. package/lib/module/protocols/blockchain.js.map +1 -1
  40. package/lib/module/protocols/fxblox.js +43 -0
  41. package/lib/module/protocols/fxblox.js.map +1 -0
  42. package/lib/module/types/fxblox.js +2 -0
  43. package/lib/module/types/fxblox.js.map +1 -0
  44. package/lib/typescript/index.d.ts +1 -0
  45. package/lib/typescript/interfaces/fulaNativeModule.d.ts +2 -0
  46. package/lib/typescript/protocols/fxblox.d.ts +7 -0
  47. package/lib/typescript/types/fxblox.d.ts +8 -0
  48. package/package.json +1 -1
  49. package/src/index.tsx +2 -1
  50. package/src/interfaces/fulaNativeModule.ts +41 -8
  51. package/src/protocols/blockchain.ts +318 -274
  52. package/src/protocols/fxblox.ts +49 -0
  53. package/src/types/fxblox.ts +8 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Fula","wifiRemoveall","console","log","res","then","jsonRes","JSON","parse","e","catch","err","reboot"],"sources":["fxblox.ts"],"sourcesContent":["import Fula from '../interfaces/fulaNativeModule';\r\nimport type * as BType from '../types/fxblox';\r\n\r\n/**\r\n * send a command to Blox hardware to remove all save wifis.\r\n * @returns json{status:true if success, false if fails; msg: error message or success log}\r\n */\r\n\r\nexport const wifiRemoveall = (): Promise<BType.wifiRemoveallResponse> => {\r\n console.log('wifiRemoveall in react-native started');\r\n let res = Fula.wifiRemoveall()\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.wifiRemoveallResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\nexport const reboot = (): Promise<BType.rebootResponse> => {\r\n console.log('reboot in react-native started');\r\n let res = Fula.reboot()\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.rebootResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,gCAAgC;AAGjD;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,aAAa,GAAG,MAA4C;EACvEC,OAAO,CAACC,GAAG,CAAC,uCAAuC,CAAC;EACpD,IAAIC,GAAG,GAAGJ,IAAI,CAACC,aAAa,EAAE,CAC3BI,IAAI,CAAED,GAAG,IAAK;IACb,IAAI;MACF,IAAIE,OAAoC,GAAGC,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;MAC1D,OAAOE,OAAO;IAChB,CAAC,CAAC,OAAOG,CAAC,EAAE;MACV,IAAI;QACF,OAAOF,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;MACxB,CAAC,CAAC,OAAOK,CAAC,EAAE;QACV,OAAOL,GAAG;MACZ;IACF;EACF,CAAC,CAAC,CACDM,KAAK,CAAEC,GAAG,IAAK;IACd,OAAOA,GAAG;EACZ,CAAC,CAAC;EACJ,OAAOP,GAAG;AACZ,CAAC;AAED,OAAO,MAAMQ,MAAM,GAAG,MAAqC;EACzDV,OAAO,CAACC,GAAG,CAAC,gCAAgC,CAAC;EAC7C,IAAIC,GAAG,GAAGJ,IAAI,CAACY,MAAM,EAAE,CACpBP,IAAI,CAAED,GAAG,IAAK;IACb,IAAI;MACF,IAAIE,OAA6B,GAAGC,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;MACnD,OAAOE,OAAO;IAChB,CAAC,CAAC,OAAOG,CAAC,EAAE;MACV,IAAI;QACF,OAAOF,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;MACxB,CAAC,CAAC,OAAOK,CAAC,EAAE;QACV,OAAOL,GAAG;MACZ;IACF;EACF,CAAC,CAAC,CACDM,KAAK,CAAEC,GAAG,IAAK;IACd,OAAOA,GAAG;EACZ,CAAC,CAAC;EACJ,OAAOP,GAAG;AACZ,CAAC"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=fxblox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["fxblox.ts"],"sourcesContent":["export interface wifiRemoveallResponse {\r\n status: boolean;\r\n msg: string;\r\n}\r\nexport interface rebootResponse {\r\n status: boolean;\r\n msg: string;\r\n}\r\n"],"mappings":""}
@@ -1,3 +1,4 @@
1
1
  export * as fula from './protocols/fula';
2
2
  export * as blockchain from './protocols/blockchain';
3
3
  export * as chainApi from './protocols/chain-api';
4
+ export * as fxblox from './protocols/fxblox';
@@ -53,6 +53,8 @@ interface FulaNativeModule {
53
53
  removeStorer: (seed: string, storer: string, poolID: number, cid: string) => Promise<string>;
54
54
  removeStoredReplication: (seed: string, uploader: string, poolID: number, cid: string) => Promise<string>;
55
55
  bloxFreeSpace: () => Promise<string>;
56
+ wifiRemoveall: () => Promise<string>;
57
+ reboot: () => Promise<string>;
56
58
  }
57
59
  declare const _default: FulaNativeModule;
58
60
  export default _default;
@@ -0,0 +1,7 @@
1
+ import type * as BType from '../types/fxblox';
2
+ /**
3
+ * send a command to Blox hardware to remove all save wifis.
4
+ * @returns json{status:true if success, false if fails; msg: error message or success log}
5
+ */
6
+ export declare const wifiRemoveall: () => Promise<BType.wifiRemoveallResponse>;
7
+ export declare const reboot: () => Promise<BType.rebootResponse>;
@@ -0,0 +1,8 @@
1
+ export interface wifiRemoveallResponse {
2
+ status: boolean;
3
+ msg: string;
4
+ }
5
+ export interface rebootResponse {
6
+ status: boolean;
7
+ msg: string;
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionland/react-native-fula",
3
- "version": "1.2.1001",
3
+ "version": "1.9.0",
4
4
  "description": "This package is a bridge to use the Fula libp2p protocols in the react-native which is using wnfs",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
package/src/index.tsx CHANGED
@@ -1,3 +1,4 @@
1
1
  export * as fula from './protocols/fula';
2
2
  export * as blockchain from './protocols/blockchain';
3
- export * as chainApi from './protocols/chain-api';
3
+ export * as chainApi from './protocols/chain-api';
4
+ export * as fxblox from './protocols/fxblox';
@@ -19,7 +19,7 @@ interface FulaNativeModule {
19
19
  autoFlush: boolean, //set to false always unless you know what you are doing. This is to write actions to disk explicitly after each write
20
20
  useRelay: boolean | null, // if true it forces the use of relay
21
21
  refresh: boolean // if true it forces to refresh the fula object
22
- ) => Promise<string>;
22
+ ) => Promise<string>;
23
23
  isReady: (filesystemCheck: boolean) => Promise<boolean>;
24
24
  logout: (identity: string, storePath: string) => Promise<boolean>;
25
25
  checkFailedActions: (retry: boolean, timeout: number) => Promise<boolean>;
@@ -47,7 +47,7 @@ interface FulaNativeModule {
47
47
 
48
48
  shutdown: () => Promise<void>;
49
49
 
50
- //Blockchain related functions
50
+ //Blockchain related functions
51
51
  createAccount: (seed: string) => Promise<string>;
52
52
  checkAccountExists: (account: string) => Promise<string>;
53
53
  createPool: (seed: string, poolName: string) => Promise<string>;
@@ -56,14 +56,47 @@ interface FulaNativeModule {
56
56
  leavePool: (seed: string, poolID: number) => Promise<string>;
57
57
  cancelPoolJoin: (seed: string, poolID: number) => Promise<string>;
58
58
  listPoolJoinRequests: (poolID: number) => Promise<string>;
59
- votePoolJoinRequest: (seed: string, poolID: number, account: string, accept: boolean) => Promise<string>;
60
- newReplicationRequest: (seed: string, poolID: number, replicationFactor: number, cid: string) => Promise<string>;
61
- newStoreRequest: (seed: string, poolID: number, uploader: string, cid: string) => Promise<string>;
59
+ votePoolJoinRequest: (
60
+ seed: string,
61
+ poolID: number,
62
+ account: string,
63
+ accept: boolean
64
+ ) => Promise<string>;
65
+ newReplicationRequest: (
66
+ seed: string,
67
+ poolID: number,
68
+ replicationFactor: number,
69
+ cid: string
70
+ ) => Promise<string>;
71
+ newStoreRequest: (
72
+ seed: string,
73
+ poolID: number,
74
+ uploader: string,
75
+ cid: string
76
+ ) => Promise<string>;
62
77
  listAvailableReplicationRequests: (poolID: number) => Promise<string>;
63
- removeReplicationRequest: (seed: string, poolID: number, cid: string) => Promise<string>;
64
- removeStorer: (seed: string, storer: string, poolID: number, cid: string) => Promise<string>;
65
- removeStoredReplication: (seed: string, uploader: string, poolID: number, cid: string) => Promise<string>;
78
+ removeReplicationRequest: (
79
+ seed: string,
80
+ poolID: number,
81
+ cid: string
82
+ ) => Promise<string>;
83
+ removeStorer: (
84
+ seed: string,
85
+ storer: string,
86
+ poolID: number,
87
+ cid: string
88
+ ) => Promise<string>;
89
+ removeStoredReplication: (
90
+ seed: string,
91
+ uploader: string,
92
+ poolID: number,
93
+ cid: string
94
+ ) => Promise<string>;
95
+
96
+ //Hardware
66
97
  bloxFreeSpace: () => Promise<string>;
98
+ wifiRemoveall: () => Promise<string>;
99
+ reboot: () => Promise<string>;
67
100
  }
68
101
 
69
102
  const LINKING_ERROR =