@functionland/react-native-fula 1.0.0 → 1.1.5

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 +139 -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 +134 -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 +58 -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 +86 -52
  81. package/src/protocols/blockchain.ts +460 -0
  82. package/src/protocols/chain-api.ts +80 -0
  83. package/src/protocols/fula.ts +285 -212
  84. package/src/types/blockchain.ts +81 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createAccount","seed","console","log","res","Fula","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;AAAkD;AAGlD;AACA;AACA;AACO,MAAMA,aAAa,GAAG,CAC3BC,IAAY,CAAE;AAAA,KACoB;EAClCC,OAAO,CAACC,GAAG,CACT,uCAAuC,EACvCF,IAAI,CACL;EACD,IAAIG,GAAG,GAAGC,yBAAI,CAACL,aAAa,CAACC,IAAI,CAAC,CAACK,IAAI,CAAEF,GAAG,IAAK;IAC/C,IAAG;MACD,IAAIG,OAA4B,GA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K;IAC7C,IAAI;MACJ,IAAIG,OAAoC,GAAGC,IAAI,CAACC,KAAK,CAACL,GAAG,CAAC;MAC1D,OAAOG,OAAO;IACd,CAAC,CAAC,OAAOG,CAAC,EAAE;MACZ,IAAI;QACJ,OAAOF,IAAI,CAACC,KAAK,CAACL,GAAG,CAAC;MACtB,CAAC,CAAC,OAAOM,CAAC,EAAE;QACZ,OAAON,GAAG;MACV;IACA;EACA,CAAC,CAAC,CAACO,KAAK,CAAEC,GAAG,IAAK;IAClB,OAAOA,GAAG;EACV,CAAC,CAAC;EACF,OAAOR,GAAG;AACV,CAAC;AAAC"}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.listPools = exports.init = exports.disconnectApi = exports.checkJoinRequest = void 0;
7
+ var _apiLookup = _interopRequireDefault(require("../interfaces/api-lookup"));
8
+ var _api = require("@polkadot/api");
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ const types = {
11
+ FulaPoolPool: _apiLookup.default.FulaPoolPool
12
+ };
13
+ const init = async function () {
14
+ let wsAddress = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'wss://node.testnet.fx.land';
15
+ const provider = new _api.WsProvider(wsAddress);
16
+ const api = await _api.ApiPromise.create({
17
+ types,
18
+ provider
19
+ }).catch(err => {
20
+ console.log(err);
21
+ return Promise.reject(err);
22
+ });
23
+ return api;
24
+ };
25
+ exports.init = init;
26
+ const disconnectApi = async api => {
27
+ await api.disconnect();
28
+ };
29
+
30
+ /*
31
+ 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
32
+ */
33
+ exports.disconnectApi = disconnectApi;
34
+ const listPools = async function (api) {
35
+ let start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
36
+ let length = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
37
+ console.log('listPools in react-native started');
38
+ try {
39
+ if (api == undefined) {
40
+ api = await init();
41
+ }
42
+ const pools = {
43
+ pools: []
44
+ };
45
+ const lastPoolId = await api.query.pool.lastPoolId();
46
+ let finalReturnedId = Number(lastPoolId.toHuman());
47
+ if (Number(lastPoolId.toHuman()) > start + length) {
48
+ finalReturnedId = start + length;
49
+ }
50
+ for (let i = start; i <= finalReturnedId; i++) {
51
+ const poolInfo = await api.query.pool.pools(i).catch(err => {
52
+ console.log(err);
53
+ return Promise.reject(err);
54
+ });
55
+ if (poolInfo != null) {
56
+ let formattedPoolInfo = JSON.parse(JSON.stringify(poolInfo.toHuman()));
57
+ pools.pools.push(formattedPoolInfo);
58
+ }
59
+ }
60
+ return Promise.resolve(pools);
61
+ } catch (err) {
62
+ return Promise.reject(err);
63
+ }
64
+ };
65
+
66
+ /*
67
+ checkJoinRequest: This function takes poolId and AccontId and returns a promise of an object that contains request to the pools.
68
+ */
69
+ exports.listPools = listPools;
70
+ const checkJoinRequest = async (api, poolId, accountId) => {
71
+ console.log('checkJoinRequest in react-native started');
72
+ try {
73
+ if (api == undefined) {
74
+ api = await init();
75
+ }
76
+ const poolRequest = await api.query.pool.poolRequests(poolId, accountId);
77
+ if (poolRequest != null) {
78
+ let formattedPoolRequest = JSON.parse(JSON.stringify(poolRequest.toHuman()));
79
+ return Promise.resolve(formattedPoolRequest);
80
+ }
81
+ return Promise.resolve(null);
82
+ } catch (err) {
83
+ return Promise.reject(err);
84
+ }
85
+ };
86
+ exports.checkJoinRequest = checkJoinRequest;
87
+ //# sourceMappingURL=chain-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["types","FulaPoolPool","EventTypes","init","wsAddress","provider","WsProvider","api","ApiPromise","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.resolve(formattedPoolRequest);\r\n }\r\n return Promise.resolve(null);\r\n \r\n } catch (err) {\r\n return Promise.reject(err);\r\n }\r\n }"],"mappings":";;;;;;AAAA;AAEA;AAAuD;AAGnD,MAAMA,KAAK,GAAG;EACVC,YAAY,EAAEC,kBAAU,CAACD;AAC7B,CAAC;AAEM,MAAME,IAAI,GAAG,kBAAiF;EAAA,IAA1EC,SAAiB,uEAAG,4BAA4B;EACvE,MAAMC,QAAQ,GAAG,IAAIC,eAAU,CAACF,SAAS,CAAC;EAC1C,MAAMG,GAAG,GAAG,MAAMC,eAAU,CAACC,MAAM,CAAC;IAAET,KAAK;IAAEK;EAAS,CAAC,CAAC,CAACK,KAAK,CAAEC,GAAG,IAAK;IACpEC,OAAO,CAACC,GAAG,CAACF,GAAG,CAAC;IAChB,OAAOG,OAAO,CAACC,MAAM,CAACJ,GAAG,CAAC;EAC9B,CAAC,CAAC;EACF,OAAOJ,GAAG;AACd,CAAC;AAAC;AAEK,MAAMS,aAAa,GAAG,MAAOT,GAAe,IAAoB;EACnE,MAAMA,GAAG,CAACU,UAAU,EAAE;AAC1B,CAAC;;AAEL;AACA;AACA;AAFA;AAGS,MAAMC,SAAS,GAAG,gBAAOX,GAAyB,EAA0E;EAAA,IAAxEY,KAAa,uEAAC,CAAC;EAAA,IAAEC,MAAc,uEAAC,EAAE;EAC3FR,OAAO,CAACC,GAAG,CACP,mCAAmC,CACtC;EACD,IAAI;IACA,IAAGN,GAAG,IAAIc,SAAS,EAAE;MACjBd,GAAG,GAAG,MAAMJ,IAAI,EAAE;IACtB;IACA,MAAMmB,KAA6B,GAA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ACjBd,GAAG,GAAG,MAAMJ,IAAI,EAAE;IACtB;IAEA,MAAMqC,WAAW,GAAG,MAAMjC,GAAG,CAACiB,KAAK,CAACC,IAAI,CAACgB,YAAY,CAACH,MAAM,EAAEC,SAAS,CAAC;IAExE,IAAGC,WAAW,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;AAAA"}
@@ -3,116 +3,151 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.writeFileContent = exports.writeFile = exports.shutdown = exports.rm = exports.readFileContent = exports.readFile = exports.put = exports.push = exports.mv = exports.mkdir = exports.ls = exports.logout = exports.init = exports.has = exports.get = exports.cp = void 0;
6
+ exports.writeFileContent = exports.writeFile = exports.shutdown = exports.setAuth = exports.rm = exports.readFileContent = exports.readFile = exports.put = exports.push = exports.newClient = exports.mv = exports.mkdir = exports.ls = exports.logout = exports.isReady = exports.init = exports.has = exports.get = exports.cp = exports.checkFailedActions = exports.checkConnection = void 0;
7
7
  var _fulaNativeModule = _interopRequireDefault(require("../interfaces/fulaNativeModule"));
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
- /**
10
- * Get gets the value corresponding to the given key from the local datastore.
11
- // The key must be a valid ipld.Link.
12
- * @param config
13
- * @returns boolean
9
+ /**
10
+ * Get gets the value corresponding to the given key from the local datastore.
11
+ // The key must be a valid ipld.Link.
12
+ * @param config
13
+ * @returns boolean
14
14
  */
