diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index e591f40ca..aba96d20e 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -12,8 +12,8 @@ android { applicationId = "org.bitcoinppl.cove" minSdk = 33 targetSdk = 36 - versionCode = 16 - versionName = "1.2.1" + versionCode = 17 + versionName = "1.3.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { diff --git a/android/app/src/main/java/org/bitcoinppl/cove/MainActivity.kt b/android/app/src/main/java/org/bitcoinppl/cove/MainActivity.kt index 9add2b753..09ec6a783 100644 --- a/android/app/src/main/java/org/bitcoinppl/cove/MainActivity.kt +++ b/android/app/src/main/java/org/bitcoinppl/cove/MainActivity.kt @@ -82,7 +82,6 @@ import org.bitcoinppl.cove.views.TermsAndConditionsSheet import org.bitcoinppl.cove_core.bootstrap import org.bitcoinppl.cove_core.activeMigration import org.bitcoinppl.cove_core.bootstrapProgress -import org.bitcoinppl.cove.utils.isMigrationInProgress import org.bitcoinppl.cove_core.cancelBootstrap import org.bitcoinppl.cove_core.AfterPinAction import org.bitcoinppl.cove_core.AppInitException @@ -390,7 +389,7 @@ class MainActivity : FragmentActivity() { delay(66) val step = bootstrapProgress() - if (!migrationDetected && step.isMigrationInProgress) { + if (!migrationDetected && step.isMigrationInProgress()) { migrationDetected = true } diff --git a/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/AppearanceSettingsScreen.kt b/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/AppearanceSettingsScreen.kt index 7f8b4b9d2..60b28b2f0 100644 --- a/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/AppearanceSettingsScreen.kt +++ b/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/AppearanceSettingsScreen.kt @@ -36,7 +36,6 @@ import org.bitcoinppl.cove.views.SectionHeader import org.bitcoinppl.cove_core.AppAction import org.bitcoinppl.cove_core.types.ColorSchemeSelection import org.bitcoinppl.cove_core.types.allColorSchemes -import org.bitcoinppl.cove_core.types.colorSchemeSelectionCapitalizedString @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -118,7 +117,7 @@ private fun ColorSchemeRow( verticalAlignment = Alignment.CenterVertically, ) { Text( - text = colorSchemeSelectionCapitalizedString(colorScheme), + text = colorScheme.capitalizedString(), style = MaterialTheme.typography.bodyLarge, ) diff --git a/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/FiatCurrencySettingsScreen.kt b/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/FiatCurrencySettingsScreen.kt index 4ba29103c..387bdf9d1 100644 --- a/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/FiatCurrencySettingsScreen.kt +++ b/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/FiatCurrencySettingsScreen.kt @@ -36,8 +36,6 @@ import org.bitcoinppl.cove.views.SectionHeader import org.bitcoinppl.cove_core.AppAction import org.bitcoinppl.cove_core.FiatCurrency import org.bitcoinppl.cove_core.allFiatCurrencies -import org.bitcoinppl.cove_core.fiatCurrencyEmoji -import org.bitcoinppl.cove_core.fiatCurrencyToString @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -119,7 +117,7 @@ private fun FiatCurrencyRow( verticalAlignment = Alignment.CenterVertically, ) { Text( - text = "${fiatCurrencyEmoji(fiatCurrency)} ${fiatCurrencyToString(fiatCurrency)}", + text = "${fiatCurrency.emojiString()} ${fiatCurrency}", style = MaterialTheme.typography.bodyLarge, ) diff --git a/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/NetworkSettingsScreen.kt b/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/NetworkSettingsScreen.kt index bba74d7bf..942084434 100644 --- a/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/NetworkSettingsScreen.kt +++ b/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/NetworkSettingsScreen.kt @@ -41,7 +41,6 @@ import org.bitcoinppl.cove.views.SectionHeader import org.bitcoinppl.cove_core.AppAction import org.bitcoinppl.cove_core.types.Network import org.bitcoinppl.cove_core.types.allNetworks -import org.bitcoinppl.cove_core.types.networkToString @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -113,7 +112,7 @@ fun NetworkSettingsScreen( AlertDialog( onDismissRequest = { pendingNetworkChange = null }, title = { Text("Warning: Network Changed") }, - text = { Text("You've changed your network to ${networkToString(network)}") }, + text = { Text("You've changed your network to ${network.toString()}") }, confirmButton = { TextButton( onClick = { @@ -153,7 +152,7 @@ private fun NetworkRow( verticalAlignment = Alignment.CenterVertically, ) { Text( - text = networkToString(network), + text = network.toString(), style = MaterialTheme.typography.bodyLarge, ) diff --git a/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/NodeSettingsScreen.kt b/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/NodeSettingsScreen.kt index 802102e87..054cf4822 100644 --- a/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/NodeSettingsScreen.kt +++ b/android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/NodeSettingsScreen.kt @@ -60,7 +60,6 @@ import org.bitcoinppl.cove_core.ApiType import org.bitcoinppl.cove_core.NodeSelection import org.bitcoinppl.cove_core.NodeSelector import org.bitcoinppl.cove_core.NodeSelectorException -import org.bitcoinppl.cove_core.nodeSelectionToNode @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -75,7 +74,7 @@ fun NodeSettingsScreen( val nodeList = remember { nodeSelector.nodeList() } var selectedNodeSelection by remember { mutableStateOf(nodeSelector.selectedNode()) } var selectedNodeName by remember { - mutableStateOf(nodeSelectionToNode(selectedNodeSelection).name) + mutableStateOf(selectedNodeSelection.toNode().name) } var customUrl by remember { mutableStateOf("") } @@ -109,7 +108,7 @@ fun NodeSettingsScreen( if (showCustomFields && customUrl.isEmpty()) { val savedNode = selectedNodeSelection if (savedNode is NodeSelection.Custom) { - val node = nodeSelectionToNode(savedNode) + val node = savedNode.toNode() val matchesType = when (selectedNodeName) { customElectrum -> node.apiType == ApiType.ELECTRUM @@ -266,7 +265,7 @@ fun NodeSettingsScreen( Column { // preset nodes nodeList.forEachIndexed { index, nodeSelection -> - val node = nodeSelectionToNode(nodeSelection) + val node = nodeSelection.toNode() NodeRow( nodeName = node.name, isSelected = selectedNodeName == node.name, diff --git a/android/app/src/main/java/org/bitcoinppl/cove/flows/TapSignerFlow/TapSignerEnterPinView.kt b/android/app/src/main/java/org/bitcoinppl/cove/flows/TapSignerFlow/TapSignerEnterPinView.kt index f220ba629..164d78e43 100644 --- a/android/app/src/main/java/org/bitcoinppl/cove/flows/TapSignerFlow/TapSignerEnterPinView.kt +++ b/android/app/src/main/java/org/bitcoinppl/cove/flows/TapSignerFlow/TapSignerEnterPinView.kt @@ -383,5 +383,5 @@ private suspend fun signAction( private fun isAuthError(error: Exception): Boolean { // check if error is a bad auth error using type-safe FFI function return error is org.bitcoinppl.cove_core.TapSignerReaderException && - org.bitcoinppl.cove_core.tapSignerErrorIsAuthError(error) + error.isAuthError() } diff --git a/android/app/src/main/java/org/bitcoinppl/cove/utils/BootstrapStepExt.kt b/android/app/src/main/java/org/bitcoinppl/cove/utils/BootstrapStepExt.kt deleted file mode 100644 index 1c73e33a5..000000000 --- a/android/app/src/main/java/org/bitcoinppl/cove/utils/BootstrapStepExt.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.bitcoinppl.cove.utils - -import org.bitcoinppl.cove_core.BootstrapStep -import org.bitcoinppl.cove_core.bootstrapStepIsMigrationInProgress - -val BootstrapStep.isMigrationInProgress: Boolean - get() = bootstrapStepIsMigrationInProgress(this) diff --git a/android/app/src/main/java/org/bitcoinppl/cove_core/cove.kt b/android/app/src/main/java/org/bitcoinppl/cove_core/cove.kt index 837387ffe..697df26f4 100644 --- a/android/app/src/main/java/org/bitcoinppl/cove_core/cove.kt +++ b/android/app/src/main/java/org/bitcoinppl/cove_core/cove.kt @@ -991,22 +991,12 @@ external fun uniffi_cove_checksum_func_bootstrap( ): Short external fun uniffi_cove_checksum_func_bootstrap_progress( ): Short -external fun uniffi_cove_checksum_func_bootstrap_step_is_migration_in_progress( -): Short external fun uniffi_cove_checksum_func_cancel_bootstrap( ): Short external fun uniffi_cove_checksum_func_active_migration( ): Short external fun uniffi_cove_checksum_func_all_fiat_currencies( ): Short -external fun uniffi_cove_checksum_func_fiat_currency_emoji( -): Short -external fun uniffi_cove_checksum_func_fiat_currency_suffix( -): Short -external fun uniffi_cove_checksum_func_fiat_currency_symbol( -): Short -external fun uniffi_cove_checksum_func_fiat_currency_to_string( -): Short external fun uniffi_cove_checksum_func_is_fiat_currency_symbol( ): Short external fun uniffi_cove_checksum_func_fiat_amount_preview_new( @@ -1015,11 +1005,7 @@ external fun uniffi_cove_checksum_func_prices_are_equal( ): Short external fun uniffi_cove_checksum_func_updatepricesifneeded( ): Short -external fun uniffi_cove_checksum_func_coin_control_list_sort_key_to_string( -): Short -external fun uniffi_cove_checksum_func_address_error_to_alert_state( -): Short -external fun uniffi_cove_checksum_func_wallet_state_is_equal( +external fun uniffi_cove_checksum_func_send_flow_alert_state_from_address_error( ): Short external fun uniffi_cove_checksum_func_grouped_plain_words_of( ): Short @@ -1029,27 +1015,15 @@ external fun uniffi_cove_checksum_func_numberofwordstowordcount( ): Short external fun uniffi_cove_checksum_func_multi_format_try_from_nfc_message( ): Short -external fun uniffi_cove_checksum_func_string_or_data_try_into_multi_format( -): Short external fun uniffi_cove_checksum_func_default_node_selection( ): Short -external fun uniffi_cove_checksum_func_node_selection_to_node( -): Short -external fun uniffi_cove_checksum_func_after_pin_action_user_message( -): Short -external fun uniffi_cove_checksum_func_hash_route( -): Short -external fun uniffi_cove_checksum_func_is_route_equal( -): Short -external fun uniffi_cove_checksum_func_is_tap_signer_route_equal( -): Short external fun uniffi_cove_checksum_func_tap_signer_confirm_pin_args_new_from_new_pin( ): Short -external fun uniffi_cove_checksum_func_signedtransactionorpsbttryfrombytes( +external fun uniffi_cove_checksum_func_signed_transaction_or_psbt_try_from_bytes( ): Short -external fun uniffi_cove_checksum_func_signedtransactionorpsbttryfromnfcmessage( +external fun uniffi_cove_checksum_func_signed_transaction_or_psbt_try_from_nfc_message( ): Short -external fun uniffi_cove_checksum_func_signedtransactionorpsbttryparse( +external fun uniffi_cove_checksum_func_signed_transaction_or_psbt_try_parse( ): Short external fun uniffi_cove_checksum_func_create_transport_error_from_code( ): Short @@ -1057,10 +1031,6 @@ external fun uniffi_cove_checksum_func_is_valid_chain_code( ): Short external fun uniffi_cove_checksum_func_create_tap_signer_reader( ): Short -external fun uniffi_cove_checksum_func_tapsignererrorisautherror( -): Short -external fun uniffi_cove_checksum_func_tapsignererrorisnobackuperror( -): Short external fun uniffi_cove_checksum_func_tapsignerresponsebackupresponse( ): Short external fun uniffi_cove_checksum_func_tapsignerresponsechangeresponse( @@ -1081,8 +1051,6 @@ external fun uniffi_cove_checksum_func_transaction_preview_unconfirmed_new( ): Short external fun uniffi_cove_checksum_func_transactions_preview_new( ): Short -external fun uniffi_cove_checksum_func_wallet_address_type_sort_order( -): Short external fun uniffi_cove_checksum_func_ffi_min_send_amount( ): Short external fun uniffi_cove_checksum_func_ffi_min_send_sats( @@ -1093,12 +1061,6 @@ external fun uniffi_cove_checksum_func_preview_new_wrapped_found_address( ): Short external fun uniffi_cove_checksum_func_default_wallet_colors( ): Short -external fun uniffi_cove_checksum_func_hardware_wallet_is_tap_signer( -): Short -external fun uniffi_cove_checksum_func_wallet_metadata_hash( -): Short -external fun uniffi_cove_checksum_func_wallet_metadata_is_equal( -): Short external fun uniffi_cove_checksum_func_wallet_metadata_preview( ): Short external fun uniffi_cove_checksum_method_ffiapp_auth_type( @@ -2977,6 +2939,8 @@ external fun uniffi_cove_fn_method_backuperror_uniffi_trait_display(`ptr`: RustB ): RustBuffer.ByValue external fun uniffi_cove_fn_method_walletsecrettype_display_name(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue +external fun uniffi_cove_fn_method_bootstrapstep_ismigrationinprogress(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Byte external fun uniffi_cove_fn_method_convertererror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_fn_method_databaseerror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, @@ -3003,6 +2967,12 @@ external fun uniffi_cove_fn_method_walletdataerror_uniffi_trait_display(`ptr`: R ): RustBuffer.ByValue external fun uniffi_cove_fn_method_labeldberror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue +external fun uniffi_cove_fn_method_fiatcurrency_emojistring(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue +external fun uniffi_cove_fn_method_fiatcurrency_suffixstring(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue +external fun uniffi_cove_fn_method_fiatcurrency_symbolstring(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue external fun uniffi_cove_fn_method_fiatcurrency_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_fn_method_filehandlererror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, @@ -3011,6 +2981,8 @@ external fun uniffi_cove_fn_method_labelmanagererror_uniffi_trait_display(`ptr`: ): RustBuffer.ByValue external fun uniffi_cove_fn_method_authmanagererror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue +external fun uniffi_cove_fn_method_coincontrollistsortkey_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue external fun uniffi_cove_fn_method_importwalleterror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_fn_method_pendingwalletmanagererror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, @@ -3021,6 +2993,8 @@ external fun uniffi_cove_fn_method_sendflowerror_uniffi_trait_display(`ptr`: Rus ): RustBuffer.ByValue external fun uniffi_cove_fn_method_sendflowfiatonchangeerror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue +external fun uniffi_cove_fn_method_walletloadstate_is_equal(`ptr`: RustBuffer.ByValue,`other`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Byte external fun uniffi_cove_fn_method_walletmanagererror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_fn_method_mnemonicerror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, @@ -3033,12 +3007,24 @@ external fun uniffi_cove_fn_method_multiformat_uniffi_trait_eq_ne(`ptr`: RustBuf ): Byte external fun uniffi_cove_fn_method_multiformaterror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue +external fun uniffi_cove_fn_method_stringordata_try_into_multi_format(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue +external fun uniffi_cove_fn_method_nodeselection_to_node(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue external fun uniffi_cove_fn_method_multiqrerror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_fn_method_scanprogress_detail_text(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_fn_method_scanprogress_display_text(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue +external fun uniffi_cove_fn_method_afterpinaction_usermessage(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue +external fun uniffi_cove_fn_method_route_is_equal(`ptr`: RustBuffer.ByValue,`routeToCheck`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Byte +external fun uniffi_cove_fn_method_route_stablehash(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Long +external fun uniffi_cove_fn_method_tapsignerroute_is_equal(`ptr`: RustBuffer.ByValue,`other`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Byte external fun uniffi_cove_fn_method_bip39error_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_fn_method_seedqrerror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, @@ -3055,12 +3041,18 @@ external fun uniffi_cove_fn_method_signedtransactionorpsbt_txid(`ptr`: RustBuffe ): Long external fun uniffi_cove_fn_method_transporterror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue +external fun uniffi_cove_fn_method_tapsignerreadererror_isautherror(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Byte +external fun uniffi_cove_fn_method_tapsignerreadererror_isnobackuperror(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Byte external fun uniffi_cove_fn_method_tapsignerreadererror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_fn_method_bitcointransactionerror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_fn_method_transactiondetailerror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue +external fun uniffi_cove_fn_method_walletaddresstype_sortorder(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Byte external fun uniffi_cove_fn_method_walletaddresstype_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_fn_method_walleterror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, @@ -3073,6 +3065,8 @@ external fun uniffi_cove_fn_method_discoverystate_uniffi_trait_eq_ne(`ptr`: Rust ): Byte external fun uniffi_cove_fn_method_discoverystate_uniffi_trait_hash(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): Long +external fun uniffi_cove_fn_method_hardwarewalletmetadata_istapsigner(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Byte external fun uniffi_cove_fn_method_wallettype_display_name(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_fn_method_wallettype_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, @@ -3083,6 +3077,10 @@ external fun uniffi_cove_fn_method_descriptorerror_uniffi_trait_display(`ptr`: R ): RustBuffer.ByValue external fun uniffi_cove_fn_method_xpuberror_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue +external fun uniffi_cove_fn_method_walletmetadata_is_equal(`ptr`: RustBuffer.ByValue,`other`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Byte +external fun uniffi_cove_fn_method_walletmetadata_stablehash(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Long external fun uniffi_cove_fn_method_walletmetadata_uniffi_trait_eq_eq(`ptr`: RustBuffer.ByValue,`other`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): Byte external fun uniffi_cove_fn_method_walletmetadata_uniffi_trait_eq_ne(`ptr`: RustBuffer.ByValue,`other`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, @@ -3095,22 +3093,12 @@ external fun uniffi_cove_fn_func_bootstrap( ): Long external fun uniffi_cove_fn_func_bootstrap_progress(uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue -external fun uniffi_cove_fn_func_bootstrap_step_is_migration_in_progress(`step`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): Byte external fun uniffi_cove_fn_func_cancel_bootstrap(uniffi_out_err: UniffiRustCallStatus, ): Unit external fun uniffi_cove_fn_func_active_migration(uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_fn_func_all_fiat_currencies(uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue -external fun uniffi_cove_fn_func_fiat_currency_emoji(`fiatCurrency`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): RustBuffer.ByValue -external fun uniffi_cove_fn_func_fiat_currency_suffix(`fiatCurrency`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): RustBuffer.ByValue -external fun uniffi_cove_fn_func_fiat_currency_symbol(`fiatCurrency`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): RustBuffer.ByValue -external fun uniffi_cove_fn_func_fiat_currency_to_string(`fiatCurrency`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): RustBuffer.ByValue external fun uniffi_cove_fn_func_is_fiat_currency_symbol(`symbol`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): Byte external fun uniffi_cove_fn_func_fiat_amount_preview_new(uniffi_out_err: UniffiRustCallStatus, @@ -3119,12 +3107,8 @@ external fun uniffi_cove_fn_func_prices_are_equal(`lhs`: Long,`rhs`: Long,uniffi ): Byte external fun uniffi_cove_fn_func_updatepricesifneeded( ): Long -external fun uniffi_cove_fn_func_coin_control_list_sort_key_to_string(`key`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +external fun uniffi_cove_fn_func_send_flow_alert_state_from_address_error(`error`: RustBufferAddressError.ByValue,`address`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue -external fun uniffi_cove_fn_func_address_error_to_alert_state(`error`: RustBufferAddressError.ByValue,`address`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): RustBuffer.ByValue -external fun uniffi_cove_fn_func_wallet_state_is_equal(`lhs`: RustBuffer.ByValue,`rhs`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): Byte external fun uniffi_cove_fn_func_grouped_plain_words_of(`mnemonic`: RustBuffer.ByValue,`groups`: Byte,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_fn_func_numberofwordsingroups(`me`: RustBuffer.ByValue,`of`: Byte,uniffi_out_err: UniffiRustCallStatus, @@ -3133,27 +3117,15 @@ external fun uniffi_cove_fn_func_numberofwordstowordcount(`me`: RustBuffer.ByVal ): Byte external fun uniffi_cove_fn_func_multi_format_try_from_nfc_message(`nfcMessage`: Long,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue -external fun uniffi_cove_fn_func_string_or_data_try_into_multi_format(`stringOrData`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): RustBuffer.ByValue external fun uniffi_cove_fn_func_default_node_selection(uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue -external fun uniffi_cove_fn_func_node_selection_to_node(`node`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): RustBuffer.ByValue -external fun uniffi_cove_fn_func_after_pin_action_user_message(`action`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): RustBuffer.ByValue -external fun uniffi_cove_fn_func_hash_route(`route`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): Long -external fun uniffi_cove_fn_func_is_route_equal(`route`: RustBuffer.ByValue,`routeToCheck`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): Byte -external fun uniffi_cove_fn_func_is_tap_signer_route_equal(`lhs`: RustBuffer.ByValue,`rhs`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): Byte external fun uniffi_cove_fn_func_tap_signer_confirm_pin_args_new_from_new_pin(`args`: RustBuffer.ByValue,`newPin`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue -external fun uniffi_cove_fn_func_signedtransactionorpsbttryfrombytes(`data`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +external fun uniffi_cove_fn_func_signed_transaction_or_psbt_try_from_bytes(`data`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue -external fun uniffi_cove_fn_func_signedtransactionorpsbttryfromnfcmessage(`nfcMessage`: Long,uniffi_out_err: UniffiRustCallStatus, +external fun uniffi_cove_fn_func_signed_transaction_or_psbt_try_from_nfc_message(`nfcMessage`: Long,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue -external fun uniffi_cove_fn_func_signedtransactionorpsbttryparse(`input`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +external fun uniffi_cove_fn_func_signed_transaction_or_psbt_try_parse(`input`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_fn_func_create_transport_error_from_code(`code`: Short,`message`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue @@ -3161,10 +3133,6 @@ external fun uniffi_cove_fn_func_is_valid_chain_code(`chainCode`: RustBuffer.ByV ): Byte external fun uniffi_cove_fn_func_create_tap_signer_reader(`transport`: Long,`cmd`: RustBuffer.ByValue, ): Long -external fun uniffi_cove_fn_func_tapsignererrorisautherror(`error`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): Byte -external fun uniffi_cove_fn_func_tapsignererrorisnobackuperror(`error`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): Byte external fun uniffi_cove_fn_func_tapsignerresponsebackupresponse(`response`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_fn_func_tapsignerresponsechangeresponse(`response`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, @@ -3185,8 +3153,6 @@ external fun uniffi_cove_fn_func_transaction_preview_unconfirmed_new(uniffi_out_ ): RustBuffer.ByValue external fun uniffi_cove_fn_func_transactions_preview_new(`confirmed`: Byte,`unconfirmed`: Byte,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue -external fun uniffi_cove_fn_func_wallet_address_type_sort_order(`addressType`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): Byte external fun uniffi_cove_fn_func_ffi_min_send_amount(uniffi_out_err: UniffiRustCallStatus, ): Long external fun uniffi_cove_fn_func_ffi_min_send_sats(uniffi_out_err: UniffiRustCallStatus, @@ -3197,12 +3163,6 @@ external fun uniffi_cove_fn_func_preview_new_wrapped_found_address(uniffi_out_er ): RustBuffer.ByValue external fun uniffi_cove_fn_func_default_wallet_colors(uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue -external fun uniffi_cove_fn_func_hardware_wallet_is_tap_signer(`hardwareWallet`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): Byte -external fun uniffi_cove_fn_func_wallet_metadata_hash(`metadata`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): Long -external fun uniffi_cove_fn_func_wallet_metadata_is_equal(`lhs`: RustBuffer.ByValue,`rhs`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): Byte external fun uniffi_cove_fn_func_wallet_metadata_preview(uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun ffi_cove_rustbuffer_alloc(`size`: Long,uniffi_out_err: UniffiRustCallStatus, @@ -3333,9 +3293,6 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_cove_checksum_func_bootstrap_progress() != 47242.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_cove_checksum_func_bootstrap_step_is_migration_in_progress() != 43717.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } if (lib.uniffi_cove_checksum_func_cancel_bootstrap() != 59164.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -3345,18 +3302,6 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_cove_checksum_func_all_fiat_currencies() != 53482.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_cove_checksum_func_fiat_currency_emoji() != 42864.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_cove_checksum_func_fiat_currency_suffix() != 43766.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_cove_checksum_func_fiat_currency_symbol() != 15961.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_cove_checksum_func_fiat_currency_to_string() != 47206.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } if (lib.uniffi_cove_checksum_func_is_fiat_currency_symbol() != 60129.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -3369,13 +3314,7 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_cove_checksum_func_updatepricesifneeded() != 5753.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_cove_checksum_func_coin_control_list_sort_key_to_string() != 15603.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_cove_checksum_func_address_error_to_alert_state() != 44369.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_cove_checksum_func_wallet_state_is_equal() != 22901.toShort()) { + if (lib.uniffi_cove_checksum_func_send_flow_alert_state_from_address_error() != 25696.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } if (lib.uniffi_cove_checksum_func_grouped_plain_words_of() != 51957.toShort()) { @@ -3390,37 +3329,19 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_cove_checksum_func_multi_format_try_from_nfc_message() != 63598.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_cove_checksum_func_string_or_data_try_into_multi_format() != 10759.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } if (lib.uniffi_cove_checksum_func_default_node_selection() != 32212.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_cove_checksum_func_node_selection_to_node() != 13406.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_cove_checksum_func_after_pin_action_user_message() != 30105.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_cove_checksum_func_hash_route() != 38756.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_cove_checksum_func_is_route_equal() != 13176.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_cove_checksum_func_is_tap_signer_route_equal() != 21746.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } if (lib.uniffi_cove_checksum_func_tap_signer_confirm_pin_args_new_from_new_pin() != 4888.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_cove_checksum_func_signedtransactionorpsbttryfrombytes() != 36882.toShort()) { + if (lib.uniffi_cove_checksum_func_signed_transaction_or_psbt_try_from_bytes() != 29004.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_cove_checksum_func_signedtransactionorpsbttryfromnfcmessage() != 49359.toShort()) { + if (lib.uniffi_cove_checksum_func_signed_transaction_or_psbt_try_from_nfc_message() != 64085.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_cove_checksum_func_signedtransactionorpsbttryparse() != 7350.toShort()) { + if (lib.uniffi_cove_checksum_func_signed_transaction_or_psbt_try_parse() != 50770.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } if (lib.uniffi_cove_checksum_func_create_transport_error_from_code() != 12205.toShort()) { @@ -3432,12 +3353,6 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_cove_checksum_func_create_tap_signer_reader() != 39823.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_cove_checksum_func_tapsignererrorisautherror() != 54484.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_cove_checksum_func_tapsignererrorisnobackuperror() != 36431.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } if (lib.uniffi_cove_checksum_func_tapsignerresponsebackupresponse() != 56452.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -3468,9 +3383,6 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_cove_checksum_func_transactions_preview_new() != 59467.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_cove_checksum_func_wallet_address_type_sort_order() != 21818.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } if (lib.uniffi_cove_checksum_func_ffi_min_send_amount() != 61138.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -3486,15 +3398,6 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_cove_checksum_func_default_wallet_colors() != 11354.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_cove_checksum_func_hardware_wallet_is_tap_signer() != 49430.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_cove_checksum_func_wallet_metadata_hash() != 36015.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_cove_checksum_func_wallet_metadata_is_equal() != 16249.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } if (lib.uniffi_cove_checksum_func_wallet_metadata_preview() != 44605.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -27488,6 +27391,26 @@ data class WalletMetadata ( var `internal`: InternalOnlyMetadata ): Disposable{ + fun `isEqual`(`other`: WalletMetadata): kotlin.Boolean { + return FfiConverterBoolean.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_walletmetadata_is_equal(FfiConverterTypeWalletMetadata.lower(this), + FfiConverterTypeWalletMetadata.lower(`other`),_status) +} + ) + } + + + fun `stableHash`(): kotlin.ULong { + return FfiConverterULong.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_walletmetadata_stablehash(FfiConverterTypeWalletMetadata.lower(this), + _status) +} + ) + } + + @@ -27756,6 +27679,16 @@ sealed class AfterPinAction: Disposable { + fun `userMessage`(): kotlin.String { + return FfiConverterString.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_afterpinaction_usermessage(FfiConverterTypeAfterPinAction.lower(this), + _status) +} + ) + } + + @@ -29341,6 +29274,10 @@ sealed class AppInitException(message: String): kotlin.Exception(message) { class AlreadyCalled(message: String) : AppInitException(message) + class DatabaseKeyMismatch(message: String) : AppInitException(message) + + class DatabaseVerificationFailed(message: String) : AppInitException(message) + companion object ErrorHandler : UniffiRustCallStatusErrorHandler { override fun lift(error_buf: RustBuffer.ByValue): AppInitException = FfiConverterTypeAppInitError.lift(error_buf) @@ -29359,6 +29296,8 @@ public object FfiConverterTypeAppInitError : FfiConverterRustBuffer AppInitException.WalletDatabaseMigration(FfiConverterString.read(buf)) 4 -> AppInitException.Cancelled(FfiConverterString.read(buf)) 5 -> AppInitException.AlreadyCalled(FfiConverterString.read(buf)) + 6 -> AppInitException.DatabaseKeyMismatch(FfiConverterString.read(buf)) + 7 -> AppInitException.DatabaseVerificationFailed(FfiConverterString.read(buf)) else -> throw RuntimeException("invalid error enum value, something is very wrong!!") } @@ -29390,6 +29329,14 @@ public object FfiConverterTypeAppInitError : FfiConverterRustBuffer { + buf.putInt(6) + Unit + } + is AppInitException.DatabaseVerificationFailed -> { + buf.putInt(7) + Unit + } }.let { /* this makes the `when` an expression, which ensures it is exhaustive */ } } @@ -30996,6 +30943,16 @@ enum class BootstrapStep { MIGRATING_BDK_DATABASES, COMPLETE; + fun `isMigrationInProgress`(): kotlin.Boolean { + return FfiConverterBoolean.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_bootstrapstep_ismigrationinprogress(FfiConverterTypeBootstrapStep.lower(this), + _status) +} + ) + } + + @@ -31582,6 +31539,15 @@ enum class CoinControlListSortKey { + // The local Rust `Display`/`Debug` implementation. + override fun toString(): String { + return FfiConverterString.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_coincontrollistsortkey_uniffi_trait_display(FfiConverterTypeCoinControlListSortKey.lower(this), + _status) +} + ) + } companion object } @@ -33354,6 +33320,36 @@ enum class FiatCurrency { CHF, JPY; + fun `emojiString`(): kotlin.String { + return FfiConverterString.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_fiatcurrency_emojistring(FfiConverterTypeFiatCurrency.lower(this), + _status) +} + ) + } + + + fun `suffixString`(): kotlin.String { + return FfiConverterString.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_fiatcurrency_suffixstring(FfiConverterTypeFiatCurrency.lower(this), + _status) +} + ) + } + + + fun `symbolString`(): kotlin.String { + return FfiConverterString.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_fiatcurrency_symbolstring(FfiConverterTypeFiatCurrency.lower(this), + _status) +} + ) + } + + // The local Rust `Display`/`Debug` implementation. @@ -34261,6 +34257,16 @@ sealed class HardwareWalletMetadata: Disposable { + fun `isTapSigner`(): kotlin.Boolean { + return FfiConverterBoolean.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_hardwarewalletmetadata_istapsigner(FfiConverterTypeHardwareWalletMetadata.lower(this), + _status) +} + ) + } + + @@ -36413,6 +36419,16 @@ sealed class NodeSelection { + fun `toNode`(): Node { + return FfiConverterTypeNode.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_nodeselection_to_node(FfiConverterTypeNodeSelection.lower(this), + _status) +} + ) + } + + @@ -37068,6 +37084,26 @@ sealed class Route: Disposable { + fun `isEqual`(`routeToCheck`: Route): kotlin.Boolean { + return FfiConverterBoolean.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_route_is_equal(FfiConverterTypeRoute.lower(this), + FfiConverterTypeRoute.lower(`routeToCheck`),_status) +} + ) + } + + + fun `stableHash`(): kotlin.ULong { + return FfiConverterULong.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_route_stablehash(FfiConverterTypeRoute.lower(this), + _status) +} + ) + } + + @@ -40963,7 +40999,7 @@ public object FfiConverterTypeStoreType: FfiConverterRustBuffer { /** * A string or data, could be a string or data (bytes) */ -sealed class StringOrData { +sealed class StringOrData: Disposable { data class String( val v1: kotlin.String) : StringOrData() @@ -40985,9 +41021,40 @@ sealed class StringOrData { + @Suppress("UNNECESSARY_SAFE_CALL") // codegen is much simpler if we unconditionally emit safe calls here + override fun destroy() { + when(this) { + is StringOrData.String -> { + + Disposable.destroy( + this.v1 + ) + + } + is StringOrData.Data -> { + + Disposable.destroy( + this.v1 + ) + + } + }.let { /* this makes the `when` an expression, which ensures it is exhaustive */ } + } + + @Throws(MultiFormatException::class) fun `tryIntoMultiFormat`(): MultiFormat { + return FfiConverterTypeMultiFormat.lift( + uniffiRustCallWithError(MultiFormatException) { _status -> + UniffiLib.uniffi_cove_fn_method_stringordata_try_into_multi_format(FfiConverterTypeStringOrData.lower(this), + _status) +} + ) + } + + + companion object @@ -41371,6 +41438,26 @@ sealed class TapSignerReaderException: kotlin.Exception() { } + fun `isAuthError`(): kotlin.Boolean { + return FfiConverterBoolean.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_tapsignerreadererror_isautherror(FfiConverterTypeTapSignerReaderError.lower(this), + _status) +} + ) + } + + + fun `isNoBackupError`(): kotlin.Boolean { + return FfiConverterBoolean.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_tapsignerreadererror_isnobackuperror(FfiConverterTypeTapSignerReaderError.lower(this), + _status) +} + ) + } + + // The local Rust `Display`/`Debug` implementation. @@ -41901,6 +41988,16 @@ sealed class TapSignerRoute: Disposable { + fun `isEqual`(`other`: TapSignerRoute): kotlin.Boolean { + return FfiConverterBoolean.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_tapsignerroute_is_equal(FfiConverterTypeTapSignerRoute.lower(this), + FfiConverterTypeTapSignerRoute.lower(`other`),_status) +} + ) + } + + @@ -42993,6 +43090,16 @@ enum class WalletAddressType { WRAPPED_SEGWIT, LEGACY; + fun `sortOrder`(): kotlin.UByte { + return FfiConverterUByte.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_walletaddresstype_sortorder(FfiConverterTypeWalletAddressType.lower(this), + _status) +} + ) + } + + // The local Rust `Display`/`Debug` implementation. @@ -44140,6 +44247,16 @@ sealed class WalletLoadState: Disposable { + fun `isEqual`(`other`: WalletLoadState): kotlin.Boolean { + return FfiConverterBoolean.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_fn_method_walletloadstate_is_equal(FfiConverterTypeWalletLoadState.lower(this), + FfiConverterTypeWalletLoadState.lower(`other`),_status) +} + ) + } + + @@ -48657,16 +48774,6 @@ object UrExceptionExternalErrorHandler : UniffiRustCallStatusErrorHandler - UniffiLib.uniffi_cove_fn_func_bootstrap_step_is_migration_in_progress( - - FfiConverterTypeBootstrapStep.lower(`step`),_status) -} - ) - } - /** * Signal the bootstrap to stop at the next cancellation check point, @@ -48710,46 +48817,6 @@ object UrExceptionExternalErrorHandler : UniffiRustCallStatusErrorHandler - UniffiLib.uniffi_cove_fn_func_fiat_currency_emoji( - - FfiConverterTypeFiatCurrency.lower(`fiatCurrency`),_status) -} - ) - } - - fun `fiatCurrencySuffix`(`fiatCurrency`: FiatCurrency): kotlin.String { - return FfiConverterString.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_fn_func_fiat_currency_suffix( - - FfiConverterTypeFiatCurrency.lower(`fiatCurrency`),_status) -} - ) - } - - fun `fiatCurrencySymbol`(`fiatCurrency`: FiatCurrency): kotlin.String { - return FfiConverterString.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_fn_func_fiat_currency_symbol( - - FfiConverterTypeFiatCurrency.lower(`fiatCurrency`),_status) -} - ) - } - - fun `fiatCurrencyToString`(`fiatCurrency`: FiatCurrency): kotlin.String { - return FfiConverterString.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_fn_func_fiat_currency_to_string( - - FfiConverterTypeFiatCurrency.lower(`fiatCurrency`),_status) -} - ) - } - fun `isFiatCurrencySymbol`(`symbol`: kotlin.String): kotlin.Boolean { return FfiConverterBoolean.lift( uniffiRustCall() { _status -> @@ -48795,36 +48862,16 @@ object UrExceptionExternalErrorHandler : UniffiRustCallStatusErrorHandler - UniffiLib.uniffi_cove_fn_func_coin_control_list_sort_key_to_string( - - FfiConverterTypeCoinControlListSortKey.lower(`key`),_status) -} - ) - } - - fun `addressErrorToAlertState`(`error`: AddressException, `address`: kotlin.String): SendFlowAlertState { + fun `sendFlowAlertStateFromAddressError`(`error`: AddressException, `address`: kotlin.String): SendFlowAlertState { return FfiConverterTypeSendFlowAlertState.lift( uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_fn_func_address_error_to_alert_state( + UniffiLib.uniffi_cove_fn_func_send_flow_alert_state_from_address_error( FfiConverterTypeAddressError.lower(`error`),FfiConverterString.lower(`address`),_status) } ) } - fun `walletStateIsEqual`(`lhs`: WalletLoadState, `rhs`: WalletLoadState): kotlin.Boolean { - return FfiConverterBoolean.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_fn_func_wallet_state_is_equal( - - FfiConverterTypeWalletLoadState.lower(`lhs`),FfiConverterTypeWalletLoadState.lower(`rhs`),_status) -} - ) - } - @Throws(MnemonicParseException::class) fun `groupedPlainWordsOf`(`mnemonic`: kotlin.String, `groups`: kotlin.UByte): List> { return FfiConverterSequenceSequenceString.lift( @@ -48867,17 +48914,6 @@ object UrExceptionExternalErrorHandler : UniffiRustCallStatusErrorHandler - UniffiLib.uniffi_cove_fn_func_string_or_data_try_into_multi_format( - - FfiConverterTypeStringOrData.lower(`stringOrData`),_status) -} - ) - } - fun `defaultNodeSelection`(): NodeSelection { return FfiConverterTypeNodeSelection.lift( uniffiRustCall() { _status -> @@ -48888,56 +48924,6 @@ object UrExceptionExternalErrorHandler : UniffiRustCallStatusErrorHandler - UniffiLib.uniffi_cove_fn_func_node_selection_to_node( - - FfiConverterTypeNodeSelection.lower(`node`),_status) -} - ) - } - - fun `afterPinActionUserMessage`(`action`: AfterPinAction): kotlin.String { - return FfiConverterString.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_fn_func_after_pin_action_user_message( - - FfiConverterTypeAfterPinAction.lower(`action`),_status) -} - ) - } - - fun `hashRoute`(`route`: Route): kotlin.ULong { - return FfiConverterULong.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_fn_func_hash_route( - - FfiConverterTypeRoute.lower(`route`),_status) -} - ) - } - - fun `isRouteEqual`(`route`: Route, `routeToCheck`: Route): kotlin.Boolean { - return FfiConverterBoolean.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_fn_func_is_route_equal( - - FfiConverterTypeRoute.lower(`route`),FfiConverterTypeRoute.lower(`routeToCheck`),_status) -} - ) - } - - fun `isTapSignerRouteEqual`(`lhs`: TapSignerRoute, `rhs`: TapSignerRoute): kotlin.Boolean { - return FfiConverterBoolean.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_fn_func_is_tap_signer_route_equal( - - FfiConverterTypeTapSignerRoute.lower(`lhs`),FfiConverterTypeTapSignerRoute.lower(`rhs`),_status) -} - ) - } - fun `tapSignerConfirmPinArgsNewFromNewPin`(`args`: TapSignerNewPinArgs, `newPin`: kotlin.String): TapSignerConfirmPinArgs { return FfiConverterTypeTapSignerConfirmPinArgs.lift( uniffiRustCall() { _status -> @@ -48949,13 +48935,10 @@ object UrExceptionExternalErrorHandler : UniffiRustCallStatusErrorHandler - UniffiLib.uniffi_cove_fn_func_signedtransactionorpsbttryfrombytes( + UniffiLib.uniffi_cove_fn_func_signed_transaction_or_psbt_try_from_bytes( FfiConverterByteArray.lower(`data`),_status) } @@ -48963,13 +48946,10 @@ object UrExceptionExternalErrorHandler : UniffiRustCallStatusErrorHandler - UniffiLib.uniffi_cove_fn_func_signedtransactionorpsbttryfromnfcmessage( + UniffiLib.uniffi_cove_fn_func_signed_transaction_or_psbt_try_from_nfc_message( FfiConverterTypeNfcMessage.lower(`nfcMessage`),_status) } @@ -48977,13 +48957,10 @@ object UrExceptionExternalErrorHandler : UniffiRustCallStatusErrorHandler - UniffiLib.uniffi_cove_fn_func_signedtransactionorpsbttryparse( + UniffiLib.uniffi_cove_fn_func_signed_transaction_or_psbt_try_parse( FfiConverterString.lower(`input`),_status) } @@ -49030,26 +49007,6 @@ object UrExceptionExternalErrorHandler : UniffiRustCallStatusErrorHandler - UniffiLib.uniffi_cove_fn_func_tapsignererrorisautherror( - - FfiConverterTypeTapSignerReaderError.lower(`error`),_status) -} - ) - } - - fun `tapSignerErrorIsNoBackupError`(`error`: TapSignerReaderException): kotlin.Boolean { - return FfiConverterBoolean.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_fn_func_tapsignererrorisnobackuperror( - - FfiConverterTypeTapSignerReaderError.lower(`error`),_status) -} - ) - } - fun `tapSignerResponseBackupResponse`(`response`: TapSignerResponse): kotlin.ByteArray? { return FfiConverterOptionalByteArray.lift( uniffiRustCall() { _status -> @@ -49150,16 +49107,6 @@ object UrExceptionExternalErrorHandler : UniffiRustCallStatusErrorHandler - UniffiLib.uniffi_cove_fn_func_wallet_address_type_sort_order( - - FfiConverterTypeWalletAddressType.lower(`addressType`),_status) -} - ) - } - fun `ffiMinSendAmount`(): Amount { return FfiConverterTypeAmount.lift( uniffiRustCall() { _status -> @@ -49210,36 +49157,6 @@ object UrExceptionExternalErrorHandler : UniffiRustCallStatusErrorHandler - UniffiLib.uniffi_cove_fn_func_hardware_wallet_is_tap_signer( - - FfiConverterTypeHardwareWalletMetadata.lower(`hardwareWallet`),_status) -} - ) - } - - fun `walletMetadataHash`(`metadata`: WalletMetadata): kotlin.ULong { - return FfiConverterULong.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_fn_func_wallet_metadata_hash( - - FfiConverterTypeWalletMetadata.lower(`metadata`),_status) -} - ) - } - - fun `walletMetadataIsEqual`(`lhs`: WalletMetadata, `rhs`: WalletMetadata): kotlin.Boolean { - return FfiConverterBoolean.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_fn_func_wallet_metadata_is_equal( - - FfiConverterTypeWalletMetadata.lower(`lhs`),FfiConverterTypeWalletMetadata.lower(`rhs`),_status) -} - ) - } - fun `walletMetadataPreview`(): WalletMetadata { return FfiConverterTypeWalletMetadata.lift( uniffiRustCall() { _status -> diff --git a/android/app/src/main/java/org/bitcoinppl/cove_core/types/cove_types.kt b/android/app/src/main/java/org/bitcoinppl/cove_core/types/cove_types.kt index c37590789..c9c659515 100644 --- a/android/app/src/main/java/org/bitcoinppl/cove_core/types/cove_types.kt +++ b/android/app/src/main/java/org/bitcoinppl/cove_core/types/cove_types.kt @@ -644,8 +644,6 @@ external fun uniffi_cove_types_checksum_func_address_string_spaced_out( ): Short external fun uniffi_cove_types_checksum_func_all_color_schemes( ): Short -external fun uniffi_cove_types_checksum_func_color_scheme_selection_capitalized_string( -): Short external fun uniffi_cove_types_checksum_func_confirm_details_preview_new( ): Short external fun uniffi_cove_types_checksum_func_qr_density_is_equal( @@ -666,14 +664,6 @@ external fun uniffi_cove_types_checksum_func_all_units( ): Short external fun uniffi_cove_types_checksum_func_previewnewutxolist( ): Short -external fun uniffi_cove_types_checksum_func_utxo_date( -): Short -external fun uniffi_cove_types_checksum_func_utxo_hash_to_uint( -): Short -external fun uniffi_cove_types_checksum_func_utxo_is_equal( -): Short -external fun uniffi_cove_types_checksum_func_utxo_name( -): Short external fun uniffi_cove_types_checksum_method_address_hashtouint( ): Short external fun uniffi_cove_types_checksum_method_address_spaced_out( @@ -1232,6 +1222,8 @@ external fun uniffi_cove_types_fn_clone_utxolist(`handle`: Long,uniffi_out_err: ): Long external fun uniffi_cove_types_fn_free_utxolist(`handle`: Long,uniffi_out_err: UniffiRustCallStatus, ): Unit +external fun uniffi_cove_types_fn_method_colorschemeselection_capitalized_string(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue external fun uniffi_cove_types_fn_method_qrexportformat_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun uniffi_cove_types_fn_method_feespeed_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, @@ -1242,6 +1234,14 @@ external fun uniffi_cove_types_fn_method_network_uniffi_trait_display(`ptr`: Rus ): RustBuffer.ByValue external fun uniffi_cove_types_fn_method_bitcoinunit_uniffi_trait_display(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue +external fun uniffi_cove_types_fn_method_utxo_date(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue +external fun uniffi_cove_types_fn_method_utxo_hash_to_uint(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Long +external fun uniffi_cove_types_fn_method_utxo_is_equal(`ptr`: RustBuffer.ByValue,`other`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): Byte +external fun uniffi_cove_types_fn_method_utxo_name(`ptr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, +): RustBuffer.ByValue external fun uniffi_cove_types_fn_method_utxo_uniffi_trait_eq_eq(`ptr`: RustBuffer.ByValue,`other`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, ): Byte external fun uniffi_cove_types_fn_method_utxo_uniffi_trait_eq_ne(`ptr`: RustBuffer.ByValue,`other`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, @@ -1256,8 +1256,6 @@ external fun uniffi_cove_types_fn_func_address_string_spaced_out(`address`: Rust ): RustBuffer.ByValue external fun uniffi_cove_types_fn_func_all_color_schemes(uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue -external fun uniffi_cove_types_fn_func_color_scheme_selection_capitalized_string(`colorScheme`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): RustBuffer.ByValue external fun uniffi_cove_types_fn_func_confirm_details_preview_new(uniffi_out_err: UniffiRustCallStatus, ): Long external fun uniffi_cove_types_fn_func_qr_density_is_equal(`lhs`: Long,`rhs`: Long,uniffi_out_err: UniffiRustCallStatus, @@ -1278,14 +1276,6 @@ external fun uniffi_cove_types_fn_func_all_units(uniffi_out_err: UniffiRustCallS ): RustBuffer.ByValue external fun uniffi_cove_types_fn_func_previewnewutxolist(`outputCount`: Byte,`changeCount`: Byte,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue -external fun uniffi_cove_types_fn_func_utxo_date(`utxo`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): RustBuffer.ByValue -external fun uniffi_cove_types_fn_func_utxo_hash_to_uint(`utxo`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): Long -external fun uniffi_cove_types_fn_func_utxo_is_equal(`lhs`: RustBuffer.ByValue,`rhs`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): Byte -external fun uniffi_cove_types_fn_func_utxo_name(`utxo`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus, -): RustBuffer.ByValue external fun ffi_cove_types_rustbuffer_alloc(`size`: Long,uniffi_out_err: UniffiRustCallStatus, ): RustBuffer.ByValue external fun ffi_cove_types_rustbuffer_from_bytes(`bytes`: ForeignBytes.ByValue,uniffi_out_err: UniffiRustCallStatus, @@ -1417,9 +1407,6 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_cove_types_checksum_func_all_color_schemes() != 49693.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_cove_types_checksum_func_color_scheme_selection_capitalized_string() != 30731.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } if (lib.uniffi_cove_types_checksum_func_confirm_details_preview_new() != 41030.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -1450,18 +1437,6 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) { if (lib.uniffi_cove_types_checksum_func_previewnewutxolist() != 31621.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } - if (lib.uniffi_cove_types_checksum_func_utxo_date() != 26239.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_cove_types_checksum_func_utxo_hash_to_uint() != 33471.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_cove_types_checksum_func_utxo_is_equal() != 34078.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } - if (lib.uniffi_cove_types_checksum_func_utxo_name() != 48729.toShort()) { - throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - } if (lib.uniffi_cove_types_checksum_method_address_hashtouint() != 25307.toShort()) { throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } @@ -9332,6 +9307,46 @@ data class Utxo ( var `type`: UtxoType ): Disposable{ + fun `date`(): kotlin.String { + return FfiConverterString.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_types_fn_method_utxo_date(FfiConverterTypeUtxo.lower(this), + _status) +} + ) + } + + + fun `hashToUint`(): kotlin.ULong { + return FfiConverterULong.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_types_fn_method_utxo_hash_to_uint(FfiConverterTypeUtxo.lower(this), + _status) +} + ) + } + + + fun `isEqual`(`other`: Utxo): kotlin.Boolean { + return FfiConverterBoolean.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_types_fn_method_utxo_is_equal(FfiConverterTypeUtxo.lower(this), + FfiConverterTypeUtxo.lower(`other`),_status) +} + ) + } + + + fun `name`(): kotlin.String { + return FfiConverterString.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_types_fn_method_utxo_name(FfiConverterTypeUtxo.lower(this), + _status) +} + ) + } + + @@ -9614,6 +9629,16 @@ enum class ColorSchemeSelection { DARK, SYSTEM; + fun `capitalizedString`(): kotlin.String { + return FfiConverterString.lift( + uniffiRustCall() { _status -> + UniffiLib.uniffi_cove_types_fn_method_colorschemeselection_capitalized_string(FfiConverterTypeColorSchemeSelection.lower(this), + _status) +} + ) + } + + @@ -10818,16 +10843,6 @@ public typealias FfiConverterTypeWalletId = FfiConverterString ) } - fun `colorSchemeSelectionCapitalizedString`(`colorScheme`: ColorSchemeSelection): kotlin.String { - return FfiConverterString.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_types_fn_func_color_scheme_selection_capitalized_string( - - FfiConverterTypeColorSchemeSelection.lower(`colorScheme`),_status) -} - ) - } - /** * Preview `ConfirmDetails` for `SwiftUI` previews @@ -10934,45 +10949,5 @@ public typealias FfiConverterTypeWalletId = FfiConverterString ) } - fun `utxoDate`(`utxo`: Utxo): kotlin.String { - return FfiConverterString.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_types_fn_func_utxo_date( - - FfiConverterTypeUtxo.lower(`utxo`),_status) -} - ) - } - - fun `utxoHashToUint`(`utxo`: Utxo): kotlin.ULong { - return FfiConverterULong.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_types_fn_func_utxo_hash_to_uint( - - FfiConverterTypeUtxo.lower(`utxo`),_status) -} - ) - } - - fun `utxoIsEqual`(`lhs`: Utxo, `rhs`: Utxo): kotlin.Boolean { - return FfiConverterBoolean.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_types_fn_func_utxo_is_equal( - - FfiConverterTypeUtxo.lower(`lhs`),FfiConverterTypeUtxo.lower(`rhs`),_status) -} - ) - } - - fun `utxoName`(`utxo`: Utxo): kotlin.String { - return FfiConverterString.lift( - uniffiRustCall() { _status -> - UniffiLib.uniffi_cove_types_fn_func_utxo_name( - - FfiConverterTypeUtxo.lower(`utxo`),_status) -} - ) - } - diff --git a/ios/Cove.xcodeproj/project.pbxproj b/ios/Cove.xcodeproj/project.pbxproj index 877132fe1..34f76b38c 100644 --- a/ios/Cove.xcodeproj/project.pbxproj +++ b/ios/Cove.xcodeproj/project.pbxproj @@ -306,7 +306,7 @@ CODE_SIGN_ENTITLEMENTS = Cove/Cove.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 62; + CURRENT_PROJECT_VERSION = 64; DEVELOPMENT_ASSET_PATHS = "\"Cove/Preview Content\""; DEVELOPMENT_TEAM = Q8UP8C53Y8; ENABLE_APP_SANDBOX = YES; @@ -326,12 +326,12 @@ INFOPLIST_KEY_UILaunchScreen_Generation = NO; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; - IPHONEOS_DEPLOYMENT_TARGET = 18.0; + IPHONEOS_DEPLOYMENT_TARGET = 18.4; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.2.1; + MARKETING_VERSION = 1.3.0; NEW_SETTING = ""; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = org.bitcoinppl.cove; @@ -356,7 +356,7 @@ CODE_SIGN_ENTITLEMENTS = Cove/Cove.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 62; + CURRENT_PROJECT_VERSION = 64; DEVELOPMENT_ASSET_PATHS = "\"Cove/Preview Content\""; DEVELOPMENT_TEAM = Q8UP8C53Y8; ENABLE_APP_SANDBOX = YES; @@ -376,12 +376,12 @@ INFOPLIST_KEY_UILaunchScreen_Generation = NO; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; - IPHONEOS_DEPLOYMENT_TARGET = 18.0; + IPHONEOS_DEPLOYMENT_TARGET = 18.4; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.2.1; + MARKETING_VERSION = 1.3.0; NEW_SETTING = ""; OTHER_LDFLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = org.bitcoinppl.cove; diff --git a/ios/Cove/CoveApp.swift b/ios/Cove/CoveApp.swift index 10f3ddc27..30ab0d0e8 100644 --- a/ios/Cove/CoveApp.swift +++ b/ios/Cove/CoveApp.swift @@ -110,7 +110,7 @@ extension CoveApp { if !migrationDetected { let step = bootstrapProgress() - if step.isMigrationInProgress { + if step.isMigrationInProgress() { migrationDetected = true } else if let progress = activeMigration()?.progress(), progress.total > 0 { migrationDetected = true @@ -147,6 +147,12 @@ extension CoveApp { if step == .complete { Log.warn("[STARTUP] bootstrap completed despite error — treating as success") completeBootstrap() + } else if case AppInitError.DatabaseKeyMismatch = error { + Log.error("[STARTUP] database encryption key mismatch") + bootstrapError = + "Your app's encryption key doesn't match the database. " + + "This can happen after restoring from a backup or reinstalling.\n\n" + + "Please contact feedback@covebitcoinwallet.com for recovery assistance." } else if case AppInitError.AlreadyCalled = error { Log.error("[STARTUP] bootstrap already called at step: \(step)") bootstrapError = diff --git a/ios/Cove/Extention/ColorSchemeSelection+Ext.swift b/ios/Cove/Extention/ColorSchemeSelection+Ext.swift deleted file mode 100644 index d7ea45371..000000000 --- a/ios/Cove/Extention/ColorSchemeSelection+Ext.swift +++ /dev/null @@ -1,5 +0,0 @@ -extension ColorSchemeSelection { - var capitalizedString: String { - colorSchemeSelectionCapitalizedString(colorScheme: self) - } -} diff --git a/ios/Cove/Extention/Enum+Ext.swift b/ios/Cove/Extention/Enum+Ext.swift index 0f3426d57..94b7c512d 100644 --- a/ios/Cove/Extention/Enum+Ext.swift +++ b/ios/Cove/Extention/Enum+Ext.swift @@ -1,47 +1,20 @@ import Foundation -import SwiftUI extension Network: @retroactive CaseIterable {} -extension Network: @retroactive CustomStringConvertible {} extension Network: SettingsEnum { - public var description: String { - toString() - } - public static var allCases: [Network] { allNetworks() } - - func toString() -> String { - networkToString(network: self) - } } extension FiatCurrency: @retroactive CaseIterable {} -extension FiatCurrency: @retroactive CustomStringConvertible {} extension FiatCurrency: SettingsEnum { - public var description: String { - "\(emoji()) \(toString())" - } - public static var allCases: [FiatCurrency] { allFiatCurrencies() } - func toString() -> String { - fiatCurrencyToString(fiatCurrency: self) - } - - func symbol() -> String { - fiatCurrencySymbol(fiatCurrency: self) - } - - func emoji() -> String { - fiatCurrencyEmoji(fiatCurrency: self) - } - - func suffix() -> String { - fiatCurrencySuffix(fiatCurrency: self) + var displayName: String { + "\(emojiString()) \(description)" } } @@ -49,17 +22,9 @@ extension ColorSchemeSelection: @retroactive CaseIterable {} extension ColorSchemeSelection: @retroactive CustomStringConvertible {} extension ColorSchemeSelection: SettingsEnum { public var description: String { - colorSchemeSelectionCapitalizedString(colorScheme: self) + capitalizedString() } -// var symbol: String { -// switch self { -// case .light: return "sun.max.fill" -// case .dark: return "moon.stars.fill" -// case .system: return "circle.lefthalf.fill" -// } -// } - public static var allCases: [ColorSchemeSelection] { allColorSchemes() } diff --git a/ios/Cove/Extention/Error+Ext.swift b/ios/Cove/Extention/Error+Ext.swift index 920dac5b8..9d42c0121 100644 --- a/ios/Cove/Extention/Error+Ext.swift +++ b/ios/Cove/Extention/Error+Ext.swift @@ -10,13 +10,3 @@ extension TransportError { self = createTransportErrorFromCode(code: UInt16(code), message: message) } } - -extension TapSignerReaderError { - var isAuthError: Bool { - tapSignerErrorIsAuthError(error: self) - } - - var isNoBackupError: Bool { - tapSignerErrorIsNoBackupError(error: self) - } -} diff --git a/ios/Cove/Extention/NodeSelection+Ext.swift b/ios/Cove/Extention/NodeSelection+Ext.swift index b3341aa8f..242a1dc8b 100644 --- a/ios/Cove/Extention/NodeSelection+Ext.swift +++ b/ios/Cove/Extention/NodeSelection+Ext.swift @@ -8,15 +8,11 @@ import Foundation extension NodeSelection { - var node: Node { - nodeSelectionToNode(node: self) - } - var url: String { - node.url + toNode().url } var name: String { - node.name + toNode().name } } diff --git a/ios/Cove/Extention/Routes+Ext.swift b/ios/Cove/Extention/Routes+Ext.swift index 5f10cdd6d..56a2f885d 100644 --- a/ios/Cove/Extention/Routes+Ext.swift +++ b/ios/Cove/Extention/Routes+Ext.swift @@ -9,12 +9,11 @@ import Foundation extension Route: Equatable, Hashable { public static func == (lhs: Route, rhs: Route) -> Bool { - isRouteEqual(route: lhs, routeToCheck: rhs) + lhs.isEqual(routeToCheck: rhs) } public func hash(into hasher: inout Hasher) { - let hashed = hashRoute(route: self) - hasher.combine(hashed) + hasher.combine(self.stableHash()) } } diff --git a/ios/Cove/Extention/String+Ext.swift b/ios/Cove/Extention/String+Ext.swift index 289ca7004..b04e33cea 100644 --- a/ios/Cove/Extention/String+Ext.swift +++ b/ios/Cove/Extention/String+Ext.swift @@ -35,7 +35,7 @@ extension String { } init(_ network: Network) { - self = network.toString() + self = network.description } func removingLeadingZeros() -> String { diff --git a/ios/Cove/Extention/StringOrData+Ext.swift b/ios/Cove/Extention/StringOrData+Ext.swift index cd990531f..2bfbb8ad9 100644 --- a/ios/Cove/Extention/StringOrData+Ext.swift +++ b/ios/Cove/Extention/StringOrData+Ext.swift @@ -26,6 +26,6 @@ extension StringOrData { } func toMultiFormat() throws -> MultiFormat { - try stringOrDataTryIntoMultiFormat(stringOrData: self) + try tryIntoMultiFormat() } } diff --git a/ios/Cove/Extention/WalletAddressType+Ext.swift b/ios/Cove/Extention/WalletAddressType+Ext.swift index d65f2fc7d..7a72781ef 100644 --- a/ios/Cove/Extention/WalletAddressType+Ext.swift +++ b/ios/Cove/Extention/WalletAddressType+Ext.swift @@ -2,6 +2,6 @@ import Foundation extension WalletAddressType: Comparable { public static func < (lhs: WalletAddressType, rhs: WalletAddressType) -> Bool { - walletAddressTypeSortOrder(addressType: lhs) < walletAddressTypeSortOrder(addressType: rhs) + lhs.sortOrder() < rhs.sortOrder() } } diff --git a/ios/Cove/Extention/WalletMetadata+Ext.swift b/ios/Cove/Extention/WalletMetadata+Ext.swift index 8117c08c6..97cc6ad14 100644 --- a/ios/Cove/Extention/WalletMetadata+Ext.swift +++ b/ios/Cove/Extention/WalletMetadata+Ext.swift @@ -7,11 +7,11 @@ extension WalletMetadata: Identifiable & Hashable & Equatable { } public static func == (lhs: WalletMetadata, rhs: WalletMetadata) -> Bool { - walletMetadataIsEqual(lhs: lhs, rhs: rhs) + lhs.isEqual(other: rhs) } public func hash(into hasher: inout Hasher) { - hasher.combine(walletMetadataHash(metadata: self)) + hasher.combine(self.stableHash()) } #if DEBUG diff --git a/ios/Cove/Flows/CoinControlFlow/UtxoListScreen.swift b/ios/Cove/Flows/CoinControlFlow/UtxoListScreen.swift index 8cab9ddea..63acc8509 100644 --- a/ios/Cove/Flows/CoinControlFlow/UtxoListScreen.swift +++ b/ios/Cove/Flows/CoinControlFlow/UtxoListScreen.swift @@ -315,7 +315,7 @@ private struct UtxoRow: View { VStack(alignment: .leading, spacing: 4) { // Name HStack(spacing: 4) { - Text(utxo.name) + Text(utxo.name()) .font(.footnote) .truncationMode(.middle) .lineLimit(1) @@ -346,7 +346,7 @@ private struct UtxoRow: View { .font(.footnote) .fontWeight(.regular) - Text(utxo.date) + Text(utxo.date()) .font(.caption) .foregroundColor(.secondary) } diff --git a/ios/Cove/Flows/CoinControlFlow/UtxoRowPreview.swift b/ios/Cove/Flows/CoinControlFlow/UtxoRowPreview.swift index e0330017f..c6f7eaac1 100644 --- a/ios/Cove/Flows/CoinControlFlow/UtxoRowPreview.swift +++ b/ios/Cove/Flows/CoinControlFlow/UtxoRowPreview.swift @@ -23,7 +23,7 @@ struct UtxoRowPreview: View { Spacer() HStack(alignment: .center, spacing: 8) { - Text(utxo.name) + Text(utxo.name()) .foregroundColor(.primary) .font(.body) .fontWeight(.medium) @@ -40,7 +40,7 @@ struct UtxoRowPreview: View { HStack { Text(displayAmount(utxo.amount, true)) Spacer() - Text(utxo.date) + Text(utxo.date()) } .foregroundColor(.secondary) .font(.footnote) diff --git a/ios/Cove/Flows/SendFlow/Common/SendFlowUtxoCustomAmountSheetView.swift b/ios/Cove/Flows/SendFlow/Common/SendFlowUtxoCustomAmountSheetView.swift index 7e07075ac..1baf1fd96 100644 --- a/ios/Cove/Flows/SendFlow/Common/SendFlowUtxoCustomAmountSheetView.swift +++ b/ios/Cove/Flows/SendFlow/Common/SendFlowUtxoCustomAmountSheetView.swift @@ -268,7 +268,7 @@ private struct UtxoRow: View { VStack(alignment: .leading, spacing: 4) { // Name HStack(spacing: 4) { - Text(utxo.name) + Text(utxo.name()) .font(.footnote) .truncationMode(.middle) .lineLimit(1) @@ -298,7 +298,7 @@ private struct UtxoRow: View { .font(.footnote) .fontWeight(.regular) - Text(utxo.date) + Text(utxo.date()) .font(.caption) .foregroundColor(.secondary) } diff --git a/ios/Cove/Flows/SettingsFlow/SettingsPicker.swift b/ios/Cove/Flows/SettingsFlow/SettingsPicker.swift index 6cc645c14..042fba5c9 100644 --- a/ios/Cove/Flows/SettingsFlow/SettingsPicker.swift +++ b/ios/Cove/Flows/SettingsFlow/SettingsPicker.swift @@ -9,12 +9,17 @@ import SwiftUI protocol SettingsEnum: CustomStringConvertible & CaseIterable & Hashable { var symbol: String { get } + var displayName: String { get } } extension SettingsEnum { var symbol: String { "" } + + var displayName: String { + description + } } struct SettingsPicker: View where T.AllCases: RandomAccessCollection { @@ -28,7 +33,7 @@ struct SettingsPicker: View where T.AllCases: RandomAccessColle Image(systemName: item.symbol) } - Text(item.description) + Text(item.displayName) .font(.subheadline) Spacer() diff --git a/ios/Cove/Flows/SettingsFlow/WalletSettings/WalletSettingsView.swift b/ios/Cove/Flows/SettingsFlow/WalletSettings/WalletSettingsView.swift index 82b578e98..bf57ceedb 100644 --- a/ios/Cove/Flows/SettingsFlow/WalletSettings/WalletSettingsView.swift +++ b/ios/Cove/Flows/SettingsFlow/WalletSettings/WalletSettingsView.swift @@ -42,7 +42,7 @@ struct WalletSettingsView: View { HStack { Text("Network") Spacer() - Text(metadata.network.toString()) + Text(metadata.network.description) .foregroundColor(.secondary) } .font(.subheadline) diff --git a/ios/Cove/Flows/TapSignerFlow/TapSignerConfirmPinView.swift b/ios/Cove/Flows/TapSignerFlow/TapSignerConfirmPinView.swift index 91bac9bee..d29ad1a47 100644 --- a/ios/Cove/Flows/TapSignerFlow/TapSignerConfirmPinView.swift +++ b/ios/Cove/Flows/TapSignerFlow/TapSignerConfirmPinView.swift @@ -79,8 +79,8 @@ struct TapSignerConfirmPinView: View { ) ) case let .failure(error): - if error.isAuthError { return app.alertState = .init(.tapSignerInvalidAuth) } - if error.isNoBackupError { return app.alertState = .init(.tapSignerNoBackup(tapSigner: args.tapSigner)) } + if error.isAuthError() { return app.alertState = .init(.tapSignerInvalidAuth) } + if error.isNoBackupError() { return app.alertState = .init(.tapSignerNoBackup(tapSigner: args.tapSigner)) } app.alertState = .init(.general(title: "Error", message: error.description)) } } diff --git a/ios/Cove/Flows/TapSignerFlow/TapSignerEnterPinView.swift b/ios/Cove/Flows/TapSignerFlow/TapSignerEnterPinView.swift index 182ac9649..8cb120ec9 100644 --- a/ios/Cove/Flows/TapSignerFlow/TapSignerEnterPinView.swift +++ b/ios/Cove/Flows/TapSignerFlow/TapSignerEnterPinView.swift @@ -15,7 +15,7 @@ struct TapSignerEnterPin: View { let action: AfterPinAction var message: String { - action.userMessage + action.userMessage() } // private @@ -51,7 +51,7 @@ struct TapSignerEnterPin: View { case let .success(deriveInfo): manager.resetRoute(to: .importSuccess(tapSigner, deriveInfo)) case let .failure(error): - if error.isAuthError { + if error.isAuthError() { app.sheetState = nil app.alertState = .init(.tapSignerWrongPin(tapSigner: tapSigner, action: .derive)) } else { @@ -80,7 +80,7 @@ struct TapSignerEnterPin: View { } case let .failure(error): - if error.isAuthError { + if error.isAuthError() { app.sheetState = nil app.alertState = .init(.tapSignerWrongPin(tapSigner: tapSigner, action: .backup)) } else { @@ -125,7 +125,7 @@ struct TapSignerEnterPin: View { } } case let .failure(error): - if error.isAuthError { + if error.isAuthError() { app.sheetState = nil app.alertState = .init(.tapSignerWrongPin(tapSigner: tapSigner, action: .sign(psbt))) } else { diff --git a/ios/Cove/WalletManager.swift b/ios/Cove/WalletManager.swift index 42e5b8c76..6658e59dd 100644 --- a/ios/Cove/WalletManager.swift +++ b/ios/Cove/WalletManager.swift @@ -275,6 +275,6 @@ extension WeakReconciler: WalletManagerReconciler where Reconciler == WalletMana extension WalletLoadState: @retroactive Equatable { public static func == (lhs: WalletLoadState, rhs: WalletLoadState) -> Bool { - walletStateIsEqual(lhs: lhs, rhs: rhs) + lhs.isEqual(other: rhs) } } diff --git a/ios/CoveCore/Sources/CoveCore/CoveCore.swift b/ios/CoveCore/Sources/CoveCore/CoveCore.swift index 9b44f7098..47e00ca19 100644 --- a/ios/CoveCore/Sources/CoveCore/CoveCore.swift +++ b/ios/CoveCore/Sources/CoveCore/CoveCore.swift @@ -131,7 +131,7 @@ public extension SetupCmdResponse { extension TapSignerRoute: Equatable, Hashable { public static func == (lhs: TapSignerRoute, rhs: TapSignerRoute) -> Bool { - isTapSignerRouteEqual(lhs: lhs, rhs: rhs) + lhs.isEqual(other: rhs) } public func hash(into hasher: inout Hasher) { @@ -161,12 +161,6 @@ public extension TapSignerResponse { } } -public extension AfterPinAction { - var userMessage: String { - afterPinActionUserMessage(action: self) - } -} - extension AfterPinAction: @retroactive Equatable { public static func == (lhs: AfterPinAction, rhs: AfterPinAction) -> Bool { switch (lhs, rhs) { @@ -211,15 +205,9 @@ public extension WalletMetadata { } } -public extension HardwareWalletMetadata { - func isTapSigner() -> Bool { - hardwareWalletIsTapSigner(hardwareWallet: self) - } -} - extension SendFlowAlertState { init(_ addressError: AddressError, address: String) { - self = addressErrorToAlertState(error: addressError, address: address) + self = sendFlowAlertStateFromAddressError(error: addressError, address: address) } } @@ -229,14 +217,6 @@ extension Utxo: @retroactive Identifiable { public var id: OutPoint { self.outpoint } - - public var name: String { - utxoName(utxo: self) - } - - public var date: String { - utxoDate(utxo: self) - } } extension OutPoint: @retroactive Hashable, Equatable { @@ -251,12 +231,6 @@ extension OutPoint: @retroactive Hashable, Equatable { public extension CoinControlListSortKey { var title: String { - coinControlListSortKeyToString(key: self) - } -} - -public extension BootstrapStep { - var isMigrationInProgress: Bool { - bootstrapStepIsMigrationInProgress(step: self) + description } } diff --git a/ios/CoveCore/Sources/CoveCore/generated/cove.swift b/ios/CoveCore/Sources/CoveCore/generated/cove.swift index 75ef6955c..794ac3da0 100644 --- a/ios/CoveCore/Sources/CoveCore/generated/cove.swift +++ b/ios/CoveCore/Sources/CoveCore/generated/cove.swift @@ -13908,6 +13908,23 @@ public struct WalletMetadata: Equatable, Hashable { } +public func isEqual(other: WalletMetadata) -> Bool { + return try! FfiConverterBool.lift(try! rustCall() { + uniffi_cove_fn_method_walletmetadata_is_equal( + FfiConverterTypeWalletMetadata_lower(self), + FfiConverterTypeWalletMetadata_lower(other),$0 + ) +}) +} + +public func stableHash() -> UInt64 { + return try! FfiConverterUInt64.lift(try! rustCall() { + uniffi_cove_fn_method_walletmetadata_stablehash( + FfiConverterTypeWalletMetadata_lower(self),$0 + ) +}) +} + // The local Rust `Eq` implementation - only `eq` is used. @@ -14159,6 +14176,14 @@ public enum AfterPinAction { +public func userMessage() -> String { + return try! FfiConverterString.lift(try! rustCall() { + uniffi_cove_fn_method_afterpinaction_usermessage( + FfiConverterTypeAfterPinAction_lower(self),$0 + ) +}) +} + } @@ -15077,6 +15102,10 @@ public enum AppInitError: Swift.Error, Equatable, Hashable, Foundation.Localized case AlreadyCalled(message: String) + case DatabaseKeyMismatch(message: String) + + case DatabaseVerificationFailed(message: String) + @@ -15126,6 +15155,14 @@ public struct FfiConverterTypeAppInitError: FfiConverterRustBuffer { message: try FfiConverterString.read(from: &buf) ) + case 6: return .DatabaseKeyMismatch( + message: try FfiConverterString.read(from: &buf) + ) + + case 7: return .DatabaseVerificationFailed( + message: try FfiConverterString.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } @@ -15147,6 +15184,10 @@ public struct FfiConverterTypeAppInitError: FfiConverterRustBuffer { writeInt(&buf, Int32(4)) case .AlreadyCalled(_ /* message is ignored*/): writeInt(&buf, Int32(5)) + case .DatabaseKeyMismatch(_ /* message is ignored*/): + writeInt(&buf, Int32(6)) + case .DatabaseVerificationFailed(_ /* message is ignored*/): + writeInt(&buf, Int32(7)) } @@ -16297,6 +16338,14 @@ public enum BootstrapStep: Equatable, Hashable { +public func isMigrationInProgress() -> Bool { + return try! FfiConverterBool.lift(try! rustCall() { + uniffi_cove_fn_method_bootstrapstep_ismigrationinprogress( + FfiConverterTypeBootstrapStep_lower(self),$0 + ) +}) +} + } @@ -16854,7 +16903,7 @@ public func FfiConverterTypeCoinControlListSort_lower(_ value: CoinControlListSo // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. -public enum CoinControlListSortKey: Equatable, Hashable { +public enum CoinControlListSortKey: Equatable, Hashable, CustomStringConvertible { case date case name @@ -16865,6 +16914,16 @@ public enum CoinControlListSortKey: Equatable, Hashable { +// The local Rust `Display` implementation. +public var description: String { + return try! FfiConverterString.lift( + try! rustCall() { + uniffi_cove_fn_method_coincontrollistsortkey_uniffi_trait_display( + FfiConverterTypeCoinControlListSortKey_lower(self),$0 + ) +} + ) +} } #if compiler(>=6) @@ -18089,6 +18148,30 @@ public enum FiatCurrency: Equatable, Hashable, CustomStringConvertible { +public func emojiString() -> String { + return try! FfiConverterString.lift(try! rustCall() { + uniffi_cove_fn_method_fiatcurrency_emojistring( + FfiConverterTypeFiatCurrency_lower(self),$0 + ) +}) +} + +public func suffixString() -> String { + return try! FfiConverterString.lift(try! rustCall() { + uniffi_cove_fn_method_fiatcurrency_suffixstring( + FfiConverterTypeFiatCurrency_lower(self),$0 + ) +}) +} + +public func symbolString() -> String { + return try! FfiConverterString.lift(try! rustCall() { + uniffi_cove_fn_method_fiatcurrency_symbolstring( + FfiConverterTypeFiatCurrency_lower(self),$0 + ) +}) +} + // The local Rust `Display` implementation. @@ -18799,6 +18882,7 @@ public enum GlobalFlagKey: Equatable, Hashable { case completedOnboarding case acceptedTerms case betaFeaturesEnabled + case betaImportExportEnabled @@ -18826,6 +18910,8 @@ public struct FfiConverterTypeGlobalFlagKey: FfiConverterRustBuffer { case 3: return .betaFeaturesEnabled + case 4: return .betaImportExportEnabled + default: throw UniffiInternalError.unexpectedEnumCase } } @@ -18845,6 +18931,10 @@ public struct FfiConverterTypeGlobalFlagKey: FfiConverterRustBuffer { case .betaFeaturesEnabled: writeInt(&buf, Int32(3)) + + case .betaImportExportEnabled: + writeInt(&buf, Int32(4)) + } } } @@ -19055,6 +19145,14 @@ public enum HardwareWalletMetadata { +public func isTapSigner() -> Bool { + return try! FfiConverterBool.lift(try! rustCall() { + uniffi_cove_fn_method_hardwarewalletmetadata_istapsigner( + FfiConverterTypeHardwareWalletMetadata_lower(self),$0 + ) +}) +} + } @@ -20875,6 +20973,14 @@ public enum NodeSelection: Equatable, Hashable { +public func toNode() -> Node { + return try! FfiConverterTypeNode_lift(try! rustCall() { + uniffi_cove_fn_method_nodeselection_to_node( + FfiConverterTypeNodeSelection_lower(self),$0 + ) +}) +} + } @@ -21424,6 +21530,23 @@ public enum Route { +public func isEqual(routeToCheck: Route) -> Bool { + return try! FfiConverterBool.lift(try! rustCall() { + uniffi_cove_fn_method_route_is_equal( + FfiConverterTypeRoute_lower(self), + FfiConverterTypeRoute_lower(routeToCheck),$0 + ) +}) +} + +public func stableHash() -> UInt64 { + return try! FfiConverterUInt64.lift(try! rustCall() { + uniffi_cove_fn_method_route_stablehash( + FfiConverterTypeRoute_lower(self),$0 + ) +}) +} + } @@ -24198,7 +24321,7 @@ public func FfiConverterTypeStoreType_lower(_ value: StoreType) -> RustBuffer { * A string or data, could be a string or data (bytes) */ -public enum StringOrData: Equatable, Hashable { +public enum StringOrData { case string(String ) @@ -24207,6 +24330,14 @@ public enum StringOrData: Equatable, Hashable { +public func tryIntoMultiFormat()throws -> MultiFormat { + return try FfiConverterTypeMultiFormat_lift(try rustCallWithError(FfiConverterTypeMultiFormatError_lift) { + uniffi_cove_fn_method_stringordata_try_into_multi_format( + FfiConverterTypeStringOrData_lower(self),$0 + ) +}) +} + } @@ -24469,6 +24600,22 @@ public enum TapSignerReaderError: Swift.Error, Equatable, Hashable, Foundation.L ) +public func isAuthError() -> Bool { + return try! FfiConverterBool.lift(try! rustCall() { + uniffi_cove_fn_method_tapsignerreadererror_isautherror( + FfiConverterTypeTapSignerReaderError_lower(self),$0 + ) +}) +} + +public func isNoBackupError() -> Bool { + return try! FfiConverterBool.lift(try! rustCall() { + uniffi_cove_fn_method_tapsignerreadererror_isnobackuperror( + FfiConverterTypeTapSignerReaderError_lower(self),$0 + ) +}) +} + // The local Rust `Display` implementation. @@ -24738,6 +24885,15 @@ public enum TapSignerRoute { +public func isEqual(other: TapSignerRoute) -> Bool { + return try! FfiConverterBool.lift(try! rustCall() { + uniffi_cove_fn_method_tapsignerroute_is_equal( + FfiConverterTypeTapSignerRoute_lower(self), + FfiConverterTypeTapSignerRoute_lower(other),$0 + ) +}) +} + } @@ -25622,6 +25778,14 @@ public enum WalletAddressType: Equatable, Hashable, CustomStringConvertible { +public func sortOrder() -> UInt8 { + return try! FfiConverterUInt8.lift(try! rustCall() { + uniffi_cove_fn_method_walletaddresstype_sortorder( + FfiConverterTypeWalletAddressType_lower(self),$0 + ) +}) +} + // The local Rust `Display` implementation. @@ -26470,6 +26634,15 @@ public enum WalletLoadState { +public func isEqual(other: WalletLoadState) -> Bool { + return try! FfiConverterBool.lift(try! rustCall() { + uniffi_cove_fn_method_walletloadstate_is_equal( + FfiConverterTypeWalletLoadState_lower(self), + FfiConverterTypeWalletLoadState_lower(other),$0 + ) +}) +} + } @@ -30685,13 +30858,6 @@ public func bootstrapProgress() -> BootstrapStep { ) }) } -public func bootstrapStepIsMigrationInProgress(step: BootstrapStep) -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffi_cove_fn_func_bootstrap_step_is_migration_in_progress( - FfiConverterTypeBootstrapStep_lower(step),$0 - ) -}) -} /** * Signal the bootstrap to stop at the next cancellation check point, * typically called from the frontend watchdog when a timeout fires @@ -30723,34 +30889,6 @@ public func allFiatCurrencies() -> [FiatCurrency] { ) }) } -public func fiatCurrencyEmoji(fiatCurrency: FiatCurrency) -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffi_cove_fn_func_fiat_currency_emoji( - FfiConverterTypeFiatCurrency_lower(fiatCurrency),$0 - ) -}) -} -public func fiatCurrencySuffix(fiatCurrency: FiatCurrency) -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffi_cove_fn_func_fiat_currency_suffix( - FfiConverterTypeFiatCurrency_lower(fiatCurrency),$0 - ) -}) -} -public func fiatCurrencySymbol(fiatCurrency: FiatCurrency) -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffi_cove_fn_func_fiat_currency_symbol( - FfiConverterTypeFiatCurrency_lower(fiatCurrency),$0 - ) -}) -} -public func fiatCurrencyToString(fiatCurrency: FiatCurrency) -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffi_cove_fn_func_fiat_currency_to_string( - FfiConverterTypeFiatCurrency_lower(fiatCurrency),$0 - ) -}) -} public func isFiatCurrencySymbol(symbol: String) -> Bool { return try! FfiConverterBool.lift(try! rustCall() { uniffi_cove_fn_func_is_fiat_currency_symbol( @@ -30787,29 +30925,14 @@ public func updatePricesIfNeeded()async { ) } -public func coinControlListSortKeyToString(key: CoinControlListSortKey) -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffi_cove_fn_func_coin_control_list_sort_key_to_string( - FfiConverterTypeCoinControlListSortKey_lower(key),$0 - ) -}) -} -public func addressErrorToAlertState(error: AddressError, address: String) -> SendFlowAlertState { +public func sendFlowAlertStateFromAddressError(error: AddressError, address: String) -> SendFlowAlertState { return try! FfiConverterTypeSendFlowAlertState_lift(try! rustCall() { - uniffi_cove_fn_func_address_error_to_alert_state( + uniffi_cove_fn_func_send_flow_alert_state_from_address_error( FfiConverterTypeAddressError_lower(error), FfiConverterString.lower(address),$0 ) }) } -public func walletStateIsEqual(lhs: WalletLoadState, rhs: WalletLoadState) -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffi_cove_fn_func_wallet_state_is_equal( - FfiConverterTypeWalletLoadState_lower(lhs), - FfiConverterTypeWalletLoadState_lower(rhs),$0 - ) -}) -} public func groupedPlainWordsOf(mnemonic: String, groups: UInt8)throws -> [[String]] { return try FfiConverterSequenceSequenceString.lift(try rustCallWithError(FfiConverterTypeMnemonicParseError_lift) { uniffi_cove_fn_func_grouped_plain_words_of( @@ -30840,56 +30963,12 @@ public func multiFormatTryFromNfcMessage(nfcMessage: NfcMessage)throws -> Multi ) }) } -public func stringOrDataTryIntoMultiFormat(stringOrData: StringOrData)throws -> MultiFormat { - return try FfiConverterTypeMultiFormat_lift(try rustCallWithError(FfiConverterTypeMultiFormatError_lift) { - uniffi_cove_fn_func_string_or_data_try_into_multi_format( - FfiConverterTypeStringOrData_lower(stringOrData),$0 - ) -}) -} public func defaultNodeSelection() -> NodeSelection { return try! FfiConverterTypeNodeSelection_lift(try! rustCall() { uniffi_cove_fn_func_default_node_selection($0 ) }) } -public func nodeSelectionToNode(node: NodeSelection) -> Node { - return try! FfiConverterTypeNode_lift(try! rustCall() { - uniffi_cove_fn_func_node_selection_to_node( - FfiConverterTypeNodeSelection_lower(node),$0 - ) -}) -} -public func afterPinActionUserMessage(action: AfterPinAction) -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffi_cove_fn_func_after_pin_action_user_message( - FfiConverterTypeAfterPinAction_lower(action),$0 - ) -}) -} -public func hashRoute(route: Route) -> UInt64 { - return try! FfiConverterUInt64.lift(try! rustCall() { - uniffi_cove_fn_func_hash_route( - FfiConverterTypeRoute_lower(route),$0 - ) -}) -} -public func isRouteEqual(route: Route, routeToCheck: Route) -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffi_cove_fn_func_is_route_equal( - FfiConverterTypeRoute_lower(route), - FfiConverterTypeRoute_lower(routeToCheck),$0 - ) -}) -} -public func isTapSignerRouteEqual(lhs: TapSignerRoute, rhs: TapSignerRoute) -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffi_cove_fn_func_is_tap_signer_route_equal( - FfiConverterTypeTapSignerRoute_lower(lhs), - FfiConverterTypeTapSignerRoute_lower(rhs),$0 - ) -}) -} public func tapSignerConfirmPinArgsNewFromNewPin(args: TapSignerNewPinArgs, newPin: String) -> TapSignerConfirmPinArgs { return try! FfiConverterTypeTapSignerConfirmPinArgs_lift(try! rustCall() { uniffi_cove_fn_func_tap_signer_confirm_pin_args_new_from_new_pin( @@ -30898,32 +30977,23 @@ public func tapSignerConfirmPinArgsNewFromNewPin(args: TapSignerNewPinArgs, newP ) }) } -/** - * Parse from raw bytes - */ public func signedTransactionOrPsbtTryFromBytes(data: Data)throws -> SignedTransactionOrPsbt { return try FfiConverterTypeSignedTransactionOrPsbt_lift(try rustCallWithError(FfiConverterTypeSignedImportError_lift) { - uniffi_cove_fn_func_signedtransactionorpsbttryfrombytes( + uniffi_cove_fn_func_signed_transaction_or_psbt_try_from_bytes( FfiConverterData.lower(data),$0 ) }) } -/** - * Parse from an NFC message - */ public func signedTransactionOrPsbtTryFromNfcMessage(nfcMessage: NfcMessage)throws -> SignedTransactionOrPsbt { return try FfiConverterTypeSignedTransactionOrPsbt_lift(try rustCallWithError(FfiConverterTypeSignedImportError_lift) { - uniffi_cove_fn_func_signedtransactionorpsbttryfromnfcmessage( + uniffi_cove_fn_func_signed_transaction_or_psbt_try_from_nfc_message( FfiConverterTypeNfcMessage_lower(nfcMessage),$0 ) }) } -/** - * Parse from string input (base64 or hex encoded) - */ public func signedTransactionOrPsbtTryParse(input: String)throws -> SignedTransactionOrPsbt { return try FfiConverterTypeSignedTransactionOrPsbt_lift(try rustCallWithError(FfiConverterTypeSignedImportError_lift) { - uniffi_cove_fn_func_signedtransactionorpsbttryparse( + uniffi_cove_fn_func_signed_transaction_or_psbt_try_parse( FfiConverterString.lower(input),$0 ) }) @@ -30962,20 +31032,6 @@ public func createTapSignerReader(transport: TapcardTransportProtocol, cmd: TapS errorHandler: FfiConverterTypeTapSignerReaderError_lift ) } -public func tapSignerErrorIsAuthError(error: TapSignerReaderError) -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffi_cove_fn_func_tapsignererrorisautherror( - FfiConverterTypeTapSignerReaderError_lower(error),$0 - ) -}) -} -public func tapSignerErrorIsNoBackupError(error: TapSignerReaderError) -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffi_cove_fn_func_tapsignererrorisnobackuperror( - FfiConverterTypeTapSignerReaderError_lower(error),$0 - ) -}) -} public func tapSignerResponseBackupResponse(response: TapSignerResponse) -> Data? { return try! FfiConverterOptionData.lift(try! rustCall() { uniffi_cove_fn_func_tapsignerresponsebackupresponse( @@ -31045,13 +31101,6 @@ public func transactionsPreviewNew(confirmed: UInt8, unconfirmed: UInt8) -> [Tra ) }) } -public func walletAddressTypeSortOrder(addressType: WalletAddressType) -> UInt8 { - return try! FfiConverterUInt8.lift(try! rustCall() { - uniffi_cove_fn_func_wallet_address_type_sort_order( - FfiConverterTypeWalletAddressType_lower(addressType),$0 - ) -}) -} public func ffiMinSendAmount() -> Amount { return try! FfiConverterTypeAmount_lift(try! rustCall() { uniffi_cove_fn_func_ffi_min_send_amount($0 @@ -31082,28 +31131,6 @@ public func defaultWalletColors() -> [WalletColor] { ) }) } -public func hardwareWalletIsTapSigner(hardwareWallet: HardwareWalletMetadata) -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffi_cove_fn_func_hardware_wallet_is_tap_signer( - FfiConverterTypeHardwareWalletMetadata_lower(hardwareWallet),$0 - ) -}) -} -public func walletMetadataHash(metadata: WalletMetadata) -> UInt64 { - return try! FfiConverterUInt64.lift(try! rustCall() { - uniffi_cove_fn_func_wallet_metadata_hash( - FfiConverterTypeWalletMetadata_lower(metadata),$0 - ) -}) -} -public func walletMetadataIsEqual(lhs: WalletMetadata, rhs: WalletMetadata) -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffi_cove_fn_func_wallet_metadata_is_equal( - FfiConverterTypeWalletMetadata_lower(lhs), - FfiConverterTypeWalletMetadata_lower(rhs),$0 - ) -}) -} public func walletMetadataPreview() -> WalletMetadata { return try! FfiConverterTypeWalletMetadata_lift(try! rustCall() { uniffi_cove_fn_func_wallet_metadata_preview($0 @@ -31135,9 +31162,6 @@ private let initializationResult: InitializationResult = { if (uniffi_cove_checksum_func_bootstrap_progress() != 47242) { return InitializationResult.apiChecksumMismatch } - if (uniffi_cove_checksum_func_bootstrap_step_is_migration_in_progress() != 43717) { - return InitializationResult.apiChecksumMismatch - } if (uniffi_cove_checksum_func_cancel_bootstrap() != 59164) { return InitializationResult.apiChecksumMismatch } @@ -31147,18 +31171,6 @@ private let initializationResult: InitializationResult = { if (uniffi_cove_checksum_func_all_fiat_currencies() != 53482) { return InitializationResult.apiChecksumMismatch } - if (uniffi_cove_checksum_func_fiat_currency_emoji() != 42864) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_cove_checksum_func_fiat_currency_suffix() != 43766) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_cove_checksum_func_fiat_currency_symbol() != 15961) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_cove_checksum_func_fiat_currency_to_string() != 47206) { - return InitializationResult.apiChecksumMismatch - } if (uniffi_cove_checksum_func_is_fiat_currency_symbol() != 60129) { return InitializationResult.apiChecksumMismatch } @@ -31171,13 +31183,7 @@ private let initializationResult: InitializationResult = { if (uniffi_cove_checksum_func_updatepricesifneeded() != 5753) { return InitializationResult.apiChecksumMismatch } - if (uniffi_cove_checksum_func_coin_control_list_sort_key_to_string() != 15603) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_cove_checksum_func_address_error_to_alert_state() != 44369) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_cove_checksum_func_wallet_state_is_equal() != 22901) { + if (uniffi_cove_checksum_func_send_flow_alert_state_from_address_error() != 25696) { return InitializationResult.apiChecksumMismatch } if (uniffi_cove_checksum_func_grouped_plain_words_of() != 51957) { @@ -31192,37 +31198,19 @@ private let initializationResult: InitializationResult = { if (uniffi_cove_checksum_func_multi_format_try_from_nfc_message() != 63598) { return InitializationResult.apiChecksumMismatch } - if (uniffi_cove_checksum_func_string_or_data_try_into_multi_format() != 10759) { - return InitializationResult.apiChecksumMismatch - } if (uniffi_cove_checksum_func_default_node_selection() != 32212) { return InitializationResult.apiChecksumMismatch } - if (uniffi_cove_checksum_func_node_selection_to_node() != 13406) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_cove_checksum_func_after_pin_action_user_message() != 30105) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_cove_checksum_func_hash_route() != 38756) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_cove_checksum_func_is_route_equal() != 13176) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_cove_checksum_func_is_tap_signer_route_equal() != 21746) { - return InitializationResult.apiChecksumMismatch - } if (uniffi_cove_checksum_func_tap_signer_confirm_pin_args_new_from_new_pin() != 4888) { return InitializationResult.apiChecksumMismatch } - if (uniffi_cove_checksum_func_signedtransactionorpsbttryfrombytes() != 36882) { + if (uniffi_cove_checksum_func_signed_transaction_or_psbt_try_from_bytes() != 29004) { return InitializationResult.apiChecksumMismatch } - if (uniffi_cove_checksum_func_signedtransactionorpsbttryfromnfcmessage() != 49359) { + if (uniffi_cove_checksum_func_signed_transaction_or_psbt_try_from_nfc_message() != 64085) { return InitializationResult.apiChecksumMismatch } - if (uniffi_cove_checksum_func_signedtransactionorpsbttryparse() != 7350) { + if (uniffi_cove_checksum_func_signed_transaction_or_psbt_try_parse() != 50770) { return InitializationResult.apiChecksumMismatch } if (uniffi_cove_checksum_func_create_transport_error_from_code() != 12205) { @@ -31234,12 +31222,6 @@ private let initializationResult: InitializationResult = { if (uniffi_cove_checksum_func_create_tap_signer_reader() != 39823) { return InitializationResult.apiChecksumMismatch } - if (uniffi_cove_checksum_func_tapsignererrorisautherror() != 54484) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_cove_checksum_func_tapsignererrorisnobackuperror() != 36431) { - return InitializationResult.apiChecksumMismatch - } if (uniffi_cove_checksum_func_tapsignerresponsebackupresponse() != 56452) { return InitializationResult.apiChecksumMismatch } @@ -31270,9 +31252,6 @@ private let initializationResult: InitializationResult = { if (uniffi_cove_checksum_func_transactions_preview_new() != 59467) { return InitializationResult.apiChecksumMismatch } - if (uniffi_cove_checksum_func_wallet_address_type_sort_order() != 21818) { - return InitializationResult.apiChecksumMismatch - } if (uniffi_cove_checksum_func_ffi_min_send_amount() != 61138) { return InitializationResult.apiChecksumMismatch } @@ -31288,15 +31267,6 @@ private let initializationResult: InitializationResult = { if (uniffi_cove_checksum_func_default_wallet_colors() != 11354) { return InitializationResult.apiChecksumMismatch } - if (uniffi_cove_checksum_func_hardware_wallet_is_tap_signer() != 49430) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_cove_checksum_func_wallet_metadata_hash() != 36015) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_cove_checksum_func_wallet_metadata_is_equal() != 16249) { - return InitializationResult.apiChecksumMismatch - } if (uniffi_cove_checksum_func_wallet_metadata_preview() != 44605) { return InitializationResult.apiChecksumMismatch } diff --git a/ios/CoveCore/Sources/CoveCore/generated/cove_types.swift b/ios/CoveCore/Sources/CoveCore/generated/cove_types.swift index 8a56fc406..27934ccf0 100644 --- a/ios/CoveCore/Sources/CoveCore/generated/cove_types.swift +++ b/ios/CoveCore/Sources/CoveCore/generated/cove_types.swift @@ -4478,6 +4478,39 @@ public struct Utxo: Equatable, Hashable { } +public func date() -> String { + return try! FfiConverterString.lift(try! rustCall() { + uniffi_cove_types_fn_method_utxo_date( + FfiConverterTypeUtxo_lower(self),$0 + ) +}) +} + +public func hashToUint() -> UInt64 { + return try! FfiConverterUInt64.lift(try! rustCall() { + uniffi_cove_types_fn_method_utxo_hash_to_uint( + FfiConverterTypeUtxo_lower(self),$0 + ) +}) +} + +public func isEqual(other: Utxo) -> Bool { + return try! FfiConverterBool.lift(try! rustCall() { + uniffi_cove_types_fn_method_utxo_is_equal( + FfiConverterTypeUtxo_lower(self), + FfiConverterTypeUtxo_lower(other),$0 + ) +}) +} + +public func name() -> String { + return try! FfiConverterString.lift(try! rustCall() { + uniffi_cove_types_fn_method_utxo_name( + FfiConverterTypeUtxo_lower(self),$0 + ) +}) +} + // The local Rust `Eq` implementation - only `eq` is used. @@ -4751,6 +4784,14 @@ public enum ColorSchemeSelection: Equatable, Hashable { +public func capitalizedString() -> String { + return try! FfiConverterString.lift(try! rustCall() { + uniffi_cove_types_fn_method_colorschemeselection_capitalized_string( + FfiConverterTypeColorSchemeSelection_lower(self),$0 + ) +}) +} + } @@ -5994,13 +6035,6 @@ public func allColorSchemes() -> [ColorSchemeSelection] { ) }) } -public func colorSchemeSelectionCapitalizedString(colorScheme: ColorSchemeSelection) -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffi_cove_types_fn_func_color_scheme_selection_capitalized_string( - FfiConverterTypeColorSchemeSelection_lower(colorScheme),$0 - ) -}) -} /** * Preview `ConfirmDetails` for `SwiftUI` previews */ @@ -6077,35 +6111,6 @@ public func previewNewUtxoList(outputCount: UInt8, changeCount: UInt8) -> [Utxo] ) }) } -public func utxoDate(utxo: Utxo) -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffi_cove_types_fn_func_utxo_date( - FfiConverterTypeUtxo_lower(utxo),$0 - ) -}) -} -public func utxoHashToUint(utxo: Utxo) -> UInt64 { - return try! FfiConverterUInt64.lift(try! rustCall() { - uniffi_cove_types_fn_func_utxo_hash_to_uint( - FfiConverterTypeUtxo_lower(utxo),$0 - ) -}) -} -public func utxoIsEqual(lhs: Utxo, rhs: Utxo) -> Bool { - return try! FfiConverterBool.lift(try! rustCall() { - uniffi_cove_types_fn_func_utxo_is_equal( - FfiConverterTypeUtxo_lower(lhs), - FfiConverterTypeUtxo_lower(rhs),$0 - ) -}) -} -public func utxoName(utxo: Utxo) -> String { - return try! FfiConverterString.lift(try! rustCall() { - uniffi_cove_types_fn_func_utxo_name( - FfiConverterTypeUtxo_lower(utxo),$0 - ) -}) -} private enum InitializationResult { case ok @@ -6134,9 +6139,6 @@ private let initializationResult: InitializationResult = { if (uniffi_cove_types_checksum_func_all_color_schemes() != 49693) { return InitializationResult.apiChecksumMismatch } - if (uniffi_cove_types_checksum_func_color_scheme_selection_capitalized_string() != 30731) { - return InitializationResult.apiChecksumMismatch - } if (uniffi_cove_types_checksum_func_confirm_details_preview_new() != 41030) { return InitializationResult.apiChecksumMismatch } @@ -6167,18 +6169,6 @@ private let initializationResult: InitializationResult = { if (uniffi_cove_types_checksum_func_previewnewutxolist() != 31621) { return InitializationResult.apiChecksumMismatch } - if (uniffi_cove_types_checksum_func_utxo_date() != 26239) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_cove_types_checksum_func_utxo_hash_to_uint() != 33471) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_cove_types_checksum_func_utxo_is_equal() != 34078) { - return InitializationResult.apiChecksumMismatch - } - if (uniffi_cove_types_checksum_func_utxo_name() != 48729) { - return InitializationResult.apiChecksumMismatch - } if (uniffi_cove_types_checksum_method_address_hashtouint() != 25307) { return InitializationResult.apiChecksumMismatch } diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 015ae38e2..96198f76d 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -981,7 +981,7 @@ dependencies = [ [[package]] name = "cove" -version = "1.2.1" +version = "1.3.0" dependencies = [ "act-zero", "act-zero-ext", @@ -1116,6 +1116,7 @@ dependencies = [ "rand 0.10.0", "sha2", "thiserror 2.0.18", + "tracing", "zeroize", ] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 78ae4478b..ccba5cee1 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cove" -version = "1.2.1" +version = "1.3.0" edition = "2024" [lib] diff --git a/rust/crates/cove-cspp/Cargo.toml b/rust/crates/cove-cspp/Cargo.toml index ca11cf4d3..7935fa1a1 100644 --- a/rust/crates/cove-cspp/Cargo.toml +++ b/rust/crates/cove-cspp/Cargo.toml @@ -13,3 +13,4 @@ rand = { workspace = true } zeroize = { workspace = true, features = ["derive"] } hex = { workspace = true } thiserror = { workspace = true } +tracing = { workspace = true } diff --git a/rust/crates/cove-cspp/src/cspp.rs b/rust/crates/cove-cspp/src/cspp.rs index 39735368b..11c972262 100644 --- a/rust/crates/cove-cspp/src/cspp.rs +++ b/rust/crates/cove-cspp/src/cspp.rs @@ -1,5 +1,6 @@ use cove_util::ResultExt as _; use std::sync::{Arc, LazyLock, Mutex}; +use tracing::{info, warn}; use arc_swap::ArcSwapOption; use cove_util::encryption::Cryptor; @@ -43,11 +44,13 @@ impl Cspp { // try loading from store if let Some(key) = self.get_master_key()? { + info!("Master key loaded from keychain"); MASTER_KEY_CACHE.store(Some(Arc::new(Zeroizing::new(*key.as_bytes())))); return Ok(key); } // generate and save new key + warn!("Master key not found in keychain, generating new key"); let key = MasterKey::generate(); self.save_master_key(&key)?; MASTER_KEY_CACHE.store(Some(Arc::new(Zeroizing::new(*key.as_bytes())))); @@ -93,11 +96,20 @@ impl Cspp { /// Loads the master key, returns None if not found fn get_master_key(&self) -> Result, CsppError> { - let Some(encryption_secret) = self.0.get(MASTER_KEY_ENCRYPTION_KEY_AND_NONCE.into()) else { + let has_encryption_key = self.0.get(MASTER_KEY_ENCRYPTION_KEY_AND_NONCE.into()); + let has_master_key = self.0.get(MASTER_KEY_NAME.into()); + + info!( + encryption_key_found = has_encryption_key.is_some(), + master_key_found = has_master_key.is_some(), + "Keychain master key lookup" + ); + + let Some(encryption_secret) = has_encryption_key else { return Ok(None); }; - let Some(encrypted) = self.0.get(MASTER_KEY_NAME.into()) else { + let Some(encrypted) = has_master_key else { return Ok(None); }; diff --git a/rust/crates/cove-types/src/color_scheme.rs b/rust/crates/cove-types/src/color_scheme.rs index dddcc6371..51b374377 100644 --- a/rust/crates/cove-types/src/color_scheme.rs +++ b/rust/crates/cove-types/src/color_scheme.rs @@ -84,6 +84,8 @@ fn all_color_schemes() -> Vec { } #[uniffi::export] -fn color_scheme_selection_capitalized_string(color_scheme: ColorSchemeSelection) -> String { - color_scheme.as_capitalized_string().to_string() +impl ColorSchemeSelection { + fn capitalized_string(&self) -> String { + self.as_capitalized_string().to_string() + } } diff --git a/rust/crates/cove-types/src/utxo.rs b/rust/crates/cove-types/src/utxo.rs index 2bcc80939..abe3a44c9 100644 --- a/rust/crates/cove-types/src/utxo.rs +++ b/rust/crates/cove-types/src/utxo.rs @@ -162,30 +162,30 @@ impl From for UtxoType { // MARK: FFI #[uniffi::export] -fn utxo_name(utxo: &Utxo) -> String { - utxo.name().to_string() -} +impl Utxo { + #[uniffi::method(name = "name")] + fn ffi_name(&self) -> String { + self.name().to_string() + } -#[uniffi::export] -#[allow(clippy::cast_possible_wrap)] // datetime is always valid timestamp -fn utxo_date(utxo: &Utxo) -> String { - let Ok(timestamp) = jiff::Timestamp::from_second(utxo.datetime as i64) else { - return String::new(); - }; + #[allow(clippy::cast_possible_wrap)] + fn date(&self) -> String { + let Ok(timestamp) = jiff::Timestamp::from_second(self.datetime as i64) else { + return String::new(); + }; - timestamp.strftime("%b %d, %Y").to_string() -} + timestamp.strftime("%b %d, %Y").to_string() + } -#[uniffi::export] -fn utxo_hash_to_uint(utxo: &Utxo) -> u64 { - let mut hasher = std::hash::DefaultHasher::new(); - utxo.hash(&mut hasher); - hasher.finish() -} + fn hash_to_uint(&self) -> u64 { + let mut hasher = std::hash::DefaultHasher::new(); + self.hash(&mut hasher); + hasher.finish() + } -#[uniffi::export] -fn utxo_is_equal(lhs: &Utxo, rhs: &Utxo) -> bool { - lhs == rhs + fn is_equal(&self, other: &Utxo) -> bool { + self == other + } } // MARK: FFI PREVIEW diff --git a/rust/src/bootstrap.rs b/rust/src/bootstrap.rs index d85beeb8d..6dc380c0d 100644 --- a/rust/src/bootstrap.rs +++ b/rust/src/bootstrap.rs @@ -39,8 +39,11 @@ impl BootstrapStep { } #[uniffi::export] -fn bootstrap_step_is_migration_in_progress(step: BootstrapStep) -> bool { - step.is_migration_in_progress() +impl BootstrapStep { + #[uniffi::method(name = "isMigrationInProgress")] + fn ffi_is_migration_in_progress(&self) -> bool { + self.is_migration_in_progress() + } } static BOOTSTRAP_STEP: Mutex = Mutex::new(BootstrapStep::NotStarted); @@ -185,6 +188,12 @@ pub enum AppInitError { #[error("Bootstrap already called: {0}")] AlreadyCalled(String), + + #[error("Database encryption key mismatch (backup/restore?): {0}")] + DatabaseKeyMismatch(String), + + #[error("Database verification failed: {0}")] + DatabaseVerificationFailed(String), } /// Idempotent storage bootstrap: derives encryption key and runs all pending @@ -235,6 +244,11 @@ fn do_bootstrap(track_progress: bool) -> Result { } info!("Encryption key derived and set"); + // verify the key matches the existing database before proceeding + let db_path = cove_common::consts::ROOT_DATA_DIR.join("cove.db"); + crate::database::encrypted_backend::verify_database_key(&db_path) + .map_err(map_database_key_verification_error)?; + check_cancelled()?; // recover interrupted redb migrations before proceeding @@ -289,6 +303,17 @@ fn do_bootstrap(track_progress: bool) -> Result { Ok(bdk_count) } +fn map_database_key_verification_error( + error: crate::database::error::DatabaseError, +) -> AppInitError { + match error { + crate::database::error::DatabaseError::HeaderIntegrity { error, .. } => { + AppInitError::DatabaseKeyMismatch(error) + } + other => AppInitError::DatabaseVerificationFailed(other.to_string()), + } +} + /// Pre-seed the bootstrap OnceLock with a test encryption key, skipping /// keychain access and migrations #[cfg(test)] @@ -313,3 +338,37 @@ fn set_step(step: BootstrapStep) { pub fn bootstrap_progress() -> BootstrapStep { *BOOTSTRAP_STEP.lock() } + +#[cfg(test)] +mod tests { + use super::*; + use crate::database::error::DatabaseError; + + #[test] + fn database_key_verification_maps_header_integrity_to_key_mismatch() { + let error = DatabaseError::HeaderIntegrity { + path: "/tmp/cove.db".into(), + error: "wrong key".into(), + }; + + let mapped = map_database_key_verification_error(error); + assert!( + matches!(mapped, AppInitError::DatabaseKeyMismatch(message) if message == "wrong key") + ); + } + + #[test] + fn database_key_verification_preserves_non_mismatch_failures() { + let error = DatabaseError::BackendOpen { + path: "/tmp/cove.db".into(), + error: "permission denied".into(), + }; + + let mapped = map_database_key_verification_error(error); + assert!(matches!( + mapped, + AppInitError::DatabaseVerificationFailed(message) + if message == "failed to open encrypted backend at /tmp/cove.db: permission denied" + )); + } +} diff --git a/rust/src/database/encrypted_backend.rs b/rust/src/database/encrypted_backend.rs index 2ade0b3b7..5519b6acf 100644 --- a/rust/src/database/encrypted_backend.rs +++ b/rust/src/database/encrypted_backend.rs @@ -17,6 +17,7 @@ const TAG_LEN: usize = 16; const DISK_BLOCK_SIZE: usize = NONCE_LEN + BLOCK_SIZE + TAG_LEN; // 4136 const HEADER_SIZE: usize = 64; const MAGIC: &[u8; 4] = b"COVE"; +const VERSION_V1: u8 = 1; const VERSION_V2: u8 = 2; const CURRENT_VERSION: u8 = VERSION_V2; @@ -117,6 +118,78 @@ fn verify_header_tag(key: &[u8; 32], header: &[u8; HEADER_SIZE]) -> io::Result<( Ok(()) } +fn decrypt_disk_block( + cipher: &XChaCha20Poly1305, + block_index: u64, + disk_data: &[u8], +) -> io::Result> { + if disk_data.len() < NONCE_LEN + TAG_LEN { + return Err(io::Error::new( + io::ErrorKind::InvalidData, + "disk block too small to contain nonce + tag", + )); + } + + let nonce = XNonce::from_slice(&disk_data[..NONCE_LEN]); + let ciphertext_with_tag = &disk_data[NONCE_LEN..]; + let aad = block_index.to_le_bytes(); + + cipher + .decrypt(nonce, Payload { msg: ciphertext_with_tag, aad: &aad }) + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, format!("decryption failed: {e}"))) +} + +fn verify_v1_database_key( + file: &File, + path: &str, + key: &[u8; 32], +) -> Result<(), super::error::DatabaseError> { + use super::error::DatabaseError; + + let file_len = file + .metadata() + .map_err(|e| DatabaseError::BackendOpen { path: path.to_string(), error: e.to_string() })? + .len(); + + if file_len <= HEADER_SIZE as u64 { + return Ok(()); + } + + let payload_len = file_len - HEADER_SIZE as u64; + let trailing_bytes = payload_len % DISK_BLOCK_SIZE as u64; + if trailing_bytes != 0 { + return Err(DatabaseError::CorruptBlock { + path: path.to_string(), + error: format!("encrypted database payload has partial block bytes: {trailing_bytes}"), + }); + } + + let cipher = XChaCha20Poly1305::new(key.into()); + + for block_index in 0..(payload_len / DISK_BLOCK_SIZE as u64) { + let physical_offset = HEADER_SIZE as u64 + block_index * DISK_BLOCK_SIZE as u64; + let mut disk_block = vec![0u8; DISK_BLOCK_SIZE]; + file.read_exact_at(&mut disk_block, physical_offset).map_err(|e| { + DatabaseError::BackendOpen { path: path.to_string(), error: e.to_string() } + })?; + + if disk_block.iter().all(|&b| b == 0) { + continue; + } + + decrypt_disk_block(&cipher, block_index, &disk_block).map_err(|e| { + DatabaseError::HeaderIntegrity { + path: path.to_string(), + error: format!("v1 database key verification failed: {e}"), + } + })?; + + return Ok(()); + } + + Ok(()) +} + impl EncryptedBackend { /// Create a new encrypted database file at `path` pub fn create(path: impl AsRef, key: &[u8; 32]) -> io::Result { @@ -155,6 +228,16 @@ impl EncryptedBackend { VERSION_V2 => { verify_header_tag(key, &header)?; } + VERSION_V1 => { + // upgrade V1 header in-place: add HMAC tag and bump version + let mut upgraded = header; + upgraded[VERSION_OFFSET] = VERSION_V2; + let tag = compute_header_tag(key, &upgraded); + upgraded[HEADER_TAG_OFFSET..HEADER_TAG_OFFSET + HEADER_TAG_LEN] + .copy_from_slice(&tag); + file.write_all_at(&upgraded, 0)?; + file.sync_all()?; + } v => { return Err(io::Error::new( io::ErrorKind::InvalidData, @@ -208,6 +291,48 @@ impl EncryptedBackend { } } +/// Verify the encryption key matches an existing database without fully opening it. +/// Returns Ok(()) if the key is valid or the file doesn't exist. +/// Returns Err(HeaderIntegrity) on key mismatch +pub fn verify_database_key(path: &Path) -> Result<(), super::error::DatabaseError> { + use super::error::DatabaseError; + + if !path.exists() { + return Ok(()); + } + + let path_str = path.display().to_string(); + let key = encryption_key().ok_or(DatabaseError::EncryptionKeyNotSet)?; + + let file = File::open(path) + .map_err(|e| DatabaseError::BackendOpen { path: path_str.clone(), error: e.to_string() })?; + + let header = read_header(&file) + .map_err(|e| DatabaseError::BackendOpen { path: path_str.clone(), error: e.to_string() })?; + + validate_header_magic(&header) + .map_err(|e| DatabaseError::BackendOpen { path: path_str.clone(), error: e.to_string() })?; + + let version = header[VERSION_OFFSET]; + match version { + VERSION_V2 => { + verify_header_tag(key, &header).map_err(|e| DatabaseError::HeaderIntegrity { + path: path_str, + error: e.to_string(), + })?; + } + VERSION_V1 => verify_v1_database_key(&file, &path_str, key)?, + version => { + return Err(DatabaseError::HeaderIntegrity { + path: path_str, + error: format!("unsupported encrypted database version: {version}"), + }); + } + } + + Ok(()) +} + /// Open or create a redb database at the given path, handling 3 cases: /// - File doesn't exist → create encrypted /// - File exists + encrypted → open with EncryptedBackend @@ -270,20 +395,7 @@ impl EncryptedBackend { } fn decrypt_block(&self, block_index: u64, disk_data: &[u8]) -> io::Result> { - if disk_data.len() < NONCE_LEN + TAG_LEN { - return Err(io::Error::new( - io::ErrorKind::InvalidData, - "disk block too small to contain nonce + tag", - )); - } - - let nonce = XNonce::from_slice(&disk_data[..NONCE_LEN]); - let ciphertext_with_tag = &disk_data[NONCE_LEN..]; - let aad = block_index.to_le_bytes(); - - self.cipher.decrypt(nonce, Payload { msg: ciphertext_with_tag, aad: &aad }).map_err(|e| { - io::Error::new(io::ErrorKind::InvalidData, format!("decryption failed: {e}")) - }) + decrypt_disk_block(&self.cipher, block_index, disk_data) } fn read_disk_block(&self, block_index: u64) -> io::Result> { @@ -502,8 +614,6 @@ mod tests { use redb::{ReadableTableMetadata as _, StorageBackend as _}; use tempfile::TempDir; - const VERSION_V1: u8 = 1; - fn test_key() -> [u8; 32] { [0xAB; 32] } @@ -950,9 +1060,9 @@ mod tests { } #[test] - fn v1_rejected() { + fn v1_header_auto_upgraded_to_v2() { let dir = TempDir::new().unwrap(); - let path = test_path(&dir, "v1_reject.enc"); + let path = test_path(&dir, "v1_upgrade.enc"); let key = test_key(); // create a v1 header manually @@ -967,9 +1077,60 @@ mod tests { file.sync_all().unwrap(); } - let result = EncryptedBackend::open(&path, &key); - assert!(result.is_err()); - assert!(result.unwrap_err().to_string().contains("unsupported")); + // open should succeed and upgrade in-place + { + let _backend = EncryptedBackend::open(&path, &key).unwrap(); + } + + // verify on-disk header is now V2 with valid HMAC + { + let file = File::open(&path).unwrap(); + let header = read_header(&file).unwrap(); + assert_eq!(header[VERSION_OFFSET], VERSION_V2); + verify_header_tag(&key, &header).unwrap(); + } + } + + #[test] + fn v1_header_with_data_survives_upgrade() { + let dir = TempDir::new().unwrap(); + let path = test_path(&dir, "v1_data_upgrade.enc"); + let key = test_key(); + + let table_def: redb::TableDefinition<&str, &str> = redb::TableDefinition::new("v1_data"); + + // create a V2 database with actual data, then downgrade header to V1 + { + let backend = EncryptedBackend::create(&path, &key).unwrap(); + let db = redb::Database::builder().create_with_backend(backend).unwrap(); + + let write_txn = db.begin_write().unwrap(); + { + let mut table = write_txn.open_table(table_def).unwrap(); + table.insert("alice", "bob").unwrap(); + table.insert("num", "42").unwrap(); + } + write_txn.commit().unwrap(); + } + + // downgrade header to V1: set version=1 and zero out the HMAC tag + { + let file = OpenOptions::new().read(true).write(true).open(&path).unwrap(); + file.write_all_at(&[VERSION_V1], VERSION_OFFSET as u64).unwrap(); + file.write_all_at(&[0u8; HEADER_TAG_LEN], HEADER_TAG_OFFSET as u64).unwrap(); + file.sync_all().unwrap(); + } + + // open triggers V1→V2 migration, then verify data is intact + { + let backend = EncryptedBackend::open(&path, &key).unwrap(); + let db = redb::Database::builder().create_with_backend(backend).unwrap(); + + let read_txn = db.begin_read().unwrap(); + let table = read_txn.open_table(table_def).unwrap(); + assert_eq!(table.get("alice").unwrap().unwrap().value(), "bob"); + assert_eq!(table.get("num").unwrap().unwrap().value(), "42"); + } } #[test] @@ -1059,4 +1220,107 @@ mod tests { "expected PlaintextNotAllowed, got: {err}" ); } + + #[test] + fn key_mismatch_detected_by_verify() { + // ensure global key is set to test_key ([0xAB; 32]) + set_test_encryption_key(); + + let dir = TempDir::new().unwrap(); + let path = test_path(&dir, "verify_mismatch.enc"); + + // create a database with a DIFFERENT key than the global one + let wrong_key = [0xFF; 32]; + { + let backend = EncryptedBackend::create(&path, &wrong_key).unwrap(); + backend.write(0, &[0x11u8; 64]).unwrap(); + } + + // verify_database_key uses the global key ([0xAB]) which won't match + let result = verify_database_key(&path); + assert!(result.is_err(), "expected key mismatch error"); + + let err = result.unwrap_err(); + assert!( + matches!(err, crate::database::error::DatabaseError::HeaderIntegrity { .. }), + "expected HeaderIntegrity, got: {err}" + ); + } + + #[test] + fn verify_database_key_succeeds_with_correct_key() { + set_test_encryption_key(); + + let dir = TempDir::new().unwrap(); + let path = test_path(&dir, "verify_ok.enc"); + + // create with the same key as the global one + let key = test_key(); + { + let backend = EncryptedBackend::create(&path, &key).unwrap(); + backend.write(0, &[0x11u8; 64]).unwrap(); + } + + assert!(verify_database_key(&path).is_ok()); + } + + #[test] + fn verify_database_key_nonexistent_file_is_ok() { + set_test_encryption_key(); + + let dir = TempDir::new().unwrap(); + let path = test_path(&dir, "does_not_exist.enc"); + + assert!(verify_database_key(&path).is_ok()); + } + + #[test] + fn verify_database_key_rejects_v1_database_with_wrong_key_without_mutating_header() { + set_test_encryption_key(); + + let dir = TempDir::new().unwrap(); + let path = test_path(&dir, "verify_v1_mismatch.enc"); + let original_key = [0xFF; 32]; + let table_def: redb::TableDefinition<&str, &str> = redb::TableDefinition::new("v1_verify"); + + { + let backend = EncryptedBackend::create(&path, &original_key).unwrap(); + let db = redb::Database::builder().create_with_backend(backend).unwrap(); + + let write_txn = db.begin_write().unwrap(); + { + let mut table = write_txn.open_table(table_def).unwrap(); + table.insert("alice", "bob").unwrap(); + } + write_txn.commit().unwrap(); + } + + let original_v1_header = { + let file = OpenOptions::new().read(true).write(true).open(&path).unwrap(); + file.write_all_at(&[VERSION_V1], VERSION_OFFSET as u64).unwrap(); + file.write_all_at(&[0u8; HEADER_TAG_LEN], HEADER_TAG_OFFSET as u64).unwrap(); + file.sync_all().unwrap(); + + read_header(&file).unwrap() + }; + + let result = verify_database_key(&path); + assert!(result.is_err(), "expected V1 key mismatch error"); + + let err = result.unwrap_err(); + assert!( + matches!(err, crate::database::error::DatabaseError::HeaderIntegrity { .. }), + "expected HeaderIntegrity, got: {err}" + ); + + let header_after_verify = { + let file = File::open(&path).unwrap(); + read_header(&file).unwrap() + }; + assert_eq!(header_after_verify, original_v1_header, "verify must not rewrite V1 headers"); + assert_eq!(header_after_verify[VERSION_OFFSET], VERSION_V1); + + let result = EncryptedBackend::open(&path, &original_key); + assert!(result.is_ok(), "the original key should still open the V1 database"); + } } diff --git a/rust/src/fiat.rs b/rust/src/fiat.rs index 1b657bf53..ad12dc4fc 100644 --- a/rust/src/fiat.rs +++ b/rust/src/fiat.rs @@ -134,31 +134,29 @@ impl From<&FiatCurrency> for &'static str { } #[uniffi::export] -fn all_fiat_currencies() -> Vec { - FiatCurrency::iter().collect() -} - -#[uniffi::export] -fn is_fiat_currency_symbol(symbol: &str) -> bool { - FiatCurrency::is_symbol(symbol) -} +impl FiatCurrency { + #[uniffi::method(name = "symbolString")] + fn ffi_symbol_string(&self) -> String { + self.symbol().to_string() + } -#[uniffi::export] -fn fiat_currency_to_string(fiat_currency: FiatCurrency) -> String { - fiat_currency.to_string() -} + #[uniffi::method(name = "emojiString")] + fn ffi_emoji_string(&self) -> String { + self.emoji().to_string() + } -#[uniffi::export] -fn fiat_currency_symbol(fiat_currency: FiatCurrency) -> String { - fiat_currency.symbol().to_string() + #[uniffi::method(name = "suffixString")] + fn ffi_suffix_string(&self) -> String { + self.suffix().to_string() + } } #[uniffi::export] -fn fiat_currency_emoji(fiat_currency: FiatCurrency) -> String { - fiat_currency.emoji().to_string() +fn all_fiat_currencies() -> Vec { + FiatCurrency::iter().collect() } #[uniffi::export] -fn fiat_currency_suffix(fiat_currency: FiatCurrency) -> String { - fiat_currency.suffix().to_string() +fn is_fiat_currency_symbol(symbol: &str) -> bool { + FiatCurrency::is_symbol(symbol) } diff --git a/rust/src/manager/coin_control_manager.rs b/rust/src/manager/coin_control_manager.rs index a7d1f1c3c..2967c670f 100644 --- a/rust/src/manager/coin_control_manager.rs +++ b/rust/src/manager/coin_control_manager.rs @@ -360,6 +360,7 @@ pub enum CoinControlListSort { #[derive( Debug, Clone, Copy, Hash, Eq, PartialEq, PartialOrd, Ord, uniffi::Enum, derive_more::Display, )] +#[uniffi::export(Display)] pub enum CoinControlListSortKey { Date, Name, @@ -367,11 +368,6 @@ pub enum CoinControlListSortKey { Change, } -#[uniffi::export] -fn coin_control_list_sort_key_to_string(key: CoinControlListSortKey) -> String { - key.to_string() -} - impl Default for CoinControlListSort { fn default() -> Self { Self::Date(ListSortDirection::Descending) diff --git a/rust/src/manager/send_flow_manager/alert_state.rs b/rust/src/manager/send_flow_manager/alert_state.rs index bec59739e..07f40d47a 100644 --- a/rust/src/manager/send_flow_manager/alert_state.rs +++ b/rust/src/manager/send_flow_manager/alert_state.rs @@ -15,7 +15,10 @@ impl SendFlowAlertState { } #[uniffi::export] -fn address_error_to_alert_state(error: AddressError, address: String) -> SendFlowAlertState { +fn send_flow_alert_state_from_address_error( + error: AddressError, + address: String, +) -> SendFlowAlertState { SendFlowAlertState::from_address_error(error, address) } diff --git a/rust/src/manager/wallet_manager.rs b/rust/src/manager/wallet_manager.rs index 8548d83fc..cee713ed1 100644 --- a/rust/src/manager/wallet_manager.rs +++ b/rust/src/manager/wallet_manager.rs @@ -1440,6 +1440,8 @@ fn get_public_descriptor_content(id: &WalletId) -> Result { } #[uniffi::export] -fn wallet_state_is_equal(lhs: WalletLoadState, rhs: WalletLoadState) -> bool { - lhs == rhs +impl WalletLoadState { + fn is_equal(&self, other: WalletLoadState) -> bool { + self == &other + } } diff --git a/rust/src/mnemonic/ffi.rs b/rust/src/mnemonic/ffi.rs index 2cbf663c2..5627775ed 100644 --- a/rust/src/mnemonic/ffi.rs +++ b/rust/src/mnemonic/ffi.rs @@ -2,13 +2,15 @@ use super::{Error, GroupedWord, Mnemonic, NumberOfBip39Words, WordAccess as _}; use crate::wallet::metadata::WalletId; #[uniffi::export] -pub fn number_of_words_in_groups(me: NumberOfBip39Words, of: u8) -> Vec> { - me.in_groups_of(of as usize) -} +impl NumberOfBip39Words { + fn in_groups(&self, of: u8) -> Vec> { + self.in_groups_of(of as usize) + } -#[uniffi::export] -pub fn number_of_words_to_word_count(me: NumberOfBip39Words) -> u8 { - me.to_word_count() as u8 + #[uniffi::method(name = "toWordCount")] + fn ffi_to_word_count(&self) -> u8 { + self.to_word_count() as u8 + } } #[uniffi::export] diff --git a/rust/src/multi_format.rs b/rust/src/multi_format.rs index d0b8cea6c..953e5cf07 100644 --- a/rust/src/multi_format.rs +++ b/rust/src/multi_format.rs @@ -323,10 +323,13 @@ fn multi_format_try_from_nfc_message( } #[uniffi::export] -fn string_or_data_try_into_multi_format( - string_or_data: StringOrData, -) -> Result { - string_or_data.try_into() +impl StringOrData { + fn try_into_multi_format(&self) -> Result { + match self { + Self::String(string) => MultiFormat::try_from_string(string), + Self::Data(data) => MultiFormat::try_from_data(data), + } + } } #[derive( diff --git a/rust/src/node_connect.rs b/rust/src/node_connect.rs index 88aabd844..175e14922 100644 --- a/rust/src/node_connect.rs +++ b/rust/src/node_connect.rs @@ -280,8 +280,10 @@ fn parse_node_url(url: &str) -> eyre::Result { } #[uniffi::export] -fn node_selection_to_node(node: NodeSelection) -> Node { - node.into() +impl NodeSelection { + fn to_node(&self) -> Node { + self.clone().into() + } } #[uniffi::export] diff --git a/rust/src/router.rs b/rust/src/router.rs index 9caf5bbd5..8da5c01d2 100644 --- a/rust/src/router.rs +++ b/rust/src/router.rs @@ -394,15 +394,17 @@ impl TapSignerConfirmPinArgs { } #[uniffi::export] -fn is_route_equal(route: Route, route_to_check: Route) -> bool { - route == route_to_check -} +impl Route { + fn is_equal(&self, route_to_check: Route) -> bool { + self == &route_to_check + } -#[uniffi::export] -fn hash_route(route: Route) -> u64 { - let mut hasher = std::collections::hash_map::DefaultHasher::new(); - route.hash(&mut hasher); - hasher.finish() + #[uniffi::method(name = "stableHash")] + fn stable_hash(&self) -> u64 { + let mut hasher = std::collections::hash_map::DefaultHasher::new(); + self.hash(&mut hasher); + hasher.finish() + } } impl From for Route { @@ -412,8 +414,10 @@ impl From for Route { } #[uniffi::export] -fn is_tap_signer_route_equal(lhs: TapSignerRoute, rhs: TapSignerRoute) -> bool { - lhs == rhs +impl TapSignerRoute { + fn is_equal(&self, other: TapSignerRoute) -> bool { + self == &other + } } impl AfterPinAction { @@ -422,14 +426,17 @@ impl AfterPinAction { Self::Derive => "For security purposes, you need to enter your TAPSIGNER PIN before you can import your wallet".to_string(), Self::Change => "Please enter your current PIN".to_string(), Self::Backup => "For security purposes, you need to enter your TAPSIGNER PIN before you can backup your wallet".to_string(), - Self::Sign(_) => "For security purposes, you need must enter your TAPSIGNER PIN before you can sign a transaction".to_string(), + Self::Sign(_) => "For security purposes, you must enter your TAPSIGNER PIN before you can sign a transaction".to_string(), } } } #[uniffi::export] -fn after_pin_action_user_message(action: AfterPinAction) -> String { - action.user_message() +impl AfterPinAction { + #[uniffi::method(name = "userMessage")] + fn ffi_user_message(&self) -> String { + self.user_message() + } } #[uniffi::export] diff --git a/rust/src/signed_import.rs b/rust/src/signed_import.rs index 6f1354e16..9c1f7c634 100644 --- a/rust/src/signed_import.rs +++ b/rust/src/signed_import.rs @@ -164,24 +164,18 @@ impl SignedTransactionOrPsbt { } } -// UniFFI standalone functions for fallible constructors -// (UniFFI only supports fallible constructors for Objects, not Enums) - -/// Parse from string input (base64 or hex encoded) -#[uniffi::export(name = "signedTransactionOrPsbtTryParse")] -pub fn signed_transaction_or_psbt_try_parse(input: String) -> Result { +#[uniffi::export] +fn signed_transaction_or_psbt_try_parse(input: String) -> Result { SignedTransactionOrPsbt::try_parse(&input) } -/// Parse from raw bytes -#[uniffi::export(name = "signedTransactionOrPsbtTryFromBytes")] -pub fn signed_transaction_or_psbt_try_from_bytes(data: Vec) -> Result { +#[uniffi::export] +fn signed_transaction_or_psbt_try_from_bytes(data: Vec) -> Result { SignedTransactionOrPsbt::try_from_bytes(&data) } -/// Parse from an NFC message -#[uniffi::export(name = "signedTransactionOrPsbtTryFromNfcMessage")] -pub fn signed_transaction_or_psbt_try_from_nfc_message( +#[uniffi::export] +fn signed_transaction_or_psbt_try_from_nfc_message( nfc_message: Arc, ) -> Result { SignedTransactionOrPsbt::try_from_nfc_message(&nfc_message) diff --git a/rust/src/tap_card.rs b/rust/src/tap_card.rs index a5d74e743..f7e8d7711 100644 --- a/rust/src/tap_card.rs +++ b/rust/src/tap_card.rs @@ -164,7 +164,7 @@ impl From for rust_cktap::apdu::CkTapError { } #[uniffi::export] -pub fn create_transport_error_from_code(code: u16, message: String) -> TransportError { +fn create_transport_error_from_code(code: u16, message: String) -> TransportError { use rust_cktap::apdu::CkTapError as CTE; let error = CTE::error_from_code(code); diff --git a/rust/src/tap_card/tap_signer_reader.rs b/rust/src/tap_card/tap_signer_reader.rs index 8f3b0691b..fcd2912d8 100644 --- a/rust/src/tap_card/tap_signer_reader.rs +++ b/rust/src/tap_card/tap_signer_reader.rs @@ -611,14 +611,17 @@ fn _ffi_tap_signer_setup_retry_continue_cmd(preview: bool) -> SetupCmdResponse { }) } -#[uniffi::export(name = "tapSignerErrorIsAuthError")] -fn _ffi_tap_signer_error_is_auth_error(error: TapSignerReaderError) -> bool { - error.is_auth_error() -} +#[uniffi::export] +impl TapSignerReaderError { + #[uniffi::method(name = "isAuthError")] + fn ffi_is_auth_error(&self) -> bool { + self.is_auth_error() + } -#[uniffi::export(name = "tapSignerErrorIsNoBackupError")] -fn _ffi_tap_signer_error_is_no_backup_error(error: TapSignerReaderError) -> bool { - error.is_no_backup_error() + #[uniffi::method(name = "isNoBackupError")] + fn ffi_is_no_backup_error(&self) -> bool { + self.is_no_backup_error() + } } // MARK: - FFI PREVIEW diff --git a/rust/src/wallet.rs b/rust/src/wallet.rs index 04a66ddc9..60758477b 100644 --- a/rust/src/wallet.rs +++ b/rust/src/wallet.rs @@ -129,8 +129,11 @@ impl WalletAddressType { } #[uniffi::export] -const fn wallet_address_type_sort_order(address_type: WalletAddressType) -> u8 { - address_type.sort_order() +impl WalletAddressType { + #[uniffi::method(name = "sortOrder")] + fn ffi_sort_order(&self) -> u8 { + self.sort_order() + } } impl Wallet { diff --git a/rust/src/wallet/metadata.rs b/rust/src/wallet/metadata.rs index 8e427b09e..078d2453a 100644 --- a/rust/src/wallet/metadata.rs +++ b/rust/src/wallet/metadata.rs @@ -300,25 +300,24 @@ pub enum WalletColor { WLightPastelYellow, } -#[uniffi::export] -fn default_wallet_colors() -> Vec { - vec![ - WalletColor::WBeige, - WalletColor::WPastelBlue, - WalletColor::WPastelNavy, - WalletColor::WPastelRed, - WalletColor::WPastelYellow, - WalletColor::WPastelTeal, - WalletColor::Blue, - WalletColor::Green, - WalletColor::Orange, - WalletColor::Purple, - ] -} - impl WalletColor { + pub fn defaults() -> Vec { + vec![ + Self::WBeige, + Self::WPastelBlue, + Self::WPastelNavy, + Self::WPastelRed, + Self::WPastelYellow, + Self::WPastelTeal, + Self::Blue, + Self::Green, + Self::Orange, + Self::Purple, + ] + } + pub fn random() -> Self { - let options = default_wallet_colors(); + let options = Self::defaults(); use rand::RngExt; let random_index = rand::rng().random_range(0..options.len()); @@ -326,6 +325,11 @@ impl WalletColor { } } +#[uniffi::export] +fn default_wallet_colors() -> Vec { + WalletColor::defaults() +} + const fn default_true() -> bool { true } @@ -338,17 +342,18 @@ fn default_address_type() -> WalletAddressType { Default::default() } -// MARK: PREVIEW ONLY #[uniffi::export] -fn wallet_metadata_is_equal(lhs: WalletMetadata, rhs: WalletMetadata) -> bool { - lhs == rhs -} +impl WalletMetadata { + fn is_equal(&self, other: WalletMetadata) -> bool { + self == &other + } -#[uniffi::export] -fn wallet_metadata_hash(metadata: WalletMetadata) -> u64 { - let mut hasher = std::collections::hash_map::DefaultHasher::new(); - metadata.hash(&mut hasher); - hasher.finish() + #[uniffi::method(name = "stableHash")] + fn stable_hash(&self) -> u64 { + let mut hasher = std::collections::hash_map::DefaultHasher::new(); + self.hash(&mut hasher); + hasher.finish() + } } #[uniffi::export] @@ -361,6 +366,9 @@ const fn file_store_default() -> StoreType { } #[uniffi::export] -fn hardware_wallet_is_tap_signer(hardware_wallet: HardwareWalletMetadata) -> bool { - hardware_wallet.is_tap_signer() +impl HardwareWalletMetadata { + #[uniffi::method(name = "isTapSigner")] + fn ffi_is_tap_signer(&self) -> bool { + self.is_tap_signer() + } }