up
This commit is contained in:
parent
c5fd454089
commit
4f550a937f
69 changed files with 8098 additions and 23341 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -6,3 +6,4 @@ tmp/
|
|||
temp/
|
||||
.env
|
||||
build/
|
||||
db.sqlite
|
||||
7
README.md
Normal file
7
README.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Awesome Project Build with TypeORM
|
||||
|
||||
Steps to run this project:
|
||||
|
||||
1. Run `npm i` command
|
||||
2. Setup database settings inside `data-source.ts` file
|
||||
3. Run `npm start` command
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
"use strict";
|
||||
// This file was autogenerated from a .proto file, DO NOT EDIT!
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var express_1 = __importDefault(require("express"));
|
||||
var Types = __importStar(require("./types"));
|
||||
var logErrorAndReturnResponse = function (error, response, res, logger) { logger.error(error.message || error); res.json({ status: 'ERROR', reason: response }); };
|
||||
exports.default = (function (methods, opts) {
|
||||
var logger = opts.logger || { log: console.log, error: console.error };
|
||||
var app = (0, express_1.default)();
|
||||
if (!opts.allowNotImplementedMethods && !methods.EncryptionExchange)
|
||||
throw new Error('method: EncryptionExchange is not implemented');
|
||||
app.post('/api/encryption/exchange', function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var authContext, request, error, query, params, response, e_1;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
_a.trys.push([0, 3, , 4]);
|
||||
if (!methods.EncryptionExchange)
|
||||
throw new Error('method: EncryptionExchange is not implemented');
|
||||
return [4 /*yield*/, opts.NoAuthAuthGuard(req.headers['authorization'])];
|
||||
case 1:
|
||||
authContext = _a.sent();
|
||||
request = req.body;
|
||||
error = Types.EncryptionExchangeRequestValidate(request);
|
||||
if (error !== null)
|
||||
return [2 /*return*/, logErrorAndReturnResponse(error, 'invalid request body', res, logger)];
|
||||
query = req.query;
|
||||
params = req.params;
|
||||
return [4 /*yield*/, methods.EncryptionExchange(__assign(__assign(__assign({}, authContext), query), params), request)];
|
||||
case 2:
|
||||
response = _a.sent();
|
||||
res.json({ status: 'OK', result: response });
|
||||
return [3 /*break*/, 4];
|
||||
case 3:
|
||||
e_1 = _a.sent();
|
||||
logErrorAndReturnResponse(e_1, e_1.message || e_1, res, logger);
|
||||
return [3 /*break*/, 4];
|
||||
case 4: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
}); });
|
||||
return { Listen: function (port) { return app.listen(port, function () { return logger.log('Example app listening on port ' + port); }); } };
|
||||
});
|
||||
//# sourceMappingURL=express_server.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"express_server.js","sourceRoot":"","sources":["../proto/autogenerated/ts/express_server.ts"],"names":[],"mappings":";AAAA,+DAA+D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/D,oDAA2C;AAC3C,6CAAgC;AAUhC,IAAM,yBAAyB,GAAG,UAAC,KAAY,EAAE,QAAgB,EAAE,GAAa,EAAE,MAAc,IAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA,CAAC,CAAC,CAAA;AAC9L,mBAAe,UAAC,OAA4B,EAAE,IAAmB;IAC7D,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAA;IACxE,IAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAA;IACrB,IAAI,CAAC,IAAI,CAAC,0BAA0B,IAAI,CAAC,OAAO,CAAC,kBAAkB;QAAE,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;IACrI,GAAG,CAAC,IAAI,CAAC,0BAA0B,EAAE,UAAO,GAAG,EAAE,GAAG;;;;;;oBAE5C,IAAI,CAAC,OAAO,CAAC,kBAAkB;wBAAE,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;oBAC7E,qBAAM,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,EAAA;;oBAAtE,WAAW,GAAG,SAAwD;oBACtE,OAAO,GAAG,GAAG,CAAC,IAAI,CAAA;oBAClB,KAAK,GAAG,KAAK,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAA;oBAC9D,IAAI,KAAK,KAAK,IAAI;wBAAE,sBAAO,yBAAyB,CAAC,KAAK,EAAE,sBAAsB,EAAE,GAAG,EAAE,MAAM,CAAC,EAAA;oBAC1F,KAAK,GAAG,GAAG,CAAC,KAAK,CAAA;oBACjB,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;oBACR,qBAAM,OAAO,CAAC,kBAAkB,gCAAM,WAAW,GAAK,KAAK,GAAK,MAAM,GAAI,OAAO,CAAC,EAAA;;oBAA7F,QAAQ,GAAG,SAAkF;oBACnG,GAAG,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAC,CAAC,CAAA;;;;oBAC3B,yBAAyB,CAAC,GAAC,EAAE,GAAC,CAAC,OAAO,IAAI,GAAC,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;;;;;SAC/E,CAAC,CAAA;IACF,OAAO,EAAE,MAAM,EAAE,UAAC,IAAY,IAAK,OAAA,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,cAAM,OAAA,MAAM,CAAC,GAAG,CAAC,gCAAgC,GAAG,IAAI,CAAC,EAAnD,CAAmD,CAAC,EAA3E,CAA2E,EAAE,CAAA;AACpH,CAAC,EAAA"}
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// This file was autogenerated from a .proto file, DO NOT EDIT!
|
||||
var axios_1 = __importDefault(require("axios"));
|
||||
var Types = __importStar(require("./types"));
|
||||
exports.default = (function (retrievers) { return ({
|
||||
EncryptionExchange: function (request) { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var auth, data, error;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, retrievers.retrieveNoAuthAuth()];
|
||||
case 1:
|
||||
auth = _a.sent();
|
||||
if (auth === null)
|
||||
throw new Error('retrieveNoAuthAuth() returned null');
|
||||
return [4 /*yield*/, axios_1.default.post('/api/encryption/exchange', request, { headers: { 'authorization': auth } })];
|
||||
case 2:
|
||||
data = (_a.sent()).data;
|
||||
if (data.status === 'ERROR' && typeof data.reason === 'string')
|
||||
return [2 /*return*/, data];
|
||||
if (data.status === 'OK') {
|
||||
error = Types.EmptyValidate(data.result);
|
||||
if (error === null) {
|
||||
return [2 /*return*/, data];
|
||||
}
|
||||
else
|
||||
return [2 /*return*/, { status: 'ERROR', reason: error.message }];
|
||||
}
|
||||
return [2 /*return*/, { status: 'ERROR', reason: 'invalid response' }];
|
||||
}
|
||||
});
|
||||
}); },
|
||||
}); });
|
||||
//# sourceMappingURL=http_client.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"http_client.js","sourceRoot":"","sources":["../proto/autogenerated/ts/http_client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA+D;AAC/D,gDAAyB;AACzB,6CAAgC;AAQhC,mBAAe,UAAC,UAA6B,IAAK,OAAA,CAAC;IAC/C,kBAAkB,EAAE,UAAO,OAAwC;;;;wBAClD,qBAAM,UAAU,CAAC,kBAAkB,EAAE,EAAA;;oBAA5C,IAAI,GAAG,SAAqC;oBAClD,IAAI,IAAI,KAAK,IAAI;wBAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;oBACvD,qBAAM,eAAK,CAAC,IAAI,CAAC,0BAA0B,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,CAAC,EAAA;;oBAAtG,IAAI,GAAK,CAAA,SAA6F,CAAA,KAAlG;oBACZ,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;wBAAE,sBAAO,IAAI,EAAA;oBAC3E,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE;wBAChB,KAAK,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;wBAC9C,IAAI,KAAK,KAAK,IAAI,EAAE;4BAAE,sBAAO,IAAI,EAAA;yBAAE;;4BAAM,sBAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,EAAA;qBAC7F;oBACD,sBAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAA;;;SACzD;CACJ,CAAC,EAZgD,CAYhD,EAAA"}
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
"use strict";
|
||||
// This file was autogenerated from a .proto file, DO NOT EDIT!
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const express_1 = __importDefault(require("express"));
|
||||
const Types = __importStar(require("./types"));
|
||||
const logErrorAndReturnResponse = (error, response, res, logger) => { logger.error(error.message || error); res.json({ status: 'ERROR', reason: response }); };
|
||||
exports.default = (methods, opts) => {
|
||||
const logger = opts.logger || { log: console.log, error: console.error };
|
||||
const app = (0, express_1.default)();
|
||||
if (!opts.allowNotImplementedMethods && !methods.Health)
|
||||
throw new Error('method: Health is not implemented');
|
||||
app.get('/health', (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
try {
|
||||
if (!methods.Health)
|
||||
throw new Error('method: Health is not implemented');
|
||||
const authContext = yield opts.NoAuthAuthGuard(req.headers['authorization']);
|
||||
const query = req.query;
|
||||
const params = req.params;
|
||||
yield methods.Health(Object.assign(Object.assign(Object.assign({}, authContext), query), params));
|
||||
res.json({ status: 'OK' });
|
||||
}
|
||||
catch (ex) {
|
||||
const e = ex;
|
||||
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');
|
||||
app.post('/api/encryption/exchange', (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
try {
|
||||
if (!methods.EncryptionExchange)
|
||||
throw new Error('method: EncryptionExchange is not implemented');
|
||||
const authContext = yield opts.NoAuthAuthGuard(req.headers['authorization']);
|
||||
const request = req.body;
|
||||
const error = Types.EncryptionExchangeRequestValidate(request);
|
||||
if (error !== null)
|
||||
return logErrorAndReturnResponse(error, 'invalid request body', res, logger);
|
||||
const query = req.query;
|
||||
const params = req.params;
|
||||
yield methods.EncryptionExchange(Object.assign(Object.assign(Object.assign({}, authContext), query), params), request);
|
||||
res.json({ status: 'OK' });
|
||||
}
|
||||
catch (ex) {
|
||||
const e = ex;
|
||||
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');
|
||||
app.get('/api/lnd/getinfo', (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
try {
|
||||
if (!methods.LndGetInfo)
|
||||
throw new Error('method: LndGetInfo is not implemented');
|
||||
const authContext = yield opts.NoAuthAuthGuard(req.headers['authorization']);
|
||||
const query = req.query;
|
||||
const params = req.params;
|
||||
const response = yield methods.LndGetInfo(Object.assign(Object.assign(Object.assign({}, authContext), query), params));
|
||||
res.json({ status: 'OK', result: response });
|
||||
}
|
||||
catch (ex) {
|
||||
const e = ex;
|
||||
logErrorAndReturnResponse(e, e.message || e, res, logger);
|
||||
if (opts.throwErrors)
|
||||
throw e;
|
||||
}
|
||||
}));
|
||||
var server;
|
||||
return {
|
||||
Close: () => { if (!server) {
|
||||
throw new Error('tried closing server before starting');
|
||||
}
|
||||
else
|
||||
server.close(); },
|
||||
Listen: (port) => { server = app.listen(port, () => logger.log('Example app listening on port ' + port)); }
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=express_server.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"express_server.js","sourceRoot":"","sources":["../../../../proto/autogenerated/ts/express_server.ts"],"names":[],"mappings":";AAAA,+DAA+D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/D,sDAA2C;AAC3C,+CAAgC;AAWhC,MAAM,yBAAyB,GAAG,CAAC,KAAY,EAAE,QAAgB,EAAE,GAAa,EAAE,MAAc,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA,CAAC,CAAC,CAAA;AAC9L,kBAAe,CAAC,OAA4B,EAAE,IAAmB,EAAE,EAAE;IACjE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAA;IACxE,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAA;IACrB,IAAI,CAAC,IAAI,CAAC,0BAA0B,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;IAC7G,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,CAAO,GAAG,EAAE,GAAG,EAAE,EAAE;QAClC,IAAI;YACA,IAAI,CAAC,OAAO,CAAC,MAAM;gBAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;YACzE,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAA;YAC5E,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAA;YACvB,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;YACzB,MAAM,OAAO,CAAC,MAAM,+CAAM,WAAW,GAAK,KAAK,GAAK,MAAM,EAAG,CAAA;YAC7D,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;SAC7B;QAAC,OAAO,EAAE,EAAE;YAAE,MAAM,CAAC,GAAG,EAAS,CAAC;YAAC,yBAAyB,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;YAAC,IAAI,IAAI,CAAC,WAAW;gBAAE,MAAM,CAAC,CAAA;SAAE;IAClI,CAAC,CAAA,CAAC,CAAA;IACF,IAAI,CAAC,IAAI,CAAC,0BAA0B,IAAI,CAAC,OAAO,CAAC,kBAAkB;QAAE,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;IACrI,GAAG,CAAC,IAAI,CAAC,0BAA0B,EAAE,CAAO,GAAG,EAAE,GAAG,EAAE,EAAE;QACpD,IAAI;YACA,IAAI,CAAC,OAAO,CAAC,kBAAkB;gBAAE,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;YACjG,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAA;YAC5E,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAA;YACxB,MAAM,KAAK,GAAG,KAAK,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAA;YAC9D,IAAI,KAAK,KAAK,IAAI;gBAAE,OAAO,yBAAyB,CAAC,KAAK,EAAE,sBAAsB,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;YAChG,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAA;YACvB,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;YACzB,MAAM,OAAO,CAAC,kBAAkB,+CAAM,WAAW,GAAK,KAAK,GAAK,MAAM,GAAI,OAAO,CAAC,CAAA;YAClF,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;SAC7B;QAAC,OAAO,EAAE,EAAE;YAAE,MAAM,CAAC,GAAG,EAAS,CAAC;YAAC,yBAAyB,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;YAAC,IAAI,IAAI,CAAC,WAAW;gBAAE,MAAM,CAAC,CAAA;SAAE;IAClI,CAAC,CAAA,CAAC,CAAA;IACF,IAAI,CAAC,IAAI,CAAC,0BAA0B,IAAI,CAAC,OAAO,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;IACrH,GAAG,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAO,GAAG,EAAE,GAAG,EAAE,EAAE;QAC3C,IAAI;YACA,IAAI,CAAC,OAAO,CAAC,UAAU;gBAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;YACjF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAA;YAC5E,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAA;YACvB,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;YACzB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,UAAU,+CAAM,WAAW,GAAK,KAAK,GAAK,MAAM,EAAG,CAAA;YAClF,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA;SAC/C;QAAC,OAAO,EAAE,EAAE;YAAE,MAAM,CAAC,GAAG,EAAS,CAAC;YAAC,yBAAyB,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;YAAC,IAAI,IAAI,CAAC,WAAW;gBAAE,MAAM,CAAC,CAAA;SAAE;IAClI,CAAC,CAAA,CAAC,CAAA;IACF,IAAI,MAAyC,CAAA;IAC7C,OAAO;QACH,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;SAAE;;YAAM,MAAM,CAAC,KAAK,EAAE,CAAA,CAAC,CAAC;QAC7G,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE,GAAG,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,gCAAgC,GAAG,IAAI,CAAC,CAAC,CAAA,CAAC,CAAC;KACrH,CAAA;AACL,CAAC,CAAA"}
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// This file was autogenerated from a .proto file, DO NOT EDIT!
|
||||
const axios_1 = __importDefault(require("axios"));
|
||||
const Types = __importStar(require("./types"));
|
||||
exports.default = (params) => ({
|
||||
Health: () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const auth = yield params.retrieveNoAuthAuth();
|
||||
if (auth === null)
|
||||
throw new Error('retrieveNoAuthAuth() returned null');
|
||||
const { data } = yield axios_1.default.get(params.baseUrl + '/health', { headers: { 'authorization': auth } });
|
||||
if (data.status === 'ERROR' && typeof data.reason === 'string')
|
||||
return data;
|
||||
if (data.status === 'OK') {
|
||||
return data;
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' };
|
||||
}),
|
||||
EncryptionExchange: (request) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const auth = yield params.retrieveNoAuthAuth();
|
||||
if (auth === null)
|
||||
throw new Error('retrieveNoAuthAuth() returned null');
|
||||
const { data } = yield axios_1.default.post(params.baseUrl + '/api/encryption/exchange', request, { headers: { 'authorization': auth } });
|
||||
if (data.status === 'ERROR' && typeof data.reason === 'string')
|
||||
return data;
|
||||
if (data.status === 'OK') {
|
||||
return data;
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' };
|
||||
}),
|
||||
LndGetInfo: () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const auth = yield params.retrieveNoAuthAuth();
|
||||
if (auth === null)
|
||||
throw new Error('retrieveNoAuthAuth() returned null');
|
||||
const { data } = yield axios_1.default.get(params.baseUrl + '/api/lnd/getinfo', { headers: { 'authorization': auth } });
|
||||
if (data.status === 'ERROR' && typeof data.reason === 'string')
|
||||
return data;
|
||||
if (data.status === 'OK') {
|
||||
const error = Types.LndGetInfoResponseValidate(data.result);
|
||||
if (error === null) {
|
||||
return data;
|
||||
}
|
||||
else
|
||||
return { status: 'ERROR', reason: error.message };
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' };
|
||||
}),
|
||||
});
|
||||
//# sourceMappingURL=http_client.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"http_client.js","sourceRoot":"","sources":["../../../../proto/autogenerated/ts/http_client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA+D;AAC/D,kDAAyB;AACzB,+CAAgC;AAShC,kBAAe,CAAC,MAAoB,EAAE,EAAE,CAAC,CAAC;IACtC,MAAM,EAAE,GAAkD,EAAE;QACxD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,kBAAkB,EAAE,CAAA;QAC9C,IAAI,IAAI,KAAK,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;QACxE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,GAAG,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;QACpG,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAA;QAC3E,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE;YACtB,OAAO,IAAI,CAAA;SACd;QACD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAA;IAC1D,CAAC,CAAA;IACD,kBAAkB,EAAE,CAAO,OAAwC,EAA2C,EAAE;QAC5G,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,kBAAkB,EAAE,CAAA;QAC9C,IAAI,IAAI,KAAK,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;QACxE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,0BAA0B,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;QAC/H,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAA;QAC3E,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE;YACtB,OAAO,IAAI,CAAA;SACd;QACD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAA;IAC1D,CAAC,CAAA;IACD,UAAU,EAAE,GAAuE,EAAE;QACjF,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,kBAAkB,EAAE,CAAA;QAC9C,IAAI,IAAI,KAAK,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;QACxE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,GAAG,kBAAkB,EAAE,EAAE,OAAO,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;QAC7G,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAA;QAC3E,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE;YACtB,MAAM,KAAK,GAAG,KAAK,CAAC,0BAA0B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YAC3D,IAAI,KAAK,KAAK,IAAI,EAAE;gBAAE,OAAO,IAAI,CAAA;aAAE;;gBAAM,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,CAAA;SAC7F;QACD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAA;IAC1D,CAAC,CAAA;CACJ,CAAC,CAAA"}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
"use strict";
|
||||
// This file was autogenerated from a .proto file, DO NOT EDIT!
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.EncryptionExchangeRequestValidate = exports.EncryptionExchangeRequestOptionalFields = exports.EmptyValidate = exports.EmptyOptionalFields = exports.LndGetInfoResponseValidate = exports.LndGetInfoResponseOptionalFields = void 0;
|
||||
exports.LndGetInfoResponseOptionalFields = [];
|
||||
const LndGetInfoResponseValidate = (o, opts = {}, path = 'LndGetInfoResponse::root.') => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet)
|
||||
return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message');
|
||||
if (typeof o !== 'object' || o === null)
|
||||
return new Error(path + ': object is not an instance of an object or is null');
|
||||
if (typeof o.alias !== 'string')
|
||||
return new Error(`${path}.alias: is not a string`);
|
||||
if (opts.alias_CustomCheck && !opts.alias_CustomCheck(o.alias))
|
||||
return new Error(`${path}.alias: custom check failed`);
|
||||
return null;
|
||||
};
|
||||
exports.LndGetInfoResponseValidate = LndGetInfoResponseValidate;
|
||||
exports.EmptyOptionalFields = [];
|
||||
const EmptyValidate = (o, opts = {}, path = 'Empty::root.') => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet)
|
||||
return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message');
|
||||
if (typeof o !== 'object' || o === null)
|
||||
return new Error(path + ': object is not an instance of an object or is null');
|
||||
return null;
|
||||
};
|
||||
exports.EmptyValidate = EmptyValidate;
|
||||
exports.EncryptionExchangeRequestOptionalFields = [];
|
||||
const EncryptionExchangeRequestValidate = (o, opts = {}, path = 'EncryptionExchangeRequest::root.') => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet)
|
||||
return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message');
|
||||
if (typeof o !== 'object' || o === null)
|
||||
return new Error(path + ': object is not an instance of an object or is null');
|
||||
if (typeof o.public_key !== 'string')
|
||||
return new Error(`${path}.public_key: is not a string`);
|
||||
if (opts.public_key_CustomCheck && !opts.public_key_CustomCheck(o.public_key))
|
||||
return new Error(`${path}.public_key: custom check failed`);
|
||||
if (typeof o.device_id !== 'string')
|
||||
return new Error(`${path}.device_id: is not a string`);
|
||||
if (opts.device_id_CustomCheck && !opts.device_id_CustomCheck(o.device_id))
|
||||
return new Error(`${path}.device_id: custom check failed`);
|
||||
return null;
|
||||
};
|
||||
exports.EncryptionExchangeRequestValidate = EncryptionExchangeRequestValidate;
|
||||
//# sourceMappingURL=types.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../proto/autogenerated/ts/types.ts"],"names":[],"mappings":";AAAA,+DAA+D;;;AAyClD,QAAA,gCAAgC,GAAO,EAAE,CAAA;AAK/C,MAAM,0BAA0B,GAAG,CAAC,CAAsB,EAAE,OAAkC,EAAE,EAAE,OAAe,2BAA2B,EAAgB,EAAE;IACjK,IAAI,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,kBAAkB;QAAE,OAAO,IAAI,KAAK,CAAC,IAAI,GAAG,yFAAyF,CAAC,CAAA;IAC5K,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,KAAK,CAAC,IAAI,GAAG,qDAAqD,CAAC,CAAA;IAEvH,IAAI,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,KAAK,CAAC,GAAG,IAAI,yBAAyB,CAAC,CAAA;IACnF,IAAI,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,KAAK,CAAC,GAAG,IAAI,6BAA6B,CAAC,CAAA;IAEtH,OAAO,IAAI,CAAA;AACf,CAAC,CAAA;AARY,QAAA,0BAA0B,8BAQtC;AAIY,QAAA,mBAAmB,GAAO,EAAE,CAAA;AAIlC,MAAM,aAAa,GAAG,CAAC,CAAS,EAAE,OAAqB,EAAE,EAAE,OAAe,cAAc,EAAgB,EAAE;IAC7G,IAAI,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,kBAAkB;QAAE,OAAO,IAAI,KAAK,CAAC,IAAI,GAAG,yFAAyF,CAAC,CAAA;IAC5K,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,KAAK,CAAC,IAAI,GAAG,qDAAqD,CAAC,CAAA;IAEvH,OAAO,IAAI,CAAA;AACf,CAAC,CAAA;AALY,QAAA,aAAa,iBAKzB;AAMY,QAAA,uCAAuC,GAAO,EAAE,CAAA;AAMtD,MAAM,iCAAiC,GAAG,CAAC,CAA6B,EAAE,OAAyC,EAAE,EAAE,OAAe,kCAAkC,EAAgB,EAAE;IAC7L,IAAI,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,kBAAkB;QAAE,OAAO,IAAI,KAAK,CAAC,IAAI,GAAG,yFAAyF,CAAC,CAAA;IAC5K,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,KAAK,CAAC,IAAI,GAAG,qDAAqD,CAAC,CAAA;IAEvH,IAAI,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ;QAAE,OAAO,IAAI,KAAK,CAAC,GAAG,IAAI,8BAA8B,CAAC,CAAA;IAC7F,IAAI,IAAI,CAAC,sBAAsB,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,UAAU,CAAC;QAAE,OAAO,IAAI,KAAK,CAAC,GAAG,IAAI,kCAAkC,CAAC,CAAA;IAE1I,IAAI,OAAO,CAAC,CAAC,SAAS,KAAK,QAAQ;QAAE,OAAO,IAAI,KAAK,CAAC,GAAG,IAAI,6BAA6B,CAAC,CAAA;IAC3F,IAAI,IAAI,CAAC,qBAAqB,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,KAAK,CAAC,GAAG,IAAI,iCAAiC,CAAC,CAAA;IAEtI,OAAO,IAAI,CAAA;AACf,CAAC,CAAA;AAXY,QAAA,iCAAiC,qCAW7C"}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.InvoicesClient = void 0;
|
||||
const invoices_1 = require("./invoices");
|
||||
const runtime_rpc_1 = require("@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
|
||||
*/
|
||||
class InvoicesClient {
|
||||
constructor(_transport) {
|
||||
this._transport = _transport;
|
||||
this.typeName = invoices_1.Invoices.typeName;
|
||||
this.methods = invoices_1.Invoices.methods;
|
||||
this.options = invoices_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.stackIntercept)("unary", this._transport, method, opt, input);
|
||||
}
|
||||
}
|
||||
exports.InvoicesClient = InvoicesClient;
|
||||
//# sourceMappingURL=invoices.client.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"invoices.client.js","sourceRoot":"","sources":["../../../proto/lnd/invoices.client.ts"],"names":[],"mappings":";;;AAKA,yCAAsC;AAQtC,0DAA0D;AA+C1D;;;;;GAKG;AACH,MAAa,cAAc;IAIvB,YAA6B,UAAwB;QAAxB,eAAU,GAAV,UAAU,CAAc;QAHrD,aAAQ,GAAG,mBAAQ,CAAC,QAAQ,CAAC;QAC7B,YAAO,GAAG,mBAAQ,CAAC,OAAO,CAAC;QAC3B,YAAO,GAAG,mBAAQ,CAAC,OAAO,CAAC;IAE3B,CAAC;IACD;;;;;;;OAOG;IACH,sBAAsB,CAAC,KAAoC,EAAE,OAAoB;QAC7E,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,IAAA,4BAAc,EAAyC,iBAAiB,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC1H,CAAC;IACD;;;;;;;OAOG;IACH,aAAa,CAAC,KAAuB,EAAE,OAAoB;QACvD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,IAAA,4BAAc,EAAsC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC7G,CAAC;IACD;;;;;;OAMG;IACH,cAAc,CAAC,KAA4B,EAAE,OAAoB;QAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,IAAA,4BAAc,EAA4C,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACnH,CAAC;IACD;;;;;;OAMG;IACH,aAAa,CAAC,KAAuB,EAAE,OAAoB;QACvD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,IAAA,4BAAc,EAAsC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC7G,CAAC;CACJ;AApDD,wCAoDC"}
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.InvoicesClient = void 0;
|
||||
// @generated by protobuf-ts 2.5.0 with parameter long_type_string,client_grpc1
|
||||
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
const invoices_1 = require("./invoices");
|
||||
const grpc = __importStar(require("@grpc/grpc-js"));
|
||||
/**
|
||||
* Invoices is a service that can be used to create, accept, settle and cancel
|
||||
* invoices.
|
||||
*
|
||||
* @generated from protobuf service invoicesrpc.Invoices
|
||||
*/
|
||||
class InvoicesClient extends grpc.Client {
|
||||
constructor(address, credentials, options = {}, binaryOptions = {}) {
|
||||
super(address, credentials, options);
|
||||
this._binaryOptions = binaryOptions;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options) {
|
||||
const method = invoices_1.Invoices.methods[0];
|
||||
return this.makeServerStreamRequest(`/${invoices_1.Invoices.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = invoices_1.Invoices.methods[1];
|
||||
return this.makeUnaryRequest(`/${invoices_1.Invoices.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = invoices_1.Invoices.methods[2];
|
||||
return this.makeUnaryRequest(`/${invoices_1.Invoices.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = invoices_1.Invoices.methods[3];
|
||||
return this.makeUnaryRequest(`/${invoices_1.Invoices.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
}
|
||||
exports.InvoicesClient = InvoicesClient;
|
||||
//# sourceMappingURL=invoices.grpc-client.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"invoices.grpc-client.js","sourceRoot":"","sources":["../../../proto/lnd/invoices.grpc-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,wFAAwF;AACxF,iBAAiB;AACjB,yCAAsC;AAWtC,oDAAsC;AAqDtC;;;;;GAKG;AACH,MAAa,cAAe,SAAQ,IAAI,CAAC,MAAM;IAE3C,YAAY,OAAe,EAAE,WAAoC,EAAE,UAA8B,EAAE,EAAE,gBAAiE,EAAE;QACpK,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACxC,CAAC;IACD;;;;;;;OAOG;IACH,sBAAsB,CAAC,KAAoC,EAAE,QAA2C,EAAE,OAA0B;QAChI,MAAM,MAAM,GAAG,mBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,uBAAuB,CAAyC,IAAI,mBAAQ,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,KAAoC,EAAU,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,KAAa,EAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,EAAE,KAAK,EAAG,QAAgB,EAAE,OAAO,CAAC,CAAC;IACtV,CAAC;IACD;;;;;;;OAOG;IACH,aAAa,CAAC,KAAuB,EAAE,QAAiH,EAAE,OAAiG,EAAE,QAA+E;QACxU,MAAM,MAAM,GAAG,mBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,gBAAgB,CAAsC,IAAI,mBAAQ,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,KAAuB,EAAU,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,KAAa,EAAqB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,EAAE,KAAK,EAAG,QAAgB,EAAG,OAAe,EAAG,QAAgB,CAAC,CAAC;IACrW,CAAC;IACD;;;;;;OAMG;IACH,cAAc,CAAC,KAA4B,EAAE,QAAkH,EAAE,OAAkG,EAAE,QAAgF;QACjV,MAAM,MAAM,GAAG,mBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,gBAAgB,CAA4C,IAAI,mBAAQ,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,KAA4B,EAAU,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,KAAa,EAAsB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,EAAE,KAAK,EAAG,QAAgB,EAAG,OAAe,EAAG,QAAgB,CAAC,CAAC;IACjX,CAAC;IACD;;;;;;OAMG;IACH,aAAa,CAAC,KAAuB,EAAE,QAAiH,EAAE,OAAiG,EAAE,QAA+E;QACxU,MAAM,MAAM,GAAG,mBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,gBAAgB,CAAsC,IAAI,mBAAQ,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,KAAuB,EAAU,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,KAAa,EAAqB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,EAAE,KAAK,EAAG,QAAgB,EAAG,OAAe,EAAG,QAAgB,CAAC,CAAC;IACrW,CAAC;CACJ;AApDD,wCAoDC"}
|
||||
|
|
@ -1,374 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Invoices = exports.SubscribeSingleInvoiceRequest = exports.SettleInvoiceResp = exports.SettleInvoiceMsg = exports.AddHoldInvoiceResp = exports.AddHoldInvoiceRequest = exports.CancelInvoiceResp = exports.CancelInvoiceMsg = void 0;
|
||||
// @generated by protobuf-ts 2.5.0 with parameter long_type_string
|
||||
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
const rpc_1 = require("./rpc");
|
||||
const runtime_rpc_1 = require("@protobuf-ts/runtime-rpc");
|
||||
const runtime_1 = require("@protobuf-ts/runtime");
|
||||
const runtime_2 = require("@protobuf-ts/runtime");
|
||||
const runtime_3 = require("@protobuf-ts/runtime");
|
||||
const runtime_4 = require("@protobuf-ts/runtime");
|
||||
const runtime_5 = require("@protobuf-ts/runtime");
|
||||
const rpc_2 = require("./rpc");
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class CancelInvoiceMsg$Type extends runtime_5.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, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader, length, options, target) {
|
||||
let message = target !== null && target !== void 0 ? 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 ? runtime_2.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, runtime_1.WireType.LengthDelimited).bytes(message.paymentHash);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.CancelInvoiceMsg
|
||||
*/
|
||||
exports.CancelInvoiceMsg = new CancelInvoiceMsg$Type();
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class CancelInvoiceResp$Type extends runtime_5.MessageType {
|
||||
constructor() {
|
||||
super("invoicesrpc.CancelInvoiceResp", []);
|
||||
}
|
||||
create(value) {
|
||||
const message = {};
|
||||
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader, length, options, target) {
|
||||
return target !== null && target !== void 0 ? target : this.create();
|
||||
}
|
||||
internalBinaryWrite(message, writer, options) {
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.CancelInvoiceResp
|
||||
*/
|
||||
exports.CancelInvoiceResp = new CancelInvoiceResp$Type();
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class AddHoldInvoiceRequest$Type extends runtime_5.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*/ },
|
||||
{ no: 10, name: "value_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
|
||||
{ no: 4, name: "description_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 5, name: "expiry", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
|
||||
{ no: 6, name: "fallback_addr", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 7, name: "cltv_expiry", kind: "scalar", T: 4 /*ScalarType.UINT64*/ },
|
||||
{ no: 8, name: "route_hints", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => rpc_2.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, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader, length, options, target) {
|
||||
let message = target !== null && target !== void 0 ? 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().toString();
|
||||
break;
|
||||
case /* int64 value_msat */ 10:
|
||||
message.valueMsat = reader.int64().toString();
|
||||
break;
|
||||
case /* bytes description_hash */ 4:
|
||||
message.descriptionHash = reader.bytes();
|
||||
break;
|
||||
case /* int64 expiry */ 5:
|
||||
message.expiry = reader.int64().toString();
|
||||
break;
|
||||
case /* string fallback_addr */ 6:
|
||||
message.fallbackAddr = reader.string();
|
||||
break;
|
||||
case /* uint64 cltv_expiry */ 7:
|
||||
message.cltvExpiry = reader.uint64().toString();
|
||||
break;
|
||||
case /* repeated lnrpc.RouteHint route_hints */ 8:
|
||||
message.routeHints.push(rpc_2.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 ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
internalBinaryWrite(message, writer, options) {
|
||||
/* string memo = 1; */
|
||||
if (message.memo !== "")
|
||||
writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.memo);
|
||||
/* bytes hash = 2; */
|
||||
if (message.hash.length)
|
||||
writer.tag(2, runtime_1.WireType.LengthDelimited).bytes(message.hash);
|
||||
/* int64 value = 3; */
|
||||
if (message.value !== "0")
|
||||
writer.tag(3, runtime_1.WireType.Varint).int64(message.value);
|
||||
/* int64 value_msat = 10; */
|
||||
if (message.valueMsat !== "0")
|
||||
writer.tag(10, runtime_1.WireType.Varint).int64(message.valueMsat);
|
||||
/* bytes description_hash = 4; */
|
||||
if (message.descriptionHash.length)
|
||||
writer.tag(4, runtime_1.WireType.LengthDelimited).bytes(message.descriptionHash);
|
||||
/* int64 expiry = 5; */
|
||||
if (message.expiry !== "0")
|
||||
writer.tag(5, runtime_1.WireType.Varint).int64(message.expiry);
|
||||
/* string fallback_addr = 6; */
|
||||
if (message.fallbackAddr !== "")
|
||||
writer.tag(6, runtime_1.WireType.LengthDelimited).string(message.fallbackAddr);
|
||||
/* uint64 cltv_expiry = 7; */
|
||||
if (message.cltvExpiry !== "0")
|
||||
writer.tag(7, runtime_1.WireType.Varint).uint64(message.cltvExpiry);
|
||||
/* repeated lnrpc.RouteHint route_hints = 8; */
|
||||
for (let i = 0; i < message.routeHints.length; i++)
|
||||
rpc_2.RouteHint.internalBinaryWrite(message.routeHints[i], writer.tag(8, runtime_1.WireType.LengthDelimited).fork(), options).join();
|
||||
/* bool private = 9; */
|
||||
if (message.private !== false)
|
||||
writer.tag(9, runtime_1.WireType.Varint).bool(message.private);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.AddHoldInvoiceRequest
|
||||
*/
|
||||
exports.AddHoldInvoiceRequest = new AddHoldInvoiceRequest$Type();
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class AddHoldInvoiceResp$Type extends runtime_5.MessageType {
|
||||
constructor() {
|
||||
super("invoicesrpc.AddHoldInvoiceResp", [
|
||||
{ no: 1, name: "payment_request", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
||||
]);
|
||||
}
|
||||
create(value) {
|
||||
const message = { paymentRequest: "" };
|
||||
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader, length, options, target) {
|
||||
let message = target !== null && target !== void 0 ? 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;
|
||||
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 ? runtime_2.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, runtime_1.WireType.LengthDelimited).string(message.paymentRequest);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.AddHoldInvoiceResp
|
||||
*/
|
||||
exports.AddHoldInvoiceResp = new AddHoldInvoiceResp$Type();
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class SettleInvoiceMsg$Type extends runtime_5.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, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader, length, options, target) {
|
||||
let message = target !== null && target !== void 0 ? 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 ? runtime_2.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, runtime_1.WireType.LengthDelimited).bytes(message.preimage);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.SettleInvoiceMsg
|
||||
*/
|
||||
exports.SettleInvoiceMsg = new SettleInvoiceMsg$Type();
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class SettleInvoiceResp$Type extends runtime_5.MessageType {
|
||||
constructor() {
|
||||
super("invoicesrpc.SettleInvoiceResp", []);
|
||||
}
|
||||
create(value) {
|
||||
const message = {};
|
||||
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader, length, options, target) {
|
||||
return target !== null && target !== void 0 ? target : this.create();
|
||||
}
|
||||
internalBinaryWrite(message, writer, options) {
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.SettleInvoiceResp
|
||||
*/
|
||||
exports.SettleInvoiceResp = new SettleInvoiceResp$Type();
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class SubscribeSingleInvoiceRequest$Type extends runtime_5.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, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader, length, options, target) {
|
||||
let message = target !== null && target !== void 0 ? 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 ? runtime_2.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, runtime_1.WireType.LengthDelimited).bytes(message.rHash);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @generated MessageType for protobuf message invoicesrpc.SubscribeSingleInvoiceRequest
|
||||
*/
|
||||
exports.SubscribeSingleInvoiceRequest = new SubscribeSingleInvoiceRequest$Type();
|
||||
/**
|
||||
* @generated ServiceType for protobuf service invoicesrpc.Invoices
|
||||
*/
|
||||
exports.Invoices = new runtime_rpc_1.ServiceType("invoicesrpc.Invoices", [
|
||||
{ name: "SubscribeSingleInvoice", serverStreaming: true, options: {}, I: exports.SubscribeSingleInvoiceRequest, O: rpc_1.Invoice },
|
||||
{ name: "CancelInvoice", options: {}, I: exports.CancelInvoiceMsg, O: exports.CancelInvoiceResp },
|
||||
{ name: "AddHoldInvoice", options: {}, I: exports.AddHoldInvoiceRequest, O: exports.AddHoldInvoiceResp },
|
||||
{ name: "SettleInvoice", options: {}, I: exports.SettleInvoiceMsg, O: exports.SettleInvoiceResp }
|
||||
]);
|
||||
//# sourceMappingURL=invoices.js.map
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1,225 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RouterClient = void 0;
|
||||
const router_1 = require("./router");
|
||||
const runtime_rpc_1 = require("@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
|
||||
*/
|
||||
class RouterClient {
|
||||
constructor(_transport) {
|
||||
this._transport = _transport;
|
||||
this.typeName = router_1.Router.typeName;
|
||||
this.methods = router_1.Router.methods;
|
||||
this.options = router_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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[2], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[3], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[4], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[5], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[6], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[7], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[8], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[9], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[10], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[11], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[12], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[13], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[14], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[15], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[16], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.stackIntercept)("unary", this._transport, method, opt, input);
|
||||
}
|
||||
}
|
||||
exports.RouterClient = RouterClient;
|
||||
//# sourceMappingURL=router.client.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"router.client.js","sourceRoot":"","sources":["../../../proto/lnd/router.client.ts"],"names":[],"mappings":";;;AAKA,qCAAkC;AA8BlC,0DAA0D;AAsK1D;;;;;GAKG;AACH,MAAa,YAAY;IAIrB,YAA6B,UAAwB;QAAxB,eAAU,GAAV,UAAU,CAAc;QAHrD,aAAQ,GAAG,eAAM,CAAC,QAAQ,CAAC;QAC3B,YAAO,GAAG,eAAM,CAAC,OAAO,CAAC;QACzB,YAAO,GAAG,eAAM,CAAC,OAAO,CAAC;IAEzB,CAAC;IACD;;;;;;;OAOG;IACH,aAAa,CAAC,KAAyB,EAAE,OAAoB;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,IAAA,4BAAc,EAA8B,iBAAiB,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC/G,CAAC;IACD;;;;;;OAMG;IACH,cAAc,CAAC,KAA0B,EAAE,OAAoB;QAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,IAAA,4BAAc,EAA+B,iBAAiB,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAChH,CAAC;IACD;;;;;;OAMG;IACH,gBAAgB,CAAC,KAAsB,EAAE,OAAoB;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,IAAA,4BAAc,EAAoC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC3G,CAAC;IACD;;;;;;;;;;OAUG;IACH,WAAW,CAAC,KAAyB,EAAE,OAAoB;QACvD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,IAAA,4BAAc,EAA0C,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACjH,CAAC;IACD;;;;;;;;OAQG;IACH,aAAa,CAAC,KAAyB,EAAE,OAAoB;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,IAAA,4BAAc,EAAkC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACzG,CAAC;IACD;;;;;;OAMG;IACH,mBAAmB,CAAC,KAAiC,EAAE,OAAoB;QACvE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,IAAA,4BAAc,EAA0D,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACjI,CAAC;IACD;;;;;;OAMG;IACH,mBAAmB,CAAC,KAAiC,EAAE,OAAoB;QACvE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,IAAA,4BAAc,EAA0D,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACjI,CAAC;IACD;;;;;;;;OAQG;IACH,qBAAqB,CAAC,KAAmC,EAAE,OAAoB;QAC3E,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,IAAA,4BAAc,EAA8D,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACrI,CAAC;IACD;;;;;OAKG;IACH,uBAAuB,CAAC,KAAqC,EAAE,OAAoB;QAC/E,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,IAAA,4BAAc,EAAkE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACzI,CAAC;IACD;;;;;;OAMG;IACH,uBAAuB,CAAC,KAAqC,EAAE,OAAoB;QAC/E,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,IAAA,4BAAc,EAAkE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACzI,CAAC;IACD;;;;;;OAMG;IACH,gBAAgB,CAAC,KAA8B,EAAE,OAAoB;QACjE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC7E,OAAO,IAAA,4BAAc,EAAoD,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC3H,CAAC;IACD;;;;;;;OAOG;IACH,UAAU,CAAC,KAAwB,EAAE,OAAoB;QACrD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC7E,OAAO,IAAA,4BAAc,EAAwC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC/G,CAAC;IACD;;;;;;OAMG;IACH,mBAAmB,CAAC,KAAiC,EAAE,OAAoB;QACvE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC7E,OAAO,IAAA,4BAAc,EAAwC,iBAAiB,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACzH,CAAC;IACD;;;;;;;;OAQG;IACH,WAAW,CAAC,KAAyB,EAAE,OAAoB;QACvD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC7E,OAAO,IAAA,4BAAc,EAAoC,iBAAiB,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACrH,CAAC;IACD;;;;;;;OAOG;IACH,YAAY,CAAC,KAA0B,EAAE,OAAoB;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC7E,OAAO,IAAA,4BAAc,EAAqC,iBAAiB,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACtH,CAAC;IACD;;;;;;;;;OASG;IACH,eAAe,CAAC,OAAoB;QAChC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC7E,OAAO,IAAA,4BAAc,EAA4D,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7H,CAAC;IACD;;;;;;;;OAQG;IACH,gBAAgB,CAAC,KAA8B,EAAE,OAAoB;QACjE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC7E,OAAO,IAAA,4BAAc,EAAoD,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC3H,CAAC;CACJ;AAlND,oCAkNC"}
|
||||
|
|
@ -1,249 +0,0 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RouterClient = void 0;
|
||||
// @generated by protobuf-ts 2.5.0 with parameter long_type_string,client_grpc1
|
||||
// @generated from protobuf file "router.proto" (package "routerrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
const router_1 = require("./router");
|
||||
const grpc = __importStar(require("@grpc/grpc-js"));
|
||||
/**
|
||||
* Router is a service that offers advanced interaction with the router
|
||||
* subsystem of the daemon.
|
||||
*
|
||||
* @generated from protobuf service routerrpc.Router
|
||||
*/
|
||||
class RouterClient extends grpc.Client {
|
||||
constructor(address, credentials, options = {}, binaryOptions = {}) {
|
||||
super(address, credentials, options);
|
||||
this._binaryOptions = binaryOptions;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options) {
|
||||
const method = router_1.Router.methods[0];
|
||||
return this.makeServerStreamRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options) {
|
||||
const method = router_1.Router.methods[1];
|
||||
return this.makeServerStreamRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = router_1.Router.methods[2];
|
||||
return this.makeUnaryRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = router_1.Router.methods[3];
|
||||
return this.makeUnaryRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = router_1.Router.methods[4];
|
||||
return this.makeUnaryRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* ResetMissionControl clears all mission control state and starts with a clean
|
||||
* slate.
|
||||
*
|
||||
* @generated from protobuf rpc: ResetMissionControl(routerrpc.ResetMissionControlRequest) returns (routerrpc.ResetMissionControlResponse);
|
||||
*/
|
||||
resetMissionControl(input, metadata, options, callback) {
|
||||
const method = router_1.Router.methods[5];
|
||||
return this.makeUnaryRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = router_1.Router.methods[6];
|
||||
return this.makeUnaryRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = router_1.Router.methods[7];
|
||||
return this.makeUnaryRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* GetMissionControlConfig returns mission control's current config.
|
||||
*
|
||||
* @generated from protobuf rpc: GetMissionControlConfig(routerrpc.GetMissionControlConfigRequest) returns (routerrpc.GetMissionControlConfigResponse);
|
||||
*/
|
||||
getMissionControlConfig(input, metadata, options, callback) {
|
||||
const method = router_1.Router.methods[8];
|
||||
return this.makeUnaryRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = router_1.Router.methods[9];
|
||||
return this.makeUnaryRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = router_1.Router.methods[10];
|
||||
return this.makeUnaryRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = router_1.Router.methods[11];
|
||||
return this.makeUnaryRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options) {
|
||||
const method = router_1.Router.methods[12];
|
||||
return this.makeServerStreamRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options) {
|
||||
const method = router_1.Router.methods[13];
|
||||
return this.makeServerStreamRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options) {
|
||||
const method = router_1.Router.methods[14];
|
||||
return this.makeServerStreamRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
|
||||
}
|
||||
/**
|
||||
* *
|
||||
* 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(metadata, options) {
|
||||
const method = router_1.Router.methods[15];
|
||||
return this.makeBidiStreamRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), metadata, options);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = router_1.Router.methods[16];
|
||||
return this.makeUnaryRequest(`/${router_1.Router.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
}
|
||||
exports.RouterClient = RouterClient;
|
||||
//# sourceMappingURL=router.grpc-client.js.map
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
|
@ -1,803 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LightningClient = void 0;
|
||||
const rpc_1 = require("./rpc");
|
||||
const runtime_rpc_1 = require("@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
|
||||
*/
|
||||
class LightningClient {
|
||||
constructor(_transport) {
|
||||
this._transport = _transport;
|
||||
this.typeName = rpc_1.Lightning.typeName;
|
||||
this.methods = rpc_1.Lightning.methods;
|
||||
this.options = rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.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 (0, runtime_rpc_1.stackIntercept)("serverStreaming", 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[23], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[24], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[25], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[26], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[27], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[28], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[29], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[30], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[31], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[32], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[33], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[34], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[35], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[36], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.stackIntercept)("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* DeleteAllPayments deletes all outgoing payments from DB.
|
||||
*
|
||||
* @generated from protobuf rpc: DeleteAllPayments(lnrpc.DeleteAllPaymentsRequest) returns (lnrpc.DeleteAllPaymentsResponse);
|
||||
*/
|
||||
deleteAllPayments(input, options) {
|
||||
const method = this.methods[37], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[38], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[39], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[40], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[41], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[42], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[43], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[44], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[45], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[46], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[47], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[48], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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. If no time-range is specified, then the first chunk
|
||||
* of the past 24 hrs of forwarding history are returned.
|
||||
*
|
||||
* 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[49], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[50], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[51], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[52], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[53], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[54], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[55], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[56], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[57], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.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[58], opt = this._transport.mergeOptions(options);
|
||||
return (0, runtime_rpc_1.stackIntercept)("unary", this._transport, method, opt, input);
|
||||
}
|
||||
}
|
||||
exports.LightningClient = LightningClient;
|
||||
//# sourceMappingURL=rpc.client.js.map
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1,827 +0,0 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LightningClient = void 0;
|
||||
// @generated by protobuf-ts 2.5.0 with parameter long_type_string,client_grpc1
|
||||
// @generated from protobuf file "rpc.proto" (package "lnrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
const rpc_1 = require("./rpc");
|
||||
const grpc = __importStar(require("@grpc/grpc-js"));
|
||||
//
|
||||
// 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
|
||||
*/
|
||||
class LightningClient extends grpc.Client {
|
||||
constructor(address, credentials, options = {}, binaryOptions = {}) {
|
||||
super(address, credentials, options);
|
||||
this._binaryOptions = binaryOptions;
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[0];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[1];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[2];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[3];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[4];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[5];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options) {
|
||||
const method = rpc_1.Lightning.methods[6];
|
||||
return this.makeServerStreamRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[7];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[8];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[9];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[10];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[11];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[12];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* lncli: `listpeers`
|
||||
* ListPeers returns a verbose listing of all currently active peers.
|
||||
*
|
||||
* @generated from protobuf rpc: ListPeers(lnrpc.ListPeersRequest) returns (lnrpc.ListPeersResponse);
|
||||
*/
|
||||
listPeers(input, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[13];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options) {
|
||||
const method = rpc_1.Lightning.methods[14];
|
||||
return this.makeServerStreamRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[15];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* * 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[16];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
// 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[17];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[18];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options) {
|
||||
const method = rpc_1.Lightning.methods[19];
|
||||
return this.makeServerStreamRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[20];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[21];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options) {
|
||||
const method = rpc_1.Lightning.methods[22];
|
||||
return this.makeServerStreamRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[23];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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(metadata, options) {
|
||||
const method = rpc_1.Lightning.methods[24];
|
||||
return this.makeBidiStreamRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), metadata, options);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options) {
|
||||
const method = rpc_1.Lightning.methods[25];
|
||||
return this.makeServerStreamRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[26];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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(metadata, options) {
|
||||
const method = rpc_1.Lightning.methods[27];
|
||||
return this.makeBidiStreamRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), metadata, options);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[28];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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(metadata, options) {
|
||||
const method = rpc_1.Lightning.methods[29];
|
||||
return this.makeBidiStreamRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), metadata, options);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[30];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[31];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[32];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[33];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options) {
|
||||
const method = rpc_1.Lightning.methods[34];
|
||||
return this.makeServerStreamRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[35];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* lncli: `listpayments`
|
||||
* ListPayments returns a list of all outgoing payments.
|
||||
*
|
||||
* @generated from protobuf rpc: ListPayments(lnrpc.ListPaymentsRequest) returns (lnrpc.ListPaymentsResponse);
|
||||
*/
|
||||
listPayments(input, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[36];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* DeleteAllPayments deletes all outgoing payments from DB.
|
||||
*
|
||||
* @generated from protobuf rpc: DeleteAllPayments(lnrpc.DeleteAllPaymentsRequest) returns (lnrpc.DeleteAllPaymentsResponse);
|
||||
*/
|
||||
deleteAllPayments(input, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[37];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[38];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[39];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[40];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[41];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[42];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[43];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[44];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options) {
|
||||
const method = rpc_1.Lightning.methods[45];
|
||||
return this.makeServerStreamRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[46];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[47];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[48];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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. If no time-range is specified, then the first chunk
|
||||
* of the past 24 hrs of forwarding history are returned.
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[49];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[50];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[51];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[52];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[53];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 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, metadata, options) {
|
||||
const method = rpc_1.Lightning.methods[54];
|
||||
return this.makeServerStreamRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[55];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* lncli: `listmacaroonids`
|
||||
* ListMacaroonIDs returns all root key IDs that are in use.
|
||||
*
|
||||
* @generated from protobuf rpc: ListMacaroonIDs(lnrpc.ListMacaroonIDsRequest) returns (lnrpc.ListMacaroonIDsResponse);
|
||||
*/
|
||||
listMacaroonIDs(input, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[56];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[57];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
/**
|
||||
* 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, metadata, options, callback) {
|
||||
const method = rpc_1.Lightning.methods[58];
|
||||
return this.makeUnaryRequest(`/${rpc_1.Lightning.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
|
||||
}
|
||||
}
|
||||
exports.LightningClient = LightningClient;
|
||||
//# sourceMappingURL=rpc.grpc-client.js.map
|
||||
File diff suppressed because one or more lines are too long
12362
build/proto/lnd/rpc.js
12362
build/proto/lnd/rpc.js
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
|
@ -1,19 +0,0 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const serverOptions = {
|
||||
AdminAuthGuard: (authHeader) => __awaiter(void 0, void 0, void 0, function* () { console.log("admin auth login with header: " + authHeader); return { pub: "__pubkey__" }; }),
|
||||
GuestAuthGuard: (authHeader) => __awaiter(void 0, void 0, void 0, function* () { console.log("guest auth login with header: " + authHeader); return { token: "__token__" }; }),
|
||||
NoAuthAuthGuard: (_) => __awaiter(void 0, void 0, void 0, function* () { return ({}); }),
|
||||
encryptionCallback: (_, b) => b
|
||||
};
|
||||
exports.default = serverOptions;
|
||||
//# sourceMappingURL=auth.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,MAAM,aAAa,GAAkB;IACjC,cAAc,EAAE,CAAO,UAAU,EAAE,EAAE,kDAAG,OAAO,CAAC,GAAG,CAAC,gCAAgC,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,CAAA,CAAC,CAAC,CAAA;IAClI,cAAc,EAAE,CAAO,UAAU,EAAE,EAAE,kDAAG,OAAO,CAAC,GAAG,CAAC,gCAAgC,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAA,CAAC,CAAC,CAAA;IACnI,eAAe,EAAE,CAAO,CAAC,EAAE,EAAE,kDAAC,OAAA,CAAC,EAAE,CAAC,CAAA,GAAA;IAClC,kBAAkB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;CAClC,CAAA;AACD,kBAAe,aAAa,CAAA"}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("dotenv/config");
|
||||
const server_1 = __importDefault(require("./server"));
|
||||
server_1.default.Listen(3000);
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;AAAA,yBAAsB;AACtB,sDAA6B;AAG7B,gBAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA"}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ServerTestSuite = void 0;
|
||||
require("dotenv/config"); // TODO - test env
|
||||
const testyts_1 = require("testyts");
|
||||
const express_server_1 = __importDefault(require("../proto/autogenerated/ts/express_server"));
|
||||
const http_client_1 = __importDefault(require("../proto/autogenerated/ts/http_client"));
|
||||
const main_1 = __importDefault(require("./services/main"));
|
||||
const auth_1 = __importDefault(require("./auth"));
|
||||
const testPort = 4000;
|
||||
const server = (0, express_server_1.default)(main_1.default, Object.assign(Object.assign({}, auth_1.default), { throwErrors: true }));
|
||||
const client = (0, http_client_1.default)({
|
||||
baseUrl: `http://localhost:${testPort}`,
|
||||
retrieveAdminAuth: () => __awaiter(void 0, void 0, void 0, function* () { return (""); }),
|
||||
retrieveGuestAuth: () => __awaiter(void 0, void 0, void 0, function* () { return (""); }),
|
||||
retrieveNoAuthAuth: () => __awaiter(void 0, void 0, void 0, function* () { return (""); }),
|
||||
});
|
||||
let ServerTestSuite = class ServerTestSuite {
|
||||
startServer() {
|
||||
server.Listen(testPort);
|
||||
}
|
||||
stopServer() {
|
||||
server.Close();
|
||||
}
|
||||
health() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield client.Health();
|
||||
});
|
||||
}
|
||||
getInfo() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
console.log(yield client.LndGetInfo());
|
||||
});
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
(0, testyts_1.BeforeAll)(),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", void 0)
|
||||
], ServerTestSuite.prototype, "startServer", null);
|
||||
__decorate([
|
||||
(0, testyts_1.AfterAll)(),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", void 0)
|
||||
], ServerTestSuite.prototype, "stopServer", null);
|
||||
__decorate([
|
||||
(0, testyts_1.Test)(),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", Promise)
|
||||
], ServerTestSuite.prototype, "health", null);
|
||||
__decorate([
|
||||
(0, testyts_1.Test)(),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", Promise)
|
||||
], ServerTestSuite.prototype, "getInfo", null);
|
||||
ServerTestSuite = __decorate([
|
||||
(0, testyts_1.TestSuite)()
|
||||
], ServerTestSuite);
|
||||
exports.ServerTestSuite = ServerTestSuite;
|
||||
//# sourceMappingURL=index.spec.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../src/index.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,yBAAsB,CAAC,kBAAkB;AACzC,qCAAuE;AACvE,8FAAgE;AAChE,wFAA6D;AAC7D,2DAAsC;AACtC,kDAAmC;AACnC,MAAM,QAAQ,GAAG,IAAI,CAAA;AACrB,MAAM,MAAM,GAAG,IAAA,wBAAS,EAAC,cAAO,kCAAO,cAAa,KAAE,WAAW,EAAE,IAAI,IAAG,CAAA;AAC1E,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC;IACrB,OAAO,EAAE,oBAAoB,QAAQ,EAAE;IACvC,iBAAiB,EAAE,GAAS,EAAE,kDAAC,OAAA,CAAC,EAAE,CAAC,CAAA,GAAA;IACnC,iBAAiB,EAAE,GAAS,EAAE,kDAAC,OAAA,CAAC,EAAE,CAAC,CAAA,GAAA;IACnC,kBAAkB,EAAE,GAAS,EAAE,kDAAC,OAAA,CAAC,EAAE,CAAC,CAAA,GAAA;CACvC,CAAC,CAAA;AAEF,IAAa,eAAe,GAA5B,MAAa,eAAe;IAExB,WAAW;QACP,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IAC3B,CAAC;IAED,UAAU;QACN,MAAM,CAAC,KAAK,EAAE,CAAA;IAClB,CAAC;IAEK,MAAM;;YACR,MAAM,MAAM,CAAC,MAAM,EAAE,CAAA;QACzB,CAAC;KAAA;IAGK,OAAO;;YACT,OAAO,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC,CAAA;QAC1C,CAAC;KAAA;CACJ,CAAA;AAhBG;IADC,IAAA,mBAAS,GAAE;;;;kDAGX;AAED;IADC,IAAA,kBAAQ,GAAE;;;;iDAGV;AAED;IADC,IAAA,cAAI,GAAE;;;;6CAGN;AAGD;IADC,IAAA,cAAI,GAAE;;;;8CAGN;AAjBQ,eAAe;IAD3B,IAAA,mBAAS,GAAE;GACC,eAAe,CAkB3B;AAlBY,0CAAe"}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const express_server_1 = __importDefault(require("../proto/autogenerated/ts/express_server"));
|
||||
const main_1 = __importDefault(require("./services/main"));
|
||||
const auth_1 = __importDefault(require("./auth"));
|
||||
exports.default = (0, express_server_1.default)(main_1.default, auth_1.default);
|
||||
//# sourceMappingURL=server.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;;;;AAAA,8FAAgE;AAChE,2DAAqC;AACrC,kDAAmC;AACnC,kBAAe,IAAA,wBAAS,EAAC,cAAO,EAAE,cAAa,CAAC,CAAA"}
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ServerTestSuite = void 0;
|
||||
require("dotenv/config"); // TODO - test env
|
||||
const testyts_1 = require("testyts");
|
||||
const http_client_1 = __importDefault(require("../proto/autogenerated/ts/http_client"));
|
||||
const server_1 = __importDefault(require("./server"));
|
||||
const testPort = 4000;
|
||||
const client = (0, http_client_1.default)({
|
||||
baseUrl: `http://localhost:${testPort}`,
|
||||
retrieveAdminAuth: () => __awaiter(void 0, void 0, void 0, function* () { return (""); }),
|
||||
retrieveGuestAuth: () => __awaiter(void 0, void 0, void 0, function* () { return (""); }),
|
||||
retrieveNoAuthAuth: () => __awaiter(void 0, void 0, void 0, function* () { return (""); }),
|
||||
});
|
||||
let ServerTestSuite = class ServerTestSuite {
|
||||
startServer() {
|
||||
server_1.default.Listen(testPort);
|
||||
}
|
||||
stopServer() {
|
||||
server_1.default.Close();
|
||||
}
|
||||
health() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield client.Health();
|
||||
});
|
||||
}
|
||||
getInfo() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
console.log(yield client.LndGetInfo());
|
||||
});
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
(0, testyts_1.BeforeAll)(),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", void 0)
|
||||
], ServerTestSuite.prototype, "startServer", null);
|
||||
__decorate([
|
||||
(0, testyts_1.AfterAll)(),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", void 0)
|
||||
], ServerTestSuite.prototype, "stopServer", null);
|
||||
__decorate([
|
||||
(0, testyts_1.Test)(),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", Promise)
|
||||
], ServerTestSuite.prototype, "health", null);
|
||||
__decorate([
|
||||
(0, testyts_1.Test)(),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", Promise)
|
||||
], ServerTestSuite.prototype, "getInfo", null);
|
||||
ServerTestSuite = __decorate([
|
||||
(0, testyts_1.TestSuite)()
|
||||
], ServerTestSuite);
|
||||
exports.ServerTestSuite = ServerTestSuite;
|
||||
//# sourceMappingURL=server.spec.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"server.spec.js","sourceRoot":"","sources":["../../src/server.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,yBAAsB,CAAC,kBAAkB;AACzC,qCAAuE;AACvE,wFAA6D;AAC7D,sDAA8C;AAC9C,MAAM,QAAQ,GAAG,IAAI,CAAA;AACrB,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC;IACrB,OAAO,EAAE,oBAAoB,QAAQ,EAAE;IACvC,iBAAiB,EAAE,GAAS,EAAE,kDAAC,OAAA,CAAC,EAAE,CAAC,CAAA,GAAA;IACnC,iBAAiB,EAAE,GAAS,EAAE,kDAAC,OAAA,CAAC,EAAE,CAAC,CAAA,GAAA;IACnC,kBAAkB,EAAE,GAAS,EAAE,kDAAC,OAAA,CAAC,EAAE,CAAC,CAAA,GAAA;CACvC,CAAC,CAAA;AAEF,IAAa,eAAe,GAA5B,MAAa,eAAe;IAExB,WAAW;QACP,gBAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IAC3B,CAAC;IAED,UAAU;QACN,gBAAM,CAAC,KAAK,EAAE,CAAA;IAClB,CAAC;IAEK,MAAM;;YACR,MAAM,MAAM,CAAC,MAAM,EAAE,CAAA;QACzB,CAAC;KAAA;IAGK,OAAO;;YACT,OAAO,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC,CAAA;QAC1C,CAAC;KAAA;CACJ,CAAA;AAhBG;IADC,IAAA,mBAAS,GAAE;;;;kDAGX;AAED;IADC,IAAA,kBAAQ,GAAE;;;;iDAGV;AAED;IADC,IAAA,cAAI,GAAE;;;;6CAGN;AAGD;IADC,IAAA,cAAI,GAAE;;;;8CAGN;AAjBQ,eAAe;IAD3B,IAAA,mBAAS,GAAE;GACC,eAAe,CAkB3B;AAlBY,0CAAe"}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//const grpc = require('@grpc/grpc-js');
|
||||
const grpc_js_1 = require("@grpc/grpc-js");
|
||||
const grpc_transport_1 = require("@protobuf-ts/grpc-transport");
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const rpc_client_1 = require("../../../proto/lnd/rpc.client");
|
||||
const invoices_client_1 = require("../../../proto/lnd/invoices.client");
|
||||
const router_client_1 = require("../../../proto/lnd/router.client");
|
||||
const lndAddr = process.env.LND_ADDRESS;
|
||||
const lndCertPath = process.env.LND_CERT_PATH;
|
||||
const lndMacaroonPath = process.env.LND_MACAROON_PATH;
|
||||
if (!lndAddr || !lndCertPath || !lndMacaroonPath) {
|
||||
throw new Error(`Something missing from ADDR/TLS/MACAROON`);
|
||||
}
|
||||
const lndCert = fs_1.default.readFileSync(lndCertPath);
|
||||
const macaroon = fs_1.default.readFileSync(lndMacaroonPath).toString('hex');
|
||||
const sslCreds = grpc_js_1.credentials.createSsl(lndCert);
|
||||
const macaroonCreds = grpc_js_1.credentials.createFromMetadataGenerator(function (args, callback) {
|
||||
let metadata = new grpc_js_1.Metadata();
|
||||
metadata.add('macaroon', macaroon);
|
||||
callback(null, metadata);
|
||||
});
|
||||
const creds = grpc_js_1.credentials.combineChannelCredentials(sslCreds, macaroonCreds);
|
||||
const transport = new grpc_transport_1.GrpcTransport({ host: lndAddr, channelCredentials: creds });
|
||||
const lightning = new rpc_client_1.LightningClient(transport);
|
||||
const invoices = new invoices_client_1.InvoicesClient(transport);
|
||||
const router = new router_client_1.RouterClient(transport);
|
||||
const DefaultMetadata = (deadline = 10 * 1000) => ({ deadline: Date.now() + deadline });
|
||||
exports.default = {
|
||||
getInfo: () => __awaiter(void 0, void 0, void 0, function* () { return (yield lightning.getInfo({}, DefaultMetadata())).response; })
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/lnd/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,wCAAwC;AACxC,2CAAqD;AACrD,gEAA4D;AAC5D,4CAAmB;AACnB,8DAA+D;AAC/D,wEAAmE;AACnE,oEAA+D;AAG/D,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;AACxC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;AAC9C,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;AACtD,IAAI,CAAC,OAAO,IAAI,CAAC,WAAW,IAAI,CAAC,eAAe,EAAE;IAC9C,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;CAC/D;AACD,MAAM,OAAO,GAAG,YAAE,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;AAC7C,MAAM,QAAQ,GAAG,YAAE,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAClE,MAAM,QAAQ,GAAG,qBAAW,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AAChD,MAAM,aAAa,GAAG,qBAAW,CAAC,2BAA2B,CACzD,UAAU,IAAS,EAAE,QAAa;IAC9B,IAAI,QAAQ,GAAG,IAAI,kBAAQ,EAAE,CAAC;IAC9B,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC7B,CAAC,CACJ,CAAC;AACF,MAAM,KAAK,GAAG,qBAAW,CAAC,yBAAyB,CAC/C,QAAQ,EACR,aAAa,CAChB,CAAC;AACF,MAAM,SAAS,GAAG,IAAI,8BAAa,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,CAAA;AACjF,MAAM,SAAS,GAAG,IAAI,4BAAe,CAAC,SAAS,CAAC,CAAA;AAChD,MAAM,QAAQ,GAAG,IAAI,gCAAc,CAAC,SAAS,CAAC,CAAA;AAC9C,MAAM,MAAM,GAAG,IAAI,4BAAY,CAAC,SAAS,CAAC,CAAA;AAC1C,MAAM,eAAe,GAAG,CAAC,QAAQ,GAAG,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAA;AAEvF,kBAAe;IACX,OAAO,EAAE,GAAmC,EAAE,kDAAC,OAAA,CAAC,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAA,GAAA;CAC3G,CAAA"}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const lnd_1 = __importDefault(require("../lnd"));
|
||||
const methods = {
|
||||
EncryptionExchange: (ctx, req) => __awaiter(void 0, void 0, void 0, function* () { }),
|
||||
Health: (ctx) => __awaiter(void 0, void 0, void 0, function* () { }),
|
||||
LndGetInfo: (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const info = yield lnd_1.default.getInfo();
|
||||
return { alias: info.alias };
|
||||
})
|
||||
};
|
||||
exports.default = methods;
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/main/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,iDAAwB;AACxB,MAAM,OAAO,GAAwB;IACjC,kBAAkB,EAAE,CAAO,GAAqC,EAAE,GAAoC,EAAiB,EAAE,kDAAG,CAAC,CAAA;IAC7H,MAAM,EAAE,CAAO,GAAyB,EAAiB,EAAE,kDAAG,CAAC,CAAA;IAC/D,UAAU,EAAE,CAAO,GAA6B,EAAqC,EAAE;QACnF,MAAM,IAAI,GAAG,MAAM,aAAG,CAAC,OAAO,EAAE,CAAA;QAChC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAA;IAEhC,CAAC,CAAA;CACJ,CAAA;AACD,kBAAe,OAAO,CAAA"}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
"use strict";
|
||||
// This file was autogenerated from a .proto file, DO NOT EDIT!
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.EmptyValidate = exports.EmptyOptionalFields = exports.EncryptionExchangeRequestValidate = exports.EncryptionExchangeRequestOptionalFields = void 0;
|
||||
exports.EncryptionExchangeRequestOptionalFields = [];
|
||||
var EncryptionExchangeRequestValidate = function (o, opts, path) {
|
||||
if (opts === void 0) { opts = {}; }
|
||||
if (path === void 0) { path = 'EncryptionExchangeRequest::root.'; }
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet)
|
||||
return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message');
|
||||
if (typeof o !== 'object' || o === null)
|
||||
return new Error(path + ': object is not an instance of an object or is null');
|
||||
if (typeof o.public_key !== 'string')
|
||||
return new Error("".concat(path, ".public_key: is not a string"));
|
||||
if (opts.public_key_CustomCheck && !opts.public_key_CustomCheck(o.public_key))
|
||||
return new Error("".concat(path, ".public_key: custom check failed"));
|
||||
if (typeof o.device_id !== 'string')
|
||||
return new Error("".concat(path, ".device_id: is not a string"));
|
||||
if (opts.device_id_CustomCheck && !opts.device_id_CustomCheck(o.device_id))
|
||||
return new Error("".concat(path, ".device_id: custom check failed"));
|
||||
return null;
|
||||
};
|
||||
exports.EncryptionExchangeRequestValidate = EncryptionExchangeRequestValidate;
|
||||
exports.EmptyOptionalFields = [];
|
||||
var EmptyValidate = function (o, opts, path) {
|
||||
if (opts === void 0) { opts = {}; }
|
||||
if (path === void 0) { path = 'Empty::root.'; }
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet)
|
||||
return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message');
|
||||
if (typeof o !== 'object' || o === null)
|
||||
return new Error(path + ': object is not an instance of an object or is null');
|
||||
return null;
|
||||
};
|
||||
exports.EmptyValidate = EmptyValidate;
|
||||
//# sourceMappingURL=types.js.map
|
||||
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../proto/autogenerated/ts/types.ts"],"names":[],"mappings":";AAAA,+DAA+D;;;AA8BlD,QAAA,uCAAuC,GAAO,EAAE,CAAA;AAMtD,IAAM,iCAAiC,GAAG,UAAC,CAA6B,EAAE,IAA2C,EAAE,IAAiD;IAA9F,qBAAA,EAAA,SAA2C;IAAE,qBAAA,EAAA,yCAAiD;IAC3K,IAAI,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,kBAAkB;QAAE,OAAO,IAAI,KAAK,CAAC,IAAI,GAAG,yFAAyF,CAAC,CAAA;IAC5K,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,KAAK,CAAC,IAAI,GAAG,qDAAqD,CAAC,CAAA;IAEvH,IAAI,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ;QAAE,OAAO,IAAI,KAAK,CAAC,UAAG,IAAI,iCAA8B,CAAC,CAAA;IAC7F,IAAI,IAAI,CAAC,sBAAsB,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,UAAU,CAAC;QAAE,OAAO,IAAI,KAAK,CAAC,UAAG,IAAI,qCAAkC,CAAC,CAAA;IAE1I,IAAI,OAAO,CAAC,CAAC,SAAS,KAAK,QAAQ;QAAE,OAAO,IAAI,KAAK,CAAC,UAAG,IAAI,gCAA6B,CAAC,CAAA;IAC3F,IAAI,IAAI,CAAC,qBAAqB,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,KAAK,CAAC,UAAG,IAAI,oCAAiC,CAAC,CAAA;IAEtI,OAAO,IAAI,CAAA;AACf,CAAC,CAAA;AAXY,QAAA,iCAAiC,qCAW7C;AAIY,QAAA,mBAAmB,GAAO,EAAE,CAAA;AAIlC,IAAM,aAAa,GAAG,UAAC,CAAS,EAAE,IAAuB,EAAE,IAA6B;IAAtD,qBAAA,EAAA,SAAuB;IAAE,qBAAA,EAAA,qBAA6B;IAC3F,IAAI,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,kBAAkB;QAAE,OAAO,IAAI,KAAK,CAAC,IAAI,GAAG,yFAAyF,CAAC,CAAA;IAC5K,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,KAAK,CAAC,IAAI,GAAG,qDAAqD,CAAC,CAAA;IAEvH,OAAO,IAAI,CAAA;AACf,CAAC,CAAA;AALY,QAAA,aAAa,iBAKzB"}
|
||||
2142
package-lock.json
generated
2142
package-lock.json
generated
File diff suppressed because it is too large
Load diff
18
package.json
18
package.json
|
|
@ -5,10 +5,11 @@
|
|||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tsc && testyts",
|
||||
"start": "tsc && ts-node src/index",
|
||||
"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/* ",
|
||||
"build_lnd_client": "cd proto && rimraf lnd/* && npx protoc --ts_out ./lnd --ts_opt long_type_string --proto_path others others/* "
|
||||
"build_lnd_client": "cd proto && rimraf lnd/* && npx protoc --ts_out ./lnd --ts_opt long_type_string --proto_path others others/* ",
|
||||
"typeorm": "typeorm-ts-node-commonjs"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
@ -30,23 +31,32 @@
|
|||
"@types/secp256k1": "^4.0.3",
|
||||
"axios": "^0.27.2",
|
||||
"copyfiles": "^2.4.1",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.0.0",
|
||||
"eccrypto": "^1.1.6",
|
||||
"express": "^4.18.1",
|
||||
"grpc-tools": "^1.11.2",
|
||||
"lodash": "^4.17.21",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"rxjs": "^7.5.5",
|
||||
"secp256k1": "^4.0.3",
|
||||
"sqlite3": "^5.1.2",
|
||||
"ts-node": "^10.7.0",
|
||||
"ts-proto": "^1.112.1",
|
||||
"typeorm": "0.3.10",
|
||||
"typescript": "^4.6.4",
|
||||
"uuid": "^8.3.2"
|
||||
"uuid": "^8.3.2",
|
||||
"pg": "^8.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/eccrypto": "^1.1.3",
|
||||
"@types/lodash": "^4.14.182",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"testyts": "^1.5.0"
|
||||
"testyts": "^1.5.0",
|
||||
"ts-node": "10.7.0",
|
||||
"@types/node": "^16.11.10",
|
||||
"typescript": "4.5.2"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
([]*main.Method) (len=3 cap=4) {
|
||||
(*main.Method)(0xc00029e730)({
|
||||
([]*main.Method) (len=11 cap=16) {
|
||||
(*main.Method)(0xc0002b6730)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=5) "Empty",
|
||||
hasZeroFields: (bool) true
|
||||
|
|
@ -9,23 +9,23 @@
|
|||
name: (string) (len=5) "Empty",
|
||||
hasZeroFields: (bool) true
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc000039b60)({
|
||||
authType: (*main.supportedAuth)(0xc0003a2b40)({
|
||||
id: (string) (len=7) "no_auth",
|
||||
name: (string) (len=6) "NoAuth",
|
||||
opts: (*main.methodOptions)(0xc0003f2480)({
|
||||
authType: (*main.supportedAuth)(0xc0003c3dd0)({
|
||||
id: (string) (len=5) "guest",
|
||||
name: (string) (len=5) "Guest",
|
||||
encrypted: (bool) false,
|
||||
context: (map[string]string) {
|
||||
}
|
||||
}),
|
||||
method: (string) (len=3) "get",
|
||||
route: (main.decodedRoute) {
|
||||
route: (string) (len=7) "/health",
|
||||
route: (string) (len=11) "/api/health",
|
||||
params: ([]string) <nil>
|
||||
},
|
||||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc00029e780)({
|
||||
(*main.Method)(0xc0002b6780)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=25) "EncryptionExchangeRequest",
|
||||
hasZeroFields: (bool) false
|
||||
|
|
@ -35,10 +35,10 @@
|
|||
name: (string) (len=5) "Empty",
|
||||
hasZeroFields: (bool) true
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc000039ce0)({
|
||||
authType: (*main.supportedAuth)(0xc0003a2c00)({
|
||||
id: (string) (len=7) "no_auth",
|
||||
name: (string) (len=6) "NoAuth",
|
||||
opts: (*main.methodOptions)(0xc0003f2600)({
|
||||
authType: (*main.supportedAuth)(0xc0003c3ec0)({
|
||||
id: (string) (len=5) "guest",
|
||||
name: (string) (len=5) "Guest",
|
||||
encrypted: (bool) false,
|
||||
context: (map[string]string) {
|
||||
}
|
||||
|
|
@ -51,27 +51,242 @@
|
|||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc00029e7d0)({
|
||||
(*main.Method)(0xc0002b67d0)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=5) "Empty",
|
||||
hasZeroFields: (bool) true
|
||||
name: (string) (len=17) "LndGetInfoRequest",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
name: (string) (len=10) "LndGetInfo",
|
||||
out: (main.MethodMessage) {
|
||||
name: (string) (len=18) "LndGetInfoResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc000039e60)({
|
||||
authType: (*main.supportedAuth)(0xc0003a2cc0)({
|
||||
id: (string) (len=7) "no_auth",
|
||||
name: (string) (len=6) "NoAuth",
|
||||
opts: (*main.methodOptions)(0xc0003f2780)({
|
||||
authType: (*main.supportedAuth)(0xc0003c3f80)({
|
||||
id: (string) (len=5) "admin",
|
||||
name: (string) (len=5) "Admin",
|
||||
encrypted: (bool) true,
|
||||
context: (map[string]string) (len=1) {
|
||||
(string) (len=8) "admin_id": (string) (len=6) "string"
|
||||
}
|
||||
}),
|
||||
method: (string) (len=4) "post",
|
||||
route: (main.decodedRoute) {
|
||||
route: (string) (len=16) "/api/lnd/getinfo",
|
||||
params: ([]string) <nil>
|
||||
},
|
||||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b6820)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=14) "AddUserRequest",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
name: (string) (len=7) "AddUser",
|
||||
out: (main.MethodMessage) {
|
||||
name: (string) (len=15) "AddUserResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f2900)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe060)({
|
||||
id: (string) (len=5) "guest",
|
||||
name: (string) (len=5) "Guest",
|
||||
encrypted: (bool) false,
|
||||
context: (map[string]string) {
|
||||
}
|
||||
}),
|
||||
method: (string) (len=3) "get",
|
||||
method: (string) (len=4) "post",
|
||||
route: (main.decodedRoute) {
|
||||
route: (string) (len=16) "/api/lnd/getinfo",
|
||||
route: (string) (len=13) "/api/user/add",
|
||||
params: ([]string) <nil>
|
||||
},
|
||||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b6870)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=15) "AuthUserRequest",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
name: (string) (len=8) "AuthUser",
|
||||
out: (main.MethodMessage) {
|
||||
name: (string) (len=16) "AuthUserResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f2a80)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe120)({
|
||||
id: (string) (len=5) "guest",
|
||||
name: (string) (len=5) "Guest",
|
||||
encrypted: (bool) false,
|
||||
context: (map[string]string) {
|
||||
}
|
||||
}),
|
||||
method: (string) (len=4) "post",
|
||||
route: (main.decodedRoute) {
|
||||
route: (string) (len=14) "/api/user/auth",
|
||||
params: ([]string) <nil>
|
||||
},
|
||||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b6910)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=5) "Empty",
|
||||
hasZeroFields: (bool) true
|
||||
},
|
||||
name: (string) (len=10) "NewAddress",
|
||||
out: (main.MethodMessage) {
|
||||
name: (string) (len=18) "NewAddressResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f2c00)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe1e0)({
|
||||
id: (string) (len=4) "user",
|
||||
name: (string) (len=4) "User",
|
||||
encrypted: (bool) false,
|
||||
context: (map[string]string) (len=1) {
|
||||
(string) (len=7) "user_id": (string) (len=6) "string"
|
||||
}
|
||||
}),
|
||||
method: (string) (len=4) "post",
|
||||
route: (main.decodedRoute) {
|
||||
route: (string) (len=19) "/api/user/chain/new",
|
||||
params: ([]string) <nil>
|
||||
},
|
||||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b69b0)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=17) "PayAddressRequest",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
name: (string) (len=10) "PayAddress",
|
||||
out: (main.MethodMessage) {
|
||||
name: (string) (len=18) "PayAddressResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f2d80)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe2a0)({
|
||||
id: (string) (len=4) "user",
|
||||
name: (string) (len=4) "User",
|
||||
encrypted: (bool) false,
|
||||
context: (map[string]string) (len=1) {
|
||||
(string) (len=7) "user_id": (string) (len=6) "string"
|
||||
}
|
||||
}),
|
||||
method: (string) (len=4) "post",
|
||||
route: (main.decodedRoute) {
|
||||
route: (string) (len=19) "/api/user/chain/pay",
|
||||
params: ([]string) <nil>
|
||||
},
|
||||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b6a50)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=17) "NewInvoiceRequest",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
name: (string) (len=10) "NewInvoice",
|
||||
out: (main.MethodMessage) {
|
||||
name: (string) (len=18) "NewInvoiceResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f2f00)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe360)({
|
||||
id: (string) (len=4) "user",
|
||||
name: (string) (len=4) "User",
|
||||
encrypted: (bool) false,
|
||||
context: (map[string]string) (len=1) {
|
||||
(string) (len=7) "user_id": (string) (len=6) "string"
|
||||
}
|
||||
}),
|
||||
method: (string) (len=4) "post",
|
||||
route: (main.decodedRoute) {
|
||||
route: (string) (len=21) "/api/user/invoice/new",
|
||||
params: ([]string) <nil>
|
||||
},
|
||||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b6af0)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=17) "PayInvoiceRequest",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
name: (string) (len=10) "PayInvoice",
|
||||
out: (main.MethodMessage) {
|
||||
name: (string) (len=18) "PayInvoiceResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f3080)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe420)({
|
||||
id: (string) (len=4) "user",
|
||||
name: (string) (len=4) "User",
|
||||
encrypted: (bool) false,
|
||||
context: (map[string]string) (len=1) {
|
||||
(string) (len=7) "user_id": (string) (len=6) "string"
|
||||
}
|
||||
}),
|
||||
method: (string) (len=4) "post",
|
||||
route: (main.decodedRoute) {
|
||||
route: (string) (len=21) "/api/user/invoice/pay",
|
||||
params: ([]string) <nil>
|
||||
},
|
||||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b6b90)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=18) "OpenChannelRequest",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
name: (string) (len=11) "OpenChannel",
|
||||
out: (main.MethodMessage) {
|
||||
name: (string) (len=19) "OpenChannelResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f3200)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe4e0)({
|
||||
id: (string) (len=4) "user",
|
||||
name: (string) (len=4) "User",
|
||||
encrypted: (bool) false,
|
||||
context: (map[string]string) (len=1) {
|
||||
(string) (len=7) "user_id": (string) (len=6) "string"
|
||||
}
|
||||
}),
|
||||
method: (string) (len=4) "post",
|
||||
route: (main.decodedRoute) {
|
||||
route: (string) (len=22) "/api/user/open/channel",
|
||||
params: ([]string) <nil>
|
||||
},
|
||||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b6be0)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=5) "Empty",
|
||||
hasZeroFields: (bool) true
|
||||
},
|
||||
name: (string) (len=19) "GetOpenChannelLNURL",
|
||||
out: (main.MethodMessage) {
|
||||
name: (string) (len=27) "GetOpenChannelLNURLResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f3380)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe5a0)({
|
||||
id: (string) (len=4) "user",
|
||||
name: (string) (len=4) "User",
|
||||
encrypted: (bool) false,
|
||||
context: (map[string]string) (len=1) {
|
||||
(string) (len=7) "user_id": (string) (len=6) "string"
|
||||
}
|
||||
}),
|
||||
method: (string) (len=4) "post",
|
||||
route: (main.decodedRoute) {
|
||||
route: (string) (len=23) "/api/user/lnurl_channel",
|
||||
params: ([]string) <nil>
|
||||
},
|
||||
query: ([]string) <nil>
|
||||
|
|
@ -81,36 +296,12 @@
|
|||
|
||||
([]*main.Enum) <nil>
|
||||
|
||||
(map[string]*main.Message) (len=3) {
|
||||
(string) (len=25) "EncryptionExchangeRequest": (*main.Message)(0xc000238f40)({
|
||||
fullName: (string) (len=25) "EncryptionExchangeRequest",
|
||||
name: (string) (len=25) "EncryptionExchangeRequest",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc0003a2390)({
|
||||
name: (string) (len=10) "public_key",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003a23c0)({
|
||||
name: (string) (len=9) "device_id",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=18) "LndGetInfoResponse": (*main.Message)(0xc000238f80)({
|
||||
(map[string]*main.Message) (len=18) {
|
||||
(string) (len=18) "LndGetInfoResponse": (*main.Message)(0xc0002470c0)({
|
||||
fullName: (string) (len=18) "LndGetInfoResponse",
|
||||
name: (string) (len=18) "LndGetInfoResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003a23f0)({
|
||||
(*main.Field)(0xc0003c3260)({
|
||||
name: (string) (len=5) "alias",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
|
|
@ -121,14 +312,335 @@
|
|||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=5) "Empty": (*main.Message)(0xc000238f00)({
|
||||
(string) (len=18) "NewInvoiceResponse": (*main.Message)(0xc000247200)({
|
||||
fullName: (string) (len=18) "NewInvoiceResponse",
|
||||
name: (string) (len=18) "NewInvoiceResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c3380)({
|
||||
name: (string) (len=7) "invoice",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=17) "PayInvoiceRequest": (*main.Message)(0xc000247240)({
|
||||
fullName: (string) (len=17) "PayInvoiceRequest",
|
||||
name: (string) (len=17) "PayInvoiceRequest",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c33b0)({
|
||||
name: (string) (len=6) "invoce",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=25) "EncryptionExchangeRequest": (*main.Message)(0xc000247040)({
|
||||
fullName: (string) (len=25) "EncryptionExchangeRequest",
|
||||
name: (string) (len=25) "EncryptionExchangeRequest",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc0003c31d0)({
|
||||
name: (string) (len=10) "public_key",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c3200)({
|
||||
name: (string) (len=9) "device_id",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=17) "LndGetInfoRequest": (*main.Message)(0xc000247080)({
|
||||
fullName: (string) (len=17) "LndGetInfoRequest",
|
||||
name: (string) (len=17) "LndGetInfoRequest",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c3230)({
|
||||
name: (string) (len=7) "node_id",
|
||||
kind: (string) (len=5) "int64",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=18) "NewAddressResponse": (*main.Message)(0xc000247100)({
|
||||
fullName: (string) (len=18) "NewAddressResponse",
|
||||
name: (string) (len=18) "NewAddressResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c3290)({
|
||||
name: (string) (len=7) "address",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=17) "NewInvoiceRequest": (*main.Message)(0xc0002471c0)({
|
||||
fullName: (string) (len=17) "NewInvoiceRequest",
|
||||
name: (string) (len=17) "NewInvoiceRequest",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c3350)({
|
||||
name: (string) (len=11) "amount_sats",
|
||||
kind: (string) (len=5) "int64",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=18) "OpenChannelRequest": (*main.Message)(0xc0002472c0)({
|
||||
fullName: (string) (len=18) "OpenChannelRequest",
|
||||
name: (string) (len=18) "OpenChannelRequest",
|
||||
fields: ([]*main.Field) (len=3 cap=4) {
|
||||
(*main.Field)(0xc0003c3410)({
|
||||
name: (string) (len=11) "destination",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c3440)({
|
||||
name: (string) (len=15) "channel_balance",
|
||||
kind: (string) (len=5) "int64",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c3470)({
|
||||
name: (string) (len=11) "push_amount",
|
||||
kind: (string) (len=5) "int64",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=14) "AddUserRequest": (*main.Message)(0xc000247380)({
|
||||
fullName: (string) (len=14) "AddUserRequest",
|
||||
name: (string) (len=14) "AddUserRequest",
|
||||
fields: ([]*main.Field) (len=3 cap=4) {
|
||||
(*main.Field)(0xc0003c3500)({
|
||||
name: (string) (len=12) "callback_url",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c3530)({
|
||||
name: (string) (len=4) "name",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c3560)({
|
||||
name: (string) (len=6) "secret",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=15) "AuthUserRequest": (*main.Message)(0xc000247400)({
|
||||
fullName: (string) (len=15) "AuthUserRequest",
|
||||
name: (string) (len=15) "AuthUserRequest",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc0003c35f0)({
|
||||
name: (string) (len=4) "name",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c3620)({
|
||||
name: (string) (len=6) "secret",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=17) "PayAddressRequest": (*main.Message)(0xc000247140)({
|
||||
fullName: (string) (len=17) "PayAddressRequest",
|
||||
name: (string) (len=17) "PayAddressRequest",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc0003c32c0)({
|
||||
name: (string) (len=7) "address",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c32f0)({
|
||||
name: (string) (len=10) "amout_sats",
|
||||
kind: (string) (len=5) "int64",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=18) "PayAddressResponse": (*main.Message)(0xc000247180)({
|
||||
fullName: (string) (len=18) "PayAddressResponse",
|
||||
name: (string) (len=18) "PayAddressResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c3320)({
|
||||
name: (string) (len=5) "tx_id",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=16) "AuthUserResponse": (*main.Message)(0xc000247440)({
|
||||
fullName: (string) (len=16) "AuthUserResponse",
|
||||
name: (string) (len=16) "AuthUserResponse",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc0003c3650)({
|
||||
name: (string) (len=7) "user_id",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c3680)({
|
||||
name: (string) (len=10) "auth_token",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=5) "Empty": (*main.Message)(0xc000247000)({
|
||||
fullName: (string) (len=5) "Empty",
|
||||
name: (string) (len=5) "Empty",
|
||||
fields: ([]*main.Field) <nil>
|
||||
}),
|
||||
(string) (len=18) "PayInvoiceResponse": (*main.Message)(0xc000247280)({
|
||||
fullName: (string) (len=18) "PayInvoiceResponse",
|
||||
name: (string) (len=18) "PayInvoiceResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c33e0)({
|
||||
name: (string) (len=8) "preimage",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=19) "OpenChannelResponse": (*main.Message)(0xc000247300)({
|
||||
fullName: (string) (len=19) "OpenChannelResponse",
|
||||
name: (string) (len=19) "OpenChannelResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c34a0)({
|
||||
name: (string) (len=10) "channel_id",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=27) "GetOpenChannelLNURLResponse": (*main.Message)(0xc000247340)({
|
||||
fullName: (string) (len=27) "GetOpenChannelLNURLResponse",
|
||||
name: (string) (len=27) "GetOpenChannelLNURLResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c34d0)({
|
||||
name: (string) (len=5) "lnurl",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=15) "AddUserResponse": (*main.Message)(0xc0002473c0)({
|
||||
fullName: (string) (len=15) "AddUserResponse",
|
||||
name: (string) (len=15) "AddUserResponse",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc0003c3590)({
|
||||
name: (string) (len=7) "user_id",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c35c0)({
|
||||
name: (string) (len=10) "auth_token",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
parsing file: structs 3
|
||||
parsing file: structs 18
|
||||
parsing file: methods 2
|
||||
-> [{no_auth NoAuth false map[]} {guest Guest false map[token:string]} {admin Admin true map[pub:string]}]
|
||||
-> [{guest Guest false map[]} {user User false map[user_id:string]} {admin Admin true map[admin_id:string]}]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +1,35 @@
|
|||
// This file was autogenerated from a .proto file, DO NOT EDIT!
|
||||
|
||||
import express, { Response } from 'express'
|
||||
import express, { Response, json, urlencoded } from 'express'
|
||||
import cors from 'cors'
|
||||
import * as Types from './types'
|
||||
export type Logger = { log: (v: any) => void, error: (v: any) => void }
|
||||
export type ServerOptions = {
|
||||
allowCors?: true
|
||||
staticFiles?: string
|
||||
allowNotImplementedMethods?: number
|
||||
logger?: Logger
|
||||
throwErrors?: true
|
||||
NoAuthAuthGuard: (authorizationHeader?: string) => Promise<Types.NoAuthContext>
|
||||
GuestAuthGuard: (authorizationHeader?: string) => Promise<Types.GuestContext>
|
||||
UserAuthGuard: (authorizationHeader?: string) => Promise<Types.UserContext>
|
||||
AdminAuthGuard: (authorizationHeader?: string) => Promise<Types.AdminContext>
|
||||
encryptionCallback: (ctx: Types.AuthContext, body: any) => Promise<string>
|
||||
decryptCallback: (encryptionDeviceId: string, body: any) => Promise<any>
|
||||
encryptCallback: (encryptionDeviceId: string, plain: any) => Promise<any>
|
||||
}
|
||||
const logErrorAndReturnResponse = (error: Error, response: string, res: Response, logger: Logger) => { logger.error(error.message || error); res.json({ status: 'ERROR', reason: response }) }
|
||||
export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
||||
const logger = opts.logger || { log: console.log, error: console.error }
|
||||
const app = express()
|
||||
if (opts.allowCors) {
|
||||
app.use(cors())
|
||||
}
|
||||
app.use(json())
|
||||
app.use(urlencoded({ extended: true }))
|
||||
if (!opts.allowNotImplementedMethods && !methods.Health) throw new Error('method: Health is not implemented')
|
||||
app.get('/health', async (req, res) => {
|
||||
app.get('/api/health', async (req, res) => {
|
||||
try {
|
||||
if (!methods.Health) throw new Error('method: Health is not implemented')
|
||||
const authContext = await opts.NoAuthAuthGuard(req.headers['authorization'])
|
||||
const authContext = await opts.GuestAuthGuard(req.headers['authorization'])
|
||||
const query = req.query
|
||||
const params = req.params
|
||||
await methods.Health({ ...authContext, ...query, ...params })
|
||||
|
|
@ -31,7 +40,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
app.post('/api/encryption/exchange', async (req, res) => {
|
||||
try {
|
||||
if (!methods.EncryptionExchange) throw new Error('method: EncryptionExchange is not implemented')
|
||||
const authContext = await opts.NoAuthAuthGuard(req.headers['authorization'])
|
||||
const authContext = await opts.GuestAuthGuard(req.headers['authorization'])
|
||||
const request = req.body
|
||||
const error = Types.EncryptionExchangeRequestValidate(request)
|
||||
if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger)
|
||||
|
|
@ -42,16 +51,130 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
} 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')
|
||||
app.get('/api/lnd/getinfo', async (req, res) => {
|
||||
app.post('/api/lnd/getinfo', async (req, res) => {
|
||||
try {
|
||||
if (!methods.LndGetInfo) throw new Error('method: LndGetInfo is not implemented')
|
||||
const authContext = await opts.NoAuthAuthGuard(req.headers['authorization'])
|
||||
const authContext = await opts.AdminAuthGuard(req.headers['authorization'])
|
||||
const encryptionDeviceId = req.headers['x-e2ee-device-id-x']
|
||||
if (typeof encryptionDeviceId !== 'string' || encryptionDeviceId === '') throw new Error('invalid encryption header provided')
|
||||
const request = await opts.decryptCallback(encryptionDeviceId, req.body)
|
||||
const error = Types.LndGetInfoRequestValidate(request)
|
||||
if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger)
|
||||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.LndGetInfo({ ...authContext, ...query, ...params })
|
||||
const response = await methods.LndGetInfo({ ...authContext, ...query, ...params }, request)
|
||||
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')
|
||||
app.post('/api/user/add', async (req, res) => {
|
||||
try {
|
||||
if (!methods.AddUser) throw new Error('method: AddUser is not implemented')
|
||||
const authContext = await opts.GuestAuthGuard(req.headers['authorization'])
|
||||
const request = req.body
|
||||
const error = Types.AddUserRequestValidate(request)
|
||||
if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger)
|
||||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.AddUser({ ...authContext, ...query, ...params }, request)
|
||||
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')
|
||||
app.post('/api/user/auth', async (req, res) => {
|
||||
try {
|
||||
if (!methods.AuthUser) throw new Error('method: AuthUser is not implemented')
|
||||
const authContext = await opts.GuestAuthGuard(req.headers['authorization'])
|
||||
const request = req.body
|
||||
const error = Types.AuthUserRequestValidate(request)
|
||||
if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger)
|
||||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.AuthUser({ ...authContext, ...query, ...params }, request)
|
||||
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')
|
||||
app.post('/api/user/chain/new', async (req, res) => {
|
||||
try {
|
||||
if (!methods.NewAddress) throw new Error('method: NewAddress is not implemented')
|
||||
const authContext = await opts.UserAuthGuard(req.headers['authorization'])
|
||||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.NewAddress({ ...authContext, ...query, ...params })
|
||||
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')
|
||||
app.post('/api/user/chain/pay', async (req, res) => {
|
||||
try {
|
||||
if (!methods.PayAddress) throw new Error('method: PayAddress is not implemented')
|
||||
const authContext = await opts.UserAuthGuard(req.headers['authorization'])
|
||||
const request = req.body
|
||||
const error = Types.PayAddressRequestValidate(request)
|
||||
if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger)
|
||||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.PayAddress({ ...authContext, ...query, ...params }, request)
|
||||
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')
|
||||
app.post('/api/user/invoice/new', async (req, res) => {
|
||||
try {
|
||||
if (!methods.NewInvoice) throw new Error('method: NewInvoice is not implemented')
|
||||
const authContext = await opts.UserAuthGuard(req.headers['authorization'])
|
||||
const request = req.body
|
||||
const error = Types.NewInvoiceRequestValidate(request)
|
||||
if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger)
|
||||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.NewInvoice({ ...authContext, ...query, ...params }, request)
|
||||
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')
|
||||
app.post('/api/user/invoice/pay', async (req, res) => {
|
||||
try {
|
||||
if (!methods.PayInvoice) throw new Error('method: PayInvoice is not implemented')
|
||||
const authContext = await opts.UserAuthGuard(req.headers['authorization'])
|
||||
const request = req.body
|
||||
const error = Types.PayInvoiceRequestValidate(request)
|
||||
if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger)
|
||||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.PayInvoice({ ...authContext, ...query, ...params }, request)
|
||||
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')
|
||||
app.post('/api/user/open/channel', async (req, res) => {
|
||||
try {
|
||||
if (!methods.OpenChannel) throw new Error('method: OpenChannel is not implemented')
|
||||
const authContext = await opts.UserAuthGuard(req.headers['authorization'])
|
||||
const request = req.body
|
||||
const error = Types.OpenChannelRequestValidate(request)
|
||||
if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger)
|
||||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.OpenChannel({ ...authContext, ...query, ...params }, request)
|
||||
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')
|
||||
app.post('/api/user/lnurl_channel', async (req, res) => {
|
||||
try {
|
||||
if (!methods.GetOpenChannelLNURL) throw new Error('method: GetOpenChannelLNURL is not implemented')
|
||||
const authContext = await opts.UserAuthGuard(req.headers['authorization'])
|
||||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.GetOpenChannelLNURL({ ...authContext, ...query, ...params })
|
||||
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) {
|
||||
app.use(express.static(opts.staticFiles))
|
||||
}
|
||||
var server: { close: () => void } | undefined
|
||||
return {
|
||||
Close: () => { if (!server) { throw new Error('tried closing server before starting') } else server.close() },
|
||||
|
|
|
|||
|
|
@ -5,15 +5,19 @@ export type ResultError = { status: 'ERROR', reason: string }
|
|||
|
||||
export type ClientParams = {
|
||||
baseUrl: string
|
||||
retrieveNoAuthAuth: () => Promise<string | null>
|
||||
retrieveGuestAuth: () => Promise<string | null>
|
||||
retrieveUserAuth: () => Promise<string | null>
|
||||
retrieveAdminAuth: () => Promise<string | null>
|
||||
encryptCallback: (plain: any) => Promise<any>
|
||||
decryptCallback: (encrypted: any) => Promise<any>
|
||||
deviceId: string
|
||||
}
|
||||
export default (params: ClientParams) => ({
|
||||
Health: async (): Promise<ResultError | { status: 'OK' }> => {
|
||||
const auth = await params.retrieveNoAuthAuth()
|
||||
if (auth === null) throw new Error('retrieveNoAuthAuth() returned null')
|
||||
const { data } = await axios.get(params.baseUrl + '/health', { headers: { 'authorization': auth } })
|
||||
const auth = await params.retrieveGuestAuth()
|
||||
if (auth === null) throw new Error('retrieveGuestAuth() returned null')
|
||||
let finalRoute = '/api/health'
|
||||
const { data } = await axios.get(params.baseUrl + finalRoute, { headers: { 'authorization': auth } })
|
||||
if (data.status === 'ERROR' && typeof data.reason === 'string') return data
|
||||
if (data.status === 'OK') {
|
||||
return data
|
||||
|
|
@ -21,23 +25,130 @@ export default (params: ClientParams) => ({
|
|||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
EncryptionExchange: async (request: Types.EncryptionExchangeRequest): Promise<ResultError | { status: 'OK' }> => {
|
||||
const auth = await params.retrieveNoAuthAuth()
|
||||
if (auth === null) throw new Error('retrieveNoAuthAuth() returned null')
|
||||
const { data } = await axios.post(params.baseUrl + '/api/encryption/exchange', request, { headers: { 'authorization': auth } })
|
||||
const auth = await params.retrieveGuestAuth()
|
||||
if (auth === null) throw new Error('retrieveGuestAuth() returned null')
|
||||
let finalRoute = '/api/encryption/exchange'
|
||||
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') {
|
||||
return data
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
LndGetInfo: async (): Promise<ResultError | { status: 'OK', result: Types.Empty }> => {
|
||||
const auth = await params.retrieveNoAuthAuth()
|
||||
if (auth === null) throw new Error('retrieveNoAuthAuth() returned null')
|
||||
const { data } = await axios.get(params.baseUrl + '/api/lnd/getinfo', { headers: { 'authorization': auth } })
|
||||
LndGetInfo: async (request: Types.LndGetInfoRequest): Promise<ResultError | { status: 'OK', result: Types.LndGetInfoResponse }> => {
|
||||
const auth = await params.retrieveAdminAuth()
|
||||
if (auth === null) throw new Error('retrieveAdminAuth() returned null')
|
||||
let finalRoute = '/api/lnd/getinfo'
|
||||
const { data } = await axios.post(params.baseUrl + finalRoute, await params.encryptCallback(request), { headers: { 'authorization': auth, 'x-e2ee-device-id-x': params.deviceId } })
|
||||
if (data.status === 'ERROR' && typeof data.reason === 'string') return data
|
||||
if (data.status === 'OK') {
|
||||
const error = Types.LndGetInfoResponseValidate(data.result)
|
||||
if (error === null) { return data } else return { status: 'ERROR', reason: error.message }
|
||||
const result = await params.decryptCallback(data.result)
|
||||
const error = Types.LndGetInfoResponseValidate(result)
|
||||
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
AddUser: async (request: Types.AddUserRequest): Promise<ResultError | { status: 'OK', result: Types.AddUserResponse }> => {
|
||||
const auth = await params.retrieveGuestAuth()
|
||||
if (auth === null) throw new Error('retrieveGuestAuth() returned null')
|
||||
let finalRoute = '/api/user/add'
|
||||
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.result
|
||||
const error = Types.AddUserResponseValidate(result)
|
||||
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
AuthUser: async (request: Types.AuthUserRequest): Promise<ResultError | { status: 'OK', result: Types.AuthUserResponse }> => {
|
||||
const auth = await params.retrieveGuestAuth()
|
||||
if (auth === null) throw new Error('retrieveGuestAuth() returned null')
|
||||
let finalRoute = '/api/user/auth'
|
||||
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.result
|
||||
const error = Types.AuthUserResponseValidate(result)
|
||||
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
NewAddress: async (): Promise<ResultError | { status: 'OK', result: Types.NewAddressResponse }> => {
|
||||
const auth = await params.retrieveUserAuth()
|
||||
if (auth === null) throw new Error('retrieveUserAuth() returned null')
|
||||
let finalRoute = '/api/user/chain/new'
|
||||
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.result
|
||||
const error = Types.NewAddressResponseValidate(result)
|
||||
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
PayAddress: async (request: Types.PayAddressRequest): Promise<ResultError | { status: 'OK', result: Types.PayAddressResponse }> => {
|
||||
const auth = await params.retrieveUserAuth()
|
||||
if (auth === null) throw new Error('retrieveUserAuth() returned null')
|
||||
let finalRoute = '/api/user/chain/pay'
|
||||
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.result
|
||||
const error = Types.PayAddressResponseValidate(result)
|
||||
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
NewInvoice: async (request: Types.NewInvoiceRequest): Promise<ResultError | { status: 'OK', result: Types.NewInvoiceResponse }> => {
|
||||
const auth = await params.retrieveUserAuth()
|
||||
if (auth === null) throw new Error('retrieveUserAuth() returned null')
|
||||
let finalRoute = '/api/user/invoice/new'
|
||||
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.result
|
||||
const error = Types.NewInvoiceResponseValidate(result)
|
||||
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
PayInvoice: async (request: Types.PayInvoiceRequest): Promise<ResultError | { status: 'OK', result: Types.PayInvoiceResponse }> => {
|
||||
const auth = await params.retrieveUserAuth()
|
||||
if (auth === null) throw new Error('retrieveUserAuth() returned null')
|
||||
let finalRoute = '/api/user/invoice/pay'
|
||||
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.result
|
||||
const error = Types.PayInvoiceResponseValidate(result)
|
||||
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
OpenChannel: async (request: Types.OpenChannelRequest): Promise<ResultError | { status: 'OK', result: Types.OpenChannelResponse }> => {
|
||||
const auth = await params.retrieveUserAuth()
|
||||
if (auth === null) throw new Error('retrieveUserAuth() returned null')
|
||||
let finalRoute = '/api/user/open/channel'
|
||||
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.result
|
||||
const error = Types.OpenChannelResponseValidate(result)
|
||||
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
GetOpenChannelLNURL: async (): Promise<ResultError | { status: 'OK', result: Types.GetOpenChannelLNURLResponse }> => {
|
||||
const auth = await params.retrieveUserAuth()
|
||||
if (auth === null) throw new Error('retrieveUserAuth() returned null')
|
||||
let finalRoute = '/api/user/lnurl_channel'
|
||||
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.result
|
||||
const error = Types.GetOpenChannelLNURLResponseValidate(result)
|
||||
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
|
||||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,34 +1,82 @@
|
|||
// This file was autogenerated from a .proto file, DO NOT EDIT!
|
||||
|
||||
export type NoAuthContext = {
|
||||
}
|
||||
export type GuestContext = {
|
||||
token: string
|
||||
}
|
||||
export type UserContext = {
|
||||
user_id: string
|
||||
}
|
||||
export type AdminContext = {
|
||||
pub: string
|
||||
admin_id: string
|
||||
}
|
||||
export type AuthContext = NoAuthContext | GuestContext | AdminContext
|
||||
export type AuthContext = GuestContext | UserContext | AdminContext
|
||||
|
||||
export type Health_Query = {
|
||||
}
|
||||
export type Health_RouteParams = {
|
||||
}
|
||||
export type Health_Context = Health_Query & Health_RouteParams & NoAuthContext
|
||||
export type Health_Context = Health_Query & Health_RouteParams & GuestContext
|
||||
export type EncryptionExchange_Query = {
|
||||
}
|
||||
export type EncryptionExchange_RouteParams = {
|
||||
}
|
||||
export type EncryptionExchange_Context = EncryptionExchange_Query & EncryptionExchange_RouteParams & NoAuthContext
|
||||
export type EncryptionExchange_Context = EncryptionExchange_Query & EncryptionExchange_RouteParams & GuestContext
|
||||
export type LndGetInfo_Query = {
|
||||
}
|
||||
export type LndGetInfo_RouteParams = {
|
||||
}
|
||||
export type LndGetInfo_Context = LndGetInfo_Query & LndGetInfo_RouteParams & NoAuthContext
|
||||
export type LndGetInfo_Context = LndGetInfo_Query & LndGetInfo_RouteParams & AdminContext
|
||||
export type AddUser_Query = {
|
||||
}
|
||||
export type AddUser_RouteParams = {
|
||||
}
|
||||
export type AddUser_Context = AddUser_Query & AddUser_RouteParams & GuestContext
|
||||
export type AuthUser_Query = {
|
||||
}
|
||||
export type AuthUser_RouteParams = {
|
||||
}
|
||||
export type AuthUser_Context = AuthUser_Query & AuthUser_RouteParams & GuestContext
|
||||
export type NewAddress_Query = {
|
||||
}
|
||||
export type NewAddress_RouteParams = {
|
||||
}
|
||||
export type NewAddress_Context = NewAddress_Query & NewAddress_RouteParams & UserContext
|
||||
export type PayAddress_Query = {
|
||||
}
|
||||
export type PayAddress_RouteParams = {
|
||||
}
|
||||
export type PayAddress_Context = PayAddress_Query & PayAddress_RouteParams & UserContext
|
||||
export type NewInvoice_Query = {
|
||||
}
|
||||
export type NewInvoice_RouteParams = {
|
||||
}
|
||||
export type NewInvoice_Context = NewInvoice_Query & NewInvoice_RouteParams & UserContext
|
||||
export type PayInvoice_Query = {
|
||||
}
|
||||
export type PayInvoice_RouteParams = {
|
||||
}
|
||||
export type PayInvoice_Context = PayInvoice_Query & PayInvoice_RouteParams & UserContext
|
||||
export type OpenChannel_Query = {
|
||||
}
|
||||
export type OpenChannel_RouteParams = {
|
||||
}
|
||||
export type OpenChannel_Context = OpenChannel_Query & OpenChannel_RouteParams & UserContext
|
||||
export type GetOpenChannelLNURL_Query = {
|
||||
}
|
||||
export type GetOpenChannelLNURL_RouteParams = {
|
||||
}
|
||||
export type GetOpenChannelLNURL_Context = GetOpenChannelLNURL_Query & GetOpenChannelLNURL_RouteParams & UserContext
|
||||
export type ServerMethods = {
|
||||
Health?: (ctx: Health_Context) => Promise<void>
|
||||
EncryptionExchange?: (ctx: EncryptionExchange_Context, req: EncryptionExchangeRequest) => Promise<void>
|
||||
LndGetInfo?: (ctx: LndGetInfo_Context) => Promise<LndGetInfoResponse>
|
||||
LndGetInfo?: (ctx: LndGetInfo_Context, req: LndGetInfoRequest) => Promise<LndGetInfoResponse>
|
||||
AddUser?: (ctx: AddUser_Context, req: AddUserRequest) => Promise<AddUserResponse>
|
||||
AuthUser?: (ctx: AuthUser_Context, req: AuthUserRequest) => Promise<AuthUserResponse>
|
||||
NewAddress?: (ctx: NewAddress_Context) => Promise<NewAddressResponse>
|
||||
PayAddress?: (ctx: PayAddress_Context, req: PayAddressRequest) => Promise<PayAddressResponse>
|
||||
NewInvoice?: (ctx: NewInvoice_Context, req: NewInvoiceRequest) => Promise<NewInvoiceResponse>
|
||||
PayInvoice?: (ctx: PayInvoice_Context, req: PayInvoiceRequest) => Promise<PayInvoiceResponse>
|
||||
OpenChannel?: (ctx: OpenChannel_Context, req: OpenChannelRequest) => Promise<OpenChannelResponse>
|
||||
GetOpenChannelLNURL?: (ctx: GetOpenChannelLNURL_Context) => Promise<GetOpenChannelLNURLResponse>
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -36,6 +84,178 @@ export type OptionsBaseMessage = {
|
|||
allOptionalsAreSet?: true
|
||||
}
|
||||
|
||||
export type AuthUserResponse = {
|
||||
user_id: string
|
||||
auth_token: string
|
||||
}
|
||||
export const AuthUserResponseOptionalFields: [] = []
|
||||
export type AuthUserResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
user_id_CustomCheck?: (v: string) => boolean
|
||||
auth_token_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const AuthUserResponseValidate = (o?: AuthUserResponse, opts: AuthUserResponseOptions = {}, path: string = 'AuthUserResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.user_id !== 'string') return new Error(`${path}.user_id: is not a string`)
|
||||
if (opts.user_id_CustomCheck && !opts.user_id_CustomCheck(o.user_id)) return new Error(`${path}.user_id: custom check failed`)
|
||||
|
||||
if (typeof o.auth_token !== 'string') return new Error(`${path}.auth_token: is not a string`)
|
||||
if (opts.auth_token_CustomCheck && !opts.auth_token_CustomCheck(o.auth_token)) return new Error(`${path}.auth_token: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type PayAddressRequest = {
|
||||
address: string
|
||||
amout_sats: number
|
||||
}
|
||||
export const PayAddressRequestOptionalFields: [] = []
|
||||
export type PayAddressRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
address_CustomCheck?: (v: string) => boolean
|
||||
amout_sats_CustomCheck?: (v: number) => boolean
|
||||
}
|
||||
export const PayAddressRequestValidate = (o?: PayAddressRequest, opts: PayAddressRequestOptions = {}, path: string = 'PayAddressRequest::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.address !== 'string') return new Error(`${path}.address: is not a string`)
|
||||
if (opts.address_CustomCheck && !opts.address_CustomCheck(o.address)) return new Error(`${path}.address: custom check failed`)
|
||||
|
||||
if (typeof o.amout_sats !== 'number') return new Error(`${path}.amout_sats: is not a number`)
|
||||
if (opts.amout_sats_CustomCheck && !opts.amout_sats_CustomCheck(o.amout_sats)) return new Error(`${path}.amout_sats: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type PayAddressResponse = {
|
||||
tx_id: string
|
||||
}
|
||||
export const PayAddressResponseOptionalFields: [] = []
|
||||
export type PayAddressResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
tx_id_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const PayAddressResponseValidate = (o?: PayAddressResponse, opts: PayAddressResponseOptions = {}, path: string = 'PayAddressResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.tx_id !== 'string') return new Error(`${path}.tx_id: is not a string`)
|
||||
if (opts.tx_id_CustomCheck && !opts.tx_id_CustomCheck(o.tx_id)) return new Error(`${path}.tx_id: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type OpenChannelResponse = {
|
||||
channel_id: string
|
||||
}
|
||||
export const OpenChannelResponseOptionalFields: [] = []
|
||||
export type OpenChannelResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
channel_id_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const OpenChannelResponseValidate = (o?: OpenChannelResponse, opts: OpenChannelResponseOptions = {}, path: string = 'OpenChannelResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.channel_id !== 'string') return new Error(`${path}.channel_id: is not a string`)
|
||||
if (opts.channel_id_CustomCheck && !opts.channel_id_CustomCheck(o.channel_id)) return new Error(`${path}.channel_id: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type GetOpenChannelLNURLResponse = {
|
||||
lnurl: string
|
||||
}
|
||||
export const GetOpenChannelLNURLResponseOptionalFields: [] = []
|
||||
export type GetOpenChannelLNURLResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
lnurl_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const GetOpenChannelLNURLResponseValidate = (o?: GetOpenChannelLNURLResponse, opts: GetOpenChannelLNURLResponseOptions = {}, path: string = 'GetOpenChannelLNURLResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.lnurl !== 'string') return new Error(`${path}.lnurl: is not a string`)
|
||||
if (opts.lnurl_CustomCheck && !opts.lnurl_CustomCheck(o.lnurl)) return new Error(`${path}.lnurl: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type AddUserResponse = {
|
||||
user_id: string
|
||||
auth_token: string
|
||||
}
|
||||
export const AddUserResponseOptionalFields: [] = []
|
||||
export type AddUserResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
user_id_CustomCheck?: (v: string) => boolean
|
||||
auth_token_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const AddUserResponseValidate = (o?: AddUserResponse, opts: AddUserResponseOptions = {}, path: string = 'AddUserResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.user_id !== 'string') return new Error(`${path}.user_id: is not a string`)
|
||||
if (opts.user_id_CustomCheck && !opts.user_id_CustomCheck(o.user_id)) return new Error(`${path}.user_id: custom check failed`)
|
||||
|
||||
if (typeof o.auth_token !== 'string') return new Error(`${path}.auth_token: is not a string`)
|
||||
if (opts.auth_token_CustomCheck && !opts.auth_token_CustomCheck(o.auth_token)) return new Error(`${path}.auth_token: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type Empty = {
|
||||
}
|
||||
export const EmptyOptionalFields: [] = []
|
||||
export type EmptyOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
}
|
||||
export const EmptyValidate = (o?: Empty, opts: EmptyOptions = {}, path: string = 'Empty::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type PayInvoiceResponse = {
|
||||
preimage: string
|
||||
}
|
||||
export const PayInvoiceResponseOptionalFields: [] = []
|
||||
export type PayInvoiceResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
preimage_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const PayInvoiceResponseValidate = (o?: PayInvoiceResponse, opts: PayInvoiceResponseOptions = {}, path: string = 'PayInvoiceResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.preimage !== 'string') return new Error(`${path}.preimage: is not a string`)
|
||||
if (opts.preimage_CustomCheck && !opts.preimage_CustomCheck(o.preimage)) return new Error(`${path}.preimage: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type PayInvoiceRequest = {
|
||||
invoce: string
|
||||
}
|
||||
export const PayInvoiceRequestOptionalFields: [] = []
|
||||
export type PayInvoiceRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
invoce_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const PayInvoiceRequestValidate = (o?: PayInvoiceRequest, opts: PayInvoiceRequestOptions = {}, path: string = 'PayInvoiceRequest::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.invoce !== 'string') return new Error(`${path}.invoce: is not a string`)
|
||||
if (opts.invoce_CustomCheck && !opts.invoce_CustomCheck(o.invoce)) return new Error(`${path}.invoce: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type LndGetInfoResponse = {
|
||||
alias: string
|
||||
}
|
||||
|
|
@ -54,16 +274,136 @@ export const LndGetInfoResponseValidate = (o?: LndGetInfoResponse, opts: LndGetI
|
|||
return null
|
||||
}
|
||||
|
||||
export type Empty = {
|
||||
export type NewInvoiceResponse = {
|
||||
invoice: string
|
||||
}
|
||||
export const EmptyOptionalFields: [] = []
|
||||
export type EmptyOptions = OptionsBaseMessage & {
|
||||
export const NewInvoiceResponseOptionalFields: [] = []
|
||||
export type NewInvoiceResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
invoice_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const EmptyValidate = (o?: Empty, opts: EmptyOptions = {}, path: string = 'Empty::root.'): Error | null => {
|
||||
export const NewInvoiceResponseValidate = (o?: NewInvoiceResponse, opts: NewInvoiceResponseOptions = {}, path: string = 'NewInvoiceResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`)
|
||||
if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type NewAddressResponse = {
|
||||
address: string
|
||||
}
|
||||
export const NewAddressResponseOptionalFields: [] = []
|
||||
export type NewAddressResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
address_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const NewAddressResponseValidate = (o?: NewAddressResponse, opts: NewAddressResponseOptions = {}, path: string = 'NewAddressResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.address !== 'string') return new Error(`${path}.address: is not a string`)
|
||||
if (opts.address_CustomCheck && !opts.address_CustomCheck(o.address)) return new Error(`${path}.address: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type NewInvoiceRequest = {
|
||||
amount_sats: number
|
||||
}
|
||||
export const NewInvoiceRequestOptionalFields: [] = []
|
||||
export type NewInvoiceRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
amount_sats_CustomCheck?: (v: number) => boolean
|
||||
}
|
||||
export const NewInvoiceRequestValidate = (o?: NewInvoiceRequest, opts: NewInvoiceRequestOptions = {}, path: string = 'NewInvoiceRequest::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.amount_sats !== 'number') return new Error(`${path}.amount_sats: is not a number`)
|
||||
if (opts.amount_sats_CustomCheck && !opts.amount_sats_CustomCheck(o.amount_sats)) return new Error(`${path}.amount_sats: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type OpenChannelRequest = {
|
||||
destination: string
|
||||
channel_balance: number
|
||||
push_amount: number
|
||||
}
|
||||
export const OpenChannelRequestOptionalFields: [] = []
|
||||
export type OpenChannelRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
destination_CustomCheck?: (v: string) => boolean
|
||||
channel_balance_CustomCheck?: (v: number) => boolean
|
||||
push_amount_CustomCheck?: (v: number) => boolean
|
||||
}
|
||||
export const OpenChannelRequestValidate = (o?: OpenChannelRequest, opts: OpenChannelRequestOptions = {}, path: string = 'OpenChannelRequest::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.destination !== 'string') return new Error(`${path}.destination: is not a string`)
|
||||
if (opts.destination_CustomCheck && !opts.destination_CustomCheck(o.destination)) return new Error(`${path}.destination: custom check failed`)
|
||||
|
||||
if (typeof o.channel_balance !== 'number') return new Error(`${path}.channel_balance: is not a number`)
|
||||
if (opts.channel_balance_CustomCheck && !opts.channel_balance_CustomCheck(o.channel_balance)) return new Error(`${path}.channel_balance: custom check failed`)
|
||||
|
||||
if (typeof o.push_amount !== 'number') return new Error(`${path}.push_amount: is not a number`)
|
||||
if (opts.push_amount_CustomCheck && !opts.push_amount_CustomCheck(o.push_amount)) return new Error(`${path}.push_amount: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type AddUserRequest = {
|
||||
callback_url: string
|
||||
name: string
|
||||
secret: string
|
||||
}
|
||||
export const AddUserRequestOptionalFields: [] = []
|
||||
export type AddUserRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
callback_url_CustomCheck?: (v: string) => boolean
|
||||
name_CustomCheck?: (v: string) => boolean
|
||||
secret_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const AddUserRequestValidate = (o?: AddUserRequest, opts: AddUserRequestOptions = {}, path: string = 'AddUserRequest::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.callback_url !== 'string') return new Error(`${path}.callback_url: is not a string`)
|
||||
if (opts.callback_url_CustomCheck && !opts.callback_url_CustomCheck(o.callback_url)) return new Error(`${path}.callback_url: custom check failed`)
|
||||
|
||||
if (typeof o.name !== 'string') return new Error(`${path}.name: is not a string`)
|
||||
if (opts.name_CustomCheck && !opts.name_CustomCheck(o.name)) return new Error(`${path}.name: custom check failed`)
|
||||
|
||||
if (typeof o.secret !== 'string') return new Error(`${path}.secret: is not a string`)
|
||||
if (opts.secret_CustomCheck && !opts.secret_CustomCheck(o.secret)) return new Error(`${path}.secret: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type AuthUserRequest = {
|
||||
name: string
|
||||
secret: string
|
||||
}
|
||||
export const AuthUserRequestOptionalFields: [] = []
|
||||
export type AuthUserRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
name_CustomCheck?: (v: string) => boolean
|
||||
secret_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const AuthUserRequestValidate = (o?: AuthUserRequest, opts: AuthUserRequestOptions = {}, path: string = 'AuthUserRequest::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.name !== 'string') return new Error(`${path}.name: is not a string`)
|
||||
if (opts.name_CustomCheck && !opts.name_CustomCheck(o.name)) return new Error(`${path}.name: custom check failed`)
|
||||
|
||||
if (typeof o.secret !== 'string') return new Error(`${path}.secret: is not a string`)
|
||||
if (opts.secret_CustomCheck && !opts.secret_CustomCheck(o.secret)) return new Error(`${path}.secret: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
@ -90,3 +430,21 @@ export const EncryptionExchangeRequestValidate = (o?: EncryptionExchangeRequest,
|
|||
return null
|
||||
}
|
||||
|
||||
export type LndGetInfoRequest = {
|
||||
node_id: number
|
||||
}
|
||||
export const LndGetInfoRequestOptionalFields: [] = []
|
||||
export type LndGetInfoRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
node_id_CustomCheck?: (v: number) => boolean
|
||||
}
|
||||
export const LndGetInfoRequestValidate = (o?: LndGetInfoRequest, opts: LndGetInfoRequestOptions = {}, path: string = 'LndGetInfoRequest::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.node_id !== 'number') return new Error(`${path}.node_id: is not a number`)
|
||||
if (opts.node_id_CustomCheck && !opts.node_id_CustomCheck(o.node_id)) return new Error(`${path}.node_id: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -10,15 +10,15 @@ option (file_options) = {
|
|||
supported_http_methods:["post", "get"];
|
||||
supported_auths:[
|
||||
{
|
||||
id: "no_auth"
|
||||
name: "NoAuth"
|
||||
id: "guest"
|
||||
name: "Guest"
|
||||
context:[]
|
||||
},
|
||||
{
|
||||
id: "guest"
|
||||
name: "Guest",
|
||||
id: "user"
|
||||
name: "User",
|
||||
context:{
|
||||
key:"token",
|
||||
key:"user_id",
|
||||
value:"string"
|
||||
}
|
||||
},
|
||||
|
|
@ -27,7 +27,7 @@ option (file_options) = {
|
|||
name: "Admin",
|
||||
encrypted:true,
|
||||
context:{
|
||||
key:"pub",
|
||||
key:"admin_id",
|
||||
value:"string"
|
||||
}
|
||||
}
|
||||
|
|
@ -63,18 +63,60 @@ extend google.protobuf.FileOptions {
|
|||
|
||||
service LightningPub {
|
||||
rpc Health(structs.Empty) returns (structs.Empty){
|
||||
option (auth_type) = "NoAuth";
|
||||
option (auth_type) = "Guest";
|
||||
option (http_method) = "get";
|
||||
option (http_route) = "/health";
|
||||
option (http_route) = "/api/health";
|
||||
};
|
||||
rpc EncryptionExchange(structs.EncryptionExchangeRequest) returns (structs.Empty){
|
||||
option (auth_type) = "NoAuth";
|
||||
option (auth_type) = "Guest";
|
||||
option (http_method) = "post";
|
||||
option (http_route) = "/api/encryption/exchange";
|
||||
};
|
||||
rpc LndGetInfo(structs.Empty) returns (structs.LndGetInfoResponse){
|
||||
option (auth_type) = "NoAuth";
|
||||
option (http_method) = "get";
|
||||
rpc LndGetInfo(structs.LndGetInfoRequest) returns (structs.LndGetInfoResponse){
|
||||
option (auth_type) = "Admin";
|
||||
option (http_method) = "post";
|
||||
option (http_route) = "/api/lnd/getinfo";
|
||||
};
|
||||
|
||||
rpc AddUser(structs.AddUserRequest)returns (structs.AddUserResponse){
|
||||
option (auth_type) = "Guest";
|
||||
option (http_method) = "post";
|
||||
option (http_route) = "/api/user/add";
|
||||
}
|
||||
rpc AuthUser(structs.AuthUserRequest)returns (structs.AuthUserResponse){
|
||||
option (auth_type) = "Guest";
|
||||
option (http_method) = "post";
|
||||
option (http_route) = "/api/user/auth";
|
||||
}
|
||||
// USER
|
||||
rpc NewAddress(structs.Empty) returns (structs.NewAddressResponse) {
|
||||
option (auth_type) = "User";
|
||||
option (http_method) = "post";
|
||||
option (http_route) = "/api/user/chain/new";
|
||||
}
|
||||
rpc PayAddress(structs.PayAddressRequest) returns (structs.PayAddressResponse){
|
||||
option (auth_type) = "User";
|
||||
option (http_method) = "post";
|
||||
option (http_route) = "/api/user/chain/pay";
|
||||
}
|
||||
rpc NewInvoice(structs.NewInvoiceRequest) returns (structs.NewInvoiceResponse){
|
||||
option (auth_type) = "User";
|
||||
option (http_method) = "post";
|
||||
option (http_route) = "/api/user/invoice/new";
|
||||
}
|
||||
rpc PayInvoice(structs.PayInvoiceRequest) returns (structs.PayInvoiceResponse){
|
||||
option (auth_type) = "User";
|
||||
option (http_method) = "post";
|
||||
option (http_route) = "/api/user/invoice/pay";
|
||||
}
|
||||
rpc OpenChannel(structs.OpenChannelRequest) returns (structs.OpenChannelResponse){
|
||||
option (auth_type) = "User";
|
||||
option (http_method) = "post";
|
||||
option (http_route) = "/api/user/open/channel";
|
||||
}
|
||||
rpc GetOpenChannelLNURL(structs.Empty) returns (structs.GetOpenChannelLNURLResponse){
|
||||
option (auth_type) = "User";
|
||||
option (http_method) = "post";
|
||||
option (http_route) = "/api/user/lnurl_channel";
|
||||
}
|
||||
}
|
||||
|
|
@ -12,6 +12,73 @@ message EncryptionExchangeRequest {
|
|||
string device_id = 2;
|
||||
}
|
||||
|
||||
message LndGetInfoRequest {
|
||||
int64 node_id = 1;
|
||||
}
|
||||
|
||||
message LndGetInfoResponse {
|
||||
string alias = 1;
|
||||
}
|
||||
|
||||
message NewAddressResponse{
|
||||
string address = 1;
|
||||
}
|
||||
message PayAddressRequest{
|
||||
string address = 1;
|
||||
int64 amout_sats = 2;
|
||||
}
|
||||
|
||||
message PayAddressResponse{
|
||||
string tx_id = 1;
|
||||
}
|
||||
|
||||
message NewInvoiceRequest{
|
||||
int64 amount_sats = 1;
|
||||
}
|
||||
|
||||
message NewInvoiceResponse{
|
||||
string invoice = 1;
|
||||
}
|
||||
|
||||
message PayInvoiceRequest{
|
||||
string invoce = 1;
|
||||
}
|
||||
|
||||
message PayInvoiceResponse{
|
||||
string preimage = 1;
|
||||
}
|
||||
|
||||
message OpenChannelRequest{
|
||||
string destination = 1;
|
||||
int64 channel_balance = 2;
|
||||
int64 push_amount = 3;
|
||||
}
|
||||
|
||||
message OpenChannelResponse{
|
||||
string channel_id = 1;
|
||||
}
|
||||
|
||||
message GetOpenChannelLNURLResponse{
|
||||
string lnurl = 1;
|
||||
}
|
||||
|
||||
message AddUserRequest{
|
||||
string callback_url = 1;
|
||||
string name = 2;
|
||||
string secret = 3;
|
||||
}
|
||||
|
||||
message AddUserResponse{
|
||||
string user_id = 1;
|
||||
string auth_token = 2;
|
||||
}
|
||||
|
||||
message AuthUserRequest{
|
||||
string name = 2;
|
||||
string secret = 3;
|
||||
}
|
||||
|
||||
message AuthUserResponse{
|
||||
string user_id = 1;
|
||||
string auth_token = 2;
|
||||
}
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
import { ServerOptions } from "../proto/autogenerated/ts/express_server";
|
||||
|
||||
const serverOptions: ServerOptions = {
|
||||
AdminAuthGuard: async (authHeader) => { console.log("admin auth login with header: " + authHeader); return { pub: "__pubkey__" } },
|
||||
GuestAuthGuard: async (authHeader) => { console.log("guest auth login with header: " + authHeader); return { token: "__token__" } },
|
||||
NoAuthAuthGuard: async (_) => ({}),
|
||||
encryptionCallback: (_, b) => b
|
||||
AdminAuthGuard: async (authHeader) => { console.log("admin auth login with header: " + authHeader); return { admin_token: "__Admin__" } },
|
||||
UserAuthGuard: async (authHeader) => { console.log("user auth login with header: " + authHeader); return { user_token: "__user__" } },
|
||||
GuestAuthGuard: async (_) => ({}),
|
||||
encryptCallback: async (_, b) => b,
|
||||
decryptCallback: async (_, b) => b,
|
||||
}
|
||||
export default serverOptions
|
||||
|
|
@ -2,7 +2,7 @@ import 'dotenv/config' // TODO - test env
|
|||
import { AfterAll, BeforeAll, expect, Test, TestSuite } from 'testyts';
|
||||
import NewServer from '../proto/autogenerated/ts/express_server'
|
||||
import NewClient from '../proto/autogenerated/ts/http_client'
|
||||
import methods from './services/main';
|
||||
import methods from './services/serverMethods';
|
||||
import serverOptions from './auth';
|
||||
const testPort = 4000
|
||||
const server = NewServer(methods, { ...serverOptions, throwErrors: true })
|
||||
|
|
@ -10,7 +10,10 @@ const client = NewClient({
|
|||
baseUrl: `http://localhost:${testPort}`,
|
||||
retrieveAdminAuth: async () => (""),
|
||||
retrieveGuestAuth: async () => (""),
|
||||
retrieveNoAuthAuth: async () => (""),
|
||||
retrieveUserAuth: async () => (""),
|
||||
decryptCallback: async (b) => b,
|
||||
encryptCallback: async (b) => b,
|
||||
deviceId: "device0"
|
||||
})
|
||||
@TestSuite()
|
||||
export class ServerTestSuite {
|
||||
|
|
@ -29,6 +32,6 @@ export class ServerTestSuite {
|
|||
|
||||
@Test()
|
||||
async getInfo() {
|
||||
console.log(await client.LndGetInfo())
|
||||
console.log(await client.LndGetInfo({ node_id: 0 }))
|
||||
}
|
||||
}
|
||||
16
src/index.ts
16
src/index.ts
|
|
@ -1,5 +1,15 @@
|
|||
import 'dotenv/config'
|
||||
import Server from './server'
|
||||
|
||||
|
||||
import NewServer from '../proto/autogenerated/ts/express_server'
|
||||
import GetServerMethods from './services/serverMethods'
|
||||
import serverOptions from './auth';
|
||||
import Storage from './services/storage'
|
||||
import LND from './services/lnd'
|
||||
import Main from './services/main'
|
||||
(async () => {
|
||||
const storageHandler = new Storage()
|
||||
const lndHandler = new LND()
|
||||
const mainHandler = new Main(storageHandler, lndHandler)
|
||||
await storageHandler.Connect()
|
||||
const Server = NewServer(GetServerMethods(mainHandler), serverOptions)
|
||||
Server.Listen(3000)
|
||||
})()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import NewServer from '../proto/autogenerated/ts/express_server'
|
||||
import methods from './services/main'
|
||||
import GetServerMethods from './services/serverMethods'
|
||||
import serverOptions from './auth';
|
||||
export default NewServer(methods, serverOptions)
|
||||
export default NewServer(GetServerMethods(), serverOptions)
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
import { AfterAll, BeforeAll, expect, Test, TestSuite } from 'testyts';
|
||||
|
||||
import {
|
||||
generateRandomString,
|
||||
convertBase64ToBuffer,
|
||||
convertBufferToBase64,
|
||||
killCryptoSubprocess
|
||||
} from './crypto'
|
||||
@TestSuite()
|
||||
export class CryptoTestSuite {
|
||||
@Test()
|
||||
async generateRandomStringWithSpecifiedLength() {
|
||||
const base = Math.ceil(Math.random() * 100)
|
||||
const len = base % 2 !== 0 ? base + 1 : base
|
||||
const result = await generateRandomString(len)
|
||||
expect.toBeEqual(result.length, len)
|
||||
}
|
||||
|
||||
@Test()
|
||||
async BufferToStringConvertPreserverValues() {
|
||||
const rnd = await generateRandomString(24)
|
||||
|
||||
const asBuffer = convertBase64ToBuffer(rnd)
|
||||
|
||||
const asStringAgain = convertBufferToBase64(asBuffer)
|
||||
|
||||
expect.toBeEqual(asStringAgain, rnd)
|
||||
}
|
||||
|
||||
@AfterAll()
|
||||
killCryptoSubProcess() {
|
||||
killCryptoSubprocess()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
/**
|
||||
* @format
|
||||
*/
|
||||
import { Buffer } from 'buffer'
|
||||
import { ChildProcess, fork } from 'child_process'
|
||||
import { invoke } from './subprocess'
|
||||
export type EncryptedMessage = {
|
||||
ciphertext: string
|
||||
iv: string
|
||||
mac: string
|
||||
ephemPublicKey: string
|
||||
}
|
||||
|
||||
export type EncryptedMessageBuffer = {
|
||||
ciphertext: Buffer
|
||||
iv: Buffer
|
||||
mac: Buffer
|
||||
ephemPublicKey: Buffer
|
||||
metadata?: any
|
||||
}
|
||||
export type EncryptedMessageResponse = EncryptedMessage & { metadata?: any }
|
||||
|
||||
|
||||
export const generateRandomString = async (childProcess: ChildProcess, length = 16): Promise<string> => {
|
||||
if (length % 2 !== 0 || length < 2) {
|
||||
throw new Error('Random string length must be an even number.')
|
||||
}
|
||||
|
||||
const res = await invoke('generateRandomString', [length], childProcess)
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
export const convertUTF8ToBuffer = (value: string) => Buffer.from(value, 'utf-8')
|
||||
|
||||
export const convertBase64ToBuffer = (value: string) => Buffer.from(value, 'base64')
|
||||
|
||||
export const convertBufferToBase64 = (buffer: Buffer) => buffer.toString('base64')
|
||||
|
||||
export const processKey = (key: Buffer | string) => {
|
||||
if (Buffer.isBuffer(key)) {
|
||||
return key
|
||||
}
|
||||
const convertedKey = convertBase64ToBuffer(key)
|
||||
return convertedKey
|
||||
}
|
||||
|
||||
export const convertToEncryptedMessageResponse = (encryptedMessage: EncryptedMessageBuffer | EncryptedMessageResponse): EncryptedMessageResponse => {
|
||||
if (
|
||||
Buffer.isBuffer(encryptedMessage.ciphertext) &&
|
||||
Buffer.isBuffer(encryptedMessage.iv) &&
|
||||
Buffer.isBuffer(encryptedMessage.mac) &&
|
||||
Buffer.isBuffer(encryptedMessage.ephemPublicKey)
|
||||
) {
|
||||
return {
|
||||
ciphertext: convertBufferToBase64(encryptedMessage.ciphertext),
|
||||
iv: convertBufferToBase64(encryptedMessage.iv),
|
||||
mac: convertBufferToBase64(encryptedMessage.mac),
|
||||
ephemPublicKey: convertBufferToBase64(encryptedMessage.ephemPublicKey),
|
||||
metadata: encryptedMessage.metadata
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof encryptedMessage.ciphertext === 'string') {
|
||||
return encryptedMessage
|
||||
}
|
||||
|
||||
throw new Error('Unknown encrypted message format')
|
||||
}
|
||||
|
||||
export const convertToEncryptedMessage = (encryptedMessage: EncryptedMessageBuffer | EncryptedMessageResponse): EncryptedMessageBuffer => {
|
||||
if (
|
||||
encryptedMessage.ciphertext instanceof Buffer &&
|
||||
encryptedMessage.iv instanceof Buffer &&
|
||||
encryptedMessage.mac instanceof Buffer &&
|
||||
encryptedMessage.ephemPublicKey instanceof Buffer
|
||||
) {
|
||||
return encryptedMessage
|
||||
}
|
||||
if (
|
||||
typeof encryptedMessage.ciphertext === 'string' &&
|
||||
typeof encryptedMessage.iv === 'string' &&
|
||||
typeof encryptedMessage.mac === 'string' &&
|
||||
typeof encryptedMessage.ephemPublicKey === 'string'
|
||||
) {
|
||||
return {
|
||||
ciphertext: convertBase64ToBuffer(encryptedMessage.ciphertext),
|
||||
iv: convertBase64ToBuffer(encryptedMessage.iv),
|
||||
mac: convertBase64ToBuffer(encryptedMessage.mac),
|
||||
ephemPublicKey: convertBase64ToBuffer(encryptedMessage.ephemPublicKey),
|
||||
metadata: encryptedMessage.metadata
|
||||
}
|
||||
}
|
||||
throw new Error('Unknown encrypted message format')
|
||||
}
|
||||
|
|
@ -1,142 +0,0 @@
|
|||
import Path from 'path'
|
||||
|
||||
const words = require('random-words')
|
||||
|
||||
import {
|
||||
authorizeDevice,
|
||||
decryptMessage,
|
||||
encryptMessage,
|
||||
generateKeyPair,
|
||||
isAuthorizedDevice,
|
||||
killECCCryptoSubprocess,
|
||||
generatePrivate,
|
||||
getPublic
|
||||
} from './index'
|
||||
|
||||
const uuid = () => {
|
||||
const arr = /** @type {string[]} */ (words({ exactly: 24 }))
|
||||
return arr.join('-')
|
||||
}
|
||||
|
||||
const storageDirectory = Path.resolve(__dirname, `./.test-storage`)
|
||||
|
||||
console.log(`Storage directory: ${storageDirectory}`)
|
||||
|
||||
describe('ECC', () => {
|
||||
describe('generateKeyPair()', () => {
|
||||
it('generates a keypair', async () => {
|
||||
expect.hasAssertions()
|
||||
const pair = await generateKeyPair(uuid())
|
||||
|
||||
expect(pair.privateKey).toBeInstanceOf(Buffer)
|
||||
expect(typeof pair.privateKeyBase64 === 'string').toBeTruthy()
|
||||
expect(pair.publicKey).toBeInstanceOf(Buffer)
|
||||
expect(typeof pair.publicKeyBase64 === 'string').toBeTruthy()
|
||||
})
|
||||
it('returns the same pair for the same device', async () => {
|
||||
expect.hasAssertions()
|
||||
const id = uuid()
|
||||
const pair = await generateKeyPair(id)
|
||||
const pairAgain = await generateKeyPair(id)
|
||||
|
||||
expect(pairAgain).toStrictEqual(pair)
|
||||
})
|
||||
})
|
||||
|
||||
describe('authorizeDevice()/isAuthorizedDevice()', () => {
|
||||
it('authorizes a device given its ID', async () => {
|
||||
expect.hasAssertions()
|
||||
await Storage.init({
|
||||
dir: storageDirectory
|
||||
})
|
||||
const deviceId = uuid()
|
||||
const pair = await generateKeyPair(deviceId)
|
||||
await authorizeDevice({ deviceId, publicKey: pair.publicKeyBase64 })
|
||||
expect(isAuthorizedDevice({ deviceId })).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
||||
describe('encryptMessage()/decryptMessage()', () => {
|
||||
before(() =>
|
||||
Storage.init({
|
||||
dir: storageDirectory
|
||||
})
|
||||
)
|
||||
it('throws if provided with an unauthorized device id when encrypting', async () => {
|
||||
expect.hasAssertions()
|
||||
const deviceId = uuid()
|
||||
|
||||
try {
|
||||
await encryptMessage({
|
||||
message: uuid(),
|
||||
deviceId
|
||||
})
|
||||
throw new Error('encryptMessage() did not throw')
|
||||
} catch (_) {
|
||||
expect(true).toBeTruthy()
|
||||
}
|
||||
})
|
||||
it('throws if provided with an unknown device id when decrypting', async () => {
|
||||
expect.hasAssertions()
|
||||
const deviceId = uuid()
|
||||
|
||||
try {
|
||||
await decryptMessage({
|
||||
deviceId,
|
||||
encryptedMessage: {
|
||||
ciphertext: uuid(),
|
||||
ephemPublicKey: uuid(),
|
||||
iv: uuid(),
|
||||
mac: uuid(),
|
||||
metadata: uuid()
|
||||
}
|
||||
})
|
||||
throw new Error('decryptMessage() did not throw')
|
||||
} catch (_) {
|
||||
expect(true).toBeTruthy()
|
||||
}
|
||||
})
|
||||
it('encrypts and decrypts messages when given a known device id', async () => {
|
||||
expect.hasAssertions()
|
||||
const deviceId = uuid()
|
||||
|
||||
const pair = await generateKeyPair(deviceId)
|
||||
|
||||
await authorizeDevice({ deviceId, publicKey: pair.publicKeyBase64 })
|
||||
|
||||
const message = 'Bitcoin fixes this'
|
||||
|
||||
const encryptedMessage = await encryptMessage({ deviceId, message })
|
||||
|
||||
const decrypted = await decryptMessage({
|
||||
deviceId,
|
||||
encryptedMessage
|
||||
})
|
||||
|
||||
expect(decrypted).toEqual(message)
|
||||
})
|
||||
})
|
||||
|
||||
describe('generatePrivate()', () => {
|
||||
it('generates a private key', async () => {
|
||||
expect.hasAssertions()
|
||||
|
||||
const priv = await generatePrivate()
|
||||
|
||||
expect(priv).toBeInstanceOf(Buffer)
|
||||
})
|
||||
})
|
||||
|
||||
describe('getPublic()', () => {
|
||||
it('derives a public key from a private key', async () => {
|
||||
expect.hasAssertions()
|
||||
|
||||
const priv = await generatePrivate()
|
||||
const pub = await getPublic(priv)
|
||||
|
||||
expect(pub).toBeInstanceOf(Buffer)
|
||||
})
|
||||
})
|
||||
|
||||
after(killECCCryptoSubprocess)
|
||||
})
|
||||
|
|
@ -1,167 +0,0 @@
|
|||
import { fork } from 'child_process'
|
||||
import storage from '../storage'
|
||||
import type { EncryptedMessageResponse, EncryptedMessage } from './crypto'
|
||||
//const logger = require('../../config/log')
|
||||
import {
|
||||
generateRandomString as genString,
|
||||
convertBufferToBase64,
|
||||
processKey,
|
||||
convertToEncryptedMessageResponse,
|
||||
convertUTF8ToBuffer,
|
||||
convertToEncryptedMessage,
|
||||
convertBase64ToBuffer
|
||||
} from './crypto'
|
||||
import { invoke } from './subprocess'
|
||||
|
||||
const cryptoSubprocess = fork('src/services/encryption/subprocess')
|
||||
export const generateRandomString = (length?: number) => genString(cryptoSubprocess, length)
|
||||
//const nodeKeyPairs = new Map()
|
||||
//const devicePublicKeys = new Map()
|
||||
|
||||
|
||||
export type Pair = {
|
||||
privateKey: Buffer
|
||||
publicKey: Buffer
|
||||
privateKeyBase64: string
|
||||
publicKeyBase64: string
|
||||
}
|
||||
|
||||
export const isEncryptedMessage = (message: EncryptedMessage) =>
|
||||
message &&
|
||||
message.ciphertext &&
|
||||
message.iv &&
|
||||
message.mac &&
|
||||
message.ephemPublicKey
|
||||
|
||||
export const generateKeyPair = async (deviceId: string): Promise<Pair> => {
|
||||
try {
|
||||
const existingKey = await storage.getDeviceKeyPair(deviceId)
|
||||
|
||||
if (existingKey) {
|
||||
//logger.info('Device ID is already trusted')
|
||||
return {
|
||||
...existingKey,
|
||||
publicKeyBase64: convertBufferToBase64(existingKey.publicKey),
|
||||
privateKeyBase64: convertBufferToBase64(existingKey.privateKey)
|
||||
}
|
||||
}
|
||||
|
||||
const privateKey = await invoke('generatePrivate', [], cryptoSubprocess)
|
||||
const publicKey = await invoke('getPublic', [privateKey], cryptoSubprocess)
|
||||
const privateKeyBase64 = convertBufferToBase64(privateKey)
|
||||
const publicKeyBase64 = convertBufferToBase64(publicKey)
|
||||
|
||||
if (!Buffer.isBuffer(privateKey) || !Buffer.isBuffer(publicKey)) {
|
||||
throw new Error('Invalid KeyPair Generated')
|
||||
}
|
||||
|
||||
storage.setDeviceKeyPair(deviceId, {
|
||||
privateKey,
|
||||
publicKey
|
||||
})
|
||||
|
||||
return {
|
||||
privateKey,
|
||||
publicKey,
|
||||
privateKeyBase64,
|
||||
publicKeyBase64
|
||||
}
|
||||
} catch (err) {
|
||||
//logger.error(
|
||||
// '[ENCRYPTION] An error has occurred while generating a new KeyPair',
|
||||
// err
|
||||
//)
|
||||
//logger.error('Device ID:', deviceId)
|
||||
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
export const isAuthorizedDevice = ({ deviceId }: { deviceId: string }) => devicePublicKeys.has(deviceId)
|
||||
|
||||
export const authorizeDevice = async ({ deviceId, publicKey }: { deviceId: string, publicKey: string }) => {
|
||||
const hostId = await Storage.get('encryption/hostId')
|
||||
devicePublicKeys.set(deviceId, convertBase64ToBuffer(publicKey))
|
||||
const keyPair = await generateKeyPair(deviceId)
|
||||
|
||||
return {
|
||||
success: true,
|
||||
APIPublicKey: keyPair.publicKeyBase64,
|
||||
hostId
|
||||
}
|
||||
}
|
||||
|
||||
export const encryptMessage = async ({ message = '', deviceId }: { deviceId: string, message: string | number | boolean }): Promise<EncryptedMessageResponse> => {
|
||||
const parsedMessage = message.toString()
|
||||
// decryptMessage checks for known devices while this one checks for
|
||||
// authorized ones instead, why?
|
||||
const publicKey = devicePublicKeys.get(deviceId)
|
||||
|
||||
if (!publicKey) {
|
||||
throw new Error('encryptMessage() -> Unauthorized Device ID detected')
|
||||
}
|
||||
|
||||
const processedPublicKey = processKey(publicKey)
|
||||
const messageBuffer = convertUTF8ToBuffer(parsedMessage)
|
||||
const encryptedMessage = await invoke(
|
||||
'encrypt',
|
||||
[processedPublicKey, messageBuffer],
|
||||
cryptoSubprocess
|
||||
)
|
||||
|
||||
const encryptedMessageResponse = {
|
||||
ciphertext: encryptedMessage.ciphertext,
|
||||
iv: encryptedMessage.iv,
|
||||
mac: encryptedMessage.mac,
|
||||
ephemPublicKey: encryptedMessage.ephemPublicKey,
|
||||
metadata: {
|
||||
_deviceId: deviceId,
|
||||
_publicKey: publicKey
|
||||
}
|
||||
}
|
||||
|
||||
return convertToEncryptedMessageResponse(encryptedMessageResponse)
|
||||
}
|
||||
|
||||
export const decryptMessage = async ({ encryptedMessage, deviceId }: { encryptedMessage: EncryptedMessageResponse, deviceId: string }) => {
|
||||
// encryptMessages checks for authorized devices while this one checks for
|
||||
// known ones, why?
|
||||
const keyPair = nodeKeyPairs.get(deviceId)
|
||||
try {
|
||||
if (!keyPair) {
|
||||
throw new Error('decryptMessage() -> Unknown Device ID detected')
|
||||
}
|
||||
|
||||
const processedPrivateKey = processKey(keyPair.privateKey)
|
||||
const decryptedMessage = await invoke(
|
||||
'decrypt',
|
||||
[processedPrivateKey, convertToEncryptedMessage(encryptedMessage)],
|
||||
cryptoSubprocess
|
||||
)
|
||||
const parsedMessage = decryptedMessage.toString('utf8')
|
||||
|
||||
return parsedMessage
|
||||
} catch (err) {
|
||||
//logger.error(err)
|
||||
//if (err.message?.toLowerCase() === 'bad mac') {
|
||||
// logger.error(
|
||||
// 'Bad Mac!',
|
||||
// err,
|
||||
// convertToEncryptedMessage(encryptedMessage),
|
||||
// !!keyPair
|
||||
// )
|
||||
//}
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
export const generatePrivate = (): Promise<Buffer> => invoke('generatePrivate', [], cryptoSubprocess)
|
||||
|
||||
export const getPublic = (priv: Buffer): Promise<Buffer> => invoke('getPublic', [priv], cryptoSubprocess)
|
||||
|
||||
module.exports = {
|
||||
|
||||
killECCCryptoSubprocess() {
|
||||
cryptoSubprocess.kill()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,155 +0,0 @@
|
|||
import Crypto from 'crypto'
|
||||
import ECCrypto from 'eccrypto'
|
||||
import { v1 as uuid } from 'uuid'
|
||||
import { Buffer } from 'buffer'
|
||||
import mapValues from 'lodash/mapValues'
|
||||
import type { ChildProcess } from 'child_process'
|
||||
|
||||
//import logger from '../../config/log'
|
||||
/*
|
||||
logger.info('crypto subprocess invoked')
|
||||
|
||||
process.on('uncaughtException', e => {
|
||||
logger.error('Uncaught exception inside crypto subprocess:')
|
||||
logger.error(e)
|
||||
})
|
||||
|
||||
process.on('unhandledRejection', e => {
|
||||
logger.error('Unhandled rejection inside crypto subprocess:')
|
||||
logger.error(e)
|
||||
})
|
||||
*/
|
||||
|
||||
type Method = 'generateRandomString' | 'convertUTF8ToBuffer'
|
||||
| 'convertBase64ToBuffer' | 'convertBufferToBase64' | 'generatePrivate'
|
||||
| 'getPublic' | 'encrypt' | 'decrypt'
|
||||
type Msg = {
|
||||
args: any[]
|
||||
id: string
|
||||
method: Method
|
||||
}
|
||||
|
||||
const processBufferAfterSerialization = (obj: any): any => {
|
||||
if (typeof obj === 'object' && obj !== null) {
|
||||
if (obj.type === 'Buffer') {
|
||||
return Buffer.from(obj.data)
|
||||
}
|
||||
return mapValues(obj, processBufferAfterSerialization)
|
||||
}
|
||||
return obj
|
||||
}
|
||||
|
||||
|
||||
const handleMsg = async (msg: Msg) => {
|
||||
if (typeof msg !== 'object' || msg === null) {
|
||||
throw new Error('Msg in crypto subprocess not an object')
|
||||
}
|
||||
|
||||
const { id, method } = msg
|
||||
const args = msg.args.map(processBufferAfterSerialization)
|
||||
if (!process.send) {
|
||||
throw new Error("sub process was not spawned as child")
|
||||
}
|
||||
try {
|
||||
if (method === 'generateRandomString') {
|
||||
const [length] = args
|
||||
|
||||
Crypto.randomBytes(length / 2, (err, buffer) => {
|
||||
if (!process.send) {
|
||||
throw new Error("sub process was not spawned as child")
|
||||
}
|
||||
if (err) {
|
||||
process.send({
|
||||
id,
|
||||
err: err.message
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const token = buffer.toString('hex')
|
||||
process.send({
|
||||
id,
|
||||
payload: token
|
||||
})
|
||||
})
|
||||
}
|
||||
if (method === 'convertUTF8ToBuffer') {
|
||||
const [value] = args
|
||||
|
||||
process.send({
|
||||
id,
|
||||
payload: Buffer.from(value, 'utf8')
|
||||
})
|
||||
}
|
||||
if (method === 'convertBase64ToBuffer') {
|
||||
const [value] = args
|
||||
|
||||
process.send({
|
||||
id,
|
||||
payload: Buffer.from(value, 'base64')
|
||||
})
|
||||
}
|
||||
if (method === 'convertBufferToBase64') {
|
||||
const [buffer] = args
|
||||
|
||||
process.send({
|
||||
id,
|
||||
payload: buffer.toString('base64')
|
||||
})
|
||||
}
|
||||
if (method === 'generatePrivate') {
|
||||
process.send({
|
||||
id,
|
||||
payload: ECCrypto.generatePrivate()
|
||||
})
|
||||
}
|
||||
if (method === 'getPublic') {
|
||||
const [privateKey] = args
|
||||
process.send({
|
||||
id,
|
||||
payload: ECCrypto.getPublic(privateKey)
|
||||
})
|
||||
}
|
||||
if (method === 'encrypt') {
|
||||
const [processedPublicKey, messageBuffer] = args
|
||||
process.send({
|
||||
id,
|
||||
payload: await ECCrypto.encrypt(processedPublicKey, messageBuffer)
|
||||
})
|
||||
}
|
||||
if (method === 'decrypt') {
|
||||
const [processedPrivateKey, encryptedMessage] = args
|
||||
process.send({
|
||||
id,
|
||||
payload: await ECCrypto.decrypt(processedPrivateKey, encryptedMessage)
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
process.send({
|
||||
err: e.message
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
process.on('message', handleMsg)
|
||||
|
||||
export const invoke = (method: Method, args: any[], cryptoSubprocess: ChildProcess): Promise<any> =>
|
||||
new Promise((res, rej) => {
|
||||
const id = uuid()
|
||||
const listener = (msg: any) => {
|
||||
if (msg.id === id) {
|
||||
cryptoSubprocess.off('message', listener)
|
||||
if (msg.err) {
|
||||
rej(new Error(msg.err))
|
||||
} else {
|
||||
res(processBufferAfterSerialization(msg.payload))
|
||||
}
|
||||
}
|
||||
}
|
||||
cryptoSubprocess.on('message', listener)
|
||||
cryptoSubprocess.send({
|
||||
args,
|
||||
id,
|
||||
method
|
||||
})
|
||||
})
|
||||
48
src/services/serverMethods/index.ts
Normal file
48
src/services/serverMethods/index.ts
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import * as Types from '../../../proto/autogenerated/ts/types'
|
||||
import Main from '../main'
|
||||
export default (mainHandler: Main): Types.ServerMethods => {
|
||||
return {
|
||||
EncryptionExchange: async (ctx: Types.EncryptionExchange_Context, req: Types.EncryptionExchangeRequest): Promise<void> => { },
|
||||
Health: async (ctx: Types.Health_Context): Promise<void> => { },
|
||||
LndGetInfo: async (ctx: Types.LndGetInfo_Context): Promise<Types.LndGetInfoResponse> => {
|
||||
const info = await mainHandler.lnd.GetInfo()
|
||||
return { alias: info.alias }
|
||||
},
|
||||
AddUser: async (ctx: Types.GuestContext, req: Types.AddUserRequest): Promise<Types.AddUserResponse> => {
|
||||
const err = Types.AddUserRequestValidate(req, {
|
||||
callback_url_CustomCheck: url => url.startsWith("http://") || url.startsWith("https://"),
|
||||
name_CustomCheck: name => req.name.length > 0,
|
||||
secret_CustomCheck: secret => secret.length > 8
|
||||
})
|
||||
if (err != null) throw new Error(err.message)
|
||||
return mainHandler.AddUser(req)
|
||||
},
|
||||
AuthUser: async (ctx: Types.GuestContext, req: Types.AuthUserRequest): Promise<Types.AuthUserResponse> => {
|
||||
throw new Error("unimplemented")
|
||||
},
|
||||
OpenChannel: async (ctx: Types.UserContext, req: Types.OpenChannelRequest): Promise<Types.OpenChannelResponse> => {
|
||||
const err = Types.OpenChannelRequestValidate(req, {
|
||||
channel_balance_CustomCheck: balance => balance > 0,
|
||||
push_amount_CustomCheck: amt => amt > 0,
|
||||
destination_CustomCheck: dest => dest !== ""
|
||||
})
|
||||
if (err != null) throw new Error(err.message)
|
||||
return mainHandler.OpenChannel(req)
|
||||
},
|
||||
NewAddress: async (ctx: Types.UserContext): Promise<Types.NewAddressResponse> => {
|
||||
throw new Error("unimplemented")
|
||||
},
|
||||
PayAddress: async (ctx: Types.UserContext, req: Types.PayAddressRequest): Promise<Types.PayAddressResponse> => {
|
||||
throw new Error("unimplemented")
|
||||
},
|
||||
NewInvoice: async (ctx: Types.UserContext, req: Types.NewInvoiceRequest): Promise<Types.NewInvoiceResponse> => {
|
||||
throw new Error("unimplemented")
|
||||
},
|
||||
PayInvoice: async (ctx: Types.UserContext, req: Types.PayInvoiceRequest): Promise<Types.PayInvoiceResponse> => {
|
||||
throw new Error("unimplemented")
|
||||
},
|
||||
GetOpenChannelLNURL: async (ctx: Types.UserContext): Promise<Types.GetOpenChannelLNURLResponse> => {
|
||||
throw new Error("unimplemented")
|
||||
}
|
||||
}
|
||||
}
|
||||
13
src/services/storage/db.ts
Normal file
13
src/services/storage/db.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import "reflect-metadata"
|
||||
import { DataSource } from "typeorm"
|
||||
import { User } from "./entity/User"
|
||||
|
||||
const AppDataSource = new DataSource({
|
||||
type: "sqlite",
|
||||
database: `db.sqlite`,
|
||||
logging: true,
|
||||
entities: [User],
|
||||
})
|
||||
export default async () => {
|
||||
return AppDataSource.initialize()
|
||||
}
|
||||
29
src/services/storage/entity/User.ts
Normal file
29
src/services/storage/entity/User.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { Entity, PrimaryGeneratedColumn, Column, Index, Check } from "typeorm"
|
||||
|
||||
@Entity()
|
||||
@Check(`"balance_sats" >= 0`)
|
||||
export class User {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
serial_id: number
|
||||
|
||||
@Column()
|
||||
@Index({ unique: true })
|
||||
user_id: string
|
||||
|
||||
@Column()
|
||||
@Index({ unique: true })
|
||||
name: string
|
||||
|
||||
@Column()
|
||||
secret_sha256: string
|
||||
|
||||
@Column()
|
||||
callbackUrl: string
|
||||
|
||||
@Column({ type: 'integer' })
|
||||
balance_sats: number
|
||||
|
||||
@Column()
|
||||
locked: boolean
|
||||
}
|
||||
|
|
@ -1,9 +1,58 @@
|
|||
type Pair = {
|
||||
privateKey: Buffer
|
||||
publicKey: Buffer
|
||||
import { DataSource, EntityManager } from "typeorm"
|
||||
import crypto from 'crypto';
|
||||
import NewDB from "./db"
|
||||
import { User } from "./entity/User"
|
||||
|
||||
export default class {
|
||||
DB: DataSource
|
||||
async Connect() {
|
||||
this.DB = await NewDB()
|
||||
}
|
||||
async AddUser(name: string, callbackUrl: string, secret: string, entityManager = this.DB) {
|
||||
return entityManager.getRepository(User).create({
|
||||
name: name,
|
||||
callbackUrl: callbackUrl,
|
||||
secret_sha256: crypto.createHash('sha256').update(secret).digest('base64')
|
||||
})
|
||||
}
|
||||
FindUser(userId: string, entityManager = this.DB) {
|
||||
return entityManager.getRepository(User).findOne({
|
||||
where: {
|
||||
user_id: userId
|
||||
}
|
||||
})
|
||||
}
|
||||
async GetUser(user_id: string, entityManager = this.DB): Promise<User> {
|
||||
const user = await this.FindUser(user_id, entityManager)
|
||||
if (!user) {
|
||||
throw new Error(`user ${user_id} not found`) // TODO: fix logs doxing
|
||||
}
|
||||
return user
|
||||
}
|
||||
LockUser(userId: string, entityManager = this.DB) {
|
||||
return entityManager.getRepository(User).update({
|
||||
user_id: userId
|
||||
}, { locked: true })
|
||||
}
|
||||
UnlockUser(userId: string, entityManager = this.DB) {
|
||||
return entityManager.getRepository(User).update({
|
||||
user_id: userId
|
||||
}, { locked: false })
|
||||
}
|
||||
async IncrementUserBalance(userId: string, increment: number, entityManager = this.DB) {
|
||||
const res = await entityManager.getRepository(User).increment({
|
||||
user_id: userId,
|
||||
}, "balance_sats", increment)
|
||||
if (!res.affected) {
|
||||
throw new Error("unaffected balance increment for " + userId) // TODO: fix logs doxing
|
||||
}
|
||||
}
|
||||
async DecrementUserBalance(userId: string, decrement: number, entityManager = this.DB) {
|
||||
const res = await entityManager.getRepository(User).decrement({
|
||||
user_id: userId,
|
||||
}, "balance_sats", decrement)
|
||||
if (!res.affected) {
|
||||
throw new Error("unaffected balance decrement for " + userId) // TODO: fix logs doxing
|
||||
}
|
||||
}
|
||||
const getDeviceKeyPair = async (deviceId: string): Promise<Pair | null> => {
|
||||
return null
|
||||
}
|
||||
const setDeviceKeyPair = async (deviceId: string, pair: Pair) => { }
|
||||
export default { getDeviceKeyPair, setDeviceKeyPair }
|
||||
Loading…
Add table
Add a link
Reference in a new issue