diff --git a/sdk/src/impl/position-impl.ts b/sdk/src/impl/position-impl.ts index 0b28262..a5447ee 100644 --- a/sdk/src/impl/position-impl.ts +++ b/sdk/src/impl/position-impl.ts @@ -44,9 +44,9 @@ export class PositionImpl implements Position { async increaseLiquidity( liquidityInput: IncreaseLiquidityInput, + resolveATA = true, sourceWallet?: Address, positionWallet?: Address, - resolveATA?: boolean, ataPayer?: Address ) { const sourceWalletKey = sourceWallet @@ -117,9 +117,9 @@ export class PositionImpl implements Position { async decreaseLiquidity( liquidityInput: DecreaseLiquidityInput, + resolveATA = true, sourceWallet?: Address, positionWallet?: Address, - resolveATA?: boolean, ataPayer?: Address ) { const sourceWalletKey = sourceWallet diff --git a/sdk/src/whirlpool-client.ts b/sdk/src/whirlpool-client.ts index e6cafb2..e6f4cd8 100644 --- a/sdk/src/whirlpool-client.ts +++ b/sdk/src/whirlpool-client.ts @@ -207,20 +207,20 @@ export interface Position { /** * Deposit additional tokens into this postiion. * The wallet must contain the position token and the necessary token A & B to complete the deposit. - * If `positionWallet` are `wallet` is provided, the wallet owners have to sign this transaction. + * If `positionWallet` and `wallet` is provided, the wallet owners have to sign this transaction. * * @param liquidityInput - input that defines the desired liquidity amount and maximum tokens willing to be to deposited. + * @param resolveATA - optional - if true, add instructions to create associated token accounts for tokenA,B for the destinationWallet if necessary. (RPC call required) * @param wallet - the wallet to withdraw tokens to deposit into the position. If null, the WhirlpoolContext wallet is used. * @param positionWallet - optional - the wallet to that houses the position token. If null, the WhirlpoolContext wallet is used. - * @param resolveATA - optional - if true, add instructions to create associated token accounts for tokenA,B for the destinationWallet if necessary. * @param ataPayer - optional - wallet that will fund the creation of the new associated token accounts * @return the transaction that will deposit the tokens into the position when executed. */ increaseLiquidity: ( liquidityInput: IncreaseLiquidityInput, + resolveATA?: boolean, wallet?: Address, positionWallet?: Address, - resolveATA?: boolean, ataPayer?: Address ) => Promise; @@ -230,17 +230,17 @@ export interface Position { * If `positionWallet` is provided, the wallet owners have to sign this transaction. * * @param liquidityInput - input that defines the desired liquidity amount and minimum tokens willing to be to withdrawn from the position. + * @param resolveATA - optional - if true, add instructions to create associated token accounts for tokenA,B for the destinationWallet if necessary. (RPC call required) * @param destinationWallet - optional - the wallet to deposit tokens into when withdrawing from the position. If null, the WhirlpoolContext wallet is used. * @param positionWallet - optional - the wallet to that houses the position token. If null, the WhirlpoolContext wallet is used. - * @param resolveATA - optional - if true, add instructions to create associated token accounts for tokenA,B for the destinationWallet if necessary. * @param ataPayer - optional - wallet that will fund the creation of the new associated token accounts * @return the transaction that will deposit the tokens into the position when executed. */ decreaseLiquidity: ( liquidityInput: DecreaseLiquidityInput, + resolveATA?: boolean, destinationWallet?: Address, positionWallet?: Address, - resolveATA?: boolean, ataPayer?: Address ) => Promise; diff --git a/sdk/tests/sdk/whirlpools/position-impl.test.ts b/sdk/tests/sdk/whirlpools/position-impl.test.ts index 047b454..6cfaabc 100644 --- a/sdk/tests/sdk/whirlpools/position-impl.test.ts +++ b/sdk/tests/sdk/whirlpools/position-impl.test.ts @@ -79,7 +79,7 @@ describe("position-impl", () => { ); await ( - await position.increaseLiquidity(increase_quote, ctx.wallet.publicKey) + await position.increaseLiquidity(increase_quote, false, ctx.wallet.publicKey) ).buildAndExecute(); const postIncreaseData = await position.refreshData(); @@ -97,9 +97,7 @@ describe("position-impl", () => { pool ); - await ( - await position.decreaseLiquidity(decrease_quote, ctx.wallet.publicKey, ctx.wallet.publicKey) - ).buildAndExecute(); + await (await position.decreaseLiquidity(decrease_quote, false)).buildAndExecute(); const postWithdrawData = await position.refreshData(); const expectedPostWithdrawLiquidity = postIncreaseData.liquidity.sub( @@ -164,9 +162,7 @@ describe("position-impl", () => { pool ); - await ( - await position.increaseLiquidity(increase_quote, ctx.wallet.publicKey) - ).buildAndExecute(); + await (await position.increaseLiquidity(increase_quote, false)).buildAndExecute(); const postIncreaseData = await position.refreshData(); const expectedPostIncreaseLiquidity = preIncreaseData.liquidity.add( @@ -214,9 +210,9 @@ describe("position-impl", () => { await ( await position.increaseLiquidity( increaseQuoteFromOtherWallet, + true, otherWallet.publicKey, - otherWallet.publicKey, - true + otherWallet.publicKey ) ) .addSigner(otherWallet) @@ -229,9 +225,9 @@ describe("position-impl", () => { await ( await position.decreaseLiquidity( decrease_quote, + true, destinationWallet.publicKey, - otherWallet.publicKey, - true + otherWallet.publicKey ) ) .addSigner(otherWallet) diff --git a/sdk/tests/sdk/whirlpools/whirlpool-impl.test.ts b/sdk/tests/sdk/whirlpools/whirlpool-impl.test.ts index fd91115..11448b7 100644 --- a/sdk/tests/sdk/whirlpools/whirlpool-impl.test.ts +++ b/sdk/tests/sdk/whirlpools/whirlpool-impl.test.ts @@ -20,12 +20,7 @@ import { TickUtil, } from "../../../src"; import Decimal from "decimal.js"; -import { - deriveATA, - Percentage, - TransactionBuilder, - TransactionProcessor, -} from "@orca-so/common-sdk"; +import { deriveATA, Percentage, TransactionBuilder } from "@orca-so/common-sdk"; import { mintTokensToTestAccount } from "../../utils/test-builders"; describe("whirlpool-impl", () => {