This commit is contained in:
hatim boufnichel 2022-11-21 23:12:38 +01:00
parent 96b619c886
commit 4fd8c0d71d
31 changed files with 2734 additions and 2004 deletions

File diff suppressed because it is too large Load diff

View file

@ -94,6 +94,31 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
res.json({status: 'OK', ...response})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.GetUserInfo) throw new Error('method: GetUserInfo is not implemented')
app.post('/api/user/info', async (req, res) => {
try {
if (!methods.GetUserInfo) throw new Error('method: GetUserInfo is not implemented')
const authContext = await opts.UserAuthGuard(req.headers['authorization'])
const query = req.query
const params = req.params
const response = await methods.GetUserInfo({ ...authContext, ...query, ...params })
res.json({status: 'OK', ...response})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.GetUserOperations) throw new Error('method: GetUserOperations is not implemented')
app.post('/api/user/operations', async (req, res) => {
try {
if (!methods.GetUserOperations) throw new Error('method: GetUserOperations is not implemented')
const authContext = await opts.UserAuthGuard(req.headers['authorization'])
const request = req.body
const error = Types.GetUserOperationsRequestValidate(request)
if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger)
const query = req.query
const params = req.params
const response = await methods.GetUserOperations({ ...authContext, ...query, ...params }, request)
res.json({status: 'OK', ...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')
app.post('/api/user/chain/new', async (req, res) => {
try {

View file

@ -78,6 +78,34 @@ export default (params: ClientParams) => ({
}
return { status: 'ERROR', reason: 'invalid response' }
},
GetUserInfo: async (): Promise<ResultError | ({ status: 'OK' }& Types.UserInfo)> => {
const auth = await params.retrieveUserAuth()
if (auth === null) throw new Error('retrieveUserAuth() returned null')
let finalRoute = '/api/user/info'
const { data } = await axios.post(params.baseUrl + finalRoute, {}, { headers: { 'authorization': auth } })
if (data.status === 'ERROR' && typeof data.reason === 'string') return data
if (data.status === 'OK') {
const result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.UserInfoValidate(result)
if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message }
}
return { status: 'ERROR', reason: 'invalid response' }
},
GetUserOperations: async (request: Types.GetUserOperationsRequest): Promise<ResultError | ({ status: 'OK' }& Types.GetUserOperationsResponse)> => {
const auth = await params.retrieveUserAuth()
if (auth === null) throw new Error('retrieveUserAuth() returned null')
let finalRoute = '/api/user/operations'
const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } })
if (data.status === 'ERROR' && typeof data.reason === 'string') return data
if (data.status === 'OK') {
const result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.GetUserOperationsResponseValidate(result)
if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message }
}
return { status: 'ERROR', reason: 'invalid response' }
},
NewAddress: async (request: Types.NewAddressRequest): Promise<ResultError | ({ status: 'OK' }& Types.NewAddressResponse)> => {
const auth = await params.retrieveUserAuth()
if (auth === null) throw new Error('retrieveUserAuth() returned null')

View file

@ -9,6 +9,35 @@ export type NostrClientParams = {
checkResult?: true
}
export default (params: NostrClientParams, send: (to:string, message: NostrRequest) => Promise<any>) => ({
GetUserInfo: async (): Promise<ResultError | ({ status: 'OK' }& Types.UserInfo)> => {
const auth = await params.retrieveNostrUserAuth()
if (auth === null) throw new Error('retrieveNostrUserAuth() returned null')
const nostrRequest: NostrRequest = {}
const data = await send(params.pubDestination, {rpcName:'GetUserInfo',authIdentifier:auth, ...nostrRequest })
if (data.status === 'ERROR' && typeof data.reason === 'string') return data
if (data.status === 'OK') {
const result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.UserInfoValidate(result)
if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message }
}
return { status: 'ERROR', reason: 'invalid response' }
},
GetUserOperations: async (request: Types.GetUserOperationsRequest): Promise<ResultError | ({ status: 'OK' }& Types.GetUserOperationsResponse)> => {
const auth = await params.retrieveNostrUserAuth()
if (auth === null) throw new Error('retrieveNostrUserAuth() returned null')
const nostrRequest: NostrRequest = {}
nostrRequest.body = request
const data = await send(params.pubDestination, {rpcName:'GetUserOperations',authIdentifier:auth, ...nostrRequest })
if (data.status === 'ERROR' && typeof data.reason === 'string') return data
if (data.status === 'OK') {
const result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.GetUserOperationsResponseValidate(result)
if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message }
}
return { status: 'ERROR', reason: 'invalid response' }
},
NewAddress: async (request: Types.NewAddressRequest): Promise<ResultError | ({ status: 'OK' }& Types.NewAddressResponse)> => {
const auth = await params.retrieveNostrUserAuth()
if (auth === null) throw new Error('retrieveNostrUserAuth() returned null')

View file

@ -21,6 +21,29 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => {
const logger = opts.logger || { log: console.log, error: console.error }
return async (req: NostrRequest, res: NostrResponse) => {
switch (req.rpcName) {
case 'GetUserInfo':
try {
if (!methods.GetUserInfo) throw new Error('method: GetUserInfo is not implemented')
const authContext = await opts.NostrUserAuthGuard(req.authIdentifier)
const query = req.query
const params = req.params
const response = await methods.GetUserInfo({ ...authContext, ...query, ...params })
res({status: 'OK', ...response})
}catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
break
case 'GetUserOperations':
try {
if (!methods.GetUserOperations) throw new Error('method: GetUserOperations is not implemented')
const authContext = await opts.NostrUserAuthGuard(req.authIdentifier)
const request = req.body
const error = Types.GetUserOperationsRequestValidate(request)
if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger)
const query = req.query
const params = req.params
const response = await methods.GetUserOperations({ ...authContext, ...query, ...params }, request)
res({status: 'OK', ...response})
}catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
break
case 'NewAddress':
try {
if (!methods.NewAddress) throw new Error('method: NewAddress is not implemented')

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
// @generated by protobuf-ts 2.8.1 with parameter long_type_number
// @generated by protobuf-ts 2.8.1
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
// tslint:disable
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";

View file

@ -1,4 +1,4 @@
// @generated by protobuf-ts 2.8.1 with parameter long_type_number
// @generated by protobuf-ts 2.8.1
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
// tslint:disable
import { Invoice } from "./lightning.js";
@ -59,7 +59,7 @@ export interface AddHoldInvoiceRequest {
*
* @generated from protobuf field: int64 value = 3;
*/
value: number;
value: bigint;
/**
*
* The value of this invoice in millisatoshis
@ -68,7 +68,7 @@ export interface AddHoldInvoiceRequest {
*
* @generated from protobuf field: int64 value_msat = 10;
*/
valueMsat: number;
valueMsat: bigint;
/**
*
* 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: number;
expiry: bigint;
/**
* Fallback on-chain address.
*
@ -95,7 +95,7 @@ export interface AddHoldInvoiceRequest {
*
* @generated from protobuf field: uint64 cltv_expiry = 7;
*/
cltvExpiry: number;
cltvExpiry: bigint;
/**
*
* 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: number;
addIndex: bigint;
/**
*
* 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: 2 /*LongType.NUMBER*/ },
{ no: 10, name: "value_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
{ 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: 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: 5, name: "expiry", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ 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: 7, name: "cltv_expiry", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
{ 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: 0, valueMsat: 0, descriptionHash: new Uint8Array(0), expiry: 0, fallbackAddr: "", cltvExpiry: 0, routeHints: [], private: false };
const message = { memo: "", hash: new Uint8Array(0), value: 0n, valueMsat: 0n, descriptionHash: new Uint8Array(0), expiry: 0n, fallbackAddr: "", cltvExpiry: 0n, 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().toNumber();
message.value = reader.int64().toBigInt();
break;
case /* int64 value_msat */ 10:
message.valueMsat = reader.int64().toNumber();
message.valueMsat = reader.int64().toBigInt();
break;
case /* bytes description_hash */ 4:
message.descriptionHash = reader.bytes();
break;
case /* int64 expiry */ 5:
message.expiry = reader.int64().toNumber();
message.expiry = reader.int64().toBigInt();
break;
case /* string fallback_addr */ 6:
message.fallbackAddr = reader.string();
break;
case /* uint64 cltv_expiry */ 7:
message.cltvExpiry = reader.uint64().toNumber();
message.cltvExpiry = reader.uint64().toBigInt();
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 !== 0)
if (message.value !== 0n)
writer.tag(3, WireType.Varint).int64(message.value);
/* int64 value_msat = 10; */
if (message.valueMsat !== 0)
if (message.valueMsat !== 0n)
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)
if (message.expiry !== 0n)
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)
if (message.cltvExpiry !== 0n)
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: 2 /*LongType.NUMBER*/ },
{ no: 2, name: "add_index", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 3, name: "payment_addr", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
]);
}
create(value?: PartialMessage<AddHoldInvoiceResp>): AddHoldInvoiceResp {
const message = { paymentRequest: "", addIndex: 0, paymentAddr: new Uint8Array(0) };
const message = { paymentRequest: "", addIndex: 0n, 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().toNumber();
message.addIndex = reader.uint64().toBigInt();
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 !== 0)
if (message.addIndex !== 0n)
writer.tag(2, WireType.Varint).uint64(message.addIndex);
/* bytes payment_addr = 3; */
if (message.paymentAddr.length)

View file

@ -1,4 +1,4 @@
// @generated by protobuf-ts 2.8.1 with parameter long_type_number
// @generated by protobuf-ts 2.8.1
// @generated from protobuf file "lightning.proto" (package "lnrpc", syntax proto3)
// tslint:disable
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
// @generated by protobuf-ts 2.8.1 with parameter long_type_number
// @generated by protobuf-ts 2.8.1
// @generated from protobuf file "router.proto" (package "routerrpc", syntax proto3)
// tslint:disable
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";

View file

@ -1,4 +1,4 @@
// @generated by protobuf-ts 2.8.1 with parameter long_type_number
// @generated by protobuf-ts 2.8.1
// @generated from protobuf file "router.proto" (package "routerrpc", syntax proto3)
// tslint:disable
import { Payment } from "./lightning.js";
@ -38,7 +38,7 @@ export interface SendPaymentRequest {
*
* @generated from protobuf field: int64 amt = 2;
*/
amt: number;
amt: bigint;
/**
*
* Number of millisatoshis to send.
@ -47,7 +47,7 @@ export interface SendPaymentRequest {
*
* @generated from protobuf field: int64 amt_msat = 12;
*/
amtMsat: number;
amtMsat: bigint;
/**
* 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: number;
feeLimitSat: bigint;
/**
*
* 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: number;
feeLimitMsat: bigint;
/**
*
* 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: number[];
outgoingChanIds: bigint[];
/**
*
* 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: number;
maxShardSizeMsat: bigint;
/**
*
* If set, an AMP-payment will be attempted.
@ -276,7 +276,7 @@ export interface RouteFeeRequest {
*
* @generated from protobuf field: int64 amt_sat = 2;
*/
amtSat: number;
amtSat: bigint;
}
/**
* @generated from protobuf message routerrpc.RouteFeeResponse
@ -289,7 +289,7 @@ export interface RouteFeeResponse {
*
* @generated from protobuf field: int64 routing_fee_msat = 1;
*/
routingFeeMsat: number;
routingFeeMsat: bigint;
/**
*
* 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: number;
timeLockDelay: bigint;
}
/**
* @generated from protobuf message routerrpc.SendToRouteRequest
@ -428,7 +428,7 @@ export interface PairData {
*
* @generated from protobuf field: int64 fail_time = 1;
*/
failTime: number;
failTime: bigint;
/**
*
* 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: number;
failAmtSat: bigint;
/**
*
* 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: number;
failAmtMsat: bigint;
/**
* Time of last success.
*
* @generated from protobuf field: int64 success_time = 5;
*/
successTime: number;
successTime: bigint;
/**
* Highest amount that we could successfully forward rounded to whole sats.
*
* @generated from protobuf field: int64 success_amt_sat = 6;
*/
successAmtSat: number;
successAmtSat: bigint;
/**
* Highest amount that we could successfully forward in millisats.
*
* @generated from protobuf field: int64 success_amt_msat = 7;
*/
successAmtMsat: number;
successAmtMsat: bigint;
}
/**
* @generated from protobuf message routerrpc.GetMissionControlConfigRequest
@ -513,7 +513,7 @@ export interface MissionControlConfig {
*
* @generated from protobuf field: uint64 half_life_seconds = 1;
*/
halfLifeSeconds: number;
halfLifeSeconds: bigint;
/**
*
* 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: number;
minimumFailureRelaxInterval: bigint;
}
/**
* @generated from protobuf message routerrpc.QueryProbabilityRequest
@ -573,7 +573,7 @@ export interface QueryProbabilityRequest {
*
* @generated from protobuf field: int64 amt_msat = 3;
*/
amtMsat: number;
amtMsat: bigint;
}
/**
* @generated from protobuf message routerrpc.QueryProbabilityResponse
@ -603,7 +603,7 @@ export interface BuildRouteRequest {
*
* @generated from protobuf field: int64 amt_msat = 1;
*/
amtMsat: number;
amtMsat: bigint;
/**
*
* 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: number;
incomingChannelId: bigint;
/**
*
* 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: number;
outgoingChannelId: bigint;
/**
*
* 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: number;
incomingHtlcId: bigint;
/**
*
* 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: number;
outgoingHtlcId: bigint;
/**
*
* The time in unix nanoseconds that the event occurred.
*
* @generated from protobuf field: uint64 timestamp_ns = 5;
*/
timestampNs: number;
timestampNs: bigint;
/**
*
* 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: number;
incomingAmtMsat: bigint;
/**
* The amount of the outgoing htlc.
*
* @generated from protobuf field: uint64 outgoing_amt_msat = 4;
*/
outgoingAmtMsat: number;
outgoingAmtMsat: bigint;
}
/**
* @generated from protobuf message routerrpc.ForwardEvent
@ -915,13 +915,13 @@ export interface CircuitKey {
*
* @generated from protobuf field: uint64 chan_id = 1;
*/
chanId: number;
chanId: bigint;
/**
* / The index of the incoming htlc in the incoming channel.
*
* @generated from protobuf field: uint64 htlc_id = 2;
*/
htlcId: number;
htlcId: bigint;
}
/**
* @generated from protobuf message routerrpc.ForwardHtlcInterceptRequest
@ -940,7 +940,7 @@ export interface ForwardHtlcInterceptRequest {
*
* @generated from protobuf field: uint64 incoming_amount_msat = 5;
*/
incomingAmountMsat: number;
incomingAmountMsat: bigint;
/**
* The incoming htlc expiry.
*
@ -963,13 +963,13 @@ export interface ForwardHtlcInterceptRequest {
*
* @generated from protobuf field: uint64 outgoing_requested_chan_id = 7;
*/
outgoingRequestedChanId: number;
outgoingRequestedChanId: bigint;
/**
* The outgoing htlc amount.
*
* @generated from protobuf field: uint64 outgoing_amount_msat = 3;
*/
outgoingAmountMsat: number;
outgoingAmountMsat: bigint;
/**
* 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: 2 /*LongType.NUMBER*/ },
{ no: 12, name: "amt_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
{ 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: 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: 2 /*LongType.NUMBER*/ },
{ no: 13, name: "fee_limit_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
{ 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: 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: 2 /*LongType.NUMBER*/ },
{ no: 19, name: "outgoing_chan_ids", kind: "scalar", repeat: 1 /*RepeatType.PACKED*/, T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
{ 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: 2 /*LongType.NUMBER*/ },
{ no: 21, name: "max_shard_size_msat", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
{ 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: 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 };
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 };
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().toNumber();
message.amt = reader.int64().toBigInt();
break;
case /* int64 amt_msat */ 12:
message.amtMsat = reader.int64().toNumber();
message.amtMsat = reader.int64().toBigInt();
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().toNumber();
message.feeLimitSat = reader.int64().toBigInt();
break;
case /* int64 fee_limit_msat */ 13:
message.feeLimitMsat = reader.int64().toNumber();
message.feeLimitMsat = reader.int64().toBigInt();
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().toNumber());
message.outgoingChanIds.push(reader.uint64().toBigInt());
else
message.outgoingChanIds.push(reader.uint64().toNumber());
message.outgoingChanIds.push(reader.uint64().toBigInt());
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().toNumber();
message.maxShardSizeMsat = reader.uint64().toBigInt();
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 !== 0)
if (message.amt !== 0n)
writer.tag(2, WireType.Varint).int64(message.amt);
/* int64 amt_msat = 12; */
if (message.amtMsat !== 0)
if (message.amtMsat !== 0n)
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 !== 0)
if (message.feeLimitSat !== 0n)
writer.tag(7, WireType.Varint).int64(message.feeLimitSat);
/* int64 fee_limit_msat = 13; */
if (message.feeLimitMsat !== 0)
if (message.feeLimitMsat !== 0n)
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 !== 0)
if (message.maxShardSizeMsat !== 0n)
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: 2 /*LongType.NUMBER*/ }
{ no: 2, name: "amt_sat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
]);
}
create(value?: PartialMessage<RouteFeeRequest>): RouteFeeRequest {
const message = { dest: new Uint8Array(0), amtSat: 0 };
const message = { dest: new Uint8Array(0), amtSat: 0n };
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().toNumber();
message.amtSat = reader.int64().toBigInt();
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 !== 0)
if (message.amtSat !== 0n)
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: 2 /*LongType.NUMBER*/ },
{ no: 2, name: "time_lock_delay", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ }
{ 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*/ }
]);
}
create(value?: PartialMessage<RouteFeeResponse>): RouteFeeResponse {
const message = { routingFeeMsat: 0, timeLockDelay: 0 };
const message = { routingFeeMsat: 0n, timeLockDelay: 0n };
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().toNumber();
message.routingFeeMsat = reader.int64().toBigInt();
break;
case /* int64 time_lock_delay */ 2:
message.timeLockDelay = reader.int64().toNumber();
message.timeLockDelay = reader.int64().toBigInt();
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 !== 0)
if (message.routingFeeMsat !== 0n)
writer.tag(1, WireType.Varint).int64(message.routingFeeMsat);
/* int64 time_lock_delay = 2; */
if (message.timeLockDelay !== 0)
if (message.timeLockDelay !== 0n)
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: 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*/ }
{ 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*/ }
]);
}
create(value?: PartialMessage<PairData>): PairData {
const message = { failTime: 0, failAmtSat: 0, failAmtMsat: 0, successTime: 0, successAmtSat: 0, successAmtMsat: 0 };
const message = { failTime: 0n, failAmtSat: 0n, failAmtMsat: 0n, successTime: 0n, successAmtSat: 0n, successAmtMsat: 0n };
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().toNumber();
message.failTime = reader.int64().toBigInt();
break;
case /* int64 fail_amt_sat */ 2:
message.failAmtSat = reader.int64().toNumber();
message.failAmtSat = reader.int64().toBigInt();
break;
case /* int64 fail_amt_msat */ 4:
message.failAmtMsat = reader.int64().toNumber();
message.failAmtMsat = reader.int64().toBigInt();
break;
case /* int64 success_time */ 5:
message.successTime = reader.int64().toNumber();
message.successTime = reader.int64().toBigInt();
break;
case /* int64 success_amt_sat */ 6:
message.successAmtSat = reader.int64().toNumber();
message.successAmtSat = reader.int64().toBigInt();
break;
case /* int64 success_amt_msat */ 7:
message.successAmtMsat = reader.int64().toNumber();
message.successAmtMsat = reader.int64().toBigInt();
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 !== 0)
if (message.failTime !== 0n)
writer.tag(1, WireType.Varint).int64(message.failTime);
/* int64 fail_amt_sat = 2; */
if (message.failAmtSat !== 0)
if (message.failAmtSat !== 0n)
writer.tag(2, WireType.Varint).int64(message.failAmtSat);
/* int64 fail_amt_msat = 4; */
if (message.failAmtMsat !== 0)
if (message.failAmtMsat !== 0n)
writer.tag(4, WireType.Varint).int64(message.failAmtMsat);
/* int64 success_time = 5; */
if (message.successTime !== 0)
if (message.successTime !== 0n)
writer.tag(5, WireType.Varint).int64(message.successTime);
/* int64 success_amt_sat = 6; */
if (message.successAmtSat !== 0)
if (message.successAmtSat !== 0n)
writer.tag(6, WireType.Varint).int64(message.successAmtSat);
/* int64 success_amt_msat = 7; */
if (message.successAmtMsat !== 0)
if (message.successAmtMsat !== 0n)
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: 2 /*LongType.NUMBER*/ },
{ no: 1, name: "half_life_seconds", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
{ 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: 2 /*LongType.NUMBER*/ }
{ no: 5, name: "minimum_failure_relax_interval", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }
]);
}
create(value?: PartialMessage<MissionControlConfig>): MissionControlConfig {
const message = { halfLifeSeconds: 0, hopProbability: 0, weight: 0, maximumPaymentResults: 0, minimumFailureRelaxInterval: 0 };
const message = { halfLifeSeconds: 0n, hopProbability: 0, weight: 0, maximumPaymentResults: 0, minimumFailureRelaxInterval: 0n };
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().toNumber();
message.halfLifeSeconds = reader.uint64().toBigInt();
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().toNumber();
message.minimumFailureRelaxInterval = reader.uint64().toBigInt();
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 !== 0)
if (message.halfLifeSeconds !== 0n)
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 !== 0)
if (message.minimumFailureRelaxInterval !== 0n)
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: 2 /*LongType.NUMBER*/ }
{ no: 3, name: "amt_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
]);
}
create(value?: PartialMessage<QueryProbabilityRequest>): QueryProbabilityRequest {
const message = { fromNode: new Uint8Array(0), toNode: new Uint8Array(0), amtMsat: 0 };
const message = { fromNode: new Uint8Array(0), toNode: new Uint8Array(0), amtMsat: 0n };
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().toNumber();
message.amtMsat = reader.int64().toBigInt();
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 !== 0)
if (message.amtMsat !== 0n)
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: 2 /*LongType.NUMBER*/ },
{ no: 1, name: "amt_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ 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: 0, finalCltvDelta: 0, outgoingChanId: "0", hopPubkeys: [], paymentAddr: new Uint8Array(0) };
const message = { amtMsat: 0n, 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().toNumber();
message.amtMsat = reader.int64().toBigInt();
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 !== 0)
if (message.amtMsat !== 0n)
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: 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: 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: 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: 0, outgoingChannelId: 0, incomingHtlcId: 0, outgoingHtlcId: 0, timestampNs: 0, eventType: 0, event: { oneofKind: undefined } };
const message = { incomingChannelId: 0n, outgoingChannelId: 0n, incomingHtlcId: 0n, outgoingHtlcId: 0n, timestampNs: 0n, 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().toNumber();
message.incomingChannelId = reader.uint64().toBigInt();
break;
case /* uint64 outgoing_channel_id */ 2:
message.outgoingChannelId = reader.uint64().toNumber();
message.outgoingChannelId = reader.uint64().toBigInt();
break;
case /* uint64 incoming_htlc_id */ 3:
message.incomingHtlcId = reader.uint64().toNumber();
message.incomingHtlcId = reader.uint64().toBigInt();
break;
case /* uint64 outgoing_htlc_id */ 4:
message.outgoingHtlcId = reader.uint64().toNumber();
message.outgoingHtlcId = reader.uint64().toBigInt();
break;
case /* uint64 timestamp_ns */ 5:
message.timestampNs = reader.uint64().toNumber();
message.timestampNs = reader.uint64().toBigInt();
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 !== 0)
if (message.incomingChannelId !== 0n)
writer.tag(1, WireType.Varint).uint64(message.incomingChannelId);
/* uint64 outgoing_channel_id = 2; */
if (message.outgoingChannelId !== 0)
if (message.outgoingChannelId !== 0n)
writer.tag(2, WireType.Varint).uint64(message.outgoingChannelId);
/* uint64 incoming_htlc_id = 3; */
if (message.incomingHtlcId !== 0)
if (message.incomingHtlcId !== 0n)
writer.tag(3, WireType.Varint).uint64(message.incomingHtlcId);
/* uint64 outgoing_htlc_id = 4; */
if (message.outgoingHtlcId !== 0)
if (message.outgoingHtlcId !== 0n)
writer.tag(4, WireType.Varint).uint64(message.outgoingHtlcId);
/* uint64 timestamp_ns = 5; */
if (message.timestampNs !== 0)
if (message.timestampNs !== 0n)
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: 2 /*LongType.NUMBER*/ },
{ no: 4, name: "outgoing_amt_msat", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ }
{ 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*/ }
]);
}
create(value?: PartialMessage<HtlcInfo>): HtlcInfo {
const message = { incomingTimelock: 0, outgoingTimelock: 0, incomingAmtMsat: 0, outgoingAmtMsat: 0 };
const message = { incomingTimelock: 0, outgoingTimelock: 0, incomingAmtMsat: 0n, outgoingAmtMsat: 0n };
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().toNumber();
message.incomingAmtMsat = reader.uint64().toBigInt();
break;
case /* uint64 outgoing_amt_msat */ 4:
message.outgoingAmtMsat = reader.uint64().toNumber();
message.outgoingAmtMsat = reader.uint64().toBigInt();
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 !== 0)
if (message.incomingAmtMsat !== 0n)
writer.tag(3, WireType.Varint).uint64(message.incomingAmtMsat);
/* uint64 outgoing_amt_msat = 4; */
if (message.outgoingAmtMsat !== 0)
if (message.outgoingAmtMsat !== 0n)
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: 2 /*LongType.NUMBER*/ },
{ no: 2, name: "htlc_id", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ }
{ 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*/ }
]);
}
create(value?: PartialMessage<CircuitKey>): CircuitKey {
const message = { chanId: 0, htlcId: 0 };
const message = { chanId: 0n, htlcId: 0n };
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().toNumber();
message.chanId = reader.uint64().toBigInt();
break;
case /* uint64 htlc_id */ 2:
message.htlcId = reader.uint64().toNumber();
message.htlcId = reader.uint64().toBigInt();
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 !== 0)
if (message.chanId !== 0n)
writer.tag(1, WireType.Varint).uint64(message.chanId);
/* uint64 htlc_id = 2; */
if (message.htlcId !== 0)
if (message.htlcId !== 0n)
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: 2 /*LongType.NUMBER*/ },
{ no: 5, name: "incoming_amount_msat", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
{ 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: 2 /*LongType.NUMBER*/ },
{ no: 3, name: "outgoing_amount_msat", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
{ 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: 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: 0, incomingExpiry: 0, paymentHash: new Uint8Array(0), outgoingRequestedChanId: 0, outgoingAmountMsat: 0, outgoingExpiry: 0, customRecords: {}, onionBlob: new Uint8Array(0), autoFailHeight: 0 };
const message = { incomingAmountMsat: 0n, incomingExpiry: 0, paymentHash: new Uint8Array(0), outgoingRequestedChanId: 0n, outgoingAmountMsat: 0n, 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().toNumber();
message.incomingAmountMsat = reader.uint64().toBigInt();
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().toNumber();
message.outgoingRequestedChanId = reader.uint64().toBigInt();
break;
case /* uint64 outgoing_amount_msat */ 3:
message.outgoingAmountMsat = reader.uint64().toNumber();
message.outgoingAmountMsat = reader.uint64().toBigInt();
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 !== 0)
if (message.incomingAmountMsat !== 0n)
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 !== 0)
if (message.outgoingRequestedChanId !== 0n)
writer.tag(7, WireType.Varint).uint64(message.outgoingRequestedChanId);
/* uint64 outgoing_amount_msat = 3; */
if (message.outgoingAmountMsat !== 0)
if (message.outgoingAmountMsat !== 0n)
writer.tag(3, WireType.Varint).uint64(message.outgoingAmountMsat);
/* uint32 outgoing_expiry = 4; */
if (message.outgoingExpiry !== 0)

View file

@ -89,7 +89,19 @@ service LightningPub {
option (http_method) = "post";
option (http_route) = "/api/user/auth";
}
// USER
rpc GetUserInfo(structs.Empty)returns(structs.UserInfo){
option (auth_type) = "User";
option (http_method) = "post";
option (http_route) = "/api/user/info";
option (nostr) = true;
}
// USER
rpc GetUserOperations(structs.GetUserOperationsRequest) returns (structs.GetUserOperationsResponse) {
option (auth_type) = "User";
option (http_method) = "post";
option (http_route) = "/api/user/operations";
option (nostr) = true;
}
rpc NewAddress(structs.NewAddressRequest) returns (structs.NewAddressResponse) {
option (auth_type) = "User";
option (http_method) = "post";

View file

@ -115,3 +115,36 @@ message AuthUserResponse{
string userId = 1;
string authToken = 2;
}
message UserInfo{
string userId = 1;
int64 balance = 2;
}
message GetUserOperationsRequest{
int64 latestIncomingInvoice = 1;
int64 latestOutgoingInvoice = 2;
int64 latestIncomingTx = 3;
int64 latestOutgoingTx = 4;
}
enum UserOperationType {
INCOMING_TX =0;
OUTGOING_TX =1;
INCOMING_INVOICE =2;
OUTGOING_INVOICE=3;
}
message UserOperation{
int64 paidAtUnix=1;
UserOperationType type = 2;
bool inbound =3;
int64 amount = 4;
}
message UserOperations {
int64 fromIndex=1;
int64 toIndex=2;
repeated UserOperation operations=3;
}
message GetUserOperationsResponse{
UserOperations latestOutgoingInvoiceOperations=1;
UserOperations latestIncomingInvoiceOperations=2;
UserOperations latestOutgoingTxOperations=3;
UserOperations latestIncomingTxOperations=4;
}