Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/metal-mangos-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
17 changes: 16 additions & 1 deletion Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,22 @@ cluster = "localnet"
wallet = "~/.config/solana/id.json"

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk"
# When you run "anchor test" command, it searches for Test.toml files under the anchor_tests directory and executes them in order.
# These tests are large and require several hours to complete.
#
# If you want to run only specific test cases, specify the directory where Test.toml resides using --run option.
#
# Example 1) Run all tests
#
# anchor test
#
# Example 2) Run only the tests for integration/token-badge
#
# anchor test --run anchor_tests/int/token-badge
#
# Example 3) Run only the tests for integration/token-badge and sdk/whirlpools/utils
#
# anchor test --run anchor_tests/int/token-badge --run anchor_tests/sdk/utils

[test.validator]
# If we use slot_per_epoch = "33", rent for Position account (216 byte) was not 0.00239424 but 0.002394239
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions anchor_tests/int/adaptive-fee/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/integration/adaptive-fee"
4 changes: 4 additions & 0 deletions anchor_tests/int/migration/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/integration/migration"
4 changes: 4 additions & 0 deletions anchor_tests/int/multi-ix/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/integration/multi-ix"
4 changes: 4 additions & 0 deletions anchor_tests/int/token-badge/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/integration/token-badge"
4 changes: 4 additions & 0 deletions anchor_tests/int/token-extensions/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/integration/token-extensions"
4 changes: 4 additions & 0 deletions anchor_tests/int/v1-ix/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/integration/v1-ix"
4 changes: 4 additions & 0 deletions anchor_tests/int/v2-ix/collect/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/integration/v2-ix/collect"
4 changes: 4 additions & 0 deletions anchor_tests/int/v2-ix/initialize/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/integration/v2-ix/initialize"
4 changes: 4 additions & 0 deletions anchor_tests/int/v2-ix/liquidity/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/integration/v2-ix/liquidity"
4 changes: 4 additions & 0 deletions anchor_tests/int/v2-ix/swap/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/integration/v2-ix/swap"
4 changes: 4 additions & 0 deletions anchor_tests/int/v2-ix/two-hop-swap/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/integration/v2-ix/two-hop-swap"
4 changes: 4 additions & 0 deletions anchor_tests/sdk/client-impl/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/sdk/whirlpools/client-impl"
4 changes: 4 additions & 0 deletions anchor_tests/sdk/quote/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/sdk/whirlpools/quote"
4 changes: 4 additions & 0 deletions anchor_tests/sdk/swap/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/sdk/whirlpools/swap"
4 changes: 4 additions & 0 deletions anchor_tests/sdk/types/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/sdk/types"
4 changes: 4 additions & 0 deletions anchor_tests/sdk/utils/Test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends = ["../../setup.toml"]

[scripts]
test = "yarn vitest run --test-timeout 1000000 --no-file-parallelism --globals legacy-sdk/whirlpool/tests/sdk/whirlpools/utils"
82 changes: 82 additions & 0 deletions anchor_tests/setup.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[test.validator]
# If we use slot_per_epoch = "33", rent for Position account (216 byte) was not 0.00239424 but 0.002394239
slots_per_epoch = "32"
ticks_per_slot = 7
url = "https://api.mainnet-beta.solana.com"

# In v0.29.0, this doesn't work because ProgramData account is cloned with executable = false (anchor bug ?)
# So we need to use test.genesis config.
# [[test.validator.clone]]
# address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"

[[test.genesis]]
address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
program = "../legacy-sdk/whirlpool/tests/external_program/mpl_token_metadata.20240214.so"

[[test.genesis]]
address = "EBZDYx7599krFc4m2govwBdZcicr4GgepqC78m71nsHS"
program = "../legacy-sdk/whirlpool/tests/external_program/transfer_hook_counter.so"

# Newer Token-2022
[[test.genesis]]
address = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
program = "../legacy-sdk/whirlpool/tests/external_program/token_2022.20250510.so"

