Skip to content

Miscellaneous fixes and cleanup - new version #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 15, 2025
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
5 changes: 5 additions & 0 deletions .changeset/spotty-planets-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@fireblocks/e2e-tests': minor
---

update vault navigation to be able to go to vault from main page or from specific vault
12 changes: 12 additions & 0 deletions packages/e2e-tests/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ export const navigateToVault = async (page: Page, vaultToNavigateTo: number) =>
return;
} catch (e) {
console.log(`Utility is not in Vault ${vaultToNavigateTo}`, e);
try {
try {
await page.getByRole('link', { name: 'My Vault' }).innerText({ timeout: 5000 });
await page.getByRole('link', { name: 'My Vault' }).click();
} catch (e) {
console.log(`Not in a specifiv vault, willt try to move to one`, e);
}
await page.getByRole('cell', { name: `Vault ${vaultToNavigateTo}` }).click();
return;
} catch (e) {
console.log(`Failed to navigate to Vault ${vaultToNavigateTo}`, e);
}
}
await page.getByLabel('Close modal').click();
await page.getByRole('link', { name: 'My Vault' }).click();
Expand Down
8 changes: 5 additions & 3 deletions packages/extended-key-recovery/src/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable guard-for-in */
/* eslint-disable no-restricted-syntax */
import { NCWWalletMasterMetadata, RecoveryPackageMetadata, SigningKeyMetadata, UnknownChainCodeError } from './types';

export const parseMetadataFile = (metadataFile: string): RecoveryPackageMetadata => {
Expand Down Expand Up @@ -29,7 +31,7 @@ export const parseMetadataFile = (metadataFile: string): RecoveryPackageMetadata
if (typeof keysInKit[key].chainCode === 'string') {
metadataChainCode = Buffer.from(keysInKit[key].chainCode! as string, 'hex');
} else {
metadataChainCode = keysInKit[key].chainCode! as Buffer;
metadataChainCode = keysInKit[key].chainCode! as unknown as Buffer;
}
} else {
metadataChainCode = Buffer.from(defaultChainCode); // Copy of chaincode.
Expand Down Expand Up @@ -62,12 +64,12 @@ export const parseMetadataFile = (metadataFile: string): RecoveryPackageMetadata
if (typeof keyMetadata.walletSeed === 'string') {
walletSeed = Buffer.from(keyMetadata.walletSeed, 'hex');
} else {
walletSeed = keyMetadata.walletSeed as Buffer;
walletSeed = keyMetadata.walletSeed as unknown as Buffer;
}
if (typeof keyMetadata.assetSeed === 'string') {
assetSeed = Buffer.from(keyMetadata.assetSeed, 'hex');
} else {
assetSeed = keyMetadata.assetSeed as Buffer;
assetSeed = keyMetadata.assetSeed as unknown as Buffer;
}
const { cosigners } = keyMetadata;

Expand Down
14 changes: 10 additions & 4 deletions packages/extended-key-recovery/src/recover.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/* eslint-disable no-new */
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable prefer-destructuring */
/* eslint-disable no-lonely-if */
/* eslint-disable no-continue */
/* eslint-disable no-restricted-syntax */
import fs from 'fs';
import path from 'path';
import AdmZip, { IZipEntry } from 'adm-zip';
Expand Down Expand Up @@ -70,7 +76,7 @@ const recoverKeysShares = (
throw new InvalidRSAPrivateKeyError();
}

let decrypted: any;
let decrypted: unknown;
try {
// @ts-ignore
decrypted = Buffer.from(privateKey.decrypt(data, 'RSA-OAEP'), 'binary').toString('hex');
Expand Down Expand Up @@ -147,11 +153,11 @@ export const recoverKeys = (params: KeyRecoveryConfig): RecoveredKeys => {
}
}

const privateKeysTemp: CalculatedPrivateKey | undefined = reconstructKeys(players, signingKeys);
if (!privateKeysTemp) {
const tmp: CalculatedPrivateKey | undefined = reconstructKeys(players, signingKeys);
if (!tmp) {
throw new Error('Mismatch between recovered keys and metadata - unable to continue');
}
const privateKeys = privateKeysTemp!;
const privateKeys = tmp!;

const keyAlgorithms: Algorithm[] = Object.keys(privateKeys) as Algorithm[];
let ecdsa: Algorithm;
Expand Down
9 changes: 4 additions & 5 deletions packages/shared/hooks/useBaseWorkspace/useRelayUrl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,11 @@ export const useRelayUrl = <App extends 'utility' | 'relay'>(app: App, baseUrl:
if (!relayUrl) {
// setInboundRelayParams(undefined);
return false;
} else {
const params = getInboundRelayParams(relayUrl);

setInboundRelayParams(params);
return true;
}
const params = getInboundRelayParams(relayUrl);

setInboundRelayParams(params);
return true;
} catch (error) {
logger.error(error);
return false;
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/schemas/recoverAccountInput.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable no-restricted-globals */
import { z } from 'zod';
import { nonEmptyString } from './scalars';
Expand All @@ -6,6 +7,7 @@ const numberFromString = z
.string()
.transform((v) => (v === '' ? null : v))
.nullable()
// @ts-ignore
.refine((v) => v === null || !isNaN(v), { message: 'Invalid number' })
.transform((v) => (v === null ? -1 : Number(v)))
.pipe(z.number().nullable());
Expand Down