15
15
 
16
16
  const init = function (identity, storePath, bloxAddr, exchange) {
17
- let rootCid = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
18
- console.log('init in react-native started', identity, storePath, bloxAddr, exchange);
19
- return _fulaNativeModule.default.init(identity, storePath, bloxAddr, exchange, rootCid);
17
+ let autoFlush = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
18
+ let rootCid = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
19
+ let useRelay = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : true;
20
+ let refresh = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
21
+ console.log('init in react-native started', identity, storePath, bloxAddr, exchange, autoFlush, useRelay);
22
+ return _fulaNativeModule.default.init(identity, storePath, bloxAddr, exchange, autoFlush, rootCid, useRelay, refresh);
20
23
  };
21
24
 
22
- /**
23
- * rm removes all data
24
- * @param path
25
- * @returns string: new cid of the root
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 config
29
+ * @returns boolean
26
30
  */
27
31
  exports.init = init;
32
+ const newClient = function (identity, storePath, bloxAddr, exchange) {
33
+ let autoFlush = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
34
+ let useRelay = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
35
+ let refresh = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
36
+ console.log('newClient in react-native started', identity, storePath, bloxAddr, exchange, autoFlush, useRelay, refresh);
37
+ return _fulaNativeModule.default.newClient(identity, storePath, bloxAddr, exchange, autoFlush, useRelay, refresh);
38
+ };
39
+
40
+ /**
41
+ * rm removes all data
42
+ * @param path
43
+ * @returns string: new cid of the root
44
+ */
45
+ exports.newClient = newClient;
28
46
  const logout = (identity, storePath) => {
29
47
  return _fulaNativeModule.default.logout(identity, storePath);
30
48
  };
31
49
 
32
- /**
33
- * Get gets the value corresponding to the given key from the local datastore.
34
- // The key must be a valid ipld.Link.
35
- * @param key
36
- * @returns value
50
+ /**
51
+ * Checks if there are any un-synced changes on the device
37
52
  */
38
53
  exports.logout = logout;
54
+ const checkFailedActions = function () {
55
+ let retry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
56
+ return _fulaNativeModule.default.checkFailedActions(retry);
57
+ };
58
+
59
+ /**
60
+ * Checks if there are any un-synced changes on the device
61
+ */
62
+ exports.checkFailedActions = checkFailedActions;
63
+ const checkConnection = () => {
64
+ return _fulaNativeModule.default.checkConnection();
65
+ };
66
+
67
+ /**
68
+ * Get gets the value corresponding to the given key from the local datastore.
69
+ // The key must be a valid ipld.Link.
70
+ * @param key
71
+ * @returns value
72
+ */
73
+ exports.checkConnection = checkConnection;
39
74
  const get = key => {
40
75
  return _fulaNativeModule.default.get(key);
41
76
  };
42
77
 
43
- /**
44
- * Has checks whether the value corresponding to the given key is present in the local datastore.
45
- // The key must be a valid ipld.Link.
46
- * @param key
47
- * @returns boolean
78
+ /**
79
+ * Has checks whether the value corresponding to the given key is present in the local datastore.
80
+ // The key must be a valid ipld.Link.
81
+ * @param key
82
+ * @returns boolean
48
83
  */
49
84
  exports.get = get;
50
85
  const has = key => {
51
86
  return _fulaNativeModule.default.has(key);
52
87
  };
