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

Taproot: send and receive #980

Merged
merged 3 commits into from
May 20, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions backends/CLightningREST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,6 @@ export default class CLightningREST extends LND {
supportsRouting = () => true;
supportsNodeInfo = () => true;
singleFeesEarnedTotal = () => true;
supportsAddressTypeSelection = () => false;
supportsTaproot = () => false;
}
2 changes: 2 additions & 0 deletions backends/Eclair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ export default class Eclair {
supportsRouting = () => true;
supportsNodeInfo = () => true;
singleFeesEarnedTotal = () => false;
supportsAddressTypeSelection = () => false;
supportsTaproot = () => false;
}

const mapInvoice =
Expand Down
16 changes: 13 additions & 3 deletions backends/LND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export default class LND {
return `${baseUrl}${route}`;
};

request = (route: string, method: string, data?: any) => {
request = (route: string, method: string, data?: any, params?: any) => {
const {
host,
lndhubUrl,
Expand All @@ -168,6 +168,13 @@ export default class LND {
certVerification,
enableTor
} = stores.settingsStore;

if (params) {
route = `${route}?${Object.keys(params)
.map((key: string) => key + '=' + params[key])
.join('&')}`;
}

const auth = macaroonHex || accessToken;
const headers: any = this.getHeaders(auth);
headers['Content-Type'] = 'application/json';
Expand All @@ -182,7 +189,8 @@ export default class LND {
);
};

getRequest = (route: string) => this.request(route, 'get', null);
getRequest = (route: string, data?: any) =>
this.request(route, 'get', null, data);
postRequest = (route: string, data?: any) =>
this.request(route, 'post', data);
deleteRequest = (route: string) => this.request(route, 'delete', null);
Expand All @@ -208,7 +216,7 @@ export default class LND {
this.getRequest('/v1/invoices?reversed=true&num_max_invoices=100');
createInvoice = (data: any) => this.postRequest('/v1/invoices', data);
getPayments = () => this.getRequest('/v1/payments');
getNewAddress = () => this.getRequest('/v1/newaddress');
getNewAddress = (data: any) => this.getRequest('/v1/newaddress', data);
openChannel = (data: OpenChannelRequest) =>
this.postRequest('/v1/channels', {
private: data.private,
Expand Down Expand Up @@ -358,4 +366,6 @@ export default class LND {
supportsCoinControl = () => this.supports('v0.12.0');
supportsAccounts = () => this.supports('v0.13.0');
singleFeesEarnedTotal = () => false;
supportsAddressTypeSelection = () => true;
supportsTaproot = () => this.supports('v0.15.0');
}
2 changes: 2 additions & 0 deletions backends/LndHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,6 @@ export default class LndHub extends LND {
supportsRouting = () => false;
supportsNodeInfo = () => false;
singleFeesEarnedTotal = () => false;
supportsAddressTypeSelection = () => false;
supportsTaproot = () => false;
}
2 changes: 2 additions & 0 deletions backends/Spark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,6 @@ export default class Spark {
supportsHopPicking = () => false;
supportsRouting = () => true;
singleFeesEarnedTotal = () => false;
supportsAddressTypeSelection = () => false;
supportsTaproot = () => false;
}