File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
examples/developer-hub-javascript Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 33 *
44 * This script claims pending withdrawals from the FirelightVault.
55 * Withdrawals must be requested first using withdraw/redeem, then claimed after the period ends.
6+ *
7+ * Usage:
8+ * yarn hardhat run scripts/firelight/claim.ts --network coston2
69 */
710
811import { ethers } from "hardhat" ;
@@ -76,6 +79,25 @@ async function getClaimableAssets(
7679 }
7780}
7881
82+ /**
83+ * Checks if a withdrawal for a specific period has been claimed.
84+ *
85+ * @param vault - The FirelightVault instance
86+ * @param period - The period number to check
87+ * @param account - The account address to check
88+ * @returns true if the withdrawal has been claimed (no pending withdrawals), false if still pending
89+ */
90+ export async function isWithdrawClaimed (
91+ vault : IFirelightVaultInstance ,
92+ period : bigint ,
93+ account : string ,
94+ ) : Promise < boolean > {
95+ const withdrawals = bnToBigInt (
96+ await vault . withdrawalsOf ( period . toString ( ) , account ) ,
97+ ) ;
98+ return withdrawals === 0n ;
99+ }
100+
79101async function findClaimablePeriods (
80102 vault : IFirelightVaultInstance ,
81103 account : string ,
You can’t perform that action at this time.
0 commit comments