react-native-zcash 0.4.1 → 0.4.2

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
@@ -1,5 +1,10 @@
1
1
  # React Native Zcash
2
2
 
3
+ ## 0.4.2 (2023-09-14)
4
+
5
+ - changed: Always return memos array with transactions
6
+ - changed: Simplify compactMap transform
7
+
3
8
  ## 0.4.1 (2023-09-13)
4
9
 
5
10
  - fixed: Update checkpoint path (Android)
@@ -116,6 +116,8 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
116
116
  if (tx.memoCount > 0) {
117
117
  val memos = runBlocking { wallet.getMemos(tx).take(tx.memoCount).toList() }
118
118
  map.putArray("memos", Arguments.fromList(memos))
119
+ } else {
120
+ map.putArray("memos", Arguments.createArray())
119
121
  }
120
122
  return map
121
123
  }
package/ios/RNZcash.swift CHANGED
@@ -11,7 +11,7 @@ struct ConfirmedTx {
11
11
  var rawTransactionId: String
12
12
  var blockTimeInSeconds: Int
13
13
  var value: String
14
- var memo: Array<String>?
14
+ var memos: Array<String>?
15
15
  var dictionary: [String: Any?] {
16
16
  return [
17
17
  "minedHeight": minedHeight,
@@ -19,7 +19,7 @@ struct ConfirmedTx {
19
19
  "rawTransactionId": rawTransactionId,
20
20
  "blockTimeInSeconds": blockTimeInSeconds,
21
21
  "value": value,
22
- "memo": memo,
22
+ "memos": memos ?? [],
23
23
  ]
24
24
  }
25
25
  var nsDictionary: NSDictionary {
@@ -278,13 +278,9 @@ class RNZcash: RCTEventEmitter {
278
278
  if tx.memoCount > 0 {
279
279
  let memos = (try? await wallet.synchronizer.getMemos(for: tx)) ?? []
280
280
  let textMemos = memos.compactMap {
281
- if case let .text(memo) = $0 {
282
- return memo.string
283
- } else {
284
- return nil
285
- }
281
+ return $0.toString()
286
282
  }
287
- confTx.memo = textMemos
283
+ confTx.memos = textMemos
288
284
  }
289
285
  out.append(confTx.nsDictionary)
290
286
  }
@@ -60,5 +60,5 @@ export interface ConfirmedTransaction {
60
60
  minedHeight: number;
61
61
  value: string;
62
62
  toAddress?: string;
63
- memo?: string;
63
+ memos: string[];
64
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-zcash",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Zcash library for React Native",
5
5
  "homepage": "https://github.com/EdgeApp/react-native-zcash",
6
6
  "repository": {
package/src/types.ts CHANGED
@@ -79,5 +79,5 @@ export interface ConfirmedTransaction {
79
79
  minedHeight: number
80
80
  value: string
81
81
  toAddress?: string
82
- memo?: string
82
+ memos: string[]
83
83
  }