Skip to content

Commit 28ec669

Browse files
committed
support sub-sat fee rates in CAT-21 mint (port of PR #14)
Bitcoin Core now accepts sub-sat fee rates (e.g. 0.5 sat/vB). Three changes to the cat21-mint component: 1. Fix BigInt crash: BigInt(vsize * feeRate) throws when result is fractional. Now uses Math.ceil() to round up to nearest sat. 2. Remove fullNumberValidator: users can now enter decimal fee rates. 3. Fix fee check toggle: was hardcoded to floor=1 (broken when recommended fee < 1). Now toggles between recommended and 0. Our Bitcoin node (v30.2.0) already relays sub-sat txs (default minrelaytxfee=1 sat/kvB = 0.001 sat/vB). No node config change needed.
1 parent 8c0928e commit 28ec669

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

frontend/src/app/components/_ordpool/cat21-mint/cat21-mint.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ <h2 class="mt-2 mb-4">Mint a CAT-21 Ordinal</h2>
6262

6363
<div class="feedback-error p-1" *ngIf="cfeeRate.invalid">
6464
<div *ngIf="cfeeRate.hasError('required')">Please enter a value!</div>
65-
<div *ngIf="cfeeRate.hasError('min')">Enter at least a value of {{ minRequiredFee }} sat/vB! If you are really sure that you want a fee rate that is lower than the recommended rate, switch to Expert mode and deactivate the check.</div>
66-
<div *ngIf="cfeeRate.hasError('notFullNumber')">Enter whole numbers only!</div>
65+
<div *ngIf="cfeeRate.hasError('min')">Enter at least a value of {{ minRequiredFee }} sat/vB! If you are really sure that you want a fee rate that is lower than the recommended rate, scroll down and deactivate the check.</div>
6766
</div>
6867

6968
</div>
@@ -105,7 +104,8 @@ <h2 class="mt-2 mb-4">Mint a CAT-21 Ordinal</h2>
105104
We automatically select your largest UTXO, but feel free to select a different one if you like:
106105
</p>
107106

108-
<a *ngIf="minRequiredFee != 1" href="javascript:void(0)" (click)="updateMinRequiredFee(1)">⚠️ Click here to disable the required fee rate check (do you know what you are doing!?)</a>
107+
<a *ngIf="minRequiredFee != 0" href="javascript:void(0)" (click)="updateMinRequiredFee(0)">⚠️ Click here to disable the required fee rate check.</a>
108+
<span *ngIf="minRequiredFee == 0">⚠️ Required fee rate check disabled. You can enter any value!</span>
109109

110110
<div class="mt-4 pl-2 pr-2 pt-1 pb-1 shape-border" *ngFor="let x of paymentOutputs$ | async"
111111
[ngClass]="{ selected: x === this.selectedPaymentOutput }">

frontend/src/app/components/_ordpool/cat21-mint/cat21-mint.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ export class Cat21MintComponent implements OnInit {
121121
BigInt(0)
122122
);
123123

124-
const transactionFee = BigInt(simulation1.vsize * feeRate);
124+
// feeRate can be fractional (e.g. 0.5 sat/vB), so we ceil to avoid BigInt crash
125+
const transactionFee = BigInt(Math.ceil(simulation1.vsize * feeRate));
125126

126127
// simulate the transaction again, with exact transactionFee
127128
const simulation2 = this.cat21Service.simulateTransaction(
@@ -199,7 +200,7 @@ export class Cat21MintComponent implements OnInit {
199200
this.cfeeRate.setValidators([
200201
Validators.required,
201202
Validators.min(this.minRequiredFee),
202-
fullNumberValidator()
203+
// fullNumberValidator() -- removed: sub-sat fee rates (e.g. 0.5 sat/vB) are valid now
203204
]);
204205

205206
if (this.cfeeRate.value < this.minRequiredFee) {

0 commit comments

Comments
 (0)