@@ -117,28 +117,19 @@ describe("Blackjack", () => {
117117
118118 // --- Initialize Computation Definitions ---
119119 console . log ( "Initializing computation definitions..." ) ;
120- await Promise . all ( [
121- initShuffleAndDealCardsCompDef ( program as any , owner ) . then ( ( sig ) =>
122- console . log ( "Shuffle/Deal CompDef Init Sig:" , sig )
123- ) ,
124- initPlayerHitCompDef ( program as any , owner ) . then ( ( sig ) =>
125- console . log ( "Player Hit CompDef Init Sig:" , sig )
126- ) ,
127- initPlayerStandCompDef ( program as any , owner ) . then ( ( sig ) =>
128- console . log ( "Player Stand CompDef Init Sig:" , sig )
129- ) ,
130- initPlayerDoubleDownCompDef ( program as any , owner ) . then ( ( sig ) =>
131- console . log ( "Player DoubleDown CompDef Init Sig:" , sig )
132- ) ,
133- initDealerPlayCompDef ( program as any , owner ) . then ( ( sig ) =>
134- console . log ( "Dealer Play CompDef Init Sig:" , sig )
135- ) ,
136- initResolveGameCompDef ( program as any , owner ) . then ( ( sig ) =>
137- console . log ( "Resolve Game CompDef Init Sig:" , sig )
138- ) ,
139- ] ) ;
120+ const inits = [
121+ { name : "Shuffle/Deal" , fn : initShuffleAndDealCardsCompDef } ,
122+ { name : "Player Hit" , fn : initPlayerHitCompDef } ,
123+ { name : "Player Stand" , fn : initPlayerStandCompDef } ,
124+ { name : "Player DoubleDown" , fn : initPlayerDoubleDownCompDef } ,
125+ { name : "Dealer Play" , fn : initDealerPlayCompDef } ,
126+ { name : "Resolve Game" , fn : initResolveGameCompDef } ,
127+ ] ;
128+ for ( const { name, fn } of inits ) {
129+ const sig = await fn ( program as any , owner ) ;
130+ console . log ( `${ name } CompDef Init Sig:` , sig ) ;
131+ }
140132 console . log ( "All computation definitions initialized." ) ;
141- await new Promise ( ( res ) => setTimeout ( res , 2000 ) ) ;
142133
143134 // --- Setup Game Cryptography ---
144135 const privateKey = x25519 . utils . randomSecretKey ( ) ;
@@ -198,7 +189,10 @@ describe("Blackjack", () => {
198189 blackjackGame : blackjackGamePDA ,
199190 } )
200191 . signers ( [ owner ] )
201- . rpc ( { commitment : "confirmed" , preflightCommitment : "confirmed" } ) ;
192+ . rpc ( {
193+ skipPreflight : true ,
194+ commitment : "confirmed" ,
195+ } ) ;
202196 console . log ( "Initialize game TX Signature:" , initGameSig ) ;
203197
204198 console . log ( "Waiting for shuffle/deal computation finalization..." ) ;
@@ -303,7 +297,10 @@ describe("Blackjack", () => {
303297 payer : owner . publicKey ,
304298 } )
305299 . signers ( [ owner ] )
306- . rpc ( { commitment : "confirmed" , preflightCommitment : "confirmed" } ) ;
300+ . rpc ( {
301+ skipPreflight : true ,
302+ commitment : "confirmed" ,
303+ } ) ;
307304 console . log ( "Player Hit TX Signature:" , playerHitSig ) ;
308305
309306 console . log ( "Waiting for player hit computation finalization..." ) ;
@@ -392,7 +389,10 @@ describe("Blackjack", () => {
392389 payer : owner . publicKey ,
393390 } )
394391 . signers ( [ owner ] )
395- . rpc ( { commitment : "confirmed" , preflightCommitment : "confirmed" } ) ;
392+ . rpc ( {
393+ skipPreflight : true ,
394+ commitment : "confirmed" ,
395+ } ) ;
396396 console . log ( "Player Stand TX Signature:" , playerStandSig ) ;
397397
398398 console . log ( "Waiting for player stand computation finalization..." ) ;
@@ -465,7 +465,10 @@ describe("Blackjack", () => {
465465 blackjackGame : blackjackGamePDA ,
466466 } )
467467 . signers ( [ owner ] )
468- . rpc ( { commitment : "confirmed" , preflightCommitment : "confirmed" } ) ;
468+ . rpc ( {
469+ skipPreflight : true ,
470+ commitment : "confirmed" ,
471+ } ) ;
469472 console . log ( "Dealer Play TX Signature:" , dealerPlaySig ) ;
470473
471474 console . log ( "Waiting for dealer play computation finalization..." ) ;
@@ -529,7 +532,10 @@ describe("Blackjack", () => {
529532 payer : owner . publicKey ,
530533 } )
531534 . signers ( [ owner ] )
532- . rpc ( { commitment : "confirmed" , preflightCommitment : "confirmed" } ) ;
535+ . rpc ( {
536+ skipPreflight : true ,
537+ commitment : "confirmed" ,
538+ } ) ;
533539 console . log ( "Resolve Game TX Signature:" , resolveSig ) ;
534540
535541 console . log ( "Waiting for resolve game computation finalization..." ) ;
@@ -600,7 +606,10 @@ describe("Blackjack", () => {
600606 mxeAccount,
601607 addressLookupTable : lutAddress ,
602608 } )
603- . rpc ( { commitment : "confirmed" , preflightCommitment : "confirmed" } ) ;
609+ . rpc ( {
610+ skipPreflight : true ,
611+ commitment : "confirmed" ,
612+ } ) ;
604613
605614 const rawCircuit = fs . readFileSync ( "build/shuffle_and_deal_cards.arcis" ) ;
606615 await uploadCircuit (
@@ -652,7 +661,10 @@ describe("Blackjack", () => {
652661 mxeAccount,
653662 addressLookupTable : lutAddress ,
654663 } )
655- . rpc ( { commitment : "confirmed" , preflightCommitment : "confirmed" } ) ;
664+ . rpc ( {
665+ skipPreflight : true ,
666+ commitment : "confirmed" ,
667+ } ) ;
656668
657669 const rawCircuit = fs . readFileSync ( "build/player_hit.arcis" ) ;
658670 await uploadCircuit (
@@ -704,7 +716,10 @@ describe("Blackjack", () => {
704716 mxeAccount,
705717 addressLookupTable : lutAddress ,
706718 } )
707- . rpc ( { commitment : "confirmed" , preflightCommitment : "confirmed" } ) ;
719+ . rpc ( {
720+ skipPreflight : true ,
721+ commitment : "confirmed" ,
722+ } ) ;
708723
709724 const rawCircuit = fs . readFileSync ( "build/player_stand.arcis" ) ;
710725 await uploadCircuit (
@@ -756,7 +771,10 @@ describe("Blackjack", () => {
756771 mxeAccount,
757772 addressLookupTable : lutAddress ,
758773 } )
759- . rpc ( { commitment : "confirmed" , preflightCommitment : "confirmed" } ) ;
774+ . rpc ( {
775+ skipPreflight : true ,
776+ commitment : "confirmed" ,
777+ } ) ;
760778
761779 const rawCircuit = fs . readFileSync ( "build/player_double_down.arcis" ) ;
762780 await uploadCircuit (
@@ -808,7 +826,10 @@ describe("Blackjack", () => {
808826 mxeAccount,
809827 addressLookupTable : lutAddress ,
810828 } )
811- . rpc ( { commitment : "confirmed" , preflightCommitment : "confirmed" } ) ;
829+ . rpc ( {
830+ skipPreflight : true ,
831+ commitment : "confirmed" ,
832+ } ) ;
812833
813834 const rawCircuit = fs . readFileSync ( "build/dealer_play.arcis" ) ;
814835 await uploadCircuit (
@@ -860,7 +881,10 @@ describe("Blackjack", () => {
860881 mxeAccount,
861882 addressLookupTable : lutAddress ,
862883 } )
863- . rpc ( { commitment : "confirmed" , preflightCommitment : "confirmed" } ) ;
884+ . rpc ( {
885+ skipPreflight : true ,
886+ commitment : "confirmed" ,
887+ } ) ;
864888
865889 const rawCircuit = fs . readFileSync ( "build/resolve_game.arcis" ) ;
866890 await uploadCircuit (
0 commit comments