-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: turn lockVestingTokens to effectul system
- Loading branch information
1 parent
94f2d4a
commit 83c3e12
Showing
6 changed files
with
122 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { expect } from "vitest"; | ||
import { Emulator, Result, TxComplete } from "../src"; | ||
import { Contract } from "../src/endpoints/Contract"; | ||
import { pipe } from "effect"; | ||
|
||
export const submitAction = async (tx: Result<TxComplete>) => { | ||
expect(tx.type).toBe("ok"); | ||
if (tx.type === "ok") { | ||
return await (await tx.data.sign().complete()).submit(); | ||
} | ||
}; | ||
|
||
export const collectAction = async ( | ||
user: Awaited<ReturnType<typeof Contract.withLucid>>, | ||
emulator: Emulator | ||
) => | ||
pipe( | ||
await user | ||
.collectVestingTokens({ | ||
vestingOutRef: (await user.getVestedTokens())[0].outRef, | ||
currentTime: emulator.now(), | ||
}) | ||
.build(), | ||
submitAction | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters