Skip to content

Commit 8b1bad8

Browse files
committed
v13.16.2: minor raydium improvements and fixes
1 parent da2f0d4 commit 8b1bad8

File tree

8 files changed

+75
-203
lines changed

8 files changed

+75
-203
lines changed

dist/esm/index.js

Lines changed: 15 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Token from '@depay/web3-tokens';
22
import { request, getProvider } from '@depay/web3-client';
33
import { ethers } from 'ethers';
44
import Blockchains from '@depay/web3-blockchains';
5-
import { BN, struct, publicKey, u128, u64 as u64$1, seq, u8, u16, i32, bool, i128, PublicKey, Buffer, Keypair, SystemProgram, TransactionInstruction, blob, u32, Transaction } from '@depay/solana-web3.js';
5+
import { BN, struct, publicKey, u128, u64 as u64$1, seq, u8, u16, i32, bool, i128, PublicKey, Buffer, Keypair, SystemProgram, TransactionInstruction, blob, u32 } from '@depay/solana-web3.js';
66
import Decimal from 'decimal.js';
77

88
function _optionalChain$6(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }class Route {
@@ -3325,31 +3325,31 @@ const getTransaction$4 = async({
33253325
const dataLayout = struct([u64$1("amountIn"), u64$1("amounOutMin")]);
33263326

33273327
const keys = [
3328-
// payer
3328+
// 0 payer
33293329
{ pubkey: new PublicKey(account), isSigner: true, isWritable: false },
3330-
// authority
3330+
// 1 authority
33313331
{ pubkey: await getPdaPoolAuthority(CP_PROGRAM_ID), isSigner: false, isWritable: false },
3332-
// configId
3332+
// 2 configId
33333333
{ pubkey: pool.data.configId, isSigner: false, isWritable: false },
3334-
// poolId
3334+
// 3 poolId
33353335
{ pubkey: poolId, isSigner: false, isWritable: true },
3336-
// userInputAccount
3336+
// 4 userInputAccount
33373337
{ pubkey: tokenAccountIn, isSigner: false, isWritable: true },
3338-
// userOutputAccount
3338+
// 5 userOutputAccount
33393339
{ pubkey: tokenAccountOut, isSigner: false, isWritable: true },
3340-
// inputVault
3340+
// 6 inputVault
33413341
{ pubkey: inputVault, isSigner: false, isWritable: true },
3342-
// outputVault
3342+
// 7 outputVault
33433343
{ pubkey: outputVault, isSigner: false, isWritable: true },
3344-
// inputTokenProgram
3344+
// 8 inputTokenProgram
33453345
{ pubkey: new PublicKey(Token.solana.TOKEN_PROGRAM), isSigner: false, isWritable: false },
3346-
// outputTokenProgram
3346+
// 9 outputTokenProgram
33473347
{ pubkey: new PublicKey(Token.solana.TOKEN_PROGRAM), isSigner: false, isWritable: false },
3348-
// inputMint
3348+
// 10 inputMint
33493349
{ pubkey: inputMint, isSigner: false, isWritable: false },
3350-
// outputMint
3350+
// 11 outputMint
33513351
{ pubkey: outputMint, isSigner: false, isWritable: false },
3352-
// observationId
3352+
// 12 observationId
33533353
{ pubkey: await getPdaObservationId(CP_PROGRAM_ID, poolId), isSigner: false, isWritable: true },
33543354
];
33553355

@@ -3426,44 +3426,12 @@ const getTransaction$4 = async({
34263426
);
34273427
}
34283428

3429-
await debug(instructions, provider);
3429+
// await debug(instructions, provider)
34303430

34313431
transaction.instructions = instructions;
34323432
return transaction
34333433
};
34343434

3435-
const debug = async(instructions, provider)=>{
3436-
console.log('instructions.length', instructions.length);
3437-
let data;
3438-
instructions.forEach((instruction)=>{
3439-
console.log('INSTRUCTION.programId', instruction.programId.toString());
3440-
console.log('INSTRUCTION.keys', instruction.keys);
3441-
try {
3442-
const LAYOUT = struct([
3443-
u64$1("anchorDiscriminator"),
3444-
u64$1("amount"),
3445-
u64$1("otherAmountThreshold"),
3446-
u128("sqrtPriceLimit"),
3447-
bool("amountSpecifiedIsInput"),
3448-
bool("aToB"),
3449-
]);
3450-
data = LAYOUT.decode(instruction.data);
3451-
} catch (e3) {}
3452-
});
3453-
if(data) {
3454-
console.log('INSTRUCTION.data', data);
3455-
console.log('amount', data.amount.toString());
3456-
console.log('otherAmountThreshold', data.otherAmountThreshold.toString());
3457-
console.log('sqrtPriceLimit', data.sqrtPriceLimit.toString());
3458-
}
3459-
let simulation = new Transaction({ feePayer: new PublicKey('2UgCJaHU5y8NC4uWQcZYeV9a5RyYLF7iKYCybCsdFFD1') });
3460-
instructions.forEach((instruction)=>simulation.add(instruction));
3461-
let result;
3462-
console.log('SIMULATE');
3463-
try{ result = await provider.simulateTransaction(simulation); } catch(e) { console.log('error', e); }
3464-
console.log('SIMULATION RESULT', result);
3465-
};
3466-
34673435
var Raydium = {
34683436
findPath: findPath$4,
34693437
pathExists: pathExists$4,

dist/esm/index.solana.js

Lines changed: 15 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Token from '@depay/web3-tokens-solana';
22
import { request, getProvider } from '@depay/web3-client-solana';
33
import { ethers } from 'ethers';
44
import Blockchains from '@depay/web3-blockchains';
5-
import { BN, struct, publicKey, u128, u64 as u64$1, seq, u8, u16, i32, bool, i128, PublicKey, Buffer, Keypair, SystemProgram, TransactionInstruction, blob, u32, Transaction } from '@depay/solana-web3.js';
5+
import { BN, struct, publicKey, u128, u64 as u64$1, seq, u8, u16, i32, bool, i128, PublicKey, Buffer, Keypair, SystemProgram, TransactionInstruction, blob, u32 } from '@depay/solana-web3.js';
66
import Decimal from 'decimal.js';
77

88
function _optionalChain$2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }class Route {
@@ -2968,31 +2968,31 @@ const getTransaction = async({
29682968
const dataLayout = struct([u64$1("amountIn"), u64$1("amounOutMin")]);
29692969

29702970
const keys = [
2971-
// payer
2971+
// 0 payer
29722972
{ pubkey: new PublicKey(account), isSigner: true, isWritable: false },
2973-
// authority
2973+
// 1 authority
29742974
{ pubkey: await getPdaPoolAuthority(CP_PROGRAM_ID), isSigner: false, isWritable: false },
2975-
// configId
2975+
// 2 configId
29762976
{ pubkey: pool.data.configId, isSigner: false, isWritable: false },
2977-
// poolId
2977+
// 3 poolId
29782978
{ pubkey: poolId, isSigner: false, isWritable: true },
2979-
// userInputAccount
2979+
// 4 userInputAccount
29802980
{ pubkey: tokenAccountIn, isSigner: false, isWritable: true },
2981-
// userOutputAccount
2981+
// 5 userOutputAccount
29822982
{ pubkey: tokenAccountOut, isSigner: false, isWritable: true },
2983-
// inputVault
2983+
// 6 inputVault
29842984
{ pubkey: inputVault, isSigner: false, isWritable: true },
2985-
// outputVault
2985+
// 7 outputVault
29862986
{ pubkey: outputVault, isSigner: false, isWritable: true },
2987-
// inputTokenProgram
2987+
// 8 inputTokenProgram
29882988
{ pubkey: new PublicKey(Token.solana.TOKEN_PROGRAM), isSigner: false, isWritable: false },
2989-
// outputTokenProgram
2989+
// 9 outputTokenProgram
29902990
{ pubkey: new PublicKey(Token.solana.TOKEN_PROGRAM), isSigner: false, isWritable: false },
2991-
// inputMint
2991+
// 10 inputMint
29922992
{ pubkey: inputMint, isSigner: false, isWritable: false },
2993-
// outputMint
2993+
// 11 outputMint
29942994
{ pubkey: outputMint, isSigner: false, isWritable: false },
2995-
// observationId
2995+
// 12 observationId
29962996
{ pubkey: await getPdaObservationId(CP_PROGRAM_ID, poolId), isSigner: false, isWritable: true },
29972997
];
29982998

@@ -3069,44 +3069,12 @@ const getTransaction = async({
30693069
);
30703070
}
30713071

3072-
await debug(instructions, provider);
3072+
// await debug(instructions, provider)
30733073

30743074
transaction.instructions = instructions;
30753075
return transaction
30763076
};
30773077

3078-
const debug = async(instructions, provider)=>{
3079-
console.log('instructions.length', instructions.length);
3080-
let data;
3081-
instructions.forEach((instruction)=>{
3082-
console.log('INSTRUCTION.programId', instruction.programId.toString());
3083-
console.log('INSTRUCTION.keys', instruction.keys);
3084-
try {
3085-
const LAYOUT = struct([
3086-
u64$1("anchorDiscriminator"),
3087-
u64$1("amount"),
3088-
u64$1("otherAmountThreshold"),
3089-
u128("sqrtPriceLimit"),
3090-
bool("amountSpecifiedIsInput"),
3091-
bool("aToB"),
3092-
]);
3093-
data = LAYOUT.decode(instruction.data);
3094-
} catch (e3) {}
3095-
});
3096-
if(data) {
3097-
console.log('INSTRUCTION.data', data);
3098-
console.log('amount', data.amount.toString());
3099-
console.log('otherAmountThreshold', data.otherAmountThreshold.toString());
3100-
console.log('sqrtPriceLimit', data.sqrtPriceLimit.toString());
3101-
}
3102-
let simulation = new Transaction({ feePayer: new PublicKey('2UgCJaHU5y8NC4uWQcZYeV9a5RyYLF7iKYCybCsdFFD1') });
3103-
instructions.forEach((instruction)=>simulation.add(instruction));
3104-
let result;
3105-
console.log('SIMULATE');
3106-
try{ result = await provider.simulateTransaction(simulation); } catch(e) { console.log('error', e); }
3107-
console.log('SIMULATION RESULT', result);
3108-
};
3109-
31103078
var Raydium = {
31113079
findPath,
31123080
pathExists,

dist/umd/index.js

Lines changed: 14 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3330,31 +3330,31 @@
33303330
const dataLayout = solanaWeb3_js.struct([solanaWeb3_js.u64("amountIn"), solanaWeb3_js.u64("amounOutMin")]);
33313331

33323332
const keys = [
3333-
// payer
3333+
// 0 payer
33343334
{ pubkey: new solanaWeb3_js.PublicKey(account), isSigner: true, isWritable: false },
3335-
// authority
3335+
// 1 authority
33363336
{ pubkey: await getPdaPoolAuthority(CP_PROGRAM_ID), isSigner: false, isWritable: false },
3337-
// configId
3337+
// 2 configId
33383338
{ pubkey: pool.data.configId, isSigner: false, isWritable: false },
3339-
// poolId
3339+
// 3 poolId
33403340
{ pubkey: poolId, isSigner: false, isWritable: true },
3341-
// userInputAccount
3341+
// 4 userInputAccount
33423342
{ pubkey: tokenAccountIn, isSigner: false, isWritable: true },
3343-
// userOutputAccount
3343+
// 5 userOutputAccount
33443344
{ pubkey: tokenAccountOut, isSigner: false, isWritable: true },
3345-
// inputVault
3345+
// 6 inputVault
33463346
{ pubkey: inputVault, isSigner: false, isWritable: true },
3347-
// outputVault
3347+
// 7 outputVault
33483348
{ pubkey: outputVault, isSigner: false, isWritable: true },
3349-
// inputTokenProgram
3349+
// 8 inputTokenProgram
33503350
{ pubkey: new solanaWeb3_js.PublicKey(Token__default['default'].solana.TOKEN_PROGRAM), isSigner: false, isWritable: false },
3351-
// outputTokenProgram
3351+
// 9 outputTokenProgram
33523352
{ pubkey: new solanaWeb3_js.PublicKey(Token__default['default'].solana.TOKEN_PROGRAM), isSigner: false, isWritable: false },
3353-
// inputMint
3353+
// 10 inputMint
33543354
{ pubkey: inputMint, isSigner: false, isWritable: false },
3355-
// outputMint
3355+
// 11 outputMint
33563356
{ pubkey: outputMint, isSigner: false, isWritable: false },
3357-
// observationId
3357+
// 12 observationId
33583358
{ pubkey: await getPdaObservationId(CP_PROGRAM_ID, poolId), isSigner: false, isWritable: true },
33593359
];
33603360

@@ -3431,44 +3431,12 @@
34313431
);
34323432
}
34333433

3434-
await debug(instructions, provider);
3434+
// await debug(instructions, provider)
34353435

34363436
transaction.instructions = instructions;
34373437
return transaction
34383438
};
34393439

3440-
const debug = async(instructions, provider)=>{
3441-
console.log('instructions.length', instructions.length);
3442-
let data;
3443-
instructions.forEach((instruction)=>{
3444-
console.log('INSTRUCTION.programId', instruction.programId.toString());
3445-
console.log('INSTRUCTION.keys', instruction.keys);
3446-
try {
3447-
const LAYOUT = solanaWeb3_js.struct([
3448-
solanaWeb3_js.u64("anchorDiscriminator"),
3449-
solanaWeb3_js.u64("amount"),
3450-
solanaWeb3_js.u64("otherAmountThreshold"),
3451-
solanaWeb3_js.u128("sqrtPriceLimit"),
3452-
solanaWeb3_js.bool("amountSpecifiedIsInput"),
3453-
solanaWeb3_js.bool("aToB"),
3454-
]);
3455-
data = LAYOUT.decode(instruction.data);
3456-
} catch (e3) {}
3457-
});
3458-
if(data) {
3459-
console.log('INSTRUCTION.data', data);
3460-
console.log('amount', data.amount.toString());
3461-
console.log('otherAmountThreshold', data.otherAmountThreshold.toString());
3462-
console.log('sqrtPriceLimit', data.sqrtPriceLimit.toString());
3463-
}
3464-
let simulation = new solanaWeb3_js.Transaction({ feePayer: new solanaWeb3_js.PublicKey('2UgCJaHU5y8NC4uWQcZYeV9a5RyYLF7iKYCybCsdFFD1') });
3465-
instructions.forEach((instruction)=>simulation.add(instruction));
3466-
let result;
3467-
console.log('SIMULATE');
3468-
try{ result = await provider.simulateTransaction(simulation); } catch(e) { console.log('error', e); }
3469-
console.log('SIMULATION RESULT', result);
3470-
};
3471-
34723440
var Raydium = {
34733441
findPath: findPath$4,
34743442
pathExists: pathExists$4,

dist/umd/index.solana.js

Lines changed: 14 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2973,31 +2973,31 @@
29732973
const dataLayout = solanaWeb3_js.struct([solanaWeb3_js.u64("amountIn"), solanaWeb3_js.u64("amounOutMin")]);
29742974

29752975
const keys = [
2976-
// payer
2976+
// 0 payer
29772977
{ pubkey: new solanaWeb3_js.PublicKey(account), isSigner: true, isWritable: false },
2978-
// authority
2978+
// 1 authority
29792979
{ pubkey: await getPdaPoolAuthority(CP_PROGRAM_ID), isSigner: false, isWritable: false },
2980-
// configId
2980+
// 2 configId
29812981
{ pubkey: pool.data.configId, isSigner: false, isWritable: false },
2982-
// poolId
2982+
// 3 poolId
29832983
{ pubkey: poolId, isSigner: false, isWritable: true },
2984-
// userInputAccount
2984+
// 4 userInputAccount
29852985
{ pubkey: tokenAccountIn, isSigner: false, isWritable: true },
2986-
// userOutputAccount
2986+
// 5 userOutputAccount
29872987
{ pubkey: tokenAccountOut, isSigner: false, isWritable: true },
2988-
// inputVault
2988+
// 6 inputVault
29892989
{ pubkey: inputVault, isSigner: false, isWritable: true },
2990-
// outputVault
2990+
// 7 outputVault
29912991
{ pubkey: outputVault, isSigner: false, isWritable: true },
2992-
// inputTokenProgram
2992+
// 8 inputTokenProgram
29932993
{ pubkey: new solanaWeb3_js.PublicKey(Token__default['default'].solana.TOKEN_PROGRAM), isSigner: false, isWritable: false },
2994-
// outputTokenProgram
2994+
// 9 outputTokenProgram
29952995
{ pubkey: new solanaWeb3_js.PublicKey(Token__default['default'].solana.TOKEN_PROGRAM), isSigner: false, isWritable: false },
2996-
// inputMint
2996+
// 10 inputMint
29972997
{ pubkey: inputMint, isSigner: false, isWritable: false },
2998-
// outputMint
2998+
// 11 outputMint
29992999
{ pubkey: outputMint, isSigner: false, isWritable: false },
3000-
// observationId
3000+
// 12 observationId
30013001
{ pubkey: await getPdaObservationId(CP_PROGRAM_ID, poolId), isSigner: false, isWritable: true },
30023002
];
30033003

@@ -3074,44 +3074,12 @@
30743074
);
30753075
}
30763076

3077-
await debug(instructions, provider);
3077+
// await debug(instructions, provider)
30783078

30793079
transaction.instructions = instructions;
30803080
return transaction
30813081
};
30823082

