wip
This commit is contained in:
parent
4f550a937f
commit
f39025df53
39 changed files with 7571 additions and 1892 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -7,3 +7,4 @@ temp/
|
|||
.env
|
||||
build/
|
||||
db.sqlite
|
||||
.key/
|
||||
5
example.env
Normal file
5
example.env
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
LND_ADDRESS=
|
||||
LND_CERT_PATH=
|
||||
LND_MACAROON_PATH=
|
||||
DATABASE_FILE=db.sqlite
|
||||
JWT_SECRET=bigsecrethere
|
||||
217
package-lock.json
generated
217
package-lock.json
generated
|
|
@ -23,6 +23,7 @@
|
|||
"eccrypto": "^1.1.6",
|
||||
"express": "^4.18.1",
|
||||
"grpc-tools": "^1.11.2",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"lodash": "^4.17.21",
|
||||
"pg": "^8.4.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
|
|
@ -39,6 +40,7 @@
|
|||
"devDependencies": {
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/eccrypto": "^1.1.3",
|
||||
"@types/jsonwebtoken": "^8.5.9",
|
||||
"@types/lodash": "^4.14.182",
|
||||
"@types/node": "^16.11.10",
|
||||
"@types/uuid": "^8.3.4",
|
||||
|
|
@ -386,6 +388,15 @@
|
|||
"integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/jsonwebtoken": {
|
||||
"version": "8.5.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.5.9.tgz",
|
||||
"integrity": "sha512-272FMnFGzAVMGtu9tkr29hRL6bZj4Zs1KZNeHLnKqAvp06tAIcarTMwOh8/8bz4FmKRcMxZhZNeUAQsNLoiPhg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/lodash": {
|
||||
"version": "4.14.182",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.182.tgz",
|
||||
|
|
@ -807,6 +818,11 @@
|
|||
"ieee754": "^1.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer-equal-constant-time": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
|
||||
"integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="
|
||||
},
|
||||
"node_modules/buffer-from": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
|
|
@ -1242,6 +1258,14 @@
|
|||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ecdsa-sig-formatter": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
|
||||
"integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
|
|
@ -1886,6 +1910,59 @@
|
|||
"json5": "lib/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/jsonwebtoken": {
|
||||
"version": "8.5.1",
|
||||
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz",
|
||||
"integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==",
|
||||
"dependencies": {
|
||||
"jws": "^3.2.2",
|
||||
"lodash.includes": "^4.3.0",
|
||||
"lodash.isboolean": "^3.0.3",
|
||||
"lodash.isinteger": "^4.0.4",
|
||||
"lodash.isnumber": "^3.0.3",
|
||||
"lodash.isplainobject": "^4.0.6",
|
||||
"lodash.isstring": "^4.0.1",
|
||||
"lodash.once": "^4.0.0",
|
||||
"ms": "^2.1.1",
|
||||
"semver": "^5.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4",
|
||||
"npm": ">=1.4.28"
|
||||
}
|
||||
},
|
||||
"node_modules/jsonwebtoken/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=="
|
||||
},
|
||||
"node_modules/jsonwebtoken/node_modules/semver": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||
"bin": {
|
||||
"semver": "bin/semver"
|
||||
}
|
||||
},
|
||||
"node_modules/jwa": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
|
||||
"integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==",
|
||||
"dependencies": {
|
||||
"buffer-equal-constant-time": "1.0.1",
|
||||
"ecdsa-sig-formatter": "1.0.11",
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/jws": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz",
|
||||
"integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==",
|
||||
"dependencies": {
|
||||
"jwa": "^1.4.1",
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
|
|
@ -1896,6 +1973,41 @@
|
|||
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
|
||||
"integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY="
|
||||
},
|
||||
"node_modules/lodash.includes": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
||||
"integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w=="
|
||||
},
|
||||
"node_modules/lodash.isboolean": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
|
||||
"integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg=="
|
||||
},
|
||||
"node_modules/lodash.isinteger": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
|
||||
"integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA=="
|
||||
},
|
||||
"node_modules/lodash.isnumber": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
|
||||
"integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw=="
|
||||
},
|
||||
"node_modules/lodash.isplainobject": {
|
||||
"version": "4.0.6",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
|
||||
"integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA=="
|
||||
},
|
||||
"node_modules/lodash.isstring": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",
|
||||
"integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw=="
|
||||
},
|
||||
"node_modules/lodash.once": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
|
||||
"integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg=="
|
||||
},
|
||||
"node_modules/long": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
|
||||
|
|
@ -4010,6 +4122,15 @@
|
|||
"integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=",
|
||||
"dev": true
|
||||
},
|
||||
"@types/jsonwebtoken": {
|
||||
"version": "8.5.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.5.9.tgz",
|
||||
"integrity": "sha512-272FMnFGzAVMGtu9tkr29hRL6bZj4Zs1KZNeHLnKqAvp06tAIcarTMwOh8/8bz4FmKRcMxZhZNeUAQsNLoiPhg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/lodash": {
|
||||
"version": "4.14.182",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.182.tgz",
|
||||
|
|
@ -4344,6 +4465,11 @@
|
|||
"ieee754": "^1.2.1"
|
||||
}
|
||||
},
|
||||
"buffer-equal-constant-time": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
|
||||
"integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="
|
||||
},
|
||||
"buffer-from": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
|
|
@ -4680,6 +4806,14 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"ecdsa-sig-formatter": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
|
||||
"integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
|
||||
"requires": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
|
|
@ -5184,6 +5318,54 @@
|
|||
"minimist": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"jsonwebtoken": {
|
||||
"version": "8.5.1",
|
||||
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz",
|
||||
"integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==",
|
||||
"requires": {
|
||||
"jws": "^3.2.2",
|
||||
"lodash.includes": "^4.3.0",
|
||||
"lodash.isboolean": "^3.0.3",
|
||||
"lodash.isinteger": "^4.0.4",
|
||||
"lodash.isnumber": "^3.0.3",
|
||||
"lodash.isplainobject": "^4.0.6",
|
||||
"lodash.isstring": "^4.0.1",
|
||||
"lodash.once": "^4.0.0",
|
||||
"ms": "^2.1.1",
|
||||
"semver": "^5.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"jwa": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
|
||||
"integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==",
|
||||
"requires": {
|
||||
"buffer-equal-constant-time": "1.0.1",
|
||||
"ecdsa-sig-formatter": "1.0.11",
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"jws": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz",
|
||||
"integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==",
|
||||
"requires": {
|
||||
"jwa": "^1.4.1",
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
|
|
@ -5194,6 +5376,41 @@
|
|||
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
|
||||
"integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY="
|
||||
},
|
||||
"lodash.includes": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
||||
"integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w=="
|
||||
},
|
||||
"lodash.isboolean": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
|
||||
"integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg=="
|
||||
},
|
||||
"lodash.isinteger": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
|
||||
"integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA=="
|
||||
},
|
||||
"lodash.isnumber": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
|
||||
"integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw=="
|
||||
},
|
||||
"lodash.isplainobject": {
|
||||
"version": "4.0.6",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
|
||||
"integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA=="
|
||||
},
|
||||
"lodash.isstring": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",
|
||||
"integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw=="
|
||||
},
|
||||
"lodash.once": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
|
||||
"integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg=="
|
||||
},
|
||||
"long": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
|
||||
|
|
|
|||
|
|
@ -36,7 +36,9 @@
|
|||
"eccrypto": "^1.1.6",
|
||||
"express": "^4.18.1",
|
||||
"grpc-tools": "^1.11.2",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"lodash": "^4.17.21",
|
||||
"pg": "^8.4.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"rxjs": "^7.5.5",
|
||||
|
|
@ -46,17 +48,17 @@
|
|||
"ts-proto": "^1.112.1",
|
||||
"typeorm": "0.3.10",
|
||||
"typescript": "^4.6.4",
|
||||
"uuid": "^8.3.2",
|
||||
"pg": "^8.4.0"
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/eccrypto": "^1.1.3",
|
||||
"@types/jsonwebtoken": "^8.5.9",
|
||||
"@types/lodash": "^4.14.182",
|
||||
"@types/node": "^16.11.10",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"testyts": "^1.5.0",
|
||||
"ts-node": "10.7.0",
|
||||
"@types/node": "^16.11.10",
|
||||
"typescript": "4.5.2"
|
||||
}
|
||||
}
|
||||
2
proto/CODEGEN.md
Normal file
2
proto/CODEGEN.md
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
create lnd classes: `npx protoc -I ./others --ts_out=./lnd others/*`
|
||||
create server classes: `npx protoc -I ./service --pub_out=. service/*`
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
([]*main.Method) (len=11 cap=16) {
|
||||
(*main.Method)(0xc0002b6730)({
|
||||
(*main.Method)(0xc0002886e0)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=5) "Empty",
|
||||
hasZeroFields: (bool) true
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
name: (string) (len=5) "Empty",
|
||||
hasZeroFields: (bool) true
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f2480)({
|
||||
authType: (*main.supportedAuth)(0xc0003c3dd0)({
|
||||
opts: (*main.methodOptions)(0xc0003cc420)({
|
||||
authType: (*main.supportedAuth)(0xc000379fb0)({
|
||||
id: (string) (len=5) "guest",
|
||||
name: (string) (len=5) "Guest",
|
||||
encrypted: (bool) false,
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b6780)({
|
||||
(*main.Method)(0xc000288730)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=25) "EncryptionExchangeRequest",
|
||||
hasZeroFields: (bool) false
|
||||
|
|
@ -35,8 +35,8 @@
|
|||
name: (string) (len=5) "Empty",
|
||||
hasZeroFields: (bool) true
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f2600)({
|
||||
authType: (*main.supportedAuth)(0xc0003c3ec0)({
|
||||
opts: (*main.methodOptions)(0xc0003cc5a0)({
|
||||
authType: (*main.supportedAuth)(0xc0003d60c0)({
|
||||
id: (string) (len=5) "guest",
|
||||
name: (string) (len=5) "Guest",
|
||||
encrypted: (bool) false,
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b67d0)({
|
||||
(*main.Method)(0xc000288780)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=17) "LndGetInfoRequest",
|
||||
hasZeroFields: (bool) false
|
||||
|
|
@ -61,8 +61,8 @@
|
|||
name: (string) (len=18) "LndGetInfoResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f2780)({
|
||||
authType: (*main.supportedAuth)(0xc0003c3f80)({
|
||||
opts: (*main.methodOptions)(0xc0003cc720)({
|
||||
authType: (*main.supportedAuth)(0xc0003d6180)({
|
||||
id: (string) (len=5) "admin",
|
||||
name: (string) (len=5) "Admin",
|
||||
encrypted: (bool) true,
|
||||
|
|
@ -78,7 +78,7 @@
|
|||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b6820)({
|
||||
(*main.Method)(0xc0002887d0)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=14) "AddUserRequest",
|
||||
hasZeroFields: (bool) false
|
||||
|
|
@ -88,8 +88,8 @@
|
|||
name: (string) (len=15) "AddUserResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f2900)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe060)({
|
||||
opts: (*main.methodOptions)(0xc0003cc8a0)({
|
||||
authType: (*main.supportedAuth)(0xc0003d6240)({
|
||||
id: (string) (len=5) "guest",
|
||||
name: (string) (len=5) "Guest",
|
||||
encrypted: (bool) false,
|
||||
|
|
@ -104,7 +104,7 @@
|
|||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b6870)({
|
||||
(*main.Method)(0xc000288820)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=15) "AuthUserRequest",
|
||||
hasZeroFields: (bool) false
|
||||
|
|
@ -114,8 +114,8 @@
|
|||
name: (string) (len=16) "AuthUserResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f2a80)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe120)({
|
||||
opts: (*main.methodOptions)(0xc0003cca20)({
|
||||
authType: (*main.supportedAuth)(0xc0003d6300)({
|
||||
id: (string) (len=5) "guest",
|
||||
name: (string) (len=5) "Guest",
|
||||
encrypted: (bool) false,
|
||||
|
|
@ -130,18 +130,18 @@
|
|||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b6910)({
|
||||
(*main.Method)(0xc0002888c0)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=5) "Empty",
|
||||
hasZeroFields: (bool) true
|
||||
name: (string) (len=17) "NewAddressRequest",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
name: (string) (len=10) "NewAddress",
|
||||
out: (main.MethodMessage) {
|
||||
name: (string) (len=18) "NewAddressResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f2c00)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe1e0)({
|
||||
opts: (*main.methodOptions)(0xc0003ccba0)({
|
||||
authType: (*main.supportedAuth)(0xc0003d63c0)({
|
||||
id: (string) (len=4) "user",
|
||||
name: (string) (len=4) "User",
|
||||
encrypted: (bool) false,
|
||||
|
|
@ -157,7 +157,7 @@
|
|||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b69b0)({
|
||||
(*main.Method)(0xc000288960)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=17) "PayAddressRequest",
|
||||
hasZeroFields: (bool) false
|
||||
|
|
@ -167,8 +167,8 @@
|
|||
name: (string) (len=18) "PayAddressResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f2d80)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe2a0)({
|
||||
opts: (*main.methodOptions)(0xc0003ccd20)({
|
||||
authType: (*main.supportedAuth)(0xc0003d6480)({
|
||||
id: (string) (len=4) "user",
|
||||
name: (string) (len=4) "User",
|
||||
encrypted: (bool) false,
|
||||
|
|
@ -184,7 +184,7 @@
|
|||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b6a50)({
|
||||
(*main.Method)(0xc000288a00)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=17) "NewInvoiceRequest",
|
||||
hasZeroFields: (bool) false
|
||||
|
|
@ -194,8 +194,8 @@
|
|||
name: (string) (len=18) "NewInvoiceResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f2f00)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe360)({
|
||||
opts: (*main.methodOptions)(0xc0003ccea0)({
|
||||
authType: (*main.supportedAuth)(0xc0003d6540)({
|
||||
id: (string) (len=4) "user",
|
||||
name: (string) (len=4) "User",
|
||||
encrypted: (bool) false,
|
||||
|
|
@ -211,7 +211,7 @@
|
|||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b6af0)({
|
||||
(*main.Method)(0xc000288aa0)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=17) "PayInvoiceRequest",
|
||||
hasZeroFields: (bool) false
|
||||
|
|
@ -221,8 +221,8 @@
|
|||
name: (string) (len=18) "PayInvoiceResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f3080)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe420)({
|
||||
opts: (*main.methodOptions)(0xc0003cd020)({
|
||||
authType: (*main.supportedAuth)(0xc0003d6600)({
|
||||
id: (string) (len=4) "user",
|
||||
name: (string) (len=4) "User",
|
||||
encrypted: (bool) false,
|
||||
|
|
@ -238,7 +238,7 @@
|
|||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b6b90)({
|
||||
(*main.Method)(0xc000288b40)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=18) "OpenChannelRequest",
|
||||
hasZeroFields: (bool) false
|
||||
|
|
@ -248,8 +248,8 @@
|
|||
name: (string) (len=19) "OpenChannelResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f3200)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe4e0)({
|
||||
opts: (*main.methodOptions)(0xc0003cd1a0)({
|
||||
authType: (*main.supportedAuth)(0xc0003d66c0)({
|
||||
id: (string) (len=4) "user",
|
||||
name: (string) (len=4) "User",
|
||||
encrypted: (bool) false,
|
||||
|
|
@ -265,7 +265,7 @@
|
|||
query: ([]string) <nil>
|
||||
})
|
||||
}),
|
||||
(*main.Method)(0xc0002b6be0)({
|
||||
(*main.Method)(0xc000288b90)({
|
||||
in: (main.MethodMessage) {
|
||||
name: (string) (len=5) "Empty",
|
||||
hasZeroFields: (bool) true
|
||||
|
|
@ -275,8 +275,8 @@
|
|||
name: (string) (len=27) "GetOpenChannelLNURLResponse",
|
||||
hasZeroFields: (bool) false
|
||||
},
|
||||
opts: (*main.methodOptions)(0xc0003f3380)({
|
||||
authType: (*main.supportedAuth)(0xc0003fe5a0)({
|
||||
opts: (*main.methodOptions)(0xc0003cd320)({
|
||||
authType: (*main.supportedAuth)(0xc0003d6780)({
|
||||
id: (string) (len=4) "user",
|
||||
name: (string) (len=4) "User",
|
||||
encrypted: (bool) false,
|
||||
|
|
@ -294,83 +294,32 @@
|
|||
})
|
||||
}
|
||||
|
||||
([]*main.Enum) <nil>
|
||||
([]*main.Enum) (len=1 cap=1) {
|
||||
(*main.Enum)(0xc000379860)({
|
||||
name: (string) (len=11) "AddressType",
|
||||
values: ([]main.EnumValue) (len=3 cap=4) {
|
||||
(main.EnumValue) {
|
||||
number: (int64) 0,
|
||||
name: (string) (len=19) "WITNESS_PUBKEY_HASH"
|
||||
},
|
||||
(main.EnumValue) {
|
||||
number: (int64) 1,
|
||||
name: (string) (len=18) "NESTED_PUBKEY_HASH"
|
||||
},
|
||||
(main.EnumValue) {
|
||||
number: (int64) 2,
|
||||
name: (string) (len=14) "TAPROOT_PUBKEY"
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
(map[string]*main.Message) (len=18) {
|
||||
(string) (len=18) "LndGetInfoResponse": (*main.Message)(0xc0002470c0)({
|
||||
fullName: (string) (len=18) "LndGetInfoResponse",
|
||||
name: (string) (len=18) "LndGetInfoResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c3260)({
|
||||
name: (string) (len=5) "alias",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=18) "NewInvoiceResponse": (*main.Message)(0xc000247200)({
|
||||
fullName: (string) (len=18) "NewInvoiceResponse",
|
||||
name: (string) (len=18) "NewInvoiceResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c3380)({
|
||||
name: (string) (len=7) "invoice",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=17) "PayInvoiceRequest": (*main.Message)(0xc000247240)({
|
||||
fullName: (string) (len=17) "PayInvoiceRequest",
|
||||
name: (string) (len=17) "PayInvoiceRequest",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c33b0)({
|
||||
name: (string) (len=6) "invoce",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=25) "EncryptionExchangeRequest": (*main.Message)(0xc000247040)({
|
||||
fullName: (string) (len=25) "EncryptionExchangeRequest",
|
||||
name: (string) (len=25) "EncryptionExchangeRequest",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc0003c31d0)({
|
||||
name: (string) (len=10) "public_key",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c3200)({
|
||||
name: (string) (len=9) "device_id",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=17) "LndGetInfoRequest": (*main.Message)(0xc000247080)({
|
||||
(map[string]*main.Message) (len=19) {
|
||||
(string) (len=17) "LndGetInfoRequest": (*main.Message)(0xc000215140)({
|
||||
fullName: (string) (len=17) "LndGetInfoRequest",
|
||||
name: (string) (len=17) "LndGetInfoRequest",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c3230)({
|
||||
(*main.Field)(0xc000379320)({
|
||||
name: (string) (len=7) "node_id",
|
||||
kind: (string) (len=5) "int64",
|
||||
isMap: (bool) false,
|
||||
|
|
@ -381,12 +330,12 @@
|
|||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=18) "NewAddressResponse": (*main.Message)(0xc000247100)({
|
||||
fullName: (string) (len=18) "NewAddressResponse",
|
||||
name: (string) (len=18) "NewAddressResponse",
|
||||
(string) (len=18) "LndGetInfoResponse": (*main.Message)(0xc000215180)({
|
||||
fullName: (string) (len=18) "LndGetInfoResponse",
|
||||
name: (string) (len=18) "LndGetInfoResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c3290)({
|
||||
name: (string) (len=7) "address",
|
||||
(*main.Field)(0xc000379350)({
|
||||
name: (string) (len=5) "alias",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
|
|
@ -396,11 +345,26 @@
|
|||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=17) "NewInvoiceRequest": (*main.Message)(0xc0002471c0)({
|
||||
(string) (len=17) "NewAddressRequest": (*main.Message)(0xc0002151c0)({
|
||||
fullName: (string) (len=17) "NewAddressRequest",
|
||||
name: (string) (len=17) "NewAddressRequest",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc000379380)({
|
||||
name: (string) (len=12) "address_type",
|
||||
kind: (string) (len=11) "AddressType",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) true,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=17) "NewInvoiceRequest": (*main.Message)(0xc0002152c0)({
|
||||
fullName: (string) (len=17) "NewInvoiceRequest",
|
||||
name: (string) (len=17) "NewInvoiceRequest",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c3350)({
|
||||
(*main.Field)(0xc000379470)({
|
||||
name: (string) (len=11) "amount_sats",
|
||||
kind: (string) (len=5) "int64",
|
||||
isMap: (bool) false,
|
||||
|
|
@ -411,169 +375,11 @@
|
|||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=18) "OpenChannelRequest": (*main.Message)(0xc0002472c0)({
|
||||
fullName: (string) (len=18) "OpenChannelRequest",
|
||||
name: (string) (len=18) "OpenChannelRequest",
|
||||
fields: ([]*main.Field) (len=3 cap=4) {
|
||||
(*main.Field)(0xc0003c3410)({
|
||||
name: (string) (len=11) "destination",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c3440)({
|
||||
name: (string) (len=15) "channel_balance",
|
||||
kind: (string) (len=5) "int64",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c3470)({
|
||||
name: (string) (len=11) "push_amount",
|
||||
kind: (string) (len=5) "int64",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=14) "AddUserRequest": (*main.Message)(0xc000247380)({
|
||||
fullName: (string) (len=14) "AddUserRequest",
|
||||
name: (string) (len=14) "AddUserRequest",
|
||||
fields: ([]*main.Field) (len=3 cap=4) {
|
||||
(*main.Field)(0xc0003c3500)({
|
||||
name: (string) (len=12) "callback_url",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c3530)({
|
||||
name: (string) (len=4) "name",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c3560)({
|
||||
name: (string) (len=6) "secret",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=15) "AuthUserRequest": (*main.Message)(0xc000247400)({
|
||||
fullName: (string) (len=15) "AuthUserRequest",
|
||||
name: (string) (len=15) "AuthUserRequest",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc0003c35f0)({
|
||||
name: (string) (len=4) "name",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c3620)({
|
||||
name: (string) (len=6) "secret",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=17) "PayAddressRequest": (*main.Message)(0xc000247140)({
|
||||
fullName: (string) (len=17) "PayAddressRequest",
|
||||
name: (string) (len=17) "PayAddressRequest",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc0003c32c0)({
|
||||
name: (string) (len=7) "address",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c32f0)({
|
||||
name: (string) (len=10) "amout_sats",
|
||||
kind: (string) (len=5) "int64",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=18) "PayAddressResponse": (*main.Message)(0xc000247180)({
|
||||
fullName: (string) (len=18) "PayAddressResponse",
|
||||
name: (string) (len=18) "PayAddressResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c3320)({
|
||||
name: (string) (len=5) "tx_id",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=16) "AuthUserResponse": (*main.Message)(0xc000247440)({
|
||||
fullName: (string) (len=16) "AuthUserResponse",
|
||||
name: (string) (len=16) "AuthUserResponse",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc0003c3650)({
|
||||
name: (string) (len=7) "user_id",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c3680)({
|
||||
name: (string) (len=10) "auth_token",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=5) "Empty": (*main.Message)(0xc000247000)({
|
||||
fullName: (string) (len=5) "Empty",
|
||||
name: (string) (len=5) "Empty",
|
||||
fields: ([]*main.Field) <nil>
|
||||
}),
|
||||
(string) (len=18) "PayInvoiceResponse": (*main.Message)(0xc000247280)({
|
||||
(string) (len=18) "PayInvoiceResponse": (*main.Message)(0xc000215380)({
|
||||
fullName: (string) (len=18) "PayInvoiceResponse",
|
||||
name: (string) (len=18) "PayInvoiceResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c33e0)({
|
||||
(*main.Field)(0xc000379530)({
|
||||
name: (string) (len=8) "preimage",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
|
|
@ -584,11 +390,11 @@
|
|||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=19) "OpenChannelResponse": (*main.Message)(0xc000247300)({
|
||||
(string) (len=19) "OpenChannelResponse": (*main.Message)(0xc000215400)({
|
||||
fullName: (string) (len=19) "OpenChannelResponse",
|
||||
name: (string) (len=19) "OpenChannelResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c34a0)({
|
||||
(*main.Field)(0xc000379620)({
|
||||
name: (string) (len=10) "channel_id",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
|
|
@ -599,11 +405,89 @@
|
|||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=27) "GetOpenChannelLNURLResponse": (*main.Message)(0xc000247340)({
|
||||
(string) (len=18) "PayAddressResponse": (*main.Message)(0xc000215280)({
|
||||
fullName: (string) (len=18) "PayAddressResponse",
|
||||
name: (string) (len=18) "PayAddressResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc000379440)({
|
||||
name: (string) (len=5) "tx_id",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=17) "PayInvoiceRequest": (*main.Message)(0xc000215340)({
|
||||
fullName: (string) (len=17) "PayInvoiceRequest",
|
||||
name: (string) (len=17) "PayInvoiceRequest",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc0003794d0)({
|
||||
name: (string) (len=7) "invoice",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc000379500)({
|
||||
name: (string) (len=6) "amount",
|
||||
kind: (string) (len=5) "int64",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=25) "EncryptionExchangeRequest": (*main.Message)(0xc000215100)({
|
||||
fullName: (string) (len=25) "EncryptionExchangeRequest",
|
||||
name: (string) (len=25) "EncryptionExchangeRequest",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc0003792c0)({
|
||||
name: (string) (len=10) "public_key",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003792f0)({
|
||||
name: (string) (len=9) "device_id",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=18) "NewAddressResponse": (*main.Message)(0xc000215200)({
|
||||
fullName: (string) (len=18) "NewAddressResponse",
|
||||
name: (string) (len=18) "NewAddressResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003793b0)({
|
||||
name: (string) (len=7) "address",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=27) "GetOpenChannelLNURLResponse": (*main.Message)(0xc000215440)({
|
||||
fullName: (string) (len=27) "GetOpenChannelLNURLResponse",
|
||||
name: (string) (len=27) "GetOpenChannelLNURLResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003c34d0)({
|
||||
(*main.Field)(0xc000379650)({
|
||||
name: (string) (len=5) "lnurl",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
|
|
@ -614,11 +498,44 @@
|
|||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=15) "AddUserResponse": (*main.Message)(0xc0002473c0)({
|
||||
(string) (len=14) "AddUserRequest": (*main.Message)(0xc000215480)({
|
||||
fullName: (string) (len=14) "AddUserRequest",
|
||||
name: (string) (len=14) "AddUserRequest",
|
||||
fields: ([]*main.Field) (len=3 cap=4) {
|
||||
(*main.Field)(0xc000379680)({
|
||||
name: (string) (len=12) "callback_url",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003796b0)({
|
||||
name: (string) (len=4) "name",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003796e0)({
|
||||
name: (string) (len=6) "secret",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=15) "AddUserResponse": (*main.Message)(0xc0002154c0)({
|
||||
fullName: (string) (len=15) "AddUserResponse",
|
||||
name: (string) (len=15) "AddUserResponse",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc0003c3590)({
|
||||
(*main.Field)(0xc000379710)({
|
||||
name: (string) (len=7) "user_id",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
|
|
@ -627,7 +544,7 @@
|
|||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003c35c0)({
|
||||
(*main.Field)(0xc000379740)({
|
||||
name: (string) (len=10) "auth_token",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
|
|
@ -637,10 +554,144 @@
|
|||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=15) "AuthUserRequest": (*main.Message)(0xc000215500)({
|
||||
fullName: (string) (len=15) "AuthUserRequest",
|
||||
name: (string) (len=15) "AuthUserRequest",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc000379770)({
|
||||
name: (string) (len=4) "name",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003797a0)({
|
||||
name: (string) (len=6) "secret",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=16) "AuthUserResponse": (*main.Message)(0xc000215540)({
|
||||
fullName: (string) (len=16) "AuthUserResponse",
|
||||
name: (string) (len=16) "AuthUserResponse",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc0003797d0)({
|
||||
name: (string) (len=7) "user_id",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc000379800)({
|
||||
name: (string) (len=10) "auth_token",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=5) "Empty": (*main.Message)(0xc0002150c0)({
|
||||
fullName: (string) (len=5) "Empty",
|
||||
name: (string) (len=5) "Empty",
|
||||
fields: ([]*main.Field) <nil>
|
||||
}),
|
||||
(string) (len=17) "PayAddressRequest": (*main.Message)(0xc000215240)({
|
||||
fullName: (string) (len=17) "PayAddressRequest",
|
||||
name: (string) (len=17) "PayAddressRequest",
|
||||
fields: ([]*main.Field) (len=2 cap=2) {
|
||||
(*main.Field)(0xc0003793e0)({
|
||||
name: (string) (len=7) "address",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc000379410)({
|
||||
name: (string) (len=10) "amout_sats",
|
||||
kind: (string) (len=5) "int64",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=18) "NewInvoiceResponse": (*main.Message)(0xc000215300)({
|
||||
fullName: (string) (len=18) "NewInvoiceResponse",
|
||||
name: (string) (len=18) "NewInvoiceResponse",
|
||||
fields: ([]*main.Field) (len=1 cap=1) {
|
||||
(*main.Field)(0xc0003794a0)({
|
||||
name: (string) (len=7) "invoice",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
}),
|
||||
(string) (len=18) "OpenChannelRequest": (*main.Message)(0xc0002153c0)({
|
||||
fullName: (string) (len=18) "OpenChannelRequest",
|
||||
name: (string) (len=18) "OpenChannelRequest",
|
||||
fields: ([]*main.Field) (len=4 cap=4) {
|
||||
(*main.Field)(0xc000379560)({
|
||||
name: (string) (len=11) "destination",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc000379590)({
|
||||
name: (string) (len=14) "funding_amount",
|
||||
kind: (string) (len=5) "int64",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003795c0)({
|
||||
name: (string) (len=11) "push_amount",
|
||||
kind: (string) (len=5) "int64",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
}),
|
||||
(*main.Field)(0xc0003795f0)({
|
||||
name: (string) (len=13) "close_address",
|
||||
kind: (string) (len=6) "string",
|
||||
isMap: (bool) false,
|
||||
isArray: (bool) false,
|
||||
isEnum: (bool) false,
|
||||
isMessage: (bool) false,
|
||||
isOptional: (bool) false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
parsing file: structs 18
|
||||
parsing file: structs 19
|
||||
parsing file: methods 2
|
||||
-> [{guest Guest false map[]} {user User false map[user_id:string]} {admin Admin true map[admin_id:string]}]
|
||||
|
||||
|
|
|
|||
|
|
@ -99,9 +99,12 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => {
|
|||
try {
|
||||
if (!methods.NewAddress) throw new Error('method: NewAddress is not implemented')
|
||||
const authContext = await opts.UserAuthGuard(req.headers['authorization'])
|
||||
const request = req.body
|
||||
const error = Types.NewAddressRequestValidate(request)
|
||||
if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger)
|
||||
const query = req.query
|
||||
const params = req.params
|
||||
const response = await methods.NewAddress({ ...authContext, ...query, ...params })
|
||||
const response = await methods.NewAddress({ ...authContext, ...query, ...params }, request)
|
||||
res.json({status: 'OK', result: response})
|
||||
} catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e }
|
||||
})
|
||||
|
|
|
|||
|
|
@ -74,11 +74,11 @@ export default (params: ClientParams) => ({
|
|||
}
|
||||
return { status: 'ERROR', reason: 'invalid response' }
|
||||
},
|
||||
NewAddress: async (): Promise<ResultError | { status: 'OK', result: Types.NewAddressResponse }> => {
|
||||
NewAddress: async (request: Types.NewAddressRequest): Promise<ResultError | { status: 'OK', result: Types.NewAddressResponse }> => {
|
||||
const auth = await params.retrieveUserAuth()
|
||||
if (auth === null) throw new Error('retrieveUserAuth() returned null')
|
||||
let finalRoute = '/api/user/chain/new'
|
||||
const { data } = await axios.post(params.baseUrl + finalRoute, {}, { headers: { 'authorization': auth } })
|
||||
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
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ export type ServerMethods = {
|
|||
LndGetInfo?: (ctx: LndGetInfo_Context, req: LndGetInfoRequest) => Promise<LndGetInfoResponse>
|
||||
AddUser?: (ctx: AddUser_Context, req: AddUserRequest) => Promise<AddUserResponse>
|
||||
AuthUser?: (ctx: AuthUser_Context, req: AuthUserRequest) => Promise<AuthUserResponse>
|
||||
NewAddress?: (ctx: NewAddress_Context) => Promise<NewAddressResponse>
|
||||
NewAddress?: (ctx: NewAddress_Context, req: NewAddressRequest) => Promise<NewAddressResponse>
|
||||
PayAddress?: (ctx: PayAddress_Context, req: PayAddressRequest) => Promise<PayAddressResponse>
|
||||
NewInvoice?: (ctx: NewInvoice_Context, req: NewInvoiceRequest) => Promise<NewInvoiceResponse>
|
||||
PayInvoice?: (ctx: PayInvoice_Context, req: PayInvoiceRequest) => Promise<PayInvoiceResponse>
|
||||
|
|
@ -79,31 +79,30 @@ export type ServerMethods = {
|
|||
GetOpenChannelLNURL?: (ctx: GetOpenChannelLNURL_Context) => Promise<GetOpenChannelLNURLResponse>
|
||||
}
|
||||
|
||||
export enum AddressType {
|
||||
WITNESS_PUBKEY_HASH = 'WITNESS_PUBKEY_HASH',
|
||||
NESTED_PUBKEY_HASH = 'NESTED_PUBKEY_HASH',
|
||||
TAPROOT_PUBKEY = 'TAPROOT_PUBKEY',
|
||||
}
|
||||
const enumCheckAddressType = (e?: AddressType): boolean => {
|
||||
for (const v in AddressType) if (e === v) return true
|
||||
return false
|
||||
}
|
||||
|
||||
export type OptionsBaseMessage = {
|
||||
allOptionalsAreSet?: true
|
||||
}
|
||||
|
||||
export type AuthUserResponse = {
|
||||
user_id: string
|
||||
auth_token: string
|
||||
export type Empty = {
|
||||
}
|
||||
export const AuthUserResponseOptionalFields: [] = []
|
||||
export type AuthUserResponseOptions = OptionsBaseMessage & {
|
||||
export const EmptyOptionalFields: [] = []
|
||||
export type EmptyOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
user_id_CustomCheck?: (v: string) => boolean
|
||||
auth_token_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const AuthUserResponseValidate = (o?: AuthUserResponse, opts: AuthUserResponseOptions = {}, path: string = 'AuthUserResponse::root.'): Error | null => {
|
||||
export const EmptyValidate = (o?: Empty, opts: EmptyOptions = {}, path: string = 'Empty::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
|
@ -130,20 +129,53 @@ export const PayAddressRequestValidate = (o?: PayAddressRequest, opts: PayAddres
|
|||
return null
|
||||
}
|
||||
|
||||
export type PayAddressResponse = {
|
||||
tx_id: string
|
||||
export type NewInvoiceResponse = {
|
||||
invoice: string
|
||||
}
|
||||
export const PayAddressResponseOptionalFields: [] = []
|
||||
export type PayAddressResponseOptions = OptionsBaseMessage & {
|
||||
export const NewInvoiceResponseOptionalFields: [] = []
|
||||
export type NewInvoiceResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
tx_id_CustomCheck?: (v: string) => boolean
|
||||
invoice_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const PayAddressResponseValidate = (o?: PayAddressResponse, opts: PayAddressResponseOptions = {}, path: string = 'PayAddressResponse::root.'): Error | null => {
|
||||
export const NewInvoiceResponseValidate = (o?: NewInvoiceResponse, opts: NewInvoiceResponseOptions = {}, path: string = 'NewInvoiceResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.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.invoice !== 'string') return new Error(`${path}.invoice: is not a string`)
|
||||
if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type 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
|
||||
}
|
||||
|
|
@ -166,92 +198,20 @@ export const OpenChannelResponseValidate = (o?: OpenChannelResponse, opts: OpenC
|
|||
return null
|
||||
}
|
||||
|
||||
export type GetOpenChannelLNURLResponse = {
|
||||
lnurl: string
|
||||
export type LndGetInfoRequest = {
|
||||
node_id: number
|
||||
}
|
||||
export const GetOpenChannelLNURLResponseOptionalFields: [] = []
|
||||
export type GetOpenChannelLNURLResponseOptions = OptionsBaseMessage & {
|
||||
export const LndGetInfoRequestOptionalFields: [] = []
|
||||
export type LndGetInfoRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
lnurl_CustomCheck?: (v: string) => boolean
|
||||
node_id_CustomCheck?: (v: number) => boolean
|
||||
}
|
||||
export const GetOpenChannelLNURLResponseValidate = (o?: GetOpenChannelLNURLResponse, opts: GetOpenChannelLNURLResponseOptions = {}, path: string = 'GetOpenChannelLNURLResponse::root.'): Error | null => {
|
||||
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.lnurl !== 'string') return new Error(`${path}.lnurl: is not a string`)
|
||||
if (opts.lnurl_CustomCheck && !opts.lnurl_CustomCheck(o.lnurl)) return new Error(`${path}.lnurl: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type AddUserResponse = {
|
||||
user_id: string
|
||||
auth_token: string
|
||||
}
|
||||
export const AddUserResponseOptionalFields: [] = []
|
||||
export type AddUserResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
user_id_CustomCheck?: (v: string) => boolean
|
||||
auth_token_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const AddUserResponseValidate = (o?: AddUserResponse, opts: AddUserResponseOptions = {}, path: string = 'AddUserResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.user_id !== 'string') return new Error(`${path}.user_id: is not a string`)
|
||||
if (opts.user_id_CustomCheck && !opts.user_id_CustomCheck(o.user_id)) return new Error(`${path}.user_id: custom check failed`)
|
||||
|
||||
if (typeof o.auth_token !== 'string') return new Error(`${path}.auth_token: is not a string`)
|
||||
if (opts.auth_token_CustomCheck && !opts.auth_token_CustomCheck(o.auth_token)) return new Error(`${path}.auth_token: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type Empty = {
|
||||
}
|
||||
export const EmptyOptionalFields: [] = []
|
||||
export type EmptyOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
}
|
||||
export const EmptyValidate = (o?: Empty, opts: EmptyOptions = {}, path: string = 'Empty::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type PayInvoiceResponse = {
|
||||
preimage: string
|
||||
}
|
||||
export const PayInvoiceResponseOptionalFields: [] = []
|
||||
export type PayInvoiceResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
preimage_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const PayInvoiceResponseValidate = (o?: PayInvoiceResponse, opts: PayInvoiceResponseOptions = {}, path: string = 'PayInvoiceResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.preimage !== 'string') return new Error(`${path}.preimage: is not a string`)
|
||||
if (opts.preimage_CustomCheck && !opts.preimage_CustomCheck(o.preimage)) return new Error(`${path}.preimage: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type PayInvoiceRequest = {
|
||||
invoce: string
|
||||
}
|
||||
export const PayInvoiceRequestOptionalFields: [] = []
|
||||
export type PayInvoiceRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
invoce_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const PayInvoiceRequestValidate = (o?: PayInvoiceRequest, opts: PayInvoiceRequestOptions = {}, path: string = 'PayInvoiceRequest::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.invoce !== 'string') return new Error(`${path}.invoce: is not a string`)
|
||||
if (opts.invoce_CustomCheck && !opts.invoce_CustomCheck(o.invoce)) return new Error(`${path}.invoce: custom check failed`)
|
||||
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
|
||||
}
|
||||
|
|
@ -274,38 +234,20 @@ export const LndGetInfoResponseValidate = (o?: LndGetInfoResponse, opts: LndGetI
|
|||
return null
|
||||
}
|
||||
|
||||
export type NewInvoiceResponse = {
|
||||
invoice: string
|
||||
export type NewAddressRequest = {
|
||||
address_type: AddressType
|
||||
}
|
||||
export const NewInvoiceResponseOptionalFields: [] = []
|
||||
export type NewInvoiceResponseOptions = OptionsBaseMessage & {
|
||||
export const NewAddressRequestOptionalFields: [] = []
|
||||
export type NewAddressRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
invoice_CustomCheck?: (v: string) => boolean
|
||||
address_type_CustomCheck?: (v: AddressType) => boolean
|
||||
}
|
||||
export const NewInvoiceResponseValidate = (o?: NewInvoiceResponse, opts: NewInvoiceResponseOptions = {}, path: string = 'NewInvoiceResponse::root.'): Error | null => {
|
||||
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 (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`)
|
||||
if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type NewAddressResponse = {
|
||||
address: string
|
||||
}
|
||||
export const NewAddressResponseOptionalFields: [] = []
|
||||
export type NewAddressResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
address_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const NewAddressResponseValidate = (o?: NewAddressResponse, opts: NewAddressResponseOptions = {}, path: string = 'NewAddressResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.address !== 'string') return new Error(`${path}.address: is not a string`)
|
||||
if (opts.address_CustomCheck && !opts.address_CustomCheck(o.address)) return new Error(`${path}.address: custom check failed`)
|
||||
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
|
||||
}
|
||||
|
|
@ -328,30 +270,166 @@ export const NewInvoiceRequestValidate = (o?: NewInvoiceRequest, opts: NewInvoic
|
|||
return null
|
||||
}
|
||||
|
||||
export type OpenChannelRequest = {
|
||||
destination: string
|
||||
channel_balance: number
|
||||
push_amount: number
|
||||
export type PayInvoiceResponse = {
|
||||
preimage: string
|
||||
}
|
||||
export const OpenChannelRequestOptionalFields: [] = []
|
||||
export type OpenChannelRequestOptions = OptionsBaseMessage & {
|
||||
export const PayInvoiceResponseOptionalFields: [] = []
|
||||
export type PayInvoiceResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
destination_CustomCheck?: (v: string) => boolean
|
||||
channel_balance_CustomCheck?: (v: number) => boolean
|
||||
push_amount_CustomCheck?: (v: number) => boolean
|
||||
preimage_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const OpenChannelRequestValidate = (o?: OpenChannelRequest, opts: OpenChannelRequestOptions = {}, path: string = 'OpenChannelRequest::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.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.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.channel_balance !== 'number') return new Error(`${path}.channel_balance: is not a number`)
|
||||
if (opts.channel_balance_CustomCheck && !opts.channel_balance_CustomCheck(o.channel_balance)) return new Error(`${path}.channel_balance: custom check failed`)
|
||||
return null
|
||||
}
|
||||
|
||||
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`)
|
||||
export type PayAddressResponse = {
|
||||
tx_id: string
|
||||
}
|
||||
export const PayAddressResponseOptionalFields: [] = []
|
||||
export type PayAddressResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
tx_id_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const PayAddressResponseValidate = (o?: PayAddressResponse, opts: PayAddressResponseOptions = {}, path: string = 'PayAddressResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.tx_id !== 'string') return new Error(`${path}.tx_id: is not a string`)
|
||||
if (opts.tx_id_CustomCheck && !opts.tx_id_CustomCheck(o.tx_id)) return new Error(`${path}.tx_id: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type PayInvoiceRequest = {
|
||||
invoice: string
|
||||
amount: number
|
||||
}
|
||||
export const PayInvoiceRequestOptionalFields: [] = []
|
||||
export type PayInvoiceRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
invoice_CustomCheck?: (v: string) => boolean
|
||||
amount_CustomCheck?: (v: number) => boolean
|
||||
}
|
||||
export const PayInvoiceRequestValidate = (o?: PayInvoiceRequest, opts: PayInvoiceRequestOptions = {}, path: string = 'PayInvoiceRequest::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`)
|
||||
if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`)
|
||||
|
||||
if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`)
|
||||
if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type AuthUserRequest = {
|
||||
name: string
|
||||
secret: string
|
||||
}
|
||||
export const AuthUserRequestOptionalFields: [] = []
|
||||
export type AuthUserRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
name_CustomCheck?: (v: string) => boolean
|
||||
secret_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const AuthUserRequestValidate = (o?: AuthUserRequest, opts: AuthUserRequestOptions = {}, path: string = 'AuthUserRequest::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.name !== 'string') return new Error(`${path}.name: is not a string`)
|
||||
if (opts.name_CustomCheck && !opts.name_CustomCheck(o.name)) return new Error(`${path}.name: custom check failed`)
|
||||
|
||||
if (typeof o.secret !== 'string') return new Error(`${path}.secret: is not a string`)
|
||||
if (opts.secret_CustomCheck && !opts.secret_CustomCheck(o.secret)) return new Error(`${path}.secret: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type AuthUserResponse = {
|
||||
user_id: string
|
||||
auth_token: string
|
||||
}
|
||||
export const AuthUserResponseOptionalFields: [] = []
|
||||
export type AuthUserResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
user_id_CustomCheck?: (v: string) => boolean
|
||||
auth_token_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const AuthUserResponseValidate = (o?: AuthUserResponse, opts: AuthUserResponseOptions = {}, path: string = 'AuthUserResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.user_id !== 'string') return new Error(`${path}.user_id: is not a string`)
|
||||
if (opts.user_id_CustomCheck && !opts.user_id_CustomCheck(o.user_id)) return new Error(`${path}.user_id: custom check failed`)
|
||||
|
||||
if (typeof o.auth_token !== 'string') return new Error(`${path}.auth_token: is not a string`)
|
||||
if (opts.auth_token_CustomCheck && !opts.auth_token_CustomCheck(o.auth_token)) return new Error(`${path}.auth_token: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type 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`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type NewAddressResponse = {
|
||||
address: string
|
||||
}
|
||||
export const NewAddressResponseOptionalFields: [] = []
|
||||
export type NewAddressResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
address_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const NewAddressResponseValidate = (o?: NewAddressResponse, opts: NewAddressResponseOptions = {}, path: string = 'NewAddressResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.address !== 'string') return new Error(`${path}.address: is not a string`)
|
||||
if (opts.address_CustomCheck && !opts.address_CustomCheck(o.address)) return new Error(`${path}.address: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export type GetOpenChannelLNURLResponse = {
|
||||
lnurl: string
|
||||
}
|
||||
export const GetOpenChannelLNURLResponseOptionalFields: [] = []
|
||||
export type GetOpenChannelLNURLResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
lnurl_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const GetOpenChannelLNURLResponseValidate = (o?: GetOpenChannelLNURLResponse, opts: GetOpenChannelLNURLResponseOptions = {}, path: string = 'GetOpenChannelLNURLResponse::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.lnurl !== 'string') return new Error(`${path}.lnurl: is not a string`)
|
||||
if (opts.lnurl_CustomCheck && !opts.lnurl_CustomCheck(o.lnurl)) return new Error(`${path}.lnurl: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
|
@ -384,66 +462,25 @@ export const AddUserRequestValidate = (o?: AddUserRequest, opts: AddUserRequestO
|
|||
return null
|
||||
}
|
||||
|
||||
export type AuthUserRequest = {
|
||||
name: string
|
||||
secret: string
|
||||
export type AddUserResponse = {
|
||||
user_id: string
|
||||
auth_token: string
|
||||
}
|
||||
export const AuthUserRequestOptionalFields: [] = []
|
||||
export type AuthUserRequestOptions = OptionsBaseMessage & {
|
||||
export const AddUserResponseOptionalFields: [] = []
|
||||
export type AddUserResponseOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
name_CustomCheck?: (v: string) => boolean
|
||||
secret_CustomCheck?: (v: string) => boolean
|
||||
user_id_CustomCheck?: (v: string) => boolean
|
||||
auth_token_CustomCheck?: (v: string) => boolean
|
||||
}
|
||||
export const AuthUserRequestValidate = (o?: AuthUserRequest, opts: AuthUserRequestOptions = {}, path: string = 'AuthUserRequest::root.'): Error | null => {
|
||||
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.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.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.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 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`)
|
||||
|
||||
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`)
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
// @generated by protobuf-ts 2.5.0 with parameter long_type_string
|
||||
// @generated by protobuf-ts 2.5.0
|
||||
// @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 { Invoices } from "./invoices";
|
||||
import type { LookupInvoiceMsg } from "./invoices";
|
||||
import type { SettleInvoiceResp } from "./invoices";
|
||||
import type { SettleInvoiceMsg } from "./invoices";
|
||||
import type { AddHoldInvoiceResp } from "./invoices";
|
||||
|
|
@ -12,7 +13,7 @@ import type { CancelInvoiceResp } from "./invoices";
|
|||
import type { CancelInvoiceMsg } from "./invoices";
|
||||
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
|
||||
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
|
||||
import type { Invoice } from "./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";
|
||||
|
|
@ -57,6 +58,14 @@ export interface IInvoicesClient {
|
|||
* @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
|
||||
|
|
@ -116,4 +125,15 @@ export class InvoicesClient implements IInvoicesClient, ServiceInfo {
|
|||
const method = this.methods[3], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<SettleInvoiceMsg, SettleInvoiceResp>("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: LookupInvoiceMsg, options?: RpcOptions): UnaryCall<LookupInvoiceMsg, Invoice> {
|
||||
const method = this.methods[4], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<LookupInvoiceMsg, Invoice>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// @generated by protobuf-ts 2.5.0 with parameter long_type_string
|
||||
// @generated by protobuf-ts 2.5.0
|
||||
// @generated from protobuf file "invoices.proto" (package "invoicesrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
import { Invoice } from "./rpc";
|
||||
import { Invoice } from "./lightning";
|
||||
import { ServiceType } from "@protobuf-ts/runtime-rpc";
|
||||
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
||||
import type { IBinaryWriter } from "@protobuf-ts/runtime";
|
||||
|
|
@ -13,13 +13,14 @@ 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 "./rpc";
|
||||
import { RouteHint } from "./lightning";
|
||||
/**
|
||||
* @generated from protobuf message invoicesrpc.CancelInvoiceMsg
|
||||
*/
|
||||
export interface CancelInvoiceMsg {
|
||||
/**
|
||||
* Hash corresponding to the (hold) invoice to cancel.
|
||||
* 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;
|
||||
*/
|
||||
|
|
@ -58,7 +59,7 @@ export interface AddHoldInvoiceRequest {
|
|||
*
|
||||
* @generated from protobuf field: int64 value = 3;
|
||||
*/
|
||||
value: string;
|
||||
value: bigint;
|
||||
/**
|
||||
*
|
||||
* The value of this invoice in millisatoshis
|
||||
|
|
@ -67,7 +68,7 @@ export interface AddHoldInvoiceRequest {
|
|||
*
|
||||
* @generated from protobuf field: int64 value_msat = 10;
|
||||
*/
|
||||
valueMsat: string;
|
||||
valueMsat: bigint;
|
||||
/**
|
||||
*
|
||||
* Hash (SHA-256) of a description of the payment. Used if the description of
|
||||
|
|
@ -82,7 +83,7 @@ export interface AddHoldInvoiceRequest {
|
|||
*
|
||||
* @generated from protobuf field: int64 expiry = 5;
|
||||
*/
|
||||
expiry: string;
|
||||
expiry: bigint;
|
||||
/**
|
||||
* Fallback on-chain address.
|
||||
*
|
||||
|
|
@ -94,7 +95,7 @@ export interface AddHoldInvoiceRequest {
|
|||
*
|
||||
* @generated from protobuf field: uint64 cltv_expiry = 7;
|
||||
*/
|
||||
cltvExpiry: string;
|
||||
cltvExpiry: bigint;
|
||||
/**
|
||||
*
|
||||
* Route hints that can each be individually used to assist in reaching the
|
||||
|
|
@ -116,13 +117,32 @@ export interface AddHoldInvoiceRequest {
|
|||
export interface AddHoldInvoiceResp {
|
||||
/**
|
||||
*
|
||||
* A bare-bones invoice for a payment within the Lightning Network. With the
|
||||
* 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: bigint;
|
||||
/**
|
||||
*
|
||||
* 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
|
||||
|
|
@ -146,12 +166,77 @@ export interface SettleInvoiceResp {
|
|||
*/
|
||||
export interface SubscribeSingleInvoiceRequest {
|
||||
/**
|
||||
* Hash corresponding to the (hold) invoice to subscribe to.
|
||||
* 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 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
|
||||
}
|
||||
// @generated message type with reflection information, may provide speed optimized methods
|
||||
class CancelInvoiceMsg$Type extends MessageType<CancelInvoiceMsg> {
|
||||
constructor() {
|
||||
|
|
@ -231,18 +316,18 @@ class AddHoldInvoiceRequest$Type extends MessageType<AddHoldInvoiceRequest> {
|
|||
super("invoicesrpc.AddHoldInvoiceRequest", [
|
||||
{ no: 1, name: "memo", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 2, name: "hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 3, name: "value", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
|
||||
{ no: 10, name: "value_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
|
||||
{ no: 3, name: "value", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 10, name: "value_msat", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 4, name: "description_hash", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
|
||||
{ no: 5, name: "expiry", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
|
||||
{ no: 5, name: "expiry", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 6, name: "fallback_addr", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 7, name: "cltv_expiry", kind: "scalar", T: 4 /*ScalarType.UINT64*/ },
|
||||
{ no: 7, name: "cltv_expiry", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 8, name: "route_hints", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => RouteHint },
|
||||
{ no: 9, name: "private", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<AddHoldInvoiceRequest>): AddHoldInvoiceRequest {
|
||||
const message = { memo: "", hash: new Uint8Array(0), value: "0", valueMsat: "0", descriptionHash: new Uint8Array(0), expiry: "0", fallbackAddr: "", cltvExpiry: "0", routeHints: [], private: false };
|
||||
const message = { memo: "", hash: new Uint8Array(0), value: 0n, valueMsat: 0n, descriptionHash: new Uint8Array(0), expiry: 0n, fallbackAddr: "", cltvExpiry: 0n, routeHints: [], private: false };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<AddHoldInvoiceRequest>(this, message, value);
|
||||
|
|
@ -260,22 +345,22 @@ class AddHoldInvoiceRequest$Type extends MessageType<AddHoldInvoiceRequest> {
|
|||
message.hash = reader.bytes();
|
||||
break;
|
||||
case /* int64 value */ 3:
|
||||
message.value = reader.int64().toString();
|
||||
message.value = reader.int64().toBigInt();
|
||||
break;
|
||||
case /* int64 value_msat */ 10:
|
||||
message.valueMsat = reader.int64().toString();
|
||||
message.valueMsat = reader.int64().toBigInt();
|
||||
break;
|
||||
case /* bytes description_hash */ 4:
|
||||
message.descriptionHash = reader.bytes();
|
||||
break;
|
||||
case /* int64 expiry */ 5:
|
||||
message.expiry = reader.int64().toString();
|
||||
message.expiry = reader.int64().toBigInt();
|
||||
break;
|
||||
case /* string fallback_addr */ 6:
|
||||
message.fallbackAddr = reader.string();
|
||||
break;
|
||||
case /* uint64 cltv_expiry */ 7:
|
||||
message.cltvExpiry = reader.uint64().toString();
|
||||
message.cltvExpiry = reader.uint64().toBigInt();
|
||||
break;
|
||||
case /* repeated lnrpc.RouteHint route_hints */ 8:
|
||||
message.routeHints.push(RouteHint.internalBinaryRead(reader, reader.uint32(), options));
|
||||
|
|
@ -302,22 +387,22 @@ class AddHoldInvoiceRequest$Type extends MessageType<AddHoldInvoiceRequest> {
|
|||
if (message.hash.length)
|
||||
writer.tag(2, WireType.LengthDelimited).bytes(message.hash);
|
||||
/* int64 value = 3; */
|
||||
if (message.value !== "0")
|
||||
if (message.value !== 0n)
|
||||
writer.tag(3, WireType.Varint).int64(message.value);
|
||||
/* int64 value_msat = 10; */
|
||||
if (message.valueMsat !== "0")
|
||||
if (message.valueMsat !== 0n)
|
||||
writer.tag(10, WireType.Varint).int64(message.valueMsat);
|
||||
/* bytes description_hash = 4; */
|
||||
if (message.descriptionHash.length)
|
||||
writer.tag(4, WireType.LengthDelimited).bytes(message.descriptionHash);
|
||||
/* int64 expiry = 5; */
|
||||
if (message.expiry !== "0")
|
||||
if (message.expiry !== 0n)
|
||||
writer.tag(5, WireType.Varint).int64(message.expiry);
|
||||
/* string fallback_addr = 6; */
|
||||
if (message.fallbackAddr !== "")
|
||||
writer.tag(6, WireType.LengthDelimited).string(message.fallbackAddr);
|
||||
/* uint64 cltv_expiry = 7; */
|
||||
if (message.cltvExpiry !== "0")
|
||||
if (message.cltvExpiry !== 0n)
|
||||
writer.tag(7, WireType.Varint).uint64(message.cltvExpiry);
|
||||
/* repeated lnrpc.RouteHint route_hints = 8; */
|
||||
for (let i = 0; i < message.routeHints.length; i++)
|
||||
|
|
@ -339,11 +424,13 @@ export const AddHoldInvoiceRequest = new AddHoldInvoiceRequest$Type();
|
|||
class AddHoldInvoiceResp$Type extends MessageType<AddHoldInvoiceResp> {
|
||||
constructor() {
|
||||
super("invoicesrpc.AddHoldInvoiceResp", [
|
||||
{ no: 1, name: "payment_request", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
||||
{ no: 1, name: "payment_request", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 2, name: "add_index", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
|
||||
{ no: 3, name: "payment_addr", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<AddHoldInvoiceResp>): AddHoldInvoiceResp {
|
||||
const message = { paymentRequest: "" };
|
||||
const message = { paymentRequest: "", addIndex: 0n, paymentAddr: new Uint8Array(0) };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<AddHoldInvoiceResp>(this, message, value);
|
||||
|
|
@ -357,6 +444,12 @@ class AddHoldInvoiceResp$Type extends MessageType<AddHoldInvoiceResp> {
|
|||
case /* string payment_request */ 1:
|
||||
message.paymentRequest = reader.string();
|
||||
break;
|
||||
case /* uint64 add_index */ 2:
|
||||
message.addIndex = reader.uint64().toBigInt();
|
||||
break;
|
||||
case /* bytes payment_addr */ 3:
|
||||
message.paymentAddr = reader.bytes();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
if (u === "throw")
|
||||
|
|
@ -372,6 +465,12 @@ class AddHoldInvoiceResp$Type extends MessageType<AddHoldInvoiceResp> {
|
|||
/* string payment_request = 1; */
|
||||
if (message.paymentRequest !== "")
|
||||
writer.tag(1, WireType.LengthDelimited).string(message.paymentRequest);
|
||||
/* uint64 add_index = 2; */
|
||||
if (message.addIndex !== 0n)
|
||||
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);
|
||||
|
|
@ -502,6 +601,83 @@ class SubscribeSingleInvoiceRequest$Type extends MessageType<SubscribeSingleInvo
|
|||
* @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<LookupInvoiceMsg> {
|
||||
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?: PartialMessage<LookupInvoiceMsg>): LookupInvoiceMsg {
|
||||
const message = { invoiceRef: { oneofKind: undefined }, lookupModifier: 0 };
|
||||
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<LookupInvoiceMsg>(this, message, value);
|
||||
return message;
|
||||
}
|
||||
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: LookupInvoiceMsg): LookupInvoiceMsg {
|
||||
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: LookupInvoiceMsg, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
||||
/* 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
|
||||
*/
|
||||
|
|
@ -509,5 +685,6 @@ 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: "SettleInvoice", options: {}, I: SettleInvoiceMsg, O: SettleInvoiceResp },
|
||||
{ name: "LookupInvoiceV2", options: {}, I: LookupInvoiceMsg, O: Invoice }
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -1,119 +1,135 @@
|
|||
// @generated by protobuf-ts 2.5.0 with parameter long_type_string
|
||||
// @generated from protobuf file "rpc.proto" (package "lnrpc", syntax proto3)
|
||||
// @generated by protobuf-ts 2.5.0
|
||||
// @generated from protobuf file "lightning.proto" (package "lnrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
||||
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
|
||||
import { Lightning } from "./rpc";
|
||||
import type { ListPermissionsResponse } from "./rpc";
|
||||
import type { ListPermissionsRequest } from "./rpc";
|
||||
import type { DeleteMacaroonIDResponse } from "./rpc";
|
||||
import type { DeleteMacaroonIDRequest } from "./rpc";
|
||||
import type { ListMacaroonIDsResponse } from "./rpc";
|
||||
import type { ListMacaroonIDsRequest } from "./rpc";
|
||||
import type { BakeMacaroonResponse } from "./rpc";
|
||||
import type { BakeMacaroonRequest } from "./rpc";
|
||||
import type { ChannelBackupSubscription } from "./rpc";
|
||||
import type { RestoreBackupResponse } from "./rpc";
|
||||
import type { RestoreChanBackupRequest } from "./rpc";
|
||||
import type { VerifyChanBackupResponse } from "./rpc";
|
||||
import type { ChanBackupSnapshot } from "./rpc";
|
||||
import type { ChanBackupExportRequest } from "./rpc";
|
||||
import type { ChannelBackup } from "./rpc";
|
||||
import type { ExportChannelBackupRequest } from "./rpc";
|
||||
import type { ForwardingHistoryResponse } from "./rpc";
|
||||
import type { ForwardingHistoryRequest } from "./rpc";
|
||||
import type { PolicyUpdateResponse } from "./rpc";
|
||||
import type { PolicyUpdateRequest } from "./rpc";
|
||||
import type { FeeReportResponse } from "./rpc";
|
||||
import type { FeeReportRequest } from "./rpc";
|
||||
import type { DebugLevelResponse } from "./rpc";
|
||||
import type { DebugLevelRequest } from "./rpc";
|
||||
import type { GraphTopologyUpdate } from "./rpc";
|
||||
import type { GraphTopologySubscription } from "./rpc";
|
||||
import type { StopResponse } from "./rpc";
|
||||
import type { StopRequest } from "./rpc";
|
||||
import type { NetworkInfo } from "./rpc";
|
||||
import type { NetworkInfoRequest } from "./rpc";
|
||||
import type { QueryRoutesResponse } from "./rpc";
|
||||
import type { QueryRoutesRequest } from "./rpc";
|
||||
import type { NodeInfo } from "./rpc";
|
||||
import type { NodeInfoRequest } from "./rpc";
|
||||
import type { ChannelEdge } from "./rpc";
|
||||
import type { ChanInfoRequest } from "./rpc";
|
||||
import type { NodeMetricsResponse } from "./rpc";
|
||||
import type { NodeMetricsRequest } from "./rpc";
|
||||
import type { ChannelGraph } from "./rpc";
|
||||
import type { ChannelGraphRequest } from "./rpc";
|
||||
import type { DeleteAllPaymentsResponse } from "./rpc";
|
||||
import type { DeleteAllPaymentsRequest } from "./rpc";
|
||||
import type { ListPaymentsResponse } from "./rpc";
|
||||
import type { ListPaymentsRequest } from "./rpc";
|
||||
import type { PayReq } from "./rpc";
|
||||
import type { PayReqString } from "./rpc";
|
||||
import type { InvoiceSubscription } from "./rpc";
|
||||
import type { PaymentHash } from "./rpc";
|
||||
import type { ListInvoiceResponse } from "./rpc";
|
||||
import type { ListInvoiceRequest } from "./rpc";
|
||||
import type { AddInvoiceResponse } from "./rpc";
|
||||
import type { Invoice } from "./rpc";
|
||||
import type { SendToRouteRequest } from "./rpc";
|
||||
import type { SendResponse } from "./rpc";
|
||||
import type { SendRequest } from "./rpc";
|
||||
import type { AbandonChannelResponse } from "./rpc";
|
||||
import type { AbandonChannelRequest } from "./rpc";
|
||||
import type { CloseStatusUpdate } from "./rpc";
|
||||
import type { CloseChannelRequest } from "./rpc";
|
||||
import type { ChannelAcceptRequest } from "./rpc";
|
||||
import type { ChannelAcceptResponse } from "./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 type { DuplexStreamingCall } from "@protobuf-ts/runtime-rpc";
|
||||
import type { FundingStateStepResp } from "./rpc";
|
||||
import type { FundingTransitionMsg } from "./rpc";
|
||||
import type { OpenStatusUpdate } from "./rpc";
|
||||
import type { ChannelPoint } from "./rpc";
|
||||
import type { OpenChannelRequest } from "./rpc";
|
||||
import type { ClosedChannelsResponse } from "./rpc";
|
||||
import type { ClosedChannelsRequest } from "./rpc";
|
||||
import type { ChannelEventUpdate } from "./rpc";
|
||||
import type { ChannelEventSubscription } from "./rpc";
|
||||
import type { ListChannelsResponse } from "./rpc";
|
||||
import type { ListChannelsRequest } from "./rpc";
|
||||
import type { PendingChannelsResponse } from "./rpc";
|
||||
import type { PendingChannelsRequest } from "./rpc";
|
||||
import type { GetRecoveryInfoResponse } from "./rpc";
|
||||
import type { GetRecoveryInfoRequest } from "./rpc";
|
||||
import type { GetInfoResponse } from "./rpc";
|
||||
import type { GetInfoRequest } from "./rpc";
|
||||
import type { PeerEvent } from "./rpc";
|
||||
import type { PeerEventSubscription } from "./rpc";
|
||||
import type { ListPeersResponse } from "./rpc";
|
||||
import type { ListPeersRequest } from "./rpc";
|
||||
import type { DisconnectPeerResponse } from "./rpc";
|
||||
import type { DisconnectPeerRequest } from "./rpc";
|
||||
import type { ConnectPeerResponse } from "./rpc";
|
||||
import type { ConnectPeerRequest } from "./rpc";
|
||||
import type { VerifyMessageResponse } from "./rpc";
|
||||
import type { VerifyMessageRequest } from "./rpc";
|
||||
import type { SignMessageResponse } from "./rpc";
|
||||
import type { SignMessageRequest } from "./rpc";
|
||||
import type { NewAddressResponse } from "./rpc";
|
||||
import type { NewAddressRequest } from "./rpc";
|
||||
import type { SendManyResponse } from "./rpc";
|
||||
import type { SendManyRequest } from "./rpc";
|
||||
import type { Transaction } from "./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 { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
|
||||
import type { ListUnspentResponse } from "./rpc";
|
||||
import type { ListUnspentRequest } from "./rpc";
|
||||
import type { SendCoinsResponse } from "./rpc";
|
||||
import type { SendCoinsRequest } from "./rpc";
|
||||
import type { EstimateFeeResponse } from "./rpc";
|
||||
import type { EstimateFeeRequest } from "./rpc";
|
||||
import type { TransactionDetails } from "./rpc";
|
||||
import type { GetTransactionsRequest } from "./rpc";
|
||||
import type { ChannelBalanceResponse } from "./rpc";
|
||||
import type { ChannelBalanceRequest } from "./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 { stackIntercept } from "@protobuf-ts/runtime-rpc";
|
||||
import type { WalletBalanceResponse } from "./rpc";
|
||||
import type { WalletBalanceRequest } from "./rpc";
|
||||
import type { WalletBalanceResponse } from "./lightning";
|
||||
import type { WalletBalanceRequest } from "./lightning";
|
||||
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
|
||||
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
|
||||
//
|
||||
|
|
@ -358,6 +374,17 @@ export interface ILightningClient {
|
|||
* @generated from protobuf rpc: OpenChannel(lnrpc.OpenChannelRequest) returns (stream lnrpc.OpenStatusUpdate);
|
||||
*/
|
||||
openChannel(input: OpenChannelRequest, options?: RpcOptions): ServerStreamingCall<OpenChannelRequest, OpenStatusUpdate>;
|
||||
/**
|
||||
* 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: BatchOpenChannelRequest, options?: RpcOptions): UnaryCall<BatchOpenChannelRequest, BatchOpenChannelResponse>;
|
||||
/**
|
||||
*
|
||||
* FundingStateStep is an advanced funding related call that allows the caller
|
||||
|
|
@ -514,7 +541,16 @@ export interface ILightningClient {
|
|||
listPayments(input: ListPaymentsRequest, options?: RpcOptions): UnaryCall<ListPaymentsRequest, ListPaymentsResponse>;
|
||||
/**
|
||||
*
|
||||
* DeleteAllPayments deletes all outgoing payments from DB.
|
||||
* 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: DeletePaymentRequest, options?: RpcOptions): UnaryCall<DeletePaymentRequest, DeletePaymentResponse>;
|
||||
/**
|
||||
*
|
||||
* 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);
|
||||
*/
|
||||
|
|
@ -631,8 +667,9 @@ export interface ILightningClient {
|
|||
* lncli: `fwdinghistory`
|
||||
* ForwardingHistory allows the caller to query the htlcswitch for a record of
|
||||
* all HTLCs forwarded within the target time range, and integer offset
|
||||
* within that time range. If no time-range is specified, then the first chunk
|
||||
* of the past 24 hrs of forwarding history are returned.
|
||||
* 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.
|
||||
|
|
@ -730,6 +767,61 @@ export interface ILightningClient {
|
|||
* @generated from protobuf rpc: ListPermissions(lnrpc.ListPermissionsRequest) returns (lnrpc.ListPermissionsResponse);
|
||||
*/
|
||||
listPermissions(input: ListPermissionsRequest, options?: RpcOptions): UnaryCall<ListPermissionsRequest, ListPermissionsResponse>;
|
||||
/**
|
||||
*
|
||||
* 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: CheckMacPermRequest, options?: RpcOptions): UnaryCall<CheckMacPermRequest, CheckMacPermResponse>;
|
||||
/**
|
||||
*
|
||||
* 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?: RpcOptions): DuplexStreamingCall<RPCMiddlewareResponse, RPCMiddlewareRequest>;
|
||||
/**
|
||||
* lncli: `sendcustom`
|
||||
* SendCustomMessage sends a custom peer message.
|
||||
*
|
||||
* @generated from protobuf rpc: SendCustomMessage(lnrpc.SendCustomMessageRequest) returns (lnrpc.SendCustomMessageResponse);
|
||||
*/
|
||||
sendCustomMessage(input: SendCustomMessageRequest, options?: RpcOptions): UnaryCall<SendCustomMessageRequest, SendCustomMessageResponse>;
|
||||
/**
|
||||
* 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: SubscribeCustomMessagesRequest, options?: RpcOptions): ServerStreamingCall<SubscribeCustomMessagesRequest, CustomMessage>;
|
||||
/**
|
||||
* 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: ListAliasesRequest, options?: RpcOptions): UnaryCall<ListAliasesRequest, ListAliasesResponse>;
|
||||
/**
|
||||
* @generated from protobuf rpc: LookupHtlc(lnrpc.LookupHtlcRequest) returns (lnrpc.LookupHtlcResponse);
|
||||
*/
|
||||
lookupHtlc(input: LookupHtlcRequest, options?: RpcOptions): UnaryCall<LookupHtlcRequest, LookupHtlcResponse>;
|
||||
}
|
||||
//
|
||||
// Comments in this file will be directly parsed into the API
|
||||
|
|
@ -1047,6 +1139,20 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
const method = this.methods[22], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<OpenChannelRequest, OpenStatusUpdate>("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: BatchOpenChannelRequest, options?: RpcOptions): UnaryCall<BatchOpenChannelRequest, BatchOpenChannelResponse> {
|
||||
const method = this.methods[23], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<BatchOpenChannelRequest, BatchOpenChannelResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* FundingStateStep is an advanced funding related call that allows the caller
|
||||
|
|
@ -1061,7 +1167,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: FundingStateStep(lnrpc.FundingTransitionMsg) returns (lnrpc.FundingStateStepResp);
|
||||
*/
|
||||
fundingStateStep(input: FundingTransitionMsg, options?: RpcOptions): UnaryCall<FundingTransitionMsg, FundingStateStepResp> {
|
||||
const method = this.methods[23], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[24], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<FundingTransitionMsg, FundingStateStepResp>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1075,7 +1181,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: ChannelAcceptor(stream lnrpc.ChannelAcceptResponse) returns (stream lnrpc.ChannelAcceptRequest);
|
||||
*/
|
||||
channelAcceptor(options?: RpcOptions): DuplexStreamingCall<ChannelAcceptResponse, ChannelAcceptRequest> {
|
||||
const method = this.methods[24], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[25], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ChannelAcceptResponse, ChannelAcceptRequest>("duplex", this._transport, method, opt);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1091,7 +1197,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: CloseChannel(lnrpc.CloseChannelRequest) returns (stream lnrpc.CloseStatusUpdate);
|
||||
*/
|
||||
closeChannel(input: CloseChannelRequest, options?: RpcOptions): ServerStreamingCall<CloseChannelRequest, CloseStatusUpdate> {
|
||||
const method = this.methods[25], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[26], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<CloseChannelRequest, CloseStatusUpdate>("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1106,7 +1212,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: AbandonChannel(lnrpc.AbandonChannelRequest) returns (lnrpc.AbandonChannelResponse);
|
||||
*/
|
||||
abandonChannel(input: AbandonChannelRequest, options?: RpcOptions): UnaryCall<AbandonChannelRequest, AbandonChannelResponse> {
|
||||
const method = this.methods[26], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[27], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<AbandonChannelRequest, AbandonChannelResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1121,7 +1227,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: SendPayment(stream lnrpc.SendRequest) returns (stream lnrpc.SendResponse);
|
||||
*/
|
||||
sendPayment(options?: RpcOptions): DuplexStreamingCall<SendRequest, SendResponse> {
|
||||
const method = this.methods[27], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[28], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<SendRequest, SendResponse>("duplex", this._transport, method, opt);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1134,7 +1240,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: SendPaymentSync(lnrpc.SendRequest) returns (lnrpc.SendResponse);
|
||||
*/
|
||||
sendPaymentSync(input: SendRequest, options?: RpcOptions): UnaryCall<SendRequest, SendResponse> {
|
||||
const method = this.methods[28], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[29], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<SendRequest, SendResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1149,7 +1255,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: SendToRoute(stream lnrpc.SendToRouteRequest) returns (stream lnrpc.SendResponse);
|
||||
*/
|
||||
sendToRoute(options?: RpcOptions): DuplexStreamingCall<SendToRouteRequest, SendResponse> {
|
||||
const method = this.methods[29], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[30], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<SendToRouteRequest, SendResponse>("duplex", this._transport, method, opt);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1160,7 +1266,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: SendToRouteSync(lnrpc.SendToRouteRequest) returns (lnrpc.SendResponse);
|
||||
*/
|
||||
sendToRouteSync(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, SendResponse> {
|
||||
const method = this.methods[30], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[31], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<SendToRouteRequest, SendResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1172,7 +1278,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: AddInvoice(lnrpc.Invoice) returns (lnrpc.AddInvoiceResponse);
|
||||
*/
|
||||
addInvoice(input: Invoice, options?: RpcOptions): UnaryCall<Invoice, AddInvoiceResponse> {
|
||||
const method = this.methods[31], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[32], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<Invoice, AddInvoiceResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1188,7 +1294,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: ListInvoices(lnrpc.ListInvoiceRequest) returns (lnrpc.ListInvoiceResponse);
|
||||
*/
|
||||
listInvoices(input: ListInvoiceRequest, options?: RpcOptions): UnaryCall<ListInvoiceRequest, ListInvoiceResponse> {
|
||||
const method = this.methods[32], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[33], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ListInvoiceRequest, ListInvoiceResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1200,7 +1306,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: LookupInvoice(lnrpc.PaymentHash) returns (lnrpc.Invoice);
|
||||
*/
|
||||
lookupInvoice(input: PaymentHash, options?: RpcOptions): UnaryCall<PaymentHash, Invoice> {
|
||||
const method = this.methods[33], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[34], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<PaymentHash, Invoice>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1218,7 +1324,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: SubscribeInvoices(lnrpc.InvoiceSubscription) returns (stream lnrpc.Invoice);
|
||||
*/
|
||||
subscribeInvoices(input: InvoiceSubscription, options?: RpcOptions): ServerStreamingCall<InvoiceSubscription, Invoice> {
|
||||
const method = this.methods[34], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[35], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<InvoiceSubscription, Invoice>("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1230,7 +1336,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: DecodePayReq(lnrpc.PayReqString) returns (lnrpc.PayReq);
|
||||
*/
|
||||
decodePayReq(input: PayReqString, options?: RpcOptions): UnaryCall<PayReqString, PayReq> {
|
||||
const method = this.methods[35], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[36], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<PayReqString, PayReq>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1240,17 +1346,29 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: ListPayments(lnrpc.ListPaymentsRequest) returns (lnrpc.ListPaymentsResponse);
|
||||
*/
|
||||
listPayments(input: ListPaymentsRequest, options?: RpcOptions): UnaryCall<ListPaymentsRequest, ListPaymentsResponse> {
|
||||
const method = this.methods[36], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[37], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ListPaymentsRequest, ListPaymentsResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* DeleteAllPayments deletes all outgoing payments from DB.
|
||||
* 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: DeletePaymentRequest, options?: RpcOptions): UnaryCall<DeletePaymentRequest, DeletePaymentResponse> {
|
||||
const method = this.methods[38], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<DeletePaymentRequest, DeletePaymentResponse>("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: DeleteAllPaymentsRequest, options?: RpcOptions): UnaryCall<DeleteAllPaymentsRequest, DeleteAllPaymentsResponse> {
|
||||
const method = this.methods[37], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[39], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<DeleteAllPaymentsRequest, DeleteAllPaymentsResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1265,7 +1383,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: DescribeGraph(lnrpc.ChannelGraphRequest) returns (lnrpc.ChannelGraph);
|
||||
*/
|
||||
describeGraph(input: ChannelGraphRequest, options?: RpcOptions): UnaryCall<ChannelGraphRequest, ChannelGraph> {
|
||||
const method = this.methods[38], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[40], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ChannelGraphRequest, ChannelGraph>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1276,7 +1394,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: GetNodeMetrics(lnrpc.NodeMetricsRequest) returns (lnrpc.NodeMetricsResponse);
|
||||
*/
|
||||
getNodeMetrics(input: NodeMetricsRequest, options?: RpcOptions): UnaryCall<NodeMetricsRequest, NodeMetricsResponse> {
|
||||
const method = this.methods[39], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[41], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<NodeMetricsRequest, NodeMetricsResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1289,7 +1407,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: GetChanInfo(lnrpc.ChanInfoRequest) returns (lnrpc.ChannelEdge);
|
||||
*/
|
||||
getChanInfo(input: ChanInfoRequest, options?: RpcOptions): UnaryCall<ChanInfoRequest, ChannelEdge> {
|
||||
const method = this.methods[40], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[42], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ChanInfoRequest, ChannelEdge>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1300,7 +1418,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: GetNodeInfo(lnrpc.NodeInfoRequest) returns (lnrpc.NodeInfo);
|
||||
*/
|
||||
getNodeInfo(input: NodeInfoRequest, options?: RpcOptions): UnaryCall<NodeInfoRequest, NodeInfo> {
|
||||
const method = this.methods[41], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[43], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<NodeInfoRequest, NodeInfo>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1319,7 +1437,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: QueryRoutes(lnrpc.QueryRoutesRequest) returns (lnrpc.QueryRoutesResponse);
|
||||
*/
|
||||
queryRoutes(input: QueryRoutesRequest, options?: RpcOptions): UnaryCall<QueryRoutesRequest, QueryRoutesResponse> {
|
||||
const method = this.methods[42], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[44], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<QueryRoutesRequest, QueryRoutesResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1330,7 +1448,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: GetNetworkInfo(lnrpc.NetworkInfoRequest) returns (lnrpc.NetworkInfo);
|
||||
*/
|
||||
getNetworkInfo(input: NetworkInfoRequest, options?: RpcOptions): UnaryCall<NetworkInfoRequest, NetworkInfo> {
|
||||
const method = this.methods[43], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[45], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<NetworkInfoRequest, NetworkInfo>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1341,7 +1459,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: StopDaemon(lnrpc.StopRequest) returns (lnrpc.StopResponse);
|
||||
*/
|
||||
stopDaemon(input: StopRequest, options?: RpcOptions): UnaryCall<StopRequest, StopResponse> {
|
||||
const method = this.methods[44], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[46], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<StopRequest, StopResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1356,7 +1474,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: SubscribeChannelGraph(lnrpc.GraphTopologySubscription) returns (stream lnrpc.GraphTopologyUpdate);
|
||||
*/
|
||||
subscribeChannelGraph(input: GraphTopologySubscription, options?: RpcOptions): ServerStreamingCall<GraphTopologySubscription, GraphTopologyUpdate> {
|
||||
const method = this.methods[45], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[47], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<GraphTopologySubscription, GraphTopologyUpdate>("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1369,7 +1487,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: DebugLevel(lnrpc.DebugLevelRequest) returns (lnrpc.DebugLevelResponse);
|
||||
*/
|
||||
debugLevel(input: DebugLevelRequest, options?: RpcOptions): UnaryCall<DebugLevelRequest, DebugLevelResponse> {
|
||||
const method = this.methods[46], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[48], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<DebugLevelRequest, DebugLevelResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1380,7 +1498,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: FeeReport(lnrpc.FeeReportRequest) returns (lnrpc.FeeReportResponse);
|
||||
*/
|
||||
feeReport(input: FeeReportRequest, options?: RpcOptions): UnaryCall<FeeReportRequest, FeeReportResponse> {
|
||||
const method = this.methods[47], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[49], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<FeeReportRequest, FeeReportResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1391,15 +1509,16 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: UpdateChannelPolicy(lnrpc.PolicyUpdateRequest) returns (lnrpc.PolicyUpdateResponse);
|
||||
*/
|
||||
updateChannelPolicy(input: PolicyUpdateRequest, options?: RpcOptions): UnaryCall<PolicyUpdateRequest, PolicyUpdateResponse> {
|
||||
const method = this.methods[48], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[50], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<PolicyUpdateRequest, PolicyUpdateResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* lncli: `fwdinghistory`
|
||||
* ForwardingHistory allows the caller to query the htlcswitch for a record of
|
||||
* all HTLCs forwarded within the target time range, and integer offset
|
||||
* within that time range. If no time-range is specified, then the first chunk
|
||||
* of the past 24 hrs of forwarding history are returned.
|
||||
* 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.
|
||||
|
|
@ -1410,7 +1529,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: ForwardingHistory(lnrpc.ForwardingHistoryRequest) returns (lnrpc.ForwardingHistoryResponse);
|
||||
*/
|
||||
forwardingHistory(input: ForwardingHistoryRequest, options?: RpcOptions): UnaryCall<ForwardingHistoryRequest, ForwardingHistoryResponse> {
|
||||
const method = this.methods[49], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[51], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ForwardingHistoryRequest, ForwardingHistoryResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1425,7 +1544,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: ExportChannelBackup(lnrpc.ExportChannelBackupRequest) returns (lnrpc.ChannelBackup);
|
||||
*/
|
||||
exportChannelBackup(input: ExportChannelBackupRequest, options?: RpcOptions): UnaryCall<ExportChannelBackupRequest, ChannelBackup> {
|
||||
const method = this.methods[50], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[52], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ExportChannelBackupRequest, ChannelBackup>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1439,7 +1558,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: ExportAllChannelBackups(lnrpc.ChanBackupExportRequest) returns (lnrpc.ChanBackupSnapshot);
|
||||
*/
|
||||
exportAllChannelBackups(input: ChanBackupExportRequest, options?: RpcOptions): UnaryCall<ChanBackupExportRequest, ChanBackupSnapshot> {
|
||||
const method = this.methods[51], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[53], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ChanBackupExportRequest, ChanBackupSnapshot>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1451,7 +1570,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: VerifyChanBackup(lnrpc.ChanBackupSnapshot) returns (lnrpc.VerifyChanBackupResponse);
|
||||
*/
|
||||
verifyChanBackup(input: ChanBackupSnapshot, options?: RpcOptions): UnaryCall<ChanBackupSnapshot, VerifyChanBackupResponse> {
|
||||
const method = this.methods[52], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[54], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ChanBackupSnapshot, VerifyChanBackupResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1464,7 +1583,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: RestoreChannelBackups(lnrpc.RestoreChanBackupRequest) returns (lnrpc.RestoreBackupResponse);
|
||||
*/
|
||||
restoreChannelBackups(input: RestoreChanBackupRequest, options?: RpcOptions): UnaryCall<RestoreChanBackupRequest, RestoreBackupResponse> {
|
||||
const method = this.methods[53], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[55], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<RestoreChanBackupRequest, RestoreBackupResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1480,7 +1599,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: SubscribeChannelBackups(lnrpc.ChannelBackupSubscription) returns (stream lnrpc.ChanBackupSnapshot);
|
||||
*/
|
||||
subscribeChannelBackups(input: ChannelBackupSubscription, options?: RpcOptions): ServerStreamingCall<ChannelBackupSubscription, ChanBackupSnapshot> {
|
||||
const method = this.methods[54], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[56], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ChannelBackupSubscription, ChanBackupSnapshot>("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1492,7 +1611,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: BakeMacaroon(lnrpc.BakeMacaroonRequest) returns (lnrpc.BakeMacaroonResponse);
|
||||
*/
|
||||
bakeMacaroon(input: BakeMacaroonRequest, options?: RpcOptions): UnaryCall<BakeMacaroonRequest, BakeMacaroonResponse> {
|
||||
const method = this.methods[55], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[57], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<BakeMacaroonRequest, BakeMacaroonResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1502,7 +1621,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: ListMacaroonIDs(lnrpc.ListMacaroonIDsRequest) returns (lnrpc.ListMacaroonIDsResponse);
|
||||
*/
|
||||
listMacaroonIDs(input: ListMacaroonIDsRequest, options?: RpcOptions): UnaryCall<ListMacaroonIDsRequest, ListMacaroonIDsResponse> {
|
||||
const method = this.methods[56], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[58], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ListMacaroonIDsRequest, ListMacaroonIDsResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1513,7 +1632,7 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: DeleteMacaroonID(lnrpc.DeleteMacaroonIDRequest) returns (lnrpc.DeleteMacaroonIDResponse);
|
||||
*/
|
||||
deleteMacaroonID(input: DeleteMacaroonIDRequest, options?: RpcOptions): UnaryCall<DeleteMacaroonIDRequest, DeleteMacaroonIDResponse> {
|
||||
const method = this.methods[57], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[59], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<DeleteMacaroonIDRequest, DeleteMacaroonIDResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -1524,7 +1643,80 @@ export class LightningClient implements ILightningClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: ListPermissions(lnrpc.ListPermissionsRequest) returns (lnrpc.ListPermissionsResponse);
|
||||
*/
|
||||
listPermissions(input: ListPermissionsRequest, options?: RpcOptions): UnaryCall<ListPermissionsRequest, ListPermissionsResponse> {
|
||||
const method = this.methods[58], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[60], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ListPermissionsRequest, ListPermissionsResponse>("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: CheckMacPermRequest, options?: RpcOptions): UnaryCall<CheckMacPermRequest, CheckMacPermResponse> {
|
||||
const method = this.methods[61], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<CheckMacPermRequest, CheckMacPermResponse>("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?: RpcOptions): DuplexStreamingCall<RPCMiddlewareResponse, RPCMiddlewareRequest> {
|
||||
const method = this.methods[62], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<RPCMiddlewareResponse, RPCMiddlewareRequest>("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: SendCustomMessageRequest, options?: RpcOptions): UnaryCall<SendCustomMessageRequest, SendCustomMessageResponse> {
|
||||
const method = this.methods[63], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<SendCustomMessageRequest, SendCustomMessageResponse>("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: SubscribeCustomMessagesRequest, options?: RpcOptions): ServerStreamingCall<SubscribeCustomMessagesRequest, CustomMessage> {
|
||||
const method = this.methods[64], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<SubscribeCustomMessagesRequest, CustomMessage>("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: ListAliasesRequest, options?: RpcOptions): UnaryCall<ListAliasesRequest, ListAliasesResponse> {
|
||||
const method = this.methods[65], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ListAliasesRequest, ListAliasesResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf rpc: LookupHtlc(lnrpc.LookupHtlcRequest) returns (lnrpc.LookupHtlcResponse);
|
||||
*/
|
||||
lookupHtlc(input: LookupHtlcRequest, options?: RpcOptions): UnaryCall<LookupHtlcRequest, LookupHtlcResponse> {
|
||||
const method = this.methods[66], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<LookupHtlcRequest, LookupHtlcResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
|||
// @generated by protobuf-ts 2.5.0 with parameter long_type_string
|
||||
// @generated by protobuf-ts 2.5.0
|
||||
// @generated from protobuf file "router.proto" (package "routerrpc", syntax proto3)
|
||||
// tslint:disable
|
||||
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
||||
|
|
@ -26,15 +26,16 @@ import type { QueryMissionControlResponse } from "./router";
|
|||
import type { QueryMissionControlRequest } from "./router";
|
||||
import type { ResetMissionControlResponse } from "./router";
|
||||
import type { ResetMissionControlRequest } from "./router";
|
||||
import type { HTLCAttempt } from "./rpc";
|
||||
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 { stackIntercept } from "@protobuf-ts/runtime-rpc";
|
||||
import type { Payment } from "./rpc";
|
||||
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";
|
||||
|
|
@ -62,6 +63,18 @@ export interface IRouterClient {
|
|||
* @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
|
||||
|
|
@ -234,6 +247,21 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
const method = this.methods[1], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<TrackPaymentRequest, Payment>("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: TrackPaymentsRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentsRequest, Payment> {
|
||||
const method = this.methods[2], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<TrackPaymentsRequest, Payment>("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
|
||||
|
|
@ -242,7 +270,7 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: EstimateRouteFee(routerrpc.RouteFeeRequest) returns (routerrpc.RouteFeeResponse);
|
||||
*/
|
||||
estimateRouteFee(input: RouteFeeRequest, options?: RpcOptions): UnaryCall<RouteFeeRequest, RouteFeeResponse> {
|
||||
const method = this.methods[2], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[3], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<RouteFeeRequest, RouteFeeResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -257,7 +285,7 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: SendToRoute(routerrpc.SendToRouteRequest) returns (routerrpc.SendToRouteResponse);
|
||||
*/
|
||||
sendToRoute(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, SendToRouteResponse> {
|
||||
const method = this.methods[3], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[4], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<SendToRouteRequest, SendToRouteResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -270,7 +298,7 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: SendToRouteV2(routerrpc.SendToRouteRequest) returns (lnrpc.HTLCAttempt);
|
||||
*/
|
||||
sendToRouteV2(input: SendToRouteRequest, options?: RpcOptions): UnaryCall<SendToRouteRequest, HTLCAttempt> {
|
||||
const method = this.methods[4], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[5], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<SendToRouteRequest, HTLCAttempt>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -281,7 +309,7 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: ResetMissionControl(routerrpc.ResetMissionControlRequest) returns (routerrpc.ResetMissionControlResponse);
|
||||
*/
|
||||
resetMissionControl(input: ResetMissionControlRequest, options?: RpcOptions): UnaryCall<ResetMissionControlRequest, ResetMissionControlResponse> {
|
||||
const method = this.methods[5], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[6], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ResetMissionControlRequest, ResetMissionControlResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -292,7 +320,7 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: QueryMissionControl(routerrpc.QueryMissionControlRequest) returns (routerrpc.QueryMissionControlResponse);
|
||||
*/
|
||||
queryMissionControl(input: QueryMissionControlRequest, options?: RpcOptions): UnaryCall<QueryMissionControlRequest, QueryMissionControlResponse> {
|
||||
const method = this.methods[6], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[7], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<QueryMissionControlRequest, QueryMissionControlResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -305,7 +333,7 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: XImportMissionControl(routerrpc.XImportMissionControlRequest) returns (routerrpc.XImportMissionControlResponse);
|
||||
*/
|
||||
xImportMissionControl(input: XImportMissionControlRequest, options?: RpcOptions): UnaryCall<XImportMissionControlRequest, XImportMissionControlResponse> {
|
||||
const method = this.methods[7], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[8], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<XImportMissionControlRequest, XImportMissionControlResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -315,7 +343,7 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: GetMissionControlConfig(routerrpc.GetMissionControlConfigRequest) returns (routerrpc.GetMissionControlConfigResponse);
|
||||
*/
|
||||
getMissionControlConfig(input: GetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<GetMissionControlConfigRequest, GetMissionControlConfigResponse> {
|
||||
const method = this.methods[8], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[9], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<GetMissionControlConfigRequest, GetMissionControlConfigResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -326,7 +354,7 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: SetMissionControlConfig(routerrpc.SetMissionControlConfigRequest) returns (routerrpc.SetMissionControlConfigResponse);
|
||||
*/
|
||||
setMissionControlConfig(input: SetMissionControlConfigRequest, options?: RpcOptions): UnaryCall<SetMissionControlConfigRequest, SetMissionControlConfigResponse> {
|
||||
const method = this.methods[9], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[10], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<SetMissionControlConfigRequest, SetMissionControlConfigResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -337,7 +365,7 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: QueryProbability(routerrpc.QueryProbabilityRequest) returns (routerrpc.QueryProbabilityResponse);
|
||||
*/
|
||||
queryProbability(input: QueryProbabilityRequest, options?: RpcOptions): UnaryCall<QueryProbabilityRequest, QueryProbabilityResponse> {
|
||||
const method = this.methods[10], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[11], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<QueryProbabilityRequest, QueryProbabilityResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -349,7 +377,7 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: BuildRoute(routerrpc.BuildRouteRequest) returns (routerrpc.BuildRouteResponse);
|
||||
*/
|
||||
buildRoute(input: BuildRouteRequest, options?: RpcOptions): UnaryCall<BuildRouteRequest, BuildRouteResponse> {
|
||||
const method = this.methods[11], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[12], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<BuildRouteRequest, BuildRouteResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -360,7 +388,7 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: SubscribeHtlcEvents(routerrpc.SubscribeHtlcEventsRequest) returns (stream routerrpc.HtlcEvent);
|
||||
*/
|
||||
subscribeHtlcEvents(input: SubscribeHtlcEventsRequest, options?: RpcOptions): ServerStreamingCall<SubscribeHtlcEventsRequest, HtlcEvent> {
|
||||
const method = this.methods[12], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[13], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<SubscribeHtlcEventsRequest, HtlcEvent>("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -373,7 +401,7 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: SendPayment(routerrpc.SendPaymentRequest) returns (stream routerrpc.PaymentStatus);
|
||||
*/
|
||||
sendPayment(input: SendPaymentRequest, options?: RpcOptions): ServerStreamingCall<SendPaymentRequest, PaymentStatus> {
|
||||
const method = this.methods[13], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[14], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<SendPaymentRequest, PaymentStatus>("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -385,7 +413,7 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: TrackPayment(routerrpc.TrackPaymentRequest) returns (stream routerrpc.PaymentStatus);
|
||||
*/
|
||||
trackPayment(input: TrackPaymentRequest, options?: RpcOptions): ServerStreamingCall<TrackPaymentRequest, PaymentStatus> {
|
||||
const method = this.methods[14], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[15], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<TrackPaymentRequest, PaymentStatus>("serverStreaming", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
|
|
@ -399,7 +427,7 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: HtlcInterceptor(stream routerrpc.ForwardHtlcInterceptResponse) returns (stream routerrpc.ForwardHtlcInterceptRequest);
|
||||
*/
|
||||
htlcInterceptor(options?: RpcOptions): DuplexStreamingCall<ForwardHtlcInterceptResponse, ForwardHtlcInterceptRequest> {
|
||||
const method = this.methods[15], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[16], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ForwardHtlcInterceptResponse, ForwardHtlcInterceptRequest>("duplex", this._transport, method, opt);
|
||||
}
|
||||
/**
|
||||
|
|
@ -412,7 +440,7 @@ export class RouterClient implements IRouterClient, ServiceInfo {
|
|||
* @generated from protobuf rpc: UpdateChanStatus(routerrpc.UpdateChanStatusRequest) returns (routerrpc.UpdateChanStatusResponse);
|
||||
*/
|
||||
updateChanStatus(input: UpdateChanStatusRequest, options?: RpcOptions): UnaryCall<UpdateChanStatusRequest, UpdateChanStatusResponse> {
|
||||
const method = this.methods[16], opt = this._transport.mergeOptions(options);
|
||||
const method = this.methods[17], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<UpdateChanStatusRequest, UpdateChanStatusResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,6 @@
|
|||
syntax = "proto3";
|
||||
|
||||
import "rpc.proto";
|
||||
import "lightning.proto";
|
||||
|
||||
package invoicesrpc;
|
||||
|
||||
|
|
@ -35,10 +35,17 @@ service Invoices {
|
|||
settled, this call will succeed.
|
||||
*/
|
||||
rpc SettleInvoice (SettleInvoiceMsg) returns (SettleInvoiceResp);
|
||||
|
||||
/*
|
||||
LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced
|
||||
using either its payment hash, payment address, or set ID.
|
||||
*/
|
||||
rpc LookupInvoiceV2 (LookupInvoiceMsg) returns (lnrpc.Invoice);
|
||||
}
|
||||
|
||||
message CancelInvoiceMsg {
|
||||
// Hash corresponding to the (hold) invoice to cancel.
|
||||
// Hash corresponding to the (hold) invoice to cancel. When using
|
||||
// REST, this field must be encoded as base64.
|
||||
bytes payment_hash = 1;
|
||||
}
|
||||
message CancelInvoiceResp {
|
||||
|
|
@ -98,11 +105,26 @@ message AddHoldInvoiceRequest {
|
|||
|
||||
message AddHoldInvoiceResp {
|
||||
/*
|
||||
A bare-bones invoice for a payment within the Lightning Network. With the
|
||||
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.
|
||||
*/
|
||||
string payment_request = 1;
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
uint64 add_index = 2;
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
bytes payment_addr = 3;
|
||||
}
|
||||
|
||||
message SettleInvoiceMsg {
|
||||
|
|
@ -117,6 +139,37 @@ message SettleInvoiceResp {
|
|||
message SubscribeSingleInvoiceRequest {
|
||||
reserved 1;
|
||||
|
||||
// Hash corresponding to the (hold) invoice to subscribe to.
|
||||
// Hash corresponding to the (hold) invoice to subscribe to. When using
|
||||
// REST, this field must be encoded as base64url.
|
||||
bytes r_hash = 2;
|
||||
}
|
||||
|
||||
enum LookupModifier {
|
||||
// The default look up modifier, no look up behavior is changed.
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
HTLC_SET_BLANK = 2;
|
||||
}
|
||||
|
||||
message LookupInvoiceMsg {
|
||||
oneof invoice_ref {
|
||||
// When using REST, this field must be encoded as base64.
|
||||
bytes payment_hash = 1;
|
||||
bytes payment_addr = 2;
|
||||
bytes set_id = 3;
|
||||
}
|
||||
|
||||
LookupModifier lookup_modifier = 4;
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,6 @@
|
|||
syntax = "proto3";
|
||||
|
||||
import "rpc.proto";
|
||||
import "lightning.proto";
|
||||
|
||||
package routerrpc;
|
||||
|
||||
|
|
@ -22,6 +22,16 @@ service Router {
|
|||
*/
|
||||
rpc TrackPaymentV2 (TrackPaymentRequest) returns (stream lnrpc.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.
|
||||
*/
|
||||
rpc TrackPayments (TrackPaymentsRequest) returns (stream lnrpc.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.
|
||||
|
|
@ -284,6 +294,12 @@ message SendPaymentRequest {
|
|||
If set, an AMP-payment will be attempted.
|
||||
*/
|
||||
bool amp = 22;
|
||||
|
||||
/*
|
||||
The time preference for this payment. Set to -1 to optimize for fees
|
||||
only, to 1 to optimize for reliability only or a value inbetween for a mix.
|
||||
*/
|
||||
double time_pref = 23;
|
||||
}
|
||||
|
||||
message TrackPaymentRequest {
|
||||
|
|
@ -297,6 +313,14 @@ message TrackPaymentRequest {
|
|||
bool no_inflight_updates = 2;
|
||||
}
|
||||
|
||||
message TrackPaymentsRequest {
|
||||
/*
|
||||
If set, only the final payment updates are streamed back. Intermediate
|
||||
updates that show which htlcs are still in flight are suppressed.
|
||||
*/
|
||||
bool no_inflight_updates = 1;
|
||||
}
|
||||
|
||||
message RouteFeeRequest {
|
||||
/*
|
||||
The destination once wishes to obtain a routing fee quote to.
|
||||
|
|
@ -330,6 +354,14 @@ message SendToRouteRequest {
|
|||
|
||||
// Route that should be used to attempt to complete the payment.
|
||||
lnrpc.Route route = 2;
|
||||
|
||||
/*
|
||||
Whether the payment should be marked as failed when a temporary error is
|
||||
returned from the given route. Set it to true so the payment won't be
|
||||
failed unless a terminal error is occurred, such as payment timeout, no
|
||||
routes, incorrect payment details, or insufficient funds.
|
||||
*/
|
||||
bool skip_temp_err = 3;
|
||||
}
|
||||
|
||||
message SendToRouteResponse {
|
||||
|
|
@ -360,6 +392,11 @@ message QueryMissionControlResponse {
|
|||
message XImportMissionControlRequest {
|
||||
// Node pair-level mission control state to be imported.
|
||||
repeated PairHistory pairs = 1;
|
||||
|
||||
// Whether to force override MC pair history. Note that even with force
|
||||
// override the failure pair is imported before the success pair and both
|
||||
// still clamp existing failure/success amounts.
|
||||
bool force = 2;
|
||||
}
|
||||
|
||||
message XImportMissionControlResponse {
|
||||
|
|
@ -581,6 +618,8 @@ message HtlcEvent {
|
|||
ForwardFailEvent forward_fail_event = 8;
|
||||
SettleEvent settle_event = 9;
|
||||
LinkFailEvent link_fail_event = 10;
|
||||
SubscribedEvent subscribed_event = 11;
|
||||
FinalHtlcEvent final_htlc_event = 12;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -607,6 +646,16 @@ message ForwardFailEvent {
|
|||
}
|
||||
|
||||
message SettleEvent {
|
||||
// The revealed preimage.
|
||||
bytes preimage = 1;
|
||||
}
|
||||
|
||||
message FinalHtlcEvent {
|
||||
bool settled = 1;
|
||||
bool offchain = 2;
|
||||
}
|
||||
|
||||
message SubscribedEvent {
|
||||
}
|
||||
|
||||
message LinkFailEvent {
|
||||
|
|
@ -676,7 +725,7 @@ enum PaymentState {
|
|||
FAILED_NO_ROUTE = 3;
|
||||
|
||||
/*
|
||||
A non-recoverable error has occured.
|
||||
A non-recoverable error has occurred.
|
||||
*/
|
||||
FAILED_ERROR = 4;
|
||||
|
||||
|
|
@ -753,6 +802,10 @@ message ForwardHtlcInterceptRequest {
|
|||
|
||||
// The onion blob for the next hop
|
||||
bytes onion_blob = 9;
|
||||
|
||||
// The block height at which this htlc will be auto-failed to prevent the
|
||||
// channel from force-closing.
|
||||
int32 auto_fail_height = 10;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -774,6 +827,21 @@ message ForwardHtlcInterceptResponse {
|
|||
|
||||
// The preimage in case the resolve action is Settle.
|
||||
bytes preimage = 3;
|
||||
|
||||
// Encrypted failure message in case the resolve action is Fail.
|
||||
//
|
||||
// If failure_message is specified, the failure_code field must be set
|
||||
// to zero.
|
||||
bytes failure_message = 4;
|
||||
|
||||
// Return the specified failure code in case the resolve action is Fail. The
|
||||
// message data fields are populated automatically.
|
||||
//
|
||||
// If a non-zero failure_code is specified, failure_message must not be set.
|
||||
//
|
||||
// For backwards-compatibility reasons, TEMPORARY_CHANNEL_FAILURE is the
|
||||
// default value for this field.
|
||||
lnrpc.Failure.FailureCode failure_code = 5;
|
||||
}
|
||||
|
||||
enum ResolveHoldForwardAction {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ service LightningPub {
|
|||
option (http_route) = "/api/user/auth";
|
||||
}
|
||||
// USER
|
||||
rpc NewAddress(structs.Empty) returns (structs.NewAddressResponse) {
|
||||
rpc NewAddress(structs.NewAddressRequest) returns (structs.NewAddressResponse) {
|
||||
option (auth_type) = "User";
|
||||
option (http_method) = "post";
|
||||
option (http_route) = "/api/user/chain/new";
|
||||
|
|
|
|||
|
|
@ -19,7 +19,14 @@ message LndGetInfoRequest {
|
|||
message LndGetInfoResponse {
|
||||
string alias = 1;
|
||||
}
|
||||
|
||||
enum AddressType {
|
||||
WITNESS_PUBKEY_HASH = 0;
|
||||
NESTED_PUBKEY_HASH = 1;
|
||||
TAPROOT_PUBKEY = 2;
|
||||
}
|
||||
message NewAddressRequest {
|
||||
AddressType address_type = 1;
|
||||
}
|
||||
message NewAddressResponse{
|
||||
string address = 1;
|
||||
}
|
||||
|
|
@ -41,7 +48,8 @@ message NewInvoiceResponse{
|
|||
}
|
||||
|
||||
message PayInvoiceRequest{
|
||||
string invoce = 1;
|
||||
string invoice = 1;
|
||||
int64 amount = 2;
|
||||
}
|
||||
|
||||
message PayInvoiceResponse{
|
||||
|
|
@ -50,8 +58,9 @@ message PayInvoiceResponse{
|
|||
|
||||
message OpenChannelRequest{
|
||||
string destination = 1;
|
||||
int64 channel_balance = 2;
|
||||
int64 funding_amount = 2;
|
||||
int64 push_amount = 3;
|
||||
string close_address = 4;
|
||||
}
|
||||
|
||||
message OpenChannelResponse{
|
||||
|
|
|
|||
16
src/auth.ts
16
src/auth.ts
|
|
@ -1,10 +1,12 @@
|
|||
import { ServerOptions } from "../proto/autogenerated/ts/express_server";
|
||||
|
||||
const serverOptions: ServerOptions = {
|
||||
AdminAuthGuard: async (authHeader) => { console.log("admin auth login with header: " + authHeader); return { admin_token: "__Admin__" } },
|
||||
UserAuthGuard: async (authHeader) => { console.log("user auth login with header: " + authHeader); return { user_token: "__user__" } },
|
||||
GuestAuthGuard: async (_) => ({}),
|
||||
encryptCallback: async (_, b) => b,
|
||||
decryptCallback: async (_, b) => b,
|
||||
import Main from './services/main'
|
||||
const serverOptions = (mainHandler: Main): ServerOptions => {
|
||||
return {
|
||||
AdminAuthGuard: async (authHeader) => { console.log("admin auth login with header: " + authHeader); return { admin_id: "__Admin__" } },
|
||||
UserAuthGuard: async (authHeader) => { return { user_id: mainHandler.DecodeUserToken(authHeader) } },
|
||||
GuestAuthGuard: async (_) => ({}),
|
||||
encryptCallback: async (_, b) => b,
|
||||
decryptCallback: async (_, b) => b,
|
||||
}
|
||||
}
|
||||
export default serverOptions
|
||||
|
|
@ -1,37 +1,59 @@
|
|||
import 'dotenv/config' // TODO - test env
|
||||
import { AfterAll, BeforeAll, expect, Test, TestSuite } from 'testyts';
|
||||
import { AfterAll, BeforeAll, expect, FTest, Test, TestSuite } from 'testyts';
|
||||
import NewServer from '../proto/autogenerated/ts/express_server'
|
||||
import NewClient from '../proto/autogenerated/ts/http_client'
|
||||
import methods from './services/serverMethods';
|
||||
import serverOptions from './auth';
|
||||
import GetServerMethods from './services/serverMethods'
|
||||
import Main, { LoadMainSettingsFromEnv } from './services/main'
|
||||
import * as Types from '../proto/autogenerated/ts/types';
|
||||
const testPort = 4000
|
||||
const server = NewServer(methods, { ...serverOptions, throwErrors: true })
|
||||
const client = NewClient({
|
||||
baseUrl: `http://localhost:${testPort}`,
|
||||
retrieveAdminAuth: async () => (""),
|
||||
retrieveGuestAuth: async () => (""),
|
||||
retrieveUserAuth: async () => (""),
|
||||
decryptCallback: async (b) => b,
|
||||
encryptCallback: async (b) => b,
|
||||
deviceId: "device0"
|
||||
})
|
||||
|
||||
@TestSuite()
|
||||
export class ServerTestSuite {
|
||||
userAuthHeader = ""
|
||||
client = NewClient({
|
||||
baseUrl: `http://localhost:${testPort}`,
|
||||
retrieveAdminAuth: async () => (""),
|
||||
retrieveGuestAuth: async () => (""),
|
||||
retrieveUserAuth: async () => this.userAuthHeader,
|
||||
decryptCallback: async (b) => b,
|
||||
encryptCallback: async (b) => b,
|
||||
deviceId: "device0"
|
||||
})
|
||||
mainHandler = new Main(LoadMainSettingsFromEnv()) // TODO - test env file
|
||||
server = NewServer(GetServerMethods(this.mainHandler), { ...serverOptions(this.mainHandler), throwErrors: true })
|
||||
|
||||
|
||||
@BeforeAll()
|
||||
startServer() {
|
||||
server.Listen(testPort)
|
||||
async startServer() {
|
||||
await this.mainHandler.storage.Connect()
|
||||
this.server.Listen(testPort)
|
||||
}
|
||||
@AfterAll()
|
||||
stopServer() {
|
||||
server.Close()
|
||||
this.server.Close()
|
||||
}
|
||||
@Test()
|
||||
async health() {
|
||||
await client.Health()
|
||||
await this.client.Health()
|
||||
}
|
||||
|
||||
@Test()
|
||||
async getInfo() {
|
||||
console.log(await client.LndGetInfo({ node_id: 0 }))
|
||||
console.log(await this.client.LndGetInfo({ node_id: 0 }))
|
||||
}
|
||||
@Test()
|
||||
async createUser() {
|
||||
const res = await this.client.AddUser({ name: "test", callback_url: "http://...", secret: "shhhhhht" })
|
||||
if (res.status === 'ERROR') throw new Error(res.reason)
|
||||
console.log(res.result)
|
||||
const user = await this.mainHandler.storage.GetUser(res.result.user_id)
|
||||
console.log(user)
|
||||
this.userAuthHeader = res.result.auth_token
|
||||
}
|
||||
@Test()
|
||||
async newAddress() {
|
||||
console.log(await this.client.NewAddress({ address_type: Types.AddressType.WITNESS_PUBKEY_HASH }))
|
||||
}
|
||||
}
|
||||
12
src/index.ts
12
src/index.ts
|
|
@ -2,14 +2,10 @@ import 'dotenv/config'
|
|||
import NewServer from '../proto/autogenerated/ts/express_server'
|
||||
import GetServerMethods from './services/serverMethods'
|
||||
import serverOptions from './auth';
|
||||
import Storage from './services/storage'
|
||||
import LND from './services/lnd'
|
||||
import Main from './services/main'
|
||||
import Main, { LoadMainSettingsFromEnv } from './services/main'
|
||||
(async () => {
|
||||
const storageHandler = new Storage()
|
||||
const lndHandler = new LND()
|
||||
const mainHandler = new Main(storageHandler, lndHandler)
|
||||
await storageHandler.Connect()
|
||||
const Server = NewServer(GetServerMethods(mainHandler), serverOptions)
|
||||
const mainHandler = new Main(LoadMainSettingsFromEnv())
|
||||
await mainHandler.storage.Connect()
|
||||
const Server = NewServer(GetServerMethods(mainHandler), serverOptions(mainHandler))
|
||||
Server.Listen(3000)
|
||||
})()
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
import NewServer from '../proto/autogenerated/ts/express_server'
|
||||
import GetServerMethods from './services/serverMethods'
|
||||
import serverOptions from './auth';
|
||||
export default NewServer(GetServerMethods(), serverOptions)
|
||||
34
src/services/lnd/addInvoiceReq.ts
Normal file
34
src/services/lnd/addInvoiceReq.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { OpenChannelRequest, Invoice } from "../../../proto/lnd/lightning";
|
||||
|
||||
export const AddInvoiceReq = (value: number, memo = "", privateHints = false, expiry = 60 * 60): Invoice => ({
|
||||
expiry: BigInt(expiry),
|
||||
memo: memo,
|
||||
private: privateHints,
|
||||
value: BigInt(value),
|
||||
|
||||
fallbackAddr: "",
|
||||
cltvExpiry: 0n,
|
||||
descriptionHash: Buffer.alloc(0),
|
||||
features: {},
|
||||
isAmp: false,
|
||||
rPreimage: Buffer.alloc(0),
|
||||
routeHints: [],
|
||||
valueMsat: 0n,
|
||||
|
||||
addIndex: 0n,
|
||||
ampInvoiceState: {},
|
||||
amtPaidMsat: 0n,
|
||||
amtPaidSat: 0n,
|
||||
creationDate: 0n,
|
||||
htlcs: [],
|
||||
isKeysend: false,
|
||||
paymentAddr: Buffer.alloc(0),
|
||||
paymentRequest: "",
|
||||
rHash: Buffer.alloc(0),
|
||||
settleDate: 0n,
|
||||
settleIndex: 0n,
|
||||
state: 0,
|
||||
|
||||
amtPaid: 0n,
|
||||
settled: false,
|
||||
})
|
||||
36
src/services/lnd/index.spec.ts
Normal file
36
src/services/lnd/index.spec.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import 'dotenv/config' // TODO - test env
|
||||
import { AfterAll, BeforeAll, expect, FTest, FTestSuite, Test, TestSuite } from 'testyts';
|
||||
import LndHandler, { LoadLndSettingsFromEnv } from '.'
|
||||
import * as Types from '../../../proto/autogenerated/ts/types';
|
||||
@TestSuite()
|
||||
export class LndTestSuite {
|
||||
lnd: LndHandler
|
||||
@BeforeAll()
|
||||
createLnd() {
|
||||
this.lnd = new LndHandler(LoadLndSettingsFromEnv())
|
||||
}
|
||||
@AfterAll()
|
||||
stopStreams() {
|
||||
}
|
||||
@Test()
|
||||
async getAlias() {
|
||||
const res = await this.lnd.GetInfo()
|
||||
expect.toBeEqual(res.alias, "alice")
|
||||
}
|
||||
@Test()
|
||||
async newAddress() {
|
||||
const res = await this.lnd.NewAddress(Types.AddressType.WITNESS_PUBKEY_HASH)
|
||||
console.log(res)
|
||||
}
|
||||
@Test()
|
||||
async newInvoice() {
|
||||
const res = await this.lnd.NewInvoice(1000)
|
||||
console.log(res)
|
||||
}
|
||||
|
||||
@Test()
|
||||
async openChannel() {
|
||||
//const res = await this.lnd.OpenChannel("025ed7fc85fc05a07fc5acc13a6e3836cd11c5587c1d400afcd22630a9e230eb7a", "", 20000, 0)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,22 +2,72 @@
|
|||
import { credentials, Metadata } from '@grpc/grpc-js'
|
||||
import { GrpcTransport } from "@protobuf-ts/grpc-transport";
|
||||
import fs from 'fs'
|
||||
import { LightningClient } from '../../../proto/lnd/rpc.client'
|
||||
import * as Types from '../../../proto/autogenerated/ts/types'
|
||||
import { LightningClient } from '../../../proto/lnd/lightning.client'
|
||||
import { InvoicesClient } from '../../../proto/lnd/invoices.client'
|
||||
import { RouterClient } from '../../../proto/lnd/router.client'
|
||||
import { GetInfoResponse } from '../../../proto/lnd/rpc'
|
||||
const DefaultMetadata = (deadline = 10 * 1000) => ({ deadline: Date.now() + deadline })
|
||||
import { GetInfoResponse, AddressType, NewAddressResponse, AddInvoiceResponse, Invoice_InvoiceState, PayReq, Payment_PaymentStatus, Payment } from '../../../proto/lnd/lightning'
|
||||
import { OpenChannelReq } from './openChannelReq';
|
||||
import { AddInvoiceReq } from './addInvoiceReq';
|
||||
import { PayInvoiceReq } from './payInvoiceReq';
|
||||
const DeadLineMetadata = (deadline = 10 * 1000) => ({ deadline: Date.now() + deadline })
|
||||
export type LndSettings = {
|
||||
lndAddr: string
|
||||
lndCertPath: string
|
||||
lndMacaroonPath: string
|
||||
walletAccount: string
|
||||
feeRateLimit: number
|
||||
feeFixedLimit: number
|
||||
}
|
||||
export const LoadLndSettingsFromEnv = (test = false): LndSettings => {
|
||||
const lndAddr = process.env.LND_ADDRESS;
|
||||
const lndCertPath = process.env.LND_CERT_PATH;
|
||||
const lndMacaroonPath = process.env.LND_MACAROON_PATH;
|
||||
if (!lndAddr) throw new Error(`missing env for LND_ADDRESS`)
|
||||
if (!lndCertPath) throw new Error(`missing env for LND_CERT_PATH`)
|
||||
if (!lndMacaroonPath) throw new Error(`missing env for LND_MACAROON_PATH`)
|
||||
|
||||
if (!process.env.LIMIT_FEE_RATE_MILLISATS) {
|
||||
throw new Error(`missing env for LIMIT_FEE_RATE_MILLISATS`)
|
||||
}
|
||||
if (isNaN(+process.env.LIMIT_FEE_RATE_MILLISATS) || !Number.isInteger(+process.env.LIMIT_FEE_RATE_MILLISATS)) {
|
||||
throw new Error("LIMIT_FEE_RATE_MILLISATS must be an integer number");
|
||||
}
|
||||
|
||||
if (!process.env.LIMIT_FEE_FIXED_SATS) {
|
||||
throw new Error(`missing env for LIMIT_FEE_FIXED_SATS`)
|
||||
}
|
||||
if (isNaN(+process.env.LIMIT_FEE_FIXED_SATS) || !Number.isInteger(+process.env.LIMIT_FEE_FIXED_SATS)) {
|
||||
throw new Error("LIMIT_FEE_FIXED_SATS must be an integer number");
|
||||
}
|
||||
const feeRateLimit = +process.env.LIMIT_FEE_RATE_MILLISATS / 1000
|
||||
const feeFixedLimit = +process.env.LIMIT_FEE_FIXED_SATS
|
||||
|
||||
const walletAccount = process.env.LND_WALLET_ACCOUNT || ""
|
||||
return { lndAddr, lndCertPath, lndMacaroonPath, walletAccount, feeRateLimit, feeFixedLimit }
|
||||
}
|
||||
type TxOutput = {
|
||||
hash: string
|
||||
index: number
|
||||
}
|
||||
export type AddressPaidCb = (txOutput: TxOutput, address: string, amount: number) => void
|
||||
export type InvoicePaidCb = (paymentRequest: string, amount: number) => void
|
||||
export default class {
|
||||
lightning: LightningClient
|
||||
invoices: InvoicesClient
|
||||
router: RouterClient
|
||||
constructor() {
|
||||
const lndAddr = process.env.LND_ADDRESS;
|
||||
const lndCertPath = process.env.LND_CERT_PATH;
|
||||
const lndMacaroonPath = process.env.LND_MACAROON_PATH;
|
||||
if (!lndAddr || !lndCertPath || !lndMacaroonPath) {
|
||||
throw new Error(`Something missing from ADDR/TLS/MACAROON`);
|
||||
}
|
||||
settings: LndSettings
|
||||
ready = false
|
||||
latestKnownBlockHeigh = 0
|
||||
latestKnownSettleIndex = 0
|
||||
abortController = new AbortController()
|
||||
addressPaidCb: AddressPaidCb
|
||||
invoicePaidCb: InvoicePaidCb
|
||||
constructor(settings: LndSettings, addressPaidCb: AddressPaidCb, invoicePaidCb: InvoicePaidCb) {
|
||||
this.settings = settings
|
||||
this.addressPaidCb = addressPaidCb
|
||||
this.invoicePaidCb = invoicePaidCb
|
||||
const { lndAddr, lndCertPath, lndMacaroonPath } = this.settings
|
||||
const lndCert = fs.readFileSync(lndCertPath);
|
||||
const macaroon = fs.readFileSync(lndMacaroonPath).toString('hex');
|
||||
const sslCreds = credentials.createSsl(lndCert);
|
||||
|
|
@ -36,36 +86,134 @@ export default class {
|
|||
this.lightning = new LightningClient(transport)
|
||||
this.invoices = new InvoicesClient(transport)
|
||||
this.router = new RouterClient(transport)
|
||||
this.SubscribeAddressPaid()
|
||||
}
|
||||
Stop() {
|
||||
this.abortController.abort()
|
||||
}
|
||||
async Warmup() { this.ready = true }
|
||||
|
||||
async GetInfo(): Promise<GetInfoResponse> {
|
||||
const res = await this.lightning.getInfo({}, DefaultMetadata())
|
||||
const res = await this.lightning.getInfo({}, DeadLineMetadata())
|
||||
return res.response
|
||||
}
|
||||
async OpenChannel(destination: string, closeAddress: string, fundingAmount: number, pushSats) {
|
||||
const stream = this.lightning.openChannel({
|
||||
nodePubkey: Buffer.from(destination, 'hex'),
|
||||
closeAddress: closeAddress,
|
||||
localFundingAmount: fundingAmount,
|
||||
pushSats: pushSats,
|
||||
sa: satPerByte
|
||||
checkReady() {
|
||||
if (!this.ready) throw new Error("lnd not ready, warmup required before usage")
|
||||
}
|
||||
SubscribeAddressPaid() {
|
||||
const stream = this.lightning.subscribeTransactions({
|
||||
account: this.settings.walletAccount,
|
||||
endHeight: 0,
|
||||
startHeight: this.latestKnownBlockHeigh,
|
||||
}, { abort: this.abortController.signal })
|
||||
stream.responses.onMessage(tx => {
|
||||
if (tx.blockHeight > this.latestKnownBlockHeigh) {
|
||||
this.latestKnownBlockHeigh = tx.blockHeight
|
||||
}
|
||||
if (tx.numConfirmations > 0) {
|
||||
tx.outputDetails.forEach(output => {
|
||||
if (output.isOurAddress) {
|
||||
this.addressPaidCb({ hash: tx.txHash, index: Number(output.outputIndex) }, output.address, Number(output.amount))
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
stream.responses.onError(error => {
|
||||
// TODO...
|
||||
})
|
||||
}
|
||||
|
||||
return new Promise(res => {
|
||||
stream.on('data', response => {
|
||||
if (response) {
|
||||
res(true)
|
||||
SubscribeInvoicePaid() {
|
||||
const stream = this.lightning.subscribeInvoices({
|
||||
settleIndex: BigInt(this.latestKnownSettleIndex),
|
||||
addIndex: 0n,
|
||||
}, { abort: this.abortController.signal })
|
||||
stream.responses.onMessage(invoice => {
|
||||
if (invoice.state === Invoice_InvoiceState.SETTLED) {
|
||||
this.latestKnownSettleIndex = Number(invoice.settleIndex)
|
||||
this.invoicePaidCb(invoice.paymentRequest, Number(invoice.amtPaidSat))
|
||||
}
|
||||
})
|
||||
stream.responses.onError(error => {
|
||||
// TODO...
|
||||
})
|
||||
}
|
||||
async NewAddress(addressType: Types.AddressType): Promise<NewAddressResponse> {
|
||||
this.checkReady()
|
||||
let lndAddressType: AddressType
|
||||
switch (addressType) {
|
||||
case Types.AddressType.NESTED_PUBKEY_HASH:
|
||||
lndAddressType = AddressType.NESTED_PUBKEY_HASH
|
||||
break;
|
||||
case Types.AddressType.WITNESS_PUBKEY_HASH:
|
||||
lndAddressType = AddressType.WITNESS_PUBKEY_HASH
|
||||
break;
|
||||
case Types.AddressType.TAPROOT_PUBKEY:
|
||||
lndAddressType = AddressType.TAPROOT_PUBKEY
|
||||
break;
|
||||
default:
|
||||
throw new Error("unknown address type " + addressType)
|
||||
}
|
||||
const res = await this.lightning.newAddress({ account: this.settings.walletAccount, type: lndAddressType }, DeadLineMetadata())
|
||||
return res.response
|
||||
}
|
||||
|
||||
async NewInvoice(value: number): Promise<AddInvoiceResponse> {
|
||||
this.checkReady()
|
||||
const res = await this.lightning.addInvoice(AddInvoiceReq(value), DeadLineMetadata())
|
||||
return res.response
|
||||
}
|
||||
|
||||
async DecodeInvoice(paymentRequest: string): Promise<PayReq> {
|
||||
const res = await this.lightning.decodePayReq({ payReq: paymentRequest }, DeadLineMetadata())
|
||||
return res.response
|
||||
}
|
||||
|
||||
GetFeeLimitAmount(amount: number) {
|
||||
return Math.ceil(amount * this.settings.feeRateLimit + this.settings.feeFixedLimit);
|
||||
}
|
||||
|
||||
async PayInvoice(invoice: string, amount: number, feeLimit: number): Promise<Payment> {
|
||||
this.checkReady()
|
||||
const abortController = new AbortController()
|
||||
const stream = this.router.sendPaymentV2(PayInvoiceReq(invoice, amount, feeLimit), { abort: abortController.signal })
|
||||
return new Promise((res, rej) => {
|
||||
stream.responses.onError(error => {
|
||||
rej(error)
|
||||
})
|
||||
stream.responses.onMessage(payment => {
|
||||
switch (payment.status) {
|
||||
case Payment_PaymentStatus.FAILED:
|
||||
rej(payment.failureReason)
|
||||
return
|
||||
case Payment_PaymentStatus.SUCCEEDED:
|
||||
res(payment)
|
||||
}
|
||||
})
|
||||
stream.on('error', err => {
|
||||
if (err) {
|
||||
console.error("err")
|
||||
console.error(err)
|
||||
this.statusAll(true)
|
||||
// move to next client after the refresh
|
||||
.then(() => this.nextPreferredClient())
|
||||
res(false)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
async OpenChannel(destination: string, closeAddress: string, fundingAmount: number, pushSats: number): Promise<string> {
|
||||
this.checkReady()
|
||||
const abortController = new AbortController()
|
||||
const req = OpenChannelReq(destination, closeAddress, fundingAmount, pushSats)
|
||||
const stream = this.lightning.openChannel(req, { abort: abortController.signal })
|
||||
return new Promise((res, rej) => {
|
||||
stream.responses.onMessage(message => {
|
||||
switch (message.update.oneofKind) {
|
||||
case 'chanPending':
|
||||
abortController.abort()
|
||||
res(Buffer.from(message.pendingChanId).toString('base64'))
|
||||
break
|
||||
default:
|
||||
abortController.abort()
|
||||
rej("unexpected state response: " + message.update.oneofKind)
|
||||
}
|
||||
})
|
||||
stream.responses.onError(error => {
|
||||
rej(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
32
src/services/lnd/openChannelReq.ts
Normal file
32
src/services/lnd/openChannelReq.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { OpenChannelRequest } from "../../../proto/lnd/lightning";
|
||||
|
||||
export const OpenChannelReq = (destination: string, closeAddress: string, fundingAmount: number, pushSats: number): OpenChannelRequest => ({
|
||||
nodePubkey: Buffer.from(destination, 'hex'),
|
||||
closeAddress: closeAddress,
|
||||
localFundingAmount: BigInt(fundingAmount),
|
||||
pushSat: BigInt(pushSats),
|
||||
|
||||
satPerVbyte: 0n, // TBD
|
||||
private: false,
|
||||
minConfs: 0, // TBD
|
||||
baseFee: 0n, // TBD
|
||||
feeRate: 0n, // TBD
|
||||
zeroConf: false,
|
||||
maxLocalCsv: 0,
|
||||
remoteCsvDelay: 0,
|
||||
spendUnconfirmed: false,
|
||||
minHtlcMsat: 0n,
|
||||
remoteChanReserveSat: 0n,
|
||||
remoteMaxHtlcs: 0,
|
||||
remoteMaxValueInFlightMsat: 0n,
|
||||
targetConf: 0,
|
||||
useBaseFee: false,
|
||||
useFeeRate: false,
|
||||
|
||||
// Default stuff
|
||||
commitmentType: 0,
|
||||
scidAlias: false,
|
||||
nodePubkeyString: "",
|
||||
satPerByte: 0n,
|
||||
|
||||
})
|
||||
30
src/services/lnd/payInvoiceReq.ts
Normal file
30
src/services/lnd/payInvoiceReq.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { OpenChannelRequest } from "../../../proto/lnd/lightning";
|
||||
import { SendPaymentRequest } from "../../../proto/lnd/router";
|
||||
|
||||
export const PayInvoiceReq = (invoice: string, amount: number, feeLimit: number): SendPaymentRequest => ({
|
||||
amt: BigInt(amount),
|
||||
feeLimitSat: BigInt(feeLimit),
|
||||
noInflightUpdates: true,
|
||||
paymentRequest: invoice,
|
||||
maxParts: 3,
|
||||
timeoutSeconds: 50,
|
||||
|
||||
allowSelfPayment: false,
|
||||
amp: false,
|
||||
amtMsat: 0n,
|
||||
cltvLimit: 0,
|
||||
dest: Buffer.alloc(0),
|
||||
destCustomRecords: {},
|
||||
destFeatures: [],
|
||||
feeLimitMsat: 0n,
|
||||
finalCltvDelta: 0,
|
||||
lastHopPubkey: Buffer.alloc(0),
|
||||
maxShardSizeMsat: 0n,
|
||||
outgoingChanIds: [],
|
||||
paymentAddr: Buffer.alloc(0),
|
||||
paymentHash: Buffer.alloc(0),
|
||||
routeHints: [],
|
||||
timePref: 0,
|
||||
|
||||
outgoingChanId: ""
|
||||
})
|
||||
|
|
@ -1,25 +1,97 @@
|
|||
import Storage from '../storage'
|
||||
import jwt from 'jsonwebtoken'
|
||||
import Storage, { LoadStorageSettingsFromEnv, StorageSettings } from '../storage'
|
||||
import * as Types from '../../../proto/autogenerated/ts/types'
|
||||
import LND from '../lnd'
|
||||
import LND, { AddressPaidCb, InvoicePaidCb, LndSettings, LoadLndSettingsFromEnv } from '../lnd'
|
||||
export type MainSettings = {
|
||||
storageSettings: StorageSettings,
|
||||
lndSettings: LndSettings,
|
||||
jwtSecret: string
|
||||
}
|
||||
export const LoadMainSettingsFromEnv = (test = false): MainSettings => {
|
||||
const jwtSecret = process.env.JWT_SECRET;
|
||||
if (!jwtSecret) throw new Error(`missing env for JWT_SECRET`)
|
||||
return {
|
||||
lndSettings: LoadLndSettingsFromEnv(test),
|
||||
storageSettings: LoadStorageSettingsFromEnv(test),
|
||||
jwtSecret
|
||||
}
|
||||
}
|
||||
export default class {
|
||||
storage: Storage
|
||||
lnd: LND
|
||||
constructor(storageHandler: Storage, lndHandler: LND) {
|
||||
this.storage = storageHandler
|
||||
this.lnd = lndHandler
|
||||
settings: MainSettings
|
||||
constructor(settings: MainSettings) {
|
||||
this.settings = settings
|
||||
this.storage = new Storage(settings.storageSettings)
|
||||
this.lnd = new LND(settings.lndSettings, this.addressPaidCb, this.invoicePaidCb)
|
||||
}
|
||||
addressPaidCb: AddressPaidCb = (txOutput, address, amount) => {
|
||||
this.storage.StartTransaction(async tx => {
|
||||
const userAddress = await this.storage.GetAddressOwner(address, tx)
|
||||
if (!userAddress) { return }
|
||||
// This call will fail if the transaction is already registered
|
||||
const addedTx = await this.storage.AddAddressTransaction(address, txOutput.hash, txOutput.index, amount)
|
||||
await this.storage.IncrementUserBalance(userAddress.user.user_id, addedTx.amount, tx)
|
||||
})
|
||||
}
|
||||
invoicePaidCb: InvoicePaidCb = (paymentRequest, amount) => {
|
||||
this.storage.StartTransaction(async tx => {
|
||||
const userInvoice = await this.storage.GetInvoiceOwner(paymentRequest, tx)
|
||||
if (!userInvoice || userInvoice.paid) { return }
|
||||
// This call will fail if the invoice is already registered
|
||||
await this.storage.FlagInvoiceAsPaid(userInvoice.serial_id, amount, tx)
|
||||
await this.storage.IncrementUserBalance(userInvoice.user.user_id, amount)
|
||||
})
|
||||
}
|
||||
SignUserToken(userId: string): string {
|
||||
return jwt.sign({ userId }, this.settings.jwtSecret);
|
||||
}
|
||||
|
||||
DecodeUserToken(token?: string): string {
|
||||
if (!token) throw new Error("empty auth token provided")
|
||||
return (jwt.verify(token, this.settings.jwtSecret) as { userId: string }).userId
|
||||
}
|
||||
|
||||
async AddUser(req: Types.AddUserRequest): Promise<Types.AddUserResponse> {
|
||||
const newUser = await this.storage.AddUser(req.name, req.callback_url, req.secret)
|
||||
return {
|
||||
user_id: newUser.user_id,
|
||||
auth_token: "TMP"
|
||||
auth_token: this.SignUserToken(newUser.user_id)
|
||||
}
|
||||
}
|
||||
async OpenChannel(req: Types.OpenChannelRequest): Promise<Types.OpenChannelResponse> {
|
||||
|
||||
async NewAddress(userId: string, req: Types.NewAddressRequest): Promise<Types.NewAddressResponse> {
|
||||
const res = await this.lnd.NewAddress(req.address_type)
|
||||
const userAddress = await this.storage.AddUserAddress(userId, res.address)
|
||||
return {
|
||||
address: userAddress.address
|
||||
}
|
||||
}
|
||||
async PayInvoice(rootToken: string, invoice: string): Promise<string> { return "" }
|
||||
async GenerateInvoice(rootToken: string, amountSats: number): Promise<string> { return "" }
|
||||
async GenerateAddress(rootToken: string): Promise<string> { return "" }
|
||||
// payment received sub
|
||||
|
||||
async NewInvoice(userId: string, req: Types.NewInvoiceRequest): Promise<Types.NewInvoiceResponse> {
|
||||
const res = await this.lnd.NewInvoice(req.amount_sats)
|
||||
const userInvoice = await this.storage.AddUserInvoice(userId, res.paymentRequest)
|
||||
return {
|
||||
invoice: userInvoice.invoice
|
||||
}
|
||||
}
|
||||
|
||||
async PayInvoice(userId: string, req: Types.PayInvoiceRequest): Promise<Types.PayInvoiceResponse> {
|
||||
const decoded = await this.lnd.DecodeInvoice(req.invoice)
|
||||
const payAmount = Number(decoded.numSatoshis)
|
||||
const feeLimit = this.lnd.GetFeeLimitAmount(payAmount)
|
||||
const decrement = payAmount + feeLimit
|
||||
// this call will fail if the user balance is not enough
|
||||
await this.storage.DecrementUserBalance(userId, decrement)
|
||||
try {
|
||||
await this.lnd.PayInvoice(req.invoice, req.amount, feeLimit)
|
||||
|
||||
} catch (e) {
|
||||
await this.storage.IncrementUserBalance(userId, decrement)
|
||||
throw e
|
||||
}
|
||||
await this.storage.AddUserPayment(userId, req.invoice,)
|
||||
}
|
||||
|
||||
async OpenChannel(userId: string, req: Types.OpenChannelRequest): Promise<Types.OpenChannelResponse> { throw new Error("WIP") }
|
||||
}
|
||||
|
|
@ -11,8 +11,8 @@ export default (mainHandler: Main): Types.ServerMethods => {
|
|||
AddUser: async (ctx: Types.GuestContext, req: Types.AddUserRequest): Promise<Types.AddUserResponse> => {
|
||||
const err = Types.AddUserRequestValidate(req, {
|
||||
callback_url_CustomCheck: url => url.startsWith("http://") || url.startsWith("https://"),
|
||||
name_CustomCheck: name => req.name.length > 0,
|
||||
secret_CustomCheck: secret => secret.length > 8
|
||||
name_CustomCheck: name => name.length > 0,
|
||||
secret_CustomCheck: secret => secret.length >= 8
|
||||
})
|
||||
if (err != null) throw new Error(err.message)
|
||||
return mainHandler.AddUser(req)
|
||||
|
|
@ -22,15 +22,15 @@ export default (mainHandler: Main): Types.ServerMethods => {
|
|||
},
|
||||
OpenChannel: async (ctx: Types.UserContext, req: Types.OpenChannelRequest): Promise<Types.OpenChannelResponse> => {
|
||||
const err = Types.OpenChannelRequestValidate(req, {
|
||||
channel_balance_CustomCheck: balance => balance > 0,
|
||||
funding_amount_CustomCheck: amt => amt > 0,
|
||||
push_amount_CustomCheck: amt => amt > 0,
|
||||
destination_CustomCheck: dest => dest !== ""
|
||||
})
|
||||
if (err != null) throw new Error(err.message)
|
||||
return mainHandler.OpenChannel(req)
|
||||
return mainHandler.OpenChannel(ctx.user_id, req)
|
||||
},
|
||||
NewAddress: async (ctx: Types.UserContext): Promise<Types.NewAddressResponse> => {
|
||||
throw new Error("unimplemented")
|
||||
NewAddress: async (ctx: Types.UserContext, req: Types.NewAddressRequest): Promise<Types.NewAddressResponse> => {
|
||||
return mainHandler.NewAddress(ctx.user_id, req)
|
||||
},
|
||||
PayAddress: async (ctx: Types.UserContext, req: Types.PayAddressRequest): Promise<Types.PayAddressResponse> => {
|
||||
throw new Error("unimplemented")
|
||||
|
|
|
|||
|
|
@ -1,13 +1,24 @@
|
|||
import "reflect-metadata"
|
||||
import { DataSource } from "typeorm"
|
||||
import { AddressTransaction } from "./entity/AddressTransaction"
|
||||
import { User } from "./entity/User"
|
||||
|
||||
const AppDataSource = new DataSource({
|
||||
type: "sqlite",
|
||||
database: `db.sqlite`,
|
||||
logging: true,
|
||||
entities: [User],
|
||||
})
|
||||
export default async () => {
|
||||
return AppDataSource.initialize()
|
||||
import { UserAddress } from "./entity/UserAddress"
|
||||
import { UserInvoice } from "./entity/UserInvoice"
|
||||
import { UserPayment } from "./entity/UserPayment"
|
||||
export type DbSettings = {
|
||||
databaseFile: string
|
||||
}
|
||||
export const LoadDbSettingsFromEnv = (test = false): DbSettings => {
|
||||
const databaseFile = process.env.DATABASE_FILE
|
||||
if (!databaseFile) throw new Error(`missing env for DATABASE_FILE`)
|
||||
return { databaseFile: test ? ":memory:" : databaseFile }
|
||||
}
|
||||
export default async (settings: DbSettings) => {
|
||||
return new DataSource({
|
||||
type: "sqlite",
|
||||
database: settings.databaseFile,
|
||||
//logging: true,
|
||||
entities: [User, UserInvoice, UserAddress, AddressTransaction, UserPayment],
|
||||
synchronize: true
|
||||
}).initialize()
|
||||
}
|
||||
23
src/services/storage/entity/AddressTransaction.ts
Normal file
23
src/services/storage/entity/AddressTransaction.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
|
||||
import { User } from "./User"
|
||||
import { UserAddress } from "./UserAddress"
|
||||
|
||||
@Entity()
|
||||
@Index("address_transaction_unique", ["tx_hash", "output_index"], { unique: true })
|
||||
export class AddressTransaction {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
serial_id: number
|
||||
|
||||
@ManyToOne(type => UserAddress)
|
||||
user_address: UserAddress
|
||||
|
||||
@Column()
|
||||
tx_hash: string
|
||||
|
||||
@Column()
|
||||
output_index: number
|
||||
|
||||
@Column()
|
||||
amount: number
|
||||
}
|
||||
|
|
@ -21,9 +21,9 @@ export class User {
|
|||
@Column()
|
||||
callbackUrl: string
|
||||
|
||||
@Column({ type: 'integer' })
|
||||
@Column({ type: 'integer', default: 0 })
|
||||
balance_sats: number
|
||||
|
||||
@Column()
|
||||
@Column({ default: false })
|
||||
locked: boolean
|
||||
}
|
||||
|
|
|
|||
19
src/services/storage/entity/UserAddress.ts
Normal file
19
src/services/storage/entity/UserAddress.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
|
||||
import { User } from "./User"
|
||||
|
||||
@Entity()
|
||||
export class UserAddress {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
serial_id: number
|
||||
|
||||
@ManyToOne(type => User)
|
||||
user: User
|
||||
|
||||
@Column()
|
||||
@Index({ unique: true })
|
||||
address: string
|
||||
|
||||
@Column()
|
||||
callbackUrl: string
|
||||
}
|
||||
25
src/services/storage/entity/UserInvoice.ts
Normal file
25
src/services/storage/entity/UserInvoice.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
|
||||
import { User } from "./User"
|
||||
|
||||
@Entity()
|
||||
export class UserInvoice {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
serial_id: number
|
||||
|
||||
@ManyToOne(type => User)
|
||||
user: User
|
||||
|
||||
@Column()
|
||||
@Index({ unique: true })
|
||||
invoice: string
|
||||
|
||||
@Column({ default: false })
|
||||
paid: boolean
|
||||
|
||||
@Column()
|
||||
callbackUrl: string
|
||||
|
||||
@Column({ default: 0 })
|
||||
settle_amount: number
|
||||
}
|
||||
19
src/services/storage/entity/UserPayment.ts
Normal file
19
src/services/storage/entity/UserPayment.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne } from "typeorm"
|
||||
import { User } from "./User"
|
||||
|
||||
@Entity()
|
||||
export class UserPayment {
|
||||
|
||||
@PrimaryGeneratedColumn()
|
||||
serial_id: number
|
||||
|
||||
@ManyToOne(type => User)
|
||||
user: User
|
||||
|
||||
@Column()
|
||||
@Index({ unique: true })
|
||||
invoice: string
|
||||
|
||||
@Column()
|
||||
amount: number
|
||||
}
|
||||
|
|
@ -1,19 +1,38 @@
|
|||
import { DataSource, EntityManager } from "typeorm"
|
||||
import crypto from 'crypto';
|
||||
import NewDB from "./db"
|
||||
import NewDB, { DbSettings, LoadDbSettingsFromEnv } from "./db"
|
||||
import { User } from "./entity/User"
|
||||
import { UserAddress } from "./entity/UserAddress";
|
||||
import { UserInvoice } from "./entity/UserInvoice";
|
||||
import { AddressTransaction } from "./entity/AddressTransaction";
|
||||
import { UserPayment } from "./entity/UserPayment";
|
||||
export type StorageSettings = {
|
||||
dbSettings: DbSettings
|
||||
}
|
||||
export const LoadStorageSettingsFromEnv = (test = false): StorageSettings => {
|
||||
return { dbSettings: LoadDbSettingsFromEnv(test) }
|
||||
}
|
||||
|
||||
export default class {
|
||||
DB: DataSource
|
||||
async Connect() {
|
||||
this.DB = await NewDB()
|
||||
DB: DataSource | EntityManager
|
||||
settings: StorageSettings
|
||||
constructor(settings: StorageSettings) {
|
||||
this.settings = settings
|
||||
}
|
||||
async AddUser(name: string, callbackUrl: string, secret: string, entityManager = this.DB) {
|
||||
return entityManager.getRepository(User).create({
|
||||
async Connect() {
|
||||
this.DB = await NewDB(this.settings.dbSettings)
|
||||
}
|
||||
StartTransaction(exec: (entityManager: EntityManager) => Promise<void>) {
|
||||
this.DB.transaction(exec)
|
||||
}
|
||||
async AddUser(name: string, callbackUrl: string, secret: string, entityManager = this.DB): Promise<User> {
|
||||
const newUser = entityManager.getRepository(User).create({
|
||||
user_id: crypto.randomBytes(32).toString('hex'),
|
||||
name: name,
|
||||
callbackUrl: callbackUrl,
|
||||
secret_sha256: crypto.createHash('sha256').update(secret).digest('base64')
|
||||
})
|
||||
return entityManager.getRepository(User).save(newUser)
|
||||
}
|
||||
FindUser(userId: string, entityManager = this.DB) {
|
||||
return entityManager.getRepository(User).findOne({
|
||||
|
|
@ -22,13 +41,71 @@ export default class {
|
|||
}
|
||||
})
|
||||
}
|
||||
async GetUser(user_id: string, entityManager = this.DB): Promise<User> {
|
||||
const user = await this.FindUser(user_id, entityManager)
|
||||
async GetUser(userId: string, entityManager = this.DB): Promise<User> {
|
||||
const user = await this.FindUser(userId, entityManager)
|
||||
if (!user) {
|
||||
throw new Error(`user ${user_id} not found`) // TODO: fix logs doxing
|
||||
throw new Error(`user ${userId} not found`) // TODO: fix logs doxing
|
||||
}
|
||||
return user
|
||||
}
|
||||
|
||||
async AddAddressTransaction(address: string, txHash: string, outputIndex: number, amount: number, entityManager = this.DB) {
|
||||
const newAddressTransaction = entityManager.getRepository(AddressTransaction).create({
|
||||
user_address: { address: address },
|
||||
tx_hash: txHash,
|
||||
output_index: outputIndex,
|
||||
amount: amount
|
||||
})
|
||||
return entityManager.getRepository(AddressTransaction).save(newAddressTransaction)
|
||||
}
|
||||
|
||||
async AddUserAddress(userId: string, address: string, callbackUrl = "", entityManager = this.DB): Promise<UserAddress> {
|
||||
const newUserAddress = entityManager.getRepository(UserAddress).create({
|
||||
address,
|
||||
callbackUrl,
|
||||
user: { user_id: userId }
|
||||
})
|
||||
return entityManager.getRepository(UserAddress).save(newUserAddress)
|
||||
}
|
||||
|
||||
async FlagInvoiceAsPaid(invoiceSerialId: number, amount: number, entityManager = this.DB) {
|
||||
return entityManager.getRepository(UserInvoice).update(invoiceSerialId, { paid: true, settle_amount: amount })
|
||||
}
|
||||
|
||||
async AddUserInvoice(userId: string, invoice: string, callbackUrl = "", entityManager = this.DB): Promise<UserInvoice> {
|
||||
const newUserInvoice = entityManager.getRepository(UserInvoice).create({
|
||||
invoice: invoice,
|
||||
callbackUrl,
|
||||
user: { user_id: userId }
|
||||
})
|
||||
return entityManager.getRepository(UserInvoice).save(newUserInvoice)
|
||||
}
|
||||
|
||||
async GetAddressOwner(address: string, entityManager = this.DB): Promise<UserAddress | null> {
|
||||
return entityManager.getRepository(UserAddress).findOne({
|
||||
where: {
|
||||
address
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async GetInvoiceOwner(paymentRequest: string, entityManager = this.DB): Promise<UserInvoice | null> {
|
||||
return entityManager.getRepository(UserInvoice).findOne({
|
||||
where: {
|
||||
invoice: paymentRequest
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async AddUserPayment(userId: string, invoice: string, amount: number, entityManager = this.DB): Promise<UserPayment> {
|
||||
const newPayment = entityManager.getRepository(UserPayment).create({
|
||||
user: { user_id: userId },
|
||||
amount,
|
||||
invoice
|
||||
})
|
||||
return entityManager.getRepository(UserPayment).save(newPayment)
|
||||
}
|
||||
|
||||
LockUser(userId: string, entityManager = this.DB) {
|
||||
return entityManager.getRepository(User).update({
|
||||
user_id: userId
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
||||
/* Basic Options */
|
||||
// "incremental": true, /* Enable incremental compilation */
|
||||
"target": "ES2016" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */,
|
||||
"target": "ES2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */,
|
||||
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
||||
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue