Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement Discount CT #697

Merged
merged 1 commit into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/chainSwaps/chainSwaps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test.describe("Chain swap", () => {
await inputReceiveAmount.fill(receiveAmount);

const inputSendAmount = page.locator("input[data-testid='sendAmount']");
const sendAmount = "0.0100168";
const sendAmount = "0.01001551";
await expect(inputSendAmount).toHaveValue(sendAmount);

const inputOnchainAddress = page.locator(
Expand Down
95 changes: 67 additions & 28 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@
"bitcoinjs-lib": "^6.1.6",
"bolt11": "^1.4.1",
"boltz-bolt12": "^0.1.2",
"boltz-core": "^2.1.2",
"boltz-core": "^2.1.3",
"buffer": "^6.0.3",
"create-hmac": "^1.1.7",
"ecpair": "^2.1.0",
"ethers": "^6.13.2",
"iframe-resizer": "^5.2.4",
"liquidjs-lib": "^6.0.2-liquid.35",
"liquidjs-lib": "^6.0.2-liquid.36",
"localforage": "^1.10.0",
"loglevel": "^1.9.1",
"qr-scanner": "^1.4.2",
Expand Down
2 changes: 1 addition & 1 deletion regtest
8 changes: 6 additions & 2 deletions src/components/Fees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import { formatAmount } from "../utils/denomination";
import { getPair } from "../utils/helper";
import Denomination from "./settings/Denomination";

// When sending to an unconfidential address, we need to add an extra
// confidential OP_RETURN output with 1 sat inside
const unconfidentialExtra = 5;

const Fees = () => {
const { t, pairs, fetchPairs, denomination, separator } =
useGlobalContext();
Expand Down Expand Up @@ -68,7 +72,7 @@ const Fees = () => {
reverseCfg.fees.minerFees.claim +
reverseCfg.fees.minerFees.lockup;
if (isToUnconfidentialLiquid()) {
fee += 1;
fee += unconfidentialExtra;
}

setMinerFee(fee);
Expand All @@ -80,7 +84,7 @@ const Fees = () => {
chainCfg.fees.minerFees.server +
chainCfg.fees.minerFees.user.claim;
if (isToUnconfidentialLiquid()) {
fee += 1;
fee += unconfidentialExtra;
}

setMinerFee(fee);
Expand Down
23 changes: 13 additions & 10 deletions src/utils/compat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,19 @@ const getConstructRefundTransaction = (
liquidNetwork?: LiquidNetwork,
blindingKey?: Buffer,
) =>
targetFee(feePerVbyte, (fee) =>
fn(
refundDetails as any[],
outputScript,
timeoutBlockHeight,
addOneSatBuffer ? fee + 1 : fee,
isRbf,
liquidNetwork,
blindingKey,
),
targetFee(
feePerVbyte,
(fee) =>
fn(
refundDetails as any[],
outputScript,
timeoutBlockHeight,
addOneSatBuffer ? fee + 1 : fee,
isRbf,
liquidNetwork,
blindingKey,
),
config.network !== "mainnet",
);
};

Expand Down
4 changes: 2 additions & 2 deletions tests/components/Fees.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe("Fees component", () => {

const fees = pairs.reverse[BTC][LBTC].fees;
expect(signals.minerFee()).toEqual(
fees.minerFees.lockup + fees.minerFees.claim + 1,
fees.minerFees.lockup + fees.minerFees.claim + 5,
);
});

Expand All @@ -115,7 +115,7 @@ describe("Fees component", () => {

const fees = pairs.chain[BTC][LBTC].fees;
expect(signals.minerFee()).toEqual(
fees.minerFees.server + fees.minerFees.user.claim + 1,
fees.minerFees.server + fees.minerFees.user.claim + 5,
);
});
});