@@ -79,7 +79,7 @@ const SOLANA_SEQ_LOG = 'Program log: Sequence: ';
79
79
const SOLANA_CHAIN_NAME = MAINNET_CONFIG . chains . solana ! . key ;
80
80
81
81
// Add priority fee according to 75th percentile of recent fees paid
82
- const SOLANA_FEE_PERCENTILE = 0.75 ;
82
+ const SOLANA_FEE_PERCENTILE = 0.5 ;
83
83
84
84
const SOLANA_MAINNET_EMMITER_ID =
85
85
'ec7372995d5cc8732397fb0ad35c0121e0eaa90d26f828a534cab54391b3a4f5' ;
@@ -1225,7 +1225,9 @@ export class SolanaContext<
1225
1225
async determineComputeBudget (
1226
1226
lockedWritableAccounts : PublicKey [ ] = [ ] ,
1227
1227
) : Promise < TransactionInstruction [ ] > {
1228
- let fee = 100_000 ; // Set fee to 100,000 microlamport by default
1228
+ // https://twitter.com/0xMert_/status/1768669928825962706
1229
+
1230
+ let fee = 1 ; // Set fee to 100,000 microlamport by default
1229
1231
1230
1232
try {
1231
1233
const recentFeesResponse =
@@ -1237,11 +1239,14 @@ export class SolanaContext<
1237
1239
// Get 75th percentile fee paid in recent slots
1238
1240
const recentFees = recentFeesResponse
1239
1241
. map ( ( dp ) => dp . prioritizationFee )
1242
+ . filter ( ( dp ) => dp > 0 )
1240
1243
. sort ( ( a , b ) => a - b ) ;
1241
- fee = Math . max (
1242
- recentFees [ Math . floor ( recentFees . length * SOLANA_FEE_PERCENTILE ) ] ,
1243
- fee ,
1244
- ) ;
1244
+
1245
+ if ( recentFees . length > 0 ) {
1246
+ const medianFee =
1247
+ recentFees [ Math . floor ( recentFees . length * SOLANA_FEE_PERCENTILE ) ] ;
1248
+ fee = Math . max ( fee , medianFee ) ;
1249
+ }
1245
1250
}
1246
1251
} catch ( e ) {
1247
1252
console . error ( 'Error fetching Solana recent fees' , e ) ;
0 commit comments