diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..acec09c --- /dev/null +++ b/.eslintignore @@ -0,0 +1,5 @@ +/lib/ +/node.js +/prebuilds/ +/rust/target/ +/ios/.uniffi-generated/ diff --git a/.eslintrc.json b/.eslintrc.json index 4e9977c..6c2434d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -4,7 +4,7 @@ "standard-kit/prettier/typescript" ], "parserOptions": { - "project": "tsconfig.json" + "project": "tsconfig.eslint.json" }, "plugins": [ "simple-import-sort" @@ -12,6 +12,6 @@ "rules": { "@typescript-eslint/promise-function-async": "off", "no-var": "error", - "simple-import-sort/sort": "error" + "simple-import-sort/imports": "error" } } diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c23a54..204f409 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # dash-shielded-native +## Unreleased + +- added: Move shielded value out to a Platform or Core address +- added: Resume a shield whose asset lock is already on chain +- added: React Native reaches the same calls as Node +- added: Fund the shielded pool from L1 through an asset lock +- added: Transparent receive address, Core SPV sync, and L1 balance +- added: Smoke test covers the Orchard proving key warm-up +- added: Asset locks from an earlier run are listed and resume after a restart +- changed: Build against dashpay/platform v5.0.1 with Rust 1.98.1 +- changed: Stopping a wallet returns an error when its sync workers did not shut down cleanly +- fixed: A stopped wallet can be opened again in the same process +- fixed: Shielded spends after the first no longer fail for lack of an anchor +- fixed: Testnet reaches DAPI on port 1443 instead of an unreachable 443 +- fixed: The macOS prebuild loads instead of being killed at require +- fixed: Android ships a library for armeabi-v7a as well as arm64-v8a +- fixed: Stopping a wallet no longer panics the shielded sync task +- fixed: Dependency installs resolve instead of failing on peer conflicts + ## 0.1.0 (2026-08-31) - Initial Node N-API + React Native UniFFI package for Dash Platform shielded addresses and transfers. diff --git a/README.md b/README.md index 262e5f3..1253665 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,10 @@ socket npm install socket npm run build-native-host socket npm run smoke-node ``` + +The Rust build pulls `dash-sdk`, whose `dapi-grpc` dependency compiles protobuf +definitions at build time, so `protoc` must be on `PATH` (`brew install protobuf`). +Without it the cargo step fails with `protoc not found in PATH`. + +`smoke-node` warms the Halo 2 proving key, which takes roughly 1.5 seconds on an +Apple Silicon host, so the run is not instant even though it moves no funds. diff --git a/android/build.gradle b/android/build.gradle index 9bc3ce6..b286a05 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -26,7 +26,7 @@ android { minSdkVersion safeExtGet('minSdkVersion', 27) targetSdkVersion safeExtGet('targetSdkVersion', 35) ndk { - abiFilters 'arm64-v8a' + abiFilters 'armeabi-v7a', 'arm64-v8a' } } sourceSets { diff --git a/android/src/main/java/app/edge/rndashshielded/RNDashShieldedModule.kt b/android/src/main/java/app/edge/rndashshielded/RNDashShieldedModule.kt index bd1956e..4d0754a 100644 --- a/android/src/main/java/app/edge/rndashshielded/RNDashShieldedModule.kt +++ b/android/src/main/java/app/edge/rndashshielded/RNDashShieldedModule.kt @@ -95,6 +95,136 @@ class RNDashShieldedModule( } } + @ReactMethod + fun coreReceiveAddress(alias: String, account: Double, promise: Promise) { + moduleScope.launch { + promise.wrap { uniffi.dash.coreReceiveAddress(alias, account.toUInt()) } + } + } + + @ReactMethod + fun startCoreSync(alias: String, fromHeight: Double, promise: Promise) { + moduleScope.launch { + promise.wrap { + uniffi.dash.startCoreSync(alias, fromHeight.toUInt()) + null + } + } + } + + @ReactMethod + fun coreBalance(alias: String, promise: Promise) { + moduleScope.launch { + promise.wrap { + val balance = uniffi.dash.coreBalance(alias) + Arguments.createMap().apply { + putString("confirmedDuffs", balance.confirmedDuffs) + putString("unconfirmedDuffs", balance.unconfirmedDuffs) + putString("totalDuffs", balance.totalDuffs) + putDouble("syncedHeight", balance.syncedHeight.toDouble()) + } + } + } + } + + @ReactMethod + fun shieldFromAssetLock( + alias: String, + amountDuffs: String, + accountIndex: Double, + mnemonicSeed: String, + promise: Promise, + ) { + moduleScope.launch { + promise.wrap { + uniffi.dash.shieldFromAssetLock( + alias, + amountDuffs, + accountIndex.toUInt(), + mnemonicSeed, + ) + } + } + } + + @ReactMethod + fun platformReceiveAddress( + alias: String, + account: Double, + promise: Promise, + ) { + moduleScope.launch { + promise.wrap { uniffi.dash.platformReceiveAddress(alias, account.toUInt()) } + } + } + + @ReactMethod + fun trackedAssetLocks(alias: String, promise: Promise) { + moduleScope.launch { + promise.wrap { + val locks = Arguments.createArray() + uniffi.dash.trackedAssetLocks(alias).forEach { lock -> + val map = Arguments.createMap() + map.putString("txid", lock.txid) + map.putInt("vout", lock.vout.toInt()) + map.putString("status", lock.status) + locks.pushMap(map) + } + locks + } + } + } + + @ReactMethod + fun resumeShieldFromAssetLock( + alias: String, + txid: String, + vout: Double, + mnemonicSeed: String, + promise: Promise, + ) { + moduleScope.launch { + promise.wrap { + uniffi.dash.resumeShieldFromAssetLock(alias, txid, vout.toUInt(), mnemonicSeed) + } + } + } + + @ReactMethod + fun unshield( + alias: String, + toAddress: String, + amountCredits: String, + mnemonicSeed: String, + promise: Promise, + ) { + moduleScope.launch { + promise.wrap { uniffi.dash.unshield(alias, toAddress, amountCredits, mnemonicSeed) } + } + } + + @ReactMethod + fun shieldedWithdraw( + alias: String, + toCoreAddress: String, + amountCredits: String, + coreFeePerByte: Double, + mnemonicSeed: String, + promise: Promise, + ) { + moduleScope.launch { + promise.wrap { + uniffi.dash.shieldedWithdraw( + alias, + toCoreAddress, + amountCredits, + coreFeePerByte.toUInt(), + mnemonicSeed, + ) + } + } + } + @ReactMethod fun stop(alias: String, promise: Promise) { moduleScope.launch { diff --git a/android/src/main/java/uniffi/dash/dash.kt b/android/src/main/java/uniffi/dash/dash.kt index 581af09..5814490 100644 --- a/android/src/main/java/uniffi/dash/dash.kt +++ b/android/src/main/java/uniffi/dash/dash.kt @@ -720,6 +720,24 @@ internal interface UniffiForeignFutureCompleteVoid : com.sun.jna.Callback { + + + + + + + + + + + + + + + + + + @@ -754,7 +772,11 @@ internal interface UniffiForeignFutureCompleteVoid : com.sun.jna.Callback { // when the library is loaded. internal interface IntegrityCheckingUniffiLib : Library { // Integrity check functions only - fun uniffi_dashshielded_checksum_func_create_transfer( + fun uniffi_dashshielded_checksum_func_core_balance( +): Short +fun uniffi_dashshielded_checksum_func_core_receive_address( +): Short +fun uniffi_dashshielded_checksum_func_create_transfer( ): Short fun uniffi_dashshielded_checksum_func_derive_shielded_address( ): Short @@ -768,18 +790,32 @@ fun uniffi_dashshielded_checksum_func_is_prover_ready( ): Short fun uniffi_dashshielded_checksum_func_is_valid_address( ): Short +fun uniffi_dashshielded_checksum_func_platform_receive_address( +): Short fun uniffi_dashshielded_checksum_func_poll( ): Short fun uniffi_dashshielded_checksum_func_propose_transfer( ): Short +fun uniffi_dashshielded_checksum_func_resume_shield_from_asset_lock( +): Short fun uniffi_dashshielded_checksum_func_set_document_directory( ): Short +fun uniffi_dashshielded_checksum_func_shield_from_asset_lock( +): Short +fun uniffi_dashshielded_checksum_func_shielded_withdraw( +): Short +fun uniffi_dashshielded_checksum_func_start_core_sync( +): Short fun uniffi_dashshielded_checksum_func_start_sync( ): Short fun uniffi_dashshielded_checksum_func_stop( ): Short fun uniffi_dashshielded_checksum_func_stop_sync( ): Short +fun uniffi_dashshielded_checksum_func_tracked_asset_locks( +): Short +fun uniffi_dashshielded_checksum_func_unshield( +): Short fun uniffi_dashshielded_checksum_func_warm_up_prover( ): Short fun ffi_dashshielded_uniffi_contract_version( @@ -827,7 +863,11 @@ internal interface UniffiLib : Library { } // FFI functions - fun uniffi_dashshielded_fn_func_create_transfer(`alias`: RustBuffer.ByValue,`proposalId`: RustBuffer.ByValue,`mnemonicSeed`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, + fun uniffi_dashshielded_fn_func_core_balance(`alias`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue +fun uniffi_dashshielded_fn_func_core_receive_address(`alias`: RustBuffer.ByValue,`account`: Int,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue +fun uniffi_dashshielded_fn_func_create_transfer(`alias`: RustBuffer.ByValue,`proposalId`: RustBuffer.ByValue,`mnemonicSeed`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue fun uniffi_dashshielded_fn_func_derive_shielded_address(`alias`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue @@ -841,18 +881,32 @@ fun uniffi_dashshielded_fn_func_is_prover_ready(uniffi_out_err: UniffiRustCallSt ): Byte fun uniffi_dashshielded_fn_func_is_valid_address(`address`: RustBuffer.ByValue,`network`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): Byte +fun uniffi_dashshielded_fn_func_platform_receive_address(`alias`: RustBuffer.ByValue,`account`: Int,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue fun uniffi_dashshielded_fn_func_poll(`alias`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue fun uniffi_dashshielded_fn_func_propose_transfer(`alias`: RustBuffer.ByValue,`amountCredits`: RustBuffer.ByValue,`toAddress`: RustBuffer.ByValue,`memo`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue +fun uniffi_dashshielded_fn_func_resume_shield_from_asset_lock(`alias`: RustBuffer.ByValue,`txid`: RustBuffer.ByValue,`vout`: Int,`mnemonicSeed`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue fun uniffi_dashshielded_fn_func_set_document_directory(`path`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): Unit +fun uniffi_dashshielded_fn_func_shield_from_asset_lock(`alias`: RustBuffer.ByValue,`amountDuffs`: RustBuffer.ByValue,`accountIndex`: Int,`mnemonicSeed`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue +fun uniffi_dashshielded_fn_func_shielded_withdraw(`alias`: RustBuffer.ByValue,`toCoreAddress`: RustBuffer.ByValue,`amountCredits`: RustBuffer.ByValue,`coreFeePerByte`: Int,`mnemonicSeed`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue +fun uniffi_dashshielded_fn_func_start_core_sync(`alias`: RustBuffer.ByValue,`fromHeight`: Int,uniffi_out_err: UniffiRustCallStatus, +): Unit fun uniffi_dashshielded_fn_func_start_sync(`alias`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): Unit fun uniffi_dashshielded_fn_func_stop(`alias`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue fun uniffi_dashshielded_fn_func_stop_sync(`alias`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): Unit +fun uniffi_dashshielded_fn_func_tracked_asset_locks(`alias`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue +fun uniffi_dashshielded_fn_func_unshield(`alias`: RustBuffer.ByValue,`toAddress`: RustBuffer.ByValue,`amountCredits`: RustBuffer.ByValue,`mnemonicSeed`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue fun uniffi_dashshielded_fn_func_warm_up_prover(uniffi_out_err: UniffiRustCallStatus, ): Unit fun ffi_dashshielded_rustbuffer_alloc(`size`: Long,uniffi_out_err: UniffiRustCallStatus, @@ -981,6 +1035,12 @@ private fun uniffiCheckContractApiVersion(lib: IntegrityCheckingUniffiLib) { } @Suppress("UNUSED_PARAMETER") private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { + if (lib.uniffi_dashshielded_checksum_func_core_balance() != 19751.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_dashshielded_checksum_func_core_receive_address() != 65080.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_dashshielded_checksum_func_create_transfer() != 10651.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -1002,15 +1062,30 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_dashshielded_checksum_func_is_valid_address() != 228.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_dashshielded_checksum_func_platform_receive_address() != 21146.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_dashshielded_checksum_func_poll() != 4874.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } if (lib.uniffi_dashshielded_checksum_func_propose_transfer() != 1851.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_dashshielded_checksum_func_resume_shield_from_asset_lock() != 25321.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_dashshielded_checksum_func_set_document_directory() != 41116.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_dashshielded_checksum_func_shield_from_asset_lock() != 11151.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_dashshielded_checksum_func_shielded_withdraw() != 9474.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_dashshielded_checksum_func_start_core_sync() != 10895.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_dashshielded_checksum_func_start_sync() != 56361.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -1020,6 +1095,12 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_dashshielded_checksum_func_stop_sync() != 6076.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } + if (lib.uniffi_dashshielded_checksum_func_tracked_asset_locks() != 28174.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } + if (lib.uniffi_dashshielded_checksum_func_unshield() != 14191.toShort()) { + throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + } if (lib.uniffi_dashshielded_checksum_func_warm_up_prover() != 10994.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -1281,6 +1362,82 @@ public object FfiConverterTypeAddresses: FfiConverterRustBuffer { +data class AssetLock ( + var `txid`: kotlin.String, + var `vout`: kotlin.UInt, + var `status`: kotlin.String +) { + + companion object +} + +/** + * @suppress + */ +public object FfiConverterTypeAssetLock: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): AssetLock { + return AssetLock( + FfiConverterString.read(buf), + FfiConverterUInt.read(buf), + FfiConverterString.read(buf), + ) + } + + override fun allocationSize(value: AssetLock) = ( + FfiConverterString.allocationSize(value.`txid`) + + FfiConverterUInt.allocationSize(value.`vout`) + + FfiConverterString.allocationSize(value.`status`) + ) + + override fun write(value: AssetLock, buf: ByteBuffer) { + FfiConverterString.write(value.`txid`, buf) + FfiConverterUInt.write(value.`vout`, buf) + FfiConverterString.write(value.`status`, buf) + } +} + + + +data class CoreBalance ( + var `confirmedDuffs`: kotlin.String, + var `unconfirmedDuffs`: kotlin.String, + var `totalDuffs`: kotlin.String, + var `syncedHeight`: kotlin.UInt +) { + + companion object +} + +/** + * @suppress + */ +public object FfiConverterTypeCoreBalance: FfiConverterRustBuffer { + override fun read(buf: ByteBuffer): CoreBalance { + return CoreBalance( + FfiConverterString.read(buf), + FfiConverterString.read(buf), + FfiConverterString.read(buf), + FfiConverterUInt.read(buf), + ) + } + + override fun allocationSize(value: CoreBalance) = ( + FfiConverterString.allocationSize(value.`confirmedDuffs`) + + FfiConverterString.allocationSize(value.`unconfirmedDuffs`) + + FfiConverterString.allocationSize(value.`totalDuffs`) + + FfiConverterUInt.allocationSize(value.`syncedHeight`) + ) + + override fun write(value: CoreBalance, buf: ByteBuffer) { + FfiConverterString.write(value.`confirmedDuffs`, buf) + FfiConverterString.write(value.`unconfirmedDuffs`, buf) + FfiConverterString.write(value.`totalDuffs`, buf) + FfiConverterUInt.write(value.`syncedHeight`, buf) + } +} + + + data class Poll ( var `alias`: kotlin.String, var `status`: kotlin.String, @@ -1505,6 +1662,34 @@ public object FfiConverterSequenceString: FfiConverterRustBuffer> { + override fun read(buf: ByteBuffer): List { + val len = buf.getInt() + return List(len) { + FfiConverterTypeAssetLock.read(buf) + } + } + + override fun allocationSize(value: List): ULong { + val sizeForLength = 4UL + val sizeForItems = value.map { FfiConverterTypeAssetLock.allocationSize(it) }.sum() + return sizeForLength + sizeForItems + } + + override fun write(value: List, buf: ByteBuffer) { + buf.putInt(value.size) + value.iterator().forEach { + FfiConverterTypeAssetLock.write(it, buf) + } + } +} + + + + /** * @suppress */ @@ -1529,6 +1714,26 @@ public object FfiConverterSequenceTypeTransaction: FfiConverterRustBuffer + UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_core_balance( + FfiConverterString.lower(`alias`),_status) +} + ) + } + + + @Throws(DashException::class) fun `coreReceiveAddress`(`alias`: kotlin.String, `account`: kotlin.UInt): kotlin.String { + return FfiConverterString.lift( + uniffiRustCallWithError(DashException) { _status -> + UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_core_receive_address( + FfiConverterString.lower(`alias`),FfiConverterUInt.lower(`account`),_status) +} + ) + } + + @Throws(DashException::class) fun `createTransfer`(`alias`: kotlin.String, `proposalId`: kotlin.String, `mnemonicSeed`: kotlin.String): kotlin.String { return FfiConverterString.lift( uniffiRustCallWithError(DashException) { _status -> @@ -1596,6 +1801,16 @@ public object FfiConverterSequenceTypeTransaction: FfiConverterRustBuffer + UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_platform_receive_address( + FfiConverterString.lower(`alias`),FfiConverterUInt.lower(`account`),_status) +} + ) + } + + @Throws(DashException::class) fun `poll`(`alias`: kotlin.String): Poll { return FfiConverterTypePoll.lift( uniffiRustCallWithError(DashException) { _status -> @@ -1616,6 +1831,16 @@ public object FfiConverterSequenceTypeTransaction: FfiConverterRustBuffer + UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_resume_shield_from_asset_lock( + FfiConverterString.lower(`alias`),FfiConverterString.lower(`txid`),FfiConverterUInt.lower(`vout`),FfiConverterString.lower(`mnemonicSeed`),_status) +} + ) + } + + @Throws(DashException::class) fun `setDocumentDirectory`(`path`: kotlin.String) = uniffiRustCallWithError(DashException) { _status -> @@ -1625,6 +1850,35 @@ public object FfiConverterSequenceTypeTransaction: FfiConverterRustBuffer + UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_shield_from_asset_lock( + FfiConverterString.lower(`alias`),FfiConverterString.lower(`amountDuffs`),FfiConverterUInt.lower(`accountIndex`),FfiConverterString.lower(`mnemonicSeed`),_status) +} + ) + } + + + @Throws(DashException::class) fun `shieldedWithdraw`(`alias`: kotlin.String, `toCoreAddress`: kotlin.String, `amountCredits`: kotlin.String, `coreFeePerByte`: kotlin.UInt, `mnemonicSeed`: kotlin.String): kotlin.String { + return FfiConverterString.lift( + uniffiRustCallWithError(DashException) { _status -> + UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_shielded_withdraw( + FfiConverterString.lower(`alias`),FfiConverterString.lower(`toCoreAddress`),FfiConverterString.lower(`amountCredits`),FfiConverterUInt.lower(`coreFeePerByte`),FfiConverterString.lower(`mnemonicSeed`),_status) +} + ) + } + + + @Throws(DashException::class) fun `startCoreSync`(`alias`: kotlin.String, `fromHeight`: kotlin.UInt) + = + uniffiRustCallWithError(DashException) { _status -> + UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_start_core_sync( + FfiConverterString.lower(`alias`),FfiConverterUInt.lower(`fromHeight`),_status) +} + + + @Throws(DashException::class) fun `startSync`(`alias`: kotlin.String) = uniffiRustCallWithError(DashException) { _status -> @@ -1653,6 +1907,26 @@ public object FfiConverterSequenceTypeTransaction: FfiConverterRustBuffer { + return FfiConverterSequenceTypeAssetLock.lift( + uniffiRustCallWithError(DashException) { _status -> + UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_tracked_asset_locks( + FfiConverterString.lower(`alias`),_status) +} + ) + } + + + @Throws(DashException::class) fun `unshield`(`alias`: kotlin.String, `toAddress`: kotlin.String, `amountCredits`: kotlin.String, `mnemonicSeed`: kotlin.String): kotlin.String { + return FfiConverterString.lift( + uniffiRustCallWithError(DashException) { _status -> + UniffiLib.INSTANCE.uniffi_dashshielded_fn_func_unshield( + FfiConverterString.lower(`alias`),FfiConverterString.lower(`toAddress`),FfiConverterString.lower(`amountCredits`),FfiConverterString.lower(`mnemonicSeed`),_status) +} + ) + } + + @Throws(DashException::class) fun `warmUpProver`() = uniffiRustCallWithError(DashException) { _status -> diff --git a/ios/EdgeDashClient.swift b/ios/EdgeDashClient.swift index 3b7a85a..c3a27b9 100644 --- a/ios/EdgeDashClient.swift +++ b/ios/EdgeDashClient.swift @@ -41,6 +41,58 @@ enum EdgeDashClient { try deriveShieldedAddress(alias: alias) } + static func rustCoreReceiveAddress(alias: String, account: UInt32) throws -> String { + try coreReceiveAddress(alias: alias, account: account) + } + + static func rustStartCoreSync(alias: String, fromHeight: UInt32) throws { + try startCoreSync(alias: alias, fromHeight: fromHeight) + } + + static func rustCoreBalance(alias: String) throws -> CoreBalance { + try coreBalance(alias: alias) + } + + static func rustShieldFromAssetLock( + alias: String, amountDuffs: String, accountIndex: UInt32, mnemonicSeed: String + ) throws -> String { + try shieldFromAssetLock( + alias: alias, amountDuffs: amountDuffs, accountIndex: accountIndex, + mnemonicSeed: mnemonicSeed) + } + + static func rustPlatformReceiveAddress(alias: String, account: UInt32) throws -> String { + try platformReceiveAddress(alias: alias, account: account) + } + + static func rustTrackedAssetLocks(alias: String) throws -> [AssetLock] { + try trackedAssetLocks(alias: alias) + } + + static func rustResumeShieldFromAssetLock( + alias: String, txid: String, vout: UInt32, mnemonicSeed: String + ) throws -> String { + try resumeShieldFromAssetLock( + alias: alias, txid: txid, vout: vout, mnemonicSeed: mnemonicSeed) + } + + static func rustUnshield( + alias: String, toAddress: String, amountCredits: String, mnemonicSeed: String + ) throws -> String { + try unshield( + alias: alias, toAddress: toAddress, amountCredits: amountCredits, + mnemonicSeed: mnemonicSeed) + } + + static func rustShieldedWithdraw( + alias: String, toCoreAddress: String, amountCredits: String, coreFeePerByte: UInt32, + mnemonicSeed: String + ) throws -> String { + try shieldedWithdraw( + alias: alias, toCoreAddress: toCoreAddress, amountCredits: amountCredits, + coreFeePerByte: coreFeePerByte, mnemonicSeed: mnemonicSeed) + } + static func rustIsValidAddress(address: String, network: String) -> Bool { isValidAddress(address: address, network: network) } diff --git a/ios/RNDashShielded.m b/ios/RNDashShielded.m index d988ca7..60d5e2e 100644 --- a/ios/RNDashShielded.m +++ b/ios/RNDashShielded.m @@ -33,6 +33,67 @@ @interface RCT_EXTERN_MODULE(RNDashShielded, RCTEventEmitter) rejecter:(RCTPromiseRejectBlock)reject ) +RCT_EXTERN_METHOD(coreReceiveAddress:(NSString *)alias +:(NSInteger *)account +resolver:(RCTPromiseResolveBlock)resolve +rejecter:(RCTPromiseRejectBlock)reject +) + +RCT_EXTERN_METHOD(startCoreSync:(NSString *)alias +:(NSInteger *)fromHeight +resolver:(RCTPromiseResolveBlock)resolve +rejecter:(RCTPromiseRejectBlock)reject +) + +RCT_EXTERN_METHOD(coreBalance:(NSString *)alias +resolver:(RCTPromiseResolveBlock)resolve +rejecter:(RCTPromiseRejectBlock)reject +) + +RCT_EXTERN_METHOD(shieldFromAssetLock:(NSString *)alias +:(NSString *)amountDuffs +:(NSInteger *)accountIndex +:(NSString *)mnemonicSeed +resolver:(RCTPromiseResolveBlock)resolve +rejecter:(RCTPromiseRejectBlock)reject +) + +RCT_EXTERN_METHOD(platformReceiveAddress:(NSString *)alias +:(NSInteger *)account +resolver:(RCTPromiseResolveBlock)resolve +rejecter:(RCTPromiseRejectBlock)reject +) + +RCT_EXTERN_METHOD(trackedAssetLocks:(NSString *)alias +resolver:(RCTPromiseResolveBlock)resolve +rejecter:(RCTPromiseRejectBlock)reject +) + +RCT_EXTERN_METHOD(resumeShieldFromAssetLock:(NSString *)alias +:(NSString *)txid +:(NSInteger *)vout +:(NSString *)mnemonicSeed +resolver:(RCTPromiseResolveBlock)resolve +rejecter:(RCTPromiseRejectBlock)reject +) + +RCT_EXTERN_METHOD(unshield:(NSString *)alias +:(NSString *)toAddress +:(NSString *)amountCredits +:(NSString *)mnemonicSeed +resolver:(RCTPromiseResolveBlock)resolve +rejecter:(RCTPromiseRejectBlock)reject +) + +RCT_EXTERN_METHOD(shieldedWithdraw:(NSString *)alias +:(NSString *)toCoreAddress +:(NSString *)amountCredits +:(NSInteger *)coreFeePerByte +:(NSString *)mnemonicSeed +resolver:(RCTPromiseResolveBlock)resolve +rejecter:(RCTPromiseRejectBlock)reject +) + RCT_EXTERN_METHOD(deriveShieldedAddressFromSeed:(NSString *)seed :(NSString *)network :(NSInteger *)account diff --git a/ios/RNDashShielded.swift b/ios/RNDashShielded.swift index 2065968..4f27d0f 100644 --- a/ios/RNDashShielded.swift +++ b/ios/RNDashShielded.swift @@ -137,6 +137,117 @@ class RNDashShielded: RCTEventEmitter { } } + @objc func coreReceiveAddress( + _ alias: String, _ account: Int, + resolver resolve: @escaping RCTPromiseResolveBlock, + rejecter reject: @escaping RCTPromiseRejectBlock + ) { + run(resolve, reject, "coreReceiveAddress") { + try EdgeDashClient.rustCoreReceiveAddress(alias: alias, account: UInt32(account)) + } + } + + @objc func startCoreSync( + _ alias: String, _ fromHeight: Int, + resolver resolve: @escaping RCTPromiseResolveBlock, + rejecter reject: @escaping RCTPromiseRejectBlock + ) { + run(resolve, reject, "startCoreSync") { + try EdgeDashClient.rustStartCoreSync(alias: alias, fromHeight: UInt32(fromHeight)) + return nil + } + } + + @objc func coreBalance( + _ alias: String, + resolver resolve: @escaping RCTPromiseResolveBlock, + rejecter reject: @escaping RCTPromiseRejectBlock + ) { + run(resolve, reject, "coreBalance") { + let balance = try EdgeDashClient.rustCoreBalance(alias: alias) + return [ + "confirmedDuffs": balance.confirmedDuffs, + "unconfirmedDuffs": balance.unconfirmedDuffs, + "totalDuffs": balance.totalDuffs, + "syncedHeight": balance.syncedHeight, + ] + } + } + + @objc func shieldFromAssetLock( + _ alias: String, _ amountDuffs: String, _ accountIndex: Int, _ mnemonicSeed: String, + resolver resolve: @escaping RCTPromiseResolveBlock, + rejecter reject: @escaping RCTPromiseRejectBlock + ) { + run(resolve, reject, "shieldFromAssetLock") { + try EdgeDashClient.rustShieldFromAssetLock( + alias: alias, amountDuffs: amountDuffs, accountIndex: UInt32(accountIndex), + mnemonicSeed: mnemonicSeed) + } + } + + @objc func platformReceiveAddress( + _ alias: String, _ account: Int, + resolver resolve: @escaping RCTPromiseResolveBlock, + rejecter reject: @escaping RCTPromiseRejectBlock + ) { + run(resolve, reject, "platformReceiveAddress") { + try EdgeDashClient.rustPlatformReceiveAddress(alias: alias, account: UInt32(account)) + } + } + + @objc func trackedAssetLocks( + _ alias: String, + resolver resolve: @escaping RCTPromiseResolveBlock, + rejecter reject: @escaping RCTPromiseRejectBlock + ) { + run(resolve, reject, "trackedAssetLocks") { + try EdgeDashClient.rustTrackedAssetLocks(alias: alias).map { lock in + [ + "txid": lock.txid, + "vout": lock.vout, + "status": lock.status, + ] as NSDictionary + } + } + } + + @objc func resumeShieldFromAssetLock( + _ alias: String, _ txid: String, _ vout: Int, _ mnemonicSeed: String, + resolver resolve: @escaping RCTPromiseResolveBlock, + rejecter reject: @escaping RCTPromiseRejectBlock + ) { + run(resolve, reject, "resumeShieldFromAssetLock") { + try EdgeDashClient.rustResumeShieldFromAssetLock( + alias: alias, txid: txid, vout: UInt32(vout), mnemonicSeed: mnemonicSeed) + } + } + + @objc func unshield( + _ alias: String, _ toAddress: String, _ amountCredits: String, _ mnemonicSeed: String, + resolver resolve: @escaping RCTPromiseResolveBlock, + rejecter reject: @escaping RCTPromiseRejectBlock + ) { + run(resolve, reject, "unshield") { + try EdgeDashClient.rustUnshield( + alias: alias, toAddress: toAddress, amountCredits: amountCredits, + mnemonicSeed: mnemonicSeed) + } + } + + @objc func shieldedWithdraw( + _ alias: String, _ toCoreAddress: String, _ amountCredits: String, + _ coreFeePerByte: Int, _ mnemonicSeed: String, + resolver resolve: @escaping RCTPromiseResolveBlock, + rejecter reject: @escaping RCTPromiseRejectBlock + ) { + run(resolve, reject, "shieldedWithdraw") { + try EdgeDashClient.rustShieldedWithdraw( + alias: alias, toCoreAddress: toCoreAddress, amountCredits: amountCredits, + coreFeePerByte: UInt32(coreFeePerByte), mnemonicSeed: mnemonicSeed) + } + } + @objc func isValidAddress( _ address: String, _ network: String, resolver resolve: @escaping RCTPromiseResolveBlock, diff --git a/ios/dash.swift b/ios/dash.swift index 0648c86..85e483d 100644 --- a/ios/dash.swift +++ b/ios/dash.swift @@ -573,6 +573,170 @@ public func FfiConverterTypeAddresses_lower(_ value: Addresses) -> RustBuffer { } +public struct AssetLock { + public var txid: String + public var vout: UInt32 + public var status: String + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(txid: String, vout: UInt32, status: String) { + self.txid = txid + self.vout = vout + self.status = status + } +} + +#if compiler(>=6) +extension AssetLock: Sendable {} +#endif + + +extension AssetLock: Equatable, Hashable { + public static func ==(lhs: AssetLock, rhs: AssetLock) -> Bool { + if lhs.txid != rhs.txid { + return false + } + if lhs.vout != rhs.vout { + return false + } + if lhs.status != rhs.status { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(txid) + hasher.combine(vout) + hasher.combine(status) + } +} + + + +#if swift(>=5.8) +@_documentation(visibility: private) +#endif +public struct FfiConverterTypeAssetLock: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AssetLock { + return + try AssetLock( + txid: FfiConverterString.read(from: &buf), + vout: FfiConverterUInt32.read(from: &buf), + status: FfiConverterString.read(from: &buf) + ) + } + + public static func write(_ value: AssetLock, into buf: inout [UInt8]) { + FfiConverterString.write(value.txid, into: &buf) + FfiConverterUInt32.write(value.vout, into: &buf) + FfiConverterString.write(value.status, into: &buf) + } +} + + +#if swift(>=5.8) +@_documentation(visibility: private) +#endif +public func FfiConverterTypeAssetLock_lift(_ buf: RustBuffer) throws -> AssetLock { + return try FfiConverterTypeAssetLock.lift(buf) +} + +#if swift(>=5.8) +@_documentation(visibility: private) +#endif +public func FfiConverterTypeAssetLock_lower(_ value: AssetLock) -> RustBuffer { + return FfiConverterTypeAssetLock.lower(value) +} + + +public struct CoreBalance { + public var confirmedDuffs: String + public var unconfirmedDuffs: String + public var totalDuffs: String + public var syncedHeight: UInt32 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(confirmedDuffs: String, unconfirmedDuffs: String, totalDuffs: String, syncedHeight: UInt32) { + self.confirmedDuffs = confirmedDuffs + self.unconfirmedDuffs = unconfirmedDuffs + self.totalDuffs = totalDuffs + self.syncedHeight = syncedHeight + } +} + +#if compiler(>=6) +extension CoreBalance: Sendable {} +#endif + + +extension CoreBalance: Equatable, Hashable { + public static func ==(lhs: CoreBalance, rhs: CoreBalance) -> Bool { + if lhs.confirmedDuffs != rhs.confirmedDuffs { + return false + } + if lhs.unconfirmedDuffs != rhs.unconfirmedDuffs { + return false + } + if lhs.totalDuffs != rhs.totalDuffs { + return false + } + if lhs.syncedHeight != rhs.syncedHeight { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(confirmedDuffs) + hasher.combine(unconfirmedDuffs) + hasher.combine(totalDuffs) + hasher.combine(syncedHeight) + } +} + + + +#if swift(>=5.8) +@_documentation(visibility: private) +#endif +public struct FfiConverterTypeCoreBalance: FfiConverterRustBuffer { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CoreBalance { + return + try CoreBalance( + confirmedDuffs: FfiConverterString.read(from: &buf), + unconfirmedDuffs: FfiConverterString.read(from: &buf), + totalDuffs: FfiConverterString.read(from: &buf), + syncedHeight: FfiConverterUInt32.read(from: &buf) + ) + } + + public static func write(_ value: CoreBalance, into buf: inout [UInt8]) { + FfiConverterString.write(value.confirmedDuffs, into: &buf) + FfiConverterString.write(value.unconfirmedDuffs, into: &buf) + FfiConverterString.write(value.totalDuffs, into: &buf) + FfiConverterUInt32.write(value.syncedHeight, into: &buf) + } +} + + +#if swift(>=5.8) +@_documentation(visibility: private) +#endif +public func FfiConverterTypeCoreBalance_lift(_ buf: RustBuffer) throws -> CoreBalance { + return try FfiConverterTypeCoreBalance.lift(buf) +} + +#if swift(>=5.8) +@_documentation(visibility: private) +#endif +public func FfiConverterTypeCoreBalance_lower(_ value: CoreBalance) -> RustBuffer { + return FfiConverterTypeCoreBalance.lower(value) +} + + public struct Poll { public var alias: String public var status: String @@ -917,6 +1081,31 @@ fileprivate struct FfiConverterSequenceString: FfiConverterRustBuffer { } } +#if swift(>=5.8) +@_documentation(visibility: private) +#endif +fileprivate struct FfiConverterSequenceTypeAssetLock: FfiConverterRustBuffer { + typealias SwiftType = [AssetLock] + + public static func write(_ value: [AssetLock], into buf: inout [UInt8]) { + let len = Int32(value.count) + writeInt(&buf, len) + for item in value { + FfiConverterTypeAssetLock.write(item, into: &buf) + } + } + + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AssetLock] { + let len: Int32 = try readInt(&buf) + var seq = [AssetLock]() + seq.reserveCapacity(Int(len)) + for _ in 0 ..< len { + seq.append(try FfiConverterTypeAssetLock.read(from: &buf)) + } + return seq + } +} + #if swift(>=5.8) @_documentation(visibility: private) #endif @@ -941,6 +1130,21 @@ fileprivate struct FfiConverterSequenceTypeTransaction: FfiConverterRustBuffer { return seq } } +public func coreBalance(alias: String)throws -> CoreBalance { + return try FfiConverterTypeCoreBalance_lift(try rustCallWithError(FfiConverterTypeDashError_lift) { + uniffi_dashshielded_fn_func_core_balance( + FfiConverterString.lower(alias),$0 + ) +}) +} +public func coreReceiveAddress(alias: String, account: UInt32)throws -> String { + return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeDashError_lift) { + uniffi_dashshielded_fn_func_core_receive_address( + FfiConverterString.lower(alias), + FfiConverterUInt32.lower(account),$0 + ) +}) +} public func createTransfer(alias: String, proposalId: String, mnemonicSeed: String)throws -> String { return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeDashError_lift) { uniffi_dashshielded_fn_func_create_transfer( @@ -999,6 +1203,14 @@ public func isValidAddress(address: String, network: String) -> Bool { ) }) } +public func platformReceiveAddress(alias: String, account: UInt32)throws -> String { + return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeDashError_lift) { + uniffi_dashshielded_fn_func_platform_receive_address( + FfiConverterString.lower(alias), + FfiConverterUInt32.lower(account),$0 + ) +}) +} public func poll(alias: String)throws -> Poll { return try FfiConverterTypePoll_lift(try rustCallWithError(FfiConverterTypeDashError_lift) { uniffi_dashshielded_fn_func_poll( @@ -1016,12 +1228,50 @@ public func proposeTransfer(alias: String, amountCredits: String, toAddress: Str ) }) } +public func resumeShieldFromAssetLock(alias: String, txid: String, vout: UInt32, mnemonicSeed: String)throws -> String { + return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeDashError_lift) { + uniffi_dashshielded_fn_func_resume_shield_from_asset_lock( + FfiConverterString.lower(alias), + FfiConverterString.lower(txid), + FfiConverterUInt32.lower(vout), + FfiConverterString.lower(mnemonicSeed),$0 + ) +}) +} public func setDocumentDirectory(path: String)throws {try rustCallWithError(FfiConverterTypeDashError_lift) { uniffi_dashshielded_fn_func_set_document_directory( FfiConverterString.lower(path),$0 ) } } +public func shieldFromAssetLock(alias: String, amountDuffs: String, accountIndex: UInt32, mnemonicSeed: String)throws -> String { + return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeDashError_lift) { + uniffi_dashshielded_fn_func_shield_from_asset_lock( + FfiConverterString.lower(alias), + FfiConverterString.lower(amountDuffs), + FfiConverterUInt32.lower(accountIndex), + FfiConverterString.lower(mnemonicSeed),$0 + ) +}) +} +public func shieldedWithdraw(alias: String, toCoreAddress: String, amountCredits: String, coreFeePerByte: UInt32, mnemonicSeed: String)throws -> String { + return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeDashError_lift) { + uniffi_dashshielded_fn_func_shielded_withdraw( + FfiConverterString.lower(alias), + FfiConverterString.lower(toCoreAddress), + FfiConverterString.lower(amountCredits), + FfiConverterUInt32.lower(coreFeePerByte), + FfiConverterString.lower(mnemonicSeed),$0 + ) +}) +} +public func startCoreSync(alias: String, fromHeight: UInt32)throws {try rustCallWithError(FfiConverterTypeDashError_lift) { + uniffi_dashshielded_fn_func_start_core_sync( + FfiConverterString.lower(alias), + FfiConverterUInt32.lower(fromHeight),$0 + ) +} +} public func startSync(alias: String)throws {try rustCallWithError(FfiConverterTypeDashError_lift) { uniffi_dashshielded_fn_func_start_sync( FfiConverterString.lower(alias),$0 @@ -1041,6 +1291,23 @@ public func stopSync(alias: String)throws {try rustCallWithError(FfiConverterT ) } } +public func trackedAssetLocks(alias: String)throws -> [AssetLock] { + return try FfiConverterSequenceTypeAssetLock.lift(try rustCallWithError(FfiConverterTypeDashError_lift) { + uniffi_dashshielded_fn_func_tracked_asset_locks( + FfiConverterString.lower(alias),$0 + ) +}) +} +public func unshield(alias: String, toAddress: String, amountCredits: String, mnemonicSeed: String)throws -> String { + return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeDashError_lift) { + uniffi_dashshielded_fn_func_unshield( + FfiConverterString.lower(alias), + FfiConverterString.lower(toAddress), + FfiConverterString.lower(amountCredits), + FfiConverterString.lower(mnemonicSeed),$0 + ) +}) +} public func warmUpProver()throws {try rustCallWithError(FfiConverterTypeDashError_lift) { uniffi_dashshielded_fn_func_warm_up_prover($0 ) @@ -1062,6 +1329,12 @@ private let initializationResult: InitializationResult = { if bindings_contract_version != scaffolding_contract_version { return InitializationResult.contractVersionMismatch } + if (uniffi_dashshielded_checksum_func_core_balance() != 19751) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_dashshielded_checksum_func_core_receive_address() != 65080) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_dashshielded_checksum_func_create_transfer() != 10651) { return InitializationResult.apiChecksumMismatch } @@ -1083,15 +1356,30 @@ private let initializationResult: InitializationResult = { if (uniffi_dashshielded_checksum_func_is_valid_address() != 228) { return InitializationResult.apiChecksumMismatch } + if (uniffi_dashshielded_checksum_func_platform_receive_address() != 21146) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_dashshielded_checksum_func_poll() != 4874) { return InitializationResult.apiChecksumMismatch } if (uniffi_dashshielded_checksum_func_propose_transfer() != 1851) { return InitializationResult.apiChecksumMismatch } + if (uniffi_dashshielded_checksum_func_resume_shield_from_asset_lock() != 25321) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_dashshielded_checksum_func_set_document_directory() != 41116) { return InitializationResult.apiChecksumMismatch } + if (uniffi_dashshielded_checksum_func_shield_from_asset_lock() != 11151) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_dashshielded_checksum_func_shielded_withdraw() != 9474) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_dashshielded_checksum_func_start_core_sync() != 10895) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_dashshielded_checksum_func_start_sync() != 56361) { return InitializationResult.apiChecksumMismatch } @@ -1101,6 +1389,12 @@ private let initializationResult: InitializationResult = { if (uniffi_dashshielded_checksum_func_stop_sync() != 6076) { return InitializationResult.apiChecksumMismatch } + if (uniffi_dashshielded_checksum_func_tracked_asset_locks() != 28174) { + return InitializationResult.apiChecksumMismatch + } + if (uniffi_dashshielded_checksum_func_unshield() != 14191) { + return InitializationResult.apiChecksumMismatch + } if (uniffi_dashshielded_checksum_func_warm_up_prover() != 10994) { return InitializationResult.apiChecksumMismatch } diff --git a/package-lock.json b/package-lock.json index 653a48d..1a8cfc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dash-shielded-native", - "version": "0.1.0", + "version": "0.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dash-shielded-native", - "version": "0.1.0", + "version": "0.0.1", "license": "MIT", "dependencies": { "biggystring": "^4.2.3" @@ -19,15 +19,15 @@ "@types/node": "^14.0.5", "@types/react": "^16.14.62", "@types/react-native": "^0.62.11", - "@typescript-eslint/eslint-plugin": "^2.34.0", - "@typescript-eslint/parser": "^3.0.1", + "@typescript-eslint/eslint-plugin": "^5.36.2", + "@typescript-eslint/parser": "^5.36.2", "babel-eslint": "^10.1.0", - "eslint": "^7.15.0", - "eslint-config-standard-kit": "^0.14.4", + "eslint": "^8.57.0", + "eslint-config-standard-kit": "0.15.1", "eslint-plugin-import": "^2.20.2", "eslint-plugin-prettier": "^3.1.3", "eslint-plugin-promise": "^4.2.1", - "eslint-plugin-simple-import-sort": "^5.0.3", + "eslint-plugin-simple-import-sort": "^6.0.1", "eslint-plugin-standard": "^4.0.1", "prettier": "^2.0.5", "rimraf": "^3.0.2", @@ -36,7 +36,7 @@ "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-node-resolve": "^5.2.0", "sucrase": "^3.15.0", - "typescript": "^3.9.3" + "typescript": "5.0.4" }, "peerDependencies": { "react-native": ">=0.47.0 <1.0.0" @@ -395,100 +395,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/highlight": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.25.9.tgz", - "integrity": "sha512-llL88JShoCsth8fF8R4SJnIn+WLvR6ccFxu1H3FlMhDontdcmZWf2HgIZ7AIqV3Xcck1idlohrN4EUBQz6klbw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.25.9", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@babel/highlight/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/@babel/parser": { "version": "7.29.8", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.8.tgz", @@ -1771,25 +1677,67 @@ "node": ">=6.9.0" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", + "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, "node_modules/@eslint/eslintrc": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", - "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, "license": "MIT", "dependencies": { "ajv": "^6.12.4", - "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^13.9.0", - "ignore": "^4.0.6", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", "strip-json-comments": "^3.1.1" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/js": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/@gar/promisify": { @@ -1800,25 +1748,39 @@ "license": "MIT" }, "node_modules/@humanwhocodes/config-array": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", - "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", "deprecated": "Use @eslint/config-array instead", "dev": true, "license": "Apache-2.0", "dependencies": { - "@humanwhocodes/object-schema": "^1.2.0", - "debug": "^4.1.1", - "minimatch": "^3.0.4" + "@humanwhocodes/object-schema": "^2.0.3", + "debug": "^4.3.1", + "minimatch": "^3.0.5" }, "engines": { "node": ">=10.10.0" } }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", "deprecated": "Use @eslint/object-schema instead", "dev": true, "license": "BSD-3-Clause" @@ -1987,6 +1949,44 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@npmcli/fs": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-3.1.1.tgz", @@ -2371,13 +2371,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@types/eslint-visitor-keys": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", - "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -2407,15 +2400,15 @@ "license": "MIT" }, "node_modules/@types/react": { - "version": "16.14.62", - "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.62.tgz", - "integrity": "sha512-BWf7hqninZav6nerxXj+NeZT/mTpDeG6Lk2zREHAy63CrnXoOGPGtNqTFYFN/sqpSaREDP5otVV88axIXmKfGA==", + "version": "16.14.70", + "resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.70.tgz", + "integrity": "sha512-DM5Q7rSx9G6QYcVvMgxvEurL5P06OxcDNUXrLxlpBzG4ccUewcBCmsztYbxJBobzO8RIwwmjoaD5OsKqdHDuYQ==", "dev": true, "license": "MIT", "dependencies": { "@types/prop-types": "*", "@types/scheduler": "^0.16", - "csstype": "^3.0.2" + "csstype": "^3.2.2" } }, "node_modules/@types/react-native": { @@ -2445,28 +2438,41 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/semver": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.8.0.tgz", + "integrity": "sha512-1mAINjtQCXXeLkJ9ehXkwOcBpqtLxiVtKhpUf83DdRNdQKV0iXZpaHYqRr7nj+wvxuJzoAmAwXI+sCNMv1CzLQ==", + "dev": true, + "license": "MIT" + }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz", - "integrity": "sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ==", + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz", + "integrity": "sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/experimental-utils": "2.34.0", - "functional-red-black-tree": "^1.0.1", - "regexpp": "^3.0.0", - "tsutils": "^3.17.1" + "@eslint-community/regexpp": "^4.4.0", + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/type-utils": "5.62.0", + "@typescript-eslint/utils": "5.62.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "natural-compare-lite": "^1.4.0", + "semver": "^7.3.7", + "tsutils": "^3.21.0" }, "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^2.0.0", - "eslint": "^5.0.0 || ^6.0.0" + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -2474,51 +2480,86 @@ } } }, - "node_modules/@typescript-eslint/experimental-utils": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz", - "integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==", + "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz", + "integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==", "dev": true, - "license": "MIT", + "license": "BSD-2-Clause", "dependencies": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.34.0", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0" + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "debug": "^4.3.4" }, "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "*" + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/@typescript-eslint/parser": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.10.1.tgz", - "integrity": "sha512-Ug1RcWcrJP02hmtaXVS3axPPTTPnZjupqhgj+NnZ6BCkwSImWk/283347+x9wN+lqOdK9Eo3vsyiyDHgsmiEJw==", + "node_modules/@typescript-eslint/scope-manager": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz", + "integrity": "sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "3.10.1", - "@typescript-eslint/types": "3.10.1", - "@typescript-eslint/typescript-estree": "3.10.1", - "eslint-visitor-keys": "^1.1.0" + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/visitor-keys": "5.62.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz", + "integrity": "sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/typescript-estree": "5.62.0", + "@typescript-eslint/utils": "5.62.0", + "debug": "^4.3.4", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" + "eslint": "*" }, "peerDependenciesMeta": { "typescript": { @@ -2526,48 +2567,37 @@ } } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/experimental-utils": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.10.1.tgz", - "integrity": "sha512-DewqIgscDzmAfd5nOGe4zm6Bl7PKtMG2Ad0KG8CUZAHlXfAKTF9Ol5PXhiMh39yRL2ChRH1cuuUGOcVyyrhQIw==", + "node_modules/@typescript-eslint/types": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz", + "integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==", "dev": true, "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/types": "3.10.1", - "@typescript-eslint/typescript-estree": "3.10.1", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0" - }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "*" } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz", - "integrity": "sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w==", + "node_modules/@typescript-eslint/typescript-estree": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz", + "integrity": "sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/types": "3.10.1", - "@typescript-eslint/visitor-keys": "3.10.1", - "debug": "^4.1.1", - "glob": "^7.1.6", - "is-glob": "^4.0.1", - "lodash": "^4.17.15", - "semver": "^7.3.2", - "tsutils": "^3.17.1" + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/visitor-keys": "5.62.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", @@ -2579,7 +2609,7 @@ } } }, - "node_modules/@typescript-eslint/parser/node_modules/semver": { + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { "version": "7.8.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", @@ -2592,49 +2622,34 @@ "node": ">=10" } }, - "node_modules/@typescript-eslint/types": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.10.1.tgz", - "integrity": "sha512-+3+FCUJIahE9q0lDi1WleYzjCwJs5hIsbugIgnbB+dSCYUxl8L6PwmsyOPFZde2hc1DlTo/xnkOgiTLSyAbHiQ==", + "node_modules/@typescript-eslint/utils": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.62.0.tgz", + "integrity": "sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==", "dev": true, "license": "MIT", - "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", - "integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==", - "dev": true, - "license": "BSD-2-Clause", "dependencies": { - "debug": "^4.1.1", - "eslint-visitor-keys": "^1.1.0", - "glob": "^7.1.6", - "is-glob": "^4.0.1", - "lodash": "^4.17.15", - "semver": "^7.3.2", - "tsutils": "^3.17.1" + "@eslint-community/eslint-utils": "^4.2.0", + "@types/json-schema": "^7.0.9", + "@types/semver": "^7.3.12", + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "eslint-scope": "^5.1.1", + "semver": "^7.3.7" }, "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "node_modules/@typescript-eslint/utils/node_modules/semver": { "version": "7.8.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", @@ -2648,22 +2663,30 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz", - "integrity": "sha512-9JgC82AaQeglebjZMgYR5wgmfUdUc+EitGUUMW8u2nDckaeimzW+VsoLV6FoimPv2id3VQzfjwBxEMVz08ameQ==", + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz", + "integrity": "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==", "dev": true, "license": "MIT", "dependencies": { - "eslint-visitor-keys": "^1.1.0" + "@typescript-eslint/types": "5.62.0", + "eslint-visitor-keys": "^3.3.0" }, "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@ungap/structured-clone": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.4.0.tgz", + "integrity": "sha512-1mEZtMKPM09vDmQt5y7YvmN2+DFTP7Tg0EWXdic8/C6VRnpb33e4ghisCIE3WZjsE2N8mf+QV1Zqh7ZFYLWInQ==", + "dev": true, + "license": "ISC" + }, "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -2672,9 +2695,9 @@ "license": "ISC" }, "node_modules/acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.18.0.tgz", + "integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==", "dev": true, "license": "MIT", "bin": { @@ -2761,16 +2784,6 @@ "string-width": "^4.1.0" } }, - "node_modules/ansi-colors": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -2827,14 +2840,11 @@ } }, "node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true, - "license": "MIT", - "dependencies": { - "sprintf-js": "~1.0.2" - } + "license": "Python-2.0" }, "node_modules/array-buffer-byte-length": { "version": "1.0.2", @@ -2876,6 +2886,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/array.prototype.findlastindex": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.6.tgz", @@ -2958,16 +2978,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/async-function": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", @@ -3016,6 +3026,16 @@ "eslint": ">= 4.12.1" } }, + "node_modules/babel-eslint/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=4" + } + }, "node_modules/babel-plugin-polyfill-corejs2": { "version": "0.4.17", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.17.tgz", @@ -3066,9 +3086,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.11.20", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.20.tgz", - "integrity": "sha512-H0ulySigv6icDJ1F7SjtdCD6PrhTpdYCmP0CactWy1+ekh0AFd0o1Wn5T8b+hnTmdBx19u9yhL6wvCylXMY7zw==", + "version": "2.11.21", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.21.tgz", + "integrity": "sha512-uh8vpY/1/YyFkunIDFH/12p7/7VdPKA1hejMVEbdkEaWnUz0Hesvx5EbiU6XxjyHZIOju+ZMbQJkRh+es3/spQ==", "dev": true, "license": "Apache-2.0", "bin": { @@ -3127,6 +3147,19 @@ "concat-map": "0.0.1" } }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/brotli-size": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/brotli-size/-/brotli-size-4.0.0.tgz", @@ -3141,9 +3174,9 @@ } }, "node_modules/browserslist": { - "version": "4.28.8", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.8.tgz", - "integrity": "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==", + "version": "4.28.9", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.9.tgz", + "integrity": "sha512-EWazOblFYUvlGZcfGhPUPmYh3nikUxBVb+y9MJun5f3hBi812X+8MSQTujLBtgK3cf51fJWbWfOjyeO954d+Eg==", "dev": true, "funding": [ { @@ -3161,11 +3194,11 @@ ], "license": "MIT", "dependencies": { - "baseline-browser-mapping": "^2.11.12", - "caniuse-lite": "^1.0.30001809", - "electron-to-chromium": "^1.5.402", - "node-releases": "^2.0.53", - "update-browserslist-db": "^1.3.0" + "baseline-browser-mapping": "^2.11.20", + "caniuse-lite": "^1.0.30001810", + "electron-to-chromium": "^1.5.420", + "node-releases": "^2.0.54", + "update-browserslist-db": "^1.3.2" }, "bin": { "browserslist": "cli.js" @@ -3662,6 +3695,19 @@ "dev": true, "license": "MIT" }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -3704,9 +3750,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.417", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.417.tgz", - "integrity": "sha512-4T+DTDWuMPM4aHlHwWdAVCVWwp7LDilnhzkj+c/Lbj91XSQrLuOmZSLtS9Q4iIqjlPUbPOnC624zDVVHCHaolQ==", + "version": "1.5.424", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.424.tgz", + "integrity": "sha512-rTOe76LHREmnLOWc0NlakB7AlnWjhTNflk4YE3gnIBPbSXLiY+VDEgwYl4wAYdBPD7eq9NQq6TR8lvd9Fls2CA==", "dev": true, "license": "ISC" }, @@ -3728,20 +3774,6 @@ "iconv-lite": "^0.6.2" } }, - "node_modules/enquirer": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", - "integrity": "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-colors": "^4.1.1", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8.6" - } - }, "node_modules/env-paths": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", @@ -3954,68 +3986,66 @@ } }, "node_modules/eslint": { - "version": "7.32.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", - "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.3", - "@humanwhocodes/config-array": "^0.5.0", - "ajv": "^6.10.0", + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", - "debug": "^4.0.1", + "debug": "^4.3.2", "doctrine": "^3.0.0", - "enquirer": "^2.3.5", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^2.0.0", - "espree": "^7.3.1", - "esquery": "^1.4.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.1.2", - "globals": "^13.6.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", - "strip-json-comments": "^3.1.0", - "table": "^6.0.9", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" }, "bin": { "eslint": "bin/eslint.js" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/eslint" } }, "node_modules/eslint-config-standard-kit": { - "version": "0.14.6", - "resolved": "https://registry.npmjs.org/eslint-config-standard-kit/-/eslint-config-standard-kit-0.14.6.tgz", - "integrity": "sha512-lhKbtf2zSB+0iWyd8aj/Uh80trpEEXTeQVSsCcSi99DPyim9///Yh7WNVl9O1EDIpWUtXokKgoHv+BUSj5+92Q==", + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/eslint-config-standard-kit/-/eslint-config-standard-kit-0.15.1.tgz", + "integrity": "sha512-2GWaMElSjB1eTy3NetdnRCwKfidmdCyT7tJAOo11AZN3qlNPut51bd+8hG0bhbKAqUC0px2DyM+uI6uDyx9L9w==", "dev": true, "license": "MIT" }, @@ -4183,9 +4213,9 @@ } }, "node_modules/eslint-plugin-simple-import-sort": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-5.0.3.tgz", - "integrity": "sha512-1rf3AWiHeWNCQdAq0iXNnlccnH1UDnelGgrPbjBBHE8d2hXVtOudcmy0vTF4hri3iJ0MKz8jBhmH6lJ0ZWZLHQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-6.0.1.tgz", + "integrity": "sha512-RfFnoi7fQtv7z9sZNJidIcZgWc0ZJe8uOPC3ldmatai4Igr5iDpzTmSUDEZKYm4TnrR01N0X32kfKvax7bivHQ==", "dev": true, "license": "MIT", "peerDependencies": { @@ -4230,92 +4260,62 @@ "node": ">=8.0.0" } }, - "node_modules/eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", - "dev": true, - "license": "MIT", - "dependencies": { - "eslint-visitor-keys": "^1.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, "node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, "license": "Apache-2.0", "engines": { - "node": ">=4" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/@babel/code-frame": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", - "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, - "license": "MIT", + "license": "BSD-2-Clause", "dependencies": { - "@babel/highlight": "^7.10.4" - } - }, - "node_modules/eslint/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true, - "license": "Apache-2.0", + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, "engines": { - "node": ">=10" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/semver": { - "version": "7.8.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", - "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "node_modules/eslint/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, + "license": "BSD-2-Clause", "engines": { - "node": ">=10" + "node": ">=4.0" } }, "node_modules/espree": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", - "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^1.3.0" + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" }, "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "license": "BSD-2-Clause", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, - "engines": { - "node": ">=4" + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/esquery": { @@ -4412,6 +4412,36 @@ "dev": true, "license": "Apache-2.0" }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -4426,39 +4456,14 @@ "dev": true, "license": "MIT" }, - "node_modules/fast-uri": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.6.tgz", - "integrity": "sha512-7Ical1vFEMr0onbVzEDIreM22I4khW+fzyQPwvAFWBp1iwdshSZRsL4jjRvPG9JP1uiqMHRto+YU6R2/CzDz5Q==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fastify" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fastify" - } - ], - "license": "BSD-3-Clause" - }, - "node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "node_modules/fastq": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.3.tgz", + "integrity": "sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw==", "dev": true, - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" } }, "node_modules/file-entry-cache": { @@ -4484,6 +4489,36 @@ "node": ">= 0.4.0" } }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/flat-cache": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", @@ -4631,13 +4666,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true, - "license": "MIT" - }, "node_modules/functions-have-names": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", @@ -4769,16 +4797,16 @@ } }, "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, "license": "ISC", "dependencies": { - "is-glob": "^4.0.1" + "is-glob": "^4.0.3" }, "engines": { - "node": ">= 6" + "node": ">=10.13.0" } }, "node_modules/globals": { @@ -4814,6 +4842,27 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/gopd": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", @@ -4834,6 +4883,13 @@ "dev": true, "license": "ISC" }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, "node_modules/gzip-size": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-6.0.0.tgz", @@ -5042,9 +5098,9 @@ } }, "node_modules/ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", "dev": true, "license": "MIT", "engines": { @@ -5438,6 +5494,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/is-number-object": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", @@ -5455,6 +5521,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/is-regex": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", @@ -5638,14 +5714,23 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "3.15.2", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.15.2.tgz", - "integrity": "sha512-6EuL879VkRA+1Cz578mKMiKvjPNEuk6+r1JaFzoSWejZmtf7xWbIyw1e3KkxlkzTIt9Taw6JBhEppG7utc1P+w==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], "license": "MIT", "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" @@ -5749,12 +5834,21 @@ "dev": true, "license": "MIT" }, - "node_modules/lodash": { - "version": "4.18.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", - "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, - "license": "MIT" + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/lodash.debounce": { "version": "4.0.8", @@ -5770,13 +5864,6 @@ "dev": true, "license": "MIT" }, - "node_modules/lodash.truncate": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", - "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", - "dev": true, - "license": "MIT" - }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -6008,6 +6095,30 @@ "node": ">= 0.4" } }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/minimatch": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", @@ -6315,6 +6426,13 @@ "dev": true, "license": "MIT" }, + "node_modules/natural-compare-lite": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.1.tgz", + "integrity": "sha512-8Mz06azhPqiDlxhUaUTjBhNAbib/1MoPr89kgmuV6Ir8ICT2/Q/XSYg6VfL3fq2x8MpSQX8sqyI/NeZ5GsGyXA==", + "dev": true, + "license": "MIT" + }, "node_modules/negotiator": { "version": "0.6.4", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz", @@ -6829,6 +6947,38 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-map": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", @@ -6898,6 +7048,16 @@ "node": ">=6" } }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -6949,6 +7109,16 @@ "dev": true, "license": "ISC" }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -6957,13 +7127,13 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", - "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", "dev": true, "license": "MIT", "engines": { - "node": ">=12" + "node": ">=8.6" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" @@ -7038,16 +7208,6 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -7079,6 +7239,27 @@ "node": ">=6" } }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/read-package-json": { "version": "6.0.4", "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-6.0.4.tgz", @@ -7247,19 +7428,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, "node_modules/regexpu-core": { "version": "6.4.0", "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-6.4.0.tgz", @@ -7298,16 +7466,6 @@ "regjsparser": "bin/parser" } }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/resolve": { "version": "1.22.12", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.12.tgz", @@ -7350,6 +7508,17 @@ "node": ">= 4" } }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -7447,6 +7616,30 @@ "estree-walker": "^0.6.1" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/safe-array-concat": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.4.tgz", @@ -7788,22 +7981,14 @@ "node": ">=16 || 14 >=14.17" } }, - "node_modules/slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/slice-ansi?sponsor=1" + "node": ">=8" } }, "node_modules/smart-buffer": { @@ -7818,9 +8003,9 @@ } }, "node_modules/socks": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.9.tgz", - "integrity": "sha512-LJhUYUvItdQ0LkJTmPeaEObWXAqFyfmP85x0tch/ez9cahmhlBBLbIqDFnvBnUJGagb0JbIQrkBs1wJ+yRYpEw==", + "version": "2.8.10", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.10.tgz", + "integrity": "sha512-e0VyvkVTwVYViNovRkZ9aodhxVlyoMn7eJhVUPxZ+eK9P/7CBkxvvsBOHqFPEH416726W8tLXXXjKwqgTErrCQ==", "dev": true, "license": "MIT", "dependencies": { @@ -7904,13 +8089,6 @@ "dev": true, "license": "CC0-1.0" }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true, - "license": "BSD-3-Clause" - }, "node_modules/ssri": { "version": "10.0.6", "resolved": "https://registry.npmjs.org/ssri/-/ssri-10.0.6.tgz", @@ -8148,47 +8326,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/table": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/table/-/table-6.9.0.tgz", - "integrity": "sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "ajv": "^8.0.1", - "lodash.truncate": "^4.4.2", - "slice-ansi": "^4.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/table/node_modules/ajv": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz", - "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/table/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "license": "MIT" - }, "node_modules/tar": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", @@ -8260,19 +8397,6 @@ "node": ">=10" } }, - "node_modules/terser/node_modules/acorn": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.18.0.tgz", - "integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/terser/node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -8327,6 +8451,50 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/ts-interface-checker": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", @@ -8568,9 +8736,9 @@ } }, "node_modules/typescript": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", - "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -8578,7 +8746,7 @@ "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=12.20" } }, "node_modules/unbox-primitive": { @@ -8718,13 +8886,6 @@ "dev": true, "license": "MIT" }, - "node_modules/v8-compile-cache": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.4.0.tgz", - "integrity": "sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==", - "dev": true, - "license": "MIT" - }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -8934,6 +9095,19 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true, "license": "ISC" + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/package.json b/package.json index d32d2e9..a273795 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "build-native-host": "node -r sucrase/register ./scripts/build-native-host.ts", "build-native-ios": "node -r sucrase/register ./scripts/build-native-ios.ts", "fix": "npm run lint -- --fix", + "fund-testnet": "node -r sucrase/register ./scripts/fund-testnet.ts", "lint": "eslint .", "prepare": "rimraf lib && rollup -c && tsc", "prepublishOnly": "npm run build-native-ios && npm run build-native-android && npm run build-native-host", @@ -75,15 +76,15 @@ "@types/node": "^14.0.5", "@types/react": "^16.14.62", "@types/react-native": "^0.62.11", - "@typescript-eslint/eslint-plugin": "^2.34.0", - "@typescript-eslint/parser": "^3.0.1", + "@typescript-eslint/eslint-plugin": "^5.36.2", + "@typescript-eslint/parser": "^5.36.2", "babel-eslint": "^10.1.0", - "eslint": "^7.15.0", - "eslint-config-standard-kit": "^0.14.4", + "eslint": "^8.57.0", + "eslint-config-standard-kit": "0.15.1", "eslint-plugin-import": "^2.20.2", "eslint-plugin-prettier": "^3.1.3", "eslint-plugin-promise": "^4.2.1", - "eslint-plugin-simple-import-sort": "^5.0.3", + "eslint-plugin-simple-import-sort": "^6.0.1", "eslint-plugin-standard": "^4.0.1", "prettier": "^2.0.5", "rimraf": "^3.0.2", @@ -92,7 +93,7 @@ "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-node-resolve": "^5.2.0", "sucrase": "^3.15.0", - "typescript": "^3.9.3" + "typescript": "5.0.4" }, "peerDependencies": { "react-native": ">=0.47.0 <1.0.0" diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 9e5d8dd..be1e5b1 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -139,6 +139,7 @@ dependencies = [ "blake2", "cpufeatures 0.2.17", "password-hash", + "zeroize", ] [[package]] @@ -312,26 +313,6 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7" -[[package]] -name = "bincode" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740" -dependencies = [ - "bincode_derive", - "serde", - "unty", -] - -[[package]] -name = "bincode_derive" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf95709a440f45e986983918d0e8a1f30a9b1df04918fc828670606804ac3c09" -dependencies = [ - "virtue 0.0.18", -] - [[package]] name = "bindgen" version = "0.65.1" @@ -1060,14 +1041,15 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "dash-platform-macros", "futures-core", "getrandom 0.2.17", "platform-version", "prost", + "prost-build", "tenderdash-proto", "tonic", "tonic-prost", @@ -1111,18 +1093,20 @@ dependencies = [ [[package]] name = "dash-async" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ + "futures", "thiserror 2.0.20", "tokio", + "tokio-util", "tracing", ] [[package]] name = "dash-context-provider" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "dash-async", "dpp", @@ -1135,36 +1119,52 @@ dependencies = [ [[package]] name = "dash-network" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=70d4bf8e36057c58e02d56769a6e9760f701dd06#70d4bf8e36057c58e02d56769a6e9760f701dd06" +source = "git+https://github.com/dashpay/rust-dashcore?rev=d631aaca3632cc713143476e363c9a9aca038d2e#d631aaca3632cc713143476e363c9a9aca038d2e" dependencies = [ - "bincode", - "bincode_derive", "cbindgen", + "grovedb-bincode", + "grovedb-bincode-derive", "serde", ] [[package]] name = "dash-network-seeds" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=70d4bf8e36057c58e02d56769a6e9760f701dd06#70d4bf8e36057c58e02d56769a6e9760f701dd06" +source = "git+https://github.com/dashpay/rust-dashcore?rev=d631aaca3632cc713143476e363c9a9aca038d2e#d631aaca3632cc713143476e363c9a9aca038d2e" dependencies = [ "dash-network", ] [[package]] name = "dash-platform-macros" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "heck", "quote", "syn 2.0.119", ] +[[package]] +name = "dash-platform-queries" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" +dependencies = [ + "dapi-grpc", + "dash-context-provider", + "dash-platform-macros", + "dpp", + "drive", + "drive-proof-verifier", + "hex", + "thiserror 2.0.20", + "tracing", +] + [[package]] name = "dash-sdk" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "arc-swap", "async-trait", @@ -1176,6 +1176,7 @@ dependencies = [ "dash-context-provider", "dash-network-seeds", "dash-platform-macros", + "dash-platform-queries", "derive_more 1.0.0", "dpp", "drive", @@ -1200,7 +1201,7 @@ dependencies = [ [[package]] name = "dash-spv" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=70d4bf8e36057c58e02d56769a6e9760f701dd06#70d4bf8e36057c58e02d56769a6e9760f701dd06" +source = "git+https://github.com/dashpay/rust-dashcore?rev=d631aaca3632cc713143476e363c9a9aca038d2e#d631aaca3632cc713143476e363c9a9aca038d2e" dependencies = [ "async-trait", "chrono", @@ -1229,13 +1230,11 @@ dependencies = [ [[package]] name = "dashcore" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=70d4bf8e36057c58e02d56769a6e9760f701dd06#70d4bf8e36057c58e02d56769a6e9760f701dd06" +source = "git+https://github.com/dashpay/rust-dashcore?rev=d631aaca3632cc713143476e363c9a9aca038d2e#d631aaca3632cc713143476e363c9a9aca038d2e" dependencies = [ "anyhow", "base64-compat", "bech32 0.9.1", - "bincode", - "bincode_derive", "bitvec", "blake3", "blsful", @@ -1243,6 +1242,8 @@ dependencies = [ "dashcore-private", "dashcore_hashes", "ed25519-dalek", + "grovedb-bincode", + "grovedb-bincode-derive", "hex", "hex_lit", "rustversion", @@ -1255,12 +1256,12 @@ dependencies = [ [[package]] name = "dashcore-private" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=70d4bf8e36057c58e02d56769a6e9760f701dd06#70d4bf8e36057c58e02d56769a6e9760f701dd06" +source = "git+https://github.com/dashpay/rust-dashcore?rev=d631aaca3632cc713143476e363c9a9aca038d2e#d631aaca3632cc713143476e363c9a9aca038d2e" [[package]] name = "dashcore-rpc" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=70d4bf8e36057c58e02d56769a6e9760f701dd06#70d4bf8e36057c58e02d56769a6e9760f701dd06" +source = "git+https://github.com/dashpay/rust-dashcore?rev=d631aaca3632cc713143476e363c9a9aca038d2e#d631aaca3632cc713143476e363c9a9aca038d2e" dependencies = [ "dashcore-rpc-json", "hex", @@ -1273,10 +1274,10 @@ dependencies = [ [[package]] name = "dashcore-rpc-json" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=70d4bf8e36057c58e02d56769a6e9760f701dd06#70d4bf8e36057c58e02d56769a6e9760f701dd06" +source = "git+https://github.com/dashpay/rust-dashcore?rev=d631aaca3632cc713143476e363c9a9aca038d2e#d631aaca3632cc713143476e363c9a9aca038d2e" dependencies = [ - "bincode", "dashcore", + "grovedb-bincode", "hex", "key-wallet", "serde", @@ -1288,18 +1289,18 @@ dependencies = [ [[package]] name = "dashcore_hashes" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=70d4bf8e36057c58e02d56769a6e9760f701dd06#70d4bf8e36057c58e02d56769a6e9760f701dd06" +source = "git+https://github.com/dashpay/rust-dashcore?rev=d631aaca3632cc713143476e363c9a9aca038d2e#d631aaca3632cc713143476e363c9a9aca038d2e" dependencies = [ - "bincode", "dashcore-private", + "grovedb-bincode", "rs-x11-hash", "serde", ] [[package]] name = "dashpay-contract" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "platform-value", "platform-version", @@ -1309,8 +1310,8 @@ dependencies = [ [[package]] name = "data-contracts" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1499,8 +1500,8 @@ dependencies = [ [[package]] name = "dpns-contract" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "platform-value", "platform-version", @@ -1510,14 +1511,13 @@ dependencies = [ [[package]] name = "dpp" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "anyhow", "async-trait", "base64 0.22.1", "bech32 0.11.1", - "bincode", "bs58", "byteorder", "chrono", @@ -1528,6 +1528,7 @@ dependencies = [ "dpp-json-convertible-derive", "env_logger", "getrandom 0.2.17", + "grovedb-bincode", "grovedb-commitment-tree", "hex", "indexmap 2.14.1", @@ -1536,6 +1537,7 @@ dependencies = [ "key-wallet", "key-wallet-manager", "lazy_static", + "libm", "nohash-hasher", "num_enum 0.7.6", "once_cell", @@ -1557,8 +1559,8 @@ dependencies = [ [[package]] name = "dpp-json-convertible-derive" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "proc-macro2", "quote", @@ -1567,17 +1569,19 @@ dependencies = [ [[package]] name = "drive" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ - "bincode", "byteorder", "derive_more 1.0.0", "dpp", "grovedb", + "grovedb-bincode", "grovedb-costs", "grovedb-epoch-based-storage-flags", + "grovedb-merk", "grovedb-path", + "grovedb-query", "grovedb-version", "hex", "indexmap 2.14.1", @@ -1591,15 +1595,15 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ - "bincode", "dapi-grpc", "dash-context-provider", "derive_more 1.0.0", "dpp", "drive", + "grovedb-bincode", "hex", "indexmap 2.14.1", "platform-serialization", @@ -1608,6 +1612,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + [[package]] name = "ed" version = "0.2.2" @@ -1658,6 +1668,7 @@ dependencies = [ name = "edge-dash-shielded" version = "0.1.0" dependencies = [ + "async-trait", "bech32 0.11.1", "bip0039", "dash-network-seeds", @@ -2134,7 +2145,7 @@ dependencies = [ [[package]] name = "git-state" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=70d4bf8e36057c58e02d56769a6e9760f701dd06#70d4bf8e36057c58e02d56769a6e9760f701dd06" +source = "git+https://github.com/dashpay/rust-dashcore?rev=d631aaca3632cc713143476e363c9a9aca038d2e#d631aaca3632cc713143476e363c9a9aca038d2e" [[package]] name = "glob" @@ -2181,12 +2192,12 @@ dependencies = [ [[package]] name = "grovedb" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?tag=v5.0.1#6bb2ebff62a842a3c416126bbcfcf7774dfe0262" +version = "6.1.1" +source = "git+https://github.com/dashpay/grovedb?rev=2128ea18f9b1c2f9502f99967b1b1c6485c91f8b#2128ea18f9b1c2f9502f99967b1b1c6485c91f8b" dependencies = [ - "bincode", - "bincode_derive", "blake3", + "grovedb-bincode", + "grovedb-bincode-derive", "grovedb-bulk-append-tree", "grovedb-costs", "grovedb-dense-fixed-sized-merkle-tree", @@ -2202,29 +2213,52 @@ dependencies = [ "thiserror 2.0.20", ] +[[package]] +name = "grovedb-bincode" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce912028682ecc5870a5ad609ea456b76b0bf4ec1ba1eb649400b64ff73a7782" +dependencies = [ + "grovedb-bincode-derive", + "serde", + "unty", +] + +[[package]] +name = "grovedb-bincode-derive" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eaff4e961dcb3e7e55c34c8c6982249036e5aaa19e55f6dab94ebcd4896b03a" +dependencies = [ + "virtue 0.0.18", +] + [[package]] name = "grovedb-bulk-append-tree" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?tag=v5.0.1#6bb2ebff62a842a3c416126bbcfcf7774dfe0262" +version = "6.1.1" +source = "git+https://github.com/dashpay/grovedb?rev=2128ea18f9b1c2f9502f99967b1b1c6485c91f8b#2128ea18f9b1c2f9502f99967b1b1c6485c91f8b" dependencies = [ - "bincode", "blake3", + "grovedb-bincode", "grovedb-costs", "grovedb-dense-fixed-sized-merkle-tree", "grovedb-merkle-mountain-range", "grovedb-query", + "grovedb-version", "hex", + "integer-encoding", "thiserror 2.0.20", ] [[package]] name = "grovedb-commitment-tree" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?tag=v5.0.1#6bb2ebff62a842a3c416126bbcfcf7774dfe0262" +version = "6.1.1" +source = "git+https://github.com/dashpay/grovedb?rev=2128ea18f9b1c2f9502f99967b1b1c6485c91f8b#2128ea18f9b1c2f9502f99967b1b1c6485c91f8b" dependencies = [ "blake3", "grovedb-bulk-append-tree", "grovedb-costs", + "grovedb-version", "incrementalmerkletree", "orchard", "rusqlite", @@ -2234,8 +2268,8 @@ dependencies = [ [[package]] name = "grovedb-costs" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?tag=v5.0.1#6bb2ebff62a842a3c416126bbcfcf7774dfe0262" +version = "6.1.1" +source = "git+https://github.com/dashpay/grovedb?rev=2128ea18f9b1c2f9502f99967b1b1c6485c91f8b#2128ea18f9b1c2f9502f99967b1b1c6485c91f8b" dependencies = [ "integer-encoding", "intmap", @@ -2244,24 +2278,26 @@ dependencies = [ [[package]] name = "grovedb-dense-fixed-sized-merkle-tree" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?tag=v5.0.1#6bb2ebff62a842a3c416126bbcfcf7774dfe0262" +version = "6.1.1" +source = "git+https://github.com/dashpay/grovedb?rev=2128ea18f9b1c2f9502f99967b1b1c6485c91f8b#2128ea18f9b1c2f9502f99967b1b1c6485c91f8b" dependencies = [ - "bincode", "blake3", + "grovedb-bincode", "grovedb-costs", "grovedb-query", + "grovedb-version", "thiserror 2.0.20", ] [[package]] name = "grovedb-element" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?tag=v5.0.1#6bb2ebff62a842a3c416126bbcfcf7774dfe0262" +version = "6.1.1" +source = "git+https://github.com/dashpay/grovedb?rev=2128ea18f9b1c2f9502f99967b1b1c6485c91f8b#2128ea18f9b1c2f9502f99967b1b1c6485c91f8b" dependencies = [ - "bincode", - "bincode_derive", + "grovedb-bincode", + "grovedb-bincode-derive", "grovedb-path", + "grovedb-query", "grovedb-version", "hex", "integer-encoding", @@ -2270,8 +2306,8 @@ dependencies = [ [[package]] name = "grovedb-epoch-based-storage-flags" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?tag=v5.0.1#6bb2ebff62a842a3c416126bbcfcf7774dfe0262" +version = "6.1.1" +source = "git+https://github.com/dashpay/grovedb?rev=2128ea18f9b1c2f9502f99967b1b1c6485c91f8b#2128ea18f9b1c2f9502f99967b1b1c6485c91f8b" dependencies = [ "grovedb-costs", "hex", @@ -2282,14 +2318,14 @@ dependencies = [ [[package]] name = "grovedb-merk" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?tag=v5.0.1#6bb2ebff62a842a3c416126bbcfcf7774dfe0262" +version = "6.1.1" +source = "git+https://github.com/dashpay/grovedb?rev=2128ea18f9b1c2f9502f99967b1b1c6485c91f8b#2128ea18f9b1c2f9502f99967b1b1c6485c91f8b" dependencies = [ - "bincode", - "bincode_derive", "blake3", "byteorder", "ed", + "grovedb-bincode", + "grovedb-bincode-derive", "grovedb-costs", "grovedb-element", "grovedb-path", @@ -2304,30 +2340,31 @@ dependencies = [ [[package]] name = "grovedb-merkle-mountain-range" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?tag=v5.0.1#6bb2ebff62a842a3c416126bbcfcf7774dfe0262" +version = "6.1.1" +source = "git+https://github.com/dashpay/grovedb?rev=2128ea18f9b1c2f9502f99967b1b1c6485c91f8b#2128ea18f9b1c2f9502f99967b1b1c6485c91f8b" dependencies = [ - "bincode", "blake3", + "grovedb-bincode", "grovedb-costs", + "grovedb-version", ] [[package]] name = "grovedb-path" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?tag=v5.0.1#6bb2ebff62a842a3c416126bbcfcf7774dfe0262" +version = "6.1.1" +source = "git+https://github.com/dashpay/grovedb?rev=2128ea18f9b1c2f9502f99967b1b1c6485c91f8b#2128ea18f9b1c2f9502f99967b1b1c6485c91f8b" dependencies = [ "hex", ] [[package]] name = "grovedb-query" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?tag=v5.0.1#6bb2ebff62a842a3c416126bbcfcf7774dfe0262" +version = "6.1.1" +source = "git+https://github.com/dashpay/grovedb?rev=2128ea18f9b1c2f9502f99967b1b1c6485c91f8b#2128ea18f9b1c2f9502f99967b1b1c6485c91f8b" dependencies = [ - "bincode", "byteorder", "ed", + "grovedb-bincode", "hex", "indexmap 2.14.1", "integer-encoding", @@ -2336,17 +2373,17 @@ dependencies = [ [[package]] name = "grovedb-version" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?tag=v5.0.1#6bb2ebff62a842a3c416126bbcfcf7774dfe0262" +version = "6.1.1" +source = "git+https://github.com/dashpay/grovedb?rev=2128ea18f9b1c2f9502f99967b1b1c6485c91f8b#2128ea18f9b1c2f9502f99967b1b1c6485c91f8b" dependencies = [ "thiserror 2.0.20", - "versioned-feature-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "versioned-feature-core", ] [[package]] name = "grovedb-visualize" -version = "5.0.1" -source = "git+https://github.com/dashpay/grovedb?tag=v5.0.1#6bb2ebff62a842a3c416126bbcfcf7774dfe0262" +version = "6.1.1" +source = "git+https://github.com/dashpay/grovedb?rev=2128ea18f9b1c2f9502f99967b1b1c6485c91f8b#2128ea18f9b1c2f9502f99967b1b1c6485c91f8b" dependencies = [ "hex", "itertools 0.14.0", @@ -3069,7 +3106,7 @@ dependencies = [ [[package]] name = "key-wallet" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=70d4bf8e36057c58e02d56769a6e9760f701dd06#70d4bf8e36057c58e02d56769a6e9760f701dd06" +source = "git+https://github.com/dashpay/rust-dashcore?rev=d631aaca3632cc713143476e363c9a9aca038d2e#d631aaca3632cc713143476e363c9a9aca038d2e" dependencies = [ "async-trait", "base58ck", @@ -3092,7 +3129,7 @@ dependencies = [ [[package]] name = "key-wallet-manager" version = "0.45.0" -source = "git+https://github.com/dashpay/rust-dashcore?rev=70d4bf8e36057c58e02d56769a6e9760f701dd06#70d4bf8e36057c58e02d56769a6e9760f701dd06" +source = "git+https://github.com/dashpay/rust-dashcore?rev=d631aaca3632cc713143476e363c9a9aca038d2e#d631aaca3632cc713143476e363c9a9aca038d2e" dependencies = [ "async-trait", "dashcore", @@ -3265,6 +3302,17 @@ version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" +[[package]] +name = "memsec" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c797b9d6bb23aab2fc369c65f871be49214f5c759af65bde26ffaaa2b646b492" +dependencies = [ + "getrandom 0.2.17", + "libc", + "windows-sys 0.45.0", +] + [[package]] name = "memuse" version = "0.2.2" @@ -3437,6 +3485,18 @@ dependencies = [ "tempfile", ] +[[package]] +name = "nix" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +dependencies = [ + "bitflags 2.13.1", + "cfg-if", + "cfg_aliases", + "libc", +] + [[package]] name = "nohash-hasher" version = "0.2.0" @@ -3513,13 +3573,13 @@ checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" [[package]] name = "num-derive" -version = "0.4.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +checksum = "e4e98dc3b890f6c23a0f9d3d491a2823d0dea0fa656302a13dd225fa924112a8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.119", + "syn 3.0.4", ] [[package]] @@ -3862,8 +3922,8 @@ checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" [[package]] name = "platform-encryption" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "aes", "cbc", @@ -3875,17 +3935,17 @@ dependencies = [ [[package]] name = "platform-serialization" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ - "bincode", + "grovedb-bincode", "platform-version", ] [[package]] name = "platform-serialization-derive" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "proc-macro2", "quote", @@ -3895,13 +3955,13 @@ dependencies = [ [[package]] name = "platform-value" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "base64 0.22.1", - "bincode", "bs58", "ciborium", + "grovedb-bincode", "hex", "indexmap 2.14.1", "platform-serialization", @@ -3915,19 +3975,19 @@ dependencies = [ [[package]] name = "platform-version" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ - "bincode", + "grovedb-bincode", "grovedb-version", "thiserror 2.0.20", - "versioned-feature-core 1.0.0 (git+https://github.com/dashpay/versioned-feature-core)", + "versioned-feature-core", ] [[package]] name = "platform-versioning" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "proc-macro2", "quote", @@ -3936,13 +3996,14 @@ dependencies = [ [[package]] name = "platform-wallet" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "arc-swap", "async-trait", "bimap", "bs58", + "dash-async", "dash-sdk", "dash-spv", "dashcore", @@ -3953,6 +4014,7 @@ dependencies = [ "image", "key-wallet", "key-wallet-manager", + "log", "platform-encryption", "rusqlite", "serde", @@ -3968,12 +4030,11 @@ dependencies = [ [[package]] name = "platform-wallet-storage" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "apple-native-keyring-store", "argon2", - "bincode", "chacha20poly1305", "chrono", "clap", @@ -3983,21 +4044,25 @@ dependencies = [ "dpp", "fd-lock", "getrandom 0.2.17", + "grovedb-bincode", "hex", "humantime", "key-wallet", "keyring-core", "libc", + "memsec", "platform-wallet", "refinery", + "refinery-core", "region", "rusqlite", + "schemars", "serde", "serde_json", - "sha2", "subtle", "tempfile", "thiserror 1.0.69", + "time", "tracing", "tracing-subscriber", "windows-native-keyring-store", @@ -4387,6 +4452,26 @@ dependencies = [ "bitflags 2.13.1", ] +[[package]] +name = "ref-cast" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.4", +] + [[package]] name = "refinery" version = "0.9.2" @@ -4529,8 +4614,8 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "backon", "chrono", @@ -4550,21 +4635,26 @@ dependencies = [ [[package]] name = "rs-sdk-trusted-context-provider" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "arc-swap", "dash-async", "dash-context-provider", "dpp", + "futures", + "gloo-timers", "hex", "lru", "reqwest", "serde", "serde_json", "thiserror 2.0.20", + "tokio", "tracing", "url", + "wasm-bindgen-futures", + "web-time", ] [[package]] @@ -4728,6 +4818,18 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "schemars" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "687274d293b6cdc6e73e0fee520bf2049650090d7164f87672d212a3c530cf4a" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -5288,8 +5390,8 @@ dependencies = [ [[package]] name = "tenderdash-abci" -version = "1.5.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v1.5.1#fae47294618125fa9d69150e8a7a5b607af6867c" +version = "1.8.1" +source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v1.8.1#eebfc46cc64b27022ccbbb3924604dd87a10c340" dependencies = [ "bytes", "hex", @@ -5303,8 +5405,8 @@ dependencies = [ [[package]] name = "tenderdash-proto" -version = "1.5.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v1.5.1#fae47294618125fa9d69150e8a7a5b607af6867c" +version = "1.8.1" +source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v1.8.1#eebfc46cc64b27022ccbbb3924604dd87a10c340" dependencies = [ "bytes", "chrono", @@ -5320,8 +5422,8 @@ dependencies = [ [[package]] name = "tenderdash-proto-compiler" -version = "1.5.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v1.5.1#fae47294618125fa9d69150e8a7a5b607af6867c" +version = "1.8.1" +source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v1.8.1#eebfc46cc64b27022ccbbb3924604dd87a10c340" dependencies = [ "fs_extra", "prost-build", @@ -5401,9 +5503,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.55" +version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +checksum = "711a53c2d47bbd818258c498c8dbfe186a2526c631495cfe7e078567f86b8469" dependencies = [ "deranged", "num-conv", @@ -5421,9 +5523,9 @@ checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" [[package]] name = "time-macros" -version = "0.2.32" +version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" +checksum = "71c652a3727a9cbb9a02f707f530b618ce00d0ccd762009c8c23bd191df3c17d" dependencies = [ "num-conv", "time-core", @@ -5456,8 +5558,8 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "token-history-contract" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "platform-value", "platform-version", @@ -5857,9 +5959,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typed-path" -version = "0.12.3" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e" +checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e" [[package]] name = "typenum" @@ -6156,11 +6258,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "898c0ad500fdb1914df465a2c729fce33646ef65dfbbbd16a6d8050e0d2404df" -[[package]] -name = "versioned-feature-core" -version = "1.0.0" -source = "git+https://github.com/dashpay/versioned-feature-core#560157096c8405a46ce0f21a2e7e1bd11d6625b4" - [[package]] name = "virtue" version = "0.0.17" @@ -6443,13 +6540,22 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -6458,7 +6564,7 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -6470,34 +6576,67 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-targets" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -6510,24 +6649,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -6563,8 +6726,8 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "4.1.1" -source = "git+https://github.com/dashpay/platform.git?tag=v4.1.1#69b85c81af8e000e8506edaa13406d1f6274af5a" +version = "5.0.1" +source = "git+https://github.com/dashpay/platform.git?rev=093268c09bac75045756bc925deb530537b65580#093268c09bac75045756bc925deb530537b65580" dependencies = [ "num_enum 0.5.11", "platform-value", @@ -6730,15 +6893,18 @@ dependencies = [ [[package]] name = "zip" -version = "8.6.0" +version = "9.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d04a6b5381502aa6087c94c669499eb1602eb9c5e8198e534de571f7154809b" +checksum = "1156b39d142a34b999c2310a50455e0cb3760bf7efad0122f796d813bee26ccb" dependencies = [ "crc32fast", "flate2", + "getrandom 0.4.3", "indexmap 2.14.1", "memchr", + "nix", "typed-path", + "windows-sys 0.61.2", "zopfli", ] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index e83ce5c..cbaa5c5 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -14,15 +14,19 @@ napi-backend = ["dep:napi", "dep:napi-derive", "dep:napi-build"] uniffi-backend = ["dep:uniffi", "dep:thiserror"] [dependencies] -dash-sdk = { git = "https://github.com/dashpay/platform.git", tag = "v4.1.1", default-features = false, features = ["wallet"] } -dashcore = { git = "https://github.com/dashpay/rust-dashcore", rev = "70d4bf8e36057c58e02d56769a6e9760f701dd06" } -key-wallet = { git = "https://github.com/dashpay/rust-dashcore", rev = "70d4bf8e36057c58e02d56769a6e9760f701dd06" } -platform-wallet-storage = { git = "https://github.com/dashpay/platform.git", tag = "v4.1.1", features = ["sqlite"] } -dash-spv = { git = "https://github.com/dashpay/rust-dashcore", rev = "70d4bf8e36057c58e02d56769a6e9760f701dd06" } -dash-network-seeds = { git = "https://github.com/dashpay/rust-dashcore", rev = "70d4bf8e36057c58e02d56769a6e9760f701dd06" } -rs-sdk-trusted-context-provider = { git = "https://github.com/dashpay/platform.git", tag = "v4.1.1" } +dash-sdk = { git = "https://github.com/dashpay/platform.git", rev = "093268c09bac75045756bc925deb530537b65580", default-features = false, features = ["wallet"] } +dashcore = { git = "https://github.com/dashpay/rust-dashcore", rev = "d631aaca3632cc713143476e363c9a9aca038d2e" } +key-wallet = { git = "https://github.com/dashpay/rust-dashcore", rev = "d631aaca3632cc713143476e363c9a9aca038d2e" } +platform-wallet-storage = { git = "https://github.com/dashpay/platform.git", rev = "093268c09bac75045756bc925deb530537b65580", features = ["sqlite"] } +dash-spv = { git = "https://github.com/dashpay/rust-dashcore", rev = "d631aaca3632cc713143476e363c9a9aca038d2e" } +dash-network-seeds = { git = "https://github.com/dashpay/rust-dashcore", rev = "d631aaca3632cc713143476e363c9a9aca038d2e" } +# `withdrawals-contract`: Drive verifies a shielded withdrawal's proof against +# the withdrawals system contract, which the provider only knows when this +# feature compiles it in. Without it the withdrawal lands and the call errors. +rs-sdk-trusted-context-provider = { git = "https://github.com/dashpay/platform.git", rev = "093268c09bac75045756bc925deb530537b65580", features = ["withdrawals-contract"] } reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] } -platform-wallet = { git = "https://github.com/dashpay/platform.git", tag = "v4.1.1", features = ["shielded"] } +platform-wallet = { git = "https://github.com/dashpay/platform.git", rev = "093268c09bac75045756bc925deb530537b65580", features = ["shielded"] } +async-trait = "0.1" bech32 = "0.11" bip0039 = { version = "0.12", features = ["rand"] } hex = "0.4" diff --git a/rust/rust-toolchain.toml b/rust/rust-toolchain.toml index cbe0274..2a5efef 100644 --- a/rust/rust-toolchain.toml +++ b/rust/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.97.1" +channel = "1.98.1" components = [ "clippy", "rustfmt" ] diff --git a/rust/src/dash.udl b/rust/src/dash.udl index 1c6365c..e6591d9 100644 --- a/rust/src/dash.udl +++ b/rust/src/dash.udl @@ -17,6 +17,19 @@ dictionary Transaction { sequence memos; }; +dictionary CoreBalance { + string confirmed_duffs; + string unconfirmed_duffs; + string total_duffs; + u32 synced_height; +}; + +dictionary AssetLock { + string txid; + u32 vout; + string status; +}; + dictionary Poll { string alias; string status; @@ -53,6 +66,54 @@ namespace dash { [Throws=DashError] Addresses derive_shielded_address(string alias); + [Throws=DashError] + string core_receive_address(string alias, u32 account); + + [Throws=DashError] + void start_core_sync(string alias, u32 from_height); + + [Throws=DashError] + CoreBalance core_balance(string alias); + + [Throws=DashError] + string shield_from_asset_lock( + string alias, + string amount_duffs, + u32 account_index, + string mnemonic_seed + ); + + [Throws=DashError] + string platform_receive_address(string alias, u32 account); + + [Throws=DashError] + sequence tracked_asset_locks(string alias); + + [Throws=DashError] + string resume_shield_from_asset_lock( + string alias, + string txid, + u32 vout, + string mnemonic_seed + ); + + [Throws=DashError] + string unshield( + string alias, + string to_address, + string amount_credits, + string mnemonic_seed + ); + + [Throws=DashError] + string shielded_withdraw( + string alias, + string to_core_address, + string amount_credits, + u32 core_fee_per_byte, + string mnemonic_seed + ); + boolean is_valid_address(string address, string network); [Throws=DashError] diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 5e996f9..b3c7aab 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -10,7 +10,7 @@ mod uniffi_api; pub use uniffi_api::*; #[cfg(feature = "uniffi-backend")] -pub use wallet::{Addresses, Poll, Transaction}; +pub use wallet::{Addresses, AssetLock, CoreBalance, Poll, Transaction}; #[cfg(feature = "uniffi-backend")] uniffi::include_scaffolding!("dash"); diff --git a/rust/src/napi_api.rs b/rust/src/napi_api.rs index a150897..cc27486 100644 --- a/rust/src/napi_api.rs +++ b/rust/src/napi_api.rs @@ -119,6 +119,118 @@ pub async fn derive_shielded_address(alias: String) -> Result { map(wallet::derive_shielded_address(alias).await).map(Into::into) } +#[napi] +pub async fn core_receive_address(alias: String, account: u32) -> Result { + map(wallet::core_receive_address(alias, account).await) +} + +#[napi] +pub async fn platform_receive_address(alias: String, account: u32) -> Result { + map(wallet::platform_receive_address(alias, account).await) +} + +#[napi(object)] +pub struct JsCoreBalance { + pub confirmed_duffs: String, + pub unconfirmed_duffs: String, + pub total_duffs: String, + pub synced_height: u32, +} + +impl From for JsCoreBalance { + fn from(value: wallet::CoreBalance) -> Self { + Self { + confirmed_duffs: value.confirmed_duffs, + unconfirmed_duffs: value.unconfirmed_duffs, + total_duffs: value.total_duffs, + synced_height: value.synced_height, + } + } +} + +#[napi] +pub async fn start_core_sync(alias: String, from_height: u32) -> Result<()> { + map(wallet::start_core_sync(alias, from_height).await) +} + +#[napi] +pub async fn core_balance(alias: String) -> Result { + map(wallet::core_balance(alias).await).map(Into::into) +} + +#[napi] +pub async fn shield_from_asset_lock( + alias: String, + amount_duffs: String, + account_index: u32, + mnemonic_seed: String, +) -> Result { + map(wallet::shield_from_asset_lock(alias, amount_duffs, account_index, mnemonic_seed).await) +} + +#[napi(object)] +pub struct JsAssetLock { + pub txid: String, + pub vout: u32, + pub status: String, +} + +impl From for JsAssetLock { + fn from(value: wallet::AssetLock) -> Self { + Self { + txid: value.txid, + vout: value.vout, + status: value.status, + } + } +} + +#[napi] +pub async fn tracked_asset_locks(alias: String) -> Result> { + map(wallet::tracked_asset_locks(alias).await) + .map(|locks| locks.into_iter().map(Into::into).collect()) +} + +#[napi] +pub async fn resume_shield_from_asset_lock( + alias: String, + txid: String, + vout: u32, + mnemonic_seed: String, +) -> Result { + map(wallet::resume_shield_from_asset_lock(alias, txid, vout, mnemonic_seed).await) +} + +#[napi] +pub async fn unshield( + alias: String, + to_address: String, + amount_credits: String, + mnemonic_seed: String, +) -> Result { + map(wallet::unshield(alias, to_address, amount_credits, mnemonic_seed).await) +} + +#[napi] +pub async fn shielded_withdraw( + alias: String, + to_core_address: String, + amount_credits: String, + core_fee_per_byte: u32, + mnemonic_seed: String, +) -> Result { + map( + wallet::shielded_withdraw( + alias, + to_core_address, + amount_credits, + core_fee_per_byte, + mnemonic_seed, + ) + .await, + ) +} + #[napi] pub fn is_valid_address(address: String, network: String) -> bool { wallet::is_valid_address(address, network) diff --git a/rust/src/uniffi_api.rs b/rust/src/uniffi_api.rs index 2ddc0ce..08a5ecf 100644 --- a/rust/src/uniffi_api.rs +++ b/rust/src/uniffi_api.rs @@ -57,6 +57,84 @@ pub fn derive_shielded_address(alias: String) -> Result Result { + map(block_on(wallet::core_receive_address(alias, account))) +} + +pub fn start_core_sync(alias: String, from_height: u32) -> Result<(), DashError> { + map(block_on(wallet::start_core_sync(alias, from_height))) +} + +pub fn core_balance(alias: String) -> Result { + map(block_on(wallet::core_balance(alias))) +} + +pub fn shield_from_asset_lock( + alias: String, + amount_duffs: String, + account_index: u32, + mnemonic_seed: String, +) -> Result { + map(block_on(wallet::shield_from_asset_lock( + alias, + amount_duffs, + account_index, + mnemonic_seed, + ))) +} + +pub fn platform_receive_address(alias: String, account: u32) -> Result { + map(block_on(wallet::platform_receive_address(alias, account))) +} + +pub fn tracked_asset_locks(alias: String) -> Result, DashError> { + map(block_on(wallet::tracked_asset_locks(alias))) +} + +pub fn resume_shield_from_asset_lock( + alias: String, + txid: String, + vout: u32, + mnemonic_seed: String, +) -> Result { + map(block_on(wallet::resume_shield_from_asset_lock( + alias, + txid, + vout, + mnemonic_seed, + ))) +} + +pub fn unshield( + alias: String, + to_address: String, + amount_credits: String, + mnemonic_seed: String, +) -> Result { + map(block_on(wallet::unshield( + alias, + to_address, + amount_credits, + mnemonic_seed, + ))) +} + +pub fn shielded_withdraw( + alias: String, + to_core_address: String, + amount_credits: String, + core_fee_per_byte: u32, + mnemonic_seed: String, +) -> Result { + map(block_on(wallet::shielded_withdraw( + alias, + to_core_address, + amount_credits, + core_fee_per_byte, + mnemonic_seed, + ))) +} + pub fn is_valid_address(address: String, network: String) -> bool { wallet::is_valid_address(address, network) } diff --git a/rust/src/wallet.rs b/rust/src/wallet.rs index 870e85f..b4dd954 100644 --- a/rust/src/wallet.rs +++ b/rust/src/wallet.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; use std::path::PathBuf; -use std::sync::{Arc, Mutex}; +use std::sync::{Arc, Mutex, Weak}; use rs_sdk_trusted_context_provider::TrustedHttpContextProvider; use dash_sdk::sdk::{Address as SdkAddress, AddressList}; @@ -89,7 +89,6 @@ const MAINNET_HRP: &str = "dash"; const TESTNET_HRP: &str = "tdash"; pub struct ClientSlot { - pub mnemonic: String, pub network: String, pub account: u32, pub address: String, @@ -102,6 +101,13 @@ pub struct ClientSlot { /// shielded coordinator that drives note scanning. pub manager: Option>, pub wallet: Option>, + /// The wallet store, observed without keeping it open. The store claims + /// its file for the whole process until its last reference drops, so + /// `stop` checks this to prove the alias can be opened again. + store: Weak, + /// Per-alias state directory, reused by the Core SPV client for its own + /// header/filter storage so both layers stay under one wallet folder. + pub db_dir: PathBuf, /// Commitments walked by the most recent sync pass, for scan progress. pub total_scanned: u64, pub network_block_height: u32, @@ -126,6 +132,31 @@ pub struct Addresses { pub shielded_address: String, } +pub struct CoreBalance { + pub confirmed_duffs: String, + pub unconfirmed_duffs: String, + pub total_duffs: String, + pub synced_height: u32, +} + +/// One asset lock this wallet is tracking, as a host needs to see it. +/// +/// `status` is the lifecycle stage: `built`, `broadcast`, `instant_send_locked`, +/// `chain_locked`, or `consumed`. Anything short of `consumed` is value sitting +/// in a lock that never became a shielded note, which is what +/// `resume_shield_from_asset_lock` takes. +/// +/// A lock rebuilt from the wallet's chain records in a later process reads +/// `recovered_from_chain`: Core has finalized it, and the wallet cannot tell +/// locally whether Platform already consumed it. Resuming one is how a host +/// finds out. A stranded lock shields; a spent one returns an error, moves no +/// value and keeps this status. +pub struct AssetLock { + pub txid: String, + pub vout: u32, + pub status: String, +} + pub struct Transaction { pub txid: String, pub block_time_in_seconds: i64, @@ -293,6 +324,37 @@ async fn fetch_active_masternodes(quorum_base: &str) -> WalletResult Ok(out) } +/// Platform gRPC port for a network. +/// +/// Mainnet serves DAPI on 443, testnet on 1443. The quorum service reports +/// each node's Core P2P endpoint, never its Platform one, so the port has to +/// come from the network rather than from that address. A non-zero +/// `caller_port` wins, which is how a devnet or a custom deployment is reached. +fn platform_port(network: Network, caller_port: u32) -> u32 { + if caller_port != 0 { + return caller_port; + } + match network { + Network::Mainnet => 443, + _ => 1443, + } +} + +/// Both public DAPI ports terminate TLS; anything else is a local deployment. +/// +/// Only ever applied to the caller's own `default_host` fallback. Nodes found +/// through the quorum service are public masternodes and stay on `https` +/// whatever port they answer on: inferring their scheme from a caller-supplied +/// port would silently put mainnet or testnet gRPC in cleartext, and a shielded +/// wallet's request stream is exactly the metadata the pool exists to hide. +fn platform_scheme(port: u32) -> &'static str { + if port == 443 || port == 1443 { + "https" + } else { + "http" + } +} + pub async fn initialize( mnemonic_seed: String, account: u32, @@ -314,21 +376,27 @@ pub async fn initialize( _ => "", }; + let port = platform_port(network, default_port); + let mut endpoints: Vec = Vec::new(); if !quorum_base.is_empty() { if let Ok(rows) = fetch_active_masternodes(quorum_base).await { endpoints = rows .into_iter() - .filter_map(|ip| format!("https://{ip}:443").parse().ok()) + .filter_map(|ip| format!("https://{ip}:{port}").parse().ok()) .collect(); } } // Caller-supplied host is the fallback (devnets, custom deployments). - let scheme = if default_port == 443 { "https" } else { "http" }; if endpoints.is_empty() { - if let Ok(explicit) = - format!("{}://{}:{}", scheme, default_host, default_port).parse::() + if let Ok(explicit) = format!( + "{}://{}:{}", + platform_scheme(default_port), + default_host, + default_port + ) + .parse::() { endpoints.push(explicit); } @@ -367,11 +435,12 @@ pub async fn initialize( let inner = SqlitePersister::open(SqlitePersisterConfig::new(db_dir.join("wallet.db"))) .map_err(|e| format!("open wallet store: {e}"))?; - let persister = ShieldedCapablePersister { inner }; + let persister = Arc::new(ShieldedCapablePersister { inner }); + let store = Arc::downgrade(&persister); let manager = Arc::new(Manager::new( Arc::new(sdk), - Arc::new(persister), + persister, Arc::new(SilentEventHandler) as Arc, )); @@ -409,15 +478,43 @@ pub async fn initialize( let seed64 = mnemonic.to_seed(""); let shielded_seed = seed64; - let wallet = manager - .create_wallet_from_seed_bytes( - network, - &seed64, - WalletAccountCreationOptions::Default, - None, - ) - .await - .map_err(|e| format!("create_wallet_from_seed_bytes: {e}"))?; + // Hydrate anything this alias persisted on a previous open BEFORE creating a + // wallet from the seed, so a restored wallet is reused rather than rebuilt. + // + // The load brings back the wallet with its Core balance, its address pool + // and its tracked asset locks, which is what lets + // `resume_shield_from_asset_lock` find a lock a previous process broadcast. + // The restored address pool also remembers which receive addresses were + // handed out, so `core_receive_address` continues from the next unused one. + // + // Best-effort: a fresh store has nothing to load, and a load failure must + // not stop a wallet from opening. + if let Err(e) = manager.load_from_persistor().await { + if std::env::var("DASH_SHIELDED_DEBUG").is_ok() { + eprintln!("[dash-shielded] load_from_persistor: {e}"); + } + } + + // A restored wallet is already in the manager, and creating it again would + // collide on WalletAlreadyExists. One manager serves one alias here, so the + // single restored id is this alias's wallet. + let restored = match manager.wallet_ids().await.first() { + Some(id) => manager.get_wallet(id).await, + None => None, + }; + + let wallet = match restored { + Some(wallet) => wallet, + None => manager + .create_wallet_from_seed_bytes( + network, + &seed64, + WalletAccountCreationOptions::Default, + None, + ) + .await + .map_err(|e| format!("create_wallet_from_seed_bytes: {e}"))?, + }; let coordinator = manager .shielded_coordinator() @@ -455,7 +552,6 @@ pub async fn initialize( clients.insert( alias, ClientSlot { - mnemonic: mnemonic_seed, network: network_name, account, address, @@ -466,6 +562,8 @@ pub async fn initialize( proposals: HashMap::new(), manager: Some(manager), wallet: Some(wallet), + store, + db_dir, total_scanned: 0, network_block_height: 0, }, @@ -474,8 +572,51 @@ pub async fn initialize( } pub async fn stop(alias: String) -> WalletResult { - let mut clients = CLIENTS.lock().await; - clients.remove(&alias); + // Take the slot out first so nothing else starts work on it, but hold the + // manager alive past the removal. Dropping it while the shielded-sync task + // still owns a tokio timer tears the runtime down underneath that task, and + // the timer entry panics with "A Tokio 1.x context was found, but it is + // being shutdown". `shutdown` drains every sync pass and joins the worker + // threads first, so nothing is dropped while a task can still run. + let Some(slot) = CLIENTS.lock().await.remove(&alias) else { + return Ok("STOPPED".to_string()); + }; + let ClientSlot { + manager, + wallet, + store, + .. + } = slot; + drop(wallet); + + if let Some(manager) = manager { + manager.shielded_sync_arc().stop(); + // Each drain and join in `shutdown` has a bounded budget, and the + // report marks any worker that outlived its budget. That means the + // close was not clean, so report a failure instead of "STOPPED". + let report = manager.shutdown().await; + // The manager's wallet map and the wallets in it reference each other, + // so dropping the manager alone leaves the wallet store open for the + // life of the process, and reopening this alias then fails with "a + // SqlitePersister is already open". Removing each wallet breaks that + // cycle before the manager goes. + for id in manager.wallet_ids().await { + manager + .remove_wallet(&id) + .await + .map_err(|e| format!("stop {alias}: remove wallet: {e}"))?; + } + drop(manager); + if !report.all_clean() { + return Err(format!("stop {alias}: shutdown not clean: {report:?}")); + } + } + if store.strong_count() > 0 { + return Err(format!( + "stop {alias}: wallet store still open after shutdown, so it cannot be reopened" + )); + } + Ok("STOPPED".to_string()) } @@ -499,8 +640,28 @@ pub async fn start_sync(alias: String) -> WalletResult<()> { .and_then(|slot| slot.wallet.clone()) }; tokio::spawn(async move { - if let Some(coordinator) = manager.shielded_coordinator().await { - let summary = coordinator.sync(true).await; + if manager.shielded_coordinator().await.is_some() { + // Go through the sync manager, never the coordinator. `sync_now` + // holds the manager-wide in-flight slot, so this pass cannot + // overlap the loop's own first pass. Two overlapping passes both + // snapshot the tree size before either appends, so each appends + // every commitment and the local tree ends up ahead of Platform: + // no later note is ever witnessable, and every spend after the + // first fails with "no recorded anchor". + let sync = manager.shielded_sync_arc(); + let summary = loop { + let summary = sync.sync_now(true).await; + // An empty summary means the pass was skipped because one + // was already in flight. Wait it out, then run ours. + if !summary.is_empty() || !sync.is_running() { + break summary; + } + tokio::time::sleep(std::time::Duration::from_millis(250)).await; + }; + if summary.is_empty() { + // Stopped before any pass of ours ran: nothing to record. + return; + } if std::env::var("DASH_SHIELDED_DEBUG").is_ok() { eprintln!("[dash-shielded] sync summary: {summary:?}"); // Local tree size vs what the pass walked: if the chain has @@ -566,6 +727,504 @@ pub async fn derive_shielded_address(alias: String) -> WalletResult { }) } +/// Next unused BIP-44 external address on the Core (L1) side of the wallet. +/// +/// The shielded pool is only reachable from L1: value enters through an asset +/// lock, so a caller funding a fresh wallet needs a transparent Dash address +/// before any shielded operation is possible. `account` is the BIP-44 standard +/// account index on the Core wallet, which is a different numbering from the +/// ZIP-32 Orchard account the shielded side uses. +pub async fn core_receive_address(alias: String, account: u32) -> WalletResult { + let wallet = { + let clients = CLIENTS.lock().await; + let slot = clients.get(&alias).ok_or("unknown alias")?; + slot.wallet.clone().ok_or("wallet not initialized")? + }; + + let address = wallet + .core() + .next_receive_address_for_account(account) + .await + .map_err(|e| format!("next_receive_address_for_account: {e}"))?; + Ok(address.to_string()) +} + +/// Next unused transparent Platform address. +/// +/// The counterpart to `core_receive_address` one layer up: this is where +/// `unshield` puts value that leaves the Orchard pool but stays on Platform. +/// Derived from public key material under DIP-17, so no seed is touched. +pub async fn platform_receive_address(alias: String, account: u32) -> WalletResult { + let (wallet, network_name) = { + let clients = CLIENTS.lock().await; + let slot = clients.get(&alias).ok_or("unknown alias")?; + ( + slot.wallet.clone().ok_or("wallet not initialized")?, + slot.network.clone(), + ) + }; + + // key_class 0 is the clear-funds purpose; the shielded classes are separate + // derivations and would produce an address unshield cannot pay. + let account_key = key_wallet::account::account_collection::PlatformPaymentAccountKey { + account, + key_class: 0, + }; + + let address = wallet + .platform() + .next_unused_receive_address(account_key) + .await + .map_err(|e| format!("next_unused_receive_address: {e}"))?; + + Ok(address.to_bech32m_string(network_from_name(&network_name))) +} + +/// Seed-backed Core signer. +/// +/// The asset-lock path signs L1 inputs and the credit-output key binding, which +/// needs private keys the `PlatformWallet` deliberately does not hold: it is +/// created external-signable so the seed never becomes resident wallet state. +/// This signer re-derives from the mnemonic for the duration of one call, the +/// same posture `create_transfer` already uses for the Orchard spend authority. +/// +/// The mnemonic is a per-call parameter and never resident wallet state. Reading +/// it off the open client instead would make an alias string sufficient to move +/// funds, and an alias is not a secret: it is enumerable from host state and +/// every read-only call already takes one. +struct SeedSigner { + wallet: key_wallet::wallet::Wallet, +} + +impl SeedSigner { + fn new(seed: [u8; 64], network: Network) -> WalletResult { + Ok(Self { + wallet: key_wallet::wallet::Wallet::from_seed_bytes( + seed, + network, + WalletAccountCreationOptions::None, + ) + .map_err(|e| format!("seed wallet: {e}"))?, + }) + } +} + +#[async_trait::async_trait] +impl key_wallet::signer::Signer for SeedSigner { + type Error = String; + + fn supported_methods(&self) -> &[key_wallet::signer::SignerMethod] { + &[key_wallet::signer::SignerMethod::Digest] + } + + async fn sign_ecdsa( + &self, + path: &key_wallet::bip32::DerivationPath, + sighash: [u8; 32], + ) -> Result< + ( + dashcore::secp256k1::ecdsa::Signature, + dashcore::secp256k1::PublicKey, + ), + String, + > { + let xprv = self + .wallet + .derive_extended_private_key(path) + .map_err(|e| e.to_string())?; + let secp = dashcore::secp256k1::Secp256k1::new(); + let msg = dashcore::secp256k1::Message::from_digest(sighash); + Ok(( + secp.sign_ecdsa(&msg, &xprv.private_key), + dashcore::secp256k1::PublicKey::from_secret_key(&secp, &xprv.private_key), + )) + } + + async fn public_key( + &self, + path: &key_wallet::bip32::DerivationPath, + ) -> Result { + let xprv = self + .wallet + .derive_extended_private_key(path) + .map_err(|e| e.to_string())?; + let secp = dashcore::secp256k1::Secp256k1::new(); + Ok(dashcore::secp256k1::PublicKey::from_secret_key( + &secp, + &xprv.private_key, + )) + } +} + +#[async_trait::async_trait] +impl key_wallet::signer::ExtendedPubKeySigner for SeedSigner { + async fn extended_public_key( + &self, + path: &key_wallet::bip32::DerivationPath, + ) -> Result { + self.wallet + .derive_extended_public_key(path) + .map_err(|e| e.to_string()) + } +} + +/// Start the Core (L1) SPV client for this wallet. +/// +/// The Platform SDK connection `initialize` builds only reaches Platform. L1 +/// balance, and therefore anything that spends a UTXO, needs a separate SPV +/// sync against Dash Core peers. `from_height` skips history the wallet cannot +/// own: a wallet created today has no transactions below the current tip, and +/// scanning from genesis costs hours of filter matching for nothing. +pub async fn start_core_sync(alias: String, from_height: u32) -> WalletResult<()> { + let (manager, network, db_dir) = { + let clients = CLIENTS.lock().await; + let slot = clients.get(&alias).ok_or("unknown alias")?; + ( + slot.manager.clone().ok_or("wallet not initialized")?, + network_from_name(&slot.network), + slot.db_dir.clone(), + ) + }; + + let spv_dir = db_dir.join("spv"); + std::fs::create_dir_all(&spv_dir).map_err(|e| format!("mkdir {spv_dir:?}: {e}"))?; + + let mut config = dash_spv::ClientConfig::new(network).with_storage_path(spv_dir); + if from_height > 0 { + config = config.with_start_height(from_height); + } + + match manager.spv().start(config).await { + Ok(()) => {} + // Re-arming an already-running client is a no-op, not a failure: the + // host may call this again after a reconnect. + Err(platform_wallet::PlatformWalletError::SpvAlreadyRunning) => return Ok(()), + Err(e) => return Err(format!("spv start: {e}")), + } + manager.spv_arc().spawn_run_loop(); + Ok(()) +} + +/// Confirmed / unconfirmed Core balance in duffs, plus SPV sync height. +pub async fn core_balance(alias: String) -> WalletResult { + let (manager, wallet) = { + let clients = CLIENTS.lock().await; + let slot = clients.get(&alias).ok_or("unknown alias")?; + ( + slot.manager.clone().ok_or("wallet not initialized")?, + slot.wallet.clone().ok_or("wallet not initialized")?, + ) + }; + + let balance = wallet.core().balance(); + let synced_height = manager + .spv() + .sync_progress() + .await + .and_then(|p| p.headers().ok().map(|h| h.tip_height())) + .unwrap_or(0); + + Ok(CoreBalance { + confirmed_duffs: balance.confirmed().to_string(), + unconfirmed_duffs: balance.unconfirmed().to_string(), + total_duffs: balance.total().to_string(), + synced_height, + }) +} + +/// Move Core (L1) value into the shielded pool through an asset lock. +/// +/// This is the only way value enters the pool: `create_transfer` spends notes +/// that must already exist. The call builds and broadcasts an L1 asset lock, +/// waits for its InstantSend or ChainLock proof, then proves and broadcasts a +/// Type 18 `ShieldFromAssetLock` transition paying this wallet's own Orchard +/// address. The Halo 2 proof runs inside, so expect it to take seconds. +pub async fn shield_from_asset_lock( + alias: String, + amount_duffs: String, + account_index: u32, + mnemonic_seed: String, +) -> WalletResult { + let amount: u64 = amount_duffs + .parse() + .map_err(|_| "amount must be a whole number of duffs".to_string())?; + if amount == 0 { + return Err("amount must be greater than zero".into()); + } + + let (network_name, wallet, manager, account) = { + let clients = CLIENTS.lock().await; + let slot = clients.get(&alias).ok_or("unknown alias")?; + ( + slot.network.clone(), + slot.wallet.clone().ok_or("wallet not initialized")?, + slot.manager.clone().ok_or("wallet not initialized")?, + slot.account, + ) + }; + + let coordinator = manager + .shielded_coordinator() + .await + .ok_or("shielded coordinator missing")?; + + let raw = wallet + .shielded_default_address(account) + .await + .ok_or("shielded_default_address returned none")?; + let recipient = dash_sdk::dpp::address_funds::OrchardAddress::from_raw_bytes(&raw) + .map_err(|e| format!("orchard address: {e}"))?; + + let seed = mnemonic_to_seed(&mnemonic_seed)?; + let signer = SeedSigner::new(seed, network_from_name(&network_name))?; + let prover = platform_wallet::wallet::shielded::prover::CachedOrchardProver::new(); + + wallet + .shielded_fund_from_asset_lock( + &coordinator, + platform_wallet::wallet::asset_lock::orchestration::AssetLockFunding::FromWalletBalance { + amount_duffs: amount, + account_index, + }, + vec![(recipient, None)], + &signer, + &prover, + None, + 0, + None, + None, + ) + .await + .map_err(|e| format!("shielded fund from asset lock failed: {e}"))?; + + Ok(encode_raw_orchard_address(&raw, &network_name)?) +} + +/// List the asset locks this wallet is tracking. +/// +/// `resume_shield_from_asset_lock` needs an outpoint, and a host that crashed +/// mid-shield has no other way to learn one: the failing call returns an error, +/// not the lock it had just broadcast. Enumerating them is what turns resume +/// from an entry point into a usable recovery path. +/// +/// The list survives a restart. Opening a wallet on a store that already holds +/// its history rebuilds the locks from the wallet's chain records, each with +/// the status `recovered_from_chain`. A lock this store saw consumed is left +/// out of that rebuild. +pub async fn tracked_asset_locks(alias: String) -> WalletResult> { + let (manager, wallet) = { + let clients = CLIENTS.lock().await; + let slot = clients.get(&alias).ok_or("unknown alias")?; + ( + slot.manager.clone().ok_or("wallet not initialized")?, + slot.wallet.clone().ok_or("wallet not initialized")?, + ) + }; + + let wallet_id = wallet.wallet_id(); + // The accessor takes the manager lock with `blocking_read`, which panics on + // a runtime worker thread, so it has to run somewhere blocking is allowed. + let snapshots = tokio::task::spawn_blocking(move || { + manager.tracked_asset_locks_blocking(&wallet_id) + }) + .await + .map_err(|e| format!("tracked_asset_locks join: {e}"))?; + + Ok(snapshots + .into_iter() + .map(|snap| AssetLock { + txid: snap.outpoint.txid.to_string(), + vout: snap.outpoint.vout, + status: match snap.status { + 0 => "built", + 1 => "broadcast", + 2 => "instant_send_locked", + 3 => "chain_locked", + 4 => "consumed", + 5 => "recovered_from_chain", + _ => "unknown", + } + .to_string(), + }) + .collect()) +} + +/// Finish a shield whose L1 asset lock is already on-chain. +/// +/// `shield_from_asset_lock` broadcasts the lock first and proves the Type 18 +/// transition second, so a failure between the two leaves the locked value +/// stranded: the duffs are spent into the lock, but nothing credits the pool. +/// Building a fresh lock cannot recover them. This resumes the tracked lock at +/// `txid:vout` instead, which is the only path back for those funds and the +/// reason an auto-shielding host can retry safely. +/// +/// The lock does not have to come from this process. A wallet reopened on its +/// store lists the locks an earlier process broadcast, and a stranded one +/// resumes here. +/// +/// A lock Platform already consumed fails instead. Upstream then tries to +/// record the lock as consumption-unknown, which needs the `wallet_restore` +/// persistence capability the SQLite persister does not attest, so the error a +/// host sees names that capability and not the consumed lock. +pub async fn resume_shield_from_asset_lock( + alias: String, + txid: String, + vout: u32, + mnemonic_seed: String, +) -> WalletResult { + let (network_name, wallet, manager, account) = { + let clients = CLIENTS.lock().await; + let slot = clients.get(&alias).ok_or("unknown alias")?; + ( + slot.network.clone(), + slot.wallet.clone().ok_or("wallet not initialized")?, + slot.manager.clone().ok_or("wallet not initialized")?, + slot.account, + ) + }; + + let parsed_txid: dashcore::Txid = txid + .parse() + .map_err(|e| format!("invalid txid {txid}: {e}"))?; + let out_point = dashcore::OutPoint { + txid: parsed_txid, + vout, + }; + + let coordinator = manager + .shielded_coordinator() + .await + .ok_or("shielded coordinator missing")?; + + let raw = wallet + .shielded_default_address(account) + .await + .ok_or("shielded_default_address returned none")?; + let recipient = dash_sdk::dpp::address_funds::OrchardAddress::from_raw_bytes(&raw) + .map_err(|e| format!("orchard address: {e}"))?; + + let seed = mnemonic_to_seed(&mnemonic_seed)?; + let signer = SeedSigner::new(seed, network_from_name(&network_name))?; + let prover = platform_wallet::wallet::shielded::prover::CachedOrchardProver::new(); + + wallet + .shielded_fund_from_asset_lock( + &coordinator, + platform_wallet::wallet::asset_lock::orchestration::AssetLockFunding::FromExistingAssetLock { + out_point, + // Never true here: an invitation voucher is a bearer claim + // already shared with someone else, and consuming one into this + // wallet would invalidate their claim. Only DashPay's reclaim + // flow sets it. + consume_invitation_voucher: false, + }, + vec![(recipient, None)], + &signer, + &prover, + None, + 0, + None, + None, + ) + .await + .map_err(|e| format!("resume shield from asset lock failed: {e}"))?; + + encode_raw_orchard_address(&raw, &network_name) +} + +/// Move shielded value to a transparent Platform address. +/// +/// The counterpart to shielding: notes are spent and the value lands on a +/// Platform address as ordinary credits, leaving the Orchard pool. +pub async fn unshield( + alias: String, + to_address: String, + amount_credits: String, + mnemonic_seed: String, +) -> WalletResult { + let amount: u64 = amount_credits + .parse() + .map_err(|_| "amount must be a whole number of credits".to_string())?; + if amount == 0 { + return Err("amount must be greater than zero".into()); + } + + let (wallet, manager, account) = { + let clients = CLIENTS.lock().await; + let slot = clients.get(&alias).ok_or("unknown alias")?; + ( + slot.wallet.clone().ok_or("wallet not initialized")?, + slot.manager.clone().ok_or("wallet not initialized")?, + slot.account, + ) + }; + + let coordinator = manager + .shielded_coordinator() + .await + .ok_or("shielded coordinator missing")?; + let seed = mnemonic_to_seed(&mnemonic_seed)?; + let prover = platform_wallet::wallet::shielded::prover::CachedOrchardProver::new(); + + wallet + .shielded_unshield_to(&coordinator, &seed[..], account, &to_address, amount, &prover) + .await + .map_err(|e| format!("unshield failed: {e}"))?; + + Ok(to_address) +} + +/// Move shielded value out to a Core L1 address. +/// +/// `core_fee_per_byte` is the L1 fee rate in duffs per byte, which prices the +/// withdrawal transaction the network builds on the far side. +pub async fn shielded_withdraw( + alias: String, + to_core_address: String, + amount_credits: String, + core_fee_per_byte: u32, + mnemonic_seed: String, +) -> WalletResult { + let amount: u64 = amount_credits + .parse() + .map_err(|_| "amount must be a whole number of credits".to_string())?; + if amount == 0 { + return Err("amount must be greater than zero".into()); + } + + let (wallet, manager, account) = { + let clients = CLIENTS.lock().await; + let slot = clients.get(&alias).ok_or("unknown alias")?; + ( + slot.wallet.clone().ok_or("wallet not initialized")?, + slot.manager.clone().ok_or("wallet not initialized")?, + slot.account, + ) + }; + + let coordinator = manager + .shielded_coordinator() + .await + .ok_or("shielded coordinator missing")?; + let seed = mnemonic_to_seed(&mnemonic_seed)?; + let prover = platform_wallet::wallet::shielded::prover::CachedOrchardProver::new(); + + wallet + .shielded_withdraw_to( + &coordinator, + &seed[..], + account, + &to_core_address, + amount, + core_fee_per_byte, + &prover, + ) + .await + .map_err(|e| format!("shielded withdraw failed: {e}"))?; + + Ok(to_core_address) +} + pub async fn poll(alias: String) -> WalletResult { let (manager, wallet, account, network_name) = { let clients = CLIENTS.lock().await; diff --git a/scripts/build-native-android.ts b/scripts/build-native-android.ts index ebfdd9e..c8d91fb 100644 --- a/scripts/build-native-android.ts +++ b/scripts/build-native-android.ts @@ -28,7 +28,7 @@ function run( child.on('error', reject) child.on('exit', code => { if (code === 0) resolve() - else reject(new Error(`${cmd} ${args.join(' ')} exited ${code}`)) + else reject(new Error(`${cmd} ${args.join(' ')} exited ${String(code)}`)) }) }) } @@ -42,6 +42,7 @@ async function patchKotlinErrorField(path: string): Promise { const source = await readFile(path, 'utf8') const patched = source .replace( + // eslint-disable-next-line no-template-curly-in-string -- Kotlin source text 'val `message`: kotlin.String\n ) : DashException() {\n override val message\n get() = "message=${ `message` }"', 'val errorMessage: kotlin.String\n ) : DashException() {\n override val message\n get() = errorMessage' ) @@ -119,46 +120,60 @@ async function main(): Promise { await patchKotlinErrorField(join(androidJava, 'uniffi/dash/dash.kt')) - // arm64-v8a only. RNDashShieldedModule.kt sets - // `uniffi.component.dash.libraryOverride` to "dashshielded", so the ABI - // directory needs exactly libdashshielded.so — no libuniffi_dash.so copy. - const abi = 'arm64-v8a' - const target = 'aarch64-linux-android' - const toolchainBin = await findToolchainBin(ndk) - await run( - 'cargo', - [ - 'ndk', - '-t', - abi, - 'build', - '--release', - '--no-default-features', - '--features', - 'uniffi-backend' - ], - rustDir, + // Both ABIs edge-react-gui ships (its abiFilters are 'armeabi-v7a' and + // 'arm64-v8a'). RNDashShieldedModule.kt sets + // `uniffi.component.dash.libraryOverride` to "dashshielded", so each ABI + // directory needs exactly libdashshielded.so, no libuniffi_dash.so copy. + const abis = [ + { + abi: 'arm64-v8a', + target: 'aarch64-linux-android', + rustflagsVar: 'AARCH64_LINUX_ANDROID' + }, { - ANDROID_NDK_HOME: ndk, - // Android 15 ships 16 KB pages; link for it or the loader rejects us. - CARGO_TARGET_AARCH64_LINUX_ANDROID_RUSTFLAGS: - '-C link-arg=-Wl,-z,max-page-size=16384 -C link-arg=-Wl,-z,common-page-size=16384', - // Dependencies that compile C (rs-x11-hash) go through the `cc` crate. - // cargo-ndk points it at a bare `clang` and expects the NDK toolchain - // to be first on PATH; without that it resolves to host clang, which - // has no Android sysroot and dies on a missing `stdlib.h`. Setting - // CC_ here does not help — cargo-ndk overwrites it. - PATH: `${toolchainBin}:${process.env.PATH ?? ''}` + abi: 'armeabi-v7a', + target: 'armv7-linux-androideabi', + rustflagsVar: 'ARMV7_LINUX_ANDROIDEABI' } - ) + ] + const toolchainBin = await findToolchainBin(ndk) - const destDir = join(androidJni, abi) - await mkdir(destDir, { recursive: true }) - await copyFile( - join(rustDir, 'target', target, 'release', 'libdashshielded.so'), - join(destDir, 'libdashshielded.so') - ) - console.log(`Wrote ${join(destDir, 'libdashshielded.so')}`) + for (const { abi, target, rustflagsVar } of abis) { + await run( + 'cargo', + [ + 'ndk', + '-t', + abi, + 'build', + '--release', + '--no-default-features', + '--features', + 'uniffi-backend' + ], + rustDir, + { + ANDROID_NDK_HOME: ndk, + // Android 15 ships 16 KB pages; link for it or the loader rejects us. + [`CARGO_TARGET_${rustflagsVar}_RUSTFLAGS`]: + '-C link-arg=-Wl,-z,max-page-size=16384 -C link-arg=-Wl,-z,common-page-size=16384', + // Dependencies that compile C (rs-x11-hash) go through the `cc` crate. + // cargo-ndk points it at a bare `clang` and expects the NDK toolchain + // to be first on PATH; without that it resolves to host clang, which + // has no Android sysroot and dies on a missing `stdlib.h`. Setting + // CC_ here does not help, since cargo-ndk overwrites it. + PATH: `${toolchainBin}:${process.env.PATH ?? ''}` + } + ) + + const destDir = join(androidJni, abi) + await mkdir(destDir, { recursive: true }) + await copyFile( + join(rustDir, 'target', target, 'release', 'libdashshielded.so'), + join(destDir, 'libdashshielded.so') + ) + console.log(`Wrote ${join(destDir, 'libdashshielded.so')}`) + } } main().catch((error: unknown) => { diff --git a/scripts/build-native-host.ts b/scripts/build-native-host.ts index 7e03046..fc1455b 100644 --- a/scripts/build-native-host.ts +++ b/scripts/build-native-host.ts @@ -1,6 +1,6 @@ +import { spawn } from 'child_process' import { copyFile, mkdir } from 'fs/promises' import { join } from 'path' -import { spawn } from 'child_process' const rustDir = join(__dirname, '../rust') const prebuildDir = join( @@ -15,7 +15,7 @@ function run(cmd: string, args: string[], cwd: string): Promise { child.on('error', reject) child.on('exit', code => { if (code === 0) resolve() - else reject(new Error(`${cmd} ${args.join(' ')} exited ${code}`)) + else reject(new Error(`${cmd} ${args.join(' ')} exited ${String(code)}`)) }) }) } @@ -29,10 +29,20 @@ async function main(): Promise { await mkdir(prebuildDir, { recursive: true }) const dylib = - process.platform === 'darwin' ? 'libdashshielded.dylib' : 'libdashshielded.so' + process.platform === 'darwin' + ? 'libdashshielded.dylib' + : 'libdashshielded.so' const built = join(rustDir, 'target', 'release', dylib) const dest = join(prebuildDir, 'dashshielded.node') await copyFile(built, dest) + + // macOS refuses to load a copied dylib under its original linker-signed + // signature: the copy is SIGKILLed at require() with no output. Re-sign the + // destination ad hoc so the addon actually loads. + if (process.platform === 'darwin') { + await run('codesign', ['--force', '--sign', '-', dest], prebuildDir) + } + console.log(`Wrote ${dest}`) } diff --git a/scripts/build-native-ios.ts b/scripts/build-native-ios.ts index 60c59ed..3c15f20 100644 --- a/scripts/build-native-ios.ts +++ b/scripts/build-native-ios.ts @@ -20,7 +20,7 @@ function run(cmd: string, args: string[], cwd: string): Promise { child.on('error', reject) child.on('exit', code => { if (code === 0) resolve() - else reject(new Error(`${cmd} ${args.join(' ')} exited ${code}`)) + else reject(new Error(`${cmd} ${args.join(' ')} exited ${String(code)}`)) }) }) } @@ -93,7 +93,13 @@ async function main(): Promise { [ '-create-xcframework', '-library', - join(rustDir, 'target', 'aarch64-apple-ios', 'release', 'libdashshielded.a'), + join( + rustDir, + 'target', + 'aarch64-apple-ios', + 'release', + 'libdashshielded.a' + ), '-headers', deviceHeaders, '-library', diff --git a/scripts/fund-testnet.ts b/scripts/fund-testnet.ts new file mode 100644 index 0000000..0d71322 --- /dev/null +++ b/scripts/fund-testnet.ts @@ -0,0 +1,112 @@ +// Walk a testnet wallet from empty to a funded shielded pool. +// +// Value can only reach the Orchard pool through Dash L1: a transparent UTXO +// becomes an asset lock, and the asset lock becomes a shielded note. This +// script drives that whole path so the shielded send path has something to +// spend. +// +// DASH_MNEMONIC="<24 words>" node -r sucrase/register ./scripts/fund-testnet.ts +// +// It prints the wallet's L1 receive address and waits. Pay that address from +// https://faucet.testnet.networks.dash.org/ while it runs; once the balance +// lands it shields `SHIELD_DUFFS` (default 0.1 DASH) into the pool and reports +// the shielded balance. +// +// Environment: +// DASH_MNEMONIC BIP-39 phrase for the wallet (required) +// DASH_DATA_DIR where wallet + SPV state live (default: a temp dir) +// START_HEIGHT L1 height to start the SPV scan from (default: 1549000) +// SHIELD_DUFFS amount to move into the pool (default: 10000000) +// WAIT_MINUTES how long to wait for the faucet payment (default: 30) + +import { mkdtempSync } from 'fs' +import { tmpdir } from 'os' +import { join } from 'path' + +import { makeNodeDashShieldedModule } from '../src/node' + +const ALIAS = 'fund' +const NETWORK = 'testnet' + +const sleep = async (ms: number): Promise => + await new Promise(resolve => setTimeout(resolve, ms)) + +async function main(): Promise { + const mnemonicSeed = process.env.DASH_MNEMONIC ?? '' + if (mnemonicSeed === '') { + throw new Error('set DASH_MNEMONIC to the wallet phrase') + } + const documentDirectory = + process.env.DASH_DATA_DIR ?? mkdtempSync(join(tmpdir(), 'dash-fund-')) + const startHeight = Number(process.env.START_HEIGHT ?? 1549000) + const shieldDuffs = process.env.SHIELD_DUFFS ?? '10000000' + const waitMinutes = Number(process.env.WAIT_MINUTES ?? 30) + + const io = makeNodeDashShieldedModule({ documentDirectory }) + const synchronizer = await io.makeSynchronizer({ + mnemonicSeed, + account: 0, + alias: ALIAS, + network: NETWORK, + dataDir: documentDirectory, + defaultHost: 'seed-1.testnet.networks.dash.org', + defaultPort: 1443 + }) + + const { shieldedAddress } = await synchronizer.deriveShieldedAddress() + const coreAddress = await synchronizer.coreReceiveAddress() + console.log(`data dir: ${documentDirectory}`) + console.log(`shielded address ${shieldedAddress}`) + console.log(`fund this L1 address: ${coreAddress}`) + + // The Platform SDK connection cannot see L1, so the transparent balance + // needs its own SPV sync before an asset lock has anything to spend. + await synchronizer.startCoreSync(startHeight) + + const deadline = Date.now() + waitMinutes * 60_000 + let funded = false + while (Date.now() < deadline) { + const core = await synchronizer.coreBalance() + console.log( + `L1 height ${core.syncedHeight} confirmed ${core.confirmedDuffs} unconfirmed ${core.unconfirmedDuffs}` + ) + if (BigInt(core.confirmedDuffs) >= BigInt(shieldDuffs)) { + funded = true + break + } + await sleep(15_000) + } + if (!funded) { + throw new Error( + `no confirmed L1 balance of ${shieldDuffs} duffs after ${String( + waitMinutes + )} minutes` + ) + } + + // Building the Halo 2 key first keeps its cost out of the shield timing. + await io.Tools.warmUpProver() + + console.log(`shielding ${shieldDuffs} duffs`) + const started = Date.now() + const recipient = await synchronizer.shieldFromAssetLock( + shieldDuffs, + mnemonicSeed + ) + console.log(`shielded to ${recipient} in ${String(Date.now() - started)} ms`) + + await synchronizer.startSync() + for (let i = 0; i < 40; i++) { + await sleep(15_000) + const balance = await synchronizer.getBalance() + console.log(`shielded balance ${balance.totalCredits} credits`) + if (balance.totalCredits !== '0') break + } + + await synchronizer.stop() +} + +main().catch((error: unknown) => { + console.error(error) + process.exit(1) +}) diff --git a/scripts/smoke-node.ts b/scripts/smoke-node.ts index b168d64..04ca00d 100644 --- a/scripts/smoke-node.ts +++ b/scripts/smoke-node.ts @@ -11,11 +11,8 @@ async function main(): Promise { const mnemonic = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art' - const validDummy = await io.Tools.isValidAddress( - 'not-an-address', - 'testnet' - ) - if (validDummy !== false) { + const validDummy = await io.Tools.isValidAddress('not-an-address', 'testnet') + if (validDummy) { throw new Error('isValidAddress should reject garbage') } @@ -29,11 +26,11 @@ async function main(): Promise { throw new Error(`unexpected testnet address ${address}`) } const addressOk = await io.Tools.isValidAddress(address, 'testnet') - if (addressOk !== true) { + if (!addressOk) { throw new Error(`derived address failed validation: ${address}`) } - const synchronizer = await io.makeSynchronizer({ + const synchronizerOptions = { mnemonicSeed: mnemonic, account: 0, alias: 'smoke', @@ -41,21 +38,39 @@ async function main(): Promise { dataDir: documentDirectory, defaultHost: 'seed-1.testnet.networks.dash.org', defaultPort: 1443 - }) + } as const + const synchronizer = await io.makeSynchronizer(synchronizerOptions) const derived = await synchronizer.deriveShieldedAddress() if (derived.shieldedAddress !== address) { - throw new Error( - `address mismatch ${derived.shieldedAddress} vs ${address}` - ) + throw new Error(`address mismatch ${derived.shieldedAddress} vs ${address}`) } const balance = await synchronizer.getBalance() if (balance.totalCredits !== '0') { throw new Error(`expected empty balance, got ${balance.totalCredits}`) } - console.log('smoke-node ok') - console.log(JSON.stringify({ address, viewing }, null, 2)) + // Building the Halo 2 proving key is the heaviest thing this module does and + // the only part a spend cannot skip, so the smoke test proves it completes + // rather than leaving it to be discovered on a user's first send. + if (await io.Tools.isProverReady()) { + throw new Error('prover reported ready before warm-up') + } + const proverStart = Date.now() + await io.Tools.warmUpProver() + const proverMs = Date.now() - proverStart + if (!(await io.Tools.isProverReady())) { + throw new Error('prover did not become ready after warm-up') + } + await synchronizer.stop() + + // Stopping has to release the wallet store, or this alias cannot be opened + // again until the process exits. + const reopened = await io.makeSynchronizer(synchronizerOptions) + await reopened.stop() + + console.log('smoke-node ok') + console.log(JSON.stringify({ address, viewing, proverMs }, null, 2)) } main().catch((error: unknown) => { diff --git a/src/docs/dash-shielded-wallet.md b/src/docs/dash-shielded-wallet.md new file mode 100644 index 0000000..d99c72b --- /dev/null +++ b/src/docs/dash-shielded-wallet.md @@ -0,0 +1,1086 @@ +# Dash shielded native module: one Rust wallet for the Platform shielded pool, callable from Node and React Native + +| | | +|---|---| +| Status | Implemented (shield, shielded transfer, unshield, withdrawal to [L1](#l1) and resume after a restart verified on testnet from the Node host; a shielded transfer verified from the Edge app on an iOS simulator and an Android emulator; on two physical Android phones the wallet store opens, syncs, stops and reopens at the `v5.0.1` pin, and on one of them the app ran a shielded transfer, an unshield, a withdrawal to L1, a shield from L1 and a resume, see [4.3](#43-state-on-disk-and-wallet-open) and [5.8](#58-in-the-edge-app-physical-android-phones)) | +| Author | Jon Tzeng | +| Reviewer | - | +| Last updated | 2026-10-28 | +| Repos | [dash-shielded-native](https://github.com/EdgeApp/dash-shielded-native) | +| Implementation | [EdgeApp/dash-shielded-native#1](https://github.com/EdgeApp/dash-shielded-native/pull/1) | +| Supersedes | - | +| Related | [Asana task](https://app.asana.com/0/0/1216611553286539/f) | + + + +File and symbol references point at the `jon/dash-shielded-install-and-smoke` branch, which is stacked on `paul/dashShielded`. The base branch carries the first version of the module by Paul Puey (key derivation, addresses, shielded sync, shielded transfer). This document describes the two branches as one module, and [6. Phase history](#6-phase-history) records which branch added what. + +## Contents + +1. [Problem](#1-problem) +2. [Prior art](#2-prior-art) +3. [Goals and non-goals](#3-goals-and-non-goals) +4. [Design overview](#4-design-overview) +5. [Testing](#5-testing) +6. [Phase history](#6-phase-history) +7. [Decisions](#7-decisions) +8. [Glossary](#8-glossary) +9. [References](#9-references) +10. [Post-implementation retrospective](#10-post-implementation-retrospective) + +## 1. Problem + +Edge has no way to hold or move value in the [Dash Platform](#dash-platform) [shielded pool](#shielded-pool). The pool is an [Orchard](#orchard) pool on Dash Platform, and every operation on it needs a [Halo 2](#halo-2) proof built on the device that holds the spend authority. Dash's JavaScript SDK does not build those proofs: the shielded state-transition builder in `@dashevo/wasm-dpp` 4.1.0 is an unimplemented `todo!()`. + +An Edge wallet needs four capabilities from one dependency: + +- Derive a shielded address and a viewing key from a [BIP-39](#bip-39) mnemonic, on mainnet and testnet. +- Scan the pool for the wallet's notes and report balance, sync status and history. +- Move value in from [L1](#l1), move it inside the pool, and move it back out, either to a transparent Platform address or to an L1 address. +- Run on the targets the Edge app ships: iOS 15.6 on arm64, Android API 28 on `arm64-v8a` and `armeabi-v7a`, plus Node for the currency plugin's tests and scripts. + +Value enters the pool in two steps on two chains. The wallet broadcasts an [asset lock](#asset-lock) on L1, waits for proof that the lock is final, then submits a Platform transition that consumes the lock and [credits](#credits) a shielded note. A failure between the steps leaves the [duffs](#duffs) spent into the lock with nothing credited, and a new lock cannot recover them. The module therefore has to list the locks it has built and finish a shield from an existing one. + +The mnemonic authorizes every spend. A host process that keeps a wallet open for hours should not keep the mnemonic in that wallet's resident state, where any caller that knows the wallet's alias could use it. + +## 2. Prior art + +**A [WASM](#wasm-webassembly) prover in the plugin WebView.** The community `pshenmic-dpp` package builds shielded transitions in WASM, and Edge's currency plugins already run in a WebView. Measured on one Apple Silicon host, a shield proof takes 11973 to 12030 ms in WASM against 523 to 576 ms native, about 22 times slower. The package is also a dev-tagged build from a single maintainer that would hold spend keys. See [Decision 1](#decision-1-native-rust-module-over-a-wasm-prover). + +**Dash's own mobile SDKs.** `dashpay/platform` ships [packages/swift-sdk](https://github.com/dashpay/platform/tree/v4.2.0-beta.7/packages/swift-sdk) and [packages/kotlin-sdk](https://github.com/dashpay/platform/tree/v4.2.0-beta.7/packages/kotlin-sdk) at tag `v4.2.0-beta.7`. Neither fits Edge's targets: + +| | Dash SDK at `v4.2.0-beta.7` | Edge app | +|---|---|---| +| iOS deployment target | `build_ios.sh` defaults to 17.0, `Package.swift` declares iOS 18 | 15.6 | +| Android `minSdk` | 29 | 28 | +| Android ABIs | `arm64-v8a` and `x86_64`; `build_android.sh` excludes `armeabi-v7a` by policy | `arm64-v8a` and `armeabi-v7a` | +| Node target | none | required for plugin tests | + +Both SDKs wrap the whole Platform surface (identities, documents, contracts, tokens), of which a shielded wallet uses a small part. See [Decision 4](#decision-4-generate-bindings-from-the-modules-own-udl). + +**Edge's native wallet modules.** [react-native-zano](https://github.com/EdgeApp/react-native-zano) and [react-native-monero](https://github.com/EdgeApp/react-native-monero) set the packaging pattern this module follows: a podspec that vendors an [xcframework](#xcframework), an Android library with prebuilt `jniLibs`, a thin TypeScript wrapper, and build scripts in `scripts/`. This module adds a Node addon to that pattern. + +**The seed list compiled into `dash-network-seeds`.** The Rust SDK can dial a fixed list of Platform nodes. The list ages with each release, and the module instead asks the network's quorum service for the live set. See [Decision 10](#decision-10-discover-nodes-from-the-quorum-service). + +## 3. Goals and non-goals + +Goals: + +- One Rust crate holds all wallet logic, and both hosts call the same functions. +- Fund the pool from [L1](#l1), transfer inside it, exit to Platform and to L1. +- A shield interrupted after its L1 lock is broadcast can be finished later from the lock's outpoint. +- No function moves funds without the mnemonic passed to that call. +- Native artifacts for the targets listed in [1. Problem](#1-problem), built from scripts in the repo. + +Non-goals: + +- The Edge currency plugin and GUI that call this module. They are a separate body of work in `edge-currency-accountbased` and `edge-react-gui`. +- Platform features outside the [shielded pool](#shielded-pool): identities, documents, [DPNS](#dpns-dash-platform-name-service), tokens. +- Reopening a wallet without the mnemonic. `initialize` always receives it; see [Decision 7](#decision-7-attest-the-viewing-key-capability-in-a-wrapper). +- `x86_64` slices for Android emulators and Intel iOS simulators. The Edge app's `abiFilters` excludes Intel. +- Cross-compiled Node prebuilds. A Node prebuild is produced on, and for, the build host. +- Tuning proving time on phones. No phone has run a proof yet; see [6.5 Deferred work](#65-deferred-work). + +## 4. Design overview + +The module is one repo. A single Rust file, `rust/src/wallet.rs`, owns wallet state and every operation. [N-API](#n-api) exports it for Node and [UniFFI](#uniffi) for iOS and Android. TypeScript wrappers on each host present the same `Synchronizer` object. + +### 4.1 Layers and bindings + +```mermaid +flowchart TD + NodeHost["Node host (src/node.ts)"] --> Addon["N-API addon (dashshielded.node)"] + RNHost["React Native host (src/react-native.ts)"] --> Bridge["RNDashShielded bridge (Swift, Kotlin)"] + Bridge --> Bindings["UniFFI bindings generated from dash.udl"] + Addon --> Wallet["rust/src/wallet.rs"] + Bindings --> Wallet + Wallet --> Manager["PlatformWalletManager (rs-platform-wallet)"] + Manager --> Dapi["Platform masternodes over DAPI"] + Manager --> Spv["dash-spv client (L1 peers)"] + Manager --> Store["SQLite stores under the document directory"] +``` + +The crate `edge-dash-shielded` builds a library named `dashshielded` as both `cdylib` and `staticlib`. A Cargo feature selects the backend: `napi-backend` (the default) compiles `rust/src/napi_api.rs`, and `uniffi-backend` compiles `rust/src/uniffi_api.rs` against the interface in `rust/src/dash.udl`. Both files are pass-through shims: they convert argument and error types and call `wallet.rs`. + +UniFFI generates `ios/dash.swift` and `android/src/main/java/uniffi/dash/dash.kt` from the [UDL](#udl-uniffi-definition-language). The hand-written bridges (`ios/RNDashShielded.swift` with its `RNDashShielded.m` export table, and `RNDashShieldedModule.kt`) expose 22 methods to React Native and forward each to the generated bindings. + +On Node, `src/load-addon.ts` walks up to six parent directories from its own location looking for `prebuilds/-/dashshielded.node`, then for a development build under `rust/target/release`. It throws an error that names `npm run build-native-host` when none exists. + +Dependency versions are pinned to fixed refs: + +| Dependency | Ref | +|---|---| +| `dash-sdk`, `platform-wallet`, `platform-wallet-storage`, `rs-sdk-trusted-context-provider` | `dashpay/platform` tag `v5.0.1` | +| `dashcore`, `key-wallet`, `dash-spv`, `dash-network-seeds` | `dashpay/rust-dashcore` rev `d631aaca` | +| [`orchard`](#orchard) | `dashpay/orchard` tag `dashified-0.14.1` | +| Rust toolchain | 1.98.1, in `rust/rust-toolchain.toml` | + +`v5.0.1` is the newest release of `dashpay/platform`. It restores a wallet from its store, which `v4.1.1` cannot, and its storage crate opens the wallet store on Android, which `v4.2.0-beta.7` refused. [Decision 11](#decision-11-pin-the-released-v501) records the choice. + +### 4.2 Endpoint discovery + +`initialize` asks the network's quorum service (`quorums.mainnet.networks.dash.org` or `quorums.testnet.networks.dash.org`) for the current masternode list and builds the SDK's address list from it. The caller's `defaultHost` and `defaultPort` are a fallback for when discovery returns nothing, and the only source on a devnet, which has no quorum service. With neither, `initialize` fails with `no DAPI endpoints`. + +Platform gRPC listens on a different port per network, and the port comes from the network unless the caller names one: + +[`rust/src/wallet.rs`](https://github.com/EdgeApp/dash-shielded-native/blob/8ccc97cb1de8513bbe109ae6285bb85ede083f25/rust/src/wallet.rs) +```rust +fn platform_port(network: Network, caller_port: u32) -> u32 { + if caller_port != 0 { + return caller_port; + } + match network { + Network::Mainnet => 443, + _ => 1443, + } +} +``` + +Every discovered node is dialed over `https`, whatever port it answers on. The scheme is inferred from the port only for the caller's own fallback host, where a local deployment without TLS is a legitimate target: + +[`rust/src/wallet.rs`](https://github.com/EdgeApp/dash-shielded-native/blob/8ccc97cb1de8513bbe109ae6285bb85ede083f25/rust/src/wallet.rs) +```rust +fn platform_scheme(port: u32) -> &'static str { + if port == 443 || port == 1443 { + "https" + } else { + "http" + } +} +``` + +See [Decision 2](#decision-2-https-for-every-discovered-node) and [Decision 3](#decision-3-port-from-the-network-when-the-caller-passes-0). + +Proofs returned by Platform are verified against quorum public keys from a `TrustedHttpContextProvider` with a 100-entry cache. The provider is compiled with its `withdrawals-contract` feature. Verifying the proof of a shielded withdrawal reads the withdrawals system contract, and the provider serves that contract only with the feature on. + +### 4.3 State on disk and wallet open + +`setDocumentDirectory` names a root, and each wallet alias gets `/dash-shielded//` containing: + +| Path | Owner | Contents | +|---|---|---| +| `wallet.db` | `SqlitePersister` (`platform-wallet-storage`) | Core wallet state, Platform addresses, asset-lock rows | +| `shielded.db` | the shielded coordinator's store | notes, the commitment tree and its checkpoints, activity | +| [`spv](#spv-simplified-payment-verification)/` | `dash-spv` | headers and compact filters for [L1](#l1) | + +`initialize` opens a wallet in this order: + +1. Build the SDK and a `PlatformWalletManager` over the persister. +2. Call `load_from_persistor`, then reuse the restored wallet if the store held one. Failure is not fatal and is logged only when `DASH_SHIELDED_DEBUG` is set. +3. On a store with no wallet, create it from the 64-byte [BIP-39](#bip-39) seed. +4. Derive the Orchard keys under [ZIP-32](#zip-32) (coin type 5 on mainnet, 1 on testnet) and bind them to the coordinator with `bind_shielded`. + +On a populated store, step 2 restores the wallet with its Core balance, its address pool and its tracked asset locks. A second process on the same store reports the L1 balance before its SPV client has synced a block, and it lists the locks an earlier process broadcast. [4.5 Funding from L1](#45-funding-from-l1) covers what that listing means. See [Decision 6](#decision-6-load-from-the-persister-before-creating). + +The restored address pool remembers which receive addresses were handed out. `coreReceiveAddress` returned `yffmKKHNbN9Sm7anAJpRg8mW7EJiD2n3DR` on a new store and the next unused address, `yefKbrX5PEZAuY9kt6td6EGMBH5K6J1fqs`, on the same store reopened. A host that checks a phrase by comparing the first receive address against a known value has to do it on a new store. The shielded address is derived from the seed alone and is the same on both. + +`SqlitePersister::open` inspects the directory that will hold `wallet.db` before it creates the file. `check_parent_perms` (`rs-platform-wallet-storage/src/parent_permissions.rs`) walks that directory and every ancestor up to `/`, once along the path as given and once along its canonical form. It refuses the open when a directory is writable by someone the check does not trust and lacks the sticky bit, or when its owner is not trusted. The check runs on every Unix target, `SqlitePersisterConfig` has no field that turns it off, and `open` is the only constructor. + +Who the check trusts depends on the target: + +| | Trusted owner | Trusted group on a group-writable directory | +|---|---|---| +| Android | the process's user, uid 0, the owner of `/`, and `system` (uid 1000) | `system` (gid 1000) and the app's own group, whose gid equals the app's uid | +| Other Unix | the process's user, uid 0, and the owner of `/` | none | + +Android creates `/data`, `/data/user` and `/data/user/0` as `system:system` with mode 0771, and each app's `files` directory with mode 0771 in the app's own group. Every path an app can write lies below them, and all of them pass on Android. At `v4.2.0-beta.7` the check trusted neither identity, and Android refused the store at the first of those directories ([5.7](#57-in-the-edge-app-ios-simulator-and-android-emulator)). [dashpay/platform#5352](https://github.com/dashpay/platform/pull/5352) added the Android identities, and `v5.0.0` was the first release to carry it. At this pin the store opens in the Edge app's `files` directory on two physical phones ([5.8](#58-in-the-edge-app-physical-android-phones)). + +The rules for other Unix targets did not change. The iOS simulator still refuses a device directory on the Mac with mode 0775 ([5.7](#57-in-the-edge-app-ios-simulator-and-android-emulator)). That failure belongs to the Mac's directory layout, and whether an iOS device passes has not been observed. + +The storage crate also allows one open `SqlitePersister` per database path in each process. `open` claims the path in a process-wide registry, and only dropping the persister releases the claim. A second `open` on a claimed path fails with `a SqlitePersister is already open on … in this process`. The claim outlives a wallet whose last reference is not dropped, which is why `stop` checks for it below. + +`bind_shielded` requires a persister that attests the `SHIELDED_VIEWING_KEYS` capability. The stock `SqlitePersister` attests it only when `platform-wallet-storage` is compiled with its `shielded` feature, which this crate does not enable. A wrapper adds it: + +[`rust/src/wallet.rs`](https://github.com/EdgeApp/dash-shielded-native/blob/8ccc97cb1de8513bbe109ae6285bb85ede083f25/rust/src/wallet.rs) +```rust +struct ShieldedCapablePersister { + inner: SqlitePersister, +} +``` + +[`rust/src/wallet.rs`](https://github.com/EdgeApp/dash-shielded-native/blob/8ccc97cb1de8513bbe109ae6285bb85ede083f25/rust/src/wallet.rs) +```rust + fn persistence_capabilities(&self) -> PersistenceCapabilities { + self.inner + .persistence_capabilities() + .union(PersistenceCapabilities::SHIELDED_VIEWING_KEYS) + } +``` + +Open wallets live in a process-wide map from alias to `ClientSlot`, behind one async mutex. A slot holds the manager, the wallet handle, the network, the account index, cached status, pending transfer proposals, and a weak reference to the wallet store. It holds no mnemonic. + +`stop` closes a wallet in this order: + +1. Remove the slot. No other call can reach the wallet after this. +2. Stop the shielded sync loop and call the manager's `shutdown`, which drains the sync passes and joins the worker threads, each within a bounded budget. Dropping the manager while a sync task still owns a timer panics that task, which is why this step comes before any drop. +3. Remove every wallet from the manager with `remove_wallet`, then drop the manager. The manager's wallet map and the wallets in it hold references to each other. Dropping the manager alone leaves that cycle, and the wallet store with it, open. +4. Return an error if the `ShutdownReport` is not clean, or if the weak reference to the store can still be upgraded. + +[`rust/src/wallet.rs`](https://github.com/EdgeApp/dash-shielded-native/blob/8ccc97cb1de8513bbe109ae6285bb85ede083f25/rust/src/wallet.rs) +```rust + let report = manager.shutdown().await; + for id in manager.wallet_ids().await { + manager + .remove_wallet(&id) + .await + .map_err(|e| format!("stop {alias}: remove wallet: {e}"))?; + } + drop(manager); +``` + +A `STOPPED` result therefore means the alias can be opened again in the same process. See [Decision 13](#decision-13-stop-proves-the-wallet-store-is-closed). + +### 4.4 API surface + +The same calls exist on both hosts. Names below are the TypeScript ones; the Rust and UDL names are the snake-case equivalents. + +| Group | Call | Needs mnemonic | Result | +|---|---|---|---| +| Tools | `generateMnemonic`, `deriveViewingKey`, `deriveShieldedAddress`, `isValidAddress` | derivation only | 24-word phrase, viewing key, [Bech32m](#bech32m) address | +| Tools | `warmUpProver`, `isProverReady` | no | builds the [Halo 2](#halo-2) proving key once per process | +| Lifecycle | `initialize`, `stop` | `initialize` | opens or closes the wallet for an alias | +| Shielded sync | `startSync`, `stopSync`, `poll` | no | status, scan progress, balance in [credits](#credits), up to 500 activity rows | +| L1 | `coreReceiveAddress`, `startCoreSync`, `coreBalance` | no | [BIP-44](#bip-44) address, SPV sync from a start height, balance in [duffs](#duffs) | +| Platform | `platformReceiveAddress` | no | transparent Platform address under [DIP-17](#dip-17) | +| Fund | `shieldFromAssetLock`, `trackedAssetLocks`, `resumeShieldFromAssetLock` | shield and resume | the credited shielded address; `{ txid, vout, status }` per lock | +| Transfer | `proposeTransfer`, `createTransfer` | `createTransfer` | `{ proposalId, feeCredits }`, then `{ txid }` | +| Exit | `unshield`, `shieldedWithdraw` | yes | the destination address | + +Amounts cross the boundary as decimal strings. L1 amounts are in duffs and pool amounts are in credits, at 1000 credits per duff. `proposeTransfer` validates the recipient's network, the memo length (32 UTF-8 bytes at most) and the balance before returning a fee. A caller therefore never shows a fee for a transfer that cannot be built. + +A shielded address is Bech32m with the prefix `dash` or `tdash`, carrying a type byte `0x10` and the 43-byte raw Orchard address. + +Each host wraps these calls in a `Synchronizer` that polls and emits `onBalanceChanged`, `onStatusChanged`, `onTransactionsChanged`, `onUpdate` and `onError`. The React Native wrapper polls every 500 ms while the status is `SYNCING` and every 2000 ms otherwise. + +### 4.5 Funding from L1 + +```mermaid +sequenceDiagram + participant Host + participant Wallet as wallet.rs + participant Core as Core chain (SPV peers) + participant Platform as Platform (DAPI) + Host->>Wallet: startCoreSync(fromHeight) + Wallet->>Core: sync headers and filters + Host->>Wallet: coreBalance() + Wallet-->>Host: confirmed duffs + Host->>Wallet: shieldFromAssetLock(amountDuffs, mnemonic) + Wallet->>Core: broadcast asset lock transaction + Core-->>Wallet: InstantSend lock or ChainLock proof + Note over Wallet,Core: Value now sits in the asset lock.
A failure past here leaves it there
until a resume. + Wallet->>Wallet: build Halo 2 proof + Wallet->>Platform: Type 18 ShieldFromAssetLock transition + Platform-->>Wallet: accepted + Wallet-->>Host: shielded address credited + opt the call failed after the lock was broadcast + Host->>Wallet: trackedAssetLocks() + Wallet-->>Host: txid, vout, status + Host->>Wallet: resumeShieldFromAssetLock(txid, vout, mnemonic) + Wallet->>Platform: Type 18 transition from the existing lock + end +``` + +The Platform SDK connection cannot see L1. `startCoreSync` starts the `dash-spv` client the manager holds, storing its data under `spv/`, and `fromHeight` skips history a new wallet cannot own. Calling it again while the client runs is a no-op. + +`shieldFromAssetLock` passes `AssetLockFunding::FromWalletBalance { amount_duffs, account_index }` to the upstream orchestrator, which builds the lock, waits for its proof, proves the Type 18 transition and pays the wallet's own Orchard address. `resumeShieldFromAssetLock` passes `AssetLockFunding::FromExistingAssetLock { out_point, consume_invitation_voucher: false }` and skips the L1 half. + +`trackedAssetLocks` is what makes resume usable. A failing shield returns an error, not the outpoint it had just broadcast, and the listing is the only way a host learns it. Each lock reports one status: `built`, `broadcast`, `instant_send_locked`, `chain_locked`, `consumed` or `recovered_from_chain`. + +The first five are stages a lock passes through inside the process that built it. `recovered_from_chain` is what a lock reads after [wallet open](#43-state-on-disk-and-wallet-open) rebuilds it in a later process from the wallet's chain records. Core has finalized such a lock, and the wallet cannot tell locally whether Platform consumed it. A lock this store saw consumed is left out of the rebuild. A lock consumed through some other store is rebuilt, and it reads `recovered_from_chain` like a stranded one. + +Resuming is how a host tells the two apart. A stranded lock shields and reads `consumed` for the rest of that process. A lock Platform already consumed fails, moves no value and keeps its status. A host cannot clear spent locks from the list. In that second case upstream tries to record the lock as consumption-unknown. That write requires the `wallet_restore` persistence capability, which `SqlitePersister` does not attest because its restore has no readers for token balances or the DashPay overlay. The host therefore receives `Failed to persist state: asset-lock reconciliation requires persistence capabilities ["wallet_restore"]` in place of upstream's typed `AssetLockAlreadyConsumed`. [6.5 Deferred work](#65-deferred-work) lists this. + +### 4.6 Seed handling + +The wallet is created external-signable: `PlatformWallet` holds public key material and no private keys. Every call that moves funds takes the mnemonic as a parameter and derives what it needs for that call: + +- `createTransfer`, `unshield` and `shieldedWithdraw` derive the 64-byte seed and hand it to the upstream spend function, which derives the Orchard spend authority. +- `shieldFromAssetLock` and `resumeShieldFromAssetLock` build a `SeedSigner`, which signs the L1 inputs and the credit-output key binding. + +[`rust/src/wallet.rs`](https://github.com/EdgeApp/dash-shielded-native/blob/8ccc97cb1de8513bbe109ae6285bb85ede083f25/rust/src/wallet.rs) +```rust +struct SeedSigner { + wallet: key_wallet::wallet::Wallet, +} + +impl SeedSigner { + fn new(seed: [u8; 64], network: Network) -> WalletResult { + Ok(Self { + wallet: key_wallet::wallet::Wallet::from_seed_bytes( + seed, + network, + WalletAccountCreationOptions::None, + ) + .map_err(|e| format!("seed wallet: {e}"))?, + }) + } +} +``` + +`SeedSigner` signs any derivation path the orchestrator asks for. It reaches the transparent L1 balance as well as the lock. That reach is why it is built per call and dropped when the call returns. See [Decision 5](#decision-5-the-mnemonic-is-a-per-call-parameter). + +Read-only calls (`poll`, the receive-address calls, `coreBalance`, `trackedAssetLocks`) need only the alias. + +### 4.7 Sync passes, anchors and spends + +`createTransfer`, `unshield` and `shieldedWithdraw` all end in upstream's `extract_spends_and_anchor`. Platform accepts a spend only if its [anchor](#anchor) is a commitment-tree root Platform recorded, and it records one anchor per block. The function fetches the recorded set, then probes the wallet's tree for the shallowest checkpoint whose root is in that set: depth 0 first, then depths 1 to 99 (`MAX_ANCHOR_PROBE_DEPTH = 100`, matching the tree's checkpoint retention). When none matches it returns `ShieldedNoRecordedAnchor` with the text `no recorded anchor covers the selected notes; wait for the next shielded sync`, and nothing is broadcast. The module passes this error through unchanged. + +A root in the wallet's tree can match one of Platform's only if the tree holds the same commitments in the same positions, which means every sync pass has to append each commitment once. Upstream's pass does not guarantee that by itself. It reads the tree size under a read lock, fetches the commitments past that size, and takes the write lock only to append them (`wallet/shielded/sync.rs`). Two passes that overlap both read the old size and both append the full range, and the tree ends up with every commitment twice. + +`ShieldedSyncManager::sync_now` prevents the overlap: it holds an in-flight flag for the whole pass and returns an empty summary when another pass holds it. The coordinator's own `sync` method has no such guard. `startSync` needs two things from upstream, the periodic loop (one pass every 60 seconds until `stopSync`) and one immediate forced pass whose summary it records so that `poll` reports a scan count and a `SYNCED` or `ERROR` status. The loop's first pass starts at once and returns its summary to nobody the module can read. The module therefore sends its own pass through the manager and waits out a pass already in flight: + +[`rust/src/wallet.rs`](https://github.com/EdgeApp/dash-shielded-native/blob/8ccc97cb1de8513bbe109ae6285bb85ede083f25/rust/src/wallet.rs) +```rust + let sync = manager.shielded_sync_arc(); + let summary = loop { + let summary = sync.sync_now(true).await; + // An empty summary means the pass was skipped because one + // was already in flight. Wait it out, then run ours. + if !summary.is_empty() || !sync.is_running() { + break summary; + } + tokio::time::sleep(std::time::Duration::from_millis(250)).await; + }; + if summary.is_empty() { + // Stopped before any pass of ours ran: nothing to record. + return; + } +``` + +```mermaid +sequenceDiagram + participant Host + participant Module as wallet.rs + participant Mgr as ShieldedSyncManager + participant Tree as wallet commitment tree + Host->>Module: startSync() + Module->>Mgr: start() + Mgr->>Tree: first pass reads size 0 + Module-->>Host: returns, status SYNCING + Module->>Mgr: sync_now(true) + Mgr-->>Module: empty summary, a pass is in flight + Note over Module: wait 250 ms, then ask again + Mgr->>Tree: first pass writes commitments 0 to N + Module->>Mgr: sync_now(true) + Mgr->>Tree: second pass reads size N, writes only newer ones + Mgr-->>Module: summary of the second pass + Module->>Module: record scan count and status for poll +``` + +The forced flag matters for the second pass. The loop passes `false`, which lets a wallet that caught up less than 30 seconds ago skip the round trip to Platform. A host that just called `startSync` wants a pass that checks Platform regardless. An empty summary with the loop no longer running means `stopSync` arrived first, and the task records nothing. See [Decision 12](#decision-12-run-the-immediate-sync-pass-through-the-sync-manager). + +`shieldedWithdraw` has a step the other two spends lack. After Platform accepts the transition, upstream verifies the execution proof, and that verification reads the withdrawals system contract from the context provider ([4.2](#42-endpoint-discovery)). When the provider cannot serve the contract, the withdrawal has already landed and the call still returns an error that begins `Shielded withdraw was submitted but its execution result could not be confirmed`. The rest of the text tells the host not to resubmit. With the feature on, the call returns the destination address. + +`createTransfer` has one more step. The upstream transfer call returns nothing, and the transaction id exists only as a row in the store's activity log. The module snapshots the activity ids before the spend and polls for a new outgoing row, 40 times at 250 ms, then returns its id as `txid`. If no row appears it returns an error that says the transfer was submitted, since the spend itself was accepted. + +`shieldedWithdraw` takes a `coreFeePerByte` rate that prices the L1 transaction Platform builds on the far side. + +### 4.8 Native artifacts and build + +| Artifact | Script | Targets | Size | +|---|---|---|---| +| `prebuilds/-/dashshielded.node` | `build-native-host.ts` | the build host | - | +| `ios/libdashshielded.xcframework` | `build-native-ios.ts` | `ios-arm64`, `ios-arm64-simulator`, deployment target 15.6 | 36.9 MB per slice | +| `android/src/main/jniLibs//libdashshielded.so` | `build-native-android.ts` | `arm64-v8a`, `armeabi-v7a`, [NDK](#ndk-native-development-kit) 27.1.12297006 | 15.7 MB and 12.4 MB, stripped | + +The Android script builds through `cargo ndk` and passes linker arguments for 16 KB page alignment. `android/build.gradle` packages both ABIs (`abiFilters 'armeabi-v7a', 'arm64-v8a'`). The host script copies the built library into `prebuilds/` and re-signs it ad hoc: a copied Mach-O keeps its linker-generated signature, macOS rejects that signature on load, and `require()` of the unsigned copy is killed with `SIGKILL` and no message. + +The release profile optimizes for size, because the iOS app links every native module into one binary: + +[`rust/Cargo.toml`](https://github.com/EdgeApp/dash-shielded-native/blob/8ccc97cb1de8513bbe109ae6285bb85ede083f25/rust/Cargo.toml) +```toml +[profile.release] +opt-level = "z" +lto = "fat" +codegen-units = 1 +strip = true +# Deliberately NOT `panic = "abort"`: both backends turn a Rust panic into a +# host-side error, and aborting would take the whole app down instead. +``` + +See [Decision 8](#decision-8-size-optimized-release-profile-with-unwinding-panics). + +Build prerequisites beyond Rust: `protoc` on the path (`dash-sdk` compiles protobuf definitions during the cargo build), and every cross target installed on the pinned 1.98.1 toolchain. A target installed only on the default stable toolchain fails with `E0463: can't find crate for std`. + +## 5. Testing + +Every run below is against live Dash testnet. [5.1](#51-host-build-and-smoke-test) to [5.6](#56-unshield-withdrawal-and-repeated-spends) ran on the Node host on macOS arm64. [5.7](#57-in-the-edge-app-ios-simulator-and-android-emulator) ran the mobile artifacts inside the Edge app on an iOS simulator and an Android emulator, and [5.8](#58-in-the-edge-app-physical-android-phones) on two physical Android phones. Sections [5.2](#52-fund-and-shield) to [5.7](#57-in-the-edge-app-ios-simulator-and-android-emulator) ran at the earlier pins `v4.1.1` and `v4.2.0-beta.7`. At `v5.0.1` the host build, the smoke test, one shielded transfer and one withdrawal from the host, and the phone runs in [5.8](#58-in-the-edge-app-physical-android-phones) ran. The phone runs include a transfer, an unshield, a withdrawal, a shield and a resume from the app. + +### 5.1 Host build and smoke test + +| Step | Result | +|---|---| +| `socket npm install` | 638 packages resolve | +| `socket npm run lint` | no findings | +| `socket npm run prepare` (rollup, then tsc) | passes | +| `socket npm run build-native-host` | produces the signed addon; `codesign -dv` reports `adhoc` | +| `socket npm run smoke-node` | prints `smoke-node ok` with a derived testnet address and the viewing key; `proverMs` 1350 to 1464, and 1456 at `v5.0.1` | + +The smoke test warms the [Halo 2](#halo-2) proving key and asserts that `isProverReady` flips. It then stops the wallet and opens the same alias again, which fails unless `stop` released the wallet store ([4.3](#43-state-on-disk-and-wallet-open)). A separate script that opens, syncs and stops one alias three times in one process reopened it all three times at `v5.0.1`. Deleting `prebuilds/darwin-arm64/`, rebuilding and re-running reproduces the pass from a clean state. + +### 5.2 Fund and shield + +`scripts/fund-testnet.ts` prints the [L1](#l1) address, starts the Core sync, waits for a balance, shields and reports the pool balance. + +``` +fund this L1 address: yffmKKHNbN9Sm7anAJpRg8mW7EJiD2n3DR +L1 height 1550616 confirmed 89999703 unconfirmed 0 +shielding 10000000 duffs +shielded to tdash1zryn7dw2rhsjxv628awvgxfmw4jh0ytpdgz9rrl2ff38mclgdtm3p936uh2h8zg4gw3c08gqsancf in 4151 ms +shielded balance 9787148800 credits +``` + +The 10000000 [duffs](#duffs) are 10000000000 [credits](#credits). The shield cost 212851200 credits. The Core sync reached testnet tip from a start height about 1100 blocks back in roughly a minute. + +### 5.3 Shielded transfer + +``` +status SYNCED available 9787148800 total 9787148800 +proposal {"proposalId":"p-1","feeCredits":"162851200"} +TRANSFER_RESULT {"txid":"fd960262bb68bed1ba1a49bdba394de1a0209ad2e0fc93210a894c22140e291e","amountCredits":"1000000000","feeCredits":"162851200"} in 4225 ms +``` + +A second transfer on a later store landed as `4f7f10de7da3e818d4507e1ee63d5f84749803856e45997fa5dd17e39ddd329b` in 4132 ms. + +### 5.4 Seed gate, lock listing and resume + +Calling `unshield` on an open wallet with a wrong phrase is refused with `invalid mnemonic: BIP-0039 mnemonic only supports 12/15/18/21/24 words` before any note is selected. + +Lock listing and resume, in one process: + +``` +LOCKS_BEFORE [] +L1 height 1550770 confirmed 79999406 +SHIELD ok tdash1zryn7dw2rhsjxv628awvgxfmw4jh0ytpdgz9rrl2ff38mclgdtm3p936uh2h8zg4gw3c08gqsancf in 4466 ms +LOCKS_AFTER [{"txid":"ce79317247b018827f2cc0e8be41781b8641ac6d1258ae2d7f9663c47d18a9e8","vout":0,"status":"consumed"}] +RESUME_ERR ce79317247b018827f2cc0e8be41781b8641ac6d1258ae2d7f9663c47d18a9e8:0 Asset lock ce79317247b018827f2cc0e8be41781b8641ac6d1258ae2d7f9663c47d18a9e8:0 has already been consumed +``` + +That run was on `v4.1.1`, where a new process restored nothing, which is why `LOCKS_BEFORE` is empty. The resume of a lock this process built returns `AssetLockAlreadyConsumed`: the lookup found the lock, and upstream refused to spend it twice. + +Resume after a restart. The first shield this module ever attempted broadcast the lock `c12094b3…:0` and then failed on the port ([6.2](#62-install-fix-funding-exits-and-artifacts)), and the process that built it exited. On `v4.2.0-beta.7`, a second process on a store that had synced the wallet's L1 history listed that lock and finished the shield: + +``` +CORE h=1567749 confirmed=78999109 unconfirmed=1000000 total=79999109 +LOCKS [{"txid":"332e9956e19c7c43986c936237119aab0b74cc76caee00f78400136dcf214f6f","vout":0,"status":"unknown"},{"txid":"ce79317247b018827f2cc0e8be41781b8641ac6d1258ae2d7f9663c47d18a9e8","vout":0,"status":"unknown"},{"txid":"c12094b34f3ecb86d3670ddcb1a0d6b00a6b711838e5ebc5e25d66f53eef52f8","vout":0,"status":"unknown"}] +RESUME-OK tdash1zryn7dw2rhsjxv628awvgxfmw4jh0ytpdgz9rrl2ff38mclgdtm3p936uh2h8zg4gw3c08gqsancf +LOCKS [{"txid":"332e9956e19c7c43986c936237119aab0b74cc76caee00f78400136dcf214f6f","vout":0,"status":"unknown"},{"txid":"ce79317247b018827f2cc0e8be41781b8641ac6d1258ae2d7f9663c47d18a9e8","vout":0,"status":"unknown"},{"txid":"c12094b34f3ecb86d3670ddcb1a0d6b00a6b711838e5ebc5e25d66f53eef52f8","vout":0,"status":"consumed"}] +``` + +- The `CORE` line is printed at open, before the [SPV](#spv-simplified-payment-verification) client has synced a block. The balance came from the store. +- The resume returned 4.4 seconds after the listing. A later sync on a new store showed 14821200800 credits, up from 5034052000 by 9787148800: the lock's 10000000000 less a 212851200 fee. +- The statuses read `unknown` because that build predates the module's name for upstream's `RecoveredFromChain`. The next block is the same store on the PR build. + +The same test on `v4.1.1`, with a second process on its own synced store, has nothing to resume: + +``` +CORE h=1567742 confirmed=0 unconfirmed=0 total=0 +CORE h=1567749 confirmed=79999109 unconfirmed=0 total=79999109 +LOCKS [] +RESUME-ERR resume shield from asset lock failed: Asset lock c12094b34f3ecb86d3670ddcb1a0d6b00a6b711838e5ebc5e25d66f53eef52f8:0 is not tracked by this wallet +``` + +A third process on the `v4.2.0-beta.7` store, running the PR build, shows what a reopened wallet lists and what resuming a spent lock returns: + +``` +LOCKS [{"txid":"332e9956e19c7c43986c936237119aab0b74cc76caee00f78400136dcf214f6f","vout":0,"status":"recovered_from_chain"},{"txid":"ce79317247b018827f2cc0e8be41781b8641ac6d1258ae2d7f9663c47d18a9e8","vout":0,"status":"recovered_from_chain"}] +RESUME-ERR resume shield from asset lock failed: Failed to persist state: asset-lock reconciliation requires persistence capabilities ["wallet_restore"] (missing mask 0x80) +LOCKS [{"txid":"332e9956e19c7c43986c936237119aab0b74cc76caee00f78400136dcf214f6f","vout":0,"status":"recovered_from_chain"},{"txid":"ce79317247b018827f2cc0e8be41781b8641ac6d1258ae2d7f9663c47d18a9e8","vout":0,"status":"recovered_from_chain"}] +``` + +- `c12094b3…:0` is no longer listed. This store saw it consumed in the second process. +- The two listed locks were consumed weeks earlier through stores that no longer exist. The resume targeted `ce793172…:0`, returned in 2.1 seconds, and left the listing unchanged. [4.5](#45-funding-from-l1) explains the error text. + +### 5.5 Native artifacts: symbols and APK size + +Every symbol the generated bindings load was diffed against what each library exports. + +| Bindings | Symbols referenced | Library | Symbols exported | Missing | +|---|---|---|---|---| +| Kotlin (`dash.kt`) | 103 | `arm64-v8a`, `armeabi-v7a` | 103 each | 0 | +| Swift (`dash.swift`) | 49 | `ios-arm64`, `ios-arm64-simulator` | 103 each | 0 | + +The counts were taken on the libraries built at `v4.2.0-beta.7`, and the `ios-arm64` slice carries `minos 15.6`. This check catches a library-name mismatch or a codegen gap on one [ABI](#abi-application-binary-interface), which would otherwise appear on a device as an `UnsatisfiedLinkError` or an undefined symbol at link time. The `arm64-v8a` and `ios-arm64-simulator` libraries were also loaded and run ([5.7](#57-in-the-edge-app-ios-simulator-and-android-emulator)). The symbol diff is the only check `armeabi-v7a` and `ios-arm64` have had beyond being packaged. See [Decision 9](#decision-9-static-symbol-diff-for-the-slices-no-test-host-loads). + +Edge cannot ship an app bundle. It ships one APK per ABI, and Google Play caps an APK at 100 MB. A release build of `edge-react-gui` (`develop` at `982bc31ee`) with the module linked from the PR head, `./gradlew assembleRelease -PabiSplits`, produced these files at each pin. The `v5.0.1` build also carries the local test script from [5.8](#58-in-the-edge-app-physical-android-phones), a few KB of JavaScript. One MB is 1000000 bytes here, the tighter reading of the cap. + +| APK | Bytes at `v4.2.0-beta.7` | Bytes at `v5.0.1` | Size at `v5.0.1` | Room under 100 MB | +|---|---|---|---|---| +| `app-arm64-v8a-release.apk` | 91700971 | 91944739 | 91.9 MB | 8.1 MB | +| `app-armeabi-v7a-release.apk` | 87580319 | 87795675 | 87.8 MB | 12.2 MB | +| `app-universal-release.apk` | 128855272 | 129303396 | 129.3 MB | over by 29.3 MB | + +What the module adds to each split, read from the APK's own entries: + +| Split | Pin | `libdashshielded.so` | Compressed in the APK | [JNA](#jna-java-native-access) `libjnidispatch.so` | Compressed in the APK | +|---|---|---|---|---|---| +| `arm64-v8a` | `v4.2.0-beta.7` | 15743776 | 8539456 | 165992 | 40195 | +| `arm64-v8a` | `v5.0.1` | 16192408 | 8772226 | 165992 | 40195 | +| `armeabi-v7a` | `v4.2.0-beta.7` | 12399948 | 7696734 | 116344 | 42075 | +| `armeabi-v7a` | `v5.0.1` | 12775124 | 7901089 | 116344 | 42075 | + +[UniFFI](#uniffi)'s Kotlin bindings call the library through JNA. The app therefore also gains JNA's native library and its classes. The module costs each split about 8 to 9 MB. The move to `v5.0.1` added 232770 compressed bytes to the `arm64-v8a` library, and that split keeps 8.1 MB of room for everything else Edge adds before it reaches the cap. + +### 5.6 Unshield, withdrawal and repeated spends + +Each row below is one spend from a store opened new and synced to tip. Wallet tree size and Platform's notes count were read just before the attempt. The readings come from scratch builds that add a diagnostics call, which the PR does not carry. + +With the two overlapping first passes ([4.7](#47-sync-passes-anchors-and-spends)), the wallet's tree is twice Platform's: + +| Pin | Spend | Wallet tree size | Platform notes | Outcome | +|---|---|---|---|---| +| `v4.1.1` | withdraw 1000000000 | 9506 | 4753 | accepted, `97eab26b898f5e25e04969cbd0e2b04ef07b483ca9eedb1a53b57ae118d74e75`; the call returned the unconfirmed-result error | +| `v4.1.1` | unshield 500000000 | 9506 | 4755 | `no recorded anchor covers the selected notes` | +| `v4.2.0-beta.7` | withdraw 1000000000 | 9530 | 4765 | accepted, `17801e42b676d1534ca122cdd10a32e5b7be9cf71fd03fa4982e1737b52d9241`; the call returned the unconfirmed-result error | +| `v4.2.0-beta.7` | unshield 500000000 | 9530 | 4767 | accepted, `e5c5204a2f7a064572aef763da610c87cdf735eec70e198334e4729e26305626` | +| `v4.2.0-beta.7` | unshield 500000000 | 9530 | 4769 | `no recorded anchor covers the selected notes` | + +In every row the wallet's depth-0 root was not one Platform had recorded. The spends that landed used the depth-1 checkpoint, taken after one pass had appended and before the other did, whose root Platform still recognized. The doubled tree is larger than Platform's count. Later passes fetch nothing and the size never moves: the tree stops gaining commitments, the wallet's own change notes among them. This is the sequence the earlier testnet drives hit, with one transfer accepted and every spend after it failing. An earlier version of this document placed the cause upstream; see item 7 of [10.2](#102-where-this-document-was-wrong-or-silent). + +With the immediate pass routed through the sync manager, the wallet's size equals Platform's notes count and the wallet's depth-0 root equals Platform's most recent [anchor](#anchor) before every spend. Roots are shown by their first 16 hex digits. + +| Pin | Spend | Tree size and notes | Root and anchor | Outcome | +|---|---|---|---|---| +| `v4.1.1` | withdraw 1000000000 | 4755 | `a62723dc6fc9fedc` | accepted, `d58c71461c5abceec044b6c207e62e8b8ca5509d818c99cb91e566f77fba1f67`; unconfirmed-result error | +| `v4.1.1` | unshield 500000000 | 4757 | `a09821168cdc6efd` | accepted, `715c69f1bd982347b09038948f21495678b6a791ce2c33e211792fd81ed47b7a` | +| `v4.1.1` | transfer 300000000 | 4759 | `d431079716570cc9` | accepted, `0b0ddc433f70f9b3fbc458984b2081f4e2bdb9c85c33c055669ea964179396c6` | +| `v4.1.1` | unshield 500000000 | 4761 | `3534052d644fce87` | accepted, `dcf263e970be7720ad9a7fdf5e5aea5df155c693430e3c364cada377f1a3b3cf` | +| `v4.1.1` | withdraw 1000000000 | 4763 | `236730b25e7470db` | accepted, `8d08a327db193fee2e3fbd7b6320b667dd4ef4193c98e4191ea4955e8d63c34f`; unconfirmed-result error | +| `v4.2.0-beta.7`, withdrawals feature on | withdraw 1000000000 | 4769 | `ae78a13bcc7ff203` | accepted, `d41b6353b93e6e338d29b4656ce5b7b6f546c1b429a22d4698f974397dc66182`; returned the address in 3.5 s | +| `v4.2.0-beta.7`, withdrawals feature on | unshield 500000000 | 4771 | `932286347b45533b` | accepted, `5abb7a4425728b05b4ff7f80161cdfb9f8354ee5d82ad6c92d9f363bae1e0f4c` | + +The `v4.1.1` rows ran without the `withdrawals-contract` feature. Both withdrawals landed on chain while the call returned an error, the first naming the missing contract and the second a gRPC timeout. With the feature on, the withdrawal returns its destination. + +The PR build, on its own new store, in one process: + +| Spend | Outcome | Time | Pool balance after | +|---|---|---|---| +| withdraw 1000000000 to `yffmKKHNbN9Sm7anAJpRg8mW7EJiD2n3DR` | accepted, `9a862caf4a7f0d008946b5f003e55eeda0cf628d5cb9a5514706f89adb522dad` | 3278 ms | 13546009600 | +| unshield 500000000 to `tdash1krxraw6u2wczgp956t7mpn2pg05l2uzxk57hdvlx` | accepted, `4cc80a45c8e2945af5b5e8c6a7dd5b77efc9c485e66bfaf780da27930da094a3` | 3535 ms | 12877075600 | +| transfer 300000000, fee 114140000 | accepted, `b440f3ded5238f38f08765ae916771aee9478f914e9ba0126f4e586ff88bcc48` | 3625 ms | 12714224400 | + +The pool held 14821200800 credits before the first of these. The withdrawal arrived on L1: the wallet's Core balance rose from 79999109 to 80999109 duffs. + +### 5.7 In the Edge app: iOS simulator and Android emulator + +These runs were at `v4.2.0-beta.7`. `edge-react-gui` (`develop` at `982bc31ee`) was built with the module added as a `file:` dependency on the PR head, plus a local test script that runs at app start. Neither change is committed anywhere. The script warms the prover, opens a new store from the test wallet's phrase on testnet, checks the shielded address, syncs, and sends 300000000 [credits](#credits) to the wallet's own shielded address through `proposeTransfer` and `createTransfer`. + +| Host | Store open | Prover warm-up | First sync | Transfer | +|---|---|---|---|---| +| iOS 18.6 simulator, as booted | refused: `database ancestor …/CoreSimulator/Devices//data is group/other-writable (mode 0775) and not sticky` | 1709 ms | - | - | +| iOS 18.6 simulator, after `chmod go-w` on that directory | opened | 1435 ms | 77.7 s | accepted in 3514 ms, `19cd3c064df975805ccf13ea73f4ea19c2bbb47185d321e5514c87a7c10d82d2`; pool 12714224400 to 12551373200 | +| Android 16 emulator (`arm64-v8a`), as booted | refused: `database ancestor /data/user/0/co.edgesecure.app/files is group/other-writable (mode 0771) and not sticky` | 2466 ms | - | - | +| same, app `files` directory set to 0700 | refused: `database ancestor /data is group/other-writable (mode 0771) and not sticky` | - | - | - | +| same, `/data` set to 0751 by root | refused: `database ancestor /data is owned by uid 1000, neither the current user (10213) nor root` | - | - | - | +| same, `/data` owned by root | opened | 2217 ms | 78.8 s | accepted in 4241 ms, `84b80fc37506947347592384bd47a7f4b09436030c97142bf2685d0dce73efcf`, mined at height 613480; pool 12551373200 to 12388522000 | + +The three refused Android rows ran with the public [BIP-39](#bip-39) test vector, which holds nothing, and the funded wallet was opened only once the store could open. Each refusal is the upstream check in [4.3](#43-state-on-disk-and-wallet-open). With the check satisfied, the same build loads the library, proves and spends on both hosts. The check is the only thing found between the Android artifact and a working wallet. Satisfying it took root on a disposable emulator, which no app has on a phone. + +Both hosts run on the Mac's CPU. The warm-up and transfer times are not phone times. + +`proposeTransfer` returned `feeCredits` 114140000 on both hosts, and each mined transfer took 162851200 from the pool. The transfer in [5.6](#56-unshield-withdrawal-and-repeated-spends) shows the same pair of figures. The quote prices two [Orchard](#orchard) actions (`TRANSFER_ACTIONS`), and the network charged more than that for every transfer measured. + +### 5.8 In the Edge app: physical Android phones + +These runs were at `v5.0.1`, on two phones rented from a device cloud: a Google Pixel 10 and a Samsung Galaxy S26, both on Android 16. The `edge-react-gui` build is the one from [5.5](#55-native-artifacts-symbols-and-apk-size), the `arm64-v8a` release APK, installed new on each phone. Its local test script opens the store from the public [BIP-39](#bip-39) test vector on testnet, because the APK went to a third party's phones. The store-open runs below used it while it held nothing. The script warms the prover, opens the store as alias `androidprobe1`, reads the shielded address, starts sync and polls every 5 seconds until it sees `SYNCED`. It then calls `stop`, opens the same alias again, reads the address and calls `stop` a second time. The first pair of rows ran an earlier version of the script that ended after sync. The store lives under `/data/user/0/co.edgesecure.app/files`, the directory the emulator in [5.7](#57-in-the-edge-app-ios-simulator-and-android-emulator) refused at `v4.2.0-beta.7`. + +| Phone | Build | Prover warm-up | Store open | Sync | `stop` | Reopen | Address after reopen | Second `stop` | +|---|---|---|---|---|---|---|---|---| +| Pixel 10 | `v5.0.1` | 2955 ms | opened, 372 ms | `SYNCED` at 651790 | not called | not called | - | - | +| Galaxy S26 | `v5.0.1` | 1961 ms | opened, 320 ms | `SYNCED` at 651790 | not called | not called | - | - | +| Pixel 10 | `v5.0.1` | 2810 ms | opened, 247 ms | `SYNCED` at 651798 | `STOPPED`, 61 ms | refused in 139 ms: `a SqlitePersister is already open on …/androidprobe1/wallet.db in this process` | - | - | +| Galaxy S26 | `v5.0.1` | 2041 ms | opened, 264 ms | `SYNCED` at 651798 | `STOPPED`, 7 ms | refused in 38 ms, same error | - | - | +| Pixel 10 | `v5.0.1` with the stop fix | 2844 ms | opened, 249 ms | `SYNCED` at 651816 | `STOPPED`, 74 ms | opened, 313 ms | same address, 3 ms | `STOPPED`, 8 ms | +| Galaxy S26 | `v5.0.1` with the stop fix | 1810 ms | opened, 211 ms | `SYNCED` at 651816 | `STOPPED`, 22 ms | opened, 109 ms | same address, 1 ms | `STOPPED`, 3 ms | + +Every run derived `tdash1zq7l6p3htfnsxcn9m7d9850c9f25kylnj2zs5ycdvlplj3e3jkqtx8waadmrgtvm06yv0yc37mqwh` and reported 0 credits. Each phone reached `SYNCED` by its second poll, within 9 seconds of the start of sync; the test wallet has no notes to scan. + +The store opened on both phones with no change to any directory, which is what [dashpay/platform#5352](https://github.com/dashpay/platform/pull/5352) set out to do ([4.3](#43-state-on-disk-and-wallet-open)). The middle pair of rows found a second fault: `stop` returned `STOPPED` while the store stayed open. The alias could not be opened again until the app restarted. The last pair ran with the fix described in [4.3](#43-state-on-disk-and-wallet-open) and [Decision 13](#decision-13-stop-proves-the-wallet-store-is-closed). + +A spend run followed at `8ccc97c`. The Node host sent 2000000000 credits from the funded testnet wallet to the test vector's shielded address (transfer `37c9c516dfc3c2a621634f84e78603bd4a3167a55d8e427c41367ae45260adc5`, quote 114140000). A new APK then ran on a Pixel 10, Android 16, as alias `androidspend1`: sync, a transfer of 300000000 credits back to the funded wallet, an `unshield` of 300000000 credits to the test vector's own Platform address once the change note was mined, then `stop`, reopen and `stop`. The APK still carried only the test vector. + +| Step | Time | Result | +|---|---|---| +| Prover warm-up | 2611 ms | ready | +| Store open | 343 ms | opened | +| Sync | 22159 ms to `SYNCED` | 2000000000 credits at height 651835 | +| `proposeTransfer` 300000000 | 10 ms | quote 114140000 | +| `createTransfer` | 5418 ms | accepted, `c2b96646c78917716220e027e315d573689252f7d0bce7506018d130a9ebe88b` | +| Change note spendable | about 40 s | 1585860000 credits at height 651836 | +| `unshield` 300000000 | 5105 ms | accepted | +| `stop`, reopen, address, second `stop` | 61, 358, 4, 8 ms | `STOPPED`, opened, same address, `STOPPED` | + +`unshield` returns the destination address, not a transaction id ([wallet.rs](../../rust/src/wallet.rs)). The balances show the outcome. A fresh host sync of both wallets afterwards read 10460242000 credits on the funded wallet, 300000000 more than after its send, and 1165637200 on the test vector. That is 1585860000 less the 300000000 unshielded and a 120222800 fee. + +A funding run followed at the same code. The Node host withdrew 4000000000 credits from the funded wallet to the test vector's first Core address, `yNUZE4nJW14BzL4hHCA61jz5VP7oew91XR`. The L1 transaction `1123be375c47b883d88c074bca37477e985c191a32056fd027a6f27d50aba04c` paid it 3999810 duffs. Two more APKs, still carrying only the test vector, then ran on a Pixel 10, Android 16, as new aliases `androidfund1` and `androidfund2`. Each one synced Platform and Core, withdrew 500000000 credits to its own Core address, waited for a confirmed Core balance, shielded from L1, listed its asset locks, resumed the lock its own shield had just consumed, waited for the credits and called `stop`. + +| Step | `androidfund1` | `androidfund2` | +|---|---|---| +| Core address | `yNUZE4n…` | `yNUZE4n…` | +| Sync | `SYNCED` in 22706 ms at 651850, 1165637200 credits | `SYNCED` in 27015 ms at 651854, 2275017200 credits | +| `shieldedWithdraw` 500000000 | accepted, 5578 ms | accepted, 5488 ms | +| Confirmed Core balance | 3999810 duffs at 1581284 | 2499357 duffs at 1581285 | +| `shieldFromAssetLock` | 2000000 duffs, 5964 ms, lock `b82bb07222c58c67e7d67d8361cc4e6ee63c509167476e766b5f69a44894682b:0` | 1000000 duffs, 5633 ms, lock `c32594324e4a805fa3045d04d3360a8924a5434f15ac415c48ce6a71999ab90f:0` | +| `trackedAssetLocks` | its own lock, `consumed` | its own lock, `consumed`; `b82bb072…:0` as `recovered_from_chain` | +| Resume of its own lock | refused: `cannot be reused; Platform completion is unconfirmed` | refused, same text | +| Credits after the shield | not reached | 2384397200 at 651857 | +| `stop` | not reached | `STOPPED`, 96 ms | + +The refusal is upstream's `AssetLockAlreadyConsumed`, the error [5.4](#54-seed-gate-lock-listing-and-resume) recorded at `v4.1.1` as `has already been consumed`; `v5.0.1` reworded it. The first script matched only the old wording, marked the run failed at the resume and stopped there. The second matched both. + +The chain shows both exits. `androidfund1`'s withdrawal reached L1 as asset-unlock transaction `21b1fc6965a236cc3ee8574133f02b7951eb26a56f7fb9ac3d580bf4613da52a`, paying 499810 duffs to `yNUZE4n…`, and was confirmed before `androidfund2` started. Its lock transaction `b82bb072…` locked 2000000 duffs and returned 1999547 in change. The shielded balance moved by the same 390620000 credits of fees in each run, across one withdrawal and one shield: 1165637200 to 2275017200 with a 2000000-duff shield, then 2275017200 to 2384397200 with a 1000000-duff one. + +`androidfund2` opened a new store, and the listing rebuilt `androidfund1`'s spent lock as `recovered_from_chain`, the case [4.5](#45-funding-from-l1) describes. Neither script resumed that lock. + +### 5.9 Not run + +- A resume at `v5.0.1` of a lock that is stranded, or of a spent lock rebuilt as `recovered_from_chain`. The phone resumed only locks its own shield had consumed ([5.8](#58-in-the-edge-app-physical-android-phones)). +- Shield and resume from the Node host at `v5.0.1`. The host ran a transfer and a withdrawal at this pin. +- A spend or a shield on the Galaxy S26. Its store-open runs passed, and the spends and shields ran on the Pixel 10 only. +- Any call on an iOS device. +- The `armeabi-v7a` library and the `ios-arm64` device slice. Both were packaged and symbol-checked, and nothing loaded them. +- The symbol diff in [5.5](#55-native-artifacts-symbols-and-apk-size), repeated at `v5.0.1`. +- Any mainnet call that moves funds. +- `v4.1.1` with the `withdrawals-contract` feature on. Two `v4.1.1` withdrawals returned a gRPC timeout in place of the missing-contract text, and whether the feature clears that variant on the old tag is unmeasured. + +## 6. Phase history + +### 6.1 Base module + +The first version, on `paul/dashShielded`, ships the crate with both backends, key and address derivation, shielded sync with `poll`, `proposeTransfer` and `createTransfer`, the React Native bridges, and the three build scripts. A second commit adds opt-in diagnostics behind `DASH_SHIELDED_DEBUG`. + +It had no way to put value in the pool, and its install step failed. Nothing downstream of `npm install` had run. + +### 6.2 Install fix, funding, exits and artifacts + +Commits are named by subject, since their hashes change whenever the branch is rewritten. + +| Commit | Shipped | Diverged from the first sketch | +|---|---|---| +| `Fix dependency install and lint config` | Lint toolchain moved to typescript-eslint 5 on eslint 8, `standard-kit` 0.15.1, TypeScript 5.0.4, with a lint-only tsconfig. The old pins could not resolve: plugin 2.34.0 needs parser 2 on eslint 5 or 6, and the manifest pinned parser 3 on eslint 7 | Moving the parser alone did not resolve in either direction | +| `Cover the prover warm-up in the smoke test` | Smoke test warms the prover and asserts readiness | - | +| `Fund the shielded pool from L1` | `coreReceiveAddress`, `startCoreSync`, `coreBalance`, `shieldFromAssetLock`, `SeedSigner`, `scripts/fund-testnet.ts` | The plan was to fund from a faucet in a browser. The module had no [L1](#l1) address to pay, so funding became an API | +| `Reach testnet DAPI on the right port` | Port from the network, `stop` awaits quiesce, `protoc` documented | Found only because the first shield timed out after its lock was broadcast | +| `Add the shielded pool exit and resume paths` | `resumeShieldFromAssetLock`, `trackedAssetLocks`, `unshield`, `platformReceiveAddress`, `shieldedWithdraw`; the resident `mnemonic` field removed; discovered nodes pinned to `https`; load before create | The port commit derived the scheme from the caller's port for every node. This commit narrows that to the fallback host | +| `Expose the full surface to React Native` | [UDL](#udl-uniffi-definition-language), generated Swift and Kotlin, and both bridges cover the full surface | The [UniFFI](#uniffi) side had been left at 14 functions while [N-API](#n-api) grew | +| `Reach the new native calls from TypeScript` | `src/react-native.ts` and the types reach the new calls | - | +| `Sign the macOS prebuild after copying it` | Ad hoc signing of the copied macOS addon | - | +| `Build both Android ABIs, not just arm64` | Android script builds `armeabi-v7a` as well as `arm64-v8a`, and `android/build.gradle` packages both | The first Android build was arm64 only, and the Gradle filter was still arm64 only after the script built both | + +The first shield attempt, before the port fix, broadcast a lock and then failed on the port. Its 0.1 tDASH stayed locked at `c12094b34f3ecb86d3670ddcb1a0d6b00a6b711838e5ebc5e25d66f53eef52f8:0` through this phase: on `v4.1.1` the process that built a lock was the only one that could list it, and that process had exited. + +At the end of this phase a transfer had been accepted once, every spend after it failed with the [anchor](#anchor) error, and no unshield or withdrawal had landed. The phase's record placed the cause upstream of the module. + +### 6.3 Sync routing, withdrawal confirmation and the 4.2 pin + +The anchor failures were this module's doing. `startSync` started the upstream loop and also called the coordinator's `sync` directly, the two first passes overlapped, and the tree doubled ([4.7](#47-sync-passes-anchors-and-spends), [5.6](#56-unshield-withdrawal-and-repeated-spends)). The same tests ran on `v4.1.1` and on `v4.2.0-beta.7`, and the failure and its fix are the same on both. + +| Commit | Shipped | Diverged from the plan | +|---|---|---| +| `Fix shielded sync racing its own first pass` | The immediate pass goes through `ShieldedSyncManager::sync_now` and waits out a pass in flight | The plan was to report an anchor defect to `dashpay/platform`. A new store on the unchanged pin showed a tree of exactly twice Platform's size, which pointed at the module's own two passes | +| `Add the shielded pool exit and resume paths` (amended) | The context provider's `withdrawals-contract` feature | Withdrawals had been landing on chain all along. The error came from proof verification afterwards, which the earlier anchor failures had hidden | +| `Bump dashpay/platform to v4.2.0-beta.7` | The 4.2 pins, Rust 1.98.1, and the `recovered_from_chain` status | The bump was expected to need source changes for API moves and compiled with none. It was tried as a fix for the anchor failures and fixed resume after a restart, the one gap `v4.1.1` could not close | + +The stranded lock from [6.2](#62-install-fix-funding-exits-and-artifacts) was resumed on the new pin by a later process, and its value is in the pool ([5.4](#54-seed-gate-lock-listing-and-resume)). + +The app runs in [5.7](#57-in-the-edge-app-ios-simulator-and-android-emulator) came after these commits and changed no code. They replaced a projected split APK size with a measured one, and they found that the new pin refuses the wallet store on Android ([4.3](#43-state-on-disk-and-wallet-open)). The Node-host tests could not show that, because the host's store directories pass the check. + +### 6.4 The `v5.0.1` pin and a stop that closes the store + +Dash changed the parent-directory check to trust Android's platform and per-app identities ([dashpay/platform#5352](https://github.com/dashpay/platform/pull/5352)) and released it in `v5.0.0`. The pin moved to `v5.0.1`, the newest release. + +| Commit | Shipped | Diverged from the plan | +|---|---|---| +| `Bump dashpay/platform to v5.0.1` | The `v5.0.1` pins with `rust-dashcore` `d631aaca`, and `stop` taking its verdict from `shutdown`'s `ShutdownReport` | The bump was expected to compile unchanged, as the 4.2 bump had. `quiesce` and `shutdown` now return results the caller must read. A separate `quiesce` before `shutdown` timed out on a sync pass that `shutdown`'s own drain then finished cleanly, so the module reads only the report | +| `Release the wallet store when a wallet stops` | `remove_wallet` for each wallet before the manager drops, a weak reference to the store in the slot, and a reopen in the smoke test | The plan was to open the store on a phone and sync. The phones did that, then failed to reopen the alias they had just stopped, with `a SqlitePersister is already open`. The host smoke test had never reopened an alias, which is why no earlier run caught it | + +The Android store refusal recorded in [6.3](#63-sync-routing-withdrawal-confirmation-and-the-42-pin) is closed by the pin. No source change in the module was needed for it. + +### 6.5 Deferred work + +| Item | Disposition | Reason | +|---|---|---| +| Wallet store on an iOS device | Check at the first device build | The simulator's refusal came from a directory on the Mac. A device's container path has not been walked | +| A first run of `armeabi-v7a` and `ios-arm64` | First funded device build of the app integration | Both phones load `arm64-v8a`. The Pixel 10 proved every spend and shield in [5.8](#58-in-the-edge-app-physical-android-phones) within 5.0 to 6.0 seconds per call, network included | +| `proposeTransfer` quotes less than the network charges | Fix before a host shows the fee to a user | Quoted 114140000 and charged 162851200 on three transfers ([5.7](#57-in-the-edge-app-ios-simulator-and-android-emulator)). The quote prices two actions | +| Dropping the persister wrapper for the storage crate's `shielded` feature | Try at the next change to the pins | The stock persister still attests the capability under that feature at `v5.0.1` ([Decision 7](#decision-7-attest-the-viewing-key-capability-in-a-wrapper)). The `v5.0.1` bump kept the wrapper, and no build with the feature on has run | +| Spent locks that keep reading `recovered_from_chain` | Held. Nothing has been sent to Dash | A reopened wallet cannot tell a spent lock from a stranded one, and resuming a spent one returns a persistence-capability error ([4.5](#45-funding-from-l1)). Seen at `v4.2.0-beta.7`. At `v5.0.1` a new store still listed a lock spent through another store as `recovered_from_chain` ([5.8](#58-in-the-edge-app-physical-android-phones)), and its resume was not tried. Clearing it needs upstream to attest `WALLET_RESTORE` or to record consumption another way | +| Upstream's pass reads the tree size before it takes the write lock | Held. Nothing has been sent to Dash | The module no longer overlaps passes, so it is not exposed. Any other caller that mixes the coordinator's `sync` with the manager's loop is | +| Seed zeroization | Security review before any Edge wiring | The mnemonic crosses the binding boundary as a string and the derived seed is not wiped after use | + +## 7. Decisions + +### Decision 1: Native Rust module over a WASM prover + +Chosen: compile `rs-platform-wallet` natively and bind it to each host. + +Evidence: a shield proof measured 523 to 576 ms native and 11973 to 12030 ms in [WASM](#wasm-webassembly) on the same Apple Silicon host. `rs-platform-wallet` at the pinned tag carries the prover, note selection, the store and all shielded transitions. + +Rejected: + +- WASM in the plugin WebView. No app-architecture change, but about 22 times slower before any phone is involved, and it depends on dev-tagged community packages holding spend keys. +- `react-native-node-api` with the community package's prebuilt binaries. It registers a C++ TurboModule, which needs React Native's New Architecture, and `edge-react-gui` runs with `newArchEnabled=false`. Its shipped slices were also iOS simulator only and Android arm64 only. + +A measured on-device WASM proof under two seconds would reopen this. + +### Decision 2: https for every discovered node + +Chosen: nodes from the quorum service are always dialed over `https`. Only the caller's own fallback host gets a scheme inferred from its port. + +Evidence: the port is caller-controlled. With the scheme inferred from it, a caller passing a non-standard port on mainnet or testnet would send every gRPC request in cleartext, and a shielded wallet's request stream is the metadata the pool hides. + +Rejected: + +- Scheme from the port for all nodes, as the commit `Reach testnet DAPI on the right port` first did. It is the failure described above. +- `https` for the fallback host too. A local `dashmate` deployment has no TLS, and it is the only way to test without testnet funds. + +A public network that serves Platform gRPC without TLS would reopen this. + +### Decision 3: Port from the network when the caller passes 0 + +Chosen: 443 on mainnet and 1443 otherwise, unless the caller passes a non-zero port. + +Evidence: measured against the live testnet quorum list, 0 of 30 enabled masternodes accepted a connection on 443 and 30 of 30 accepted on 1443. With 443 hard-coded, every testnet call timed out, and the first one to do so was a shield whose lock was already broadcast. + +Rejected: + +- Requiring the caller to pass the port. Every host would repeat the same table, and a wrong value fails late and expensively. +- Reading the port from the quorum service response. The response lists addresses without the Platform gRPC port. + +A network whose masternodes advertise differing Platform ports would reopen this. + +### Decision 4: Generate bindings from the module's own UDL + +Chosen: a [UDL](#udl-uniffi-definition-language) in this repo, with Swift and Kotlin generated by [UniFFI](#uniffi) and a separate [N-API](#n-api) backend. + +Evidence: the table in [2. Prior art](#2-prior-art). The Rust side compiles at an iOS 15.6 deployment target and for `armeabi-v7a`. The floors in Dash's SDKs come from their wrappers, not from the cryptography. + +Rejected: + +- Dash's `swift-sdk` and `kotlin-sdk`. Their OS floors and [ABI](#abi-application-binary-interface) policy exclude devices Edge supports, they have no Node target, and they bind the whole Platform surface. +- Linking Dash's C [FFI](#ffi-foreign-function-interface) crates from Objective-C++ and [JNI](#jni-java-native-interface) by hand. It avoids the wrappers' floors but means maintaining two hand-written bindings where the UDL generates both. + +Dash lowering its SDK floors to Edge's and shipping `armeabi-v7a` would reopen this for the mobile hosts; Node would still need the N-API backend. + +### Decision 5: The mnemonic is a per-call parameter + +Chosen: no resident mnemonic. Each fund-moving call takes it, derives what it needs and drops it. + +Evidence: the base module's `ClientSlot` had a `mnemonic` field that nothing read, since `createTransfer` already took the seed per call. Using that field for the new calls would have made an alias sufficient to move funds, and an alias is a short string that any code in the host can enumerate. + +Rejected: + +- Keeping the mnemonic in the slot. Fewer parameters, at the cost above. +- A session token returned by `initialize`. It narrows who can spend but leaves the seed resident for the life of the wallet. + +A host that keeps the wallet in a separate process, with no other code able to call it, would reopen this. + +### Decision 6: Load from the persister before creating + +Chosen: `initialize` calls `load_from_persistor` and reuses a restored wallet, falling back to creation from the seed. + +Evidence: at `v4.2.0-beta.7` the load restores the wallet with its Core balance, address pool and tracked asset locks, and a second process resumed a lock the first one never saw built ([5.4](#54-seed-gate-lock-listing-and-resume)). At `v4.1.1` the same call restored nothing and cost one query. The move between the two tags needed no change here because the call was already in place. + +Rejected: + +- Create only. Simpler, and it is what `v4.1.1` amounted to: a new process listed no locks and could not resume one. +- Reading the `asset_locks` table directly. It couples the module to a private schema, and the rows alone are not enough: resume needs the lock re-registered in the manager's state. + +A restored wallet that differs from a seed-created one in a way a host cannot absorb, such as a different wallet id or shielded address, would reopen this. The two differences seen so far, the next unused Core address and the `recovered_from_chain` status, are documented in [4.3](#43-state-on-disk-and-wallet-open) and [4.5](#45-funding-from-l1). + +### Decision 7: Attest the viewing-key capability in a wrapper + +Chosen: `ShieldedCapablePersister` wraps `SqlitePersister` and adds `SHIELDED_VIEWING_KEYS` to its capabilities. + +Evidence: `bind_shielded` refuses a persister without the capability. The capability exists so a wallet can rebind its viewing keys on restart without the seed. This module never does that: `initialize` always has the mnemonic and re-derives on every open, and notes persist in the coordinator's own store. At `v5.0.1`, as at `v4.2.0-beta.7`, the stock persister attests the capability only when `platform-wallet-storage` is built with its `shielded` feature, which this crate leaves off. + +Rejected: + +- Implementing real viewing-key rows. It is the only correct basis for a seedless reopen, which is a non-goal. +- Patching `platform-wallet-storage`. A fork to maintain against a moving upstream. + +A requirement to reopen a wallet without the mnemonic would reopen this, and the wrapper would have to be replaced by real persistence first. A build showing that the storage crate's `shielded` feature gives the same behavior with no wrapper would also reopen it ([6.5 Deferred work](#65-deferred-work)). + +### Decision 8: Size-optimized release profile with unwinding panics + +Chosen: `opt-level = "z"`, fat link-time optimization, one codegen unit, stripped symbols, and the default unwinding panic strategy. + +Evidence: with the default release profile the iOS app link failed with `B/BL out of range`. ARM64 direct branches reach 128 MB in either direction, the app's combined text segment passed that, and the linker cannot insert branch islands inside the pre-linked Monero library. + +Rejected: + +- `panic = "abort"`, which shrinks the binary further. Both backends convert a Rust panic into a host error, and an abort would end the app. +- The default profile with the other native modules rebuilt smaller. It moves the problem into repos this module does not own. + +A measured proving-time regression from `opt-level = "z"` on a phone would reopen this. + +### Decision 9: Static symbol diff for the slices no test host loads + +Chosen: verify each mobile artifact by diffing the symbols its bindings load against the symbols it exports, run the two slices a Mac can host (`ios-arm64-simulator` and `arm64-v8a`) inside the Edge app, and state that nothing has run on a physical device. + +Evidence: the repo has no example app. Linking the module into a local `edge-react-gui` build, uncommitted, loaded both hosted slices and mined a transfer from each ([5.7](#57-in-the-edge-app-ios-simulator-and-android-emulator)). `ios-arm64` needs an iOS device, and only the 64-bit split was installed on the emulator. + +Rejected: + +- Building an example app in this repo. It would prove linking and proving, at the cost of a second React Native project to maintain. +- Claiming device support from a successful cross-compile. A compile does not show that the bindings find their symbols, and the app runs showed it does not show that the wallet store opens either. + +The first device build of the app integration replaces the symbol diff for the two remaining slices, and would reopen the question of an in-repo example app only if that integration stalls. + +### Decision 10: Discover nodes from the quorum service + +Chosen: fetch the live masternode list from the network's quorum service at `initialize`. + +Evidence: the service returns the enabled set at call time, which is how the port finding in [Decision 3](#decision-3-port-from-the-network-when-the-caller-passes-0) was measured. + +Rejected: + +- The list compiled into `dash-network-seeds`. It needs no HTTP call at open, but it is fixed at the pinned rev and a wallet built months earlier dials whatever was live then. +- A caller-supplied list only. It moves discovery into every host. + +The quorum service becoming unavailable, or Edge wanting to avoid a Dash-operated HTTP dependency at wallet open, would reopen this. + +### Decision 11: Pin the released v5.0.1 + +Chosen: `dashpay/platform` tag `v5.0.1`, with the `rust-dashcore` rev and Rust toolchain that tag requires. + +Evidence: each earlier pin had a gap the other lacked, and `v5.0.1` has neither. + +| | `v4.1.1` | `v4.2.0-beta.7` | `v5.0.1` | +|---|---|---|---| +| Resume a stranded [asset lock](#asset-lock) after a restart | no | yes ([5.4](#54-seed-gate-lock-listing-and-resume)) | refuses a consumed lock on a phone ([5.8](#58-in-the-edge-app-physical-android-phones)); a stranded lock not run | +| Wallet store opens on Android | not run | no ([5.7](#57-in-the-edge-app-ios-simulator-and-android-emulator)) | yes, on two phones ([5.8](#58-in-the-edge-app-physical-android-phones)) | +| Spends, with the sync fix | yes | yes ([5.6](#56-unshield-withdrawal-and-repeated-spends)) | yes, on a phone ([5.8](#58-in-the-edge-app-physical-android-phones)) | +| Release status | released | beta | released | + +The move from `v4.2.0-beta.7` needed one source change: `stop` reads the results that `quiesce` and `shutdown` now return ([4.3](#43-state-on-disk-and-wallet-open)). The host build and the smoke test pass at this pin. + +Rejected: + +- Staying on `v4.2.0-beta.7`. No wallet opens on Android at that tag, and closing that took a patched storage crate. +- Returning to `v4.1.1`. A shield interrupted between its two halves would leave value that no later process can recover. +- `v5.0.0`, the first release with the Android fix. `v5.0.1` is the newest release and carries the same fix. +- A `[patch]` entry for `platform-wallet-storage`. Upstream shipped the change, which leaves a fork nothing to do. + +A spend that fails at this pin and passed at `v4.2.0-beta.7` would reopen this. A transfer and an unshield have passed at `v5.0.1` ([5.8](#58-in-the-edge-app-physical-android-phones)); shield, withdrawal and resume have not ([5.9](#59-not-run)). + +### Decision 12: Run the immediate sync pass through the sync manager + +Chosen: `startSync` starts the upstream loop, then calls `ShieldedSyncManager::sync_now(true)` and retries every 250 ms while the answer is an empty summary and the loop is still running. + +Evidence: with the immediate pass sent to the coordinator's `sync`, a new store ended its first sync with a tree of 9506 commitments against Platform's 4753, and of 9530 against 4765 on the newer pin. With it sent through the manager, tree size and depth-0 root matched Platform before each of seven spends across both pins ([5.6](#56-unshield-withdrawal-and-repeated-spends)). + +Rejected: + +- The coordinator's `sync` called directly. It bypasses the in-flight flag, and it is the cause of the doubled tree. +- No immediate pass, with the loop's first pass doing the work. The loop calls with `force = false` and hands its summary to nobody the module can read. `poll` would have no scan count or terminal status until the module found another source for them. +- A mutex in the module around its own pass. The loop's passes run inside upstream and would not take it. + +Upstream reading the tree size under the same lock it appends with would make overlapping passes harmless and reopen the simpler direct call. + +### Decision 13: `stop` proves the wallet store is closed + +Chosen: `stop` removes each wallet from the manager before dropping it, takes its verdict from `shutdown`'s `ShutdownReport`, and returns an error when a weak reference to the store can still be upgraded. + +Evidence: the storage crate refuses a second open of a path that is still claimed in the process ([4.3](#43-state-on-disk-and-wallet-open)). On both phones `stop` returned `STOPPED` and the next open of the same alias failed with `a SqlitePersister is already open` ([5.8](#58-in-the-edge-app-physical-android-phones)). On the host the store held 8 references after `shutdown`, 3 after `remove_wallet`, and 0 once the manager dropped. With the change the smoke test reopens its alias, and a script that opens, syncs and stops one alias reopened it three times out of three. + +`shutdown` drains the sync passes within a 10-second budget and records a timeout in its report. A `quiesce` call before it has the same budget. In one run a pass took longer than that, `quiesce` timed out, and `shutdown` then finished the same pass cleanly. Reading the report alone gives one verdict for one drain. + +Rejected: + +- Dropping the manager and trusting the result. It is what the module did, and it leaves the store open for the life of the process. +- A process restart between closing and reopening a wallet. A host cannot restart to switch accounts. +- `quiesce` and then `shutdown`, failing on either. It reports a failure for a pass that shut down cleanly. + +Upstream breaking the cycle between the manager and its wallets, or releasing the path claim when `shutdown` finishes, would make the `remove_wallet` loop unnecessary. The weak-reference check would still catch a regression. + +## 8. Glossary + +### Asset lock + +An L1 transaction that locks duffs so Platform can credit them. In this design it is the first half of a shield, and its outpoint is what a resume needs. See [DIP-27](https://github.com/dashpay/dips/blob/master/dip-0027.md). + +### InstantSend + +Dash's quorum-signed transaction lock, which makes an L1 transaction final in seconds. The shield waits for it, or for a ChainLock, before submitting the Platform transition. See [DIP-10](https://github.com/dashpay/dips/blob/master/dip-0010.md). + +### ChainLock + +A quorum signature over an L1 block that makes it final. It is the fallback proof for an asset lock that did not get an InstantSend lock. See [DIP-8](https://github.com/dashpay/dips/blob/master/dip-0008.md). + +### LLMQ (long-living masternode quorum) + +A group of masternodes that signs together. Quorums produce InstantSend locks and ChainLocks, and their public keys verify Platform's proofs. See [DIP-6](https://github.com/dashpay/dips/blob/master/dip-0006.md). + +### Orchard + +The shielded protocol from Zcash that Dash Platform's pool uses, through Dash's fork of the `orchard` crate. Notes, addresses and spend authority in this module are Orchard's. See the [Orchard book](https://zcash.github.io/orchard/) and [dashpay/orchard](https://github.com/dashpay/orchard). + +### Halo 2 + +The zero-knowledge proving system Orchard uses, with no trusted setup. Every shield and spend builds one proof, and the proving key is built once per process by `warmUpProver`. See the [Halo 2 book](https://zcash.github.io/halo2/). + +### Anchor + +A root of the note commitment tree at some point in time. A spend proves its notes exist under an anchor, and Platform accepts only anchors it recorded. See the [Zcash protocol specification](https://zips.z.cash/protocol/protocol.pdf). + +### Shielded pool + +The set of Orchard notes held on Dash Platform, whose amounts and owners are hidden. See [dashpay/platform](https://github.com/dashpay/platform). + +### Dash Platform + +Dash's second layer, a chain run by the masternodes that holds identities, data contracts and the shielded pool. See the [Platform documentation](https://docs.dash.org/projects/platform/en/stable/docs/explanations/dapi.html). + +### L1 + +The Dash Core chain, where transparent DASH lives. Value enters the pool from it and `shieldedWithdraw` returns value to it. See the [Dash feature overview](https://docs.dash.org/en/stable/docs/user/introduction/features.html). + +### DAPI (decentralized API) + +The gRPC interface every Platform masternode serves. The module sends transitions and reads proofs through it. See [DAPI](https://docs.dash.org/projects/platform/en/stable/docs/explanations/dapi.html). + +### SPV (simplified payment verification) + +Syncing a chain from headers and compact block filters, without full blocks. The module's L1 side uses the [dash-spv](https://github.com/dashpay/rust-dashcore/tree/e4208c90786a6854bd498315bcb571ef24182c15/dash-spv) client, with filters as in [BIP-157](https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki). + +### Duffs + +The smallest L1 unit, 1e-8 DASH. L1 amounts in the API are in duffs. See the [Dash feature overview](https://docs.dash.org/en/stable/docs/user/introduction/features.html). + +### Credits + +Platform's unit of account, 1000 per duff. Pool balances and fees in the API are in credits. See [Platform fees](https://docs.dash.org/projects/platform/en/stable/docs/explanations/fees.html). + +### UniFFI + +Mozilla's binding generator for Rust. It produces the Swift and Kotlin that call the library on iOS and Android. See the [UniFFI guide](https://mozilla.github.io/uniffi-rs/latest/). + +### UDL (UniFFI definition language) + +The interface file UniFFI reads. `rust/src/dash.udl` is the single definition of what the mobile hosts can call. See the [UniFFI guide](https://mozilla.github.io/uniffi-rs/latest/). + +### N-API + +Node's stable native-addon interface. The `napi-backend` feature builds the library as an addon Node loads with `require`. See [Node-API](https://nodejs.org/api/n-api.html). + +### FFI (foreign function interface) + +The C-level boundary between Rust and a host language. Both backends are FFI layers over `wallet.rs`. See the [UniFFI guide](https://mozilla.github.io/uniffi-rs/latest/). + +### ZIP-32 + +Zcash's hierarchical key derivation for shielded keys. The module derives the Orchard account keys under it. See [ZIP-32](https://zips.z.cash/zip-0032). + +### DIP-17 + +Dash's derivation scheme for transparent Platform payment addresses. `platformReceiveAddress` derives under it from public key material. See [DIP-17](https://github.com/dashpay/dips/blob/master/dip-0017.md) and the address encoding in [DIP-18](https://github.com/dashpay/dips/blob/master/dip-0018.md). + +### Bech32m + +A checksummed text encoding for addresses. Shielded addresses are Bech32m with the prefix `dash` or `tdash`. See [BIP-350](https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki). + +### BIP-39 + +The mnemonic phrase standard. The module accepts a phrase and derives the 64-byte seed with an empty passphrase. See [BIP-39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki). + +### BIP-44 + +The account path standard for transparent wallets. `coreReceiveAddress` returns the next unused external address of a BIP-44 account. See [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki). + +### xcframework + +Apple's bundle format for a library built for several platforms. The iOS artifact holds a device slice and a simulator slice. See [Creating a multiplatform binary framework bundle](https://developer.apple.com/documentation/xcode/creating-a-multi-platform-binary-framework-bundle). + +### ABI (application binary interface) + +On Android, the CPU and calling convention a native library is built for. The module ships `arm64-v8a` and `armeabi-v7a`. See [Android ABIs](https://developer.android.com/ndk/guides/abis). + +### NDK (native development kit) + +Android's toolchain for native code. The Android script drives it through [cargo-ndk](https://github.com/bbqsrc/cargo-ndk) and links for [16 KB pages](https://developer.android.com/guide/practices/page-sizes). + +### WASM (WebAssembly) + +A portable bytecode that browsers and WebViews run in a sandbox. Edge's currency plugins run in a WebView. A WASM prover was the route that needed no native code, and it is the one [Decision 1](#decision-1-native-rust-module-over-a-wasm-prover) measures and rejects. See [webassembly.org](https://webassembly.org/). + +### DPNS (Dash Platform Name Service) + +Platform's username registry, which maps a name to an identity. This module does not touch it. See the [DPNS explanation](https://docs.dash.org/projects/platform/en/stable/docs/explanations/dpns.html). + +### JNI (Java Native Interface) + +The JVM's interface for calling native code, and what Kotlin on Android uses to reach the Rust library. UniFFI generates the Kotlin side so the module has no hand-written JNI. See the [JNI specification](https://docs.oracle.com/en/java/javase/21/docs/specs/jni/index.html). + +### JNA (Java Native Access) + +A library that lets JVM code call native functions without hand-written JNI. UniFFI's generated Kotlin loads the Rust library through it. An Android app that links the module also ships JNA's own native library. See [JNA](https://github.com/java-native-access/jna). + +## 9. References + +- [EdgeApp/dash-shielded-native#1](https://github.com/EdgeApp/dash-shielded-native/pull/1), the implementation +- [rs-platform-wallet at v5.0.1](https://github.com/dashpay/platform/tree/v5.0.1/packages/rs-platform-wallet), the wallet library this module wraps +- [rs-platform-wallet-storage at v5.0.1](https://github.com/dashpay/platform/tree/v5.0.1/packages/rs-platform-wallet-storage), the SQLite persister +- [dashpay/platform#5352](https://github.com/dashpay/platform/pull/5352), the change that trusts Android's own directories in the storage crate's parent-directory check +- [swift-sdk](https://github.com/dashpay/platform/tree/v4.2.0-beta.7/packages/swift-sdk) and [kotlin-sdk](https://github.com/dashpay/platform/tree/v4.2.0-beta.7/packages/kotlin-sdk) at v4.2.0-beta.7, Dash's mobile SDKs +- [DIP-27](https://github.com/dashpay/dips/blob/master/dip-0027.md), asset locks +- [The Orchard book](https://zcash.github.io/orchard/) and [the Halo 2 book](https://zcash.github.io/halo2/) +- [react-native-zano](https://github.com/EdgeApp/react-native-zano) and [react-native-monero](https://github.com/EdgeApp/react-native-monero), the packaging pattern +- [Dash Platform documentation](https://docs.dash.org/projects/platform/en/stable/docs/explanations/dapi.html) + +## 10. Post-implementation retrospective + +### 10.1 Estimate vs. actuals + +| Item | Expected at the start | Actual | +|---|---|---| +| Integration route | The JavaScript SDK, then [WASM](#wasm-webassembly) in the plugin WebView | A native Rust module; the JavaScript SDK has no shielded builder and WASM proving is about 22 times slower | +| Funding a test wallet | A faucet payment from a browser | Four new API calls and a script, because the module exposed no [L1](#l1) address | +| Mobile bindings | Wrap Dash's Swift and Kotlin SDKs | Generated from the module's [UDL](#udl-uniffi-definition-language); Dash's SDKs exclude iOS 15.6, Android API 28 and `armeabi-v7a` | +| Pool exits | Working once exposed | Exposed on both hosts. Every spend after the first failed on testnet until the module's own overlapping sync passes were found and fixed, and withdrawal also needed a context-provider feature turned on | +| Resume | Working once exposed | Works inside one process on either tag, and across restarts only on the 4.2 beta | +| Platform pin | The released `v4.1.1` | `v4.2.0-beta.7` for wallet restore, which refused the wallet store on Android; then the released `v5.0.1`, which opens it | +| Native artifacts | Buildable from the existing scripts | Built after fixes for the pinned toolchain's targets, the second Android [ABI](#abi-application-binary-interface) and macOS signing. The split APKs measure 91.9 MB and 87.8 MB at `v5.0.1` against a 100 MB cap | + +### 10.2 Where this document was wrong or silent + +This document was written after the code. The items below are places the implementation and its own records disagree, found while writing it or by the tests that followed. + +1. [4.8 Native artifacts and build](#48-native-artifacts-and-build): the Android script built two ABIs while `android/build.gradle` packaged one (`abiFilters 'arm64-v8a'`). The filter now lists both. A release build packaged both, and only `arm64-v8a` has been loaded. +2. [4.2 Endpoint discovery](#42-endpoint-discovery): the fallback endpoint is built from the caller's raw `defaultPort`, not the resolved port. A caller that passes 0 and whose quorum lookup fails dials port 0 on the fallback host. +3. [4.4 API surface](#44-api-surface): the Node `Synchronizer` has `getBalance` and `getTransactions`, and the React Native one does not. +4. [4.3 State on disk and wallet open](#43-state-on-disk-and-wallet-open): the module's Gradle default `minSdkVersion` is 27 and the podspec declares iOS 13.0, while the artifacts are built for API 28 hosts and iOS 15.6. +5. [5.1 Host build and smoke test](#51-host-build-and-smoke-test): the comment on `warm_up_prover` says the proving key takes about 30 seconds to build. It measured 1.4 seconds on the Node host, 1.4 to 1.7 seconds on the iOS simulator and 2.2 to 2.5 seconds on the Android emulator, all on one Apple Silicon Mac, and is unmeasured on a phone. +6. The README still says the first version covers keys, addresses, sync stubs and transfer proposals, and that a live testnet send is not yet possible. Separately, `package.json` is at version `0.0.1` while the crate and the changelog are at `0.1.0`. +7. [4.7 Sync passes, anchors and spends](#47-sync-passes-anchors-and-spends) and [5.6](#56-unshield-withdrawal-and-repeated-spends): the first version of this document placed the anchor failures in upstream code and planned a report to `dashpay/platform`. The cause was `startSync` in this module running a second pass beside the loop's first. Transfer, unshield and withdrawal had each recorded the same error on testnet without anyone comparing the wallet's tree size to Platform's notes count, which is the one reading that shows the doubling. +8. [5.4](#54-seed-gate-lock-listing-and-resume): the first version said resume after a restart waited on upstream. Upstream had already shipped it on the 4.2 line, and the pin was the only thing in the way. +9. An earlier list of what held said the released `v4.1.1` tag carried everything the module needed. It lacks wallet restore ([Decision 11](#decision-11-pin-the-released-v501)). +10. [4.3 State on disk and wallet open](#43-state-on-disk-and-wallet-open): this document said nothing about the parent-directory check until the app runs. Every earlier test ran on the Node host, whose directories pass it, and the mobile libraries had only been symbol-checked. The check came in with the 4.2 pin and stopped the wallet from opening on Android until `v5.0.0`. +11. [5.5](#55-native-artifacts-symbols-and-apk-size): an earlier version gave split APK sizes projected from file listings, 91697803 and 87575707 bytes. The Gradle build came within 5 KB of both. +12. [4.4 API surface](#44-api-surface) says `proposeTransfer` returns a fee the caller can show. The fee it returned, 114140000 credits, is lower than the 162851200 the network took for each of three transfers ([5.7](#57-in-the-edge-app-ios-simulator-and-android-emulator)). +13. [4.3 State on disk and wallet open](#43-state-on-disk-and-wallet-open): this document described `stop` as closing the wallet. It shut the sync workers down and left the wallet store open, because the manager and its wallets hold references to each other. No test reopened an alias in the same process until the phones did ([5.8](#58-in-the-edge-app-physical-android-phones)). + +### 10.3 What held + +- Wrapping `rs-platform-wallet` directly. Every operation the module needed already existed upstream as one call, and the module added no cryptography of its own. +- One Rust file behind two shims. Bringing React Native to the same surface as Node took a UDL change and pass-through code, with no logic duplicated. +- A thin wrapper over upstream calls. The move from `v4.1.1` to `v4.2.0-beta.7` needed no source change in the module, and the move to `v5.0.1` needed one, in `stop`. +- Loading from the persister before creating. It did nothing on `v4.1.1` and made restore work on the new pin with no further change. +- The per-call seed. Adding five fund-moving calls did not add any resident secret. + +### 10.4 Verification highlights + +- Shield of 10000000 [duffs](#duffs) accepted in 4151 ms, and again in 4466 ms. +- Shielded transfers accepted in 4225 ms and 4132 ms: `fd960262bb68bed1ba1a49bdba394de1a0209ad2e0fc93210a894c22140e291e` and `4f7f10de7da3e818d4507e1ee63d5f84749803856e45997fa5dd17e39ddd329b`. +- From the PR build on a new store, in one process: withdrawal to L1 `9a862caf4a7f0d008946b5f003e55eeda0cf628d5cb9a5514706f89adb522dad` in 3278 ms, unshield `4cc80a45c8e2945af5b5e8c6a7dd5b77efc9c485e66bfaf780da27930da094a3` in 3535 ms, transfer `b440f3ded5238f38f08765ae916771aee9478f914e9ba0126f4e586ff88bcc48` in 3625 ms. +- Wallet tree size equal to Platform's notes count, and depth-0 root equal to Platform's most recent [anchor](#anchor), before each of seven spends on two pins. +- A second process resumed the [asset lock](#asset-lock) stranded since the first funding run, in 4.4 seconds. +- Prover warm-up of 1350 to 1464 ms on the host. +- From the Edge app on an iOS 18.6 simulator: warm-up 1435 ms, transfer `19cd3c064df975805ccf13ea73f4ea19c2bbb47185d321e5514c87a7c10d82d2` in 3514 ms. +- From the Edge app on an Android 16 emulator, after root satisfied the upstream directory check: warm-up 2217 ms, transfer `84b80fc37506947347592384bd47a7f4b09436030c97142bf2685d0dce73efcf` in 4241 ms. +- On the same emulator as booted, the wallet store was refused three ways, ending at `/data`, which no app can change. +- At `v5.0.1`, on a physical Pixel 10 and Galaxy S26 running Android 16: the store opened in the app's own `files` directory with no change to it, synced, stopped, and opened again in the same process (313 ms and 109 ms). +- Release split APKs with the module linked, at `v5.0.1`: 91944739 bytes for `arm64-v8a` and 87795675 for `armeabi-v7a`, against a 100 MB cap. +- 0 of 30 testnet masternodes on port 443, 30 of 30 on 1443. +- 103 of 103 binding symbols present in each Android library, 49 of 49 in each iOS slice. +- Evidence and logs are in [EdgeApp/dash-shielded-native#1](https://github.com/EdgeApp/dash-shielded-native/pull/1) and the linked Asana task. diff --git a/src/load-addon.ts b/src/load-addon.ts index a5dfeaf..d44672c 100644 --- a/src/load-addon.ts +++ b/src/load-addon.ts @@ -15,13 +15,48 @@ export interface NativeDashAddon { startSync: (alias: string) => Promise stopSync: (alias: string) => Promise deriveShieldedAddress: (alias: string) => Promise<{ shieldedAddress: string }> + coreReceiveAddress: (alias: string, account: number) => Promise + platformReceiveAddress: (alias: string, account: number) => Promise + startCoreSync: (alias: string, fromHeight: number) => Promise + coreBalance: (alias: string) => Promise<{ + confirmedDuffs: string + unconfirmedDuffs: string + totalDuffs: string + syncedHeight: number + }> + shieldFromAssetLock: ( + alias: string, + amountDuffs: string, + accountIndex: number, + mnemonicSeed: string + ) => Promise + trackedAssetLocks: ( + alias: string + ) => Promise> + resumeShieldFromAssetLock: ( + alias: string, + txid: string, + vout: number, + mnemonicSeed: string + ) => Promise + unshield: ( + alias: string, + toAddress: string, + amountCredits: string, + mnemonicSeed: string + ) => Promise + shieldedWithdraw: ( + alias: string, + toCoreAddress: string, + amountCredits: string, + coreFeePerByte: number, + mnemonicSeed: string + ) => Promise isValidAddress: (address: string, network: string) => boolean deriveViewingKey: (mnemonicSeed: string, network: string) => string warmUpProver: () => Promise isProverReady: () => boolean - poll: ( - alias: string - ) => Promise<{ + poll: (alias: string) => Promise<{ alias: string status: string scanProgress: number @@ -80,6 +115,9 @@ export function loadNativeAddon(): NativeDashAddon { missing.push(candidate) continue } + // The addon path is resolved at runtime from the platform triple, so this + // cannot be a static import. + // eslint-disable-next-line @typescript-eslint/no-var-requires const mod = require(candidate) as NativeDashAddon if (typeof mod.initialize !== 'function') continue cached = mod diff --git a/src/node.ts b/src/node.ts index 30dde25..cdd683b 100644 --- a/src/node.ts +++ b/src/node.ts @@ -3,6 +3,8 @@ import { mkdirSync } from 'fs' import { loadNativeAddon, NativeDashAddon } from './load-addon' import { Addresses, + AssetLock, + CoreBalance, CreateTransferOpts, InitializerConfig, Network, @@ -83,7 +85,7 @@ export class Synchronizer { async stop(): Promise { this.unsubscribe() - return this.addon.stop(this.alias) + return await this.addon.stop(this.alias) } async initialize(config: InitializerConfig): Promise { @@ -108,7 +110,126 @@ export class Synchronizer { } async deriveShieldedAddress(): Promise { - return this.addon.deriveShieldedAddress(this.alias) + return await this.addon.deriveShieldedAddress(this.alias) + } + + /** + * Next unused transparent (L1) receive address, for getting value into the + * wallet in the first place. The shielded pool is only reachable from L1, so + * a fresh wallet has to be funded here before any shielded operation works. + */ + async coreReceiveAddress(account: number = 0): Promise { + return await this.addon.coreReceiveAddress(this.alias, account) + } + + /** + * Next unused transparent Platform address, the counterpart to + * `coreReceiveAddress` one layer up. This is where `unshield` puts value that + * leaves the Orchard pool but stays on Platform. + */ + async platformReceiveAddress(account: number = 0): Promise { + return await this.addon.platformReceiveAddress(this.alias, account) + } + + /** + * Start the Core (L1) SPV sync. The Platform connection cannot see L1, so + * transparent balance stays at zero until this runs. `fromHeight` skips + * history older than the wallet. + */ + async startCoreSync(fromHeight: number): Promise { + await this.addon.startCoreSync(this.alias, fromHeight) + } + + async coreBalance(): Promise { + return await this.addon.coreBalance(this.alias) + } + + /** + * Move transparent balance into the shielded pool through an asset lock. + * + * Takes the seed per call rather than reusing the one `initialize` was given. + * An alias is not a secret, so a resident seed would make knowing the alias + * enough to move funds. + * Builds and broadcasts the L1 lock, waits for its InstantSend or ChainLock + * proof, then proves and broadcasts the shielding transition, so this takes + * seconds and needs a synced Core balance to spend. + */ + async shieldFromAssetLock( + amountDuffs: string, + mnemonicSeed: string, + accountIndex: number = 0 + ): Promise { + return await this.addon.shieldFromAssetLock( + this.alias, + amountDuffs, + accountIndex, + mnemonicSeed + ) + } + + /** + * The asset locks this wallet is tracking. A host that crashed mid-shield has + * no other way to learn the outpoint `resumeShieldFromAssetLock` needs, since + * the failing call returns an error rather than the lock it broadcast. + * + * The list survives a restart. Opening a wallet on a store that already + * holds its history rebuilds the locks from the wallet's chain records, each + * with the status `recovered_from_chain`. A lock this store saw consumed is + * left out of that rebuild. + */ + async trackedAssetLocks(): Promise { + return await this.addon.trackedAssetLocks(this.alias) + } + + /** + * Finish a shield whose L1 asset lock is already on chain. A failure between + * broadcasting the lock and proving the transition strands the locked value, + * and only resuming that outpoint recovers it; building a fresh lock cannot. + */ + async resumeShieldFromAssetLock( + txid: string, + vout: number, + mnemonicSeed: string + ): Promise { + return await this.addon.resumeShieldFromAssetLock( + this.alias, + txid, + vout, + mnemonicSeed + ) + } + + /** Move shielded value out to a transparent Platform address. */ + async unshield( + toAddress: string, + amountCredits: string, + mnemonicSeed: string + ): Promise { + return await this.addon.unshield( + this.alias, + toAddress, + amountCredits, + mnemonicSeed + ) + } + + /** + * Move shielded value out to a Core L1 address. `coreFeePerByte` prices the + * L1 transaction the network builds on the far side, in duffs per byte. + */ + async shieldedWithdraw( + toCoreAddress: string, + amountCredits: string, + mnemonicSeed: string, + coreFeePerByte: number = 1 + ): Promise { + return await this.addon.shieldedWithdraw( + this.alias, + toCoreAddress, + amountCredits, + coreFeePerByte, + mnemonicSeed + ) } async getBalance(): Promise<{ @@ -235,9 +356,7 @@ export const makeSynchronizer = async ( return synchronizer } -export function makeNodeDashShieldedModule( - opts: MakeNodeDashShieldedOpts -): { +export function makeNodeDashShieldedModule(opts: MakeNodeDashShieldedOpts): { Tools: typeof Tools makeSynchronizer: typeof makeSynchronizer } { diff --git a/src/react-native.ts b/src/react-native.ts index e458e39..65ea64b 100644 --- a/src/react-native.ts +++ b/src/react-native.ts @@ -6,6 +6,8 @@ import { import { Addresses, + AssetLock, + CoreBalance, CreateTransferOpts, InitializerConfig, Network, @@ -110,6 +112,80 @@ export class Synchronizer { return RNDashShielded.deriveShieldedAddress(this.alias) } + async coreReceiveAddress(account: number = 0): Promise { + return RNDashShielded.coreReceiveAddress(this.alias, account) + } + + async startCoreSync(fromHeight: number): Promise { + await RNDashShielded.startCoreSync(this.alias, fromHeight) + } + + async coreBalance(): Promise { + return RNDashShielded.coreBalance(this.alias) + } + + async shieldFromAssetLock( + amountDuffs: string, + mnemonicSeed: string, + accountIndex: number = 0 + ): Promise { + return RNDashShielded.shieldFromAssetLock( + this.alias, + amountDuffs, + accountIndex, + mnemonicSeed + ) + } + + async platformReceiveAddress(account: number = 0): Promise { + return RNDashShielded.platformReceiveAddress(this.alias, account) + } + + async trackedAssetLocks(): Promise { + return RNDashShielded.trackedAssetLocks(this.alias) + } + + async resumeShieldFromAssetLock( + txid: string, + vout: number, + mnemonicSeed: string + ): Promise { + return RNDashShielded.resumeShieldFromAssetLock( + this.alias, + txid, + vout, + mnemonicSeed + ) + } + + async unshield( + toAddress: string, + amountCredits: string, + mnemonicSeed: string + ): Promise { + return RNDashShielded.unshield( + this.alias, + toAddress, + amountCredits, + mnemonicSeed + ) + } + + async shieldedWithdraw( + toCoreAddress: string, + amountCredits: string, + mnemonicSeed: string, + coreFeePerByte: number = 1 + ): Promise { + return RNDashShielded.shieldedWithdraw( + this.alias, + toCoreAddress, + amountCredits, + coreFeePerByte, + mnemonicSeed + ) + } + async proposeTransfer(opts: ProposeTransferOpts): Promise { const result = await RNDashShielded.proposeTransfer( this.alias, diff --git a/src/types.ts b/src/types.ts index 4f31775..86df9af 100644 --- a/src/types.ts +++ b/src/types.ts @@ -76,13 +76,39 @@ export interface ErrorEvent { } export interface SynchronizerCallbacks { - onBalanceChanged(balance: BalanceEvent): void - onStatusChanged(status: StatusEvent): void - onTransactionsChanged(transactions: TransactionEvent): void - onUpdate(event: UpdateEvent): void - onError(error: ErrorEvent): void + onBalanceChanged: (balance: BalanceEvent) => void + onStatusChanged: (status: StatusEvent) => void + onTransactionsChanged: (transactions: TransactionEvent) => void + onUpdate: (event: UpdateEvent) => void + onError: (error: ErrorEvent) => void } export interface Addresses { shieldedAddress: string } + +/** Transparent (L1) balance in duffs, with the SPV client's header height. */ +export interface CoreBalance { + confirmedDuffs: string + unconfirmedDuffs: string + totalDuffs: string + syncedHeight: number +} + +/** + * One asset lock the wallet is tracking. `status` runs `built`, `broadcast`, + * `instantSendLocked` in the native casing `instant_send_locked`, + * `chain_locked`, then `consumed`. Anything short of `consumed` is value in a + * lock that never became a note, which `resumeShieldFromAssetLock` takes. + * + * A lock rebuilt from the wallet's chain records in a later process reads + * `recovered_from_chain`: Core has finalized it, and the wallet cannot tell + * locally whether Platform already consumed it. Resuming one is how a host + * finds out. A stranded lock shields; a spent one returns an error, moves no + * value and keeps this status. + */ +export interface AssetLock { + txid: string + vout: number + status: string +} diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json new file mode 100644 index 0000000..188253d --- /dev/null +++ b/tsconfig.eslint.json @@ -0,0 +1,16 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": true + }, + "include": [ + "src/**/*", + "scripts/**/*", + "node.d.ts" + ], + "exclude": [ + "node_modules", + "lib", + "rust" + ] +}