Skip to content

Commit

Permalink
fix: cr commnets, store timestamp 0 for imported accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszjasiuk committed Dec 19, 2024
1 parent 8145873 commit b632b0e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions apps/extension/src/background/keyring/keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class KeyRing {
path: bip44Path,
type: AccountType.Ledger,
source: "imported",
timestamp: new Date().getTime(),
timestamp: 0,
};

const sensitive = await this.vaultService.encryptSensitiveData({
Expand Down Expand Up @@ -162,8 +162,8 @@ export class KeyRing {
await this.vaultService.assertIsUnlocked();

const keys = this.sdkService.getSdk().getKeys();
const timestamp = new Date().getTime();
const source = flow === "create" ? "generated" : "imported";
const timestamp = source === "generated" ? new Date().getTime() : 0;

const { sk, text, passphrase, accountType } = ((): {
sk: string;
Expand Down Expand Up @@ -449,7 +449,7 @@ export class KeyRing {
);
}

const timestamp = new Date().getTime();
const timestamp = source === "generated" ? new Date().getTime() : 0;
const derivedAccount = await this.persistAccount(
type === AccountType.ShieldedKeys ? zip32Path : derivationPath,
parentId,
Expand Down
5 changes: 3 additions & 2 deletions apps/extension/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,13 @@ export const toPublicAccount = (derivedAccount: DerivedAccount): Account => {
alias,
address,
type,
pseudoExtendedKey,
source,
timestamp,
};
if (isShielded) {
account.viewingKey = owner;
account.pseudoExtendedKey = pseudoExtendedKey;
account.source = source;
account.timestamp = timestamp;
} else {
account.publicKey = publicKey;
}
Expand Down
4 changes: 2 additions & 2 deletions apps/namadillo/src/atoms/balance/atoms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ const toDatedKeypair = async (
api: DefaultApi,
{ viewingKey, source, timestamp }: Account
): Promise<DatedViewingKey> => {
if (!viewingKey) {
if (typeof viewingKey === "undefined") {
throw new Error("Viewing key not found");
}
if (!timestamp) {
if (typeof timestamp === "undefined") {
throw new Error("Timestamp not found");
}
let height = 0;
Expand Down

0 comments on commit b632b0e

Please sign in to comment.