lnurl withdraw + lnurl pay

This commit is contained in:
hatim boufnichel 2022-11-19 23:02:05 +01:00
parent 6f531cf69f
commit 91d67ab4ee
48 changed files with 2287 additions and 32905 deletions

View file

@ -9,6 +9,7 @@ SERVICE_FEE_INCOMING_TX_PERCENT=0
SERVICE_FEE_OUTGOING_TX_PERCENT=0
SERVICE_FEE_INCOMING_INVOICE_PERCENT=0
SERVICE_FEE_OUTGOING_INVOICE_PERCENT=0
SERVICE_URL=http://localhost:8080
NOSTR_PUBLIC_KEY=
NOSTR_PRIVATE_KEY=
NOSTR_RELAYS=

421
package-lock.json generated
View file

@ -17,6 +17,7 @@
"@types/node": "^17.0.31",
"@types/secp256k1": "^4.0.3",
"axios": "^0.27.2",
"bech32": "^2.0.0",
"chai": "^4.3.7",
"copyfiles": "^2.4.1",
"cors": "^2.8.5",
@ -48,6 +49,7 @@
"@types/lodash": "^4.14.182",
"@types/node": "^16.11.10",
"@types/uuid": "^8.3.4",
"nodemon": "^2.0.20",
"ts-node": "10.7.0",
"typescript": "4.5.2"
}
@ -663,6 +665,19 @@
"resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
"integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A=="
},
"node_modules/anymatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
"integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
"dev": true,
"dependencies": {
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/app-root-path": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-3.1.0.tgz",
@ -771,6 +786,20 @@
}
]
},
"node_modules/bech32": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz",
"integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg=="
},
"node_modules/binary-extensions": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/bindings": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
@ -1018,6 +1047,33 @@
"node": "*"
}
},
"node_modules/chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
"dev": true,
"funding": [
{
"type": "individual",
"url": "https://paulmillr.com/funding/"
}
],
"dependencies": {
"anymatch": "~3.1.2",
"braces": "~3.0.2",
"glob-parent": "~5.1.2",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.6.0"
},
"engines": {
"node": ">= 8.10.0"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/chownr": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
@ -1733,6 +1789,20 @@
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
},
"node_modules/fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@ -2087,6 +2157,12 @@
"node": ">= 4"
}
},
"node_modules/ignore-by-default": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
"integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",
"dev": true
},
"node_modules/imurmurhash": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
@ -2139,6 +2215,18 @@
"node": ">= 0.10"
}
},
"node_modules/is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"dev": true,
"dependencies": {
"binary-extensions": "^2.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@ -2773,6 +2861,79 @@
"safe-buffer": "~5.2.0"
}
},
"node_modules/nodemon": {
"version": "2.0.20",
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.20.tgz",
"integrity": "sha512-Km2mWHKKY5GzRg6i1j5OxOHQtuvVsgskLfigG25yTtbyfRGn/GNvIbRyOf1PSCKJ2aT/58TiuUsuOU5UToVViw==",
"dev": true,
"dependencies": {
"chokidar": "^3.5.2",
"debug": "^3.2.7",
"ignore-by-default": "^1.0.1",
"minimatch": "^3.1.2",
"pstree.remy": "^1.1.8",
"semver": "^5.7.1",
"simple-update-notifier": "^1.0.7",
"supports-color": "^5.5.0",
"touch": "^3.1.0",
"undefsafe": "^2.0.5"
},
"bin": {
"nodemon": "bin/nodemon.js"
},
"engines": {
"node": ">=8.10.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/nodemon"
}
},
"node_modules/nodemon/node_modules/debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/nodemon/node_modules/has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
"dev": true,
"engines": {
"node": ">=4"
}
},
"node_modules/nodemon/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"dev": true
},
"node_modules/nodemon/node_modules/semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true,
"bin": {
"semver": "bin/semver"
}
},
"node_modules/nodemon/node_modules/supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"dependencies": {
"has-flag": "^3.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/noms": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/noms/-/noms-0.0.0.tgz",
@ -2796,6 +2957,15 @@
"node": ">=6"
}
},
"node_modules/normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/nostr-tools": {
"version": "0.24.1",
"resolved": "https://registry.npmjs.org/nostr-tools/-/nostr-tools-0.24.1.tgz",
@ -3125,6 +3295,12 @@
"node": ">= 0.10"
}
},
"node_modules/pstree.remy": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
"integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==",
"dev": true
},
"node_modules/qs": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
@ -3191,6 +3367,18 @@
"string_decoder": "~0.10.x"
}
},
"node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"dev": true,
"dependencies": {
"picomatch": "^2.2.1"
},
"engines": {
"node": ">=8.10.0"
}
},
"node_modules/reflect-metadata": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz",
@ -3414,6 +3602,27 @@
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="
},
"node_modules/simple-update-notifier": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.0.7.tgz",
"integrity": "sha512-BBKgR84BJQJm6WjWFMHgLVuo61FBDSj1z/xSFUIozqO6wO7ii0JxCqlIud7Enr/+LhlbNI0whErq96P2qHNWew==",
"dev": true,
"dependencies": {
"semver": "~7.0.0"
},
"engines": {
"node": ">=8.10.0"
}
},
"node_modules/simple-update-notifier/node_modules/semver": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz",
"integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==",
"dev": true,
"bin": {
"semver": "bin/semver.js"
}
},
"node_modules/slash": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz",
@ -3676,6 +3885,33 @@
"node": ">=0.6"
}
},
"node_modules/touch": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
"integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==",
"dev": true,
"dependencies": {
"nopt": "~1.0.10"
},
"bin": {
"nodetouch": "bin/nodetouch.js"
}
},
"node_modules/touch/node_modules/nopt": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
"integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==",
"dev": true,
"dependencies": {
"abbrev": "1"
},
"bin": {
"nopt": "bin/nopt.js"
},
"engines": {
"node": "*"
}
},
"node_modules/tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
@ -4041,6 +4277,12 @@
"node": ">=4.2.0"
}
},
"node_modules/undefsafe": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
"integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==",
"dev": true
},
"node_modules/unique-filename": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz",
@ -4796,6 +5038,16 @@
"resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
"integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A=="
},
"anymatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
"integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
"dev": true,
"requires": {
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
}
},
"app-root-path": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-3.1.0.tgz",
@ -4880,6 +5132,17 @@
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
},
"bech32": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz",
"integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg=="
},
"binary-extensions": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
"dev": true
},
"bindings": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
@ -5078,6 +5341,22 @@
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
"integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA=="
},
"chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
"dev": true,
"requires": {
"anymatch": "~3.1.2",
"braces": "~3.0.2",
"fsevents": "~2.3.2",
"glob-parent": "~5.1.2",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.6.0"
}
},
"chownr": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
@ -5658,6 +5937,13 @@
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
},
"fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"optional": true
},
"function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@ -5920,6 +6206,12 @@
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz",
"integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ=="
},
"ignore-by-default": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
"integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",
"dev": true
},
"imurmurhash": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
@ -5963,6 +6255,15 @@
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="
},
"is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"dev": true,
"requires": {
"binary-extensions": "^2.0.0"
}
},
"is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@ -6470,6 +6771,62 @@
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz",
"integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg=="
},
"nodemon": {
"version": "2.0.20",
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.20.tgz",
"integrity": "sha512-Km2mWHKKY5GzRg6i1j5OxOHQtuvVsgskLfigG25yTtbyfRGn/GNvIbRyOf1PSCKJ2aT/58TiuUsuOU5UToVViw==",
"dev": true,
"requires": {
"chokidar": "^3.5.2",
"debug": "^3.2.7",
"ignore-by-default": "^1.0.1",
"minimatch": "^3.1.2",
"pstree.remy": "^1.1.8",
"semver": "^5.7.1",
"simple-update-notifier": "^1.0.7",
"supports-color": "^5.5.0",
"touch": "^3.1.0",
"undefsafe": "^2.0.5"
},
"dependencies": {
"debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
"dev": true
},
"ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"dev": true
},
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true
},
"supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
}
}
}
},
"noms": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/noms/-/noms-0.0.0.tgz",
@ -6487,6 +6844,12 @@
"abbrev": "1"
}
},
"normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
"dev": true
},
"nostr-tools": {
"version": "0.24.1",
"resolved": "https://registry.npmjs.org/nostr-tools/-/nostr-tools-0.24.1.tgz",
@ -6743,6 +7106,12 @@
"ipaddr.js": "1.9.1"
}
},
"pstree.remy": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
"integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==",
"dev": true
},
"qs": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
@ -6783,6 +7152,15 @@
"string_decoder": "~0.10.x"
}
},
"readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"dev": true,
"requires": {
"picomatch": "^2.2.1"
}
},
"reflect-metadata": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz",
@ -6942,6 +7320,23 @@
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="
},
"simple-update-notifier": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.0.7.tgz",
"integrity": "sha512-BBKgR84BJQJm6WjWFMHgLVuo61FBDSj1z/xSFUIozqO6wO7ii0JxCqlIud7Enr/+LhlbNI0whErq96P2qHNWew==",
"dev": true,
"requires": {
"semver": "~7.0.0"
},
"dependencies": {
"semver": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz",
"integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==",
"dev": true
}
}
},
"slash": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz",
@ -7144,6 +7539,26 @@
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="
},
"touch": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
"integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==",
"dev": true,
"requires": {
"nopt": "~1.0.10"
},
"dependencies": {
"nopt": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
"integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==",
"dev": true,
"requires": {
"abbrev": "1"
}
}
}
},
"tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
@ -7363,6 +7778,12 @@
"integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==",
"devOptional": true
},
"undefsafe": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
"integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==",
"dev": true
},
"unique-filename": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz",

View file

@ -4,12 +4,13 @@
"description": "",
"main": "index.js",
"scripts": {
"test": " ts-node testRunner.ts",
"start": "ts-node src/index.ts",
"test": " tsc && node build/src/testRunner.js",
"start": "tsc && cd build && node src/index.js",
"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/* ",
"typeorm": "typeorm-ts-node-commonjs"
"typeorm": "typeorm-ts-node-commonjs",
"aa": "tsc && cd build && node src/services/nostr/index.js"
},
"repository": {
"type": "git",
@ -31,6 +32,7 @@
"@types/node": "^17.0.31",
"@types/secp256k1": "^4.0.3",
"axios": "^0.27.2",
"bech32": "^2.0.0",
"chai": "^4.3.7",
"copyfiles": "^2.4.1",
"cors": "^2.8.5",
@ -62,6 +64,7 @@
"@types/lodash": "^4.14.182",
"@types/node": "^16.11.10",
"@types/uuid": "^8.3.4",
"nodemon": "^2.0.20",
"ts-node": "10.7.0",
"typescript": "4.5.2"
}

File diff suppressed because it is too large Load diff

View file

