Skip to content

Commit

Permalink
corected bloxFreeSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
Erfan Shekarchi committed Apr 4, 2024
1 parent 5f140fe commit f26bac3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions ios/Fula.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1332,17 +1332,27 @@ class FulaModule: NSObject {


@objc(bloxFreeSpace:withRejecter:)
func bloxFreeSpace( resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
func bloxFreeSpace(resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) {
print("ReactNative", "bloxFreeSpace")
guard let fulaClient = self.fula else {
print("bloxFreeSpace", "fula client is nil")
let error = NSError(domain: "FulaModuleError", code: 0, userInfo: [NSLocalizedDescriptionKey: "Fula client is not initialized"])
reject("ERR_FULA_NOT_INITIALIZED", "Fula client is not initialized", error)
return
}

do {
let result = try self.fula!.bloxFreeSpace()
let resultString = result.toUTF8String()!
let result = try fulaClient.bloxFreeSpace()
guard let resultString = result.toUTF8String() else {
let error = NSError(domain: "FulaModuleError", code: 1, userInfo: [NSLocalizedDescriptionKey: "Failed to convert result to String"])
reject("ERR_FULA_RESULT_CONVERSION", "Failed to convert result to String", error)
return
}
resolve(resultString)
} catch let error {
print("bloxFreeSpace", error.localizedDescription)
reject("ERR_FULA", "bloxFreeSpace", error)
}

}

@objc(transferToFula:wallet:chain:withResolver:withRejecter:)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@functionland/react-native-fula",
"version": "1.54.13",
"version": "1.54.14",
"description": "This package is a bridge to use the Fula libp2p protocols in the react-native which is using wnfs",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down

0 comments on commit f26bac3

Please sign in to comment.