react-native-zcash 0.9.13 → 0.10.1-beta.1
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 +4 -0
- package/android/build.gradle +6 -6
- package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/3130000.json +8 -0
- package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/3140000.json +8 -0
- package/android/src/main/java/app/edge/rnzcash/RNZcashModule.kt +126 -69
- package/ios/RNZcash.m +0 -5
- package/ios/RNZcash.swift +153 -104
- package/ios/ZCashLightClientKit/Account/Account.swift +48 -0
- package/ios/ZCashLightClientKit/Account/AccountMetadataKey.swift +96 -0
- package/ios/ZCashLightClientKit/Block/Actions/ScanAction.swift +23 -4
- package/ios/ZCashLightClientKit/Block/Actions/UpdateChainTipAction.swift +6 -2
- package/ios/ZCashLightClientKit/Block/Actions/UpdateSubtreeRootsAction.swift +4 -2
- package/ios/ZCashLightClientKit/Block/Actions/ValidateServerAction.swift +4 -1
- package/ios/ZCashLightClientKit/Block/CompactBlockProcessor.swift +83 -16
- package/ios/ZCashLightClientKit/Block/Download/BlockDownloader.swift +4 -2
- package/ios/ZCashLightClientKit/Block/Download/BlockDownloaderService.swift +22 -19
- package/ios/ZCashLightClientKit/Block/Enhance/BlockEnhancer.swift +50 -19
- package/ios/ZCashLightClientKit/Block/FetchUnspentTxOutputs/UTXOFetcher.swift +5 -3
- package/ios/ZCashLightClientKit/Block/SaplingParameters/SaplingParametersHandler.swift +22 -5
- package/ios/ZCashLightClientKit/Block/Scan/BlockScanner.swift +2 -1
- package/ios/ZCashLightClientKit/Block/Utils/CompactBlockProgress.swift +5 -3
- package/ios/ZCashLightClientKit/Checkpoint/BundleCheckpointSource.swift +88 -0
- package/ios/ZCashLightClientKit/Checkpoint/CheckpointSource.swift +4 -0
- package/ios/ZCashLightClientKit/ClosureSynchronizer.swift +52 -21
- package/ios/ZCashLightClientKit/CombineSynchronizer.swift +49 -27
- package/ios/ZCashLightClientKit/Constants/ZcashSDK.swift +8 -2
- package/ios/ZCashLightClientKit/DAO/BlockDao.swift +65 -0
- package/ios/ZCashLightClientKit/DAO/TransactionDao.swift +86 -1
- package/ios/ZCashLightClientKit/Entity/AccountEntity.swift +4 -4
- package/ios/ZCashLightClientKit/Entity/Pczt.swift +10 -0
- package/ios/ZCashLightClientKit/Entity/SentNoteEntity.swift +2 -2
- package/ios/ZCashLightClientKit/Entity/TransactionEntity.swift +40 -16
- package/ios/ZCashLightClientKit/Error/Sourcery/generateErrorCode.sh +1 -1
- package/ios/ZCashLightClientKit/Error/ZcashError.swift +182 -14
- package/ios/ZCashLightClientKit/Error/ZcashErrorCode.swift +63 -5
- package/ios/ZCashLightClientKit/Error/ZcashErrorCodeDefinition.swift +122 -12
- package/ios/ZCashLightClientKit/Initializer.swift +49 -14
- package/ios/ZCashLightClientKit/Metrics/SDKMetrics.swift +15 -6
- package/ios/ZCashLightClientKit/Model/SingleUseTransparentAddress.swift +29 -0
- package/ios/ZCashLightClientKit/Model/TransactionDataRequest.swift +83 -2
- package/ios/ZCashLightClientKit/Model/WalletSummary.swift +21 -4
- package/ios/ZCashLightClientKit/Model/WalletTypes.swift +38 -8
- package/ios/ZCashLightClientKit/Modules/Service/GRPC/LightWalletGRPCService.swift +177 -45
- package/ios/ZCashLightClientKit/Modules/Service/LightWalletService.swift +63 -16
- package/ios/ZCashLightClientKit/Modules/Service/Tor/LightWalletGRPCServiceOverTor.swift +273 -0
- package/ios/ZCashLightClientKit/Providers/LatestBlocksDataProvider.swift +5 -2
- package/ios/ZCashLightClientKit/Repository/TransactionRepository.swift +2 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2675000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2677500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2682500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2685000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2687500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2692500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2695000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2697500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2702500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2705000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2707500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2712500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2715000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2717500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2722500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2725000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2727500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2732500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2735000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2737500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2742500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2745000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2747500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2752500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2755000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2757500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2762500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2765000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2767500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2772500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2775000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2777500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2782500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2785000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2787500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2792500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2795000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2797500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2802500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2805000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2807500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2812500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2815000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2817500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2822500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2825000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2827500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2832500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2835000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2837500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2842500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2845000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2847500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2852500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2855000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2857500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2862500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2865000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2867500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2872500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2875000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2877500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2882500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2885000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2887500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2892500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2895000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2897500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2902500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2905000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2907500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2912500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2915000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2917500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2922500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2925000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2927500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2932500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2935000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2937500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2942500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2945000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2947500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2952500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2955000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2957500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2962500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2965000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2967500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2972500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2975000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2977500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2982500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2985000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2987500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2992500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2995000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2997500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3002500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3005000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3007500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3012500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3015000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3017500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3022500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3025000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3027500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3032500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3035000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3037500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3042500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3045000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3047500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3052500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3055000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3057500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3062500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3065000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3067500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3072500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3075000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3077500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3082500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3085000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3087500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3092500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3095000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3097500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3102500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3105000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3107500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3112500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3115000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3117500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3122500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3125000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3127500.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3130000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/3140000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3010000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3020000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3030000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3040000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3050000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3060000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3070000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3080000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3090000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3100000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3110000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3120000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3130000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3140000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3150000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3160000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3170000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3180000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3190000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3200000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3210000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3220000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3230000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3240000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3250000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3260000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3270000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3280000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3290000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3300000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3310000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3320000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3330000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3340000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3350000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3360000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3370000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3380000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3390000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3400000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3410000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3420000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3430000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3440000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3450000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3460000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3470000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3480000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3490000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3500000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3510000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3520000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3530000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3540000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3550000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3560000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3570000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3580000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3590000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3600000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3610000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3620000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3630000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3640000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3650000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3660000.json +8 -0
- package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/3670000.json +8 -0
- package/ios/ZCashLightClientKit/Rust/ZcashKeyDerivationBackend.swift +89 -10
- package/ios/ZCashLightClientKit/Rust/ZcashKeyDerivationBackendWelding.swift +39 -3
- package/ios/ZCashLightClientKit/Rust/ZcashRustBackend.swift +532 -74
- package/ios/ZCashLightClientKit/Rust/ZcashRustBackendWelding.swift +97 -14
- package/ios/ZCashLightClientKit/Synchronizer/ClosureSDKSynchronizer.swift +104 -28
- package/ios/ZCashLightClientKit/Synchronizer/CombineSDKSynchronizer.swift +105 -31
- package/ios/ZCashLightClientKit/Synchronizer/Dependencies.swift +36 -9
- package/ios/ZCashLightClientKit/Synchronizer/SDKSynchronizer.swift +401 -175
- package/ios/ZCashLightClientKit/Synchronizer.swift +192 -69
- package/ios/ZCashLightClientKit/Tool/DerivationTool.swift +69 -12
- package/ios/ZCashLightClientKit/Tor/TorClient.swift +502 -11
- package/ios/ZCashLightClientKit/Transaction/TransactionEncoder.swift +10 -6
- package/ios/ZCashLightClientKit/Transaction/WalletTransactionEncoder.swift +24 -9
- package/ios/ZCashLightClientKit/Utils/SDKFlags.swift +71 -0
- package/ios/libzcashlc.xcframework/Info.plist +5 -5
- package/ios/libzcashlc.xcframework/ios-arm64/libzcashlc.a +0 -0
- package/ios/libzcashlc.xcframework/ios-arm64_x86_64-simulator/libzcashlc.a +0 -0
- package/ios/zcashlc.h +1640 -378
- package/lib/rnzcash.rn.js.map +1 -1
- package/lib/src/react-native.d.ts +2 -2
- package/lib/src/types.d.ts +2 -0
- package/package.json +1 -1
- package/src/react-native.ts +2 -3
- package/src/types.ts +2 -0
|
@@ -24,10 +24,51 @@ enum RustLogging: String {
|
|
|
24
24
|
case trace
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/// A description of the policy that is used to determine what notes are available for spending,
|
|
28
|
+
/// based upon the number of confirmations (the number of blocks in the chain since and including
|
|
29
|
+
/// the block in which a note was produced.)
|
|
30
|
+
///
|
|
31
|
+
/// See [`ZIP 315`] for details including the definitions of "trusted" and "untrusted" notes.
|
|
32
|
+
///
|
|
33
|
+
/// # Note
|
|
34
|
+
///
|
|
35
|
+
/// `trusted` and `untrusted` are both meant to be non-zero values.
|
|
36
|
+
/// `0` will be treated as a request for a default value.
|
|
37
|
+
///
|
|
38
|
+
/// [`ZIP 315`]: https://zips.z.cash/zip-0315
|
|
39
|
+
public struct SwiftConfirmationsPolicy {
|
|
40
|
+
/// NonZero, zero for default
|
|
41
|
+
let trusted: UInt32
|
|
42
|
+
/// NonZero, zero for default; if this is set to zero, `trusted` must also be set to zero
|
|
43
|
+
let untrusted: UInt32
|
|
44
|
+
let allowZeroConfShielding: Bool
|
|
45
|
+
|
|
46
|
+
init(trusted: UInt32 = 3, untrusted: UInt32 = 10, allowZeroConfShielding: Bool = true) {
|
|
47
|
+
self.trusted = trusted
|
|
48
|
+
self.untrusted = untrusted
|
|
49
|
+
self.allowZeroConfShielding = allowZeroConfShielding
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public static func defaultTransferPolicy() -> Self {
|
|
53
|
+
SwiftConfirmationsPolicy.init()
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public static func defaultShieldingPolicy() -> Self {
|
|
57
|
+
SwiftConfirmationsPolicy.init(trusted: 1, untrusted: 1, allowZeroConfShielding: true)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public func toBackend() -> ConfirmationsPolicy {
|
|
61
|
+
var libzcashlcConfirmationsPolicy = ConfirmationsPolicy()
|
|
62
|
+
libzcashlcConfirmationsPolicy.trusted = self.trusted
|
|
63
|
+
libzcashlcConfirmationsPolicy.untrusted = self.untrusted
|
|
64
|
+
libzcashlcConfirmationsPolicy.allow_zero_conf_shielding = self.allowZeroConfShielding
|
|
65
|
+
return libzcashlcConfirmationsPolicy
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
27
69
|
struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
28
|
-
let
|
|
29
|
-
let
|
|
30
|
-
let useZIP317Fees = true
|
|
70
|
+
let confirmationsPolicy: SwiftConfirmationsPolicy = SwiftConfirmationsPolicy.defaultTransferPolicy()
|
|
71
|
+
let shieldingConfirmationsPolicy: SwiftConfirmationsPolicy = SwiftConfirmationsPolicy.defaultShieldingPolicy()
|
|
31
72
|
|
|
32
73
|
let dbData: (String, UInt)
|
|
33
74
|
let fsBlockDbRoot: (String, UInt)
|
|
@@ -36,6 +77,7 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
36
77
|
let keyDeriving: ZcashKeyDerivationBackendWelding
|
|
37
78
|
|
|
38
79
|
let networkType: NetworkType
|
|
80
|
+
let sdkFlags: SDKFlags
|
|
39
81
|
|
|
40
82
|
static var rustInitialized = false
|
|
41
83
|
|
|
@@ -57,7 +99,8 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
57
99
|
spendParamsPath: URL,
|
|
58
100
|
outputParamsPath: URL,
|
|
59
101
|
networkType: NetworkType,
|
|
60
|
-
logLevel: RustLogging = RustLogging.off
|
|
102
|
+
logLevel: RustLogging = RustLogging.off,
|
|
103
|
+
sdkFlags: SDKFlags
|
|
61
104
|
) {
|
|
62
105
|
self.dbData = dbData.osStr()
|
|
63
106
|
self.fsBlockDbRoot = fsBlockDbRoot.osPathStr()
|
|
@@ -65,6 +108,7 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
65
108
|
self.outputParamsPath = outputParamsPath.osPathStr()
|
|
66
109
|
self.networkType = networkType
|
|
67
110
|
self.keyDeriving = ZcashKeyDerivationBackend(networkType: networkType)
|
|
111
|
+
self.sdkFlags = sdkFlags
|
|
68
112
|
|
|
69
113
|
if !Self.rustInitialized {
|
|
70
114
|
Self.rustInitialized = true
|
|
@@ -73,7 +117,7 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
73
117
|
}
|
|
74
118
|
|
|
75
119
|
@DBActor
|
|
76
|
-
func listAccounts() async throws -> [
|
|
120
|
+
func listAccounts() async throws -> [Account] {
|
|
77
121
|
let accountsPtr = zcashlc_list_accounts(
|
|
78
122
|
dbData.0,
|
|
79
123
|
dbData.1,
|
|
@@ -86,18 +130,103 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
86
130
|
|
|
87
131
|
defer { zcashlc_free_accounts(accountsPtr) }
|
|
88
132
|
|
|
89
|
-
var accounts: [
|
|
133
|
+
var accounts: [Account] = []
|
|
90
134
|
|
|
91
135
|
for i in (0 ..< Int(accountsPtr.pointee.len)) {
|
|
92
|
-
let
|
|
93
|
-
|
|
136
|
+
let accountUUIDPtr = accountsPtr.pointee.ptr.advanced(by: i).pointee
|
|
137
|
+
let accountUUID = AccountUUID(id: accountUUIDPtr.uuidArray)
|
|
138
|
+
|
|
139
|
+
let account = try await getAccount(for: accountUUID)
|
|
140
|
+
|
|
141
|
+
accounts.append(account)
|
|
94
142
|
}
|
|
95
143
|
|
|
96
144
|
return accounts
|
|
97
145
|
}
|
|
98
146
|
|
|
99
147
|
@DBActor
|
|
100
|
-
func
|
|
148
|
+
func getAccount(
|
|
149
|
+
for accountUUID: AccountUUID
|
|
150
|
+
) async throws -> Account {
|
|
151
|
+
let accountPtr: UnsafeMutablePointer<FfiAccount>? = zcashlc_get_account(
|
|
152
|
+
dbData.0,
|
|
153
|
+
dbData.1,
|
|
154
|
+
networkType.networkId,
|
|
155
|
+
accountUUID.id
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
guard let accountPtr else {
|
|
159
|
+
throw ZcashError.rustImportAccountUfvk(lastErrorMessage(fallback: "`getAccount` failed with unknown error"))
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
defer { zcashlc_free_account(accountPtr) }
|
|
163
|
+
|
|
164
|
+
guard let validAccount = accountPtr.pointee.unsafeToAccount() else {
|
|
165
|
+
throw ZcashError.rustUUIDAccountNotFound(lastErrorMessage(fallback: "`getAccount` failed with unknown error"))
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return validAccount
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// swiftlint:disable:next function_parameter_count
|
|
172
|
+
@DBActor func importAccount(
|
|
173
|
+
ufvk: String,
|
|
174
|
+
seedFingerprint: [UInt8]?,
|
|
175
|
+
zip32AccountIndex: Zip32AccountIndex?,
|
|
176
|
+
treeState: TreeState,
|
|
177
|
+
recoverUntil: UInt32?,
|
|
178
|
+
purpose: AccountPurpose,
|
|
179
|
+
name: String,
|
|
180
|
+
keySource: String?
|
|
181
|
+
) async throws -> AccountUUID {
|
|
182
|
+
var rUntil: Int64 = -1
|
|
183
|
+
|
|
184
|
+
if let recoverUntil {
|
|
185
|
+
rUntil = Int64(recoverUntil)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
let treeStateBytes = try treeState.serializedData(partial: false).bytes
|
|
189
|
+
|
|
190
|
+
var kSource: [CChar]?
|
|
191
|
+
|
|
192
|
+
if let keySource {
|
|
193
|
+
kSource = [CChar](keySource.utf8CString)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
let index: UInt32 = zip32AccountIndex?.index ?? UINT32_MAX
|
|
197
|
+
|
|
198
|
+
let uuidPtr = zcashlc_import_account_ufvk(
|
|
199
|
+
dbData.0,
|
|
200
|
+
dbData.1,
|
|
201
|
+
[CChar](ufvk.utf8CString),
|
|
202
|
+
treeStateBytes,
|
|
203
|
+
UInt(treeStateBytes.count),
|
|
204
|
+
rUntil,
|
|
205
|
+
networkType.networkId,
|
|
206
|
+
purpose.rawValue,
|
|
207
|
+
[CChar](name.utf8CString),
|
|
208
|
+
kSource,
|
|
209
|
+
seedFingerprint,
|
|
210
|
+
index
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
guard let uuidPtr else {
|
|
214
|
+
throw ZcashError.rustImportAccountUfvk(lastErrorMessage(fallback: "`importAccount` failed with unknown error"))
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
defer { zcashlc_free_ffi_uuid(uuidPtr) }
|
|
218
|
+
|
|
219
|
+
return uuidPtr.pointee.unsafeToAccountUUID()
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
@DBActor
|
|
223
|
+
func createAccount(
|
|
224
|
+
seed: [UInt8],
|
|
225
|
+
treeState: TreeState,
|
|
226
|
+
recoverUntil: UInt32?,
|
|
227
|
+
name: String,
|
|
228
|
+
keySource: String?
|
|
229
|
+
) async throws -> UnifiedSpendingKey {
|
|
101
230
|
var rUntil: Int64 = -1
|
|
102
231
|
|
|
103
232
|
if let recoverUntil {
|
|
@@ -106,6 +235,12 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
106
235
|
|
|
107
236
|
let treeStateBytes = try treeState.serializedData(partial: false).bytes
|
|
108
237
|
|
|
238
|
+
var kSource: [CChar]?
|
|
239
|
+
|
|
240
|
+
if let keySource {
|
|
241
|
+
kSource = [CChar](keySource.utf8CString)
|
|
242
|
+
}
|
|
243
|
+
|
|
109
244
|
let ffiBinaryKeyPtr = zcashlc_create_account(
|
|
110
245
|
dbData.0,
|
|
111
246
|
dbData.1,
|
|
@@ -114,7 +249,9 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
114
249
|
treeStateBytes,
|
|
115
250
|
UInt(treeStateBytes.count),
|
|
116
251
|
rUntil,
|
|
117
|
-
networkType.networkId
|
|
252
|
+
networkType.networkId,
|
|
253
|
+
[CChar](name.utf8CString),
|
|
254
|
+
kSource
|
|
118
255
|
)
|
|
119
256
|
|
|
120
257
|
guard let ffiBinaryKeyPtr else {
|
|
@@ -149,7 +286,7 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
149
286
|
|
|
150
287
|
@DBActor
|
|
151
288
|
func proposeTransfer(
|
|
152
|
-
|
|
289
|
+
accountUUID: AccountUUID,
|
|
153
290
|
to address: String,
|
|
154
291
|
value: Int64,
|
|
155
292
|
memo: MemoBytes?
|
|
@@ -157,13 +294,12 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
157
294
|
let proposal = zcashlc_propose_transfer(
|
|
158
295
|
dbData.0,
|
|
159
296
|
dbData.1,
|
|
160
|
-
|
|
297
|
+
accountUUID.id,
|
|
161
298
|
[CChar](address.utf8CString),
|
|
162
299
|
value,
|
|
163
300
|
memo?.bytes,
|
|
164
301
|
networkType.networkId,
|
|
165
|
-
|
|
166
|
-
useZIP317Fees
|
|
302
|
+
confirmationsPolicy.toBackend()
|
|
167
303
|
)
|
|
168
304
|
|
|
169
305
|
guard let proposal else {
|
|
@@ -172,7 +308,7 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
172
308
|
|
|
173
309
|
defer { zcashlc_free_boxed_slice(proposal) }
|
|
174
310
|
|
|
175
|
-
return try FfiProposal(
|
|
311
|
+
return try FfiProposal(serializedData: Data(
|
|
176
312
|
bytes: proposal.pointee.ptr,
|
|
177
313
|
count: Int(proposal.pointee.len)
|
|
178
314
|
))
|
|
@@ -181,16 +317,15 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
181
317
|
@DBActor
|
|
182
318
|
func proposeTransferFromURI(
|
|
183
319
|
_ uri: String,
|
|
184
|
-
|
|
320
|
+
accountUUID: AccountUUID
|
|
185
321
|
) async throws -> FfiProposal {
|
|
186
322
|
let proposal = zcashlc_propose_transfer_from_uri(
|
|
187
323
|
dbData.0,
|
|
188
324
|
dbData.1,
|
|
189
|
-
|
|
325
|
+
accountUUID.id,
|
|
190
326
|
[CChar](uri.utf8CString),
|
|
191
327
|
networkType.networkId,
|
|
192
|
-
|
|
193
|
-
useZIP317Fees
|
|
328
|
+
confirmationsPolicy.toBackend()
|
|
194
329
|
)
|
|
195
330
|
|
|
196
331
|
guard let proposal else {
|
|
@@ -199,34 +334,187 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
199
334
|
|
|
200
335
|
defer { zcashlc_free_boxed_slice(proposal) }
|
|
201
336
|
|
|
202
|
-
return try FfiProposal(
|
|
337
|
+
return try FfiProposal(serializedData: Data(
|
|
203
338
|
bytes: proposal.pointee.ptr,
|
|
204
339
|
count: Int(proposal.pointee.len)
|
|
205
340
|
))
|
|
206
341
|
}
|
|
342
|
+
|
|
343
|
+
@DBActor
|
|
344
|
+
func createPCZTFromProposal(
|
|
345
|
+
accountUUID: AccountUUID,
|
|
346
|
+
proposal: FfiProposal
|
|
347
|
+
) async throws -> Pczt {
|
|
348
|
+
let proposalBytes = try proposal.serializedData(partial: false).bytes
|
|
349
|
+
|
|
350
|
+
let pcztPtr = proposalBytes.withUnsafeBufferPointer { proposalPtr in
|
|
351
|
+
zcashlc_create_pczt_from_proposal(
|
|
352
|
+
dbData.0,
|
|
353
|
+
dbData.1,
|
|
354
|
+
networkType.networkId,
|
|
355
|
+
proposalPtr.baseAddress,
|
|
356
|
+
UInt(proposalBytes.count),
|
|
357
|
+
accountUUID.id
|
|
358
|
+
)
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
guard let pcztPtr else {
|
|
362
|
+
throw ZcashError.rustCreatePCZTFromProposal(lastErrorMessage(fallback: "`createPCZTFromProposal` failed with unknown error"))
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
defer { zcashlc_free_boxed_slice(pcztPtr) }
|
|
366
|
+
|
|
367
|
+
return Pczt(
|
|
368
|
+
bytes: pcztPtr.pointee.ptr,
|
|
369
|
+
count: Int(pcztPtr.pointee.len)
|
|
370
|
+
)
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
func redactPCZTForSigner(pczt: Pczt) async throws -> Pczt {
|
|
374
|
+
let pcztPtr: UnsafeMutablePointer<FfiBoxedSlice>? = pczt.withUnsafeBytes { buffer in
|
|
375
|
+
guard let bufferPtr = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
|
376
|
+
return nil
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return zcashlc_redact_pczt_for_signer(
|
|
380
|
+
bufferPtr,
|
|
381
|
+
UInt(pczt.count)
|
|
382
|
+
)
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
guard let pcztPtr else {
|
|
386
|
+
throw ZcashError.rustRedactPCZTForSigner(lastErrorMessage(fallback: "`redactPCZTForSigner` failed with unknown error"))
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
defer { zcashlc_free_boxed_slice(pcztPtr) }
|
|
390
|
+
|
|
391
|
+
return Pczt(
|
|
392
|
+
bytes: pcztPtr.pointee.ptr,
|
|
393
|
+
count: Int(pcztPtr.pointee.len)
|
|
394
|
+
)
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
func PCZTRequiresSaplingProofs(pczt: Pczt) async -> Bool {
|
|
398
|
+
return pczt.withUnsafeBytes { buffer in
|
|
399
|
+
guard let bufferPtr = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
|
400
|
+
// Return `false` here so the caller proceeds to `addProofsToPCZT` and
|
|
401
|
+
// gets the same error.
|
|
402
|
+
return false
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
return zcashlc_pczt_requires_sapling_proofs(
|
|
406
|
+
bufferPtr,
|
|
407
|
+
UInt(pczt.count)
|
|
408
|
+
)
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
func addProofsToPCZT(
|
|
413
|
+
pczt: Pczt
|
|
414
|
+
) async throws -> Pczt {
|
|
415
|
+
let pcztPtr: UnsafeMutablePointer<FfiBoxedSlice>? = pczt.withUnsafeBytes { buffer in
|
|
416
|
+
guard let bufferPtr = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
|
417
|
+
return nil
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
return zcashlc_add_proofs_to_pczt(
|
|
421
|
+
bufferPtr,
|
|
422
|
+
UInt(pczt.count),
|
|
423
|
+
spendParamsPath.0,
|
|
424
|
+
spendParamsPath.1,
|
|
425
|
+
outputParamsPath.0,
|
|
426
|
+
outputParamsPath.1
|
|
427
|
+
)
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
guard let pcztPtr else {
|
|
431
|
+
throw ZcashError.rustAddProofsToPCZT(lastErrorMessage(fallback: "`addProofsToPCZT` failed with unknown error"))
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
defer { zcashlc_free_boxed_slice(pcztPtr) }
|
|
435
|
+
|
|
436
|
+
return Pczt(
|
|
437
|
+
bytes: pcztPtr.pointee.ptr,
|
|
438
|
+
count: Int(pcztPtr.pointee.len)
|
|
439
|
+
)
|
|
440
|
+
}
|
|
207
441
|
|
|
208
442
|
@DBActor
|
|
209
|
-
func
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
443
|
+
func extractAndStoreTxFromPCZT(
|
|
444
|
+
pcztWithProofs: Pczt,
|
|
445
|
+
pcztWithSigs: Pczt
|
|
446
|
+
) async throws -> Data {
|
|
447
|
+
let txidPtr: UnsafeMutablePointer<FfiBoxedSlice>? = pcztWithProofs.withUnsafeBytes { pcztWithProofsBuffer in
|
|
448
|
+
guard let pcztWithProofsBufferPtr = pcztWithProofsBuffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
|
449
|
+
return nil
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
return pcztWithSigs.withUnsafeBytes { pcztWithSigsBuffer in
|
|
453
|
+
guard let pcztWithSigsBufferPtr = pcztWithSigsBuffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
|
|
454
|
+
return nil
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
return zcashlc_extract_and_store_from_pczt(
|
|
458
|
+
dbData.0,
|
|
459
|
+
dbData.1,
|
|
460
|
+
networkType.networkId,
|
|
461
|
+
pcztWithProofsBufferPtr,
|
|
462
|
+
UInt(pcztWithProofs.count),
|
|
463
|
+
pcztWithSigsBufferPtr,
|
|
464
|
+
UInt(pcztWithSigs.count),
|
|
465
|
+
spendParamsPath.0,
|
|
466
|
+
spendParamsPath.1,
|
|
467
|
+
outputParamsPath.0,
|
|
468
|
+
outputParamsPath.1
|
|
469
|
+
)
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
guard let txidPtr else {
|
|
474
|
+
throw ZcashError.rustExtractAndStoreTxFromPCZT(lastErrorMessage(fallback: "`extractAndStoreTxFromPCZT` failed with unknown error"))
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
guard txidPtr.pointee.len == 32 else {
|
|
478
|
+
throw ZcashError.rustTxidPtrIncorrectLength(lastErrorMessage(fallback: "`extractAndStoreTxFromPCZT` failed with unknown error"))
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
defer { zcashlc_free_boxed_slice(txidPtr) }
|
|
482
|
+
|
|
483
|
+
return Data(
|
|
484
|
+
bytes: txidPtr.pointee.ptr,
|
|
485
|
+
count: Int(txidPtr.pointee.len)
|
|
217
486
|
)
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
@DBActor
|
|
490
|
+
func decryptAndStoreTransaction(txBytes: [UInt8], minedHeight: UInt32?) async throws -> Data {
|
|
491
|
+
var contiguousTxidBytes = ContiguousArray<UInt8>(Data(count: 32))
|
|
492
|
+
|
|
493
|
+
let result = contiguousTxidBytes.withUnsafeMutableBufferPointer { txidBytePtr in
|
|
494
|
+
zcashlc_decrypt_and_store_transaction(
|
|
495
|
+
dbData.0,
|
|
496
|
+
dbData.1,
|
|
497
|
+
txBytes,
|
|
498
|
+
UInt(txBytes.count),
|
|
499
|
+
Int64(minedHeight ?? 0),
|
|
500
|
+
networkType.networkId,
|
|
501
|
+
txidBytePtr.baseAddress
|
|
502
|
+
)
|
|
503
|
+
}
|
|
218
504
|
|
|
219
505
|
guard result != 0 else {
|
|
220
506
|
throw ZcashError.rustDecryptAndStoreTransaction(lastErrorMessage(fallback: "`decryptAndStoreTransaction` failed with unknown error"))
|
|
221
507
|
}
|
|
508
|
+
|
|
509
|
+
return Data(contiguousTxidBytes)
|
|
222
510
|
}
|
|
223
511
|
|
|
224
512
|
@DBActor
|
|
225
|
-
func getCurrentAddress(
|
|
513
|
+
func getCurrentAddress(accountUUID: AccountUUID) async throws -> UnifiedAddress {
|
|
226
514
|
let addressCStr = zcashlc_get_current_address(
|
|
227
515
|
dbData.0,
|
|
228
516
|
dbData.1,
|
|
229
|
-
|
|
517
|
+
accountUUID.id,
|
|
230
518
|
networkType.networkId
|
|
231
519
|
)
|
|
232
520
|
|
|
@@ -244,12 +532,13 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
244
532
|
}
|
|
245
533
|
|
|
246
534
|
@DBActor
|
|
247
|
-
func getNextAvailableAddress(
|
|
535
|
+
func getNextAvailableAddress(accountUUID: AccountUUID, receiverFlags: UInt32) async throws -> UnifiedAddress {
|
|
248
536
|
let addressCStr = zcashlc_get_next_available_address(
|
|
249
537
|
dbData.0,
|
|
250
538
|
dbData.1,
|
|
251
|
-
|
|
252
|
-
networkType.networkId
|
|
539
|
+
accountUUID.id,
|
|
540
|
+
networkType.networkId,
|
|
541
|
+
receiverFlags
|
|
253
542
|
)
|
|
254
543
|
|
|
255
544
|
guard let addressCStr else {
|
|
@@ -284,22 +573,18 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
284
573
|
}
|
|
285
574
|
|
|
286
575
|
@DBActor
|
|
287
|
-
func getTransparentBalance(
|
|
288
|
-
guard account >= 0 else {
|
|
289
|
-
throw ZcashError.rustGetTransparentBalanceNegativeAccount(Int(account))
|
|
290
|
-
}
|
|
291
|
-
|
|
576
|
+
func getTransparentBalance(accountUUID: AccountUUID) async throws -> Int64 {
|
|
292
577
|
let balance = zcashlc_get_total_transparent_balance_for_account(
|
|
293
578
|
dbData.0,
|
|
294
579
|
dbData.1,
|
|
295
580
|
networkType.networkId,
|
|
296
|
-
|
|
581
|
+
accountUUID.id
|
|
297
582
|
)
|
|
298
583
|
|
|
299
584
|
guard balance >= 0 else {
|
|
300
585
|
throw ZcashError.rustGetTransparentBalance(
|
|
301
|
-
|
|
302
|
-
lastErrorMessage(fallback: "Error getting Total Transparent balance from
|
|
586
|
+
accountUUID,
|
|
587
|
+
lastErrorMessage(fallback: "Error getting Total Transparent balance from accountUUID \(accountUUID.id)")
|
|
303
588
|
)
|
|
304
589
|
}
|
|
305
590
|
|
|
@@ -307,23 +592,19 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
307
592
|
}
|
|
308
593
|
|
|
309
594
|
@DBActor
|
|
310
|
-
func getVerifiedTransparentBalance(
|
|
311
|
-
guard account >= 0 else {
|
|
312
|
-
throw ZcashError.rustGetVerifiedTransparentBalanceNegativeAccount(Int(account))
|
|
313
|
-
}
|
|
314
|
-
|
|
595
|
+
func getVerifiedTransparentBalance(accountUUID: AccountUUID) async throws -> Int64 {
|
|
315
596
|
let balance = zcashlc_get_verified_transparent_balance_for_account(
|
|
316
597
|
dbData.0,
|
|
317
598
|
dbData.1,
|
|
318
599
|
networkType.networkId,
|
|
319
|
-
|
|
320
|
-
|
|
600
|
+
accountUUID.id,
|
|
601
|
+
shieldingConfirmationsPolicy.toBackend()
|
|
321
602
|
)
|
|
322
603
|
|
|
323
604
|
guard balance >= 0 else {
|
|
324
605
|
throw ZcashError.rustGetVerifiedTransparentBalance(
|
|
325
|
-
|
|
326
|
-
lastErrorMessage(fallback: "Error getting verified transparent balance from
|
|
606
|
+
accountUUID,
|
|
607
|
+
lastErrorMessage(fallback: "Error getting verified transparent balance from accountUUID \(accountUUID.id)")
|
|
327
608
|
)
|
|
328
609
|
}
|
|
329
610
|
|
|
@@ -427,11 +708,11 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
427
708
|
}
|
|
428
709
|
|
|
429
710
|
@DBActor
|
|
430
|
-
func listTransparentReceivers(
|
|
711
|
+
func listTransparentReceivers(accountUUID: AccountUUID) async throws -> [TransparentAddress] {
|
|
431
712
|
let encodedKeysPtr = zcashlc_list_transparent_receivers(
|
|
432
713
|
dbData.0,
|
|
433
714
|
dbData.1,
|
|
434
|
-
|
|
715
|
+
accountUUID.id,
|
|
435
716
|
networkType.networkId
|
|
436
717
|
)
|
|
437
718
|
|
|
@@ -486,7 +767,7 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
486
767
|
|
|
487
768
|
@DBActor
|
|
488
769
|
func rewindToHeight(height: BlockHeight) async throws -> RewindResult {
|
|
489
|
-
var safeRewindHeight: Int64 = -1
|
|
770
|
+
var safeRewindHeight: Int64 = -1
|
|
490
771
|
let result = zcashlc_rewind_to_height(dbData.0, dbData.1, UInt32(height), networkType.networkId, &safeRewindHeight)
|
|
491
772
|
|
|
492
773
|
if result >= 0 {
|
|
@@ -658,7 +939,7 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
658
939
|
|
|
659
940
|
@DBActor
|
|
660
941
|
func getWalletSummary() async throws -> WalletSummary? {
|
|
661
|
-
let summaryPtr = zcashlc_get_wallet_summary(dbData.0, dbData.1, networkType.networkId,
|
|
942
|
+
let summaryPtr = zcashlc_get_wallet_summary(dbData.0, dbData.1, networkType.networkId, confirmationsPolicy.toBackend())
|
|
662
943
|
|
|
663
944
|
guard let summaryPtr else {
|
|
664
945
|
throw ZcashError.rustGetWalletSummary(lastErrorMessage(fallback: "`getWalletSummary` failed with unknown error"))
|
|
@@ -670,17 +951,42 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
670
951
|
return nil
|
|
671
952
|
}
|
|
672
953
|
|
|
673
|
-
var accountBalances: [
|
|
954
|
+
var accountBalances: [AccountUUID: AccountBalance] = [:]
|
|
674
955
|
|
|
675
956
|
for i in (0 ..< Int(summaryPtr.pointee.account_balances_len)) {
|
|
676
957
|
let accountBalance = summaryPtr.pointee.account_balances.advanced(by: i).pointee
|
|
677
|
-
accountBalances[accountBalance.
|
|
958
|
+
accountBalances[AccountUUID(id: accountBalance.uuidArray)] = accountBalance.toAccountBalance()
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
// Modify spendable `accountBalances` if chainTip hasn't been updated yet
|
|
962
|
+
if await !sdkFlags.chainTipUpdated {
|
|
963
|
+
accountBalances.forEach { key, _ in
|
|
964
|
+
if let accountBalance = accountBalances[key] {
|
|
965
|
+
accountBalances[key] = AccountBalance(
|
|
966
|
+
saplingBalance: PoolBalance(
|
|
967
|
+
spendableValue: .zero,
|
|
968
|
+
changePendingConfirmation: accountBalance.saplingBalance.changePendingConfirmation,
|
|
969
|
+
valuePendingSpendability: accountBalance.saplingBalance.valuePendingSpendability
|
|
970
|
+
+ accountBalance.saplingBalance.spendableValue
|
|
971
|
+
),
|
|
972
|
+
orchardBalance: PoolBalance(
|
|
973
|
+
spendableValue: .zero,
|
|
974
|
+
changePendingConfirmation: accountBalance.orchardBalance.changePendingConfirmation,
|
|
975
|
+
valuePendingSpendability: accountBalance.orchardBalance.valuePendingSpendability
|
|
976
|
+
+ accountBalance.orchardBalance.spendableValue
|
|
977
|
+
),
|
|
978
|
+
unshielded: .zero,
|
|
979
|
+
awaitingResolution: accountBalance.unshielded
|
|
980
|
+
)
|
|
981
|
+
}
|
|
982
|
+
}
|
|
678
983
|
}
|
|
679
984
|
|
|
680
985
|
return WalletSummary(
|
|
681
986
|
accountBalances: accountBalances,
|
|
682
987
|
chainTipHeight: BlockHeight(summaryPtr.pointee.chain_tip_height),
|
|
683
988
|
fullyScannedHeight: BlockHeight(summaryPtr.pointee.fully_scanned_height),
|
|
989
|
+
recoveryProgress: summaryPtr.pointee.recovery_progress?.pointee.toScanProgress(),
|
|
684
990
|
scanProgress: summaryPtr.pointee.scan_progress?.pointee.toScanProgress(),
|
|
685
991
|
nextSaplingSubtreeIndex: UInt32(summaryPtr.pointee.next_sapling_subtree_index),
|
|
686
992
|
nextOrchardSubtreeIndex: UInt32(summaryPtr.pointee.next_orchard_subtree_index)
|
|
@@ -750,7 +1056,7 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
750
1056
|
|
|
751
1057
|
@DBActor
|
|
752
1058
|
func proposeShielding(
|
|
753
|
-
|
|
1059
|
+
accountUUID: AccountUUID,
|
|
754
1060
|
memo: MemoBytes?,
|
|
755
1061
|
shieldingThreshold: Zatoshi,
|
|
756
1062
|
transparentReceiver: String?
|
|
@@ -758,13 +1064,12 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
758
1064
|
let proposal = zcashlc_propose_shielding(
|
|
759
1065
|
dbData.0,
|
|
760
1066
|
dbData.1,
|
|
761
|
-
|
|
1067
|
+
accountUUID.id,
|
|
762
1068
|
memo?.bytes,
|
|
763
1069
|
UInt64(shieldingThreshold.amount),
|
|
764
1070
|
transparentReceiver.map { [CChar]($0.utf8CString) },
|
|
765
1071
|
networkType.networkId,
|
|
766
|
-
|
|
767
|
-
useZIP317Fees
|
|
1072
|
+
shieldingConfirmationsPolicy.toBackend()
|
|
768
1073
|
)
|
|
769
1074
|
|
|
770
1075
|
guard let proposal else {
|
|
@@ -774,10 +1079,10 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
774
1079
|
defer { zcashlc_free_boxed_slice(proposal) }
|
|
775
1080
|
|
|
776
1081
|
guard proposal.pointee.ptr != nil else {
|
|
777
|
-
|
|
1082
|
+
return nil
|
|
778
1083
|
}
|
|
779
1084
|
|
|
780
|
-
return try FfiProposal(
|
|
1085
|
+
return try FfiProposal(serializedData: Data(
|
|
781
1086
|
bytes: proposal.pointee.ptr,
|
|
782
1087
|
count: Int(proposal.pointee.len)
|
|
783
1088
|
))
|
|
@@ -834,8 +1139,8 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
834
1139
|
return branchId
|
|
835
1140
|
}
|
|
836
1141
|
|
|
837
|
-
|
|
838
|
-
func transactionDataRequests() async throws -> [TransactionDataRequest] {
|
|
1142
|
+
// swiftlint:disable:next cyclomatic_complexity
|
|
1143
|
+
@DBActor func transactionDataRequests() async throws -> [TransactionDataRequest] {
|
|
839
1144
|
let tDataRequestsPtr = zcashlc_transaction_data_requests(
|
|
840
1145
|
dbData.0,
|
|
841
1146
|
dbData.1,
|
|
@@ -859,15 +1164,47 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
859
1164
|
tDataRequest = TransactionDataRequest.getStatus(FfiTxId(tuple: tDataRequestPtr.get_status).array)
|
|
860
1165
|
} else if tDataRequestPtr.tag == 1 {
|
|
861
1166
|
tDataRequest = TransactionDataRequest.enhancement(FfiTxId(tuple: tDataRequestPtr.enhancement).array)
|
|
862
|
-
} else if tDataRequestPtr.tag == 2, let address = String(validatingUTF8: tDataRequestPtr.
|
|
863
|
-
let end = tDataRequestPtr.
|
|
1167
|
+
} else if tDataRequestPtr.tag == 2, let address = String(validatingUTF8: tDataRequestPtr.transactions_involving_address.address) {
|
|
1168
|
+
let end = tDataRequestPtr.transactions_involving_address.block_range_end
|
|
864
1169
|
let blockRangeEnd: UInt32? = end > UInt32.max || end == -1 ? nil : UInt32(end)
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
1170
|
+
|
|
1171
|
+
let ffiRequestAt = tDataRequestPtr.transactions_involving_address.request_at
|
|
1172
|
+
let requestAt: Date? = if ffiRequestAt == -1 {
|
|
1173
|
+
nil
|
|
1174
|
+
} else if ffiRequestAt >= 0 {
|
|
1175
|
+
Date(timeIntervalSince1970: TimeInterval(ffiRequestAt))
|
|
1176
|
+
} else {
|
|
1177
|
+
throw ZcashError.rustTransactionDataRequests("Invalid request_at")
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
let ffiTxStatusFilter = tDataRequestPtr.transactions_involving_address.tx_status_filter
|
|
1181
|
+
let txStatusFilter = if ffiTxStatusFilter == TransactionStatusFilter_Mined {
|
|
1182
|
+
TransactionStatusFilter.mined
|
|
1183
|
+
} else if ffiTxStatusFilter == TransactionStatusFilter_Mempool {
|
|
1184
|
+
TransactionStatusFilter.mempool
|
|
1185
|
+
} else if ffiTxStatusFilter == TransactionStatusFilter_All {
|
|
1186
|
+
TransactionStatusFilter.all
|
|
1187
|
+
} else {
|
|
1188
|
+
throw ZcashError.rustTransactionDataRequests("Invalid tx_status_filter")
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
let ffiOutputStatusFilter = tDataRequestPtr.transactions_involving_address.output_status_filter
|
|
1192
|
+
let outputStatusFilter = if ffiOutputStatusFilter == OutputStatusFilter_Unspent {
|
|
1193
|
+
OutputStatusFilter.unspent
|
|
1194
|
+
} else if ffiOutputStatusFilter == OutputStatusFilter_All {
|
|
1195
|
+
OutputStatusFilter.all
|
|
1196
|
+
} else {
|
|
1197
|
+
throw ZcashError.rustTransactionDataRequests("Invalid output_status_filter")
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
tDataRequest = TransactionDataRequest.transactionsInvolvingAddress(
|
|
1201
|
+
TransactionsInvolvingAddress(
|
|
868
1202
|
address: address,
|
|
869
|
-
blockRangeStart: tDataRequestPtr.
|
|
870
|
-
blockRangeEnd: blockRangeEnd
|
|
1203
|
+
blockRangeStart: tDataRequestPtr.transactions_involving_address.block_range_start,
|
|
1204
|
+
blockRangeEnd: blockRangeEnd,
|
|
1205
|
+
requestAt: requestAt,
|
|
1206
|
+
txStatusFilter: txStatusFilter,
|
|
1207
|
+
outputStatusFilter: outputStatusFilter
|
|
871
1208
|
)
|
|
872
1209
|
)
|
|
873
1210
|
}
|
|
@@ -903,6 +1240,35 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
|
|
|
903
1240
|
transactionStatus
|
|
904
1241
|
)
|
|
905
1242
|
}
|
|
1243
|
+
|
|
1244
|
+
@DBActor
|
|
1245
|
+
func fixWitnesses() async {
|
|
1246
|
+
zcashlc_fix_witnesses(dbData.0, dbData.1, networkType.networkId)
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
@DBActor
|
|
1250
|
+
func getSingleUseTransparentAddress(accountUUID: AccountUUID) async throws -> SingleUseTransparentAddress {
|
|
1251
|
+
let singleUseTaddrPtr = zcashlc_get_single_use_taddr(
|
|
1252
|
+
dbData.0,
|
|
1253
|
+
dbData.1,
|
|
1254
|
+
networkType.networkId,
|
|
1255
|
+
accountUUID.id
|
|
1256
|
+
)
|
|
1257
|
+
|
|
1258
|
+
guard let singleUseTaddrPtr else {
|
|
1259
|
+
throw ZcashError.rustGetSingleUseTransparentAddress(
|
|
1260
|
+
lastErrorMessage(fallback: "`getSingleUseTransparentAddress` failed with unknown error")
|
|
1261
|
+
)
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
defer { zcashlc_free_single_use_taddr(singleUseTaddrPtr) }
|
|
1265
|
+
|
|
1266
|
+
return SingleUseTransparentAddress(
|
|
1267
|
+
address: String(cString: singleUseTaddrPtr.pointee.address),
|
|
1268
|
+
gapPosition: singleUseTaddrPtr.pointee.gap_position,
|
|
1269
|
+
gapLimit: singleUseTaddrPtr.pointee.gap_limit
|
|
1270
|
+
)
|
|
1271
|
+
}
|
|
906
1272
|
}
|
|
907
1273
|
|
|
908
1274
|
private extension ZcashRustBackend {
|
|
@@ -958,7 +1324,94 @@ extension String {
|
|
|
958
1324
|
}
|
|
959
1325
|
}
|
|
960
1326
|
|
|
1327
|
+
extension FfiAddress {
|
|
1328
|
+
/// converts an [`FfiAddress`] into a [`UnifiedAddress`]
|
|
1329
|
+
/// - Note: This does not check that the converted value actually holds a valid UnifiedAddress
|
|
1330
|
+
func unsafeToUnifiedAddress(_ networkType: NetworkType) -> UnifiedAddress {
|
|
1331
|
+
.init(validatedEncoding: String(cString: address), networkType: networkType)
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
extension FfiAccount {
|
|
1336
|
+
var uuidArray: [UInt8] {
|
|
1337
|
+
withUnsafeBytes(of: uuid_bytes) { buf in
|
|
1338
|
+
[UInt8](buf)
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
var seedFingerprintArray: [UInt8] {
|
|
1343
|
+
withUnsafeBytes(of: seed_fingerprint) { buf in
|
|
1344
|
+
[UInt8](buf)
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
/// converts an [`FfiAccount`] into a [`Account`]
|
|
1349
|
+
/// - Note: This does not check that the converted value actually holds a valid Account
|
|
1350
|
+
func unsafeToAccount() -> Account? {
|
|
1351
|
+
// Invalid UUID check
|
|
1352
|
+
guard uuidArray != [UInt8](repeating: 0, count: 16) else {
|
|
1353
|
+
return nil
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
// Invalid ZIP 32 account index
|
|
1357
|
+
if hd_account_index == UInt32.max {
|
|
1358
|
+
return .init(
|
|
1359
|
+
id: AccountUUID(id: uuidArray),
|
|
1360
|
+
name: account_name != nil ? String(cString: account_name) : nil,
|
|
1361
|
+
keySource: key_source != nil ? String(cString: key_source) : nil,
|
|
1362
|
+
seedFingerprint: nil,
|
|
1363
|
+
hdAccountIndex: nil,
|
|
1364
|
+
ufvk: nil
|
|
1365
|
+
)
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
let ufvkTyped = ufvk.map { UnifiedFullViewingKey(validatedEncoding: String(cString: $0)) }
|
|
1369
|
+
|
|
1370
|
+
// Valid ZIP32 account index
|
|
1371
|
+
return .init(
|
|
1372
|
+
id: AccountUUID(id: uuidArray),
|
|
1373
|
+
name: account_name != nil ? String(cString: account_name) : nil,
|
|
1374
|
+
keySource: key_source != nil ? String(cString: key_source) : nil,
|
|
1375
|
+
seedFingerprint: seedFingerprintArray,
|
|
1376
|
+
hdAccountIndex: Zip32AccountIndex(hd_account_index),
|
|
1377
|
+
ufvk: ufvkTyped
|
|
1378
|
+
)
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
extension FfiBoxedSlice {
|
|
1383
|
+
/// converts an [`FfiBoxedSlice`] into a [`UnifiedSpendingKey`]
|
|
1384
|
+
/// - Note: This does not check that the converted value actually holds a valid USK
|
|
1385
|
+
func unsafeToUnifiedSpendingKey(network: NetworkType) -> UnifiedSpendingKey {
|
|
1386
|
+
.init(
|
|
1387
|
+
network: network,
|
|
1388
|
+
bytes: self.ptr.toByteArray(length: Int(self.len))
|
|
1389
|
+
)
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
extension FfiUuid {
|
|
1394
|
+
var uuidArray: [UInt8] {
|
|
1395
|
+
withUnsafeBytes(of: self.uuid_bytes) { buf in
|
|
1396
|
+
[UInt8](buf)
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
/// converts an [`FfiUuid`] into a [`AccountUUID`]
|
|
1401
|
+
func unsafeToAccountUUID() -> AccountUUID {
|
|
1402
|
+
.init(
|
|
1403
|
+
id: self.uuidArray
|
|
1404
|
+
)
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
|
|
961
1408
|
extension FFIBinaryKey {
|
|
1409
|
+
var uuidArray: [UInt8] {
|
|
1410
|
+
withUnsafeBytes(of: self.account_uuid) { buf in
|
|
1411
|
+
[UInt8](buf)
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
|
|
962
1415
|
/// converts an [`FFIBinaryKey`] into a [`UnifiedSpendingKey`]
|
|
963
1416
|
/// - Note: This does not check that the converted value actually holds a valid USK
|
|
964
1417
|
func unsafeToUnifiedSpendingKey(network: NetworkType) -> UnifiedSpendingKey {
|
|
@@ -966,8 +1419,7 @@ extension FFIBinaryKey {
|
|
|
966
1419
|
network: network,
|
|
967
1420
|
bytes: self.encoding.toByteArray(
|
|
968
1421
|
length: Int(self.encoding_len)
|
|
969
|
-
)
|
|
970
|
-
account: self.account_id
|
|
1422
|
+
)
|
|
971
1423
|
)
|
|
972
1424
|
}
|
|
973
1425
|
}
|
|
@@ -1013,6 +1465,12 @@ extension FfiBalance {
|
|
|
1013
1465
|
}
|
|
1014
1466
|
|
|
1015
1467
|
extension FfiAccountBalance {
|
|
1468
|
+
var uuidArray: [UInt8] {
|
|
1469
|
+
withUnsafeBytes(of: self.account_uuid) { buf in
|
|
1470
|
+
[UInt8](buf)
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1016
1474
|
/// Converts an [`FfiAccountBalance`] into a [`AccountBalance`].
|
|
1017
1475
|
func toAccountBalance() -> AccountBalance {
|
|
1018
1476
|
.init(
|
|
@@ -1033,7 +1491,7 @@ extension FfiScanProgress {
|
|
|
1033
1491
|
}
|
|
1034
1492
|
}
|
|
1035
1493
|
|
|
1036
|
-
// swiftlint:disable large_tuple line_length
|
|
1494
|
+
// swiftlint:disable large_tuple line_length file_length
|
|
1037
1495
|
struct FfiTxId {
|
|
1038
1496
|
var tuple: (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8)
|
|
1039
1497
|
var array: [UInt8] {
|