mirror of
https://github.com/stakwork/sphinx-relay.git
synced 2026-08-13 12:33:24 +02:00
queryRoutes shim, bolt11->payment_request in subscribe
This commit is contained in:
parent
643892ca2b
commit
d9924453e5
14 changed files with 123 additions and 64 deletions
2
dist/src/grpc/interfaces.js
vendored
2
dist/src/grpc/interfaces.js
vendored
|
|
@ -231,6 +231,8 @@ function subscribeResponse(res) {
|
|||
is_keysend,
|
||||
htlcs: [{ custom_records }],
|
||||
state: InvoiceState.SETTLED,
|
||||
r_hash: r.payment_hash,
|
||||
payment_request: r.bolt11,
|
||||
};
|
||||
const { satoshi, millisatoshi } = greenlightAmoutToAmounts(r.amount);
|
||||
i.value = satoshi;
|
||||
|
|
|
|||
2
dist/src/grpc/interfaces.js.map
vendored
2
dist/src/grpc/interfaces.js.map
vendored
File diff suppressed because one or more lines are too long
65
dist/src/grpc/lightning.js
vendored
65
dist/src/grpc/lightning.js
vendored
|
|
@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getChanInfo = exports.channelBalance = exports.complexBalances = exports.openChannel = exports.connectPeer = exports.pendingChannels = exports.listChannels = exports.addInvoice = exports.getInfo = exports.verifyAscii = exports.verifyMessage = exports.verifyBytes = exports.signBuffer = exports.signMessage = exports.listAllPaymentsFull = exports.listPaymentsPaginated = exports.listAllPayments = exports.listAllInvoices = exports.listInvoices = exports.signAscii = exports.keysendMessage = exports.loadRouter = exports.keysend = exports.sendPayment = exports.newAddress = exports.UNUSED_NESTED_PUBKEY_HASH = exports.UNUSED_WITNESS_PUBKEY_HASH = exports.NESTED_PUBKEY_HASH = exports.WITNESS_PUBKEY_HASH = exports.queryRoute = exports.getRoute = exports.setLock = exports.getLock = exports.getHeaders = exports.unlockWallet = exports.loadWalletUnlocker = exports.loadLightning = exports.loadCredentials = exports.SPHINX_CUSTOM_RECORD_KEY = exports.LND_KEYSEND_KEY = void 0;
|
||||
exports.getChanInfo = exports.channelBalance = exports.complexBalances = exports.openChannel = exports.connectPeer = exports.pendingChannels = exports.listChannels = exports.addInvoice = exports.getInfo = exports.verifyAscii = exports.verifyMessage = exports.verifyBytes = exports.signBuffer = exports.signMessage = exports.listAllPaymentsFull = exports.listPaymentsPaginated = exports.listAllPayments = exports.listAllInvoices = exports.listInvoices = exports.signAscii = exports.keysendMessage = exports.loadRouter = exports.keysend = exports.sendPayment = exports.newAddress = exports.UNUSED_NESTED_PUBKEY_HASH = exports.UNUSED_WITNESS_PUBKEY_HASH = exports.NESTED_PUBKEY_HASH = exports.WITNESS_PUBKEY_HASH = exports.queryRoute = exports.setLock = exports.getLock = exports.getHeaders = exports.unlockWallet = exports.loadWalletUnlocker = exports.loadLightning = exports.loadCredentials = exports.SPHINX_CUSTOM_RECORD_KEY = exports.LND_KEYSEND_KEY = void 0;
|
||||
const ByteBuffer = require("bytebuffer");
|
||||
const fs = require("fs");
|
||||
const grpc = require("grpc");
|
||||
|
|
@ -145,45 +145,38 @@ const setLock = (value) => {
|
|||
}, 1000 * 60 * 2);
|
||||
};
|
||||
exports.setLock = setLock;
|
||||
const getRoute = (pub_key, amt, route_hint, callback) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
log('getRoute');
|
||||
let lightning = yield loadLightning(true); // try proxy
|
||||
const options = { pub_key, amt };
|
||||
if (route_hint && route_hint.includes(':')) {
|
||||
const arr = route_hint.split(':');
|
||||
const node_id = arr[0];
|
||||
const chan_id = arr[1];
|
||||
options.route_hints = [{
|
||||
hop_hints: [{ node_id, chan_id }]
|
||||
}];
|
||||
}
|
||||
lightning.queryRoutes(options, (err, response) => callback(err, response));
|
||||
});
|
||||
exports.getRoute = getRoute;
|
||||
const queryRoute = (pub_key, amt, route_hint, ownerPubkey) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
log('queryRoute');
|
||||
return new Promise(function (resolve, reject) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let lightning = yield loadLightning(true, ownerPubkey); // try proxy
|
||||
const options = { pub_key, amt };
|
||||
if (route_hint && route_hint.includes(':')) {
|
||||
const arr = route_hint.split(':');
|
||||
const node_id = arr[0];
|
||||
const chan_id = arr[1];
|
||||
options.route_hints = [{
|
||||
hop_hints: [{ node_id, chan_id }]
|
||||
}];
|
||||
}
|
||||
lightning.queryRoutes(options, (err, response) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
function queryRoute(pub_key, amt, route_hint, ownerPubkey) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
log('queryRoute');
|
||||
if (IS_GREENLIGHT) { // shim for now
|
||||
return {
|
||||
success_prob: 1,
|
||||
routes: []
|
||||
};
|
||||
}
|
||||
return new Promise(function (resolve, reject) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let lightning = yield loadLightning(true, ownerPubkey); // try proxy
|
||||
const options = { pub_key, amt };
|
||||
if (route_hint && route_hint.includes(':')) {
|
||||
const arr = route_hint.split(':');
|
||||
const node_id = arr[0];
|
||||
const chan_id = arr[1];
|
||||
options.route_hints = [{
|
||||
hop_hints: [{ node_id, chan_id }]
|
||||
}];
|
||||
}
|
||||
resolve(response);
|
||||
lightning.queryRoutes(options, (err, response) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
resolve(response);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.queryRoute = queryRoute;
|
||||
exports.WITNESS_PUBKEY_HASH = 0;
|
||||
exports.NESTED_PUBKEY_HASH = 1;
|
||||
|
|
|
|||
2
dist/src/grpc/lightning.js.map
vendored
2
dist/src/grpc/lightning.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/src/grpc/subscribe.js
vendored
4
dist/src/grpc/subscribe.js
vendored
|
|
@ -26,9 +26,9 @@ function subscribeInvoices(parseKeysendInvoice) {
|
|||
var call = lightning[cmd]();
|
||||
call.on('data', function (response) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
console.log("=> INVOICE RAW", response);
|
||||
// console.log("=> INVOICE RAW", response)
|
||||
const inv = interfaces.subscribeResponse(response);
|
||||
console.log("INVOICE RECEIVED", inv);
|
||||
// console.log("INVOICE RECEIVED", inv)
|
||||
// loginvoice(inv)
|
||||
if (inv.state !== interfaces.InvoiceState.SETTLED) {
|
||||
return;
|
||||
|
|
|
|||
2
dist/src/grpc/subscribe.js.map
vendored
2
dist/src/grpc/subscribe.js.map
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"subscribe.js","sourceRoot":"","sources":["../../../src/grpc/subscribe.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAA2C;AAC3C,sCAAqC;AACrC,iCAAgC;AAChC,4CAAgD;AAChD,uCAA2C;AAC3C,2CAA0C;AAE1C,MAAM,oBAAoB,GAAG,EAAE,CAAA;AAC/B,MAAM,uBAAuB,GAAG,CAAC,CAAA;AACjC,MAAM,sBAAsB,GAAG,EAAE,CAAA,CAAC,SAAS;AAE3C,SAAgB,iBAAiB,CAAC,mBAAmB;IACpD,OAAO,IAAI,OAAO,CAAC,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;QAC5C,MAAM,SAAS,GAAG,MAAM,yBAAa,CAAC,IAAI,CAAC,CAAA,CAAC,YAAY;QAExD,MAAM,GAAG,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAA;QACzC,IAAI,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,EAAE,CAAA;QAC3B,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,UAAgB,QAAQ;;gBACvC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAA;gBACvC,MAAM,GAAG,GAAG,UAAU,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAA;gBAClD,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAA;gBACpC,kBAAkB;gBAClB,IAAI,GAAG,CAAC,K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ACH,CAAC;AApDD,8CAoDC;AAED,SAAS,gBAAgB;IACxB,UAAU,CAAC,GAAE,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;AAC3D,CAAC;AAED,IAAI,CAAC,GAAG,CAAC,CAAA;AACT,IAAI,GAAG,GAAG,CAAC,CAAA;AACX,SAAsB,oBAAoB,CAAC,QAAgB,EAAE,QAAmB;;QAC/E,GAAG,GAAG,QAAQ,CAAA;QACd,CAAC,EAAE,CAAA;QACH,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,IAAI,EAAE,CAAC;QAC1D,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,yCAAyC,CAAC,EAAE,CAAC,CAAA;QAClE,IAAI;YACH,MAAM,OAAO,CAAC,qBAAqB,EAAE,CAAA;YACrC,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,IAAI,EAAE,CAAC;YAC1D,OAAO,CAAC,GAAG,CAAC,6BAA6B,GAAG,EAAE,CAAC,CAAA;YAC/C,IAAI,QAAQ;gBAAE,QAAQ,EAAE,CAAA;SACxB;QAAC,OAAO,CAAC,EAAE;YACX,IAAI,CAAC,CAAC,IAAI,KAAK,sBAAsB,EAAE;gBACtC,MAAM,uBAAc,EAAE,CAAA;aACtB;YACD,UAAU,CAAC,GAAS,EAAE;gBACrB,IAAI,GAAG,KAAK,QAAQ,EAAE,EAAE,iDAAiD;oBACxE,MAAM,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;iBAC9C;YACF,CAAC,CAAA,EAAE,IAAI,CAAC,CAAA;SACR;IACF,CAAC;CAAA;AApBD,oDAoBC"}
|
||||
|
|
@ -375,7 +375,7 @@ interface Hop {
|
|||
pub_key: string,
|
||||
custom_records: DestCustomRecords,
|
||||
}
|
||||
interface Route {
|
||||
export interface Route {
|
||||
total_time_lock: number,
|
||||
total_fees: string, // deprecated
|
||||
total_amt: string, // deprecated
|
||||
|
|
@ -506,6 +506,8 @@ export function subscribeResponse(res: Invoice|GreenlightIncomingPayment): Invoi
|
|||
is_keysend,
|
||||
htlcs: [<InvoiceHTLC>{custom_records}],
|
||||
state: InvoiceState.SETTLED,
|
||||
r_hash: r.payment_hash,
|
||||
payment_request: r.bolt11,
|
||||
}
|
||||
const {satoshi, millisatoshi} = greenlightAmoutToAmounts(r.amount)
|
||||
i.value = satoshi
|
||||
|
|
|
|||
|
|
@ -134,26 +134,18 @@ export const setLock = (value) => {
|
|||
}, 1000 * 60 * 2)
|
||||
}
|
||||
|
||||
export const getRoute = async (pub_key, amt, route_hint, callback) => {
|
||||
log('getRoute')
|
||||
let lightning = await loadLightning(true) // try proxy
|
||||
const options:{[k:string]:any} = { pub_key, amt }
|
||||
if(route_hint && route_hint.includes(':')) {
|
||||
const arr = route_hint.split(':')
|
||||
const node_id = arr[0]
|
||||
const chan_id = arr[1]
|
||||
options.route_hints = [{
|
||||
hop_hints: [{ node_id, chan_id }]
|
||||
}]
|
||||
}
|
||||
lightning.queryRoutes(
|
||||
options,
|
||||
(err, response) => callback(err, response)
|
||||
)
|
||||
interface QueryRouteResponse {
|
||||
success_prob: number,
|
||||
routes: interfaces.Route[]
|
||||
}
|
||||
|
||||
export const queryRoute = async (pub_key, amt, route_hint, ownerPubkey?:string) => {
|
||||
export async function queryRoute(pub_key, amt, route_hint, ownerPubkey?:string): Promise<QueryRouteResponse> {
|
||||
log('queryRoute')
|
||||
if(IS_GREENLIGHT) { // shim for now
|
||||
return {
|
||||
success_prob: 1,
|
||||
routes: []
|
||||
}
|
||||
}
|
||||
return new Promise(async function (resolve, reject) {
|
||||
let lightning = await loadLightning(true, ownerPubkey) // try proxy
|
||||
const options:{[k:string]:any} = { pub_key, amt }
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ export function subscribeInvoices(parseKeysendInvoice) {
|
|||
const cmd = interfaces.subscribeCommand()
|
||||
var call = lightning[cmd]()
|
||||
call.on('data', async function (response) {
|
||||
console.log("=> INVOICE RAW", response)
|
||||
// console.log("=> INVOICE RAW", response)
|
||||
const inv = interfaces.subscribeResponse(response)
|
||||
console.log("INVOICE RECEIVED", inv)
|
||||
// console.log("INVOICE RECEIVED", inv)
|
||||
// loginvoice(inv)
|
||||
if (inv.state !== interfaces.InvoiceState.SETTLED) {
|
||||
return
|
||||
|
|
|
|||
3
testing/.gitignore
vendored
3
testing/.gitignore
vendored
|
|
@ -6,4 +6,5 @@ cluster_config.json
|
|||
greenlight/alice_creds
|
||||
greenlight/bob_creds
|
||||
greenlight/charlie_creds
|
||||
greenlight/scheduler_creds
|
||||
greenlight/scheduler_creds
|
||||
greenlight/orange_creds
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ node ./dist/app.js --config="/Users/evanfeenstra/code/sphinx-relay/testing/green
|
|||
|
||||
node ./dist/app.js --config="/Users/evanfeenstra/code/sphinx-relay/testing/greenlight/charlie.json" --db="/Users/evanfeenstra/code/sphinx-relay/testing/greenlight/charlie-db.json"
|
||||
|
||||
node ./dist/app.js --config="/Users/evanfeenstra/code/sphinx-relay/testing/greenlight/orange.json" --db="/Users/evanfeenstra/code/sphinx-relay/testing/greenlight/orange-db.json"
|
||||
|
||||
sqlite3 /Users/Shared/sphinx-alice-greenlight.db
|
||||
|
||||
```
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
"scheduler_tls_location": "/Users/evanfeenstra/code/sphinx-relay/testing/greenlight/scheduler_creds/ca.pem",
|
||||
"scheduler_key_location": "/Users/evanfeenstra/code/sphinx-relay/testing/greenlight/scheduler_creds/device-key.pem",
|
||||
"scheduler_chain_location": "/Users/evanfeenstra/code/sphinx-relay/testing/greenlight/scheduler_creds/device.crt",
|
||||
"scheduler_default_pubkey": "02739d50cedddf3bd8affc8c978d19575c71bad1abfba90d9bcf90ea52aa7362ff"
|
||||
"hsm_secret_path": "/Users/evanfeenstra/code/sphinx-relay/testing/greenlight/charlie_creds/hsm_secret"
|
||||
},
|
||||
"production": {
|
||||
"senza_url": "https://staging.senza.us/api/v2/",
|
||||
|
|
|
|||
7
testing/greenlight/orange-db.json
Normal file
7
testing/greenlight/orange-db.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"development": {
|
||||
"dialect": "sqlite",
|
||||
"storage": "/Users/Shared/sphinx-orange-greenlight.db"
|
||||
}
|
||||
}
|
||||
|
||||
60
testing/greenlight/orange.json
Normal file
60
testing/greenlight/orange.json
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
"development": {
|
||||
"lightning_provider": "GREENLIGHT",
|
||||
"senza_url": "http://localhost:3000/api/v2",
|
||||
"node_ip": "127.0.0.1",
|
||||
"tls_location": "/Users/evanfeenstra/code/sphinx-relay/testing/greenlight/orange_creds/ca.pem",
|
||||
"tls_key_location": "/Users/evanfeenstra/code/sphinx-relay/testing/greenlight/orange_creds/device-key.pem",
|
||||
"tls_chain_location": "/Users/evanfeenstra/code/sphinx-relay/testing/greenlight/orange_creds/device.crt",
|
||||
"lnd_ip": "35.236.110.178",
|
||||
"lnd_port": "6042",
|
||||
"node_http_protocol": "http",
|
||||
"node_http_port": "3004",
|
||||
"hub_api_url": "http://lvh.me/api/v1",
|
||||
"hub_url": "http://lvh.me/ping",
|
||||
"hub_invite_url": "http://lvh.me/invites",
|
||||
"hub_check_invite_url": "http://lvh.me/check_invite",
|
||||
"media_host": "localhost:5000",
|
||||
"tribes_host": "localhost:5002",
|
||||
"tribes_mqtt_port": "1883",
|
||||
"tribes_insecure": true,
|
||||
"public_url": "",
|
||||
"connection_string_path": "connection_string.txt",
|
||||
"ssl": {
|
||||
"enabled": false,
|
||||
"save": true,
|
||||
"port": "80"
|
||||
},
|
||||
"connect_ui": true,
|
||||
"scheduler_tls_location": "/Users/evanfeenstra/code/sphinx-relay/testing/greenlight/scheduler_creds/ca.pem",
|
||||
"scheduler_key_location": "/Users/evanfeenstra/code/sphinx-relay/testing/greenlight/scheduler_creds/device-key.pem",
|
||||
"scheduler_chain_location": "/Users/evanfeenstra/code/sphinx-relay/testing/greenlight/scheduler_creds/device.crt",
|
||||
"hsm_secret_path": "/Users/evanfeenstra/code/sphinx-relay/testing/greenlight/orange_creds/hsm_secret"
|
||||
},
|
||||
"production": {
|
||||
"senza_url": "https://staging.senza.us/api/v2/",
|
||||
"macaroon_location": "/relay/.lnd/data/chain/bitcoin/mainnet/admin.macaroon",
|
||||
"tls_location": "/relay/.lnd/tls.cert",
|
||||
"lnd_log_location": "/relay/.lnd/logs/bitcoin/mainnet/lnd.log",
|
||||
"node_ip": "localhost",
|
||||
"lnd_ip": "localhost",
|
||||
"node_http_protocol": "http",
|
||||
"node_http_port": "3001",
|
||||
"lnd_port": "10009",
|
||||
"hub_api_url": "https://hub.sphinx.chat/api/v1",
|
||||
"hub_url": "https://hub.sphinx.chat/ping",
|
||||
"hub_invite_url": "https://hub.sphinx.chat/invites",
|
||||
"hub_check_invite_url": "https://hub.sphinx.chat/check_invite",
|
||||
"media_host": "localhost:5000",
|
||||
"tribes_host": "localhost:5002",
|
||||
"tribes_mqtt_port": "1883",
|
||||
"public_url": "",
|
||||
"connection_string_path": "connection_string.txt",
|
||||
"ssl": {
|
||||
"enabled": false,
|
||||
"save": true,
|
||||
"port": "80"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue