@functionland/react-native-fula 1.8.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +214 -205
  2. package/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
  3. package/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
  4. package/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
  5. package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
  6. package/android/.gradle/7.6/checksums/checksums.lock +0 -0
  7. package/android/.gradle/7.6/checksums/md5-checksums.bin +0 -0
  8. package/android/.gradle/7.6/checksums/sha1-checksums.bin +0 -0
  9. package/android/.gradle/7.6/executionHistory/executionHistory.bin +0 -0
  10. package/android/.gradle/7.6/executionHistory/executionHistory.lock +0 -0
  11. package/android/.gradle/7.6/fileHashes/fileHashes.bin +0 -0
  12. package/android/.gradle/7.6/fileHashes/fileHashes.lock +0 -0
  13. package/android/.gradle/7.6/fileHashes/resourceHashesCache.bin +0 -0
  14. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  15. package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
  16. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  17. package/android/.gradle/file-system.probe +0 -0
  18. package/android/.idea/compiler.xml +1 -1
  19. package/android/.idea/gradle.xml +1 -0
  20. package/android/.idea/misc.xml +9 -9
  21. package/android/.idea/sonarlint/securityhotspotstore/index.pb +0 -0
  22. package/android/build.gradle +2 -1
  23. package/android/src/main/java/land/fx/fula/Cryptography.java +60 -60
  24. package/android/src/main/java/land/fx/fula/FulaModule.java +126 -17
  25. package/android/src/main/java/land/fx/fula/FulaPackage.java +32 -32
  26. package/lib/commonjs/index.js.map +1 -1
  27. package/lib/commonjs/interfaces/fulaNativeModule.js.map +1 -1
  28. package/lib/commonjs/protocols/blockchain.js +12 -12
  29. package/lib/commonjs/protocols/blockchain.js.map +1 -1
  30. package/lib/commonjs/protocols/fula.js +113 -98
  31. package/lib/commonjs/protocols/fula.js.map +1 -1
  32. package/lib/commonjs/protocols/fxblox.js +23 -4
  33. package/lib/commonjs/protocols/fxblox.js.map +1 -1
  34. package/lib/commonjs/types/fxblox.js.map +1 -1
  35. package/lib/module/index.js.map +1 -1
  36. package/lib/module/interfaces/fulaNativeModule.js.map +1 -1
  37. package/lib/module/protocols/blockchain.js +12 -12
  38. package/lib/module/protocols/blockchain.js.map +1 -1
  39. package/lib/module/protocols/fula.js +109 -96
  40. package/lib/module/protocols/fula.js.map +1 -1
  41. package/lib/module/protocols/fxblox.js +21 -3
  42. package/lib/module/protocols/fxblox.js.map +1 -1
  43. package/lib/module/types/fxblox.js.map +1 -1
  44. package/lib/typescript/interfaces/fulaNativeModule.d.ts +3 -0
  45. package/lib/typescript/protocols/fula.d.ts +5 -0
  46. package/lib/typescript/protocols/fxblox.d.ts +1 -0
  47. package/lib/typescript/types/fxblox.d.ts +4 -0
  48. package/package.json +1 -1
  49. package/src/index.tsx +4 -4
  50. package/src/interfaces/fulaNativeModule.ts +43 -8
  51. package/src/protocols/blockchain.ts +318 -274
  52. package/src/protocols/fula.ts +301 -286
  53. package/src/protocols/fxblox.ts +49 -28
  54. package/src/types/fxblox.ts +8 -4
@@ -5,26 +5,25 @@ import type * as BType from '../types/blockchain';
5
5
  createAccount: 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.
6
6
  */
