From 6bc68707d0be1e2e5d797018a3da39dedf7639ba Mon Sep 17 00:00:00 2001 From: dtfiedler Date: Mon, 27 Nov 2023 10:02:54 -0800 Subject: [PATCH 1/3] feat(warp): add block timestamp to interactions endpoint We already fetch the height, so easy enough to add the timestamp --- src/api/graphql.ts | 2 ++ src/types.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/src/api/graphql.ts b/src/api/graphql.ts index d53d992..e55abd1 100644 --- a/src/api/graphql.ts +++ b/src/api/graphql.ts @@ -149,6 +149,7 @@ export async function getWalletInteractionsForContract( } block { height + timestamp } } } @@ -177,6 +178,7 @@ export async function getWalletInteractionsForContract( : undefined; interactions.set(e.node.id, { height: e.node.block.height, + timestamp: e.node.block.timestamp, input: parsedInput, owner: e.node.owner.address, }); diff --git a/src/types.ts b/src/types.ts index 0fd911e..a5baa1e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -54,6 +54,7 @@ export type ArNSInteraction = { input: PstInput | undefined; height: number; owner: string; + timestamp: number; errorMessage?: string; }; From ed2d64dbdd8c832e775a18b3c828d5d31a083878 Mon Sep 17 00:00:00 2001 From: dtfiedler Date: Mon, 27 Nov 2023 11:09:39 -0800 Subject: [PATCH 2/3] chore: fix tests --- tests/integration/routes.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/routes.test.ts b/tests/integration/routes.test.ts index 4d5331e..1205963 100644 --- a/tests/integration/routes.test.ts +++ b/tests/integration/routes.test.ts @@ -82,6 +82,7 @@ describe('Integration tests', () => { height: (await arweave.blocks.getCurrent()).height, input: transferInteraction, owner: walletAddress, + timestamp: (await arweave.blocks.getCurrent()).timestamp, valid: true, id: writeInteraction!.originalTxId, }); From 77ee231de94d96cb128caabc47dde7a0f763981e Mon Sep 17 00:00:00 2001 From: dtfiedler Date: Mon, 27 Nov 2023 11:18:21 -0800 Subject: [PATCH 3/3] fix(tests): set timestamp to seconds in tests --- tests/integration/routes.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/integration/routes.test.ts b/tests/integration/routes.test.ts index 1205963..1fdcbb9 100644 --- a/tests/integration/routes.test.ts +++ b/tests/integration/routes.test.ts @@ -78,11 +78,12 @@ describe('Integration tests', () => { ); expect(writeInteraction?.originalTxId).to.not.be.undefined; transferToAddress = address; + const interactionBlock = await arweave.blocks.getCurrent(); contractInteractions.push({ - height: (await arweave.blocks.getCurrent()).height, + height: interactionBlock.height, input: transferInteraction, owner: walletAddress, - timestamp: (await arweave.blocks.getCurrent()).timestamp, + timestamp: Math.floor(interactionBlock.timestamp / 1000), valid: true, id: writeInteraction!.originalTxId, });