# For reset_position_range test
# Now, it is impossible to initialize position account without additional rent for ticks.
# So we need to load test old position account without the additional rent.
[[test.validator.account]]
address = "4GQ4VQZKPt4fLxGCusfdBZia2ge5hUZpfwwr3pqxUrmf"
filename = "../legacy-sdk/whirlpool/tests/preload_account/reset_position_range/owner_wallet.json"
[[test.validator.account]]
address = "Jd4M8bfJG3sAkd82RsGWyEXoaBXQP7njFzBwEaCTuDa"
filename = "../legacy-sdk/whirlpool/tests/preload_account/reset_position_range/token_a.json"
[[test.validator.account]]
address = "BRjpCHtyQLNCo8gqRUr8jtdAj5AjPYQaoqbvcZiHok1k"
filename = "../legacy-sdk/whirlpool/tests/preload_account/reset_position_range/token_b.json"
[[test.validator.account]]
address = "EgxU92G34jw6QDG9RuTX9StFg1PmHuDqkRKAE5kVEiZ4"
filename = "../legacy-sdk/whirlpool/tests/preload_account/reset_position_range/whirlpool.json"
[[test.validator.account]]
address = "GedZgiHw8dJpR6Fyt1PNgSwYznEyh18qgZvobuxYxMQ3"
filename = "../legacy-sdk/whirlpool/tests/preload_account/reset_position_range/vault_a.json"
[[test.validator.account]]
address = "4KDudC7XagDiZZbd9Xzabcy5yZMC8bvz7c8q7Bb9vXTa"
filename = "../legacy-sdk/whirlpool/tests/preload_account/reset_position_range/vault_b.json"
[[test.validator.account]]
address = "AihMywzP74pU2riq1ihFW2YSVcc1itT3yiP7minvkxDs"
filename = "../legacy-sdk/whirlpool/tests/preload_account/reset_position_range/fixed_tick_array_lower.json"
[[test.validator.account]]
address = "F4h3qr6uBgdLDJyTms4YiebiaiuCEvC5C9LJE8scA1LV"
filename = "../legacy-sdk/whirlpool/tests/preload_account/reset_position_range/fixed_tick_array_upper.json"
[[test.validator.account]]
address = "CzKujYEJWNCvFHhjCBcv5gKnnTdvXrQ3b9ecxyZQV6sg"
filename = "../legacy-sdk/whirlpool/tests/preload_account/reset_position_range/position_mint.json"
[[test.validator.account]]
address = "J6DFYFKUsoMYgxkbeAqVnpSb8fniA9tHR44ZQu8KBgMS"
filename = "../legacy-sdk/whirlpool/tests/preload_account/reset_position_range/position.json"
[[test.validator.account]]
address = "6wGj2VeDPPP1ni6TJA1KuwExFXCWKsvXLyJZvfBsfgWY"
filename = "../legacy-sdk/whirlpool/tests/preload_account/reset_position_range/position_ata.json"
[[test.validator.account]]
address = "oH6UWXaG2uvePMcqR9bih8E2Gt9eS4jhYx5VyAEC4k1"
filename = "../legacy-sdk/whirlpool/tests/preload_account/reset_position_range/token_a_ata.json"
[[test.validator.account]]
address = "7kshCxjaA7uY2C77X733ZZjM1EE31FhceM9dm4QXrxqZ"
filename = "../legacy-sdk/whirlpool/tests/preload_account/reset_position_range/token_b_ata.json"

# For migrate_repurpose_reward_authority_space test
# Now, it is impossible to initialize whirlpool with 3 reward authorities (not migrated layout)
# So we need to load test old Whirlpool account.
[[test.validator.account]]
address = "7vWRTPPBq3aNaJZsrfterTz1BSjht4YSHBXJwnbuV6SC"
filename = "../legacy-sdk/whirlpool/tests/preload_account/migrate_repurpose_reward_authority_space/whirlpool.json"

# For open_position_with_token_extensions test
# Now, it is impossible to initialize whirlpool with 3 reward authorities (not migrated layout)
# So we need to load test old Whirlpool account.
# This account has not been migrated, and unless that is recognized, the bit array may be misinterpreted as control_flags,
# potentially resulting in the creation of a non-transferable position.
[[test.validator.account]]
address = "Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE"
filename = "../legacy-sdk/whirlpool/tests/preload_account/open_position_with_token_extensions/whirlpool.json"
4 changes: 2 additions & 2 deletions examples/rust-sdk/whirlpool_repositioning_bot/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import {
toTx,
WhirlpoolContext,
WhirlpoolIx,
} from "../../../../src";
import { defaultConfirmOptions } from "../../../utils/const";
} from "../../../src";
import { defaultConfirmOptions } from "../../utils/const";
import type {
DeleteTokenBadgeParams,
InitializeTokenBadgeParams,
} from "../../../../src/instructions";
import { createMintV2 } from "../../../utils/v2/token-2022";
import type { TokenTrait } from "../../../utils/v2/init-utils-v2";
import { getLocalnetAdminKeypair0 } from "../../../utils";
} from "../../../src/instructions";
import { createMintV2 } from "../../utils/v2/token-2022";
import type { TokenTrait } from "../../utils/v2/init-utils-v2";
import { getLocalnetAdminKeypair0 } from "../../utils";

