@@ -586,72 +586,70 @@ describe("Bankrun - Rebalance", () => {
586586 mints : [ DEFAULT_BUY_MINT . publicKey , DEFAULT_SELL_MINT . publicKey ] ,
587587 } ,
588588
589- ...[
590- ExtensionType . TransferFeeConfig ,
591- ExtensionType . MintCloseAuthority ,
592- ExtensionType . NonTransferable ,
593- ] . map ( ( extension ) => {
594- return {
595- desc : `Should fail if ${ ExtensionType [ extension ] } is present on mint` ,
596- expectedError : "UnsupportedSPLToken" ,
597- allRebalanceDetailsAdded : true ,
598- addMintExtension : async ( ctx : LiteSVM , buyMint : PublicKey ) => {
599- const accountLen = getMintLen ( [ extension ] ) ;
600- const existingAccount = await ctx . getAccount ( buyMint ) ;
601- const existingData = Buffer . from ( existingAccount . data ) ;
602- const lengthRequired = accountLen - existingData . length ;
603- const additionalData = Buffer . alloc ( lengthRequired ) ;
604- const startForExtensions = ACCOUNT_SIZE - existingData . length ;
605- additionalData . writeUInt8 ( AccountType . Mint , startForExtensions ) ;
606- let offset = startForExtensions + 1 ;
607- additionalData . writeUInt16LE ( extension , offset ) ;
608- offset += 2 ;
609- additionalData . writeUInt16LE ( getTypeLen ( extension ) , offset ) ;
610- offset += 2 ;
611-
612- const finalData = Buffer . concat ( [ existingData , additionalData ] ) ;
613- ctx . setAccount ( buyMint , {
614- ...existingAccount ,
615- data : finalData ,
616- } ) ;
617- } ,
618- existingRebalanceParams : {
619- nonce : new BN ( 10 ) ,
620- currentAuctionId : new BN ( 1 ) ,
621- allRebalanceDetailsAdded : false ,
622- auctionLauncherWindow : 100 ,
623- ttl : 100 ,
624- startedAt : new BN ( 100 ) ,
625- restrictedUntil : new BN ( 100 ) ,
626- availableUntil : new BN ( 100 ) ,
627- } ,
628- pricesAndLimits : [
629- {
630- prices : {
631- low : new BN ( 1 ) ,
632- high : new BN ( 2 ) ,
633- } ,
634- limits : {
635- spot : new BN ( 1 ) ,
636- low : new BN ( 1 ) ,
637- high : new BN ( 2 ) ,
638- } ,
589+ ...[ ExtensionType . TransferFeeConfig , ExtensionType . NonTransferable ] . map (
590+ ( extension ) => {
591+ return {
592+ desc : `Should fail if ${ ExtensionType [ extension ] } is present on mint` ,
593+ expectedError : "UnsupportedSPLToken" ,
594+ allRebalanceDetailsAdded : true ,
595+ addMintExtension : async ( ctx : LiteSVM , buyMint : PublicKey ) => {
596+ const accountLen = getMintLen ( [ extension ] ) ;
597+ const existingAccount = await ctx . getAccount ( buyMint ) ;
598+ const existingData = Buffer . from ( existingAccount . data ) ;
599+ const lengthRequired = accountLen - existingData . length ;
600+ const additionalData = Buffer . alloc ( lengthRequired ) ;
601+ const startForExtensions = ACCOUNT_SIZE - existingData . length ;
602+ additionalData . writeUInt8 ( AccountType . Mint , startForExtensions ) ;
603+ let offset = startForExtensions + 1 ;
604+ additionalData . writeUInt16LE ( extension , offset ) ;
605+ offset += 2 ;
606+ additionalData . writeUInt16LE ( getTypeLen ( extension ) , offset ) ;
607+ offset += 2 ;
608+
609+ const finalData = Buffer . concat ( [ existingData , additionalData ] ) ;
610+ ctx . setAccount ( buyMint , {
611+ ...existingAccount ,
612+ data : finalData ,
613+ } ) ;
639614 } ,
640- {
641- prices : {
642- low : new BN ( 1 ) ,
643- high : new BN ( 2 ) ,
615+ existingRebalanceParams : {
616+ nonce : new BN ( 10 ) ,
617+ currentAuctionId : new BN ( 1 ) ,
618+ allRebalanceDetailsAdded : false ,
619+ auctionLauncherWindow : 100 ,
620+ ttl : 100 ,
621+ startedAt : new BN ( 100 ) ,
622+ restrictedUntil : new BN ( 100 ) ,
623+ availableUntil : new BN ( 100 ) ,
624+ } ,
625+ pricesAndLimits : [
626+ {
627+ prices : {
628+ low : new BN ( 1 ) ,
629+ high : new BN ( 2 ) ,
630+ } ,
631+ limits : {
632+ spot : new BN ( 1 ) ,
633+ low : new BN ( 1 ) ,
634+ high : new BN ( 2 ) ,
635+ } ,
644636 } ,
645- limits : {
646- spot : new BN ( 2 ) ,
647- low : new BN ( 1 ) ,
648- high : new BN ( 2 ) ,
637+ {
638+ prices : {
639+ low : new BN ( 1 ) ,
640+ high : new BN ( 2 ) ,
641+ } ,
642+ limits : {
643+ spot : new BN ( 2 ) ,
644+ low : new BN ( 1 ) ,
645+ high : new BN ( 2 ) ,
646+ } ,
649647 } ,
650- } ,
651- ] ,
652- mints : [ BUY_MINTS_2022 [ 0 ] . publicKey , DEFAULT_SELL_MINT . publicKey ] ,
653- } ;
654- } ) ,
648+ ] ,
649+ mints : [ BUY_MINTS_2022 [ 0 ] . publicKey , DEFAULT_SELL_MINT . publicKey ] ,
650+ } ;
651+ }
652+ ) ,
655653
656654 ...[
657655 ExtensionType . Uninitialized ,
@@ -1096,72 +1094,70 @@ describe("Bankrun - Rebalance", () => {
10961094 mints : [ DEFAULT_BUY_MINT . publicKey , DEFAULT_SELL_MINT . publicKey ] ,
10971095 } ,
10981096
1099- ...[
1100- ExtensionType . TransferFeeConfig ,
1101- ExtensionType . MintCloseAuthority ,
1102- ExtensionType . NonTransferable ,
1103- ] . map ( ( extension ) => {
1104- return {
1105- desc : `Should fail if ${ ExtensionType [ extension ] } is present on mint` ,
1106- expectedError : "UnsupportedSPLToken" ,
1107- allRebalanceDetailsAdded : true ,
1108- addMintExtension : async ( ctx : LiteSVM , buyMint : PublicKey ) => {
1109- const accountLen = getMintLen ( [ extension ] ) ;
1110- const existingAccount = await ctx . getAccount ( buyMint ) ;
1111- const existingData = Buffer . from ( existingAccount . data ) ;
1112- const lengthRequired = accountLen - existingData . length ;
1113- const additionalData = Buffer . alloc ( lengthRequired ) ;
1114- const startForExtensions = ACCOUNT_SIZE - existingData . length ;
1115- additionalData . writeUInt8 ( AccountType . Mint , startForExtensions ) ;
1116- let offset = startForExtensions + 1 ;
1117- additionalData . writeUInt16LE ( extension , offset ) ;
1118- offset += 2 ;
1119- additionalData . writeUInt16LE ( getTypeLen ( extension ) , offset ) ;
1120- offset += 2 ;
1121-
1122- const finalData = Buffer . concat ( [ existingData , additionalData ] ) ;
1123- ctx . setAccount ( buyMint , {
1124- ...existingAccount ,
1125- data : finalData ,
1126- } ) ;
1127- } ,
1128- existingRebalanceParams : {
1129- nonce : new BN ( 10 ) ,
1130- currentAuctionId : new BN ( 1 ) ,
1131- allRebalanceDetailsAdded : false ,
1132- auctionLauncherWindow : 100 ,
1133- ttl : 100 ,
1134- startedAt : new BN ( 100 ) ,
1135- restrictedUntil : new BN ( 100 ) ,
1136- availableUntil : new BN ( 100 ) ,
1137- } ,
1138- pricesAndLimits : [
1139- {
1140- prices : {
1141- low : new BN ( 1 ) ,
1142- high : new BN ( 2 ) ,
1143- } ,
1144- limits : {
1145- spot : new BN ( 1 ) ,
1146- low : new BN ( 1 ) ,
1147- high : new BN ( 2 ) ,
1148- } ,
1097+ ...[ ExtensionType . TransferFeeConfig , ExtensionType . NonTransferable ] . map (
1098+ ( extension ) => {
1099+ return {
1100+ desc : `Should fail if ${ ExtensionType [ extension ] } is present on mint` ,
1101+ expectedError : "UnsupportedSPLToken" ,
1102+ allRebalanceDetailsAdded : true ,
1103+ addMintExtension : async ( ctx : LiteSVM , buyMint : PublicKey ) => {
1104+ const accountLen = getMintLen ( [ extension ] ) ;
1105+ const existingAccount = await ctx . getAccount ( buyMint ) ;
1106+ const existingData = Buffer . from ( existingAccount . data ) ;
1107+ const lengthRequired = accountLen - existingData . length ;
1108+ const additionalData = Buffer . alloc ( lengthRequired ) ;
1109+ const startForExtensions = ACCOUNT_SIZE - existingData . length ;
1110+ additionalData . writeUInt8 ( AccountType . Mint , startForExtensions ) ;
1111+ let offset = startForExtensions + 1 ;
1112+ additionalData . writeUInt16LE ( extension , offset ) ;
1113+ offset += 2 ;
1114+ additionalData . writeUInt16LE ( getTypeLen ( extension ) , offset ) ;
1115+ offset += 2 ;
1116+
1117+ const finalData = Buffer . concat ( [ existingData , additionalData ] ) ;
1118+ ctx . setAccount ( buyMint , {
1119+ ...existingAccount ,
1120+ data : finalData ,
1121+ } ) ;
11491122 } ,
1150- {
1151- prices : {
1152- low : new BN ( 1 ) ,
1153- high : new BN ( 2 ) ,
1123+ existingRebalanceParams : {
1124+ nonce : new BN ( 10 ) ,
1125+ currentAuctionId : new BN ( 1 ) ,
1126+ allRebalanceDetailsAdded : false ,
1127+ auctionLauncherWindow : 100 ,
1128+ ttl : 100 ,
1129+ startedAt : new BN ( 100 ) ,
1130+ restrictedUntil : new BN ( 100 ) ,
1131+ availableUntil : new BN ( 100 ) ,
1132+ } ,
1133+ pricesAndLimits : [
1134+ {
1135+ prices : {
1136+ low : new BN ( 1 ) ,
1137+ high : new BN ( 2 ) ,
1138+ } ,
1139+ limits : {
1140+ spot : new BN ( 1 ) ,
1141+ low : new BN ( 1 ) ,
1142+ high : new BN ( 2 ) ,
1143+ } ,
11541144 } ,
1155- limits : {
1156- spot : new BN ( 2 ) ,
1157- low : new BN ( 1 ) ,
1158- high : new BN ( 2 ) ,
1145+ {
1146+ prices : {
1147+ low : new BN ( 1 ) ,
1148+ high : new BN ( 2 ) ,
1149+ } ,
1150+ limits : {
1151+ spot : new BN ( 2 ) ,
1152+ low : new BN ( 1 ) ,
1153+ high : new BN ( 2 ) ,
1154+ } ,
11591155 } ,
1160- } ,
1161- ] ,
1162- mints : [ BUY_MINTS_2022 [ 0 ] . publicKey , DEFAULT_SELL_MINT . publicKey ] ,
1163- } ;
1164- } ) ,
1156+ ] ,
1157+ mints : [ BUY_MINTS_2022 [ 0 ] . publicKey , DEFAULT_SELL_MINT . publicKey ] ,
1158+ } ;
1159+ }
1160+ ) ,
11651161
11661162 ...[
11671163 ExtensionType . Uninitialized ,
0 commit comments