-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the ts-sdk testing setup #448
Conversation
wjthieme
commented
Nov 1, 2024
- Add tests for fetching positions
- Use actual instructions for initializing pools/positions/tokens/etc. instead of trying to write the data ourselves
- Bankrun does not support gpa yet so some functions cannot be tested through bankrun
ts-sdk/whirlpool/tests/e2e.test.ts
Outdated
const mint1 = await setupMint({ decimals: 9 }); | ||
const mint2 = await setupMint({ decimals: 6 }); | ||
[mintA, mintB] = | ||
Buffer.from(mint1) < Buffer.from(mint2) ? [mint1, mint2] : [mint2, mint1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: orderMints
ts-sdk/whirlpool/tests/pool.test.ts
Outdated
const mint1 = await setupMint(); | ||
const mint2 = await setupMint(); | ||
[mintA, mintB] = | ||
Buffer.from(mint1) < Buffer.from(mint2) ? [mint1, mint2] : [mint2, mint1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: orderMints
const mint1 = await setupMint(); | ||
const mint2 = await setupMint(); | ||
[mintA, mintB] = | ||
Buffer.from(mint1) < Buffer.from(mint2) ? [mint1, mint2] : [mint2, mint1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: orderMints
[TOKEN_MINT_1]: 100n, | ||
[TOKEN_MINT_2]: 100n, | ||
[mintA]: 100n, | ||
[mintB]: 100n, | ||
[NATIVE_MINT]: 100n, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be sure, in this case (strategy is none), the balance of ATA for native mint should be zero even if 100n is specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. This is how it is currently explained in the docs:
* - **None**:
* Uses or creates the ATA without performing any SOL wrapping or unwrapping.
It might make sense to throw if the balance is insufficient (also for the non-SOL mints). Basically this can be used to say: "I need x amount in this token account" and is currently only doing something for SOL (if wrapping strategy is not none). What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation!
It makes sense🙂 (memo: the instruction requires X SOL, but my ATA already has > X SOL, so no need to wrap)
# Conflicts: # ts-sdk/whirlpool/src/pool.ts # ts-sdk/whirlpool/tests/token.test.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