Skip to content

Commit

Permalink
Bump ic-js (#4664)
Browse files Browse the repository at this point in the history
# Motivation

Keep our ic-js dependency up to date.

In particular, we want to use the `timestamp` field that was added to
the `Transaction` type of the index canister.

I attempted this with #4663 but
had forgotten to publish the changes first.

# Changes

1. Ran `npm run upgrade:next`.
2. Set the `timestamp` field on test values where it's required.

# Tests

Still pass

# Todos

- [ ] Add entry to changelog (if necessary).
not necessary
  • Loading branch information
dskloetd authored Mar 26, 2024
1 parent 8d343cf commit eb37b66
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 68 deletions.
108 changes: 54 additions & 54 deletions frontend/package-lock.json

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

2 changes: 2 additions & 0 deletions frontend/src/tests/lib/pages/NnsWallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ describe("NnsWallet", () => {
memo: 123456n,
icrc1_memo: [],
created_at_time: [{ timestamp_nanos: 1234n }],
timestamp: [{ timestamp_nanos: 1235n }],
operation: {
Transfer: {
from: mockMainAccount.identifier,
Expand Down Expand Up @@ -511,6 +512,7 @@ describe("NnsWallet", () => {
memo: 123456n,
icrc1_memo: [],
created_at_time: [{ timestamp_nanos: 1234n }],
timestamp: [{ timestamp_nanos: 1235n }],
operation: {
Transfer: {
from: mockMainAccount.identifier,
Expand Down
31 changes: 17 additions & 14 deletions frontend/src/tests/mocks/icp-transactions.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const mockTransactionTransfer: Transaction = {
},
},
created_at_time: [{ timestamp_nanos: 234n }],
timestamp: [{ timestamp_nanos: 235n }],
};

const defaultTimestamp = new Date("2023-01-01T00:00:00.000Z");
Expand All @@ -32,20 +33,22 @@ export const createTransactionWithId = ({
memo?: bigint;
timestamp?: Date;
id?: bigint;
}): TransactionWithId => ({
id,
transaction: {
memo: memo ?? 0n,
icrc1_memo: [],
operation,
created_at_time: [
{
timestamp_nanos:
BigInt(timestamp.getTime()) * BigInt(NANO_SECONDS_IN_MILLISECOND),
},
],
},
});
}): TransactionWithId => {
const timestampNanos = {
timestamp_nanos:
BigInt(timestamp.getTime()) * BigInt(NANO_SECONDS_IN_MILLISECOND),
};
return {
id,
transaction: {
memo: memo ?? 0n,
icrc1_memo: [],
operation,
created_at_time: [timestampNanos],
timestamp: [timestampNanos],
},
};
};

export const mockTransactionWithId: TransactionWithId = {
id: 234n,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/tests/mocks/transaction.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,6 @@ export const mockTransactionWithId: TransactionWithId = {
},
},
created_at_time: [],
timestamp: [],
},
};

0 comments on commit eb37b66

Please sign in to comment.