react-native-zcash 0.2.0 → 0.2.3

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,22 @@
1
1
  # React Native Zcash
2
2
 
3
+ ## 0.2.3 (2022-08-07)
4
+
5
+ - iOS: Handle potential throw in synchronizer.latestHeight()
6
+
7
+ ## 0.2.2 (2022-06-10)
8
+
9
+ - Upgrade SDKs to NU5 compatible versions
10
+ - Android: Upgrade zcash-android-sdk to v1.5.0-beta01
11
+ - iOS: Upgrade ZcashLightClientKit to v0.14.0-beta
12
+ - iOS: Fix memory leak after stopping synchronizer
13
+ - ANdroid: White space and import cleanups
14
+
15
+ ## 0.2.1 (2022-03-16)
16
+
17
+ - Update the ZcashLightClientKit dependency
18
+ - Remove unused build scripts
19
+
3
20
  ## 0.2.0 (2022-01-10)
4
21
 
5
22
  - Add iOS support
@@ -1,7 +1,7 @@
1
1
  buildscript {
2
2
  ext.versions = [
3
3
  'kotlin': '1.5.0',
4
- 'zcash': '1.3.0-beta18',
4
+ 'zcash': '1.5.0-beta01',
5
5
  'room': '2.3.0'
6
6
  ]
7
7
  repositories {
@@ -33,7 +33,7 @@ def safeExtGet(prop, fallback) {
33
33
 
34
34
  def DEFAULT_COMPILE_SDK_VERSION = 28
35
35
  def DEFAULT_BUILD_TOOLS_VERSION = "28.0.2"
36
- def DEFAULT_MIN_SDK_VERSION = 16
36
+ def DEFAULT_MIN_SDK_VERSION = 19
37
37
  def DEFAULT_TARGET_SDK_VERSION = 27
38
38
 
39
39
  android {
@@ -80,4 +80,10 @@ dependencies {
80
80
  implementation "androidx.paging:paging-runtime-ktx:2.1.2"
81
81
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9"
82
82
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9"
83
+
84
+ implementation ("androidx.appcompat:appcompat:1.3.1") {
85
+ version {
86
+ strictly '1.3.1'
87
+ }
88
+ }
83
89
  }
@@ -1,32 +1,29 @@
1
1
  package app.edge.rnzcash;
2
2
 
3
- import androidx.paging.PagedList
4
3
  import cash.z.ecc.android.sdk.Initializer
5
4
  import cash.z.ecc.android.sdk.SdkSynchronizer
6
5
  import cash.z.ecc.android.sdk.Synchronizer
7
- import cash.z.ecc.android.sdk.Synchronizer.Status.SYNCED
8
- import cash.z.ecc.android.sdk.block.CompactBlockProcessor
9
6
  import cash.z.ecc.android.sdk.db.entity.*
10
7
  import cash.z.ecc.android.sdk.ext.*
11
- import cash.z.ecc.android.sdk.transaction.*
8
+ import cash.z.ecc.android.sdk.internal.transaction.PagedTransactionRepository
9
+ import cash.z.ecc.android.sdk.internal.*
12
10
  import cash.z.ecc.android.sdk.type.*
13
11
  import cash.z.ecc.android.sdk.tool.DerivationTool
14
12
  import com.facebook.react.bridge.*
15
13
  import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter
16
14
  import kotlinx.coroutines.CoroutineScope
17
- import kotlinx.coroutines.cancel
18
15
  import kotlinx.coroutines.flow.distinctUntilChanged
19
- import kotlinx.coroutines.flow.filter
20
16
  import kotlinx.coroutines.launch
17
+ import kotlinx.coroutines.runBlocking
21
18
  import java.nio.charset.StandardCharsets
22
19
  import kotlin.coroutines.EmptyCoroutineContext
23
20
 
24
21
  class WalletSynchronizer constructor(val initializer: Initializer) {
25
-
26
- val synchronizer: SdkSynchronizer = Synchronizer(
22
+
23
+ val synchronizer: SdkSynchronizer = Synchronizer.newBlocking(
27
24
  initializer
28
25
  ) as SdkSynchronizer
29
- val repository = PagedTransactionRepository(initializer.context, 10, initializer.rustBackend, initializer.birthday, initializer.viewingKeys)
26
+ val repository = runBlocking { PagedTransactionRepository.new(initializer.context, 10, initializer.rustBackend, initializer.birthday, initializer.viewingKeys) }
30
27
  var isStarted = false
31
28
  }
32
29
 
@@ -50,28 +47,32 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
50
47
  @ReactMethod
51
48
  fun initialize(extfvk: String, extpub: String, birthdayHeight: Int, alias: String, networkName: String = "mainnet", defaultHost: String = "mainnet.lightwalletd.com", defaultPort: Int = 9067, promise: Promise) =
52
49
  promise.wrap {
53
- Twig.plant(TroubleshootingTwig())
54
- var vk = UnifiedViewingKey(extfvk, extpub)
55
- if (synchronizerMap[alias] == null) {
56
- val initializer = Initializer(reactApplicationContext) { config ->
57
- config.importedWalletBirthday(birthdayHeight)
58
- config.setViewingKeys(vk)
59
- config.setNetwork(networks[networkName] ?: ZcashNetwork.Mainnet, defaultHost, defaultPort)
60
- config.alias = alias
61
- }
62
- synchronizerMap[alias] = WalletSynchronizer(initializer)
63
- val wallet = getWallet(alias)
50
+ Twig.plant(TroubleshootingTwig())
51
+ var vk = UnifiedViewingKey(extfvk, extpub)
52
+ if (synchronizerMap[alias] == null) {
53
+ runBlocking {
54
+ Initializer.new(reactApplicationContext) {
55
+ it.importedWalletBirthday(birthdayHeight)
56
+ it.setViewingKeys(vk)
57
+ it.setNetwork(networks[networkName]
58
+ ?: ZcashNetwork.Mainnet, defaultHost, defaultPort)
59
+ it.alias = alias
60
+ }
61
+ }.let { initializer ->
62
+ synchronizerMap[alias] = WalletSynchronizer(initializer)
64
63
  }
65
- val wallet = getWallet(alias)
66
- wallet.synchronizer.hashCode().toString()
67
-
64
+ }
65
+ val wallet = getWallet(alias)
66
+ wallet.synchronizer.hashCode().toString()
68
67
  }
69
68
 
70
69
  @ReactMethod
71
70
  fun start(alias: String, promise: Promise) = promise.wrap {
72
71
  val wallet = getWallet(alias)
73
72
  if (!wallet.isStarted) {
74
- wallet.synchronizer.prepare()
73
+ runBlocking {
74
+ wallet.synchronizer.prepare()
75
+ }
75
76
  wallet.synchronizer.start(moduleScope)
76
77
  val scope = wallet.synchronizer.coroutineScope
77
78
  wallet.synchronizer.processorInfo.collectWith(scope, { update ->
@@ -83,7 +84,7 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
83
84
  args.putInt("networkBlockHeight", update.networkBlockHeight)
84
85
  }
85
86
  })
86
- wallet.synchronizer.status.collectWith(scope, { status ->
87
+ wallet.synchronizer.status.collectWith(scope, { status ->
87
88
  sendEvent("StatusEvent") { args ->
88
89
  args.putString("alias", alias)
89
90
  args.putString("name", status.toString())
@@ -104,7 +105,6 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
104
105
  args.putInt("transactionCount", txList.count())
105
106
  }
106
107
  })
107
- wallet.repository.prepare()
108
108
  wallet.isStarted = true
109
109
  }
110
110
  "success"
@@ -152,7 +152,7 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
152
152
 
153
153
  @ReactMethod
154
154
  fun deriveViewingKey(seedBytesHex: String, network: String = "mainnet", promise: Promise) {
155
- var keys = DerivationTool.deriveUnifiedViewingKeys(seedBytesHex.fromHex(), networks.getOrDefault(network, ZcashNetwork.Mainnet))[0]
155
+ var keys = runBlocking { DerivationTool.deriveUnifiedViewingKeys(seedBytesHex.fromHex(), networks.getOrDefault(network, ZcashNetwork.Mainnet))[0] }
156
156
  val map = Arguments.createMap()
157
157
  map.putString("extfvk", keys.extfvk)
158
158
  map.putString("extpub", keys.extpub)
@@ -161,7 +161,7 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
161
161
 
162
162
  @ReactMethod
163
163
  fun deriveSpendingKey(seedBytesHex: String, network: String = "mainnet", promise: Promise) = promise.wrap {
164
- DerivationTool.deriveSpendingKeys(seedBytesHex.fromHex(), networks.getOrDefault(network, ZcashNetwork.Mainnet))[0]
164
+ runBlocking { DerivationTool.deriveSpendingKeys(seedBytesHex.fromHex(), networks.getOrDefault(network, ZcashNetwork.Mainnet))[0] }
165
165
  }
166
166
 
167
167
  //
@@ -226,7 +226,7 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
226
226
  promise.reject("Err", t)
227
227
  }
228
228
  }
229
-
229
+
230
230
  }
231
231
 
232
232
  //
@@ -235,7 +235,7 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
235
235
 
236
236
  @ReactMethod
237
237
  fun deriveShieldedAddress(viewingKey: String, network: String = "mainnet", promise: Promise) = promise.wrap {
238
- DerivationTool.deriveShieldedAddress(viewingKey, networks.getOrDefault(network, ZcashNetwork.Mainnet))
238
+ runBlocking { DerivationTool.deriveShieldedAddress(viewingKey, networks.getOrDefault(network, ZcashNetwork.Mainnet)) }
239
239
  }
240
240
 
241
241
  @ReactMethod
@@ -256,7 +256,7 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
256
256
  }
257
257
 
258
258
  @ReactMethod
259
- fun isValidTransparentAddress(address: String, network: String, promise: Promise) {
259
+ fun isValidTransparentAddress(address: String, network: String, promise: Promise) {
260
260
  moduleScope.launch {
261
261
  promise.wrap {
262
262
  var isValid = false
@@ -278,13 +278,13 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
278
278
 
279
279
  /**
280
280
  * Retrieve wallet object from synchronizer map
281
- */
281
+ */
282
282
  private fun getWallet(alias: String): WalletSynchronizer {
283
283
  val wallet = synchronizerMap.get(alias)
284
284
  if (wallet == null) throw Exception("Wallet not found")
285
285
  return wallet
286
286
  }
287
-
287
+
288
288
 
289
289
  /**
290
290
  * Wrap the given block of logic in a promise, rejecting for any error.
@@ -314,4 +314,12 @@ class RNZcashModule(private val reactContext: ReactApplicationContext) :
314
314
  "Unable to parse memo."
315
315
  }
316
316
  }
317
+
318
+ inline fun ByteArray.toHexReversed(): String {
319
+ val sb = StringBuilder(size * 2)
320
+ var i = size - 1
321
+ while (i >= 0)
322
+ sb.append(String.format("%02x", this[i--]))
323
+ return sb.toString()
324
+ }
317
325
  }
package/ios/RNZcash.swift CHANGED
@@ -135,6 +135,7 @@ class RNZcash : RCTEventEmitter {
135
135
  @objc func stop(_ alias: String, resolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
136
136
  if let wallet = SynchronizerMap[alias] {
137
137
  wallet.synchronizer.stop()
138
+ SynchronizerMap[alias] = nil
138
139
  resolve(nil)
139
140
  } else {
140
141
  reject("StopError", "Wallet does not exist", genericError)
@@ -327,7 +328,7 @@ class WalletSynchronizer : NSObject {
327
328
 
328
329
  public func subscribe() {
329
330
  // Processor status
330
- NotificationCenter.default.addObserver(self, selector: #selector(updateProcessorState(notification:)), name: .blockProcessorUpdated, object: self.synchronizer.blockProcessor)
331
+ NotificationCenter.default.addObserver(self, selector: #selector(updateProcessorState(notification:)), name: nil, object: self.synchronizer.blockProcessor)
331
332
  // Synchronizer Status
332
333
  NotificationCenter.default.addObserver(self, selector: #selector(updateSyncStatus(notification:)), name: .synchronizerDisconnected, object: self.synchronizer)
333
334
  NotificationCenter.default.addObserver(self, selector: #selector(updateSyncStatus(notification:)), name: .synchronizerStopped, object: self.synchronizer)
@@ -371,17 +372,44 @@ class WalletSynchronizer : NSObject {
371
372
  }
372
373
 
373
374
  @objc public func updateProcessorState(notification: NSNotification) {
374
- let status: CompactBlockProgress = notification.userInfo![CompactBlockProcessorNotificationKey.progress] as! CompactBlockProgress
375
- if case .download = status {
376
- self.processorState.lastDownloadedHeight = status.progressHeight!
377
- } else if case .scan = status {
378
- self.processorState.lastScannedHeight = status.progressHeight!
379
- self.processorState.scanProgress = Int(status.progress * 100)
375
+ let prevLastDownloadedHeight = self.processorState.lastDownloadedHeight
376
+ let prevScanProgress = self.processorState.scanProgress
377
+ let prevLastScannedHeight = self.synchronizer.latestScannedHeight
378
+ let prevNetworkBlockHeight = self.processorState.lastScannedHeight
379
+
380
+ if !self.fullySynced {
381
+ switch self.synchronizer.status {
382
+ case .downloading(let status):
383
+ // The SDK emits all zero values just before emitting a SYNCED status so we need to ignore these
384
+ if status.targetHeight == 0 {
385
+ return
386
+ }
387
+ self.processorState.lastDownloadedHeight = status.progressHeight
388
+ self.processorState.networkBlockHeight = status.targetHeight
389
+ break
390
+ case .scanning(let status):
391
+ self.processorState.scanProgress = Int(floor(status.progress * 100))
392
+ self.processorState.lastScannedHeight = status.progressHeight
393
+ self.processorState.networkBlockHeight = status.targetHeight
394
+ default:
395
+ return
396
+ }
380
397
  } else {
381
- return
398
+ self.processorState.lastDownloadedHeight = self.synchronizer.latestScannedHeight
399
+ self.processorState.scanProgress = 100
400
+ self.processorState.lastScannedHeight = self.synchronizer.latestScannedHeight
401
+ do {
402
+ try self.processorState.networkBlockHeight = self.synchronizer.latestHeight()
403
+ } catch {
404
+ // ignore if synchronizer throws
405
+ }
406
+ }
407
+
408
+ if self.processorState.lastDownloadedHeight != prevLastDownloadedHeight || self.processorState.scanProgress != prevScanProgress ||
409
+ self.processorState.lastScannedHeight != prevLastScannedHeight ||
410
+ self.processorState.networkBlockHeight != prevNetworkBlockHeight {
411
+ emit("UpdateEvent", self.processorState.nsDictionary)
382
412
  }
383
- self.processorState.networkBlockHeight = status.targetHeight!
384
- emit("UpdateEvent", self.processorState.nsDictionary)
385
413
  }
386
414
 
387
415
  func initializeProcessorState() {
@@ -430,7 +458,7 @@ func documentsDirectoryHelper() throws -> URL {
430
458
  func cacheDbURLHelper(_ alias: String, _ network: ZcashNetwork) throws -> URL {
431
459
  try documentsDirectoryHelper()
432
460
  .appendingPathComponent(
433
- network.constants.DEFAULT_DB_NAME_PREFIX + alias + ZcashSDK.DEFAULT_CACHES_DB_NAME,
461
+ network.constants.defaultDbNamePrefix + alias + ZcashSDK.defaultCacheDbName,
434
462
  isDirectory: false
435
463
  )
436
464
  }
@@ -438,14 +466,14 @@ func cacheDbURLHelper(_ alias: String, _ network: ZcashNetwork) throws -> URL {
438
466
  func dataDbURLHelper(_ alias: String, _ network: ZcashNetwork) throws -> URL {
439
467
  try documentsDirectoryHelper()
440
468
  .appendingPathComponent(
441
- network.constants.DEFAULT_DB_NAME_PREFIX + alias + ZcashSDK.DEFAULT_DATA_DB_NAME,
469
+ network.constants.defaultDbNamePrefix + alias + ZcashSDK.defaultDataDbName,
442
470
  isDirectory: false
443
471
  )
444
472
  }
445
473
 
446
474
  func pendingDbURLHelper(_ alias: String, _ network: ZcashNetwork) throws -> URL {
447
475
  try documentsDirectoryHelper()
448
- .appendingPathComponent(network.constants.DEFAULT_DB_NAME_PREFIX + alias + ZcashSDK.DEFAULT_PENDING_DB_NAME)
476
+ .appendingPathComponent(network.constants.defaultDbNamePrefix + alias + ZcashSDK.defaultPendingDbName)
449
477
  }
450
478
 
451
479
  func spendParamsURLHelper(_ alias: String) throws -> URL {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-zcash",
3
- "version": "0.2.0",
3
+ "version": "0.2.3",
4
4
  "description": "Zcash library for React Native",
5
5
  "homepage": "https://github.com/EdgeApp/react-native-zcash",
6
6
  "repository": {
@@ -28,7 +28,6 @@
28
28
  "lib",
29
29
  "package.json",
30
30
  "README.md",
31
- "Scripts",
32
31
  "src"
33
32
  ],
34
33
  "main": "lib/rnzcash.rn.js",
@@ -15,15 +15,8 @@ Pod::Spec.new do |s|
15
15
  s.requires_arc = true
16
16
  s.source = { :git => "https://github.com/EdgeApp/react-native-zcash.git", :tag => "v#{s.version}" }
17
17
  s.source_files = "ios/**/*.{h,m,swift}"
18
- s.script_phase = {
19
- :name => 'Build generate constants and build librustzcash',
20
- :script => 'sh ${PODS_TARGET_SRCROOT}/Scripts/build_librustzcash_xcode.sh',
21
- :execution_position => :before_compile
22
- }
23
- s.prepare_command = <<-CMD
24
- sh Scripts/prepare_zcash_sdk.sh
25
- CMD
26
18
 
27
- s.dependency "React"
28
- s.dependency 'ZcashLightClientKit', '0.12.0-beta.5'
19
+ s.dependency "React"
20
+ s.dependency 'ZcashLightClientKit', '0.14.0-beta'
21
+
29
22
  end
@@ -1,23 +0,0 @@
1
- #!/bin/bash
2
-
3
- BASEPATH="${PWD}"
4
- TARGET_DIR="target"
5
-
6
-
7
- LIB_PATH="ZcashLightClientKit/$FLAVOR_FOLDER/zcashlc"
8
- echo "++++ Building librustzcash $NETWORK_TYPE library ++++"
9
-
10
-
11
- if [ -f $TARGET_DIR ]; then
12
- rm -rf $TARGET_DIR
13
- fi
14
-
15
- cargo lipo --manifest-path ${PODS_TARGET_SRCROOT}/Cargo.toml --release
16
-
17
-
18
- if [ -f $LIB_PATH ]; then
19
- rm -rf $LIB_PATH
20
- mkdir -p $LIB_PATH
21
- fi
22
-
23
- cp -rf $TARGET_DIR/universal/release/* $LIB_PATH
@@ -1,64 +0,0 @@
1
- #!/bin/sh
2
-
3
- set -x
4
-
5
- SCRIPT_COMMONS="${PODS_TARGET_SRCROOT}/Scripts/script_commons.sh"
6
- if [ ! -f $SCRIPT_COMMONS ]; then
7
- echo "Failed to load $SCRIPT_COMMONS"
8
- exit 1
9
- fi
10
- source $SCRIPT_COMMONS
11
-
12
- if [ "$ACTION" = "clean" ]; then
13
- echo "CLEAN DETECTED"
14
- clean
15
- exit 0
16
- fi
17
-
18
- echo "Building Rust backend"
19
- echo ""
20
- echo "${PODS_TARGET_SRCROOT}"
21
- echo "platform name"
22
- echo $PLATFORM_NAME
23
- if [ $PLATFORM_NAME = "iphonesimulator" ]; then
24
- ZCASH_ACTIVE_ARCHITECTURE="aarch64-apple-ios-sim x86_64-apple-ios"
25
- RUSTUP_TOOLCHAIN="nightly-2021-09-24"
26
- else
27
- ZCASH_ACTIVE_ARCHITECTURE="aarch64-apple-ios"
28
- RUSTUP_TOOLCHAIN="stable"
29
- fi
30
-
31
- echo "fix 'permission denied issue'"
32
- chmod -R +w ${PODS_TARGET_SRCROOT}
33
-
34
- echo "RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN} cargo build --manifest-path ${PODS_TARGET_SRCROOT}/Cargo.toml --target $ZCASH_ACTIVE_ARCHITECTURE --release"
35
- if [[ -n "${DEVELOPER_SDK_DIR:-}" ]]; then
36
- # Assume we're in Xcode, which means we're probably cross-compiling.
37
- # In this case, we need to add an extra library search path for build scripts and proc-macros,
38
- # which run on the host instead of the target.
39
- # (macOS Big Sur does not have linkable libraries in /usr/lib/.)
40
- echo "export LIBRARY_PATH=\"${DEVELOPER_SDK_DIR}/MacOSX.sdk/usr/lib:${LIBRARY_PATH:-}\""
41
- export LIBRARY_PATH="${DEVELOPER_SDK_DIR}/MacOSX.sdk/usr/lib:${LIBRARY_PATH:-}"
42
- fi
43
- if [ ! -f ${ZCASH_LIB_RUST_BUILD_PATH}/universal/release/${ZCASH_LIB_RUST_NAME} ]; then
44
- RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN} cargo lipo --manifest-path ${PODS_TARGET_SRCROOT}/Cargo.toml --targets $ZCASH_ACTIVE_ARCHITECTURE --release
45
- persist_environment
46
- fi
47
-
48
-
49
-
50
- if [ ! -d "${RUST_LIB_PATH}" ]; then
51
- mkdir -p "${RUST_LIB_PATH}"
52
- fi
53
-
54
- echo "clean up existing artifacts: rm -f ${ZCASH_SDK_RUST_LIB_PATH}/${ZCASH_LIB_RUST_NAME}"
55
- rm -f "${ZCASH_SDK_RUST_LIB_PATH}/${ZCASH_LIB_RUST_NAME}"
56
- echo "clean up sdk lib path: rm -f ${RUST_LIB_PATH}/${ZCASH_LIB_RUST_NAME}"
57
-
58
- rm -f "${RUST_LIB_PATH}/${ZCASH_LIB_RUST_NAME}"
59
- echo "copying artifacts: cp -f ${ZCASH_LIB_RUST_BUILD_PATH}/universal/release/${ZCASH_LIB_RUST_NAME} ${ZCASH_SDK_RUST_LIB_PATH}/${ZCASH_LIB_RUST_NAME}"
60
- # ALWAYS SHIP RELEASE NO MATTER WHAT YOUR BUILD IS (FOR NOW AT LEAST)
61
- cp -f "${ZCASH_LIB_RUST_BUILD_PATH}/universal/release/${ZCASH_LIB_RUST_NAME}" "${ZCASH_SDK_RUST_LIB_PATH}/${ZCASH_LIB_RUST_NAME}"
62
- echo "copying artifacts: cp -f ${ZCASH_LIB_RUST_BUILD_PATH}/universal/release/${ZCASH_LIB_RUST_NAME} ${RUST_LIB_PATH}/${ZCASH_LIB_RUST_NAME}"
63
- cp -f "${ZCASH_LIB_RUST_BUILD_PATH}/universal/release/${ZCASH_LIB_RUST_NAME}" "${RUST_LIB_PATH}/${ZCASH_LIB_RUST_NAME}"
64
-
@@ -1,16 +0,0 @@
1
- #!/bin/sh
2
- #check if env-vars.sh exists
3
- ENV_VARS_PATH=${PODS_TARGET_SRCROOT}/env-vars.sh
4
- if [ -f $ENV_VARS_PATH ]; then
5
- source $ENV_VARS_PATH
6
- echo "importing $ENV_VARS_PATH"
7
- fi
8
-
9
- export ZCASH_TEST_SRC_PATH="${PODS_TARGET_SRCROOT}/ZcashLightClientKitTests"
10
- if [ ! ${LIGHTWALLETD_ADDRESS} ]; then
11
- echo "LIGHTWALLETD_ADDRESS VARIABLE NOT DEFINED"
12
- exit 1
13
- fi
14
- echo "export ZCASH_TEST_SRC_PATH=$ZCASH_TEST_SRC_PATH"
15
- #no `else` case needed if the CI works as expected
16
- sourcery --templates "${ZCASH_TEST_SRC_PATH}/Stencil" --sources ${ZCASH_TEST_SRC_PATH} --output ${ZCASH_TEST_SRC_PATH} --args addr=$LIGHTWALLETD_ADDRESS
@@ -1,31 +0,0 @@
1
- #!/bin/sh
2
-
3
- cargo install cargo-lipo
4
- rustup target add aarch64-apple-ios x86_64-apple-ios
5
-
6
- echo "PWD: ${PWD}"
7
-
8
- echo "*********************************************"
9
- echo "* create fake .a so pod install picks it up *"
10
- echo "*********************************************"
11
- RUST_LIB_PATH="${PWD}"/lib
12
- mkdir -p -v $RUST_LIB_PATH
13
- echo "******************************************************************************"
14
- echo " touch $RUST_LIB_PATH/libzcashlc.a "
15
- echo "******************************************************************************"
16
- touch $RUST_LIB_PATH/libzcashlc.a
17
-
18
-
19
- ZCASH_POD_ROOT="${PWD%/*/*}"
20
- ZCASH_POD_SRCROOT="${ZCASH_POD_ROOT}/ios/Pods/ZcashLightClientKit/ZcashLightClientKit"
21
- ZCASH_SDK_GENERATED_SOURCES_FOLDER="${ZCASH_POD_SRCROOT}/Generated"
22
-
23
- echo "***************************************************************************"
24
- echo " touch ${ZCASH_POD_ROOT}/zcashlc/libzcashlc.a"
25
- echo "***************************************************************************"
26
- touch ${ZCASH_POD_SRCROOT}/zcashlc/libzcashlc.a
27
-
28
- echo "***************************************************************************"
29
- echo " touch ${ZCASH_POD_ROOT}/zcashlc/zcashlc.h"
30
- echo "***************************************************************************"
31
- touch ${ZCASH_POD_SRCROOT}/zcashlc/zcashlc.h
@@ -1,23 +0,0 @@
1
- #!/bin/sh
2
-
3
- export PATH="$HOME/.cargo/bin:$PATH"
4
- export RUST_LIB_PATH="${PODS_TARGET_SRCROOT}/lib"
5
- export ZCASH_POD_SCRIPTS="${PODS_TARGET_SRCROOT}/Scripts"
6
- export ZCASH_LIB_RUST_BUILD_PATH="${PODS_TARGET_SRCROOT%/*/*/*/*}/ZcashLightClientKit/target"
7
-
8
- export ZCASH_LIB_RUST_NAME="libzcashlc.a"
9
-
10
- export ZCASH_SRC_PATH="${PODS_TARGET_SRCROOT%/*/*/*/*}/ZcashLightClientKit/ZcashLightClientKit"
11
- export ZCASH_SDK_RUST_LIB_PATH="${ZCASH_SRC_PATH}/zcashlc"
12
-
13
-
14
- function clean {
15
- echo "CLEAN DETECTED"
16
- cargo clean
17
- if [ -d "${RUST_LIB_PATH}" ]; then
18
- rm -rf "${RUST_LIB_PATH}"
19
- fi
20
- if [ -d "${ZCASH_LIB_RUST_BUILD_PATH}" ]; then
21
- rm -rf "${ZCASH_LIB_RUST_BUILD_PATH}"
22
- fi
23
- }
@@ -1,8 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -x
4
-
5
- APP_DIR=${TRAVIS_BUILD_DIR}/Example/ZcashLightClientSample
6
- cd ${APP_DIR}
7
-
8
- pod install
@@ -1,13 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -x
4
-
5
- rustup-init --verbose -y
6
-
7
- source $HOME/.cargo/env
8
-
9
- rustup target add aarch64-apple-ios x86_64-apple-ios
10
- rustup toolchain add nightly-2021-09-24
11
- rustup +nightly-2021-09-24 target add aarch64-apple-ios-sim x86_64-apple-ios
12
-
13
- cargo install cargo-lipo