3083-
const debug = async(instructions, provider)=>{
3084-
console.log('instructions.length', instructions.length);
3085-
let data;
3086-
instructions.forEach((instruction)=>{
3087-
console.log('INSTRUCTION.programId', instruction.programId.toString());
3088-
console.log('INSTRUCTION.keys', instruction.keys);
3089-
try {
3090-
const LAYOUT = solanaWeb3_js.struct([
3091-
solanaWeb3_js.u64("anchorDiscriminator"),
3092-
solanaWeb3_js.u64("amount"),
3093-
solanaWeb3_js.u64("otherAmountThreshold"),
3094-
solanaWeb3_js.u128("sqrtPriceLimit"),
3095-
solanaWeb3_js.bool("amountSpecifiedIsInput"),
3096-
solanaWeb3_js.bool("aToB"),
3097-
]);
3098-
data = LAYOUT.decode(instruction.data);
3099-
} catch (e3) {}
3100-
});
3101-
if(data) {
3102-
console.log('INSTRUCTION.data', data);
3103-
console.log('amount', data.amount.toString());
3104-
console.log('otherAmountThreshold', data.otherAmountThreshold.toString());
3105-
console.log('sqrtPriceLimit', data.sqrtPriceLimit.toString());
3106-
}
3107-
let simulation = new solanaWeb3_js.Transaction({ feePayer: new solanaWeb3_js.PublicKey('2UgCJaHU5y8NC4uWQcZYeV9a5RyYLF7iKYCybCsdFFD1') });
3108-
instructions.forEach((instruction)=>simulation.add(instruction));
3109-
let result;
3110-
console.log('SIMULATE');
3111-
try{ result = await provider.simulateTransaction(simulation); } catch(e) { console.log('error', e); }
3112-
console.log('SIMULATION RESULT', result);
3113-
};
3114-
31153083
var Raydium = {
31163084
findPath,
31173085
pathExists,

package.evm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@depay/web3-exchanges-evm",
33
"moduleName": "Web3Exchanges",
4-
"version": "13.16.1",
4+
"version": "13.16.2",
55
"description": "JavaScript library simplifying decentralized web3 exchange routing for multiple blockchains and exchanges.",
66
"main": "dist/umd/index.evm.js",
77
"module": "dist/esm/index.evm.js",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@depay/web3-exchanges",
33
"moduleName": "Web3Exchanges",
4-
"version": "13.16.1",
4+
"version": "13.16.2",
55
"description": "JavaScript library simplifying decentralized web3 exchange routing for multiple blockchains and exchanges.",
66
"main": "dist/umd/index.js",
77
"module": "dist/esm/index.js",

0 commit comments

Comments
 (0)