Use Subgraph & Batched Events #2
@ -170,13 +170,15 @@ export async function getAllCommitments({ fromBlock, toBlock, chainId }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = commitments.map((e) => ({
|
const data = commitments
|
||||||
|
.map((e) => ({
|
||||||
blockNumber: Number(e.blockNumber),
|
blockNumber: Number(e.blockNumber),
|
||||||
transactionHash: e.transactionHash,
|
transactionHash: e.transactionHash,
|
||||||
index: Number(e.index),
|
index: Number(e.index),
|
||||||
commitment: e.commitment,
|
commitment: e.commitment,
|
||||||
encryptedOutput: e.encryptedOutput
|
encryptedOutput: e.encryptedOutput
|
||||||
}))
|
}))
|
||||||
|
.sort((a, b) => a.index - b.index)
|
||||||
|
|
||||||
const [lastEvent] = data.slice(-numbers.ONE)
|
const [lastEvent] = data.slice(-numbers.ONE)
|
||||||
|
|
||||||
|
@ -231,13 +231,15 @@ export async function getAllCommitments({ fromBlock, chainId }: Params) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = commitments.map((e) => ({
|
const data = commitments
|
||||||
|
.map((e) => ({
|
||||||
index: Number(e.index),
|
index: Number(e.index),
|
||||||
commitment: e.commitment,
|
commitment: e.commitment,
|
||||||
blockNumber: Number(e.blockNumber),
|
blockNumber: Number(e.blockNumber),
|
||||||
encryptedOutput: e.encryptedOutput,
|
encryptedOutput: e.encryptedOutput,
|
||||||
transactionHash: e.transactionHash
|
transactionHash: e.transactionHash
|
||||||
}))
|
}))
|
||||||
|
.sort((a, b) => a.index - b.index)
|
||||||
|
|
||||||
const [lastEvent] = data.slice(-numbers.ONE)
|
const [lastEvent] = data.slice(-numbers.ONE)
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user