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
5
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.11.6 to 0.11.7

6

dist/impl/whirlpool-impl.d.ts

@@ -26,7 +26,7 @@ import { Address } from "@coral-xyz/anchor";

refreshData(): Promise<WhirlpoolData>;
openPosition(tickLower: number, tickUpper: number, liquidityInput: IncreaseLiquidityInput, wallet?: Address, funder?: Address): Promise<{
openPosition(tickLower: number, tickUpper: number, liquidityInput: IncreaseLiquidityInput, wallet?: Address, funder?: Address, positionMint?: PublicKey): Promise<{
positionMint: PublicKey;
tx: TransactionBuilder;
}>;
openPositionWithMetadata(tickLower: number, tickUpper: number, liquidityInput: IncreaseLiquidityInput, sourceWallet?: Address, positionWallet?: Address, funder?: Address): Promise<{
openPositionWithMetadata(tickLower: number, tickUpper: number, liquidityInput: IncreaseLiquidityInput, sourceWallet?: Address, funder?: Address, positionMint?: PublicKey): Promise<{
positionMint: PublicKey;

@@ -42,3 +42,3 @@ tx: TransactionBuilder;

*/
getOpenPositionWithOptMetadataTx(tickLower: number, tickUpper: number, liquidityInput: IncreaseLiquidityInput, wallet: PublicKey, funder: PublicKey, withMetadata?: boolean): Promise<{
getOpenPositionWithOptMetadataTx(tickLower: number, tickUpper: number, liquidityInput: IncreaseLiquidityInput, wallet: PublicKey, funder: PublicKey, withMetadata?: boolean, positionMint?: PublicKey): Promise<{
positionMint: PublicKey;

@@ -45,0 +45,0 @@ tx: TransactionBuilder;

@@ -56,9 +56,9 @@ "use strict";

}
async openPosition(tickLower, tickUpper, liquidityInput, wallet, funder) {
async openPosition(tickLower, tickUpper, liquidityInput, wallet, funder, positionMint) {
await this.refresh();
return this.getOpenPositionWithOptMetadataTx(tickLower, tickUpper, liquidityInput, !!wallet ? common_sdk_1.AddressUtil.toPubKey(wallet) : this.ctx.wallet.publicKey, !!funder ? common_sdk_1.AddressUtil.toPubKey(funder) : this.ctx.wallet.publicKey);
return this.getOpenPositionWithOptMetadataTx(tickLower, tickUpper, liquidityInput, !!wallet ? common_sdk_1.AddressUtil.toPubKey(wallet) : this.ctx.wallet.publicKey, !!funder ? common_sdk_1.AddressUtil.toPubKey(funder) : this.ctx.wallet.publicKey, false, positionMint);
}
async openPositionWithMetadata(tickLower, tickUpper, liquidityInput, sourceWallet, positionWallet, funder) {
async openPositionWithMetadata(tickLower, tickUpper, liquidityInput, sourceWallet, funder, positionMint) {
await this.refresh();
return this.getOpenPositionWithOptMetadataTx(tickLower, tickUpper, liquidityInput, !!sourceWallet ? common_sdk_1.AddressUtil.toPubKey(sourceWallet) : this.ctx.wallet.publicKey, !!funder ? common_sdk_1.AddressUtil.toPubKey(funder) : this.ctx.wallet.publicKey, true);
return this.getOpenPositionWithOptMetadataTx(tickLower, tickUpper, liquidityInput, !!sourceWallet ? common_sdk_1.AddressUtil.toPubKey(sourceWallet) : this.ctx.wallet.publicKey, !!funder ? common_sdk_1.AddressUtil.toPubKey(funder) : this.ctx.wallet.publicKey, true, positionMint);
}

@@ -121,3 +121,3 @@ async initTickArrayForTicks(ticks, funder, opts = fetcher_1.IGNORE_CACHE) {

*/
async getOpenPositionWithOptMetadataTx(tickLower, tickUpper, liquidityInput, wallet, funder, withMetadata = false) {
async getOpenPositionWithOptMetadataTx(tickLower, tickUpper, liquidityInput, wallet, funder, withMetadata = false, positionMint) {
(0, tiny_invariant_1.default)(public_2.TickUtil.checkTickInBounds(tickLower), "tickLower is out of bounds.");

@@ -134,5 +134,6 @@ (0, tiny_invariant_1.default)(public_2.TickUtil.checkTickInBounds(tickUpper), "tickUpper is out of bounds.");

const positionMintKeypair = web3_js_1.Keypair.generate();
const positionPda = public_2.PDAUtil.getPosition(this.ctx.program.programId, positionMintKeypair.publicKey);
const metadataPda = public_2.PDAUtil.getPositionMetadata(positionMintKeypair.publicKey);
const positionTokenAccountAddress = (0, spl_token_1.getAssociatedTokenAddressSync)(positionMintKeypair.publicKey, wallet, this.ctx.accountResolverOpts.allowPDAOwnerAddress);
const positionMintPubkey = positionMint ?? positionMintKeypair.publicKey;
const positionPda = public_2.PDAUtil.getPosition(this.ctx.program.programId, positionMintPubkey);
const metadataPda = public_2.PDAUtil.getPositionMetadata(positionMintPubkey);
const positionTokenAccountAddress = (0, spl_token_1.getAssociatedTokenAddressSync)(positionMintPubkey, wallet, this.ctx.accountResolverOpts.allowPDAOwnerAddress);
const txBuilder = new common_sdk_1.TransactionBuilder(this.ctx.provider.connection, this.ctx.provider.wallet, this.ctx.txBuilderOpts);

@@ -144,3 +145,3 @@ const positionIx = (withMetadata ? instructions_1.openPositionWithMetadataIx : instructions_1.openPositionIx)(this.ctx.program, {

metadataPda,
positionMintAddress: positionMintKeypair.publicKey,
positionMintAddress: positionMintPubkey,
positionTokenAccount: positionTokenAccountAddress,

@@ -151,3 +152,6 @@ whirlpool: this.address,

});
txBuilder.addInstruction(positionIx).addSigner(positionMintKeypair);
txBuilder.addInstruction(positionIx);
if (positionMint === undefined) {
txBuilder.addSigner(positionMintKeypair);
}
const [ataA, ataB] = await (0, common_sdk_1.resolveOrCreateATAs)(this.ctx.connection, wallet, [

@@ -181,3 +185,3 @@ { tokenMint: whirlpool.tokenMintA, wrappedSolAmountIn: tokenMaxA },

return {
positionMint: positionMintKeypair.publicKey,
positionMint: positionMintPubkey,
tx: txBuilder,

@@ -184,0 +188,0 @@ };

@@ -167,5 +167,6 @@ import { Address } from "@coral-xyz/anchor";

* @param funder - the wallet that will fund the cost needed to initialize the position. If null, the WhirlpoolContext wallet is used.
* @param positionMint - the mint address of the position token to be created. If null, a new mint address will be created.
* @return `positionMint` - the position to be created. `tx` - The transaction containing the instructions to perform the operation on chain.
*/
openPosition: (tickLower: number, tickUpper: number, liquidityInput: IncreaseLiquidityInput, wallet?: Address, funder?: Address) => Promise<{
openPosition: (tickLower: number, tickUpper: number, liquidityInput: IncreaseLiquidityInput, wallet?: Address, funder?: Address, positionMint?: PublicKey) => Promise<{
positionMint: PublicKey;

@@ -186,5 +187,6 @@ tx: TransactionBuilder;

* @param funder - the wallet that will fund the cost needed to initialize the position. If null, the WhirlpoolContext wallet is used.
* @param positionMint - the mint address of the position token to be created. If null, a new mint address will be created.
* @return `positionMint` - the position to be created. `tx` - The transaction containing the instructions to perform the operation on chain.
*/
openPositionWithMetadata: (tickLower: number, tickUpper: number, liquidityInput: IncreaseLiquidityInput, wallet?: Address, funder?: Address) => Promise<{
openPositionWithMetadata: (tickLower: number, tickUpper: number, liquidityInput: IncreaseLiquidityInput, wallet?: Address, funder?: Address, positionMint?: PublicKey) => Promise<{
positionMint: PublicKey;

@@ -191,0 +193,0 @@ tx: TransactionBuilder;

{
"name": "@orca-so/whirlpools-sdk",
"version": "0.11.6",
"version": "0.11.7",
"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