react-native-zcash 0.10.1-beta.2 → 0.10.1-beta.4
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/ios/RNZcash.swift +4 -10
- package/package.json +1 -1
package/ios/RNZcash.swift
CHANGED
|
@@ -118,6 +118,7 @@ class RNZcash: RCTEventEmitter {
|
|
|
118
118
|
alias: alias, initializer: initializer, emitter: sendToJs)
|
|
119
119
|
let seedBytes = try Mnemonic.deterministicSeedBytes(from: seed)
|
|
120
120
|
let initMode = newWallet ? WalletInitMode.newWallet : WalletInitMode.existingWallet
|
|
121
|
+
let ufvk = try deriveUnifiedViewingKey(seed, network)
|
|
121
122
|
|
|
122
123
|
_ = try await wallet.synchronizer.prepare(
|
|
123
124
|
with: seedBytes,
|
|
@@ -128,7 +129,7 @@ class RNZcash: RCTEventEmitter {
|
|
|
128
129
|
)
|
|
129
130
|
try await wallet.synchronizer.start()
|
|
130
131
|
let accounts = try await wallet.synchronizer.listAccounts()
|
|
131
|
-
let accountUUID = accounts.first(where: { $0.
|
|
132
|
+
let accountUUID = accounts.first(where: { $0.ufvk == ufvk })?.id
|
|
132
133
|
wallet.accountUUID = accountUUID
|
|
133
134
|
wallet.subscribe()
|
|
134
135
|
await synchronizerStore.set(wallet, for: alias)
|
|
@@ -602,6 +603,8 @@ class WalletSynchronizer: NSObject {
|
|
|
602
603
|
}
|
|
603
604
|
|
|
604
605
|
func updateProcessorState(event: SynchronizerState) {
|
|
606
|
+
updateBalanceState(event: event)
|
|
607
|
+
|
|
605
608
|
var scanProgress = 0
|
|
606
609
|
|
|
607
610
|
switch event.internalSyncStatus {
|
|
@@ -628,7 +631,6 @@ class WalletSynchronizer: NSObject {
|
|
|
628
631
|
"networkBlockHeight": self.processorState.networkBlockHeight,
|
|
629
632
|
]
|
|
630
633
|
emit("UpdateEvent", data)
|
|
631
|
-
updateBalanceState(event: event)
|
|
632
634
|
}
|
|
633
635
|
|
|
634
636
|
func initializeProcessorState() {
|
|
@@ -732,14 +734,6 @@ class WalletSynchronizer: NSObject {
|
|
|
732
734
|
}
|
|
733
735
|
}
|
|
734
736
|
|
|
735
|
-
extension AccountUUID {
|
|
736
|
-
static func fromAlias(_ alias: String) -> AccountUUID {
|
|
737
|
-
let bytes = Array(alias.utf8)
|
|
738
|
-
let folded = foldTo16Bytes(bytes)
|
|
739
|
-
return AccountUUID(id: folded)
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
|
|
743
737
|
func foldTo16Bytes(_ bytes: [UInt8]) -> [UInt8] {
|
|
744
738
|
var out = [UInt8](repeating: 0, count: 16)
|
|
745
739
|
for (i, b) in bytes.enumerated() {
|