@ -33,7 +33,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
const query = req.query
const params = req.params
await methods.Health({ ...authContext, ...query, ...params })
res.json({ status: 'OK' })
res.json({status: 'OK'})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.EncryptionExchange) throw new Error('method: EncryptionExchange is not implemented')
@ -47,7 +47,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
const query = req.query
const params = req.params
await methods.EncryptionExchange({ ...authContext, ...query, ...params }, request)
res.json({ status: 'OK' })
res.json({status: 'OK'})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.LndGetInfo) throw new Error('method: LndGetInfo is not implemented')
@ -63,7 +63,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
const query = req.query
const params = req.params
const response = await methods.LndGetInfo({ ...authContext, ...query, ...params }, request)
res.json({ status: 'OK', result: await opts.encryptCallback(encryptionDeviceId, response) })
res.json({status: 'OK', ...await opts.encryptCallback(encryptionDeviceId, response)})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.AddUser) throw new Error('method: AddUser is not implemented')
@ -77,7 +77,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
const query = req.query
const params = req.params
const response = await methods.AddUser({ ...authContext, ...query, ...params }, request)
res.json({ status: 'OK', result: response })
res.json({status: 'OK', ...response})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.AuthUser) throw new Error('method: AuthUser is not implemented')
@ -91,7 +91,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
const query = req.query
const params = req.params
const response = await methods.AuthUser({ ...authContext, ...query, ...params }, request)
res.json({ status: 'OK', result: response })
res.json({status: 'OK', ...response})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.NewAddress) throw new Error('method: NewAddress is not implemented')
@ -105,7 +105,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
const query = req.query
const params = req.params
const response = await methods.NewAddress({ ...authContext, ...query, ...params }, request)
res.json({ status: 'OK', result: response })
res.json({status: 'OK', ...response})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.PayAddress) throw new Error('method: PayAddress is not implemented')
@ -119,7 +119,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
const query = req.query
const params = req.params
const response = await methods.PayAddress({ ...authContext, ...query, ...params }, request)
res.json({ status: 'OK', result: response })
res.json({status: 'OK', ...response})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.NewInvoice) throw new Error('method: NewInvoice is not implemented')
@ -133,7 +133,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
const query = req.query
const params = req.params
const response = await methods.NewInvoice({ ...authContext, ...query, ...params }, request)
res.json({ status: 'OK', result: response })
res.json({status: 'OK', ...response})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.PayInvoice) throw new Error('method: PayInvoice is not implemented')
@ -147,7 +147,7 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
const query = req.query
const params = req.params
const response = await methods.PayInvoice({ ...authContext, ...query, ...params }, request)
res.json({ status: 'OK', result: response })
res.json({status: 'OK', ...response})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.OpenChannel) throw new Error('method: OpenChannel is not implemented')
@ -161,18 +161,73 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
const query = req.query
const params = req.params
const response = await methods.OpenChannel({ ...authContext, ...query, ...params }, request)
res.json({ status: 'OK', result: response })
res.json({status: 'OK', ...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) => {
if (!opts.allowNotImplementedMethods && !methods.GetLnurlWithdrawLink) throw new Error('method: GetLnurlWithdrawLink is not implemented')
app.get('/api/user/lnurl_withdraw/link', async (req, res) => {
try {
if (!methods.GetOpenChannelLNURL) throw new Error('method: GetOpenChannelLNURL is not implemented')
if (!methods.GetLnurlWithdrawLink) throw new Error('method: GetLnurlWithdrawLink 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 })
const response = await methods.GetLnurlWithdrawLink({ ...authContext, ...query, ...params })
res.json({status: 'OK', ...response})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.GetLnurlWithdrawInfo) throw new Error('method: GetLnurlWithdrawInfo is not implemented')
app.get('/api/guest/lnurl_withdraw/info', async (req, res) => {
try {
if (!methods.GetLnurlWithdrawInfo) throw new Error('method: GetLnurlWithdrawInfo is not implemented')
const authContext = await opts.GuestAuthGuard(req.headers['authorization'])
const query = req.query
const params = req.params
const response = await methods.GetLnurlWithdrawInfo({ ...authContext, ...query, ...params })
res.json({status: 'OK', ...response})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.HandleLnurlWithdraw) throw new Error('method: HandleLnurlWithdraw is not implemented')
app.get('/api/guest/lnurl_withdraw/handle', async (req, res) => {
try {
if (!methods.HandleLnurlWithdraw) throw new Error('method: HandleLnurlWithdraw is not implemented')
const authContext = await opts.GuestAuthGuard(req.headers['authorization'])
const query = req.query
const params = req.params
await methods.HandleLnurlWithdraw({ ...authContext, ...query, ...params })
res.json({status: 'OK'})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.GetLnurlPayInfo) throw new Error('method: GetLnurlPayInfo is not implemented')
app.get('/api/guest/lnurl_pay/info', async (req, res) => {
try {
if (!methods.GetLnurlPayInfo) throw new Error('method: GetLnurlPayInfo is not implemented')
const authContext = await opts.GuestAuthGuard(req.headers['authorization'])
const query = req.query
const params = req.params
const response = await methods.GetLnurlPayInfo({ ...authContext, ...query, ...params })
res.json({status: 'OK', ...response})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.HandleLnurlPay) throw new Error('method: HandleLnurlPay is not implemented')
app.get('/api/guest/lnurl_pay/handle', async (req, res) => {
try {
if (!methods.HandleLnurlPay) throw new Error('method: HandleLnurlPay is not implemented')
const authContext = await opts.GuestAuthGuard(req.headers['authorization'])
const query = req.query
const params = req.params
const response = await methods.HandleLnurlPay({ ...authContext, ...query, ...params })
res.json({status: 'OK', ...response})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (!opts.allowNotImplementedMethods && !methods.GetLNURLChannelLink) throw new Error('method: GetLNURLChannelLink is not implemented')
app.post('/api/user/lnurl_channel/url', async (req, res) => {
try {
if (!methods.GetLNURLChannelLink) throw new Error('method: GetLNURLChannelLink is not implemented')
const authContext = await opts.UserAuthGuard(req.headers['authorization'])
const query = req.query
const params = req.params
const response = await methods.GetLNURLChannelLink({ ...authContext, ...query, ...params })
res.json({status: 'OK', ...response})
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
})
if (opts.staticFiles) {

View file

@ -11,9 +11,10 @@ export type ClientParams = {
encryptCallback: (plain: any) => Promise<any>
decryptCallback: (encrypted: any) => Promise<any>
deviceId: string
checkResult?: true
}
export default (params: ClientParams) => ({
Health: async (): Promise<ResultError | { status: 'OK' }> => {
Health: async (): Promise<ResultError | ({ status: 'OK' })> => {
const auth = await params.retrieveGuestAuth()
if (auth === null) throw new Error('retrieveGuestAuth() returned null')
let finalRoute = '/api/health'
@ -24,7 +25,7 @@ export default (params: ClientParams) => ({
}
return { status: 'ERROR', reason: 'invalid response' }
},
EncryptionExchange: async (request: Types.EncryptionExchangeRequest): Promise<ResultError | { status: 'OK' }> => {
EncryptionExchange: async (request: Types.EncryptionExchangeRequest): Promise<ResultError | ({ status: 'OK' })> => {
const auth = await params.retrieveGuestAuth()
if (auth === null) throw new Error('retrieveGuestAuth() returned null')
let finalRoute = '/api/encryption/exchange'
@ -35,120 +36,204 @@ export default (params: ClientParams) => ({
}
return { status: 'ERROR', reason: 'invalid response' }
},
LndGetInfo: async (request: Types.LndGetInfoRequest): Promise<ResultError | { status: 'OK', result: Types.LndGetInfoResponse }> => {
LndGetInfo: async (request: Types.LndGetInfoRequest): Promise<ResultError | ({ status: 'OK' }& 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 result = await params.decryptCallback(data.result)
const result = await params.decryptCallback(data)
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.LndGetInfoResponseValidate(result)
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
if (error === null) { return { status: 'OK', ...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 }> => {
AddUser: async (request: Types.AddUserRequest): Promise<ResultError | ({ status: 'OK' }& 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 result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.AddUserResponseValidate(result)
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
if (error === null) { return { status: 'OK', ...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 }> => {
AuthUser: async (request: Types.AuthUserRequest): Promise<ResultError | ({ status: 'OK' }& 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 result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.AuthUserResponseValidate(result)
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message }
}
return { status: 'ERROR', reason: 'invalid response' }
},
NewAddress: async (request: Types.NewAddressRequest): Promise<ResultError | { status: 'OK', result: Types.NewAddressResponse }> => {
NewAddress: async (request: Types.NewAddressRequest): Promise<ResultError | ({ status: 'OK' }& Types.NewAddressResponse)> => {
const auth = await params.retrieveUserAuth()
if (auth === null) throw new Error('retrieveUserAuth() returned null')
let finalRoute = '/api/user/chain/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 result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.NewAddressResponseValidate(result)
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
if (error === null) { return { status: 'OK', ...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 }> => {
PayAddress: async (request: Types.PayAddressRequest): Promise<ResultError | ({ status: 'OK' }& 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 result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.PayAddressResponseValidate(result)
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
if (error === null) { return { status: 'OK', ...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 }> => {
NewInvoice: async (request: Types.NewInvoiceRequest): Promise<ResultError | ({ status: 'OK' }& 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 result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.NewInvoiceResponseValidate(result)
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
if (error === null) { return { status: 'OK', ...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 }> => {
PayInvoice: async (request: Types.PayInvoiceRequest): Promise<ResultError | ({ status: 'OK' }& 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 result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.PayInvoiceResponseValidate(result)
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
if (error === null) { return { status: 'OK', ...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 }> => {
OpenChannel: async (request: Types.OpenChannelRequest): Promise<ResultError | ({ status: 'OK' }& 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 result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.OpenChannelResponseValidate(result)
if (error === null) { return { status: 'OK', result: result } } else return { status: 'ERROR', reason: error.message }
if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message }
}
return { status: 'ERROR', reason: 'invalid response' }
},
GetOpenChannelLNURL: async (): Promise<ResultError | { status: 'OK', result: Types.GetOpenChannelLNURLResponse }> => {
GetLnurlWithdrawLink: async (): Promise<ResultError | ({ status: 'OK' }& Types.LnurlLinkResponse)> => {
const auth = await params.retrieveUserAuth()
if (auth === null) throw new Error('retrieveUserAuth() returned null')
let finalRoute = '/api/user/lnurl_channel'
let finalRoute = '/api/user/lnurl_withdraw/link'
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') {
const result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.LnurlLinkResponseValidate(result)
if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message }
}
return { status: 'ERROR', reason: 'invalid response' }
},
GetLnurlWithdrawInfo: async (query: Types.GetLnurlWithdrawInfo_Query): Promise<ResultError | ({ status: 'OK' }& Types.LnurlWithdrawInfoResponse)> => {
const auth = await params.retrieveGuestAuth()
if (auth === null) throw new Error('retrieveGuestAuth() returned null')
let finalRoute = '/api/guest/lnurl_withdraw/info'
const q = (new URLSearchParams(query)).toString()
finalRoute = finalRoute + (q === '' ? '' : '?' + q)
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') {
const result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.LnurlWithdrawInfoResponseValidate(result)
if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message }
}
return { status: 'ERROR', reason: 'invalid response' }
},
HandleLnurlWithdraw: async (query: Types.HandleLnurlWithdraw_Query): Promise<ResultError | ({ status: 'OK' })> => {
const auth = await params.retrieveGuestAuth()
if (auth === null) throw new Error('retrieveGuestAuth() returned null')
let finalRoute = '/api/guest/lnurl_withdraw/handle'
const q = (new URLSearchParams(query)).toString()
finalRoute = finalRoute + (q === '' ? '' : '?' + q)
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
}
return { status: 'ERROR', reason: 'invalid response' }
},
GetLnurlPayInfo: async (query: Types.GetLnurlPayInfo_Query): Promise<ResultError | ({ status: 'OK' }& Types.LnurlPayInfoResponse)> => {
const auth = await params.retrieveGuestAuth()
if (auth === null) throw new Error('retrieveGuestAuth() returned null')
let finalRoute = '/api/guest/lnurl_pay/info'
const q = (new URLSearchParams(query)).toString()
finalRoute = finalRoute + (q === '' ? '' : '?' + q)
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') {
const result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.LnurlPayInfoResponseValidate(result)
if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message }
}
return { status: 'ERROR', reason: 'invalid response' }
},
HandleLnurlPay: async (query: Types.HandleLnurlPay_Query): Promise<ResultError | ({ status: 'OK' }& Types.HandleLnurlPayResponse)> => {
const auth = await params.retrieveGuestAuth()
if (auth === null) throw new Error('retrieveGuestAuth() returned null')
let finalRoute = '/api/guest/lnurl_pay/handle'
const q = (new URLSearchParams(query)).toString()
finalRoute = finalRoute + (q === '' ? '' : '?' + q)
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') {
const result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.HandleLnurlPayResponseValidate(result)
if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message }
}
return { status: 'ERROR', reason: 'invalid response' }
},
GetLNURLChannelLink: async (): Promise<ResultError | ({ status: 'OK' }& Types.LnurlLinkResponse)> => {
const auth = await params.retrieveUserAuth()
if (auth === null) throw new Error('retrieveUserAuth() returned null')
let finalRoute = '/api/user/lnurl_channel/url'
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 }
const result = data
if(!params.checkResult) return { status: 'OK', ...result }
const error = Types.LnurlLinkResponseValidate(result)
if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message }
}
return { status: 'ERROR', reason: 'invalid response' }
},

View file

@ -60,11 +60,42 @@ export type OpenChannel_Query = {
export type OpenChannel_RouteParams = {
}
export type OpenChannel_Context = OpenChannel_Query & OpenChannel_RouteParams & UserContext
export type GetOpenChannelLNURL_Query = {
export type GetLnurlWithdrawLink_Query = {
}
export type GetOpenChannelLNURL_RouteParams = {
export type GetLnurlWithdrawLink_RouteParams = {
}
export type GetOpenChannelLNURL_Context = GetOpenChannelLNURL_Query & GetOpenChannelLNURL_RouteParams & UserContext
export type GetLnurlWithdrawLink_Context = GetLnurlWithdrawLink_Query & GetLnurlWithdrawLink_RouteParams & UserContext
export type GetLnurlWithdrawInfo_Query = {
k1?: string
}
export type GetLnurlWithdrawInfo_RouteParams = {
}
export type GetLnurlWithdrawInfo_Context = GetLnurlWithdrawInfo_Query & GetLnurlWithdrawInfo_RouteParams & GuestContext
export type HandleLnurlWithdraw_Query = {
k1?: string
pr?: string
}
export type HandleLnurlWithdraw_RouteParams = {
}
export type HandleLnurlWithdraw_Context = HandleLnurlWithdraw_Query & HandleLnurlWithdraw_RouteParams & GuestContext
export type GetLnurlPayInfo_Query = {
k1?: string
}
export type GetLnurlPayInfo_RouteParams = {
}
export type GetLnurlPayInfo_Context = GetLnurlPayInfo_Query & GetLnurlPayInfo_RouteParams & GuestContext
export type HandleLnurlPay_Query = {
k1?: string
amount?: string
}
export type HandleLnurlPay_RouteParams = {
}
export type HandleLnurlPay_Context = HandleLnurlPay_Query & HandleLnurlPay_RouteParams & GuestContext
export type GetLNURLChannelLink_Query = {
}
export type GetLNURLChannelLink_RouteParams = {
}
export type GetLNURLChannelLink_Context = GetLNURLChannelLink_Query & GetLNURLChannelLink_RouteParams & UserContext
export type ServerMethods = {
Health?: (ctx: Health_Context) => Promise<void>
EncryptionExchange?: (ctx: EncryptionExchange_Context, req: EncryptionExchangeRequest) => Promise<void>
@ -76,7 +107,12 @@ export type ServerMethods = {
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>
GetLnurlWithdrawLink?: (ctx: GetLnurlWithdrawLink_Context) => Promise<LnurlLinkResponse>
GetLnurlWithdrawInfo?: (ctx: GetLnurlWithdrawInfo_Context) => Promise<LnurlWithdrawInfoResponse>
HandleLnurlWithdraw?: (ctx: HandleLnurlWithdraw_Context) => Promise<void>
GetLnurlPayInfo?: (ctx: GetLnurlPayInfo_Context) => Promise<LnurlPayInfoResponse>
HandleLnurlPay?: (ctx: HandleLnurlPay_Context) => Promise<HandleLnurlPayResponse>
GetLNURLChannelLink?: (ctx: GetLNURLChannelLink_Context) => Promise<LnurlLinkResponse>
}
export enum AddressType {
@ -93,6 +129,202 @@ export type OptionsBaseMessage = {
allOptionalsAreSet?: true
}
export type NewInvoiceRequest = {
amountSats: number
memo: string
}
export const NewInvoiceRequestOptionalFields: [] = []
export type NewInvoiceRequestOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
amountSats_CustomCheck?: (v: number) => boolean
memo_CustomCheck?: (v: string) => 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.amountSats !== 'number') return new Error(`${path}.amountSats: is not a number`)
if (opts.amountSats_CustomCheck && !opts.amountSats_CustomCheck(o.amountSats)) return new Error(`${path}.amountSats: custom check failed`)
if (typeof o.memo !== 'string') return new Error(`${path}.memo: is not a string`)
if (opts.memo_CustomCheck && !opts.memo_CustomCheck(o.memo)) return new Error(`${path}.memo: custom check failed`)
return null
}
export type LnurlWithdrawInfoResponse = {
tag: string
callback: string
k1: string
defaultDescription: string
minWithdrawable: number
maxWithdrawable: number
balanceCheck: string
payLink: string
}
export const LnurlWithdrawInfoResponseOptionalFields: [] = []
export type LnurlWithdrawInfoResponseOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
tag_CustomCheck?: (v: string) => boolean
callback_CustomCheck?: (v: string) => boolean
k1_CustomCheck?: (v: string) => boolean
defaultDescription_CustomCheck?: (v: string) => boolean
minWithdrawable_CustomCheck?: (v: number) => boolean
maxWithdrawable_CustomCheck?: (v: number) => boolean
balanceCheck_CustomCheck?: (v: string) => boolean
payLink_CustomCheck?: (v: string) => boolean
}
export const LnurlWithdrawInfoResponseValidate = (o?: LnurlWithdrawInfoResponse, opts: LnurlWithdrawInfoResponseOptions = {}, path: string = 'LnurlWithdrawInfoResponse::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.tag !== 'string') return new Error(`${path}.tag: is not a string`)
if (opts.tag_CustomCheck && !opts.tag_CustomCheck(o.tag)) return new Error(`${path}.tag: custom check failed`)
if (typeof o.callback !== 'string') return new Error(`${path}.callback: is not a string`)
if (opts.callback_CustomCheck && !opts.callback_CustomCheck(o.callback)) return new Error(`${path}.callback: custom check failed`)
if (typeof o.k1 !== 'string') return new Error(`${path}.k1: is not a string`)
if (opts.k1_CustomCheck && !opts.k1_CustomCheck(o.k1)) return new Error(`${path}.k1: custom check failed`)
if (typeof o.defaultDescription !== 'string') return new Error(`${path}.defaultDescription: is not a string`)
if (opts.defaultDescription_CustomCheck && !opts.defaultDescription_CustomCheck(o.defaultDescription)) return new Error(`${path}.defaultDescription: custom check failed`)
if (typeof o.minWithdrawable !== 'number') return new Error(`${path}.minWithdrawable: is not a number`)
if (opts.minWithdrawable_CustomCheck && !opts.minWithdrawable_CustomCheck(o.minWithdrawable)) return new Error(`${path}.minWithdrawable: custom check failed`)
if (typeof o.maxWithdrawable !== 'number') return new Error(`${path}.maxWithdrawable: is not a number`)
if (opts.maxWithdrawable_CustomCheck && !opts.maxWithdrawable_CustomCheck(o.maxWithdrawable)) return new Error(`${path}.maxWithdrawable: custom check failed`)
if (typeof o.balanceCheck !== 'string') return new Error(`${path}.balanceCheck: is not a string`)
if (opts.balanceCheck_CustomCheck && !opts.balanceCheck_CustomCheck(o.balanceCheck)) return new Error(`${path}.balanceCheck: custom check failed`)
if (typeof o.payLink !== 'string') return new Error(`${path}.payLink: is not a string`)
if (opts.payLink_CustomCheck && !opts.payLink_CustomCheck(o.payLink)) return new Error(`${path}.payLink: custom check failed`)
return null
}
export type HandleLnurlPayResponse = {
pr: string
routes: Empty[]
}
export const HandleLnurlPayResponseOptionalFields: [] = []
export type HandleLnurlPayResponseOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
pr_CustomCheck?: (v: string) => boolean
routes_ItemOptions?: EmptyOptions
routes_CustomCheck?: (v: Empty[]) => boolean
}
export const HandleLnurlPayResponseValidate = (o?: HandleLnurlPayResponse, opts: HandleLnurlPayResponseOptions = {}, path: string = 'HandleLnurlPayResponse::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.pr !== 'string') return new Error(`${path}.pr: is not a string`)
if (opts.pr_CustomCheck && !opts.pr_CustomCheck(o.pr)) return new Error(`${path}.pr: custom check failed`)
if (!Array.isArray(o.routes)) return new Error(`${path}.routes: is not an array`)
for (let index = 0; index < o.routes.length; index++) {
const routesErr = EmptyValidate(o.routes[index], opts.routes_ItemOptions, `${path}.routes[${index}]`)
if (routesErr !== null) return routesErr
}
if (opts.routes_CustomCheck && !opts.routes_CustomCheck(o.routes)) return new Error(`${path}.routes: custom check failed`)
return null
}
export type LndGetInfoResponse = {
alias: string
}
export const LndGetInfoResponseOptionalFields: [] = []
export type LndGetInfoResponseOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
alias_CustomCheck?: (v: string) => boolean
}
export const LndGetInfoResponseValidate = (o?: LndGetInfoResponse, opts: LndGetInfoResponseOptions = {}, path: string = 'LndGetInfoResponse::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.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
}
export type NewAddressRequest = {
addressType: AddressType
}
export const NewAddressRequestOptionalFields: [] = []
export type NewAddressRequestOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
addressType_CustomCheck?: (v: AddressType) => boolean
}
export const NewAddressRequestValidate = (o?: NewAddressRequest, opts: NewAddressRequestOptions = {}, path: string = 'NewAddressRequest::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 (!enumCheckAddressType(o.addressType)) return new Error(`${path}.addressType: is not a valid AddressType`)
if (opts.addressType_CustomCheck && !opts.addressType_CustomCheck(o.addressType)) return new Error(`${path}.addressType: custom check failed`)
return null
}
export type PayAddressResponse = {
txId: string
}
export const PayAddressResponseOptionalFields: [] = []
export type PayAddressResponseOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
txId_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.txId !== 'string') return new Error(`${path}.txId: is not a string`)
if (opts.txId_CustomCheck && !opts.txId_CustomCheck(o.txId)) return new Error(`${path}.txId: custom check failed`)
return null
}
export type LnurlPayInfoResponse = {
tag: string
callback: string
maxSendable: number
minSendable: number
metadata: string
}
export const LnurlPayInfoResponseOptionalFields: [] = []
export type LnurlPayInfoResponseOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
tag_CustomCheck?: (v: string) => boolean
callback_CustomCheck?: (v: string) => boolean
maxSendable_CustomCheck?: (v: number) => boolean
minSendable_CustomCheck?: (v: number) => boolean
metadata_CustomCheck?: (v: string) => boolean
}
export const LnurlPayInfoResponseValidate = (o?: LnurlPayInfoResponse, opts: LnurlPayInfoResponseOptions = {}, path: string = 'LnurlPayInfoResponse::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.tag !== 'string') return new Error(`${path}.tag: is not a string`)
if (opts.tag_CustomCheck && !opts.tag_CustomCheck(o.tag)) return new Error(`${path}.tag: custom check failed`)
if (typeof o.callback !== 'string') return new Error(`${path}.callback: is not a string`)
if (opts.callback_CustomCheck && !opts.callback_CustomCheck(o.callback)) return new Error(`${path}.callback: custom check failed`)
if (typeof o.maxSendable !== 'number') return new Error(`${path}.maxSendable: is not a number`)
if (opts.maxSendable_CustomCheck && !opts.maxSendable_CustomCheck(o.maxSendable)) return new Error(`${path}.maxSendable: custom check failed`)
if (typeof o.minSendable !== 'number') return new Error(`${path}.minSendable: is not a number`)
if (opts.minSendable_CustomCheck && !opts.minSendable_CustomCheck(o.minSendable)) return new Error(`${path}.minSendable: custom check failed`)
if (typeof o.metadata !== 'string') return new Error(`${path}.metadata: is not a string`)
if (opts.metadata_CustomCheck && !opts.metadata_CustomCheck(o.metadata)) return new Error(`${path}.metadata: custom check failed`)
return null
}
export type Empty = {
}
export const EmptyOptionalFields: [] = []
@ -106,24 +338,6 @@ export const EmptyValidate = (o?: Empty, opts: EmptyOptions = {}, path: string =
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
}
export type NewAddressResponse = {
address: string
}
@ -142,48 +356,63 @@ export const NewAddressResponseValidate = (o?: NewAddressResponse, opts: NewAddr
return null
}
export type PayAddressRequest = {
address: string
amout_sats: number
target_conf: number
export type OpenChannelRequest = {
destination: string
fundingAmount: number
pushAmount: number
closeAddress: string
}
export const PayAddressRequestOptionalFields: [] = []
export type PayAddressRequestOptions = OptionsBaseMessage & {
export const OpenChannelRequestOptionalFields: [] = []
export type OpenChannelRequestOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
address_CustomCheck?: (v: string) => boolean
amout_sats_CustomCheck?: (v: number) => boolean
target_conf_CustomCheck?: (v: number) => boolean
destination_CustomCheck?: (v: string) => boolean
fundingAmount_CustomCheck?: (v: number) => boolean
pushAmount_CustomCheck?: (v: number) => boolean
closeAddress_CustomCheck?: (v: string) => boolean
}
export const PayAddressRequestValidate = (o?: PayAddressRequest, opts: PayAddressRequestOptions = {}, path: string = 'PayAddressRequest::root.'): Error | null => {
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.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.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.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`)
if (typeof o.fundingAmount !== 'number') return new Error(`${path}.fundingAmount: is not a number`)
if (opts.fundingAmount_CustomCheck && !opts.fundingAmount_CustomCheck(o.fundingAmount)) return new Error(`${path}.fundingAmount: custom check failed`)
if (typeof o.target_conf !== 'number') return new Error(`${path}.target_conf: is not a number`)
if (opts.target_conf_CustomCheck && !opts.target_conf_CustomCheck(o.target_conf)) return new Error(`${path}.target_conf: custom check failed`)
if (typeof o.pushAmount !== 'number') return new Error(`${path}.pushAmount: is not a number`)
if (opts.pushAmount_CustomCheck && !opts.pushAmount_CustomCheck(o.pushAmount)) return new Error(`${path}.pushAmount: custom check failed`)
if (typeof o.closeAddress !== 'string') return new Error(`${path}.closeAddress: is not a string`)
if (opts.closeAddress_CustomCheck && !opts.closeAddress_CustomCheck(o.closeAddress)) return new Error(`${path}.closeAddress: custom check failed`)
return null
}
export type PayAddressResponse = {
tx_id: string
export type AddUserRequest = {
callbackUrl: string
name: string
secret: string
}
export const PayAddressResponseOptionalFields: [] = []
export type PayAddressResponseOptions = OptionsBaseMessage & {
export const AddUserRequestOptionalFields: [] = []
export type AddUserRequestOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
tx_id_CustomCheck?: (v: string) => boolean
callbackUrl_CustomCheck?: (v: string) => boolean
name_CustomCheck?: (v: string) => boolean
secret_CustomCheck?: (v: string) => boolean
}
export const PayAddressResponseValidate = (o?: PayAddressResponse, opts: PayAddressResponseOptions = {}, path: string = 'PayAddressResponse::root.'): Error | null => {
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.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`)
if (typeof o.callbackUrl !== 'string') return new Error(`${path}.callbackUrl: is not a string`)
if (opts.callbackUrl_CustomCheck && !opts.callbackUrl_CustomCheck(o.callbackUrl)) return new Error(`${path}.callbackUrl: 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
}
@ -211,84 +440,43 @@ export const PayInvoiceRequestValidate = (o?: PayInvoiceRequest, opts: PayInvoic
return null
}
export type OpenChannelResponse = {
channel_id: string
export type PayInvoiceResponse = {
preimage: string
}
export const OpenChannelResponseOptionalFields: [] = []
export type OpenChannelResponseOptions = OptionsBaseMessage & {
export const PayInvoiceResponseOptionalFields: [] = []
export type PayInvoiceResponseOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
channel_id_CustomCheck?: (v: string) => boolean
preimage_CustomCheck?: (v: string) => boolean
}
export const OpenChannelResponseValidate = (o?: OpenChannelResponse, opts: OpenChannelResponseOptions = {}, path: string = 'OpenChannelResponse::root.'): Error | null => {
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.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`)
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 GetOpenChannelLNURLResponse = {
export type LnurlLinkResponse = {
lnurl: string
k1: string
}
export const GetOpenChannelLNURLResponseOptionalFields: [] = []
export type GetOpenChannelLNURLResponseOptions = OptionsBaseMessage & {
export const LnurlLinkResponseOptionalFields: [] = []
export type LnurlLinkResponseOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
lnurl_CustomCheck?: (v: string) => boolean
k1_CustomCheck?: (v: string) => boolean
}
export const GetOpenChannelLNURLResponseValidate = (o?: GetOpenChannelLNURLResponse, opts: GetOpenChannelLNURLResponseOptions = {}, path: string = 'GetOpenChannelLNURLResponse::root.'): Error | null => {
export const LnurlLinkResponseValidate = (o?: LnurlLinkResponse, opts: LnurlLinkResponseOptions = {}, path: string = 'LnurlLinkResponse::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 EncryptionExchangeRequest = {
public_key: string
device_id: string
}
export const EncryptionExchangeRequestOptionalFields: [] = []
export type EncryptionExchangeRequestOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
public_key_CustomCheck?: (v: string) => boolean
device_id_CustomCheck?: (v: string) => boolean
}
export const EncryptionExchangeRequestValidate = (o?: EncryptionExchangeRequest, opts: EncryptionExchangeRequestOptions = {}, path: string = 'EncryptionExchangeRequest::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.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`)
if (typeof o.k1 !== 'string') return new Error(`${path}.k1: is not a string`)
if (opts.k1_CustomCheck && !opts.k1_CustomCheck(o.k1)) return new Error(`${path}.k1: custom check failed`)
return null
}
@ -311,20 +499,43 @@ export const NewInvoiceResponseValidate = (o?: NewInvoiceResponse, opts: NewInvo
return null
}
export type PayInvoiceResponse = {
preimage: string
export type OpenChannelResponse = {
channelId: string
}
export const PayInvoiceResponseOptionalFields: [] = []
export type PayInvoiceResponseOptions = OptionsBaseMessage & {
export const OpenChannelResponseOptionalFields: [] = []
export type OpenChannelResponseOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
preimage_CustomCheck?: (v: string) => boolean
channelId_CustomCheck?: (v: string) => boolean
}
export const PayInvoiceResponseValidate = (o?: PayInvoiceResponse, opts: PayInvoiceResponseOptions = {}, path: string = 'PayInvoiceResponse::root.'): Error | null => {
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.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`)
if (typeof o.channelId !== 'string') return new Error(`${path}.channelId: is not a string`)
if (opts.channelId_CustomCheck && !opts.channelId_CustomCheck(o.channelId)) return new Error(`${path}.channelId: custom check failed`)
return null
}
export type AddUserResponse = {
userId: string
authToken: string
}
export const AddUserResponseOptionalFields: [] = []
export type AddUserResponseOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
userId_CustomCheck?: (v: string) => boolean
authToken_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.userId !== 'string') return new Error(`${path}.userId: is not a string`)
if (opts.userId_CustomCheck && !opts.userId_CustomCheck(o.userId)) return new Error(`${path}.userId: custom check failed`)
if (typeof o.authToken !== 'string') return new Error(`${path}.authToken: is not a string`)
if (opts.authToken_CustomCheck && !opts.authToken_CustomCheck(o.authToken)) return new Error(`${path}.authToken: custom check failed`)
return null
}
@ -352,140 +563,94 @@ export const AuthUserRequestValidate = (o?: AuthUserRequest, opts: AuthUserReque
return null
}
export type LndGetInfoResponse = {
alias: string
}
export const LndGetInfoResponseOptionalFields: [] = []
export type LndGetInfoResponseOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
alias_CustomCheck?: (v: string) => boolean
}
export const LndGetInfoResponseValidate = (o?: LndGetInfoResponse, opts: LndGetInfoResponseOptions = {}, path: string = 'LndGetInfoResponse::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.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
}
export type NewAddressRequest = {
address_type: AddressType
}
export const NewAddressRequestOptionalFields: [] = []
export type NewAddressRequestOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
address_type_CustomCheck?: (v: AddressType) => boolean
}
export const NewAddressRequestValidate = (o?: NewAddressRequest, opts: NewAddressRequestOptions = {}, path: string = 'NewAddressRequest::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 (!enumCheckAddressType(o.address_type)) return new Error(`${path}.address_type: is not a valid AddressType`)
if (opts.address_type_CustomCheck && !opts.address_type_CustomCheck(o.address_type)) return new Error(`${path}.address_type: 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
funding_amount: number
push_amount: number
close_address: string
}
export const OpenChannelRequestOptionalFields: [] = []
export type OpenChannelRequestOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
destination_CustomCheck?: (v: string) => boolean
funding_amount_CustomCheck?: (v: number) => boolean
push_amount_CustomCheck?: (v: number) => boolean
close_address_CustomCheck?: (v: string) => 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.funding_amount !== 'number') return new Error(`${path}.funding_amount: is not a number`)
if (opts.funding_amount_CustomCheck && !opts.funding_amount_CustomCheck(o.funding_amount)) return new Error(`${path}.funding_amount: 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`)
if (typeof o.close_address !== 'string') return new Error(`${path}.close_address: is not a string`)
if (opts.close_address_CustomCheck && !opts.close_address_CustomCheck(o.close_address)) return new Error(`${path}.close_address: 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 AuthUserResponse = {
user_id: string
auth_token: string
userId: string
authToken: string
}
export const AuthUserResponseOptionalFields: [] = []
export type AuthUserResponseOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
user_id_CustomCheck?: (v: string) => boolean
auth_token_CustomCheck?: (v: string) => boolean
userId_CustomCheck?: (v: string) => boolean
authToken_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.userId !== 'string') return new Error(`${path}.userId: is not a string`)
if (opts.userId_CustomCheck && !opts.userId_CustomCheck(o.userId)) return new Error(`${path}.userId: 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`)
if (typeof o.authToken !== 'string') return new Error(`${path}.authToken: is not a string`)
if (opts.authToken_CustomCheck && !opts.authToken_CustomCheck(o.authToken)) return new Error(`${path}.authToken: custom check failed`)
return null
}
export type EncryptionExchangeRequest = {
publicKey: string
deviceId: string
}
export const EncryptionExchangeRequestOptionalFields: [] = []
export type EncryptionExchangeRequestOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
publicKey_CustomCheck?: (v: string) => boolean
deviceId_CustomCheck?: (v: string) => boolean
}
export const EncryptionExchangeRequestValidate = (o?: EncryptionExchangeRequest, opts: EncryptionExchangeRequestOptions = {}, path: string = 'EncryptionExchangeRequest::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.publicKey !== 'string') return new Error(`${path}.publicKey: is not a string`)
if (opts.publicKey_CustomCheck && !opts.publicKey_CustomCheck(o.publicKey)) return new Error(`${path}.publicKey: custom check failed`)
if (typeof o.deviceId !== 'string') return new Error(`${path}.deviceId: is not a string`)
if (opts.deviceId_CustomCheck && !opts.deviceId_CustomCheck(o.deviceId)) return new Error(`${path}.deviceId: custom check failed`)
return null
}
export type LndGetInfoRequest = {
nodeId: number
}
export const LndGetInfoRequestOptionalFields: [] = []
export type LndGetInfoRequestOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
nodeId_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.nodeId !== 'number') return new Error(`${path}.nodeId: is not a number`)
if (opts.nodeId_CustomCheck && !opts.nodeId_CustomCheck(o.nodeId)) return new Error(`${path}.nodeId: custom check failed`)
return null
}
export type PayAddressRequest = {
address: string
amoutSats: number
targetConf: number
}
export const PayAddressRequestOptionalFields: [] = []
export type PayAddressRequestOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: []
address_CustomCheck?: (v: string) => boolean
amoutSats_CustomCheck?: (v: number) => boolean
targetConf_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.amoutSats !== 'number') return new Error(`${path}.amoutSats: is not a number`)
if (opts.amoutSats_CustomCheck && !opts.amoutSats_CustomCheck(o.amoutSats)) return new Error(`${path}.amoutSats: custom check failed`)
if (typeof o.targetConf !== 'number') return new Error(`${path}.targetConf: is not a number`)
if (opts.targetConf_CustomCheck && !opts.targetConf_CustomCheck(o.targetConf)) return new Error(`${path}.targetConf: custom check failed`)
return null
}

View file

@ -1,122 +0,0 @@
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
// tslint:disable
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import type { LookupInvoiceMsg } from "./invoices";
import type { SettleInvoiceResp } from "./invoices";
import type { SettleInvoiceMsg } from "./invoices";
import type { AddHoldInvoiceResp } from "./invoices";
import type { AddHoldInvoiceRequest } from "./invoices";
import type { CancelInvoiceResp } from "./invoices";
import type { CancelInvoiceMsg } from "./invoices";
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
import type { Invoice } from "./lightning";
import type { SubscribeSingleInvoiceRequest } from "./invoices";
import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
/**
* Invoices is a service that can be used to create, accept, settle and cancel
* invoices.
*
* @generated from protobuf service invoicesrpc.Invoices
*/
export interface IInvoicesClient {
/**
*
* SubscribeSingleInvoice returns a uni-directional stream (server -> client)
* to notify the client of state transitions of the specified invoice.
* Initially the current invoice state is always sent out.
*
* @generated from protobuf rpc: SubscribeSingleInvoice(invoicesrpc.SubscribeSingleInvoiceRequest) returns (stream lnrpc.Invoice);
*/
subscribeSingleInvoice(input: SubscribeSingleInvoiceRequest, options?: RpcOptions): ServerStreamingCall<SubscribeSingleInvoiceRequest, Invoice>;
/**
*
* CancelInvoice cancels a currently open invoice. If the invoice is already
* canceled, this call will succeed. If the invoice is already settled, it will
* fail.
*
* @generated from protobuf rpc: CancelInvoice(invoicesrpc.CancelInvoiceMsg) returns (invoicesrpc.CancelInvoiceResp);
*/
cancelInvoice(input: CancelInvoiceMsg, options?: RpcOptions): UnaryCall<CancelInvoiceMsg, CancelInvoiceResp>;
/**
*
* AddHoldInvoice creates a hold invoice. It ties the invoice to the hash
* supplied in the request.
*
* @generated from protobuf rpc: AddHoldInvoice(invoicesrpc.AddHoldInvoiceRequest) returns (invoicesrpc.AddHoldInvoiceResp);
*/
addHoldInvoice(input: AddHoldInvoiceRequest, options?: RpcOptions): UnaryCall<AddHoldInvoiceRequest, AddHoldInvoiceResp>;
/**
*
* SettleInvoice settles an accepted invoice. If the invoice is already
* settled, this call will succeed.
*
* @generated from protobuf rpc: SettleInvoice(invoicesrpc.SettleInvoiceMsg) returns (invoicesrpc.SettleInvoiceResp);
*/
settleInvoice(input: SettleInvoiceMsg, options?: RpcOptions): UnaryCall<SettleInvoiceMsg, SettleInvoiceResp>;
/**
*
* LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced
* using either its payment hash, payment address, or set ID.
*
* @generated from protobuf rpc: LookupInvoiceV2(invoicesrpc.LookupInvoiceMsg) returns (lnrpc.Invoice);
*/
lookupInvoiceV2(input: LookupInvoiceMsg, options?: RpcOptions): UnaryCall<LookupInvoiceMsg, Invoice>;
}
/**
* Invoices is a service that can be used to create, accept, settle and cancel
* invoices.
*
* @generated from protobuf service invoicesrpc.Invoices
*/
export declare class InvoicesClient implements IInvoicesClient, ServiceInfo {
private readonly _transport;
typeName: any;
methods: any;
options: any;
constructor(_transport: RpcTransport);
/**
*
* SubscribeSingleInvoice returns a uni-directional stream (server -> client)
* to notify the client of state transitions of the specified invoice.
* Initially the current invoice state is always sent out.
*
* @generated from protobuf rpc: SubscribeSingleInvoice(invoicesrpc.SubscribeSingleInvoiceRequest) returns (stream lnrpc.Invoice);
*/
subscribeSingleInvoice(input: SubscribeSingleInvoiceRequest, options?: RpcOptions): ServerStreamingCall<SubscribeSingleInvoiceRequest, Invoice>;
/**
*
* CancelInvoice cancels a currently open invoice. If the invoice is already
* canceled, this call will succeed. If the invoice is already settled, it will
* fail.
*
* @generated from protobuf rpc: CancelInvoice(invoicesrpc.CancelInvoiceMsg) returns (invoicesrpc.CancelInvoiceResp);
*/
cancelInvoice(input: CancelInvoiceMsg, options?: RpcOptions): UnaryCall<CancelInvoiceMsg, CancelInvoiceResp>;
/**
*
* AddHoldInvoice creates a hold invoice. It ties the invoice to the hash
* supplied in the request.
*
* @generated from protobuf rpc: AddHoldInvoice(invoicesrpc.AddHoldInvoiceRequest) returns (invoicesrpc.AddHoldInvoiceResp);
*/
addHoldInvoice(input: AddHoldInvoiceRequest, options?: RpcOptions): UnaryCall<AddHoldInvoiceRequest, AddHoldInvoiceResp>;
/**
*
* SettleInvoice settles an accepted invoice. If the invoice is already
* settled, this call will succeed.
*
* @generated from protobuf rpc: SettleInvoice(invoicesrpc.SettleInvoiceMsg) returns (invoicesrpc.SettleInvoiceResp);
*/
settleInvoice(input: SettleInvoiceMsg, options?: RpcOptions): UnaryCall<SettleInvoiceMsg, SettleInvoiceResp>;
/**
*
* LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced
* using either its payment hash, payment address, or set ID.
*
* @generated from protobuf rpc: LookupInvoiceV2(invoicesrpc.LookupInvoiceMsg) returns (lnrpc.Invoice);
*/
lookupInvoiceV2(input: LookupInvoiceMsg, options?: RpcOptions): UnaryCall<LookupInvoiceMsg, Invoice>;
}

View file

@ -1,76 +0,0 @@
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
// tslint:disable
import { Invoices } from "./invoices.js";
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
/**
* Invoices is a service that can be used to create, accept, settle and cancel
* invoices.
*
* @generated from protobuf service invoicesrpc.Invoices
*/
export class InvoicesClient {
constructor(_transport) {
this._transport = _transport;
this.typeName = Invoices.typeName;
this.methods = Invoices.methods;
this.options = Invoices.options;
}
/**
*
* SubscribeSingleInvoice returns a uni-directional stream (server -> client)
* to notify the client of state transitions of the specified invoice.
* Initially the current invoice state is always sent out.
*
* @generated from protobuf rpc: SubscribeSingleInvoice(invoicesrpc.SubscribeSingleInvoiceRequest) returns (stream lnrpc.Invoice);
*/
subscribeSingleInvoice(input, options) {
const method = this.methods[0], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
*
* CancelInvoice cancels a currently open invoice. If the invoice is already
* canceled, this call will succeed. If the invoice is already settled, it will
* fail.
*
* @generated from protobuf rpc: CancelInvoice(invoicesrpc.CancelInvoiceMsg) returns (invoicesrpc.CancelInvoiceResp);
*/
cancelInvoice(input, options) {
const method = this.methods[1], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* AddHoldInvoice creates a hold invoice. It ties the invoice to the hash
* supplied in the request.
*
* @generated from protobuf rpc: AddHoldInvoice(invoicesrpc.AddHoldInvoiceRequest) returns (invoicesrpc.AddHoldInvoiceResp);
*/
addHoldInvoice(input, options) {
const method = this.methods[2], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* SettleInvoice settles an accepted invoice. If the invoice is already
* settled, this call will succeed.
*
* @generated from protobuf rpc: SettleInvoice(invoicesrpc.SettleInvoiceMsg) returns (invoicesrpc.SettleInvoiceResp);
*/
settleInvoice(input, options) {
const method = this.methods[3], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced
* using either its payment hash, payment address, or set ID.
*
* @generated from protobuf rpc: LookupInvoiceV2(invoicesrpc.LookupInvoiceMsg) returns (lnrpc.Invoice);
*/
lookupInvoiceV2(input, options) {
const method = this.methods[4], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
}

View file

@ -3,18 +3,18 @@
// tslint:disable
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import { Invoices } from "./invoices";
import type { LookupInvoiceMsg } from "./invoices";
import type { SettleInvoiceResp } from "./invoices";
import type { SettleInvoiceMsg } from "./invoices";
import type { AddHoldInvoiceResp } from "./invoices";
import type { AddHoldInvoiceRequest } from "./invoices";
import type { CancelInvoiceResp } from "./invoices";
import type { CancelInvoiceMsg } from "./invoices";
import { Invoices } from "./invoices.js";
import type { LookupInvoiceMsg } from "./invoices.js";
import type { SettleInvoiceResp } from "./invoices.js";
import type { SettleInvoiceMsg } from "./invoices.js";
import type { AddHoldInvoiceResp } from "./invoices.js";
import type { AddHoldInvoiceRequest } from "./invoices.js";
import type { CancelInvoiceResp } from "./invoices.js";
import type { CancelInvoiceMsg } from "./invoices.js";
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
import type { Invoice } from "./lightning";
import type { SubscribeSingleInvoiceRequest } from "./invoices";
import type { Invoice } from "./lightning.js";
import type { SubscribeSingleInvoiceRequest } from "./invoices.js";
import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
/**

View file

@ -1,318 +0,0 @@
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
// tslint:disable
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { IBinaryWriter } from "@protobuf-ts/runtime";
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
import type { IBinaryReader } from "@protobuf-ts/runtime";
import type { PartialMessage } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { RouteHint } from "./lightning";
/**
* @generated from protobuf message invoicesrpc.CancelInvoiceMsg
*/
export interface CancelInvoiceMsg {
/**
* Hash corresponding to the (hold) invoice to cancel. When using
* REST, this field must be encoded as base64.
*
* @generated from protobuf field: bytes payment_hash = 1;
*/
paymentHash: Uint8Array;
}
/**
* @generated from protobuf message invoicesrpc.CancelInvoiceResp
*/
export interface CancelInvoiceResp {
}
/**
* @generated from protobuf message invoicesrpc.AddHoldInvoiceRequest
*/
export interface AddHoldInvoiceRequest {
/**
*
* An optional memo to attach along with the invoice. Used for record keeping
* purposes for the invoice's creator, and will also be set in the description
* field of the encoded payment request if the description_hash field is not
* being used.
*
* @generated from protobuf field: string memo = 1;
*/
memo: string;
/**
* The hash of the preimage
*
* @generated from protobuf field: bytes hash = 2;
*/
hash: Uint8Array;
/**
*
* The value of this invoice in satoshis
*
* The fields value and value_msat are mutually exclusive.
*
* @generated from protobuf field: int64 value = 3;
*/
value: number;
/**
*
* The value of this invoice in millisatoshis
*
* The fields value and value_msat are mutually exclusive.
*
* @generated from protobuf field: int64 value_msat = 10;
*/
valueMsat: number;
/**
*
* Hash (SHA-256) of a description of the payment. Used if the description of
* payment (memo) is too long to naturally fit within the description field
* of an encoded payment request.
*
* @generated from protobuf field: bytes description_hash = 4;
*/
descriptionHash: Uint8Array;
/**
* Payment request expiry time in seconds. Default is 3600 (1 hour).
*
* @generated from protobuf field: int64 expiry = 5;
*/
expiry: number;
/**
* Fallback on-chain address.
*
* @generated from protobuf field: string fallback_addr = 6;
*/
fallbackAddr: string;
/**
* Delta to use for the time-lock of the CLTV extended to the final hop.
*
* @generated from protobuf field: uint64 cltv_expiry = 7;
*/
cltvExpiry: number;
/**
*
* Route hints that can each be individually used to assist in reaching the
* invoice's destination.
*
* @generated from protobuf field: repeated lnrpc.RouteHint route_hints = 8;
*/
routeHints: RouteHint[];
/**
* Whether this invoice should include routing hints for private channels.
*
* @generated from protobuf field: bool private = 9;
*/
private: boolean;
}
/**
* @generated from protobuf message invoicesrpc.AddHoldInvoiceResp
*/
export interface AddHoldInvoiceResp {
/**
*
* A bare-bones invoice for a payment within the Lightning Network. With the
* details of the invoice, the sender has all the data necessary to send a
* payment to the recipient.
*
* @generated from protobuf field: string payment_request = 1;
*/
paymentRequest: string;
/**
*
* The "add" index of this invoice. Each newly created invoice will increment
* this index making it monotonically increasing. Callers to the
* SubscribeInvoices call can use this to instantly get notified of all added
* invoices with an add_index greater than this one.
*
* @generated from protobuf field: uint64 add_index = 2;
*/
addIndex: number;
/**
*
* The payment address of the generated invoice. This value should be used
* in all payments for this invoice as we require it for end to end
* security.
*
* @generated from protobuf field: bytes payment_addr = 3;
*/
paymentAddr: Uint8Array;
}
/**
* @generated from protobuf message invoicesrpc.SettleInvoiceMsg
*/
export interface SettleInvoiceMsg {
/**
* Externally discovered pre-image that should be used to settle the hold
* invoice.
*
* @generated from protobuf field: bytes preimage = 1;
*/
preimage: Uint8Array;
}
/**
* @generated from protobuf message invoicesrpc.SettleInvoiceResp
*/
export interface SettleInvoiceResp {
}
/**
* @generated from protobuf message invoicesrpc.SubscribeSingleInvoiceRequest
*/
export interface SubscribeSingleInvoiceRequest {
/**
* Hash corresponding to the (hold) invoice to subscribe to. When using
* REST, this field must be encoded as base64url.
*
* @generated from protobuf field: bytes r_hash = 2;
*/
rHash: Uint8Array;
}
/**
* @generated from protobuf message invoicesrpc.LookupInvoiceMsg
*/
export interface LookupInvoiceMsg {
/**
* @generated from protobuf oneof: invoice_ref
*/
invoiceRef: {
oneofKind: "paymentHash";
/**
* When using REST, this field must be encoded as base64.
*
* @generated from protobuf field: bytes payment_hash = 1;
*/
paymentHash: Uint8Array;
} | {
oneofKind: "paymentAddr";
/**
* @generated from protobuf field: bytes payment_addr = 2;
*/
paymentAddr: Uint8Array;
} | {
oneofKind: "setId";
/**
* @generated from protobuf field: bytes set_id = 3;
*/
setId: Uint8Array;
} | {
oneofKind: undefined;
};
/**
* @generated from protobuf field: invoicesrpc.LookupModifier lookup_modifier = 4;
*/
lookupModifier: LookupModifier;
}
/**
* @generated from protobuf enum invoicesrpc.LookupModifier
*/
export declare enum LookupModifier {
/**
* The default look up modifier, no look up behavior is changed.
*
* @generated from protobuf enum value: DEFAULT = 0;
*/
DEFAULT = 0,
/**
*
* Indicates that when a look up is done based on a set_id, then only that set
* of HTLCs related to that set ID should be returned.
*
* @generated from protobuf enum value: HTLC_SET_ONLY = 1;
*/
HTLC_SET_ONLY = 1,
/**
*
* Indicates that when a look up is done using a payment_addr, then no HTLCs
* related to the payment_addr should be returned. This is useful when one
* wants to be able to obtain the set of associated setIDs with a given
* invoice, then look up the sub-invoices "projected" by that set ID.
*
* @generated from protobuf enum value: HTLC_SET_BLANK = 2;
*/
HTLC_SET_BLANK = 2
}
declare class CancelInvoiceMsg$Type extends MessageType<CancelInvoiceMsg> {
constructor();
create(value?: PartialMessage<CancelInvoiceMsg>): CancelInvoiceMsg;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CancelInvoiceMsg): CancelInvoiceMsg;
internalBinaryWrite(message: CancelInvoiceMsg, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message invoicesrpc.CancelInvoiceMsg
*/
export declare const CancelInvoiceMsg: CancelInvoiceMsg$Type;
declare class CancelInvoiceResp$Type extends MessageType<CancelInvoiceResp> {
constructor();
create(value?: PartialMessage<CancelInvoiceResp>): CancelInvoiceResp;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CancelInvoiceResp): CancelInvoiceResp;
internalBinaryWrite(message: CancelInvoiceResp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message invoicesrpc.CancelInvoiceResp
*/
export declare const CancelInvoiceResp: CancelInvoiceResp$Type;
declare class AddHoldInvoiceRequest$Type extends MessageType<AddHoldInvoiceRequest> {
constructor();
create(value?: PartialMessage<AddHoldInvoiceRequest>): AddHoldInvoiceRequest;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AddHoldInvoiceRequest): AddHoldInvoiceRequest;
internalBinaryWrite(message: AddHoldInvoiceRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message invoicesrpc.AddHoldInvoiceRequest
*/
export declare const AddHoldInvoiceRequest: AddHoldInvoiceRequest$Type;
declare class AddHoldInvoiceResp$Type extends MessageType<AddHoldInvoiceResp> {
constructor();
create(value?: PartialMessage<AddHoldInvoiceResp>): AddHoldInvoiceResp;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AddHoldInvoiceResp): AddHoldInvoiceResp;
internalBinaryWrite(message: AddHoldInvoiceResp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message invoicesrpc.AddHoldInvoiceResp
*/
export declare const AddHoldInvoiceResp: AddHoldInvoiceResp$Type;
declare class SettleInvoiceMsg$Type extends MessageType<SettleInvoiceMsg> {
constructor();
create(value?: PartialMessage<SettleInvoiceMsg>): SettleInvoiceMsg;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SettleInvoiceMsg): SettleInvoiceMsg;
internalBinaryWrite(message: SettleInvoiceMsg, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message invoicesrpc.SettleInvoiceMsg
*/
export declare const SettleInvoiceMsg: SettleInvoiceMsg$Type;
declare class SettleInvoiceResp$Type extends MessageType<SettleInvoiceResp> {
constructor();
create(value?: PartialMessage<SettleInvoiceResp>): SettleInvoiceResp;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SettleInvoiceResp): SettleInvoiceResp;
internalBinaryWrite(message: SettleInvoiceResp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message invoicesrpc.SettleInvoiceResp
*/
export declare const SettleInvoiceResp: SettleInvoiceResp$Type;
declare class SubscribeSingleInvoiceRequest$Type extends MessageType<SubscribeSingleInvoiceRequest> {
constructor();
create(value?: PartialMessage<SubscribeSingleInvoiceRequest>): SubscribeSingleInvoiceRequest;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SubscribeSingleInvoiceRequest): SubscribeSingleInvoiceRequest;
internalBinaryWrite(message: SubscribeSingleInvoiceRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message invoicesrpc.SubscribeSingleInvoiceRequest
*/
export declare const SubscribeSingleInvoiceRequest: SubscribeSingleInvoiceRequest$Type;
declare class LookupInvoiceMsg$Type extends MessageType<LookupInvoiceMsg> {
constructor();
create(value?: PartialMessage<LookupInvoiceMsg>): LookupInvoiceMsg;
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: LookupInvoiceMsg): LookupInvoiceMsg;
internalBinaryWrite(message: LookupInvoiceMsg, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
* @generated MessageType for protobuf message invoicesrpc.LookupInvoiceMsg
*/
export declare const LookupInvoiceMsg: LookupInvoiceMsg$Type;
/**
* @generated ServiceType for protobuf service invoicesrpc.Invoices
*/
export declare const Invoices: any;
export {};

View file

@ -1,495 +0,0 @@
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
// tslint:disable
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
// tslint:disable
import { Invoice } from "./lightning.js";
import { ServiceType } from "@protobuf-ts/runtime-rpc";
import { WireType } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { RouteHint } from "./lightning.js";
/**
* @generated from protobuf enum invoicesrpc.LookupModifier
*/
export var LookupModifier;
(function (LookupModifier) {
/**
* The default look up modifier, no look up behavior is changed.
*
* @generated from protobuf enum value: DEFAULT = 0;
*/
LookupModifier[LookupModifier["DEFAULT"] = 0] = "DEFAULT";
/**
*
* Indicates that when a look up is done based on a set_id, then only that set
* of HTLCs related to that set ID should be returned.
*
* @generated from protobuf enum value: HTLC_SET_ONLY = 1;
*/
LookupModifier[LookupModifier["HTLC_SET_ONLY"] = 1] = "HTLC_SET_ONLY";
/**
*
* Indicates that when a look up is done using a payment_addr, then no HTLCs
* related to the payment_addr should be returned. This is useful when one
* wants to be able to obtain the set of associated setIDs with a given
* invoice, then look up the sub-invoices "projected" by that set ID.
*
* @generated from protobuf enum value: HTLC_SET_BLANK = 2;
*/
LookupModifier[LookupModifier["HTLC_SET_BLANK"] = 2] = "HTLC_SET_BLANK";
})(LookupModifier || (LookupModifier = {}));
// @generated message type with reflection information, may provide speed optimized methods
class CancelInvoiceMsg$Type extends MessageType {
constructor() {
super("invoicesrpc.CancelInvoiceMsg", [
{ no: 1, name: "payment_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
]);
}
create(value) {
const message = { paymentHash: new Uint8Array(0) };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial(this, message, value);
return message;
}
internalBinaryRead(reader, length, options, target) {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* bytes payment_hash */ 1:
message.paymentHash = reader.bytes();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message, writer, options) {
/* bytes payment_hash = 1; */
if (message.paymentHash.length)
writer.tag(1, WireType.LengthDelimited).bytes(message.paymentHash);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message invoicesrpc.CancelInvoiceMsg
*/
export const CancelInvoiceMsg = new CancelInvoiceMsg$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CancelInvoiceResp$Type extends MessageType {
constructor() {
super("invoicesrpc.CancelInvoiceResp", []);
}
create(value) {
const message = {};
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial(this, message, value);
return message;
}
internalBinaryRead(reader, length, options, target) {
return target ?? this.create();
}
internalBinaryWrite(message, writer, options) {
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message invoicesrpc.CancelInvoiceResp
*/
export const CancelInvoiceResp = new CancelInvoiceResp$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AddHoldInvoiceRequest$Type extends MessageType {
constructor() {
super("invoicesrpc.AddHoldInvoiceRequest", [
{ no: 1, name: "memo", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
{ no: 3, name: "value", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
{ no: 10, name: "value_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
{ no: 4, name: "description_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
{ no: 5, name: "expiry", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 2 /*LongType.NUMBER*/ },
{ no: 6, name: "fallback_addr", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 7, name: "cltv_expiry", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
{ no: 8, name: "route_hints", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => RouteHint },
{ no: 9, name: "private", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
]);
}
create(value) {
const message = { memo: "", hash: new Uint8Array(0), value: 0, valueMsat: 0, descriptionHash: new Uint8Array(0), expiry: 0, fallbackAddr: "", cltvExpiry: 0, routeHints: [], private: false };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial(this, message, value);
return message;
}
internalBinaryRead(reader, length, options, target) {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* string memo */ 1:
message.memo = reader.string();
break;
case /* bytes hash */ 2:
message.hash = reader.bytes();
break;
case /* int64 value */ 3:
message.value = reader.int64().toNumber();
break;
case /* int64 value_msat */ 10:
message.valueMsat = reader.int64().toNumber();
break;
case /* bytes description_hash */ 4:
message.descriptionHash = reader.bytes();
break;
case /* int64 expiry */ 5:
message.expiry = reader.int64().toNumber();
break;
case /* string fallback_addr */ 6:
message.fallbackAddr = reader.string();
break;
case /* uint64 cltv_expiry */ 7:
message.cltvExpiry = reader.uint64().toNumber();
break;
case /* repeated lnrpc.RouteHint route_hints */ 8:
message.routeHints.push(RouteHint.internalBinaryRead(reader, reader.uint32(), options));
break;
case /* bool private */ 9:
message.private = reader.bool();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message, writer, options) {
/* string memo = 1; */
if (message.memo !== "")
writer.tag(1, WireType.LengthDelimited).string(message.memo);
/* bytes hash = 2; */
if (message.hash.length)
writer.tag(2, WireType.LengthDelimited).bytes(message.hash);
/* int64 value = 3; */
if (message.value !== 0)
writer.tag(3, WireType.Varint).int64(message.value);
/* int64 value_msat = 10; */
if (message.valueMsat !== 0)
writer.tag(10, WireType.Varint).int64(message.valueMsat);
/* bytes description_hash = 4; */
if (message.descriptionHash.length)
writer.tag(4, WireType.LengthDelimited).bytes(message.descriptionHash);
/* int64 expiry = 5; */
if (message.expiry !== 0)
writer.tag(5, WireType.Varint).int64(message.expiry);
/* string fallback_addr = 6; */
if (message.fallbackAddr !== "")
writer.tag(6, WireType.LengthDelimited).string(message.fallbackAddr);
/* uint64 cltv_expiry = 7; */
if (message.cltvExpiry !== 0)
writer.tag(7, WireType.Varint).uint64(message.cltvExpiry);
/* repeated lnrpc.RouteHint route_hints = 8; */
for (let i = 0; i < message.routeHints.length; i++)
RouteHint.internalBinaryWrite(message.routeHints[i], writer.tag(8, WireType.LengthDelimited).fork(), options).join();
/* bool private = 9; */
if (message.private !== false)
writer.tag(9, WireType.Varint).bool(message.private);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message invoicesrpc.AddHoldInvoiceRequest
*/
export const AddHoldInvoiceRequest = new AddHoldInvoiceRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AddHoldInvoiceResp$Type extends MessageType {
constructor() {
super("invoicesrpc.AddHoldInvoiceResp", [
{ no: 1, name: "payment_request", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "add_index", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 2 /*LongType.NUMBER*/ },
{ no: 3, name: "payment_addr", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
]);
}
create(value) {
const message = { paymentRequest: "", addIndex: 0, paymentAddr: new Uint8Array(0) };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial(this, message, value);
return message;
}
internalBinaryRead(reader, length, options, target) {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* string payment_request */ 1:
message.paymentRequest = reader.string();
break;
case /* uint64 add_index */ 2:
message.addIndex = reader.uint64().toNumber();
break;
case /* bytes payment_addr */ 3:
message.paymentAddr = reader.bytes();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message, writer, options) {
/* string payment_request = 1; */
if (message.paymentRequest !== "")
writer.tag(1, WireType.LengthDelimited).string(message.paymentRequest);
/* uint64 add_index = 2; */
if (message.addIndex !== 0)
writer.tag(2, WireType.Varint).uint64(message.addIndex);
/* bytes payment_addr = 3; */
if (message.paymentAddr.length)
writer.tag(3, WireType.LengthDelimited).bytes(message.paymentAddr);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message invoicesrpc.AddHoldInvoiceResp
*/
export const AddHoldInvoiceResp = new AddHoldInvoiceResp$Type();
// @generated message type with reflection information, may provide speed optimized methods
class SettleInvoiceMsg$Type extends MessageType {
constructor() {
super("invoicesrpc.SettleInvoiceMsg", [
{ no: 1, name: "preimage", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
]);
}
create(value) {
const message = { preimage: new Uint8Array(0) };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial(this, message, value);
return message;
}
internalBinaryRead(reader, length, options, target) {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* bytes preimage */ 1:
message.preimage = reader.bytes();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message, writer, options) {
/* bytes preimage = 1; */
if (message.preimage.length)
writer.tag(1, WireType.LengthDelimited).bytes(message.preimage);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message invoicesrpc.SettleInvoiceMsg
*/
export const SettleInvoiceMsg = new SettleInvoiceMsg$Type();
// @generated message type with reflection information, may provide speed optimized methods
class SettleInvoiceResp$Type extends MessageType {
constructor() {
super("invoicesrpc.SettleInvoiceResp", []);
}
create(value) {
const message = {};
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial(this, message, value);
return message;
}
internalBinaryRead(reader, length, options, target) {
return target ?? this.create();
}
internalBinaryWrite(message, writer, options) {
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message invoicesrpc.SettleInvoiceResp
*/
export const SettleInvoiceResp = new SettleInvoiceResp$Type();
// @generated message type with reflection information, may provide speed optimized methods
class SubscribeSingleInvoiceRequest$Type extends MessageType {
constructor() {
super("invoicesrpc.SubscribeSingleInvoiceRequest", [
{ no: 2, name: "r_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
]);
}
create(value) {
const message = { rHash: new Uint8Array(0) };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial(this, message, value);
return message;
}
internalBinaryRead(reader, length, options, target) {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* bytes r_hash */ 2:
message.rHash = reader.bytes();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message, writer, options) {
/* bytes r_hash = 2; */
if (message.rHash.length)
writer.tag(2, WireType.LengthDelimited).bytes(message.rHash);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message invoicesrpc.SubscribeSingleInvoiceRequest
*/
export const SubscribeSingleInvoiceRequest = new SubscribeSingleInvoiceRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class LookupInvoiceMsg$Type extends MessageType {
constructor() {
super("invoicesrpc.LookupInvoiceMsg", [
{ no: 1, name: "payment_hash", kind: "scalar", oneof: "invoiceRef", T: 12 /*ScalarType.BYTES*/ },
{ no: 2, name: "payment_addr", kind: "scalar", oneof: "invoiceRef", T: 12 /*ScalarType.BYTES*/ },
{ no: 3, name: "set_id", kind: "scalar", oneof: "invoiceRef", T: 12 /*ScalarType.BYTES*/ },
{ no: 4, name: "lookup_modifier", kind: "enum", T: () => ["invoicesrpc.LookupModifier", LookupModifier] }
]);
}
create(value) {
const message = { invoiceRef: { oneofKind: undefined }, lookupModifier: 0 };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial(this, message, value);
return message;
}
internalBinaryRead(reader, length, options, target) {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* bytes payment_hash */ 1:
message.invoiceRef = {
oneofKind: "paymentHash",
paymentHash: reader.bytes()
};
break;
case /* bytes payment_addr */ 2:
message.invoiceRef = {
oneofKind: "paymentAddr",
paymentAddr: reader.bytes()
};
break;
case /* bytes set_id */ 3:
message.invoiceRef = {
oneofKind: "setId",
setId: reader.bytes()
};
break;
case /* invoicesrpc.LookupModifier lookup_modifier */ 4:
message.lookupModifier = reader.int32();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message, writer, options) {
/* bytes payment_hash = 1; */
if (message.invoiceRef.oneofKind === "paymentHash")
writer.tag(1, WireType.LengthDelimited).bytes(message.invoiceRef.paymentHash);
/* bytes payment_addr = 2; */
if (message.invoiceRef.oneofKind === "paymentAddr")
writer.tag(2, WireType.LengthDelimited).bytes(message.invoiceRef.paymentAddr);
/* bytes set_id = 3; */
if (message.invoiceRef.oneofKind === "setId")
writer.tag(3, WireType.LengthDelimited).bytes(message.invoiceRef.setId);
/* invoicesrpc.LookupModifier lookup_modifier = 4; */
if (message.lookupModifier !== 0)
writer.tag(4, WireType.Varint).int32(message.lookupModifier);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message invoicesrpc.LookupInvoiceMsg
*/
export const LookupInvoiceMsg = new LookupInvoiceMsg$Type();
/**
* @generated ServiceType for protobuf service invoicesrpc.Invoices
*/
export const Invoices = new ServiceType("invoicesrpc.Invoices", [
{ name: "SubscribeSingleInvoice", serverStreaming: true, options: {}, I: SubscribeSingleInvoiceRequest, O: Invoice },
{ name: "CancelInvoice", options: {}, I: CancelInvoiceMsg, O: CancelInvoiceResp },
{ name: "AddHoldInvoice", options: {}, I: AddHoldInvoiceRequest, O: AddHoldInvoiceResp },
{ name: "SettleInvoice", options: {}, I: SettleInvoiceMsg, O: SettleInvoiceResp },
{ name: "LookupInvoiceV2", options: {}, I: LookupInvoiceMsg, O: Invoice }
]);

View file

@ -1,7 +1,7 @@
// @generated by protobuf-ts 2.8.1 with parameter long_type_number
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
// tslint:disable
import { Invoice } from "./lightning";
import { Invoice } from "./lightning.js";
import { ServiceType } from "@protobuf-ts/runtime-rpc";
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { IBinaryWriter } from "@protobuf-ts/runtime";
@ -13,7 +13,7 @@ import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { RouteHint } from "./lightning";
import { RouteHint } from "./lightning.js";
/**
* @generated from protobuf message invoicesrpc.CancelInvoiceMsg
*/

File diff suppressed because it is too large Load diff

View file

@ -1,901 +0,0 @@
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
// @generated from protobuf file "lightning.proto" (package "lnrpc", syntax proto3)
// tslint:disable
import { Lightning } from "./lightning.js";
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
//
// Comments in this file will be directly parsed into the API
// Documentation as descriptions of the associated method, message, or field.
// These descriptions should go right above the definition of the object, and
// can be in either block or // comment format.
//
// An RPC method can be matched to an lncli command by placing a line in the
// beginning of the description in exactly the following format:
// lncli: `methodname`
//
// Failure to specify the exact name of the command will cause documentation
// generation to fail.
//
// More information on how exactly the gRPC documentation is generated from
// this proto file can be found here:
// https://github.com/lightninglabs/lightning-api
/**
* Lightning is the main RPC server of the daemon.
*
* @generated from protobuf service lnrpc.Lightning
*/
export class LightningClient {
constructor(_transport) {
this._transport = _transport;
this.typeName = Lightning.typeName;
this.methods = Lightning.methods;
this.options = Lightning.options;
}
/**
* lncli: `walletbalance`
* WalletBalance returns total unspent outputs(confirmed and unconfirmed), all
* confirmed unspent outputs and all unconfirmed unspent outputs under control
* of the wallet.
*
* @generated from protobuf rpc: WalletBalance(lnrpc.WalletBalanceRequest) returns (lnrpc.WalletBalanceResponse);
*/
walletBalance(input, options) {
const method = this.methods[0], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `channelbalance`
* ChannelBalance returns a report on the total funds across all open channels,
* categorized in local/remote, pending local/remote and unsettled local/remote
* balances.
*
* @generated from protobuf rpc: ChannelBalance(lnrpc.ChannelBalanceRequest) returns (lnrpc.ChannelBalanceResponse);
*/
channelBalance(input, options) {
const method = this.methods[1], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `listchaintxns`
* GetTransactions returns a list describing all the known transactions
* relevant to the wallet.
*
* @generated from protobuf rpc: GetTransactions(lnrpc.GetTransactionsRequest) returns (lnrpc.TransactionDetails);
*/
getTransactions(input, options) {
const method = this.methods[2], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `estimatefee`
* EstimateFee asks the chain backend to estimate the fee rate and total fees
* for a transaction that pays to multiple specified outputs.
*
* When using REST, the `AddrToAmount` map type can be set by appending
* `&AddrToAmount[<address>]=<amount_to_send>` to the URL. Unfortunately this
* map type doesn't appear in the REST API documentation because of a bug in
* the grpc-gateway library.
*
* @generated from protobuf rpc: EstimateFee(lnrpc.EstimateFeeRequest) returns (lnrpc.EstimateFeeResponse);
*/
estimateFee(input, options) {
const method = this.methods[3], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `sendcoins`
* SendCoins executes a request to send coins to a particular address. Unlike
* SendMany, this RPC call only allows creating a single output at a time. If
* neither target_conf, or sat_per_vbyte are set, then the internal wallet will
* consult its fee model to determine a fee for the default confirmation
* target.
*
* @generated from protobuf rpc: SendCoins(lnrpc.SendCoinsRequest) returns (lnrpc.SendCoinsResponse);
*/
sendCoins(input, options) {
const method = this.methods[4], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `listunspent`
* Deprecated, use walletrpc.ListUnspent instead.
*
* ListUnspent returns a list of all utxos spendable by the wallet with a
* number of confirmations between the specified minimum and maximum.
*
* @generated from protobuf rpc: ListUnspent(lnrpc.ListUnspentRequest) returns (lnrpc.ListUnspentResponse);
*/
listUnspent(input, options) {
const method = this.methods[5], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* SubscribeTransactions creates a uni-directional stream from the server to
* the client in which any newly discovered transactions relevant to the
* wallet are sent over.
*
* @generated from protobuf rpc: SubscribeTransactions(lnrpc.GetTransactionsRequest) returns (stream lnrpc.Transaction);
*/
subscribeTransactions(input, options) {
const method = this.methods[6], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
* lncli: `sendmany`
* SendMany handles a request for a transaction that creates multiple specified
* outputs in parallel. If neither target_conf, or sat_per_vbyte are set, then
* the internal wallet will consult its fee model to determine a fee for the
* default confirmation target.
*
* @generated from protobuf rpc: SendMany(lnrpc.SendManyRequest) returns (lnrpc.SendManyResponse);
*/
sendMany(input, options) {
const method = this.methods[7], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `newaddress`
* NewAddress creates a new address under control of the local wallet.
*
* @generated from protobuf rpc: NewAddress(lnrpc.NewAddressRequest) returns (lnrpc.NewAddressResponse);
*/
newAddress(input, options) {
const method = this.methods[8], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `signmessage`
* SignMessage signs a message with this node's private key. The returned
* signature string is `zbase32` encoded and pubkey recoverable, meaning that
* only the message digest and signature are needed for verification.
*
* @generated from protobuf rpc: SignMessage(lnrpc.SignMessageRequest) returns (lnrpc.SignMessageResponse);
*/
signMessage(input, options) {
const method = this.methods[9], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `verifymessage`
* VerifyMessage verifies a signature over a msg. The signature must be
* zbase32 encoded and signed by an active node in the resident node's
* channel database. In addition to returning the validity of the signature,
* VerifyMessage also returns the recovered pubkey from the signature.
*
* @generated from protobuf rpc: VerifyMessage(lnrpc.VerifyMessageRequest) returns (lnrpc.VerifyMessageResponse);
*/
verifyMessage(input, options) {
const method = this.methods[10], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `connect`
* ConnectPeer attempts to establish a connection to a remote peer. This is at
* the networking level, and is used for communication between nodes. This is
* distinct from establishing a channel with a peer.
*
* @generated from protobuf rpc: ConnectPeer(lnrpc.ConnectPeerRequest) returns (lnrpc.ConnectPeerResponse);
*/
connectPeer(input, options) {
const method = this.methods[11], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `disconnect`
* DisconnectPeer attempts to disconnect one peer from another identified by a
* given pubKey. In the case that we currently have a pending or active channel
* with the target peer, then this action will be not be allowed.
*
* @generated from protobuf rpc: DisconnectPeer(lnrpc.DisconnectPeerRequest) returns (lnrpc.DisconnectPeerResponse);
*/
disconnectPeer(input, options) {
const method = this.methods[12], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `listpeers`
* ListPeers returns a verbose listing of all currently active peers.
*
* @generated from protobuf rpc: ListPeers(lnrpc.ListPeersRequest) returns (lnrpc.ListPeersResponse);
*/
listPeers(input, options) {
const method = this.methods[13], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* SubscribePeerEvents creates a uni-directional stream from the server to
* the client in which any events relevant to the state of peers are sent
* over. Events include peers going online and offline.
*
* @generated from protobuf rpc: SubscribePeerEvents(lnrpc.PeerEventSubscription) returns (stream lnrpc.PeerEvent);
*/
subscribePeerEvents(input, options) {
const method = this.methods[14], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
* lncli: `getinfo`
* GetInfo returns general information concerning the lightning node including
* it's identity pubkey, alias, the chains it is connected to, and information
* concerning the number of open+pending channels.
*
* @generated from protobuf rpc: GetInfo(lnrpc.GetInfoRequest) returns (lnrpc.GetInfoResponse);
*/
getInfo(input, options) {
const method = this.methods[15], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* * lncli: `getrecoveryinfo`
* GetRecoveryInfo returns information concerning the recovery mode including
* whether it's in a recovery mode, whether the recovery is finished, and the
* progress made so far.
*
* @generated from protobuf rpc: GetRecoveryInfo(lnrpc.GetRecoveryInfoRequest) returns (lnrpc.GetRecoveryInfoResponse);
*/
getRecoveryInfo(input, options) {
const method = this.methods[16], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
// TODO(roasbeef): merge with below with bool?
/**
* lncli: `pendingchannels`
* PendingChannels returns a list of all the channels that are currently
* considered "pending". A channel is pending if it has finished the funding
* workflow and is waiting for confirmations for the funding txn, or is in the
* process of closure, either initiated cooperatively or non-cooperatively.
*
* @generated from protobuf rpc: PendingChannels(lnrpc.PendingChannelsRequest) returns (lnrpc.PendingChannelsResponse);
*/
pendingChannels(input, options) {
const method = this.methods[17], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `listchannels`
* ListChannels returns a description of all the open channels that this node
* is a participant in.
*
* @generated from protobuf rpc: ListChannels(lnrpc.ListChannelsRequest) returns (lnrpc.ListChannelsResponse);
*/
listChannels(input, options) {
const method = this.methods[18], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* SubscribeChannelEvents creates a uni-directional stream from the server to
* the client in which any updates relevant to the state of the channels are
* sent over. Events include new active channels, inactive channels, and closed
* channels.
*
* @generated from protobuf rpc: SubscribeChannelEvents(lnrpc.ChannelEventSubscription) returns (stream lnrpc.ChannelEventUpdate);
*/
subscribeChannelEvents(input, options) {
const method = this.methods[19], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
* lncli: `closedchannels`
* ClosedChannels returns a description of all the closed channels that
* this node was a participant in.
*
* @generated from protobuf rpc: ClosedChannels(lnrpc.ClosedChannelsRequest) returns (lnrpc.ClosedChannelsResponse);
*/
closedChannels(input, options) {
const method = this.methods[20], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* OpenChannelSync is a synchronous version of the OpenChannel RPC call. This
* call is meant to be consumed by clients to the REST proxy. As with all
* other sync calls, all byte slices are intended to be populated as hex
* encoded strings.
*
* @generated from protobuf rpc: OpenChannelSync(lnrpc.OpenChannelRequest) returns (lnrpc.ChannelPoint);
*/
openChannelSync(input, options) {
const method = this.methods[21], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `openchannel`
* OpenChannel attempts to open a singly funded channel specified in the
* request to a remote peer. Users are able to specify a target number of
* blocks that the funding transaction should be confirmed in, or a manual fee
* rate to us for the funding transaction. If neither are specified, then a
* lax block confirmation target is used. Each OpenStatusUpdate will return
* the pending channel ID of the in-progress channel. Depending on the
* arguments specified in the OpenChannelRequest, this pending channel ID can
* then be used to manually progress the channel funding flow.
*
* @generated from protobuf rpc: OpenChannel(lnrpc.OpenChannelRequest) returns (stream lnrpc.OpenStatusUpdate);
*/
openChannel(input, options) {
const method = this.methods[22], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
* lncli: `batchopenchannel`
* BatchOpenChannel attempts to open multiple single-funded channels in a
* single transaction in an atomic way. This means either all channel open
* requests succeed at once or all attempts are aborted if any of them fail.
* This is the safer variant of using PSBTs to manually fund a batch of
* channels through the OpenChannel RPC.
*
* @generated from protobuf rpc: BatchOpenChannel(lnrpc.BatchOpenChannelRequest) returns (lnrpc.BatchOpenChannelResponse);
*/
batchOpenChannel(input, options) {
const method = this.methods[23], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* FundingStateStep is an advanced funding related call that allows the caller
* to either execute some preparatory steps for a funding workflow, or
* manually progress a funding workflow. The primary way a funding flow is
* identified is via its pending channel ID. As an example, this method can be
* used to specify that we're expecting a funding flow for a particular
* pending channel ID, for which we need to use specific parameters.
* Alternatively, this can be used to interactively drive PSBT signing for
* funding for partially complete funding transactions.
*
* @generated from protobuf rpc: FundingStateStep(lnrpc.FundingTransitionMsg) returns (lnrpc.FundingStateStepResp);
*/
fundingStateStep(input, options) {
const method = this.methods[24], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* ChannelAcceptor dispatches a bi-directional streaming RPC in which
* OpenChannel requests are sent to the client and the client responds with
* a boolean that tells LND whether or not to accept the channel. This allows
* node operators to specify their own criteria for accepting inbound channels
* through a single persistent connection.
*
* @generated from protobuf rpc: ChannelAcceptor(stream lnrpc.ChannelAcceptResponse) returns (stream lnrpc.ChannelAcceptRequest);
*/
channelAcceptor(options) {
const method = this.methods[25], opt = this._transport.mergeOptions(options);
return stackIntercept("duplex", this._transport, method, opt);
}
/**
* lncli: `closechannel`
* CloseChannel attempts to close an active channel identified by its channel
* outpoint (ChannelPoint). The actions of this method can additionally be
* augmented to attempt a force close after a timeout period in the case of an
* inactive peer. If a non-force close (cooperative closure) is requested,
* then the user can specify either a target number of blocks until the
* closure transaction is confirmed, or a manual fee rate. If neither are
* specified, then a default lax, block confirmation target is used.
*
* @generated from protobuf rpc: CloseChannel(lnrpc.CloseChannelRequest) returns (stream lnrpc.CloseStatusUpdate);
*/
closeChannel(input, options) {
const method = this.methods[26], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
* lncli: `abandonchannel`
* AbandonChannel removes all channel state from the database except for a
* close summary. This method can be used to get rid of permanently unusable
* channels due to bugs fixed in newer versions of lnd. This method can also be
* used to remove externally funded channels where the funding transaction was
* never broadcast. Only available for non-externally funded channels in dev
* build.
*
* @generated from protobuf rpc: AbandonChannel(lnrpc.AbandonChannelRequest) returns (lnrpc.AbandonChannelResponse);
*/
abandonChannel(input, options) {
const method = this.methods[27], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `sendpayment`
* Deprecated, use routerrpc.SendPaymentV2. SendPayment dispatches a
* bi-directional streaming RPC for sending payments through the Lightning
* Network. A single RPC invocation creates a persistent bi-directional
* stream allowing clients to rapidly send payments through the Lightning
* Network with a single persistent connection.
*
* @deprecated
* @generated from protobuf rpc: SendPayment(stream lnrpc.SendRequest) returns (stream lnrpc.SendResponse);
*/
sendPayment(options) {
const method = this.methods[28], opt = this._transport.mergeOptions(options);
return stackIntercept("duplex", this._transport, method, opt);
}
/**
*
* SendPaymentSync is the synchronous non-streaming version of SendPayment.
* This RPC is intended to be consumed by clients of the REST proxy.
* Additionally, this RPC expects the destination's public key and the payment
* hash (if any) to be encoded as hex strings.
*
* @generated from protobuf rpc: SendPaymentSync(lnrpc.SendRequest) returns (lnrpc.SendResponse);
*/
sendPaymentSync(input, options) {
const method = this.methods[29], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `sendtoroute`
* Deprecated, use routerrpc.SendToRouteV2. SendToRoute is a bi-directional
* streaming RPC for sending payment through the Lightning Network. This
* method differs from SendPayment in that it allows users to specify a full
* route manually. This can be used for things like rebalancing, and atomic
* swaps.
*
* @deprecated
* @generated from protobuf rpc: SendToRoute(stream lnrpc.SendToRouteRequest) returns (stream lnrpc.SendResponse);
*/
sendToRoute(options) {
const method = this.methods[30], opt = this._transport.mergeOptions(options);
return stackIntercept("duplex", this._transport, method, opt);
}
/**
*
* SendToRouteSync is a synchronous version of SendToRoute. It Will block
* until the payment either fails or succeeds.
*
* @generated from protobuf rpc: SendToRouteSync(lnrpc.SendToRouteRequest) returns (lnrpc.SendResponse);
*/
sendToRouteSync(input, options) {
const method = this.methods[31], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `addinvoice`
* AddInvoice attempts to add a new invoice to the invoice database. Any
* duplicated invoices are rejected, therefore all invoices *must* have a
* unique payment preimage.
*
* @generated from protobuf rpc: AddInvoice(lnrpc.Invoice) returns (lnrpc.AddInvoiceResponse);
*/
addInvoice(input, options) {
const method = this.methods[32], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `listinvoices`
* ListInvoices returns a list of all the invoices currently stored within the
* database. Any active debug invoices are ignored. It has full support for
* paginated responses, allowing users to query for specific invoices through
* their add_index. This can be done by using either the first_index_offset or
* last_index_offset fields included in the response as the index_offset of the
* next request. By default, the first 100 invoices created will be returned.
* Backwards pagination is also supported through the Reversed flag.
*
* @generated from protobuf rpc: ListInvoices(lnrpc.ListInvoiceRequest) returns (lnrpc.ListInvoiceResponse);
*/
listInvoices(input, options) {
const method = this.methods[33], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `lookupinvoice`
* LookupInvoice attempts to look up an invoice according to its payment hash.
* The passed payment hash *must* be exactly 32 bytes, if not, an error is
* returned.
*
* @generated from protobuf rpc: LookupInvoice(lnrpc.PaymentHash) returns (lnrpc.Invoice);
*/
lookupInvoice(input, options) {
const method = this.methods[34], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* SubscribeInvoices returns a uni-directional stream (server -> client) for
* notifying the client of newly added/settled invoices. The caller can
* optionally specify the add_index and/or the settle_index. If the add_index
* is specified, then we'll first start by sending add invoice events for all
* invoices with an add_index greater than the specified value. If the
* settle_index is specified, the next, we'll send out all settle events for
* invoices with a settle_index greater than the specified value. One or both
* of these fields can be set. If no fields are set, then we'll only send out
* the latest add/settle events.
*
* @generated from protobuf rpc: SubscribeInvoices(lnrpc.InvoiceSubscription) returns (stream lnrpc.Invoice);
*/
subscribeInvoices(input, options) {
const method = this.methods[35], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
* lncli: `decodepayreq`
* DecodePayReq takes an encoded payment request string and attempts to decode
* it, returning a full description of the conditions encoded within the
* payment request.
*
* @generated from protobuf rpc: DecodePayReq(lnrpc.PayReqString) returns (lnrpc.PayReq);
*/
decodePayReq(input, options) {
const method = this.methods[36], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `listpayments`
* ListPayments returns a list of all outgoing payments.
*
* @generated from protobuf rpc: ListPayments(lnrpc.ListPaymentsRequest) returns (lnrpc.ListPaymentsResponse);
*/
listPayments(input, options) {
const method = this.methods[37], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* DeletePayment deletes an outgoing payment from DB. Note that it will not
* attempt to delete an In-Flight payment, since that would be unsafe.
*
* @generated from protobuf rpc: DeletePayment(lnrpc.DeletePaymentRequest) returns (lnrpc.DeletePaymentResponse);
*/
deletePayment(input, options) {
const method = this.methods[38], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* DeleteAllPayments deletes all outgoing payments from DB. Note that it will
* not attempt to delete In-Flight payments, since that would be unsafe.
*
* @generated from protobuf rpc: DeleteAllPayments(lnrpc.DeleteAllPaymentsRequest) returns (lnrpc.DeleteAllPaymentsResponse);
*/
deleteAllPayments(input, options) {
const method = this.methods[39], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `describegraph`
* DescribeGraph returns a description of the latest graph state from the
* point of view of the node. The graph information is partitioned into two
* components: all the nodes/vertexes, and all the edges that connect the
* vertexes themselves. As this is a directed graph, the edges also contain
* the node directional specific routing policy which includes: the time lock
* delta, fee information, etc.
*
* @generated from protobuf rpc: DescribeGraph(lnrpc.ChannelGraphRequest) returns (lnrpc.ChannelGraph);
*/
describeGraph(input, options) {
const method = this.methods[40], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `getnodemetrics`
* GetNodeMetrics returns node metrics calculated from the graph. Currently
* the only supported metric is betweenness centrality of individual nodes.
*
* @generated from protobuf rpc: GetNodeMetrics(lnrpc.NodeMetricsRequest) returns (lnrpc.NodeMetricsResponse);
*/
getNodeMetrics(input, options) {
const method = this.methods[41], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `getchaninfo`
* GetChanInfo returns the latest authenticated network announcement for the
* given channel identified by its channel ID: an 8-byte integer which
* uniquely identifies the location of transaction's funding output within the
* blockchain.
*
* @generated from protobuf rpc: GetChanInfo(lnrpc.ChanInfoRequest) returns (lnrpc.ChannelEdge);
*/
getChanInfo(input, options) {
const method = this.methods[42], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `getnodeinfo`
* GetNodeInfo returns the latest advertised, aggregated, and authenticated
* channel information for the specified node identified by its public key.
*
* @generated from protobuf rpc: GetNodeInfo(lnrpc.NodeInfoRequest) returns (lnrpc.NodeInfo);
*/
getNodeInfo(input, options) {
const method = this.methods[43], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `queryroutes`
* QueryRoutes attempts to query the daemon's Channel Router for a possible
* route to a target destination capable of carrying a specific amount of
* satoshis. The returned route contains the full details required to craft and
* send an HTLC, also including the necessary information that should be
* present within the Sphinx packet encapsulated within the HTLC.
*
* When using REST, the `dest_custom_records` map type can be set by appending
* `&dest_custom_records[<record_number>]=<record_data_base64_url_encoded>`
* to the URL. Unfortunately this map type doesn't appear in the REST API
* documentation because of a bug in the grpc-gateway library.
*
* @generated from protobuf rpc: QueryRoutes(lnrpc.QueryRoutesRequest) returns (lnrpc.QueryRoutesResponse);
*/
queryRoutes(input, options) {
const method = this.methods[44], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `getnetworkinfo`
* GetNetworkInfo returns some basic stats about the known channel graph from
* the point of view of the node.
*
* @generated from protobuf rpc: GetNetworkInfo(lnrpc.NetworkInfoRequest) returns (lnrpc.NetworkInfo);
*/
getNetworkInfo(input, options) {
const method = this.methods[45], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `stop`
* StopDaemon will send a shutdown request to the interrupt handler, triggering
* a graceful shutdown of the daemon.
*
* @generated from protobuf rpc: StopDaemon(lnrpc.StopRequest) returns (lnrpc.StopResponse);
*/
stopDaemon(input, options) {
const method = this.methods[46], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* SubscribeChannelGraph launches a streaming RPC that allows the caller to
* receive notifications upon any changes to the channel graph topology from
* the point of view of the responding node. Events notified include: new
* nodes coming online, nodes updating their authenticated attributes, new
* channels being advertised, updates in the routing policy for a directional
* channel edge, and when channels are closed on-chain.
*
* @generated from protobuf rpc: SubscribeChannelGraph(lnrpc.GraphTopologySubscription) returns (stream lnrpc.GraphTopologyUpdate);
*/
subscribeChannelGraph(input, options) {
const method = this.methods[47], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
* lncli: `debuglevel`
* DebugLevel allows a caller to programmatically set the logging verbosity of
* lnd. The logging can be targeted according to a coarse daemon-wide logging
* level, or in a granular fashion to specify the logging for a target
* sub-system.
*
* @generated from protobuf rpc: DebugLevel(lnrpc.DebugLevelRequest) returns (lnrpc.DebugLevelResponse);
*/
debugLevel(input, options) {
const method = this.methods[48], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `feereport`
* FeeReport allows the caller to obtain a report detailing the current fee
* schedule enforced by the node globally for each channel.
*
* @generated from protobuf rpc: FeeReport(lnrpc.FeeReportRequest) returns (lnrpc.FeeReportResponse);
*/
feeReport(input, options) {
const method = this.methods[49], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `updatechanpolicy`
* UpdateChannelPolicy allows the caller to update the fee schedule and
* channel policies for all channels globally, or a particular channel.
*
* @generated from protobuf rpc: UpdateChannelPolicy(lnrpc.PolicyUpdateRequest) returns (lnrpc.PolicyUpdateResponse);
*/
updateChannelPolicy(input, options) {
const method = this.methods[50], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `fwdinghistory`
* ForwardingHistory allows the caller to query the htlcswitch for a record of
* all HTLCs forwarded within the target time range, and integer offset
* within that time range, for a maximum number of events. If no maximum number
* of events is specified, up to 100 events will be returned. If no time-range
* is specified, then events will be returned in the order that they occured.
*
* A list of forwarding events are returned. The size of each forwarding event
* is 40 bytes, and the max message size able to be returned in gRPC is 4 MiB.
* As a result each message can only contain 50k entries. Each response has
* the index offset of the last entry. The index offset can be provided to the
* request to allow the caller to skip a series of records.
*
* @generated from protobuf rpc: ForwardingHistory(lnrpc.ForwardingHistoryRequest) returns (lnrpc.ForwardingHistoryResponse);
*/
forwardingHistory(input, options) {
const method = this.methods[51], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `exportchanbackup`
* ExportChannelBackup attempts to return an encrypted static channel backup
* for the target channel identified by it channel point. The backup is
* encrypted with a key generated from the aezeed seed of the user. The
* returned backup can either be restored using the RestoreChannelBackup
* method once lnd is running, or via the InitWallet and UnlockWallet methods
* from the WalletUnlocker service.
*
* @generated from protobuf rpc: ExportChannelBackup(lnrpc.ExportChannelBackupRequest) returns (lnrpc.ChannelBackup);
*/
exportChannelBackup(input, options) {
const method = this.methods[52], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* ExportAllChannelBackups returns static channel backups for all existing
* channels known to lnd. A set of regular singular static channel backups for
* each channel are returned. Additionally, a multi-channel backup is returned
* as well, which contains a single encrypted blob containing the backups of
* each channel.
*
* @generated from protobuf rpc: ExportAllChannelBackups(lnrpc.ChanBackupExportRequest) returns (lnrpc.ChanBackupSnapshot);
*/
exportAllChannelBackups(input, options) {
const method = this.methods[53], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* VerifyChanBackup allows a caller to verify the integrity of a channel backup
* snapshot. This method will accept either a packed Single or a packed Multi.
* Specifying both will result in an error.
*
* @generated from protobuf rpc: VerifyChanBackup(lnrpc.ChanBackupSnapshot) returns (lnrpc.VerifyChanBackupResponse);
*/
verifyChanBackup(input, options) {
const method = this.methods[54], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `restorechanbackup`
* RestoreChannelBackups accepts a set of singular channel backups, or a
* single encrypted multi-chan backup and attempts to recover any funds
* remaining within the channel. If we are able to unpack the backup, then the
* new channel will be shown under listchannels, as well as pending channels.
*
* @generated from protobuf rpc: RestoreChannelBackups(lnrpc.RestoreChanBackupRequest) returns (lnrpc.RestoreBackupResponse);
*/
restoreChannelBackups(input, options) {
const method = this.methods[55], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* SubscribeChannelBackups allows a client to sub-subscribe to the most up to
* date information concerning the state of all channel backups. Each time a
* new channel is added, we return the new set of channels, along with a
* multi-chan backup containing the backup info for all channels. Each time a
* channel is closed, we send a new update, which contains new new chan back
* ups, but the updated set of encrypted multi-chan backups with the closed
* channel(s) removed.
*
* @generated from protobuf rpc: SubscribeChannelBackups(lnrpc.ChannelBackupSubscription) returns (stream lnrpc.ChanBackupSnapshot);
*/
subscribeChannelBackups(input, options) {
const method = this.methods[56], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
* lncli: `bakemacaroon`
* BakeMacaroon allows the creation of a new macaroon with custom read and
* write permissions. No first-party caveats are added since this can be done
* offline.
*
* @generated from protobuf rpc: BakeMacaroon(lnrpc.BakeMacaroonRequest) returns (lnrpc.BakeMacaroonResponse);
*/
bakeMacaroon(input, options) {
const method = this.methods[57], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `listmacaroonids`
* ListMacaroonIDs returns all root key IDs that are in use.
*
* @generated from protobuf rpc: ListMacaroonIDs(lnrpc.ListMacaroonIDsRequest) returns (lnrpc.ListMacaroonIDsResponse);
*/
listMacaroonIDs(input, options) {
const method = this.methods[58], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `deletemacaroonid`
* DeleteMacaroonID deletes the specified macaroon ID and invalidates all
* macaroons derived from that ID.
*
* @generated from protobuf rpc: DeleteMacaroonID(lnrpc.DeleteMacaroonIDRequest) returns (lnrpc.DeleteMacaroonIDResponse);
*/
deleteMacaroonID(input, options) {
const method = this.methods[59], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `listpermissions`
* ListPermissions lists all RPC method URIs and their required macaroon
* permissions to access them.
*
* @generated from protobuf rpc: ListPermissions(lnrpc.ListPermissionsRequest) returns (lnrpc.ListPermissionsResponse);
*/
listPermissions(input, options) {
const method = this.methods[60], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* CheckMacaroonPermissions checks whether a request follows the constraints
* imposed on the macaroon and that the macaroon is authorized to follow the
* provided permissions.
*
* @generated from protobuf rpc: CheckMacaroonPermissions(lnrpc.CheckMacPermRequest) returns (lnrpc.CheckMacPermResponse);
*/
checkMacaroonPermissions(input, options) {
const method = this.methods[61], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* RegisterRPCMiddleware adds a new gRPC middleware to the interceptor chain. A
* gRPC middleware is software component external to lnd that aims to add
* additional business logic to lnd by observing/intercepting/validating
* incoming gRPC client requests and (if needed) replacing/overwriting outgoing
* messages before they're sent to the client. When registering the middleware
* must identify itself and indicate what custom macaroon caveats it wants to
* be responsible for. Only requests that contain a macaroon with that specific
* custom caveat are then sent to the middleware for inspection. The other
* option is to register for the read-only mode in which all requests/responses
* are forwarded for interception to the middleware but the middleware is not
* allowed to modify any responses. As a security measure, _no_ middleware can
* modify responses for requests made with _unencumbered_ macaroons!
*
* @generated from protobuf rpc: RegisterRPCMiddleware(stream lnrpc.RPCMiddlewareResponse) returns (stream lnrpc.RPCMiddlewareRequest);
*/
registerRPCMiddleware(options) {
const method = this.methods[62], opt = this._transport.mergeOptions(options);
return stackIntercept("duplex", this._transport, method, opt);
}
/**
* lncli: `sendcustom`
* SendCustomMessage sends a custom peer message.
*
* @generated from protobuf rpc: SendCustomMessage(lnrpc.SendCustomMessageRequest) returns (lnrpc.SendCustomMessageResponse);
*/
sendCustomMessage(input, options) {
const method = this.methods[63], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* lncli: `subscribecustom`
* SubscribeCustomMessages subscribes to a stream of incoming custom peer
* messages.
*
* @generated from protobuf rpc: SubscribeCustomMessages(lnrpc.SubscribeCustomMessagesRequest) returns (stream lnrpc.CustomMessage);
*/
subscribeCustomMessages(input, options) {
const method = this.methods[64], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
* lncli: `listaliases`
* ListAliases returns the set of all aliases that have ever existed with
* their confirmed SCID (if it exists) and/or the base SCID (in the case of
* zero conf).
*
* @generated from protobuf rpc: ListAliases(lnrpc.ListAliasesRequest) returns (lnrpc.ListAliasesResponse);
*/
listAliases(input, options) {
const method = this.methods[65], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: LookupHtlc(lnrpc.LookupHtlcRequest) returns (lnrpc.LookupHtlcResponse);
*/
lookupHtlc(input, options) {
const method = this.methods[66], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
}

View file

@ -3,133 +3,133 @@
// tslint:disable
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import { Lightning } from "./lightning";
import type { LookupHtlcResponse } from "./lightning";
import type { LookupHtlcRequest } from "./lightning";
import type { ListAliasesResponse } from "./lightning";
import type { ListAliasesRequest } from "./lightning";
import type { CustomMessage } from "./lightning";
import type { SubscribeCustomMessagesRequest } from "./lightning";
import type { SendCustomMessageResponse } from "./lightning";
import type { SendCustomMessageRequest } from "./lightning";
import type { RPCMiddlewareRequest } from "./lightning";
import type { RPCMiddlewareResponse } from "./lightning";
import type { CheckMacPermResponse } from "./lightning";
import type { CheckMacPermRequest } from "./lightning";
import type { ListPermissionsResponse } from "./lightning";
import type { ListPermissionsRequest } from "./lightning";
import type { DeleteMacaroonIDResponse } from "./lightning";
import type { DeleteMacaroonIDRequest } from "./lightning";
import type { ListMacaroonIDsResponse } from "./lightning";
import type { ListMacaroonIDsRequest } from "./lightning";
import type { BakeMacaroonResponse } from "./lightning";
import type { BakeMacaroonRequest } from "./lightning";
import type { ChannelBackupSubscription } from "./lightning";
import type { RestoreBackupResponse } from "./lightning";
import type { RestoreChanBackupRequest } from "./lightning";
import type { VerifyChanBackupResponse } from "./lightning";
import type { ChanBackupSnapshot } from "./lightning";
import type { ChanBackupExportRequest } from "./lightning";
import type { ChannelBackup } from "./lightning";
import type { ExportChannelBackupRequest } from "./lightning";
import type { ForwardingHistoryResponse } from "./lightning";
import type { ForwardingHistoryRequest } from "./lightning";
import type { PolicyUpdateResponse } from "./lightning";
import type { PolicyUpdateRequest } from "./lightning";
import type { FeeReportResponse } from "./lightning";
import type { FeeReportRequest } from "./lightning";
import type { DebugLevelResponse } from "./lightning";
import type { DebugLevelRequest } from "./lightning";
import type { GraphTopologyUpdate } from "./lightning";
import type { GraphTopologySubscription } from "./lightning";
import type { StopResponse } from "./lightning";
import type { StopRequest } from "./lightning";
import type { NetworkInfo } from "./lightning";
import type { NetworkInfoRequest } from "./lightning";
import type { QueryRoutesResponse } from "./lightning";
import type { QueryRoutesRequest } from "./lightning";
import type { NodeInfo } from "./lightning";
import type { NodeInfoRequest } from "./lightning";
import type { ChannelEdge } from "./lightning";
import type { ChanInfoRequest } from "./lightning";
import type { NodeMetricsResponse } from "./lightning";
import type { NodeMetricsRequest } from "./lightning";
import type { ChannelGraph } from "./lightning";
import type { ChannelGraphRequest } from "./lightning";
import type { DeleteAllPaymentsResponse } from "./lightning";
import type { DeleteAllPaymentsRequest } from "./lightning";
import type { DeletePaymentResponse } from "./lightning";
import type { DeletePaymentRequest } from "./lightning";
import type { ListPaymentsResponse } from "./lightning";
import type { ListPaymentsRequest } from "./lightning";
import type { PayReq } from "./lightning";
import type { PayReqString } from "./lightning";
import type { InvoiceSubscription } from "./lightning";
import type { PaymentHash } from "./lightning";
import type { ListInvoiceResponse } from "./lightning";
import type { ListInvoiceRequest } from "./lightning";
import type { AddInvoiceResponse } from "./lightning";
import type { Invoice } from "./lightning";
import type { SendToRouteRequest } from "./lightning";
import type { SendResponse } from "./lightning";
import type { SendRequest } from "./lightning";
import type { AbandonChannelResponse } from "./lightning";
import type { AbandonChannelRequest } from "./lightning";
import type { CloseStatusUpdate } from "./lightning";
import type { CloseChannelRequest } from "./lightning";
import type { ChannelAcceptRequest } from "./lightning";
import type { ChannelAcceptResponse } from "./lightning";
import { Lightning } from "./lightning.js";
import type { LookupHtlcResponse } from "./lightning.js";
import type { LookupHtlcRequest } from "./lightning.js";
import type { ListAliasesResponse } from "./lightning.js";
import type { ListAliasesRequest } from "./lightning.js";
import type { CustomMessage } from "./lightning.js";
import type { SubscribeCustomMessagesRequest } from "./lightning.js";
import type { SendCustomMessageResponse } from "./lightning.js";
import type { SendCustomMessageRequest } from "./lightning.js";
import type { RPCMiddlewareRequest } from "./lightning.js";
import type { RPCMiddlewareResponse } from "./lightning.js";
import type { CheckMacPermResponse } from "./lightning.js";
import type { CheckMacPermRequest } from "./lightning.js";
import type { ListPermissionsResponse } from "./lightning.js";
import type { ListPermissionsRequest } from "./lightning.js";
import type { DeleteMacaroonIDResponse } from "./lightning.js";
import type { DeleteMacaroonIDRequest } from "./lightning.js";
import type { ListMacaroonIDsResponse } from "./lightning.js";
import type { ListMacaroonIDsRequest } from "./lightning.js";
import type { BakeMacaroonResponse } from "./lightning.js";
import type { BakeMacaroonRequest } from "./lightning.js";
import type { ChannelBackupSubscription } from "./lightning.js";
import type { RestoreBackupResponse } from "./lightning.js";
import type { RestoreChanBackupRequest } from "./lightning.js";
import type { VerifyChanBackupResponse } from "./lightning.js";
import type { ChanBackupSnapshot } from "./lightning.js";
import type { ChanBackupExportRequest } from "./lightning.js";
import type { ChannelBackup } from "./lightning.js";
import type { ExportChannelBackupRequest } from "./lightning.js";
import type { ForwardingHistoryResponse } from "./lightning.js";
import type { ForwardingHistoryRequest } from "./lightning.js";
import type { PolicyUpdateResponse } from "./lightning.js";
import type { PolicyUpdateRequest } from "./lightning.js";
import type { FeeReportResponse } from "./lightning.js";
import type { FeeReportRequest } from "./lightning.js";
import type { DebugLevelResponse } from "./lightning.js";
import type { DebugLevelRequest } from "./lightning.js";
import type { GraphTopologyUpdate } from "./lightning.js";
import type { GraphTopologySubscription } from "./lightning.js";
import type { StopResponse } from "./lightning.js";
import type { StopRequest } from "./lightning.js";
import type { NetworkInfo } from "./lightning.js";
import type { NetworkInfoRequest } from "./lightning.js";
import type { QueryRoutesResponse } from "./lightning.js";
import type { QueryRoutesRequest } from "./lightning.js";
import type { NodeInfo } from "./lightning.js";
import type { NodeInfoRequest } from "./lightning.js";
import type { ChannelEdge } from "./lightning.js";
import type { ChanInfoRequest } from "./lightning.js";
import type { NodeMetricsResponse } from "./lightning.js";
import type { NodeMetricsRequest } from "./lightning.js";
import type { ChannelGraph } from "./lightning.js";
import type { ChannelGraphRequest } from "./lightning.js";
import type { DeleteAllPaymentsResponse } from "./lightning.js";
import type { DeleteAllPaymentsRequest } from "./lightning.js";
import type { DeletePaymentResponse } from "./lightning.js";
import type { DeletePaymentRequest } from "./lightning.js";
import type { ListPaymentsResponse } from "./lightning.js";
import type { ListPaymentsRequest } from "./lightning.js";
import type { PayReq } from "./lightning.js";
import type { PayReqString } from "./lightning.js";
import type { InvoiceSubscription } from "./lightning.js";
import type { PaymentHash } from "./lightning.js";
import type { ListInvoiceResponse } from "./lightning.js";
import type { ListInvoiceRequest } from "./lightning.js";
import type { AddInvoiceResponse } from "./lightning.js";
import type { Invoice } from "./lightning.js";
import type { SendToRouteRequest } from "./lightning.js";
import type { SendResponse } from "./lightning.js";
import type { SendRequest } from "./lightning.js";
import type { AbandonChannelResponse } from "./lightning.js";
import type { AbandonChannelRequest } from "./lightning.js";
import type { CloseStatusUpdate } from "./lightning.js";
import type { CloseChannelRequest } from "./lightning.js";
import type { ChannelAcceptRequest } from "./lightning.js";
import type { ChannelAcceptResponse } from "./lightning.js";
import type { DuplexStreamingCall } from "@protobuf-ts/runtime-rpc";
import type { FundingStateStepResp } from "./lightning";
import type { FundingTransitionMsg } from "./lightning";
import type { BatchOpenChannelResponse } from "./lightning";
import type { BatchOpenChannelRequest } from "./lightning";
import type { OpenStatusUpdate } from "./lightning";
import type { ChannelPoint } from "./lightning";
import type { OpenChannelRequest } from "./lightning";
import type { ClosedChannelsResponse } from "./lightning";
import type { ClosedChannelsRequest } from "./lightning";
import type { ChannelEventUpdate } from "./lightning";
import type { ChannelEventSubscription } from "./lightning";
import type { ListChannelsResponse } from "./lightning";
import type { ListChannelsRequest } from "./lightning";
import type { PendingChannelsResponse } from "./lightning";
import type { PendingChannelsRequest } from "./lightning";
import type { GetRecoveryInfoResponse } from "./lightning";
import type { GetRecoveryInfoRequest } from "./lightning";
import type { GetInfoResponse } from "./lightning";
import type { GetInfoRequest } from "./lightning";
import type { PeerEvent } from "./lightning";
import type { PeerEventSubscription } from "./lightning";
import type { ListPeersResponse } from "./lightning";
import type { ListPeersRequest } from "./lightning";
import type { DisconnectPeerResponse } from "./lightning";
import type { DisconnectPeerRequest } from "./lightning";
import type { ConnectPeerResponse } from "./lightning";
import type { ConnectPeerRequest } from "./lightning";
import type { VerifyMessageResponse } from "./lightning";
import type { VerifyMessageRequest } from "./lightning";
import type { SignMessageResponse } from "./lightning";
import type { SignMessageRequest } from "./lightning";
import type { NewAddressResponse } from "./lightning";
import type { NewAddressRequest } from "./lightning";
import type { SendManyResponse } from "./lightning";
import type { SendManyRequest } from "./lightning";
import type { Transaction } from "./lightning";
import type { FundingStateStepResp } from "./lightning.js";
import type { FundingTransitionMsg } from "./lightning.js";
import type { BatchOpenChannelResponse } from "./lightning.js";
import type { BatchOpenChannelRequest } from "./lightning.js";
import type { OpenStatusUpdate } from "./lightning.js";
import type { ChannelPoint } from "./lightning.js";
import type { OpenChannelRequest } from "./lightning.js";
import type { ClosedChannelsResponse } from "./lightning.js";
import type { ClosedChannelsRequest } from "./lightning.js";
import type { ChannelEventUpdate } from "./lightning.js";
import type { ChannelEventSubscription } from "./lightning.js";
import type { ListChannelsResponse } from "./lightning.js";
import type { ListChannelsRequest } from "./lightning.js";
import type { PendingChannelsResponse } from "./lightning.js";
import type { PendingChannelsRequest } from "./lightning.js";
import type { GetRecoveryInfoResponse } from "./lightning.js";
import type { GetRecoveryInfoRequest } from "./lightning.js";
import type { GetInfoResponse } from "./lightning.js";
import type { GetInfoRequest } from "./lightning.js";
import type { PeerEvent } from "./lightning.js";
import type { PeerEventSubscription } from "./lightning.js";
import type { ListPeersResponse } from "./lightning.js";
import type { ListPeersRequest } from "./lightning.js";
import type { DisconnectPeerResponse } from "./lightning.js";
import type { DisconnectPeerRequest } from "./lightning.js";
import type { ConnectPeerResponse } from "./lightning.js";
import type { ConnectPeerRequest } from "./lightning.js";
import type { VerifyMessageResponse } from "./lightning.js";
import type { VerifyMessageRequest } from "./lightning.js";
import type { SignMessageResponse } from "./lightning.js";
import type { SignMessageRequest } from "./lightning.js";
import type { NewAddressResponse } from "./lightning.js";
import type { NewAddressRequest } from "./lightning.js";
import type { SendManyResponse } from "./lightning.js";
import type { SendManyRequest } from "./lightning.js";
import type { Transaction } from "./lightning.js";
import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
import type { ListUnspentResponse } from "./lightning";
import type { ListUnspentRequest } from "./lightning";
import type { SendCoinsResponse } from "./lightning";
import type { SendCoinsRequest } from "./lightning";
import type { EstimateFeeResponse } from "./lightning";
import type { EstimateFeeRequest } from "./lightning";
import type { TransactionDetails } from "./lightning";
import type { GetTransactionsRequest } from "./lightning";
import type { ChannelBalanceResponse } from "./lightning";
import type { ChannelBalanceRequest } from "./lightning";
import type { ListUnspentResponse } from "./lightning.js";
import type { ListUnspentRequest } from "./lightning.js";
import type { SendCoinsResponse } from "./lightning.js";
import type { SendCoinsRequest } from "./lightning.js";
import type { EstimateFeeResponse } from "./lightning.js";
import type { EstimateFeeRequest } from "./lightning.js";
import type { TransactionDetails } from "./lightning.js";
import type { GetTransactionsRequest } from "./lightning.js";
import type { ChannelBalanceResponse } from "./lightning.js";
import type { ChannelBalanceRequest } from "./lightning.js";
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
import type { WalletBalanceResponse } from "./lightning";
import type { WalletBalanceRequest } from "./lightning";
import type { WalletBalanceResponse } from "./lightning.js";
import type { WalletBalanceRequest } from "./lightning.js";
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
//

9340
proto/lnd/lightning.d.ts vendored

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,390 +0,0 @@
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
// @generated from protobuf file "router.proto" (package "routerrpc", syntax proto3)
// tslint:disable
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import type { UpdateChanStatusResponse } from "./router";
import type { UpdateChanStatusRequest } from "./router";
import type { ForwardHtlcInterceptRequest } from "./router";
import type { ForwardHtlcInterceptResponse } from "./router";
import type { DuplexStreamingCall } from "@protobuf-ts/runtime-rpc";
import type { PaymentStatus } from "./router";
import type { HtlcEvent } from "./router";
import type { SubscribeHtlcEventsRequest } from "./router";
import type { BuildRouteResponse } from "./router";
import type { BuildRouteRequest } from "./router";
import type { QueryProbabilityResponse } from "./router";
import type { QueryProbabilityRequest } from "./router";
import type { SetMissionControlConfigResponse } from "./router";
import type { SetMissionControlConfigRequest } from "./router";
import type { GetMissionControlConfigResponse } from "./router";
import type { GetMissionControlConfigRequest } from "./router";
import type { XImportMissionControlResponse } from "./router";
import type { XImportMissionControlRequest } from "./router";
import type { QueryMissionControlResponse } from "./router";
import type { QueryMissionControlRequest } from "./router";
import type { ResetMissionControlResponse } from "./router";
import type { ResetMissionControlRequest } from "./router";
import type { HTLCAttempt } from "./lightning";
import type { SendToRouteResponse } from "./router";
import type { SendToRouteRequest } from "./router";
import type { RouteFeeResponse } from "./router";
import type { RouteFeeRequest } from "./router";
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
import type { TrackPaymentsRequest } from "./router";
import type { TrackPaymentRequest } from "./router";
import type { Payment } from "./lightning";
import type { SendPaymentRequest } from "./router";
import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
/**
* Router is a service that offers advanced interaction with the router
* subsystem of the daemon.
*
* @generated from protobuf service routerrpc.Router
*/
export interface IRouterClient {
/**
*
* SendPaymentV2 attempts to route a payment described by the passed
* PaymentRequest to the final destination. The call returns a stream of
* payment updates.
*
* @generated from protobuf rpc: SendPaymentV2(routerrpc.SendPaymentRequest) returns (stream lnrpc.Payment);
*/
sendPaymentV2(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, Payment>;
/**
*
* TrackPaymentV2 returns an update stream for the payment identified by the
* payment hash.
*
* @generated from protobuf rpc: TrackPaymentV2(routerrpc.TrackPaymentRequest) returns (stream lnrpc.Payment);
*/
trackPaymentV2(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, Payment>;
/**
*
* TrackPayments returns an update stream for every payment that is not in a
* terminal state. Note that if payments are in-flight while starting a new
* subscription, the start of the payment stream could produce out-of-order
* and/or duplicate events. In order to get updates for every in-flight
* payment attempt make sure to subscribe to this method before initiating any
* payments.
*
* @generated from protobuf rpc: TrackPayments(routerrpc.TrackPaymentsRequest) returns (stream lnrpc.Payment);
*/
trackPayments(input: TrackPaymentsRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentsRequest, Payment>;
/**
*
* EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
* may cost to send an HTLC to the target end destination.
*
* @generated from protobuf rpc: EstimateRouteFee(routerrpc.RouteFeeRequest) returns (routerrpc.RouteFeeResponse);
*/
estimateRouteFee(input: RouteFeeRequest, options?: RpcOptions): UnaryCall<RouteFeeRequest, RouteFeeResponse>;
/**
*
* Deprecated, use SendToRouteV2. SendToRoute attempts to make a payment via
* the specified route. This method differs from SendPayment in that it
* allows users to specify a full route manually. This can be used for
* things like rebalancing, and atomic swaps. It differs from the newer
* SendToRouteV2 in that it doesn't return the full HTLC information.
*
* @deprecated
* @generated from protobuf rpc: SendToRoute(routerrpc.SendToRouteRequest) returns (routerrpc.SendToRouteResponse);
*/
sendToRoute(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, SendToRouteResponse>;
/**
*
* SendToRouteV2 attempts to make a payment via the specified route. This
* method differs from SendPayment in that it allows users to specify a full
* route manually. This can be used for things like rebalancing, and atomic
* swaps.
*
* @generated from protobuf rpc: SendToRouteV2(routerrpc.SendToRouteRequest) returns (lnrpc.HTLCAttempt);
*/
sendToRouteV2(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, HTLCAttempt>;
/**
*
* ResetMissionControl clears all mission control state and starts with a clean
* slate.
*
* @generated from protobuf rpc: ResetMissionControl(routerrpc.ResetMissionControlRequest) returns (routerrpc.ResetMissionControlResponse);
*/
resetMissionControl(input: ResetMissionControlRequest, options?: RpcOptions): UnaryCall<ResetMissionControlRequest, ResetMissionControlResponse>;
/**
*
* QueryMissionControl exposes the internal mission control state to callers.
* It is a development feature.
*
* @generated from protobuf rpc: QueryMissionControl(routerrpc.QueryMissionControlRequest) returns (routerrpc.QueryMissionControlResponse);
*/
queryMissionControl(input: QueryMissionControlRequest, options?: RpcOptions): UnaryCall<QueryMissionControlRequest, QueryMissionControlResponse>;
/**
*
* XImportMissionControl is an experimental API that imports the state provided
* to the internal mission control's state, using all results which are more
* recent than our existing values. These values will only be imported
* in-memory, and will not be persisted across restarts.
*
* @generated from protobuf rpc: XImportMissionControl(routerrpc.XImportMissionControlRequest) returns (routerrpc.XImportMissionControlResponse);
*/
xImportMissionControl(input: XImportMissionControlRequest, options?: RpcOptions): UnaryCall<XImportMissionControlRequest, XImportMissionControlResponse>;
/**
*
* GetMissionControlConfig returns mission control's current config.
*
* @generated from protobuf rpc: GetMissionControlConfig(routerrpc.GetMissionControlConfigRequest) returns (routerrpc.GetMissionControlConfigResponse);
*/
getMissionControlConfig(input: GetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<GetMissionControlConfigRequest, GetMissionControlConfigResponse>;
/**
*
* SetMissionControlConfig will set mission control's config, if the config
* provided is valid.
*
* @generated from protobuf rpc: SetMissionControlConfig(routerrpc.SetMissionControlConfigRequest) returns (routerrpc.SetMissionControlConfigResponse);
*/
setMissionControlConfig(input: SetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<SetMissionControlConfigRequest, SetMissionControlConfigResponse>;
/**
*
* QueryProbability returns the current success probability estimate for a
* given node pair and amount.
*
* @generated from protobuf rpc: QueryProbability(routerrpc.QueryProbabilityRequest) returns (routerrpc.QueryProbabilityResponse);
*/
queryProbability(input: QueryProbabilityRequest, options?: RpcOptions): UnaryCall<QueryProbabilityRequest, QueryProbabilityResponse>;
/**
*
* BuildRoute builds a fully specified route based on a list of hop public
* keys. It retrieves the relevant channel policies from the graph in order to
* calculate the correct fees and time locks.
*
* @generated from protobuf rpc: BuildRoute(routerrpc.BuildRouteRequest) returns (routerrpc.BuildRouteResponse);
*/
buildRoute(input: BuildRouteRequest, options?: RpcOptions): UnaryCall<BuildRouteRequest, BuildRouteResponse>;
/**
*
* SubscribeHtlcEvents creates a uni-directional stream from the server to
* the client which delivers a stream of htlc events.
*
* @generated from protobuf rpc: SubscribeHtlcEvents(routerrpc.SubscribeHtlcEventsRequest) returns (stream routerrpc.HtlcEvent);
*/
subscribeHtlcEvents(input: SubscribeHtlcEventsRequest, options?: RpcOptions): ServerStreamingCall<SubscribeHtlcEventsRequest, HtlcEvent>;
/**
*
* Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
* described by the passed PaymentRequest to the final destination. The call
* returns a stream of payment status updates.
*
* @deprecated
* @generated from protobuf rpc: SendPayment(routerrpc.SendPaymentRequest) returns (stream routerrpc.PaymentStatus);
*/
sendPayment(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, PaymentStatus>;
/**
*
* Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
* the payment identified by the payment hash.
*
* @deprecated
* @generated from protobuf rpc: TrackPayment(routerrpc.TrackPaymentRequest) returns (stream routerrpc.PaymentStatus);
*/
trackPayment(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, PaymentStatus>;
/**
* *
* HtlcInterceptor dispatches a bi-directional streaming RPC in which
* Forwarded HTLC requests are sent to the client and the client responds with
* a boolean that tells LND if this htlc should be intercepted.
* In case of interception, the htlc can be either settled, cancelled or
* resumed later by using the ResolveHoldForward endpoint.
*
* @generated from protobuf rpc: HtlcInterceptor(stream routerrpc.ForwardHtlcInterceptResponse) returns (stream routerrpc.ForwardHtlcInterceptRequest);
*/
htlcInterceptor(options?: RpcOptions): DuplexStreamingCall<ForwardHtlcInterceptResponse, ForwardHtlcInterceptRequest>;
/**
*
* UpdateChanStatus attempts to manually set the state of a channel
* (enabled, disabled, or auto). A manual "disable" request will cause the
* channel to stay disabled until a subsequent manual request of either
* "enable" or "auto".
*
* @generated from protobuf rpc: UpdateChanStatus(routerrpc.UpdateChanStatusRequest) returns (routerrpc.UpdateChanStatusResponse);
*/
updateChanStatus(input: UpdateChanStatusRequest, options?: RpcOptions): UnaryCall<UpdateChanStatusRequest, UpdateChanStatusResponse>;
}
/**
* Router is a service that offers advanced interaction with the router
* subsystem of the daemon.
*
* @generated from protobuf service routerrpc.Router
*/
export declare class RouterClient implements IRouterClient, ServiceInfo {
private readonly _transport;
typeName: any;
methods: any;
options: any;
constructor(_transport: RpcTransport);
/**
*
* SendPaymentV2 attempts to route a payment described by the passed
* PaymentRequest to the final destination. The call returns a stream of
* payment updates.
*
* @generated from protobuf rpc: SendPaymentV2(routerrpc.SendPaymentRequest) returns (stream lnrpc.Payment);
*/
sendPaymentV2(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, Payment>;
/**
*
* TrackPaymentV2 returns an update stream for the payment identified by the
* payment hash.
*
* @generated from protobuf rpc: TrackPaymentV2(routerrpc.TrackPaymentRequest) returns (stream lnrpc.Payment);
*/
trackPaymentV2(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, Payment>;
/**
*
* TrackPayments returns an update stream for every payment that is not in a
* terminal state. Note that if payments are in-flight while starting a new
* subscription, the start of the payment stream could produce out-of-order
* and/or duplicate events. In order to get updates for every in-flight
* payment attempt make sure to subscribe to this method before initiating any
* payments.
*
* @generated from protobuf rpc: TrackPayments(routerrpc.TrackPaymentsRequest) returns (stream lnrpc.Payment);
*/
trackPayments(input: TrackPaymentsRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentsRequest, Payment>;
/**
*
* EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
* may cost to send an HTLC to the target end destination.
*
* @generated from protobuf rpc: EstimateRouteFee(routerrpc.RouteFeeRequest) returns (routerrpc.RouteFeeResponse);
*/
estimateRouteFee(input: RouteFeeRequest, options?: RpcOptions): UnaryCall<RouteFeeRequest, RouteFeeResponse>;
/**
*
* Deprecated, use SendToRouteV2. SendToRoute attempts to make a payment via
* the specified route. This method differs from SendPayment in that it
* allows users to specify a full route manually. This can be used for
* things like rebalancing, and atomic swaps. It differs from the newer
* SendToRouteV2 in that it doesn't return the full HTLC information.
*
* @deprecated
* @generated from protobuf rpc: SendToRoute(routerrpc.SendToRouteRequest) returns (routerrpc.SendToRouteResponse);
*/
sendToRoute(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, SendToRouteResponse>;
/**
*
* SendToRouteV2 attempts to make a payment via the specified route. This
* method differs from SendPayment in that it allows users to specify a full
* route manually. This can be used for things like rebalancing, and atomic
* swaps.
*
* @generated from protobuf rpc: SendToRouteV2(routerrpc.SendToRouteRequest) returns (lnrpc.HTLCAttempt);
*/
sendToRouteV2(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, HTLCAttempt>;
/**
*
* ResetMissionControl clears all mission control state and starts with a clean
* slate.
*
* @generated from protobuf rpc: ResetMissionControl(routerrpc.ResetMissionControlRequest) returns (routerrpc.ResetMissionControlResponse);
*/
resetMissionControl(input: ResetMissionControlRequest, options?: RpcOptions): UnaryCall<ResetMissionControlRequest, ResetMissionControlResponse>;
/**
*
* QueryMissionControl exposes the internal mission control state to callers.
* It is a development feature.
*
* @generated from protobuf rpc: QueryMissionControl(routerrpc.QueryMissionControlRequest) returns (routerrpc.QueryMissionControlResponse);
*/
queryMissionControl(input: QueryMissionControlRequest, options?: RpcOptions): UnaryCall<QueryMissionControlRequest, QueryMissionControlResponse>;
/**
*
* XImportMissionControl is an experimental API that imports the state provided
* to the internal mission control's state, using all results which are more
* recent than our existing values. These values will only be imported
* in-memory, and will not be persisted across restarts.
*
* @generated from protobuf rpc: XImportMissionControl(routerrpc.XImportMissionControlRequest) returns (routerrpc.XImportMissionControlResponse);
*/
xImportMissionControl(input: XImportMissionControlRequest, options?: RpcOptions): UnaryCall<XImportMissionControlRequest, XImportMissionControlResponse>;
/**
*
* GetMissionControlConfig returns mission control's current config.
*
* @generated from protobuf rpc: GetMissionControlConfig(routerrpc.GetMissionControlConfigRequest) returns (routerrpc.GetMissionControlConfigResponse);
*/
getMissionControlConfig(input: GetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<GetMissionControlConfigRequest, GetMissionControlConfigResponse>;
/**
*
* SetMissionControlConfig will set mission control's config, if the config
* provided is valid.
*
* @generated from protobuf rpc: SetMissionControlConfig(routerrpc.SetMissionControlConfigRequest) returns (routerrpc.SetMissionControlConfigResponse);
*/
setMissionControlConfig(input: SetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<SetMissionControlConfigRequest, SetMissionControlConfigResponse>;
/**
*
* QueryProbability returns the current success probability estimate for a
* given node pair and amount.
*
* @generated from protobuf rpc: QueryProbability(routerrpc.QueryProbabilityRequest) returns (routerrpc.QueryProbabilityResponse);
*/
queryProbability(input: QueryProbabilityRequest, options?: RpcOptions): UnaryCall<QueryProbabilityRequest, QueryProbabilityResponse>;
/**
*
* BuildRoute builds a fully specified route based on a list of hop public
* keys. It retrieves the relevant channel policies from the graph in order to
* calculate the correct fees and time locks.
*
* @generated from protobuf rpc: BuildRoute(routerrpc.BuildRouteRequest) returns (routerrpc.BuildRouteResponse);
*/
buildRoute(input: BuildRouteRequest, options?: RpcOptions): UnaryCall<BuildRouteRequest, BuildRouteResponse>;
/**
*
* SubscribeHtlcEvents creates a uni-directional stream from the server to
* the client which delivers a stream of htlc events.
*
* @generated from protobuf rpc: SubscribeHtlcEvents(routerrpc.SubscribeHtlcEventsRequest) returns (stream routerrpc.HtlcEvent);
*/
subscribeHtlcEvents(input: SubscribeHtlcEventsRequest, options?: RpcOptions): ServerStreamingCall<SubscribeHtlcEventsRequest, HtlcEvent>;
/**
*
* Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
* described by the passed PaymentRequest to the final destination. The call
* returns a stream of payment status updates.
*
* @deprecated
* @generated from protobuf rpc: SendPayment(routerrpc.SendPaymentRequest) returns (stream routerrpc.PaymentStatus);
*/
sendPayment(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, PaymentStatus>;
/**
*
* Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
* the payment identified by the payment hash.
*
* @deprecated
* @generated from protobuf rpc: TrackPayment(routerrpc.TrackPaymentRequest) returns (stream routerrpc.PaymentStatus);
*/
trackPayment(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, PaymentStatus>;
/**
* *
* HtlcInterceptor dispatches a bi-directional streaming RPC in which
* Forwarded HTLC requests are sent to the client and the client responds with
* a boolean that tells LND if this htlc should be intercepted.
* In case of interception, the htlc can be either settled, cancelled or
* resumed later by using the ResolveHoldForward endpoint.
*
* @generated from protobuf rpc: HtlcInterceptor(stream routerrpc.ForwardHtlcInterceptResponse) returns (stream routerrpc.ForwardHtlcInterceptRequest);
*/
htlcInterceptor(options?: RpcOptions): DuplexStreamingCall<ForwardHtlcInterceptResponse, ForwardHtlcInterceptRequest>;
/**
*
* UpdateChanStatus attempts to manually set the state of a channel
* (enabled, disabled, or auto). A manual "disable" request will cause the
* channel to stay disabled until a subsequent manual request of either
* "enable" or "auto".
*
* @generated from protobuf rpc: UpdateChanStatus(routerrpc.UpdateChanStatusRequest) returns (routerrpc.UpdateChanStatusResponse);
*/
updateChanStatus(input: UpdateChanStatusRequest, options?: RpcOptions): UnaryCall<UpdateChanStatusRequest, UpdateChanStatusResponse>;
}

View file

@ -1,238 +0,0 @@
// @generated by protobuf-ts 2.8.1 with parameter long_type_number,output_javascript
// @generated from protobuf file "router.proto" (package "routerrpc", syntax proto3)
// tslint:disable
import { Router } from "./router.js";
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
/**
* Router is a service that offers advanced interaction with the router
* subsystem of the daemon.
*
* @generated from protobuf service routerrpc.Router
*/
export class RouterClient {
constructor(_transport) {
this._transport = _transport;
this.typeName = Router.typeName;
this.methods = Router.methods;
this.options = Router.options;
}
/**
*
* SendPaymentV2 attempts to route a payment described by the passed
* PaymentRequest to the final destination. The call returns a stream of
* payment updates.
*
* @generated from protobuf rpc: SendPaymentV2(routerrpc.SendPaymentRequest) returns (stream lnrpc.Payment);
*/
sendPaymentV2(input, options) {
const method = this.methods[0], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
*
* TrackPaymentV2 returns an update stream for the payment identified by the
* payment hash.
*
* @generated from protobuf rpc: TrackPaymentV2(routerrpc.TrackPaymentRequest) returns (stream lnrpc.Payment);
*/
trackPaymentV2(input, options) {
const method = this.methods[1], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
*
* TrackPayments returns an update stream for every payment that is not in a
* terminal state. Note that if payments are in-flight while starting a new
* subscription, the start of the payment stream could produce out-of-order
* and/or duplicate events. In order to get updates for every in-flight
* payment attempt make sure to subscribe to this method before initiating any
* payments.
*
* @generated from protobuf rpc: TrackPayments(routerrpc.TrackPaymentsRequest) returns (stream lnrpc.Payment);
*/
trackPayments(input, options) {
const method = this.methods[2], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
*
* EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
* may cost to send an HTLC to the target end destination.
*
* @generated from protobuf rpc: EstimateRouteFee(routerrpc.RouteFeeRequest) returns (routerrpc.RouteFeeResponse);
*/
estimateRouteFee(input, options) {
const method = this.methods[3], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* Deprecated, use SendToRouteV2. SendToRoute attempts to make a payment via
* the specified route. This method differs from SendPayment in that it
* allows users to specify a full route manually. This can be used for
* things like rebalancing, and atomic swaps. It differs from the newer
* SendToRouteV2 in that it doesn't return the full HTLC information.
*
* @deprecated
* @generated from protobuf rpc: SendToRoute(routerrpc.SendToRouteRequest) returns (routerrpc.SendToRouteResponse);
*/
sendToRoute(input, options) {
const method = this.methods[4], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* SendToRouteV2 attempts to make a payment via the specified route. This
* method differs from SendPayment in that it allows users to specify a full
* route manually. This can be used for things like rebalancing, and atomic
* swaps.
*
* @generated from protobuf rpc: SendToRouteV2(routerrpc.SendToRouteRequest) returns (lnrpc.HTLCAttempt);
*/
sendToRouteV2(input, options) {
const method = this.methods[5], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* ResetMissionControl clears all mission control state and starts with a clean
* slate.
*
* @generated from protobuf rpc: ResetMissionControl(routerrpc.ResetMissionControlRequest) returns (routerrpc.ResetMissionControlResponse);
*/
resetMissionControl(input, options) {
const method = this.methods[6], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* QueryMissionControl exposes the internal mission control state to callers.
* It is a development feature.
*
* @generated from protobuf rpc: QueryMissionControl(routerrpc.QueryMissionControlRequest) returns (routerrpc.QueryMissionControlResponse);
*/
queryMissionControl(input, options) {
const method = this.methods[7], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* XImportMissionControl is an experimental API that imports the state provided
* to the internal mission control's state, using all results which are more
* recent than our existing values. These values will only be imported
* in-memory, and will not be persisted across restarts.
*
* @generated from protobuf rpc: XImportMissionControl(routerrpc.XImportMissionControlRequest) returns (routerrpc.XImportMissionControlResponse);
*/
xImportMissionControl(input, options) {
const method = this.methods[8], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* GetMissionControlConfig returns mission control's current config.
*
* @generated from protobuf rpc: GetMissionControlConfig(routerrpc.GetMissionControlConfigRequest) returns (routerrpc.GetMissionControlConfigResponse);
*/
getMissionControlConfig(input, options) {
const method = this.methods[9], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* SetMissionControlConfig will set mission control's config, if the config
* provided is valid.
*
* @generated from protobuf rpc: SetMissionControlConfig(routerrpc.SetMissionControlConfigRequest) returns (routerrpc.SetMissionControlConfigResponse);
*/
setMissionControlConfig(input, options) {
const method = this.methods[10], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* QueryProbability returns the current success probability estimate for a
* given node pair and amount.
*
* @generated from protobuf rpc: QueryProbability(routerrpc.QueryProbabilityRequest) returns (routerrpc.QueryProbabilityResponse);
*/
queryProbability(input, options) {
const method = this.methods[11], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* BuildRoute builds a fully specified route based on a list of hop public
* keys. It retrieves the relevant channel policies from the graph in order to
* calculate the correct fees and time locks.
*
* @generated from protobuf rpc: BuildRoute(routerrpc.BuildRouteRequest) returns (routerrpc.BuildRouteResponse);
*/
buildRoute(input, options) {
const method = this.methods[12], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
/**
*
* SubscribeHtlcEvents creates a uni-directional stream from the server to
* the client which delivers a stream of htlc events.
*
* @generated from protobuf rpc: SubscribeHtlcEvents(routerrpc.SubscribeHtlcEventsRequest) returns (stream routerrpc.HtlcEvent);
*/
subscribeHtlcEvents(input, options) {
const method = this.methods[13], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
*
* Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
* described by the passed PaymentRequest to the final destination. The call
* returns a stream of payment status updates.
*
* @deprecated
* @generated from protobuf rpc: SendPayment(routerrpc.SendPaymentRequest) returns (stream routerrpc.PaymentStatus);
*/
sendPayment(input, options) {
const method = this.methods[14], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
*
* Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
* the payment identified by the payment hash.
*
* @deprecated
* @generated from protobuf rpc: TrackPayment(routerrpc.TrackPaymentRequest) returns (stream routerrpc.PaymentStatus);
*/
trackPayment(input, options) {
const method = this.methods[15], opt = this._transport.mergeOptions(options);
return stackIntercept("serverStreaming", this._transport, method, opt, input);
}
/**
* *
* HtlcInterceptor dispatches a bi-directional streaming RPC in which
* Forwarded HTLC requests are sent to the client and the client responds with
* a boolean that tells LND if this htlc should be intercepted.
* In case of interception, the htlc can be either settled, cancelled or
* resumed later by using the ResolveHoldForward endpoint.
*
* @generated from protobuf rpc: HtlcInterceptor(stream routerrpc.ForwardHtlcInterceptResponse) returns (stream routerrpc.ForwardHtlcInterceptRequest);
*/
htlcInterceptor(options) {
const method = this.methods[16], opt = this._transport.mergeOptions(options);
return stackIntercept("duplex", this._transport, method, opt);
}
/**
*
* UpdateChanStatus attempts to manually set the state of a channel
* (enabled, disabled, or auto). A manual "disable" request will cause the
* channel to stay disabled until a subsequent manual request of either
* "enable" or "auto".
*
* @generated from protobuf rpc: UpdateChanStatus(routerrpc.UpdateChanStatusRequest) returns (routerrpc.UpdateChanStatusResponse);
*/
updateChanStatus(input, options) {
const method = this.methods[17], opt = this._transport.mergeOptions(options);
return stackIntercept("unary", this._transport, method, opt, input);
}
}

View file

@ -3,40 +3,40 @@
// tslint:disable
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import { Router } from "./router";
import type { UpdateChanStatusResponse } from "./router";
import type { UpdateChanStatusRequest } from "./router";
import type { ForwardHtlcInterceptRequest } from "./router";
import type { ForwardHtlcInterceptResponse } from "./router";
import { Router } from "./router.js";
import type { UpdateChanStatusResponse } from "./router.js";
import type { UpdateChanStatusRequest } from "./router.js";
import type { ForwardHtlcInterceptRequest } from "./router.js";
import type { ForwardHtlcInterceptResponse } from "./router.js";
import type { DuplexStreamingCall } from "@protobuf-ts/runtime-rpc";
import type { PaymentStatus } from "./router";
import type { HtlcEvent } from "./router";
import type { SubscribeHtlcEventsRequest } from "./router";
import type { BuildRouteResponse } from "./router";
import type { BuildRouteRequest } from "./router";
import type { QueryProbabilityResponse } from "./router";
import type { QueryProbabilityRequest } from "./router";
import type { SetMissionControlConfigResponse } from "./router";
import type { SetMissionControlConfigRequest } from "./router";
import type { GetMissionControlConfigResponse } from "./router";
import type { GetMissionControlConfigRequest } from "./router";
import type { XImportMissionControlResponse } from "./router";
import type { XImportMissionControlRequest } from "./router";
import type { QueryMissionControlResponse } from "./router";
import type { QueryMissionControlRequest } from "./router";
import type { ResetMissionControlResponse } from "./router";
import type { ResetMissionControlRequest } from "./router";
import type { HTLCAttempt } from "./lightning";
import type { SendToRouteResponse } from "./router";
import type { SendToRouteRequest } from "./router";
import type { RouteFeeResponse } from "./router";
import type { RouteFeeRequest } from "./router";
import type { PaymentStatus } from "./router.js";
import type { HtlcEvent } from "./router.js";
import type { SubscribeHtlcEventsRequest } from "./router.js";
import type { BuildRouteResponse } from "./router.js";
import type { BuildRouteRequest } from "./router.js";
import type { QueryProbabilityResponse } from "./router.js";
import type { QueryProbabilityRequest } from "./router.js";
import type { SetMissionControlConfigResponse } from "./router.js";
import type { SetMissionControlConfigRequest } from "./router.js";
import type { GetMissionControlConfigResponse } from "./router.js";
import type { GetMissionControlConfigRequest } from "./router.js";
import type { XImportMissionControlResponse } from "./router.js";
import type { XImportMissionControlRequest } from "./router.js";
import type { QueryMissionControlResponse } from "./router.js";
import type { QueryMissionControlRequest } from "./router.js";
import type { ResetMissionControlResponse } from "./router.js";
import type { ResetMissionControlRequest } from "./router.js";
import type { HTLCAttempt } from "./lightning.js";
import type { SendToRouteResponse } from "./router.js";
import type { SendToRouteRequest } from "./router.js";
import type { RouteFeeResponse } from "./router.js";
import type { RouteFeeRequest } from "./router.js";
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
import type { TrackPaymentsRequest } from "./router";
import type { TrackPaymentRequest } from "./router";
import type { TrackPaymentsRequest } from "./router.js";
import type { TrackPaymentRequest } from "./router.js";
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
import type { Payment } from "./lightning";
import type { SendPaymentRequest } from "./router";
import type { Payment } from "./lightning.js";
import type { SendPaymentRequest } from "./router.js";
import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
/**

1649
proto/lnd/router.d.ts vendored

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
// @generated by protobuf-ts 2.8.1 with parameter long_type_number
// @generated from protobuf file "router.proto" (package "routerrpc", syntax proto3)
// tslint:disable
import { Payment } from "./lightning";
import { Payment } from "./lightning.js";
import { ServiceType } from "@protobuf-ts/runtime-rpc";
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { IBinaryWriter } from "@protobuf-ts/runtime";
@ -13,13 +13,13 @@ import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { ChannelPoint } from "./lightning";
import { HTLCAttempt } from "./lightning";
import { Failure_FailureCode } from "./lightning";
import { Failure } from "./lightning";
import { Route } from "./lightning";
import { FeatureBit } from "./lightning";
import { RouteHint } from "./lightning";
import { ChannelPoint } from "./lightning.js";
import { HTLCAttempt } from "./lightning.js";
import { Failure_FailureCode } from "./lightning.js";
import { Failure } from "./lightning.js";
import { Route } from "./lightning.js";
import { FeatureBit } from "./lightning.js";
import { RouteHint } from "./lightning.js";
/**
* @generated from protobuf message routerrpc.SendPaymentRequest
*/

Binary file not shown.

View file

@ -114,9 +114,38 @@ service LightningPub {
option (http_method) = "post";
option (http_route) = "/api/user/open/channel";
}
rpc GetOpenChannelLNURL(structs.Empty) returns (structs.GetOpenChannelLNURLResponse){
rpc GetLnurlWithdrawLink(structs.Empty) returns (structs.LnurlLinkResponse){
option (auth_type) = "User";
option (http_method) = "get";
option (http_route) = "/api/user/lnurl_withdraw/link";
}
rpc GetLnurlWithdrawInfo(structs.Empty) returns (structs.LnurlWithdrawInfoResponse){
option (auth_type) = "Guest";
option (http_method) = "get";
option (http_route) = "/api/guest/lnurl_withdraw/info";
option (query) = {items: ["k1"]};
}
rpc HandleLnurlWithdraw(structs.Empty) returns (structs.Empty){
option (auth_type) = "Guest";
option (http_method) = "get";
option (http_route) = "/api/guest/lnurl_withdraw/handle";
option (query) = {items: ["k1", "pr"]};
}
rpc GetLnurlPayInfo(structs.Empty)returns (structs.LnurlPayInfoResponse) {
option (auth_type) = "Guest";
option (http_method) = "get";
option (http_route) = "/api/guest/lnurl_pay/info";
option (query) = {items: ["k1"]};
}
rpc HandleLnurlPay(structs.Empty)returns (structs.HandleLnurlPayResponse) {
option (auth_type) = "Guest";
option (http_method) = "get";
option (http_route) = "/api/guest/lnurl_pay/handle";
option (query) = {items: ["k1", "amount"]};
}
rpc GetLNURLChannelLink(structs.Empty) returns (structs.LnurlLinkResponse){
option (auth_type) = "User";
option (http_method) = "post";
option (http_route) = "/api/user/lnurl_channel";
option (http_route) = "/api/user/lnurl_channel/url";
}
}

View file

@ -8,12 +8,12 @@ message Empty {}
message EncryptionExchangeRequest {
string public_key = 1;
string device_id = 2;
string publicKey = 1;
string deviceId = 2;
}
message LndGetInfoRequest {
int64 node_id = 1;
int64 nodeId = 1;
}
message LndGetInfoResponse {
@ -25,23 +25,24 @@ enum AddressType {
TAPROOT_PUBKEY = 2;
}
message NewAddressRequest {
AddressType address_type = 1;
AddressType addressType = 1;
}
message NewAddressResponse{
string address = 1;
}
message PayAddressRequest{
string address = 1;
int64 amout_sats = 2;
int64 target_conf = 3;
int64 amoutSats = 2;
int64 targetConf = 3;
}
message PayAddressResponse{
string tx_id = 1;
string txId = 1;
}
message NewInvoiceRequest{
int64 amount_sats = 1;
int64 amountSats = 1;
string memo = 2;
}
message NewInvoiceResponse{
@ -59,28 +60,50 @@ message PayInvoiceResponse{
message OpenChannelRequest{
string destination = 1;
int64 funding_amount = 2;
int64 push_amount = 3;
string close_address = 4;
int64 fundingAmount = 2;
int64 pushAmount = 3;
string closeAddress = 4;
}
message OpenChannelResponse{
string channel_id = 1;
string channelId = 1;
}
message GetOpenChannelLNURLResponse{
message LnurlLinkResponse{
string lnurl = 1;
string k1 = 2;
}
message LnurlWithdrawInfoResponse {
string tag = 1;
string callback = 2;
string k1 = 3;
string defaultDescription = 4;
int64 minWithdrawable = 5; // millisatoshi - unsafe overflow possible, but very unlikely
int64 maxWithdrawable = 6; // millisatoshi - unsafe overflow possible, but very unlikely
string balanceCheck = 7;
string payLink = 8;
}
message LnurlPayInfoResponse {
string tag = 1;
string callback = 2;
int64 maxSendable = 3; // millisatoshi - unsafe overflow possible, but very unlikely
int64 minSendable = 4; // millisatoshi - unsafe overflow possible, but very unlikely
string metadata = 5;
}
message HandleLnurlPayResponse {
string pr = 1;
repeated Empty routes = 2;
}
message AddUserRequest{
string callback_url = 1;
string callbackUrl = 1;
string name = 2;
string secret = 3;
}
message AddUserResponse{
string user_id = 1;
string auth_token = 2;
string userId = 1;
string authToken = 2;
}
message AuthUserRequest{
@ -89,6 +112,6 @@ message AuthUserRequest{
}
message AuthUserResponse{
string user_id = 1;
string auth_token = 2;
string userId = 1;
string authToken = 2;
}

View file

@ -8,6 +8,7 @@ import Main, { LoadMainSettingsFromEnv } from './services/main/index.js'
import * as Types from '../proto/autogenerated/ts/types.js';
import nostrMiddleware from './nostrMiddleware.js'
import { LoadNosrtSettingsFromEnv } from './services/nostr/index.js';
import { expect } from 'chai';
import NostrHandler from './services/nostr/index.js'
@ -35,12 +36,13 @@ const clientNostr = new NostrHandler({
privateKey: clientPrivateKey,
publicKey: clientPublicKey,
relays: settings.relays
}, (event, getContent) => {
console.log(getContent())
}, (event) => {
console.log(event.content)
})
const mainHandler = new Main(LoadMainSettingsFromEnv(true)) // TODO - test env file
const mainSettings = LoadMainSettingsFromEnv(true)
const mainHandler = new Main(mainSettings) // TODO - test env file
const serverMethods = GetServerMethods(mainHandler)
nostrMiddleware(serverMethods, mainHandler, {
const serverNostr = nostrMiddleware(serverMethods, mainHandler, {
allowedPubs: [clientPublicKey],
privateKey: serverPrivateKey,
publicKey: serverPublicKey,
@ -55,6 +57,8 @@ export const setup = async () => {
server.Listen(testPort)
}
export const teardown = async () => {
clientNostr.Stop()
serverNostr.Stop()
mainHandler.lnd.Stop()
server.Close()
}
@ -64,20 +68,33 @@ export default async (d: (message: string, failure?: boolean) => void) => {
await client.Health()
d("health ok")
console.log(await client.LndGetInfo({ node_id: 0 }))
console.log(await client.LndGetInfo({ nodeId: 0 }))
d("lnd info ok")
const res = await client.AddUser({ name: "test", callback_url: "http://...", secret: "shhhhhht" })
const res = await client.AddUser({ name: "test", callbackUrl: "http://...", secret: "shhhhhht" })
if (res.status === 'ERROR') throw new Error(res.reason)
console.log(res.result)
const user = await mainHandler.storage.GetUser(res.result.user_id)
console.log(res)
const user = await mainHandler.storage.GetUser(res.userId)
console.log(user)
userAuthHeader = res.result.auth_token
userAuthHeader = res.authToken
d("create user ok")
console.log(await client.NewAddress({ address_type: Types.AddressType.WITNESS_PUBKEY_HASH }))
console.log(await client.NewAddress({ addressType: Types.AddressType.WITNESS_PUBKEY_HASH }))
d("new address ok")
await new Promise(res => setTimeout(res, 2000))
clientNostr.Send(serverPublicKey, JSON.stringify({ requestId: "a", method: '/api/user/chain/new', body: { address_type: 'WITNESS_PUBKEY_HASH' } }))
const lnurlWithdrawLink = await client.GetLnurlWithdrawLink()
if (lnurlWithdrawLink.status === 'ERROR') throw new Error(lnurlWithdrawLink.reason)
const lnurlWithdrawInfo = await client.GetLnurlWithdrawInfo({ k1: lnurlWithdrawLink.k1 })
const expectedInfo: Partial<Types.LnurlWithdrawInfoResponse> & { status: 'OK' } = {
status: 'OK',
tag: "withdrawRequest",
defaultDescription: "lnurl withdraw from lightning.pub",
maxWithdrawable: 0,
minWithdrawable: 0,
}
expect(lnurlWithdrawInfo).to.deep.include(expectedInfo)
d("lnurl info ok")
}

View file

@ -1,10 +1,8 @@
import Main from "./services/main/index.js"
import Nostr from "./services/nostr/index.js"
import { NostrSettings } from "./services/nostr/index.js"
import { NostrSettings } from "./services/nostr/handler.js"
import * as Types from '../proto/autogenerated/ts/types.js'
import GetServerMethods from './services/serverMethods/index.js'
import serverOptions from './auth.js';
const handledEvents: string[] = [] // TODO: - big memory leak here, add TTL
const handledRequests: string[] = [] // TODO: - big memory leak here, add TTL
type EventRequest = {
requestId: string
@ -14,30 +12,22 @@ type EventRequest = {
query: Record<string, string>
}
export default (serverMethods: Types.ServerMethods, mainHandler: Main, nostrSettings: NostrSettings) => {
export default (serverMethods: Types.ServerMethods, mainHandler: Main, nostrSettings: NostrSettings): Nostr => {
// TODO: - move to codegen
const nostr = new Nostr(nostrSettings,
async (event, getContent) => {
//@ts-ignore
const eventId = event.id
if (handledEvents.includes(eventId)) {
console.log("event already handled")
return
}
handledEvents.push(eventId)
const nostrPub = event.pubkey as string
if (!nostrSettings.allowedPubs.includes(nostrPub)) {
async (event) => {
if (!nostrSettings.allowedPubs.includes(event.pub)) {
console.log("nostr pub not allowed")
return
}
let nostrUser = await mainHandler.storage.FindNostrUser(nostrPub)
let nostrUser = await mainHandler.storage.FindNostrUser(event.pub)
if (!nostrUser) {
nostrUser = await mainHandler.storage.AddNostrUser(nostrPub)
nostrUser = await mainHandler.storage.AddNostrUser(event.pub)
}
let j: EventRequest
try {
j = JSON.parse(getContent())
j = JSON.parse(event.content)
} catch {
console.error("invalid json event received", event.content)
return
@ -51,14 +41,15 @@ export default (serverMethods: Types.ServerMethods, mainHandler: Main, nostrSett
case '/api/user/chain/new':
const error = Types.NewAddressRequestValidate(j.body)
if (error !== null) {
console.error("invalid request from", nostrPub, j)// TODO: dont dox
console.error("invalid request from", event.pub, j)// TODO: dont dox
return // TODO: respond
}
if (!serverMethods.NewAddress) {
throw new Error("unimplemented NewInvoice")
}
const res = await serverMethods.NewAddress({ user_id: nostrUser.user.user_id }, j.body)
nostr.Send(nostrPub, JSON.stringify({ ...res, requestId: j.requestId }))
nostr.Send(event.pub, JSON.stringify({ ...res, requestId: j.requestId }))
}
})
return nostr
}

View file

@ -2,9 +2,10 @@ import 'dotenv/config' // TODO - test env
import { expect } from 'chai'
import LndHandler, { LoadLndSettingsFromEnv } from './index.js'
import * as Types from '../../../proto/autogenerated/ts/types.js';
const lnd = new LndHandler(LoadLndSettingsFromEnv(true), console.log, console.log)
let lnd: LndHandler
export const ignore = true
export const setup = async () => {
lnd = new LndHandler(LoadLndSettingsFromEnv(true), console.log, console.log)
await lnd.Warmup()
}
export const teardown = () => {

View file

@ -140,9 +140,9 @@ export default class {
return res.response
}
async NewInvoice(value: number): Promise<AddInvoiceResponse> {
async NewInvoice(value: number, memo: string): Promise<AddInvoiceResponse> {
this.checkReady()
const res = await this.lightning.addInvoice(AddInvoiceReq(value), DeadLineMetadata())
const res = await this.lightning.addInvoice(AddInvoiceReq(value, memo), DeadLineMetadata())
return res.response
}
@ -155,6 +155,10 @@ export default class {
return Math.ceil(amount * this.settings.feeRateLimit + this.settings.feeFixedLimit);
}
GetMaxWithinLimit(amount: number) {
return Math.max(0, Math.floor(amount * (1 - this.settings.feeRateLimit) - this.settings.feeFixedLimit))
}
async PayInvoice(invoice: string, amount: number, feeLimit: number): Promise<Payment> {
this.checkReady()
const abortController = new AbortController()

View file

@ -1,4 +1,5 @@
import jwt from 'jsonwebtoken'
import { bech32 } from 'bech32'
import Storage, { LoadStorageSettingsFromEnv, StorageSettings } from '../storage/index.js'
import * as Types from '../../../proto/autogenerated/ts/types.js'
import LND, { AddressPaidCb, InvoicePaidCb, LndSettings, LoadLndSettingsFromEnv } from '../lnd/index.js'
@ -11,6 +12,7 @@ export type MainSettings = {
outgoingTxFee: number
incomingInvoiceFee: number
outgoingInvoiceFee: number
serviceUrl: string
}
export const LoadMainSettingsFromEnv = (test = false): MainSettings => {
return {
@ -21,6 +23,7 @@ export const LoadMainSettingsFromEnv = (test = false): MainSettings => {
outgoingTxFee: EnvMustBeInteger("SERVICE_FEE_OUTGOING_TX_PERCENT") / 100,
incomingInvoiceFee: EnvMustBeInteger("SERVICE_FEE_INCOMING_INVOICE_PERCENT") / 100,
outgoingInvoiceFee: EnvMustBeInteger("SERVICE_FEE_OUTGOING_INVOICE_PERCENT") / 100,
serviceUrl: EnvMustBeNonEmptyString("SERVICE_URL")
}
}
enum ActionType {
@ -30,6 +33,7 @@ enum ActionType {
OUTGOING_INVOICE = "OUTGOING_INVOICE"
}
const defaultLnurlPayMetadata = '[["text/plain", "lnurl pay to Lightning.pub"]]'
export default class {
storage: Storage
lnd: LND
@ -91,13 +95,13 @@ export default class {
async AddBasicUser(req: Types.AddUserRequest): Promise<Types.AddUserResponse> {
const { user } = await this.storage.AddBasicUser(req.name, req.secret)
return {
user_id: user.user_id,
auth_token: this.SignUserToken(user.user_id)
userId: user.user_id,
authToken: this.SignUserToken(user.user_id)
}
}
async NewAddress(userId: string, req: Types.NewAddressRequest): Promise<Types.NewAddressResponse> {
const res = await this.lnd.NewAddress(req.address_type)
const res = await this.lnd.NewAddress(req.addressType)
const userAddress = await this.storage.AddUserAddress(userId, res.address)
return {
address: userAddress.address
@ -105,7 +109,7 @@ export default class {
}
async NewInvoice(userId: string, req: Types.NewInvoiceRequest): Promise<Types.NewInvoiceResponse> {
const res = await this.lnd.NewInvoice(req.amount_sats)
const res = await this.lnd.NewInvoice(req.amountSats, req.memo)
const userInvoice = await this.storage.AddUserInvoice(userId, res.paymentRequest)
return {
invoice: userInvoice.invoice
@ -123,6 +127,11 @@ export default class {
})
}
GetMaxPayableInvoice(balance: number): number {
const maxWithinServiceFee = Math.max(0, Math.floor(balance * (1 - this.settings.outgoingInvoiceFee)))
return this.lnd.GetMaxWithinLimit(maxWithinServiceFee)
}
async PayInvoice(userId: string, req: Types.PayInvoiceRequest): Promise<Types.PayInvoiceResponse> {
const decoded = await this.lnd.DecodeInvoice(req.invoice)
if (decoded.numSatoshis !== 0 && req.amount !== 0) {
@ -148,22 +157,98 @@ export default class {
}
async PayAddress(userId: string, req: Types.PayAddressRequest): Promise<Types.PayAddressResponse> {
const estimate = await this.lnd.EstimateChainFees(req.address, req.amout_sats, req.target_conf)
const estimate = await this.lnd.EstimateChainFees(req.address, req.amoutSats, req.targetConf)
const satPerVByte = Number(estimate.satPerVbyte)
const chainFees = Number(estimate.feeSat)
const total = req.amout_sats + chainFees
const serviceFee = this.getServiceFee(ActionType.OUTGOING_INVOICE, req.amout_sats)
const total = req.amoutSats + chainFees
const serviceFee = this.getServiceFee(ActionType.OUTGOING_INVOICE, req.amoutSats)
await this.lockUserWithMinBalance(userId, total + serviceFee)
const payment = await this.lnd.PayAddress(req.address, req.amout_sats, satPerVByte)
const payment = await this.lnd.PayAddress(req.address, req.amoutSats, satPerVByte)
await this.storage.DecrementUserBalance(userId, total + serviceFee)
await this.storage.UnlockUser(userId)
await this.storage.AddUserTransactionPayment(userId, req.address, payment.txid, 0, req.amout_sats, chainFees, serviceFee)
await this.storage.AddUserTransactionPayment(userId, req.address, payment.txid, 0, req.amoutSats, chainFees, serviceFee)
return {
tx_id: payment.txid
txId: payment.txid
}
}
balanceCheckUrl(k1: string): string {
return `${this.settings.serviceUrl}/api/guest/lnurl_withdraw/info?k1=${k1}`
}
async GetLnurlChannelLink(userId: string): Promise<Types.LnurlLinkResponse> {
const key = await this.storage.AddUserEphemeralKey(userId, 'balanceCheck')
return {
lnurl: this.encodeLnurl(this.balanceCheckUrl(key.key)),
k1: key.key
}
}
async GetLnurlWithdrawInfo(balanceCheckK1: string): Promise<Types.LnurlWithdrawInfoResponse> {
const key = await this.storage.UseUserEphemeralKey(balanceCheckK1, 'balanceCheck')
const maxWithdrawable = this.GetMaxPayableInvoice(key.user.balance_sats)
const callbackK1 = await this.storage.AddUserEphemeralKey(key.user.user_id, 'withdraw')
const newBalanceCheckK1 = await this.storage.AddUserEphemeralKey(key.user.user_id, 'balanceCheck')
const payInfoK1 = await this.storage.AddUserEphemeralKey(key.user.user_id, 'pay')
return {
tag: "withdrawRequest",
callback: `${this.settings.serviceUrl}/api/guest/lnurl_withdraw/handle`,
defaultDescription: "lnurl withdraw from lightning.pub",
k1: callbackK1.key,
maxWithdrawable: maxWithdrawable,
minWithdrawable: 0,
balanceCheck: this.balanceCheckUrl(newBalanceCheckK1.key),
payLink: `${this.settings.serviceUrl}/api/guest/lnurl_pay/info?k1=${payInfoK1.key}`,
}
}
async HandleLnurlWithdraw(k1: string, invoice: string): Promise<void> {
const key = await this.storage.UseUserEphemeralKey(k1, 'withdraw')
this.PayInvoice(key.user.user_id, {
invoice: invoice,
amount: 0
}).catch(err => {
console.error("error sending payment for lnurl withdraw to ", key.user.user_id, err)
})
}
async GetLnurlPayInfo(payInfoK1: string): Promise<Types.LnurlPayInfoResponse> {
const key = await this.storage.UseUserEphemeralKey(payInfoK1, 'payInfo')
const payK1 = await this.storage.AddUserEphemeralKey(key.user.user_id, 'pay')
return {
tag: 'payRequest',
callback: `${this.settings.serviceUrl}/api/guest/lnurl_pay/handle?k1=${payK1.key}`,
maxSendable: 10000000,
minSendable: 0,
metadata: defaultLnurlPayMetadata
}
}
async HandleLnurlPay(payK1: string, amountMillis: number): Promise<Types.HandleLnurlPayResponse> {
const key = await this.storage.UseUserEphemeralKey(payK1, 'pay')
const sats = amountMillis / 1000
if (!Number.isInteger(sats)) {
throw new Error("millisats amount must be integer sats amount")
}
const invoice = await this.NewInvoice(key.user.user_id, {
amountSats: sats,
memo: defaultLnurlPayMetadata
})
return {
pr: invoice.invoice,
routes: []
}
}
async OpenChannel(userId: string, req: Types.OpenChannelRequest): Promise<Types.OpenChannelResponse> { throw new Error("WIP") }
encodeLnurl(base: string) {
if (!base || typeof base !== 'string') {
throw new Error("provided string for lnurl encode is not a string or is an empty string")
}
let words = bech32.toWords(Buffer.from(base, 'utf8'));
return bech32.encode('lnurl', words, 1023);
}
}

View file

@ -0,0 +1,124 @@
import { relayPool, Subscription, Event } from 'nostr-tools'
//@ts-ignore
import { decrypt, encrypt } from 'nostr-tools/nip04.js'
const handledEvents: string[] = [] // TODO: - big memory leak here, add TTL
export type NostrSettings = {
privateKey: string
publicKey: string
relays: string[]
allowedPubs: string[]
}
export type NostrEvent = {
id: string
pub: string
content: string
}
type SettingsRequest = {
type: 'settings'
settings: NostrSettings
}
type SendRequest = {
type: 'send'
pub: string
message: string
}
type ReadyResponse = {
type: 'ready'
}
type EventResponse = {
type: 'event'
event: NostrEvent
}
export type ChildProcessRequest = SettingsRequest | SendRequest
export type ChildProcessResponse = ReadyResponse | EventResponse
const send = (message: ChildProcessResponse) => {
if (process.send) {
process.send(message)
}
}
let subProcessHandler: Handler | undefined
process.on("message", (message: ChildProcessRequest) => {
switch (message.type) {
case 'settings':
initSubprocessHandler(message.settings)
break
case 'send':
sendToNostr(message.pub, message.message)
default:
console.error("unknown nostr request", message)
break
}
})
const initSubprocessHandler = (settings: NostrSettings) => {
if (subProcessHandler) {
console.error("nostr settings ignored since handler already exists")
return
}
subProcessHandler = new Handler(settings, event => {
send({
type: 'event',
event: event
})
})
}
const sendToNostr = (pub: string, message: string) => {
if (!subProcessHandler) {
console.error("nostr was not initialized")
return
}
subProcessHandler.Send(pub, message)
}
send({ type: 'ready' })
export default class Handler {
pool = relayPool()
settings: NostrSettings
sub: Subscription
constructor(settings: NostrSettings, eventCallback: (event: NostrEvent) => void) {
this.settings = settings
this.pool.setPrivateKey(settings.privateKey)
settings.relays.forEach(relay => {
try {
this.pool.addRelay(relay, { read: true, write: true })
} catch (e) {
console.error("cannot add relay:", relay)
}
});
this.sub = this.pool.sub({
//@ts-ignore
filter: {
since: Math.ceil(Date.now() / 1000),
kinds: [4],
'#p': [settings.publicKey],
},
cb: async (e, relay) => {
if (e.kind !== 4 || !e.pubkey) {
return
}
//@ts-ignore
const eventId = e.id as string
if (handledEvents.includes(eventId)) {
console.log("event already handled")
return
}
handledEvents.push(eventId)
eventCallback({ id: eventId, content: decrypt(this.settings.privateKey, e.pubkey, e.content), pub: e.pubkey })
}
})
}
Send(nostrPub: string, message: string) {
this.pool.publish({
content: encrypt(this.settings.privateKey, nostrPub, message),
created_at: Math.floor(Date.now() / 1000),
kind: 4,
pubkey: this.settings.publicKey,
//@ts-ignore
tags: [['p', nostrPub]]
}, (status, url) => {
console.log(status, url) // TODO
})
}
}

View file

@ -1,9 +1,8 @@
import 'dotenv/config' // TODO - test env
import { Buffer } from 'buffer'
import { generatePrivateKey, getPublicKey, relayPool } from 'nostr-tools'
//@ts-ignore
import { decrypt, encrypt } from 'nostr-tools/nip04.js'
import NostrHandler, { LoadNosrtSettingsFromEnv, NostrSettings } from './index.js'
import { generatePrivateKey, getPublicKey } from 'nostr-tools'
import NostrHandler, { LoadNosrtSettingsFromEnv } from './index.js'
import { expect } from 'chai'
export const ignore = true
const settings = LoadNosrtSettingsFromEnv(true)
@ -13,28 +12,36 @@ const clientPublicKey = getPublicKey(Buffer.from(clientPrivateKey, "hex"))
const serverPrivateKey = generatePrivateKey()
const serverPublicKey = getPublicKey(Buffer.from(serverPrivateKey, "hex"))
let clientNostr: NostrHandler
let serverNostr: NostrHandler
export default async (d: (message: string, failure?: boolean) => void) => {
const clientNostr = new NostrHandler({
let receivedServerEvents = 0
let latestReceivedServerEvent = ""
export const setup = () => {
clientNostr = new NostrHandler({
allowedPubs: [],
privateKey: clientPrivateKey,
publicKey: clientPublicKey,
relays: settings.relays
}, (event, getContent) => {
}, (event) => {
})
let receivedServerEvents = 0
let latestReceivedServerEvent = ""
const serverNostr = new NostrHandler({
serverNostr = new NostrHandler({
allowedPubs: [clientPublicKey],
privateKey: serverPrivateKey,
publicKey: serverPublicKey,
relays: settings.relays
}, (event, getContent) => {
}, (event) => {
receivedServerEvents++
latestReceivedServerEvent = getContent()
latestReceivedServerEvent = event.content
})
}
export const teardown = () => {
clientNostr.Stop()
serverNostr.Stop()
}
export default async (d: (message: string, failure?: boolean) => void) => {
await new Promise(res => setTimeout(res, 2000))
clientNostr.Send(serverPublicKey, "test")
await new Promise(res => setTimeout(res, 1000))

View file

@ -1,15 +1,8 @@
import { relayPool, Subscription, Event } from 'nostr-tools'
//@ts-ignore
import { decrypt, encrypt } from 'nostr-tools/nip04.js'
import { EnvMustBeNonEmptyString } from '../helpers/envParser.js';
export type NostrSettings = {
privateKey: string
publicKey: string
relays: string[]
allowedPubs: string[]
}
export const LoadNosrtSettingsFromEnv = (test = false): NostrSettings => {
import { ChildProcess, fork } from 'child_process'
import { EnvMustBeNonEmptyString } from "../helpers/envParser.js"
import { NostrSettings, NostrEvent, ChildProcessRequest, ChildProcessResponse } from "./handler.js"
type EventCallback = (event: NostrEvent) => void
export const LoadNosrtSettingsFromEnv = (test = false) => {
return {
allowedPubs: EnvMustBeNonEmptyString("NOSTR_ALLOWED_PUBS").split(' '),
privateKey: EnvMustBeNonEmptyString("NOSTR_PRIVATE_KEY"),
@ -17,48 +10,34 @@ export const LoadNosrtSettingsFromEnv = (test = false): NostrSettings => {
relays: EnvMustBeNonEmptyString("NOSTR_RELAYS").split(' ')
}
}
export default class {
pool = relayPool()
export default class NostrSubprocess {
settings: NostrSettings
sub: Subscription
constructor(settings: NostrSettings, eventCallback: (event: Event, getContent: () => string) => void) {
this.settings = settings
this.pool.setPrivateKey(settings.privateKey)
settings.relays.forEach(relay => {
try {
this.pool.addRelay(relay, { read: true, write: true })
} catch (e) {
console.error("cannot add relay:", relay)
}
});
this.sub = this.pool.sub({
//@ts-ignore
filter: {
since: Math.ceil(Date.now() / 1000),
kinds: [4],
'#p': [settings.publicKey],
},
cb: async (e, relay) => {
if (e.kind !== 4 || !e.pubkey) {
return
}
eventCallback(e, () => {
return decrypt(this.settings.privateKey, e.pubkey, e.content)
})
childProcess: ChildProcess
constructor(settings: NostrSettings, eventCallback: EventCallback) {
this.childProcess = fork("./build/src/services/nostr/handler")
this.childProcess.on("error", console.error)
this.childProcess.on("message", (message: ChildProcessResponse) => {
switch (message.type) {
case 'ready':
this.sendToChildProcess({ type: 'settings', settings: settings })
break;
case 'event':
eventCallback(message.event)
break
default:
console.error("unknown nostr event response", message)
break;
}
})
}
sendToChildProcess(message: ChildProcessRequest) {
this.childProcess.send(message)
}
Send(nostrPub: string, message: string) {
this.pool.publish({
content: encrypt(this.settings.privateKey, nostrPub, message),
created_at: Math.floor(Date.now() / 1000),
kind: 4,
pubkey: this.settings.publicKey,
//@ts-ignore
tags: [['p', nostrPub]]
}, (status, url) => {
console.log(status, url) // TODO
})
Send(pub: string, message: string) {
this.sendToChildProcess({ type: 'send', pub: pub, message: message })
}
Stop() {
this.childProcess.kill()
}
}

View file

@ -2,52 +2,67 @@ import * as Types from '../../../proto/autogenerated/ts/types.js'
import Main from '../main/index.js'
export default (mainHandler: Main): Types.ServerMethods => {
return {
EncryptionExchange: async (ctx: Types.EncryptionExchange_Context, req: Types.EncryptionExchangeRequest): Promise<void> => { },
Health: async (ctx: Types.Health_Context): Promise<void> => { },
LndGetInfo: async (ctx: Types.LndGetInfo_Context): Promise<Types.LndGetInfoResponse> => {
EncryptionExchange: async (ctx, req) => { },
Health: async (ctx) => { },
LndGetInfo: async (ctx) => {
const info = await mainHandler.lnd.GetInfo()
return { alias: info.alias }
},
AddUser: async (ctx: Types.GuestContext, req: Types.AddUserRequest): Promise<Types.AddUserResponse> => {
AddUser: async (ctx, req) => {
const err = Types.AddUserRequestValidate(req, {
callback_url_CustomCheck: url => url.startsWith("http://") || url.startsWith("https://"),
callbackUrl_CustomCheck: url => url.startsWith("http://") || url.startsWith("https://"),
name_CustomCheck: name => name.length > 0,
secret_CustomCheck: secret => secret.length >= 8
})
if (err != null) throw new Error(err.message)
return mainHandler.AddBasicUser(req)
},
AuthUser: async (ctx: Types.GuestContext, req: Types.AuthUserRequest): Promise<Types.AuthUserResponse> => {
AuthUser: async (ctx, req) => {
throw new Error("unimplemented")
},
OpenChannel: async (ctx: Types.UserContext, req: Types.OpenChannelRequest): Promise<Types.OpenChannelResponse> => {
OpenChannel: async (ctx, req) => {
const err = Types.OpenChannelRequestValidate(req, {
funding_amount_CustomCheck: amt => amt > 0,
push_amount_CustomCheck: amt => amt > 0,
fundingAmount_CustomCheck: amt => amt > 0,
pushAmount_CustomCheck: amt => amt > 0,
destination_CustomCheck: dest => dest !== ""
})
if (err != null) throw new Error(err.message)
return mainHandler.OpenChannel(ctx.user_id, req)
},
NewAddress: async (ctx: Types.UserContext, req: Types.NewAddressRequest): Promise<Types.NewAddressResponse> => {
NewAddress: async (ctx, req) => {
return mainHandler.NewAddress(ctx.user_id, req)
},
PayAddress: async (ctx: Types.UserContext, req: Types.PayAddressRequest): Promise<Types.PayAddressResponse> => {
PayAddress: async (ctx, req) => {
const err = Types.PayAddressRequestValidate(req, {
address_CustomCheck: addr => addr !== '',
amout_sats_CustomCheck: amt => amt > 0,
target_conf_CustomCheck: target => target > 0
amoutSats_CustomCheck: amt => amt > 0,
targetConf_CustomCheck: target => target > 0
})
if (err != null) throw new Error(err.message)
return mainHandler.PayAddress(ctx.user_id, req)
},
NewInvoice: async (ctx: Types.UserContext, req: Types.NewInvoiceRequest): Promise<Types.NewInvoiceResponse> => {
NewInvoice: async (ctx, req) => {
throw new Error("unimplemented")
},
PayInvoice: async (ctx: Types.UserContext, req: Types.PayInvoiceRequest): Promise<Types.PayInvoiceResponse> => {
PayInvoice: async (ctx, req) => {
throw new Error("unimplemented")
},
GetOpenChannelLNURL: async (ctx: Types.UserContext): Promise<Types.GetOpenChannelLNURLResponse> => {
GetLnurlWithdrawLink: async (ctx) => {
return mainHandler.GetLnurlChannelLink(ctx.user_id)
},
GetLnurlWithdrawInfo: async (ctx) => {
if (!ctx.k1) {
throw new Error("invalid lnurl to get info")
}
return mainHandler.GetLnurlWithdrawInfo(ctx.k1)
},
HandleLnurlWithdraw: async (ctx) => {
if (!ctx.k1 || !ctx.pr) {
throw new Error("invalid lnurl to handle")
}
await mainHandler.HandleLnurlWithdraw(ctx.k1, ctx.pr)
},
GetLNURLChannelLink: async (ctx) => {
throw new Error("unimplemented")
}
}

View file

@ -9,6 +9,7 @@ import { EnvMustBeNonEmptyString } from "../helpers/envParser.js"
import { UserTransactionPayment } from "./entity/UserTransactionPayment.js"
import { UserNostrAuth } from "./entity/UserNostrAuth.js"
import { UserBasicAuth } from "./entity/UserBasicAuth.js"
import { UserEphemeralKey } from "./entity/UserEphemeralKey.js"
export type DbSettings = {
databaseFile: string
}
@ -20,7 +21,7 @@ export default async (settings: DbSettings) => {
type: "sqlite",
database: settings.databaseFile,
//logging: true,
entities: [User, UserReceivingInvoice, UserReceivingAddress, AddressReceivingTransaction, UserInvoicePayment, UserTransactionPayment, UserNostrAuth, UserBasicAuth],
entities: [User, UserReceivingInvoice, UserReceivingAddress, AddressReceivingTransaction, UserInvoicePayment, UserTransactionPayment, UserNostrAuth, UserBasicAuth, UserEphemeralKey],
synchronize: true
}).initialize()
}

View file

@ -1,4 +1,4 @@
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne, JoinColumn } from "typeorm"
import { UserReceivingAddress } from "./UserReceivingAddress.js"
@ -9,7 +9,8 @@ export class AddressReceivingTransaction {
@PrimaryGeneratedColumn()
serial_id: number
@ManyToOne(type => UserReceivingAddress)
@ManyToOne(type => UserReceivingAddress, { eager: true })
@JoinColumn()
user_address: UserReceivingAddress
@Column()

View file

@ -1,4 +1,4 @@
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne, JoinColumn } from "typeorm"
import { User } from "./User.js"
@Entity()
@ -7,7 +7,8 @@ export class UserBasicAuth {
@PrimaryGeneratedColumn()
serial_id: number
@ManyToOne(type => User)
@ManyToOne(type => User, { eager: true })
@JoinColumn()
user: User
@Column()

View file

@ -0,0 +1,20 @@
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne, JoinColumn } from "typeorm"
import { User } from "./User.js"
export type EphemeralKeyType = 'balanceCheck' | 'payInfo' | 'pay' | 'withdraw'
@Entity()
export class UserEphemeralKey {
@PrimaryGeneratedColumn()
serial_id: number
@ManyToOne(type => User, { eager: true })
@JoinColumn()
user: User
@Column()
@Index({ unique: true })
key: string
@Column()
type: EphemeralKeyType
}

View file

@ -1,4 +1,4 @@
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne, JoinColumn } from "typeorm"
import { User } from "./User.js"
@Entity()
@ -7,7 +7,8 @@ export class UserInvoicePayment {
@PrimaryGeneratedColumn()
serial_id: number
@ManyToOne(type => User)
@ManyToOne(type => User, { eager: true })
@JoinColumn()
user: User
@Column()

View file

@ -1,4 +1,4 @@
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne, JoinColumn } from "typeorm"
import { User } from "./User.js"
@Entity()
@ -7,7 +7,8 @@ export class UserNostrAuth {
@PrimaryGeneratedColumn()
serial_id: number
@ManyToOne(type => User)
@ManyToOne(type => User, { eager: true })
@JoinColumn()
user: User
@Column()

View file

@ -1,4 +1,4 @@
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne, JoinColumn } from "typeorm"
import { User } from "./User.js"
@Entity()
@ -7,7 +7,8 @@ export class UserReceivingAddress {
@PrimaryGeneratedColumn()
serial_id: number
@ManyToOne(type => User)
@ManyToOne(type => User, { eager: true })
@JoinColumn()
user: User
@Column()

View file

@ -1,4 +1,4 @@
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne, JoinColumn } from "typeorm"
import { User } from "./User.js"
@Entity()
@ -7,7 +7,8 @@ export class UserReceivingInvoice {
@PrimaryGeneratedColumn()
serial_id: number
@ManyToOne(type => User)
@ManyToOne(type => User, { eager: true })
@JoinColumn()
user: User
@Column()

View file

@ -1,4 +1,4 @@
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne, JoinColumn } from "typeorm"
import { User } from "./User.js"
@Entity()
@ -8,7 +8,8 @@ export class UserTransactionPayment {
@PrimaryGeneratedColumn()
serial_id: number
@ManyToOne(type => User)
@ManyToOne(type => User, { eager: true })
@JoinColumn()
user: User
@Column()

View file

@ -9,6 +9,7 @@ import { UserInvoicePayment } from "./entity/UserInvoicePayment.js";
import { UserTransactionPayment } from "./entity/UserTransactionPayment.js";
import { UserNostrAuth } from "./entity/UserNostrAuth.js";
import { UserBasicAuth } from "./entity/UserBasicAuth.js";
import { EphemeralKeyType, UserEphemeralKey } from "./entity/UserEphemeralKey.js";
export type StorageSettings = {
dbSettings: DbSettings
}
@ -185,5 +186,26 @@ export default class {
}
}
async AddUserEphemeralKey(userId: string, keyType: EphemeralKeyType, entityManager = this.DB): Promise<UserEphemeralKey> {
const newKey = entityManager.getRepository(UserEphemeralKey).create({
user: await this.GetUser(userId, entityManager),
key: crypto.randomBytes(31).toString('hex'),
type: keyType
})
return entityManager.getRepository(UserEphemeralKey).save(newKey)
}
async UseUserEphemeralKey(key: string, keyType: EphemeralKeyType, entityManager = this.DB): Promise<UserEphemeralKey> {
const found = await entityManager.getRepository(UserEphemeralKey).findOne({
where: {
key: key,
type: keyType
}
})
if (!found) {
throw new Error("the provided ephemeral key is invalid")
}
await entityManager.getRepository(UserEphemeralKey).delete(found.serial_id)
return found
}
}

View file

@ -1,4 +1,3 @@
import { LightningClientImpl } from '../proto/lnd/lightning'
const failure = true
export default async (describe: (message: string, failure?: boolean) => void) => {
describe("all good")

View file

@ -9,9 +9,10 @@ type TestModule = {
}
const start = async () => {
const files = await globby("**/*.spec.ts")
const files = await globby("**/*.spec.js")
for (const file of files) {
const module = await import(`./${file}`) as TestModule
console.log(file)
const module = await import(`./${file.slice("build/src/".length)}`) as TestModule
await runTestFile(file, module)
}
@ -19,10 +20,11 @@ const start = async () => {
const runTestFile = async (fileName: string, mod: TestModule) => {
const d = getDescribe(fileName)
if (mod.ignore) {
d("-----ignoring file-----")
return
}
const d = getDescribe(fileName)
try {
if (mod.setup) {
d("setup started")