Skip to content

Commit

Permalink
Merge branch 'master' into mainnet-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
wphan committed Jan 6, 2025
2 parents 7acca3f + e9cb6f3 commit 93fe143
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"main": "lib/index.js",
"license": "Apache-2.0",
"dependencies": {
"@drift-labs/jit-proxy": "0.12.37",
"@drift-labs/sdk": "2.106.0-beta.2",
"@drift-labs/jit-proxy": "0.12.38",
"@drift-labs/sdk": "2.106.0-beta.3",
"@opentelemetry/api": "1.7.0",
"@opentelemetry/auto-instrumentations-node": "0.31.2",
"@opentelemetry/exporter-prometheus": "0.31.0",
Expand Down
31 changes: 18 additions & 13 deletions src/bundleSender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,20 +526,25 @@ export class BundleSender {
* @returns current tip based on running score in lamports
*/
public calculateCurrentTipLamports(): number {
return Math.floor(
Math.max(
(this.lastTipStream?.landed_tips_50th_percentile ?? 0) *
LAMPORTS_PER_SOL,
this.minBundleTip,
Math.min(
this.maxBundleTip,
Math.pow(
this.failBundleCount / this.maxFailBundleCount,
this.tipMultiplier
) * this.maxBundleTip
)
)
// Calculate tip from tip stream
const tipStreamLamports =
(this.lastTipStream?.landed_tips_50th_percentile ?? 0) * LAMPORTS_PER_SOL;

// Calculate tip from failure count
const failureBasedTip =
Math.pow(
this.failBundleCount / this.maxFailBundleCount,
this.tipMultiplier
) * this.maxBundleTip;

// Take the larger of the two tips, but cap at maxBundleTip
const tip = Math.min(
this.maxBundleTip,
Math.max(tipStreamLamports, failureBasedTip)
);

// Ensure we never go below minBundleTip
return Math.floor(Math.max(this.minBundleTip, tip));
}

/**
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 +175,19 @@
enabled "2.0.x"
kuler "^2.0.0"

"@drift-labs/[email protected].37":
version "0.12.37"
resolved "https://registry.yarnpkg.com/@drift-labs/jit-proxy/-/jit-proxy-0.12.37.tgz#42b6551e561cad8e8974c16dddd2f243497f8ff7"
integrity sha512-XeD3B9EhbfkjBh2MP4GhhiDpgPCf6a3yul0+pSR6YcQiAcSpgMAjWQ+iY9vboJyQc6WipgqkxSjOYIdNGeIQ8w==
"@drift-labs/[email protected].38":
version "0.12.38"
resolved "https://registry.yarnpkg.com/@drift-labs/jit-proxy/-/jit-proxy-0.12.38.tgz#55c94a388ae998adfefb0d81c3b18b434c7eba83"
integrity sha512-nGMKQCzOS5lVhY6csxSIGkoAPcosHU0M1oPyG0V1wJ714qBSzl4//Y230jdPFZoQfrzUFEDZxEbylcU1I1rctA==
dependencies:
"@coral-xyz/anchor" "0.26.0"
"@drift-labs/sdk" "2.106.0-beta.2"
"@drift-labs/sdk" "2.106.0-beta.3"
"@solana/web3.js" "1.91.7"

"@drift-labs/[email protected].2":
version "2.106.0-beta.2"
resolved "https://registry.yarnpkg.com/@drift-labs/sdk/-/sdk-2.106.0-beta.2.tgz#c9eb425cd4a38c8a33fa8a1a164b7f0216a43392"
integrity sha512-LLWbopZAcascl36acB7fctO81OhEkg9ZuAcdL9XTJW5e5SScakybDREQ3FHKreXAI0g7GUns+5YpidtA68ug/g==
"@drift-labs/[email protected].3":
version "2.106.0-beta.3"
resolved "https://registry.yarnpkg.com/@drift-labs/sdk/-/sdk-2.106.0-beta.3.tgz#dc4cbd779d274c5479df1582c1b82651a7bf02e6"
integrity sha512-SahpOcXubH65FxVeawoT+/nOemDibRKyNq/ihJCos9c7Wa4rRoL+ILuO0NtOS3Rrf94MSMv2g/68VPBRJI08HQ==
dependencies:
"@coral-xyz/anchor" "0.29.0"
"@coral-xyz/anchor-30" "npm:@coral-xyz/[email protected]"
Expand Down

0 comments on commit 93fe143

Please sign in to comment.