Skip to content

Commit

Permalink
fix: add gas refill to fee
Browse files Browse the repository at this point in the history
Signed-off-by: Gregory Hill <[email protected]>
  • Loading branch information
gregdhill committed Sep 3, 2024
1 parent 5de1c6a commit 1dbf737
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
4 changes: 2 additions & 2 deletions sdk/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gobob/bob-sdk",
"version": "2.2.3",
"version": "2.2.4",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/gateway/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class GatewayApiClient {
const quote: GatewayQuote = await response.json();
return {
...quote,
fee: Math.max(0, quote.fee - (params.gasRefill || 0)),
fee: quote.fee + (params.gasRefill || 0),
};
}

Expand Down
11 changes: 2 additions & 9 deletions sdk/test/gateway.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("Gateway Tests", () => {

nock(`${MAINNET_GATEWAY_BASE_URL}`)
.get(`/quote/${SYMBOL_LOOKUP[ChainId.BOB]["tbtc"].address}?satoshis=1000`)
.times(6)
.times(5)
.reply(200, mockQuote);

assert.deepEqual(await gatewaySDK.getQuote({
Expand Down Expand Up @@ -67,14 +67,7 @@ describe("Gateway Tests", () => {
toUserAddress: ZeroAddress,
amount: 1000,
gasRefill: 5,
}), { ...mockQuote, fee: 5 });
assert.deepEqual(await gatewaySDK.getQuote({
toChain: "BOB",
toToken: "tBTC",
toUserAddress: ZeroAddress,
amount: 1000,
gasRefill: 1000,
}), { ...mockQuote, fee: 0 });
}), { ...mockQuote, fee: 15 });

// get the total available without amount
nock(`${MAINNET_GATEWAY_BASE_URL}`)
Expand Down

0 comments on commit 1dbf737

Please sign in to comment.