53
88
 
54
- /**
55
- * Push requests the given addr to download the root cid from this node.
56
- // The addr must be a valid multiaddr that includes peer ID.
57
- // this function.
58
- * @param addr
59
- * @returns null or error
89
+ /**
90
+ * Push requests the given addr to download the root cid from this node.
91
+ // The addr must be a valid multiaddr that includes peer ID.
92
+ // this function.
93
+ * @param addr
94
+ * @returns null or error
60
95
  */
61
96
  exports.has = has;
62
97
  const push = () => {
63
98
  return _fulaNativeModule.default.push();
64
99
  };
65
100
 
66
- /**
67
- * Put stores the given key value onto the local datastore.
68
- // The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding
69
- // to the given key.
70
- * @param key, value
71
- * @returns null or string
101
+ /**
102
+ * Put stores the given key value onto the local datastore.
103
+ // The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding
104
+ // to the given key.
105
+ * @param key, value
106
+ * @returns null or string
72
107
  */
73
108
  exports.push = push;
74
109
  const put = (value, codec) => {
75
110
  return _fulaNativeModule.default.put(value, codec);
76
111
  };
77
112
 
78
- /**
79
- * mkdir creates a directory at the given path.
80
- * @param path
81
- * @returns string: new cid of the root
113
+ /**
114
+ * mkdir creates a directory at the given path.
115
+ * @param path
116
+ * @returns string: new cid of the root
82
117
  */
83
118
  exports.put = put;
84
119
  const mkdir = path => {
85
120
  return _fulaNativeModule.default.mkdir(path);
86
121
  };
87
122
 
88
- /**
89
- * writeFileContent writes content at a given path
90
- * @param path
91
- * @returns string: new cid of the root
123
+ /**
124
+ * writeFileContent writes content at a given path
125
+ * @param path
126
+ * @returns string: new cid of the root
92
127
  */
93
128
  exports.mkdir = mkdir;
94
129
  const writeFileContent = (path, content) => {
95
130
  return _fulaNativeModule.default.writeFileContent(path, content);
96
131
  };
97
132
 
98
- /*
99
- // reads content of the file form localFilename (should include full absolute path to local file with read permission
100
- // writes content to the specified location by fulaTargetFilename in Fula filesystem
101
- // It keeps the original file modiifcation date
102
- // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
103
- // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
104
- // Returns: new cid of the root after this file is placed in the tree
133
+ /*
134
+ // reads content of the file form localFilename (should include full absolute path to local file with read permission
135
+ // writes content to the specified location by fulaTargetFilename in Fula filesystem
136
+ // It keeps the original file modiifcation date
137
+ // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
138
+ // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
139
+ // Returns: new cid of the root after this file is placed in the tree
105
140
  */
106
141
  exports.writeFileContent = writeFileContent;
107
142
  const writeFile = (fulaTargetFilename, localFilename) => {
108
143
  return _fulaNativeModule.default.writeFile(fulaTargetFilename, localFilename);
109
144
  };
110
145
 
111
- /**
112
- * ls lists the name of files and folders at a given path
113
- * @param path
114
- * @returns string: list of items
115
- * TODO: Findout how is the string and convert to array
146
+ /**
147
+ * ls lists the name of files and folders at a given path
148
+ * @param path
149
+ * @returns string: list of items
150
+ * TODO: Findout how is the string and convert to array
116
151
  */
117
152
  exports.writeFile = writeFile;
118
153
  const ls = path => {
@@ -144,67 +179,89 @@ const ls = path => {
144
179
  });
145
180
  };
146
181
 
147
- /**
148
- * rm removes all files and folders at a given path
149
- * @param path
150
- * @returns string: new cid of the root
182
+ /**
183
+ * rm removes all files and folders at a given path
184
+ * @param path
185
+ * @returns string: new cid of the root
151
186
  */
152
187
  exports.ls = ls;
153
188
  const rm = path => {
154
189
  return _fulaNativeModule.default.rm(path);
155
190
  };
