Skip to content
New issue

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

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

Already on GitHub? # to your account

Add option to use all funds for channel with CLNRest #2729

Merged
merged 2 commits into from
Jan 13, 2025
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
29 changes: 11 additions & 18 deletions backends/CLNRest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,24 +280,16 @@ export default class CLNRest {
const feeRate = `${new BigNumber(data.sat_per_vbyte || 0)
.times(1000)
.toString()}perkb`;
if (data.utxos && data.utxos.length > 0) {
request = {
id: data.id,
amount: data.satoshis,
feerate: feeRate,
announce: !data.privateChannel ? true : false,
minconf: data.min_confs,
utxos: data.utxos
};
} else {
request = {
id: data.id,
amount: data.satoshis,
feerate: feeRate,
announce: !data.privateChannel ? true : false,
minconf: data.min_confs
};
}

request = {
id: data.id,
amount: data.fundMax ? 'all' : data.satoshis,
feerate: feeRate,
announce: !data.privateChannel ? true : false,
minconf: data.min_confs
};

if (data.utxos && data.utxos.length > 0) request.utxos = data.utxos;

return this.postRequest('/v1/fundchannel', request);
};
Expand Down Expand Up @@ -420,6 +412,7 @@ export default class CLNRest {
supportsOnchainSendMax = () => true;
supportsOnchainBatching = () => false;
supportsChannelBatching = () => false;
supportsChannelFundMax = () => true;
supportsLSPS1customMessage = () => false;
supportsLSPS1rest = () => true;
supportsBolt11BlindedRoutes = () => false;
Expand Down
1 change: 1 addition & 0 deletions backends/EmbeddedLND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ export default class EmbeddedLND extends LND {
supportsOnchainSendMax = () => this.supports('v0.18.3');
supportsOnchainBatching = () => true;
supportsChannelBatching = () => true;
supportsChannelFundMax = () => true;
supportsLSPS1customMessage = () => true;
supportsLSPS1rest = () => false;
supportsOffers = () => false;
Expand Down
1 change: 1 addition & 0 deletions backends/LND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ export default class LND {
supportsOnchainSendMax = () => this.supports('v0.18.3');
supportsOnchainBatching = () => true;
supportsChannelBatching = () => true;
supportsChannelFundMax = () => true;
supportsLSPS1customMessage = () => false;
supportsLSPS1rest = () => true;
supportsOffers = (): Promise<boolean> | boolean => false;
Expand Down
1 change: 1 addition & 0 deletions backends/LightningNodeConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ export default class LightningNodeConnect {
supportsOnchainSendMax = () => this.supports('v0.18.3');
supportsOnchainBatching = () => true;
supportsChannelBatching = () => true;
supportsChannelFundMax = () => true;
supportsLSPS1customMessage = () => false;
supportsLSPS1rest = () => true;
supportsOffers = () => false;
Expand Down
1 change: 1 addition & 0 deletions utils/BackendUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class BackendUtils {
supportsOnchainSendMax = () => this.call('supportsOnchainSendMax');
supportsOnchainBatching = () => this.call('supportsOnchainBatching');
supportsChannelBatching = () => this.call('supportsChannelBatching');
supportsChannelFundMax = () => this.call('supportsChannelFundMax');
supportsOffers = () => this.call('supportsOffers');
supportsBolt11BlindedRoutes = () =>
this.call('supportsBolt11BlindedRoutes');
Expand Down
2 changes: 1 addition & 1 deletion views/OpenChannel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ export default class OpenChannel extends React.Component<
</View>
)}

{BackendUtils.isLNDBased() &&
{BackendUtils.supportsChannelFundMax() &&
additionalChannels.length === 0 && (
<>
<Text
Expand Down
Loading