initial nosrt integration
This commit is contained in:
parent
947cf34ff4
commit
50ba34e050
44 changed files with 40869 additions and 7913 deletions
2308
package-lock.json
generated
2308
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -4,7 +4,7 @@
|
|||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tsc && testyts",
|
||||
"test": " ts-node testRunner.ts",
|
||||
"start": "ts-node src/index.ts",
|
||||
"build_autogenerated": "cd proto && rimraf autogenerated && protoc -I ./service --pub_out=. service/*",
|
||||
"build_lnd_client_1": "cd proto && protoc -I ./others --plugin=.\\node_modules\\.bin\\protoc-gen-ts_proto.cmd --ts_proto_out=./lnd --ts_proto_opt=esModuleInterop=true others/* ",
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
"url": "git+https://github.com/shocknet/Lightning.Pub.git"
|
||||
},
|
||||
"author": "",
|
||||
"type": "module",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/shocknet/Lightning.Pub/issues"
|
||||
|
|
@ -30,14 +31,17 @@
|
|||
"@types/node": "^17.0.31",
|
||||
"@types/secp256k1": "^4.0.3",
|
||||
"axios": "^0.27.2",
|
||||
"chai": "^4.3.7",
|
||||
"copyfiles": "^2.4.1",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.0.0",
|
||||
"eccrypto": "^1.1.6",
|
||||
"express": "^4.18.1",
|
||||
"globby": "^13.1.2",
|
||||
"grpc-tools": "^1.11.2",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"lodash": "^4.17.21",
|
||||
"nostr-tools": "^0.24.1",
|
||||
"pg": "^8.4.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
|
|
@ -51,13 +55,13 @@
|
|||
"uuid": "^8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.3.4",
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/eccrypto": "^1.1.3",
|
||||
"@types/jsonwebtoken": "^8.5.9",
|
||||
"@types/lodash": "^4.14.182",
|
||||
"@types/node": "^16.11.10",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"testyts": "^1.5.0",
|
||||
"ts-node": "10.7.0",
|
||||
"typescript": "4.5.2"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import express, { Response, json, urlencoded } from 'express'
|
||||
import cors from 'cors'
|
||||
import * as Types from './types'
|
||||
import * as Types from './types.js'
|
||||
export type Logger = { log: (v: any) => void, error: (v: any) => void }
|
||||
export type ServerOptions = {
|
||||
allowCors?: true
|
||||
|
|
@ -33,7 +33,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
const query = req.query
|
||||
const params = req.params
|
||||
await methods.Health({ ...authContext, ...query, ...params })
|
||||
res.json({status: 'OK'})
|
||||
res.json({ status: 'OK' })
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
|
||||
})
|
||||
if (!opts.allowNotImplementedMethods && !methods.EncryptionExchange) throw new Error('method: EncryptionExchange is not implemented')
|
||||
|
|
@ -47,7 +47,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
const query = req.query
|
||||
const params = req.params
|
||||
await methods.EncryptionExchange({ ...authContext, ...query, ...params }, request)
|
||||
res.json({status: 'OK'})
|
||||
res.json({ status: 'OK' })
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
|
||||
})
|
||||
if (!opts.allowNotImplementedMethods && !methods.LndGetInfo) throw new Error('method: LndGetInfo is not implemented')
|
||||
|
|
@ -63,7 +63,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.LndGetInfo({ ...authContext, ...query, ...params }, request)
|
||||
res.json({status: 'OK', result: await opts.encryptCallback(encryptionDeviceId, response)})
|
||||
res.json({ status: 'OK', result: await opts.encryptCallback(encryptionDeviceId, response) })
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
|
||||
})
|
||||
if (!opts.allowNotImplementedMethods && !methods.AddUser) throw new Error('method: AddUser is not implemented')
|
||||
|
|
@ -77,7 +77,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.AddUser({ ...authContext, ...query, ...params }, request)
|
||||
res.json({status: 'OK', result: response})
|
||||
res.json({ status: 'OK', result: response })
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
|
||||
})
|
||||
if (!opts.allowNotImplementedMethods && !methods.AuthUser) throw new Error('method: AuthUser is not implemented')
|
||||
|
|
@ -91,7 +91,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.AuthUser({ ...authContext, ...query, ...params }, request)
|
||||
res.json({status: 'OK', result: response})
|
||||
res.json({ status: 'OK', result: response })
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
|
||||
})
|
||||
if (!opts.allowNotImplementedMethods && !methods.NewAddress) throw new Error('method: NewAddress is not implemented')
|
||||
|
|
@ -105,7 +105,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.NewAddress({ ...authContext, ...query, ...params }, request)
|
||||
res.json({status: 'OK', result: response})
|
||||
res.json({ status: 'OK', result: response })
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
|
||||
})
|
||||
if (!opts.allowNotImplementedMethods && !methods.PayAddress) throw new Error('method: PayAddress is not implemented')
|
||||
|
|
@ -119,7 +119,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.PayAddress({ ...authContext, ...query, ...params }, request)
|
||||
res.json({status: 'OK', result: response})
|
||||
res.json({ status: 'OK', result: response })
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
|
||||
})
|
||||
if (!opts.allowNotImplementedMethods && !methods.NewInvoice) throw new Error('method: NewInvoice is not implemented')
|
||||
|
|
@ -133,7 +133,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.NewInvoice({ ...authContext, ...query, ...params }, request)
|
||||
res.json({status: 'OK', result: response})
|
||||
res.json({ status: 'OK', result: response })
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
|
||||
})
|
||||
if (!opts.allowNotImplementedMethods && !methods.PayInvoice) throw new Error('method: PayInvoice is not implemented')
|
||||
|
|
@ -147,7 +147,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.PayInvoice({ ...authContext, ...query, ...params }, request)
|
||||
res.json({status: 'OK', result: response})
|
||||
res.json({ status: 'OK', result: response })
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
|
||||
})
|
||||
if (!opts.allowNotImplementedMethods && !methods.OpenChannel) throw new Error('method: OpenChannel is not implemented')
|
||||
|
|
@ -161,7 +161,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.OpenChannel({ ...authContext, ...query, ...params }, request)
|
||||
res.json({status: 'OK', result: response})
|
||||
res.json({ status: 'OK', result: response })
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
|
||||
})
|
||||
if (!opts.allowNotImplementedMethods && !methods.GetOpenChannelLNURL) throw new Error('method: GetOpenChannelLNURL is not implemented')
|
||||
|
|
@ -172,7 +172,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.GetOpenChannelLNURL({ ...authContext, ...query, ...params })
|
||||
res.json({status: 'OK', result: response})
|
||||
res.json({ status: 'OK', result: response })
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
|
||||
})
|
||||
if (opts.staticFiles) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// This file was autogenerated from a .proto file, DO NOT EDIT!
|
||||
import axios from 'axios'
|
||||
import * as Types from './types'
|
||||
import * as Types from './types.js'
|
||||
export type ResultError = { status: 'ERROR', reason: string }
|
||||
|
||||
export type ClientParams = {
|
||||
|
|
|
|||
122
proto/lnd/invoices.client.d.ts
vendored
Normal file
122
proto/lnd/invoices.client.d.ts
vendored
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
|
||||
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
||||
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
|
||||
import type { LookupInvoiceMsg } from "./invoices";
|
||||
import type { SettleInvoiceResp } from "./invoices";
|
||||
import type { SettleInvoiceMsg } from "./invoices";
|
||||
import type { AddHoldInvoiceResp } from "./invoices";
|
||||
import type { AddHoldInvoiceRequest } from "./invoices";
|
||||
import type { CancelInvoiceResp } from "./invoices";
|
||||
import type { CancelInvoiceMsg } from "./invoices";
|
||||
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
|
||||
import type { Invoice } from "./lightning";
|
||||
import type { SubscribeSingleInvoiceRequest } from "./invoices";
|
||||
import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
|
||||
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
|
||||
/**
|
||||
* Invoices is a service that can be used to create, accept, settle and cancel
|
||||
* invoices.
|
||||
*
|
||||
* @generated from protobuf service invoicesrpc.Invoices
|
||||
*/
|
||||
export interface IInvoicesClient {
|
||||
/**
|
||||
*
|
||||
* SubscribeSingleInvoice returns a uni-directional stream (server -> client)
|
||||
* to notify the client of state transitions of the specified invoice.
|
||||
* Initially the current invoice state is always sent out.
|
||||
*
|
||||
* @generated from protobuf rpc: SubscribeSingleInvoice(invoicesrpc.SubscribeSingleInvoiceRequest) returns (stream lnrpc.Invoice);
|
||||
*/
|
||||
subscribeSingleInvoice(input: SubscribeSingleInvoiceRequest, options?: RpcOptions): ServerStreamingCall<SubscribeSingleInvoiceRequest, Invoice>;
|
||||
/**
|
||||
*
|
||||
* CancelInvoice cancels a currently open invoice. If the invoice is already
|
||||
* canceled, this call will succeed. If the invoice is already settled, it will
|
||||
* fail.
|
||||
*
|
||||
* @generated from protobuf rpc: CancelInvoice(invoicesrpc.CancelInvoiceMsg) returns (invoicesrpc.CancelInvoiceResp);
|
||||
*/
|
||||
cancelInvoice(input: CancelInvoiceMsg, options?: RpcOptions): UnaryCall<CancelInvoiceMsg, CancelInvoiceResp>;
|
||||
/**
|
||||
*
|
||||
* AddHoldInvoice creates a hold invoice. It ties the invoice to the hash
|
||||
* supplied in the request.
|
||||
*
|
||||
* @generated from protobuf rpc: AddHoldInvoice(invoicesrpc.AddHoldInvoiceRequest) returns (invoicesrpc.AddHoldInvoiceResp);
|
||||
*/
|
||||
addHoldInvoice(input: AddHoldInvoiceRequest, options?: RpcOptions): UnaryCall<AddHoldInvoiceRequest, AddHoldInvoiceResp>;
|
||||
/**
|
||||
*
|
||||
* SettleInvoice settles an accepted invoice. If the invoice is already
|
||||
* settled, this call will succeed.
|
||||
*
|
||||
* @generated from protobuf rpc: SettleInvoice(invoicesrpc.SettleInvoiceMsg) returns (invoicesrpc.SettleInvoiceResp);
|
||||
*/
|
||||
settleInvoice(input: SettleInvoiceMsg, options?: RpcOptions): UnaryCall<SettleInvoiceMsg, SettleInvoiceResp>;
|
||||
/**
|
||||
*
|
||||
* LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced
|
||||
* using either its payment hash, payment address, or set ID.
|
||||
*
|
||||
* @generated from protobuf rpc: LookupInvoiceV2(invoicesrpc.LookupInvoiceMsg) returns (lnrpc.Invoice);
|
||||
*/
|
||||
lookupInvoiceV2(input: LookupInvoiceMsg, options?: RpcOptions): UnaryCall<LookupInvoiceMsg, Invoice>;
|
||||
}
|
||||
/**
|
||||
* Invoices is a service that can be used to create, accept, settle and cancel
|
||||
* invoices.
|
||||
*
|
||||
* @generated from protobuf service invoicesrpc.Invoices
|
||||
*/
|
||||
export declare class InvoicesClient implements IInvoicesClient, ServiceInfo {
|
||||
private readonly _transport;
|
||||
typeName: any;
|
||||
methods: any;
|
||||
options: any;
|
||||
constructor(_transport: RpcTransport);
|
||||
/**
|
||||
*
|
||||
* SubscribeSingleInvoice returns a uni-directional stream (server -> client)
|
||||
* to notify the client of state transitions of the specified invoice.
|
||||
* Initially the current invoice state is always sent out.
|
||||
*
|
||||
* @generated from protobuf rpc: SubscribeSingleInvoice(invoicesrpc.SubscribeSingleInvoiceRequest) returns (stream lnrpc.Invoice);
|
||||
*/
|
||||
subscribeSingleInvoice(input: SubscribeSingleInvoiceRequest, options?: RpcOptions): ServerStreamingCall<SubscribeSingleInvoiceRequest, Invoice>;
|
||||
/**
|
||||
*
|
||||
* CancelInvoice cancels a currently open invoice. If the invoice is already
|
||||
* canceled, this call will succeed. If the invoice is already settled, it will
|
||||
* fail.
|
||||
*
|
||||
* @generated from protobuf rpc: CancelInvoice(invoicesrpc.CancelInvoiceMsg) returns (invoicesrpc.CancelInvoiceResp);
|
||||
*/
|
||||
cancelInvoice(input: CancelInvoiceMsg, options?: RpcOptions): UnaryCall<CancelInvoiceMsg, CancelInvoiceResp>;
|
||||
/**
|
||||
*
|
||||
* AddHoldInvoice creates a hold invoice. It ties the invoice to the hash
|
||||
* supplied in the request.
|
||||
*
|
||||
* @generated from protobuf rpc: AddHoldInvoice(invoicesrpc.AddHoldInvoiceRequest) returns (invoicesrpc.AddHoldInvoiceResp);
|
||||
*/
|
||||
addHoldInvoice(input: AddHoldInvoiceRequest, options?: RpcOptions): UnaryCall<AddHoldInvoiceRequest, AddHoldInvoiceResp>;
|
||||
/**
|
||||
*
|
||||
* SettleInvoice settles an accepted invoice. If the invoice is already
|
||||
* settled, this call will succeed.
|
||||
*
|
||||
* @generated from protobuf rpc: SettleInvoice(invoicesrpc.SettleInvoiceMsg) returns (invoicesrpc.SettleInvoiceResp);
|
||||
*/
|
||||
settleInvoice(input: SettleInvoiceMsg, options?: RpcOptions): UnaryCall<SettleInvoiceMsg, SettleInvoiceResp>;
|
||||
/**
|
||||
*
|
||||
* LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced
|
||||
* using either its payment hash, payment address, or set ID.
|
||||
*
|
||||
* @generated from protobuf rpc: LookupInvoiceV2(invoicesrpc.LookupInvoiceMsg) returns (lnrpc.Invoice);
|
||||
*/
|
||||
lookupInvoiceV2(input: LookupInvoiceMsg, options?: RpcOptions): UnaryCall<LookupInvoiceMsg, Invoice>;
|
||||
}
|
||||
76
proto/lnd/invoices.client.js
Normal file
76
proto/lnd/invoices.client.js
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
|
||||
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
import { Invoices } from "./invoices.js";
|
||||
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
|
||||
/**
|
||||
* Invoices is a service that can be used to create, accept, settle and cancel
|
||||
* invoices.
|
||||
*
|
||||
* @generated from protobuf service invoicesrpc.Invoices
|
||||
*/
|
||||
export class InvoicesClient {
|
||||
constructor(_transport) {
|
||||
this._transport = _transport;
|
||||
this.typeName = Invoices.typeName;
|
||||
this.methods = Invoices.methods;
|
||||
this.options = Invoices.options;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* SubscribeSingleInvoice returns a uni-directional stream (server -> client)
|
||||
* to notify the client of state transitions of the specified invoice.
|
||||
* Initially the current invoice state is always sent out.
|
||||
*
|
||||
* @generated from protobuf rpc: SubscribeSingleInvoice(invoicesrpc.SubscribeSingleInvoiceRequest) returns (stream lnrpc.Invoice);
|
||||
*/
|
||||
subscribeSingleInvoice(input, options) {
|
||||
const method = this.methods[0], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* CancelInvoice cancels a currently open invoice. If the invoice is already
|
||||
* canceled, this call will succeed. If the invoice is already settled, it will
|
||||
* fail.
|
||||
*
|
||||
* @generated from protobuf rpc: CancelInvoice(invoicesrpc.CancelInvoiceMsg) returns (invoicesrpc.CancelInvoiceResp);
|
||||
*/
|
||||
cancelInvoice(input, options) {
|
||||
const method = this.methods[1], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* AddHoldInvoice creates a hold invoice. It ties the invoice to the hash
|
||||
* supplied in the request.
|
||||
*
|
||||
* @generated from protobuf rpc: AddHoldInvoice(invoicesrpc.AddHoldInvoiceRequest) returns (invoicesrpc.AddHoldInvoiceResp);
|
||||
*/
|
||||
addHoldInvoice(input, options) {
|
||||
const method = this.methods[2], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* SettleInvoice settles an accepted invoice. If the invoice is already
|
||||
* settled, this call will succeed.
|
||||
*
|
||||
* @generated from protobuf rpc: SettleInvoice(invoicesrpc.SettleInvoiceMsg) returns (invoicesrpc.SettleInvoiceResp);
|
||||
*/
|
||||
settleInvoice(input, options) {
|
||||
const method = this.methods[3], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced
|
||||
* using either its payment hash, payment address, or set ID.
|
||||
*
|
||||
* @generated from protobuf rpc: LookupInvoiceV2(invoicesrpc.LookupInvoiceMsg) returns (lnrpc.Invoice);
|
||||
*/
|
||||
lookupInvoiceV2(input, options) {
|
||||
const method = this.methods[4], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// @generated by protobuf-ts 2.5.0
|
||||
// @generated by protobuf-ts 2.8.1 with parameter long_type_number
|
||||
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
||||
|
|
|
|||
318
proto/lnd/invoices.d.ts
vendored
Normal file
318
proto/lnd/invoices.d.ts
vendored
Normal file
|
|
@ -0,0 +1,318 @@
|
|||
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
|
||||
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
||||
import type { IBinaryWriter } from "@protobuf-ts/runtime";
|
||||
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
||||
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
||||
import type { PartialMessage } from "@protobuf-ts/runtime";
|
||||
import { MessageType } from "@protobuf-ts/runtime";
|
||||
import { RouteHint } from "./lightning";
|
||||
/**
|
||||
* @generated from protobuf message invoicesrpc.CancelInvoiceMsg
|
||||
*/
|
||||
export interface CancelInvoiceMsg {
|
||||
/**
|
||||
* Hash corresponding to the (hold) invoice to cancel. When using
|
||||
* REST, this field must be encoded as base64.
|
||||
*
|
||||
* @generated from protobuf field: bytes payment_hash = 1;
|
||||
*/
|
||||
paymentHash: Uint8Array;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message invoicesrpc.CancelInvoiceResp
|
||||
*/
|
||||
export interface CancelInvoiceResp {
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message invoicesrpc.AddHoldInvoiceRequest
|
||||
*/
|
||||
export interface AddHoldInvoiceRequest {
|
||||
/**
|
||||
*
|
||||
* An optional memo to attach along with the invoice. Used for record keeping
|
||||
* purposes for the invoice's creator, and will also be set in the description
|
||||
* field of the encoded payment request if the description_hash field is not
|
||||
* being used.
|
||||
*
|
||||
* @generated from protobuf field: string memo = 1;
|
||||
*/
|
||||
memo: string;
|
||||
/**
|
||||
* The hash of the preimage
|
||||
*
|
||||
* @generated from protobuf field: bytes hash = 2;
|
||||
*/
|
||||
hash: Uint8Array;
|
||||
/**
|
||||
*
|
||||
* The value of this invoice in satoshis
|
||||
*
|
||||
* The fields value and value_msat are mutually exclusive.
|
||||
*
|
||||
* @generated from protobuf field: int64 value = 3;
|
||||
*/
|
||||
value: number;
|
||||
/**
|
||||
*
|
||||
* The value of this invoice in millisatoshis
|
||||
*
|
||||
* The fields value and value_msat are mutually exclusive.
|
||||
*
|
||||
* @generated from protobuf field: int64 value_msat = 10;
|
||||
*/
|
||||
valueMsat: number;
|
||||
/**
|
||||
*
|
||||
* Hash (SHA-256) of a description of the payment. Used if the description of
|
||||
* payment (memo) is too long to naturally fit within the description field
|
||||
* of an encoded payment request.
|
||||
*
|
||||
* @generated from protobuf field: bytes description_hash = 4;
|
||||
*/
|
||||
descriptionHash: Uint8Array;
|
||||
/**
|
||||
* Payment request expiry time in seconds. Default is 3600 (1 hour).
|
||||
*
|
||||
* @generated from protobuf field: int64 expiry = 5;
|
||||
*/
|
||||
expiry: number;
|
||||
/**
|
||||
* Fallback on-chain address.
|
||||
*
|
||||
* @generated from protobuf field: string fallback_addr = 6;
|
||||
*/
|
||||
fallbackAddr: string;
|
||||
/**
|
||||
* Delta to use for the time-lock of the CLTV extended to the final hop.
|
||||
*
|
||||
* @generated from protobuf field: uint64 cltv_expiry = 7;
|
||||
*/
|
||||
cltvExpiry: number;
|
||||
/**
|
||||
*
|
||||
* Route hints that can each be individually used to assist in reaching the
|
||||
* invoice's destination.
|
||||
*
|
||||
* @generated from protobuf field: repeated lnrpc.RouteHint route_hints = 8;
|
||||
*/
|
||||
routeHints: RouteHint[];
|
||||
/**
|
||||
* Whether this invoice should include routing hints for private channels.
|
||||
*
|
||||
* @generated from protobuf field: bool private = 9;
|
||||
*/
|
||||
private: boolean;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message invoicesrpc.AddHoldInvoiceResp
|
||||
*/
|
||||
export interface AddHoldInvoiceResp {
|
||||
/**
|
||||
*
|
||||
* A bare-bones invoice for a payment within the Lightning Network. With the
|
||||
* details of the invoice, the sender has all the data necessary to send a
|
||||
* payment to the recipient.
|
||||
*
|
||||
* @generated from protobuf field: string payment_request = 1;
|
||||
*/
|
||||
paymentRequest: string;
|
||||
/**
|
||||
*
|
||||
* The "add" index of this invoice. Each newly created invoice will increment
|
||||
* this index making it monotonically increasing. Callers to the
|
||||
* SubscribeInvoices call can use this to instantly get notified of all added
|
||||
* invoices with an add_index greater than this one.
|
||||
*
|
||||
* @generated from protobuf field: uint64 add_index = 2;
|
||||
*/
|
||||
addIndex: number;
|
||||
/**
|
||||
*
|
||||
* The payment address of the generated invoice. This value should be used
|
||||
* in all payments for this invoice as we require it for end to end
|
||||
* security.
|
||||
*
|
||||
* @generated from protobuf field: bytes payment_addr = 3;
|
||||
*/
|
||||
paymentAddr: Uint8Array;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message invoicesrpc.SettleInvoiceMsg
|
||||
*/
|
||||
export interface SettleInvoiceMsg {
|
||||
/**
|
||||
* Externally discovered pre-image that should be used to settle the hold
|
||||
* invoice.
|
||||
*
|
||||
* @generated from protobuf field: bytes preimage = 1;
|
||||
*/
|
||||
preimage: Uint8Array;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message invoicesrpc.SettleInvoiceResp
|
||||
*/
|
||||
export interface SettleInvoiceResp {
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message invoicesrpc.SubscribeSingleInvoiceRequest
|
||||
*/
|
||||
export interface SubscribeSingleInvoiceRequest {
|
||||
/**
|
||||
* Hash corresponding to the (hold) invoice to subscribe to. When using
|
||||
* REST, this field must be encoded as base64url.
|
||||
*
|
||||
* @generated from protobuf field: bytes r_hash = 2;
|
||||
*/
|
||||
rHash: Uint8Array;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message invoicesrpc.LookupInvoiceMsg
|
||||
*/
|
||||
export interface LookupInvoiceMsg {
|
||||
/**
|
||||
* @generated from protobuf oneof: invoice_ref
|
||||
*/
|
||||
invoiceRef: {
|
||||
oneofKind: "paymentHash";
|
||||
/**
|
||||
* When using REST, this field must be encoded as base64.
|
||||
*
|
||||
* @generated from protobuf field: bytes payment_hash = 1;
|
||||
*/
|
||||
paymentHash: Uint8Array;
|
||||
} | {
|
||||
oneofKind: "paymentAddr";
|
||||
/**
|
||||
* @generated from protobuf field: bytes payment_addr = 2;
|
||||
*/
|
||||
paymentAddr: Uint8Array;
|
||||
} | {
|
||||
oneofKind: "setId";
|
||||
/**
|
||||
* @generated from protobuf field: bytes set_id = 3;
|
||||
*/
|
||||
setId: Uint8Array;
|
||||
} | {
|
||||
oneofKind: undefined;
|
||||
};
|
||||
/**
|
||||
* @generated from protobuf field: invoicesrpc.LookupModifier lookup_modifier = 4;
|
||||
*/
|
||||
lookupModifier: LookupModifier;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf enum invoicesrpc.LookupModifier
|
||||
*/
|
||||
export declare enum LookupModifier {
|
||||
/**
|
||||
* The default look up modifier, no look up behavior is changed.
|
||||
*
|
||||
* @generated from protobuf enum value: DEFAULT = 0;
|
||||
*/
|
||||
DEFAULT = 0,
|
||||
/**
|
||||
*
|
||||
* Indicates that when a look up is done based on a set_id, then only that set
|
||||
* of HTLCs related to that set ID should be returned.
|
||||
*
|
||||
* @generated from protobuf enum value: HTLC_SET_ONLY = 1;
|
||||
*/
|
||||
HTLC_SET_ONLY = 1,
|
||||
/**
|
||||
*
|
||||
* Indicates that when a look up is done using a payment_addr, then no HTLCs
|
||||
* related to the payment_addr should be returned. This is useful when one
|
||||
* wants to be able to obtain the set of associated setIDs with a given
|
||||
* invoice, then look up the sub-invoices "projected" by that set ID.
|
||||
*
|
||||
* @generated from protobuf enum value: HTLC_SET_BLANK = 2;
|
||||
*/
|
||||
HTLC_SET_BLANK = 2
|
||||
}
|
||||
declare class CancelInvoiceMsg$Type extends MessageType<CancelInvoiceMsg> {
|
||||
constructor();
|
||||
create(value?: PartialMessage<CancelInvoiceMsg>): CancelInvoiceMsg;
|
||||
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CancelInvoiceMsg): CancelInvoiceMsg;
|
||||
internalBinaryWrite(message: CancelInvoiceMsg, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.CancelInvoiceMsg
|
||||
*/
|
||||
export declare const CancelInvoiceMsg: CancelInvoiceMsg$Type;
|
||||
declare class CancelInvoiceResp$Type extends MessageType<CancelInvoiceResp> {
|
||||
constructor();
|
||||
create(value?: PartialMessage<CancelInvoiceResp>): CancelInvoiceResp;
|
||||
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CancelInvoiceResp): CancelInvoiceResp;
|
||||
internalBinaryWrite(message: CancelInvoiceResp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.CancelInvoiceResp
|
||||
*/
|
||||
export declare const CancelInvoiceResp: CancelInvoiceResp$Type;
|
||||
declare class AddHoldInvoiceRequest$Type extends MessageType<AddHoldInvoiceRequest> {
|
||||
constructor();
|
||||
create(value?: PartialMessage<AddHoldInvoiceRequest>): AddHoldInvoiceRequest;
|
||||
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AddHoldInvoiceRequest): AddHoldInvoiceRequest;
|
||||
internalBinaryWrite(message: AddHoldInvoiceRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.AddHoldInvoiceRequest
|
||||
*/
|
||||
export declare const AddHoldInvoiceRequest: AddHoldInvoiceRequest$Type;
|
||||
declare class AddHoldInvoiceResp$Type extends MessageType<AddHoldInvoiceResp> {
|
||||
constructor();
|
||||
create(value?: PartialMessage<AddHoldInvoiceResp>): AddHoldInvoiceResp;
|
||||
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AddHoldInvoiceResp): AddHoldInvoiceResp;
|
||||
internalBinaryWrite(message: AddHoldInvoiceResp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.AddHoldInvoiceResp
|
||||
*/
|
||||
export declare const AddHoldInvoiceResp: AddHoldInvoiceResp$Type;
|
||||
declare class SettleInvoiceMsg$Type extends MessageType<SettleInvoiceMsg> {
|
||||
constructor();
|
||||
create(value?: PartialMessage<SettleInvoiceMsg>): SettleInvoiceMsg;
|
||||
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SettleInvoiceMsg): SettleInvoiceMsg;
|
||||
internalBinaryWrite(message: SettleInvoiceMsg, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.SettleInvoiceMsg
|
||||
*/
|
||||
export declare const SettleInvoiceMsg: SettleInvoiceMsg$Type;
|
||||
declare class SettleInvoiceResp$Type extends MessageType<SettleInvoiceResp> {
|
||||
constructor();
|
||||
create(value?: PartialMessage<SettleInvoiceResp>): SettleInvoiceResp;
|
||||
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SettleInvoiceResp): SettleInvoiceResp;
|
||||
internalBinaryWrite(message: SettleInvoiceResp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.SettleInvoiceResp
|
||||
*/
|
||||
export declare const SettleInvoiceResp: SettleInvoiceResp$Type;
|
||||
declare class SubscribeSingleInvoiceRequest$Type extends MessageType<SubscribeSingleInvoiceRequest> {
|
||||
constructor();
|
||||
create(value?: PartialMessage<SubscribeSingleInvoiceRequest>): SubscribeSingleInvoiceRequest;
|
||||
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SubscribeSingleInvoiceRequest): SubscribeSingleInvoiceRequest;
|
||||
internalBinaryWrite(message: SubscribeSingleInvoiceRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.SubscribeSingleInvoiceRequest
|
||||
*/
|
||||
export declare const SubscribeSingleInvoiceRequest: SubscribeSingleInvoiceRequest$Type;
|
||||
declare class LookupInvoiceMsg$Type extends MessageType<LookupInvoiceMsg> {
|
||||
constructor();
|
||||
create(value?: PartialMessage<LookupInvoiceMsg>): LookupInvoiceMsg;
|
||||
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: LookupInvoiceMsg): LookupInvoiceMsg;
|
||||
internalBinaryWrite(message: LookupInvoiceMsg, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.LookupInvoiceMsg
|
||||
*/
|
||||
export declare const LookupInvoiceMsg: LookupInvoiceMsg$Type;
|
||||
/**
|
||||
* @generated ServiceType for protobuf service invoicesrpc.Invoices
|
||||
*/
|
||||
export declare const Invoices: any;
|
||||
export {};
|
||||
495
proto/lnd/invoices.js
Normal file
495
proto/lnd/invoices.js
Normal file
|
|
@ -0,0 +1,495 @@
|
|||
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
|
||||
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
|
||||
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
import { Invoice } from "./lightning.js";
|
||||
import { ServiceType } from "@protobuf-ts/runtime-rpc";
|
||||
import { WireType } from "@protobuf-ts/runtime";
|
||||
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
||||
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
||||
import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
|
||||
import { MessageType } from "@protobuf-ts/runtime";
|
||||
import { RouteHint } from "./lightning.js";
|
||||
/**
|
||||
* @generated from protobuf enum invoicesrpc.LookupModifier
|
||||
*/
|
||||
export var LookupModifier;
|
||||
(function (LookupModifier) {
|
||||
/**
|
||||
* The default look up modifier, no look up behavior is changed.
|
||||
*
|
||||
* @generated from protobuf enum value: DEFAULT = 0;
|
||||
*/
|
||||
LookupModifier[LookupModifier["DEFAULT"] = 0] = "DEFAULT";
|
||||
/**
|
||||
*
|
||||
* Indicates that when a look up is done based on a set_id, then only that set
|
||||
* of HTLCs related to that set ID should be returned.
|
||||
*
|
||||
* @generated from protobuf enum value: HTLC_SET_ONLY = 1;
|
||||
*/
|
||||
LookupModifier[LookupModifier["HTLC_SET_ONLY"] = 1] = "HTLC_SET_ONLY";
|
||||
/**
|
||||
*
|
||||
* Indicates that when a look up is done using a payment_addr, then no HTLCs
|
||||
* related to the payment_addr should be returned. This is useful when one
|
||||
* wants to be able to obtain the set of associated setIDs with a given
|
||||
* invoice, then look up the sub-invoices "projected" by that set ID.
|
||||
*
|
||||
* @generated from protobuf enum value: HTLC_SET_BLANK = 2;
|
||||
*/
|
||||
LookupModifier[LookupModifier["HTLC_SET_BLANK"] = 2] = "HTLC_SET_BLANK";
|
||||
})(LookupModifier || (LookupModifier = {}));
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class CancelInvoiceMsg$Type extends MessageType {
|
||||
constructor() {
|
||||
super("invoicesrpc.CancelInvoiceMsg", [
|
||||
{ no: 1, name: "payment_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
||||
]);
|
||||
}
|
||||
create(value) {
|
||||
const message = { paymentHash: new Uint8Array(0) };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader, length, options, target) {
|
||||
let message = target ?? this.create(), end = reader.pos + length;
|
||||
while (reader.pos < end) {
|
||||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* bytes payment_hash */ 1:
|
||||
message.paymentHash = reader.bytes();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
if (u === "throw")
|
||||
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||
let d = reader.skip(wireType);
|
||||
if (u !== false)
|
||||
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
internalBinaryWrite(message, writer, options) {
|
||||
/* bytes payment_hash = 1; */
|
||||
if (message.paymentHash.length)
|
||||
writer.tag(1, WireType.LengthDelimited).bytes(message.paymentHash);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.CancelInvoiceMsg
|
||||
*/
|
||||
export const CancelInvoiceMsg = new CancelInvoiceMsg$Type();
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class CancelInvoiceResp$Type extends MessageType {
|
||||
constructor() {
|
||||
super("invoicesrpc.CancelInvoiceResp", []);
|
||||
}
|
||||
create(value) {
|
||||
const message = {};
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader, length, options, target) {
|
||||
return target ?? this.create();
|
||||
}
|
||||
internalBinaryWrite(message, writer, options) {
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.CancelInvoiceResp
|
||||
*/
|
||||
export const CancelInvoiceResp = new CancelInvoiceResp$Type();
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class AddHoldInvoiceRequest$Type extends MessageType {
|
||||
constructor() {
|
||||
super("invoicesrpc.AddHoldInvoiceRequest", [
|
||||
{ no: 1, name: "memo", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 2, name: "hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 3, name: "value", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 10, name: "value_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 4, name: "description_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 5, name: "expiry", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 6, name: "fallback_addr", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 7, name: "cltv_expiry", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 8, name: "route_hints", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => RouteHint },
|
||||
{ no: 9, name: "private", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
|
||||
]);
|
||||
}
|
||||
create(value) {
|
||||
const message = { memo: "", hash: new Uint8Array(0), value: 0, valueMsat: 0, descriptionHash: new Uint8Array(0), expiry: 0, fallbackAddr: "", cltvExpiry: 0, routeHints: [], private: false };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader, length, options, target) {
|
||||
let message = target ?? this.create(), end = reader.pos + length;
|
||||
while (reader.pos < end) {
|
||||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* string memo */ 1:
|
||||
message.memo = reader.string();
|
||||
break;
|
||||
case /* bytes hash */ 2:
|
||||
message.hash = reader.bytes();
|
||||
break;
|
||||
case /* int64 value */ 3:
|
||||
message.value = reader.int64().toNumber();
|
||||
break;
|
||||
case /* int64 value_msat */ 10:
|
||||
message.valueMsat = reader.int64().toNumber();
|
||||
break;
|
||||
case /* bytes description_hash */ 4:
|
||||
message.descriptionHash = reader.bytes();
|
||||
break;
|
||||
case /* int64 expiry */ 5:
|
||||
message.expiry = reader.int64().toNumber();
|
||||
break;
|
||||
case /* string fallback_addr */ 6:
|
||||
message.fallbackAddr = reader.string();
|
||||
break;
|
||||
case /* uint64 cltv_expiry */ 7:
|
||||
message.cltvExpiry = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* repeated lnrpc.RouteHint route_hints */ 8:
|
||||
message.routeHints.push(RouteHint.internalBinaryRead(reader, reader.uint32(), options));
|
||||
break;
|
||||
case /* bool private */ 9:
|
||||
message.private = reader.bool();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
if (u === "throw")
|
||||
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||
let d = reader.skip(wireType);
|
||||
if (u !== false)
|
||||
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
internalBinaryWrite(message, writer, options) {
|
||||
/* string memo = 1; */
|
||||
if (message.memo !== "")
|
||||
writer.tag(1, WireType.LengthDelimited).string(message.memo);
|
||||
/* bytes hash = 2; */
|
||||
if (message.hash.length)
|
||||
writer.tag(2, WireType.LengthDelimited).bytes(message.hash);
|
||||
/* int64 value = 3; */
|
||||
if (message.value !== 0)
|
||||
writer.tag(3, WireType.Varint).int64(message.value);
|
||||
/* int64 value_msat = 10; */
|
||||
if (message.valueMsat !== 0)
|
||||
writer.tag(10, WireType.Varint).int64(message.valueMsat);
|
||||
/* bytes description_hash = 4; */
|
||||
if (message.descriptionHash.length)
|
||||
writer.tag(4, WireType.LengthDelimited).bytes(message.descriptionHash);
|
||||
/* int64 expiry = 5; */
|
||||
if (message.expiry !== 0)
|
||||
writer.tag(5, WireType.Varint).int64(message.expiry);
|
||||
/* string fallback_addr = 6; */
|
||||
if (message.fallbackAddr !== "")
|
||||
writer.tag(6, WireType.LengthDelimited).string(message.fallbackAddr);
|
||||
/* uint64 cltv_expiry = 7; */
|
||||
if (message.cltvExpiry !== 0)
|
||||
writer.tag(7, WireType.Varint).uint64(message.cltvExpiry);
|
||||
/* repeated lnrpc.RouteHint route_hints = 8; */
|
||||
for (let i = 0; i < message.routeHints.length; i++)
|
||||
RouteHint.internalBinaryWrite(message.routeHints[i], writer.tag(8, WireType.LengthDelimited).fork(), options).join();
|
||||
/* bool private = 9; */
|
||||
if (message.private !== false)
|
||||
writer.tag(9, WireType.Varint).bool(message.private);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.AddHoldInvoiceRequest
|
||||
*/
|
||||
export const AddHoldInvoiceRequest = new AddHoldInvoiceRequest$Type();
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class AddHoldInvoiceResp$Type extends MessageType {
|
||||
constructor() {
|
||||
super("invoicesrpc.AddHoldInvoiceResp", [
|
||||
{ no: 1, name: "payment_request", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 2, name: "add_index", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 3, name: "payment_addr", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
||||
]);
|
||||
}
|
||||
create(value) {
|
||||
const message = { paymentRequest: "", addIndex: 0, paymentAddr: new Uint8Array(0) };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader, length, options, target) {
|
||||
let message = target ?? this.create(), end = reader.pos + length;
|
||||
while (reader.pos < end) {
|
||||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* string payment_request */ 1:
|
||||
message.paymentRequest = reader.string();
|
||||
break;
|
||||
case /* uint64 add_index */ 2:
|
||||
message.addIndex = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* bytes payment_addr */ 3:
|
||||
message.paymentAddr = reader.bytes();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
if (u === "throw")
|
||||
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||
let d = reader.skip(wireType);
|
||||
if (u !== false)
|
||||
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
internalBinaryWrite(message, writer, options) {
|
||||
/* string payment_request = 1; */
|
||||
if (message.paymentRequest !== "")
|
||||
writer.tag(1, WireType.LengthDelimited).string(message.paymentRequest);
|
||||
/* uint64 add_index = 2; */
|
||||
if (message.addIndex !== 0)
|
||||
writer.tag(2, WireType.Varint).uint64(message.addIndex);
|
||||
/* bytes payment_addr = 3; */
|
||||
if (message.paymentAddr.length)
|
||||
writer.tag(3, WireType.LengthDelimited).bytes(message.paymentAddr);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.AddHoldInvoiceResp
|
||||
*/
|
||||
export const AddHoldInvoiceResp = new AddHoldInvoiceResp$Type();
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class SettleInvoiceMsg$Type extends MessageType {
|
||||
constructor() {
|
||||
super("invoicesrpc.SettleInvoiceMsg", [
|
||||
{ no: 1, name: "preimage", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
||||
]);
|
||||
}
|
||||
create(value) {
|
||||
const message = { preimage: new Uint8Array(0) };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader, length, options, target) {
|
||||
let message = target ?? this.create(), end = reader.pos + length;
|
||||
while (reader.pos < end) {
|
||||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* bytes preimage */ 1:
|
||||
message.preimage = reader.bytes();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
if (u === "throw")
|
||||
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||
let d = reader.skip(wireType);
|
||||
if (u !== false)
|
||||
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
internalBinaryWrite(message, writer, options) {
|
||||
/* bytes preimage = 1; */
|
||||
if (message.preimage.length)
|
||||
writer.tag(1, WireType.LengthDelimited).bytes(message.preimage);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.SettleInvoiceMsg
|
||||
*/
|
||||
export const SettleInvoiceMsg = new SettleInvoiceMsg$Type();
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class SettleInvoiceResp$Type extends MessageType {
|
||||
constructor() {
|
||||
super("invoicesrpc.SettleInvoiceResp", []);
|
||||
}
|
||||
create(value) {
|
||||
const message = {};
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader, length, options, target) {
|
||||
return target ?? this.create();
|
||||
}
|
||||
internalBinaryWrite(message, writer, options) {
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.SettleInvoiceResp
|
||||
*/
|
||||
export const SettleInvoiceResp = new SettleInvoiceResp$Type();
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class SubscribeSingleInvoiceRequest$Type extends MessageType {
|
||||
constructor() {
|
||||
super("invoicesrpc.SubscribeSingleInvoiceRequest", [
|
||||
{ no: 2, name: "r_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
||||
]);
|
||||
}
|
||||
create(value) {
|
||||
const message = { rHash: new Uint8Array(0) };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader, length, options, target) {
|
||||
let message = target ?? this.create(), end = reader.pos + length;
|
||||
while (reader.pos < end) {
|
||||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* bytes r_hash */ 2:
|
||||
message.rHash = reader.bytes();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
if (u === "throw")
|
||||
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||
let d = reader.skip(wireType);
|
||||
if (u !== false)
|
||||
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
internalBinaryWrite(message, writer, options) {
|
||||
/* bytes r_hash = 2; */
|
||||
if (message.rHash.length)
|
||||
writer.tag(2, WireType.LengthDelimited).bytes(message.rHash);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.SubscribeSingleInvoiceRequest
|
||||
*/
|
||||
export const SubscribeSingleInvoiceRequest = new SubscribeSingleInvoiceRequest$Type();
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class LookupInvoiceMsg$Type extends MessageType {
|
||||
constructor() {
|
||||
super("invoicesrpc.LookupInvoiceMsg", [
|
||||
{ no: 1, name: "payment_hash", kind: "scalar", oneof: "invoiceRef", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 2, name: "payment_addr", kind: "scalar", oneof: "invoiceRef", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 3, name: "set_id", kind: "scalar", oneof: "invoiceRef", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 4, name: "lookup_modifier", kind: "enum", T: () => ["invoicesrpc.LookupModifier", LookupModifier] }
|
||||
]);
|
||||
}
|
||||
create(value) {
|
||||
const message = { invoiceRef: { oneofKind: undefined }, lookupModifier: 0 };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader, length, options, target) {
|
||||
let message = target ?? this.create(), end = reader.pos + length;
|
||||
while (reader.pos < end) {
|
||||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* bytes payment_hash */ 1:
|
||||
message.invoiceRef = {
|
||||
oneofKind: "paymentHash",
|
||||
paymentHash: reader.bytes()
|
||||
};
|
||||
break;
|
||||
case /* bytes payment_addr */ 2:
|
||||
message.invoiceRef = {
|
||||
oneofKind: "paymentAddr",
|
||||
paymentAddr: reader.bytes()
|
||||
};
|
||||
break;
|
||||
case /* bytes set_id */ 3:
|
||||
message.invoiceRef = {
|
||||
oneofKind: "setId",
|
||||
setId: reader.bytes()
|
||||
};
|
||||
break;
|
||||
case /* invoicesrpc.LookupModifier lookup_modifier */ 4:
|
||||
message.lookupModifier = reader.int32();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
if (u === "throw")
|
||||
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||
let d = reader.skip(wireType);
|
||||
if (u !== false)
|
||||
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
internalBinaryWrite(message, writer, options) {
|
||||
/* bytes payment_hash = 1; */
|
||||
if (message.invoiceRef.oneofKind === "paymentHash")
|
||||
writer.tag(1, WireType.LengthDelimited).bytes(message.invoiceRef.paymentHash);
|
||||
/* bytes payment_addr = 2; */
|
||||
if (message.invoiceRef.oneofKind === "paymentAddr")
|
||||
writer.tag(2, WireType.LengthDelimited).bytes(message.invoiceRef.paymentAddr);
|
||||
/* bytes set_id = 3; */
|
||||
if (message.invoiceRef.oneofKind === "setId")
|
||||
writer.tag(3, WireType.LengthDelimited).bytes(message.invoiceRef.setId);
|
||||
/* invoicesrpc.LookupModifier lookup_modifier = 4; */
|
||||
if (message.lookupModifier !== 0)
|
||||
writer.tag(4, WireType.Varint).int32(message.lookupModifier);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.LookupInvoiceMsg
|
||||
*/
|
||||
export const LookupInvoiceMsg = new LookupInvoiceMsg$Type();
|
||||
/**
|
||||
* @generated ServiceType for protobuf service invoicesrpc.Invoices
|
||||
*/
|
||||
export const Invoices = new ServiceType("invoicesrpc.Invoices", [
|
||||
{ name: "SubscribeSingleInvoice", serverStreaming: true, options: {}, I: SubscribeSingleInvoiceRequest, O: Invoice },
|
||||
{ name: "CancelInvoice", options: {}, I: CancelInvoiceMsg, O: CancelInvoiceResp },
|
||||
{ name: "AddHoldInvoice", options: {}, I: AddHoldInvoiceRequest, O: AddHoldInvoiceResp },
|
||||
{ name: "SettleInvoice", options: {}, I: SettleInvoiceMsg, O: SettleInvoiceResp },
|
||||
{ name: "LookupInvoiceV2", options: {}, I: LookupInvoiceMsg, O: Invoice }
|
||||
]);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// @generated by protobuf-ts 2.5.0
|
||||
// @generated by protobuf-ts 2.8.1 with parameter long_type_number
|
||||
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
import { Invoice } from "./lightning";
|
||||
|
|
@ -59,7 +59,7 @@ export interface AddHoldInvoiceRequest {
|
|||
*
|
||||
* @generated from protobuf field: int64 value = 3;
|
||||
*/
|
||||
value: bigint;
|
||||
value: number;
|
||||
/**
|
||||
*
|
||||
* The value of this invoice in millisatoshis
|
||||
|
|
@ -68,7 +68,7 @@ export interface AddHoldInvoiceRequest {
|
|||
*
|
||||
* @generated from protobuf field: int64 value_msat = 10;
|
||||
*/
|
||||
valueMsat: bigint;
|
||||
valueMsat: number;
|
||||
/**
|
||||
*
|
||||
* Hash (SHA-256) of a description of the payment. Used if the description of
|
||||
|
|
@ -83,7 +83,7 @@ export interface AddHoldInvoiceRequest {
|
|||
*
|
||||
* @generated from protobuf field: int64 expiry = 5;
|
||||
*/
|
||||
expiry: bigint;
|
||||
expiry: number;
|
||||
/**
|
||||
* Fallback on-chain address.
|
||||
*
|
||||
|
|
@ -95,7 +95,7 @@ export interface AddHoldInvoiceRequest {
|
|||
*
|
||||
* @generated from protobuf field: uint64 cltv_expiry = 7;
|
||||
*/
|
||||
cltvExpiry: bigint;
|
||||
cltvExpiry: number;
|
||||
/**
|
||||
*
|
||||
* Route hints that can each be individually used to assist in reaching the
|
||||
|
|
@ -133,7 +133,7 @@ export interface AddHoldInvoiceResp {
|
|||
*
|
||||
* @generated from protobuf field: uint64 add_index = 2;
|
||||
*/
|
||||
addIndex: bigint;
|
||||
addIndex: number;
|
||||
/**
|
||||
*
|
||||
* The payment address of the generated invoice. This value should be used
|
||||
|
|
@ -316,18 +316,18 @@ class AddHoldInvoiceRequest$Type extends MessageType<AddHoldInvoiceRequest> {
|
|||
super("invoicesrpc.AddHoldInvoiceRequest", [
|
||||
{ no: 1, name: "memo", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 2, name: "hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 3, name: "value", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 10, name: "value_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 3, name: "value", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 10, name: "value_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 4, name: "description_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 5, name: "expiry", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 5, name: "expiry", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 6, name: "fallback_addr", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 7, name: "cltv_expiry", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 7, name: "cltv_expiry", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 8, name: "route_hints", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => RouteHint },
|
||||
{ no: 9, name: "private", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<AddHoldInvoiceRequest>): AddHoldInvoiceRequest {
|
||||
const message = { memo: "", hash: new Uint8Array(0), value: 0n, valueMsat: 0n, descriptionHash: new Uint8Array(0), expiry: 0n, fallbackAddr: "", cltvExpiry: 0n, routeHints: [], private: false };
|
||||
const message = { memo: "", hash: new Uint8Array(0), value: 0, valueMsat: 0, descriptionHash: new Uint8Array(0), expiry: 0, fallbackAddr: "", cltvExpiry: 0, routeHints: [], private: false };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<AddHoldInvoiceRequest>(this, message, value);
|
||||
|
|
@ -345,22 +345,22 @@ class AddHoldInvoiceRequest$Type extends MessageType<AddHoldInvoiceRequest> {
|
|||
message.hash = reader.bytes();
|
||||
break;
|
||||
case /* int64 value */ 3:
|
||||
message.value = reader.int64().toBigInt();
|
||||
message.value = reader.int64().toNumber();
|
||||
break;
|
||||
case /* int64 value_msat */ 10:
|
||||
message.valueMsat = reader.int64().toBigInt();
|
||||
message.valueMsat = reader.int64().toNumber();
|
||||
break;
|
||||
case /* bytes description_hash */ 4:
|
||||
message.descriptionHash = reader.bytes();
|
||||
break;
|
||||
case /* int64 expiry */ 5:
|
||||
message.expiry = reader.int64().toBigInt();
|
||||
message.expiry = reader.int64().toNumber();
|
||||
break;
|
||||
case /* string fallback_addr */ 6:
|
||||
message.fallbackAddr = reader.string();
|
||||
break;
|
||||
case /* uint64 cltv_expiry */ 7:
|
||||
message.cltvExpiry = reader.uint64().toBigInt();
|
||||
message.cltvExpiry = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* repeated lnrpc.RouteHint route_hints */ 8:
|
||||
message.routeHints.push(RouteHint.internalBinaryRead(reader, reader.uint32(), options));
|
||||
|
|
@ -387,22 +387,22 @@ class AddHoldInvoiceRequest$Type extends MessageType<AddHoldInvoiceRequest> {
|
|||
if (message.hash.length)
|
||||
writer.tag(2, WireType.LengthDelimited).bytes(message.hash);
|
||||
/* int64 value = 3; */
|
||||
if (message.value !== 0n)
|
||||
if (message.value !== 0)
|
||||
writer.tag(3, WireType.Varint).int64(message.value);
|
||||
/* int64 value_msat = 10; */
|
||||
if (message.valueMsat !== 0n)
|
||||
if (message.valueMsat !== 0)
|
||||
writer.tag(10, WireType.Varint).int64(message.valueMsat);
|
||||
/* bytes description_hash = 4; */
|
||||
if (message.descriptionHash.length)
|
||||
writer.tag(4, WireType.LengthDelimited).bytes(message.descriptionHash);
|
||||
/* int64 expiry = 5; */
|
||||
if (message.expiry !== 0n)
|
||||
if (message.expiry !== 0)
|
||||
writer.tag(5, WireType.Varint).int64(message.expiry);
|
||||
/* string fallback_addr = 6; */
|
||||
if (message.fallbackAddr !== "")
|
||||
writer.tag(6, WireType.LengthDelimited).string(message.fallbackAddr);
|
||||
/* uint64 cltv_expiry = 7; */
|
||||
if (message.cltvExpiry !== 0n)
|
||||
if (message.cltvExpiry !== 0)
|
||||
writer.tag(7, WireType.Varint).uint64(message.cltvExpiry);
|
||||
/* repeated lnrpc.RouteHint route_hints = 8; */
|
||||
for (let i = 0; i < message.routeHints.length; i++)
|
||||
|
|
@ -425,12 +425,12 @@ class AddHoldInvoiceResp$Type extends MessageType<AddHoldInvoiceResp> {
|
|||
constructor() {
|
||||
super("invoicesrpc.AddHoldInvoiceResp", [
|
||||
{ no: 1, name: "payment_request", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 2, name: "add_index", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 2, name: "add_index", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 3, name: "payment_addr", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<AddHoldInvoiceResp>): AddHoldInvoiceResp {
|
||||
const message = { paymentRequest: "", addIndex: 0n, paymentAddr: new Uint8Array(0) };
|
||||
const message = { paymentRequest: "", addIndex: 0, paymentAddr: new Uint8Array(0) };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<AddHoldInvoiceResp>(this, message, value);
|
||||
|
|
@ -445,7 +445,7 @@ class AddHoldInvoiceResp$Type extends MessageType<AddHoldInvoiceResp> {
|
|||
message.paymentRequest = reader.string();
|
||||
break;
|
||||
case /* uint64 add_index */ 2:
|
||||
message.addIndex = reader.uint64().toBigInt();
|
||||
message.addIndex = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* bytes payment_addr */ 3:
|
||||
message.paymentAddr = reader.bytes();
|
||||
|
|
@ -466,7 +466,7 @@ class AddHoldInvoiceResp$Type extends MessageType<AddHoldInvoiceResp> {
|
|||
if (message.paymentRequest !== "")
|
||||
writer.tag(1, WireType.LengthDelimited).string(message.paymentRequest);
|
||||
/* uint64 add_index = 2; */
|
||||
if (message.addIndex !== 0n)
|
||||
if (message.addIndex !== 0)
|
||||
writer.tag(2, WireType.Varint).uint64(message.addIndex);
|
||||
/* bytes payment_addr = 3; */
|
||||
if (message.paymentAddr.length)
|
||||
|
|
|
|||
1481
proto/lnd/lightning.client.d.ts
vendored
Normal file
1481
proto/lnd/lightning.client.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
901
proto/lnd/lightning.client.js
Normal file
901
proto/lnd/lightning.client.js
Normal file
|
|
@ -0,0 +1,901 @@
|
|||
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
|
||||
// @generated from protobuf file "lightning.proto" (package "lnrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
import { Lightning } from "./lightning.js";
|
||||
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
|
||||
//
|
||||
// Comments in this file will be directly parsed into the API
|
||||
// Documentation as descriptions of the associated method, message, or field.
|
||||
// These descriptions should go right above the definition of the object, and
|
||||
// can be in either block or // comment format.
|
||||
//
|
||||
// An RPC method can be matched to an lncli command by placing a line in the
|
||||
// beginning of the description in exactly the following format:
|
||||
// lncli: `methodname`
|
||||
//
|
||||
// Failure to specify the exact name of the command will cause documentation
|
||||
// generation to fail.
|
||||
//
|
||||
// More information on how exactly the gRPC documentation is generated from
|
||||
// this proto file can be found here:
|
||||
// https://github.com/lightninglabs/lightning-api
|
||||
/**
|
||||
* Lightning is the main RPC server of the daemon.
|
||||
*
|
||||
* @generated from protobuf service lnrpc.Lightning
|
||||
*/
|
||||
export class LightningClient {
|
||||
constructor(_transport) {
|
||||
this._transport = _transport;
|
||||
this.typeName = Lightning.typeName;
|
||||
this.methods = Lightning.methods;
|
||||
this.options = Lightning.options;
|
||||
}
|
||||
/**
|
||||
* lncli: `walletbalance`
|
||||
* WalletBalance returns total unspent outputs(confirmed and unconfirmed), all
|
||||
* confirmed unspent outputs and all unconfirmed unspent outputs under control
|
||||
* of the wallet.
|
||||
*
|
||||
* @generated from protobuf rpc: WalletBalance(lnrpc.WalletBalanceRequest) returns (lnrpc.WalletBalanceResponse);
|
||||
*/
|
||||
walletBalance(input, options) {
|
||||
const method = this.methods[0], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `channelbalance`
|
||||
* ChannelBalance returns a report on the total funds across all open channels,
|
||||
* categorized in local/remote, pending local/remote and unsettled local/remote
|
||||
* balances.
|
||||
*
|
||||
* @generated from protobuf rpc: ChannelBalance(lnrpc.ChannelBalanceRequest) returns (lnrpc.ChannelBalanceResponse);
|
||||
*/
|
||||
channelBalance(input, options) {
|
||||
const method = this.methods[1], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `listchaintxns`
|
||||
* GetTransactions returns a list describing all the known transactions
|
||||
* relevant to the wallet.
|
||||
*
|
||||
* @generated from protobuf rpc: GetTransactions(lnrpc.GetTransactionsRequest) returns (lnrpc.TransactionDetails);
|
||||
*/
|
||||
getTransactions(input, options) {
|
||||
const method = this.methods[2], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `estimatefee`
|
||||
* EstimateFee asks the chain backend to estimate the fee rate and total fees
|
||||
* for a transaction that pays to multiple specified outputs.
|
||||
*
|
||||
* When using REST, the `AddrToAmount` map type can be set by appending
|
||||
* `&AddrToAmount[<address>]=<amount_to_send>` to the URL. Unfortunately this
|
||||
* map type doesn't appear in the REST API documentation because of a bug in
|
||||
* the grpc-gateway library.
|
||||
*
|
||||
* @generated from protobuf rpc: EstimateFee(lnrpc.EstimateFeeRequest) returns (lnrpc.EstimateFeeResponse);
|
||||
*/
|
||||
estimateFee(input, options) {
|
||||
const method = this.methods[3], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `sendcoins`
|
||||
* SendCoins executes a request to send coins to a particular address. Unlike
|
||||
* SendMany, this RPC call only allows creating a single output at a time. If
|
||||
* neither target_conf, or sat_per_vbyte are set, then the internal wallet will
|
||||
* consult its fee model to determine a fee for the default confirmation
|
||||
* target.
|
||||
*
|
||||
* @generated from protobuf rpc: SendCoins(lnrpc.SendCoinsRequest) returns (lnrpc.SendCoinsResponse);
|
||||
*/
|
||||
sendCoins(input, options) {
|
||||
const method = this.methods[4], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `listunspent`
|
||||
* Deprecated, use walletrpc.ListUnspent instead.
|
||||
*
|
||||
* ListUnspent returns a list of all utxos spendable by the wallet with a
|
||||
* number of confirmations between the specified minimum and maximum.
|
||||
*
|
||||
* @generated from protobuf rpc: ListUnspent(lnrpc.ListUnspentRequest) returns (lnrpc.ListUnspentResponse);
|
||||
*/
|
||||
listUnspent(input, options) {
|
||||
const method = this.methods[5], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* SubscribeTransactions creates a uni-directional stream from the server to
|
||||
* the client in which any newly discovered transactions relevant to the
|
||||
* wallet are sent over.
|
||||
*
|
||||
* @generated from protobuf rpc: SubscribeTransactions(lnrpc.GetTransactionsRequest) returns (stream lnrpc.Transaction);
|
||||
*/
|
||||
subscribeTransactions(input, options) {
|
||||
const method = this.methods[6], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `sendmany`
|
||||
* SendMany handles a request for a transaction that creates multiple specified
|
||||
* outputs in parallel. If neither target_conf, or sat_per_vbyte are set, then
|
||||
* the internal wallet will consult its fee model to determine a fee for the
|
||||
* default confirmation target.
|
||||
*
|
||||
* @generated from protobuf rpc: SendMany(lnrpc.SendManyRequest) returns (lnrpc.SendManyResponse);
|
||||
*/
|
||||
sendMany(input, options) {
|
||||
const method = this.methods[7], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `newaddress`
|
||||
* NewAddress creates a new address under control of the local wallet.
|
||||
*
|
||||
* @generated from protobuf rpc: NewAddress(lnrpc.NewAddressRequest) returns (lnrpc.NewAddressResponse);
|
||||
*/
|
||||
newAddress(input, options) {
|
||||
const method = this.methods[8], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `signmessage`
|
||||
* SignMessage signs a message with this node's private key. The returned
|
||||
* signature string is `zbase32` encoded and pubkey recoverable, meaning that
|
||||
* only the message digest and signature are needed for verification.
|
||||
*
|
||||
* @generated from protobuf rpc: SignMessage(lnrpc.SignMessageRequest) returns (lnrpc.SignMessageResponse);
|
||||
*/
|
||||
signMessage(input, options) {
|
||||
const method = this.methods[9], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `verifymessage`
|
||||
* VerifyMessage verifies a signature over a msg. The signature must be
|
||||
* zbase32 encoded and signed by an active node in the resident node's
|
||||
* channel database. In addition to returning the validity of the signature,
|
||||
* VerifyMessage also returns the recovered pubkey from the signature.
|
||||
*
|
||||
* @generated from protobuf rpc: VerifyMessage(lnrpc.VerifyMessageRequest) returns (lnrpc.VerifyMessageResponse);
|
||||
*/
|
||||
verifyMessage(input, options) {
|
||||
const method = this.methods[10], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `connect`
|
||||
* ConnectPeer attempts to establish a connection to a remote peer. This is at
|
||||
* the networking level, and is used for communication between nodes. This is
|
||||
* distinct from establishing a channel with a peer.
|
||||
*
|
||||
* @generated from protobuf rpc: ConnectPeer(lnrpc.ConnectPeerRequest) returns (lnrpc.ConnectPeerResponse);
|
||||
*/
|
||||
connectPeer(input, options) {
|
||||
const method = this.methods[11], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `disconnect`
|
||||
* DisconnectPeer attempts to disconnect one peer from another identified by a
|
||||
* given pubKey. In the case that we currently have a pending or active channel
|
||||
* with the target peer, then this action will be not be allowed.
|
||||
*
|
||||
* @generated from protobuf rpc: DisconnectPeer(lnrpc.DisconnectPeerRequest) returns (lnrpc.DisconnectPeerResponse);
|
||||
*/
|
||||
disconnectPeer(input, options) {
|
||||
const method = this.methods[12], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `listpeers`
|
||||
* ListPeers returns a verbose listing of all currently active peers.
|
||||
*
|
||||
* @generated from protobuf rpc: ListPeers(lnrpc.ListPeersRequest) returns (lnrpc.ListPeersResponse);
|
||||
*/
|
||||
listPeers(input, options) {
|
||||
const method = this.methods[13], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* SubscribePeerEvents creates a uni-directional stream from the server to
|
||||
* the client in which any events relevant to the state of peers are sent
|
||||
* over. Events include peers going online and offline.
|
||||
*
|
||||
* @generated from protobuf rpc: SubscribePeerEvents(lnrpc.PeerEventSubscription) returns (stream lnrpc.PeerEvent);
|
||||
*/
|
||||
subscribePeerEvents(input, options) {
|
||||
const method = this.methods[14], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `getinfo`
|
||||
* GetInfo returns general information concerning the lightning node including
|
||||
* it's identity pubkey, alias, the chains it is connected to, and information
|
||||
* concerning the number of open+pending channels.
|
||||
*
|
||||
* @generated from protobuf rpc: GetInfo(lnrpc.GetInfoRequest) returns (lnrpc.GetInfoResponse);
|
||||
*/
|
||||
getInfo(input, options) {
|
||||
const method = this.methods[15], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* * lncli: `getrecoveryinfo`
|
||||
* GetRecoveryInfo returns information concerning the recovery mode including
|
||||
* whether it's in a recovery mode, whether the recovery is finished, and the
|
||||
* progress made so far.
|
||||
*
|
||||
* @generated from protobuf rpc: GetRecoveryInfo(lnrpc.GetRecoveryInfoRequest) returns (lnrpc.GetRecoveryInfoResponse);
|
||||
*/
|
||||
getRecoveryInfo(input, options) {
|
||||
const method = this.methods[16], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
// TODO(roasbeef): merge with below with bool?
|
||||
/**
|
||||
* lncli: `pendingchannels`
|
||||
* PendingChannels returns a list of all the channels that are currently
|
||||
* considered "pending". A channel is pending if it has finished the funding
|
||||
* workflow and is waiting for confirmations for the funding txn, or is in the
|
||||
* process of closure, either initiated cooperatively or non-cooperatively.
|
||||
*
|
||||
* @generated from protobuf rpc: PendingChannels(lnrpc.PendingChannelsRequest) returns (lnrpc.PendingChannelsResponse);
|
||||
*/
|
||||
pendingChannels(input, options) {
|
||||
const method = this.methods[17], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `listchannels`
|
||||
* ListChannels returns a description of all the open channels that this node
|
||||
* is a participant in.
|
||||
*
|
||||
* @generated from protobuf rpc: ListChannels(lnrpc.ListChannelsRequest) returns (lnrpc.ListChannelsResponse);
|
||||
*/
|
||||
listChannels(input, options) {
|
||||
const method = this.methods[18], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* SubscribeChannelEvents creates a uni-directional stream from the server to
|
||||
* the client in which any updates relevant to the state of the channels are
|
||||
* sent over. Events include new active channels, inactive channels, and closed
|
||||
* channels.
|
||||
*
|
||||
* @generated from protobuf rpc: SubscribeChannelEvents(lnrpc.ChannelEventSubscription) returns (stream lnrpc.ChannelEventUpdate);
|
||||
*/
|
||||
subscribeChannelEvents(input, options) {
|
||||
const method = this.methods[19], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `closedchannels`
|
||||
* ClosedChannels returns a description of all the closed channels that
|
||||
* this node was a participant in.
|
||||
*
|
||||
* @generated from protobuf rpc: ClosedChannels(lnrpc.ClosedChannelsRequest) returns (lnrpc.ClosedChannelsResponse);
|
||||
*/
|
||||
closedChannels(input, options) {
|
||||
const method = this.methods[20], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* OpenChannelSync is a synchronous version of the OpenChannel RPC call. This
|
||||
* call is meant to be consumed by clients to the REST proxy. As with all
|
||||
* other sync calls, all byte slices are intended to be populated as hex
|
||||
* encoded strings.
|
||||
*
|
||||
* @generated from protobuf rpc: OpenChannelSync(lnrpc.OpenChannelRequest) returns (lnrpc.ChannelPoint);
|
||||
*/
|
||||
openChannelSync(input, options) {
|
||||
const method = this.methods[21], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `openchannel`
|
||||
* OpenChannel attempts to open a singly funded channel specified in the
|
||||
* request to a remote peer. Users are able to specify a target number of
|
||||
* blocks that the funding transaction should be confirmed in, or a manual fee
|
||||
* rate to us for the funding transaction. If neither are specified, then a
|
||||
* lax block confirmation target is used. Each OpenStatusUpdate will return
|
||||
* the pending channel ID of the in-progress channel. Depending on the
|
||||
* arguments specified in the OpenChannelRequest, this pending channel ID can
|
||||
* then be used to manually progress the channel funding flow.
|
||||
*
|
||||
* @generated from protobuf rpc: OpenChannel(lnrpc.OpenChannelRequest) returns (stream lnrpc.OpenStatusUpdate);
|
||||
*/
|
||||
openChannel(input, options) {
|
||||
const method = this.methods[22], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `batchopenchannel`
|
||||
* BatchOpenChannel attempts to open multiple single-funded channels in a
|
||||
* single transaction in an atomic way. This means either all channel open
|
||||
* requests succeed at once or all attempts are aborted if any of them fail.
|
||||
* This is the safer variant of using PSBTs to manually fund a batch of
|
||||
* channels through the OpenChannel RPC.
|
||||
*
|
||||
* @generated from protobuf rpc: BatchOpenChannel(lnrpc.BatchOpenChannelRequest) returns (lnrpc.BatchOpenChannelResponse);
|
||||
*/
|
||||
batchOpenChannel(input, options) {
|
||||
const method = this.methods[23], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* FundingStateStep is an advanced funding related call that allows the caller
|
||||
* to either execute some preparatory steps for a funding workflow, or
|
||||
* manually progress a funding workflow. The primary way a funding flow is
|
||||
* identified is via its pending channel ID. As an example, this method can be
|
||||
* used to specify that we're expecting a funding flow for a particular
|
||||
* pending channel ID, for which we need to use specific parameters.
|
||||
* Alternatively, this can be used to interactively drive PSBT signing for
|
||||
* funding for partially complete funding transactions.
|
||||
*
|
||||
* @generated from protobuf rpc: FundingStateStep(lnrpc.FundingTransitionMsg) returns (lnrpc.FundingStateStepResp);
|
||||
*/
|
||||
fundingStateStep(input, options) {
|
||||
const method = this.methods[24], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* ChannelAcceptor dispatches a bi-directional streaming RPC in which
|
||||
* OpenChannel requests are sent to the client and the client responds with
|
||||
* a boolean that tells LND whether or not to accept the channel. This allows
|
||||
* node operators to specify their own criteria for accepting inbound channels
|
||||
* through a single persistent connection.
|
||||
*
|
||||
* @generated from protobuf rpc: ChannelAcceptor(stream lnrpc.ChannelAcceptResponse) returns (stream lnrpc.ChannelAcceptRequest);
|
||||
*/
|
||||
channelAcceptor(options) {
|
||||
const method = this.methods[25], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("duplex", this._transport, method, opt);
|
||||
}
|
||||
/**
|
||||
* lncli: `closechannel`
|
||||
* CloseChannel attempts to close an active channel identified by its channel
|
||||
* outpoint (ChannelPoint). The actions of this method can additionally be
|
||||
* augmented to attempt a force close after a timeout period in the case of an
|
||||
* inactive peer. If a non-force close (cooperative closure) is requested,
|
||||
* then the user can specify either a target number of blocks until the
|
||||
* closure transaction is confirmed, or a manual fee rate. If neither are
|
||||
* specified, then a default lax, block confirmation target is used.
|
||||
*
|
||||
* @generated from protobuf rpc: CloseChannel(lnrpc.CloseChannelRequest) returns (stream lnrpc.CloseStatusUpdate);
|
||||
*/
|
||||
closeChannel(input, options) {
|
||||
const method = this.methods[26], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `abandonchannel`
|
||||
* AbandonChannel removes all channel state from the database except for a
|
||||
* close summary. This method can be used to get rid of permanently unusable
|
||||
* channels due to bugs fixed in newer versions of lnd. This method can also be
|
||||
* used to remove externally funded channels where the funding transaction was
|
||||
* never broadcast. Only available for non-externally funded channels in dev
|
||||
* build.
|
||||
*
|
||||
* @generated from protobuf rpc: AbandonChannel(lnrpc.AbandonChannelRequest) returns (lnrpc.AbandonChannelResponse);
|
||||
*/
|
||||
abandonChannel(input, options) {
|
||||
const method = this.methods[27], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `sendpayment`
|
||||
* Deprecated, use routerrpc.SendPaymentV2. SendPayment dispatches a
|
||||
* bi-directional streaming RPC for sending payments through the Lightning
|
||||
* Network. A single RPC invocation creates a persistent bi-directional
|
||||
* stream allowing clients to rapidly send payments through the Lightning
|
||||
* Network with a single persistent connection.
|
||||
*
|
||||
* @deprecated
|
||||
* @generated from protobuf rpc: SendPayment(stream lnrpc.SendRequest) returns (stream lnrpc.SendResponse);
|
||||
*/
|
||||
sendPayment(options) {
|
||||
const method = this.methods[28], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("duplex", this._transport, method, opt);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* SendPaymentSync is the synchronous non-streaming version of SendPayment.
|
||||
* This RPC is intended to be consumed by clients of the REST proxy.
|
||||
* Additionally, this RPC expects the destination's public key and the payment
|
||||
* hash (if any) to be encoded as hex strings.
|
||||
*
|
||||
* @generated from protobuf rpc: SendPaymentSync(lnrpc.SendRequest) returns (lnrpc.SendResponse);
|
||||
*/
|
||||
sendPaymentSync(input, options) {
|
||||
const method = this.methods[29], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `sendtoroute`
|
||||
* Deprecated, use routerrpc.SendToRouteV2. SendToRoute is a bi-directional
|
||||
* streaming RPC for sending payment through the Lightning Network. This
|
||||
* method differs from SendPayment in that it allows users to specify a full
|
||||
* route manually. This can be used for things like rebalancing, and atomic
|
||||
* swaps.
|
||||
*
|
||||
* @deprecated
|
||||
* @generated from protobuf rpc: SendToRoute(stream lnrpc.SendToRouteRequest) returns (stream lnrpc.SendResponse);
|
||||
*/
|
||||
sendToRoute(options) {
|
||||
const method = this.methods[30], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("duplex", this._transport, method, opt);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* SendToRouteSync is a synchronous version of SendToRoute. It Will block
|
||||
* until the payment either fails or succeeds.
|
||||
*
|
||||
* @generated from protobuf rpc: SendToRouteSync(lnrpc.SendToRouteRequest) returns (lnrpc.SendResponse);
|
||||
*/
|
||||
sendToRouteSync(input, options) {
|
||||
const method = this.methods[31], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `addinvoice`
|
||||
* AddInvoice attempts to add a new invoice to the invoice database. Any
|
||||
* duplicated invoices are rejected, therefore all invoices *must* have a
|
||||
* unique payment preimage.
|
||||
*
|
||||
* @generated from protobuf rpc: AddInvoice(lnrpc.Invoice) returns (lnrpc.AddInvoiceResponse);
|
||||
*/
|
||||
addInvoice(input, options) {
|
||||
const method = this.methods[32], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `listinvoices`
|
||||
* ListInvoices returns a list of all the invoices currently stored within the
|
||||
* database. Any active debug invoices are ignored. It has full support for
|
||||
* paginated responses, allowing users to query for specific invoices through
|
||||
* their add_index. This can be done by using either the first_index_offset or
|
||||
* last_index_offset fields included in the response as the index_offset of the
|
||||
* next request. By default, the first 100 invoices created will be returned.
|
||||
* Backwards pagination is also supported through the Reversed flag.
|
||||
*
|
||||
* @generated from protobuf rpc: ListInvoices(lnrpc.ListInvoiceRequest) returns (lnrpc.ListInvoiceResponse);
|
||||
*/
|
||||
listInvoices(input, options) {
|
||||
const method = this.methods[33], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `lookupinvoice`
|
||||
* LookupInvoice attempts to look up an invoice according to its payment hash.
|
||||
* The passed payment hash *must* be exactly 32 bytes, if not, an error is
|
||||
* returned.
|
||||
*
|
||||
* @generated from protobuf rpc: LookupInvoice(lnrpc.PaymentHash) returns (lnrpc.Invoice);
|
||||
*/
|
||||
lookupInvoice(input, options) {
|
||||
const method = this.methods[34], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* SubscribeInvoices returns a uni-directional stream (server -> client) for
|
||||
* notifying the client of newly added/settled invoices. The caller can
|
||||
* optionally specify the add_index and/or the settle_index. If the add_index
|
||||
* is specified, then we'll first start by sending add invoice events for all
|
||||
* invoices with an add_index greater than the specified value. If the
|
||||
* settle_index is specified, the next, we'll send out all settle events for
|
||||
* invoices with a settle_index greater than the specified value. One or both
|
||||
* of these fields can be set. If no fields are set, then we'll only send out
|
||||
* the latest add/settle events.
|
||||
*
|
||||
* @generated from protobuf rpc: SubscribeInvoices(lnrpc.InvoiceSubscription) returns (stream lnrpc.Invoice);
|
||||
*/
|
||||
subscribeInvoices(input, options) {
|
||||
const method = this.methods[35], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `decodepayreq`
|
||||
* DecodePayReq takes an encoded payment request string and attempts to decode
|
||||
* it, returning a full description of the conditions encoded within the
|
||||
* payment request.
|
||||
*
|
||||
* @generated from protobuf rpc: DecodePayReq(lnrpc.PayReqString) returns (lnrpc.PayReq);
|
||||
*/
|
||||
decodePayReq(input, options) {
|
||||
const method = this.methods[36], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `listpayments`
|
||||
* ListPayments returns a list of all outgoing payments.
|
||||
*
|
||||
* @generated from protobuf rpc: ListPayments(lnrpc.ListPaymentsRequest) returns (lnrpc.ListPaymentsResponse);
|
||||
*/
|
||||
listPayments(input, options) {
|
||||
const method = this.methods[37], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* DeletePayment deletes an outgoing payment from DB. Note that it will not
|
||||
* attempt to delete an In-Flight payment, since that would be unsafe.
|
||||
*
|
||||
* @generated from protobuf rpc: DeletePayment(lnrpc.DeletePaymentRequest) returns (lnrpc.DeletePaymentResponse);
|
||||
*/
|
||||
deletePayment(input, options) {
|
||||
const method = this.methods[38], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* DeleteAllPayments deletes all outgoing payments from DB. Note that it will
|
||||
* not attempt to delete In-Flight payments, since that would be unsafe.
|
||||
*
|
||||
* @generated from protobuf rpc: DeleteAllPayments(lnrpc.DeleteAllPaymentsRequest) returns (lnrpc.DeleteAllPaymentsResponse);
|
||||
*/
|
||||
deleteAllPayments(input, options) {
|
||||
const method = this.methods[39], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `describegraph`
|
||||
* DescribeGraph returns a description of the latest graph state from the
|
||||
* point of view of the node. The graph information is partitioned into two
|
||||
* components: all the nodes/vertexes, and all the edges that connect the
|
||||
* vertexes themselves. As this is a directed graph, the edges also contain
|
||||
* the node directional specific routing policy which includes: the time lock
|
||||
* delta, fee information, etc.
|
||||
*
|
||||
* @generated from protobuf rpc: DescribeGraph(lnrpc.ChannelGraphRequest) returns (lnrpc.ChannelGraph);
|
||||
*/
|
||||
describeGraph(input, options) {
|
||||
const method = this.methods[40], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `getnodemetrics`
|
||||
* GetNodeMetrics returns node metrics calculated from the graph. Currently
|
||||
* the only supported metric is betweenness centrality of individual nodes.
|
||||
*
|
||||
* @generated from protobuf rpc: GetNodeMetrics(lnrpc.NodeMetricsRequest) returns (lnrpc.NodeMetricsResponse);
|
||||
*/
|
||||
getNodeMetrics(input, options) {
|
||||
const method = this.methods[41], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `getchaninfo`
|
||||
* GetChanInfo returns the latest authenticated network announcement for the
|
||||
* given channel identified by its channel ID: an 8-byte integer which
|
||||
* uniquely identifies the location of transaction's funding output within the
|
||||
* blockchain.
|
||||
*
|
||||
* @generated from protobuf rpc: GetChanInfo(lnrpc.ChanInfoRequest) returns (lnrpc.ChannelEdge);
|
||||
*/
|
||||
getChanInfo(input, options) {
|
||||
const method = this.methods[42], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `getnodeinfo`
|
||||
* GetNodeInfo returns the latest advertised, aggregated, and authenticated
|
||||
* channel information for the specified node identified by its public key.
|
||||
*
|
||||
* @generated from protobuf rpc: GetNodeInfo(lnrpc.NodeInfoRequest) returns (lnrpc.NodeInfo);
|
||||
*/
|
||||
getNodeInfo(input, options) {
|
||||
const method = this.methods[43], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `queryroutes`
|
||||
* QueryRoutes attempts to query the daemon's Channel Router for a possible
|
||||
* route to a target destination capable of carrying a specific amount of
|
||||
* satoshis. The returned route contains the full details required to craft and
|
||||
* send an HTLC, also including the necessary information that should be
|
||||
* present within the Sphinx packet encapsulated within the HTLC.
|
||||
*
|
||||
* When using REST, the `dest_custom_records` map type can be set by appending
|
||||
* `&dest_custom_records[<record_number>]=<record_data_base64_url_encoded>`
|
||||
* to the URL. Unfortunately this map type doesn't appear in the REST API
|
||||
* documentation because of a bug in the grpc-gateway library.
|
||||
*
|
||||
* @generated from protobuf rpc: QueryRoutes(lnrpc.QueryRoutesRequest) returns (lnrpc.QueryRoutesResponse);
|
||||
*/
|
||||
queryRoutes(input, options) {
|
||||
const method = this.methods[44], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `getnetworkinfo`
|
||||
* GetNetworkInfo returns some basic stats about the known channel graph from
|
||||
* the point of view of the node.
|
||||
*
|
||||
* @generated from protobuf rpc: GetNetworkInfo(lnrpc.NetworkInfoRequest) returns (lnrpc.NetworkInfo);
|
||||
*/
|
||||
getNetworkInfo(input, options) {
|
||||
const method = this.methods[45], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `stop`
|
||||
* StopDaemon will send a shutdown request to the interrupt handler, triggering
|
||||
* a graceful shutdown of the daemon.
|
||||
*
|
||||
* @generated from protobuf rpc: StopDaemon(lnrpc.StopRequest) returns (lnrpc.StopResponse);
|
||||
*/
|
||||
stopDaemon(input, options) {
|
||||
const method = this.methods[46], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* SubscribeChannelGraph launches a streaming RPC that allows the caller to
|
||||
* receive notifications upon any changes to the channel graph topology from
|
||||
* the point of view of the responding node. Events notified include: new
|
||||
* nodes coming online, nodes updating their authenticated attributes, new
|
||||
* channels being advertised, updates in the routing policy for a directional
|
||||
* channel edge, and when channels are closed on-chain.
|
||||
*
|
||||
* @generated from protobuf rpc: SubscribeChannelGraph(lnrpc.GraphTopologySubscription) returns (stream lnrpc.GraphTopologyUpdate);
|
||||
*/
|
||||
subscribeChannelGraph(input, options) {
|
||||
const method = this.methods[47], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `debuglevel`
|
||||
* DebugLevel allows a caller to programmatically set the logging verbosity of
|
||||
* lnd. The logging can be targeted according to a coarse daemon-wide logging
|
||||
* level, or in a granular fashion to specify the logging for a target
|
||||
* sub-system.
|
||||
*
|
||||
* @generated from protobuf rpc: DebugLevel(lnrpc.DebugLevelRequest) returns (lnrpc.DebugLevelResponse);
|
||||
*/
|
||||
debugLevel(input, options) {
|
||||
const method = this.methods[48], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `feereport`
|
||||
* FeeReport allows the caller to obtain a report detailing the current fee
|
||||
* schedule enforced by the node globally for each channel.
|
||||
*
|
||||
* @generated from protobuf rpc: FeeReport(lnrpc.FeeReportRequest) returns (lnrpc.FeeReportResponse);
|
||||
*/
|
||||
feeReport(input, options) {
|
||||
const method = this.methods[49], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `updatechanpolicy`
|
||||
* UpdateChannelPolicy allows the caller to update the fee schedule and
|
||||
* channel policies for all channels globally, or a particular channel.
|
||||
*
|
||||
* @generated from protobuf rpc: UpdateChannelPolicy(lnrpc.PolicyUpdateRequest) returns (lnrpc.PolicyUpdateResponse);
|
||||
*/
|
||||
updateChannelPolicy(input, options) {
|
||||
const method = this.methods[50], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `fwdinghistory`
|
||||
* ForwardingHistory allows the caller to query the htlcswitch for a record of
|
||||
* all HTLCs forwarded within the target time range, and integer offset
|
||||
* within that time range, for a maximum number of events. If no maximum number
|
||||
* of events is specified, up to 100 events will be returned. If no time-range
|
||||
* is specified, then events will be returned in the order that they occured.
|
||||
*
|
||||
* A list of forwarding events are returned. The size of each forwarding event
|
||||
* is 40 bytes, and the max message size able to be returned in gRPC is 4 MiB.
|
||||
* As a result each message can only contain 50k entries. Each response has
|
||||
* the index offset of the last entry. The index offset can be provided to the
|
||||
* request to allow the caller to skip a series of records.
|
||||
*
|
||||
* @generated from protobuf rpc: ForwardingHistory(lnrpc.ForwardingHistoryRequest) returns (lnrpc.ForwardingHistoryResponse);
|
||||
*/
|
||||
forwardingHistory(input, options) {
|
||||
const method = this.methods[51], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `exportchanbackup`
|
||||
* ExportChannelBackup attempts to return an encrypted static channel backup
|
||||
* for the target channel identified by it channel point. The backup is
|
||||
* encrypted with a key generated from the aezeed seed of the user. The
|
||||
* returned backup can either be restored using the RestoreChannelBackup
|
||||
* method once lnd is running, or via the InitWallet and UnlockWallet methods
|
||||
* from the WalletUnlocker service.
|
||||
*
|
||||
* @generated from protobuf rpc: ExportChannelBackup(lnrpc.ExportChannelBackupRequest) returns (lnrpc.ChannelBackup);
|
||||
*/
|
||||
exportChannelBackup(input, options) {
|
||||
const method = this.methods[52], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* ExportAllChannelBackups returns static channel backups for all existing
|
||||
* channels known to lnd. A set of regular singular static channel backups for
|
||||
* each channel are returned. Additionally, a multi-channel backup is returned
|
||||
* as well, which contains a single encrypted blob containing the backups of
|
||||
* each channel.
|
||||
*
|
||||
* @generated from protobuf rpc: ExportAllChannelBackups(lnrpc.ChanBackupExportRequest) returns (lnrpc.ChanBackupSnapshot);
|
||||
*/
|
||||
exportAllChannelBackups(input, options) {
|
||||
const method = this.methods[53], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* VerifyChanBackup allows a caller to verify the integrity of a channel backup
|
||||
* snapshot. This method will accept either a packed Single or a packed Multi.
|
||||
* Specifying both will result in an error.
|
||||
*
|
||||
* @generated from protobuf rpc: VerifyChanBackup(lnrpc.ChanBackupSnapshot) returns (lnrpc.VerifyChanBackupResponse);
|
||||
*/
|
||||
verifyChanBackup(input, options) {
|
||||
const method = this.methods[54], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `restorechanbackup`
|
||||
* RestoreChannelBackups accepts a set of singular channel backups, or a
|
||||
* single encrypted multi-chan backup and attempts to recover any funds
|
||||
* remaining within the channel. If we are able to unpack the backup, then the
|
||||
* new channel will be shown under listchannels, as well as pending channels.
|
||||
*
|
||||
* @generated from protobuf rpc: RestoreChannelBackups(lnrpc.RestoreChanBackupRequest) returns (lnrpc.RestoreBackupResponse);
|
||||
*/
|
||||
restoreChannelBackups(input, options) {
|
||||
const method = this.methods[55], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* SubscribeChannelBackups allows a client to sub-subscribe to the most up to
|
||||
* date information concerning the state of all channel backups. Each time a
|
||||
* new channel is added, we return the new set of channels, along with a
|
||||
* multi-chan backup containing the backup info for all channels. Each time a
|
||||
* channel is closed, we send a new update, which contains new new chan back
|
||||
* ups, but the updated set of encrypted multi-chan backups with the closed
|
||||
* channel(s) removed.
|
||||
*
|
||||
* @generated from protobuf rpc: SubscribeChannelBackups(lnrpc.ChannelBackupSubscription) returns (stream lnrpc.ChanBackupSnapshot);
|
||||
*/
|
||||
subscribeChannelBackups(input, options) {
|
||||
const method = this.methods[56], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `bakemacaroon`
|
||||
* BakeMacaroon allows the creation of a new macaroon with custom read and
|
||||
* write permissions. No first-party caveats are added since this can be done
|
||||
* offline.
|
||||
*
|
||||
* @generated from protobuf rpc: BakeMacaroon(lnrpc.BakeMacaroonRequest) returns (lnrpc.BakeMacaroonResponse);
|
||||
*/
|
||||
bakeMacaroon(input, options) {
|
||||
const method = this.methods[57], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `listmacaroonids`
|
||||
* ListMacaroonIDs returns all root key IDs that are in use.
|
||||
*
|
||||
* @generated from protobuf rpc: ListMacaroonIDs(lnrpc.ListMacaroonIDsRequest) returns (lnrpc.ListMacaroonIDsResponse);
|
||||
*/
|
||||
listMacaroonIDs(input, options) {
|
||||
const method = this.methods[58], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `deletemacaroonid`
|
||||
* DeleteMacaroonID deletes the specified macaroon ID and invalidates all
|
||||
* macaroons derived from that ID.
|
||||
*
|
||||
* @generated from protobuf rpc: DeleteMacaroonID(lnrpc.DeleteMacaroonIDRequest) returns (lnrpc.DeleteMacaroonIDResponse);
|
||||
*/
|
||||
deleteMacaroonID(input, options) {
|
||||
const method = this.methods[59], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `listpermissions`
|
||||
* ListPermissions lists all RPC method URIs and their required macaroon
|
||||
* permissions to access them.
|
||||
*
|
||||
* @generated from protobuf rpc: ListPermissions(lnrpc.ListPermissionsRequest) returns (lnrpc.ListPermissionsResponse);
|
||||
*/
|
||||
listPermissions(input, options) {
|
||||
const method = this.methods[60], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* CheckMacaroonPermissions checks whether a request follows the constraints
|
||||
* imposed on the macaroon and that the macaroon is authorized to follow the
|
||||
* provided permissions.
|
||||
*
|
||||
* @generated from protobuf rpc: CheckMacaroonPermissions(lnrpc.CheckMacPermRequest) returns (lnrpc.CheckMacPermResponse);
|
||||
*/
|
||||
checkMacaroonPermissions(input, options) {
|
||||
const method = this.methods[61], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* RegisterRPCMiddleware adds a new gRPC middleware to the interceptor chain. A
|
||||
* gRPC middleware is software component external to lnd that aims to add
|
||||
* additional business logic to lnd by observing/intercepting/validating
|
||||
* incoming gRPC client requests and (if needed) replacing/overwriting outgoing
|
||||
* messages before they're sent to the client. When registering the middleware
|
||||
* must identify itself and indicate what custom macaroon caveats it wants to
|
||||
* be responsible for. Only requests that contain a macaroon with that specific
|
||||
* custom caveat are then sent to the middleware for inspection. The other
|
||||
* option is to register for the read-only mode in which all requests/responses
|
||||
* are forwarded for interception to the middleware but the middleware is not
|
||||
* allowed to modify any responses. As a security measure, _no_ middleware can
|
||||
* modify responses for requests made with _unencumbered_ macaroons!
|
||||
*
|
||||
* @generated from protobuf rpc: RegisterRPCMiddleware(stream lnrpc.RPCMiddlewareResponse) returns (stream lnrpc.RPCMiddlewareRequest);
|
||||
*/
|
||||
registerRPCMiddleware(options) {
|
||||
const method = this.methods[62], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("duplex", this._transport, method, opt);
|
||||
}
|
||||
/**
|
||||
* lncli: `sendcustom`
|
||||
* SendCustomMessage sends a custom peer message.
|
||||
*
|
||||
* @generated from protobuf rpc: SendCustomMessage(lnrpc.SendCustomMessageRequest) returns (lnrpc.SendCustomMessageResponse);
|
||||
*/
|
||||
sendCustomMessage(input, options) {
|
||||
const method = this.methods[63], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `subscribecustom`
|
||||
* SubscribeCustomMessages subscribes to a stream of incoming custom peer
|
||||
* messages.
|
||||
*
|
||||
* @generated from protobuf rpc: SubscribeCustomMessages(lnrpc.SubscribeCustomMessagesRequest) returns (stream lnrpc.CustomMessage);
|
||||
*/
|
||||
subscribeCustomMessages(input, options) {
|
||||
const method = this.methods[64], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `listaliases`
|
||||
* ListAliases returns the set of all aliases that have ever existed with
|
||||
* their confirmed SCID (if it exists) and/or the base SCID (in the case of
|
||||
* zero conf).
|
||||
*
|
||||
* @generated from protobuf rpc: ListAliases(lnrpc.ListAliasesRequest) returns (lnrpc.ListAliasesResponse);
|
||||
*/
|
||||
listAliases(input, options) {
|
||||
const method = this.methods[65], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf rpc: LookupHtlc(lnrpc.LookupHtlcRequest) returns (lnrpc.LookupHtlcResponse);
|
||||
*/
|
||||
lookupHtlc(input, options) {
|
||||
const method = this.methods[66], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// @generated by protobuf-ts 2.5.0
|
||||
// @generated by protobuf-ts 2.8.1 with parameter long_type_number
|
||||
// @generated from protobuf file "lightning.proto" (package "lnrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
||||
|
|
|
|||
9340
proto/lnd/lightning.d.ts
vendored
Normal file
9340
proto/lnd/lightning.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
14457
proto/lnd/lightning.js
Normal file
14457
proto/lnd/lightning.js
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
390
proto/lnd/router.client.d.ts
vendored
Normal file
390
proto/lnd/router.client.d.ts
vendored
Normal file
|
|
@ -0,0 +1,390 @@
|
|||
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
|
||||
// @generated from protobuf file "router.proto" (package "routerrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
||||
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
|
||||
import type { UpdateChanStatusResponse } from "./router";
|
||||
import type { UpdateChanStatusRequest } from "./router";
|
||||
import type { ForwardHtlcInterceptRequest } from "./router";
|
||||
import type { ForwardHtlcInterceptResponse } from "./router";
|
||||
import type { DuplexStreamingCall } from "@protobuf-ts/runtime-rpc";
|
||||
import type { PaymentStatus } from "./router";
|
||||
import type { HtlcEvent } from "./router";
|
||||
import type { SubscribeHtlcEventsRequest } from "./router";
|
||||
import type { BuildRouteResponse } from "./router";
|
||||
import type { BuildRouteRequest } from "./router";
|
||||
import type { QueryProbabilityResponse } from "./router";
|
||||
import type { QueryProbabilityRequest } from "./router";
|
||||
import type { SetMissionControlConfigResponse } from "./router";
|
||||
import type { SetMissionControlConfigRequest } from "./router";
|
||||
import type { GetMissionControlConfigResponse } from "./router";
|
||||
import type { GetMissionControlConfigRequest } from "./router";
|
||||
import type { XImportMissionControlResponse } from "./router";
|
||||
import type { XImportMissionControlRequest } from "./router";
|
||||
import type { QueryMissionControlResponse } from "./router";
|
||||
import type { QueryMissionControlRequest } from "./router";
|
||||
import type { ResetMissionControlResponse } from "./router";
|
||||
import type { ResetMissionControlRequest } from "./router";
|
||||
import type { HTLCAttempt } from "./lightning";
|
||||
import type { SendToRouteResponse } from "./router";
|
||||
import type { SendToRouteRequest } from "./router";
|
||||
import type { RouteFeeResponse } from "./router";
|
||||
import type { RouteFeeRequest } from "./router";
|
||||
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
|
||||
import type { TrackPaymentsRequest } from "./router";
|
||||
import type { TrackPaymentRequest } from "./router";
|
||||
import type { Payment } from "./lightning";
|
||||
import type { SendPaymentRequest } from "./router";
|
||||
import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
|
||||
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
|
||||
/**
|
||||
* Router is a service that offers advanced interaction with the router
|
||||
* subsystem of the daemon.
|
||||
*
|
||||
* @generated from protobuf service routerrpc.Router
|
||||
*/
|
||||
export interface IRouterClient {
|
||||
/**
|
||||
*
|
||||
* SendPaymentV2 attempts to route a payment described by the passed
|
||||
* PaymentRequest to the final destination. The call returns a stream of
|
||||
* payment updates.
|
||||
*
|
||||
* @generated from protobuf rpc: SendPaymentV2(routerrpc.SendPaymentRequest) returns (stream lnrpc.Payment);
|
||||
*/
|
||||
sendPaymentV2(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, Payment>;
|
||||
/**
|
||||
*
|
||||
* TrackPaymentV2 returns an update stream for the payment identified by the
|
||||
* payment hash.
|
||||
*
|
||||
* @generated from protobuf rpc: TrackPaymentV2(routerrpc.TrackPaymentRequest) returns (stream lnrpc.Payment);
|
||||
*/
|
||||
trackPaymentV2(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, Payment>;
|
||||
/**
|
||||
*
|
||||
* TrackPayments returns an update stream for every payment that is not in a
|
||||
* terminal state. Note that if payments are in-flight while starting a new
|
||||
* subscription, the start of the payment stream could produce out-of-order
|
||||
* and/or duplicate events. In order to get updates for every in-flight
|
||||
* payment attempt make sure to subscribe to this method before initiating any
|
||||
* payments.
|
||||
*
|
||||
* @generated from protobuf rpc: TrackPayments(routerrpc.TrackPaymentsRequest) returns (stream lnrpc.Payment);
|
||||
*/
|
||||
trackPayments(input: TrackPaymentsRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentsRequest, Payment>;
|
||||
/**
|
||||
*
|
||||
* EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
|
||||
* may cost to send an HTLC to the target end destination.
|
||||
*
|
||||
* @generated from protobuf rpc: EstimateRouteFee(routerrpc.RouteFeeRequest) returns (routerrpc.RouteFeeResponse);
|
||||
*/
|
||||
estimateRouteFee(input: RouteFeeRequest, options?: RpcOptions): UnaryCall<RouteFeeRequest, RouteFeeResponse>;
|
||||
/**
|
||||
*
|
||||
* Deprecated, use SendToRouteV2. SendToRoute attempts to make a payment via
|
||||
* the specified route. This method differs from SendPayment in that it
|
||||
* allows users to specify a full route manually. This can be used for
|
||||
* things like rebalancing, and atomic swaps. It differs from the newer
|
||||
* SendToRouteV2 in that it doesn't return the full HTLC information.
|
||||
*
|
||||
* @deprecated
|
||||
* @generated from protobuf rpc: SendToRoute(routerrpc.SendToRouteRequest) returns (routerrpc.SendToRouteResponse);
|
||||
*/
|
||||
sendToRoute(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, SendToRouteResponse>;
|
||||
/**
|
||||
*
|
||||
* SendToRouteV2 attempts to make a payment via the specified route. This
|
||||
* method differs from SendPayment in that it allows users to specify a full
|
||||
* route manually. This can be used for things like rebalancing, and atomic
|
||||
* swaps.
|
||||
*
|
||||
* @generated from protobuf rpc: SendToRouteV2(routerrpc.SendToRouteRequest) returns (lnrpc.HTLCAttempt);
|
||||
*/
|
||||
sendToRouteV2(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, HTLCAttempt>;
|
||||
/**
|
||||
*
|
||||
* ResetMissionControl clears all mission control state and starts with a clean
|
||||
* slate.
|
||||
*
|
||||
* @generated from protobuf rpc: ResetMissionControl(routerrpc.ResetMissionControlRequest) returns (routerrpc.ResetMissionControlResponse);
|
||||
*/
|
||||
resetMissionControl(input: ResetMissionControlRequest, options?: RpcOptions): UnaryCall<ResetMissionControlRequest, ResetMissionControlResponse>;
|
||||
/**
|
||||
*
|
||||
* QueryMissionControl exposes the internal mission control state to callers.
|
||||
* It is a development feature.
|
||||
*
|
||||
* @generated from protobuf rpc: QueryMissionControl(routerrpc.QueryMissionControlRequest) returns (routerrpc.QueryMissionControlResponse);
|
||||
*/
|
||||
queryMissionControl(input: QueryMissionControlRequest, options?: RpcOptions): UnaryCall<QueryMissionControlRequest, QueryMissionControlResponse>;
|
||||
/**
|
||||
*
|
||||
* XImportMissionControl is an experimental API that imports the state provided
|
||||
* to the internal mission control's state, using all results which are more
|
||||
* recent than our existing values. These values will only be imported
|
||||
* in-memory, and will not be persisted across restarts.
|
||||
*
|
||||
* @generated from protobuf rpc: XImportMissionControl(routerrpc.XImportMissionControlRequest) returns (routerrpc.XImportMissionControlResponse);
|
||||
*/
|
||||
xImportMissionControl(input: XImportMissionControlRequest, options?: RpcOptions): UnaryCall<XImportMissionControlRequest, XImportMissionControlResponse>;
|
||||
/**
|
||||
*
|
||||
* GetMissionControlConfig returns mission control's current config.
|
||||
*
|
||||
* @generated from protobuf rpc: GetMissionControlConfig(routerrpc.GetMissionControlConfigRequest) returns (routerrpc.GetMissionControlConfigResponse);
|
||||
*/
|
||||
getMissionControlConfig(input: GetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<GetMissionControlConfigRequest, GetMissionControlConfigResponse>;
|
||||
/**
|
||||
*
|
||||
* SetMissionControlConfig will set mission control's config, if the config
|
||||
* provided is valid.
|
||||
*
|
||||
* @generated from protobuf rpc: SetMissionControlConfig(routerrpc.SetMissionControlConfigRequest) returns (routerrpc.SetMissionControlConfigResponse);
|
||||
*/
|
||||
setMissionControlConfig(input: SetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<SetMissionControlConfigRequest, SetMissionControlConfigResponse>;
|
||||
/**
|
||||
*
|
||||
* QueryProbability returns the current success probability estimate for a
|
||||
* given node pair and amount.
|
||||
*
|
||||
* @generated from protobuf rpc: QueryProbability(routerrpc.QueryProbabilityRequest) returns (routerrpc.QueryProbabilityResponse);
|
||||
*/
|
||||
queryProbability(input: QueryProbabilityRequest, options?: RpcOptions): UnaryCall<QueryProbabilityRequest, QueryProbabilityResponse>;
|
||||
/**
|
||||
*
|
||||
* BuildRoute builds a fully specified route based on a list of hop public
|
||||
* keys. It retrieves the relevant channel policies from the graph in order to
|
||||
* calculate the correct fees and time locks.
|
||||
*
|
||||
* @generated from protobuf rpc: BuildRoute(routerrpc.BuildRouteRequest) returns (routerrpc.BuildRouteResponse);
|
||||
*/
|
||||
buildRoute(input: BuildRouteRequest, options?: RpcOptions): UnaryCall<BuildRouteRequest, BuildRouteResponse>;
|
||||
/**
|
||||
*
|
||||
* SubscribeHtlcEvents creates a uni-directional stream from the server to
|
||||
* the client which delivers a stream of htlc events.
|
||||
*
|
||||
* @generated from protobuf rpc: SubscribeHtlcEvents(routerrpc.SubscribeHtlcEventsRequest) returns (stream routerrpc.HtlcEvent);
|
||||
*/
|
||||
subscribeHtlcEvents(input: SubscribeHtlcEventsRequest, options?: RpcOptions): ServerStreamingCall<SubscribeHtlcEventsRequest, HtlcEvent>;
|
||||
/**
|
||||
*
|
||||
* Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
|
||||
* described by the passed PaymentRequest to the final destination. The call
|
||||
* returns a stream of payment status updates.
|
||||
*
|
||||
* @deprecated
|
||||
* @generated from protobuf rpc: SendPayment(routerrpc.SendPaymentRequest) returns (stream routerrpc.PaymentStatus);
|
||||
*/
|
||||
sendPayment(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, PaymentStatus>;
|
||||
/**
|
||||
*
|
||||
* Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
|
||||
* the payment identified by the payment hash.
|
||||
*
|
||||
* @deprecated
|
||||
* @generated from protobuf rpc: TrackPayment(routerrpc.TrackPaymentRequest) returns (stream routerrpc.PaymentStatus);
|
||||
*/
|
||||
trackPayment(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, PaymentStatus>;
|
||||
/**
|
||||
* *
|
||||
* HtlcInterceptor dispatches a bi-directional streaming RPC in which
|
||||
* Forwarded HTLC requests are sent to the client and the client responds with
|
||||
* a boolean that tells LND if this htlc should be intercepted.
|
||||
* In case of interception, the htlc can be either settled, cancelled or
|
||||
* resumed later by using the ResolveHoldForward endpoint.
|
||||
*
|
||||
* @generated from protobuf rpc: HtlcInterceptor(stream routerrpc.ForwardHtlcInterceptResponse) returns (stream routerrpc.ForwardHtlcInterceptRequest);
|
||||
*/
|
||||
htlcInterceptor(options?: RpcOptions): DuplexStreamingCall<ForwardHtlcInterceptResponse, ForwardHtlcInterceptRequest>;
|
||||
/**
|
||||
*
|
||||
* UpdateChanStatus attempts to manually set the state of a channel
|
||||
* (enabled, disabled, or auto). A manual "disable" request will cause the
|
||||
* channel to stay disabled until a subsequent manual request of either
|
||||
* "enable" or "auto".
|
||||
*
|
||||
* @generated from protobuf rpc: UpdateChanStatus(routerrpc.UpdateChanStatusRequest) returns (routerrpc.UpdateChanStatusResponse);
|
||||
*/
|
||||
updateChanStatus(input: UpdateChanStatusRequest, options?: RpcOptions): UnaryCall<UpdateChanStatusRequest, UpdateChanStatusResponse>;
|
||||
}
|
||||
/**
|
||||
* Router is a service that offers advanced interaction with the router
|
||||
* subsystem of the daemon.
|
||||
*
|
||||
* @generated from protobuf service routerrpc.Router
|
||||
*/
|
||||
export declare class RouterClient implements IRouterClient, ServiceInfo {
|
||||
private readonly _transport;
|
||||
typeName: any;
|
||||
methods: any;
|
||||
options: any;
|
||||
constructor(_transport: RpcTransport);
|
||||
/**
|
||||
*
|
||||
* SendPaymentV2 attempts to route a payment described by the passed
|
||||
* PaymentRequest to the final destination. The call returns a stream of
|
||||
* payment updates.
|
||||
*
|
||||
* @generated from protobuf rpc: SendPaymentV2(routerrpc.SendPaymentRequest) returns (stream lnrpc.Payment);
|
||||
*/
|
||||
sendPaymentV2(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, Payment>;
|
||||
/**
|
||||
*
|
||||
* TrackPaymentV2 returns an update stream for the payment identified by the
|
||||
* payment hash.
|
||||
*
|
||||
* @generated from protobuf rpc: TrackPaymentV2(routerrpc.TrackPaymentRequest) returns (stream lnrpc.Payment);
|
||||
*/
|
||||
trackPaymentV2(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, Payment>;
|
||||
/**
|
||||
*
|
||||
* TrackPayments returns an update stream for every payment that is not in a
|
||||
* terminal state. Note that if payments are in-flight while starting a new
|
||||
* subscription, the start of the payment stream could produce out-of-order
|
||||
* and/or duplicate events. In order to get updates for every in-flight
|
||||
* payment attempt make sure to subscribe to this method before initiating any
|
||||
* payments.
|
||||
*
|
||||
* @generated from protobuf rpc: TrackPayments(routerrpc.TrackPaymentsRequest) returns (stream lnrpc.Payment);
|
||||
*/
|
||||
trackPayments(input: TrackPaymentsRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentsRequest, Payment>;
|
||||
/**
|
||||
*
|
||||
* EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
|
||||
* may cost to send an HTLC to the target end destination.
|
||||
*
|
||||
* @generated from protobuf rpc: EstimateRouteFee(routerrpc.RouteFeeRequest) returns (routerrpc.RouteFeeResponse);
|
||||
*/
|
||||
estimateRouteFee(input: RouteFeeRequest, options?: RpcOptions): UnaryCall<RouteFeeRequest, RouteFeeResponse>;
|
||||
/**
|
||||
*
|
||||
* Deprecated, use SendToRouteV2. SendToRoute attempts to make a payment via
|
||||
* the specified route. This method differs from SendPayment in that it
|
||||
* allows users to specify a full route manually. This can be used for
|
||||
* things like rebalancing, and atomic swaps. It differs from the newer
|
||||
* SendToRouteV2 in that it doesn't return the full HTLC information.
|
||||
*
|
||||
* @deprecated
|
||||
* @generated from protobuf rpc: SendToRoute(routerrpc.SendToRouteRequest) returns (routerrpc.SendToRouteResponse);
|
||||
*/
|
||||
sendToRoute(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, SendToRouteResponse>;
|
||||
/**
|
||||
*
|
||||
* SendToRouteV2 attempts to make a payment via the specified route. This
|
||||
* method differs from SendPayment in that it allows users to specify a full
|
||||
* route manually. This can be used for things like rebalancing, and atomic
|
||||
* swaps.
|
||||
*
|
||||
* @generated from protobuf rpc: SendToRouteV2(routerrpc.SendToRouteRequest) returns (lnrpc.HTLCAttempt);
|
||||
*/
|
||||
sendToRouteV2(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, HTLCAttempt>;
|
||||
/**
|
||||
*
|
||||
* ResetMissionControl clears all mission control state and starts with a clean
|
||||
* slate.
|
||||
*
|
||||
* @generated from protobuf rpc: ResetMissionControl(routerrpc.ResetMissionControlRequest) returns (routerrpc.ResetMissionControlResponse);
|
||||
*/
|
||||
resetMissionControl(input: ResetMissionControlRequest, options?: RpcOptions): UnaryCall<ResetMissionControlRequest, ResetMissionControlResponse>;
|
||||
/**
|
||||
*
|
||||
* QueryMissionControl exposes the internal mission control state to callers.
|
||||
* It is a development feature.
|
||||
*
|
||||
* @generated from protobuf rpc: QueryMissionControl(routerrpc.QueryMissionControlRequest) returns (routerrpc.QueryMissionControlResponse);
|
||||
*/
|
||||
queryMissionControl(input: QueryMissionControlRequest, options?: RpcOptions): UnaryCall<QueryMissionControlRequest, QueryMissionControlResponse>;
|
||||
/**
|
||||
*
|
||||
* XImportMissionControl is an experimental API that imports the state provided
|
||||
* to the internal mission control's state, using all results which are more
|
||||
* recent than our existing values. These values will only be imported
|
||||
* in-memory, and will not be persisted across restarts.
|
||||
*
|
||||
* @generated from protobuf rpc: XImportMissionControl(routerrpc.XImportMissionControlRequest) returns (routerrpc.XImportMissionControlResponse);
|
||||
*/
|
||||
xImportMissionControl(input: XImportMissionControlRequest, options?: RpcOptions): UnaryCall<XImportMissionControlRequest, XImportMissionControlResponse>;
|
||||
/**
|
||||
*
|
||||
* GetMissionControlConfig returns mission control's current config.
|
||||
*
|
||||
* @generated from protobuf rpc: GetMissionControlConfig(routerrpc.GetMissionControlConfigRequest) returns (routerrpc.GetMissionControlConfigResponse);
|
||||
*/
|
||||
getMissionControlConfig(input: GetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<GetMissionControlConfigRequest, GetMissionControlConfigResponse>;
|
||||
/**
|
||||
*
|
||||
* SetMissionControlConfig will set mission control's config, if the config
|
||||
* provided is valid.
|
||||
*
|
||||
* @generated from protobuf rpc: SetMissionControlConfig(routerrpc.SetMissionControlConfigRequest) returns (routerrpc.SetMissionControlConfigResponse);
|
||||
*/
|
||||
setMissionControlConfig(input: SetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<SetMissionControlConfigRequest, SetMissionControlConfigResponse>;
|
||||
/**
|
||||
*
|
||||
* QueryProbability returns the current success probability estimate for a
|
||||
* given node pair and amount.
|
||||
*
|
||||
* @generated from protobuf rpc: QueryProbability(routerrpc.QueryProbabilityRequest) returns (routerrpc.QueryProbabilityResponse);
|
||||
*/
|
||||
queryProbability(input: QueryProbabilityRequest, options?: RpcOptions): UnaryCall<QueryProbabilityRequest, QueryProbabilityResponse>;
|
||||
/**
|
||||
*
|
||||
* BuildRoute builds a fully specified route based on a list of hop public
|
||||
* keys. It retrieves the relevant channel policies from the graph in order to
|
||||
* calculate the correct fees and time locks.
|
||||
*
|
||||
* @generated from protobuf rpc: BuildRoute(routerrpc.BuildRouteRequest) returns (routerrpc.BuildRouteResponse);
|
||||
*/
|
||||
buildRoute(input: BuildRouteRequest, options?: RpcOptions): UnaryCall<BuildRouteRequest, BuildRouteResponse>;
|
||||
/**
|
||||
*
|
||||
* SubscribeHtlcEvents creates a uni-directional stream from the server to
|
||||
* the client which delivers a stream of htlc events.
|
||||
*
|
||||
* @generated from protobuf rpc: SubscribeHtlcEvents(routerrpc.SubscribeHtlcEventsRequest) returns (stream routerrpc.HtlcEvent);
|
||||
*/
|
||||
subscribeHtlcEvents(input: SubscribeHtlcEventsRequest, options?: RpcOptions): ServerStreamingCall<SubscribeHtlcEventsRequest, HtlcEvent>;
|
||||
/**
|
||||
*
|
||||
* Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
|
||||
* described by the passed PaymentRequest to the final destination. The call
|
||||
* returns a stream of payment status updates.
|
||||
*
|
||||
* @deprecated
|
||||
* @generated from protobuf rpc: SendPayment(routerrpc.SendPaymentRequest) returns (stream routerrpc.PaymentStatus);
|
||||
*/
|
||||
sendPayment(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, PaymentStatus>;
|
||||
/**
|
||||
*
|
||||
* Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
|
||||
* the payment identified by the payment hash.
|
||||
*
|
||||
* @deprecated
|
||||
* @generated from protobuf rpc: TrackPayment(routerrpc.TrackPaymentRequest) returns (stream routerrpc.PaymentStatus);
|
||||
*/
|
||||
trackPayment(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, PaymentStatus>;
|
||||
/**
|
||||
* *
|
||||
* HtlcInterceptor dispatches a bi-directional streaming RPC in which
|
||||
* Forwarded HTLC requests are sent to the client and the client responds with
|
||||
* a boolean that tells LND if this htlc should be intercepted.
|
||||
* In case of interception, the htlc can be either settled, cancelled or
|
||||
* resumed later by using the ResolveHoldForward endpoint.
|
||||
*
|
||||
* @generated from protobuf rpc: HtlcInterceptor(stream routerrpc.ForwardHtlcInterceptResponse) returns (stream routerrpc.ForwardHtlcInterceptRequest);
|
||||
*/
|
||||
htlcInterceptor(options?: RpcOptions): DuplexStreamingCall<ForwardHtlcInterceptResponse, ForwardHtlcInterceptRequest>;
|
||||
/**
|
||||
*
|
||||
* UpdateChanStatus attempts to manually set the state of a channel
|
||||
* (enabled, disabled, or auto). A manual "disable" request will cause the
|
||||
* channel to stay disabled until a subsequent manual request of either
|
||||
* "enable" or "auto".
|
||||
*
|
||||
* @generated from protobuf rpc: UpdateChanStatus(routerrpc.UpdateChanStatusRequest) returns (routerrpc.UpdateChanStatusResponse);
|
||||
*/
|
||||
updateChanStatus(input: UpdateChanStatusRequest, options?: RpcOptions): UnaryCall<UpdateChanStatusRequest, UpdateChanStatusResponse>;
|
||||
}
|
||||
238
proto/lnd/router.client.js
Normal file
238
proto/lnd/router.client.js
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
|
||||
// @generated from protobuf file "router.proto" (package "routerrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
import { Router } from "./router.js";
|
||||
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
|
||||
/**
|
||||
* Router is a service that offers advanced interaction with the router
|
||||
* subsystem of the daemon.
|
||||
*
|
||||
* @generated from protobuf service routerrpc.Router
|
||||
*/
|
||||
export class RouterClient {
|
||||
constructor(_transport) {
|
||||
this._transport = _transport;
|
||||
this.typeName = Router.typeName;
|
||||
this.methods = Router.methods;
|
||||
this.options = Router.options;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* SendPaymentV2 attempts to route a payment described by the passed
|
||||
* PaymentRequest to the final destination. The call returns a stream of
|
||||
* payment updates.
|
||||
*
|
||||
* @generated from protobuf rpc: SendPaymentV2(routerrpc.SendPaymentRequest) returns (stream lnrpc.Payment);
|
||||
*/
|
||||
sendPaymentV2(input, options) {
|
||||
const method = this.methods[0], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* TrackPaymentV2 returns an update stream for the payment identified by the
|
||||
* payment hash.
|
||||
*
|
||||
* @generated from protobuf rpc: TrackPaymentV2(routerrpc.TrackPaymentRequest) returns (stream lnrpc.Payment);
|
||||
*/
|
||||
trackPaymentV2(input, options) {
|
||||
const method = this.methods[1], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* TrackPayments returns an update stream for every payment that is not in a
|
||||
* terminal state. Note that if payments are in-flight while starting a new
|
||||
* subscription, the start of the payment stream could produce out-of-order
|
||||
* and/or duplicate events. In order to get updates for every in-flight
|
||||
* payment attempt make sure to subscribe to this method before initiating any
|
||||
* payments.
|
||||
*
|
||||
* @generated from protobuf rpc: TrackPayments(routerrpc.TrackPaymentsRequest) returns (stream lnrpc.Payment);
|
||||
*/
|
||||
trackPayments(input, options) {
|
||||
const method = this.methods[2], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
|
||||
* may cost to send an HTLC to the target end destination.
|
||||
*
|
||||
* @generated from protobuf rpc: EstimateRouteFee(routerrpc.RouteFeeRequest) returns (routerrpc.RouteFeeResponse);
|
||||
*/
|
||||
estimateRouteFee(input, options) {
|
||||
const method = this.methods[3], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Deprecated, use SendToRouteV2. SendToRoute attempts to make a payment via
|
||||
* the specified route. This method differs from SendPayment in that it
|
||||
* allows users to specify a full route manually. This can be used for
|
||||
* things like rebalancing, and atomic swaps. It differs from the newer
|
||||
* SendToRouteV2 in that it doesn't return the full HTLC information.
|
||||
*
|
||||
* @deprecated
|
||||
* @generated from protobuf rpc: SendToRoute(routerrpc.SendToRouteRequest) returns (routerrpc.SendToRouteResponse);
|
||||
*/
|
||||
sendToRoute(input, options) {
|
||||
const method = this.methods[4], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* SendToRouteV2 attempts to make a payment via the specified route. This
|
||||
* method differs from SendPayment in that it allows users to specify a full
|
||||
* route manually. This can be used for things like rebalancing, and atomic
|
||||
* swaps.
|
||||
*
|
||||
* @generated from protobuf rpc: SendToRouteV2(routerrpc.SendToRouteRequest) returns (lnrpc.HTLCAttempt);
|
||||
*/
|
||||
sendToRouteV2(input, options) {
|
||||
const method = this.methods[5], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* ResetMissionControl clears all mission control state and starts with a clean
|
||||
* slate.
|
||||
*
|
||||
* @generated from protobuf rpc: ResetMissionControl(routerrpc.ResetMissionControlRequest) returns (routerrpc.ResetMissionControlResponse);
|
||||
*/
|
||||
resetMissionControl(input, options) {
|
||||
const method = this.methods[6], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* QueryMissionControl exposes the internal mission control state to callers.
|
||||
* It is a development feature.
|
||||
*
|
||||
* @generated from protobuf rpc: QueryMissionControl(routerrpc.QueryMissionControlRequest) returns (routerrpc.QueryMissionControlResponse);
|
||||
*/
|
||||
queryMissionControl(input, options) {
|
||||
const method = this.methods[7], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* XImportMissionControl is an experimental API that imports the state provided
|
||||
* to the internal mission control's state, using all results which are more
|
||||
* recent than our existing values. These values will only be imported
|
||||
* in-memory, and will not be persisted across restarts.
|
||||
*
|
||||
* @generated from protobuf rpc: XImportMissionControl(routerrpc.XImportMissionControlRequest) returns (routerrpc.XImportMissionControlResponse);
|
||||
*/
|
||||
xImportMissionControl(input, options) {
|
||||
const method = this.methods[8], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* GetMissionControlConfig returns mission control's current config.
|
||||
*
|
||||
* @generated from protobuf rpc: GetMissionControlConfig(routerrpc.GetMissionControlConfigRequest) returns (routerrpc.GetMissionControlConfigResponse);
|
||||
*/
|
||||
getMissionControlConfig(input, options) {
|
||||
const method = this.methods[9], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* SetMissionControlConfig will set mission control's config, if the config
|
||||
* provided is valid.
|
||||
*
|
||||
* @generated from protobuf rpc: SetMissionControlConfig(routerrpc.SetMissionControlConfigRequest) returns (routerrpc.SetMissionControlConfigResponse);
|
||||
*/
|
||||
setMissionControlConfig(input, options) {
|
||||
const method = this.methods[10], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* QueryProbability returns the current success probability estimate for a
|
||||
* given node pair and amount.
|
||||
*
|
||||
* @generated from protobuf rpc: QueryProbability(routerrpc.QueryProbabilityRequest) returns (routerrpc.QueryProbabilityResponse);
|
||||
*/
|
||||
queryProbability(input, options) {
|
||||
const method = this.methods[11], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* BuildRoute builds a fully specified route based on a list of hop public
|
||||
* keys. It retrieves the relevant channel policies from the graph in order to
|
||||
* calculate the correct fees and time locks.
|
||||
*
|
||||
* @generated from protobuf rpc: BuildRoute(routerrpc.BuildRouteRequest) returns (routerrpc.BuildRouteResponse);
|
||||
*/
|
||||
buildRoute(input, options) {
|
||||
const method = this.methods[12], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* SubscribeHtlcEvents creates a uni-directional stream from the server to
|
||||
* the client which delivers a stream of htlc events.
|
||||
*
|
||||
* @generated from protobuf rpc: SubscribeHtlcEvents(routerrpc.SubscribeHtlcEventsRequest) returns (stream routerrpc.HtlcEvent);
|
||||
*/
|
||||
subscribeHtlcEvents(input, options) {
|
||||
const method = this.methods[13], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
|
||||
* described by the passed PaymentRequest to the final destination. The call
|
||||
* returns a stream of payment status updates.
|
||||
*
|
||||
* @deprecated
|
||||
* @generated from protobuf rpc: SendPayment(routerrpc.SendPaymentRequest) returns (stream routerrpc.PaymentStatus);
|
||||
*/
|
||||
sendPayment(input, options) {
|
||||
const method = this.methods[14], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
|
||||
* the payment identified by the payment hash.
|
||||
*
|
||||
* @deprecated
|
||||
* @generated from protobuf rpc: TrackPayment(routerrpc.TrackPaymentRequest) returns (stream routerrpc.PaymentStatus);
|
||||
*/
|
||||
trackPayment(input, options) {
|
||||
const method = this.methods[15], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* *
|
||||
* HtlcInterceptor dispatches a bi-directional streaming RPC in which
|
||||
* Forwarded HTLC requests are sent to the client and the client responds with
|
||||
* a boolean that tells LND if this htlc should be intercepted.
|
||||
* In case of interception, the htlc can be either settled, cancelled or
|
||||
* resumed later by using the ResolveHoldForward endpoint.
|
||||
*
|
||||
* @generated from protobuf rpc: HtlcInterceptor(stream routerrpc.ForwardHtlcInterceptResponse) returns (stream routerrpc.ForwardHtlcInterceptRequest);
|
||||
*/
|
||||
htlcInterceptor(options) {
|
||||
const method = this.methods[16], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("duplex", this._transport, method, opt);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* UpdateChanStatus attempts to manually set the state of a channel
|
||||
* (enabled, disabled, or auto). A manual "disable" request will cause the
|
||||
* channel to stay disabled until a subsequent manual request of either
|
||||
* "enable" or "auto".
|
||||
*
|
||||
* @generated from protobuf rpc: UpdateChanStatus(routerrpc.UpdateChanStatusRequest) returns (routerrpc.UpdateChanStatusResponse);
|
||||
*/
|
||||
updateChanStatus(input, options) {
|
||||
const method = this.methods[17], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept("unary", this._transport, method, opt, input);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// @generated by protobuf-ts 2.5.0
|
||||
// @generated by protobuf-ts 2.8.1 with parameter long_type_number
|
||||
// @generated from protobuf file "router.proto" (package "routerrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
||||
|
|
|
|||
1649
proto/lnd/router.d.ts
vendored
Normal file
1649
proto/lnd/router.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load diff
2519
proto/lnd/router.js
Normal file
2519
proto/lnd/router.js
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
|||
// @generated by protobuf-ts 2.5.0
|
||||
// @generated by protobuf-ts 2.8.1 with parameter long_type_number
|
||||
// @generated from protobuf file "router.proto" (package "routerrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
import { Payment } from "./lightning";
|
||||
|
|
@ -38,7 +38,7 @@ export interface SendPaymentRequest {
|
|||
*
|
||||
* @generated from protobuf field: int64 amt = 2;
|
||||
*/
|
||||
amt: bigint;
|
||||
amt: number;
|
||||
/**
|
||||
*
|
||||
* Number of millisatoshis to send.
|
||||
|
|
@ -47,7 +47,7 @@ export interface SendPaymentRequest {
|
|||
*
|
||||
* @generated from protobuf field: int64 amt_msat = 12;
|
||||
*/
|
||||
amtMsat: bigint;
|
||||
amtMsat: number;
|
||||
/**
|
||||
* The hash to use within the payment's HTLC
|
||||
*
|
||||
|
|
@ -100,7 +100,7 @@ export interface SendPaymentRequest {
|
|||
*
|
||||
* @generated from protobuf field: int64 fee_limit_sat = 7;
|
||||
*/
|
||||
feeLimitSat: bigint;
|
||||
feeLimitSat: number;
|
||||
/**
|
||||
*
|
||||
* The maximum number of millisatoshis that will be paid as a fee of the
|
||||
|
|
@ -113,7 +113,7 @@ export interface SendPaymentRequest {
|
|||
*
|
||||
* @generated from protobuf field: int64 fee_limit_msat = 13;
|
||||
*/
|
||||
feeLimitMsat: bigint;
|
||||
feeLimitMsat: number;
|
||||
/**
|
||||
*
|
||||
* Deprecated, use outgoing_chan_ids. The channel id of the channel that must
|
||||
|
|
@ -131,7 +131,7 @@ export interface SendPaymentRequest {
|
|||
*
|
||||
* @generated from protobuf field: repeated uint64 outgoing_chan_ids = 19;
|
||||
*/
|
||||
outgoingChanIds: bigint[];
|
||||
outgoingChanIds: number[];
|
||||
/**
|
||||
*
|
||||
* The pubkey of the last hop of the route. If empty, any hop may be used.
|
||||
|
|
@ -210,7 +210,7 @@ export interface SendPaymentRequest {
|
|||
*
|
||||
* @generated from protobuf field: uint64 max_shard_size_msat = 21;
|
||||
*/
|
||||
maxShardSizeMsat: bigint;
|
||||
maxShardSizeMsat: number;
|
||||
/**
|
||||
*
|
||||
* If set, an AMP-payment will be attempted.
|
||||
|
|
@ -276,7 +276,7 @@ export interface RouteFeeRequest {
|
|||
*
|
||||
* @generated from protobuf field: int64 amt_sat = 2;
|
||||
*/
|
||||
amtSat: bigint;
|
||||
amtSat: number;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message routerrpc.RouteFeeResponse
|
||||
|
|
@ -289,7 +289,7 @@ export interface RouteFeeResponse {
|
|||
*
|
||||
* @generated from protobuf field: int64 routing_fee_msat = 1;
|
||||
*/
|
||||
routingFeeMsat: bigint;
|
||||
routingFeeMsat: number;
|
||||
/**
|
||||
*
|
||||
* An estimate of the worst case time delay that can occur. Note that callers
|
||||
|
|
@ -298,7 +298,7 @@ export interface RouteFeeResponse {
|
|||
*
|
||||
* @generated from protobuf field: int64 time_lock_delay = 2;
|
||||
*/
|
||||
timeLockDelay: bigint;
|
||||
timeLockDelay: number;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message routerrpc.SendToRouteRequest
|
||||
|
|
@ -428,7 +428,7 @@ export interface PairData {
|
|||
*
|
||||
* @generated from protobuf field: int64 fail_time = 1;
|
||||
*/
|
||||
failTime: bigint;
|
||||
failTime: number;
|
||||
/**
|
||||
*
|
||||
* Lowest amount that failed to forward rounded to whole sats. This may be
|
||||
|
|
@ -436,7 +436,7 @@ export interface PairData {
|
|||
*
|
||||
* @generated from protobuf field: int64 fail_amt_sat = 2;
|
||||
*/
|
||||
failAmtSat: bigint;
|
||||
failAmtSat: number;
|
||||
/**
|
||||
*
|
||||
* Lowest amount that failed to forward in millisats. This may be
|
||||
|
|
@ -444,25 +444,25 @@ export interface PairData {
|
|||
*
|
||||
* @generated from protobuf field: int64 fail_amt_msat = 4;
|
||||
*/
|
||||
failAmtMsat: bigint;
|
||||
failAmtMsat: number;
|
||||
/**
|
||||
* Time of last success.
|
||||
*
|
||||
* @generated from protobuf field: int64 success_time = 5;
|
||||
*/
|
||||
successTime: bigint;
|
||||
successTime: number;
|
||||
/**
|
||||
* Highest amount that we could successfully forward rounded to whole sats.
|
||||
*
|
||||
* @generated from protobuf field: int64 success_amt_sat = 6;
|
||||
*/
|
||||
successAmtSat: bigint;
|
||||
successAmtSat: number;
|
||||
/**
|
||||
* Highest amount that we could successfully forward in millisats.
|
||||
*
|
||||
* @generated from protobuf field: int64 success_amt_msat = 7;
|
||||
*/
|
||||
successAmtMsat: bigint;
|
||||
successAmtMsat: number;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message routerrpc.GetMissionControlConfigRequest
|
||||
|
|
@ -513,7 +513,7 @@ export interface MissionControlConfig {
|
|||
*
|
||||
* @generated from protobuf field: uint64 half_life_seconds = 1;
|
||||
*/
|
||||
halfLifeSeconds: bigint;
|
||||
halfLifeSeconds: number;
|
||||
/**
|
||||
*
|
||||
* The probability of success mission control should assign to hop in a route
|
||||
|
|
@ -550,7 +550,7 @@ export interface MissionControlConfig {
|
|||
*
|
||||
* @generated from protobuf field: uint64 minimum_failure_relax_interval = 5;
|
||||
*/
|
||||
minimumFailureRelaxInterval: bigint;
|
||||
minimumFailureRelaxInterval: number;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message routerrpc.QueryProbabilityRequest
|
||||
|
|
@ -573,7 +573,7 @@ export interface QueryProbabilityRequest {
|
|||
*
|
||||
* @generated from protobuf field: int64 amt_msat = 3;
|
||||
*/
|
||||
amtMsat: bigint;
|
||||
amtMsat: number;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message routerrpc.QueryProbabilityResponse
|
||||
|
|
@ -603,7 +603,7 @@ export interface BuildRouteRequest {
|
|||
*
|
||||
* @generated from protobuf field: int64 amt_msat = 1;
|
||||
*/
|
||||
amtMsat: bigint;
|
||||
amtMsat: number;
|
||||
/**
|
||||
*
|
||||
* CLTV delta from the current height that should be used for the timelock
|
||||
|
|
@ -671,7 +671,7 @@ export interface HtlcEvent {
|
|||
*
|
||||
* @generated from protobuf field: uint64 incoming_channel_id = 1;
|
||||
*/
|
||||
incomingChannelId: bigint;
|
||||
incomingChannelId: number;
|
||||
/**
|
||||
*
|
||||
* The short channel id that the outgoing htlc left our node on. This value
|
||||
|
|
@ -679,7 +679,7 @@ export interface HtlcEvent {
|
|||
*
|
||||
* @generated from protobuf field: uint64 outgoing_channel_id = 2;
|
||||
*/
|
||||
outgoingChannelId: bigint;
|
||||
outgoingChannelId: number;
|
||||
/**
|
||||
*
|
||||
* Incoming id is the index of the incoming htlc in the incoming channel.
|
||||
|
|
@ -687,7 +687,7 @@ export interface HtlcEvent {
|
|||
*
|
||||
* @generated from protobuf field: uint64 incoming_htlc_id = 3;
|
||||
*/
|
||||
incomingHtlcId: bigint;
|
||||
incomingHtlcId: number;
|
||||
/**
|
||||
*
|
||||
* Outgoing id is the index of the outgoing htlc in the outgoing channel.
|
||||
|
|
@ -695,14 +695,14 @@ export interface HtlcEvent {
|
|||
*
|
||||
* @generated from protobuf field: uint64 outgoing_htlc_id = 4;
|
||||
*/
|
||||
outgoingHtlcId: bigint;
|
||||
outgoingHtlcId: number;
|
||||
/**
|
||||
*
|
||||
* The time in unix nanoseconds that the event occurred.
|
||||
*
|
||||
* @generated from protobuf field: uint64 timestamp_ns = 5;
|
||||
*/
|
||||
timestampNs: bigint;
|
||||
timestampNs: number;
|
||||
/**
|
||||
*
|
||||
* The event type indicates whether the htlc was part of a send, receive or
|
||||
|
|
@ -796,13 +796,13 @@ export interface HtlcInfo {
|
|||
*
|
||||
* @generated from protobuf field: uint64 incoming_amt_msat = 3;
|
||||
*/
|
||||
incomingAmtMsat: bigint;
|
||||
incomingAmtMsat: number;
|
||||
/**
|
||||
* The amount of the outgoing htlc.
|
||||
*
|
||||
* @generated from protobuf field: uint64 outgoing_amt_msat = 4;
|
||||
*/
|
||||
outgoingAmtMsat: bigint;
|
||||
outgoingAmtMsat: number;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message routerrpc.ForwardEvent
|
||||
|
|
@ -915,13 +915,13 @@ export interface CircuitKey {
|
|||
*
|
||||
* @generated from protobuf field: uint64 chan_id = 1;
|
||||
*/
|
||||
chanId: bigint;
|
||||
chanId: number;
|
||||
/**
|
||||
* / The index of the incoming htlc in the incoming channel.
|
||||
*
|
||||
* @generated from protobuf field: uint64 htlc_id = 2;
|
||||
*/
|
||||
htlcId: bigint;
|
||||
htlcId: number;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message routerrpc.ForwardHtlcInterceptRequest
|
||||
|
|
@ -940,7 +940,7 @@ export interface ForwardHtlcInterceptRequest {
|
|||
*
|
||||
* @generated from protobuf field: uint64 incoming_amount_msat = 5;
|
||||
*/
|
||||
incomingAmountMsat: bigint;
|
||||
incomingAmountMsat: number;
|
||||
/**
|
||||
* The incoming htlc expiry.
|
||||
*
|
||||
|
|
@ -963,13 +963,13 @@ export interface ForwardHtlcInterceptRequest {
|
|||
*
|
||||
* @generated from protobuf field: uint64 outgoing_requested_chan_id = 7;
|
||||
*/
|
||||
outgoingRequestedChanId: bigint;
|
||||
outgoingRequestedChanId: number;
|
||||
/**
|
||||
* The outgoing htlc amount.
|
||||
*
|
||||
* @generated from protobuf field: uint64 outgoing_amount_msat = 3;
|
||||
*/
|
||||
outgoingAmountMsat: bigint;
|
||||
outgoingAmountMsat: number;
|
||||
/**
|
||||
* The outgoing htlc expiry.
|
||||
*
|
||||
|
|
@ -1261,17 +1261,17 @@ class SendPaymentRequest$Type extends MessageType<SendPaymentRequest> {
|
|||
constructor() {
|
||||
super("routerrpc.SendPaymentRequest", [
|
||||
{ no: 1, name: "dest", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 2, name: "amt", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 12, name: "amt_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 2, name: "amt", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 12, name: "amt_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 3, name: "payment_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 4, name: "final_cltv_delta", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
|
||||
{ no: 20, name: "payment_addr", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 5, name: "payment_request", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 6, name: "timeout_seconds", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
|
||||
{ no: 7, name: "fee_limit_sat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 13, name: "fee_limit_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 7, name: "fee_limit_sat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 13, name: "fee_limit_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 8, name: "outgoing_chan_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/ },
|
||||
{ no: 19, name: "outgoing_chan_ids", kind: "scalar", repeat: 1 /*RepeatType.PACKED*/, T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 19, name: "outgoing_chan_ids", kind: "scalar", repeat: 1 /*RepeatType.PACKED*/, T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 14, name: "last_hop_pubkey", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 9, name: "cltv_limit", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
|
||||
{ no: 10, name: "route_hints", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => RouteHint },
|
||||
|
|
@ -1280,13 +1280,13 @@ class SendPaymentRequest$Type extends MessageType<SendPaymentRequest> {
|
|||
{ no: 16, name: "dest_features", kind: "enum", repeat: 1 /*RepeatType.PACKED*/, T: () => ["lnrpc.FeatureBit", FeatureBit] },
|
||||
{ no: 17, name: "max_parts", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
||||
{ no: 18, name: "no_inflight_updates", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
|
||||
{ no: 21, name: "max_shard_size_msat", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 21, name: "max_shard_size_msat", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 22, name: "amp", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
|
||||
{ no: 23, name: "time_pref", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<SendPaymentRequest>): SendPaymentRequest {
|
||||
const message = { dest: new Uint8Array(0), amt: 0n, amtMsat: 0n, paymentHash: new Uint8Array(0), finalCltvDelta: 0, paymentAddr: new Uint8Array(0), paymentRequest: "", timeoutSeconds: 0, feeLimitSat: 0n, feeLimitMsat: 0n, outgoingChanId: "0", outgoingChanIds: [], lastHopPubkey: new Uint8Array(0), cltvLimit: 0, routeHints: [], destCustomRecords: {}, allowSelfPayment: false, destFeatures: [], maxParts: 0, noInflightUpdates: false, maxShardSizeMsat: 0n, amp: false, timePref: 0 };
|
||||
const message = { dest: new Uint8Array(0), amt: 0, amtMsat: 0, paymentHash: new Uint8Array(0), finalCltvDelta: 0, paymentAddr: new Uint8Array(0), paymentRequest: "", timeoutSeconds: 0, feeLimitSat: 0, feeLimitMsat: 0, outgoingChanId: "0", outgoingChanIds: [], lastHopPubkey: new Uint8Array(0), cltvLimit: 0, routeHints: [], destCustomRecords: {}, allowSelfPayment: false, destFeatures: [], maxParts: 0, noInflightUpdates: false, maxShardSizeMsat: 0, amp: false, timePref: 0 };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<SendPaymentRequest>(this, message, value);
|
||||
|
|
@ -1301,10 +1301,10 @@ class SendPaymentRequest$Type extends MessageType<SendPaymentRequest> {
|
|||
message.dest = reader.bytes();
|
||||
break;
|
||||
case /* int64 amt */ 2:
|
||||
message.amt = reader.int64().toBigInt();
|
||||
message.amt = reader.int64().toNumber();
|
||||
break;
|
||||
case /* int64 amt_msat */ 12:
|
||||
message.amtMsat = reader.int64().toBigInt();
|
||||
message.amtMsat = reader.int64().toNumber();
|
||||
break;
|
||||
case /* bytes payment_hash */ 3:
|
||||
message.paymentHash = reader.bytes();
|
||||
|
|
@ -1322,10 +1322,10 @@ class SendPaymentRequest$Type extends MessageType<SendPaymentRequest> {
|
|||
message.timeoutSeconds = reader.int32();
|
||||
break;
|
||||
case /* int64 fee_limit_sat */ 7:
|
||||
message.feeLimitSat = reader.int64().toBigInt();
|
||||
message.feeLimitSat = reader.int64().toNumber();
|
||||
break;
|
||||
case /* int64 fee_limit_msat */ 13:
|
||||
message.feeLimitMsat = reader.int64().toBigInt();
|
||||
message.feeLimitMsat = reader.int64().toNumber();
|
||||
break;
|
||||
case /* uint64 outgoing_chan_id = 8 [deprecated = true, jstype = JS_STRING];*/ 8:
|
||||
message.outgoingChanId = reader.uint64().toString();
|
||||
|
|
@ -1333,9 +1333,9 @@ class SendPaymentRequest$Type extends MessageType<SendPaymentRequest> {
|
|||
case /* repeated uint64 outgoing_chan_ids */ 19:
|
||||
if (wireType === WireType.LengthDelimited)
|
||||
for (let e = reader.int32() + reader.pos; reader.pos < e;)
|
||||
message.outgoingChanIds.push(reader.uint64().toBigInt());
|
||||
message.outgoingChanIds.push(reader.uint64().toNumber());
|
||||
else
|
||||
message.outgoingChanIds.push(reader.uint64().toBigInt());
|
||||
message.outgoingChanIds.push(reader.uint64().toNumber());
|
||||
break;
|
||||
case /* bytes last_hop_pubkey */ 14:
|
||||
message.lastHopPubkey = reader.bytes();
|
||||
|
|
@ -1366,7 +1366,7 @@ class SendPaymentRequest$Type extends MessageType<SendPaymentRequest> {
|
|||
message.noInflightUpdates = reader.bool();
|
||||
break;
|
||||
case /* uint64 max_shard_size_msat */ 21:
|
||||
message.maxShardSizeMsat = reader.uint64().toBigInt();
|
||||
message.maxShardSizeMsat = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* bool amp */ 22:
|
||||
message.amp = reader.bool();
|
||||
|
|
@ -1406,10 +1406,10 @@ class SendPaymentRequest$Type extends MessageType<SendPaymentRequest> {
|
|||
if (message.dest.length)
|
||||
writer.tag(1, WireType.LengthDelimited).bytes(message.dest);
|
||||
/* int64 amt = 2; */
|
||||
if (message.amt !== 0n)
|
||||
if (message.amt !== 0)
|
||||
writer.tag(2, WireType.Varint).int64(message.amt);
|
||||
/* int64 amt_msat = 12; */
|
||||
if (message.amtMsat !== 0n)
|
||||
if (message.amtMsat !== 0)
|
||||
writer.tag(12, WireType.Varint).int64(message.amtMsat);
|
||||
/* bytes payment_hash = 3; */
|
||||
if (message.paymentHash.length)
|
||||
|
|
@ -1427,10 +1427,10 @@ class SendPaymentRequest$Type extends MessageType<SendPaymentRequest> {
|
|||
if (message.timeoutSeconds !== 0)
|
||||
writer.tag(6, WireType.Varint).int32(message.timeoutSeconds);
|
||||
/* int64 fee_limit_sat = 7; */
|
||||
if (message.feeLimitSat !== 0n)
|
||||
if (message.feeLimitSat !== 0)
|
||||
writer.tag(7, WireType.Varint).int64(message.feeLimitSat);
|
||||
/* int64 fee_limit_msat = 13; */
|
||||
if (message.feeLimitMsat !== 0n)
|
||||
if (message.feeLimitMsat !== 0)
|
||||
writer.tag(13, WireType.Varint).int64(message.feeLimitMsat);
|
||||
/* uint64 outgoing_chan_id = 8 [deprecated = true, jstype = JS_STRING]; */
|
||||
if (message.outgoingChanId !== "0")
|
||||
|
|
@ -1471,7 +1471,7 @@ class SendPaymentRequest$Type extends MessageType<SendPaymentRequest> {
|
|||
if (message.noInflightUpdates !== false)
|
||||
writer.tag(18, WireType.Varint).bool(message.noInflightUpdates);
|
||||
/* uint64 max_shard_size_msat = 21; */
|
||||
if (message.maxShardSizeMsat !== 0n)
|
||||
if (message.maxShardSizeMsat !== 0)
|
||||
writer.tag(21, WireType.Varint).uint64(message.maxShardSizeMsat);
|
||||
/* bool amp = 22; */
|
||||
if (message.amp !== false)
|
||||
|
|
@ -1595,11 +1595,11 @@ class RouteFeeRequest$Type extends MessageType<RouteFeeRequest> {
|
|||
constructor() {
|
||||
super("routerrpc.RouteFeeRequest", [
|
||||
{ no: 1, name: "dest", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 2, name: "amt_sat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
|
||||
{ no: 2, name: "amt_sat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<RouteFeeRequest>): RouteFeeRequest {
|
||||
const message = { dest: new Uint8Array(0), amtSat: 0n };
|
||||
const message = { dest: new Uint8Array(0), amtSat: 0 };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<RouteFeeRequest>(this, message, value);
|
||||
|
|
@ -1614,7 +1614,7 @@ class RouteFeeRequest$Type extends MessageType<RouteFeeRequest> {
|
|||
message.dest = reader.bytes();
|
||||
break;
|
||||
case /* int64 amt_sat */ 2:
|
||||
message.amtSat = reader.int64().toBigInt();
|
||||
message.amtSat = reader.int64().toNumber();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
|
|
@ -1632,7 +1632,7 @@ class RouteFeeRequest$Type extends MessageType<RouteFeeRequest> {
|
|||
if (message.dest.length)
|
||||
writer.tag(1, WireType.LengthDelimited).bytes(message.dest);
|
||||
/* int64 amt_sat = 2; */
|
||||
if (message.amtSat !== 0n)
|
||||
if (message.amtSat !== 0)
|
||||
writer.tag(2, WireType.Varint).int64(message.amtSat);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
|
|
@ -1648,12 +1648,12 @@ export const RouteFeeRequest = new RouteFeeRequest$Type();
|
|||
class RouteFeeResponse$Type extends MessageType<RouteFeeResponse> {
|
||||
constructor() {
|
||||
super("routerrpc.RouteFeeResponse", [
|
||||
{ no: 1, name: "routing_fee_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 2, name: "time_lock_delay", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
|
||||
{ no: 1, name: "routing_fee_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 2, name: "time_lock_delay", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<RouteFeeResponse>): RouteFeeResponse {
|
||||
const message = { routingFeeMsat: 0n, timeLockDelay: 0n };
|
||||
const message = { routingFeeMsat: 0, timeLockDelay: 0 };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<RouteFeeResponse>(this, message, value);
|
||||
|
|
@ -1665,10 +1665,10 @@ class RouteFeeResponse$Type extends MessageType<RouteFeeResponse> {
|
|||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* int64 routing_fee_msat */ 1:
|
||||
message.routingFeeMsat = reader.int64().toBigInt();
|
||||
message.routingFeeMsat = reader.int64().toNumber();
|
||||
break;
|
||||
case /* int64 time_lock_delay */ 2:
|
||||
message.timeLockDelay = reader.int64().toBigInt();
|
||||
message.timeLockDelay = reader.int64().toNumber();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
|
|
@ -1683,10 +1683,10 @@ class RouteFeeResponse$Type extends MessageType<RouteFeeResponse> {
|
|||
}
|
||||
internalBinaryWrite(message: RouteFeeResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
||||
/* int64 routing_fee_msat = 1; */
|
||||
if (message.routingFeeMsat !== 0n)
|
||||
if (message.routingFeeMsat !== 0)
|
||||
writer.tag(1, WireType.Varint).int64(message.routingFeeMsat);
|
||||
/* int64 time_lock_delay = 2; */
|
||||
if (message.timeLockDelay !== 0n)
|
||||
if (message.timeLockDelay !== 0)
|
||||
writer.tag(2, WireType.Varint).int64(message.timeLockDelay);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
|
|
@ -2083,16 +2083,16 @@ export const PairHistory = new PairHistory$Type();
|
|||
class PairData$Type extends MessageType<PairData> {
|
||||
constructor() {
|
||||
super("routerrpc.PairData", [
|
||||
{ no: 1, name: "fail_time", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 2, name: "fail_amt_sat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 4, name: "fail_amt_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 5, name: "success_time", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 6, name: "success_amt_sat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 7, name: "success_amt_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
|
||||
{ no: 1, name: "fail_time", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 2, name: "fail_amt_sat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 4, name: "fail_amt_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 5, name: "success_time", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 6, name: "success_amt_sat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 7, name: "success_amt_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<PairData>): PairData {
|
||||
const message = { failTime: 0n, failAmtSat: 0n, failAmtMsat: 0n, successTime: 0n, successAmtSat: 0n, successAmtMsat: 0n };
|
||||
const message = { failTime: 0, failAmtSat: 0, failAmtMsat: 0, successTime: 0, successAmtSat: 0, successAmtMsat: 0 };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<PairData>(this, message, value);
|
||||
|
|
@ -2104,22 +2104,22 @@ class PairData$Type extends MessageType<PairData> {
|
|||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* int64 fail_time */ 1:
|
||||
message.failTime = reader.int64().toBigInt();
|
||||
message.failTime = reader.int64().toNumber();
|
||||
break;
|
||||
case /* int64 fail_amt_sat */ 2:
|
||||
message.failAmtSat = reader.int64().toBigInt();
|
||||
message.failAmtSat = reader.int64().toNumber();
|
||||
break;
|
||||
case /* int64 fail_amt_msat */ 4:
|
||||
message.failAmtMsat = reader.int64().toBigInt();
|
||||
message.failAmtMsat = reader.int64().toNumber();
|
||||
break;
|
||||
case /* int64 success_time */ 5:
|
||||
message.successTime = reader.int64().toBigInt();
|
||||
message.successTime = reader.int64().toNumber();
|
||||
break;
|
||||
case /* int64 success_amt_sat */ 6:
|
||||
message.successAmtSat = reader.int64().toBigInt();
|
||||
message.successAmtSat = reader.int64().toNumber();
|
||||
break;
|
||||
case /* int64 success_amt_msat */ 7:
|
||||
message.successAmtMsat = reader.int64().toBigInt();
|
||||
message.successAmtMsat = reader.int64().toNumber();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
|
|
@ -2134,22 +2134,22 @@ class PairData$Type extends MessageType<PairData> {
|
|||
}
|
||||
internalBinaryWrite(message: PairData, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
||||
/* int64 fail_time = 1; */
|
||||
if (message.failTime !== 0n)
|
||||
if (message.failTime !== 0)
|
||||
writer.tag(1, WireType.Varint).int64(message.failTime);
|
||||
/* int64 fail_amt_sat = 2; */
|
||||
if (message.failAmtSat !== 0n)
|
||||
if (message.failAmtSat !== 0)
|
||||
writer.tag(2, WireType.Varint).int64(message.failAmtSat);
|
||||
/* int64 fail_amt_msat = 4; */
|
||||
if (message.failAmtMsat !== 0n)
|
||||
if (message.failAmtMsat !== 0)
|
||||
writer.tag(4, WireType.Varint).int64(message.failAmtMsat);
|
||||
/* int64 success_time = 5; */
|
||||
if (message.successTime !== 0n)
|
||||
if (message.successTime !== 0)
|
||||
writer.tag(5, WireType.Varint).int64(message.successTime);
|
||||
/* int64 success_amt_sat = 6; */
|
||||
if (message.successAmtSat !== 0n)
|
||||
if (message.successAmtSat !== 0)
|
||||
writer.tag(6, WireType.Varint).int64(message.successAmtSat);
|
||||
/* int64 success_amt_msat = 7; */
|
||||
if (message.successAmtMsat !== 0n)
|
||||
if (message.successAmtMsat !== 0)
|
||||
writer.tag(7, WireType.Varint).int64(message.successAmtMsat);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
|
|
@ -2311,15 +2311,15 @@ export const SetMissionControlConfigResponse = new SetMissionControlConfigRespon
|
|||
class MissionControlConfig$Type extends MessageType<MissionControlConfig> {
|
||||
constructor() {
|
||||
super("routerrpc.MissionControlConfig", [
|
||||
{ no: 1, name: "half_life_seconds", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 1, name: "half_life_seconds", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 2, name: "hop_probability", kind: "scalar", T: 2 /*ScalarType.FLOAT*/ },
|
||||
{ no: 3, name: "weight", kind: "scalar", T: 2 /*ScalarType.FLOAT*/ },
|
||||
{ no: 4, name: "maximum_payment_results", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
||||
{ no: 5, name: "minimum_failure_relax_interval", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }
|
||||
{ no: 5, name: "minimum_failure_relax_interval", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<MissionControlConfig>): MissionControlConfig {
|
||||
const message = { halfLifeSeconds: 0n, hopProbability: 0, weight: 0, maximumPaymentResults: 0, minimumFailureRelaxInterval: 0n };
|
||||
const message = { halfLifeSeconds: 0, hopProbability: 0, weight: 0, maximumPaymentResults: 0, minimumFailureRelaxInterval: 0 };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<MissionControlConfig>(this, message, value);
|
||||
|
|
@ -2331,7 +2331,7 @@ class MissionControlConfig$Type extends MessageType<MissionControlConfig> {
|
|||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* uint64 half_life_seconds */ 1:
|
||||
message.halfLifeSeconds = reader.uint64().toBigInt();
|
||||
message.halfLifeSeconds = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* float hop_probability */ 2:
|
||||
message.hopProbability = reader.float();
|
||||
|
|
@ -2343,7 +2343,7 @@ class MissionControlConfig$Type extends MessageType<MissionControlConfig> {
|
|||
message.maximumPaymentResults = reader.uint32();
|
||||
break;
|
||||
case /* uint64 minimum_failure_relax_interval */ 5:
|
||||
message.minimumFailureRelaxInterval = reader.uint64().toBigInt();
|
||||
message.minimumFailureRelaxInterval = reader.uint64().toNumber();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
|
|
@ -2358,7 +2358,7 @@ class MissionControlConfig$Type extends MessageType<MissionControlConfig> {
|
|||
}
|
||||
internalBinaryWrite(message: MissionControlConfig, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
||||
/* uint64 half_life_seconds = 1; */
|
||||
if (message.halfLifeSeconds !== 0n)
|
||||
if (message.halfLifeSeconds !== 0)
|
||||
writer.tag(1, WireType.Varint).uint64(message.halfLifeSeconds);
|
||||
/* float hop_probability = 2; */
|
||||
if (message.hopProbability !== 0)
|
||||
|
|
@ -2370,7 +2370,7 @@ class MissionControlConfig$Type extends MessageType<MissionControlConfig> {
|
|||
if (message.maximumPaymentResults !== 0)
|
||||
writer.tag(4, WireType.Varint).uint32(message.maximumPaymentResults);
|
||||
/* uint64 minimum_failure_relax_interval = 5; */
|
||||
if (message.minimumFailureRelaxInterval !== 0n)
|
||||
if (message.minimumFailureRelaxInterval !== 0)
|
||||
writer.tag(5, WireType.Varint).uint64(message.minimumFailureRelaxInterval);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
|
|
@ -2388,11 +2388,11 @@ class QueryProbabilityRequest$Type extends MessageType<QueryProbabilityRequest>
|
|||
super("routerrpc.QueryProbabilityRequest", [
|
||||
{ no: 1, name: "from_node", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 2, name: "to_node", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 3, name: "amt_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
|
||||
{ no: 3, name: "amt_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<QueryProbabilityRequest>): QueryProbabilityRequest {
|
||||
const message = { fromNode: new Uint8Array(0), toNode: new Uint8Array(0), amtMsat: 0n };
|
||||
const message = { fromNode: new Uint8Array(0), toNode: new Uint8Array(0), amtMsat: 0 };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<QueryProbabilityRequest>(this, message, value);
|
||||
|
|
@ -2410,7 +2410,7 @@ class QueryProbabilityRequest$Type extends MessageType<QueryProbabilityRequest>
|
|||
message.toNode = reader.bytes();
|
||||
break;
|
||||
case /* int64 amt_msat */ 3:
|
||||
message.amtMsat = reader.int64().toBigInt();
|
||||
message.amtMsat = reader.int64().toNumber();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
|
|
@ -2431,7 +2431,7 @@ class QueryProbabilityRequest$Type extends MessageType<QueryProbabilityRequest>
|
|||
if (message.toNode.length)
|
||||
writer.tag(2, WireType.LengthDelimited).bytes(message.toNode);
|
||||
/* int64 amt_msat = 3; */
|
||||
if (message.amtMsat !== 0n)
|
||||
if (message.amtMsat !== 0)
|
||||
writer.tag(3, WireType.Varint).int64(message.amtMsat);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
|
|
@ -2501,7 +2501,7 @@ export const QueryProbabilityResponse = new QueryProbabilityResponse$Type();
|
|||
class BuildRouteRequest$Type extends MessageType<BuildRouteRequest> {
|
||||
constructor() {
|
||||
super("routerrpc.BuildRouteRequest", [
|
||||
{ no: 1, name: "amt_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 1, name: "amt_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 2, name: "final_cltv_delta", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
|
||||
{ no: 3, name: "outgoing_chan_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/ },
|
||||
{ no: 4, name: "hop_pubkeys", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 12 /*ScalarType.BYTES*/ },
|
||||
|
|
@ -2509,7 +2509,7 @@ class BuildRouteRequest$Type extends MessageType<BuildRouteRequest> {
|
|||
]);
|
||||
}
|
||||
create(value?: PartialMessage<BuildRouteRequest>): BuildRouteRequest {
|
||||
const message = { amtMsat: 0n, finalCltvDelta: 0, outgoingChanId: "0", hopPubkeys: [], paymentAddr: new Uint8Array(0) };
|
||||
const message = { amtMsat: 0, finalCltvDelta: 0, outgoingChanId: "0", hopPubkeys: [], paymentAddr: new Uint8Array(0) };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<BuildRouteRequest>(this, message, value);
|
||||
|
|
@ -2521,7 +2521,7 @@ class BuildRouteRequest$Type extends MessageType<BuildRouteRequest> {
|
|||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* int64 amt_msat */ 1:
|
||||
message.amtMsat = reader.int64().toBigInt();
|
||||
message.amtMsat = reader.int64().toNumber();
|
||||
break;
|
||||
case /* int32 final_cltv_delta */ 2:
|
||||
message.finalCltvDelta = reader.int32();
|
||||
|
|
@ -2548,7 +2548,7 @@ class BuildRouteRequest$Type extends MessageType<BuildRouteRequest> {
|
|||
}
|
||||
internalBinaryWrite(message: BuildRouteRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
||||
/* int64 amt_msat = 1; */
|
||||
if (message.amtMsat !== 0n)
|
||||
if (message.amtMsat !== 0)
|
||||
writer.tag(1, WireType.Varint).int64(message.amtMsat);
|
||||
/* int32 final_cltv_delta = 2; */
|
||||
if (message.finalCltvDelta !== 0)
|
||||
|
|
@ -2649,11 +2649,11 @@ export const SubscribeHtlcEventsRequest = new SubscribeHtlcEventsRequest$Type();
|
|||
class HtlcEvent$Type extends MessageType<HtlcEvent> {
|
||||
constructor() {
|
||||
super("routerrpc.HtlcEvent", [
|
||||
{ no: 1, name: "incoming_channel_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 2, name: "outgoing_channel_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 3, name: "incoming_htlc_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 4, name: "outgoing_htlc_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 5, name: "timestamp_ns", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 1, name: "incoming_channel_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 2, name: "outgoing_channel_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 3, name: "incoming_htlc_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 4, name: "outgoing_htlc_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 5, name: "timestamp_ns", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 6, name: "event_type", kind: "enum", T: () => ["routerrpc.HtlcEvent.EventType", HtlcEvent_EventType] },
|
||||
{ no: 7, name: "forward_event", kind: "message", oneof: "event", T: () => ForwardEvent },
|
||||
{ no: 8, name: "forward_fail_event", kind: "message", oneof: "event", T: () => ForwardFailEvent },
|
||||
|
|
@ -2664,7 +2664,7 @@ class HtlcEvent$Type extends MessageType<HtlcEvent> {
|
|||
]);
|
||||
}
|
||||
create(value?: PartialMessage<HtlcEvent>): HtlcEvent {
|
||||
const message = { incomingChannelId: 0n, outgoingChannelId: 0n, incomingHtlcId: 0n, outgoingHtlcId: 0n, timestampNs: 0n, eventType: 0, event: { oneofKind: undefined } };
|
||||
const message = { incomingChannelId: 0, outgoingChannelId: 0, incomingHtlcId: 0, outgoingHtlcId: 0, timestampNs: 0, eventType: 0, event: { oneofKind: undefined } };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<HtlcEvent>(this, message, value);
|
||||
|
|
@ -2676,19 +2676,19 @@ class HtlcEvent$Type extends MessageType<HtlcEvent> {
|
|||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* uint64 incoming_channel_id */ 1:
|
||||
message.incomingChannelId = reader.uint64().toBigInt();
|
||||
message.incomingChannelId = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* uint64 outgoing_channel_id */ 2:
|
||||
message.outgoingChannelId = reader.uint64().toBigInt();
|
||||
message.outgoingChannelId = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* uint64 incoming_htlc_id */ 3:
|
||||
message.incomingHtlcId = reader.uint64().toBigInt();
|
||||
message.incomingHtlcId = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* uint64 outgoing_htlc_id */ 4:
|
||||
message.outgoingHtlcId = reader.uint64().toBigInt();
|
||||
message.outgoingHtlcId = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* uint64 timestamp_ns */ 5:
|
||||
message.timestampNs = reader.uint64().toBigInt();
|
||||
message.timestampNs = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* routerrpc.HtlcEvent.EventType event_type */ 6:
|
||||
message.eventType = reader.int32();
|
||||
|
|
@ -2742,19 +2742,19 @@ class HtlcEvent$Type extends MessageType<HtlcEvent> {
|
|||
}
|
||||
internalBinaryWrite(message: HtlcEvent, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
||||
/* uint64 incoming_channel_id = 1; */
|
||||
if (message.incomingChannelId !== 0n)
|
||||
if (message.incomingChannelId !== 0)
|
||||
writer.tag(1, WireType.Varint).uint64(message.incomingChannelId);
|
||||
/* uint64 outgoing_channel_id = 2; */
|
||||
if (message.outgoingChannelId !== 0n)
|
||||
if (message.outgoingChannelId !== 0)
|
||||
writer.tag(2, WireType.Varint).uint64(message.outgoingChannelId);
|
||||
/* uint64 incoming_htlc_id = 3; */
|
||||
if (message.incomingHtlcId !== 0n)
|
||||
if (message.incomingHtlcId !== 0)
|
||||
writer.tag(3, WireType.Varint).uint64(message.incomingHtlcId);
|
||||
/* uint64 outgoing_htlc_id = 4; */
|
||||
if (message.outgoingHtlcId !== 0n)
|
||||
if (message.outgoingHtlcId !== 0)
|
||||
writer.tag(4, WireType.Varint).uint64(message.outgoingHtlcId);
|
||||
/* uint64 timestamp_ns = 5; */
|
||||
if (message.timestampNs !== 0n)
|
||||
if (message.timestampNs !== 0)
|
||||
writer.tag(5, WireType.Varint).uint64(message.timestampNs);
|
||||
/* routerrpc.HtlcEvent.EventType event_type = 6; */
|
||||
if (message.eventType !== 0)
|
||||
|
|
@ -2793,12 +2793,12 @@ class HtlcInfo$Type extends MessageType<HtlcInfo> {
|
|||
super("routerrpc.HtlcInfo", [
|
||||
{ no: 1, name: "incoming_timelock", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
||||
{ no: 2, name: "outgoing_timelock", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
||||
{ no: 3, name: "incoming_amt_msat", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 4, name: "outgoing_amt_msat", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }
|
||||
{ no: 3, name: "incoming_amt_msat", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 4, name: "outgoing_amt_msat", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<HtlcInfo>): HtlcInfo {
|
||||
const message = { incomingTimelock: 0, outgoingTimelock: 0, incomingAmtMsat: 0n, outgoingAmtMsat: 0n };
|
||||
const message = { incomingTimelock: 0, outgoingTimelock: 0, incomingAmtMsat: 0, outgoingAmtMsat: 0 };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<HtlcInfo>(this, message, value);
|
||||
|
|
@ -2816,10 +2816,10 @@ class HtlcInfo$Type extends MessageType<HtlcInfo> {
|
|||
message.outgoingTimelock = reader.uint32();
|
||||
break;
|
||||
case /* uint64 incoming_amt_msat */ 3:
|
||||
message.incomingAmtMsat = reader.uint64().toBigInt();
|
||||
message.incomingAmtMsat = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* uint64 outgoing_amt_msat */ 4:
|
||||
message.outgoingAmtMsat = reader.uint64().toBigInt();
|
||||
message.outgoingAmtMsat = reader.uint64().toNumber();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
|
|
@ -2840,10 +2840,10 @@ class HtlcInfo$Type extends MessageType<HtlcInfo> {
|
|||
if (message.outgoingTimelock !== 0)
|
||||
writer.tag(2, WireType.Varint).uint32(message.outgoingTimelock);
|
||||
/* uint64 incoming_amt_msat = 3; */
|
||||
if (message.incomingAmtMsat !== 0n)
|
||||
if (message.incomingAmtMsat !== 0)
|
||||
writer.tag(3, WireType.Varint).uint64(message.incomingAmtMsat);
|
||||
/* uint64 outgoing_amt_msat = 4; */
|
||||
if (message.outgoingAmtMsat !== 0n)
|
||||
if (message.outgoingAmtMsat !== 0)
|
||||
writer.tag(4, WireType.Varint).uint64(message.outgoingAmtMsat);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
|
|
@ -3188,12 +3188,12 @@ export const PaymentStatus = new PaymentStatus$Type();
|
|||
class CircuitKey$Type extends MessageType<CircuitKey> {
|
||||
constructor() {
|
||||
super("routerrpc.CircuitKey", [
|
||||
{ no: 1, name: "chan_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 2, name: "htlc_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }
|
||||
{ no: 1, name: "chan_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 2, name: "htlc_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<CircuitKey>): CircuitKey {
|
||||
const message = { chanId: 0n, htlcId: 0n };
|
||||
const message = { chanId: 0, htlcId: 0 };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<CircuitKey>(this, message, value);
|
||||
|
|
@ -3205,10 +3205,10 @@ class CircuitKey$Type extends MessageType<CircuitKey> {
|
|||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* uint64 chan_id */ 1:
|
||||
message.chanId = reader.uint64().toBigInt();
|
||||
message.chanId = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* uint64 htlc_id */ 2:
|
||||
message.htlcId = reader.uint64().toBigInt();
|
||||
message.htlcId = reader.uint64().toNumber();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
|
|
@ -3223,10 +3223,10 @@ class CircuitKey$Type extends MessageType<CircuitKey> {
|
|||
}
|
||||
internalBinaryWrite(message: CircuitKey, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
||||
/* uint64 chan_id = 1; */
|
||||
if (message.chanId !== 0n)
|
||||
if (message.chanId !== 0)
|
||||
writer.tag(1, WireType.Varint).uint64(message.chanId);
|
||||
/* uint64 htlc_id = 2; */
|
||||
if (message.htlcId !== 0n)
|
||||
if (message.htlcId !== 0)
|
||||
writer.tag(2, WireType.Varint).uint64(message.htlcId);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
|
|
@ -3243,11 +3243,11 @@ class ForwardHtlcInterceptRequest$Type extends MessageType<ForwardHtlcInterceptR
|
|||
constructor() {
|
||||
super("routerrpc.ForwardHtlcInterceptRequest", [
|
||||
{ no: 1, name: "incoming_circuit_key", kind: "message", T: () => CircuitKey },
|
||||
{ no: 5, name: "incoming_amount_msat", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 5, name: "incoming_amount_msat", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 6, name: "incoming_expiry", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
||||
{ no: 2, name: "payment_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 7, name: "outgoing_requested_chan_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 3, name: "outgoing_amount_msat", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 7, name: "outgoing_requested_chan_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 3, name: "outgoing_amount_msat", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
|
||||
{ no: 4, name: "outgoing_expiry", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
||||
{ no: 8, name: "custom_records", kind: "map", K: 4 /*ScalarType.UINT64*/, V: { kind: "scalar", T: 12 /*ScalarType.BYTES*/ } },
|
||||
{ no: 9, name: "onion_blob", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
|
|
@ -3255,7 +3255,7 @@ class ForwardHtlcInterceptRequest$Type extends MessageType<ForwardHtlcInterceptR
|
|||
]);
|
||||
}
|
||||
create(value?: PartialMessage<ForwardHtlcInterceptRequest>): ForwardHtlcInterceptRequest {
|
||||
const message = { incomingAmountMsat: 0n, incomingExpiry: 0, paymentHash: new Uint8Array(0), outgoingRequestedChanId: 0n, outgoingAmountMsat: 0n, outgoingExpiry: 0, customRecords: {}, onionBlob: new Uint8Array(0), autoFailHeight: 0 };
|
||||
const message = { incomingAmountMsat: 0, incomingExpiry: 0, paymentHash: new Uint8Array(0), outgoingRequestedChanId: 0, outgoingAmountMsat: 0, outgoingExpiry: 0, customRecords: {}, onionBlob: new Uint8Array(0), autoFailHeight: 0 };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<ForwardHtlcInterceptRequest>(this, message, value);
|
||||
|
|
@ -3270,7 +3270,7 @@ class ForwardHtlcInterceptRequest$Type extends MessageType<ForwardHtlcInterceptR
|
|||
message.incomingCircuitKey = CircuitKey.internalBinaryRead(reader, reader.uint32(), options, message.incomingCircuitKey);
|
||||
break;
|
||||
case /* uint64 incoming_amount_msat */ 5:
|
||||
message.incomingAmountMsat = reader.uint64().toBigInt();
|
||||
message.incomingAmountMsat = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* uint32 incoming_expiry */ 6:
|
||||
message.incomingExpiry = reader.uint32();
|
||||
|
|
@ -3279,10 +3279,10 @@ class ForwardHtlcInterceptRequest$Type extends MessageType<ForwardHtlcInterceptR
|
|||
message.paymentHash = reader.bytes();
|
||||
break;
|
||||
case /* uint64 outgoing_requested_chan_id */ 7:
|
||||
message.outgoingRequestedChanId = reader.uint64().toBigInt();
|
||||
message.outgoingRequestedChanId = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* uint64 outgoing_amount_msat */ 3:
|
||||
message.outgoingAmountMsat = reader.uint64().toBigInt();
|
||||
message.outgoingAmountMsat = reader.uint64().toNumber();
|
||||
break;
|
||||
case /* uint32 outgoing_expiry */ 4:
|
||||
message.outgoingExpiry = reader.uint32();
|
||||
|
|
@ -3328,7 +3328,7 @@ class ForwardHtlcInterceptRequest$Type extends MessageType<ForwardHtlcInterceptR
|
|||
if (message.incomingCircuitKey)
|
||||
CircuitKey.internalBinaryWrite(message.incomingCircuitKey, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
||||
/* uint64 incoming_amount_msat = 5; */
|
||||
if (message.incomingAmountMsat !== 0n)
|
||||
if (message.incomingAmountMsat !== 0)
|
||||
writer.tag(5, WireType.Varint).uint64(message.incomingAmountMsat);
|
||||
/* uint32 incoming_expiry = 6; */
|
||||
if (message.incomingExpiry !== 0)
|
||||
|
|
@ -3337,10 +3337,10 @@ class ForwardHtlcInterceptRequest$Type extends MessageType<ForwardHtlcInterceptR
|
|||
if (message.paymentHash.length)
|
||||
writer.tag(2, WireType.LengthDelimited).bytes(message.paymentHash);
|
||||
/* uint64 outgoing_requested_chan_id = 7; */
|
||||
if (message.outgoingRequestedChanId !== 0n)
|
||||
if (message.outgoingRequestedChanId !== 0)
|
||||
writer.tag(7, WireType.Varint).uint64(message.outgoingRequestedChanId);
|
||||
/* uint64 outgoing_amount_msat = 3; */
|
||||
if (message.outgoingAmountMsat !== 0n)
|
||||
if (message.outgoingAmountMsat !== 0)
|
||||
writer.tag(3, WireType.Varint).uint64(message.outgoingAmountMsat);
|
||||
/* uint32 outgoing_expiry = 4; */
|
||||
if (message.outgoingExpiry !== 0)
|
||||
|
|
|
|||
|
|
@ -1,60 +1,51 @@
|
|||
import 'dotenv/config' // TODO - test env
|
||||
import { AfterAll, BeforeAll, expect, FTest, Test, TestSuite } from 'testyts';
|
||||
import NewServer from '../proto/autogenerated/ts/express_server'
|
||||
import NewClient from '../proto/autogenerated/ts/http_client'
|
||||
import methods from './services/serverMethods';
|
||||
import serverOptions from './auth';
|
||||
import GetServerMethods from './services/serverMethods'
|
||||
import Main, { LoadMainSettingsFromEnv } from './services/main'
|
||||
import * as Types from '../proto/autogenerated/ts/types';
|
||||
import NewServer from '../proto/autogenerated/ts/express_server.js'
|
||||
import NewClient from '../proto/autogenerated/ts/http_client.js'
|
||||
import serverOptions from './auth.js';
|
||||
import GetServerMethods from './services/serverMethods/index.js'
|
||||
import Main, { LoadMainSettingsFromEnv } from './services/main/index.js'
|
||||
import * as Types from '../proto/autogenerated/ts/types.js';
|
||||
const testPort = 4000
|
||||
|
||||
@TestSuite()
|
||||
export class ServerTestSuite {
|
||||
userAuthHeader = ""
|
||||
client = NewClient({
|
||||
var userAuthHeader = ""
|
||||
const client = NewClient({
|
||||
baseUrl: `http://localhost:${testPort}`,
|
||||
retrieveAdminAuth: async () => (""),
|
||||
retrieveGuestAuth: async () => (""),
|
||||
retrieveUserAuth: async () => this.userAuthHeader,
|
||||
retrieveUserAuth: async () => userAuthHeader,
|
||||
decryptCallback: async (b) => b,
|
||||
encryptCallback: async (b) => b,
|
||||
deviceId: "device0"
|
||||
})
|
||||
mainHandler = new Main(LoadMainSettingsFromEnv(true)) // TODO - test env file
|
||||
server = NewServer(GetServerMethods(this.mainHandler), { ...serverOptions(this.mainHandler), throwErrors: true })
|
||||
})
|
||||
const mainHandler = new Main(LoadMainSettingsFromEnv(true)) // TODO - test env file
|
||||
const server = NewServer(GetServerMethods(mainHandler), { ...serverOptions(mainHandler), throwErrors: true })
|
||||
export const ignore = true
|
||||
|
||||
export const setup = async () => {
|
||||
await mainHandler.storage.Connect()
|
||||
await mainHandler.lnd.Warmup()
|
||||
server.Listen(testPort)
|
||||
}
|
||||
export const teardown = async () => {
|
||||
mainHandler.lnd.Stop()
|
||||
server.Close()
|
||||
}
|
||||
|
||||
|
||||
@BeforeAll()
|
||||
async startServer() {
|
||||
await this.mainHandler.storage.Connect()
|
||||
await this.mainHandler.lnd.Warmup()
|
||||
this.server.Listen(testPort)
|
||||
}
|
||||
@AfterAll()
|
||||
stopServer() {
|
||||
this.server.Close()
|
||||
}
|
||||
@Test()
|
||||
async health() {
|
||||
await this.client.Health()
|
||||
}
|
||||
export default async (d: (message: string, failure?: boolean) => void) => {
|
||||
await client.Health()
|
||||
d("health ok")
|
||||
|
||||
@Test()
|
||||
async getInfo() {
|
||||
console.log(await this.client.LndGetInfo({ node_id: 0 }))
|
||||
}
|
||||
@Test()
|
||||
async createUser() {
|
||||
const res = await this.client.AddUser({ name: "test", callback_url: "http://...", secret: "shhhhhht" })
|
||||
console.log(await client.LndGetInfo({ node_id: 0 }))
|
||||
d("lnd info ok")
|
||||
|
||||
const res = await client.AddUser({ name: "test", callback_url: "http://...", secret: "shhhhhht" })
|
||||
if (res.status === 'ERROR') throw new Error(res.reason)
|
||||
console.log(res.result)
|
||||
const user = await this.mainHandler.storage.GetUser(res.result.user_id)
|
||||
const user = await mainHandler.storage.GetUser(res.result.user_id)
|
||||
console.log(user)
|
||||
this.userAuthHeader = res.result.auth_token
|
||||
}
|
||||
@Test()
|
||||
async newAddress() {
|
||||
console.log(await this.client.NewAddress({ address_type: Types.AddressType.WITNESS_PUBKEY_HASH }))
|
||||
}
|
||||
userAuthHeader = res.result.auth_token
|
||||
d("create user ok")
|
||||
|
||||
console.log(await client.NewAddress({ address_type: Types.AddressType.WITNESS_PUBKEY_HASH }))
|
||||
d("new address ok")
|
||||
}
|
||||
11
src/index.ts
11
src/index.ts
|
|
@ -3,9 +3,14 @@ import NewServer from '../proto/autogenerated/ts/express_server'
|
|||
import GetServerMethods from './services/serverMethods'
|
||||
import serverOptions from './auth';
|
||||
import Main, { LoadMainSettingsFromEnv } from './services/main'
|
||||
(async () => {
|
||||
|
||||
const start = async () => {
|
||||
const mainHandler = new Main(LoadMainSettingsFromEnv())
|
||||
await mainHandler.storage.Connect()
|
||||
const Server = NewServer(GetServerMethods(mainHandler), serverOptions(mainHandler))
|
||||
|
||||
const serverMethods = GetServerMethods(mainHandler)
|
||||
|
||||
const Server = NewServer(serverMethods, serverOptions(mainHandler))
|
||||
Server.Listen(3000)
|
||||
})()
|
||||
}
|
||||
start()
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
import { OpenChannelRequest, Invoice } from "../../../proto/lnd/lightning";
|
||||
|
||||
export const AddInvoiceReq = (value: number, memo = "", privateHints = false, expiry = 60 * 60): Invoice => ({
|
||||
expiry: BigInt(expiry),
|
||||
expiry: expiry,
|
||||
memo: memo,
|
||||
private: privateHints,
|
||||
value: BigInt(value),
|
||||
value: value,
|
||||
|
||||
fallbackAddr: "",
|
||||
cltvExpiry: 0n,
|
||||
cltvExpiry: 0,
|
||||
descriptionHash: Buffer.alloc(0),
|
||||
features: {},
|
||||
isAmp: false,
|
||||
rPreimage: Buffer.alloc(0),
|
||||
routeHints: [],
|
||||
valueMsat: 0n,
|
||||
valueMsat: 0,
|
||||
|
||||
addIndex: 0n,
|
||||
addIndex: 0,
|
||||
ampInvoiceState: {},
|
||||
amtPaidMsat: 0n,
|
||||
amtPaidSat: 0n,
|
||||
creationDate: 0n,
|
||||
amtPaidMsat: 0,
|
||||
amtPaidSat: 0,
|
||||
creationDate: 0,
|
||||
htlcs: [],
|
||||
isKeysend: false,
|
||||
paymentAddr: Buffer.alloc(0),
|
||||
paymentRequest: "",
|
||||
rHash: Buffer.alloc(0),
|
||||
settleDate: 0n,
|
||||
settleIndex: 0n,
|
||||
settleDate: 0,
|
||||
settleIndex: 0,
|
||||
state: 0,
|
||||
|
||||
amtPaid: 0n,
|
||||
amtPaid: 0,
|
||||
settled: false,
|
||||
})
|
||||
|
|
@ -1,42 +1,31 @@
|
|||
import 'dotenv/config' // TODO - test env
|
||||
import { AfterAll, BeforeAll, expect, FTest, FTestSuite, Test, TestSuite } from 'testyts';
|
||||
import LndHandler, { LoadLndSettingsFromEnv } from '.'
|
||||
import * as Types from '../../../proto/autogenerated/ts/types';
|
||||
@TestSuite()
|
||||
export class LndTestSuite {
|
||||
lnd: LndHandler
|
||||
@BeforeAll()
|
||||
async createLnd() {
|
||||
this.lnd = new LndHandler(LoadLndSettingsFromEnv(true), console.log, console.log)
|
||||
await this.lnd.Warmup()
|
||||
}
|
||||
@AfterAll()
|
||||
stopStreams() {
|
||||
}
|
||||
@Test()
|
||||
async getAlias() {
|
||||
const res = await this.lnd.GetInfo()
|
||||
expect.toBeEqual(res.alias, "alice")
|
||||
}
|
||||
@Test()
|
||||
async newAddress() {
|
||||
const res = await this.lnd.NewAddress(Types.AddressType.WITNESS_PUBKEY_HASH)
|
||||
console.log(res)
|
||||
}
|
||||
@Test()
|
||||
async newInvoice() {
|
||||
const res = await this.lnd.NewInvoice(1000)
|
||||
console.log(res)
|
||||
}
|
||||
@FTest()
|
||||
async estimateFees() {
|
||||
const res = await this.lnd.EstimateChainFees("bcrt1qajzzx453x9fx5gtlyax8zrsennckrw3syd2llt", 1000, 100)
|
||||
console.log(res)
|
||||
}
|
||||
|
||||
@Test()
|
||||
async openChannel() {
|
||||
//const res = await this.lnd.OpenChannel("025ed7fc85fc05a07fc5acc13a6e3836cd11c5587c1d400afcd22630a9e230eb7a", "", 20000, 0)
|
||||
}
|
||||
|
||||
import { expect } from 'chai'
|
||||
import LndHandler, { LoadLndSettingsFromEnv } from './index.js'
|
||||
import * as Types from '../../../proto/autogenerated/ts/types.js';
|
||||
const lnd = new LndHandler(LoadLndSettingsFromEnv(true), console.log, console.log)
|
||||
export const ignore = true
|
||||
export const setup = async () => {
|
||||
await lnd.Warmup()
|
||||
}
|
||||
export const teardown = () => {
|
||||
lnd.Stop()
|
||||
}
|
||||
|
||||
export default async (d: (message: string, failure?: boolean) => void) => {
|
||||
const info = await lnd.GetInfo()
|
||||
expect(info.alias).to.equal("alice")
|
||||
d("get alias ok")
|
||||
|
||||
const addr = await lnd.NewAddress(Types.AddressType.WITNESS_PUBKEY_HASH)
|
||||
console.log(addr)
|
||||
d("new address ok")
|
||||
|
||||
const invoice = await lnd.NewInvoice(1000)
|
||||
console.log(invoice)
|
||||
d("new invoice ok")
|
||||
|
||||
const res = await lnd.EstimateChainFees("bcrt1qajzzx453x9fx5gtlyax8zrsennckrw3syd2llt", 1000, 100)
|
||||
console.log(res)
|
||||
d("estimate fee ok")
|
||||
//const res = await this.lnd.OpenChannel("025ed7fc85fc05a07fc5acc13a6e3836cd11c5587c1d400afcd22630a9e230eb7a", "", 20000, 0)
|
||||
}
|
||||
|
|
@ -2,16 +2,16 @@
|
|||
import { credentials, Metadata } from '@grpc/grpc-js'
|
||||
import { GrpcTransport } from "@protobuf-ts/grpc-transport";
|
||||
import fs from 'fs'
|
||||
import * as Types from '../../../proto/autogenerated/ts/types'
|
||||
import { LightningClient } from '../../../proto/lnd/lightning.client'
|
||||
import { InvoicesClient } from '../../../proto/lnd/invoices.client'
|
||||
import { RouterClient } from '../../../proto/lnd/router.client'
|
||||
import { GetInfoResponse, AddressType, NewAddressResponse, AddInvoiceResponse, Invoice_InvoiceState, PayReq, Payment_PaymentStatus, Payment } from '../../../proto/lnd/lightning'
|
||||
import { OpenChannelReq } from './openChannelReq';
|
||||
import { AddInvoiceReq } from './addInvoiceReq';
|
||||
import { PayInvoiceReq } from './payInvoiceReq';
|
||||
import { SendCoinsReq } from './sendCoinsReq';
|
||||
import { EnvMustBeInteger, EnvMustBeNonEmptyString } from '../helpers/envParser';
|
||||
import * as Types from '../../../proto/autogenerated/ts/types.js'
|
||||
import { LightningClient } from '../../../proto/lnd/lightning.client.js'
|
||||
import { InvoicesClient } from '../../../proto/lnd/invoices.client.js'
|
||||
import { RouterClient } from '../../../proto/lnd/router.client.js'
|
||||
import { GetInfoResponse, AddressType, NewAddressResponse, AddInvoiceResponse, Invoice_InvoiceState, PayReq, Payment_PaymentStatus, Payment } from '../../../proto/lnd/lightning.js'
|
||||
import { OpenChannelReq } from './openChannelReq.js';
|
||||
import { AddInvoiceReq } from './addInvoiceReq.js';
|
||||
import { PayInvoiceReq } from './payInvoiceReq.js';
|
||||
import { SendCoinsReq } from './sendCoinsReq.js';
|
||||
import { EnvMustBeInteger, EnvMustBeNonEmptyString } from '../helpers/envParser.js';
|
||||
const DeadLineMetadata = (deadline = 10 * 1000) => ({ deadline: Date.now() + deadline })
|
||||
export type LndSettings = {
|
||||
lndAddr: string
|
||||
|
|
@ -107,8 +107,8 @@ export default class {
|
|||
|
||||
SubscribeInvoicePaid() {
|
||||
const stream = this.lightning.subscribeInvoices({
|
||||
settleIndex: BigInt(this.latestKnownSettleIndex),
|
||||
addIndex: 0n,
|
||||
settleIndex: this.latestKnownSettleIndex,
|
||||
addIndex: 0,
|
||||
}, { abort: this.abortController.signal })
|
||||
stream.responses.onMessage(invoice => {
|
||||
if (invoice.state === Invoice_InvoiceState.SETTLED) {
|
||||
|
|
@ -176,8 +176,9 @@ export default class {
|
|||
}
|
||||
|
||||
async EstimateChainFees(address: string, amount: number, targetConf: number) {
|
||||
this.checkReady()
|
||||
const res = await this.lightning.estimateFee({
|
||||
addrToAmount: { [address]: BigInt(amount) },
|
||||
addrToAmount: { [address]: amount },
|
||||
minConfs: 1,
|
||||
spendUnconfirmed: false,
|
||||
targetConf: targetConf
|
||||
|
|
|
|||
|
|
@ -3,23 +3,23 @@ import { OpenChannelRequest } from "../../../proto/lnd/lightning";
|
|||
export const OpenChannelReq = (destination: string, closeAddress: string, fundingAmount: number, pushSats: number): OpenChannelRequest => ({
|
||||
nodePubkey: Buffer.from(destination, 'hex'),
|
||||
closeAddress: closeAddress,
|
||||
localFundingAmount: BigInt(fundingAmount),
|
||||
pushSat: BigInt(pushSats),
|
||||
localFundingAmount: fundingAmount,
|
||||
pushSat: pushSats,
|
||||
|
||||
satPerVbyte: 0n, // TBD
|
||||
satPerVbyte: 0, // TBD
|
||||
private: false,
|
||||
minConfs: 0, // TBD
|
||||
baseFee: 0n, // TBD
|
||||
feeRate: 0n, // TBD
|
||||
baseFee: 0, // TBD
|
||||
feeRate: 0, // TBD
|
||||
targetConf: 0,
|
||||
zeroConf: false,
|
||||
maxLocalCsv: 0,
|
||||
remoteCsvDelay: 0,
|
||||
spendUnconfirmed: false,
|
||||
minHtlcMsat: 0n,
|
||||
remoteChanReserveSat: 0n,
|
||||
minHtlcMsat: 0,
|
||||
remoteChanReserveSat: 0,
|
||||
remoteMaxHtlcs: 0,
|
||||
remoteMaxValueInFlightMsat: 0n,
|
||||
remoteMaxValueInFlightMsat: 0,
|
||||
useBaseFee: false,
|
||||
useFeeRate: false,
|
||||
|
||||
|
|
@ -27,6 +27,7 @@ export const OpenChannelReq = (destination: string, closeAddress: string, fundin
|
|||
commitmentType: 0,
|
||||
scidAlias: false,
|
||||
nodePubkeyString: "",
|
||||
satPerByte: 0n,
|
||||
satPerByte: 0,
|
||||
|
||||
fundingShim: undefined
|
||||
})
|
||||
|
|
@ -2,8 +2,8 @@ import { OpenChannelRequest } from "../../../proto/lnd/lightning";
|
|||
import { SendPaymentRequest } from "../../../proto/lnd/router";
|
||||
|
||||
export const PayInvoiceReq = (invoice: string, amount: number, feeLimit: number): SendPaymentRequest => ({
|
||||
amt: BigInt(amount),
|
||||
feeLimitSat: BigInt(feeLimit),
|
||||
amt: amount,
|
||||
feeLimitSat: feeLimit,
|
||||
noInflightUpdates: true,
|
||||
paymentRequest: invoice,
|
||||
maxParts: 3,
|
||||
|
|
@ -11,15 +11,15 @@ export const PayInvoiceReq = (invoice: string, amount: number, feeLimit: number)
|
|||
|
||||
allowSelfPayment: false,
|
||||
amp: false,
|
||||
amtMsat: 0n,
|
||||
amtMsat: 0,
|
||||
cltvLimit: 0,
|
||||
dest: Buffer.alloc(0),
|
||||
destCustomRecords: {},
|
||||
destFeatures: [],
|
||||
feeLimitMsat: 0n,
|
||||
feeLimitMsat: 0,
|
||||
finalCltvDelta: 0,
|
||||
lastHopPubkey: Buffer.alloc(0),
|
||||
maxShardSizeMsat: 0n,
|
||||
maxShardSizeMsat: 0,
|
||||
outgoingChanIds: [],
|
||||
paymentAddr: Buffer.alloc(0),
|
||||
paymentHash: Buffer.alloc(0),
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ import { SendCoinsRequest } from "../../../proto/lnd/lightning";
|
|||
|
||||
export const SendCoinsReq = (address: string, amount: number, satPerVByte: number, label = ""): SendCoinsRequest => ({
|
||||
addr: address,
|
||||
amount: BigInt(amount),
|
||||
amount: amount,
|
||||
label: label,
|
||||
satPerVbyte: BigInt(satPerVByte),
|
||||
satPerVbyte: satPerVByte,
|
||||
targetConf: 0,
|
||||
minConfs: 1,
|
||||
sendAll: false,
|
||||
spendUnconfirmed: false,
|
||||
satPerByte: 0n
|
||||
satPerByte: 0
|
||||
})
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import jwt from 'jsonwebtoken'
|
||||
import Storage, { LoadStorageSettingsFromEnv, StorageSettings } from '../storage'
|
||||
import * as Types from '../../../proto/autogenerated/ts/types'
|
||||
import LND, { AddressPaidCb, InvoicePaidCb, LndSettings, LoadLndSettingsFromEnv } from '../lnd'
|
||||
import { EnvMustBeInteger, EnvMustBeNonEmptyString } from '../helpers/envParser'
|
||||
import Storage, { LoadStorageSettingsFromEnv, StorageSettings } from '../storage/index.js'
|
||||
import * as Types from '../../../proto/autogenerated/ts/types.js'
|
||||
import LND, { AddressPaidCb, InvoicePaidCb, LndSettings, LoadLndSettingsFromEnv } from '../lnd/index.js'
|
||||
import { EnvMustBeInteger, EnvMustBeNonEmptyString } from '../helpers/envParser.js'
|
||||
export type MainSettings = {
|
||||
storageSettings: StorageSettings,
|
||||
lndSettings: LndSettings,
|
||||
|
|
@ -58,9 +58,13 @@ export default class {
|
|||
const userAddress = await this.storage.GetAddressOwner(address, tx)
|
||||
if (!userAddress) { return }
|
||||
const fee = this.getServiceFee(ActionType.INCOMING_TX, amount)
|
||||
try {
|
||||
// This call will fail if the transaction is already registered
|
||||
const addedTx = await this.storage.AddAddressReceivingTransaction(userAddress, txOutput.hash, txOutput.index, amount, fee, tx)
|
||||
await this.storage.IncrementUserBalance(userAddress.user.user_id, addedTx.amount, tx)
|
||||
} catch {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
invoicePaidCb: InvoicePaidCb = (paymentRequest, amount) => {
|
||||
|
|
@ -68,9 +72,11 @@ export default class {
|
|||
const userInvoice = await this.storage.GetInvoiceOwner(paymentRequest, tx)
|
||||
if (!userInvoice || userInvoice.paid) { return }
|
||||
const fee = this.getServiceFee(ActionType.INCOMING_INVOICE, amount)
|
||||
try {
|
||||
// This call will fail if the invoice is already registered
|
||||
await this.storage.FlagInvoiceAsPaid(userInvoice, amount, fee, tx)
|
||||
await this.storage.IncrementUserBalance(userInvoice.user.user_id, amount, tx)
|
||||
} catch { }
|
||||
})
|
||||
}
|
||||
SignUserToken(userId: string): string {
|
||||
|
|
@ -119,10 +125,10 @@ export default class {
|
|||
|
||||
async PayInvoice(userId: string, req: Types.PayInvoiceRequest): Promise<Types.PayInvoiceResponse> {
|
||||
const decoded = await this.lnd.DecodeInvoice(req.invoice)
|
||||
if (decoded.numSatoshis !== 0n && req.amount !== 0) {
|
||||
if (decoded.numSatoshis !== 0 && req.amount !== 0) {
|
||||
throw new Error("invoice has value, do not provide amount the the request")
|
||||
}
|
||||
if (decoded.numSatoshis === 0n && req.amount === 0) {
|
||||
if (decoded.numSatoshis === 0 && req.amount === 0) {
|
||||
throw new Error("invoice has no value, an amount must be provided in the request")
|
||||
}
|
||||
const payAmount = req.amount !== 0 ? req.amount : Number(decoded.numSatoshis)
|
||||
|
|
|
|||
40
src/services/nostr/index.spec.ts
Normal file
40
src/services/nostr/index.spec.ts
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import 'dotenv/config' // TODO - test env
|
||||
import { Buffer } from 'buffer'
|
||||
import { generatePrivateKey, getPublicKey, relayPool } from 'nostr-tools'
|
||||
//@ts-ignore
|
||||
import { decrypt, encrypt } from 'nostr-tools/nip04.js'
|
||||
import NostrHandler, { LoadNosrtSettingsFromEnv, NostrSettings } from './index.js'
|
||||
const settings = LoadNosrtSettingsFromEnv(true)
|
||||
const clientPool = relayPool()
|
||||
const clientPrivateKey = generatePrivateKey()
|
||||
const clientPublicKey = getPublicKey(Buffer.from(clientPrivateKey, "hex"))
|
||||
|
||||
settings.privateKey = generatePrivateKey()
|
||||
settings.publicKey = getPublicKey(Buffer.from(settings.privateKey, "hex"))
|
||||
settings.allowedPubs = [clientPublicKey]
|
||||
|
||||
const nostr = new NostrHandler(settings, async id => { console.log(id); return true })
|
||||
clientPool.setPrivateKey(clientPrivateKey)
|
||||
export const setup = () => {
|
||||
settings.relays.forEach(relay => {
|
||||
try {
|
||||
clientPool.addRelay(relay, { read: true, write: true })
|
||||
} catch (e) {
|
||||
console.error("cannot add relay:", relay)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default async (d: (message: string, failure?: boolean) => void) => {
|
||||
const e = await clientPool.publish({
|
||||
content: encrypt(clientPrivateKey, settings.publicKey, "test"),
|
||||
created_at: Math.floor(Date.now() / 1000),
|
||||
kind: 4,
|
||||
pubkey: clientPublicKey,
|
||||
//@ts-ignore
|
||||
tags: [['p', settings.publicKey]]
|
||||
}, (status, url) => {
|
||||
console.log(status, url)
|
||||
})
|
||||
d("nostr ok")
|
||||
}
|
||||
48
src/services/nostr/index.ts
Normal file
48
src/services/nostr/index.ts
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import { relayPool, Subscription } from 'nostr-tools'
|
||||
//@ts-ignore
|
||||
import { decrypt, encrypt } from 'nostr-tools/nip04.js'
|
||||
import { EnvMustBeNonEmptyString } from '../helpers/envParser.js';
|
||||
|
||||
export type NostrSettings = {
|
||||
privateKey: string
|
||||
publicKey: string
|
||||
relays: string[]
|
||||
allowedPubs: string[]
|
||||
}
|
||||
export const LoadNosrtSettingsFromEnv = (test = false): NostrSettings => {
|
||||
return {
|
||||
allowedPubs: EnvMustBeNonEmptyString("NOSTR_ALLOWED_PUBS").split(' '),
|
||||
privateKey: EnvMustBeNonEmptyString("NOSTR_PRIVATE_KEY"),
|
||||
publicKey: EnvMustBeNonEmptyString("NOSTR_PUBLIC_KEY"),
|
||||
relays: EnvMustBeNonEmptyString("NOSTR_RELAYS").split(' ')
|
||||
}
|
||||
}
|
||||
export default class {
|
||||
shouldHandleEvent: (eventId: string) => Promise<boolean>
|
||||
pool = relayPool()
|
||||
settings: NostrSettings
|
||||
sub: Subscription
|
||||
constructor(settings: NostrSettings, shouldHandleCb: (eventId: string) => Promise<boolean>) {
|
||||
this.settings = settings
|
||||
this.shouldHandleEvent = shouldHandleCb
|
||||
this.pool.setPrivateKey(settings.privateKey)
|
||||
settings.relays.forEach(relay => {
|
||||
try {
|
||||
this.pool.addRelay(relay, { read: true, write: true })
|
||||
} catch (e) {
|
||||
console.error("cannot add relay:", relay)
|
||||
}
|
||||
});
|
||||
this.sub = this.pool.sub({
|
||||
//@ts-ignore
|
||||
filter: {
|
||||
kinds: [4],
|
||||
'#p': [settings.publicKey],
|
||||
authors: settings.allowedPubs,
|
||||
},
|
||||
cb: async (event, relay) => {
|
||||
console.log(decrypt(this.settings.privateKey, event.pubkey, event.content))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import * as Types from '../../../proto/autogenerated/ts/types'
|
||||
import Main from '../main'
|
||||
import * as Types from '../../../proto/autogenerated/ts/types.js'
|
||||
import Main from '../main/index.js'
|
||||
export default (mainHandler: Main): Types.ServerMethods => {
|
||||
return {
|
||||
EncryptionExchange: async (ctx: Types.EncryptionExchange_Context, req: Types.EncryptionExchangeRequest): Promise<void> => { },
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import "reflect-metadata"
|
||||
import { DataSource } from "typeorm"
|
||||
import { AddressReceivingTransaction } from "./entity/AddressReceivingTransaction"
|
||||
import { User } from "./entity/User"
|
||||
import { UserReceivingAddress } from "./entity/UserReceivingAddress"
|
||||
import { UserReceivingInvoice } from "./entity/UserReceivingInvoice"
|
||||
import { UserInvoicePayment } from "./entity/UserInvoicePayment"
|
||||
import { EnvMustBeNonEmptyString } from "../helpers/envParser"
|
||||
import { UserTransactionPayment } from "./entity/UserTransactionPayment"
|
||||
import { AddressReceivingTransaction } from "./entity/AddressReceivingTransaction.js"
|
||||
import { User } from "./entity/User.js"
|
||||
import { UserReceivingAddress } from "./entity/UserReceivingAddress.js"
|
||||
import { UserReceivingInvoice } from "./entity/UserReceivingInvoice.js"
|
||||
import { UserInvoicePayment } from "./entity/UserInvoicePayment.js"
|
||||
import { EnvMustBeNonEmptyString } from "../helpers/envParser.js"
|
||||
import { UserTransactionPayment } from "./entity/UserTransactionPayment.js"
|
||||
export type DbSettings = {
|
||||
databaseFile: string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
|
||||
import { User } from "./User"
|
||||
import { UserReceivingAddress } from "./UserReceivingAddress"
|
||||
|
||||
import { UserReceivingAddress } from "./UserReceivingAddress.js"
|
||||
|
||||
@Entity()
|
||||
@Index("address_transaction_unique", ["tx_hash", "output_index"], { unique: true })
|
||||
@Index("address_receiving_transaction_unique", ["tx_hash", "output_index"], { unique: true })
|
||||
export class AddressReceivingTransaction {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
|
||||
import { User } from "./User"
|
||||
import { User } from "./User.js"
|
||||
|
||||
@Entity()
|
||||
export class UserInvoicePayment {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
|
||||
import { User } from "./User"
|
||||
import { User } from "./User.js"
|
||||
|
||||
@Entity()
|
||||
export class UserReceivingAddress {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
|
||||
import { User } from "./User"
|
||||
import { User } from "./User.js"
|
||||
|
||||
@Entity()
|
||||
export class UserReceivingInvoice {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
|
||||
import { User } from "./User"
|
||||
import { User } from "./User.js"
|
||||
|
||||
@Entity()
|
||||
@Index("address_transaction_unique", ["tx_hash", "output_index"], { unique: true })
|
||||
@Index("user_transaction_unique", ["tx_hash", "output_index"], { unique: true })
|
||||
export class UserTransactionPayment {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import { DataSource, EntityManager } from "typeorm"
|
||||
import crypto from 'crypto';
|
||||
import NewDB, { DbSettings, LoadDbSettingsFromEnv } from "./db"
|
||||
import { User } from "./entity/User"
|
||||
import { UserReceivingAddress } from "./entity/UserReceivingAddress";
|
||||
import { UserReceivingInvoice } from "./entity/UserReceivingInvoice";
|
||||
import { AddressReceivingTransaction } from "./entity/AddressReceivingTransaction";
|
||||
import { UserInvoicePayment } from "./entity/UserInvoicePayment";
|
||||
import { UserTransactionPayment } from "./entity/UserTransactionPayment";
|
||||
import NewDB, { DbSettings, LoadDbSettingsFromEnv } from "./db.js"
|
||||
import { User } from "./entity/User.js"
|
||||
import { UserReceivingAddress } from "./entity/UserReceivingAddress.js";
|
||||
import { UserReceivingInvoice } from "./entity/UserReceivingInvoice.js";
|
||||
import { AddressReceivingTransaction } from "./entity/AddressReceivingTransaction.js";
|
||||
import { UserInvoicePayment } from "./entity/UserInvoicePayment.js";
|
||||
import { UserTransactionPayment } from "./entity/UserTransactionPayment.js";
|
||||
export type StorageSettings = {
|
||||
dbSettings: DbSettings
|
||||
}
|
||||
|
|
|
|||
6
src/test.ts
Normal file
6
src/test.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import { LightningClientImpl } from '../proto/lnd/lightning'
|
||||
const failure = true
|
||||
export default async (describe: (message: string, failure?: boolean) => void) => {
|
||||
describe("all good")
|
||||
describe("oh no", failure)
|
||||
}
|
||||
56
testRunner.ts
Normal file
56
testRunner.ts
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import { globby } from 'globby'
|
||||
type Describe = (message: string, failure?: boolean) => void
|
||||
|
||||
type TestModule = {
|
||||
ignore?: boolean
|
||||
setup?: () => Promise<void>
|
||||
default: (describe: Describe) => Promise<void>
|
||||
teardown?: () => Promise<void>
|
||||
}
|
||||
const start = async () => {
|
||||
|
||||
const files = await globby("**/*.spec.ts")
|
||||
for (const file of files) {
|
||||
const module = await import(`./${file}`) as TestModule
|
||||
await runTestFile(file, module)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
const runTestFile = async (fileName: string, mod: TestModule) => {
|
||||
if (mod.ignore) {
|
||||
return
|
||||
}
|
||||
const d = getDescribe(fileName)
|
||||
try {
|
||||
if (mod.setup) {
|
||||
d("setup started")
|
||||
await mod.setup()
|
||||
}
|
||||
d("tests starting")
|
||||
await mod.default(d)
|
||||
d("tests finished")
|
||||
if (mod.teardown) {
|
||||
await mod.teardown()
|
||||
d("teardown finished")
|
||||
}
|
||||
} catch (e: any) {
|
||||
d("FAILURE", true)
|
||||
d(e, true)
|
||||
}
|
||||
}
|
||||
|
||||
const getDescribe = (fileName: string): Describe => {
|
||||
return (message, failure) => {
|
||||
if (failure) {
|
||||
console.error(redConsole, fileName, ":", message, resetConsole)
|
||||
} else {
|
||||
console.log(greenConsole, fileName, ":", message, resetConsole)
|
||||
}
|
||||
}
|
||||
}
|
||||
const greenConsole = "\x1b[32m"
|
||||
const redConsole = "\x1b[31m"
|
||||
const resetConsole = "\x1b[0m"
|
||||
start()
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
/* Basic Options */
|
||||
// "incremental": true, /* Enable incremental compilation */
|
||||
"target": "ES2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */,
|
||||
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
||||
"module": "ES2020" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
||||
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||
// "checkJs": true, /* Report errors in .js files. */
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */
|
||||
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
|
||||
/* Module Resolution Options */
|
||||
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||
|
|
@ -62,6 +62,9 @@
|
|||
"skipLibCheck": true /* Skip type checking of declaration files. */,
|
||||
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
||||
},
|
||||
"ts-node": {
|
||||
"esm": true
|
||||
},
|
||||
"exclude": [
|
||||
"./tests"
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue