react-native-zano 0.1.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.
- package/CHANGELOG.md +7 -0
- package/README.md +56 -0
- package/android/build.gradle +40 -0
- package/android/src/main/java/app/edge/rnzano/RnZanoModule.java +51 -0
- package/android/src/main/java/app/edge/rnzano/RnZanoPackage.java +21 -0
- package/ios/ZanoModule.h +4 -0
- package/ios/ZanoModule.mm +86 -0
- package/ios/ZanoModule.xcframework/Info.plist +44 -0
- package/ios/ZanoModule.xcframework/ios-arm64/libzano-module.a +0 -0
- package/ios/ZanoModule.xcframework/ios-arm64_x86_64-simulator/libzano-module.a +0 -0
- package/ios/react-native-zano.xcodeproj/project.pbxproj +1 -0
- package/lib/scripts/update-sources.d.ts +1 -0
- package/lib/scripts/update-sources.js +308 -0
- package/lib/scripts/utils/android-tools.d.ts +1 -0
- package/lib/scripts/utils/android-tools.js +25 -0
- package/lib/scripts/utils/common.d.ts +19 -0
- package/lib/scripts/utils/common.js +74 -0
- package/lib/src/CppBridge.d.ts +69 -0
- package/lib/src/CppBridge.js +328 -0
- package/lib/src/index.d.ts +4 -0
- package/lib/src/index.js +28 -0
- package/lib/src/types.d.ts +234 -0
- package/lib/src/types.js +23 -0
- package/package.json +55 -0
- package/react-native-zano.podspec +27 -0
- package/src/zano-wrapper/zano-methods.hpp +15 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
interface JsonRpcResponseBase {
|
|
2
|
+
id: number;
|
|
3
|
+
jsonrpc: string;
|
|
4
|
+
}
|
|
5
|
+
interface JsonRpcResponseSuccess<T> extends JsonRpcResponseBase {
|
|
6
|
+
result: T;
|
|
7
|
+
}
|
|
8
|
+
interface JsonRpcResponseError extends JsonRpcResponseBase {
|
|
9
|
+
error: {
|
|
10
|
+
code: string | number;
|
|
11
|
+
message: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export type JsonRpc<T> = JsonRpcResponseSuccess<T> | JsonRpcResponseError;
|
|
15
|
+
export interface ReturnCode {
|
|
16
|
+
return_code: string;
|
|
17
|
+
}
|
|
18
|
+
export interface WalletFiles {
|
|
19
|
+
items: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface AddressInfo {
|
|
22
|
+
valid: boolean;
|
|
23
|
+
is_integrated: boolean;
|
|
24
|
+
payment_id?: string;
|
|
25
|
+
address: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ConnectivityStatus {
|
|
28
|
+
is_online: boolean;
|
|
29
|
+
is_remote_node_mode: boolean;
|
|
30
|
+
is_server_busy: boolean;
|
|
31
|
+
last_daemon_is_disconnected: boolean;
|
|
32
|
+
last_proxy_communicate_timestamp: number;
|
|
33
|
+
}
|
|
34
|
+
interface AssetInfo {
|
|
35
|
+
asset_id: string;
|
|
36
|
+
current_supply: number;
|
|
37
|
+
decimal_point: number;
|
|
38
|
+
full_name: string;
|
|
39
|
+
hidden_supply: boolean;
|
|
40
|
+
meta_info: string;
|
|
41
|
+
owner: string;
|
|
42
|
+
owner_eth_pub_key: string;
|
|
43
|
+
ticker: string;
|
|
44
|
+
total_max_supply: number;
|
|
45
|
+
}
|
|
46
|
+
interface AssetBalance {
|
|
47
|
+
asset_info: AssetInfo;
|
|
48
|
+
awaiting_in: number;
|
|
49
|
+
awaiting_out: number;
|
|
50
|
+
outs_amount_max: number;
|
|
51
|
+
outs_amount_min: number;
|
|
52
|
+
outs_count: number;
|
|
53
|
+
total: number;
|
|
54
|
+
unlocked: number;
|
|
55
|
+
}
|
|
56
|
+
export interface WalletDetails {
|
|
57
|
+
name: string;
|
|
58
|
+
pass: string;
|
|
59
|
+
private_spend_key: string;
|
|
60
|
+
private_view_key: string;
|
|
61
|
+
public_spend_key: string;
|
|
62
|
+
public_view_key: string;
|
|
63
|
+
recent_history: {
|
|
64
|
+
last_item_index: number;
|
|
65
|
+
total_history_items: number;
|
|
66
|
+
};
|
|
67
|
+
recovered: boolean;
|
|
68
|
+
seed: string;
|
|
69
|
+
wallet_file_size: number;
|
|
70
|
+
wallet_id: number;
|
|
71
|
+
wallet_local_bc_size: number;
|
|
72
|
+
wi: {
|
|
73
|
+
address: string;
|
|
74
|
+
balances: AssetBalance[];
|
|
75
|
+
has_bare_unspent_outputs: boolean;
|
|
76
|
+
is_auditable: boolean;
|
|
77
|
+
is_watch_only: boolean;
|
|
78
|
+
mined_total: number;
|
|
79
|
+
path: string;
|
|
80
|
+
view_sec_key: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
declare enum WalletState {
|
|
84
|
+
SYNCING = 1,
|
|
85
|
+
SYNCED = 2,
|
|
86
|
+
ERROR = 3
|
|
87
|
+
}
|
|
88
|
+
export interface WalletStatus {
|
|
89
|
+
current_daemon_height: number;
|
|
90
|
+
current_wallet_height: number;
|
|
91
|
+
is_daemon_connected: boolean;
|
|
92
|
+
is_in_long_refresh: boolean;
|
|
93
|
+
progress: number;
|
|
94
|
+
wallet_state: WalletState;
|
|
95
|
+
}
|
|
96
|
+
export interface CloseResponse {
|
|
97
|
+
response: string;
|
|
98
|
+
}
|
|
99
|
+
export interface AsyncCallResponse {
|
|
100
|
+
job_id: number;
|
|
101
|
+
}
|
|
102
|
+
export type TryPullResultResponse<T> = {
|
|
103
|
+
status: 'canceled';
|
|
104
|
+
} | {
|
|
105
|
+
status: 'idle';
|
|
106
|
+
} | {
|
|
107
|
+
status: 'delivered';
|
|
108
|
+
result: T | {
|
|
109
|
+
error: {
|
|
110
|
+
code: number;
|
|
111
|
+
message: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
export declare const asMaybeBusy: import("cleaners").Cleaner<{
|
|
116
|
+
error: {
|
|
117
|
+
message: any;
|
|
118
|
+
};
|
|
119
|
+
} | undefined>;
|
|
120
|
+
export interface WalletInfoExtended {
|
|
121
|
+
seed: string;
|
|
122
|
+
spend_private_key: string;
|
|
123
|
+
spend_public_key: string;
|
|
124
|
+
view_private_key: string;
|
|
125
|
+
view_public_key: string;
|
|
126
|
+
}
|
|
127
|
+
export declare enum FeePriority {
|
|
128
|
+
DEFAULT = 0,
|
|
129
|
+
UNIMPORTANT = 1,
|
|
130
|
+
NORMAL = 2,
|
|
131
|
+
ELEVATED = 3,
|
|
132
|
+
PRIORITY = 4
|
|
133
|
+
}
|
|
134
|
+
export interface GetSeedPhraseInfo {
|
|
135
|
+
error_code: string;
|
|
136
|
+
response_data: {
|
|
137
|
+
address: string;
|
|
138
|
+
hash_sum_matched: boolean;
|
|
139
|
+
require_password: boolean;
|
|
140
|
+
syntax_correct: boolean;
|
|
141
|
+
tracking: boolean;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
interface AssetInfo {
|
|
145
|
+
asset_id: string;
|
|
146
|
+
current_supply: number;
|
|
147
|
+
decimal_point: number;
|
|
148
|
+
full_name: string;
|
|
149
|
+
hidden_supply: boolean;
|
|
150
|
+
meta_info: string;
|
|
151
|
+
owner: string;
|
|
152
|
+
owner_eth_pub_key: string;
|
|
153
|
+
ticker: string;
|
|
154
|
+
total_max_supply: number;
|
|
155
|
+
}
|
|
156
|
+
interface AssetBalance {
|
|
157
|
+
asset_info: AssetInfo;
|
|
158
|
+
awaiting_in: number;
|
|
159
|
+
awaiting_out: number;
|
|
160
|
+
outs_amount_max: number;
|
|
161
|
+
outs_amount_min: number;
|
|
162
|
+
outs_count: number;
|
|
163
|
+
total: number;
|
|
164
|
+
unlocked: number;
|
|
165
|
+
}
|
|
166
|
+
export interface GetBalancesResponse {
|
|
167
|
+
balance: number;
|
|
168
|
+
balances: AssetBalance[];
|
|
169
|
+
unlocked_balance: number;
|
|
170
|
+
}
|
|
171
|
+
export interface RecentTransaction {
|
|
172
|
+
comment?: string;
|
|
173
|
+
employed_entries: {
|
|
174
|
+
receive?: Array<{
|
|
175
|
+
amount: number;
|
|
176
|
+
asset_id: string;
|
|
177
|
+
index: number;
|
|
178
|
+
}>;
|
|
179
|
+
spent?: Array<{
|
|
180
|
+
amount: number;
|
|
181
|
+
asset_id: string;
|
|
182
|
+
index: number;
|
|
183
|
+
}>;
|
|
184
|
+
};
|
|
185
|
+
fee: number;
|
|
186
|
+
height: number;
|
|
187
|
+
is_mining: boolean;
|
|
188
|
+
is_mixing: boolean;
|
|
189
|
+
is_service: boolean;
|
|
190
|
+
payment_id: string;
|
|
191
|
+
show_sender: boolean;
|
|
192
|
+
subtransfers: Array<{
|
|
193
|
+
amount: number;
|
|
194
|
+
asset_id: string;
|
|
195
|
+
is_income: boolean;
|
|
196
|
+
}>;
|
|
197
|
+
timestamp: number;
|
|
198
|
+
transfer_internal_index: number;
|
|
199
|
+
tx_blob_size: number;
|
|
200
|
+
tx_hash: string;
|
|
201
|
+
tx_type: number;
|
|
202
|
+
unlock_time: number;
|
|
203
|
+
}
|
|
204
|
+
export interface GetRecentTransactionsResponse {
|
|
205
|
+
last_item_index: number;
|
|
206
|
+
pi: {
|
|
207
|
+
balance: number;
|
|
208
|
+
curent_height: number;
|
|
209
|
+
transfer_entries_count: number;
|
|
210
|
+
transfers_count: number;
|
|
211
|
+
unlocked_balance: number;
|
|
212
|
+
};
|
|
213
|
+
total_transfers: number;
|
|
214
|
+
transfers?: RecentTransaction[];
|
|
215
|
+
}
|
|
216
|
+
export interface WhitelistAssetsResponse {
|
|
217
|
+
global_whitelist: AssetInfo[];
|
|
218
|
+
local_whitelist: AssetInfo[];
|
|
219
|
+
own_assets: AssetInfo[];
|
|
220
|
+
}
|
|
221
|
+
export interface TransferParams {
|
|
222
|
+
assetId: string;
|
|
223
|
+
fee: number;
|
|
224
|
+
nativeAmount: number;
|
|
225
|
+
recipient: string;
|
|
226
|
+
comment?: string;
|
|
227
|
+
paymentId?: string;
|
|
228
|
+
}
|
|
229
|
+
export interface TransferResponse {
|
|
230
|
+
tx_hash: string;
|
|
231
|
+
tx_size: number;
|
|
232
|
+
tx_unsigned_hex: '';
|
|
233
|
+
}
|
|
234
|
+
export {};
|
package/lib/src/types.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FeePriority = exports.asMaybeBusy = void 0;
|
|
4
|
+
const cleaners_1 = require("cleaners");
|
|
5
|
+
var WalletState;
|
|
6
|
+
(function (WalletState) {
|
|
7
|
+
WalletState[WalletState["SYNCING"] = 1] = "SYNCING";
|
|
8
|
+
WalletState[WalletState["SYNCED"] = 2] = "SYNCED";
|
|
9
|
+
WalletState[WalletState["ERROR"] = 3] = "ERROR";
|
|
10
|
+
})(WalletState || (WalletState = {}));
|
|
11
|
+
exports.asMaybeBusy = (0, cleaners_1.asMaybe)((0, cleaners_1.asObject)({
|
|
12
|
+
error: (0, cleaners_1.asObject)({
|
|
13
|
+
message: (0, cleaners_1.asValue)('BUSY')
|
|
14
|
+
})
|
|
15
|
+
}));
|
|
16
|
+
var FeePriority;
|
|
17
|
+
(function (FeePriority) {
|
|
18
|
+
FeePriority[FeePriority["DEFAULT"] = 0] = "DEFAULT";
|
|
19
|
+
FeePriority[FeePriority["UNIMPORTANT"] = 1] = "UNIMPORTANT";
|
|
20
|
+
FeePriority[FeePriority["NORMAL"] = 2] = "NORMAL";
|
|
21
|
+
FeePriority[FeePriority["ELEVATED"] = 3] = "ELEVATED";
|
|
22
|
+
FeePriority[FeePriority["PRIORITY"] = 4] = "PRIORITY";
|
|
23
|
+
})(FeePriority = exports.FeePriority || (exports.FeePriority = {}));
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-zano",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React Native bindings for the Zano blockchain",
|
|
5
|
+
"homepage": "https://github.com/EdgeApp/react-native-zano",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git@github.com:EdgeApp/react-native-zano.git"
|
|
9
|
+
},
|
|
10
|
+
"license": "BSD-3-Clause",
|
|
11
|
+
"author": "Airbitz, Inc.",
|
|
12
|
+
"main": "lib/index.js",
|
|
13
|
+
"types": "lib/index.d.ts",
|
|
14
|
+
"files": [
|
|
15
|
+
"/android/",
|
|
16
|
+
"/CHANGELOG.md",
|
|
17
|
+
"/ios/",
|
|
18
|
+
"/lib/",
|
|
19
|
+
"/package.json",
|
|
20
|
+
"/react-native-zano.podspec",
|
|
21
|
+
"/README.md",
|
|
22
|
+
"/src/zano-wrapper/zano-methods.hpp"
|
|
23
|
+
],
|
|
24
|
+
"lint-staged": {
|
|
25
|
+
"*.{js,ts}": "eslint"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"fix": "npm run lint -- --fix",
|
|
29
|
+
"lint": "eslint .",
|
|
30
|
+
"prepare": "husky install && lint-staged && rimraf lib && tsc",
|
|
31
|
+
"update-sources": "ZERO_AR_DATE=1 node -r sucrase/register ./scripts/update-sources.ts"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^14.14.7",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^5.36.2",
|
|
36
|
+
"@typescript-eslint/parser": "^5.36.2",
|
|
37
|
+
"disklet": "^0.4.6",
|
|
38
|
+
"eslint": "^8.57.0",
|
|
39
|
+
"eslint-config-standard-kit": "0.15.1",
|
|
40
|
+
"eslint-plugin-import": "^2.22.1",
|
|
41
|
+
"eslint-plugin-prettier": "^3.1.4",
|
|
42
|
+
"eslint-plugin-promise": "^4.2.1",
|
|
43
|
+
"eslint-plugin-simple-import-sort": "^6.0.1",
|
|
44
|
+
"eslint-plugin-standard": "^4.0.1",
|
|
45
|
+
"husky": "^7.0.0",
|
|
46
|
+
"lint-staged": "^10.5.3",
|
|
47
|
+
"prettier": "^2.8.8",
|
|
48
|
+
"rimraf": "^3.0.2",
|
|
49
|
+
"sucrase": "^3.16.0",
|
|
50
|
+
"typescript": "5.0.4"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"cleaners": "^0.3.17"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = package['name']
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.homepage = package['homepage']
|
|
10
|
+
s.license = package['license']
|
|
11
|
+
s.authors = package['author']
|
|
12
|
+
|
|
13
|
+
s.platform = :ios, "9.0"
|
|
14
|
+
s.requires_arc = true
|
|
15
|
+
s.source = {
|
|
16
|
+
:git => "https://github.com/EdgeApp/react-native-zano.git",
|
|
17
|
+
:tag => "v#{s.version}"
|
|
18
|
+
}
|
|
19
|
+
s.source_files =
|
|
20
|
+
"ios/ZanoModule.h",
|
|
21
|
+
"ios/ZanoModule.mm",
|
|
22
|
+
"src/zano-wrapper/zano-methods.hpp"
|
|
23
|
+
s.vendored_frameworks = "ios/ZanoModule.xcframework"
|
|
24
|
+
|
|
25
|
+
s.dependency "React-Core"
|
|
26
|
+
s.dependency "OpenSSL-Universal"
|
|
27
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#ifndef ZANO_METHODS_HPP_INCLUDED
|
|
2
|
+
#define ZANO_METHODS_HPP_INCLUDED
|
|
3
|
+
|
|
4
|
+
#include <string>
|
|
5
|
+
#include <vector>
|
|
6
|
+
|
|
7
|
+
struct ZanoMethod {
|
|
8
|
+
const char *name;
|
|
9
|
+
int argc;
|
|
10
|
+
std::string (*method)(const std::vector<const std::string> &args);
|
|
11
|
+
};
|
|
12
|
+
extern const ZanoMethod zanoMethods[];
|
|
13
|
+
extern const unsigned zanoMethodCount;
|
|
14
|
+
|
|
15
|
+
#endif
|