Skip to content

Conversation

@boosik-sol
Copy link
Contributor

@boosik-sol boosik-sol commented May 9, 2025

This PR implements resetPositionRange instructions in typescript-sdk

  • : implement instruction
  • : unit test
  • : devnet/mainnet test

}
});

const testOpenPositionInstructions = async (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what I intend that

  • creating a new position
  • remove all liquidity
  • and reset position range, and check if position is correctly changed.

@orca-so orca-so deleted a comment from boohyunsik May 9, 2025
Copy link
Member

@wjthieme wjthieme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we will also need this for the rust-sdk (or will you handle that in a separate PR?

@boosik-sol
Copy link
Contributor Author

Think we will also need this for the rust-sdk (or will you handle that in a separate PR?

Yes, there are many instructions that are not implemented in rust-sdk, such as lock-position, reset-position-range, transfer-locked-position, etc.. I will collect them and report.

@boosik-sol boosik-sol force-pushed the boosik/impl_reset_position_range_ts_sdk branch from 1ce9508 to 721e409 Compare May 15, 2025 16:21
@boosik-sol boosik-sol force-pushed the boosik/impl_reset_position_range_ts_sdk branch from a674c51 to 3664a46 Compare May 19, 2025 15:36
Copy link
Collaborator

@odcheung odcheung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally looks good! but i want to push for more unit-tests

);

instructions.push(
getResetPositionRangeInstruction({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this method defined? I don't see it in HEAD or elsewhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getResetPositionRangeInstruction is defined at @orca-so/whirlpools-client.

for (const positionTypeName of positionTypes.keys()) {
const positionName = `${poolName} ${positionTypeName}`;
it(`Should reset a position for ${positionName}`, async () => {
await testResetPositionRange(poolName, positionName);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also need to verify that the reset position ix will fail if the position is not empty and if the user is trying to set it to the same tick range.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, added more tc for those cases.

@boosik-sol boosik-sol force-pushed the boosik/impl_reset_position_range_ts_sdk branch from 5028be2 to 70d439e Compare May 21, 2025 07:13
Copy link
Collaborator

@odcheung odcheung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - but if we can modify the test cases to use test.for instead of a custom loop that'd be great

Comment on lines +245 to +246
for (const poolName of poolTypes.keys()) {
for (const positionTypeName of positionTypes.keys()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm a little bummed that vitest doesn't have .each functions where we can declare test variations on like .each on jest!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait. seems like it does?
https://vitest.dev/api/#test-for

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I am checking :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a new ticket for this, and will fix this

@boosik-sol boosik-sol merged commit 8a76634 into main May 26, 2025
6 checks passed
@boosik-sol boosik-sol deleted the boosik/impl_reset_position_range_ts_sdk branch May 26, 2025 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants