@ethersproject/constants#HashZero TypeScript Examples
The following examples show how to use
@ethersproject/constants#HashZero.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: realityModule.ts From snapshot-plugins with MIT License | 6 votes |
getProposalDetails = async (
provider: StaticJsonRpcProvider,
network: string,
moduleAddress: string,
questionHash: string,
txHashes: string[]
): Promise<{ questionId: string; nextTxIndex: number | undefined }> => {
const proposalInfo = (
await multicall(
network,
provider,
REALITY_MODULE_ABI,
[[moduleAddress, 'questionIds', [questionHash]]].concat(
txHashes.map((txHash) => [
moduleAddress,
'executedProposalTransactions',
[questionHash, txHash]
])
)
)
).map((res) => res[0]);
const questionId = proposalInfo[0];
// We need to offset the index by -1 the first element is the questionId
const nextIndexToExecute = proposalInfo.indexOf(false, 1) - 1;
return {
questionId: questionId !== HashZero ? questionId : undefined,
nextTxIndex:
nextIndexToExecute < 0 || nextIndexToExecute >= txHashes.length
? undefined
: nextIndexToExecute
};
}