156
191
 
157
- /**
158
- * cp copies the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
159
- * @param sourcePath, targetPath
160
- * @returns string: new cid of the root
192
+ /**
193
+ * cp copies the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
194
+ * @param sourcePath, targetPath
195
+ * @returns string: new cid of the root
161
196
  */
162
197
  exports.rm = rm;
163
198
  const cp = (sourcePath, targetPath) => {
164
199
  return _fulaNativeModule.default.cp(sourcePath, targetPath);
165
200
  };
166
201
 
167
- /**
168
- * mv moves the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
169
- * @param sourcePath, targetPath
170
- * @returns string: new cid of the root
202
+ /**
203
+ * mv moves the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
204
+ * @param sourcePath, targetPath
205
+ * @returns string: new cid of the root
171
206
  */
172
207
  exports.cp = cp;
173
208
  const mv = (sourcePath, targetPath) => {
174
209
  return _fulaNativeModule.default.mv(sourcePath, targetPath);
175
210
  };
176
211
 
177
- /*
178
- // reads content of the file form localFilename (should include full absolute path to local file with read permission
179
- // writes content to the specified location by fulaTargetFilename in Fula filesystem
180
- // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
181
- // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
182
- // Returns: new cid of the root after this file is placed in the tree
212
+ /*
213
+ // reads content of the file form localFilename (should include full absolute path to local file with read permission
214
+ // writes content to the specified location by fulaTargetFilename in Fula filesystem
215
+ // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
216
+ // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
217
+ // Returns: new cid of the root after this file is placed in the tree
183
218
  */
184
219
  exports.mv = mv;
185
220
  const readFile = (fulaTargetFilename, localFilename) => {
186
221
  return _fulaNativeModule.default.readFile(fulaTargetFilename, localFilename);
187
222
  };
188
223
 
189
- /**
190
- * readFile reads content of a given path
191
- * @param path
192
- * @returns string: cotent
224
+ /**
225
+ * readFile reads content of a given path
226
+ * @param path
227
+ * @returns string: cotent
193
228
  */
194
229
  exports.readFile = readFile;
195
230
  const readFileContent = path => {
196
231
  return _fulaNativeModule.default.readFileContent(path);
197
232
  };
198
233
 
199
- /**
200
- * Shutdown closes all resources used by Client.
201
- // After calling this function Client must be discarded.
202
- * @param
203
- * @returns
234
+ /**
235
+ * Shutdown closes all resources used by Client.
236
+ // After calling this function Client must be discarded.
237
+ * @param
238
+ * @returns
204
239
  */
205
240
  exports.readFileContent = readFileContent;
206
241
  const shutdown = () => {
207
242
  return _fulaNativeModule.default.shutdown();
208
243
  };
244
+
245
+ /**
246
+ * setAuth adds or removes a peer from the list of peers that are allowed to push to this node.
247
+ * This can only be called on a peer that is added as an owner of blox by --authorizer parameter
248
+ * @param peerId, allow
249
+ * @returns boolean: true if successful or false if not
250
+ */
209
251
  exports.shutdown = shutdown;
