Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #72 from ar-io/block-timestamps
Browse files Browse the repository at this point in the history
feat(warp): add block timestamp to interactions endpoint
  • Loading branch information
dtfiedler authored Nov 27, 2023
2 parents 09a168c + 77ee231 commit 8ae0a23
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/api/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export async function getWalletInteractionsForContract(
}
block {
height
timestamp
}
}
}
Expand Down Expand Up @@ -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,
});
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export type ArNSInteraction = {
input: PstInput | undefined;
height: number;
owner: string;
timestamp: number;
errorMessage?: string;
};

Expand Down
4 changes: 3 additions & 1 deletion tests/integration/routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +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: Math.floor(interactionBlock.timestamp / 1000),
valid: true,
id: writeInteraction!.originalTxId,
});
Expand Down

0 comments on commit 8ae0a23

Please sign in to comment.