react-native-zano 0.1.2 → 0.2.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 +8 -0
- package/README.md +6 -0
- package/android/src/main/jniLibs/arm64-v8a/librnzano.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/librnzano.so +0 -0
- package/android/src/main/jniLibs/x86/librnzano.so +0 -0
- package/android/src/main/jniLibs/x86_64/librnzano.so +0 -0
- package/lib/scripts/update-sources.js +32 -23
- package/lib/scripts/utils/ios-tools.d.ts +8 -0
- package/lib/scripts/utils/ios-tools.js +26 -0
- package/lib/src/CppBridge.d.ts +7 -5
- package/lib/src/CppBridge.js +22 -11
- package/lib/src/types.d.ts +6 -4
- package/package.json +2 -2
- package/react-native-zano.podspec +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.2.0 (2025-05-26)
|
|
6
|
+
|
|
7
|
+
- changed: `transfer` now accepts an array of destinations.
|
|
8
|
+
|
|
9
|
+
## 0.1.3 (2025-05-05)
|
|
10
|
+
|
|
11
|
+
- fixed: Shield symbols for iOS builds using partial linking and symbol encapsulation.
|
|
12
|
+
|
|
5
13
|
## 0.1.2 (2025-04-29)
|
|
6
14
|
|
|
7
15
|
- fixed: Republish with missing .so files
|
package/README.md
CHANGED
|
@@ -54,3 +54,9 @@ This script does the following tasks:
|
|
|
54
54
|
- Compile an iOS universal static library and put it into an XCFramework.
|
|
55
55
|
|
|
56
56
|
The `update-sources` script is also the place to make edits when upgrading any of the third-party dependencies. The react-native-zano repo doesn't include these third-party C++ sources, since they are enormous.
|
|
57
|
+
|
|
58
|
+
For this to work, you need:
|
|
59
|
+
|
|
60
|
+
- A recent Android SDK, installed at `$ANDROID_HOME`
|
|
61
|
+
- Xcode command-line tools
|
|
62
|
+
- `llvm-objcopy`, provided by `brew install llvm`
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -32,6 +32,7 @@ const os_1 = require("os");
|
|
|
32
32
|
const path_1 = require("path");
|
|
33
33
|
const android_tools_1 = require("./utils/android-tools");
|
|
34
34
|
const common_1 = require("./utils/common");
|
|
35
|
+
const ios_tools_1 = require("./utils/ios-tools");
|
|
35
36
|
exports.srcPath = (0, path_1.join)(__dirname, '../src');
|
|
36
37
|
async function main() {
|
|
37
38
|
await (0, promises_1.mkdir)(common_1.tmpPath, { recursive: true });
|
|
@@ -50,6 +51,11 @@ async function main() {
|
|
|
50
51
|
async function downloadSources() {
|
|
51
52
|
await (0, common_1.getRepo)('zano_native_lib', 'https://github.com/hyle-team/zano_native_lib.git', '391a965d1d609f917cc97908b9d354a7f54e0258');
|
|
52
53
|
await (0, common_1.getRepo)('Boost-for-Android', 'https://github.com/moritz-wundke/Boost-for-Android.git', '51924ec5533a4fefb5edf99feaeded794c06a4fb');
|
|
54
|
+
// Rename the compress function in RIPEMD160.c,
|
|
55
|
+
// since that conflicts with Zlib:
|
|
56
|
+
const mdPath = (0, path_1.join)(common_1.tmpPath, 'zano_native_lib/Zano/src/crypto/RIPEMD160.h');
|
|
57
|
+
const mdText = await (0, promises_1.readFile)(mdPath, 'utf8');
|
|
58
|
+
await (0, promises_1.writeFile)(mdPath, '#define compress md_compress\n' + mdText);
|
|
53
59
|
}
|
|
54
60
|
// Compiler options:
|
|
55
61
|
const includePaths = ['zano_native_lib/Zano/src/wallet'];
|
|
@@ -86,8 +92,8 @@ const iosPlatforms = [
|
|
|
86
92
|
// { sdk: 'iphoneos', arch: 'armv7s' },
|
|
87
93
|
];
|
|
88
94
|
const iosSdkTriples = {
|
|
89
|
-
iphoneos: '%arch%-apple-
|
|
90
|
-
iphonesimulator: '%arch%-apple-
|
|
95
|
+
iphoneos: '%arch%-apple-ios13.0',
|
|
96
|
+
iphonesimulator: '%arch%-apple-ios13.0-simulator'
|
|
91
97
|
};
|
|
92
98
|
/**
|
|
93
99
|
* We compile our own Boost for Android,
|
|
@@ -183,6 +189,8 @@ async function buildIosZano(platform) {
|
|
|
183
189
|
const ar = await (0, common_1.quietExec)('xcrun', ['--sdk', sdk, '--find', 'ar']);
|
|
184
190
|
const cc = await (0, common_1.quietExec)('xcrun', ['--sdk', sdk, '--find', 'clang']);
|
|
185
191
|
const cxx = await (0, common_1.quietExec)('xcrun', ['--sdk', sdk, '--find', 'clang++']);
|
|
192
|
+
const ld = await (0, common_1.quietExec)('xcrun', ['--sdk', sdk, '--find', 'ld']);
|
|
193
|
+
const objcopy = await (0, ios_tools_1.getObjcopyPath)();
|
|
186
194
|
const sdkFlags = [
|
|
187
195
|
'-arch',
|
|
188
196
|
arch,
|
|
@@ -193,7 +201,7 @@ async function buildIosZano(platform) {
|
|
|
193
201
|
];
|
|
194
202
|
const cflags = [
|
|
195
203
|
...includePaths.map(path => `-I${(0, path_1.join)(common_1.tmpPath, path)}`),
|
|
196
|
-
'-miphoneos-version-min=
|
|
204
|
+
'-miphoneos-version-min=13.0',
|
|
197
205
|
'-O2',
|
|
198
206
|
'-Werror=partial-availability'
|
|
199
207
|
];
|
|
@@ -247,30 +255,31 @@ async function buildIosZano(platform) {
|
|
|
247
255
|
'--target',
|
|
248
256
|
'install'
|
|
249
257
|
]);
|
|
250
|
-
//
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
258
|
+
// Link everything together into a single giant .o file:
|
|
259
|
+
console.log(`Linking zano-module.o for ${sdk} ${arch}`);
|
|
260
|
+
const objectPath = (0, path_1.join)(working, 'zano-module.o');
|
|
261
|
+
await (0, common_1.loudExec)(ld, [
|
|
262
|
+
'-r',
|
|
263
|
+
'-o',
|
|
264
|
+
objectPath,
|
|
265
|
+
...objects,
|
|
266
|
+
...boostLibs.map(name => (0, path_1.join)(boostPath, `stage/${sdk}/${arch}/libboost_${name}.a`)),
|
|
267
|
+
...zanoLibs.map(name => (0, path_1.join)(working, `lib/lib${name}.a`))
|
|
268
|
+
]);
|
|
269
|
+
// Localize all symbols except the ones we really want,
|
|
270
|
+
// hiding them from future linking steps:
|
|
271
|
+
await (0, common_1.loudExec)(objcopy, [
|
|
272
|
+
objectPath,
|
|
273
|
+
'-w',
|
|
274
|
+
'-L*',
|
|
275
|
+
'-L!_zanoMethods',
|
|
276
|
+
'-L!_zanoMethodCount'
|
|
277
|
+
]);
|
|
269
278
|
// Generate a static library:
|
|
270
279
|
console.log(`Building static library for ${sdk}-${arch}...`);
|
|
271
280
|
const library = (0, path_1.join)(working, `libzano-module.a`);
|
|
272
281
|
await (0, promises_1.rm)(library, { force: true });
|
|
273
|
-
await (0, common_1.loudExec)(ar, ['rcs', library,
|
|
282
|
+
await (0, common_1.loudExec)(ar, ['rcs', library, objectPath]);
|
|
274
283
|
}
|
|
275
284
|
/**
|
|
276
285
|
* Creates a unified xcframework file out of the per-platform
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finds llvm-objcopy in Homebrew.
|
|
3
|
+
*
|
|
4
|
+
* Homebrew doesn't symlink LLVM into the normal location,
|
|
5
|
+
* to avoid conflicting with Xcode's built-in tools.
|
|
6
|
+
* We can get around this by looking in the right places.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getObjcopyPath(): Promise<string>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getObjcopyPath = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
/**
|
|
6
|
+
* Finds llvm-objcopy in Homebrew.
|
|
7
|
+
*
|
|
8
|
+
* Homebrew doesn't symlink LLVM into the normal location,
|
|
9
|
+
* to avoid conflicting with Xcode's built-in tools.
|
|
10
|
+
* We can get around this by looking in the right places.
|
|
11
|
+
*/
|
|
12
|
+
async function getObjcopyPath() {
|
|
13
|
+
const whichPath = await (0, common_1.quietExec)('which', ['llvm-objcopy']).catch(() => { });
|
|
14
|
+
if (whichPath != null)
|
|
15
|
+
return whichPath;
|
|
16
|
+
const paths = [
|
|
17
|
+
'/opt/homebrew/opt/llvm/bin/llvm-objcopy',
|
|
18
|
+
'/usr/local/opt/llvm/bin/llvm-objcopy' // for Intel Macs
|
|
19
|
+
];
|
|
20
|
+
for (const path of paths) {
|
|
21
|
+
if (await (0, common_1.fileExists)(path))
|
|
22
|
+
return path;
|
|
23
|
+
}
|
|
24
|
+
throw new Error('Please install `llvm-objcopy` using `brew install llvm`.');
|
|
25
|
+
}
|
|
26
|
+
exports.getObjcopyPath = getObjcopyPath;
|
package/lib/src/CppBridge.d.ts
CHANGED
|
@@ -56,12 +56,14 @@ export declare class CppBridge {
|
|
|
56
56
|
getBalances(walletId: number): Promise<GetBalancesResponse>;
|
|
57
57
|
getTransactions(walletId: number, offset?: number): Promise<GetRecentTransactionsResponse>;
|
|
58
58
|
whitelistAssets(walletId: number, assetIds: string[]): Promise<void>;
|
|
59
|
-
transfer(walletId: number,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
transfer(walletId: number, opts: {
|
|
60
|
+
transfers: Array<{
|
|
61
|
+
assetId: string;
|
|
62
|
+
nativeAmount: number;
|
|
63
|
+
recipient: string;
|
|
64
|
+
}>;
|
|
64
65
|
comment?: string;
|
|
66
|
+
fee: number;
|
|
65
67
|
paymentId?: string;
|
|
66
68
|
}): Promise<string>;
|
|
67
69
|
private handleRpcResponse;
|
package/lib/src/CppBridge.js
CHANGED
|
@@ -262,22 +262,33 @@ class CppBridge {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
async transfer(walletId,
|
|
265
|
+
async transfer(walletId, opts) {
|
|
266
|
+
// Transaction can only have one payment ID
|
|
267
|
+
let paymentId = opts.paymentId;
|
|
268
|
+
for (const transfer of opts.transfers) {
|
|
269
|
+
const addressInfo = await this.getAddressInfo(transfer.recipient);
|
|
270
|
+
if (!addressInfo.is_integrated)
|
|
271
|
+
continue;
|
|
272
|
+
if (paymentId == null) {
|
|
273
|
+
paymentId = addressInfo.payment_id;
|
|
274
|
+
}
|
|
275
|
+
else if (paymentId !== addressInfo.payment_id) {
|
|
276
|
+
throw new Error('Transaction can only have one payment ID');
|
|
277
|
+
}
|
|
278
|
+
}
|
|
266
279
|
const params = {
|
|
267
280
|
method: 'transfer',
|
|
268
281
|
params: {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
fee: transferOpts.fee,
|
|
282
|
+
destinations: opts.transfers.map(t => ({
|
|
283
|
+
address: t.recipient,
|
|
284
|
+
amount: t.nativeAmount,
|
|
285
|
+
asset_id: t.assetId
|
|
286
|
+
})),
|
|
287
|
+
comment: opts.comment,
|
|
288
|
+
fee: opts.fee,
|
|
289
|
+
payment_id: opts.paymentId ?? '',
|
|
278
290
|
hide_receiver: true,
|
|
279
291
|
mixin: 15,
|
|
280
|
-
payment_id: transferOpts.paymentId ?? '',
|
|
281
292
|
push_payer: false,
|
|
282
293
|
service_entries_permanent: true
|
|
283
294
|
}
|
package/lib/src/types.d.ts
CHANGED
|
@@ -219,11 +219,13 @@ export interface WhitelistAssetsResponse {
|
|
|
219
219
|
own_assets: AssetInfo[];
|
|
220
220
|
}
|
|
221
221
|
export interface TransferParams {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
222
|
+
transfers: Array<{
|
|
223
|
+
assetId: string;
|
|
224
|
+
nativeAmount: number;
|
|
225
|
+
recipient: string;
|
|
226
|
+
}>;
|
|
226
227
|
comment?: string;
|
|
228
|
+
fee: number;
|
|
227
229
|
paymentId?: string;
|
|
228
230
|
}
|
|
229
231
|
export interface TransferResponse {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-zano",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "React Native bindings for the Zano blockchain",
|
|
5
5
|
"homepage": "https://github.com/EdgeApp/react-native-zano",
|
|
6
6
|
"repository": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"license": "BSD-3-Clause",
|
|
11
11
|
"author": "Airbitz, Inc.",
|
|
12
|
-
"main": "lib/index.js",
|
|
12
|
+
"main": "lib/src/index.js",
|
|
13
13
|
"types": "lib/src/index.d.ts",
|
|
14
14
|
"files": [
|
|
15
15
|
"/android/build.gradle",
|