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
package/ios/zcashlc.h
CHANGED
|
@@ -3,38 +3,129 @@
|
|
|
3
3
|
#include <stdint.h>
|
|
4
4
|
#include <stdlib.h>
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Specifies how a "spend max" request should be evaluated.
|
|
8
|
+
*/
|
|
9
|
+
typedef enum FfiMaxSpendMode {
|
|
10
|
+
/**
|
|
11
|
+
* `MaxSpendable` will target to spend all _currently_ spendable funds where it
|
|
12
|
+
* could be the case that the wallet has received other funds that are not
|
|
13
|
+
* confirmed and therefore not spendable yet and the caller evaluates that as
|
|
14
|
+
* an acceptable scenario.
|
|
15
|
+
*/
|
|
16
|
+
MaxSpendable,
|
|
17
|
+
/**
|
|
18
|
+
* `Everything` will target to spend **all funds** and will fail if there are
|
|
19
|
+
* unspendable funds in the wallet or if the wallet is not yet synced.
|
|
20
|
+
*/
|
|
21
|
+
Everything,
|
|
22
|
+
} FfiMaxSpendMode;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A type describing the mined-ness of transactions that should be returned in response to a
|
|
26
|
+
* [`TransactionDataRequest`].
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
typedef enum TransactionStatusFilter {
|
|
30
|
+
/**
|
|
31
|
+
* Only mined transactions should be returned.
|
|
32
|
+
*/
|
|
33
|
+
TransactionStatusFilter_Mined,
|
|
34
|
+
/**
|
|
35
|
+
* Only mempool transactions should be returned.
|
|
36
|
+
*/
|
|
37
|
+
TransactionStatusFilter_Mempool,
|
|
38
|
+
/**
|
|
39
|
+
* Both mined transactions and transactions in the mempool should be returned.
|
|
40
|
+
*/
|
|
41
|
+
TransactionStatusFilter_All,
|
|
42
|
+
} TransactionStatusFilter;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A type used to filter transactions to be returned in response to a [`TransactionDataRequest`],
|
|
46
|
+
* in terms of the spentness of the transaction's transparent outputs.
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
49
|
+
typedef enum OutputStatusFilter {
|
|
50
|
+
/**
|
|
51
|
+
* Only transactions that have currently-unspent transparent outputs should be returned.
|
|
52
|
+
*/
|
|
53
|
+
OutputStatusFilter_Unspent,
|
|
54
|
+
/**
|
|
55
|
+
* All transactions corresponding to the data request should be returned, irrespective of
|
|
56
|
+
* whether or not those transactions produce transparent outputs that are currently unspent.
|
|
57
|
+
*/
|
|
58
|
+
OutputStatusFilter_All,
|
|
59
|
+
} OutputStatusFilter;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* What level of sleep to put a Tor client into.
|
|
63
|
+
*/
|
|
64
|
+
typedef enum TorDormantMode {
|
|
65
|
+
/**
|
|
66
|
+
* The client functions as normal, and background tasks run periodically.
|
|
67
|
+
*/
|
|
68
|
+
Normal,
|
|
69
|
+
/**
|
|
70
|
+
* Background tasks are suspended, conserving CPU usage. Attempts to use the client will
|
|
71
|
+
* wake it back up again.
|
|
72
|
+
*/
|
|
73
|
+
Soft,
|
|
74
|
+
} TorDormantMode;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* A struct that contains a ZIP 325 Account Metadata Key.
|
|
78
|
+
*/
|
|
79
|
+
typedef struct FfiAccountMetadataKey FfiAccountMetadataKey;
|
|
80
|
+
|
|
81
|
+
typedef struct LwdConn LwdConn;
|
|
82
|
+
|
|
6
83
|
typedef struct TorRuntime TorRuntime;
|
|
7
84
|
|
|
8
85
|
/**
|
|
9
|
-
* A struct that contains
|
|
86
|
+
* A struct that contains a 16-byte account uuid.
|
|
10
87
|
*/
|
|
11
|
-
typedef struct
|
|
12
|
-
uint8_t
|
|
13
|
-
|
|
14
|
-
} FfiAccount;
|
|
88
|
+
typedef struct FfiUuid {
|
|
89
|
+
uint8_t uuid_bytes[16];
|
|
90
|
+
} FfiUuid;
|
|
15
91
|
|
|
16
92
|
/**
|
|
17
93
|
* A struct that contains a pointer to, and length information for, a heap-allocated
|
|
18
|
-
* slice of [`
|
|
94
|
+
* slice of [`Uuid`] values.
|
|
19
95
|
*
|
|
20
96
|
* # Safety
|
|
21
97
|
*
|
|
22
|
-
* - `ptr` must be non-null and must be valid for reads for `len * mem::size_of::<
|
|
98
|
+
* - `ptr` must be non-null and must be valid for reads for `len * mem::size_of::<Uuid>()`
|
|
23
99
|
* many bytes, and it must be properly aligned. This means in particular:
|
|
24
100
|
* - The entire memory range pointed to by `ptr` must be contained within a single allocated
|
|
25
101
|
* object. Slices can never span across multiple allocated objects.
|
|
26
102
|
* - `ptr` must be non-null and aligned even for zero-length slices.
|
|
27
103
|
* - `ptr` must point to `len` consecutive properly initialized values of type
|
|
28
|
-
* [`
|
|
29
|
-
* - The total size `len * mem::size_of::<
|
|
104
|
+
* [`Uuid`].
|
|
105
|
+
* - The total size `len * mem::size_of::<Uuid>()` of the slice pointed to
|
|
30
106
|
* by `ptr` must be no larger than isize::MAX. See the safety documentation of pointer::offset.
|
|
31
|
-
* - See the safety documentation of [`FfiAccount`]
|
|
32
107
|
*/
|
|
33
108
|
typedef struct FfiAccounts {
|
|
34
|
-
struct
|
|
109
|
+
struct FfiUuid *ptr;
|
|
35
110
|
uintptr_t len;
|
|
36
111
|
} FfiAccounts;
|
|
37
112
|
|
|
113
|
+
/**
|
|
114
|
+
* A struct that contains a 16-byte account uuid along with key derivation metadata for that
|
|
115
|
+
* account.
|
|
116
|
+
*
|
|
117
|
+
* A returned value containing the all-zeros seed fingerprint and/or u32::MAX for the
|
|
118
|
+
* hd_account_index indicates that no derivation metadata is available.
|
|
119
|
+
*/
|
|
120
|
+
typedef struct FfiAccount {
|
|
121
|
+
uint8_t uuid_bytes[16];
|
|
122
|
+
char *account_name;
|
|
123
|
+
char *key_source;
|
|
124
|
+
uint8_t seed_fingerprint[32];
|
|
125
|
+
uint32_t hd_account_index;
|
|
126
|
+
char *ufvk;
|
|
127
|
+
} FfiAccount;
|
|
128
|
+
|
|
38
129
|
/**
|
|
39
130
|
* A struct that contains an account identifier along with a pointer to the binary encoding
|
|
40
131
|
* of an associated key.
|
|
@@ -44,11 +135,21 @@ typedef struct FfiAccounts {
|
|
|
44
135
|
* - `encoding` must be non-null and must point to an array of `encoding_len` bytes.
|
|
45
136
|
*/
|
|
46
137
|
typedef struct FFIBinaryKey {
|
|
47
|
-
|
|
138
|
+
uint8_t account_uuid[16];
|
|
48
139
|
uint8_t *encoding;
|
|
49
140
|
uintptr_t encoding_len;
|
|
50
141
|
} FFIBinaryKey;
|
|
51
142
|
|
|
143
|
+
/**
|
|
144
|
+
* A single-use transparent address, along with metadata about the address's use within the
|
|
145
|
+
* wallet's ephemeral gap limit.
|
|
146
|
+
*/
|
|
147
|
+
typedef struct FfiSingleUseTaddr {
|
|
148
|
+
char *address;
|
|
149
|
+
uint32_t gap_position;
|
|
150
|
+
uint32_t gap_limit;
|
|
151
|
+
} FfiSingleUseTaddr;
|
|
152
|
+
|
|
52
153
|
/**
|
|
53
154
|
* A struct that contains an account identifier along with a pointer to the string encoding
|
|
54
155
|
* of an associated key.
|
|
@@ -58,32 +159,64 @@ typedef struct FFIBinaryKey {
|
|
|
58
159
|
* - `encoding` must be non-null and must point to a null-terminated UTF-8 string.
|
|
59
160
|
*/
|
|
60
161
|
typedef struct FFIEncodedKey {
|
|
61
|
-
|
|
162
|
+
uint8_t account_uuid[16];
|
|
62
163
|
char *encoding;
|
|
63
164
|
} FFIEncodedKey;
|
|
64
165
|
|
|
65
166
|
/**
|
|
66
167
|
* A struct that contains a pointer to, and length information for, a heap-allocated
|
|
67
|
-
* slice of [`
|
|
168
|
+
* slice of [`EncodedKey`] values.
|
|
68
169
|
*
|
|
69
170
|
* # Safety
|
|
70
171
|
*
|
|
71
|
-
* - `ptr` must be non-null and must be valid for reads for `len * mem::size_of::<
|
|
172
|
+
* - `ptr` must be non-null and must be valid for reads for `len * mem::size_of::<EncodedKey>()`
|
|
72
173
|
* many bytes, and it must be properly aligned. This means in particular:
|
|
73
174
|
* - The entire memory range pointed to by `ptr` must be contained within a single allocated
|
|
74
175
|
* object. Slices can never span across multiple allocated objects.
|
|
75
176
|
* - `ptr` must be non-null and aligned even for zero-length slices.
|
|
76
177
|
* - `ptr` must point to `len` consecutive properly initialized values of type
|
|
77
|
-
* [`
|
|
78
|
-
* - The total size `len * mem::size_of::<
|
|
178
|
+
* [`EncodedKey`].
|
|
179
|
+
* - The total size `len * mem::size_of::<EncodedKey>()` of the slice pointed to
|
|
79
180
|
* by `ptr` must be no larger than isize::MAX. See the safety documentation of pointer::offset.
|
|
80
|
-
* - See the safety documentation of [`
|
|
181
|
+
* - See the safety documentation of [`EncodedKey`]
|
|
81
182
|
*/
|
|
82
183
|
typedef struct FFIEncodedKeys {
|
|
83
184
|
struct FFIEncodedKey *ptr;
|
|
84
185
|
uintptr_t len;
|
|
85
186
|
} FFIEncodedKeys;
|
|
86
187
|
|
|
188
|
+
/**
|
|
189
|
+
* A description of the policy that is used to determine what notes are available for spending,
|
|
190
|
+
* based upon the number of confirmations (the number of blocks in the chain since and including
|
|
191
|
+
* the block in which a note was produced.)
|
|
192
|
+
*
|
|
193
|
+
* See [`ZIP 315`] for details including the definitions of "trusted" and "untrusted" notes.
|
|
194
|
+
*
|
|
195
|
+
* # Note
|
|
196
|
+
*
|
|
197
|
+
* `trusted` and `untrusted` are both meant to be non-zero values.
|
|
198
|
+
* `0` will be treated as a request for a default value.
|
|
199
|
+
*
|
|
200
|
+
* [`ZIP 315`]: https://zips.z.cash/zip-0315
|
|
201
|
+
*/
|
|
202
|
+
typedef struct ConfirmationsPolicy {
|
|
203
|
+
/**
|
|
204
|
+
* The number of confirmations required before trusted notes may be spent. NonZero, set this
|
|
205
|
+
* and `untrusted` to zero to accept the default value for each.
|
|
206
|
+
*/
|
|
207
|
+
uint32_t trusted;
|
|
208
|
+
/**
|
|
209
|
+
* The number of confirmations required before untrusted notes may be spent. NonZero, set this
|
|
210
|
+
* and `trusted` both to zero to accept the default value for each.
|
|
211
|
+
*/
|
|
212
|
+
uint32_t untrusted;
|
|
213
|
+
/**
|
|
214
|
+
* A flag that enables selection of zero-conf transparent UTXOs for spends in shielding
|
|
215
|
+
* transactions.
|
|
216
|
+
*/
|
|
217
|
+
bool allow_zero_conf_shielding;
|
|
218
|
+
} ConfirmationsPolicy;
|
|
219
|
+
|
|
87
220
|
/**
|
|
88
221
|
* A struct that contains a subtree root.
|
|
89
222
|
*
|
|
@@ -102,21 +235,21 @@ typedef struct FfiSubtreeRoot {
|
|
|
102
235
|
|
|
103
236
|
/**
|
|
104
237
|
* A struct that contains a pointer to, and length information for, a heap-allocated
|
|
105
|
-
* slice of [`
|
|
238
|
+
* slice of [`SubtreeRoot`] values.
|
|
106
239
|
*
|
|
107
240
|
* # Safety
|
|
108
241
|
*
|
|
109
|
-
* - `ptr` must be non-null and must be valid for reads for `len * mem::size_of::<
|
|
242
|
+
* - `ptr` must be non-null and must be valid for reads for `len * mem::size_of::<SubtreeRoot>()`
|
|
110
243
|
* many bytes, and it must be properly aligned. This means in particular:
|
|
111
244
|
* - The entire memory range pointed to by `ptr` must be contained within a single
|
|
112
245
|
* allocated object. Slices can never span across multiple allocated objects.
|
|
113
246
|
* - `ptr` must be non-null and aligned even for zero-length slices.
|
|
114
247
|
* - `ptr` must point to `len` consecutive properly initialized values of type
|
|
115
|
-
* [`
|
|
116
|
-
* - The total size `len * mem::size_of::<
|
|
248
|
+
* [`SubtreeRoot`].
|
|
249
|
+
* - The total size `len * mem::size_of::<SubtreeRoot>()` of the slice pointed to
|
|
117
250
|
* by `ptr` must be no larger than isize::MAX. See the safety documentation of
|
|
118
251
|
* `pointer::offset`.
|
|
119
|
-
* - See the safety documentation of [`
|
|
252
|
+
* - See the safety documentation of [`SubtreeRoot`]
|
|
120
253
|
*/
|
|
121
254
|
typedef struct FfiSubtreeRoots {
|
|
122
255
|
struct FfiSubtreeRoot *ptr;
|
|
@@ -152,7 +285,7 @@ typedef struct FfiBalance {
|
|
|
152
285
|
* The sum of this struct's fields is the total balance of the account.
|
|
153
286
|
*/
|
|
154
287
|
typedef struct FfiAccountBalance {
|
|
155
|
-
|
|
288
|
+
uint8_t account_uuid[16];
|
|
156
289
|
/**
|
|
157
290
|
* The value of unspent Sapling outputs belonging to the account.
|
|
158
291
|
*/
|
|
@@ -198,18 +331,20 @@ typedef struct FfiScanProgress {
|
|
|
198
331
|
* # Safety
|
|
199
332
|
*
|
|
200
333
|
* - `account_balances` must be non-null and must be valid for reads for
|
|
201
|
-
* `account_balances_len * mem::size_of::<
|
|
334
|
+
* `account_balances_len * mem::size_of::<AccountBalance>()` many bytes, and it must
|
|
202
335
|
* be properly aligned. This means in particular:
|
|
203
336
|
* - The entire memory range pointed to by `account_balances` must be contained within
|
|
204
337
|
* a single allocated object. Slices can never span across multiple allocated objects.
|
|
205
338
|
* - `account_balances` must be non-null and aligned even for zero-length slices.
|
|
206
339
|
* - `account_balances` must point to `len` consecutive properly initialized values of
|
|
207
|
-
* type [`
|
|
208
|
-
* - The total size `account_balances_len * mem::size_of::<
|
|
340
|
+
* type [`AccountBalance`].
|
|
341
|
+
* - The total size `account_balances_len * mem::size_of::<AccountBalance>()` of the
|
|
209
342
|
* slice pointed to by `account_balances` must be no larger than `isize::MAX`. See the
|
|
210
343
|
* safety documentation of `pointer::offset`.
|
|
211
344
|
* - `scan_progress` must, if non-null, point to a struct having the layout of
|
|
212
|
-
* [`
|
|
345
|
+
* [`ScanProgress`].
|
|
346
|
+
* - `recovery_progress` must, if non-null, point to a struct having the layout of
|
|
347
|
+
* [`ScanProgress`].
|
|
213
348
|
*/
|
|
214
349
|
typedef struct FfiWalletSummary {
|
|
215
350
|
struct FfiAccountBalance *account_balances;
|
|
@@ -217,6 +352,7 @@ typedef struct FfiWalletSummary {
|
|
|
217
352
|
int32_t chain_tip_height;
|
|
218
353
|
int32_t fully_scanned_height;
|
|
219
354
|
struct FfiScanProgress *scan_progress;
|
|
355
|
+
struct FfiScanProgress *recovery_progress;
|
|
220
356
|
uint64_t next_sapling_subtree_index;
|
|
221
357
|
uint64_t next_orchard_subtree_index;
|
|
222
358
|
} FfiWalletSummary;
|
|
@@ -233,18 +369,18 @@ typedef struct FfiScanRange {
|
|
|
233
369
|
|
|
234
370
|
/**
|
|
235
371
|
* A struct that contains a pointer to, and length information for, a heap-allocated
|
|
236
|
-
* slice of [`
|
|
372
|
+
* slice of [`ScanRange`] values.
|
|
237
373
|
*
|
|
238
374
|
* # Safety
|
|
239
375
|
*
|
|
240
|
-
* - `ptr` must be non-null and must be valid for reads for `len * mem::size_of::<
|
|
376
|
+
* - `ptr` must be non-null and must be valid for reads for `len * mem::size_of::<ScanRange>()`
|
|
241
377
|
* many bytes, and it must be properly aligned. This means in particular:
|
|
242
378
|
* - The entire memory range pointed to by `ptr` must be contained within a single
|
|
243
379
|
* allocated object. Slices can never span across multiple allocated objects.
|
|
244
380
|
* - `ptr` must be non-null and aligned even for zero-length slices.
|
|
245
381
|
* - `ptr` must point to `len` consecutive properly initialized values of type
|
|
246
|
-
* [`
|
|
247
|
-
* - The total size `len * mem::size_of::<
|
|
382
|
+
* [`ScanRange`].
|
|
383
|
+
* - The total size `len * mem::size_of::<ScanRange>()` of the slice pointed to
|
|
248
384
|
* by `ptr` must be no larger than isize::MAX. See the safety documentation of
|
|
249
385
|
* `pointer::offset`.
|
|
250
386
|
*/
|
|
@@ -316,10 +452,12 @@ typedef struct FfiBoxedSlice {
|
|
|
316
452
|
* by `ptr` must be no larger than isize::MAX. See the safety documentation of
|
|
317
453
|
* `pointer::offset`.
|
|
318
454
|
*/
|
|
319
|
-
typedef struct
|
|
455
|
+
typedef struct FfiSymmetricKeys {
|
|
320
456
|
uint8_t (*ptr)[32];
|
|
321
457
|
uintptr_t len;
|
|
322
|
-
}
|
|
458
|
+
} FfiSymmetricKeys;
|
|
459
|
+
|
|
460
|
+
typedef struct FfiSymmetricKeys FfiTxIds;
|
|
323
461
|
|
|
324
462
|
/**
|
|
325
463
|
* Metadata about the status of a transaction obtained by inspecting the chain state.
|
|
@@ -402,18 +540,51 @@ enum FfiTransactionDataRequest_Tag {
|
|
|
402
540
|
*
|
|
403
541
|
* [`GetTaddressTxids`]: crate::proto::service::compact_tx_streamer_client::CompactTxStreamerClient::get_taddress_txids
|
|
404
542
|
*/
|
|
405
|
-
|
|
543
|
+
TransactionsInvolvingAddress,
|
|
406
544
|
};
|
|
407
545
|
typedef uint8_t FfiTransactionDataRequest_Tag;
|
|
408
546
|
|
|
409
|
-
typedef struct
|
|
547
|
+
typedef struct TransactionsInvolvingAddress_Body {
|
|
548
|
+
/**
|
|
549
|
+
* The address to request transactions and/or UTXOs for.
|
|
550
|
+
*/
|
|
410
551
|
char *address;
|
|
552
|
+
/**
|
|
553
|
+
* Only transactions mined at heights greater than or equal to this height should be
|
|
554
|
+
* returned.
|
|
555
|
+
*/
|
|
411
556
|
uint32_t block_range_start;
|
|
412
557
|
/**
|
|
413
|
-
*
|
|
558
|
+
* Only transactions mined at heights less than this height should be returned.
|
|
559
|
+
*
|
|
560
|
+
* Either a `u32` value, or `-1` representing no end height.
|
|
414
561
|
*/
|
|
415
562
|
int64_t block_range_end;
|
|
416
|
-
|
|
563
|
+
/**
|
|
564
|
+
* If `request_at` is non-negative, the caller evaluating this request should attempt to
|
|
565
|
+
* retrieve transaction data related to the specified address at a time that is as close
|
|
566
|
+
* as practical to the specified instant, and in a fashion that decorrelates this request
|
|
567
|
+
* to a light wallet server from other requests made by the same caller.
|
|
568
|
+
*
|
|
569
|
+
* `-1` is the only negative value, meaning "unset".
|
|
570
|
+
*
|
|
571
|
+
* This may be ignored by callers that are able to satisfy the request without exposing
|
|
572
|
+
* correlations between addresses to untrusted parties; for example, a wallet application
|
|
573
|
+
* that uses a private, trusted-for-privacy supplier of chain data can safely ignore this
|
|
574
|
+
* field.
|
|
575
|
+
*/
|
|
576
|
+
int64_t request_at;
|
|
577
|
+
/**
|
|
578
|
+
* The caller should respond to this request only with transactions that conform to the
|
|
579
|
+
* specified transaction status filter.
|
|
580
|
+
*/
|
|
581
|
+
enum TransactionStatusFilter tx_status_filter;
|
|
582
|
+
/**
|
|
583
|
+
* The caller should respond to this request only with transactions containing outputs
|
|
584
|
+
* that conform to the specified output status filter.
|
|
585
|
+
*/
|
|
586
|
+
enum OutputStatusFilter output_status_filter;
|
|
587
|
+
} TransactionsInvolvingAddress_Body;
|
|
417
588
|
|
|
418
589
|
typedef struct FfiTransactionDataRequest {
|
|
419
590
|
FfiTransactionDataRequest_Tag tag;
|
|
@@ -424,32 +595,94 @@ typedef struct FfiTransactionDataRequest {
|
|
|
424
595
|
struct {
|
|
425
596
|
uint8_t enhancement[32];
|
|
426
597
|
};
|
|
427
|
-
|
|
598
|
+
TransactionsInvolvingAddress_Body transactions_involving_address;
|
|
428
599
|
};
|
|
429
600
|
} FfiTransactionDataRequest;
|
|
430
601
|
|
|
431
602
|
/**
|
|
432
603
|
* A struct that contains a pointer to, and length information for, a heap-allocated
|
|
433
|
-
* slice of [`
|
|
604
|
+
* slice of [`TransactionDataRequest`] values.
|
|
434
605
|
*
|
|
435
606
|
* # Safety
|
|
436
607
|
*
|
|
437
|
-
* - `ptr` must be non-null and must be valid for reads for `len * mem::size_of::<
|
|
608
|
+
* - `ptr` must be non-null and must be valid for reads for `len * mem::size_of::<TransactionDataRequest>()`
|
|
438
609
|
* many bytes, and it must be properly aligned. This means in particular:
|
|
439
610
|
* - The entire memory range pointed to by `ptr` must be contained within a single allocated
|
|
440
611
|
* object. Slices can never span across multiple allocated objects.
|
|
441
612
|
* - `ptr` must be non-null and aligned even for zero-length slices.
|
|
442
613
|
* - `ptr` must point to `len` consecutive properly initialized values of type
|
|
443
|
-
* [`
|
|
444
|
-
* - The total size `len * mem::size_of::<
|
|
614
|
+
* [`TransactionDataRequest`].
|
|
615
|
+
* - The total size `len * mem::size_of::<TransactionDataRequest>()` of the slice pointed to
|
|
445
616
|
* by `ptr` must be no larger than isize::MAX. See the safety documentation of pointer::offset.
|
|
446
|
-
* - See the safety documentation of [`
|
|
617
|
+
* - See the safety documentation of [`TransactionDataRequest`]
|
|
447
618
|
*/
|
|
448
619
|
typedef struct FfiTransactionDataRequests {
|
|
449
620
|
struct FfiTransactionDataRequest *ptr;
|
|
450
621
|
uintptr_t len;
|
|
451
622
|
} FfiTransactionDataRequests;
|
|
452
623
|
|
|
624
|
+
/**
|
|
625
|
+
* An HTTP header from a response.
|
|
626
|
+
*
|
|
627
|
+
* Memory is managed by Rust.
|
|
628
|
+
*/
|
|
629
|
+
typedef struct FfiHttpResponseHeader {
|
|
630
|
+
/**
|
|
631
|
+
* The header name as a C string.
|
|
632
|
+
*/
|
|
633
|
+
char *name;
|
|
634
|
+
/**
|
|
635
|
+
* The header value as a C string.
|
|
636
|
+
*/
|
|
637
|
+
char *value;
|
|
638
|
+
} FfiHttpResponseHeader;
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* A struct that contains an HTTP response.
|
|
642
|
+
*/
|
|
643
|
+
typedef struct FfiHttpResponseBytes {
|
|
644
|
+
/**
|
|
645
|
+
* The response's status.
|
|
646
|
+
*/
|
|
647
|
+
uint16_t status;
|
|
648
|
+
/**
|
|
649
|
+
* The response's version.
|
|
650
|
+
*/
|
|
651
|
+
char *version;
|
|
652
|
+
/**
|
|
653
|
+
* A pointer to a list of the response's headers.
|
|
654
|
+
*/
|
|
655
|
+
struct FfiHttpResponseHeader *headers_ptr;
|
|
656
|
+
/**
|
|
657
|
+
* The length of the data in `headers_ptr`.
|
|
658
|
+
*/
|
|
659
|
+
uintptr_t headers_len;
|
|
660
|
+
/**
|
|
661
|
+
* A pointer to the HTTP body bytes.
|
|
662
|
+
*/
|
|
663
|
+
uint8_t *body_ptr;
|
|
664
|
+
/**
|
|
665
|
+
* The length of the data in `body_ptr`.
|
|
666
|
+
*/
|
|
667
|
+
uintptr_t body_len;
|
|
668
|
+
} FfiHttpResponseBytes;
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* An HTTP header for a request.
|
|
672
|
+
*
|
|
673
|
+
* Memory is managed by Swift.
|
|
674
|
+
*/
|
|
675
|
+
typedef struct FfiHttpRequestHeader {
|
|
676
|
+
/**
|
|
677
|
+
* The header name as a C string.
|
|
678
|
+
*/
|
|
679
|
+
const char *name;
|
|
680
|
+
/**
|
|
681
|
+
* The header value as a C string.
|
|
682
|
+
*/
|
|
683
|
+
const char *value;
|
|
684
|
+
} FfiHttpRequestHeader;
|
|
685
|
+
|
|
453
686
|
/**
|
|
454
687
|
* A decimal suitable for converting into an `NSDecimalNumber`.
|
|
455
688
|
*/
|
|
@@ -459,6 +692,42 @@ typedef struct Decimal {
|
|
|
459
692
|
bool is_sign_negative;
|
|
460
693
|
} Decimal;
|
|
461
694
|
|
|
695
|
+
/**
|
|
696
|
+
* The result of checking for UTXOs received by an ephemeral address.
|
|
697
|
+
*
|
|
698
|
+
*/
|
|
699
|
+
enum FfiAddressCheckResult_Tag {
|
|
700
|
+
/**
|
|
701
|
+
* No UTXOs were found as a result of the check.
|
|
702
|
+
*/
|
|
703
|
+
FfiAddressCheckResult_NotFound,
|
|
704
|
+
/**
|
|
705
|
+
* UTXOs were found for the given address.
|
|
706
|
+
*/
|
|
707
|
+
FfiAddressCheckResult_Found,
|
|
708
|
+
};
|
|
709
|
+
typedef uint8_t FfiAddressCheckResult_Tag;
|
|
710
|
+
|
|
711
|
+
typedef struct FfiAddressCheckResult_Found_Body {
|
|
712
|
+
char *address;
|
|
713
|
+
} FfiAddressCheckResult_Found_Body;
|
|
714
|
+
|
|
715
|
+
typedef struct FfiAddressCheckResult {
|
|
716
|
+
FfiAddressCheckResult_Tag tag;
|
|
717
|
+
union {
|
|
718
|
+
FfiAddressCheckResult_Found_Body found;
|
|
719
|
+
};
|
|
720
|
+
} FfiAddressCheckResult;
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* A struct that contains a Zcash unified address, along with the diversifier index used to
|
|
724
|
+
* generate that address.
|
|
725
|
+
*/
|
|
726
|
+
typedef struct FfiAddress {
|
|
727
|
+
char *address;
|
|
728
|
+
uint8_t diversifier_index_bytes[11];
|
|
729
|
+
} FfiAddress;
|
|
730
|
+
|
|
462
731
|
/**
|
|
463
732
|
* Initializes global Rust state, such as the logging infrastructure and threadpools.
|
|
464
733
|
*
|
|
@@ -543,16 +812,6 @@ int32_t zcashlc_init_data_database(const uint8_t *db_data,
|
|
|
543
812
|
uintptr_t seed_len,
|
|
544
813
|
uint32_t network_id);
|
|
545
814
|
|
|
546
|
-
/**
|
|
547
|
-
* Frees an array of FfiAccounts values as allocated by `zcashlc_list_accounts`.
|
|
548
|
-
*
|
|
549
|
-
* # Safety
|
|
550
|
-
*
|
|
551
|
-
* - `ptr` must be non-null and must point to a struct having the layout of [`FfiAccounts`].
|
|
552
|
-
* See the safety documentation of [`FfiAccounts`].
|
|
553
|
-
*/
|
|
554
|
-
void zcashlc_free_accounts(struct FfiAccounts *ptr);
|
|
555
|
-
|
|
556
815
|
/**
|
|
557
816
|
* Returns a list of the accounts in the wallet.
|
|
558
817
|
*
|
|
@@ -572,14 +831,28 @@ struct FfiAccounts *zcashlc_list_accounts(const uint8_t *db_data,
|
|
|
572
831
|
uint32_t network_id);
|
|
573
832
|
|
|
574
833
|
/**
|
|
575
|
-
*
|
|
834
|
+
* Returns the account data for the specified account identifier, or the [`ffi::Account::NOT_FOUND`]
|
|
835
|
+
* sentinel value if the account id does not correspond to an account in the wallet.
|
|
576
836
|
*
|
|
577
837
|
* # Safety
|
|
578
838
|
*
|
|
579
|
-
* - `
|
|
580
|
-
*
|
|
839
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
840
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
841
|
+
* operating system's preferred representation.
|
|
842
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
843
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
844
|
+
* documentation of pointer::offset.
|
|
845
|
+
* - `account_uuid_bytes` must be non-null and valid for reads for 16 bytes, and it must have an
|
|
846
|
+
* alignment of `1`.
|
|
847
|
+
* - The memory referenced by `account_uuid_bytes` must not be mutated for the duration of the
|
|
848
|
+
* function call.
|
|
849
|
+
* - Call [`zcashlc_free_account`] to free the memory associated with the returned pointer
|
|
850
|
+
* when done using it.
|
|
581
851
|
*/
|
|
582
|
-
|
|
852
|
+
struct FfiAccount *zcashlc_get_account(const uint8_t *db_data,
|
|
853
|
+
uintptr_t db_data_len,
|
|
854
|
+
uint32_t network_id,
|
|
855
|
+
const uint8_t *account_uuid_bytes);
|
|
583
856
|
|
|
584
857
|
/**
|
|
585
858
|
* Adds the next available account-level spend authority, given the current set of [ZIP 316]
|
|
@@ -610,6 +883,11 @@ void zcashlc_free_binary_key(struct FFIBinaryKey *ptr);
|
|
|
610
883
|
* - The memory referenced by `seed` must not be mutated for the duration of the function call.
|
|
611
884
|
* - The total size `seed_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
612
885
|
* of pointer::offset.
|
|
886
|
+
* - `treestate` must be non-null and valid for reads for `treestate_len` bytes, and it must have an
|
|
887
|
+
* alignment of `1`.
|
|
888
|
+
* - The memory referenced by `treestate` must not be mutated for the duration of the function call.
|
|
889
|
+
* - The total size `treestate_len` must be no larger than `isize::MAX`. See the safety
|
|
890
|
+
* documentation of pointer::offset.
|
|
613
891
|
* - Call [`zcashlc_free_binary_key`] to free the memory associated with the returned pointer when
|
|
614
892
|
* you are finished using it.
|
|
615
893
|
*
|
|
@@ -622,7 +900,53 @@ struct FFIBinaryKey *zcashlc_create_account(const uint8_t *db_data,
|
|
|
622
900
|
const uint8_t *treestate,
|
|
623
901
|
uintptr_t treestate_len,
|
|
624
902
|
int64_t recover_until,
|
|
625
|
-
uint32_t network_id
|
|
903
|
+
uint32_t network_id,
|
|
904
|
+
const char *account_name,
|
|
905
|
+
const char *key_source);
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* Adds a new account to the wallet by importing the UFVK that will be used to detect incoming
|
|
909
|
+
* payments.
|
|
910
|
+
*
|
|
911
|
+
* Derivation metadata may optionally be included. To indicate that no derivation metadata is
|
|
912
|
+
* available, the `seed_fingerprint` argument should be set to the null pointer and
|
|
913
|
+
* `hd_account_index` should be set to the value `u32::MAX`. Derivation metadata will not be
|
|
914
|
+
* stored unless both the seed fingerprint and the HD account index are provided.
|
|
915
|
+
*
|
|
916
|
+
* Returns the globally unique identifier for the account.
|
|
917
|
+
*
|
|
918
|
+
* # Safety
|
|
919
|
+
*
|
|
920
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
921
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
922
|
+
* operating system's preferred representation.
|
|
923
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
924
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
925
|
+
* documentation of pointer::offset.
|
|
926
|
+
* - `ufvk` must be non-null and must point to a null-terminated UTF-8 string.
|
|
927
|
+
* - `treestate` must be non-null and valid for reads for `treestate_len` bytes, and it must have an
|
|
928
|
+
* alignment of `1`.
|
|
929
|
+
* - The memory referenced by `treestate` must not be mutated for the duration of the function call.
|
|
930
|
+
* - The total size `treestate_len` must be no larger than `isize::MAX`. See the safety
|
|
931
|
+
* documentation of pointer::offset.
|
|
932
|
+
* - `seed_fingerprint` must either be either null or valid for reads for 32 bytes, and it must
|
|
933
|
+
* have an alignment of `1`.
|
|
934
|
+
*
|
|
935
|
+
* - Call [`zcashlc_free_ffi_uuid`] to free the memory associated with the returned pointer when
|
|
936
|
+
* you are finished using it.
|
|
937
|
+
*/
|
|
938
|
+
struct FfiUuid *zcashlc_import_account_ufvk(const uint8_t *db_data,
|
|
939
|
+
uintptr_t db_data_len,
|
|
940
|
+
const char *ufvk,
|
|
941
|
+
const uint8_t *treestate,
|
|
942
|
+
uintptr_t treestate_len,
|
|
943
|
+
int64_t recover_until,
|
|
944
|
+
uint32_t network_id,
|
|
945
|
+
uint32_t purpose,
|
|
946
|
+
const char *account_name,
|
|
947
|
+
const char *key_source,
|
|
948
|
+
const uint8_t *seed_fingerprint,
|
|
949
|
+
uint32_t hd_account_index_raw);
|
|
626
950
|
|
|
627
951
|
/**
|
|
628
952
|
* Checks whether the given seed is relevant to any of the accounts in the wallet.
|
|
@@ -653,57 +977,68 @@ int8_t zcashlc_is_seed_relevant_to_any_derived_account(const uint8_t *db_data,
|
|
|
653
977
|
uint32_t network_id);
|
|
654
978
|
|
|
655
979
|
/**
|
|
656
|
-
*
|
|
657
|
-
*
|
|
658
|
-
* # Safety
|
|
980
|
+
* Deletes the specified account, and all transactions that exclusively involve it, from the
|
|
981
|
+
* wallet database.
|
|
659
982
|
*
|
|
660
|
-
*
|
|
661
|
-
*
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
*
|
|
983
|
+
* WARNING: This is a destructive operation and may result in the permanent loss of
|
|
984
|
+
* potentially important information that is not recoverable from chain data, including:
|
|
985
|
+
* * Data about transactions sent by the account for which [`OvkPolicy::Discard`] (or
|
|
986
|
+
* [`OvkPolicy::Custom`] with random OVKs) was used;
|
|
987
|
+
* * Data related to transactions that the account attempted to send that expired or were
|
|
988
|
+
* otherwise invalidated without having been mined in the main chain;
|
|
989
|
+
* * Data related to transactions that were observed in the mempool as having inputs or
|
|
990
|
+
* outputs that involved the account, but that were never mined in the main chain;
|
|
991
|
+
* * Data related to transactions that were received by the wallet in a mined block, where
|
|
992
|
+
* that block was later un-mined in a chain reorg and the transaction was either invalidated
|
|
993
|
+
* or was never re-mined.
|
|
667
994
|
*
|
|
668
|
-
* Returns
|
|
669
|
-
* store, if necessary) the returned spending key in a secure fashion.
|
|
995
|
+
* Returns `true` on success, or `false` if an error is raised.
|
|
670
996
|
*
|
|
671
997
|
* # Safety
|
|
672
998
|
*
|
|
999
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
1000
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
1001
|
+
* operating system's preferred representation.
|
|
1002
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
1003
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1004
|
+
* documentation of pointer::offset.
|
|
673
1005
|
* - `seed` must be non-null and valid for reads for `seed_len` bytes, and it must have an
|
|
674
1006
|
* alignment of `1`.
|
|
675
|
-
*
|
|
676
|
-
*
|
|
677
|
-
*
|
|
678
|
-
* - Call `zcashlc_free_binary_key` to free the memory associated with the returned pointer when
|
|
679
|
-
* you are finished using it.
|
|
1007
|
+
*
|
|
1008
|
+
* [`OvkPolicy::Discard`]: zcash_client_backend::wallet::OvkPolicy::Discard
|
|
1009
|
+
* [`OvkPolicy::Custom`]: zcash_client_backend::wallet::OvkPolicy::Custom
|
|
680
1010
|
*/
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
1011
|
+
bool zcashlc_delete_account(const uint8_t *db_data,
|
|
1012
|
+
uintptr_t db_data_len,
|
|
1013
|
+
uint32_t network_id,
|
|
1014
|
+
const uint8_t *account_uuid_bytes);
|
|
685
1015
|
|
|
686
1016
|
/**
|
|
687
|
-
*
|
|
688
|
-
* and returns the resulting encoded UFVK string. `usk_ptr` should point to an array of `usk_len`
|
|
689
|
-
* bytes containing a unified spending key encoded as returned from the `zcashlc_create_account`
|
|
690
|
-
* or `zcashlc_derive_spending_key` functions.
|
|
1017
|
+
* Returns the most-recently-generated unified payment address for the specified account.
|
|
691
1018
|
*
|
|
692
1019
|
* # Safety
|
|
693
1020
|
*
|
|
694
|
-
* - `
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
*
|
|
1021
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
1022
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
1023
|
+
* operating system's preferred representation.
|
|
1024
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
1025
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1026
|
+
* documentation of pointer::offset.
|
|
1027
|
+
* - `account_uuid_bytes` must be non-null and valid for reads for 16 bytes, and it must have an
|
|
1028
|
+
* alignment of `1`.
|
|
1029
|
+
* - The memory referenced by `account_uuid_bytes` must not be mutated for the duration of the
|
|
1030
|
+
* function call.
|
|
698
1031
|
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
699
|
-
* when
|
|
1032
|
+
* when done using it.
|
|
700
1033
|
*/
|
|
701
|
-
char *
|
|
702
|
-
|
|
703
|
-
|
|
1034
|
+
char *zcashlc_get_current_address(const uint8_t *db_data,
|
|
1035
|
+
uintptr_t db_data_len,
|
|
1036
|
+
const uint8_t *account_uuid_bytes,
|
|
1037
|
+
uint32_t network_id);
|
|
704
1038
|
|
|
705
1039
|
/**
|
|
706
|
-
*
|
|
1040
|
+
* Generates and returns an ephemeral address for one-time use, such as when receiving a swap from
|
|
1041
|
+
* a decentralized exchange.
|
|
707
1042
|
*
|
|
708
1043
|
* # Safety
|
|
709
1044
|
*
|
|
@@ -713,17 +1048,31 @@ char *zcashlc_spending_key_to_full_viewing_key(const uint8_t *usk_ptr,
|
|
|
713
1048
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
714
1049
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
715
1050
|
* documentation of pointer::offset.
|
|
716
|
-
* -
|
|
1051
|
+
* - `account_uuid_bytes` must be non-null and valid for reads for 16 bytes, and it must have an
|
|
1052
|
+
* alignment of `1`.
|
|
1053
|
+
* - The memory referenced by `account_uuid_bytes` must not be mutated for the duration of the
|
|
1054
|
+
* function call.
|
|
1055
|
+
* - Call [`zcashlc_free_single_use_address`] to free the memory associated with the returned pointer
|
|
717
1056
|
* when done using it.
|
|
718
1057
|
*/
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
1058
|
+
struct FfiSingleUseTaddr *zcashlc_get_single_use_taddr(const uint8_t *db_data,
|
|
1059
|
+
uintptr_t db_data_len,
|
|
1060
|
+
uint32_t network_id,
|
|
1061
|
+
const uint8_t *account_uuid_bytes);
|
|
723
1062
|
|
|
724
1063
|
/**
|
|
725
1064
|
* Returns a newly-generated unified payment address for the specified account, with the next
|
|
726
|
-
* available diversifier.
|
|
1065
|
+
* available diversifier and the specified set of receivers.
|
|
1066
|
+
*
|
|
1067
|
+
* The set of receivers to include in the generated address is specified by a byte which may have
|
|
1068
|
+
* any of the following bits set:
|
|
1069
|
+
* * P2PKH = 0b00000001
|
|
1070
|
+
* * SAPLING = 0b00000100
|
|
1071
|
+
* * ORCHARD = 0b00001000
|
|
1072
|
+
*
|
|
1073
|
+
* For each bit set, a corresponding receiver will be required to be generated. If no
|
|
1074
|
+
* corresponding viewing key exists in the wallet for a required receiver, this will return an
|
|
1075
|
+
* error. At present, p2pkh-only unified addresses are not supported.
|
|
727
1076
|
*
|
|
728
1077
|
* # Safety
|
|
729
1078
|
*
|
|
@@ -733,17 +1082,23 @@ char *zcashlc_get_current_address(const uint8_t *db_data,
|
|
|
733
1082
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
734
1083
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
735
1084
|
* documentation of pointer::offset.
|
|
1085
|
+
* - `account_uuid_bytes` must be non-null and valid for reads for 16 bytes, and it must have an
|
|
1086
|
+
* alignment of `1`.
|
|
1087
|
+
* - The memory referenced by `account_uuid_bytes` must not be mutated for the duration of the
|
|
1088
|
+
* function call.
|
|
736
1089
|
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
737
1090
|
* when done using it.
|
|
738
1091
|
*/
|
|
739
1092
|
char *zcashlc_get_next_available_address(const uint8_t *db_data,
|
|
740
1093
|
uintptr_t db_data_len,
|
|
741
|
-
|
|
742
|
-
uint32_t network_id
|
|
1094
|
+
const uint8_t *account_uuid_bytes,
|
|
1095
|
+
uint32_t network_id,
|
|
1096
|
+
uint32_t receiver_flags);
|
|
743
1097
|
|
|
744
1098
|
/**
|
|
745
|
-
* Returns a list of the transparent
|
|
746
|
-
*
|
|
1099
|
+
* Returns a list of the transparent addresses that have been allocated for the provided account,
|
|
1100
|
+
* including potentially-unrevealed public-scope and private-scope (change) addresses within the
|
|
1101
|
+
* gap limit, which is currently set to 10 for public-scope addresses and 5 for change addresses.
|
|
747
1102
|
*
|
|
748
1103
|
* # Safety
|
|
749
1104
|
*
|
|
@@ -753,144 +1108,42 @@ char *zcashlc_get_next_available_address(const uint8_t *db_data,
|
|
|
753
1108
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
754
1109
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
755
1110
|
* documentation of pointer::offset.
|
|
1111
|
+
* - `account_uuid_bytes` must be non-null and valid for reads for 16 bytes, and it must have an
|
|
1112
|
+
* alignment of `1`.
|
|
1113
|
+
* - The memory referenced by `account_uuid_bytes` must not be mutated for the duration of the
|
|
1114
|
+
* function call.
|
|
756
1115
|
* - Call [`zcashlc_free_keys`] to free the memory associated with the returned pointer
|
|
757
1116
|
* when done using it.
|
|
758
1117
|
*/
|
|
759
1118
|
struct FFIEncodedKeys *zcashlc_list_transparent_receivers(const uint8_t *db_data,
|
|
760
1119
|
uintptr_t db_data_len,
|
|
761
|
-
|
|
1120
|
+
const uint8_t *account_uuid_bytes,
|
|
762
1121
|
uint32_t network_id);
|
|
763
1122
|
|
|
764
1123
|
/**
|
|
765
|
-
*
|
|
766
|
-
*
|
|
767
|
-
* Returns a pointer to a slice of typecodes. `len_ret` is set to the length of the
|
|
768
|
-
* slice.
|
|
769
|
-
*
|
|
770
|
-
* See the following sections of ZIP 316 for details on how to interpret typecodes:
|
|
771
|
-
* - [List of known typecodes](https://zips.z.cash/zip-0316#encoding-of-unified-addresses)
|
|
772
|
-
* - [Adding new types](https://zips.z.cash/zip-0316#adding-new-types)
|
|
773
|
-
* - [Metadata Items](https://zips.z.cash/zip-0316#metadata-items)
|
|
1124
|
+
* Returns the verified transparent balance for `address`, which ignores utxos that have been
|
|
1125
|
+
* received too recently and are not yet deemed spendable according to `confirmations_policy`.
|
|
774
1126
|
*
|
|
775
1127
|
* # Safety
|
|
776
1128
|
*
|
|
777
|
-
* - `
|
|
778
|
-
*
|
|
779
|
-
*
|
|
780
|
-
*
|
|
1129
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
1130
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
1131
|
+
* operating system's preferred representation.
|
|
1132
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
1133
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1134
|
+
* documentation of pointer::offset.
|
|
1135
|
+
* - `address` must be non-null and must point to a null-terminated UTF-8 string.
|
|
1136
|
+
* - The memory referenced by `address` must not be mutated for the duration of the function call.
|
|
781
1137
|
*/
|
|
782
|
-
|
|
1138
|
+
int64_t zcashlc_get_verified_transparent_balance(const uint8_t *db_data,
|
|
1139
|
+
uintptr_t db_data_len,
|
|
1140
|
+
const char *address,
|
|
1141
|
+
uint32_t network_id,
|
|
1142
|
+
struct ConfirmationsPolicy confirmations_policy);
|
|
783
1143
|
|
|
784
1144
|
/**
|
|
785
|
-
*
|
|
786
|
-
*
|
|
787
|
-
* # Safety
|
|
788
|
-
*
|
|
789
|
-
* - `data` and `len` must have been obtained from
|
|
790
|
-
* [`zcashlc_get_typecodes_for_unified_address_receivers`].
|
|
791
|
-
*/
|
|
792
|
-
void zcashlc_free_typecodes(uint32_t *data, uintptr_t len);
|
|
793
|
-
|
|
794
|
-
/**
|
|
795
|
-
* Returns the transparent receiver within the given Unified Address, if any.
|
|
796
|
-
*
|
|
797
|
-
* # Safety
|
|
798
|
-
*
|
|
799
|
-
* - `ua` must be non-null and must point to a null-terminated UTF-8 string.
|
|
800
|
-
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
801
|
-
* when done using it.
|
|
802
|
-
*/
|
|
803
|
-
char *zcashlc_get_transparent_receiver_for_unified_address(const char *ua);
|
|
804
|
-
|
|
805
|
-
/**
|
|
806
|
-
* Returns the Sapling receiver within the given Unified Address, if any.
|
|
807
|
-
*
|
|
808
|
-
* # Safety
|
|
809
|
-
*
|
|
810
|
-
* - `ua` must be non-null and must point to a null-terminated UTF-8 string.
|
|
811
|
-
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
812
|
-
* when done using it.
|
|
813
|
-
*/
|
|
814
|
-
char *zcashlc_get_sapling_receiver_for_unified_address(const char *ua);
|
|
815
|
-
|
|
816
|
-
/**
|
|
817
|
-
* Returns the network type and address kind for the given address string,
|
|
818
|
-
* if the address is a valid Zcash address.
|
|
819
|
-
*
|
|
820
|
-
* Address kind codes are as follows:
|
|
821
|
-
* * p2pkh: 0
|
|
822
|
-
* * p2sh: 1
|
|
823
|
-
* * sapling: 2
|
|
824
|
-
* * unified: 3
|
|
825
|
-
* * tex: 4
|
|
826
|
-
*
|
|
827
|
-
* # Safety
|
|
828
|
-
*
|
|
829
|
-
* - `address` must be non-null and must point to a null-terminated UTF-8 string.
|
|
830
|
-
* - The memory referenced by `address` must not be mutated for the duration of the function call.
|
|
831
|
-
*/
|
|
832
|
-
bool zcashlc_get_address_metadata(const char *address,
|
|
833
|
-
uint32_t *network_id_ret,
|
|
834
|
-
uint32_t *addr_kind_ret);
|
|
835
|
-
|
|
836
|
-
/**
|
|
837
|
-
* Returns true when the provided key decodes to a valid Sapling extended spending key for the
|
|
838
|
-
* specified network, false in any other case.
|
|
839
|
-
*
|
|
840
|
-
* # Safety
|
|
841
|
-
*
|
|
842
|
-
* - `extsk` must be non-null and must point to a null-terminated UTF-8 string.
|
|
843
|
-
* - The memory referenced by `extsk` must not be mutated for the duration of the function call.
|
|
844
|
-
*/
|
|
845
|
-
bool zcashlc_is_valid_sapling_extended_spending_key(const char *extsk, uint32_t network_id);
|
|
846
|
-
|
|
847
|
-
/**
|
|
848
|
-
* Returns true when the provided key decodes to a valid Sapling extended full viewing key for the
|
|
849
|
-
* specified network, false in any other case.
|
|
850
|
-
*
|
|
851
|
-
* # Safety
|
|
852
|
-
*
|
|
853
|
-
* - `key` must be non-null and must point to a null-terminated UTF-8 string.
|
|
854
|
-
* - The memory referenced by `key` must not be mutated for the duration of the function call.
|
|
855
|
-
*/
|
|
856
|
-
bool zcashlc_is_valid_viewing_key(const char *key, uint32_t network_id);
|
|
857
|
-
|
|
858
|
-
/**
|
|
859
|
-
* Returns true when the provided key decodes to a valid unified full viewing key for the
|
|
860
|
-
* specified network, false in any other case.
|
|
861
|
-
*
|
|
862
|
-
* # Safety
|
|
863
|
-
*
|
|
864
|
-
* - `ufvk` must be non-null and must point to a null-terminated UTF-8 string.
|
|
865
|
-
* - The memory referenced by `ufvk` must not be mutated for the duration of the
|
|
866
|
-
* function call.
|
|
867
|
-
*/
|
|
868
|
-
bool zcashlc_is_valid_unified_full_viewing_key(const char *ufvk, uint32_t network_id);
|
|
869
|
-
|
|
870
|
-
/**
|
|
871
|
-
* Returns the verified transparent balance for `address`, which ignores utxos that have been
|
|
872
|
-
* received too recently and are not yet deemed spendable according to `min_confirmations`.
|
|
873
|
-
*
|
|
874
|
-
* # Safety
|
|
875
|
-
*
|
|
876
|
-
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
877
|
-
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
878
|
-
* operating system's preferred representation.
|
|
879
|
-
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
880
|
-
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
881
|
-
* documentation of pointer::offset.
|
|
882
|
-
* - `address` must be non-null and must point to a null-terminated UTF-8 string.
|
|
883
|
-
* - The memory referenced by `address` must not be mutated for the duration of the function call.
|
|
884
|
-
*/
|
|
885
|
-
int64_t zcashlc_get_verified_transparent_balance(const uint8_t *db_data,
|
|
886
|
-
uintptr_t db_data_len,
|
|
887
|
-
const char *address,
|
|
888
|
-
uint32_t network_id,
|
|
889
|
-
uint32_t min_confirmations);
|
|
890
|
-
|
|
891
|
-
/**
|
|
892
|
-
* Returns the verified transparent balance for `account`, which ignores utxos that have been
|
|
893
|
-
* received too recently and are not yet deemed spendable according to `min_confirmations`.
|
|
1145
|
+
* Returns the verified transparent balance for `account`, which ignores utxos that have been
|
|
1146
|
+
* received too recently and are not yet deemed spendable according to `confirmations_policy`.
|
|
894
1147
|
*
|
|
895
1148
|
* # Safety
|
|
896
1149
|
*
|
|
@@ -900,14 +1153,16 @@ int64_t zcashlc_get_verified_transparent_balance(const uint8_t *db_data,
|
|
|
900
1153
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
901
1154
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
902
1155
|
* documentation of pointer::offset.
|
|
903
|
-
* - `
|
|
904
|
-
*
|
|
1156
|
+
* - `account_uuid_bytes` must be non-null and valid for reads for 16 bytes, and it must have an
|
|
1157
|
+
* alignment of `1`.
|
|
1158
|
+
* - The memory referenced by `account_uuid_bytes` must not be mutated for the duration of the
|
|
1159
|
+
* function call.
|
|
905
1160
|
*/
|
|
906
1161
|
int64_t zcashlc_get_verified_transparent_balance_for_account(const uint8_t *db_data,
|
|
907
1162
|
uintptr_t db_data_len,
|
|
908
1163
|
uint32_t network_id,
|
|
909
|
-
|
|
910
|
-
|
|
1164
|
+
const uint8_t *account_uuid_bytes,
|
|
1165
|
+
struct ConfirmationsPolicy confirmations_policy);
|
|
911
1166
|
|
|
912
1167
|
/**
|
|
913
1168
|
* Returns the balance for `address`, including all UTXOs that we know about.
|
|
@@ -939,13 +1194,15 @@ int64_t zcashlc_get_total_transparent_balance(const uint8_t *db_data,
|
|
|
939
1194
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
940
1195
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
941
1196
|
* documentation of pointer::offset.
|
|
942
|
-
* - `
|
|
943
|
-
*
|
|
1197
|
+
* - `account_uuid_bytes` must be non-null and valid for reads for 16 bytes, and it must have an
|
|
1198
|
+
* alignment of `1`.
|
|
1199
|
+
* - The memory referenced by `account_uuid_bytes` must not be mutated for the duration of the
|
|
1200
|
+
* function call.
|
|
944
1201
|
*/
|
|
945
1202
|
int64_t zcashlc_get_total_transparent_balance_for_account(const uint8_t *db_data,
|
|
946
1203
|
uintptr_t db_data_len,
|
|
947
1204
|
uint32_t network_id,
|
|
948
|
-
|
|
1205
|
+
const uint8_t *account_uuid_bytes);
|
|
949
1206
|
|
|
950
1207
|
/**
|
|
951
1208
|
* Returns the memo for a note by copying the corresponding bytes to the received
|
|
@@ -971,28 +1228,6 @@ bool zcashlc_get_memo(const uint8_t *db_data,
|
|
|
971
1228
|
uint8_t *memo_bytes_ret,
|
|
972
1229
|
uint32_t network_id);
|
|
973
1230
|
|
|
974
|
-
/**
|
|
975
|
-
* Returns the memo for a note, if it is known and a valid UTF-8 string.
|
|
976
|
-
*
|
|
977
|
-
* # Safety
|
|
978
|
-
*
|
|
979
|
-
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
980
|
-
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
981
|
-
* operating system's preferred representation.
|
|
982
|
-
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
983
|
-
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
984
|
-
* documentation of pointer::offset.
|
|
985
|
-
* - `txid_bytes` must be non-null and valid for reads for 32 bytes, and it must have an alignment
|
|
986
|
-
* of `1`.
|
|
987
|
-
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
988
|
-
* when done using it.
|
|
989
|
-
*/
|
|
990
|
-
char *zcashlc_get_memo_as_utf8(const uint8_t *db_data,
|
|
991
|
-
uintptr_t db_data_len,
|
|
992
|
-
const uint8_t *txid_bytes,
|
|
993
|
-
uint16_t output_index,
|
|
994
|
-
uint32_t network_id);
|
|
995
|
-
|
|
996
1231
|
/**
|
|
997
1232
|
* Returns a ZIP-32 signature of the given seed bytes.
|
|
998
1233
|
*
|
|
@@ -1163,31 +1398,13 @@ int64_t zcashlc_max_scanned_height(const uint8_t *db_data,
|
|
|
1163
1398
|
* function call.
|
|
1164
1399
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1165
1400
|
* documentation of pointer::offset.
|
|
1401
|
+
* - Call [`zcashlc_free_wallet_summary`] to free the memory associated with the returned
|
|
1402
|
+
* pointer when done using it.
|
|
1166
1403
|
*/
|
|
1167
1404
|
struct FfiWalletSummary *zcashlc_get_wallet_summary(const uint8_t *db_data,
|
|
1168
1405
|
uintptr_t db_data_len,
|
|
1169
1406
|
uint32_t network_id,
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
/**
|
|
1173
|
-
* Frees an [`FfiWalletSummary`] value.
|
|
1174
|
-
*
|
|
1175
|
-
* # Safety
|
|
1176
|
-
*
|
|
1177
|
-
* - `ptr` must be non-null and must point to a struct having the layout of [`FfiWalletSummary`].
|
|
1178
|
-
* See the safety documentation of [`FfiWalletSummary`].
|
|
1179
|
-
*/
|
|
1180
|
-
void zcashlc_free_wallet_summary(struct FfiWalletSummary *ptr);
|
|
1181
|
-
|
|
1182
|
-
/**
|
|
1183
|
-
* Frees an array of FfiScanRanges values as allocated by `zcashlc_derive_unified_viewing_keys_from_seed`
|
|
1184
|
-
*
|
|
1185
|
-
* # Safety
|
|
1186
|
-
*
|
|
1187
|
-
* - `ptr` must be non-null and must point to a struct having the layout of [`FfiScanRanges`].
|
|
1188
|
-
* See the safety documentation of [`FfiScanRanges`].
|
|
1189
|
-
*/
|
|
1190
|
-
void zcashlc_free_scan_ranges(struct FfiScanRanges *ptr);
|
|
1407
|
+
struct ConfirmationsPolicy confirmations_policy);
|
|
1191
1408
|
|
|
1192
1409
|
/**
|
|
1193
1410
|
* Returns a list of suggested scan ranges based upon the current wallet state.
|
|
@@ -1256,15 +1473,6 @@ struct FfiScanSummary *zcashlc_scan_blocks(const uint8_t *fs_block_cache_root,
|
|
|
1256
1473
|
uint32_t scan_limit,
|
|
1257
1474
|
uint32_t network_id);
|
|
1258
1475
|
|
|
1259
|
-
/**
|
|
1260
|
-
* Frees an [`FfiScanSummary`] value.
|
|
1261
|
-
*
|
|
1262
|
-
* # Safety
|
|
1263
|
-
*
|
|
1264
|
-
* - `ptr` must be non-null and must point to a struct having the layout of [`FfiScanSummary`].
|
|
1265
|
-
*/
|
|
1266
|
-
void zcashlc_free_scan_summary(struct FfiScanSummary *ptr);
|
|
1267
|
-
|
|
1268
1476
|
/**
|
|
1269
1477
|
* Inserts a UTXO into the wallet database.
|
|
1270
1478
|
*
|
|
@@ -1331,8 +1539,8 @@ bool zcashlc_init_block_metadata_db(const uint8_t *fs_block_db_root,
|
|
|
1331
1539
|
* - The total size `fs_block_db_root_len` must be no larger than `isize::MAX`. See the safety
|
|
1332
1540
|
* documentation of pointer::offset.
|
|
1333
1541
|
* - Block metadata represented in `blocks_meta` must be non-null. Caller must guarantee that the
|
|
1334
|
-
*
|
|
1335
|
-
* is invoked.
|
|
1542
|
+
* memory reference by this pointer is not freed up, dereferenced or invalidated while this
|
|
1543
|
+
* function is invoked.
|
|
1336
1544
|
*/
|
|
1337
1545
|
bool zcashlc_write_block_metadata(const uint8_t *fs_block_db_root,
|
|
1338
1546
|
uintptr_t fs_block_db_root_len,
|
|
@@ -1395,23 +1603,16 @@ int32_t zcashlc_latest_cached_block_height(const uint8_t *fs_block_db_root,
|
|
|
1395
1603
|
* - The memory referenced by `tx` must not be mutated for the duration of the function call.
|
|
1396
1604
|
* - The total size `tx_len` must be no larger than `isize::MAX`. See the safety
|
|
1397
1605
|
* documentation of pointer::offset.
|
|
1606
|
+
* - `txid_ret` must be non-null and valid for writes of 32 bytes with an alignment of 1.
|
|
1607
|
+
* On successful execution this will contain the txid of the decrypted transaction.
|
|
1398
1608
|
*/
|
|
1399
1609
|
int32_t zcashlc_decrypt_and_store_transaction(const uint8_t *db_data,
|
|
1400
1610
|
uintptr_t db_data_len,
|
|
1401
1611
|
const uint8_t *tx,
|
|
1402
1612
|
uintptr_t tx_len,
|
|
1403
1613
|
int64_t mined_height,
|
|
1404
|
-
uint32_t network_id
|
|
1405
|
-
|
|
1406
|
-
/**
|
|
1407
|
-
* Frees an [`FfiBoxedSlice`].
|
|
1408
|
-
*
|
|
1409
|
-
* # Safety
|
|
1410
|
-
*
|
|
1411
|
-
* - `ptr` must be non-null and must point to a struct having the layout of
|
|
1412
|
-
* [`FfiBoxedSlice`]. See the safety documentation of [`FfiBoxedSlice`].
|
|
1413
|
-
*/
|
|
1414
|
-
void zcashlc_free_boxed_slice(struct FfiBoxedSlice *ptr);
|
|
1614
|
+
uint32_t network_id,
|
|
1615
|
+
uint8_t *txid_ret);
|
|
1415
1616
|
|
|
1416
1617
|
/**
|
|
1417
1618
|
* Select transaction inputs, compute fees, and construct a proposal for a transaction
|
|
@@ -1426,21 +1627,56 @@ void zcashlc_free_boxed_slice(struct FfiBoxedSlice *ptr);
|
|
|
1426
1627
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
1427
1628
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1428
1629
|
* documentation of pointer::offset.
|
|
1630
|
+
* - `account_uuid_bytes` must be non-null and valid for reads for 16 bytes, and it must have an alignment
|
|
1631
|
+
* of `1`.
|
|
1632
|
+
* - The memory referenced by `account_uuid_bytes` must not be mutated for the duration of the
|
|
1633
|
+
* function call.
|
|
1429
1634
|
* - `to` must be non-null and must point to a null-terminated UTF-8 string.
|
|
1430
1635
|
* - `memo` must either be null (indicating an empty memo or a transparent recipient) or point to a
|
|
1431
|
-
*
|
|
1636
|
+
* 512-byte array.
|
|
1432
1637
|
* - Call [`zcashlc_free_boxed_slice`] to free the memory associated with the returned
|
|
1433
1638
|
* pointer when done using it.
|
|
1434
1639
|
*/
|
|
1435
1640
|
struct FfiBoxedSlice *zcashlc_propose_transfer(const uint8_t *db_data,
|
|
1436
1641
|
uintptr_t db_data_len,
|
|
1437
|
-
|
|
1642
|
+
const uint8_t *account_uuid_bytes,
|
|
1438
1643
|
const char *to,
|
|
1439
1644
|
int64_t value,
|
|
1440
1645
|
const uint8_t *memo,
|
|
1441
1646
|
uint32_t network_id,
|
|
1442
|
-
|
|
1443
|
-
|
|
1647
|
+
struct ConfirmationsPolicy confirmations_policy);
|
|
1648
|
+
|
|
1649
|
+
/**
|
|
1650
|
+
* Selects all spendable transaction inputs, computes fees, and constructs a proposal for a transaction
|
|
1651
|
+
* that can then be authorized and made ready for submission to the network with
|
|
1652
|
+
* `zcashlc_create_proposed_transaction`.
|
|
1653
|
+
*
|
|
1654
|
+
* # Safety
|
|
1655
|
+
*
|
|
1656
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
1657
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
1658
|
+
* operating system's preferred representation.
|
|
1659
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
1660
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1661
|
+
* documentation of pointer::offset.
|
|
1662
|
+
* - `account_uuid_bytes` must be non-null and valid for reads for 16 bytes, and it must have an alignment
|
|
1663
|
+
* of `1`.
|
|
1664
|
+
* - The memory referenced by `account_uuid_bytes` must not be mutated for the duration of the
|
|
1665
|
+
* function call.
|
|
1666
|
+
* - `to` must be non-null and must point to a null-terminated UTF-8 string.
|
|
1667
|
+
* - `memo` must either be null (indicating an empty memo or a transparent recipient) or point to a
|
|
1668
|
+
* 512-byte array.
|
|
1669
|
+
* - Call [`zcashlc_free_boxed_slice`] to free the memory associated with the returned
|
|
1670
|
+
* pointer when done using it.
|
|
1671
|
+
*/
|
|
1672
|
+
struct FfiBoxedSlice *zcashlc_propose_send_max_transfer(const uint8_t *db_data,
|
|
1673
|
+
uintptr_t db_data_len,
|
|
1674
|
+
uint32_t network_id,
|
|
1675
|
+
const uint8_t *account_uuid_bytes,
|
|
1676
|
+
const char *to,
|
|
1677
|
+
const uint8_t *memo,
|
|
1678
|
+
enum FfiMaxSpendMode mode,
|
|
1679
|
+
struct ConfirmationsPolicy confirmations_policy);
|
|
1444
1680
|
|
|
1445
1681
|
/**
|
|
1446
1682
|
* Select transaction inputs, compute fees, and construct a proposal for a transaction
|
|
@@ -1455,20 +1691,23 @@ struct FfiBoxedSlice *zcashlc_propose_transfer(const uint8_t *db_data,
|
|
|
1455
1691
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
1456
1692
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1457
1693
|
* documentation of pointer::offset.
|
|
1694
|
+
* - `account_uuid_bytes` must be non-null and valid for reads for 16 bytes, and it must have an alignment
|
|
1695
|
+
* of `1`.
|
|
1696
|
+
* - The memory referenced by `account_uuid_bytes` must not be mutated for the duration of the
|
|
1697
|
+
* function call.
|
|
1458
1698
|
* - `payment_uri` must be non-null and must point to a null-terminated UTF-8 string.
|
|
1459
1699
|
* - `network_id` a u32. 0 for Testnet and 1 for Mainnet
|
|
1460
|
-
* - `
|
|
1700
|
+
* - `confirmations_policy` number of trusted/untrusted confirmations of the funds to spend
|
|
1461
1701
|
* - `use_zip317_fees` `true` to use ZIP-317 fees.
|
|
1462
1702
|
* - Call [`zcashlc_free_boxed_slice`] to free the memory associated with the returned
|
|
1463
1703
|
* pointer when done using it.
|
|
1464
1704
|
*/
|
|
1465
1705
|
struct FfiBoxedSlice *zcashlc_propose_transfer_from_uri(const uint8_t *db_data,
|
|
1466
1706
|
uintptr_t db_data_len,
|
|
1467
|
-
|
|
1707
|
+
const uint8_t *account_uuid_bytes,
|
|
1468
1708
|
const char *payment_uri,
|
|
1469
1709
|
uint32_t network_id,
|
|
1470
|
-
|
|
1471
|
-
bool use_zip317_fees);
|
|
1710
|
+
struct ConfirmationsPolicy confirmations_policy);
|
|
1472
1711
|
|
|
1473
1712
|
int32_t zcashlc_branch_id_for_height(int32_t height, uint32_t network_id);
|
|
1474
1713
|
|
|
@@ -1484,7 +1723,29 @@ void zcashlc_string_free(char *s);
|
|
|
1484
1723
|
/**
|
|
1485
1724
|
* Select transaction inputs, compute fees, and construct a proposal for a shielding
|
|
1486
1725
|
* transaction that can then be authorized and made ready for submission to the network
|
|
1487
|
-
* with `zcashlc_create_proposed_transaction`.
|
|
1726
|
+
* with `zcashlc_create_proposed_transaction`. If there are no receivers (as selected
|
|
1727
|
+
* by `transparent_receiver`) for which at least `shielding_threshold` of value is
|
|
1728
|
+
* available to shield, fail with an error.
|
|
1729
|
+
*
|
|
1730
|
+
* # Parameters
|
|
1731
|
+
*
|
|
1732
|
+
* - db_data: A string represented as a sequence of UTF-8 bytes.
|
|
1733
|
+
* - db_data_len: The length of `db_data`, in bytes.
|
|
1734
|
+
* - account_uuid_bytes: a 16-byte array representing the UUID for an account
|
|
1735
|
+
* - memo: `null` to represent "no memo", or a pointer to an array containing exactly 512 bytes.
|
|
1736
|
+
* - shielding_threshold: the minimum value to be shielded for each receiver.
|
|
1737
|
+
* - transparent_receiver: `null` to represent "all receivers with shieldable funds", or a single
|
|
1738
|
+
* transparent address for which to shield funds. WARNING: Note that calling this with `null`
|
|
1739
|
+
* will leak the fact that all the addresses from which funds are drawn in the shielding
|
|
1740
|
+
* transaction belong to the same wallet *ON CHAIN*. This immutably reveals the shared ownership
|
|
1741
|
+
* of these addresses to all blockchain observers. If a caller wishes to avoid such linkability,
|
|
1742
|
+
* they should not pass `null` for this parameter; however, note that temporal correlations can
|
|
1743
|
+
* also heuristically be used to link addresses on-chain if funds from multiple addresses are
|
|
1744
|
+
* individually shielded in transactions that may be temporally clustered. Keeping transparent
|
|
1745
|
+
* activity private is very difficult; caveat emptor.
|
|
1746
|
+
* - network_id: The identifier for the network in use: 0 for testnet, 1 for mainnet.
|
|
1747
|
+
* - confirmations_policy: The minimum number of confirmations that are required for a UTXO to be considered
|
|
1748
|
+
* for shielding.
|
|
1488
1749
|
*
|
|
1489
1750
|
* # Safety
|
|
1490
1751
|
*
|
|
@@ -1494,29 +1755,22 @@ void zcashlc_string_free(char *s);
|
|
|
1494
1755
|
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
1495
1756
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1496
1757
|
* documentation of pointer::offset.
|
|
1758
|
+
* - `account_uuid_bytes` must be non-null and valid for reads for 16 bytes, and it must have an alignment
|
|
1759
|
+
* of `1`.
|
|
1760
|
+
* - The memory referenced by `account_uuid_bytes` must not be mutated for the duration of the
|
|
1761
|
+
* function call.
|
|
1497
1762
|
* - `shielding_threshold` a non-negative shielding threshold amount in zatoshi
|
|
1498
1763
|
* - Call [`zcashlc_free_boxed_slice`] to free the memory associated with the returned
|
|
1499
1764
|
* pointer when done using it.
|
|
1500
1765
|
*/
|
|
1501
1766
|
struct FfiBoxedSlice *zcashlc_propose_shielding(const uint8_t *db_data,
|
|
1502
1767
|
uintptr_t db_data_len,
|
|
1503
|
-
|
|
1768
|
+
const uint8_t *account_uuid_bytes,
|
|
1504
1769
|
const uint8_t *memo,
|
|
1505
1770
|
uint64_t shielding_threshold,
|
|
1506
1771
|
const char *transparent_receiver,
|
|
1507
1772
|
uint32_t network_id,
|
|
1508
|
-
|
|
1509
|
-
bool use_zip317_fees);
|
|
1510
|
-
|
|
1511
|
-
/**
|
|
1512
|
-
* Frees an array of FfiTxIds values as allocated by `zcashlc_create_proposed_transactions`.
|
|
1513
|
-
*
|
|
1514
|
-
* # Safety
|
|
1515
|
-
*
|
|
1516
|
-
* - `ptr` must be non-null and must point to a struct having the layout of [`FfiTxIds`].
|
|
1517
|
-
* See the safety documentation of [`FfiTxIds`].
|
|
1518
|
-
*/
|
|
1519
|
-
void zcashlc_free_txids(struct FfiTxIds *ptr);
|
|
1773
|
+
struct ConfirmationsPolicy confirmations_policy);
|
|
1520
1774
|
|
|
1521
1775
|
/**
|
|
1522
1776
|
* Creates a transaction from the given proposal.
|
|
@@ -1528,6 +1782,14 @@ void zcashlc_free_txids(struct FfiTxIds *ptr);
|
|
|
1528
1782
|
* Do not call this multiple times in parallel, or you will generate transactions that
|
|
1529
1783
|
* double-spend the same notes.
|
|
1530
1784
|
*
|
|
1785
|
+
* # Parameters
|
|
1786
|
+
* - `spend_params`: A pointer to a buffer containing the operating system path of the Sapling
|
|
1787
|
+
* spend proving parameters, in the operating system's preferred path representation.
|
|
1788
|
+
* - `spend_params_len`: the length of the `spend_params` buffer.
|
|
1789
|
+
* - `output_params`: A pointer to a buffer containing the operating system path of the Sapling
|
|
1790
|
+
* output proving parameters, in the operating system's preferred path representation.
|
|
1791
|
+
* - `output_params_len`: the length of the `output_params` buffer.
|
|
1792
|
+
*
|
|
1531
1793
|
* # Safety
|
|
1532
1794
|
*
|
|
1533
1795
|
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must
|
|
@@ -1550,94 +1812,297 @@ void zcashlc_free_txids(struct FfiTxIds *ptr);
|
|
|
1550
1812
|
* function call.
|
|
1551
1813
|
* - The total size `usk_len` must be no larger than `isize::MAX`. See the safety
|
|
1552
1814
|
* documentation of `pointer::offset`.
|
|
1553
|
-
* - `to` must be non-null and must point to a null-terminated UTF-8 string.
|
|
1554
|
-
* - `memo` must either be null (indicating an empty memo or a transparent recipient) or
|
|
1555
|
-
* point to a 512-byte array.
|
|
1556
1815
|
* - `spend_params` must be non-null and valid for reads for `spend_params_len` bytes,
|
|
1557
|
-
* and it must have an alignment of `1`.
|
|
1558
|
-
* parameters.
|
|
1816
|
+
* and it must have an alignment of `1`.
|
|
1559
1817
|
* - The memory referenced by `spend_params` must not be mutated for the duration of the
|
|
1560
1818
|
* function call.
|
|
1561
1819
|
* - The total size `spend_params_len` must be no larger than `isize::MAX`. See the safety
|
|
1562
1820
|
* documentation of `pointer::offset`.
|
|
1563
1821
|
* - `output_params` must be non-null and valid for reads for `output_params_len` bytes,
|
|
1564
|
-
* and it must have an alignment of `1`.
|
|
1565
|
-
* proving parameters.
|
|
1822
|
+
* and it must have an alignment of `1`.
|
|
1566
1823
|
* - The memory referenced by `output_params` must not be mutated for the duration of the
|
|
1567
1824
|
* function call.
|
|
1568
1825
|
* - The total size `output_params_len` must be no larger than `isize::MAX`. See the safety
|
|
1569
1826
|
* documentation of pointer::offset.
|
|
1570
1827
|
*/
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1828
|
+
FfiTxIds *zcashlc_create_proposed_transactions(const uint8_t *db_data,
|
|
1829
|
+
uintptr_t db_data_len,
|
|
1830
|
+
const uint8_t *proposal_ptr,
|
|
1831
|
+
uintptr_t proposal_len,
|
|
1832
|
+
const uint8_t *usk_ptr,
|
|
1833
|
+
uintptr_t usk_len,
|
|
1834
|
+
const uint8_t *spend_params,
|
|
1835
|
+
uintptr_t spend_params_len,
|
|
1836
|
+
const uint8_t *output_params,
|
|
1837
|
+
uintptr_t output_params_len,
|
|
1838
|
+
uint32_t network_id);
|
|
1582
1839
|
|
|
1583
1840
|
/**
|
|
1584
|
-
*
|
|
1841
|
+
* Creates a partially-constructed (unsigned without proofs) transaction from the given proposal.
|
|
1842
|
+
*
|
|
1843
|
+
* Returns the partially constructed transaction in the `postcard` format generated by the `pczt`
|
|
1844
|
+
* crate.
|
|
1845
|
+
*
|
|
1846
|
+
* Do not call this multiple times in parallel, or you will generate pczt instances that, if
|
|
1847
|
+
* finalized, would double-spend the same notes.
|
|
1848
|
+
*
|
|
1849
|
+
* # Parameters
|
|
1850
|
+
* - `db_data`: A pointer to a buffer containing the operating system path of the wallet database,
|
|
1851
|
+
* in the operating system's preferred path representation.
|
|
1852
|
+
* - `db_data_len`: The length of the `db_data` buffer.
|
|
1853
|
+
* - `proposal_ptr`: A pointer to a buffer containing an encoded `Proposal` protobuf.
|
|
1854
|
+
* - `proposal_len`: The length of the `proposal_ptr` buffer.
|
|
1855
|
+
* - `account_uuid_bytes`: A pointer to the 16-byte representaion of the account UUID.
|
|
1585
1856
|
*
|
|
1586
1857
|
* # Safety
|
|
1587
1858
|
*
|
|
1588
|
-
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must
|
|
1589
|
-
*
|
|
1590
|
-
*
|
|
1591
|
-
* - The memory referenced by `db_data` must not be mutated for the duration of the
|
|
1592
|
-
* function call.
|
|
1859
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
1860
|
+
* alignment of `1`.
|
|
1861
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
1593
1862
|
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
1594
|
-
* documentation of pointer::offset
|
|
1595
|
-
* - `
|
|
1596
|
-
* an alignment of `1`.
|
|
1597
|
-
* - The memory referenced by `
|
|
1863
|
+
* documentation of `pointer::offset`.
|
|
1864
|
+
* - `proposal_ptr` must be non-null and valid for reads for `proposal_len` bytes, and it
|
|
1865
|
+
* must have an alignment of `1`.
|
|
1866
|
+
* - The memory referenced by `proposal_ptr` must not be mutated for the duration of the
|
|
1598
1867
|
* function call.
|
|
1599
|
-
* - The total size `
|
|
1600
|
-
* documentation of pointer::offset
|
|
1868
|
+
* - The total size `proposal_len` must be no larger than `isize::MAX`. See the safety
|
|
1869
|
+
* documentation of `pointer::offset`.
|
|
1870
|
+
* - `account_uuid_bytes` must be non-null and valid for reads for 16 bytes, and it must have an
|
|
1871
|
+
* alignment of `1`.
|
|
1872
|
+
* - The memory referenced by `account_uuid_bytes` must not be mutated for the duration of the
|
|
1873
|
+
* function call.
|
|
1874
|
+
* - Call [`zcashlc_free_boxed_slice`] to free the memory associated with the returned
|
|
1875
|
+
* pointer when done using it.
|
|
1601
1876
|
*/
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1877
|
+
struct FfiBoxedSlice *zcashlc_create_pczt_from_proposal(const uint8_t *db_data,
|
|
1878
|
+
uintptr_t db_data_len,
|
|
1879
|
+
uint32_t network_id,
|
|
1880
|
+
const uint8_t *proposal_ptr,
|
|
1881
|
+
uintptr_t proposal_len,
|
|
1882
|
+
const uint8_t *account_uuid_bytes);
|
|
1608
1883
|
|
|
1609
1884
|
/**
|
|
1610
|
-
*
|
|
1885
|
+
* Redacts information from the given PCZT that is unnecessary for the Signer role.
|
|
1886
|
+
*
|
|
1887
|
+
* Returns the updated PCZT in its serialized format.
|
|
1888
|
+
*
|
|
1889
|
+
* # Parameters
|
|
1890
|
+
* - `pczt_ptr`: A pointer to a byte array containing the encoded partially-constructed
|
|
1891
|
+
* transaction to be redacted.
|
|
1892
|
+
* - `pczt_len`: The length of the `pczt_ptr` buffer.
|
|
1611
1893
|
*
|
|
1612
1894
|
* # Safety
|
|
1613
1895
|
*
|
|
1614
|
-
* - `
|
|
1615
|
-
*
|
|
1896
|
+
* - `pczt_ptr` must be non-null and valid for reads for `pczt_len` bytes, and it must have an
|
|
1897
|
+
* alignment of `1`.
|
|
1898
|
+
* - The memory referenced by `pczt_ptr` must not be mutated for the duration of the function
|
|
1899
|
+
* call.
|
|
1900
|
+
* - The total size `pczt_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
1901
|
+
* of `pointer::offset`.
|
|
1902
|
+
* - Call [`zcashlc_free_boxed_slice`] to free the memory associated with the returned
|
|
1903
|
+
* pointer when done using it.
|
|
1616
1904
|
*/
|
|
1617
|
-
|
|
1905
|
+
struct FfiBoxedSlice *zcashlc_redact_pczt_for_signer(const uint8_t *pczt_ptr, uintptr_t pczt_len);
|
|
1618
1906
|
|
|
1619
1907
|
/**
|
|
1620
|
-
* Returns
|
|
1908
|
+
* Returns `true` if this PCZT requires Sapling proofs (and thus the caller needs to have
|
|
1909
|
+
* downloaded them). If the PCZT is invalid, `false` will be returned.
|
|
1910
|
+
*
|
|
1911
|
+
* # Parameters
|
|
1912
|
+
* - `pczt_ptr`: A pointer to a byte array containing the encoded partially-constructed
|
|
1913
|
+
* transaction to be redacted.
|
|
1914
|
+
* - `pczt_len`: The length of the `pczt_ptr` buffer.
|
|
1621
1915
|
*
|
|
1622
1916
|
* # Safety
|
|
1623
1917
|
*
|
|
1624
|
-
* - `
|
|
1625
|
-
* alignment of `1`.
|
|
1626
|
-
*
|
|
1627
|
-
*
|
|
1628
|
-
* - The total size `
|
|
1629
|
-
*
|
|
1630
|
-
* - Call [`zcashlc_free_transaction_data_requests`] to free the memory associated with the
|
|
1631
|
-
* returned pointer when done using it.
|
|
1918
|
+
* - `pczt_ptr` must be non-null and valid for reads for `pczt_len` bytes, and it must have an
|
|
1919
|
+
* alignment of `1`.
|
|
1920
|
+
* - The memory referenced by `pczt_ptr` must not be mutated for the duration of the function
|
|
1921
|
+
* call.
|
|
1922
|
+
* - The total size `pczt_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
1923
|
+
* of `pointer::offset`.
|
|
1632
1924
|
*/
|
|
1633
|
-
|
|
1634
|
-
uintptr_t db_data_len,
|
|
1635
|
-
uint32_t network_id);
|
|
1925
|
+
bool zcashlc_pczt_requires_sapling_proofs(const uint8_t *pczt_ptr, uintptr_t pczt_len);
|
|
1636
1926
|
|
|
1637
1927
|
/**
|
|
1638
|
-
*
|
|
1928
|
+
* Adds proofs to the given PCZT.
|
|
1639
1929
|
*
|
|
1640
|
-
*
|
|
1930
|
+
* Returns the updated PCZT in its serialized format.
|
|
1931
|
+
*
|
|
1932
|
+
* # Parameters
|
|
1933
|
+
* - `pczt_ptr`: A pointer to a byte array containing the encoded partially-constructed
|
|
1934
|
+
* transaction for which proofs will be computed.
|
|
1935
|
+
* - `pczt_len`: The length of the `pczt_ptr` buffer.
|
|
1936
|
+
* - `spend_params`: A pointer to a buffer containing the operating system path of the Sapling
|
|
1937
|
+
* spend proving parameters, in the operating system's preferred path representation.
|
|
1938
|
+
* - `spend_params_len`: the length of the `spend_params` buffer.
|
|
1939
|
+
* - `output_params`: A pointer to a buffer containing the operating system path of the Sapling
|
|
1940
|
+
* output proving parameters, in the operating system's preferred path representation.
|
|
1941
|
+
* - `output_params_len`: the length of the `output_params` buffer.
|
|
1942
|
+
*
|
|
1943
|
+
* # Safety
|
|
1944
|
+
*
|
|
1945
|
+
* - `pczt_ptr` must be non-null and valid for reads for `pczt_len` bytes, and it must have an
|
|
1946
|
+
* alignment of `1`.
|
|
1947
|
+
* - The memory referenced by `pczt_ptr` must not be mutated for the duration of the function
|
|
1948
|
+
* call.
|
|
1949
|
+
* - The total size `pczt_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
1950
|
+
* of `pointer::offset`.
|
|
1951
|
+
* - `spend_params` must be non-null and valid for reads for `spend_params_len` bytes, and it must
|
|
1952
|
+
* have an alignment of `1`.
|
|
1953
|
+
* - The memory referenced by `spend_params` must not be mutated for the duration of the function
|
|
1954
|
+
* call.
|
|
1955
|
+
* - The total size `spend_params_len` must be no larger than `isize::MAX`. See the safety
|
|
1956
|
+
* documentation of `pointer::offset`.
|
|
1957
|
+
* - `output_params` must be non-null and valid for reads for `output_params_len` bytes, and it
|
|
1958
|
+
* must have an alignment of `1`.
|
|
1959
|
+
* - The memory referenced by `output_params` must not be mutated for the duration of the function
|
|
1960
|
+
* call.
|
|
1961
|
+
* - The total size `output_params_len` must be no larger than `isize::MAX`. See the safety
|
|
1962
|
+
* documentation of pointer::offset.
|
|
1963
|
+
* - Call [`zcashlc_free_boxed_slice`] to free the memory associated with the returned
|
|
1964
|
+
* pointer when done using it.
|
|
1965
|
+
*/
|
|
1966
|
+
struct FfiBoxedSlice *zcashlc_add_proofs_to_pczt(const uint8_t *pczt_ptr,
|
|
1967
|
+
uintptr_t pczt_len,
|
|
1968
|
+
const uint8_t *spend_params,
|
|
1969
|
+
uintptr_t spend_params_len,
|
|
1970
|
+
const uint8_t *output_params,
|
|
1971
|
+
uintptr_t output_params_len);
|
|
1972
|
+
|
|
1973
|
+
/**
|
|
1974
|
+
* Takes a PCZT that has been separately proven and signed, finalizes it, and stores it
|
|
1975
|
+
* in the wallet.
|
|
1976
|
+
*
|
|
1977
|
+
* Returns the txid of the completed transaction as a byte array.
|
|
1978
|
+
*
|
|
1979
|
+
* # Parameters
|
|
1980
|
+
* - `db_data`: A pointer to a buffer containing the operating system path of the wallet database,
|
|
1981
|
+
* in the operating system's preferred path representation.
|
|
1982
|
+
* - `db_data_len`: The length of the `db_data` buffer.
|
|
1983
|
+
* - `pczt_with_proofs`: A pointer to a byte array containing the encoded partially-constructed
|
|
1984
|
+
* transaction to which proofs have been added.
|
|
1985
|
+
* - `pczt_with_proofs_len`: The length of the `pczt_with_proofs` buffer.
|
|
1986
|
+
* - `pczt_with_sigs_ptr`: A pointer to a byte array containing the encoded partially-constructed
|
|
1987
|
+
* transaction to which signatures have been added.
|
|
1988
|
+
* - `pczt_with_sigs_len`: The length of the `pczt_with_sigs` buffer.
|
|
1989
|
+
* - `spend_params`: A pointer to a buffer containing the operating system path of the Sapling
|
|
1990
|
+
* spend proving parameters, in the operating system's preferred path representation.
|
|
1991
|
+
* - `spend_params_len`: the length of the `spend_params` buffer.
|
|
1992
|
+
* - `output_params`: A pointer to a buffer containing the operating system path of the Sapling
|
|
1993
|
+
* output proving parameters, in the operating system's preferred path representation.
|
|
1994
|
+
* - `output_params_len`: the length of the `output_params` buffer.
|
|
1995
|
+
*
|
|
1996
|
+
* # Safety
|
|
1997
|
+
*
|
|
1998
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
1999
|
+
* alignment of `1`.
|
|
2000
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
2001
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
2002
|
+
* documentation of `pointer::offset`.
|
|
2003
|
+
* - `pczt_with_proofs_ptr` must be non-null and valid for reads for `pczt_with_proofs_len` bytes,
|
|
2004
|
+
* and it must have an alignment of `1`.
|
|
2005
|
+
* - The memory referenced by `pczt_with_proofs_ptr` must not be mutated for the duration of the
|
|
2006
|
+
* function call.
|
|
2007
|
+
* - The total size `pczt_with_proofs_len` must be no larger than `isize::MAX`. See the safety
|
|
2008
|
+
* documentation of `pointer::offset`.
|
|
2009
|
+
* - `pczt_with_sigs_ptr` must be non-null and valid for reads for `pczt_with_sigs_len` bytes, and
|
|
2010
|
+
* it must have an alignment of `1`.
|
|
2011
|
+
* - The memory referenced by `pczt_with_sigs_ptr` must not be mutated for the duration of the
|
|
2012
|
+
* function call.
|
|
2013
|
+
* - The total size `pczt_with_sigs_len` must be no larger than `isize::MAX`. See the safety
|
|
2014
|
+
* documentation of `pointer::offset`.
|
|
2015
|
+
* - `spend_params` must either be null, or it must be valid for reads for `spend_params_len` bytes
|
|
2016
|
+
* and have an alignment of `1`.
|
|
2017
|
+
* - The memory referenced by `spend_params` must not be mutated for the duration of the function
|
|
2018
|
+
* call.
|
|
2019
|
+
* - The total size `spend_params_len` must be no larger than `isize::MAX`. See the safety
|
|
2020
|
+
* documentation of `pointer::offset`.
|
|
2021
|
+
* - `output_params` must either be null, or it must be valid for reads for `output_params_len`
|
|
2022
|
+
* bytes and have an alignment of `1`.
|
|
2023
|
+
* - The memory referenced by `output_params` must not be mutated for the duration of the function
|
|
2024
|
+
* call.
|
|
2025
|
+
* - The total size `output_params_len` must be no larger than `isize::MAX`. See the safety
|
|
2026
|
+
* documentation of pointer::offset.
|
|
2027
|
+
* - Call [`zcashlc_free_boxed_slice`] to free the memory associated with the returned pointer
|
|
2028
|
+
* when done using it.
|
|
2029
|
+
*/
|
|
2030
|
+
struct FfiBoxedSlice *zcashlc_extract_and_store_from_pczt(const uint8_t *db_data,
|
|
2031
|
+
uintptr_t db_data_len,
|
|
2032
|
+
uint32_t network_id,
|
|
2033
|
+
const uint8_t *pczt_with_proofs_ptr,
|
|
2034
|
+
uintptr_t pczt_with_proofs_len,
|
|
2035
|
+
const uint8_t *pczt_with_sigs_ptr,
|
|
2036
|
+
uintptr_t pczt_with_sigs_len,
|
|
2037
|
+
const uint8_t *spend_params,
|
|
2038
|
+
uintptr_t spend_params_len,
|
|
2039
|
+
const uint8_t *output_params,
|
|
2040
|
+
uintptr_t output_params_len);
|
|
2041
|
+
|
|
2042
|
+
/**
|
|
2043
|
+
* Sets the transaction status to the provided value.
|
|
2044
|
+
*
|
|
2045
|
+
* # Safety
|
|
2046
|
+
*
|
|
2047
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must
|
|
2048
|
+
* have an alignment of `1`. Its contents must be a string representing a valid system
|
|
2049
|
+
* path in the operating system's preferred representation.
|
|
2050
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the
|
|
2051
|
+
* function call.
|
|
2052
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
2053
|
+
* documentation of pointer::offset.
|
|
2054
|
+
* - `txid_bytes` must be non-null and valid for reads for `db_data_len` bytes, and it must have
|
|
2055
|
+
* an alignment of `1`.
|
|
2056
|
+
* - The memory referenced by `txid_bytes_len` must not be mutated for the duration of the
|
|
2057
|
+
* function call.
|
|
2058
|
+
* - The total size `txid_bytes_len` must be no larger than `isize::MAX`. See the safety
|
|
2059
|
+
* documentation of pointer::offset.
|
|
2060
|
+
*/
|
|
2061
|
+
void zcashlc_set_transaction_status(const uint8_t *db_data,
|
|
2062
|
+
uintptr_t db_data_len,
|
|
2063
|
+
uint32_t network_id,
|
|
2064
|
+
const uint8_t *txid_bytes,
|
|
2065
|
+
uintptr_t txid_bytes_len,
|
|
2066
|
+
struct FfiTransactionStatus status);
|
|
2067
|
+
|
|
2068
|
+
/**
|
|
2069
|
+
* Returns a list of transaction data requests that the network client should satisfy.
|
|
2070
|
+
*
|
|
2071
|
+
* # Safety
|
|
2072
|
+
*
|
|
2073
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
2074
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
2075
|
+
* operating system's preferred representation.
|
|
2076
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
2077
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
2078
|
+
* documentation of pointer::offset.
|
|
2079
|
+
* - Call [`zcashlc_free_transaction_data_requests`] to free the memory associated with the
|
|
2080
|
+
* returned pointer when done using it.
|
|
2081
|
+
*/
|
|
2082
|
+
struct FfiTransactionDataRequests *zcashlc_transaction_data_requests(const uint8_t *db_data,
|
|
2083
|
+
uintptr_t db_data_len,
|
|
2084
|
+
uint32_t network_id);
|
|
2085
|
+
|
|
2086
|
+
/**
|
|
2087
|
+
* Detects notes with corrupt witnesses, and adds the block ranges corresponding to the corrupt
|
|
2088
|
+
* ranges to the scan queue so that the ordinary scanning process will re-scan these ranges to fix
|
|
2089
|
+
* the corruption in question.
|
|
2090
|
+
*
|
|
2091
|
+
* # Safety
|
|
2092
|
+
*
|
|
2093
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
2094
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
2095
|
+
* operating system's preferred representation.
|
|
2096
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
2097
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
2098
|
+
* documentation of pointer::offset.
|
|
2099
|
+
*/
|
|
2100
|
+
void zcashlc_fix_witnesses(const uint8_t *db_data, uintptr_t db_data_len, uint32_t network_id);
|
|
2101
|
+
|
|
2102
|
+
/**
|
|
2103
|
+
* Creates a Tor runtime.
|
|
2104
|
+
*
|
|
2105
|
+
* # Safety
|
|
1641
2106
|
*
|
|
1642
2107
|
* - `tor_dir` must be non-null and valid for reads for `tor_dir_len` bytes, and it must
|
|
1643
2108
|
* have an alignment of `1`. Its contents must be a string representing a valid system
|
|
@@ -1656,10 +2121,127 @@ struct TorRuntime *zcashlc_create_tor_runtime(const uint8_t *tor_dir, uintptr_t
|
|
|
1656
2121
|
*
|
|
1657
2122
|
* # Safety
|
|
1658
2123
|
*
|
|
1659
|
-
* - If `ptr` is non-null, it must
|
|
2124
|
+
* - If `ptr` is non-null, it must be a pointer returned by a `zcashlc_*` method with
|
|
2125
|
+
* return type `*mut TorRuntime` that has not previously been freed.
|
|
1660
2126
|
*/
|
|
1661
2127
|
void zcashlc_free_tor_runtime(struct TorRuntime *ptr);
|
|
1662
2128
|
|
|
2129
|
+
/**
|
|
2130
|
+
* Returns a new isolated `TorRuntime` handle.
|
|
2131
|
+
*
|
|
2132
|
+
* The two `TorRuntime`s will share internal state and configuration, but their streams
|
|
2133
|
+
* will never share circuits with one another.
|
|
2134
|
+
*
|
|
2135
|
+
* Use this method when you want separate parts of your program to each have a
|
|
2136
|
+
* `TorRuntime` handle, but where you don't want their activities to be linkable to one
|
|
2137
|
+
* another over the Tor network.
|
|
2138
|
+
*
|
|
2139
|
+
* Calling this method is usually preferable to creating a completely separate
|
|
2140
|
+
* `TorRuntime` instance, since it can share its internals with the existing `TorRuntime`.
|
|
2141
|
+
*
|
|
2142
|
+
* # Safety
|
|
2143
|
+
*
|
|
2144
|
+
* - `tor_runtime` must be a non-null pointer returned by a `zcashlc_*` method with
|
|
2145
|
+
* return type `*mut TorRuntime` that has not previously been freed.
|
|
2146
|
+
* - `tor_runtime` must not be passed to two FFI calls at the same time.
|
|
2147
|
+
* - Call [`zcashlc_free_tor_runtime`] to free the memory associated with the returned
|
|
2148
|
+
* pointer when done using it.
|
|
2149
|
+
*/
|
|
2150
|
+
struct TorRuntime *zcashlc_tor_isolated_client(struct TorRuntime *tor_runtime);
|
|
2151
|
+
|
|
2152
|
+
/**
|
|
2153
|
+
* Changes the client's current dormant mode, putting background tasks to sleep or waking
|
|
2154
|
+
* them up as appropriate.
|
|
2155
|
+
*
|
|
2156
|
+
* This can be used to conserve CPU usage if you aren’t planning on using the client for
|
|
2157
|
+
* a while, especially on mobile platforms.
|
|
2158
|
+
*
|
|
2159
|
+
* See the [`ffi::TorDormantMode`] documentation for more details.
|
|
2160
|
+
*
|
|
2161
|
+
* # Safety
|
|
2162
|
+
*
|
|
2163
|
+
* - `tor_runtime` must be a non-null pointer returned by a `zcashlc_*` method with
|
|
2164
|
+
* return type `*mut TorRuntime` that has not previously been freed.
|
|
2165
|
+
* - `tor_runtime` must not be passed to two FFI calls at the same time.
|
|
2166
|
+
*/
|
|
2167
|
+
bool zcashlc_tor_set_dormant(struct TorRuntime *tor_runtime, enum TorDormantMode mode);
|
|
2168
|
+
|
|
2169
|
+
/**
|
|
2170
|
+
* Makes an HTTP GET request over Tor.
|
|
2171
|
+
*
|
|
2172
|
+
* `retry_limit` is the maximum number of times that a failed request should be retried.
|
|
2173
|
+
* You can disable retries by setting this to 0.
|
|
2174
|
+
*
|
|
2175
|
+
* # Safety
|
|
2176
|
+
*
|
|
2177
|
+
* - `tor_runtime` must be a non-null pointer returned by a `zcashlc_*` method with
|
|
2178
|
+
* return type `*mut TorRuntime` that has not previously been freed.
|
|
2179
|
+
* - `tor_runtime` must not be passed to two FFI calls at the same time.
|
|
2180
|
+
* - `url` must be non-null and must point to a null-terminated UTF-8 string.
|
|
2181
|
+
* - `headers` must be non-null and valid for reads for
|
|
2182
|
+
* `headers_len * size_of::<ffi::HttpRequestHeader>()` bytes, and it must be properly
|
|
2183
|
+
* aligned. This means in particular:
|
|
2184
|
+
* - The entire memory range of this slice must be contained within a single allocated
|
|
2185
|
+
* object! Slices can never span across multiple allocated objects.
|
|
2186
|
+
* - `headers` must be non-null and aligned even for zero-length slices.
|
|
2187
|
+
* - `headers` must point to `headers_len` consecutive properly initialized values of
|
|
2188
|
+
* type `ffi::HttpRequestHeader`.
|
|
2189
|
+
* - The memory referenced by `headers` must not be mutated for the duration of the function
|
|
2190
|
+
* call.
|
|
2191
|
+
* - The total size `headers_len * size_of::<ffi::HttpRequestHeader>()` of the slice must
|
|
2192
|
+
* be no larger than `isize::MAX`, and adding that size to `headers` must not "wrap
|
|
2193
|
+
* around" the address space. See the safety documentation of pointer::offset.
|
|
2194
|
+
* - Call [`zcashlc_free_http_response_bytes`] to free the memory associated with the
|
|
2195
|
+
* returned pointer when done using it.
|
|
2196
|
+
*/
|
|
2197
|
+
struct FfiHttpResponseBytes *zcashlc_tor_http_get(struct TorRuntime *tor_runtime,
|
|
2198
|
+
const char *url,
|
|
2199
|
+
const struct FfiHttpRequestHeader *headers,
|
|
2200
|
+
uintptr_t headers_len,
|
|
2201
|
+
uint8_t retry_limit);
|
|
2202
|
+
|
|
2203
|
+
/**
|
|
2204
|
+
* Makes an HTTP POST request over Tor.
|
|
2205
|
+
*
|
|
2206
|
+
* `retry_limit` is the maximum number of times that a failed request should be retried.
|
|
2207
|
+
* You can disable retries by setting this to 0.
|
|
2208
|
+
*
|
|
2209
|
+
* # Safety
|
|
2210
|
+
*
|
|
2211
|
+
* - `tor_runtime` must be a non-null pointer returned by a `zcashlc_*` method with
|
|
2212
|
+
* return type `*mut TorRuntime` that has not previously been freed.
|
|
2213
|
+
* - `tor_runtime` must not be passed to two FFI calls at the same time.
|
|
2214
|
+
* - `url` must be non-null and must point to a null-terminated UTF-8 string.
|
|
2215
|
+
* - `headers` must be non-null and valid for reads for
|
|
2216
|
+
* `headers_len * size_of::<ffi::HttpRequestHeader>()` bytes, and it must be properly
|
|
2217
|
+
* aligned. This means in particular:
|
|
2218
|
+
* - The entire memory range of this slice must be contained within a single allocated
|
|
2219
|
+
* object! Slices can never span across multiple allocated objects.
|
|
2220
|
+
* - `headers` must be non-null and aligned even for zero-length slices.
|
|
2221
|
+
* - `headers` must point to `headers_len` consecutive properly initialized values of
|
|
2222
|
+
* type `ffi::HttpRequestHeader`.
|
|
2223
|
+
* - The memory referenced by `headers` must not be mutated for the duration of the function
|
|
2224
|
+
* call.
|
|
2225
|
+
* - The total size `headers_len * size_of::<ffi::HttpRequestHeader>()` of the slice must
|
|
2226
|
+
* be no larger than `isize::MAX`, and adding that size to `headers` must not "wrap
|
|
2227
|
+
* around" the address space. See the safety documentation of pointer::offset.
|
|
2228
|
+
* - `body` must be non-null and valid for reads for `body_len` bytes, and it must have
|
|
2229
|
+
* an alignment of `1`.
|
|
2230
|
+
* - The memory referenced by `body` must not be mutated for the duration of the function
|
|
2231
|
+
* call.
|
|
2232
|
+
* - The total size `body_len` must be no larger than `isize::MAX`. See the safety
|
|
2233
|
+
* documentation of pointer::offset.
|
|
2234
|
+
* - Call [`zcashlc_free_http_response_bytes`] to free the memory associated with the
|
|
2235
|
+
* returned pointer when done using it.
|
|
2236
|
+
*/
|
|
2237
|
+
struct FfiHttpResponseBytes *zcashlc_tor_http_post(struct TorRuntime *tor_runtime,
|
|
2238
|
+
const char *url,
|
|
2239
|
+
const struct FfiHttpRequestHeader *headers,
|
|
2240
|
+
uintptr_t headers_len,
|
|
2241
|
+
const uint8_t *body,
|
|
2242
|
+
uintptr_t body_len,
|
|
2243
|
+
uint8_t retry_limit);
|
|
2244
|
+
|
|
1663
2245
|
/**
|
|
1664
2246
|
* Fetches the current ZEC-USD exchange rate over Tor.
|
|
1665
2247
|
*
|
|
@@ -1670,8 +2252,688 @@ void zcashlc_free_tor_runtime(struct TorRuntime *ptr);
|
|
|
1670
2252
|
*
|
|
1671
2253
|
* # Safety
|
|
1672
2254
|
*
|
|
1673
|
-
* - `tor_runtime` must be non-null
|
|
1674
|
-
*
|
|
2255
|
+
* - `tor_runtime` must be a non-null pointer returned by a `zcashlc_*` method with
|
|
2256
|
+
* return type `*mut TorRuntime` that has not previously been freed.
|
|
1675
2257
|
* - `tor_runtime` must not be passed to two FFI calls at the same time.
|
|
1676
2258
|
*/
|
|
1677
2259
|
struct Decimal zcashlc_get_exchange_rate_usd(struct TorRuntime *tor_runtime);
|
|
2260
|
+
|
|
2261
|
+
/**
|
|
2262
|
+
* Connects to the lightwalletd server at the given endpoint.
|
|
2263
|
+
*
|
|
2264
|
+
* Each connection returned by this method is isolated from any other Tor usage.
|
|
2265
|
+
*
|
|
2266
|
+
* # Safety
|
|
2267
|
+
*
|
|
2268
|
+
* - `tor_runtime` must be a non-null pointer returned by a `zcashlc_*` method with
|
|
2269
|
+
* return type `*mut TorRuntime` that has not previously been freed.
|
|
2270
|
+
* - `tor_runtime` must not be passed to two FFI calls at the same time.
|
|
2271
|
+
* - `endpoint` must be non-null and must point to a null-terminated UTF-8 string.
|
|
2272
|
+
* - Call [`zcashlc_free_tor_lwd_conn`] to free the memory associated with the returned
|
|
2273
|
+
* pointer when done using it.
|
|
2274
|
+
*/
|
|
2275
|
+
struct LwdConn *zcashlc_tor_connect_to_lightwalletd(struct TorRuntime *tor_runtime,
|
|
2276
|
+
const char *endpoint);
|
|
2277
|
+
|
|
2278
|
+
/**
|
|
2279
|
+
* Frees a Tor lightwalletd connection.
|
|
2280
|
+
*
|
|
2281
|
+
* # Safety
|
|
2282
|
+
*
|
|
2283
|
+
* - If `ptr` is non-null, it must be a pointer returned by a `zcashlc_*` method with
|
|
2284
|
+
* return type `*mut tor::LwdConn` that has not previously been freed.
|
|
2285
|
+
*/
|
|
2286
|
+
void zcashlc_free_tor_lwd_conn(struct LwdConn *ptr);
|
|
2287
|
+
|
|
2288
|
+
/**
|
|
2289
|
+
* Returns information about this lightwalletd instance and the blockchain.
|
|
2290
|
+
*
|
|
2291
|
+
* # Safety
|
|
2292
|
+
*
|
|
2293
|
+
* - `lwd_conn` must be a non-null pointer returned by a `zcashlc_*` method with
|
|
2294
|
+
* return type `*mut tor::LwdConn` that has not previously been freed.
|
|
2295
|
+
* - `lwd_conn` must not be passed to two FFI calls at the same time.
|
|
2296
|
+
* - Call [`zcashlc_free_boxed_slice`] to free the memory associated with the returned
|
|
2297
|
+
* pointer when done using it.
|
|
2298
|
+
*/
|
|
2299
|
+
struct FfiBoxedSlice *zcashlc_tor_lwd_conn_get_info(struct LwdConn *lwd_conn);
|
|
2300
|
+
|
|
2301
|
+
/**
|
|
2302
|
+
* Fetches the height and hash of the block at the tip of the best chain.
|
|
2303
|
+
*
|
|
2304
|
+
* # Safety
|
|
2305
|
+
*
|
|
2306
|
+
* - `lwd_conn` must be a non-null pointer returned by a `zcashlc_*` method with
|
|
2307
|
+
* return type `*mut tor::LwdConn` that has not previously been freed.
|
|
2308
|
+
* - `lwd_conn` must not be passed to two FFI calls at the same time.
|
|
2309
|
+
* - `height_ret` must be non-null and valid for writes for 4 bytes, and it must have an
|
|
2310
|
+
* alignment of `1`.
|
|
2311
|
+
* - Call [`zcashlc_free_boxed_slice`] to free the memory associated with the returned
|
|
2312
|
+
* pointer when done using it.
|
|
2313
|
+
*/
|
|
2314
|
+
struct FfiBoxedSlice *zcashlc_tor_lwd_conn_latest_block(struct LwdConn *lwd_conn,
|
|
2315
|
+
uint32_t *height_ret);
|
|
2316
|
+
|
|
2317
|
+
/**
|
|
2318
|
+
* Fetches the transaction with the given ID.
|
|
2319
|
+
*
|
|
2320
|
+
* # Safety
|
|
2321
|
+
*
|
|
2322
|
+
* - `lwd_conn` must be a non-null pointer returned by a `zcashlc_*` method with
|
|
2323
|
+
* return type `*mut tor::LwdConn` that has not previously been freed.
|
|
2324
|
+
* - `lwd_conn` must not be passed to two FFI calls at the same time.
|
|
2325
|
+
* - `txid_bytes` must be non-null and valid for reads for 32 bytes, and it must have an
|
|
2326
|
+
* alignment of `1`.
|
|
2327
|
+
* - `height_ret` must be non-null and valid for writes for 8 bytes, and it must have an
|
|
2328
|
+
* alignment of `1`.
|
|
2329
|
+
* - Call [`zcashlc_free_boxed_slice`] to free the memory associated with the returned
|
|
2330
|
+
* pointer when done using it.
|
|
2331
|
+
*/
|
|
2332
|
+
struct FfiBoxedSlice *zcashlc_tor_lwd_conn_fetch_transaction(struct LwdConn *lwd_conn,
|
|
2333
|
+
const uint8_t *txid_bytes,
|
|
2334
|
+
uint64_t *height_ret);
|
|
2335
|
+
|
|
2336
|
+
/**
|
|
2337
|
+
* Submits a transaction to the Zcash network via the given lightwalletd connection.
|
|
2338
|
+
*
|
|
2339
|
+
* # Safety
|
|
2340
|
+
*
|
|
2341
|
+
* - `lwd_conn` must be a non-null pointer returned by a `zcashlc_*` method with
|
|
2342
|
+
* return type `*mut tor::LwdConn` that has not previously been freed.
|
|
2343
|
+
* - `lwd_conn` must not be passed to two FFI calls at the same time.
|
|
2344
|
+
* - `tx` must be non-null and valid for reads for `tx_len` bytes, and it must have an
|
|
2345
|
+
* alignment of `1`.
|
|
2346
|
+
* - The memory referenced by `tx` must not be mutated for the duration of the function call.
|
|
2347
|
+
* - The total size `tx_len` must be no larger than `isize::MAX`. See the safety
|
|
2348
|
+
* documentation of pointer::offset.
|
|
2349
|
+
*/
|
|
2350
|
+
bool zcashlc_tor_lwd_conn_submit_transaction(struct LwdConn *lwd_conn,
|
|
2351
|
+
const uint8_t *tx,
|
|
2352
|
+
uintptr_t tx_len);
|
|
2353
|
+
|
|
2354
|
+
/**
|
|
2355
|
+
* Fetches the note commitment tree state corresponding to the given block height.
|
|
2356
|
+
*
|
|
2357
|
+
* # Safety
|
|
2358
|
+
*
|
|
2359
|
+
* - `lwd_conn` must be a non-null pointer returned by a `zcashlc_*` method with
|
|
2360
|
+
* return type `*mut tor::LwdConn` that has not previously been freed.
|
|
2361
|
+
* - `lwd_conn` must not be passed to two FFI calls at the same time.
|
|
2362
|
+
* - Call [`zcashlc_free_boxed_slice`] to free the memory associated with the returned
|
|
2363
|
+
* pointer when done using it.
|
|
2364
|
+
*/
|
|
2365
|
+
struct FfiBoxedSlice *zcashlc_tor_lwd_conn_get_tree_state(struct LwdConn *lwd_conn,
|
|
2366
|
+
uint32_t height);
|
|
2367
|
+
|
|
2368
|
+
/**
|
|
2369
|
+
* Finds all transactions associated with the given transparent address within the given block
|
|
2370
|
+
* range, and calls [`decrypt_and_store_transaction`] with each such transaction.
|
|
2371
|
+
*
|
|
2372
|
+
* The query to the light wallet server will cover the provided block range. The end height is
|
|
2373
|
+
* optional; to omit the end height for the query range use the sentinel value `-1`. If any other
|
|
2374
|
+
* value is specified, it must be in the range of a valid u32. Note that older versions of
|
|
2375
|
+
* `lightwalletd` will return an error if the end height is not specified.
|
|
2376
|
+
*
|
|
2377
|
+
* Returns an [`ffi::AddressCheckResult`] if successful, or a null pointer in the case of an
|
|
2378
|
+
* error.
|
|
2379
|
+
*
|
|
2380
|
+
* # Safety
|
|
2381
|
+
*
|
|
2382
|
+
* - `lwd_conn` must be a non-null pointer returned by a `zcashlc_*` method with
|
|
2383
|
+
* return type `*mut tor::LwdConn` that has not previously been freed.
|
|
2384
|
+
* - `lwd_conn` must not be passed to two FFI calls at the same time.
|
|
2385
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
2386
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
2387
|
+
* operating system's preferred representation.
|
|
2388
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
2389
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
2390
|
+
* documentation of pointer::offset.
|
|
2391
|
+
* - Call [`zcashlc_free_address_check_result`] to free the memory associated with the returned
|
|
2392
|
+
* pointer when done using it.
|
|
2393
|
+
*/
|
|
2394
|
+
struct FfiAddressCheckResult *zcashlc_tor_lwd_conn_update_transparent_address_transactions(struct LwdConn *lwd_conn,
|
|
2395
|
+
const uint8_t *db_data,
|
|
2396
|
+
uintptr_t db_data_len,
|
|
2397
|
+
uint32_t network_id,
|
|
2398
|
+
const char *address,
|
|
2399
|
+
uint32_t start,
|
|
2400
|
+
int64_t end);
|
|
2401
|
+
|
|
2402
|
+
/**
|
|
2403
|
+
* Checks to find any UTXOs associated with the given transparent address.
|
|
2404
|
+
*
|
|
2405
|
+
* This check will cover the block range starting at the exposure height for that address, if
|
|
2406
|
+
* known, or otherwise at the birthday height of the specified account.
|
|
2407
|
+
*
|
|
2408
|
+
* Returns an [`ffi::AddressCheckResult`] if successful, or a null pointer in the case of an
|
|
2409
|
+
* error.
|
|
2410
|
+
*
|
|
2411
|
+
* # Safety
|
|
2412
|
+
*
|
|
2413
|
+
* - `lwd_conn` must be a non-null pointer returned by a `zcashlc_*` method with
|
|
2414
|
+
* return type `*mut tor::LwdConn` that has not previously been freed.
|
|
2415
|
+
* - `lwd_conn` must not be passed to two FFI calls at the same time.
|
|
2416
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
2417
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
2418
|
+
* operating system's preferred representation.
|
|
2419
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
2420
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
2421
|
+
* documentation of pointer::offset.
|
|
2422
|
+
* - Call [`zcashlc_free_address_check_result`] to free the memory associated with the returned
|
|
2423
|
+
* pointer when done using it.
|
|
2424
|
+
*/
|
|
2425
|
+
struct FfiAddressCheckResult *zcashlc_tor_lwd_conn_fetch_utxos_by_address(struct LwdConn *lwd_conn,
|
|
2426
|
+
const uint8_t *db_data,
|
|
2427
|
+
uintptr_t db_data_len,
|
|
2428
|
+
uint32_t network_id,
|
|
2429
|
+
const uint8_t *account_uuid_bytes,
|
|
2430
|
+
const char *address);
|
|
2431
|
+
|
|
2432
|
+
/**
|
|
2433
|
+
* Checks to find any single-use ephemeral addresses exposed in the past day that have not yet
|
|
2434
|
+
* received funds, excluding any whose next check time is in the future. This will then choose the
|
|
2435
|
+
* address that is most overdue for checking, retrieve any UTXOs for that address over Tor, and
|
|
2436
|
+
* add them to the wallet database. If no such UTXOs are found, the check will be rescheduled
|
|
2437
|
+
* following an expoential-backoff-with-jitter algorithm.
|
|
2438
|
+
*
|
|
2439
|
+
* Returns an [`ffi::AddressCheckResult`] if successful, or a null pointer in the case of an
|
|
2440
|
+
* error.
|
|
2441
|
+
*
|
|
2442
|
+
* # Safety
|
|
2443
|
+
*
|
|
2444
|
+
* - `lwd_conn` must be a non-null pointer returned by a `zcashlc_*` method with
|
|
2445
|
+
* return type `*mut tor::LwdConn` that has not previously been freed.
|
|
2446
|
+
* - `lwd_conn` must not be passed to two FFI calls at the same time.
|
|
2447
|
+
* - `db_data` must be non-null and valid for reads for `db_data_len` bytes, and it must have an
|
|
2448
|
+
* alignment of `1`. Its contents must be a string representing a valid system path in the
|
|
2449
|
+
* operating system's preferred representation.
|
|
2450
|
+
* - The memory referenced by `db_data` must not be mutated for the duration of the function call.
|
|
2451
|
+
* - The total size `db_data_len` must be no larger than `isize::MAX`. See the safety
|
|
2452
|
+
* documentation of pointer::offset.
|
|
2453
|
+
* - Call [`zcashlc_free_address_check_result`] to free the memory associated with the returned
|
|
2454
|
+
* pointer when done using it.
|
|
2455
|
+
*/
|
|
2456
|
+
struct FfiAddressCheckResult *zcashlc_tor_lwd_conn_check_single_use_taddr(struct LwdConn *lwd_conn,
|
|
2457
|
+
const uint8_t *db_data,
|
|
2458
|
+
uintptr_t db_data_len,
|
|
2459
|
+
uint32_t network_id,
|
|
2460
|
+
const uint8_t *account_uuid_bytes);
|
|
2461
|
+
|
|
2462
|
+
/**
|
|
2463
|
+
* Returns the network type and address kind for the given address string,
|
|
2464
|
+
* if the address is a valid Zcash address.
|
|
2465
|
+
*
|
|
2466
|
+
* Address kind codes are as follows:
|
|
2467
|
+
* * p2pkh: 0
|
|
2468
|
+
* * p2sh: 1
|
|
2469
|
+
* * sapling: 2
|
|
2470
|
+
* * unified: 3
|
|
2471
|
+
* * tex: 4
|
|
2472
|
+
*
|
|
2473
|
+
* # Safety
|
|
2474
|
+
*
|
|
2475
|
+
* - `address` must be non-null and must point to a null-terminated UTF-8 string.
|
|
2476
|
+
* - The memory referenced by `address` must not be mutated for the duration of the function call.
|
|
2477
|
+
*/
|
|
2478
|
+
bool zcashlc_get_address_metadata(const char *address,
|
|
2479
|
+
uint32_t *network_id_ret,
|
|
2480
|
+
uint32_t *addr_kind_ret);
|
|
2481
|
+
|
|
2482
|
+
/**
|
|
2483
|
+
* Extracts the typecodes of the receivers within the given Unified Address.
|
|
2484
|
+
*
|
|
2485
|
+
* Returns a pointer to a slice of typecodes. `len_ret` is set to the length of the
|
|
2486
|
+
* slice.
|
|
2487
|
+
*
|
|
2488
|
+
* See the following sections of ZIP 316 for details on how to interpret typecodes:
|
|
2489
|
+
* - [List of known typecodes](https://zips.z.cash/zip-0316#encoding-of-unified-addresses)
|
|
2490
|
+
* - [Adding new types](https://zips.z.cash/zip-0316#adding-new-types)
|
|
2491
|
+
* - [Metadata Items](https://zips.z.cash/zip-0316#metadata-items)
|
|
2492
|
+
*
|
|
2493
|
+
* # Safety
|
|
2494
|
+
*
|
|
2495
|
+
* - `ua` must be non-null and must point to a null-terminated UTF-8 string.
|
|
2496
|
+
* - The memory referenced by `ua` must not be mutated for the duration of the function call.
|
|
2497
|
+
* - Call [`zcashlc_free_typecodes`] to free the memory associated with the returned
|
|
2498
|
+
* pointer when done using it.
|
|
2499
|
+
*/
|
|
2500
|
+
uint32_t *zcashlc_get_typecodes_for_unified_address_receivers(const char *ua, uintptr_t *len_ret);
|
|
2501
|
+
|
|
2502
|
+
/**
|
|
2503
|
+
* Frees a list of typecodes previously obtained from the FFI.
|
|
2504
|
+
*
|
|
2505
|
+
* # Safety
|
|
2506
|
+
*
|
|
2507
|
+
* - `data` and `len` must have been obtained from
|
|
2508
|
+
* [`zcashlc_get_typecodes_for_unified_address_receivers`].
|
|
2509
|
+
*/
|
|
2510
|
+
void zcashlc_free_typecodes(uint32_t *data, uintptr_t len);
|
|
2511
|
+
|
|
2512
|
+
/**
|
|
2513
|
+
* Returns true when the provided key decodes to a valid Sapling extended spending key for the
|
|
2514
|
+
* specified network, false in any other case.
|
|
2515
|
+
*
|
|
2516
|
+
* # Safety
|
|
2517
|
+
*
|
|
2518
|
+
* - `extsk` must be non-null and must point to a null-terminated UTF-8 string.
|
|
2519
|
+
* - The memory referenced by `extsk` must not be mutated for the duration of the function call.
|
|
2520
|
+
*/
|
|
2521
|
+
bool zcashlc_is_valid_sapling_extended_spending_key(const char *extsk, uint32_t network_id);
|
|
2522
|
+
|
|
2523
|
+
/**
|
|
2524
|
+
* Returns true when the provided key decodes to a valid Sapling extended full viewing key for the
|
|
2525
|
+
* specified network, false in any other case.
|
|
2526
|
+
*
|
|
2527
|
+
* # Safety
|
|
2528
|
+
*
|
|
2529
|
+
* - `key` must be non-null and must point to a null-terminated UTF-8 string.
|
|
2530
|
+
* - The memory referenced by `key` must not be mutated for the duration of the function call.
|
|
2531
|
+
*/
|
|
2532
|
+
bool zcashlc_is_valid_viewing_key(const char *key, uint32_t network_id);
|
|
2533
|
+
|
|
2534
|
+
/**
|
|
2535
|
+
* Returns true when the provided key decodes to a valid unified full viewing key for the
|
|
2536
|
+
* specified network, false in any other case.
|
|
2537
|
+
*
|
|
2538
|
+
* # Safety
|
|
2539
|
+
*
|
|
2540
|
+
* - `ufvk` must be non-null and must point to a null-terminated UTF-8 string.
|
|
2541
|
+
* - The memory referenced by `ufvk` must not be mutated for the duration of the
|
|
2542
|
+
* function call.
|
|
2543
|
+
*/
|
|
2544
|
+
bool zcashlc_is_valid_unified_full_viewing_key(const char *ufvk, uint32_t network_id);
|
|
2545
|
+
|
|
2546
|
+
/**
|
|
2547
|
+
* Derives and returns a unified spending key from the given seed for the given account ID.
|
|
2548
|
+
*
|
|
2549
|
+
* Returns the binary encoding of the spending key. The caller should manage the memory of (and
|
|
2550
|
+
* store, if necessary) the returned spending key in a secure fashion.
|
|
2551
|
+
*
|
|
2552
|
+
* # Safety
|
|
2553
|
+
*
|
|
2554
|
+
* - `seed` must be non-null and valid for reads for `seed_len` bytes.
|
|
2555
|
+
* - The memory referenced by `seed` must not be mutated for the duration of the function call.
|
|
2556
|
+
* - The total size `seed_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
2557
|
+
* of `pointer::offset`.
|
|
2558
|
+
* - Call `zcashlc_free_binary_key` to free the memory associated with the returned pointer when
|
|
2559
|
+
* you are finished using it.
|
|
2560
|
+
*/
|
|
2561
|
+
struct FfiBoxedSlice *zcashlc_derive_spending_key(const uint8_t *seed,
|
|
2562
|
+
uintptr_t seed_len,
|
|
2563
|
+
int32_t hd_account_index,
|
|
2564
|
+
uint32_t network_id);
|
|
2565
|
+
|
|
2566
|
+
/**
|
|
2567
|
+
* Obtains the unified full viewing key for the given binary-encoded unified spending key
|
|
2568
|
+
* and returns the resulting encoded UFVK string. `usk_ptr` should point to an array of `usk_len`
|
|
2569
|
+
* bytes containing a unified spending key encoded as returned from the `zcashlc_create_account`
|
|
2570
|
+
* or `zcashlc_derive_spending_key` functions.
|
|
2571
|
+
*
|
|
2572
|
+
* # Safety
|
|
2573
|
+
*
|
|
2574
|
+
* - `usk_ptr` must be non-null and must point to an array of `usk_len` bytes.
|
|
2575
|
+
* - The memory referenced by `usk_ptr` must not be mutated for the duration of the function call.
|
|
2576
|
+
* - The total size `usk_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
2577
|
+
* of `pointer::offset`.
|
|
2578
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
2579
|
+
* when you are done using it.
|
|
2580
|
+
*/
|
|
2581
|
+
char *zcashlc_spending_key_to_full_viewing_key(const uint8_t *usk_ptr,
|
|
2582
|
+
uintptr_t usk_len,
|
|
2583
|
+
uint32_t network_id);
|
|
2584
|
+
|
|
2585
|
+
/**
|
|
2586
|
+
* Derives a unified address address for the provided UFVK, along with the diversifier at which it
|
|
2587
|
+
* was derived; this may not be equal to the provided diversifier index if no valid Sapling
|
|
2588
|
+
* address could be derived at that index. If the `diversifier_index_bytes` parameter is null, the
|
|
2589
|
+
* default address for the UFVK is returned.
|
|
2590
|
+
*
|
|
2591
|
+
* # Safety
|
|
2592
|
+
*
|
|
2593
|
+
* - `ufvk` must be non-null and must point to a null-terminated UTF-8 string.
|
|
2594
|
+
* - `diversifier_index_bytes must either be null or be valid for reads for 11 bytes and have an
|
|
2595
|
+
* alignment of `1`.
|
|
2596
|
+
* - Call [`zcashlc_free_ffi_address`] to free the memory associated with the returned pointer
|
|
2597
|
+
* when done using it.
|
|
2598
|
+
*/
|
|
2599
|
+
struct FfiAddress *zcashlc_derive_address_from_ufvk(uint32_t network_id,
|
|
2600
|
+
const char *ufvk,
|
|
2601
|
+
const uint8_t *diversifier_index_bytes);
|
|
2602
|
+
|
|
2603
|
+
/**
|
|
2604
|
+
* Derives a unified address address for the provided UIVK, along with the diversifier at which it
|
|
2605
|
+
* was derived; this may not be equal to the provided diversifier index if no valid Sapling
|
|
2606
|
+
* address could be derived at that index. If the `diversifier_index_bytes` parameter is null, the
|
|
2607
|
+
* default address for the UIVK is returned.
|
|
2608
|
+
*
|
|
2609
|
+
* # Safety
|
|
2610
|
+
*
|
|
2611
|
+
* - `uivk` must be non-null and must point to a null-terminated UTF-8 string.
|
|
2612
|
+
* - `diversifier_index_bytes must either be null or be valid for reads for 11 bytes and have an
|
|
2613
|
+
* alignment of `1`.
|
|
2614
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
2615
|
+
* when done using it.
|
|
2616
|
+
*/
|
|
2617
|
+
struct FfiAddress *zcashlc_derive_address_from_uivk(uint32_t network_id,
|
|
2618
|
+
const char *uivk,
|
|
2619
|
+
const uint8_t *diversifier_index_bytes);
|
|
2620
|
+
|
|
2621
|
+
/**
|
|
2622
|
+
* Returns the transparent receiver within the given Unified Address, if any.
|
|
2623
|
+
*
|
|
2624
|
+
* # Safety
|
|
2625
|
+
*
|
|
2626
|
+
* - `ua` must be non-null and must point to a null-terminated UTF-8 string.
|
|
2627
|
+
* - The memory referenced by `ua` must not be mutated for the duration of the function call.
|
|
2628
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
2629
|
+
* when done using it.
|
|
2630
|
+
*/
|
|
2631
|
+
char *zcashlc_get_transparent_receiver_for_unified_address(const char *ua);
|
|
2632
|
+
|
|
2633
|
+
/**
|
|
2634
|
+
* Returns the Sapling receiver within the given Unified Address, if any.
|
|
2635
|
+
*
|
|
2636
|
+
* # Safety
|
|
2637
|
+
*
|
|
2638
|
+
* - `ua` must be non-null and must point to a null-terminated UTF-8 string.
|
|
2639
|
+
* - The memory referenced by `ua` must not be mutated for the duration of the function call.
|
|
2640
|
+
* - Call [`zcashlc_string_free`] to free the memory associated with the returned pointer
|
|
2641
|
+
* when done using it.
|
|
2642
|
+
*/
|
|
2643
|
+
char *zcashlc_get_sapling_receiver_for_unified_address(const char *ua);
|
|
2644
|
+
|
|
2645
|
+
/**
|
|
2646
|
+
* Constructs an ffi::AccountMetadataKey from its parts.
|
|
2647
|
+
*
|
|
2648
|
+
* # Safety
|
|
2649
|
+
*
|
|
2650
|
+
* - `sk` must be non-null and valid for reads for 32 bytes, and it must have an alignment of `1`.
|
|
2651
|
+
* - The memory referenced by `sk` must not be mutated for the duration of the function call.
|
|
2652
|
+
* - `chain_code` must be non-null and valid for reads for 32 bytes, and it must have an alignment
|
|
2653
|
+
* of `1`.
|
|
2654
|
+
* - The memory referenced by `chain_code` must not be mutated for the duration of the function
|
|
2655
|
+
* call.
|
|
2656
|
+
* - Call [`zcashlc_free_account_metadata_key`] to free the memory associated with the returned
|
|
2657
|
+
* pointer when done using it.
|
|
2658
|
+
*/
|
|
2659
|
+
struct FfiAccountMetadataKey *zcashlc_account_metadata_key_from_parts(const uint8_t *sk,
|
|
2660
|
+
const uint8_t *chain_code);
|
|
2661
|
+
|
|
2662
|
+
/**
|
|
2663
|
+
* Derives a ZIP 325 Account Metadata Key from the given seed.
|
|
2664
|
+
*
|
|
2665
|
+
* # Safety
|
|
2666
|
+
*
|
|
2667
|
+
* - `seed` must be non-null and valid for reads for `seed_len` bytes.
|
|
2668
|
+
* - The memory referenced by `seed` must not be mutated for the duration of the function call.
|
|
2669
|
+
* - The total size `seed_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
2670
|
+
* of `pointer::offset`.
|
|
2671
|
+
* - Call [`zcashlc_free_account_metadata_key`] to free the memory associated with the returned
|
|
2672
|
+
* pointer when done using it.
|
|
2673
|
+
*/
|
|
2674
|
+
struct FfiAccountMetadataKey *zcashlc_derive_account_metadata_key(const uint8_t *seed,
|
|
2675
|
+
uintptr_t seed_len,
|
|
2676
|
+
int32_t account,
|
|
2677
|
+
uint32_t network_id);
|
|
2678
|
+
|
|
2679
|
+
/**
|
|
2680
|
+
* Derives a metadata key for private use from a ZIP 325 Account Metadata Key.
|
|
2681
|
+
*
|
|
2682
|
+
* - `ufvk` is the external UFVK for which a metadata key is required, or `null` if the
|
|
2683
|
+
* metadata key is "inherent" (for the same account as the Account Metadata Key).
|
|
2684
|
+
* - `private_use_subject` is a globally unique non-empty sequence of at most 252 bytes
|
|
2685
|
+
* that identifies the desired private-use context.
|
|
2686
|
+
*
|
|
2687
|
+
* If `ufvk` is null, this function will return a single 32-byte metadata key.
|
|
2688
|
+
*
|
|
2689
|
+
* If `ufvk` is non-null, this function will return one metadata key for every FVK item
|
|
2690
|
+
* contained within the UFVK, in preference order. As UFVKs may in general change over
|
|
2691
|
+
* time (due to the inclusion of new higher-preference FVK items, or removal of older
|
|
2692
|
+
* deprecated FVK items), private usage of these keys should always follow preference
|
|
2693
|
+
* order:
|
|
2694
|
+
* - For encryption-like private usage, the first key in the array should always be
|
|
2695
|
+
* used, and all other keys ignored.
|
|
2696
|
+
* - For decryption-like private usage, each key in the array should be tried in turn
|
|
2697
|
+
* until metadata can be recovered, and then the metadata should be re-encrypted
|
|
2698
|
+
* under the first key.
|
|
2699
|
+
*
|
|
2700
|
+
* # Safety
|
|
2701
|
+
*
|
|
2702
|
+
* - `account_metadata_key` must be non-null and must point to a struct having the layout
|
|
2703
|
+
* of [`ffi::AccountMetadataKey`].
|
|
2704
|
+
* - The memory referenced by `account_metadata_key` must not be mutated for the duration
|
|
2705
|
+
* of the function call.
|
|
2706
|
+
* - If `ufvk` is non-null, it must point to a null-terminated UTF-8 string.
|
|
2707
|
+
* - `private_use_subject` must be non-null and valid for reads for `private_use_subject_len`
|
|
2708
|
+
* bytes.
|
|
2709
|
+
* - The memory referenced by `private_use_subject` must not be mutated for the duration
|
|
2710
|
+
* of the function call.
|
|
2711
|
+
* - The total size `private_use_subject_len` must be no larger than `isize::MAX`. See
|
|
2712
|
+
* the safety documentation of `pointer::offset`.
|
|
2713
|
+
* - Call `zcashlc_free_symmetric_keys` to free the memory associated with the returned
|
|
2714
|
+
* pointer when done using it.
|
|
2715
|
+
*/
|
|
2716
|
+
struct FfiSymmetricKeys *zcashlc_derive_private_use_metadata_key(const struct FfiAccountMetadataKey *account_metadata_key,
|
|
2717
|
+
const char *ufvk,
|
|
2718
|
+
const uint8_t *private_use_subject,
|
|
2719
|
+
uintptr_t private_use_subject_len,
|
|
2720
|
+
uint32_t network_id);
|
|
2721
|
+
|
|
2722
|
+
/**
|
|
2723
|
+
* Derives and returns a ZIP 32 Arbitrary Key from the given seed at the "wallet level", i.e.
|
|
2724
|
+
* directly from the seed with no ZIP 32 path applied.
|
|
2725
|
+
*
|
|
2726
|
+
* The resulting key will be the same across all networks (Zcash mainnet, Zcash testnet, OtherCoin
|
|
2727
|
+
* mainnet, and so on). You can think of it as a context-specific seed fingerprint that can be used
|
|
2728
|
+
* as (static) key material.
|
|
2729
|
+
*
|
|
2730
|
+
* `context_string` is a globally-unique non-empty sequence of at most 252 bytes that identifies
|
|
2731
|
+
* the desired context.
|
|
2732
|
+
*
|
|
2733
|
+
* # Safety
|
|
2734
|
+
*
|
|
2735
|
+
* - `context_string` must be non-null and valid for reads for `context_string_len` bytes.
|
|
2736
|
+
* - The memory referenced by `context_string` must not be mutated for the duration of the function
|
|
2737
|
+
* call.
|
|
2738
|
+
* - The total size `context_string_len` must be no larger than `isize::MAX`. See the safety
|
|
2739
|
+
* documentation of `pointer::offset`.
|
|
2740
|
+
* - `seed` must be non-null and valid for reads for `seed_len` bytes.
|
|
2741
|
+
* - The memory referenced by `seed` must not be mutated for the duration of the function call.
|
|
2742
|
+
* - The total size `seed_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
2743
|
+
* of `pointer::offset`.
|
|
2744
|
+
* - Call `zcashlc_free_boxed_slice` to free the memory associated with the returned
|
|
2745
|
+
* pointer when done using it.
|
|
2746
|
+
*/
|
|
2747
|
+
struct FfiBoxedSlice *zcashlc_derive_arbitrary_wallet_key(const uint8_t *context_string,
|
|
2748
|
+
uintptr_t context_string_len,
|
|
2749
|
+
const uint8_t *seed,
|
|
2750
|
+
uintptr_t seed_len);
|
|
2751
|
+
|
|
2752
|
+
/**
|
|
2753
|
+
* Derives and returns a ZIP 32 Arbitrary Key from the given seed at the account level.
|
|
2754
|
+
*
|
|
2755
|
+
* `context_string` is a globally-unique non-empty sequence of at most 252 bytes that identifies
|
|
2756
|
+
* the desired context.
|
|
2757
|
+
*
|
|
2758
|
+
* # Safety
|
|
2759
|
+
*
|
|
2760
|
+
* - `context_string` must be non-null and valid for reads for `context_string_len` bytes.
|
|
2761
|
+
* - The memory referenced by `context_string` must not be mutated for the duration of the function
|
|
2762
|
+
* call.
|
|
2763
|
+
* - The total size `context_string_len` must be no larger than `isize::MAX`. See the safety
|
|
2764
|
+
* documentation of `pointer::offset`.
|
|
2765
|
+
* - `seed` must be non-null and valid for reads for `seed_len` bytes`.
|
|
2766
|
+
* - The memory referenced by `seed` must not be mutated for the duration of the function call.
|
|
2767
|
+
* - The total size `seed_len` must be no larger than `isize::MAX`. See the safety documentation
|
|
2768
|
+
* of `pointer::offset`.
|
|
2769
|
+
* - Call `zcashlc_free_boxed_slice` to free the memory associated with the returned
|
|
2770
|
+
* pointer when done using it.
|
|
2771
|
+
*/
|
|
2772
|
+
struct FfiBoxedSlice *zcashlc_derive_arbitrary_account_key(const uint8_t *context_string,
|
|
2773
|
+
uintptr_t context_string_len,
|
|
2774
|
+
const uint8_t *seed,
|
|
2775
|
+
uintptr_t seed_len,
|
|
2776
|
+
int32_t account,
|
|
2777
|
+
uint32_t network_id);
|
|
2778
|
+
|
|
2779
|
+
/**
|
|
2780
|
+
* Frees an [`Account`] value
|
|
2781
|
+
*
|
|
2782
|
+
* # Safety
|
|
2783
|
+
*
|
|
2784
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`Account`].
|
|
2785
|
+
*/
|
|
2786
|
+
void zcashlc_free_account(struct FfiAccount *ptr);
|
|
2787
|
+
|
|
2788
|
+
/**
|
|
2789
|
+
* Frees a [`Uuid`] value
|
|
2790
|
+
*
|
|
2791
|
+
* # Safety
|
|
2792
|
+
*
|
|
2793
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`Uuid`].
|
|
2794
|
+
*/
|
|
2795
|
+
void zcashlc_free_ffi_uuid(struct FfiUuid *ptr);
|
|
2796
|
+
|
|
2797
|
+
/**
|
|
2798
|
+
* Frees an array of [`Uuid`] values as allocated by `zcashlc_list_accounts`.
|
|
2799
|
+
*
|
|
2800
|
+
* # Safety
|
|
2801
|
+
*
|
|
2802
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`Accounts`].
|
|
2803
|
+
* See the safety documentation of [`Accounts`].
|
|
2804
|
+
*/
|
|
2805
|
+
void zcashlc_free_accounts(struct FfiAccounts *ptr);
|
|
2806
|
+
|
|
2807
|
+
/**
|
|
2808
|
+
* Frees a [`BinaryKey`] value
|
|
2809
|
+
*
|
|
2810
|
+
* # Safety
|
|
2811
|
+
*
|
|
2812
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`BinaryKey`].
|
|
2813
|
+
* See the safety documentation of [`BinaryKey`].
|
|
2814
|
+
*/
|
|
2815
|
+
void zcashlc_free_binary_key(struct FFIBinaryKey *ptr);
|
|
2816
|
+
|
|
2817
|
+
/**
|
|
2818
|
+
* Frees an array of [`EncodedKey`] values as allocated by `zcashlc_list_transparent_receivers`.
|
|
2819
|
+
*
|
|
2820
|
+
* # Safety
|
|
2821
|
+
*
|
|
2822
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`EncodedKeys`].
|
|
2823
|
+
* See the safety documentation of [`EncodedKeys`].
|
|
2824
|
+
*/
|
|
2825
|
+
void zcashlc_free_keys(struct FFIEncodedKeys *ptr);
|
|
2826
|
+
|
|
2827
|
+
/**
|
|
2828
|
+
* Frees an [`WalletSummary`] value.
|
|
2829
|
+
*
|
|
2830
|
+
* # Safety
|
|
2831
|
+
*
|
|
2832
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`WalletSummary`].
|
|
2833
|
+
* See the safety documentation of [`WalletSummary`].
|
|
2834
|
+
*/
|
|
2835
|
+
void zcashlc_free_wallet_summary(struct FfiWalletSummary *ptr);
|
|
2836
|
+
|
|
2837
|
+
/**
|
|
2838
|
+
* Frees an array of [`ScanRange`] values as allocated by `zcashlc_suggest_scan_ranges`.
|
|
2839
|
+
*
|
|
2840
|
+
* # Safety
|
|
2841
|
+
*
|
|
2842
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`ScanRanges`].
|
|
2843
|
+
* See the safety documentation of [`ScanRanges`].
|
|
2844
|
+
*/
|
|
2845
|
+
void zcashlc_free_scan_ranges(struct FfiScanRanges *ptr);
|
|
2846
|
+
|
|
2847
|
+
/**
|
|
2848
|
+
* Frees a [`ScanSummary`] value.
|
|
2849
|
+
*
|
|
2850
|
+
* # Safety
|
|
2851
|
+
*
|
|
2852
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`ScanSummary`].
|
|
2853
|
+
*/
|
|
2854
|
+
void zcashlc_free_scan_summary(struct FfiScanSummary *ptr);
|
|
2855
|
+
|
|
2856
|
+
/**
|
|
2857
|
+
* Frees a [`BoxedSlice`].
|
|
2858
|
+
*
|
|
2859
|
+
* # Safety
|
|
2860
|
+
*
|
|
2861
|
+
* - `ptr` must be non-null and must point to a struct having the layout of
|
|
2862
|
+
* [`BoxedSlice`]. See the safety documentation of [`BoxedSlice`].
|
|
2863
|
+
*/
|
|
2864
|
+
void zcashlc_free_boxed_slice(struct FfiBoxedSlice *ptr);
|
|
2865
|
+
|
|
2866
|
+
/**
|
|
2867
|
+
* Frees an array of `[u8; 32]` values.
|
|
2868
|
+
*
|
|
2869
|
+
* # Safety
|
|
2870
|
+
*
|
|
2871
|
+
* - `ptr` must be non-null and must point to a struct having the layout of
|
|
2872
|
+
* [`SymmetricKeys`]. See the safety documentation of [`SymmetricKeys`].
|
|
2873
|
+
*/
|
|
2874
|
+
void zcashlc_free_symmetric_keys(struct FfiSymmetricKeys *ptr);
|
|
2875
|
+
|
|
2876
|
+
/**
|
|
2877
|
+
* Frees an array of `[u8; 32]` values as allocated by `zcashlc_create_proposed_transactions`.
|
|
2878
|
+
*
|
|
2879
|
+
* # Safety
|
|
2880
|
+
*
|
|
2881
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`TxIds`].
|
|
2882
|
+
* See the safety documentation of [`TxIds`].
|
|
2883
|
+
*/
|
|
2884
|
+
void zcashlc_free_txids(FfiTxIds *ptr);
|
|
2885
|
+
|
|
2886
|
+
/**
|
|
2887
|
+
* Frees an array of [`TransactionDataRequest`] values as allocated by `zcashlc_transaction_data_requests`.
|
|
2888
|
+
*
|
|
2889
|
+
* # Safety
|
|
2890
|
+
*
|
|
2891
|
+
* - `ptr` if `ptr` is non-null it must point to a struct having the layout of [`TransactionDataRequests`].
|
|
2892
|
+
* See the safety documentation of [`TransactionDataRequests`].
|
|
2893
|
+
*/
|
|
2894
|
+
void zcashlc_free_transaction_data_requests(struct FfiTransactionDataRequests *ptr);
|
|
2895
|
+
|
|
2896
|
+
/**
|
|
2897
|
+
* Frees an [`Address`] value
|
|
2898
|
+
*
|
|
2899
|
+
* # Safety
|
|
2900
|
+
*
|
|
2901
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`Address`].
|
|
2902
|
+
*/
|
|
2903
|
+
void zcashlc_free_ffi_address(struct FfiAddress *ptr);
|
|
2904
|
+
|
|
2905
|
+
/**
|
|
2906
|
+
* Frees an AccountMetadataKey value
|
|
2907
|
+
*
|
|
2908
|
+
* # Safety
|
|
2909
|
+
*
|
|
2910
|
+
* - `ptr` must either be null or point to a struct having the layout of [`AccountMetadataKey`].
|
|
2911
|
+
*/
|
|
2912
|
+
void zcashlc_free_account_metadata_key(struct FfiAccountMetadataKey *ptr);
|
|
2913
|
+
|
|
2914
|
+
/**
|
|
2915
|
+
* Frees an HttpResponseBytes value
|
|
2916
|
+
*
|
|
2917
|
+
* # Safety
|
|
2918
|
+
*
|
|
2919
|
+
* - `ptr` must either be null or point to a struct having the layout of [`HttpResponseBytes`].
|
|
2920
|
+
*/
|
|
2921
|
+
void zcashlc_free_http_response_bytes(struct FfiHttpResponseBytes *ptr);
|
|
2922
|
+
|
|
2923
|
+
/**
|
|
2924
|
+
* Frees an [`SingleUseTaddr`] value.
|
|
2925
|
+
*
|
|
2926
|
+
* # Safety
|
|
2927
|
+
*
|
|
2928
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`SingleUseTaddr`].
|
|
2929
|
+
*/
|
|
2930
|
+
void zcashlc_free_single_use_taddr(struct FfiSingleUseTaddr *ptr);
|
|
2931
|
+
|
|
2932
|
+
/**
|
|
2933
|
+
* Frees an [`AddressCheckResult`] value.
|
|
2934
|
+
*
|
|
2935
|
+
* # Safety
|
|
2936
|
+
*
|
|
2937
|
+
* - `ptr` must be non-null and must point to a struct having the layout of [`AddressCheckResult`].
|
|
2938
|
+
*/
|
|
2939
|
+
void zcashlc_free_address_check_result(struct FfiAddressCheckResult *ptr);
|