@functionland/react-native-fula 1.54.14 → 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.
Files changed (2) hide show
  1. package/ios/Fula.swift +19 -9
  2. package/package.json +1 -1
package/ios/Fula.swift CHANGED
@@ -1372,15 +1372,25 @@ class FulaModule: NSObject {
1372
1372
 
1373
1373
 
1374
1374
  @objc(getAccount:withRejecter:)
1375
- func getAccount(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
1376
- do {
1377
- let account = try self.fula!.getAccount()
1378
- let accountString = String(data: account, encoding: .utf8)
1379
- resolve(accountString)
1380
- } catch let error {
1381
- reject("ERR_FULA", "getAccount: \(error.localizedDescription)", error)
1382
- }
1383
- }
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
+ }
1384
1394
 
1385
1395
  @objc(assetsBalance:withAssetId:withClassId:withResolver:withRejecter:)
1386
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.14",
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",