diff --git a/__tests__/__snapshots__/Seed.snapshot.tsx.snap b/__tests__/__snapshots__/Seed.snapshot.tsx.snap index 39855a32d..ca0c54c82 100644 --- a/__tests__/__snapshots__/Seed.snapshot.tsx.snap +++ b/__tests__/__snapshots__/Seed.snapshot.tsx.snap @@ -663,6 +663,20 @@ exports[`Component Seed - test Seed Backup - snapshot 1`] = ` + + ... extracting UFVK... + @@ -1332,6 +1346,20 @@ exports[`Component Seed - test Seed Change - snapshot 1`] = ` + + ... extracting UFVK... + @@ -2747,6 +2775,20 @@ exports[`Component Seed - test Seed Server - snapshot 1`] = ` + + ... extracting UFVK... + @@ -3416,6 +3458,20 @@ exports[`Component Seed - test Seed View - snapshot 1`] = ` + + ... extracting UFVK... + diff --git a/android/app/build.gradle b/android/app/build.gradle index b7e51317d..4bf967480 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -115,7 +115,7 @@ android { applicationId 'org.ZingoLabs.ZingoDelegator' // Real minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 36 // Real + versionCode 37 // Real versionName "zingodelegator-0.0.1" // Real testBuildType System.getProperty('testBuildType', 'debug') testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' diff --git a/app/AppState/AppContextLoaded.ts b/app/AppState/AppContextLoaded.ts index 5390c5ea8..f3edc5546 100644 --- a/app/AppState/AppContextLoaded.ts +++ b/app/AppState/AppContextLoaded.ts @@ -51,6 +51,8 @@ export default interface AppContextLoaded { sendPageState: SendPageStateClass; setSendPageState: (s: SendPageStateClass) => void; + getUfvk: () => Promise; + // getinfo and getblockchaininfo result info: InfoType; diff --git a/app/LoadedApp/LoadedApp.tsx b/app/LoadedApp/LoadedApp.tsx index a4f7abd5b..78ab37c4f 100644 --- a/app/LoadedApp/LoadedApp.tsx +++ b/app/LoadedApp/LoadedApp.tsx @@ -501,6 +501,7 @@ export class LoadedAppClass extends Component< messagesTotal: null, sendPageState: new SendPageStateClass(new ToAddrClass(0)), setSendPageState: this.setSendPageState, + getUfvk: this.getUfvk, info: {} as InfoType, syncingStatus: {} as RPCSyncStatusType, wallet: {} as WalletType, @@ -1852,6 +1853,11 @@ export class LoadedAppClass extends Component< }); }; + getUfvk = async (): Promise => { + let wallet = await RPC.rpcFetchWallet(true); + return wallet.ufvk || ''; + }; + setRecoveryWalletInfoOnDeviceOption = async ( value: boolean, ): Promise => { @@ -2170,6 +2176,7 @@ export class LoadedAppClass extends Component< blocksTotalStakingDay: this.state.blocksTotalStakingDay, scheduledActions: this.state.scheduledActions, setScheduledActions: this.state.setScheduledActions, + getUfvk: this.getUfvk, // context settings indexerServer: this.state.indexerServer, diff --git a/app/context/contextAppLoaded.tsx b/app/context/contextAppLoaded.tsx index 8027846be..3603d7700 100644 --- a/app/context/contextAppLoaded.tsx +++ b/app/context/contextAppLoaded.tsx @@ -88,6 +88,7 @@ export const defaultAppContextLoaded: AppContextLoaded = { blocksTotalStakingDay: 0, scheduledActions: {} as ScheduledActionType[], setScheduledActions: () => {}, + getUfvk: async () => '', }; export const ContextAppLoaded = React.createContext(defaultAppContextLoaded); diff --git a/app/rpc/RPC.ts b/app/rpc/RPC.ts index 97c85a2d8..748ee601c 100644 --- a/app/rpc/RPC.ts +++ b/app/rpc/RPC.ts @@ -71,6 +71,7 @@ export default class RPC { lastServerBlockHeight: number; walletBirthday: number; walletSeed: string; + UFVK: string; fetchWalletHeightLock: boolean; fetchWalletBirthdaySeedUfvkLock: boolean; @@ -143,6 +144,7 @@ export default class RPC { this.lastServerBlockHeight = 0; this.walletBirthday = 0; this.walletSeed = ''; + this.UFVK = ''; this.fetchWalletHeightLock = false; this.fetchWalletBirthdaySeedUfvkLock = false; @@ -1414,6 +1416,7 @@ export default class RPC { if (wallet) { this.walletBirthday = wallet.birthday; this.walletSeed = wallet.seed || ''; + this.UFVK = wallet.ufvk || ''; this.fnSetWallet(wallet); } this.fetchWalletBirthdaySeedUfvkLock = false; diff --git a/components/Seed/Seed.tsx b/components/Seed/Seed.tsx index 214fcdd09..c9a4c9b97 100644 --- a/components/Seed/Seed.tsx +++ b/components/Seed/Seed.tsx @@ -41,6 +41,7 @@ const Seed: React.FunctionComponent = ({}) => { addLastSnackbar, snackbars, removeFirstSnackbar, + getUfvk, } = context; const { colors } = useTheme() as ThemeType; // when this screen is open from LoadingApp (new wallet) @@ -61,6 +62,22 @@ const Seed: React.FunctionComponent = ({}) => { const seedPhrase = wallet.seed || ''; const birthdayNumber = (wallet.birthday && wallet.birthday.toString()) || ''; + const [ufvk, setUfvk] = useState(''); + + useEffect(() => { + const loadUfvk = async () => { + try { + const value = await getUfvk(); + setUfvk(value || ''); + } catch (e) { + console.error('Failed to load ufvk', e); + setUfvk(''); + } + }; + + loadUfvk(); + }, [getUfvk]); + useEffect(() => { const seedTextArray: string[] = seedPhrase.split(' '); @@ -394,6 +411,64 @@ const Seed: React.FunctionComponent = ({}) => { )} + {!!ufvk ? ( + + + UFVK + + + { + Clipboard.setString(ufvk); + if (addLastSnackbar) { + addLastSnackbar({ + message: 'UFVK copied', + duration: SnackbarDurationEnum.short, + screenName: [screenName], + }); + } + }} + > + + {Utils.trimToSmall(ufvk, 12)} + + + + ) : ( + + ... extracting UFVK... + + )} diff --git a/ios/ZingoDelegator.xcodeproj/project.pbxproj b/ios/ZingoDelegator.xcodeproj/project.pbxproj index 2016b6d0d..55656ca7d 100644 --- a/ios/ZingoDelegator.xcodeproj/project.pbxproj +++ b/ios/ZingoDelegator.xcodeproj/project.pbxproj @@ -572,7 +572,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = ZingoDelegator/ZingoDelegator.entitlements; - CURRENT_PROJECT_VERSION = 36; + CURRENT_PROJECT_VERSION = 37; DEPLOYMENT_POSTPROCESSING = YES; DEVELOPMENT_TEAM = 788KRST4S8; ENABLE_BITCODE = NO; @@ -614,7 +614,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = ZingoDelegator/ZingoDelegator.entitlements; - CURRENT_PROJECT_VERSION = 36; + CURRENT_PROJECT_VERSION = 37; DEPLOYMENT_POSTPROCESSING = YES; DEVELOPMENT_TEAM = 788KRST4S8; ENABLE_BITCODE = NO; diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 15b396ea5..b6ec9d2d1 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -3569,7 +3569,7 @@ dependencies = [ [[package]] name = "pepper-sync" version = "0.3.0" -source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=740a0672402d566ba43fae2333ab3b1434ddd7ce#740a0672402d566ba43fae2333ab3b1434ddd7ce" +source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=b118e682bcf9a14fda4b3482978d4e3fca9c5f05#b118e682bcf9a14fda4b3482978d4e3fca9c5f05" dependencies = [ "bip32", "byteorder", @@ -8397,7 +8397,7 @@ dependencies = [ [[package]] name = "zingo-memo" version = "0.1.0" -source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=740a0672402d566ba43fae2333ab3b1434ddd7ce#740a0672402d566ba43fae2333ab3b1434ddd7ce" +source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=b118e682bcf9a14fda4b3482978d4e3fca9c5f05#b118e682bcf9a14fda4b3482978d4e3fca9c5f05" dependencies = [ "zcash_address 0.10.1 (git+https://github.com/ShieldedLabs/crosslink_monolith.git?rev=315b72497f9611267c0c6d9d44ad893af8c17d57)", "zcash_encoding 0.3.0 (git+https://github.com/ShieldedLabs/crosslink_monolith.git?rev=315b72497f9611267c0c6d9d44ad893af8c17d57)", @@ -8408,7 +8408,7 @@ dependencies = [ [[package]] name = "zingo-netutils" version = "2.0.2" -source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=740a0672402d566ba43fae2333ab3b1434ddd7ce#740a0672402d566ba43fae2333ab3b1434ddd7ce" +source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=b118e682bcf9a14fda4b3482978d4e3fca9c5f05#b118e682bcf9a14fda4b3482978d4e3fca9c5f05" dependencies = [ "http", "hyper", @@ -8423,7 +8423,7 @@ dependencies = [ [[package]] name = "zingo-price" version = "0.0.1" -source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=740a0672402d566ba43fae2333ab3b1434ddd7ce#740a0672402d566ba43fae2333ab3b1434ddd7ce" +source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=b118e682bcf9a14fda4b3482978d4e3fca9c5f05#b118e682bcf9a14fda4b3482978d4e3fca9c5f05" dependencies = [ "byteorder", "reqwest", @@ -8438,7 +8438,7 @@ dependencies = [ [[package]] name = "zingo-status" version = "0.2.0" -source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=740a0672402d566ba43fae2333ab3b1434ddd7ce#740a0672402d566ba43fae2333ab3b1434ddd7ce" +source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=b118e682bcf9a14fda4b3482978d4e3fca9c5f05#b118e682bcf9a14fda4b3482978d4e3fca9c5f05" dependencies = [ "byteorder", "zcash_primitives 0.26.1", @@ -8448,12 +8448,12 @@ dependencies = [ [[package]] name = "zingo_common_components" version = "0.3.0" -source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=740a0672402d566ba43fae2333ab3b1434ddd7ce#740a0672402d566ba43fae2333ab3b1434ddd7ce" +source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=b118e682bcf9a14fda4b3482978d4e3fca9c5f05#b118e682bcf9a14fda4b3482978d4e3fca9c5f05" [[package]] name = "zingo_test_vectors" version = "0.0.1" -source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=740a0672402d566ba43fae2333ab3b1434ddd7ce#740a0672402d566ba43fae2333ab3b1434ddd7ce" +source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=b118e682bcf9a14fda4b3482978d4e3fca9c5f05#b118e682bcf9a14fda4b3482978d4e3fca9c5f05" dependencies = [ "bip0039", ] @@ -8461,7 +8461,7 @@ dependencies = [ [[package]] name = "zingolib" version = "3.0.1" -source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=740a0672402d566ba43fae2333ab3b1434ddd7ce#740a0672402d566ba43fae2333ab3b1434ddd7ce" +source = "git+https://github.com/zingolabs/zingolib-crosslink?rev=b118e682bcf9a14fda4b3482978d4e3fca9c5f05#b118e682bcf9a14fda4b3482978d4e3fca9c5f05" dependencies = [ "append-only-vec", "bech32", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index b014469ce..b692fe02b 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -10,15 +10,15 @@ nursery = { level = "deny", priority = -1 } [workspace.dependencies] -zingo_common_components = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "740a0672402d566ba43fae2333ab3b1434ddd7ce" } -zingo-netutils = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "740a0672402d566ba43fae2333ab3b1434ddd7ce" } +zingo_common_components = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "b118e682bcf9a14fda4b3482978d4e3fca9c5f05" } +zingo-netutils = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "b118e682bcf9a14fda4b3482978d4e3fca9c5f05" } -zingolib = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "740a0672402d566ba43fae2333ab3b1434ddd7ce", default-features = true, features = [ +zingolib = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "b118e682bcf9a14fda4b3482978d4e3fca9c5f05", default-features = true, features = [ "testutils", ] } -pepper-sync = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "740a0672402d566ba43fae2333ab3b1434ddd7ce" } +pepper-sync = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "b118e682bcf9a14fda4b3482978d4e3fca9c5f05" } -zingolib_testutils = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "740a0672402d566ba43fae2333ab3b1434ddd7ce", features = [ +zingolib_testutils = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "b118e682bcf9a14fda4b3482978d4e3fca9c5f05", features = [ "test_lwd_zcashd", ] } regchest_utils = { git = "https://github.com/zingolabs/zingo-regchest", branch = "dev" } diff --git a/rust/lib/Cargo.toml b/rust/lib/Cargo.toml index 38677ed48..4a09f8f98 100644 --- a/rust/lib/Cargo.toml +++ b/rust/lib/Cargo.toml @@ -11,11 +11,11 @@ regchest = [] [dependencies] zingo-netutils = { workspace = true } -zingo_common_components = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "740a0672402d566ba43fae2333ab3b1434ddd7ce" } -zingolib = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "740a0672402d566ba43fae2333ab3b1434ddd7ce", default-features = true, features = [ +zingo_common_components = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "b118e682bcf9a14fda4b3482978d4e3fca9c5f05" } +zingolib = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "b118e682bcf9a14fda4b3482978d4e3fca9c5f05", default-features = true, features = [ "testutils", ] } -pepper-sync = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "740a0672402d566ba43fae2333ab3b1434ddd7ce" } +pepper-sync = { git = "https://github.com/zingolabs/zingolib-crosslink", rev = "b118e682bcf9a14fda4b3482978d4e3fca9c5f05" } zcash_encoding = { git = "https://github.com/ShieldedLabs/crosslink_monolith.git", rev = "315b72497f9611267c0c6d9d44ad893af8c17d57", features = [ "std", diff --git a/rust/lib/src/lib.rs b/rust/lib/src/lib.rs index 7a329fc25..e2327bc77 100644 --- a/rust/lib/src/lib.rs +++ b/rust/lib/src/lib.rs @@ -1810,10 +1810,8 @@ pub fn withdraw_stake(withdraw_stake_json: String) -> Result object! { "txid" => txid.to_string() }.pretty(2), - None => { - object! { "error" => "withdraw failed (builder returned None)" }.pretty(2) - } + Ok(txid) => object! { "txid" => txid.to_string() }.pretty(2), + Err(e) => object! { "error" => e.to_string() }.pretty(2), } })) } else {