react-native-zano 0.1.3 → 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 CHANGED
@@ -2,6 +2,10 @@
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
+
5
9
  ## 0.1.3 (2025-05-05)
6
10
 
7
11
  - fixed: Shield symbols for iOS builds using partial linking and symbol encapsulation.
@@ -8,32 +8,32 @@
8
8
  <key>BinaryPath</key>
9
9
  <string>libzano-module.a</string>
10
10
  <key>LibraryIdentifier</key>
11
- <string>ios-arm64</string>
11
+ <string>ios-arm64_x86_64-simulator</string>
12
12
  <key>LibraryPath</key>
13
13
  <string>libzano-module.a</string>
14
14
  <key>SupportedArchitectures</key>
15
15
  <array>
16
16
  <string>arm64</string>
17
+ <string>x86_64</string>
17
18
  </array>
18
19
  <key>SupportedPlatform</key>
19
20
  <string>ios</string>
21
+ <key>SupportedPlatformVariant</key>
22
+ <string>simulator</string>
20
23
  </dict>
21
24
  <dict>
22
25
  <key>BinaryPath</key>
23
26
  <string>libzano-module.a</string>
24
27
  <key>LibraryIdentifier</key>
25
- <string>ios-arm64_x86_64-simulator</string>
28
+ <string>ios-arm64</string>
26
29
  <key>LibraryPath</key>
27
30
  <string>libzano-module.a</string>
28
31
  <key>SupportedArchitectures</key>
29
32
  <array>
30
33
  <string>arm64</string>
31
- <string>x86_64</string>
32
34
  </array>
33
35
  <key>SupportedPlatform</key>
34
36
  <string>ios</string>
35
- <key>SupportedPlatformVariant</key>
36
- <string>simulator</string>
37
37
  </dict>
38
38
  </array>
39
39
  <key>CFBundlePackageType</key>
@@ -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, transferOpts: {
60
- assetId: string;
61
- fee: number;
62
- nativeAmount: number;
63
- recipient: string;
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;
@@ -262,22 +262,33 @@ class CppBridge {
262
262
  }
263
263
  }
264
264
  }
265
- async transfer(walletId, transferOpts) {
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
- comment: transferOpts.comment,
270
- destinations: [
271
- {
272
- address: transferOpts.recipient,
273
- amount: transferOpts.nativeAmount,
274
- asset_id: transferOpts.assetId
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
  }
@@ -219,11 +219,13 @@ export interface WhitelistAssetsResponse {
219
219
  own_assets: AssetInfo[];
220
220
  }
221
221
  export interface TransferParams {
222
- assetId: string;
223
- fee: number;
224
- nativeAmount: number;
225
- recipient: string;
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.1.3",
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": {