@functionland/react-native-fula 1.0.0 → 1.1.4

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 (84) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +190 -133
  3. package/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
  4. package/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
  5. package/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
  6. package/android/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  7. package/android/.gradle/7.5.1/dependencies-accessors/gc.properties +0 -0
  8. package/android/.gradle/7.5.1/executionHistory/executionHistory.bin +0 -0
  9. package/android/.gradle/7.5.1/executionHistory/executionHistory.lock +0 -0
  10. package/android/.gradle/7.5.1/fileChanges/last-build.bin +0 -0
  11. package/android/.gradle/7.5.1/fileHashes/fileHashes.bin +0 -0
  12. package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
  13. package/android/.gradle/7.5.1/fileHashes/resourceHashesCache.bin +0 -0
  14. package/android/.gradle/7.5.1/gc.properties +0 -0
  15. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  16. package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
  17. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  18. package/android/.gradle/file-system.probe +0 -0
  19. package/android/.gradle/vcs-1/gc.properties +0 -0
  20. package/android/.idea/compiler.xml +5 -5
  21. package/android/.idea/gradle.xml +18 -17
  22. package/android/.idea/jarRepositories.xml +49 -44
  23. package/android/.idea/misc.xml +9 -9
  24. package/android/.idea/sonarlint/issuestore/index.pb +0 -0
  25. package/android/.idea/vcs.xml +5 -5
  26. package/android/build.gradle +69 -69
  27. package/android/gradle/wrapper/gradle-wrapper.properties +7 -7
  28. package/android/gradle.properties +1 -1
  29. package/android/gradlew +291 -375
  30. package/android/local.properties +8 -8
  31. package/android/src/main/AndroidManifest.xml +4 -4
  32. package/android/src/main/java/land/fx/fula/ConfigRef.java +7 -7
  33. package/android/src/main/java/land/fx/fula/Cryptography.java +47 -47
  34. package/android/src/main/java/land/fx/fula/FulaModule.java +1248 -701
  35. package/android/src/main/java/land/fx/fula/FulaPackage.java +2 -2
  36. package/android/src/main/java/land/fx/fula/SharedPreferenceHelper.java +65 -65
  37. package/android/src/main/java/land/fx/fula/StaticHelper.java +13 -13
  38. package/android/src/main/java/land/fx/fula/ThreadUtils.java +42 -42
  39. package/ios/FulaModule.h +10 -10
  40. package/ios/FulaModule.m +149 -149
  41. package/lib/commonjs/index.js +5 -1
  42. package/lib/commonjs/index.js.map +1 -1
  43. package/lib/commonjs/interfaces/api-lookup.js +1653 -0
  44. package/lib/commonjs/interfaces/api-lookup.js.map +1 -0
  45. package/lib/commonjs/interfaces/fulaNativeModule.js +1 -1
  46. package/lib/commonjs/interfaces/fulaNativeModule.js.map +1 -1
  47. package/lib/commonjs/protocols/blockchain.js +404 -0
  48. package/lib/commonjs/protocols/blockchain.js.map +1 -0
  49. package/lib/commonjs/protocols/chain-api.js +87 -0
  50. package/lib/commonjs/protocols/chain-api.js.map +1 -0
  51. package/lib/commonjs/protocols/fula.js +138 -82
  52. package/lib/commonjs/protocols/fula.js.map +1 -1
  53. package/lib/commonjs/types/blockchain.js +2 -0
  54. package/lib/commonjs/types/blockchain.js.map +1 -0
  55. package/lib/module/index.js +4 -0
  56. package/lib/module/index.js.map +1 -1
  57. package/lib/module/interfaces/api-lookup.js +1648 -0
  58. package/lib/module/interfaces/api-lookup.js.map +1 -0
  59. package/lib/module/interfaces/fulaNativeModule.js +1 -1
  60. package/lib/module/interfaces/fulaNativeModule.js.map +1 -1
  61. package/lib/module/protocols/blockchain.js +383 -0
  62. package/lib/module/protocols/blockchain.js.map +1 -0
  63. package/lib/module/protocols/chain-api.js +76 -0
  64. package/lib/module/protocols/chain-api.js.map +1 -0
  65. package/lib/module/protocols/fula.js +133 -81
  66. package/lib/module/protocols/fula.js.map +1 -1
  67. package/lib/module/types/blockchain.js +2 -0
  68. package/lib/module/types/blockchain.js.map +1 -0
  69. package/lib/typescript/index.d.ts +3 -1
  70. package/lib/typescript/interfaces/api-lookup.d.ts +1643 -0
  71. package/lib/typescript/interfaces/fulaNativeModule.d.ts +57 -28
  72. package/lib/typescript/protocols/blockchain.d.ts +17 -0
  73. package/lib/typescript/protocols/chain-api.d.ts +6 -0
  74. package/lib/typescript/protocols/fula.d.ts +127 -99
  75. package/lib/typescript/types/blockchain.d.ts +68 -0
  76. package/package.json +157 -149
  77. package/react-native-fula.podspec +19 -19
  78. package/src/index.tsx +3 -1
  79. package/src/interfaces/api-lookup.ts +1647 -0
  80. package/src/interfaces/fulaNativeModule.ts +85 -52
  81. package/src/protocols/blockchain.ts +460 -0
  82. package/src/protocols/chain-api.ts +80 -0
  83. package/src/protocols/fula.ts +283 -212
  84. package/src/types/blockchain.ts +81 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Fula","createAccount","seed","console","log","res","then","jsonRes","JSON","parse","e","catch","err","checkAccountExists","account","createPool","poolName","listPools","joinPool","poolID","leavePool","cancelPoolJoin","listPoolJoinRequests","votePoolJoinRequest","accept","newReplicationRequest","replicationFactor","cid","newStoreRequest","uploader","listAvailableReplicationRequests","removeReplicationRequest","removeStorer","storer","removeStoredReplication","bloxFreeSpace"],"sources":["blockchain.ts"],"sourcesContent":["import Fula from '../interfaces/fulaNativeModule';\r\nimport type * as BType from '../types/blockchain';\r\n\r\n/*\r\ncreateAccount: This function takes a seed argument, which is used to create an account. The seed must start with \"/\". The function returns a promise of an object that contains the seed and the account that was created.\r\n*/\r\nexport const createAccount = (\r\n seed: string, //seed that is used to create the account. It must start with \"/\"\r\n): Promise<BType.SeededResponse> => {\r\n console.log(\r\n 'createAccount in react-native started',\r\n seed\r\n );\r\n let res = Fula.createAccount(seed).then((res) => {\r\n try{\r\n let jsonRes:BType.SeededResponse = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\ncheckAccountExists: This function takes an account argument, and returns a promise of an object that contains the account and a boolean exists flag. If exists is true, it means the account exists, otherwise, the account does not exist\r\n*/\r\nexport const checkAccountExists = (\r\n account: string,\r\n): Promise<BType.AccountExistsResponse> => {\r\n console.log(\r\n 'checkAccountExists in react-native started',\r\n account\r\n );\r\n let res = Fula.checkAccountExists(account).then((res) => {\r\n try{\r\n let jsonRes: BType.AccountExistsResponse = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\ncreatePool: This function takes two arguments: seed and poolName. The seed is used to identify the account that is creating the pool, and the poolName is the name of the pool being created. The function returns a promise of an object that contains the owner of the pool and the poolID of the created pool.\r\n*/\r\nexport const createPool = (seed: string, poolName: string): Promise<BType.PoolCreateResponse> => {\r\n console.log(\r\n 'createPool in react-native started',\r\n seed,\r\n poolName\r\n );\r\n let res = Fula.createPool(seed, poolName).then((res) => {\r\n try {\r\n let jsonRes: BType.PoolCreateResponse = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };\r\n \r\n /*\r\n listPools: This function takes no arguments and returns a promise of an object that contains a list of pools. Each pool in the list contains the poolID, owner, poolName, parent, and participants of the pool\r\n */\r\n export const listPools = (): Promise<BType.PoolListResponse> => {\r\n console.log(\r\n 'listPools in react-native started'\r\n );\r\n let res = Fula.listPools().then((res) => {\r\n try {\r\n let jsonRes: BType.PoolListResponse = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };\r\n\r\n /*\r\n joinPool: This function takes two arguments: seed and poolID. The seed is used to identify the account that is joining the pool, and the poolID is the ID of the pool the account is joining. The function returns a promise of an object that contains the account joining the pool and the poolID of the joined pool.\r\n */\r\n\r\n export const joinPool = (seed: string, poolID: number): Promise<BType.PoolJoinResponse> => {\r\n console.log(\r\n 'joinPool in react-native started',\r\n seed,\r\n poolID\r\n );\r\n let res = Fula.joinPool(seed, poolID).then((res) => {\r\n try {\r\n let jsonRes: BType.PoolJoinResponse = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };\r\n\r\n /*\r\n leavePool: This function takes two arguments: seed and poolID. The seed is used to identify the account that is leaving the pool, and the poolID is the ID of the pool the account is leaving. The function returns a promise of an object that contains the `\r\n */\r\n \r\n export const leavePool = (seed: string, poolID: number): Promise<BType.PoolLeaveResponse> => {\r\n console.log(\r\n 'leavePool in react-native started',\r\n seed,\r\n poolID\r\n );\r\n let res = Fula.leavePool(seed, poolID).then((res) => {\r\n try {\r\n let jsonRes: BType.PoolLeaveResponse = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };\r\n\r\n export const cancelPoolJoin = (seed: string, poolID: number): Promise<BType.PoolCancelJoinResponse> => {\r\n console.log(\r\n 'cancelPoolJoin in react-native started',\r\n seed,\r\n poolID\r\n );\r\n let res = Fula.cancelPoolJoin(seed, poolID).then((res) => {\r\n try {\r\n let jsonRes: BType.PoolCancelJoinResponse = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };\r\n export const listPoolJoinRequests = (poolID: number): Promise<BType.PoolRequestsResponse> => {\r\n console.log(\r\n 'listPoolJoinRequests in react-native started',\r\n poolID\r\n );\r\n let res = Fula.listPoolJoinRequests(poolID).then((res) => {\r\n try {\r\n let jsonRes: BType.PoolRequestsResponse = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };\r\n\r\n /*\r\n seed is used to authorize the request.\r\npoolID is the ID of the pool in which the account is requesting to join.\r\naccount is the account that is requesting to join the pool.\r\naccept is a boolean value that indicates whether to accept or reject the join request.\r\nIt returns a promise of BType.PoolVoteResponse which includes the account and poolID\r\n*/\r\n export const votePoolJoinRequest = (seed: string, poolID: number, account: string, accept: boolean): Promise<BType.PoolVoteResponse> => {\r\n console.log(\r\n 'votePoolJoinRequest in react-native started',\r\n seed,\r\n poolID,\r\n account,\r\n accept\r\n );\r\n let res = Fula.votePoolJoinRequest(seed, poolID, account, accept).then((res) => {\r\n try {\r\n let jsonRes: BType.PoolVoteResponse = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };\r\n \r\n\r\n /*\r\nIt takes four arguments:\r\n\r\nseed is used to authorize the request.\r\npoolID is the ID of the pool in which the replication request is made.\r\nreplicationFactor is the number of copies of the content to be stored.\r\ncid is the content identifier of the content to be replicated.\r\nIt returns a promise of BType.ManifestUploadResponse which includes the uploader, storage, ManifestMetadata, and poolID\r\n */\r\n export const newReplicationRequest = (seed: string, poolID: number, replicationFactor: number, cid: string): Promise<BType.ManifestUploadResponse> => {\r\n console.log(\r\n 'newReplicationRequest in react-native started',\r\n seed,\r\n poolID,\r\n replicationFactor,\r\n cid\r\n );\r\n let res = Fula.newReplicationRequest(seed, poolID, replicationFactor, cid).then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\nIt takes four arguments:\r\n\r\nseed is used to authorize the request.\r\npoolID is the ID of the pool in which the replication request is made.\r\nuploader is the account of the user making the request\r\ncid is the content identifier of the content to be stored.\r\nIt returns a promise of BType.ManifestUploadResponse which includes the uploader, storage, ManifestMetadata, and poolID\r\n*/\r\nexport const newStoreRequest = (seed: string, poolID: number, uploader: string, cid: string): Promise<BType.ManifestUploadResponse> => {\r\n console.log(\r\n 'newStoreRequest in react-native started',\r\n seed,\r\n poolID,\r\n uploader,\r\n cid\r\n );\r\n let res = Fula.newStoreRequest(seed, poolID, uploader, cid).then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n\r\n/*\r\nIt takes one argument:\r\n\r\npoolID is the ID of the pool for which the replication requests are listed\r\nIt returns a promise of BType.ManifestUploadResponse[] which is an array of the replication requests, including the uploader, storage, ManifestMetadata, and poolID\r\n*/\r\nexport const listAvailableReplicationRequests = (poolID: number): Promise<BType.ManifestUploadResponse[]> => {\r\n console.log(\r\n 'listAvailableReplicationRequests in react-native started',\r\n poolID\r\n );\r\n let res = Fula.listAvailableReplicationRequests(poolID).then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse[] = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n\r\n/*\r\nIt takes three arguments:\r\n\r\nseed is the seed of the account that is removing the replication request\r\npoolID is the ID of the pool for which the replication request is being removed\r\ncid is the content ID of the replication request being removed\r\nIt returns a promise of BType.ManifestUploadResponse which is the removed replication request, including the uploader, storage, ManifestMetadata, and poolID\r\n*/\r\nexport const removeReplicationRequest = (seed: string, poolID: number, cid: string): Promise<BType.ManifestUploadResponse> => {\r\n console.log(\r\n 'removeReplicationRequest in react-native started',\r\n seed,\r\n poolID,\r\n cid\r\n );\r\n let res = Fula.removeReplicationRequest(seed, poolID, cid).then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\nIt takes four arguments:\r\n\r\nseed is the seed of the account that is removing the storer\r\nstorer is the address of the storer that is being removed\r\npoolID is the ID of the pool for which the storer is being removed\r\ncid is the content ID of the replication request for which the storer is being removed\r\nIt returns a promise of BType.ManifestUploadResponse which is the replication request, including the uploader, storage, ManifestMetadata, and poolID after the storer has been removed.\r\n*/\r\nexport const removeStorer = (seed: string, storer: string, poolID: number, cid: string): Promise<BType.ManifestUploadResponse> => {\r\n console.log(\r\n 'removeStorer in react-native started',\r\n seed,\r\n storer,\r\n poolID,\r\n cid\r\n );\r\n let res = Fula.removeStorer(seed, storer, poolID, cid).then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n\r\n/*\r\nIt takes four arguments:\r\n\r\nseed is the seed of the account that is removing the stored replication\r\nuploader is the address of the uploader that is being removed\r\npoolID is the ID of the pool for which the stored replication is being removed\r\ncid is the content ID of the replication request for which the stored replication is being removed\r\nIt returns a promise of BType.ManifestUploadResponse which is the replication request, including the uploader, storage, ManifestMetadata, and poolID after the stored replication has been removed.\r\n*/\r\nexport const removeStoredReplication = (seed: string, uploader: string, poolID: number, cid: string): Promise<BType.ManifestUploadResponse> => {\r\n console.log(\r\n 'removeStoredReplication in react-native started',\r\n seed,\r\n uploader,\r\n poolID,\r\n cid\r\n );\r\n let res = Fula.removeStoredReplication(seed, uploader, poolID, cid).then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n /*\r\n bloxFreeSpace: This function takes no arguments and returns a promise of an object that contains the blox free space information.\r\n */\r\n export const bloxFreeSpace = (): Promise<BType.BloxFreeSpaceResponse> => {\r\n console.log(\r\n 'bloxFreeSpace in react-native started'\r\n );\r\n let res = Fula.bloxFreeSpace().then((res) => {\r\n try {\r\n let jsonRes: BType.BloxFreeSpaceResponse = 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 }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };"],"mappings":"AAAA,OAAOA,IAAI,MAAM,gCAAgC;AAGjD;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAG,CAC3BC,IAAY,CAAE;AAAA,KACoB;EAClCC,OAAO,CAACC,GAAG,CACT,uCAAuC,EACvCF,IAAI,CACL;EACD,IAAIG,GAAG,GAAGL,IAAI,CAACC,aAAa,CAACC,IAAI,CAAC,CAACI,IAAI,CAAED,GAAG,IAAK;IAC/C,IAAG;MACD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,IAAI,CAAED,GAAG,IAAK;IAC7C,IAAI;MACJ,IAAIE,OAAoC,GAAGC,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;MAC1D,OAAOE,OAAO;IACd,CAAC,CAAC,OAAOG,CAAC,EAAE;MACZ,IAAI;QACJ,OAAOF,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;MACtB,CAAC,CAAC,OAAOK,CAAC,EAAE;QACZ,OAAOL,GAAG;MACV;IACA;EACA,CAAC,CAAC,CAACM,KAAK,CAAEC,GAAG,IAAK;IAClB,OAAOA,GAAG;EACV,CAAC,CAAC;EACF,OAAOP,GAAG;AACV,CAAC"}
@@ -0,0 +1,76 @@
1
+ import { default as EventTypes } from '../interfaces/api-lookup';
2
+ import { ApiPromise, WsProvider } from '@polkadot/api';
3
+ const types = {
4
+ FulaPoolPool: EventTypes.FulaPoolPool
5
+ };
6
+ export const init = async function () {
7
+ let wsAddress = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'wss://node.testnet.fx.land';
8
+ const provider = new WsProvider(wsAddress);
9
+ const api = await ApiPromise.create({
10
+ types,
11
+ provider
12
+ }).catch(err => {
13
+ console.log(err);
14
+ return Promise.reject(err);
15
+ });
16
+ return api;
17
+ };
18
+ export const disconnectApi = async api => {
19
+ await api.disconnect();
20
+ };
21
+
22
+ /*
23
+ listPools: This function takes start index and length and returns a promise of an object that contains a list of pools. Each pool in the list contains the poolID, owner, poolName, parent, and participants of the pool
24
+ */
25
+ export const listPools = async function (api) {
26
+ let start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
27
+ let length = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
28
+ console.log('listPools in react-native started');
29
+ try {
30
+ if (api == undefined) {
31
+ api = await init();
32
+ }
33
+ const pools = {
34
+ pools: []
35
+ };
36
+ const lastPoolId = await api.query.pool.lastPoolId();
37
+ let finalReturnedId = Number(lastPoolId.toHuman());
38
+ if (Number(lastPoolId.toHuman()) > start + length) {
39
+ finalReturnedId = start + length;
40
+ }
41
+ for (let i = start; i <= finalReturnedId; i++) {
42
+ const poolInfo = await api.query.pool.pools(i).catch(err => {
43
+ console.log(err);
44
+ return Promise.reject(err);
45
+ });
46
+ if (poolInfo != null) {
47
+ let formattedPoolInfo = JSON.parse(JSON.stringify(poolInfo.toHuman()));
48
+ pools.pools.push(formattedPoolInfo);
49
+ }
50
+ }
51
+ return Promise.resolve(pools);
52
+ } catch (err) {
53
+ return Promise.reject(err);
54
+ }
55
+ };
56
+
57
+ /*
58
+ checkJoinRequest: This function takes poolId and AccontId and returns a promise of an object that contains request to the pools.
59
+ */
60
+ export const checkJoinRequest = async (api, poolId, accountId) => {
61
+ console.log('checkJoinRequest in react-native started');
62
+ try {
63
+ if (api == undefined) {
64
+ api = await init();
65
+ }
66
+ const poolRequest = await api.query.pool.poolRequests(poolId, accountId);
67
+ if (poolRequest != null) {
68
+ let formattedPoolRequest = JSON.parse(JSON.stringify(poolRequest.toHuman()));
69
+ return Promise.resolve(formattedPoolRequest);
70
+ }
71
+ return Promise.resolve(null);
72
+ } catch (err) {
73
+ return Promise.reject(err);
74
+ }
75
+ };
76
+ //# sourceMappingURL=chain-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["default","EventTypes","ApiPromise","WsProvider","types","FulaPoolPool","init","wsAddress","provider","api","create","catch","err","console","log","Promise","reject","disconnectApi","disconnect","listPools","start","length","undefined","pools","lastPoolId","query","pool","finalReturnedId","Number","toHuman","i","poolInfo","formattedPoolInfo","JSON","parse","stringify","push","resolve","checkJoinRequest","poolId","accountId","poolRequest","poolRequests","formattedPoolRequest"],"sources":["chain-api.ts"],"sourcesContent":["import { default as EventTypes } from '../interfaces/api-lookup';\r\n\r\nimport { ApiPromise, WsProvider } from '@polkadot/api';\r\nimport type * as BType from '../types/blockchain';\r\n\r\n const types = {\r\n FulaPoolPool: EventTypes.FulaPoolPool,\r\n }\r\n\r\n export const init = async (wsAddress: string = 'wss://node.testnet.fx.land'): Promise<ApiPromise> => {\r\n const provider = new WsProvider(wsAddress);\r\n const api = await ApiPromise.create({ types, provider }).catch((err) => {\r\n console.log(err);\r\n return Promise.reject(err);\r\n });\r\n return api;\r\n };\r\n\r\n export const disconnectApi = async (api: ApiPromise): Promise<void> => {\r\n await api.disconnect();\r\n };\r\n\r\n/*\r\n listPools: This function takes start index and length and returns a promise of an object that contains a list of pools. Each pool in the list contains the poolID, owner, poolName, parent, and participants of the pool\r\n */\r\n export const listPools = async (api: ApiPromise|undefined, start: number=1, length: number=10): Promise<BType.PoolListResponse> => {\r\n console.log(\r\n 'listPools in react-native started'\r\n );\r\n try {\r\n if(api == undefined) {\r\n api = await init();\r\n }\r\n const pools: BType.PoolListResponse = { pools: [] };\r\n const lastPoolId = await api.query.pool.lastPoolId();\r\n let finalReturnedId: number = Number(lastPoolId.toHuman());\r\n if (Number(lastPoolId.toHuman()) > start + length) {\r\n finalReturnedId = start + length;\r\n }\r\n for(let i=start; i<=finalReturnedId;i++) {\r\n const poolInfo = await api.query.pool\r\n .pools(i).catch((err) => {\r\n console.log(err);\r\n return Promise.reject(err);\r\n });\r\n if(poolInfo != null) {\r\n let formattedPoolInfo: BType.Pool = JSON.parse(JSON.stringify(poolInfo.toHuman()));\r\n pools.pools.push(formattedPoolInfo);\r\n }\r\n }\r\n return Promise.resolve(pools);\r\n } catch (err) {\r\n return Promise.reject(err);\r\n }\r\n }\r\n\r\n /*\r\n checkJoinRequest: This function takes poolId and AccontId and returns a promise of an object that contains request to the pools.\r\n */\r\n export const checkJoinRequest = async (api: ApiPromise|undefined, poolId: number, accountId: string): Promise<BType.PoolRequest|null> => {\r\n console.log(\r\n 'checkJoinRequest in react-native started'\r\n );\r\n try {\r\n if(api == undefined) {\r\n api = await init();\r\n }\r\n\r\n const poolRequest = await api.query.pool.poolRequests(poolId, accountId);\r\n\r\n if(poolRequest != null) {\r\n let formattedPoolRequest: BType.PoolRequest = JSON.parse(JSON.stringify(poolRequest.toHuman()));\r\n return Promise.resol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W,IAAI,IAAI,EAAE;MACpB,IAAIE,oBAAuC,GAAGV,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,SAAS,CAACM,WAAW,CAACZ,OAAO,EAAE,CAAC,CAAC;MAC/F,OAAOd,OAAO,CAACsB,OAAO,CAACM,oBAAoB,CAAC;IAChD;IACA,OAAO5B,OAAO,CAACsB,OAAO,CAAC,IAAI,CAAC;EAEhC,CAAC,CAAC,OAAOzB,GAAG,EAAE;IACV,OAAOG,OAAO,CAACC,MAAM,CAACJ,GAAG,CAAC;EAC9B;AACF,CAAC"}
@@ -1,104 +1,136 @@
1
1
  import Fula from '../interfaces/fulaNativeModule';
2
2
 
3
- /**
4
- * Get gets the value corresponding to the given key from the local datastore.
5
- // The key must be a valid ipld.Link.
6
- * @param config
7
- * @returns boolean
3
+ /**
4
+ * Get gets the value corresponding to the given key from the local datastore.
5
+ // The key must be a valid ipld.Link.
6
+ * @param config
7
+ * @returns boolean
8
8
  */
9
9
 
10
10
  export const init = function (identity, storePath, bloxAddr, exchange) {
11
- let rootCid = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
12
- console.log('init in react-native started', identity, storePath, bloxAddr, exchange);
13
- return Fula.init(identity, storePath, bloxAddr, exchange, rootCid);
11
+ let autoFlush = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
12
+ let rootCid = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
13
+ let useRelay = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : true;
14
+ let refresh = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
15
+ console.log('init in react-native started', identity, storePath, bloxAddr, exchange, autoFlush, useRelay);
16
+ return Fula.init(identity, storePath, bloxAddr, exchange, autoFlush, rootCid, useRelay, refresh);
17
+ };
18
+
19
+ /**
20
+ * Get gets the value corresponding to the given key from the local datastore.
21
+ // The key must be a valid ipld.Link.
22
+ * @param config
23
+ * @returns boolean
24
+ */
25
+
26
+ export const newClient = function (identity, storePath, bloxAddr, exchange) {
27
+ let autoFlush = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
28
+ let useRelay = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
29
+ console.log('newClient in react-native started', identity, storePath, bloxAddr, exchange, autoFlush, useRelay);
30
+ return Fula.newClient(identity, storePath, bloxAddr, exchange, autoFlush, useRelay);
14
31
  };
15
32
 
16
- /**
17
- * rm removes all data
18
- * @param path
19
- * @returns string: new cid of the root
33
+ /**
34
+ * rm removes all data
35
+ * @param path
36
+ * @returns string: new cid of the root
20
37
  */
21
38
  export const logout = (identity, storePath) => {
22
39
  return Fula.logout(identity, storePath);
23
40
  };
24
41
 
25
- /**
26
- * Get gets the value corresponding to the given key from the local datastore.
27
- // The key must be a valid ipld.Link.
28
- * @param key
29
- * @returns value
42
+ /**
43
+ * Checks if there are any un-synced changes on the device
44
+ */
45
+ export const checkFailedActions = function () {
46
+ let retry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
47
+ return Fula.checkFailedActions(retry);
48
+ };
49
+
50
+ /**
51
+ * Checks if there are any un-synced changes on the device
52
+ */
53
+ export const checkConnection = () => {
54
+ return Fula.checkConnection();
55
+ };
56
+
57
+ /**
58
+ * Get gets the value corresponding to the given key from the local datastore.
59
+ // The key must be a valid ipld.Link.
60
+ * @param key
61
+ * @returns value
30
62
  */
31
63
  export const get = key => {
32
64
  return Fula.get(key);
33
65
  };
34
66
 
35
- /**
36
- * Has checks whether the value corresponding to the given key is present in the local datastore.
37
- // The key must be a valid ipld.Link.
38
- * @param key
39
- * @returns boolean
67
+ /**
68
+ * Has checks whether the value corresponding to the given key is present in the local datastore.
69
+ // The key must be a valid ipld.Link.
70
+ * @param key
71
+ * @returns boolean
40
72
  */
41
73
  export const has = key => {
42
74
  return Fula.has(key);
43
75
  };
44
76
 
45
- /**
46
- * Push requests the given addr to download the root cid from this node.
47
- // The addr must be a valid multiaddr that includes peer ID.
48
- // this function.
49
- * @param addr
50
- * @returns null or error
77
+ /**
78
+ * Push requests the given addr to download the root cid from this node.
79
+ // The addr must be a valid multiaddr that includes peer ID.
80
+ // this function.
81
+ * @param addr
82
+ * @returns null or error
51
83
  */
52
84
  export const push = () => {
53
85
  return Fula.push();
54
86
  };
55
87
 
56
- /**
57
- * Put stores the given key value onto the local datastore.
58
- // The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding
59
- // to the given key.
60
- * @param key, value
61
- * @returns null or string
88
+ /**
89
+ * Put stores the given key value onto the local datastore.
90
+ // The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding
91
+ // to the given key.
92
+ * @param key, value
93
+ * @returns null or string
62
94
  */
63
95
  export const put = (value, codec) => {
64
96
  return Fula.put(value, codec);
65
97
  };
66
98
 
67
- /**
68
- * mkdir creates a directory at the given path.
69
- * @param path
70
- * @returns string: new cid of the root
99
+ /**
100
+ * mkdir creates a directory at the given path.
101
+ * @param path
102
+ * @returns string: new cid of the root
71
103
  */
72
104
  export const mkdir = path => {
73
105
  return Fula.mkdir(path);
74
106
  };
75
107
 
76
- /**
77
- * writeFileContent writes content at a given path
78
- * @param path
79
- * @returns string: new cid of the root
108
+ /**
109
+ * writeFileContent writes content at a given path
110
+ * @param path
111
+ * @returns string: new cid of the root
80
112
  */
81
113
  export const writeFileContent = (path, content) => {
82
114
  return Fula.writeFileContent(path, content);
83
115
  };
84
116
 
85
- /*
86
- // reads content of the file form localFilename (should include full absolute path to local file with read permission
87
- // writes content to the specified location by fulaTargetFilename in Fula filesystem
88
- // It keeps the original file modiifcation date
89
- // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
90
- // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
91
- // Returns: new cid of the root after this file is placed in the tree
117
+ /*
118
+ // reads content of the file form localFilename (should include full absolute path to local file with read permission
119
+ // writes content to the specified location by fulaTargetFilename in Fula filesystem
120
+ // It keeps the original file modiifcation date
121
+ // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
122
+ // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
123
+ // Returns: new cid of the root after this file is placed in the tree
92
124
  */
93
125
  export const writeFile = (fulaTargetFilename, localFilename) => {
94
126
  return Fula.writeFile(fulaTargetFilename, localFilename);
95
127
  };
96
128
 
97
- /**
98
- * ls lists the name of files and folders at a given path
99
- * @param path
100
- * @returns string: list of items
101
- * TODO: Findout how is the string and convert to array
129
+ /**
130
+ * ls lists the name of files and folders at a given path
131
+ * @param path
132
+ * @returns string: list of items
133
+ * TODO: Findout how is the string and convert to array
102
134
  */
103
135
  export const ls = path => {
104
136
  return Fula.ls(path).then(res => {
@@ -129,60 +161,80 @@ export const ls = path => {
129
161
  });
130
162
  };
131
163
 
132
- /**
133
- * rm removes all files and folders at a given path
134
- * @param path
135
- * @returns string: new cid of the root
164
+ /**
165
+ * rm removes all files and folders at a given path
166
+ * @param path
167
+ * @returns string: new cid of the root
136
168
  */
137
169
  export const rm = path => {
138
170
  return Fula.rm(path);
139
171
  };
140
172
 
141
- /**
142
- * cp copies the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
143
- * @param sourcePath, targetPath
144
- * @returns string: new cid of the root
173
+ /**
174
+ * cp copies the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
175
+ * @param sourcePath, targetPath
176
+ * @returns string: new cid of the root
145
177
  */
146
178
  export const cp = (sourcePath, targetPath) => {
147
179
  return Fula.cp(sourcePath, targetPath);
148
180
  };
149
181
 
150
- /**
151
- * mv moves the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
152
- * @param sourcePath, targetPath
153
- * @returns string: new cid of the root
182
+ /**
183
+ * mv moves the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
184
+ * @param sourcePath, targetPath
185
+ * @returns string: new cid of the root
154
186
  */
155
187
  export const mv = (sourcePath, targetPath) => {
156
188
  return Fula.mv(sourcePath, targetPath);
157
189
  };
158
190
 
159
- /*
160
- // reads content of the file form localFilename (should include full absolute path to local file with read permission
161
- // writes content to the specified location by fulaTargetFilename in Fula filesystem
162
- // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
163
- // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
164
- // Returns: new cid of the root after this file is placed in the tree
191
+ /*
192
+ // reads content of the file form localFilename (should include full absolute path to local file with read permission
193
+ // writes content to the specified location by fulaTargetFilename in Fula filesystem
194
+ // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
195
+ // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
196
+ // Returns: new cid of the root after this file is placed in the tree
165
197
  */
166
198
  export const readFile = (fulaTargetFilename, localFilename) => {
167
199
  return Fula.readFile(fulaTargetFilename, localFilename);
168
200
  };
169
201
 
170
- /**
171
- * readFile reads content of a given path
172
- * @param path
173
- * @returns string: cotent
202
+ /**
203
+ * readFile reads content of a given path
204
+ * @param path
205
+ * @returns string: cotent
174
206
  */
175
207
  export const readFileContent = path => {
176
208
  return Fula.readFileContent(path);
177
209
  };
178
210
 
179
- /**
180
- * Shutdown closes all resources used by Client.
181
- // After calling this function Client must be discarded.
182
- * @param
183
- * @returns
211
+ /**
212
+ * Shutdown closes all resources used by Client.
213
+ // After calling this function Client must be discarded.
214
+ * @param
215
+ * @returns
184
216
  */
185
217
  export const shutdown = () => {
186
218
  return Fula.shutdown();
187
219
  };
220
+
221
+ /**
222
+ * setAuth adds or removes a peer from the list of peers that are allowed to push to this node.
223
+ * This can only be called on a peer that is added as an owner of blox by --authorizer parameter
224
+ * @param peerId, allow
225
+ * @returns boolean: true if successful or false if not
226
+ */
227
+ export const setAuth = (peerId, allow) => {
228
+ return Fula.setAuth(peerId, allow);
229
+ };
230
+
231
+ /**
232
+ * isReady checks if the connection is ready to be used.
233
+ * @param filesystemCheck: also check if the wnfs is ready
234
+ * @returns boolean: true if ready or false if not
235
+ */
236
+ export const isReady = function () {
237
+ let filesystemCheck = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
238
+ return Fula.isReady(filesystemCheck);
239
+ };
188
240
  //# sourceMappingURL=fula.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Fula","init","identity","storePath","bloxAddr","exchange","rootCid","console","log","logout","get","key","has","push","put","value","codec","mkdir","path","writeFileContent","content","writeFile","fulaTargetFilename","localFilename","ls","then","res","lsResult","lsRows","split","element","rowItems","item","name","created","modified","jsonRes","JSON","parse","stringify","catch","e","rm","cp","sourcePath","targetPath","mv","readFile","readFileContent","shutdown"],"sources":["fula.ts"],"sourcesContent":["import Fula from '../interfaces/fulaNativeModule';\n\n/**\n * Get gets the value corresponding to the given key from the local datastore.\n// The key must be a valid ipld.Link.\n * @param config\n * @returns boolean\n */\n\nexport const init = (\n identity: string, //privateKey of did identity\n storePath: string,\n bloxAddr: string,\n exchange: string,\n rootCid: string | null = null\n): Promise<{ peerId: string; rootCid: string; private_ref: string }> => {\n console.log(\n 'init in react-native started',\n identity,\n storePath,\n bloxAddr,\n exchange\n );\n return Fula.init(identity, storePath, bloxAddr, exchange, rootCid);\n};\n\n/**\n * rm removes all data\n * @param path\n * @returns string: new cid of the root\n */\nexport const logout = (\n identity: string,\n storePath: string\n): Promise<boolean> => {\n return Fula.logout(identity, storePath);\n};\n\n/**\n * Get gets the value corresponding to the given key from the local datastore.\n// The key must be a valid ipld.Link.\n * @param key\n * @returns value\n */\nexport const get = (key: string): Promise<string> => {\n return Fula.get(key);\n};\n\n/**\n * Has checks whether the value corresponding to the given key is present in the local datastore.\n// The key must be a valid ipld.Link.\n * @param key\n * @returns boolean\n */\nexport const has = (key: Uint8Array): Promise<boolean> => {\n return Fula.has(key);\n};\n\n/**\n * Push requests the given addr to download the root cid from this node.\n// The addr must be a valid multiaddr that includes peer ID.\n// this function.\n * @param addr\n * @returns null or error\n */\nexport const push = (): Promise<string> => {\n return Fula.push();\n};\n\n/**\n * Put stores the given key value onto the local datastore.\n// The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding\n// to the given key.\n * @param key, value\n * @returns null or string\n */\nexport const put = (value: string, codec: string): Promise<string> => {\n return Fula.put(value, codec);\n};\n\n/**\n * mkdir creates a directory at the given path.\n * @param path\n * @returns string: new cid of the root\n */\nexport const mkdir = (path: string): Promise<string> => {\n return Fula.mkdir(path);\n};\n\n/**\n * writeFileContent writes content at a given path\n * @param path\n * @returns string: new cid of the root\n */\nexport const writeFileContent = (\n path: string,\n content: string\n): Promise<string> => {\n return Fula.writeFileContent(path, content);\n};\n\n/*\n // reads content of the file form localFilename (should include full absolute path to local file with read permission\n // writes content to the specified location by fulaTargetFilename in Fula filesystem\n // It keeps the original file modiifcation date\n // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)\n // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)\n // Returns: new cid of the root after this file is placed in the tree\n */\nexport const writeFile = (\n fulaTargetFilename: string,\n localFilename: string\n): Promise<string> => {\n return Fula.writeFile(fulaTargetFilename, localFilename);\n};\n\n/**\n * ls lists the name of files and folders at a given path\n * @param path\n * @returns string: list of items\n * TODO: Findout how is the string and convert to array\n */\nexport const ls = (path: string): Promise<void | JSON> => {\n return Fula.ls(path)\n .then((res) => {\n let lsResult = [];\n let lsRows = res.split('!!!');\n for (const element of lsRows) {\n let rowItems = element.split('???');\n if (rowItems && rowItems[0]) {\n let item = {\n name: '',\n created: '',\n modified: '',\n };\n item.name = rowItems[0];\n if (rowItems[1]) {\n item.created = rowItems[1];\n }\n if (rowItems[2]) {\n item.modified = rowItems[2];\n }\n lsResult.push(item);\n }\n }\n let jsonRes = JSON.parse(JSON.stringify(lsResult));\n return jsonRes;\n })\n .catch((e) => {\n return e;\n });\n};\n\n/**\n * rm removes all files and folders at a given path\n * @param path\n * @returns string: new cid of the root\n */\nexport const rm = (path: string): Promise<string> => {\n return Fula.rm(path);\n};\n\n/**\n * cp copies the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already\n * @param sourcePath, targetPath\n * @returns string: new cid of the root\n */\nexport const cp = (sourcePath: string, targetPath: string): Promise<string> => {\n return Fula.cp(sourcePath, targetPath);\n};\n\n/**\n * mv moves the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already\n * @param sourcePath, targetPath\n * @returns string: new cid of the root\n */\nexport const mv = (sourcePath: string, targetPath: string): Promise<string> => {\n return Fula.mv(sourcePath, targetPath);\n};\n\n/*\n // reads content of the file form localFilename (should include full absolute path to local file with read permission\n // writes content to the specified location by fulaTargetFilename in Fula filesystem\n // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)\n // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)\n // Returns: new cid of the root after this file is placed in the tree\n */\nexport const readFile = (\n fulaTargetFilename: string,\n localFilename: string\n): Promise<string> => {\n return Fula.readFile(fulaTargetFilename, localFilename);\n};\n\n/**\n * readFile reads content of a given path\n * @param path\n * @returns string: cotent\n */\nexport const readFileContent = (path: string): Promise<string> => {\n return Fula.readFileContent(path);\n};\n\n/**\n * Shutdown closes all resources used by Client.\n// After calling this function Client must be discarded.\n * @param\n * @returns\n */\nexport const shutdown = (): Promise<void> => {\n return Fula.shutdown();\n};\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,gCAAgC;;AAEjD;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,IAAI,GAAG,UAClBC,QAAgB,EAChBC,SAAiB,EACjBC,QAAgB,EAChBC,QAAgB,EAEsD;EAAA,IADtEC,OAAsB,uEAAG,IAAI;EAE7BC,OAAO,CAACC,GAAG,CACT,8BAA8B,EAC9BN,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,QAAQ,CACT;EACD,OAAOL,IAAI,CAACC,IAAI,CAACC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,OAAO,CAAC;AACpE,CAA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AAMyB,EAAE,GAAG,CAACC,UAAkB,EAAEC,UAAkB,KAAsB;EAC7E,OAAO7C,IAAI,CAAC2C,EAAE,CAACC,UAAU,EAAEC,UAAU,CAAC;AACxC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,EAAE,GAAG,CAACF,UAAkB,EAAEC,UAAkB,KAAsB;EAC7E,OAAO7C,IAAI,CAAC8C,EAAE,CAACF,UAAU,EAAEC,UAAU,CAAC;AACxC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,QAAQ,GAAG,CACtBzB,kBAA0B,EAC1BC,aAAqB,KACD;EACpB,OAAOvB,IAAI,CAAC+C,QAAQ,CAACzB,kBAAkB,EAAEC,aAAa,CAAC;AACzD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMyB,eAAe,GAAI9B,IAAY,IAAsB;EAChE,OAAOlB,IAAI,CAACgD,eAAe,CAAC9B,IAAI,CAAC;AACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM+B,QAAQ,GAAG,MAAqB;EAC3C,OAAOjD,IAAI,CAACiD,QAAQ,EAAE;AACxB,CAAC"}
1
+ {"version":3,"names":["Fula","init","identity","storePath","bloxAddr","exchange","autoFlush","rootCid","useRelay","refresh","console","log","newClient","logout","checkFailedActions","retry","checkConnection","get","key","has","push","put","value","codec","mkdir","path","writeFileContent","content","writeFile","fulaTargetFilename","localFilename","ls","then","res","lsResult","lsRows","split","element","rowItems","item","name","created","modified","jsonRes","JSON","parse","stringify","catch","e","rm","cp","sourcePath","targetPath","mv","readFile","readFileContent","shutdown","setAuth","peerId","allow","isReady","filesystemCheck"],"sources":["fula.ts"],"sourcesContent":["import Fula from '../interfaces/fulaNativeModule';\r\n\r\n/**\r\n * Get gets the value corresponding to the given key from the local datastore.\r\n// The key must be a valid ipld.Link.\r\n * @param config\r\n * @returns boolean\r\n */\r\n\r\nexport const init = (\r\n identity: string, //privateKey of did identity\r\n storePath: string,\r\n bloxAddr: string,\r\n exchange: string,\r\n autoFlush: boolean = false,\r\n rootCid: string | null = null,\r\n useRelay: boolean = true,\r\n refresh: boolean = false\r\n): Promise<{ peerId: string; rootCid: string; private_ref: string }> => {\r\n console.log(\r\n 'init in react-native started',\r\n identity,\r\n storePath,\r\n bloxAddr,\r\n exchange,\r\n autoFlush,\r\n useRelay\r\n );\r\n return Fula.init(identity, storePath, bloxAddr, exchange, autoFlush, rootCid, useRelay, refresh);\r\n};\r\n\r\n/**\r\n * Get gets the value corresponding to the given key from the local datastore.\r\n// The key must be a valid ipld.Link.\r\n * @param config\r\n * @returns boolean\r\n */\r\n\r\nexport const newClient = (\r\n identity: string, //privateKey of did identity\r\n storePath: string,\r\n bloxAddr: string,\r\n exchange: string,\r\n autoFlush: boolean = false,\r\n useRelay: boolean = true\r\n): Promise<string> => {\r\n console.log(\r\n 'newClient in react-native started',\r\n identity,\r\n storePath,\r\n bloxAddr,\r\n exchange,\r\n autoFlush,\r\n useRelay\r\n );\r\n return Fula.newClient(identity, storePath, bloxAddr, exchange, autoFlush, useRelay);\r\n};\r\n\r\n/**\r\n * rm removes all data\r\n * @param path\r\n * @returns string: new cid of the root\r\n */\r\nexport const logout = (\r\n identity: string,\r\n storePath: string\r\n): Promise<boolean> => {\r\n return Fula.logout(identity, storePath);\r\n};\r\n\r\n/**\r\n * Checks if there are any un-synced changes on the device\r\n */\r\nexport const checkFailedActions = (\r\n retry: boolean = false\r\n): Promise<boolean> => {\r\n return Fula.checkFailedActions(retry);\r\n};\r\n\r\n/**\r\n * Checks if there are any un-synced changes on the device\r\n */\r\nexport const checkConnection = (): Promise<boolean> => {\r\n return Fula.checkConnection();\r\n};\r\n\r\n/**\r\n * Get gets the value corresponding to the given key from the local datastore.\r\n// The key must be a valid ipld.Link.\r\n * @param key\r\n * @returns value\r\n */\r\nexport const get = (key: string): Promise<string> => {\r\n return Fula.get(key);\r\n};\r\n\r\n/**\r\n * Has checks whether the value corresponding to the given key is present in the local datastore.\r\n// The key must be a valid ipld.Link.\r\n * @param key\r\n * @returns boolean\r\n */\r\nexport const has = (key: Uint8Array): Promise<boolean> => {\r\n return Fula.has(key);\r\n};\r\n\r\n/**\r\n * Push requests the given addr to download the root cid from this node.\r\n// The addr must be a valid multiaddr that includes peer ID.\r\n// this function.\r\n * @param addr\r\n * @returns null or error\r\n */\r\nexport const push = (): Promise<string> => {\r\n return Fula.push();\r\n};\r\n\r\n/**\r\n * Put stores the given key value onto the local datastore.\r\n// The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding\r\n// to the given key.\r\n * @param key, value\r\n * @returns null or string\r\n */\r\nexport const put = (value: string, codec: string): Promise<string> => {\r\n return Fula.put(value, codec);\r\n};\r\n\r\n/**\r\n * mkdir creates a directory at the given path.\r\n * @param path\r\n * @returns string: new cid of the root\r\n */\r\nexport const mkdir = (path: string): Promise<string> => {\r\n return Fula.mkdir(path);\r\n};\r\n\r\n/**\r\n * writeFileContent writes content at a given path\r\n * @param path\r\n * @returns string: new cid of the root\r\n */\r\nexport const writeFileContent = (\r\n path: string,\r\n content: string\r\n): Promise<string> => {\r\n return Fula.writeFileContent(path, content);\r\n};\r\n\r\n/*\r\n // reads content of the file form localFilename (should include full absolute path to local file with read permission\r\n // writes content to the specified location by fulaTargetFilename in Fula filesystem\r\n // It keeps the original file modiifcation date\r\n // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)\r\n // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)\r\n // Returns: new cid of the root after this file is placed in the tree\r\n */\r\nexport const writeFile = (\r\n fulaTargetFilename: string,\r\n localFilename: string\r\n): Promise<string> => {\r\n return Fula.writeFile(fulaTargetFilename, localFilename);\r\n};\r\n\r\n/**\r\n * ls lists the name of files and folders at a given path\r\n * @param path\r\n * @returns string: list of items\r\n * TODO: Findout how is the string and convert to array\r\n */\r\nexport const ls = (path: string): Promise<void | JSON> => {\r\n return Fula.ls(path)\r\n .then((res) => {\r\n let lsResult = [];\r\n let lsRows = res.split('!!!');\r\n for (const element of lsRows) {\r\n let rowItems = element.split('???');\r\n if (rowItems && rowItems[0]) {\r\n let item = {\r\n name: '',\r\n created: '',\r\n modified: '',\r\n };\r\n item.name = rowItems[0];\r\n if (rowItems[1]) {\r\n item.created = rowItems[1];\r\n }\r\n if (rowItems[2]) {\r\n item.modified = rowItems[2];\r\n }\r\n lsResult.push(item);\r\n }\r\n }\r\n let jsonRes = JSON.parse(JSON.stringify(lsResult));\r\n return jsonRes;\r\n })\r\n .catch((e) => {\r\n return e;\r\n });\r\n};\r\n\r\n/**\r\n * rm removes all files and folders at a given path\r\n * @param path\r\n * @returns string: new cid of the root\r\n */\r\nexport const rm = (path: string): Promise<string> => {\r\n return Fula.rm(path);\r\n};\r\n\r\n/**\r\n * cp copies the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already\r\n * @param sourcePath, targetPath\r\n * @returns string: new cid of the root\r\n */\r\nexport const cp = (sourcePath: string, targetPath: string): Promise<string> => {\r\n return Fula.cp(sourcePath, targetPath);\r\n};\r\n\r\n/**\r\n * mv moves the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already\r\n * @param sourcePath, targetPath\r\n * @returns string: new cid of the root\r\n */\r\nexport const mv = (sourcePath: string, targetPath: string): Promise<string> => {\r\n return Fula.mv(sourcePath, targetPath);\r\n};\r\n\r\n/*\r\n // reads content of the file form localFilename (should include full absolute path to local file with read permission\r\n // writes content to the specified location by fulaTargetFilename in Fula filesystem\r\n // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)\r\n // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)\r\n // Returns: new cid of the root after this file is placed in the tree\r\n */\r\nexport const readFile = (\r\n fulaTargetFilename: string,\r\n localFilename: string\r\n): Promise<string> => {\r\n return Fula.readFile(fulaTargetFilename, localFilename);\r\n};\r\n\r\n/**\r\n * readFile reads content of a given path\r\n * @param path\r\n * @returns string: cotent\r\n */\r\nexport const readFileContent = (path: string): Promise<string> => {\r\n return Fula.readFileContent(path);\r\n};\r\n\r\n/**\r\n * Shutdown closes all resources used by Client.\r\n// After calling this function Client must be discarded.\r\n * @param\r\n * @returns\r\n */\r\nexport const shutdown = (): Promise<void> => {\r\n return Fula.shutdown();\r\n};\r\n\r\n/**\r\n * setAuth adds or removes a peer from the list of peers that are allowed to push to this node.\r\n * This can only be called on a peer that is added as an owner of blox by --authorizer parameter\r\n * @param peerId, allow\r\n * @returns boolean: true if successful or false if not\r\n */\r\nexport const setAuth = (\r\n peerId: string,\r\n allow: boolean\r\n): Promise<boolean> => {\r\n return Fula.setAuth(peerId, allow);\r\n};\r\n\r\n\r\n/**\r\n * isReady checks if the connection is ready to be used.\r\n * @param filesystemCheck: also check if the wnfs is ready\r\n * @returns boolean: true if ready or false if not\r\n */\r\nexport const isReady = (filesystemCheck: boolean = true): Promise<boolean> => {\r\n return Fula.isReady(filesystemCheck);\r\n};\r\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,gCAAgC;;AAEjD;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,IAAI,GAAG,UAClBC,QAAgB,EAChBC,SAAiB,EACjBC,QAAgB,EAChBC,QAAgB,EAKsD;EAAA,IAJtEC,SAAkB,uEAAG,KAAK;EAAA,IAC1BC,OAAsB,uEAAG,IAAI;EAAA,IAC7BC,QAAiB,uEAAG,IAAI;EAAA,IACxBC,OAAgB,uEAAG,KAAK;EAExBC,OAAO,CAACC,GAAG,CACT,8BAA8B,EAC9BT,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACTE,QAAQ,CACT;EACD,OAAOR,IAAI,CAACC,IAAI,CAACC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,OAAO,CAAC;AAClG,CAAC;;AAED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AAMyB,eAAe,GAAI9B,IAAY,IAAsB;EAChE,OAAOzB,IAAI,CAACuD,eAAe,CAAC9B,IAAI,CAAC;AACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM+B,QAAQ,GAAG,MAAqB;EAC3C,OAAOxD,IAAI,CAACwD,QAAQ,EAAE;AACxB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAG,CACrBC,MAAc,EACdC,KAAc,KACO;EACrB,OAAO3D,IAAI,CAACyD,OAAO,CAACC,MAAM,EAAEC,KAAK,CAAC;AACpC,CAAC;;AAGD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAG,YAAuD;EAAA,IAAtDC,eAAwB,uEAAG,IAAI;EACrD,OAAO7D,IAAI,CAAC4D,OAAO,CAACC,eAAe,CAAC;AACtC,CAAC"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=blockchain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["blockchain.ts"],"sourcesContent":[" export interface SeededResponse {\r\n seed: string;\r\n account: string;\r\n }\r\n \r\n export interface AccountExistsResponse {\r\n account: string;\r\n exists: boolean;\r\n }\r\n \r\n export interface PoolCreateResponse {\r\n owner: string;\r\n poolID: number;\r\n }\r\n \r\n export interface PoolJoinResponse {\r\n account: string;\r\n poolID: number;\r\n }\r\n \r\n export interface PoolCancelJoinResponse {\r\n account: string;\r\n poolID: number;\r\n }\r\n \r\n export interface PoolRequestsResponse {\r\n poolRequests: PoolRequest[];\r\n }\r\n \r\n export interface PoolListResponse {\r\n pools: Pool[];\r\n }\r\n \r\n export interface PoolVoteResponse {\r\n account: string;\r\n poolID: number;\r\n }\r\n \r\n export interface PoolLeaveResponse {\r\n account: string;\r\n poolID: number;\r\n }\r\n \r\n export interface ManifestUploadResponse {\r\n uploader: string;\r\n storage: string[];\r\n manifestMetadata: ManifestMetadata;\r\n poolID: number;\r\n }\r\n\r\n export interface PoolRequest {\r\n poolID: number;\r\n account: string;\r\n voted: string[];\r\n positiveVotes: number;\r\n peerID: string;\r\n }\r\n\r\n export interface Pool {\r\n poolID: number;\r\n owner: string;\r\n poolName: string;\r\n parent: string;\r\n participants: string[];\r\n }\r\n\r\n export interface ManifestMetadata {\r\n job: ManifestJob;\r\n }\r\n\r\n export interface ManifestJob {\r\n work: string;\r\n engine: string;\r\n uri: string;\r\n }\r\n export interface BloxFreeSpaceResponse {\r\n size: number;\r\n avail: number;\r\n used: number;\r\n used_percentage: number;\r\n }"],"mappings":""}
@@ -1 +1,3 @@
1
- export * as fula from './protocols/fula';
1
+ export * as fula from './protocols/fula';
2
+ export * as blockchain from './protocols/blockchain';
3
+ export * as chainApi from './protocols/chain-api';