Skip to content

Commit 49fa31a

Browse files
authored
Adaptive Fee SDK update (base change) (#926)
* integrating adaptive fee * integrating adaptive fee * drop deprecated features (WhirlpoolRouter, PriceModule) * drop deprecated feature (PoolGraph) * update swapQuoteWithParams * fix test utils * wrap adaptiveFeeInfo by adaptiveFeeCtx to handle trade enable timestamp * fix field name * update adaptive_fee test cases with quote * lint * add FeeRateManager (TS) test cases * lint * integrating adaptive fee (new sdk) * remove adaptiveFeeCtx * adaptive fee (new sdk) * tweak (self review) * format * tweak * update test case (rust-sdk core) * revert tweak (feeTierIndex to feeTierIndexSeed) * fix legacy-sdk test cases (merged test cases) * add quick check test cases for adaptive fee * tickSpacing to feeTierIndex * add gpa helper functions * lint * changeset + Cargo.lock updates * fix lint errors * fix merge issue * address review comment * util method name update * add is_initialized_with_adaptive_fee with WASM * cargo fmt * add use wasm_expose * fix lint error
1 parent 7e76812 commit 49fa31a

File tree

77 files changed

+5459
-4519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+5459
-4519
lines changed

.changeset/yellow-dots-look.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
"@orca-so/whirlpools-rust": major
3+
"@orca-so/whirlpools": major
4+
"@orca-so/whirlpools-rust-client": major
5+
"@orca-so/whirlpools-rust-core": major
6+
"@orca-so/whirlpools-client": major
7+
"@orca-so/whirlpools-core": major
8+
"@orca-so/whirlpools-sdk": minor
9+
"@orca-so/whirlpools-sdk-cli": patch
10+
---
11+
12+
Adaptive Fee SDK update

legacy-sdk/cli/src/commands/poolops/push_price.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,12 @@ const quote = swapQuoteWithParams(
165165
tickArrays,
166166
whirlpoolData: whirlpool,
167167
tokenExtensionCtx,
168-
168+
oracleData: await SwapUtils.getOracle(
169+
ORCA_WHIRLPOOL_PROGRAM_ID,
170+
whirlpoolPubkey,
171+
ctx.fetcher,
172+
IGNORE_CACHE,
173+
),
169174
// use too much input to estimate required input amount
170175
tokenAmount: U64_MAX,
171176
sqrtPriceLimit: targetSqrtPrice,

legacy-sdk/whirlpool/src/errors/errors.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,13 @@ export enum SwapErrorCode {
2222
TickArraySequenceInvalid = `TickArraySequenceInvalid`,
2323
AmountRemainingOverflow = `AmountRemainingOverflow`,
2424
AmountCalcOverflow = `AmountCalcOverflow`,
25-
}
26-
27-
export enum RouteQueryErrorCode {
28-
RouteDoesNotExist = "RouteDoesNotExist",
29-
TradeAmountTooHigh = "TradeAmountTooHigh",
30-
ZeroInputAmount = "ZeroInputAmount",
31-
General = "General",
25+
TradeIsNotEnabled = `TradeIsNotEnabled`,
3226
}
3327

3428
export type WhirlpoolsErrorCode =
3529
| TokenErrorCode
3630
| SwapErrorCode
37-
| MathErrorCode
38-
| RouteQueryErrorCode;
31+
| MathErrorCode;
3932

4033
export class WhirlpoolsError extends Error {
4134
message: string;

legacy-sdk/whirlpool/src/impl/whirlpool-client-impl.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import type {
1414
WhirlpoolAccountFetcherInterface,
1515
} from "../network/public/fetcher";
1616
import { IGNORE_CACHE, PREFER_CACHE } from "../network/public/fetcher";
17-
import type { WhirlpoolRouter } from "../router/public";
18-
import { WhirlpoolRouterBuilder } from "../router/public";
1917
import type { WhirlpoolData } from "../types/public";
2018
import { SPLASH_POOL_TICK_SPACING } from "../types/public";
2119
import { getTickArrayDataForPosition } from "../utils/builder/position-builder-util";
@@ -46,10 +44,6 @@ export class WhirlpoolClientImpl implements WhirlpoolClient {
4644
return this.ctx.fetcher;
4745
}
4846

49-
public getRouter(poolAddresses: Address[]): Promise<WhirlpoolRouter> {
50-
return WhirlpoolRouterBuilder.buildWithPools(this.ctx, poolAddresses);
51-
}
52-
5347
public async getPool(
5448
poolAddress: Address,
5549
opts = PREFER_CACHE,

legacy-sdk/whirlpool/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ export * from "./context";
44
export * from "./impl/position-impl";
55
export * from "./ix";
66
export * from "./network/public";
7-
export * from "./prices";
87
export * from "./quotes/public";
9-
export * from "./router/public";
108
export * from "./types/public";
119
export * from "./types/public/anchor-types";
1210
export * from "./utils/public";

0 commit comments

Comments
 (0)