Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions __tests__/__snapshots__/Seed.snapshot.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,20 @@ exports[`Component Seed - test Seed Backup - snapshot 1`] = `
</Text>
</View>
</View>
<Text
style={
{
"color": "#c3c3c3",
"flexGrow": 1,
"flexShrink": 1,
"fontSize": 20,
"marginTop": 10,
"opacity": 0.65,
}
}
>
... extracting UFVK...
</Text>
</View>
</View>
</RCTScrollView>
Expand Down Expand Up @@ -1332,6 +1346,20 @@ exports[`Component Seed - test Seed Change - snapshot 1`] = `
</Text>
</View>
</View>
<Text
style={
{
"color": "#c3c3c3",
"flexGrow": 1,
"flexShrink": 1,
"fontSize": 20,
"marginTop": 10,
"opacity": 0.65,
}
}
>
... extracting UFVK...
</Text>
</View>
</View>
</RCTScrollView>
Expand Down Expand Up @@ -2747,6 +2775,20 @@ exports[`Component Seed - test Seed Server - snapshot 1`] = `
</Text>
</View>
</View>
<Text
style={
{
"color": "#c3c3c3",
"flexGrow": 1,
"flexShrink": 1,
"fontSize": 20,
"marginTop": 10,
"opacity": 0.65,
}
}
>
... extracting UFVK...
</Text>
</View>
</View>
</RCTScrollView>
Expand Down Expand Up @@ -3416,6 +3458,20 @@ exports[`Component Seed - test Seed View - snapshot 1`] = `
</Text>
</View>
</View>
<Text
style={
{
"color": "#c3c3c3",
"flexGrow": 1,
"flexShrink": 1,
"fontSize": 20,
"marginTop": 10,
"opacity": 0.65,
}
}
>
... extracting UFVK...
</Text>
</View>
</View>
</RCTScrollView>
Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 2 additions & 0 deletions app/AppState/AppContextLoaded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export default interface AppContextLoaded {
sendPageState: SendPageStateClass;
setSendPageState: (s: SendPageStateClass) => void;

getUfvk: () => Promise<string>;

// getinfo and getblockchaininfo result
info: InfoType;

Expand Down
7 changes: 7 additions & 0 deletions app/LoadedApp/LoadedApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -1852,6 +1853,11 @@ export class LoadedAppClass extends Component<
});
};

getUfvk = async (): Promise<string> => {
let wallet = await RPC.rpcFetchWallet(true);
return wallet.ufvk || '';
};

setRecoveryWalletInfoOnDeviceOption = async (
value: boolean,
): Promise<void> => {
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions app/context/contextAppLoaded.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const defaultAppContextLoaded: AppContextLoaded = {
blocksTotalStakingDay: 0,
scheduledActions: {} as ScheduledActionType[],
setScheduledActions: () => {},
getUfvk: async () => '',
};

export const ContextAppLoaded = React.createContext(defaultAppContextLoaded);
Expand Down
3 changes: 3 additions & 0 deletions app/rpc/RPC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default class RPC {
lastServerBlockHeight: number;
walletBirthday: number;
walletSeed: string;
UFVK: string;

fetchWalletHeightLock: boolean;
fetchWalletBirthdaySeedUfvkLock: boolean;
Expand Down Expand Up @@ -143,6 +144,7 @@ export default class RPC {
this.lastServerBlockHeight = 0;
this.walletBirthday = 0;
this.walletSeed = '';
this.UFVK = '';

this.fetchWalletHeightLock = false;
this.fetchWalletBirthdaySeedUfvkLock = false;
Expand Down Expand Up @@ -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;
Expand Down
75 changes: 75 additions & 0 deletions components/Seed/Seed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const Seed: React.FunctionComponent<SeedProps> = ({}) => {
addLastSnackbar,
snackbars,
removeFirstSnackbar,
getUfvk,
} = context;
const { colors } = useTheme() as ThemeType;
// when this screen is open from LoadingApp (new wallet)
Expand All @@ -61,6 +62,22 @@ const Seed: React.FunctionComponent<SeedProps> = ({}) => {
const seedPhrase = wallet.seed || '';
const birthdayNumber = (wallet.birthday && wallet.birthday.toString()) || '';

const [ufvk, setUfvk] = useState<string>('');

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(' ');

Expand Down Expand Up @@ -394,6 +411,64 @@ const Seed: React.FunctionComponent<SeedProps> = ({}) => {
</TouchableOpacity>
</View>
)}
{!!ufvk ? (
<View
style={{
flexDirection: 'row',
justifyContent: 'flex-start',
borderColor: colors.border,
borderWidth: 1,
borderRadius: 25,
marginTop: 10,
marginBottom: 10,
backgroundColor: colors.secondary,
width: '100%',
minWidth: '50%',
minHeight: 48,
alignItems: 'center',
paddingHorizontal: 25,
paddingVertical: 15,
}}
>
<FadeText
style={{
flexGrow: 1,
flexShrink: 1,
fontSize: 20,
}}
>
UFVK
</FadeText>

<TouchableOpacity
onPress={() => {
Clipboard.setString(ufvk);
if (addLastSnackbar) {
addLastSnackbar({
message: 'UFVK copied',
duration: SnackbarDurationEnum.short,
screenName: [screenName],
});
}
}}
>
<RegText color={colors.text} style={{ textAlign: 'center' }}>
{Utils.trimToSmall(ufvk, 12)}
</RegText>
</TouchableOpacity>
</View>
) : (
<FadeText
style={{
flexGrow: 1,
flexShrink: 1,
fontSize: 20,
marginTop: 10,
}}
>
... extracting UFVK...
</FadeText>
)}
</View>
</ScrollView>
</ToastProvider>
Expand Down
4 changes: 2 additions & 2 deletions ios/ZingoDelegator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
6 changes: 3 additions & 3 deletions rust/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 2 additions & 4 deletions rust/lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1810,10 +1810,8 @@ pub fn withdraw_stake(withdraw_stake_json: String) -> Result<String, ZingolibErr
}
};
match res {
Some(txid) => 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 {
Expand Down
Loading