Skip to content
Open
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
1 change: 1 addition & 0 deletions src/lib/actions/getAnnouncements/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface AnnouncementLog extends Log {
metadata: `0x${string}`;
schemeId: bigint;
stealthAddress: EthAddress;
timestamp?: bigint;
}

export type GetAnnouncementsParams = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ describe('getAnnouncementsUsingSubgraph with real subgraph', () => {
'stealthAddress',
'caller',
'ephemeralPubKey',
'metadata'
'metadata',
'timestamp'
];

for (const result of testResults) {
Expand All @@ -148,6 +149,8 @@ describe('getAnnouncementsUsingSubgraph with real subgraph', () => {
for (const prop of expectedProperties) {
expect(announcement).toHaveProperty(prop);
}
// Verify timestamp is a bigint (should always be present from subgraph)
expect(typeof announcement.timestamp).toBe('bigint');
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ async function getAnnouncementsUsingSubgraph({
removed
schemeId
stealthAddress
timestamp
topics
transactionHash
transactionIndex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ describe('convertSubgraphEntityToAnnouncementLog', () => {
stealthAddress: '0xstealth',
caller: '0xcaller',
ephemeralPubKey: '0xephemeral',
metadata: '0xmetadata'
metadata: '0xmetadata',
timestamp: '1234567890'
};

const result = convertSubgraphEntityToAnnouncementLog(subgraphEntity);
Expand All @@ -177,7 +178,8 @@ describe('convertSubgraphEntityToAnnouncementLog', () => {
stealthAddress: '0xstealth',
caller: '0xcaller',
ephemeralPubKey: '0xephemeral',
metadata: '0xmetadata'
metadata: '0xmetadata',
timestamp: BigInt(1234567890)
});
});

Expand All @@ -196,7 +198,8 @@ describe('convertSubgraphEntityToAnnouncementLog', () => {
stealthAddress: '0xstealth',
caller: '0xcaller',
ephemeralPubKey: '0xephemeral',
metadata: '0xmetadata'
metadata: '0xmetadata',
timestamp: '1234567890'
};

const result = convertSubgraphEntityToAnnouncementLog(subgraphEntity);
Expand All @@ -219,7 +222,8 @@ describe('convertSubgraphEntityToAnnouncementLog', () => {
stealthAddress: '0xstealth',
caller: '0xcaller',
ephemeralPubKey: '0xephemeral',
metadata: '0xmetadata'
metadata: '0xmetadata',
timestamp: '1609459200' // Jan 1, 2021 timestamp
};

const result = convertSubgraphEntityToAnnouncementLog(subgraphEntity);
Expand All @@ -228,5 +232,6 @@ describe('convertSubgraphEntityToAnnouncementLog', () => {
expect(result.logIndex).toEqual(255);
expect(result.transactionIndex).toEqual(65535);
expect(result.schemeId).toEqual(BigInt('9876543210987654321'));
expect(result.timestamp).toEqual(BigInt('1609459200'));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,17 @@ export function convertSubgraphEntityToAnnouncementLog(
address: ERC5564_CONTRACT_ADDRESS, // Contract address is the same for all chains
blockHash: entity.blockHash as `0x${string}`,
blockNumber: BigInt(entity.blockNumber),
logIndex: Number(entity.logIndex),
logIndex: Number.parseInt(entity.logIndex, 10),
removed: entity.removed,
transactionHash: entity.transactionHash as `0x${string}`,
transactionIndex: Number(entity.transactionIndex),
transactionIndex: Number.parseInt(entity.transactionIndex, 10),
topics: entity.topics as [`0x${string}`, ...`0x${string}`[]] | [],
data: entity.data as `0x${string}`,
schemeId: BigInt(entity.schemeId),
stealthAddress: entity.stealthAddress as `0x${string}`,
caller: entity.caller as `0x${string}`,
ephemeralPubKey: entity.ephemeralPubKey as `0x${string}`,
metadata: entity.metadata as `0x${string}`
metadata: entity.metadata as `0x${string}`,
timestamp: BigInt(entity.timestamp)
};
}
1 change: 1 addition & 0 deletions src/lib/actions/getAnnouncementsUsingSubgraph/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type SubgraphAnnouncementEntity = {
schemeId: string;
stealthAddress: string;
transactionHash: string;
timestamp: string;

// Additional log information
blockHash: string;
Expand Down