@@ -2,7 +2,7 @@ import Token from '@depay/web3-tokens';
22import { request , getProvider } from '@depay/web3-client' ;
33import { ethers } from 'ethers' ;
44import 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' ;
66import Decimal from 'decimal.js' ;
77
88function _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-
34673435var Raydium = {
34683436 findPath : findPath$4 ,
34693437 pathExists : pathExists$4 ,
0 commit comments