@@ -356,6 +356,10 @@ describe('Sol Token Transfer Builder', () => {
356356 txBuilder . send ( { address : otherAccount . pub , amount, tokenName : nameUSDC } ) ;
357357 txBuilder . memo ( memo ) ;
358358 txBuilder . createAssociatedTokenAccount ( { ownerAddress : otherAccount . pub , tokenName : nameUSDC } ) ;
359+ const prioFeeMicroLamports = '0' ;
360+ const priorityFee : FeeOptions = {
361+ amount : prioFeeMicroLamports ,
362+ } ;
359363 txBuilder . setPriorityFee ( priorityFee ) ;
360364 const tx = await txBuilder . build ( ) ;
361365 tx . inputs . length . should . equal ( 1 ) ;
@@ -371,26 +375,26 @@ describe('Sol Token Transfer Builder', () => {
371375 coin : nameUSDC ,
372376 } ) ;
373377 const txJson = tx . toJson ( ) ;
374- txJson . instructionsData . length . should . equal ( 4 ) ;
375- txJson . instructionsData [ 0 ] . type . should . equal ( 'SetPriorityFee' ) ;
376- txJson . instructionsData [ 1 ] . type . should . equal ( 'CreateAssociatedTokenAccount' ) ;
377- txJson . instructionsData [ 1 ] . params . should . deepEqual ( {
378+ // Since prio fee is 0, we are not adding compute unit price instruction
379+ txJson . instructionsData . length . should . equal ( 3 ) ;
380+ txJson . instructionsData [ 0 ] . type . should . equal ( 'CreateAssociatedTokenAccount' ) ;
381+ txJson . instructionsData [ 0 ] . params . should . deepEqual ( {
378382 mintAddress : mintUSDC ,
379383 ataAddress : ataAddress ,
380384 ownerAddress : otherAccount . pub ,
381385 payerAddress : walletPK ,
382386 tokenName : nameUSDC ,
383387 } ) ;
384- txJson . instructionsData [ 2 ] . type . should . equal ( 'TokenTransfer' ) ;
385- txJson . instructionsData [ 2 ] . params . should . deepEqual ( {
388+ txJson . instructionsData [ 1 ] . type . should . equal ( 'TokenTransfer' ) ;
389+ txJson . instructionsData [ 1 ] . params . should . deepEqual ( {
386390 fromAddress : walletPK ,
387391 toAddress : otherAccount . pub ,
388392 amount : amount ,
389393 tokenName : nameUSDC ,
390394 sourceAddress : 'B5rJjuVi7En63iK6o3ijKdJwAoTe2gwCYmJsVdHQ2aKV' ,
391395 } ) ;
392- txJson . instructionsData [ 3 ] . type . should . equal ( 'Memo' ) ;
393- txJson . instructionsData [ 3 ] . params . memo . should . equal ( memo ) ;
396+ txJson . instructionsData [ 2 ] . type . should . equal ( 'Memo' ) ;
397+ txJson . instructionsData [ 2 ] . params . memo . should . equal ( memo ) ;
394398
395399 const rawTx = tx . toBroadcastFormat ( ) ;
396400 should . equal ( Utils . isValidRawTransaction ( rawTx ) , true ) ;
0 commit comments