diff --git a/package.json b/package.json index 6f3b4ef..2e74668 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Raydium SDK V2 demo.", "license": "GPL-3.0", "dependencies": { - "@raydium-io/raydium-sdk-v2": "0.1.101-alpha", + "@raydium-io/raydium-sdk-v2": "0.1.103-alpha", "@solana/spl-token": "^0.4.6", "@solana/web3.js": "^1.95.3", "@triton-one/yellowstone-grpc": "^1.2.0", diff --git a/src/amm/addLiquidity.ts b/src/amm/addLiquidity.ts index 16c4e98..2ca4f0f 100644 --- a/src/amm/addLiquidity.ts +++ b/src/amm/addLiquidity.ts @@ -11,6 +11,7 @@ import { initSdk, txVersion } from '../config' import { isValidAmm } from './utils' import Decimal from 'decimal.js' import BN from 'bn.js' +import { PublicKey } from '@solana/web3.js' export const addLiquidity = async () => { const raydium = await initSdk() @@ -62,6 +63,12 @@ export const addLiquidity = async () => { // units: 600000, // microLamports: 46591500, // }, + + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) // don't want to wait confirm, set sendAndConfirm to false or don't pass any params to execute diff --git a/src/amm/swap.ts b/src/amm/swap.ts index 9ea1169..504c9f4 100644 --- a/src/amm/swap.ts +++ b/src/amm/swap.ts @@ -5,6 +5,7 @@ import { isValidAmm } from './utils' import Decimal from 'decimal.js' import { NATIVE_MINT } from '@solana/spl-token' import { printSimulateInfo } from '../util' +import { PublicKey } from '@solana/web3.js' export const swap = async () => { const raydium = await initSdk() @@ -82,10 +83,16 @@ export const swap = async () => { // }, // optional: set up priority fee here - computeBudgetConfig: { - units: 600000, - microLamports: 46591500, - }, + // computeBudgetConfig: { + // units: 600000, + // microLamports: 46591500, + // }, + + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) printSimulateInfo() @@ -97,4 +104,4 @@ export const swap = async () => { } /** uncomment code below to execute */ -swap() +// swap() diff --git a/src/amm/swapBaseOut.ts b/src/amm/swapBaseOut.ts index 901a3ea..0cd92ed 100644 --- a/src/amm/swapBaseOut.ts +++ b/src/amm/swapBaseOut.ts @@ -12,6 +12,7 @@ import { isValidAmm } from './utils' import Decimal from 'decimal.js' import { NATIVE_MINT } from '@solana/spl-token' import { printSimulateInfo } from '../util' +import { PublicKey } from '@solana/web3.js' // setLoggerLevel('Raydium_LiquidityV2', LogLevel.Debug) // uncomment to show debug log @@ -94,6 +95,12 @@ export const swapBaseOut = async () => { units: 600000, microLamports: 465915, }, + + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) printSimulateInfo() diff --git a/src/amm/withdrawLiquidity.ts b/src/amm/withdrawLiquidity.ts index ea683dc..8b8a690 100644 --- a/src/amm/withdrawLiquidity.ts +++ b/src/amm/withdrawLiquidity.ts @@ -3,6 +3,7 @@ import { initSdk, txVersion } from '../config' import BN from 'bn.js' import Decimal from 'decimal.js' import { isValidAmm } from './utils' +import { PublicKey } from '@solana/web3.js' export const withdrawLiquidity = async () => { const raydium = await initSdk() @@ -50,6 +51,12 @@ export const withdrawLiquidity = async () => { // units: 600000, // microLamports: 46591500, // }, + + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) // don't want to wait confirm, set sendAndConfirm to false or don't pass any params to execute diff --git a/src/clmm/closePosition.ts b/src/clmm/closePosition.ts index fbbf6f4..05ffd4f 100644 --- a/src/clmm/closePosition.ts +++ b/src/clmm/closePosition.ts @@ -36,6 +36,11 @@ export const closePosition = async () => { poolKeys, ownerPosition: position, txVersion, + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) // don't want to wait confirm, set sendAndConfirm to false or don't pass any params to execute diff --git a/src/clmm/createFarm.ts b/src/clmm/createFarm.ts index a554120..79a099b 100644 --- a/src/clmm/createFarm.ts +++ b/src/clmm/createFarm.ts @@ -52,6 +52,12 @@ export const createFarm = async () => { // units: 600000, // microLamports: 46591500, // }, + + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) // don't want to wait confirm, set sendAndConfirm to false or don't pass any params to execute diff --git a/src/clmm/decreaseLiquidity.ts b/src/clmm/decreaseLiquidity.ts index 4578471..2343e42 100644 --- a/src/clmm/decreaseLiquidity.ts +++ b/src/clmm/decreaseLiquidity.ts @@ -50,6 +50,11 @@ export const decreaseLiquidity = async () => { // units: 600000, // microLamports: 46591500, // }, + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) // don't want to wait confirm, set sendAndConfirm to false or don't pass any params to execute diff --git a/src/clmm/increaseLiquidity.ts b/src/clmm/increaseLiquidity.ts index f491844..fcc2c59 100644 --- a/src/clmm/increaseLiquidity.ts +++ b/src/clmm/increaseLiquidity.ts @@ -66,6 +66,12 @@ export const increaseLiquidity = async () => { // units: 600000, // microLamports: 46591500, // }, + + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) // don't want to wait confirm, set sendAndConfirm to false or don't pass any params to execute diff --git a/src/clmm/lockPosition.ts b/src/clmm/lockPosition.ts index d761a6d..9402d89 100644 --- a/src/clmm/lockPosition.ts +++ b/src/clmm/lockPosition.ts @@ -44,6 +44,12 @@ export const lockPosition = async () => { // units: 600000, // microLamports: 46591500, // }, + + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) const { txId } = await execute({}) diff --git a/src/clmm/swap.ts b/src/clmm/swap.ts index 5af4b06..5f69867 100644 --- a/src/clmm/swap.ts +++ b/src/clmm/swap.ts @@ -10,6 +10,7 @@ import BN from 'bn.js' import { initSdk, txVersion } from '../config' import { isValidClmm } from './utils' import { printSimulateInfo } from '../util' +import { PublicKey } from '@solana/web3.js' export const swap = async () => { const raydium = await initSdk() @@ -78,6 +79,12 @@ export const swap = async () => { // units: 600000, // microLamports: 465915, // }, + + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) printSimulateInfo() diff --git a/src/clmm/swapBaseOut.ts b/src/clmm/swapBaseOut.ts index 4fa1d7e..e056d79 100644 --- a/src/clmm/swapBaseOut.ts +++ b/src/clmm/swapBaseOut.ts @@ -11,6 +11,7 @@ import { initSdk, txVersion } from '../config' import { isValidClmm } from './utils' import { NATIVE_MINT } from '@solana/spl-token' import Decimal from 'decimal.js' +import { PublicKey } from '@solana/web3.js' // swapBaseOut means fixed output token amount, calculate needed input token amount export const swapBaseOut = async () => { @@ -93,6 +94,12 @@ export const swapBaseOut = async () => { units: 600000, microLamports: 465915, }, + + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) const { txId } = await execute({ sendAndConfirm: true }) diff --git a/src/cpmm/deposit.ts b/src/cpmm/deposit.ts index b17fcb2..2e35ec6 100644 --- a/src/cpmm/deposit.ts +++ b/src/cpmm/deposit.ts @@ -62,6 +62,12 @@ export const deposit = async () => { // units: 600000, // microLamports: 46591500, // }, + + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) // don't want to wait confirm, set sendAndConfirm to false or don't pass any params to execute // const { txId } = await execute({ sendAndConfirm: true }) diff --git a/src/cpmm/harvestLockLiquidity.ts b/src/cpmm/harvestLockLiquidity.ts index f6123a1..90fcdf9 100644 --- a/src/cpmm/harvestLockLiquidity.ts +++ b/src/cpmm/harvestLockLiquidity.ts @@ -25,6 +25,11 @@ export const harvestLockLiquidity = async () => { nftMint: new PublicKey('CgkdQL6eRN1nxG2AmC8NFG5iboXuKtSjT4pShnspomZy'), // locked nft mint lpFeeAmount: new BN(99999999), txVersion, + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) const { txId } = await execute({ sendAndConfirm: true }) diff --git a/src/cpmm/swap.ts b/src/cpmm/swap.ts index 01df3b3..3765351 100644 --- a/src/cpmm/swap.ts +++ b/src/cpmm/swap.ts @@ -4,6 +4,7 @@ import BN from 'bn.js' import { isValidCpmm } from './utils' import { NATIVE_MINT } from '@solana/spl-token' import { printSimulateInfo } from '../util' +import { PublicKey } from '@solana/web3.js' export const swap = async () => { const raydium = await initSdk() @@ -62,6 +63,12 @@ export const swap = async () => { // units: 600000, // microLamports: 4659150, // }, + + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) printSimulateInfo() diff --git a/src/cpmm/swapBaseOut.ts b/src/cpmm/swapBaseOut.ts index 6a4e4c2..31d71a2 100644 --- a/src/cpmm/swapBaseOut.ts +++ b/src/cpmm/swapBaseOut.ts @@ -10,6 +10,7 @@ import BN from 'bn.js' import { isValidCpmm } from './utils' import { NATIVE_MINT } from '@solana/spl-token' import { printSimulateInfo } from '../util' +import { PublicKey } from '@solana/web3.js' // swapBaseOut means fixed output token amount, calculate needed input token amount export const swapBaseOut = async () => { @@ -79,6 +80,12 @@ export const swapBaseOut = async () => { units: 600000, microLamports: 465915, }, + + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) printSimulateInfo() diff --git a/src/cpmm/withdraw.ts b/src/cpmm/withdraw.ts index fc63100..1a4944a 100644 --- a/src/cpmm/withdraw.ts +++ b/src/cpmm/withdraw.ts @@ -36,6 +36,11 @@ export const withdraw = async () => { // units: 600000, // microLamports: 46591500, // }, + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) // don't want to wait confirm, set sendAndConfirm to false or don't pass any params to execute diff --git a/src/farm/stake.ts b/src/farm/stake.ts index b8b9ee5..66963ba 100644 --- a/src/farm/stake.ts +++ b/src/farm/stake.ts @@ -22,6 +22,11 @@ export const stake = async () => { // units: 600000, // microLamports: 46591500, // }, + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) // don't want to wait confirm, set sendAndConfirm to false or don't pass any params to execute diff --git a/src/farm/unstake.ts b/src/farm/unstake.ts index b89613a..bfcfd22 100644 --- a/src/farm/unstake.ts +++ b/src/farm/unstake.ts @@ -19,6 +19,11 @@ export const unstake = async () => { // units: 600000, // microLamports: 46591500, // }, + // optional: add transfer sol to tip account instruction. e.g sent tip to jito + // txTipConfig: { + // address: new PublicKey('96gYZGLnJYVFmbjzopPSU6QiEV5fGqZNyN9nmNhvrZU5'), + // amount: new BN(10000000), // 0.01 sol + // }, }) // don't want to wait confirm, set sendAndConfirm to false or don't pass any params to execute diff --git a/yarn.lock b/yarn.lock index ca24673..0a71cc3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -278,10 +278,10 @@ resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== -"@raydium-io/raydium-sdk-v2@0.1.101-alpha": - version "0.1.101-alpha" - resolved "https://registry.yarnpkg.com/@raydium-io/raydium-sdk-v2/-/raydium-sdk-v2-0.1.101-alpha.tgz#44833d7ba95c34655132b83c205d73aab3d47fc4" - integrity sha512-EN/b8RX1y3gXXugpAmyxpTOaCAvTtxEULzkygbkoy0tkxlP3Jh1FyzU3kXX3WT4q4oDXdunoMDZdlH4G0xQ81A== +"@raydium-io/raydium-sdk-v2@0.1.103-alpha": + version "0.1.103-alpha" + resolved "https://registry.yarnpkg.com/@raydium-io/raydium-sdk-v2/-/raydium-sdk-v2-0.1.103-alpha.tgz#78129f1f544772c21565fb9d6d7a7c43bbfa28ad" + integrity sha512-M65ghL755vB6BgOsuj47HlNyf53kZlFscpqwpzVmfiWsaMZuokx3MMQPirci8sSovgnVEpiJAPYdJjY0IiWQNQ== dependencies: "@solana/buffer-layout" "^4.0.1" "@solana/spl-token" "^0.4.8"