7
7
  export const createAccount = (
8
- seed: string, //seed that is used to create the account. It must start with "/"
8
+ seed: string //seed that is used to create the account. It must start with "/"
9
9
  ): Promise<BType.SeededResponse> => {
10
- console.log(
11
- 'createAccount in react-native started',
12
- seed
13
- );
14
- let res = Fula.createAccount(seed).then((res) => {
15
- try{
16
- let jsonRes:BType.SeededResponse = JSON.parse(res);
17
- return jsonRes;
18
- } catch (e) {
10
+ console.log('createAccount in react-native started', seed);
11
+ let res = Fula.createAccount(seed)
12
+ .then((res) => {
19
13
  try {
20
- return JSON.parse(res)
14
+ let jsonRes: BType.SeededResponse = JSON.parse(res);
15
+ return jsonRes;
21
16
  } catch (e) {
22
- return res;
17
+ try {
18
+ return JSON.parse(res);
19
+ } catch (e) {
20
+ return res;
21
+ }
23
22
  }
24
- }
25
- }).catch((err) => {
26
- return err;
27
- });
23
+ })
24
+ .catch((err) => {
25
+ return err;
26
+ });
28
27
  return res;
29
28
  };
30
29
 
@@ -32,211 +31,221 @@ export const createAccount = (
32
31
  checkAccountExists: 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
33
32
  */
34
33
  export const checkAccountExists = (
35
- account: string,
34
+ account: string
36
35
  ): Promise<BType.AccountExistsResponse> => {
37
- console.log(
38
- 'checkAccountExists in react-native started',
39
- account
40
- );
41
- let res = Fula.checkAccountExists(account).then((res) => {
42
- try{
43
- let jsonRes: BType.AccountExistsResponse = JSON.parse(res);
44
- return jsonRes;
45
- } catch (e) {
36
+ console.log('checkAccountExists in react-native started', account);
37
+ let res = Fula.checkAccountExists(account)
38
+ .then((res) => {
46
39
  try {
47
- return JSON.parse(res)
40
+ let jsonRes: BType.AccountExistsResponse = JSON.parse(res);
41
+ return jsonRes;
48
42
  } catch (e) {
49
- return res;
43
+ try {
44
+ return JSON.parse(res);
45
+ } catch (e) {
46
+ return res;
47
+ }
50
48
  }
51
- }
52
- }).catch((err) => {
53
- return err;
54
- });
49
+ })
50
+ .catch((err) => {
51
+ return err;
52
+ });
55
53
  return res;
56
54
  };
57
55
 
58
56
  /*
59
57
  createPool: 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.
60
58
  */
61
- export const createPool = (seed: string, poolName: string): Promise<BType.PoolCreateResponse> => {
62
- console.log(
63
- 'createPool in react-native started',
64
- seed,
65
- poolName
66
- );
67
- let res = Fula.createPool(seed, poolName).then((res) => {
68
- try {
69
- let jsonRes: BType.PoolCreateResponse = JSON.parse(res);
70
- return jsonRes;
71
- } catch (e) {
72
- try {
73
- return JSON.parse(res);
74
- } catch (e) {
75
- return res;
76
- }
77
- }
78
- }).catch((err) => {
79
- return err;
80
- });
59
+ export const createPool = (
60
+ seed: string,
61
+ poolName: string
62
+ ): Promise<BType.PoolCreateResponse> => {
63
+ console.log('createPool in react-native started', seed, poolName);
64
+ let res = Fula.createPool(seed, poolName)
65
+ .then((res) => {
66
+ try {
67
+ let jsonRes: BType.PoolCreateResponse = JSON.parse(res);
68
+ return jsonRes;
69
+ } catch (e) {
70
+ try {
71
+ return JSON.parse(res);
72
+ } catch (e) {
73
+ return res;
74
+ }
75
+ }
76
+ })
77
+ .catch((err) => {
78
+ return err;
79
+ });
81
80
  return res;
82
- };
83
-
84
- /*
81
+ };
82
+
83
+ /*
85
84
  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
86
85
  */
87
- export const listPools = (): Promise<BType.PoolListResponse> => {
88
- console.log(
89
- 'listPools in react-native started'
90
- );
91
- let res = Fula.listPools().then((res) => {
92
- try {
93
- let jsonRes: BType.PoolListResponse = JSON.parse(res);
94
- return jsonRes;
95
- } catch (e) {
96
- try {
97
- return JSON.parse(res);
98
- } catch (e) {
99
- return res;
100
- }
101
- }
102
- }).catch((err) => {
103
- return err;
86
+ export const listPools = (): Promise<BType.PoolListResponse> => {
87
+ console.log('listPools in react-native started');
88
+ let res = Fula.listPools()
89
+ .then((res) => {
90
+ try {
91
+ let jsonRes: BType.PoolListResponse = JSON.parse(res);
92
+ return jsonRes;
93
+ } catch (e) {
94
+ try {
95
+ return JSON.parse(res);
96
+ } catch (e) {
97
+ return res;
98
+ }
99
+ }
100
+ })
101
+ .catch((err) => {
102
+ return err;
104
103
  });
105
- return res;
106
- };
104
+ return res;
105
+ };
107
106
 
108
- /*
107
+ /*
109
108
  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.
110
109
  */
111
110
 
112
- export const joinPool = (seed: string, poolID: number): Promise<BType.PoolJoinResponse> => {
113
- console.log(
114
- 'joinPool in react-native started',
115
- seed,
116
- poolID
117
- );
118
- let res = Fula.joinPool(seed, poolID).then((res) => {
119
- try {
120
- let jsonRes: BType.PoolJoinResponse = JSON.parse(res);
121
- return jsonRes;
122
- } catch (e) {
111
+ export const joinPool = (
112
+ seed: string,
113
+ poolID: number
114
+ ): Promise<BType.PoolJoinResponse> => {
115
+ console.log('joinPool in react-native started', seed, poolID);
116
+ let res = Fula.joinPool(seed, poolID)
117
+ .then((res) => {
123
118
  try {
124
- return JSON.parse(res);
119
+ let jsonRes: BType.PoolJoinResponse = JSON.parse(res);
120
+ return jsonRes;
125
121
  } catch (e) {
126
- return res;
127
- }
122
+ try {
123
+ return JSON.parse(res);
124
+ } catch (e) {
125
+ return res;
126
+ }
128
127
  }
129
- }).catch((err) => {
128
+ })
129
+ .catch((err) => {
130
130
  return err;
131
- });
132
- return res;
133
- };
131
+ });
132
+ return res;
133
+ };
134
134
 
135
- /*
135
+ /*
136
136
  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 `
137
137
  */
138
-
139
- export const leavePool = (seed: string, poolID: number): Promise<BType.PoolLeaveResponse> => {
140
- console.log(
141
- 'leavePool in react-native started',
142
- seed,
143
- poolID
144
- );
145
- let res = Fula.leavePool(seed, poolID).then((res) => {
146
- try {
138
+
139
+ export const leavePool = (
140
+ seed: string,
141
+ poolID: number
142
+ ): Promise<BType.PoolLeaveResponse> => {
143
+ console.log('leavePool in react-native started', seed, poolID);
144
+ let res = Fula.leavePool(seed, poolID)
145
+ .then((res) => {
146
+ try {
147
147
  let jsonRes: BType.PoolLeaveResponse = JSON.parse(res);
148
148
  return jsonRes;
149
- } catch (e) {
149
+ } catch (e) {
150
150
  try {
151
- return JSON.parse(res);
151
+ return JSON.parse(res);
152
152
  } catch (e) {
153
- return res;
154
- }
153
+ return res;
155
154
  }
156
- }).catch((err) => {
157
- return err;
158
- });
159
- return res;
160
- };
155
+ }
156
+ })
157
+ .catch((err) => {
158
+ return err;
159
+ });
160
+ return res;
161
+ };
161
162
 
162
- export const cancelPoolJoin = (seed: string, poolID: number): Promise<BType.PoolCancelJoinResponse> => {
163
- console.log(
164
- 'cancelPoolJoin in react-native started',
165
- seed,
166
- poolID
167
- );
168
- let res = Fula.cancelPoolJoin(seed, poolID).then((res) => {
169
- try {
170
- let jsonRes: BType.PoolCancelJoinResponse = JSON.parse(res);
171
- return jsonRes;
172
- } catch (e) {
173
- try {
163
+ export const cancelPoolJoin = (
164
+ seed: string,
165
+ poolID: number
166
+ ): Promise<BType.PoolCancelJoinResponse> => {
167
+ console.log('cancelPoolJoin in react-native started', seed, poolID);
168
+ let res = Fula.cancelPoolJoin(seed, poolID)
169
+ .then((res) => {
170
+ try {
171
+ let jsonRes: BType.PoolCancelJoinResponse = JSON.parse(res);
172
+ return jsonRes;
173
+ } catch (e) {
174
+ try {
174
175
  return JSON.parse(res);
175
- } catch (e) {
176
+ } catch (e) {
176
177
  return res;
177
- }
178
- }
179
- }).catch((err) => {
180
- return err;
181
- });
178
+ }
179
+ }
180
+ })
181
+ .catch((err) => {
182
+ return err;
183
+ });
184
+ return res;
185
+ };
186
+ export const listPoolJoinRequests = (
187
+ poolID: number
188
+ ): Promise<BType.PoolRequestsResponse> => {
189
+ console.log('listPoolJoinRequests in react-native started', poolID);
190
+ let res = Fula.listPoolJoinRequests(poolID)
191
+ .then((res) => {
192
+ try {
193
+ let jsonRes: BType.PoolRequestsResponse = JSON.parse(res);
194
+ return jsonRes;
195
+ } catch (e) {
196
+ try {
197
+ return JSON.parse(res);
198
+ } catch (e) {
182
199
  return res;
183
- };
184
- export const listPoolJoinRequests = (poolID: number): Promise<BType.PoolRequestsResponse> => {
185
- console.log(
186
- 'listPoolJoinRequests in react-native started',
187
- poolID
188
- );
189
- let res = Fula.listPoolJoinRequests(poolID).then((res) => {
190
- try {
191
- let jsonRes: BType.PoolRequestsResponse = JSON.parse(res);
192
- return jsonRes;
193
- } catch (e) {
194
- try {
195
- return JSON.parse(res);
196
- } catch (e) {
197
- return res;
198
- }
199
- }
200
- }).catch((err) => {
201
- return err;
202
- });
203
- return res;
204
- };
200
+ }
201
+ }
202
+ })
203
+ .catch((err) => {
204
+ return err;
205
+ });
206
+ return res;
207
+ };
205
208
 
206
- /*
209
+ /*
207
210
  seed is used to authorize the request.
208
211
  poolID is the ID of the pool in which the account is requesting to join.
209
212
  account is the account that is requesting to join the pool.
210
213
  accept is a boolean value that indicates whether to accept or reject the join request.
211
214
  It returns a promise of BType.PoolVoteResponse which includes the account and poolID
212
215
  */
213
- export const votePoolJoinRequest = (seed: string, poolID: number, account: string, accept: boolean): Promise<BType.PoolVoteResponse> => {
214
- console.log(
215
- 'votePoolJoinRequest in react-native started',
216
- seed,
217
- poolID,
218
- account,
219
- accept
220
- );
221
- let res = Fula.votePoolJoinRequest(seed, poolID, account, accept).then((res) => {
222
- try {
223
- let jsonRes: BType.PoolVoteResponse = JSON.parse(res);
224
- return jsonRes;
225
- } catch (e) {
226
- try {
227
- return JSON.parse(res);
228
- } catch (e) {
229
- return res;
230
- }
231
- }
232
- }).catch((err) => {
233
- return err;
234
- });
235
- return res;
236
- };
237
-
216
+ export const votePoolJoinRequest = (
217
+ seed: string,
218
+ poolID: number,
219
+ account: string,
220
+ accept: boolean
221
+ ): Promise<BType.PoolVoteResponse> => {
222
+ console.log(
223
+ 'votePoolJoinRequest in react-native started',
224
+ seed,
225
+ poolID,
226
+ account,
227
+ accept
228
+ );
229
+ let res = Fula.votePoolJoinRequest(seed, poolID, account, accept)
230
+ .then((res) => {
231
+ try {
232
+ let jsonRes: BType.PoolVoteResponse = JSON.parse(res);
233
+ return jsonRes;
234
+ } catch (e) {
235
+ try {
236
+ return JSON.parse(res);
237
+ } catch (e) {
238
+ return res;
239
+ }
240
+ }
241
+ })
242
+ .catch((err) => {
243
+ return err;
244
+ });
245
+ return res;
246
+ };
238
247
 
239
- /*
248
+ /*
240
249
  It takes four arguments:
241
250
 
242
251
  seed is used to authorize the request.
@@ -245,7 +254,12 @@ replicationFactor is the number of copies of the content to be stored.
245
254
  cid is the content identifier of the content to be replicated.
246
255
  It returns a promise of BType.ManifestUploadResponse which includes the uploader, storage, ManifestMetadata, and poolID
247
256
  */
248
- export const newReplicationRequest = (seed: string, poolID: number, replicationFactor: number, cid: string): Promise<BType.ManifestUploadResponse> => {
257
+ export const newReplicationRequest = (
258
+ seed: string,
259
+ poolID: number,
260
+ replicationFactor: number,
261
+ cid: string
262
+ ): Promise<BType.ManifestUploadResponse> => {
249
263
  console.log(
250
264
  'newReplicationRequest in react-native started',
251
265
  seed,
@@ -253,20 +267,22 @@ It returns a promise of BType.ManifestUploadResponse which includes the uploader
253
267
  replicationFactor,
254
268
  cid
255
269
  );
256
- let res = Fula.newReplicationRequest(seed, poolID, replicationFactor, cid).then((res) => {
257
- try {
258
- let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);
259
- return jsonRes;
260
- } catch (e) {
270
+ let res = Fula.newReplicationRequest(seed, poolID, replicationFactor, cid)
271
+ .then((res) => {
261
272
  try {
262
- return JSON.parse(res);
273
+ let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);
274
+ return jsonRes;
263
275
  } catch (e) {
264
- return res;
276
+ try {
277
+ return JSON.parse(res);
278
+ } catch (e) {
279
+ return res;
280
+ }
265
281
  }
266
- }
267
- }).catch((err) => {
268
- return err;
269
- });
282
+ })
283
+ .catch((err) => {
284
+ return err;
285
+ });
270
286
  return res;
271
287
  };
272
288
 
@@ -279,7 +295,12 @@ uploader is the account of the user making the request
279
295
  cid is the content identifier of the content to be stored.
280
296
  It returns a promise of BType.ManifestUploadResponse which includes the uploader, storage, ManifestMetadata, and poolID
281
297
  */
282
- export const newStoreRequest = (seed: string, poolID: number, uploader: string, cid: string): Promise<BType.ManifestUploadResponse> => {
298
+ export const newStoreRequest = (
299
+ seed: string,
300
+ poolID: number,
301
+ uploader: string,
302
+ cid: string
303
+ ): Promise<BType.ManifestUploadResponse> => {
283
304
  console.log(
284
305
  'newStoreRequest in react-native started',
285
306
  seed,
@@ -287,53 +308,57 @@ export const newStoreRequest = (seed: string, poolID: number, uploader: string,
287
308
  uploader,
288
309
  cid
289
310
  );
290
- let res = Fula.newStoreRequest(seed, poolID, uploader, cid).then((res) => {
291
- try {
292
- let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);
293
- return jsonRes;
294
- } catch (e) {
311
+ let res = Fula.newStoreRequest(seed, poolID, uploader, cid)
312
+ .then((res) => {
295
313
  try {
296
- return JSON.parse(res);
314
+ let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);
315
+ return jsonRes;
297
316
  } catch (e) {
298
- return res;
317
+ try {
318
+ return JSON.parse(res);
319
+ } catch (e) {
320
+ return res;
321
+ }
299
322
  }
300
- }
301
- }).catch((err) => {
302
- return err;
303
- });
323
+ })
324
+ .catch((err) => {
325
+ return err;
326
+ });
304
327
  return res;
305
328
  };
306
329
 
307
-
308
330
  /*
309
331
  It takes one argument:
310
332
 
311
333
  poolID is the ID of the pool for which the replication requests are listed
312
334
  It returns a promise of BType.ManifestUploadResponse[] which is an array of the replication requests, including the uploader, storage, ManifestMetadata, and poolID
313
335
  */
314
- export const listAvailableReplicationRequests = (poolID: number): Promise<BType.ManifestUploadResponse[]> => {
336
+ export const listAvailableReplicationRequests = (
337
+ poolID: number
338
+ ): Promise<BType.ManifestUploadResponse[]> => {
315
339
  console.log(
316
340
  'listAvailableReplicationRequests in react-native started',
317
341
  poolID
318
342
  );
319
- let res = Fula.listAvailableReplicationRequests(poolID).then((res) => {
320
- try {
321
- let jsonRes: BType.ManifestUploadResponse[] = JSON.parse(res);
322
- return jsonRes;
323
- } catch (e) {
343
+ let res = Fula.listAvailableReplicationRequests(poolID)
344
+ .then((res) => {
324
345
  try {
325
- return JSON.parse(res);
346
+ let jsonRes: BType.ManifestUploadResponse[] = JSON.parse(res);
347
+ return jsonRes;
326
348
  } catch (e) {
327
- return res;
349
+ try {
350
+ return JSON.parse(res);
351
+ } catch (e) {
352
+ return res;
353
+ }
328
354
  }
329
- }
330
- }).catch((err) => {
331
- return err;
332
- });
355
+ })
356
+ .catch((err) => {
357
+ return err;
358
+ });
333
359
  return res;
334
360
  };
335
361
 
336
-
337
362
  /*
338
363
  It takes three arguments:
339
364
 
@@ -342,27 +367,33 @@ poolID is the ID of the pool for which the replication request is being removed
342
367
  cid is the content ID of the replication request being removed
343
368
  It returns a promise of BType.ManifestUploadResponse which is the removed replication request, including the uploader, storage, ManifestMetadata, and poolID
344
369
  */
345
- export const removeReplicationRequest = (seed: string, poolID: number, cid: string): Promise<BType.ManifestUploadResponse> => {
370
+ export const removeReplicationRequest = (
371
+ seed: string,
372
+ poolID: number,
373
+ cid: string
374
+ ): Promise<BType.ManifestUploadResponse> => {
346
375
  console.log(
347
376
  'removeReplicationRequest in react-native started',
348
377
  seed,
349
378
  poolID,
350
379
  cid
351
380
  );
352
- let res = Fula.removeReplicationRequest(seed, poolID, cid).then((res) => {
353
- try {
354
- let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);
355
- return jsonRes;
356
- } catch (e) {
381
+ let res = Fula.removeReplicationRequest(seed, poolID, cid)
382
+ .then((res) => {
357
383
  try {
358
- return JSON.parse(res);
384
+ let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);
385
+ return jsonRes;
359
386
  } catch (e) {
360
- return res;
387
+ try {
388
+ return JSON.parse(res);
389
+ } catch (e) {
390
+ return res;
391
+ }
361
392
  }
362
- }
363
- }).catch((err) => {
364
- return err;
365
- });
393
+ })
394
+ .catch((err) => {
395
+ return err;
396
+ });
366
397
  return res;
367
398
  };
368
399
 
@@ -375,7 +406,12 @@ poolID is the ID of the pool for which the storer is being removed
375
406
  cid is the content ID of the replication request for which the storer is being removed
376
407
  It returns a promise of BType.ManifestUploadResponse which is the replication request, including the uploader, storage, ManifestMetadata, and poolID after the storer has been removed.
377
408
  */
378
- export const removeStorer = (seed: string, storer: string, poolID: number, cid: string): Promise<BType.ManifestUploadResponse> => {
409
+ export const removeStorer = (
410
+ seed: string,
411
+ storer: string,
412
+ poolID: number,
413
+ cid: string
414
+ ): Promise<BType.ManifestUploadResponse> => {
379
415
  console.log(
380
416
  'removeStorer in react-native started',
381
417
  seed,
@@ -383,24 +419,25 @@ export const removeStorer = (seed: string, storer: string, poolID: number, cid:
383
419
  poolID,
384
420
  cid
385
421
  );
386
- let res = Fula.removeStorer(seed, storer, poolID, cid).then((res) => {
387
- try {
388
- let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);
389
- return jsonRes;
390
- } catch (e) {
422
+ let res = Fula.removeStorer(seed, storer, poolID, cid)
423
+ .then((res) => {
391
424
  try {
392
- return JSON.parse(res);
425
+ let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);
426
+ return jsonRes;
393
427
  } catch (e) {
394
- return res;
428
+ try {
429
+ return JSON.parse(res);
430
+ } catch (e) {
431
+ return res;
432
+ }
395
433
  }
396
- }
397
- }).catch((err) => {
398
- return err;
399
- });
434
+ })
435
+ .catch((err) => {
436
+ return err;
437
+ });
400
438
  return res;
401
439
  };
402
440
 
403
-
404
441
  /*
405
442
  It takes four arguments:
406
443
 
@@ -410,7 +447,12 @@ poolID is the ID of the pool for which the stored replication is being removed
410
447
  cid is the content ID of the replication request for which the stored replication is being removed
411
448
  It 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.
412
449
  */
413
- export const removeStoredReplication = (seed: string, uploader: string, poolID: number, cid: string): Promise<BType.ManifestUploadResponse> => {
450
+ export const removeStoredReplication = (
451
+ seed: string,
452
+ uploader: string,
453
+ poolID: number,
454
+ cid: string
455
+ ): Promise<BType.ManifestUploadResponse> => {
414
456
  console.log(
415
457
  'removeStoredReplication in react-native started',
416
458
  seed,
@@ -418,43 +460,45 @@ export const removeStoredReplication = (seed: string, uploader: string, poolID:
418
460
  poolID,
419
461
  cid
420
462
  );
421
- let res = Fula.removeStoredReplication(seed, uploader, poolID, cid).then((res) => {
422
- try {
423
- let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);
424
- return jsonRes;
425
- } catch (e) {
463
+ let res = Fula.removeStoredReplication(seed, uploader, poolID, cid)
464
+ .then((res) => {
426
465
  try {
427
- return JSON.parse(res);
466
+ let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);
467
+ return jsonRes;
428
468
  } catch (e) {
429
- return res;
469
+ try {
470
+ return JSON.parse(res);
471
+ } catch (e) {
472
+ return res;
473
+ }
430
474
  }
431
- }
432
- }).catch((err) => {
433
- return err;
434
- });
475
+ })
476
+ .catch((err) => {
477
+ return err;
478
+ });
435
479
  return res;
436
480
  };
437
481
 
438
- /*
482
+ /*
439
483
  bloxFreeSpace: This function takes no arguments and returns a promise of an object that contains the blox free space information.
440
484
  */
441
- export const bloxFreeSpace = (): Promise<BType.BloxFreeSpaceResponse> => {
442
- console.log(
443
- 'bloxFreeSpace in react-native started'
444
- );
445
- let res = Fula.bloxFreeSpace().then((res) => {
446
- try {
447
- let jsonRes: BType.BloxFreeSpaceResponse = JSON.parse(res);
448
- return jsonRes;
449
- } catch (e) {
450
- try {
451
- return JSON.parse(res);
452
- } catch (e) {
453
- return res;
454
- }
455
- }
456
- }).catch((err) => {
457
- return err;
485
+ export const bloxFreeSpace = (): Promise<BType.BloxFreeSpaceResponse> => {
486
+ console.log('bloxFreeSpace in react-native started');
487
+ let res = Fula.bloxFreeSpace()
488
+ .then((res) => {
489
+ try {
490
+ let jsonRes: BType.BloxFreeSpaceResponse = JSON.parse(res);
491
+ return jsonRes;
492
+ } catch (e) {
493
+ try {
494
+ return JSON.parse(res);
495
+ } catch (e) {
496
+ return res;
497
+ }
498
+ }
499
+ })
500
+ .catch((err) => {
501
+ return err;
458
502
  });
459
- return res;
460
- };
503
+ return res;
504
+ };