Skip to content

Commit

Permalink
Merge pull request #2664 from kaloudis/zeus-2663
Browse files Browse the repository at this point in the history
ZEUS-2663: LND: update BumpFee params and UI
  • Loading branch information
kaloudis authored Dec 23, 2024
2 parents b6a0f29 + 891aa54 commit e56a654
Show file tree
Hide file tree
Showing 63 changed files with 4,352 additions and 397 deletions.
2 changes: 2 additions & 0 deletions backends/EmbeddedLND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const {
signMessageNodePubkey,
verifyMessageNodePubkey,
bumpFee,
bumpForceCloseFee,
fundPsbt,
signPsbt,
finalizePsbt,
Expand Down Expand Up @@ -273,6 +274,7 @@ export default class EmbeddedLND extends LND {

getUTXOs = async (data: any) => await listUnspent(data);
bumpFee = async (data: any) => await bumpFee(data);
bumpForceCloseFee = async (data: any) => await bumpForceCloseFee(data);
lookupInvoice = async (data: any) => await lookupInvoice(data.r_hash);

listAccounts = async () => await listAccounts();
Expand Down
2 changes: 2 additions & 0 deletions backends/LND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,8 @@ export default class LND {
this.postRequest('/v1/funding/step', data);
getUTXOs = (data: any) => this.postRequest('/v2/wallet/utxos', data);
bumpFee = (data: any) => this.postRequest('/v2/wallet/bumpfee', data);
bumpForceCloseFee = (data: any) =>
this.postRequest('/v2/wallet/BumpForceCloseFee', data);
listAccounts = () => this.getRequest('/v2/wallet/accounts');
listAddresses = () => this.getRequest('/v2/wallet/addresses');
importAccount = (data: any) =>
Expand Down
11 changes: 9 additions & 2 deletions backends/LightningNodeConnect.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NativeModules, NativeEventEmitter } from 'react-native';

import LNC, { lnrpc, walletrpc } from '../zeus_modules/@lightninglabs/lnc-rn';
import LNC from '../zeus_modules/@lightninglabs/lnc-rn';
import { lnrpc, walletrpc } from '../zeus_modules/@lightninglabs/lnc-core';

import { settingsStore, nodeInfoStore } from '../stores/storeInstances';
import CredentialStore from './LNC/credentialStore';
Expand Down Expand Up @@ -111,7 +112,7 @@ export default class LightningNodeConnect {
.closedChannels({})
.then((data: lnrpc.ClosedChannelsResponse) => snakeize(data));
getChannelInfo = async (chanId: string) => {
const request: lnrpc.ChanInfoRequest = { chanId };
const request: lnrpc.ChanInfoRequest = { chanId, chanPoint: '' };
return await this.lnc.lnd.lightning
.getChanInfo(request)
.then((data: lnrpc.ChannelEdge) => snakeize(data));
Expand Down Expand Up @@ -456,6 +457,12 @@ export default class LightningNodeConnect {
await this.lnc.lnd.walletKit
.bumpFee(snakeize(req))
.then((data: walletrpc.BumpFeeResponse) => snakeize(data));
bumpForceCloseFee = async (req: walletrpc.BumpForceCloseFeeRequest) =>
await this.lnc.lnd.walletKit
.bumpForceCloseFee(snakeize(req))
.then((data: walletrpc.BumpForceCloseFeeResponse) =>
snakeize(data)
);
listAccounts = async () =>
await this.lnc.lnd.walletKit
.listAccounts({})
Expand Down
3 changes: 2 additions & 1 deletion components/Modals/InfoModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export default class InfoModal extends React.Component<InfoModalProps, {}> {
style={{
fontFamily: 'PPNeueMontreal-Book',
color: themeColor('text'),
fontSize: 20,
fontSize:
infoModalText.length > 3 ? 18 : 20,
marginBottom: 40
}}
>
Expand Down
25 changes: 20 additions & 5 deletions lndmobile/LndMobileInjection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import {
signMessage,
signMessageNodePubkey,
bumpFee,
bumpForceCloseFee,
fundPsbt,
signPsbt,
finalizePsbt,
Expand Down Expand Up @@ -393,15 +394,28 @@ export interface ILndMobileInjections {
) => Promise<lnrpc.SignMessageResponse>;
bumpFee: ({
outpoint,
target_conf,
force,
sat_per_vbyte
immediate,
sat_per_vbyte,
budget
}: {
outpoint: lnrpc.OutPoint;
target_conf?: number;
force?: boolean;
immediate?: boolean;
sat_per_vbyte?: Long;
budget?: Long;
}) => Promise<walletrpc.BumpFeeResponse>;
bumpForceCloseFee: ({
chan_point,
target_conf,
immediate,
starting_feerate,
budget
}: {
chan_point: lnrpc.OutPoint;
target_conf?: number;
immediate?: boolean;
starting_feerate?: Long;
budget?: Long;
}) => Promise<walletrpc.BumpForceCloseFeeResponse>;
fundPsbt: ({
account,
psbt,
Expand Down Expand Up @@ -550,6 +564,7 @@ export default {
signMessage,
signMessageNodePubkey,
bumpFee,
bumpForceCloseFee,
fundPsbt,
signPsbt,
finalizePsbt,
Expand Down
50 changes: 45 additions & 5 deletions lndmobile/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,24 @@ import Base64Utils from '../utils/Base64Utils';
export const bumpFee = async ({
outpoint,
target_conf,
force,
sat_per_vbyte
immediate,
sat_per_vbyte,
budget
}: {
outpoint: lnrpc.OutPoint;
target_conf?: number;
force?: boolean;
immediate?: boolean;
sat_per_vbyte?: Long;
budget?: Long;
}): Promise<walletrpc.BumpFeeResponse> => {
const options: walletrpc.IBumpFeeRequest = {
outpoint,
target_conf,
force,
sat_per_vbyte: sat_per_vbyte ? Long.fromValue(sat_per_vbyte) : undefined
immediate,
sat_per_vbyte: sat_per_vbyte
? Long.fromValue(sat_per_vbyte)
: undefined,
budget: budget ? Long.fromValue(budget) : undefined
};
const response = await sendCommand<
walletrpc.IBumpFeeRequest,
Expand All @@ -40,6 +45,41 @@ export const bumpFee = async ({
return response;
};

/**
* @throws
*/
export const bumpForceCloseFee = async ({
chan_point,
immediate,
starting_feerate,
budget
}: {
chan_point: lnrpc.ChannelPoint;
immediate?: boolean;
starting_feerate?: Long;
budget?: Long;
}): Promise<walletrpc.BumpForceCloseFeeResponse> => {
const options: walletrpc.IBumpForceCloseFeeRequest = {
chan_point,
immediate,
starting_feerate: starting_feerate
? Long.fromValue(starting_feerate)
: undefined,
budget: budget ? Long.fromValue(budget) : undefined
};
const response = await sendCommand<
walletrpc.IBumpForceCloseFeeRequest,
walletrpc.BumpForceCloseFeeRequest,
walletrpc.BumpForceCloseFeeResponse
>({
request: walletrpc.BumpForceCloseFeeRequest,
response: walletrpc.BumpForceCloseFeeResponse,
method: 'WalletKitBumpForceCloseFee',
options
});
return response;
};

/**
* @throws
*/
Expand Down
13 changes: 13 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"general.true": "True",
"general.false": "False",
"general.force": "Force",
"general.immediate": "Immediate",
"general.proceed": "Proceed",
"general.fiatFetchError": "Error fetching exchange rates",
"general.iUnderstand": "I understand",
Expand Down Expand Up @@ -1001,9 +1002,21 @@
"views.Mortals.title": "Mortals",
"views.BumpFee.title": "Speed up transaction",
"views.BumpFee.titleAlt": "Speed up channel open",
"views.BumpFee.titleClose": "Speed up channel close",
"views.BumpFee.titleForceClose": "Speed up channel force close",
"views.BumpFee.targetConfs": "Target confirmations",
"views.BumpFee.success": "Successfully bumped fee!",
"views.BumpFee.error": "Error bumping fee",
"views.BumpFee.outpoint.explainer1": "An outpoint is a reference to a particular output of a previous transaction. It consists of two parts:",
"views.BumpFee.outpoint.explainer2": "1) Transaction ID (txid): This is a unique identifier for a specific transaction on the Bitcoin blockchain.",
"views.BumpFee.outpoint.explainer3": "2) Output Index (vout): This denotes which specific output of the referenced transaction is being spent.",
"views.BumpFee.outpoint.explainer4": "The two are combined with a : character, for example: a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d:0",
"views.BumpFee.outpoint.explainer5": "This is the first output in this transaction, as the output index starts at 0. The second output has vout 1, etc.",
"views.BumpFee.budget": "Budget (sats)",
"views.BumpFee.budget.explainer1": "The max amount in sats that can be used as the fees. Setting this value greater than the input's value may result in CPFP - one or more wallet utxos will be used to pay the fees specified by the budget.",
"views.BumpFee.budget.explainer2": "If not set, for new inputs, by default 50% of the input's value will be treated as the budget for fee bumping; for existing inputs, their current budgets will be retained.",
"views.BumpFee.immediate.explainer": "Whether this input will be swept immediately. When enabled, the sweeper will sweep this input without waiting for the next batch.",
"views.BumpFee.startingFee": "Starting fee (sat/vbyte)",
"views.Sync.title": "Syncing wallet",
"views.Sync.currentBlockHeight": "Current block height",
"views.Sync.tip": "Tip",
Expand Down
Loading

0 comments on commit e56a654

Please sign in to comment.