Skip to content
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

Add rust-sdk position test #601

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pauldragonfly
Copy link
Contributor

Add Position and Position Bundle Test Coverage

Overview

  • Introduces additional position and position bundle tests, aligned with the TypeScript SDK tests.

Changes

  • Implemented setup_position and setup_position_bundle for SPL and Token-2022.
  • Added tests for:
    • Position ownership and retrieval
    • Position bundle creation and retrieval

Notes

  • Tests are currently #[ignore] due to missing getProgramAccounts support in solana-bankrun.
  • Once support is added, these tests can be enabled by removing the #[ignore] attributes.

@pauldragonfly pauldragonfly marked this pull request as ready for review December 17, 2024 18:14
let ctx = RpcContext::new().await;

// Use token utility functions
let position_mint = setup_mint_with_decimals(&ctx, 0).await?;
Copy link
Member

Choose a reason for hiding this comment

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

You don't have to setup mint and ata when opening a position. The OpenPosition instruction will do that

setup_ata_with_amount(&ctx, mint_b, 1_000_000_000).await?;

let whirlpool = setup_whirlpool(&ctx, mint_a, mint_b, 64).await?;
let position_pubkey = setup_position(whirlpool).await?;
Copy link
Member

Choose a reason for hiding this comment

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

Might be nice to add a position bundle and te_position as well to check if fetch_positions_for_owner finds those positions as well.

Same goes from the fetch_positions_in_pool test

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.

2 participants