describe("delete_token_badge", () => {
const provider = anchor.AnchorProvider.local(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { TOKEN_PROGRAM_ID } from "@solana/spl-token";
import type { PublicKey, TransactionInstruction } from "@solana/web3.js";
import { Keypair, LAMPORTS_PER_SOL, SystemProgram } from "@solana/web3.js";
import * as assert from "assert";
import { PDAUtil, toTx, WhirlpoolContext, WhirlpoolIx } from "../../../../src";
import { defaultConfirmOptions } from "../../../utils/const";
import type { InitConfigExtensionParams } from "../../../../src/instructions";
import { getLocalnetAdminKeypair0 } from "../../../utils";
import { PDAUtil, toTx, WhirlpoolContext, WhirlpoolIx } from "../../../src";
import { defaultConfirmOptions } from "../../utils/const";
import type { InitConfigExtensionParams } from "../../../src/instructions";
import { getLocalnetAdminKeypair0 } from "../../utils";

describe("initialize_config_extension", () => {
const provider = anchor.AnchorProvider.local(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import {
toTx,
WhirlpoolContext,
WhirlpoolIx,
} from "../../../../src";
import { defaultConfirmOptions } from "../../../utils/const";
import type { InitializeTokenBadgeParams } from "../../../../src/instructions";
import { createMintV2 } from "../../../utils/v2/token-2022";
import type { TokenTrait } from "../../../utils/v2/init-utils-v2";
import { getLocalnetAdminKeypair0 } from "../../../utils";
} from "../../../src";
import { defaultConfirmOptions } from "../../utils/const";
import type { InitializeTokenBadgeParams } from "../../../src/instructions";
import { createMintV2 } from "../../utils/v2/token-2022";
import type { TokenTrait } from "../../utils/v2/init-utils-v2";
import { getLocalnetAdminKeypair0 } from "../../utils";

describe("initialize_token_badge", () => {
const provider = anchor.AnchorProvider.local(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
toTx,
WhirlpoolContext,
WhirlpoolIx,
} from "../../../../src";
import { defaultConfirmOptions } from "../../../utils/const";
import { getLocalnetAdminKeypair0 } from "../../../utils";
} from "../../../src";
import { defaultConfirmOptions } from "../../utils/const";
import { getLocalnetAdminKeypair0 } from "../../utils";

describe("set_config_extension_authority", () => {
const provider = anchor.AnchorProvider.local(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import {
toTx,
WhirlpoolContext,
WhirlpoolIx,
} from "../../../../src";
import { defaultConfirmOptions } from "../../../utils/const";
} from "../../../src";
import { defaultConfirmOptions } from "../../utils/const";
import type {
InitializeTokenBadgeParams,
SetTokenBadgeAttributeParams,
} from "../../../../src/instructions";
import { createMintV2 } from "../../../utils/v2/token-2022";
import type { TokenTrait } from "../../../utils/v2/init-utils-v2";
import { getLocalnetAdminKeypair0 } from "../../../utils";
} from "../../../src/instructions";
import { createMintV2 } from "../../utils/v2/token-2022";
import type { TokenTrait } from "../../utils/v2/init-utils-v2";
import { getLocalnetAdminKeypair0 } from "../../utils";

describe("set_token_badge_attribute", () => {
const provider = anchor.AnchorProvider.local(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
toTx,
WhirlpoolContext,
WhirlpoolIx,
} from "../../../../src";
import { defaultConfirmOptions } from "../../../utils/const";
import type { InitializeTokenBadgeParams } from "../../../../src/instructions";
import { createMintV2 } from "../../../utils/v2/token-2022";
import { getLocalnetAdminKeypair0 } from "../../../utils";
} from "../../../src";
import { defaultConfirmOptions } from "../../utils/const";
import type { InitializeTokenBadgeParams } from "../../../src/instructions";
import { createMintV2 } from "../../utils/v2/token-2022";
import { getLocalnetAdminKeypair0 } from "../../utils";

describe("set_token_badge_authority", () => {
const provider = anchor.AnchorProvider.local(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as anchor from "@coral-xyz/anchor";
import { BN } from "@coral-xyz/anchor";
import { Percentage } from "@orca-so/common-sdk";
import * as assert from "assert";
import type { WhirlpoolData } from "../../../../src";
import type { WhirlpoolData } from "../../../src";
import {
NO_ORACLE_DATA,
PDAUtil,
Expand All @@ -11,23 +11,23 @@ import {
toTx,
WhirlpoolContext,
WhirlpoolIx,
} from "../../../../src";
import { IGNORE_CACHE } from "../../../../src/network/public/fetcher";
} from "../../../src";
import { IGNORE_CACHE } from "../../../src/network/public/fetcher";
import {
getProviderWalletKeypair,
getTokenBalance,
sleep,
TEST_TOKEN_2022_PROGRAM_ID,
TickSpacing,
} from "../../../utils";
import { defaultConfirmOptions } from "../../../utils/const";
} from "../../utils";
import { defaultConfirmOptions } from "../../utils/const";
import {
fundPositionsV2,
initTestPoolWithTokensV2,
} from "../../../utils/v2/init-utils-v2";
} from "../../utils/v2/init-utils-v2";
import type { PublicKey } from "@solana/web3.js";
import { initTickArrayRange } from "../../../utils/init-utils";
import { TokenExtensionUtil } from "../../../../src/utils/public/token-extension-util";
import { initTickArrayRange } from "../../utils/init-utils";
import { TokenExtensionUtil } from "../../../src/utils/public/token-extension-util";
import {
amountToUiAmount,
updateRateInterestBearingMint,
Expand Down
Loading