Skip to content

Commit

Permalink
fix: use script path fee estimation for chain swaps
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 committed May 29, 2024
1 parent 4bf5fdb commit ddc6878
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/rates/FeeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,16 @@ class FeeProvider {

const sendingMinerfees = this.minerFees.get(
getSendingChain(base, quote, orderSide),
)![SwapVersion.Taproot].reverse;
)![SwapVersion.Taproot];
const receivingMinerFees = this.minerFees.get(
getReceivingChain(base, quote, orderSide),
)![SwapVersion.Taproot].reverse;
)![SwapVersion.Taproot];

return {
server: sendingMinerfees.lockup + receivingMinerFees.claim,
server: sendingMinerfees.reverse.lockup + receivingMinerFees.normal,
user: {
claim: sendingMinerfees.claim,
lockup: receivingMinerFees.lockup,
claim: sendingMinerfees.reverse.claim,
lockup: receivingMinerFees.reverse.lockup,
},
} as ChainSwapMinerFees as T;
} else {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/rates/FeeProvider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,8 @@ describe('FeeProvider', () => {
${'LTC/BTC'} | ${OrderSide.SELL} | ${SwapType.Submarine} | ${SwapVersion.Taproot} | ${453}
${'BTC/BTC'} | ${OrderSide.BUY} | ${SwapType.ReverseSubmarine} | ${SwapVersion.Legacy} | ${{ claim: 4968, lockup: 5508 }}
${'BTC/BTC'} | ${OrderSide.BUY} | ${SwapType.ReverseSubmarine} | ${SwapVersion.Taproot} | ${{ claim: 3996, lockup: 5544 }}
${'LTC/BTC'} | ${OrderSide.BUY} | ${SwapType.Chain} | ${SwapVersion.Taproot} | ${{ server: 4458, user: { claim: 333, lockup: 5544 } }}
${'LTC/BTC'} | ${OrderSide.SELL} | ${SwapType.Chain} | ${SwapVersion.Taproot} | ${{ server: 5877, user: { claim: 3996, lockup: 462 } }}
${'LTC/BTC'} | ${OrderSide.BUY} | ${SwapType.Chain} | ${SwapVersion.Taproot} | ${{ server: 5898, user: { claim: 333, lockup: 5544 } }}
${'LTC/BTC'} | ${OrderSide.SELL} | ${SwapType.Chain} | ${SwapVersion.Taproot} | ${{ server: 5997, user: { claim: 3996, lockup: 462 } }}
`(
'should get swap base fees',
({ pair, orderSide, type, version, expected }) => {
Expand Down

0 comments on commit ddc6878

Please sign in to comment.