@functionland/react-native-fula 1.54.13 → 1.54.15
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.
- package/ios/Fula.swift +33 -13
- package/package.json +1 -1
package/ios/Fula.swift
CHANGED
|
@@ -1332,17 +1332,27 @@ class FulaModule: NSObject {
|
|
|
1332
1332
|
|
|
1333
1333
|
|
|
1334
1334
|
@objc(bloxFreeSpace:withRejecter:)
|
|
1335
|
-
func bloxFreeSpace(
|
|
1335
|
+
func bloxFreeSpace(resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) {
|
|
1336
1336
|
print("ReactNative", "bloxFreeSpace")
|
|
1337
|
+
guard let fulaClient = self.fula else {
|
|
1338
|
+
print("bloxFreeSpace", "fula client is nil")
|
|
1339
|
+
let error = NSError(domain: "FulaModuleError", code: 0, userInfo: [NSLocalizedDescriptionKey: "Fula client is not initialized"])
|
|
1340
|
+
reject("ERR_FULA_NOT_INITIALIZED", "Fula client is not initialized", error)
|
|
1341
|
+
return
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1337
1344
|
do {
|
|
1338
|
-
let result = try
|
|
1339
|
-
let resultString = result.toUTF8String()
|
|
1345
|
+
let result = try fulaClient.bloxFreeSpace()
|
|
1346
|
+
guard let resultString = result.toUTF8String() else {
|
|
1347
|
+
let error = NSError(domain: "FulaModuleError", code: 1, userInfo: [NSLocalizedDescriptionKey: "Failed to convert result to String"])
|
|
1348
|
+
reject("ERR_FULA_RESULT_CONVERSION", "Failed to convert result to String", error)
|
|
1349
|
+
return
|
|
1350
|
+
}
|
|
1340
1351
|
resolve(resultString)
|
|
1341
1352
|
} catch let error {
|
|
1342
1353
|
print("bloxFreeSpace", error.localizedDescription)
|
|
1343
1354
|
reject("ERR_FULA", "bloxFreeSpace", error)
|
|
1344
1355
|
}
|
|
1345
|
-
|
|
1346
1356
|
}
|
|
1347
1357
|
|
|
1348
1358
|
@objc(transferToFula:wallet:chain:withResolver:withRejecter:)
|
|
@@ -1362,15 +1372,25 @@ class FulaModule: NSObject {
|
|
|
1362
1372
|
|
|
1363
1373
|
|
|
1364
1374
|
@objc(getAccount:withRejecter:)
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1375
|
+
func getAccount(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
1376
|
+
guard let fulaClient = self.fula else {
|
|
1377
|
+
let error = NSError(domain: "FulaModuleError", code: -1, userInfo: [NSLocalizedDescriptionKey: "Fula client is not initialized"])
|
|
1378
|
+
reject("ERR_FULA_NOT_INITIALIZED", "Fula client is not initialized", error)
|
|
1379
|
+
return
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
do {
|
|
1383
|
+
let account = try fulaClient.getAccount()
|
|
1384
|
+
guard let accountString = String(data: account, encoding: .utf8) else {
|
|
1385
|
+
let conversionError = NSError(domain: "FulaModuleError", code: -2, userInfo: [NSLocalizedDescriptionKey: "Unable to convert account data to String"])
|
|
1386
|
+
reject("ERR_FULA_CONVERSION_FAILED", "Unable to convert account data to String", conversionError)
|
|
1387
|
+
return
|
|
1388
|
+
}
|
|
1389
|
+
resolve(accountString)
|
|
1390
|
+
} catch let error {
|
|
1391
|
+
reject("ERR_FULA", "getAccount: \(error.localizedDescription)", error)
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1374
1394
|
|
|
1375
1395
|
@objc(assetsBalance:withAssetId:withClassId:withResolver:withRejecter:)
|
|
1376
1396
|
func assetsBalance(account: String, assetId: String, classId: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@functionland/react-native-fula",
|
|
3
|
-
"version": "1.54.
|
|
3
|
+
"version": "1.54.15",
|
|
4
4
|
"description": "This package is a bridge to use the Fula libp2p protocols in the react-native which is using wnfs",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|