@@ -48,27 +48,30 @@ async function initialize(matchingEngine: MatchingEngineProgram, signer: SolanaL
48
48
securityDepositBase : uint64ToBN ( BigInt ( config . securityDepositBase ) ) ,
49
49
securityDepositBps : toIntegerNumber ( config . securityDepositBps , "securityDepositBps" ) ,
50
50
}
51
- const initializeIx = await matchingEngine . initializeIx (
51
+ const initializeInstructions = [ ] ;
52
+ const priorityFee = ComputeBudgetProgram . setComputeUnitPrice ( { microLamports : solana . priorityMicrolamports } ) ;
53
+ initializeInstructions . push ( await matchingEngine . initializeIx (
52
54
{
53
55
owner : signerPubkey ,
54
56
ownerAssistant : new PublicKey ( config . ownerAssistant ) ,
55
57
feeRecipient : new PublicKey ( config . feeRecipient ) ,
56
58
} ,
57
59
auctionParams
58
- ) ;
60
+ ) ) ;
61
+ initializeInstructions . push ( priorityFee ) ;
59
62
60
63
// TODO: this doesn't check if the ATA already exists
61
64
const splToken = await import ( "@solana/spl-token" ) ;
62
65
const assocciatedTokenProgramId = splToken . ASSOCIATED_TOKEN_PROGRAM_ID ;
63
66
const associatedToken = splToken . getAssociatedTokenAddressSync ( usdcMint , signerPubkey , undefined , usdcMint , assocciatedTokenProgramId ) ;
64
67
const createAtaInstructions = [ ] ;
65
68
createAtaInstructions . push ( splToken . createAssociatedTokenAccountInstruction ( signerPubkey , associatedToken , signerPubkey , usdcMint ) ) ;
66
- createAtaInstructions . push ( ComputeBudgetProgram . setComputeUnitPrice ( { microLamports : solana . priorityMicrolamports } ) ) ;
69
+ createAtaInstructions . push ( priorityFee ) ;
67
70
68
71
const createAtaTxid = await solana . ledgerSignAndSend ( connection , createAtaInstructions , [ ] ) ;
69
72
log ( `CreateAtaTxid ${ createAtaTxid } ` ) ;
70
73
71
- const initializeTxid = await solana . ledgerSignAndSend ( connection , [ initializeIx ] , [ ] ) ;
74
+ const initializeTxid = await solana . ledgerSignAndSend ( connection , initializeInstructions , [ ] ) ;
72
75
log ( `InitializeTxid ${ initializeTxid } ` ) ;
73
76
}
74
77
0 commit comments