-
Notifications
You must be signed in to change notification settings - Fork 7
Add tests for native mint #27
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
Conversation
f0b8742
to
3511119
Compare
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.
Looks great, thanks for adding the test case!
program/tests/helpers/common.rs
Outdated
state.pack_base(); | ||
|
||
let native_token_account = Account { | ||
lamports: Rent::default().minimum_balance(Mint::LEN), |
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: this should really be Rent.minimum_balance(Account::LEN) + balance
since it's a wrapped SOL account. Its lamports should be the total amount minus the rent exempt requirement to be a token account
program/tests/helpers/common.rs
Outdated
|
||
let native_token_account = Account { | ||
lamports: Rent::default() | ||
.minimum_balance(Mint::LEN) |
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.
This still isn't a mint 😉
.minimum_balance(Mint::LEN) | |
.minimum_balance(Account::LEN) |
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.
Whoops! Fixing.
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.
Sometimes I get confused with the two different account types. It's spl_token_2022::state::Account::LEN
right?
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 you got it right!
Ensures program successfully wraps and unwraps with native mint