@functionland/react-native-fula 1.55.11 → 1.55.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/android/build.gradle +2 -2
- package/android/gradle.properties +2 -2
- package/android/src/main/java/land/fx/fula/FulaModule.java +2057 -1991
- package/ios/Fula.mm +272 -248
- package/ios/Fula.swift +217 -0
- package/ios/Fula.xcodeproj/project.pbxproj +2 -2
- package/lib/commonjs/index.js +1 -2
- package/lib/commonjs/interfaces/fulaNativeModule.js.map +1 -1
- package/lib/commonjs/protocols/blockchain.js +67 -1
- package/lib/commonjs/protocols/blockchain.js.map +1 -1
- package/lib/module/interfaces/fulaNativeModule.js.map +1 -1
- package/lib/module/protocols/blockchain.js +64 -0
- package/lib/module/protocols/blockchain.js.map +1 -1
- package/package.json +1 -1
- package/react-native-fula.podspec +47 -47
- package/src/interfaces/fulaNativeModule.ts +177 -175
- package/src/protocols/blockchain.ts +72 -0
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
require "json"
|
|
2
|
-
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
-
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
|
-
|
|
6
|
-
Pod::Spec.new do |s|
|
|
7
|
-
s.name = "react-native-fula"
|
|
8
|
-
s.version = package["version"]
|
|
9
|
-
s.summary = package["description"]
|
|
10
|
-
s.homepage = package["homepage"]
|
|
11
|
-
s.license = package["license"]
|
|
12
|
-
s.authors = package["author"]
|
|
13
|
-
|
|
14
|
-
s.platforms = { :ios => "
|
|
15
|
-
s.source = { :git => "https://github.com/functionland/react-native-fula.git", :tag => "v#{s.version}" }
|
|
16
|
-
|
|
17
|
-
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
|
-
|
|
19
|
-
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
20
|
-
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
21
|
-
if respond_to?(:install_modules_dependencies, true)
|
|
22
|
-
install_modules_dependencies(s)
|
|
23
|
-
else
|
|
24
|
-
s.dependency "React-Core"
|
|
25
|
-
|
|
26
|
-
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
27
|
-
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
28
|
-
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
29
|
-
s.pod_target_xcconfig = {
|
|
30
|
-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
31
|
-
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
32
|
-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
33
|
-
}
|
|
34
|
-
s.dependency "React-Codegen"
|
|
35
|
-
s.dependency "RCT-Folly"
|
|
36
|
-
s.dependency "RCTRequired"
|
|
37
|
-
s.dependency "RCTTypeSafety"
|
|
38
|
-
s.dependency "ReactCommon/turbomodule/core"
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
s.dependency 'Fula','~> 1.
|
|
42
|
-
s.dependency "Wnfs", "1.1.1"
|
|
43
|
-
s.dependency 'CryptoSwift', '~> 1.7.1'
|
|
44
|
-
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
|
|
45
|
-
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
|
|
46
|
-
|
|
47
|
-
end
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
|
+
|
|
6
|
+
Pod::Spec.new do |s|
|
|
7
|
+
s.name = "react-native-fula"
|
|
8
|
+
s.version = package["version"]
|
|
9
|
+
s.summary = package["description"]
|
|
10
|
+
s.homepage = package["homepage"]
|
|
11
|
+
s.license = package["license"]
|
|
12
|
+
s.authors = package["author"]
|
|
13
|
+
|
|
14
|
+
s.platforms = { :ios => "15.0" }
|
|
15
|
+
s.source = { :git => "https://github.com/functionland/react-native-fula.git", :tag => "v#{s.version}" }
|
|
16
|
+
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
|
+
|
|
19
|
+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
20
|
+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
21
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
22
|
+
install_modules_dependencies(s)
|
|
23
|
+
else
|
|
24
|
+
s.dependency "React-Core"
|
|
25
|
+
|
|
26
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
27
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
28
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
29
|
+
s.pod_target_xcconfig = {
|
|
30
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
31
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
32
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
33
|
+
}
|
|
34
|
+
s.dependency "React-Codegen"
|
|
35
|
+
s.dependency "RCT-Folly"
|
|
36
|
+
s.dependency "RCTRequired"
|
|
37
|
+
s.dependency "RCTTypeSafety"
|
|
38
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
s.dependency 'Fula','~> 1.55.15'
|
|
42
|
+
s.dependency "Wnfs", "1.1.1"
|
|
43
|
+
s.dependency 'CryptoSwift', '~> 1.7.1'
|
|
44
|
+
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
|
|
45
|
+
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
|
|
46
|
+
|
|
47
|
+
end
|
|
@@ -1,175 +1,177 @@
|
|
|
1
|
-
import { NativeModules, Platform } from 'react-native';
|
|
2
|
-
|
|
3
|
-
interface FulaNativeModule {
|
|
4
|
-
registerLifecycleListener: () => Promise<void>;
|
|
5
|
-
initFula: (
|
|
6
|
-
identity: string, //Private key of did identity
|
|
7
|
-
storePath: string, //You can leave empty
|
|
8
|
-
bloxAddr: string, //Blox multiadddr needs to be manually entered now
|
|
9
|
-
exchange: string, //set to 'noope' for testing
|
|
10
|
-
autoFlush: boolean, //set to false always unless you know what you are doing. This is to write actions to disk explicitly after each write
|
|
11
|
-
rootCid: string | null, //if you have the latest rootCid you can send it and it generates the private_ref for filesystem
|
|
12
|
-
useRelay: boolean | null, // if true it forces the use of relay
|
|
13
|
-
refresh: boolean // if true it forces to refresh the fula object
|
|
14
|
-
) => Promise<{ peerId: string; rootCid: string }>;
|
|
15
|
-
newClient: (
|
|
16
|
-
identity: string, //Private key of did identity
|
|
17
|
-
storePath: string, //You can leave empty
|
|
18
|
-
bloxAddr: string, //Blox multiadddr needs to be manually entered now
|
|
19
|
-
exchange: string, //set to 'noope' for testing
|
|
20
|
-
autoFlush: boolean, //set to false always unless you know what you are doing. This is to write actions to disk explicitly after each write
|
|
21
|
-
useRelay: boolean | null, // if true it forces the use of relay
|
|
22
|
-
refresh: boolean // if true it forces to refresh the fula object
|
|
23
|
-
) => Promise<string>;
|
|
24
|
-
isReady: (filesystemCheck: boolean) => Promise<boolean>;
|
|
25
|
-
logout: (identity: string, storePath: string) => Promise<boolean>;
|
|
26
|
-
checkFailedActions: (retry: boolean, timeout: number) => Promise<boolean>;
|
|
27
|
-
listFailedActions: (cids: string[]) => Promise<string[]>;
|
|
28
|
-
listRecentCidsAsString: () => Promise<string[]>;
|
|
29
|
-
listRecentCidsAsStringWithChildren: () => Promise<string[]>;
|
|
30
|
-
clearCidsFromRecent: (cids: string[]) => Promise<boolean>;
|
|
31
|
-
checkConnection: (timeout: number) => Promise<boolean>;
|
|
32
|
-
get: (key: string) => Promise<string>;
|
|
33
|
-
has: (key: Uint8Array) => Promise<boolean>;
|
|
34
|
-
push: () => Promise<string>;
|
|
35
|
-
put: (content: string, codec: string) => Promise<string>;
|
|
36
|
-
mkdir: (path: string) => Promise<string>;
|
|
37
|
-
writeFileContent: (path: string, content: string) => Promise<string>;
|
|
38
|
-
writeFile: (
|
|
39
|
-
fulaTargetFilename: string,
|
|
40
|
-
localFilename: string
|
|
41
|
-
) => Promise<string>;
|
|
42
|
-
ls: (path: string) => Promise<string>;
|
|
43
|
-
rm: (path: string) => Promise<string>;
|
|
44
|
-
cp: (sourcePath: string, targetPath: string) => Promise<string>;
|
|
45
|
-
mv: (sourcePath: string, targetPath: string) => Promise<string>;
|
|
46
|
-
readFile: (
|
|
47
|
-
fulaTargetFilename: string,
|
|
48
|
-
localFilename: string
|
|
49
|
-
) => Promise<string>;
|
|
50
|
-
readFileContent: (path: string) => Promise<string>;
|
|
51
|
-
setAuth: (peerId: string, allow: boolean) => Promise<boolean>;
|
|
52
|
-
|
|
53
|
-
shutdown: () => Promise<void>;
|
|
54
|
-
|
|
55
|
-
testData: (identity: string, bloxAddr: string) => Promise<string>;
|
|
56
|
-
|
|
57
|
-
//Blockchain related functions
|
|
58
|
-
createAccount: (seed: string) => Promise<string>;
|
|
59
|
-
checkAccountExists: (account: string) => Promise<string>;
|
|
60
|
-
accountFund: (account: string) => Promise<string>;
|
|
61
|
-
createPool: (seed: string, poolName: string) => Promise<string>;
|
|
62
|
-
listPools: () => Promise<string>;
|
|
63
|
-
joinPool: (poolID: string) => Promise<string>;
|
|
64
|
-
leavePool: (poolID: string) => Promise<string>;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
'-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
interface FulaNativeModule {
|
|
4
|
+
registerLifecycleListener: () => Promise<void>;
|
|
5
|
+
initFula: (
|
|
6
|
+
identity: string, //Private key of did identity
|
|
7
|
+
storePath: string, //You can leave empty
|
|
8
|
+
bloxAddr: string, //Blox multiadddr needs to be manually entered now
|
|
9
|
+
exchange: string, //set to 'noope' for testing
|
|
10
|
+
autoFlush: boolean, //set to false always unless you know what you are doing. This is to write actions to disk explicitly after each write
|
|
11
|
+
rootCid: string | null, //if you have the latest rootCid you can send it and it generates the private_ref for filesystem
|
|
12
|
+
useRelay: boolean | null, // if true it forces the use of relay
|
|
13
|
+
refresh: boolean // if true it forces to refresh the fula object
|
|
14
|
+
) => Promise<{ peerId: string; rootCid: string }>;
|
|
15
|
+
newClient: (
|
|
16
|
+
identity: string, //Private key of did identity
|
|
17
|
+
storePath: string, //You can leave empty
|
|
18
|
+
bloxAddr: string, //Blox multiadddr needs to be manually entered now
|
|
19
|
+
exchange: string, //set to 'noope' for testing
|
|
20
|
+
autoFlush: boolean, //set to false always unless you know what you are doing. This is to write actions to disk explicitly after each write
|
|
21
|
+
useRelay: boolean | null, // if true it forces the use of relay
|
|
22
|
+
refresh: boolean // if true it forces to refresh the fula object
|
|
23
|
+
) => Promise<string>;
|
|
24
|
+
isReady: (filesystemCheck: boolean) => Promise<boolean>;
|
|
25
|
+
logout: (identity: string, storePath: string) => Promise<boolean>;
|
|
26
|
+
checkFailedActions: (retry: boolean, timeout: number) => Promise<boolean>;
|
|
27
|
+
listFailedActions: (cids: string[]) => Promise<string[]>;
|
|
28
|
+
listRecentCidsAsString: () => Promise<string[]>;
|
|
29
|
+
listRecentCidsAsStringWithChildren: () => Promise<string[]>;
|
|
30
|
+
clearCidsFromRecent: (cids: string[]) => Promise<boolean>;
|
|
31
|
+
checkConnection: (timeout: number) => Promise<boolean>;
|
|
32
|
+
get: (key: string) => Promise<string>;
|
|
33
|
+
has: (key: Uint8Array) => Promise<boolean>;
|
|
34
|
+
push: () => Promise<string>;
|
|
35
|
+
put: (content: string, codec: string) => Promise<string>;
|
|
36
|
+
mkdir: (path: string) => Promise<string>;
|
|
37
|
+
writeFileContent: (path: string, content: string) => Promise<string>;
|
|
38
|
+
writeFile: (
|
|
39
|
+
fulaTargetFilename: string,
|
|
40
|
+
localFilename: string
|
|
41
|
+
) => Promise<string>;
|
|
42
|
+
ls: (path: string) => Promise<string>;
|
|
43
|
+
rm: (path: string) => Promise<string>;
|
|
44
|
+
cp: (sourcePath: string, targetPath: string) => Promise<string>;
|
|
45
|
+
mv: (sourcePath: string, targetPath: string) => Promise<string>;
|
|
46
|
+
readFile: (
|
|
47
|
+
fulaTargetFilename: string,
|
|
48
|
+
localFilename: string
|
|
49
|
+
) => Promise<string>;
|
|
50
|
+
readFileContent: (path: string) => Promise<string>;
|
|
51
|
+
setAuth: (peerId: string, allow: boolean) => Promise<boolean>;
|
|
52
|
+
|
|
53
|
+
shutdown: () => Promise<void>;
|
|
54
|
+
|
|
55
|
+
testData: (identity: string, bloxAddr: string) => Promise<string>;
|
|
56
|
+
|
|
57
|
+
//Blockchain related functions
|
|
58
|
+
createAccount: (seed: string) => Promise<string>;
|
|
59
|
+
checkAccountExists: (account: string) => Promise<string>;
|
|
60
|
+
accountFund: (account: string) => Promise<string>;
|
|
61
|
+
createPool: (seed: string, poolName: string) => Promise<string>;
|
|
62
|
+
listPools: () => Promise<string>;
|
|
63
|
+
joinPool: (poolID: string) => Promise<string>;
|
|
64
|
+
leavePool: (poolID: string) => Promise<string>;
|
|
65
|
+
joinPoolWithChain: (poolID: string, chainName: string) => Promise<string>;
|
|
66
|
+
leavePoolWithChain: (poolID: string, chainName: string) => Promise<string>;
|
|
67
|
+
cancelPoolJoin: (poolID: string) => Promise<string>;
|
|
68
|
+
listPoolJoinRequests: (poolID: string) => Promise<string>;
|
|
69
|
+
votePoolJoinRequest: (
|
|
70
|
+
seed: string,
|
|
71
|
+
poolID: number,
|
|
72
|
+
account: string,
|
|
73
|
+
accept: boolean
|
|
74
|
+
) => Promise<string>;
|
|
75
|
+
batchUploadManifest: (
|
|
76
|
+
cid: string[],
|
|
77
|
+
poolID: string,
|
|
78
|
+
replicationFactor: string
|
|
79
|
+
) => Promise<string>;
|
|
80
|
+
replicateInPool: (
|
|
81
|
+
cid: string[],
|
|
82
|
+
account: string,
|
|
83
|
+
poolID: string
|
|
84
|
+
) => Promise<string>;
|
|
85
|
+
newStoreRequest: (
|
|
86
|
+
seed: string,
|
|
87
|
+
poolID: number,
|
|
88
|
+
uploader: string,
|
|
89
|
+
cid: string
|
|
90
|
+
) => Promise<string>;
|
|
91
|
+
listAvailableReplicationRequests: (poolID: string) => Promise<string>;
|
|
92
|
+
removeReplicationRequest: (
|
|
93
|
+
seed: string,
|
|
94
|
+
poolID: number,
|
|
95
|
+
cid: string
|
|
96
|
+
) => Promise<string>;
|
|
97
|
+
removeStorer: (
|
|
98
|
+
seed: string,
|
|
99
|
+
storer: string,
|
|
100
|
+
poolID: number,
|
|
101
|
+
cid: string
|
|
102
|
+
) => Promise<string>;
|
|
103
|
+
removeStoredReplication: (
|
|
104
|
+
seed: string,
|
|
105
|
+
uploader: string,
|
|
106
|
+
poolID: number,
|
|
107
|
+
cid: string
|
|
108
|
+
) => Promise<string>;
|
|
109
|
+
|
|
110
|
+
//On Blox calls for chain
|
|
111
|
+
//Hardware
|
|
112
|
+
assetsBalance: (
|
|
113
|
+
account: string,
|
|
114
|
+
assetId: string,
|
|
115
|
+
classId: string
|
|
116
|
+
) => Promise<string>;
|
|
117
|
+
transferToFula: (
|
|
118
|
+
amount: string,
|
|
119
|
+
wallet: string,
|
|
120
|
+
chain: string
|
|
121
|
+
) => Promise<string>;
|
|
122
|
+
getAccount: () => Promise<string>;
|
|
123
|
+
|
|
124
|
+
//Hardware
|
|
125
|
+
eraseBlData: () => Promise<string>;
|
|
126
|
+
fetchContainerLogs: (
|
|
127
|
+
containerName: string,
|
|
128
|
+
tailCount: string
|
|
129
|
+
) => Promise<string>;
|
|
130
|
+
findBestAndTargetInLogs: (
|
|
131
|
+
containerName: string,
|
|
132
|
+
tailCount: string
|
|
133
|
+
) => Promise<string>;
|
|
134
|
+
getFolderSize: (folderPath: string) => Promise<string>;
|
|
135
|
+
getDatastoreSize: () => Promise<string>;
|
|
136
|
+
bloxFreeSpace: () => Promise<string>;
|
|
137
|
+
wifiRemoveall: () => Promise<string>;
|
|
138
|
+
reboot: () => Promise<string>;
|
|
139
|
+
partition: () => Promise<string>;
|
|
140
|
+
|
|
141
|
+
// Plugin related functions
|
|
142
|
+
listPlugins: () => Promise<string>;
|
|
143
|
+
listActivePlugins: () => Promise<string>;
|
|
144
|
+
installPlugin: (pluginName: string, params: string) => Promise<string>;
|
|
145
|
+
uninstallPlugin: (pluginName: string) => Promise<string>;
|
|
146
|
+
showPluginStatus: (pluginName: string, lines: number) => Promise<string>;
|
|
147
|
+
getInstallOutput: (pluginName: string, params: string) => Promise<string>;
|
|
148
|
+
getInstallStatus: (pluginName: string) => Promise<string>;
|
|
149
|
+
updatePlugin: (pluginName: string) => Promise<string>;
|
|
150
|
+
deleteDsLock: () => Promise<void>;
|
|
151
|
+
|
|
152
|
+
//AI
|
|
153
|
+
chatWithAI: (aiModel: string, userMessage: string) => Promise<string>;
|
|
154
|
+
getChatChunk: (streamID: string) => Promise<string>;
|
|
155
|
+
streamChunks: (streamID: string) => Promise<void>;
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const LINKING_ERROR =
|
|
161
|
+
`The package 'react-native-fula/Fula' doesn't seem to be linked. Make sure: \n\n` +
|
|
162
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
163
|
+
'- You rebuilt the app after installing the package\n' +
|
|
164
|
+
'- You are not using Expo managed workflow\n';
|
|
165
|
+
|
|
166
|
+
const Fula = NativeModules.FulaModule
|
|
167
|
+
? NativeModules.FulaModule
|
|
168
|
+
: new Proxy(
|
|
169
|
+
{},
|
|
170
|
+
{
|
|
171
|
+
get() {
|
|
172
|
+
throw new Error(LINKING_ERROR);
|
|
173
|
+
},
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
export default Fula as FulaNativeModule;
|
|
@@ -182,6 +182,78 @@ export const leavePool = (poolID: number): Promise<BType.PoolLeaveResponse> => {
|
|
|
182
182
|
return res1;
|
|
183
183
|
};
|
|
184
184
|
|
|
185
|
+
/*
|
|
186
|
+
joinPoolWithChain: This function takes two arguments: poolID and chainName. The poolID is the ID of the pool to join, and the chainName specifies the blockchain network to use for the operation. The function returns a promise of an object that contains the account and poolID.
|
|
187
|
+
*/
|
|
188
|
+
export const joinPoolWithChain = (poolID: number, chainName: string): Promise<BType.PoolJoinResponse> => {
|
|
189
|
+
console.log('joinPoolWithChain in react-native started', poolID, chainName);
|
|
190
|
+
|
|
191
|
+
// Validate inputs
|
|
192
|
+
if (typeof poolID !== 'number' || poolID <= 0) {
|
|
193
|
+
return Promise.reject(new Error('Pool ID must be a positive number'));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (typeof chainName !== 'string' || chainName.trim().length === 0) {
|
|
197
|
+
return Promise.reject(new Error('Chain name must be a non-empty string'));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
let res1 = Fula.joinPoolWithChain(poolID.toString(), chainName.trim())
|
|
201
|
+
.then((res) => {
|
|
202
|
+
try {
|
|
203
|
+
let jsonRes: BType.PoolJoinResponse = JSON.parse(res);
|
|
204
|
+
return jsonRes;
|
|
205
|
+
} catch (e) {
|
|
206
|
+
try {
|
|
207
|
+
return JSON.parse(res);
|
|
208
|
+
} catch (e2) {
|
|
209
|
+
console.error('Error parsing res in joining pool with chain:', e);
|
|
210
|
+
return res; // Return raw response if parsing fails
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
})
|
|
214
|
+
.catch((err) => {
|
|
215
|
+
console.error('Error joining pool with chain:', err);
|
|
216
|
+
throw err; // Rethrow the error to maintain the rejection state
|
|
217
|
+
});
|
|
218
|
+
return res1;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
/*
|
|
222
|
+
leavePoolWithChain: This function takes two arguments: poolID and chainName. The poolID is the ID of the pool to leave, and the chainName specifies the blockchain network to use for the operation. The function returns a promise of an object that contains the account and poolID.
|
|
223
|
+
*/
|
|
224
|
+
export const leavePoolWithChain = (poolID: number, chainName: string): Promise<BType.PoolLeaveResponse> => {
|
|
225
|
+
console.log('leavePoolWithChain in react-native started', poolID, chainName);
|
|
226
|
+
|
|
227
|
+
// Validate inputs
|
|
228
|
+
if (typeof poolID !== 'number' || poolID <= 0) {
|
|
229
|
+
return Promise.reject(new Error('Pool ID must be a positive number'));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (typeof chainName !== 'string' || chainName.trim().length === 0) {
|
|
233
|
+
return Promise.reject(new Error('Chain name must be a non-empty string'));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
let res1 = Fula.leavePoolWithChain(poolID.toString(), chainName.trim())
|
|
237
|
+
.then((res) => {
|
|
238
|
+
try {
|
|
239
|
+
let jsonRes: BType.PoolLeaveResponse = JSON.parse(res);
|
|
240
|
+
return jsonRes;
|
|
241
|
+
} catch (e) {
|
|
242
|
+
try {
|
|
243
|
+
return JSON.parse(res);
|
|
244
|
+
} catch (e2) {
|
|
245
|
+
console.error('Error parsing res in leaving pool with chain:', e);
|
|
246
|
+
return res; // Return raw response if parsing fails
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
})
|
|
250
|
+
.catch((err) => {
|
|
251
|
+
console.error('Error leaving pool with chain:', err);
|
|
252
|
+
throw err; // Rethrow the error to maintain the rejection state
|
|
253
|
+
});
|
|
254
|
+
return res1;
|
|
255
|
+
};
|
|
256
|
+
|
|
185
257
|
export const cancelPoolJoin = (
|
|
186
258
|
poolID: number
|
|
187
259
|
): Promise<BType.PoolCancelJoinResponse> => {
|