252
+ const setAuth = (peerId, allow) => {
253
+ return _fulaNativeModule.default.setAuth(peerId, allow);
254
+ };
255
+
256
+ /**
257
+ * isReady checks if the connection is ready to be used.
258
+ * @param filesystemCheck: also check if the wnfs is ready
259
+ * @returns boolean: true if ready or false if not
260
+ */
261
+ exports.setAuth = setAuth;
262
+ const isReady = function () {
263
+ let filesystemCheck = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
264
+ return _fulaNativeModule.default.isReady(filesystemCheck);
265
+ };
266
+ exports.isReady = isReady;
210
267
  //# sourceMappingURL=fula.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["init","identity","storePath","bloxAddr","exchange","rootCid","console","log","Fula","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;AAAkD;AAElD;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,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,OAAOI,yBAAI,CAACR,IAAI,CAACC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,OAAO,CAAC;AACpE,CAAC;;A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KO,MAAMyB,EAAE,GAAG,CAACC,UAAkB,EAAEC,UAAkB,KAAsB;EAC7E,OAAOrC,yBAAI,CAACmC,EAAE,CAACC,UAAU,EAAEC,UAAU,CAAC;AACxC,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJA;AAKO,MAAMC,EAAE,GAAG,CAACF,UAAkB,EAAEC,UAAkB,KAAsB;EAC7E,OAAOrC,yBAAI,CAACsC,EAAE,CAACF,UAAU,EAAEC,UAAU,CAAC;AACxC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAOO,MAAME,QAAQ,GAAG,CACtBzB,kBAA0B,EAC1BC,aAAqB,KACD;EACpB,OAAOf,yBAAI,CAACuC,QAAQ,CAACzB,kBAAkB,EAAEC,aAAa,CAAC;AACzD,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJA;AAKO,MAAMyB,eAAe,GAAI9B,IAAY,IAAsB;EAChE,OAAOV,yBAAI,CAACwC,eAAe,CAAC9B,IAAI,CAAC;AACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA;AAMO,MAAM+B,QAAQ,GAAG,MAAqB;EAC3C,OAAOzC,yBAAI,CAACyC,QAAQ,EAAE;AACxB,CAAC;AAAC"}
1
+ {"version":3,"names":["init","identity","storePath","bloxAddr","exchange","autoFlush","rootCid","useRelay","refresh","console","log","Fula","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 refresh: boolean = false\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 refresh\r\n );\r\n return Fula.newClient(identity, storePath, bloxAddr, exchange, autoFlush, useRelay, refresh);\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;AAAkD;AAElD;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,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,OAAOI,yBAAI,CAACX,IAAI,CAACC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,OAAO,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C2C,QAAQ,CAACzB,kBAAkB,EAAEC,aAAa,CAAC;AACzD,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJA;AAKO,MAAMyB,eAAe,GAAI9B,IAAY,IAAsB;EAChE,OAAOd,yBAAI,CAAC4C,eAAe,CAAC9B,IAAI,CAAC;AACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA;AAMO,MAAM+B,QAAQ,GAAG,MAAqB;EAC3C,OAAO7C,yBAAI,CAAC6C,QAAQ,EAAE;AACxB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA;AAMO,MAAMC,OAAO,GAAG,CACrBC,MAAc,EACdC,KAAc,KACO;EACrB,OAAOhD,yBAAI,CAAC8C,OAAO,CAACC,MAAM,EAAEC,KAAK,CAAC;AACpC,CAAC;;AAGD;AACA;AACA;AACA;AACA;AAJA;AAKO,MAAMC,OAAO,GAAG,YAAuD;EAAA,IAAtDC,eAAwB,uEAAG,IAAI;EACrD,OAAOlD,yBAAI,CAACiD,OAAO,CAACC,eAAe,CAAC;AACtC,CAAC;AAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
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,3 +1,7 @@
1
1
  import * as _fula from './protocols/fula';
2
2
  export { _fula as fula };
3
+ import * as _blockchain from './protocols/blockchain';
4
+ export { _blockchain as blockchain };
5
+ import * as _chainApi from './protocols/chain-api';
6
+ export { _chainApi as chainApi };
3
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["fula"],"sources":["index.tsx"],"sourcesContent":["export * as fula from './protocols/fula';"],"mappings":"uBAAsB,kBAAkB;AAAA,kBAA5BA,IAAI"}
1
+ {"version":3,"names":["fula","blockchain","chainApi"],"sources":["index.tsx"],"sourcesContent":["export * as fula from './protocols/fula';\r\nexport * as blockchain from './protocols/blockchain';\r\nexport * as chainApi from './protocols/chain-api';"],"mappings":"uBAAsB,kBAAkB;AAAA,kBAA5BA,IAAI;AAAA,6BACY,wBAAwB;AAAA,wBAAxCC,UAAU;AAAA,2BACI,uBAAuB;AAAA,sBAArCC,QAAQ"}