Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@orca-so/whirlpools-sdk

Package Overview
Dependencies
Maintainers
4
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orca-so/whirlpools-sdk - npm Package Compare versions

Comparing version 0.2.3 to 0.3.1

4

dist/impl/position-impl.d.ts

@@ -18,5 +18,5 @@ import { TransactionBuilder } from "@orca-so/common-sdk";

refreshData(): Promise<PositionData>;
increaseLiquidity(liquidityInput: IncreaseLiquidityInput, sourceWallet?: Address, positionWallet?: Address): Promise<TransactionBuilder>;
decreaseLiquidity(liquidityInput: DecreaseLiquidityInput, sourceWallet?: Address, positionWallet?: Address, resolveATA?: boolean, ataPayer?: Address): Promise<TransactionBuilder>;
increaseLiquidity(liquidityInput: IncreaseLiquidityInput, resolveATA?: boolean, sourceWallet?: Address, positionWallet?: Address, ataPayer?: Address): Promise<TransactionBuilder>;
decreaseLiquidity(liquidityInput: DecreaseLiquidityInput, resolveATA?: boolean, sourceWallet?: Address, positionWallet?: Address, ataPayer?: Address): Promise<TransactionBuilder>;
private refresh;
}

@@ -46,3 +46,3 @@ "use strict";

}
increaseLiquidity(liquidityInput, sourceWallet, positionWallet) {
increaseLiquidity(liquidityInput, resolveATA = true, sourceWallet, positionWallet, ataPayer) {
return __awaiter(this, void 0, void 0, function* () {

@@ -55,2 +55,3 @@ const sourceWalletKey = sourceWallet

: this.ctx.wallet.publicKey;
const ataPayerKey = ataPayer ? common_sdk_1.AddressUtil.toPubKey(ataPayer) : this.ctx.wallet.publicKey;
const whirlpool = yield this.fetcher.getPool(this.data.whirlpool, true);

@@ -61,4 +62,20 @@ if (!whirlpool) {

const txBuilder = new common_sdk_1.TransactionBuilder(this.ctx.provider);
const tokenOwnerAccountA = yield (0, common_sdk_1.deriveATA)(sourceWalletKey, whirlpool.tokenMintA);
const tokenOwnerAccountB = yield (0, common_sdk_1.deriveATA)(sourceWalletKey, whirlpool.tokenMintB);
let tokenOwnerAccountA;
let tokenOwnerAccountB;
if (resolveATA) {
const [ataA, ataB] = yield (0, common_sdk_1.resolveOrCreateATAs)(this.ctx.connection, sourceWalletKey, [
{ tokenMint: whirlpool.tokenMintA, wrappedSolAmountIn: liquidityInput.tokenMaxA },
{ tokenMint: whirlpool.tokenMintB, wrappedSolAmountIn: liquidityInput.tokenMaxB },
], () => this.fetcher.getAccountRentExempt(), ataPayerKey);
const _a = ataA, { address: ataAddrA } = _a, tokenOwnerAccountAIx = __rest(_a, ["address"]);
const _b = ataB, { address: ataAddrB } = _b, tokenOwnerAccountBIx = __rest(_b, ["address"]);
tokenOwnerAccountA = ataAddrA;
tokenOwnerAccountB = ataAddrB;
txBuilder.addInstruction(tokenOwnerAccountAIx);
txBuilder.addInstruction(tokenOwnerAccountBIx);
}
else {
tokenOwnerAccountA = yield (0, common_sdk_1.deriveATA)(sourceWalletKey, whirlpool.tokenMintA);
tokenOwnerAccountB = yield (0, common_sdk_1.deriveATA)(sourceWalletKey, whirlpool.tokenMintB);
}
const positionTokenAccount = yield (0, common_sdk_1.deriveATA)(positionWalletKey, this.data.positionMint);

@@ -72,3 +89,3 @@ const increaseIx = (0, instructions_1.increaseLiquidityIx)(this.ctx.program, Object.assign(Object.assign({}, liquidityInput), { whirlpool: this.data.whirlpool, position: this.address, positionTokenAccount,

}
decreaseLiquidity(liquidityInput, sourceWallet, positionWallet, resolveATA, ataPayer) {
decreaseLiquidity(liquidityInput, resolveATA = true, sourceWallet, positionWallet, ataPayer) {
return __awaiter(this, void 0, void 0, function* () {

@@ -75,0 +92,0 @@ const sourceWalletKey = sourceWallet

@@ -165,9 +165,12 @@ import { Percentage, TransactionBuilder } from "@orca-so/common-sdk";

* The wallet must contain the position token and the necessary token A & B to complete the deposit.
* If `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 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, wallet?: Address) => Promise<TransactionBuilder>;
increaseLiquidity: (liquidityInput: IncreaseLiquidityInput, resolveATA?: boolean, wallet?: Address, positionWallet?: Address, ataPayer?: Address) => Promise<TransactionBuilder>;
/**

@@ -179,9 +182,9 @@ * Withdraw liquidity from this position.

* @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, destinationWallet?: Address, positionWallet?: Address, resolveATA?: boolean, ataPayer?: Address) => Promise<TransactionBuilder>;
decreaseLiquidity: (liquidityInput: DecreaseLiquidityInput, resolveATA?: boolean, destinationWallet?: Address, positionWallet?: Address, ataPayer?: Address) => Promise<TransactionBuilder>;
}
{
"name": "@orca-so/whirlpools-sdk",
"version": "0.2.3",
"version": "0.3.1",
"description": "Typescript SDK to interact with Orca's Whirlpool program.",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc