mirror of
https://github.com/Brotocol-xyz/bro-sdk.git
synced 2026-01-12 22:25:00 +08:00
fix: dex aggregator bridge-fee estimation
This commit is contained in:
@@ -143,7 +143,21 @@ export const getStacks2BtcFeeInfo = async (
|
||||
route: KnownRoute_FromStacks_ToBitcoin,
|
||||
options: {
|
||||
/**
|
||||
* the initial route step
|
||||
* The entry route step that triggered the Stacks transaction.
|
||||
* It's crucial for correctly calculating fees in multi-step bridging
|
||||
* processes.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* * BTC > Runes (`via: ALEX`):
|
||||
* 1. btc > stacks (initialRoute)
|
||||
* 2. stacks > runes
|
||||
* * BTC > Runes (`via: evmDexAggregator`):
|
||||
* 1. btc > stacks (initialRoute as well, but not what we want)
|
||||
* 2. stacks > evm
|
||||
* 3. evm swap
|
||||
* 4. evm > stacks (initialRoute for this partition)
|
||||
* 5. stacks > runes
|
||||
*/
|
||||
initialRoute: null | KnownRoute_ToStacks
|
||||
/**
|
||||
@@ -169,7 +183,21 @@ const _getStacks2BtcFeeInfo = async (
|
||||
route: KnownRoute_FromStacks_ToBitcoin,
|
||||
options: {
|
||||
/**
|
||||
* the initial route step
|
||||
* The entry route step that triggered the Stacks transaction.
|
||||
* It's crucial for correctly calculating fees in multi-step bridging
|
||||
* processes.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* * BTC > Runes (`via: ALEX`):
|
||||
* 1. btc > stacks (initialRoute)
|
||||
* 2. stacks > runes
|
||||
* * BTC > Runes (`via: evmDexAggregator`):
|
||||
* 1. btc > stacks (initialRoute as well, but not what we want)
|
||||
* 2. stacks > evm
|
||||
* 3. evm swap
|
||||
* 4. evm > stacks (initialRoute for this partition)
|
||||
* 5. stacks > runes
|
||||
*/
|
||||
initialRoute: null | KnownRoute_ToStacks
|
||||
/**
|
||||
|
||||
@@ -237,7 +237,21 @@ export const getStacks2EvmFeeInfo = async (
|
||||
options: {
|
||||
toDexAggregator: boolean
|
||||
/**
|
||||
* checkout the comments in getSpecialFeeDetailsForSwapRoute
|
||||
* The entry route step that triggered the Stacks transaction.
|
||||
* It's crucial for correctly calculating fees in multi-step bridging
|
||||
* processes.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* * BTC > Runes (`via: ALEX`):
|
||||
* 1. btc > stacks (initialRoute)
|
||||
* 2. stacks > runes
|
||||
* * BTC > Runes (`via: evmDexAggregator`):
|
||||
* 1. btc > stacks (initialRoute as well, but not what we want)
|
||||
* 2. stacks > evm
|
||||
* 3. evm swap
|
||||
* 4. evm > stacks (initialRoute for this partition)
|
||||
* 5. stacks > runes
|
||||
*/
|
||||
initialRoute: null | KnownRoute_ToStacks
|
||||
},
|
||||
@@ -260,7 +274,21 @@ const _getStacks2EvmFeeInfo = async (
|
||||
options: {
|
||||
toDexAggregator: boolean
|
||||
/**
|
||||
* checkout the comments in getSpecialFeeDetailsForSwapRoute
|
||||
* The entry route step that triggered the Stacks transaction.
|
||||
* It's crucial for correctly calculating fees in multi-step bridging
|
||||
* processes.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* * BTC > Runes (`via: ALEX`):
|
||||
* 1. btc > stacks (initialRoute)
|
||||
* 2. stacks > runes
|
||||
* * BTC > Runes (`via: evmDexAggregator`):
|
||||
* 1. btc > stacks (initialRoute as well, but not what we want)
|
||||
* 2. stacks > evm
|
||||
* 3. evm swap
|
||||
* 4. evm > stacks (initialRoute for this partition)
|
||||
* 5. stacks > runes
|
||||
*/
|
||||
initialRoute: null | KnownRoute_ToStacks
|
||||
},
|
||||
|
||||
@@ -226,7 +226,21 @@ export const getStacks2MetaFeeInfo = async (
|
||||
route: KnownRoute_FromStacks_ToBRC20 | KnownRoute_FromStacks_ToRunes,
|
||||
options: {
|
||||
/**
|
||||
* the initial route step
|
||||
* The entry route step that triggered the Stacks transaction.
|
||||
* It's crucial for correctly calculating fees in multi-step bridging
|
||||
* processes.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* * BTC > Runes (`via: ALEX`):
|
||||
* 1. btc > stacks (initialRoute)
|
||||
* 2. stacks > runes
|
||||
* * BTC > Runes (`via: evmDexAggregator`):
|
||||
* 1. btc > stacks (initialRoute as well, but not what we want)
|
||||
* 2. stacks > evm
|
||||
* 3. evm swap
|
||||
* 4. evm > stacks (initialRoute for this partition)
|
||||
* 5. stacks > runes
|
||||
*/
|
||||
initialRoute: null | KnownRoute_ToStacks
|
||||
/**
|
||||
@@ -252,7 +266,21 @@ const _getStacks2MetaFeeInfo = async (
|
||||
route: KnownRoute_FromStacks_ToBRC20 | KnownRoute_FromStacks_ToRunes,
|
||||
options: {
|
||||
/**
|
||||
* the initial route step
|
||||
* The entry route step that triggered the Stacks transaction.
|
||||
* It's crucial for correctly calculating fees in multi-step bridging
|
||||
* processes.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* * BTC > Runes (`via: ALEX`):
|
||||
* 1. btc > stacks (initialRoute)
|
||||
* 2. stacks > runes
|
||||
* * BTC > Runes (`via: evmDexAggregator`):
|
||||
* 1. btc > stacks (initialRoute as well, but not what we want)
|
||||
* 2. stacks > evm
|
||||
* 3. evm swap
|
||||
* 4. evm > stacks (initialRoute for this partition)
|
||||
* 5. stacks > runes
|
||||
*/
|
||||
initialRoute: null | KnownRoute_ToStacks
|
||||
/**
|
||||
|
||||
@@ -513,7 +513,7 @@ async function bridgeInfoFromBitcoin_toMeta(
|
||||
}),
|
||||
...intermediaryInfo.steps,
|
||||
getStacks2MetaFeeInfo(ctx, metaPegOutRoute as any, {
|
||||
initialRoute: btcPegInRoute,
|
||||
initialRoute: last(intermediaryInfo.routes) as KnownRoute_ToStacks,
|
||||
swapRoute: null,
|
||||
}),
|
||||
])
|
||||
|
||||
@@ -622,7 +622,7 @@ async function bridgeInfoFromMeta_toBitcoin(
|
||||
}),
|
||||
...intermediaryInfo.steps,
|
||||
getStacks2BtcFeeInfo(ctx, btcPegOutRoute, {
|
||||
initialRoute: metaPegInRoute,
|
||||
initialRoute: last(intermediaryInfo.routes) as KnownRoute_ToStacks,
|
||||
swapRoute: null,
|
||||
}),
|
||||
])
|
||||
@@ -782,7 +782,7 @@ async function bridgeInfoFromMeta_toMeta(
|
||||
}),
|
||||
...intermediaryInfo.steps,
|
||||
getStacks2MetaFeeInfo(ctx, metaPegOutRoute, {
|
||||
initialRoute: metaPegInRoute,
|
||||
initialRoute: last(intermediaryInfo.routes) as KnownRoute_ToStacks,
|
||||
swapRoute: null,
|
||||
}),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user