From d6216df87e63ddedbaee1447eba85fa754a4dc7b Mon Sep 17 00:00:00 2001 From: Dario Anongba Varela Date: Tue, 2 Jul 2024 12:39:01 +0200 Subject: [PATCH 1/6] upgrade deps --- .dockerignore | 21 + .github/workflows/build.yml | 38 + Cargo.lock | 1037 ++++++++++++++---- Cargo.toml | 34 +- Dockerfile | 34 + Makefile | 25 +- src/application/errors/database_error.rs | 3 + src/infra/database/sea_orm/sea_orm_client.rs | 8 + src/infra/lightning/breez/breez_client.rs | 4 +- 9 files changed, 981 insertions(+), 223 deletions(-) create mode 100644 .dockerignore create mode 100644 .github/workflows/build.yml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..631575d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,21 @@ +target +*.rs.bk +*.log +*.tmp +*.swp +*.swo +.github +.vscode +certs +deps +storage +target +.dockerignore +.git +.gitignore +tests +examples +docs +README.md +CONTRIBUTING.md +CODE_OF_CONDUCT.md \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..83789e0 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: Build and Push Docker Image + +on: + push: + tags: + - "v*" + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Install doctl + uses: digitalocean/action-doctl@v2 + with: + token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} + + - name: Log in to DigitalOcean Container Registry with short-lived credentials + run: doctl registry login --expiry-seconds 600 + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: | + registry.digitalocean.com/swissknife/swissknife:latest + registry.digitalocean.com/swissknife/swissknife:${{ github.ref_name }} diff --git a/Cargo.lock b/Cargo.lock index a6e211e..6242505 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -136,6 +136,55 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" + +[[package]] +name = "anstyle-parse" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "anyhow" version = "1.0.86" @@ -202,6 +251,154 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "async-attributes" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener 2.5.3", + "futures-core", +] + +[[package]] +name = "async-channel" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8828ec6e544c02b0d6691d21ed9f9218d0384a82542855073c2a3f58304aaf0" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand 2.1.0", + "futures-lite 2.3.0", + "slab", +] + +[[package]] +name = "async-global-executor" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" +dependencies = [ + "async-channel 2.3.1", + "async-executor", + "async-io 2.3.3", + "async-lock 3.4.0", + "blocking", + "futures-lite 2.3.0", + "once_cell", + "tokio", +] + +[[package]] +name = "async-io" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" +dependencies = [ + "async-lock 2.8.0", + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-lite 1.13.0", + "log", + "parking", + "polling 2.8.0", + "rustix 0.37.27", + "slab", + "socket2 0.4.10", + "waker-fn", +] + +[[package]] +name = "async-io" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6baa8f0178795da0e71bc42c9e5d13261aac7ee549853162e66a241ba17964" +dependencies = [ + "async-lock 3.4.0", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite 2.3.0", + "parking", + "polling 3.7.2", + "rustix 0.38.34", + "slab", + "tracing", + "windows-sys 0.52.0", +] + +[[package]] +name = "async-lock" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" +dependencies = [ + "event-listener 2.5.3", +] + +[[package]] +name = "async-lock" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" +dependencies = [ + "event-listener 5.3.1", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-std" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +dependencies = [ + "async-attributes", + "async-channel 1.9.0", + "async-global-executor", + "async-io 1.13.0", + "async-lock 2.8.0", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite 1.13.0", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + [[package]] name = "async-stream" version = "0.3.5" @@ -221,9 +418,15 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + [[package]] name = "async-trait" version = "0.1.80" @@ -232,7 +435,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -314,7 +517,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.0", "http-body-util", - "hyper 1.3.1", + "hyper 1.4.0", "hyper-util", "itoa", "matchit", @@ -410,9 +613,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.72" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17c6a35df3749d2e8bb1b7b21a976d82b15548788d2735b9d82f329268f71a11" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", @@ -447,6 +650,16 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "bcder" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c627747a6774aab38beb35990d88309481378558875a41da1a4b2e373c906ef0" +dependencies = [ + "bytes", + "smallvec", +] + [[package]] name = "bcrypt" version = "0.15.1" @@ -596,9 +809,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" dependencies = [ "serde", ] @@ -633,6 +846,19 @@ dependencies = [ "generic-array", ] +[[package]] +name = "blocking" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" +dependencies = [ + "async-channel 2.3.1", + "async-task", + "futures-io", + "futures-lite 2.3.0", + "piper", +] + [[package]] name = "blowfish" version = "0.9.1" @@ -674,20 +900,18 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", "syn_derive", ] [[package]] name = "breez-sdk-core" -version = "0.4.1" -source = "git+https://github.com/breez/breez-sdk?tag=0.4.2-rc1#76cd730e298d330ad4922fccc5296ab020201f36" +version = "0.5.0" +source = "git+https://github.com/breez/breez-sdk?tag=0.5.0#83740c3595ac16b29896c76a2e8790fba0535ab3" dependencies = [ "aes", "anyhow", "base64 0.13.1", - "bip21", - "cbc", "chrono", "const_format", "ecies", @@ -702,13 +926,13 @@ dependencies = [ "once_cell", "openssl", "prost 0.11.9", - "querystring", "rand", "regex", "reqwest 0.11.20", "ripemd", "rusqlite", "rusqlite_migration", + "sdk-common", "serde", "serde_json", "serde_with", @@ -720,7 +944,6 @@ dependencies = [ "tokio", "tokio-stream", "tonic 0.8.3", - "tonic-build 0.8.4", "zbase32", ] @@ -760,9 +983,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.16.0" +version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5" +checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" [[package]] name = "byteorder" @@ -787,9 +1010,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.98" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" +checksum = "74b6a57f98764a267ff415d50a25e6e166f3831a5071af4995296ea97d210490" [[package]] name = "cfg-if" @@ -859,6 +1082,46 @@ dependencies = [ "zeroize", ] +[[package]] +name = "clap" +version = "4.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84b3edb18336f4df585bc9aa31dd99c036dfa5dc5e9a2939a722a188f3a8970d" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1c09dd5ada6c6c78075d6fd0da3f90d8080651e2d6cc8eb2f1aaa4034ced708" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "clap_lex" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" + [[package]] name = "cln-grpc" version = "0.1.8" @@ -875,6 +1138,21 @@ dependencies = [ "tonic-build 0.8.4", ] +[[package]] +name = "colorchoice" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "config" version = "0.13.4" @@ -997,6 +1275,15 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "crypto" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf1e6e5492f8f0830c37f301f6349e0dac8b2466e4fe89eef90e9eef906cd046" +dependencies = [ + "crypto-common", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -1038,7 +1325,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -1049,7 +1336,7 @@ checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -1142,13 +1429,13 @@ dependencies = [ [[package]] name = "displaydoc" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -1195,9 +1482,9 @@ dependencies = [ [[package]] name = "either" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" dependencies = [ "serde", ] @@ -1270,6 +1557,27 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "event-listener" +version = "5.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +dependencies = [ + "event-listener 5.3.1", + "pin-project-lite", +] + [[package]] name = "fallible-iterator" version = "0.2.0" @@ -1282,6 +1590,15 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "fastrand" version = "2.1.0" @@ -1447,6 +1764,34 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand 1.9.0", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + +[[package]] +name = "futures-lite" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" +dependencies = [ + "fastrand 2.1.0", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + [[package]] name = "futures-macro" version = "0.3.30" @@ -1455,7 +1800,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -1529,8 +1874,8 @@ checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "gl-client" -version = "0.1.11" -source = "git+https://github.com/Blockstream/greenlight.git?rev=97e2f418c331653330f9fa928ed10ed1538c27d0#97e2f418c331653330f9fa928ed10ed1538c27d0" +version = "0.2.0" +source = "git+https://github.com/Blockstream/greenlight.git?rev=16fa13d40f4fc271cf99febf3f40246b6b23716a#16fa13d40f4fc271cf99febf3f40246b6b23716a" dependencies = [ "anyhow", "async-trait", @@ -1547,14 +1892,16 @@ dependencies = [ "mockall", "pin-project", "prost 0.11.9", + "prost-derive 0.11.9", "rand", "rcgen", "reqwest 0.11.20", "ring 0.16.20", + "runeauth", "rustls-pemfile 1.0.4", "secp256k1 0.26.0", "serde", - "serde_bolt 0.2.6", + "serde_bolt", "serde_json", "sha256", "tempfile", @@ -1570,6 +1917,25 @@ dependencies = [ "vls-persist", "vls-protocol", "vls-protocol-signer", + "x509-certificate", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", ] [[package]] @@ -1702,6 +2068,12 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +[[package]] +name = "hermit-abi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" + [[package]] name = "hex" version = "0.4.3" @@ -1792,12 +2164,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", - "futures-core", + "futures-util", "http 1.1.0", "http-body 1.0.0", "pin-project-lite", @@ -1805,9 +2177,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -1838,7 +2210,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.5.7", "tokio", "tower-service", "tracing", @@ -1847,9 +2219,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +checksum = "c4fe55fb7a772d59a5ff1dfbff4fe0258d19b89fec4b233e75d35d5d2316badc" dependencies = [ "bytes", "futures-channel", @@ -1880,6 +2252,23 @@ dependencies = [ "tokio-rustls 0.24.1", ] +[[package]] +name = "hyper-rustls" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +dependencies = [ + "futures-util", + "http 1.1.0", + "hyper 1.4.0", + "hyper-util", + "rustls 0.23.10", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.26.0", + "tower-service", +] + [[package]] name = "hyper-timeout" version = "0.4.1" @@ -1913,7 +2302,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.3.1", + "hyper 1.4.0", "hyper-util", "native-tls", "tokio", @@ -1923,18 +2312,18 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" +checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" dependencies = [ "bytes", "futures-channel", "futures-util", "http 1.1.0", "http-body 1.0.0", - "hyper 1.3.1", + "hyper 1.4.0", "pin-project-lite", - "socket2", + "socket2 0.5.7", "tokio", "tower", "tower-service", @@ -2010,7 +2399,7 @@ checksum = "0122b7114117e64a63ac49f752a5ca4624d534c7b1c7de796ac196381cd2d947" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -2032,6 +2421,17 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "ipnet" version = "2.9.0" @@ -2049,6 +2449,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itertools" version = "0.10.5" @@ -2108,13 +2514,22 @@ dependencies = [ "simple_asn1", ] +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" dependencies = [ - "spin 0.5.2", + "spin 0.9.8", ] [[package]] @@ -2236,7 +2651,13 @@ dependencies = [ name = "linked-hash-map" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" @@ -2256,9 +2677,12 @@ dependencies = [ [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +dependencies = [ + "value-bag", +] [[package]] name = "matchers" @@ -2287,9 +2711,17 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "migration" +version = "0.1.0" +dependencies = [ + "async-std", + "sea-orm-migration", +] [[package]] name = "mime" @@ -2305,9 +2737,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] @@ -2407,9 +2839,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ "num-integer", "num-traits", @@ -2480,9 +2912,9 @@ dependencies = [ [[package]] name = "object" -version = "0.35.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e" +checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" dependencies = [ "memchr", ] @@ -2518,7 +2950,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -2535,7 +2967,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -2546,9 +2978,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.3.0+3.3.0" +version = "300.3.1+3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba8804a1c5765b18c4b3f907e6897ebabeedebc9830e1a0046c4a4cf44663e1" +checksum = "7259953d42a81bf137fbbd73bd30a8e1914d6dce43c2b90ed575783a22608b91" dependencies = [ "cc", ] @@ -2606,7 +3038,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -2615,6 +3047,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "parking" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" + [[package]] name = "parking_lot" version = "0.12.3" @@ -2633,7 +3071,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.1", + "redox_syscall 0.5.2", "smallvec", "windows-targets 0.52.5", ] @@ -2701,9 +3139,9 @@ checksum = "3637c05577168127568a64e9dc5a6887da720efef07b3d9472d45f63ab191166" [[package]] name = "pest" -version = "2.7.10" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8" +checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" dependencies = [ "memchr", "thiserror", @@ -2712,9 +3150,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.10" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26293c9193fbca7b1a3bf9b79dc1e388e927e6cacaa78b4a3ab705a1d3d41459" +checksum = "2a548d2beca6773b1c244554d36fcf8548a8a58e74156968211567250e48e49a" dependencies = [ "pest", "pest_generator", @@ -2722,22 +3160,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.10" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ec22af7d3fb470a85dd2ca96b7c577a1eb4ef6f1683a9fe9a8c16e136c04687" +checksum = "3c93a82e8d145725dcbaf44e5ea887c8a869efdcc28706df2d08c69e17077183" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] name = "pest_meta" -version = "2.7.10" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a240022f37c361ec1878d646fc5b7d7c4d28d5946e1a80ad5a7a4f4ca0bdcd" +checksum = "a941429fea7e08bedec25e4f6785b6ffaacc6b755da98df5ef3e7dcf4a124c4f" dependencies = [ "once_cell", "pest", @@ -2771,7 +3209,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -2786,6 +3224,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1d5c74c9876f070d3e8fd503d748c7d974c3e48da8f41350fa5222ef9b4391" +dependencies = [ + "atomic-waker", + "fastrand 2.1.0", + "futures-io", +] + [[package]] name = "pkcs1" version = "0.7.5" @@ -2813,6 +3262,37 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +[[package]] +name = "polling" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "concurrent-queue", + "libc", + "log", + "pin-project-lite", + "windows-sys 0.48.0", +] + +[[package]] +name = "polling" +version = "3.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3ed00ed3fbf728b5816498ecd316d1716eecaced9c0c8d2c5a6740ca214985b" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi 0.4.0", + "pin-project-lite", + "rustix 0.38.34", + "tracing", + "windows-sys 0.52.0", +] + [[package]] name = "poly1305" version = "0.8.0" @@ -2901,7 +3381,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -2939,9 +3419,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.85" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -3005,7 +3485,7 @@ dependencies = [ "prost 0.12.6", "prost-types 0.12.6", "regex", - "syn 2.0.66", + "syn 2.0.68", "tempfile", ] @@ -3032,7 +3512,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -3148,23 +3628,23 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", ] [[package]] name = "regex" -version = "1.10.4" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -3178,13 +3658,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.3", + "regex-syntax 0.8.4", ] [[package]] @@ -3195,9 +3675,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rend" @@ -3223,7 +3703,7 @@ dependencies = [ "http 0.2.12", "http-body 0.4.6", "hyper 0.14.29", - "hyper-rustls", + "hyper-rustls 0.24.2", "hyper-tls 0.5.0", "ipnet", "js-sys", @@ -3252,9 +3732,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" dependencies = [ "base64 0.22.1", "bytes", @@ -3266,7 +3746,8 @@ dependencies = [ "http 1.1.0", "http-body 1.0.0", "http-body-util", - "hyper 1.3.1", + "hyper 1.4.0", + "hyper-rustls 0.27.2", "hyper-tls 0.6.0", "hyper-util", "ipnet", @@ -3281,7 +3762,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 0.1.2", + "sync_wrapper 1.0.1", "system-configuration", "tokio", "tokio-native-tls", @@ -3394,13 +3875,29 @@ dependencies = [ "zeroize", ] +[[package]] +name = "runeauth" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef37d2c452a17120641e4180b6360268a6d2e842169febe791d21316c9107c84" +dependencies = [ + "anyhow", + "base64 0.21.7", + "crypto", + "env_logger 0.10.2", + "hex", + "indexmap 2.2.6", + "sha2", + "thiserror", +] + [[package]] name = "rusqlite" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "549b9d036d571d42e6e85d1c1425e2ac83491075078ca9a15be021c56b1641f2" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -3459,13 +3956,13 @@ dependencies = [ "futures-util", "http 1.1.0", "native-tls", - "reqwest 0.12.4", + "reqwest 0.12.5", "serde", "serde_json", "thiserror", "tokio", - "tokio-tungstenite 0.21.0", - "tungstenite 0.21.0", + "tokio-tungstenite", + "tungstenite", "url", ] @@ -3513,16 +4010,30 @@ dependencies = [ "nom", ] +[[package]] +name = "rustix" +version = "0.37.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] + [[package]] name = "rustix" version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.14", "windows-sys 0.52.0", ] @@ -3564,6 +4075,19 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls" +version = "0.23.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki 0.102.4", + "subtle", + "zeroize", +] + [[package]] name = "rustls-native-certs" version = "0.6.3" @@ -3659,6 +4183,33 @@ dependencies = [ "untrusted 0.9.0", ] +[[package]] +name = "sdk-common" +version = "0.5.0" +source = "git+https://github.com/breez/breez-sdk?tag=0.5.0#83740c3595ac16b29896c76a2e8790fba0535ab3" +dependencies = [ + "aes", + "anyhow", + "base64 0.13.1", + "bip21", + "bitcoin 0.29.2", + "cbc", + "hex", + "lightning 0.0.116", + "lightning-invoice 0.24.0", + "log", + "prost 0.11.9", + "querystring", + "regex", + "reqwest 0.11.20", + "serde", + "serde_json", + "strum_macros 0.25.3", + "thiserror", + "tonic 0.8.3", + "tonic-build 0.8.4", +] + [[package]] name = "sea-bae" version = "0.2.0" @@ -3669,7 +4220,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -3700,6 +4251,23 @@ dependencies = [ "uuid", ] +[[package]] +name = "sea-orm-cli" +version = "0.12.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "620bc560062ae251b1366bde43b3f1508445cab5c2c8cbdb397034638ab1b357" +dependencies = [ + "chrono", + "clap", + "dotenvy", + "glob", + "regex", + "sea-schema", + "tracing", + "tracing-subscriber", + "url", +] + [[package]] name = "sea-orm-macros" version = "0.12.15" @@ -3710,10 +4278,27 @@ dependencies = [ "proc-macro2", "quote", "sea-bae", - "syn 2.0.66", + "syn 2.0.68", "unicode-ident", ] +[[package]] +name = "sea-orm-migration" +version = "0.12.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8269bc6ff71afd6b78aa4333ac237a69eebd2cdb439036291e64fb4b8db23c" +dependencies = [ + "async-trait", + "clap", + "dotenvy", + "futures", + "sea-orm", + "sea-orm-cli", + "sea-schema", + "tracing", + "tracing-subscriber", +] + [[package]] name = "sea-query" version = "0.30.7" @@ -3726,6 +4311,7 @@ dependencies = [ "inherent", "ordered-float", "rust_decimal", + "sea-query-derive", "serde_json", "time", "uuid", @@ -3747,6 +4333,42 @@ dependencies = [ "uuid", ] +[[package]] +name = "sea-query-derive" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a82fcb49253abcb45cdcb2adf92956060ec0928635eb21b4f7a6d8f25ab0bc" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.68", + "thiserror", +] + +[[package]] +name = "sea-schema" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d148608012d25222442d1ebbfafd1228dbc5221baf4ec35596494e27a2394e" +dependencies = [ + "futures", + "sea-query", + "sea-schema-derive", +] + +[[package]] +name = "sea-schema-derive" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f686050f76bffc4f635cda8aea6df5548666b830b52387e8bc7de11056d11e" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "seahash" version = "4.1.0" @@ -3809,7 +4431,7 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "core-foundation", "core-foundation-sys", "libc", @@ -3835,17 +4457,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bolt" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99292690b804a2234f387403ccccbc201a9e5750f93b676eea0faadd9c4350f6" -dependencies = [ - "hex", - "serde", - "serde_derive", -] - [[package]] name = "serde_bolt" version = "0.3.4" @@ -3866,7 +4477,7 @@ checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -3884,9 +4495,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.117" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" dependencies = [ "itoa", "ryu", @@ -3917,9 +4528,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.8.1" +version = "3.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" +checksum = "079f3a42cd87588d924ed95b533f8d30a483388c4e400ab736a7058e34f16169" dependencies = [ "base64 0.22.1", "chrono", @@ -3935,14 +4546,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.8.1" +version = "3.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" +checksum = "bc03aad67c1d26b7de277d51c86892e7d9a0110a2fe44bf6b26cc569fba302d6" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -4041,6 +4652,16 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "socket2" version = "0.5.7" @@ -4078,11 +4699,10 @@ dependencies = [ [[package]] name = "sqlformat" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" +checksum = "f895e3734318cc55f1fe66258926c9b910c124d47520339efecbb6c59cec7c1f" dependencies = [ - "itertools 0.12.1", "nom", "unicode_categories", ] @@ -4116,7 +4736,7 @@ dependencies = [ "crossbeam-queue", "dotenvy", "either", - "event-listener", + "event-listener 2.5.3", "futures-channel", "futures-core", "futures-intrusive", @@ -4196,7 +4816,7 @@ dependencies = [ "atoi", "base64 0.21.7", "bigdecimal", - "bitflags 2.5.0", + "bitflags 2.6.0", "byteorder", "bytes", "chrono", @@ -4243,7 +4863,7 @@ dependencies = [ "atoi", "base64 0.21.7", "bigdecimal", - "bitflags 2.5.0", + "bitflags 2.6.0", "byteorder", "chrono", "crc", @@ -4335,9 +4955,9 @@ checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" [[package]] name = "strum" -version = "0.26.2" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" [[package]] name = "strum_macros" @@ -4349,31 +4969,31 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] name = "strum_macros" -version = "0.26.3" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7993a8e3a9e88a00351486baae9522c91b123a088f76469e5bd5cc17198ea87" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", "rustversion", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "swissknife" -version = "0.1.0" +version = "0.0.1" dependencies = [ "anyhow", "async-trait", @@ -4390,20 +5010,20 @@ dependencies = [ "humantime", "jsonwebtoken", "lightning-invoice 0.31.0", + "migration", "prost 0.12.6", "regex", "reqwest 0.11.20", "rust_socketio", "sea-orm", "serde", - "serde_bolt 0.3.4", + "serde_bolt", "serde_json", "serde_with", - "strum 0.26.2", - "strum_macros 0.26.3", + "strum 0.26.3", + "strum_macros 0.26.4", "thiserror", "tokio", - "tokio-tungstenite 0.23.0", "tonic 0.11.0", "tonic-build 0.11.0", "tower-http", @@ -4425,9 +5045,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.66" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", @@ -4443,7 +5063,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -4504,8 +5124,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", - "fastrand", - "rustix", + "fastrand 2.1.0", + "rustix 0.38.34", "windows-sys 0.52.0", ] @@ -4541,7 +5161,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -4615,9 +5235,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "c55115c6fbe2d2bef26eb09ad74bde02d8255476fc0c7b515ef09fbb35742d82" dependencies = [ "tinyvec_macros", ] @@ -4642,7 +5262,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.5.7", "tokio-macros", "windows-sys 0.48.0", ] @@ -4665,7 +5285,7 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -4710,6 +5330,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls 0.23.10", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.15" @@ -4732,21 +5363,7 @@ dependencies = [ "native-tls", "tokio", "tokio-native-tls", - "tungstenite 0.21.0", -] - -[[package]] -name = "tokio-tungstenite" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "becd34a233e7e31a3dbf7c7241b38320f57393dcae8e7324b0167d21b8e320b0" -dependencies = [ - "futures-util", - "log", - "native-tls", - "tokio", - "tokio-native-tls", - "tungstenite 0.23.0", + "tungstenite", ] [[package]] @@ -4877,7 +5494,7 @@ dependencies = [ "proc-macro2", "prost-build 0.12.6", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -4906,7 +5523,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "bytes", "http 1.1.0", "http-body 1.0.0", @@ -4950,7 +5567,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -5041,25 +5658,6 @@ dependencies = [ "utf-8", ] -[[package]] -name = "tungstenite" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e2ce1e47ed2994fd43b04c8f618008d4cabdd5ee34027cf14f9d918edd9c8" -dependencies = [ - "byteorder", - "bytes", - "data-encoding", - "http 1.1.0", - "httparse", - "log", - "native-tls", - "rand", - "sha1", - "thiserror", - "utf-8", -] - [[package]] name = "txoo" version = "0.6.4" @@ -5069,7 +5667,7 @@ dependencies = [ "bitcoin 0.29.2", "log", "serde", - "serde_bolt 0.3.4", + "serde_bolt", ] [[package]] @@ -5153,9 +5751,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -5168,11 +5766,17 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "uuid" -version = "1.8.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" +checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439" dependencies = [ "getrandom", "serde", @@ -5184,6 +5788,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "value-bag" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a84c137d37ab0142f0f2ddfe332651fdbf252e7b7dbb4e67b6c1f1b2e925101" + [[package]] name = "vcpkg" version = "0.2.15" @@ -5217,7 +5827,7 @@ dependencies = [ "log", "scopeguard", "serde", - "serde_bolt 0.3.4", + "serde_bolt", "serde_derive", "serde_with", "txoo", @@ -5249,7 +5859,7 @@ dependencies = [ "bolt-derive", "hex", "log", - "serde_bolt 0.3.4", + "serde_bolt", "txoo", ] @@ -5265,6 +5875,12 @@ dependencies = [ "vls-protocol", ] +[[package]] +name = "waker-fn" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" + [[package]] name = "want" version = "0.3.1" @@ -5307,7 +5923,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", "wasm-bindgen-shared", ] @@ -5341,7 +5957,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5412,7 +6028,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix", + "rustix 0.38.34", ] [[package]] @@ -5642,6 +6258,25 @@ dependencies = [ "tap", ] +[[package]] +name = "x509-certificate" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66534846dec7a11d7c50a74b7cdb208b9a581cad890b7866430d438455847c85" +dependencies = [ + "bcder", + "bytes", + "chrono", + "der", + "hex", + "pem 3.0.4", + "ring 0.17.8", + "signature", + "spki", + "thiserror", + "zeroize", +] + [[package]] name = "x509-parser" version = "0.14.0" @@ -5702,7 +6337,7 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -5722,5 +6357,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] diff --git a/Cargo.toml b/Cargo.toml index b219c61..da44b80 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,34 +1,34 @@ [package] name = "swissknife" -version = "0.1.0" +version = "0.0.1" edition = "2021" authors = ["Dario Anongba Varela "] -rust-version = "1.73" +rust-version = "1.79" license = "MIT" -description = "Numeraire's Bitcoin SwissKnife is a software application enabling easy integration of Bitcoin, the Lightning network and the RGB protocol." +description = "Numeraire SwissKnife enables easy integration of Bitcoin, Lightning and smart contract protocols." repository = "https://github.com/bitcoin-numeraire/swissknife" homepage = "https://numeraire.tech" [dependencies] -async-trait = "0.1.74" -axum = "0.7.2" -axum-extra = { version = "0.9.0", features = ["typed-header", "query"] } -serde = { version = "1.0.192", features = ["derive"] } -serde_json = "1.0.108" +async-trait = "0.1.80" +axum = "0.7.5" +axum-extra = { version = "0.9.3", features = ["typed-header", "query"] } +serde = { version = "1.0.203", features = ["derive"] } +serde_json = "1.0.120" serde_bolt = "=0.3.4" -serde_with = "3.8.1" -tokio = { version = "1.34", features = ["full"] } -breez-sdk-core = { git = "https://github.com/breez/breez-sdk", tag = "0.4.2-rc1" } +serde_with = "3.8.2" +tokio = { version = "1.38", features = ["full"] } +breez-sdk-core = { git = "https://github.com/breez/breez-sdk", tag = "0.5.0" } bip39 = { version = "*", features = ["rand_core"] } config = { version = "0.13.4", features = ["yaml", "json", "toml"] } dotenv = "0.15.0" tracing = "0.1.40" tracing-subscriber = { version = "0.3.18", features = ["json", "env-filter"] } -jsonwebtoken = "9.2.0" +jsonwebtoken = "9.3.0" reqwest = "=0.11.20" -uuid = { version = "1.6.1", features = ["v4", "serde"] } -chrono = "0.4.31" -thiserror = "1.0.56" +uuid = { version = "1.9.1", features = ["v4", "serde"] } +chrono = "0.4.38" +thiserror = "1.0.61" tower-http = { version = "0.5", features = ["timeout", "trace", "cors"] } regex = "1" sea-orm = { version = "0.12", features = [ @@ -42,15 +42,15 @@ sea-orm = { version = "0.12", features = [ strum = "0.26" strum_macros = "0.26" tonic = { version = "0.11.0", features = ["tls"] } -prost = "0.12.4" +prost = "0.12.6" lightning-invoice = "0.31.0" hex = "0.4.3" anyhow = "1.0.86" -tokio-tungstenite = { version = "0.23.0", features = ["native-tls"] } futures-util = "0.3.30" humantime = "2.1.0" rust_socketio = { version = "0.6.0", features = ["async"] } bcrypt = "0.15.1" +migration = { path = "migration" } [build-dependencies] tonic-build = "0.11.0" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a28d1da --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +FROM lukemathwalker/cargo-chef:0.1.67-rust-1.79 AS chef +WORKDIR /app + +FROM chef AS planner +COPY . . +RUN cargo chef prepare --recipe-path recipe.json + +FROM chef AS builder +COPY --from=planner /app/recipe.json recipe.json + +# Fetch dependencies +RUN cargo chef cook --release --recipe-path recipe.json + +# Copy the source code +COPY . . + +# Build the project +RUN cargo build --release + +# Use a minimal base image for the final stage +FROM debian:bookworm-slim + +# Install required runtime dependencies +RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* + +# Copy the build artifact from the builder stage +COPY --from=builder /app/target/release/swissknife /usr/local/bin +COPY ./config/default.toml /config/default.toml + +# Set the environment variable for production +ENV RUN_MODE=production + +# Set the entrypoint +ENTRYPOINT ["swissknife"] \ No newline at end of file diff --git a/Makefile b/Makefile index f9284b7..6ae0fea 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ COMPOSE := docker compose -f docker-compose.yml -EXPOSED_PORTS := 50001 50002 DB_SERVICE := postgres PGADMIN_SERVICE := pgadmin LIGHTNINGD_SERVICE := lightningd +IMAGE_NAME := swissknife:latest -.PHONY: up up-lightningd up-postgres up-pgadmin shutdown down generate-certs +.PHONY: up up-lightningd up-postgres up-pgadmin shutdown down generate-certs build-docker run-docker up: @$(MAKE) down @@ -17,7 +17,6 @@ up-lightningd: up-postgres: @$(COMPOSE) up -d $(DB_SERVICE) @until $(COMPOSE) logs $(DB_SERVICE) | grep 'database system is ready to accept connections'; do sleep 1; done - @sea-orm-cli migrate up up-pgadmin: @$(COMPOSE) up -d $(PGADMIN_SERVICE) @@ -33,6 +32,8 @@ shutdown: install-tools: @cargo install sea-orm-cli + @cargo install cargo-edit + @cargo install cargo-outdated generate-models: @sea-orm-cli generate entity --output-dir models --verbose @@ -41,3 +42,21 @@ generate-certs: @mkdir -p certs @openssl genrsa -out certs/client_key.pem 2048 @openssl req -new -x509 -key certs/client_key.pem -out certs/client_cert.pem -days 365 -subj /CN=localhost + +build-docker: + @docker build -t $(IMAGE_NAME) . + +run-docker: + @docker run -p 5000:5000 $(IMAGE_NAME) + +deps-upgrade: + @cargo upgrade + +deps-outdated: + @cargo outdated + +lint: + @cargo clippy + +lint-fix: + @cargo fix \ No newline at end of file diff --git a/src/application/errors/database_error.rs b/src/application/errors/database_error.rs index bc6ff72..5f2c49b 100644 --- a/src/application/errors/database_error.rs +++ b/src/application/errors/database_error.rs @@ -5,6 +5,9 @@ pub enum DatabaseError { #[error("Failed to connect to database: {0}")] Connect(String), + #[error("Failed to execute migrations: {0}")] + Migrations(String), + #[error("Failed to find resource: {0}")] FindOne(String), diff --git a/src/infra/database/sea_orm/sea_orm_client.rs b/src/infra/database/sea_orm/sea_orm_client.rs index 4c045df..6f74066 100644 --- a/src/infra/database/sea_orm/sea_orm_client.rs +++ b/src/infra/database/sea_orm/sea_orm_client.rs @@ -1,6 +1,8 @@ use sea_orm::{ConnectOptions, Database, DatabaseConnection}; +use tracing::{debug, trace}; use crate::{application::errors::DatabaseError, infra::database::DatabaseConfig}; +use migration::{Migrator, MigratorTrait}; #[derive(Clone)] pub struct SeaORMClient {} @@ -30,6 +32,12 @@ impl SeaORMClient { .await .map_err(|e| DatabaseError::Connect(e.to_string()))?; + trace!("Executing migrations..."); + Migrator::up(&db_conn, None) + .await + .map_err(|e| DatabaseError::Migrations(e.to_string()))?; + debug!("Migrations executed successfully"); + Ok(db_conn) } } diff --git a/src/infra/lightning/breez/breez_client.rs b/src/infra/lightning/breez/breez_client.rs index bb5310a..d9e00e9 100644 --- a/src/infra/lightning/breez/breez_client.rs +++ b/src/infra/lightning/breez/breez_client.rs @@ -63,8 +63,8 @@ impl BreezClient { NodeConfig::Greenlight { config: GreenlightNodeConfig { partner_credentials: Some(GreenlightCredentials { - device_cert: client_crt, - device_key: client_key, + developer_cert: client_crt, + developer_key: client_key, }), invite_code: None, }, From f81cea24b3674f12184e3a3a5978b44fec62d049 Mon Sep 17 00:00:00 2001 From: Dario Anongba Varela Date: Tue, 2 Jul 2024 12:43:05 +0200 Subject: [PATCH 2/6] remove unused --- src/application/dtos/lightning.rs | 11 ----------- src/infra/lightning/cln/cln_grpc_client.rs | 6 +++--- src/infra/lightning/cln/cln_rest_client.rs | 6 +++--- src/infra/lightning/cln/cln_rest_types.rs | 12 ------------ 4 files changed, 6 insertions(+), 29 deletions(-) diff --git a/src/application/dtos/lightning.rs b/src/application/dtos/lightning.rs index 7426a23..f6133f2 100644 --- a/src/application/dtos/lightning.rs +++ b/src/application/dtos/lightning.rs @@ -36,17 +36,6 @@ pub struct RegisterLightningAddressRequest { pub username: String, } -#[derive(Debug, Deserialize)] -pub struct ProcessEventRequest { - pub template: String, - pub data: EventDataRequest, -} - -#[derive(Debug, Deserialize)] -pub struct EventDataRequest { - pub payment_hash: String, -} - #[derive(Debug, Deserialize)] pub struct ConnectLSPRequest { pub lsp_id: String, diff --git a/src/infra/lightning/cln/cln_grpc_client.rs b/src/infra/lightning/cln/cln_grpc_client.rs index 1d95fbb..5cb5c4e 100644 --- a/src/infra/lightning/cln/cln_grpc_client.rs +++ b/src/infra/lightning/cln/cln_grpc_client.rs @@ -172,9 +172,9 @@ impl LnClient for ClnGrpcClient { async fn pay_onchain( &self, - amount_sat: u64, - recipient_address: String, - feerate: u32, + _amount_sat: u64, + _recipient_address: String, + _feerate: u32, ) -> Result { todo!(); } diff --git a/src/infra/lightning/cln/cln_rest_client.rs b/src/infra/lightning/cln/cln_rest_client.rs index 17cdb90..6bc3049 100644 --- a/src/infra/lightning/cln/cln_rest_client.rs +++ b/src/infra/lightning/cln/cln_rest_client.rs @@ -169,9 +169,9 @@ impl LnClient for ClnRestClient { async fn pay_onchain( &self, - amount_sat: u64, - recipient_address: String, - feerate: u32, + _amount_sat: u64, + _recipient_address: String, + _feerate: u32, ) -> Result { todo!(); } diff --git a/src/infra/lightning/cln/cln_rest_types.rs b/src/infra/lightning/cln/cln_rest_types.rs index 4f1e011..3d7f7be 100644 --- a/src/infra/lightning/cln/cln_rest_types.rs +++ b/src/infra/lightning/cln/cln_rest_types.rs @@ -15,15 +15,6 @@ pub struct InvoiceRequest { #[derive(Debug, Deserialize)] pub struct InvoiceResponse { pub bolt11: String, - pub payment_hash: String, - pub payment_secret: String, - pub expires_at: u64, - pub warning_capacity: Option, - pub warning_offline: Option, - pub warning_deadends: Option, - pub warning_private_unused: Option, - pub warning_mpp: Option, - pub created_index: Option, } #[derive(Debug, Serialize)] @@ -41,12 +32,9 @@ pub struct PayResponse { pub payment_preimage: String, pub payment_hash: String, pub created_at: f64, - pub parts: u32, pub amount_msat: u64, pub amount_sent_msat: u64, pub status: String, - pub destination: Option, - pub warning_partial_completion: Option, } impl Into for PayResponse { From 01d1d1a05cde554a2210e9169aef5fa34cafb466 Mon Sep 17 00:00:00 2001 From: Dario Anongba Varela Date: Tue, 2 Jul 2024 13:36:49 +0200 Subject: [PATCH 3/6] done --- Makefile | 2 +- src/application/entities/ordering.rs | 6 +- src/application/entities/transaction.rs | 6 +- .../errors/authentication_error.rs | 2 +- .../invoices/adapters/invoice_model.rs | 6 +- .../invoices/adapters/invoice_repository.rs | 14 +- src/domains/invoices/api/invoice_handler.rs | 8 +- src/domains/invoices/entities/invoice.rs | 6 +- .../invoices/services/invoice_service.rs | 2 +- .../lightning/api/breez_node_handler.rs | 4 +- .../lightning/api/ln_address_handler.rs | 4 +- src/domains/lightning/api/lnurlp_handler.rs | 4 +- .../lightning/services/ln_events_service.rs | 12 +- .../lightning/services/lnurl_service.rs | 2 +- src/domains/payments/api/payment_handler.rs | 10 +- src/domains/payments/entities/payment.rs | 6 +- .../payments/services/payments_service.rs | 34 +- .../wallet/adapters/wallet_repository.rs | 4 +- src/domains/wallet/api/wallet_handler.rs | 18 +- src/infra/app/mod.rs | 4 +- src/infra/app/{app.rs => server.rs} | 4 +- src/infra/auth/{auth.rs => authenticator.rs} | 0 src/infra/auth/mod.rs | 4 +- src/infra/auth/oauth2/oauth2_authenticator.rs | 5 +- src/infra/database/{database.rs => config.rs} | 0 src/infra/database/mod.rs | 4 +- src/infra/lightning/breez/breez_client.rs | 2 +- src/infra/lightning/breez/breez_types.rs | 92 +- src/infra/lightning/cln/cln_grpc_listener.rs | 10 +- src/infra/lightning/cln/cln_grpc_types.rs | 22 +- src/infra/lightning/cln/cln_rest_client.rs | 2 +- src/infra/lightning/cln/cln_rest_types.rs | 22 +- .../lightning/cln/cln_websocket_types.rs | 32 +- src/infra/lightning/cln/proto/node.proto | 1231 ++++++++++++++++- .../lightning/cln/proto/primitives.proto | 25 +- .../lightning/{lightning.rs => ln_client.rs} | 0 src/infra/lightning/mod.rs | 4 +- src/infra/lightning/types.rs | 40 +- src/main.rs | 4 +- 39 files changed, 1403 insertions(+), 254 deletions(-) rename src/infra/app/{app.rs => server.rs} (98%) rename src/infra/auth/{auth.rs => authenticator.rs} (100%) rename src/infra/database/{database.rs => config.rs} (100%) rename src/infra/lightning/{lightning.rs => ln_client.rs} (100%) diff --git a/Makefile b/Makefile index 6ae0fea..1643c5e 100644 --- a/Makefile +++ b/Makefile @@ -59,4 +59,4 @@ lint: @cargo clippy lint-fix: - @cargo fix \ No newline at end of file + @cargo fmt \ No newline at end of file diff --git a/src/application/entities/ordering.rs b/src/application/entities/ordering.rs index e4e49ae..215654e 100644 --- a/src/application/entities/ordering.rs +++ b/src/application/entities/ordering.rs @@ -9,9 +9,9 @@ pub enum OrderDirection { Asc, } -impl Into for OrderDirection { - fn into(self) -> Order { - match self { +impl From for Order { + fn from(val: OrderDirection) -> Self { + match val { OrderDirection::Asc => Order::Asc, OrderDirection::Desc => Order::Desc, } diff --git a/src/application/entities/transaction.rs b/src/application/entities/transaction.rs index 2cddb21..9aa94c4 100644 --- a/src/application/entities/transaction.rs +++ b/src/application/entities/transaction.rs @@ -4,9 +4,9 @@ use strum_macros::{Display, EnumString}; #[derive(Clone, Debug, EnumString, Deserialize, Serialize, Display, PartialEq, Eq, Default)] pub enum Ledger { #[default] - LIGHTNING, - INTERNAL, - ONCHAIN, + Lightning, + Internal, + Onchain, } #[derive(Clone, Debug, EnumString, Deserialize, Serialize, Display, PartialEq, Eq, Default)] diff --git a/src/application/errors/authentication_error.rs b/src/application/errors/authentication_error.rs index 66ae299..fb249c1 100644 --- a/src/application/errors/authentication_error.rs +++ b/src/application/errors/authentication_error.rs @@ -3,7 +3,7 @@ use thiserror::Error; #[derive(Debug, Error)] pub enum AuthenticationError { #[error("Failed to fetch JWKS: {0}")] - JWKS(String), + Jwks(String), #[error("Failed to decode JWT header: {0}")] DecodeJWTHeader(String), diff --git a/src/domains/invoices/adapters/invoice_model.rs b/src/domains/invoices/adapters/invoice_model.rs index b255e99..a8c8d58 100644 --- a/src/domains/invoices/adapters/invoice_model.rs +++ b/src/domains/invoices/adapters/invoice_model.rs @@ -56,10 +56,10 @@ impl ActiveModelBehavior for ActiveModel {} impl From for Invoice { fn from(model: Model) -> Self { let status = match model.payment_time { - Some(_) => InvoiceStatus::SETTLED, + Some(_) => InvoiceStatus::Settled, None => match model.expires_at { - Some(expires_at) if Utc::now() > expires_at => InvoiceStatus::EXPIRED, - _ => InvoiceStatus::PENDING, + Some(expires_at) if Utc::now() > expires_at => InvoiceStatus::Expired, + _ => InvoiceStatus::Pending, }, }; diff --git a/src/domains/invoices/adapters/invoice_repository.rs b/src/domains/invoices/adapters/invoice_repository.rs index e9b8eb0..f4fd40f 100644 --- a/src/domains/invoices/adapters/invoice_repository.rs +++ b/src/domains/invoices/adapters/invoice_repository.rs @@ -57,13 +57,13 @@ impl InvoiceRepository for SeaOrmInvoiceRepository { .apply_if(filter.user_id, |q, user| q.filter(Column::UserId.eq(user))) .apply_if(filter.ids, |q, ids| q.filter(Column::Id.is_in(ids))) .apply_if(filter.status, |q, s| match s { - InvoiceStatus::PENDING => q.filter( + InvoiceStatus::Pending => q.filter( Condition::all() .add(Expr::col(Column::ExpiresAt).gt(Expr::current_timestamp())) .add(Expr::col(Column::PaymentTime).is_null()), ), - InvoiceStatus::SETTLED => q.filter(Expr::col(Column::PaymentTime).is_not_null()), - InvoiceStatus::EXPIRED => q.filter( + InvoiceStatus::Settled => q.filter(Expr::col(Column::PaymentTime).is_not_null()), + InvoiceStatus::Expired => q.filter( Condition::all() .add(Expr::col(Column::ExpiresAt).lte(Expr::current_timestamp())) .add(Expr::col(Column::PaymentTime).is_null()), @@ -99,7 +99,7 @@ impl InvoiceRepository for SeaOrmInvoiceRepository { ..Default::default() }; - if invoice.ledger == Ledger::LIGHTNING { + if invoice.ledger == Ledger::Lightning { let lightning = invoice.lightning.unwrap(); model.bolt11 = Set(lightning.bolt11.into()); model.payee_pubkey = Set(lightning.payee_pubkey.into()); @@ -150,13 +150,13 @@ impl InvoiceRepository for SeaOrmInvoiceRepository { .apply_if(filter.user_id, |q, user| q.filter(Column::UserId.eq(user))) .apply_if(filter.ids, |q, ids| q.filter(Column::Id.is_in(ids))) .apply_if(filter.status, |q, status| match status { - InvoiceStatus::PENDING => q.filter( + InvoiceStatus::Pending => q.filter( Condition::all() .add(Expr::col(Column::ExpiresAt).gt(Expr::current_timestamp())) .add(Expr::col(Column::PaymentTime).is_null()), ), - InvoiceStatus::SETTLED => q.filter(Expr::col(Column::PaymentTime).is_not_null()), - InvoiceStatus::EXPIRED => q.filter( + InvoiceStatus::Settled => q.filter(Expr::col(Column::PaymentTime).is_not_null()), + InvoiceStatus::Expired => q.filter( Condition::all() .add(Expr::col(Column::ExpiresAt).lte(Expr::current_timestamp())) .add(Expr::col(Column::PaymentTime).is_null()), diff --git a/src/domains/invoices/api/invoice_handler.rs b/src/domains/invoices/api/invoice_handler.rs index ebae1fd..3943295 100644 --- a/src/domains/invoices/api/invoice_handler.rs +++ b/src/domains/invoices/api/invoice_handler.rs @@ -36,7 +36,7 @@ impl InvoiceHandler { ) -> Result, ApplicationError> { user.check_permission(Permission::WriteLnTransaction)?; - let ln_address = app_state + let invoice = app_state .services .invoice .invoice( @@ -46,7 +46,7 @@ impl InvoiceHandler { payload.expiry, ) .await?; - Ok(Json(ln_address.into())) + Ok(invoice.into()) } async fn get( @@ -56,8 +56,8 @@ impl InvoiceHandler { ) -> Result, ApplicationError> { user.check_permission(Permission::ReadLnTransaction)?; - let ln_address = app_state.services.invoice.get(id).await?; - Ok(Json(ln_address.into())) + let invoice = app_state.services.invoice.get(id).await?; + Ok(invoice.into()) } async fn list( diff --git a/src/domains/invoices/entities/invoice.rs b/src/domains/invoices/entities/invoice.rs index b41398a..ea65a45 100644 --- a/src/domains/invoices/entities/invoice.rs +++ b/src/domains/invoices/entities/invoice.rs @@ -52,9 +52,9 @@ pub struct LnInvoice { #[derive(Clone, Debug, EnumString, Deserialize, Serialize, Display, PartialEq, Eq, Default)] pub enum InvoiceStatus { #[default] - PENDING, - SETTLED, - EXPIRED, + Pending, + Settled, + Expired, } #[derive(Clone, Debug, Deserialize, Serialize, Default)] diff --git a/src/domains/invoices/services/invoice_service.rs b/src/domains/invoices/services/invoice_service.rs index 9921119..26e6637 100644 --- a/src/domains/invoices/services/invoice_service.rs +++ b/src/domains/invoices/services/invoice_service.rs @@ -53,7 +53,7 @@ impl InvoiceUseCases for InvoiceService { expiry.unwrap_or(self.invoice_expiry), ) .await?; - invoice.user_id = user_id.clone(); + invoice.user_id.clone_from(&user_id); let invoice = self.store.invoice.insert(None, invoice).await?; diff --git a/src/domains/lightning/api/breez_node_handler.rs b/src/domains/lightning/api/breez_node_handler.rs index f835b2f..ea687a4 100644 --- a/src/domains/lightning/api/breez_node_handler.rs +++ b/src/domains/lightning/api/breez_node_handler.rs @@ -186,7 +186,7 @@ impl BreezNodeHandler { let client = app_state.ln_node_client.as_breez_client()?; let data = client.backup()?; - return match data { + match data { Some(data) => { let filename = "channels_backup.txt"; let body = Body::from(data.join("\n").into_bytes()); @@ -202,7 +202,7 @@ impl BreezNodeHandler { Ok((headers, body).into_response()) } None => Err(LightningError::Backup("No backup data found".to_string()))?, - }; + } } async fn health_check( diff --git a/src/domains/lightning/api/ln_address_handler.rs b/src/domains/lightning/api/ln_address_handler.rs index 2d7a5a9..4536e66 100644 --- a/src/domains/lightning/api/ln_address_handler.rs +++ b/src/domains/lightning/api/ln_address_handler.rs @@ -41,7 +41,7 @@ impl LnAddressHandler { .lnurl .register(payload.user_id.unwrap_or(user.sub), payload.username) .await?; - Ok(Json(ln_address.into())) + Ok(ln_address.into()) } async fn get( @@ -52,7 +52,7 @@ impl LnAddressHandler { user.check_permission(Permission::ReadLnAddress)?; let ln_address = app_state.services.lnurl.get(id).await?; - Ok(Json(ln_address.into())) + Ok(ln_address.into()) } async fn list( diff --git a/src/domains/lightning/api/lnurlp_handler.rs b/src/domains/lightning/api/lnurlp_handler.rs index 3bad7bd..3013821 100644 --- a/src/domains/lightning/api/lnurlp_handler.rs +++ b/src/domains/lightning/api/lnurlp_handler.rs @@ -36,11 +36,11 @@ impl LnURLpHandler { Query(query_params): Query, State(app_state): State>, ) -> Result, ApplicationError> { - let invoice = app_state + let callback = app_state .services .lnurl .lnurlp_callback(username, query_params.amount, query_params.comment) .await?; - Ok(Json(invoice.into())) + Ok(callback.into()) } } diff --git a/src/domains/lightning/services/ln_events_service.rs b/src/domains/lightning/services/ln_events_service.rs index da765a4..c84b036 100644 --- a/src/domains/lightning/services/ln_events_service.rs +++ b/src/domains/lightning/services/ln_events_service.rs @@ -35,8 +35,8 @@ impl LnEventsUseCases for LnEventsService { .store .invoice .find_many(InvoiceFilter { - status: Some(InvoiceStatus::SETTLED), - ledger: Some(Ledger::LIGHTNING), + status: Some(InvoiceStatus::Settled), + ledger: Some(Ledger::Lightning), pagination: PaginationFilter { limit: Some(1), ..Default::default() @@ -87,7 +87,7 @@ impl LnEventsUseCases for LnEventsService { .await?; if let Some(mut payment_retrieved) = payment_option { - if payment_retrieved.status == PaymentStatus::SETTLED { + if payment_retrieved.status == PaymentStatus::Settled { debug!( id = %payment_retrieved.id, "Lightning payment already settled" @@ -95,7 +95,7 @@ impl LnEventsUseCases for LnEventsService { return Ok(()); } - payment_retrieved.status = PaymentStatus::SETTLED; + payment_retrieved.status = PaymentStatus::Settled; payment_retrieved.payment_time = Some(event.payment_time); payment_retrieved.payment_preimage = Some(event.payment_preimage); payment_retrieved.amount_msat = event.amount_msat; @@ -124,7 +124,7 @@ impl LnEventsUseCases for LnEventsService { .await?; if let Some(mut payment_retrieved) = payment_option { - if payment_retrieved.status == PaymentStatus::FAILED { + if payment_retrieved.status == PaymentStatus::Failed { debug!( id = %payment_retrieved.id, "Lightning payment already failed" @@ -132,7 +132,7 @@ impl LnEventsUseCases for LnEventsService { return Ok(()); } - payment_retrieved.status = PaymentStatus::FAILED; + payment_retrieved.status = PaymentStatus::Failed; payment_retrieved.error = Some(event.reason); let payment = self.store.payment.update(payment_retrieved).await?; diff --git a/src/domains/lightning/services/lnurl_service.rs b/src/domains/lightning/services/lnurl_service.rs index e049760..4ba6db1 100644 --- a/src/domains/lightning/services/lnurl_service.rs +++ b/src/domains/lightning/services/lnurl_service.rs @@ -104,7 +104,7 @@ impl LnUrlUseCases for LnUrlService { self.invoice_expiry, ) .await?; - invoice.user_id = ln_address.user_id.clone(); + invoice.user_id.clone_from(&ln_address.user_id); invoice.ln_address = Some(ln_address.id); // TODO: Get or add more information to make this a LNURLp invoice (like fetching a success action specific to the user) diff --git a/src/domains/payments/api/payment_handler.rs b/src/domains/payments/api/payment_handler.rs index af914a2..4fd8845 100644 --- a/src/domains/payments/api/payment_handler.rs +++ b/src/domains/payments/api/payment_handler.rs @@ -37,7 +37,7 @@ impl PaymentHandler { user.check_permission(Permission::WriteLnTransaction)?; let payment = app_state.services.payment.pay(payload).await?; - Ok(Json(payment.into())) + Ok(payment.into()) } async fn get( @@ -47,8 +47,8 @@ impl PaymentHandler { ) -> Result, ApplicationError> { user.check_permission(Permission::ReadLnTransaction)?; - let ln_address = app_state.services.payment.get(id).await?; - Ok(Json(ln_address.into())) + let payment = app_state.services.payment.get(id).await?; + Ok(payment.into()) } async fn list( @@ -58,9 +58,9 @@ impl PaymentHandler { ) -> Result>, ApplicationError> { user.check_permission(Permission::ReadLnTransaction)?; - let lightning_payments = app_state.services.payment.list(query_params).await?; + let payments = app_state.services.payment.list(query_params).await?; - let response: Vec = lightning_payments.into_iter().map(Into::into).collect(); + let response: Vec = payments.into_iter().map(Into::into).collect(); Ok(response.into()) } diff --git a/src/domains/payments/entities/payment.rs b/src/domains/payments/entities/payment.rs index fc899de..116a6d6 100644 --- a/src/domains/payments/entities/payment.rs +++ b/src/domains/payments/entities/payment.rs @@ -38,9 +38,9 @@ pub struct Payment { #[derive(Clone, Debug, EnumString, Display, Deserialize, Serialize, PartialEq, Eq, Default)] pub enum PaymentStatus { #[default] - PENDING, - SETTLED, - FAILED, + Pending, + Settled, + Failed, } #[derive(Clone, Debug, Deserialize, Serialize, Default)] diff --git a/src/domains/payments/services/payments_service.rs b/src/domains/payments/services/payments_service.rs index a0cb229..e6f3196 100644 --- a/src/domains/payments/services/payments_service.rs +++ b/src/domains/payments/services/payments_service.rs @@ -92,16 +92,16 @@ impl PaymentService { } match retrieved_invoice.status { - InvoiceStatus::SETTLED => { + InvoiceStatus::Settled => { return Err(DataError::Validation( "Invoice has already been paid.".to_string(), ) .into()); } - InvoiceStatus::EXPIRED => { + InvoiceStatus::Expired => { return Err(DataError::Validation("Invoice is expired.".to_string()).into()); } - InvoiceStatus::PENDING => { + InvoiceStatus::Pending => { // Internal payment let txn = self.store.begin().await?; @@ -110,12 +110,12 @@ impl PaymentService { Payment { user_id, amount_msat: amount, - status: PaymentStatus::SETTLED, + status: PaymentStatus::Settled, payment_hash: Some(invoice.payment_hash), description: invoice.description, fee_msat: Some(0), payment_time: Some(Utc::now()), - ledger: Ledger::INTERNAL, + ledger: Ledger::Internal, ..Default::default() }, 0.0, @@ -144,8 +144,8 @@ impl PaymentService { Payment { user_id, amount_msat: amount, - status: PaymentStatus::PENDING, - ledger: Ledger::LIGHTNING, + status: PaymentStatus::Pending, + ledger: Ledger::Lightning, payment_hash: Some(invoice.payment_hash), description: invoice.description, ..Default::default() @@ -190,7 +190,7 @@ impl PaymentService { match req.ln_address.clone() { Some(ln_address) => { let address = ln_address.split('@').next().unwrap(); - let address_opt = self.store.ln_address.find_by_username(&address).await?; + let address_opt = self.store.ln_address.find_by_username(address).await?; match address_opt { Some(retrieved_address) => { @@ -212,14 +212,14 @@ impl PaymentService { Invoice { user_id: retrieved_address.user_id, ln_address: Some(retrieved_address.id), - ledger: Ledger::INTERNAL, + ledger: Ledger::Internal, description: comment.clone().or( DEFAULT_INTERNAL_INVOICE_DESCRIPTION.to_string().into(), ), currency: Currency::Bitcoin, amount_msat: Some(amount), timestamp: curr_time, - status: InvoiceStatus::SETTLED, + status: InvoiceStatus::Settled, fee_msat: Some(0), payment_time: Some(curr_time), ..Default::default() @@ -232,13 +232,13 @@ impl PaymentService { Payment { user_id, amount_msat: amount, - status: PaymentStatus::SETTLED, + status: PaymentStatus::Settled, description: comment.or( DEFAULT_INTERNAL_PAYMENT_DESCRIPTION.to_string().into(), ), fee_msat: Some(0), payment_time: Some(Utc::now()), - ledger: Ledger::INTERNAL, + ledger: Ledger::Internal, ln_address: Some(ln_address), ..Default::default() }, @@ -280,7 +280,7 @@ impl PaymentService { Payment { user_id: user_id.clone(), amount_msat: amount, - status: PaymentStatus::PENDING, + status: PaymentStatus::Pending, ln_address: req.ln_address.clone(), description: comment.clone(), payment_hash: Some( @@ -289,7 +289,7 @@ impl PaymentService { .payment_hash() .to_hex(), ), - ledger: Ledger::LIGHTNING, + ledger: Ledger::Lightning, ..Default::default() }, self.fee_buffer, @@ -327,7 +327,7 @@ impl PaymentService { .await .map_err(|e| DatabaseError::Transaction(e.to_string()))?; - return Ok(pending_payment); + Ok(pending_payment) } async fn handle_processed_payment( @@ -339,7 +339,7 @@ impl PaymentService { match result { Ok(mut settled_payment) => { settled_payment.id = pending_payment.id; - settled_payment.status = PaymentStatus::SETTLED; + settled_payment.status = PaymentStatus::Settled; let success_action = match success_action { Some(sa) => Some(process_success_action( @@ -356,7 +356,7 @@ impl PaymentService { Ok(payment) } Err(error) => { - pending_payment.status = PaymentStatus::FAILED; + pending_payment.status = PaymentStatus::Failed; pending_payment.error = Some(error.to_string()); self.store.payment.update(pending_payment).await?; diff --git a/src/domains/wallet/adapters/wallet_repository.rs b/src/domains/wallet/adapters/wallet_repository.rs index 48c5688..dae7b80 100644 --- a/src/domains/wallet/adapters/wallet_repository.rs +++ b/src/domains/wallet/adapters/wallet_repository.rs @@ -32,8 +32,8 @@ impl WalletRepository for SeaOrmWalletRepository { r#" WITH sent AS ( SELECT - SUM(amount_msat) FILTER (WHERE status IN ('SETTLED', 'PENDING')) AS sent_msat, - SUM(COALESCE(fee_msat, 0)) FILTER (WHERE status = 'SETTLED') AS fees_paid_msat + SUM(amount_msat) FILTER (WHERE status IN ('Settled', 'Pending')) AS sent_msat, + SUM(COALESCE(fee_msat, 0)) FILTER (WHERE status = 'Settled') AS fees_paid_msat FROM payment WHERE user_id = $1 ), diff --git a/src/domains/wallet/api/wallet_handler.rs b/src/domains/wallet/api/wallet_handler.rs index 5777f8a..44f5d0c 100644 --- a/src/domains/wallet/api/wallet_handler.rs +++ b/src/domains/wallet/api/wallet_handler.rs @@ -46,7 +46,7 @@ impl WalletHandler { user: AuthUser, ) -> Result, ApplicationError> { let wallet = app_state.services.wallet.get(user.sub).await?; - Ok(Json(wallet.into())) + Ok(wallet.into()) } async fn pay( @@ -56,7 +56,7 @@ impl WalletHandler { ) -> Result, ApplicationError> { payload.user_id = Some(user.sub); let payment = app_state.services.payment.pay(payload).await?; - Ok(Json(payment.into())) + Ok(payment.into()) } async fn get_balance( @@ -83,7 +83,7 @@ impl WalletHandler { ) .await?; - Ok(Json(invoice.into())) + Ok(invoice.into()) } async fn get_address( @@ -104,7 +104,7 @@ impl WalletHandler { .cloned() .ok_or_else(|| DataError::NotFound("Lightning address not found.".to_string()))?; - Ok(Json(ln_address.into())) + Ok(ln_address.into()) } async fn register_address( @@ -117,7 +117,7 @@ impl WalletHandler { .lnurl .register(user.sub, payload.username) .await?; - Ok(Json(ln_address.into())) + Ok(ln_address.into()) } async fn list_payments( @@ -153,7 +153,7 @@ impl WalletHandler { .cloned() .ok_or_else(|| DataError::NotFound("Lightning payment not found.".to_string()))?; - Ok(Json(lightning_payment.into())) + Ok(lightning_payment.into()) } async fn list_invoices( @@ -189,7 +189,7 @@ impl WalletHandler { .cloned() .ok_or_else(|| DataError::NotFound("Lightning invoice not found.".to_string()))?; - Ok(Json(lightning_invoice.into())) + Ok(lightning_invoice.into()) } async fn delete_expired_invoices( @@ -201,7 +201,7 @@ impl WalletHandler { .invoice .delete_many(InvoiceFilter { user_id: Some(user.sub), - status: Some(InvoiceStatus::EXPIRED), + status: Some(InvoiceStatus::Expired), ..Default::default() }) .await?; @@ -217,7 +217,7 @@ impl WalletHandler { .payment .delete_many(PaymentFilter { user_id: Some(user.sub), - status: Some(PaymentStatus::FAILED), + status: Some(PaymentStatus::Failed), ..Default::default() }) .await?; diff --git a/src/infra/app/mod.rs b/src/infra/app/mod.rs index fd54156..4efc8fd 100644 --- a/src/infra/app/mod.rs +++ b/src/infra/app/mod.rs @@ -1,5 +1,5 @@ -mod app; mod app_state; +mod server; -pub use app::App; pub use app_state::AppState; +pub use server::Server; diff --git a/src/infra/app/app.rs b/src/infra/app/server.rs similarity index 98% rename from src/infra/app/app.rs rename to src/infra/app/server.rs index dfc3d5d..0a5750a 100644 --- a/src/infra/app/app.rs +++ b/src/infra/app/server.rs @@ -18,11 +18,11 @@ use crate::{ infra::app::AppState, }; -pub struct App { +pub struct Server { router: Router, } -impl App { +impl Server { pub fn new(state: Arc) -> Self { let router = Router::new() .nest("/.well-known/lnurlp", LnURLpHandler::well_known_route()) diff --git a/src/infra/auth/auth.rs b/src/infra/auth/authenticator.rs similarity index 100% rename from src/infra/auth/auth.rs rename to src/infra/auth/authenticator.rs diff --git a/src/infra/auth/mod.rs b/src/infra/auth/mod.rs index c4e85dc..77a2b81 100644 --- a/src/infra/auth/mod.rs +++ b/src/infra/auth/mod.rs @@ -1,6 +1,6 @@ -mod auth; +mod authenticator; pub mod bypass; pub mod jwt; pub mod oauth2; -pub use auth::Authenticator; +pub use authenticator::*; diff --git a/src/infra/auth/oauth2/oauth2_authenticator.rs b/src/infra/auth/oauth2/oauth2_authenticator.rs index 0bf01c2..dee37fa 100644 --- a/src/infra/auth/oauth2/oauth2_authenticator.rs +++ b/src/infra/auth/oauth2/oauth2_authenticator.rs @@ -49,7 +49,7 @@ impl OAuth2Authenticator { let initial_jwks = Self::fetch_jwks(&jwks_uri) .await - .map_err(|e| AuthenticationError::JWKS(e.to_string()))?; + .map_err(|e| AuthenticationError::Jwks(e.to_string()))?; let jwks = Arc::new(RwLock::new(initial_jwks)); let jwks_clone = Arc::clone(&jwks); @@ -79,7 +79,8 @@ impl OAuth2Authenticator { } async fn fetch_jwks(jwks_uri: &str) -> Result { - Ok(reqwest::get(jwks_uri).await?.json().await?) + let jwks = reqwest::get(jwks_uri).await?.json().await?; + Ok(jwks) } } diff --git a/src/infra/database/database.rs b/src/infra/database/config.rs similarity index 100% rename from src/infra/database/database.rs rename to src/infra/database/config.rs diff --git a/src/infra/database/mod.rs b/src/infra/database/mod.rs index bd5cee2..770f2e0 100644 --- a/src/infra/database/mod.rs +++ b/src/infra/database/mod.rs @@ -1,4 +1,4 @@ -mod database; +mod config; pub mod sea_orm; -pub use database::*; +pub use config::DatabaseConfig; diff --git a/src/infra/lightning/breez/breez_client.rs b/src/infra/lightning/breez/breez_client.rs index d9e00e9..6a48b83 100644 --- a/src/infra/lightning/breez/breez_client.rs +++ b/src/infra/lightning/breez/breez_client.rs @@ -70,7 +70,7 @@ impl BreezClient { }, }, ); - breez_config.working_dir = config.working_dir.clone(); + breez_config.working_dir.clone_from(&config.working_dir); let seed = Mnemonic::parse(config.seed).map_err(|e| LightningError::ParseSeed(e.to_string()))?; diff --git a/src/infra/lightning/breez/breez_types.rs b/src/infra/lightning/breez/breez_types.rs index 1179a02..a917c0d 100644 --- a/src/infra/lightning/breez/breez_types.rs +++ b/src/infra/lightning/breez/breez_types.rs @@ -15,24 +15,24 @@ use crate::{ }, }; -impl Into for LNInvoice { - fn into(self) -> Invoice { +impl From for Invoice { + fn from(val: LNInvoice) -> Self { Invoice { - ledger: Ledger::LIGHTNING, - currency: self.network.into(), - description: self.description, - amount_msat: self.amount_msat, - timestamp: Utc.timestamp_opt(self.timestamp as i64, 0).unwrap(), + ledger: Ledger::Lightning, + currency: val.network.into(), + description: val.description, + amount_msat: val.amount_msat, + timestamp: Utc.timestamp_opt(val.timestamp as i64, 0).unwrap(), lightning: Some(LnInvoice { - bolt11: self.bolt11, - payee_pubkey: self.payee_pubkey, - payment_hash: self.payment_hash, - description_hash: self.description_hash, - payment_secret: self.payment_secret.to_hex(), - min_final_cltv_expiry_delta: self.min_final_cltv_expiry_delta, - expiry: Duration::from_secs(self.expiry), + bolt11: val.bolt11, + payee_pubkey: val.payee_pubkey, + payment_hash: val.payment_hash, + description_hash: val.description_hash, + payment_secret: val.payment_secret.to_hex(), + min_final_cltv_expiry_delta: val.min_final_cltv_expiry_delta, + expiry: Duration::from_secs(val.expiry), expires_at: Utc - .timestamp_opt((self.timestamp + self.expiry) as i64, 0) + .timestamp_opt((val.timestamp + val.expiry) as i64, 0) .unwrap(), }), ..Default::default() @@ -40,29 +40,29 @@ impl Into for LNInvoice { } } -impl Into for BreezPayment { - fn into(self) -> Payment { +impl From for Payment { + fn from(val: BreezPayment) -> Self { Payment { - ledger: Ledger::LIGHTNING, - payment_hash: Some(self.id), - payment_preimage: match self.details { + ledger: Ledger::Lightning, + payment_hash: Some(val.id), + payment_preimage: match val.details { PaymentDetails::Ln { data } => Some(data.payment_preimage), _ => None, }, - error: self.error, - amount_msat: self.amount_msat, - fee_msat: Some(self.fee_msat), - payment_time: Some(Utc.timestamp_opt(self.payment_time, 0).unwrap()), - description: self.description, - metadata: self.metadata, + error: val.error, + amount_msat: val.amount_msat, + fee_msat: Some(val.fee_msat), + payment_time: Some(Utc.timestamp_opt(val.payment_time, 0).unwrap()), + description: val.description, + metadata: val.metadata, ..Default::default() } } } -impl Into for BreezNetwork { - fn into(self) -> Currency { - match self { +impl From for Currency { + fn from(val: BreezNetwork) -> Self { + match val { BreezNetwork::Bitcoin => Currency::Bitcoin, BreezNetwork::Regtest => Currency::Regtest, BreezNetwork::Signet => Currency::Signet, @@ -71,37 +71,37 @@ impl Into for BreezNetwork { } } -impl Into for BreezPayment { - fn into(self) -> LnInvoicePaidEvent { +impl From for LnInvoicePaidEvent { + fn from(val: BreezPayment) -> Self { LnInvoicePaidEvent { - payment_hash: self.id, - amount_msat: self.amount_msat, - fee_msat: self.fee_msat, - payment_time: Utc.timestamp_opt(self.payment_time, 0).unwrap(), + payment_hash: val.id, + amount_msat: val.amount_msat, + fee_msat: val.fee_msat, + payment_time: Utc.timestamp_opt(val.payment_time, 0).unwrap(), } } } -impl Into for BreezPayment { - fn into(self) -> LnPaySuccessEvent { +impl From for LnPaySuccessEvent { + fn from(val: BreezPayment) -> Self { LnPaySuccessEvent { - amount_msat: self.amount_msat, - fees_msat: self.fee_msat, - payment_hash: self.id, - payment_preimage: match self.details { + amount_msat: val.amount_msat, + fees_msat: val.fee_msat, + payment_hash: val.id, + payment_preimage: match val.details { PaymentDetails::Ln { data } => data.payment_preimage, _ => String::new(), }, - payment_time: Utc.timestamp_opt(self.payment_time as i64, 0).unwrap(), + payment_time: Utc.timestamp_opt(val.payment_time, 0).unwrap(), } } } -impl Into for PaymentFailedData { - fn into(self) -> LnPayFailureEvent { +impl From for LnPayFailureEvent { + fn from(val: PaymentFailedData) -> Self { LnPayFailureEvent { - reason: self.error, - payment_hash: self.invoice.unwrap().payment_hash, + reason: val.error, + payment_hash: val.invoice.unwrap().payment_hash, } } } diff --git a/src/infra/lightning/cln/cln_grpc_listener.rs b/src/infra/lightning/cln/cln_grpc_listener.rs index 766b6e9..aebda3d 100644 --- a/src/infra/lightning/cln/cln_grpc_listener.rs +++ b/src/infra/lightning/cln/cln_grpc_listener.rs @@ -114,13 +114,13 @@ pub async fn listen_invoices( } } -impl Into for WaitanyinvoiceResponse { - fn into(self) -> LnInvoicePaidEvent { +impl From for LnInvoicePaidEvent { + fn from(val: WaitanyinvoiceResponse) -> Self { LnInvoicePaidEvent { - payment_hash: self.payment_hash.to_hex(), - amount_msat: self.amount_received_msat.as_ref().unwrap().msat, + payment_hash: val.payment_hash.to_hex(), + amount_msat: val.amount_received_msat.as_ref().unwrap().msat, fee_msat: 0, - payment_time: Utc.timestamp_opt(self.paid_at() as i64, 0).unwrap(), + payment_time: Utc.timestamp_opt(val.paid_at() as i64, 0).unwrap(), } } } diff --git a/src/infra/lightning/cln/cln_grpc_types.rs b/src/infra/lightning/cln/cln_grpc_types.rs index e70a312..47e89d5 100644 --- a/src/infra/lightning/cln/cln_grpc_types.rs +++ b/src/infra/lightning/cln/cln_grpc_types.rs @@ -5,25 +5,25 @@ use crate::{application::entities::Ledger, domains::payments::entities::Payment} use super::cln::{pay_response::PayStatus, PayResponse}; -impl Into for PayResponse { - fn into(self) -> Payment { - let error = match self.status() { +impl From for Payment { + fn from(val: PayResponse) -> Self { + let error = match val.status() { PayStatus::Complete => None, _ => Some(format!( "Unexpected error. Payment returned successfully but with status {}", - self.status().as_str_name() + val.status().as_str_name() )), }; - let seconds = self.created_at as i64; - let nanoseconds = ((self.created_at - seconds as f64) * 1e9) as u32; + let seconds = val.created_at as i64; + let nanoseconds = ((val.created_at - seconds as f64) * 1e9) as u32; Payment { - ledger: Ledger::LIGHTNING, - payment_hash: Some(self.payment_hash.to_hex()), - payment_preimage: Some(self.payment_preimage.to_hex()), - amount_msat: self.amount_sent_msat.clone().unwrap().msat, - fee_msat: Some(self.amount_sent_msat.unwrap().msat - self.amount_msat.unwrap().msat), + ledger: Ledger::Lightning, + payment_hash: Some(val.payment_hash.to_hex()), + payment_preimage: Some(val.payment_preimage.to_hex()), + amount_msat: val.amount_sent_msat.clone().unwrap().msat, + fee_msat: Some(val.amount_sent_msat.unwrap().msat - val.amount_msat.unwrap().msat), payment_time: Some(Utc.timestamp_opt(seconds, nanoseconds).unwrap()), error, ..Default::default() diff --git a/src/infra/lightning/cln/cln_rest_client.rs b/src/infra/lightning/cln/cln_rest_client.rs index 6bc3049..23ab9a2 100644 --- a/src/infra/lightning/cln/cln_rest_client.rs +++ b/src/infra/lightning/cln/cln_rest_client.rs @@ -154,7 +154,7 @@ impl LnClient for ClnRestClient { label: Some(Uuid::new_v4().to_string()), maxfeepercent: self.maxfeepercent, retry_for: self.retry_for, - exemptfee: self.payment_exemptfee.clone(), + exemptfee: self.payment_exemptfee, }, ) .await diff --git a/src/infra/lightning/cln/cln_rest_types.rs b/src/infra/lightning/cln/cln_rest_types.rs index 3d7f7be..217154b 100644 --- a/src/infra/lightning/cln/cln_rest_types.rs +++ b/src/infra/lightning/cln/cln_rest_types.rs @@ -37,25 +37,25 @@ pub struct PayResponse { pub status: String, } -impl Into for PayResponse { - fn into(self) -> Payment { - let error = match self.status.as_str() { +impl From for Payment { + fn from(val: PayResponse) -> Self { + let error = match val.status.as_str() { "complete" => None, _ => Some(format!( "Unexpected error. Payment returned successfully but with status {}", - self.status + val.status )), }; - let seconds = self.created_at as i64; - let nanoseconds = ((self.created_at - seconds as f64) * 1e9) as u32; + let seconds = val.created_at as i64; + let nanoseconds = ((val.created_at - seconds as f64) * 1e9) as u32; Payment { - ledger: Ledger::LIGHTNING, - payment_hash: Some(self.payment_hash), - payment_preimage: Some(self.payment_preimage), - amount_msat: self.amount_sent_msat, - fee_msat: Some(self.amount_sent_msat - self.amount_msat), + ledger: Ledger::Lightning, + payment_hash: Some(val.payment_hash), + payment_preimage: Some(val.payment_preimage), + amount_msat: val.amount_sent_msat, + fee_msat: Some(val.amount_sent_msat - val.amount_msat), payment_time: Some(Utc.timestamp_opt(seconds, nanoseconds).unwrap()), error, ..Default::default() diff --git a/src/infra/lightning/cln/cln_websocket_types.rs b/src/infra/lightning/cln/cln_websocket_types.rs index e9b65b2..db9a582 100644 --- a/src/infra/lightning/cln/cln_websocket_types.rs +++ b/src/infra/lightning/cln/cln_websocket_types.rs @@ -37,34 +37,34 @@ pub struct SendPayFailureData { pub status: String, } -impl Into for CoinMovement { - fn into(self) -> LnInvoicePaidEvent { +impl From for LnInvoicePaidEvent { + fn from(val: CoinMovement) -> Self { LnInvoicePaidEvent { - payment_hash: self.payment_hash, - amount_msat: self.credit_msat, + payment_hash: val.payment_hash, + amount_msat: val.credit_msat, fee_msat: 0, - payment_time: Utc.timestamp_opt(self.timestamp as i64, 0).unwrap(), + payment_time: Utc.timestamp_opt(val.timestamp as i64, 0).unwrap(), } } } -impl Into for SendPaySuccess { - fn into(self) -> LnPaySuccessEvent { +impl From for LnPaySuccessEvent { + fn from(val: SendPaySuccess) -> Self { LnPaySuccessEvent { - amount_msat: self.amount_msat, - fees_msat: self.amount_sent_msat - self.amount_msat, - payment_hash: self.payment_hash, - payment_preimage: self.payment_preimage, - payment_time: Utc.timestamp_opt(self.completed_at as i64, 0).unwrap(), + amount_msat: val.amount_msat, + fees_msat: val.amount_sent_msat - val.amount_msat, + payment_hash: val.payment_hash, + payment_preimage: val.payment_preimage, + payment_time: Utc.timestamp_opt(val.completed_at as i64, 0).unwrap(), } } } -impl Into for SendPayFailure { - fn into(self) -> LnPayFailureEvent { +impl From for LnPayFailureEvent { + fn from(val: SendPayFailure) -> Self { LnPayFailureEvent { - reason: self.message, - payment_hash: self.data.payment_hash, + reason: val.message, + payment_hash: val.data.payment_hash, } } } diff --git a/src/infra/lightning/cln/proto/node.proto b/src/infra/lightning/cln/proto/node.proto index ae34b0f..a3e719c 100644 --- a/src/infra/lightning/cln/proto/node.proto +++ b/src/infra/lightning/cln/proto/node.proto @@ -14,6 +14,7 @@ service Node { rpc SendPay(SendpayRequest) returns (SendpayResponse) {} rpc ListChannels(ListchannelsRequest) returns (ListchannelsResponse) {} rpc AddGossip(AddgossipRequest) returns (AddgossipResponse) {} + rpc AddPsbtOutput(AddpsbtoutputRequest) returns (AddpsbtoutputResponse) {} rpc AutoCleanInvoice(AutocleaninvoiceRequest) returns (AutocleaninvoiceResponse) {} rpc AutoCleanOnce(AutocleanonceRequest) returns (AutocleanonceResponse) {} rpc AutoCleanStatus(AutocleanstatusRequest) returns (AutocleanstatusResponse) {} @@ -26,12 +27,20 @@ service Node { rpc CreateOnion(CreateonionRequest) returns (CreateonionResponse) {} rpc DelDatastore(DeldatastoreRequest) returns (DeldatastoreResponse) {} rpc DelInvoice(DelinvoiceRequest) returns (DelinvoiceResponse) {} + rpc DevForgetChannel(DevforgetchannelRequest) returns (DevforgetchannelResponse) {} + rpc EmergencyRecover(EmergencyrecoverRequest) returns (EmergencyrecoverResponse) {} + rpc Recover(RecoverRequest) returns (RecoverResponse) {} + rpc RecoverChannel(RecoverchannelRequest) returns (RecoverchannelResponse) {} rpc Invoice(InvoiceRequest) returns (InvoiceResponse) {} + rpc CreateInvoiceRequest(InvoicerequestRequest) returns (InvoicerequestResponse) {} + rpc DisableInvoiceRequest(DisableinvoicerequestRequest) returns (DisableinvoicerequestResponse) {} + rpc ListInvoiceRequests(ListinvoicerequestsRequest) returns (ListinvoicerequestsResponse) {} rpc ListDatastore(ListdatastoreRequest) returns (ListdatastoreResponse) {} rpc ListInvoices(ListinvoicesRequest) returns (ListinvoicesResponse) {} rpc SendOnion(SendonionRequest) returns (SendonionResponse) {} rpc ListSendPays(ListsendpaysRequest) returns (ListsendpaysResponse) {} rpc ListTransactions(ListtransactionsRequest) returns (ListtransactionsResponse) {} + rpc MakeSecret(MakesecretRequest) returns (MakesecretResponse) {} rpc Pay(PayRequest) returns (PayResponse) {} rpc ListNodes(ListnodesRequest) returns (ListnodesResponse) {} rpc WaitAnyInvoice(WaitanyinvoiceRequest) returns (WaitanyinvoiceResponse) {} @@ -62,12 +71,14 @@ service Node { rpc FundChannel(FundchannelRequest) returns (FundchannelResponse) {} rpc FundChannel_Start(Fundchannel_startRequest) returns (Fundchannel_startResponse) {} rpc GetLog(GetlogRequest) returns (GetlogResponse) {} + rpc FunderUpdate(FunderupdateRequest) returns (FunderupdateResponse) {} rpc GetRoute(GetrouteRequest) returns (GetrouteResponse) {} rpc ListForwards(ListforwardsRequest) returns (ListforwardsResponse) {} rpc ListOffers(ListoffersRequest) returns (ListoffersResponse) {} rpc ListPays(ListpaysRequest) returns (ListpaysResponse) {} rpc ListHtlcs(ListhtlcsRequest) returns (ListhtlcsResponse) {} rpc MultiFundChannel(MultifundchannelRequest) returns (MultifundchannelResponse) {} + rpc MultiWithdraw(MultiwithdrawRequest) returns (MultiwithdrawResponse) {} rpc Offer(OfferRequest) returns (OfferResponse) {} rpc OpenChannel_Abort(Openchannel_abortRequest) returns (Openchannel_abortResponse) {} rpc OpenChannel_Bump(Openchannel_bumpRequest) returns (Openchannel_bumpResponse) {} @@ -75,13 +86,28 @@ service Node { rpc OpenChannel_Signed(Openchannel_signedRequest) returns (Openchannel_signedResponse) {} rpc OpenChannel_Update(Openchannel_updateRequest) returns (Openchannel_updateResponse) {} rpc Ping(PingRequest) returns (PingResponse) {} + rpc Plugin(PluginRequest) returns (PluginResponse) {} + rpc RenePayStatus(RenepaystatusRequest) returns (RenepaystatusResponse) {} + rpc RenePay(RenepayRequest) returns (RenepayResponse) {} + rpc ReserveInputs(ReserveinputsRequest) returns (ReserveinputsResponse) {} rpc SendCustomMsg(SendcustommsgRequest) returns (SendcustommsgResponse) {} + rpc SendInvoice(SendinvoiceRequest) returns (SendinvoiceResponse) {} + rpc SendOnionMessage(SendonionmessageRequest) returns (SendonionmessageResponse) {} rpc SetChannel(SetchannelRequest) returns (SetchannelResponse) {} + rpc SetConfig(SetconfigRequest) returns (SetconfigResponse) {} + rpc SetPsbtVersion(SetpsbtversionRequest) returns (SetpsbtversionResponse) {} rpc SignInvoice(SigninvoiceRequest) returns (SigninvoiceResponse) {} rpc SignMessage(SignmessageRequest) returns (SignmessageResponse) {} + rpc Splice_Init(Splice_initRequest) returns (Splice_initResponse) {} + rpc Splice_Signed(Splice_signedRequest) returns (Splice_signedResponse) {} + rpc Splice_Update(Splice_updateRequest) returns (Splice_updateResponse) {} + rpc UnreserveInputs(UnreserveinputsRequest) returns (UnreserveinputsResponse) {} + rpc UpgradeWallet(UpgradewalletRequest) returns (UpgradewalletResponse) {} rpc WaitBlockHeight(WaitblockheightRequest) returns (WaitblockheightResponse) {} rpc Wait(WaitRequest) returns (WaitResponse) {} + rpc ListConfigs(ListconfigsRequest) returns (ListconfigsResponse) {} rpc Stop(StopRequest) returns (StopResponse) {} + rpc Help(HelpRequest) returns (HelpResponse) {} rpc PreApproveKeysend(PreapprovekeysendRequest) returns (PreapprovekeysendResponse) {} rpc PreApproveInvoice(PreapproveinvoiceRequest) returns (PreapproveinvoiceResponse) {} rpc StaticBackup(StaticbackupRequest) returns (StaticbackupResponse) {} @@ -91,6 +117,16 @@ service Node { rpc BkprListAccountEvents(BkprlistaccounteventsRequest) returns (BkprlistaccounteventsResponse) {} rpc BkprListBalances(BkprlistbalancesRequest) returns (BkprlistbalancesResponse) {} rpc BkprListIncome(BkprlistincomeRequest) returns (BkprlistincomeResponse) {} + rpc BlacklistRune(BlacklistruneRequest) returns (BlacklistruneResponse) {} + rpc CheckRune(CheckruneRequest) returns (CheckruneResponse) {} + rpc CreateRune(CreateruneRequest) returns (CreateruneResponse) {} + rpc ShowRunes(ShowrunesRequest) returns (ShowrunesResponse) {} + + rpc SubscribeBlockAdded(StreamBlockAddedRequest) returns (stream BlockAddedNotification) {} + rpc SubscribeChannelOpenFailed(StreamChannelOpenFailedRequest) returns (stream ChannelOpenFailedNotification) {} + rpc SubscribeChannelOpened(StreamChannelOpenedRequest) returns (stream ChannelOpenedNotification) {} + rpc SubscribeConnect(StreamConnectRequest) returns (stream PeerConnectNotification) {} + rpc SubscribeCustomMsg(StreamCustomMsgRequest) returns (stream CustomMsgNotification) {} } message GetinfoRequest { @@ -161,6 +197,7 @@ message ListpeersRequest { DEBUG = 1; INFO = 2; UNUSUAL = 3; + TRACE = 4; } optional bytes id = 1; optional ListpeersLevel level = 2; @@ -190,6 +227,7 @@ message ListpeersPeersLog { DEBUG = 4; IO_IN = 5; IO_OUT = 6; + TRACE = 7; } ListpeersPeersLogType item_type = 1; optional uint32 num_skipped = 2; @@ -323,6 +361,19 @@ message AddgossipRequest { message AddgossipResponse { } +message AddpsbtoutputRequest { + Amount satoshi = 1; + optional uint32 locktime = 2; + optional string initialpsbt = 3; + optional string destination = 4; +} + +message AddpsbtoutputResponse { + string psbt = 1; + uint32 estimated_added_weight = 2; + uint32 outnum = 3; +} + message AutocleaninvoiceRequest { optional uint64 expired_by = 1; optional uint64 cycle_seconds = 2; @@ -533,8 +584,8 @@ message CreateinvoiceResponse { } message CreateinvoicePaid_outpoint { - optional bytes txid = 1; - optional uint32 outnum = 2; + bytes txid = 1; + uint32 outnum = 2; } message DatastoreRequest { @@ -565,12 +616,12 @@ message DatastoreusageRequest { } message DatastoreusageResponse { - optional DatastoreusageDatastoreusage datastoreusage = 1; + DatastoreusageDatastoreusage datastoreusage = 1; } message DatastoreusageDatastoreusage { - optional string key = 1; - optional uint64 total_bytes = 2; + string key = 1; + uint64 total_bytes = 2; } message CreateonionRequest { @@ -639,6 +690,46 @@ message DelinvoiceResponse { optional bytes payment_preimage = 17; } +message DevforgetchannelRequest { + bytes id = 1; + optional string short_channel_id = 2; + optional bytes channel_id = 3; + optional bool force = 4; +} + +message DevforgetchannelResponse { + bool forced = 1; + bool funding_unspent = 2; + bytes funding_txid = 3; +} + +message EmergencyrecoverRequest { +} + +message EmergencyrecoverResponse { + repeated bytes stubs = 1; +} + +message RecoverRequest { + string hsmsecret = 1; +} + +message RecoverResponse { + // Recover.result + enum RecoverResult { + RECOVERY_RESTART_IN_PROGRESS = 0; + } + optional RecoverResult result = 1; +} + +message RecoverchannelRequest { + repeated bytes scb = 1; +} + +message RecoverchannelResponse { + repeated string stubs = 1; +} + message InvoiceRequest { string description = 2; string label = 3; @@ -646,6 +737,7 @@ message InvoiceRequest { optional bytes preimage = 5; optional uint32 cltv = 6; optional uint64 expiry = 7; + repeated string exposeprivatechannels = 8; optional bool deschashonly = 9; AmountOrAny amount_msat = 10; } @@ -663,6 +755,55 @@ message InvoiceResponse { optional uint64 created_index = 10; } +message InvoicerequestRequest { + Amount amount = 1; + string description = 2; + optional string issuer = 3; + optional string label = 4; + optional uint64 absolute_expiry = 5; + optional bool single_use = 6; +} + +message InvoicerequestResponse { + bytes invreq_id = 1; + bool active = 2; + bool single_use = 3; + string bolt12 = 4; + bool used = 5; + optional string label = 6; +} + +message DisableinvoicerequestRequest { + string invreq_id = 1; +} + +message DisableinvoicerequestResponse { + bytes invreq_id = 1; + bool active = 2; + bool single_use = 3; + string bolt12 = 4; + bool used = 5; + optional string label = 6; +} + +message ListinvoicerequestsRequest { + optional string invreq_id = 1; + optional bool active_only = 2; +} + +message ListinvoicerequestsResponse { + repeated ListinvoicerequestsInvoicerequests invoicerequests = 1; +} + +message ListinvoicerequestsInvoicerequests { + bytes invreq_id = 1; + bool active = 2; + bool single_use = 3; + string bolt12 = 4; + bool used = 5; + optional string label = 6; +} + message ListdatastoreRequest { repeated string key = 2; } @@ -724,8 +865,8 @@ message ListinvoicesInvoices { } message ListinvoicesInvoicesPaid_outpoint { - optional bytes txid = 1; - optional uint32 outnum = 2; + bytes txid = 1; + uint32 outnum = 2; } message SendonionRequest { @@ -853,6 +994,15 @@ message ListtransactionsTransactionsOutputs { Amount amount_msat = 6; } +message MakesecretRequest { + optional bytes hex = 1; + optional string string = 2; +} + +message MakesecretResponse { + bytes secret = 1; +} + message PayRequest { string bolt11 = 1; optional string label = 3; @@ -957,8 +1107,8 @@ message WaitanyinvoiceResponse { } message WaitanyinvoicePaid_outpoint { - optional bytes txid = 1; - optional uint32 outnum = 2; + bytes txid = 1; + uint32 outnum = 2; } message WaitinvoiceRequest { @@ -989,8 +1139,8 @@ message WaitinvoiceResponse { } message WaitinvoicePaid_outpoint { - optional bytes txid = 1; - optional uint32 outnum = 2; + bytes txid = 1; + uint32 outnum = 2; } message WaitsendpayRequest { @@ -1217,9 +1367,9 @@ message ListpeerchannelsChannels { DUALOPEND_OPEN_COMMITTED = 12; DUALOPEND_OPEN_COMMIT_READY = 13; } - optional bytes peer_id = 1; - optional bool peer_connected = 2; - optional ListpeerchannelsChannelsState state = 3; + bytes peer_id = 1; + bool peer_connected = 2; + ListpeerchannelsChannelsState state = 3; optional bytes scratch_txid = 4; optional ListpeerchannelsChannelsFeerate feerate = 6; optional string owner = 7; @@ -1234,7 +1384,7 @@ message ListpeerchannelsChannels { repeated ListpeerchannelsChannelsInflight inflight = 16; optional bytes close_to = 17; optional bool private = 18; - optional ChannelSide opener = 19; + ChannelSide opener = 19; optional ChannelSide closer = 20; optional ListpeerchannelsChannelsFunding funding = 22; optional Amount to_us_msat = 23; @@ -1277,45 +1427,45 @@ message ListpeerchannelsChannels { } message ListpeerchannelsChannelsUpdates { - optional ListpeerchannelsChannelsUpdatesLocal local = 1; + ListpeerchannelsChannelsUpdatesLocal local = 1; optional ListpeerchannelsChannelsUpdatesRemote remote = 2; } message ListpeerchannelsChannelsUpdatesLocal { - optional Amount htlc_minimum_msat = 1; - optional Amount htlc_maximum_msat = 2; - optional uint32 cltv_expiry_delta = 3; - optional Amount fee_base_msat = 4; - optional uint32 fee_proportional_millionths = 5; + Amount htlc_minimum_msat = 1; + Amount htlc_maximum_msat = 2; + uint32 cltv_expiry_delta = 3; + Amount fee_base_msat = 4; + uint32 fee_proportional_millionths = 5; } message ListpeerchannelsChannelsUpdatesRemote { - optional Amount htlc_minimum_msat = 1; - optional Amount htlc_maximum_msat = 2; - optional uint32 cltv_expiry_delta = 3; - optional Amount fee_base_msat = 4; - optional uint32 fee_proportional_millionths = 5; + Amount htlc_minimum_msat = 1; + Amount htlc_maximum_msat = 2; + uint32 cltv_expiry_delta = 3; + Amount fee_base_msat = 4; + uint32 fee_proportional_millionths = 5; } message ListpeerchannelsChannelsFeerate { - optional uint32 perkw = 1; - optional uint32 perkb = 2; + uint32 perkw = 1; + uint32 perkb = 2; } message ListpeerchannelsChannelsInflight { - optional bytes funding_txid = 1; - optional uint32 funding_outnum = 2; - optional string feerate = 3; - optional Amount total_funding_msat = 4; - optional Amount our_funding_msat = 5; + bytes funding_txid = 1; + uint32 funding_outnum = 2; + string feerate = 3; + Amount total_funding_msat = 4; + Amount our_funding_msat = 5; optional bytes scratch_txid = 6; optional sint64 splice_amount = 7; } message ListpeerchannelsChannelsFunding { optional Amount pushed_msat = 1; - optional Amount local_funds_msat = 2; - optional Amount remote_funds_msat = 3; + Amount local_funds_msat = 2; + Amount remote_funds_msat = 3; optional Amount fee_paid_msat = 4; optional Amount fee_rcvd_msat = 5; } @@ -1331,14 +1481,14 @@ message ListpeerchannelsChannelsHtlcs { IN = 0; OUT = 1; } - optional ListpeerchannelsChannelsHtlcsDirection direction = 1; - optional uint64 id = 2; - optional Amount amount_msat = 3; - optional uint32 expiry = 4; - optional bytes payment_hash = 5; + ListpeerchannelsChannelsHtlcsDirection direction = 1; + uint64 id = 2; + Amount amount_msat = 3; + uint32 expiry = 4; + bytes payment_hash = 5; optional bool local_trimmed = 6; optional string status = 7; - optional HtlcState state = 8; + HtlcState state = 8; } message ListclosedchannelsRequest { @@ -1411,6 +1561,7 @@ message DecodepayResponse { optional bytes payment_metadata = 13; repeated DecodepayFallbacks fallbacks = 14; repeated DecodepayExtra extra = 16; + optional DecodeRoutehintList routes = 17; } message DecodepayFallbacks { @@ -1521,11 +1672,14 @@ message DecodeResponse { optional Amount amount_msat = 79; optional string description = 80; optional bytes features = 81; + optional DecodeRoutehintList routes = 82; } message DecodeOffer_paths { - bytes first_node_id = 1; + optional bytes first_node_id = 1; bytes blinding = 2; + optional uint32 first_scid_dir = 4; + optional string first_scid = 5; } message DecodeOffer_recurrencePaywindow { @@ -1679,9 +1833,9 @@ message FeeratesPerkb { } message FeeratesPerkbEstimates { - optional uint32 blockcount = 1; - optional uint32 feerate = 2; - optional uint32 smoothed_feerate = 3; + uint32 blockcount = 1; + uint32 feerate = 2; + uint32 smoothed_feerate = 3; } message FeeratesPerkw { @@ -1699,9 +1853,9 @@ message FeeratesPerkw { } message FeeratesPerkwEstimates { - optional uint32 blockcount = 1; - optional uint32 feerate = 2; - optional uint32 smoothed_feerate = 3; + uint32 blockcount = 1; + uint32 feerate = 2; + uint32 smoothed_feerate = 3; } message FeeratesOnchain_fee_estimates { @@ -1829,6 +1983,7 @@ message GetlogRequest { INFO = 2; DEBUG = 3; IO = 4; + TRACE = 5; } optional GetlogLevel level = 1; } @@ -1850,6 +2005,7 @@ message GetlogLog { DEBUG = 4; IO_IN = 5; IO_OUT = 6; + TRACE = 7; } GetlogLogType item_type = 1; optional uint32 num_skipped = 2; @@ -1860,6 +2016,57 @@ message GetlogLog { optional bytes data = 7; } +message FunderupdateRequest { + // FunderUpdate.policy + enum FunderupdatePolicy { + MATCH = 0; + AVAILABLE = 1; + FIXED = 2; + } + optional FunderupdatePolicy policy = 1; + optional Amount policy_mod = 2; + optional bool leases_only = 3; + optional Amount min_their_funding_msat = 4; + optional Amount max_their_funding_msat = 5; + optional Amount per_channel_min_msat = 6; + optional Amount per_channel_max_msat = 7; + optional Amount reserve_tank_msat = 8; + optional uint32 fuzz_percent = 9; + optional uint32 fund_probability = 10; + optional Amount lease_fee_base_msat = 11; + optional uint32 lease_fee_basis = 12; + optional uint32 funding_weight = 13; + optional Amount channel_fee_max_base_msat = 14; + optional uint32 channel_fee_max_proportional_thousandths = 15; + optional bytes compact_lease = 16; +} + +message FunderupdateResponse { + // FunderUpdate.policy + enum FunderupdatePolicy { + MATCH = 0; + AVAILABLE = 1; + FIXED = 2; + } + string summary = 1; + FunderupdatePolicy policy = 2; + uint32 policy_mod = 3; + bool leases_only = 4; + Amount min_their_funding_msat = 5; + Amount max_their_funding_msat = 6; + Amount per_channel_min_msat = 7; + Amount per_channel_max_msat = 8; + Amount reserve_tank_msat = 9; + uint32 fuzz_percent = 10; + uint32 fund_probability = 11; + optional Amount lease_fee_base_msat = 12; + optional uint32 lease_fee_basis = 13; + optional uint32 funding_weight = 14; + optional Amount channel_fee_max_base_msat = 15; + optional uint32 channel_fee_max_proportional_thousandths = 16; + optional bytes compact_lease = 17; +} + message GetrouteRequest { bytes id = 1; uint64 riskfactor = 3; @@ -2082,6 +2289,18 @@ message MultifundchannelFailedError { string message = 2; } +message MultiwithdrawRequest { + repeated OutputDesc outputs = 1; + optional Feerate feerate = 2; + optional uint32 minconf = 3; + repeated Outpoint utxos = 4; +} + +message MultiwithdrawResponse { + bytes tx = 1; + bytes txid = 2; +} + message OfferRequest { string amount = 1; string description = 2; @@ -2205,6 +2424,99 @@ message PingResponse { uint32 totlen = 1; } +message PluginRequest { + PluginSubcommand subcommand = 1; + optional string plugin = 2; + optional string directory = 3; + repeated string options = 4; +} + +message PluginResponse { + PluginSubcommand command = 1; + repeated PluginPlugins plugins = 2; + optional string result = 3; +} + +message PluginPlugins { + string name = 1; + bool active = 2; + bool dynamic = 3; +} + +message RenepaystatusRequest { + optional string invstring = 1; +} + +message RenepaystatusResponse { + repeated RenepaystatusPaystatus paystatus = 1; +} + +message RenepaystatusPaystatus { + // RenePayStatus.paystatus[].status + enum RenepaystatusPaystatusStatus { + COMPLETE = 0; + PENDING = 1; + FAILED = 2; + } + string bolt11 = 1; + optional bytes payment_preimage = 2; + bytes payment_hash = 3; + double created_at = 4; + uint32 groupid = 5; + optional uint32 parts = 6; + Amount amount_msat = 7; + optional Amount amount_sent_msat = 8; + RenepaystatusPaystatusStatus status = 9; + optional bytes destination = 10; + repeated string notes = 11; +} + +message RenepayRequest { + string invstring = 1; + optional Amount amount_msat = 2; + optional Amount maxfee = 3; + optional uint32 maxdelay = 4; + optional uint32 retry_for = 5; + optional string description = 6; + optional string label = 7; + optional bool dev_use_shadow = 8; +} + +message RenepayResponse { + // RenePay.status + enum RenepayStatus { + COMPLETE = 0; + PENDING = 1; + FAILED = 2; + } + bytes payment_preimage = 1; + bytes payment_hash = 2; + double created_at = 3; + uint32 parts = 4; + Amount amount_msat = 5; + Amount amount_sent_msat = 6; + RenepayStatus status = 7; + optional bytes destination = 8; +} + +message ReserveinputsRequest { + string psbt = 1; + optional bool exclusive = 2; + optional uint32 reserve = 3; +} + +message ReserveinputsResponse { + repeated ReserveinputsReservations reservations = 1; +} + +message ReserveinputsReservations { + bytes txid = 1; + uint32 vout = 2; + bool was_reserved = 3; + bool reserved = 4; + uint32 reserved_to_block = 5; +} + message SendcustommsgRequest { bytes node_id = 1; bytes msg = 2; @@ -2214,6 +2526,50 @@ message SendcustommsgResponse { string status = 1; } +message SendinvoiceRequest { + string invreq = 1; + string label = 2; + optional Amount amount_msat = 3; + optional uint32 timeout = 4; + optional uint64 quantity = 5; +} + +message SendinvoiceResponse { + // SendInvoice.status + enum SendinvoiceStatus { + UNPAID = 0; + PAID = 1; + EXPIRED = 2; + } + string label = 1; + string description = 2; + bytes payment_hash = 3; + SendinvoiceStatus status = 4; + uint64 expires_at = 5; + optional Amount amount_msat = 6; + optional string bolt12 = 7; + optional uint64 created_index = 8; + optional uint64 updated_index = 9; + optional uint64 pay_index = 10; + optional Amount amount_received_msat = 11; + optional uint64 paid_at = 12; + optional bytes payment_preimage = 13; +} + +message SendonionmessageRequest { + bytes first_id = 1; + bytes blinding = 2; + repeated SendonionmessageHops hops = 3; +} + +message SendonionmessageResponse { +} + +message SendonionmessageHops { + bytes node = 1; + uint32 tlv = 2; +} + message SetchannelRequest { string id = 1; optional Amount feebase = 2; @@ -2241,6 +2597,36 @@ message SetchannelChannels { optional bool ignore_fee_limits = 10; } +message SetconfigRequest { + string config = 1; + optional string val = 2; +} + +message SetconfigResponse { + SetconfigConfig config = 1; +} + +message SetconfigConfig { + string config = 1; + string source = 2; + optional string plugin = 3; + bool dynamic = 4; + optional bool set = 5; + optional string value_str = 6; + optional Amount value_msat = 7; + optional sint64 value_int = 8; + optional bool value_bool = 9; +} + +message SetpsbtversionRequest { + string psbt = 1; + uint32 version = 2; +} + +message SetpsbtversionResponse { + string psbt = 1; +} + message SigninvoiceRequest { string invstring = 1; } @@ -2259,6 +2645,68 @@ message SignmessageResponse { string zbase = 3; } +message Splice_initRequest { + bytes channel_id = 1; + sint64 relative_amount = 2; + optional string initialpsbt = 3; + optional uint32 feerate_per_kw = 4; + optional bool force_feerate = 5; +} + +message Splice_initResponse { + string psbt = 1; +} + +message Splice_signedRequest { + bytes channel_id = 1; + string psbt = 2; + optional bool sign_first = 3; +} + +message Splice_signedResponse { + bytes tx = 1; + bytes txid = 2; +} + +message Splice_updateRequest { + bytes channel_id = 1; + string psbt = 2; +} + +message Splice_updateResponse { + string psbt = 1; + bool commitments_secured = 2; +} + +message UnreserveinputsRequest { + string psbt = 1; + optional uint32 reserve = 2; +} + +message UnreserveinputsResponse { + repeated UnreserveinputsReservations reservations = 1; +} + +message UnreserveinputsReservations { + bytes txid = 1; + uint32 vout = 2; + bool was_reserved = 3; + bool reserved = 4; + optional uint32 reserved_to_block = 5; +} + +message UpgradewalletRequest { + optional Feerate feerate = 1; + optional bool reservedok = 2; +} + +message UpgradewalletResponse { + optional uint64 upgraded_outs = 1; + optional string psbt = 2; + optional bytes tx = 3; + optional bytes txid = 4; +} + message WaitblockheightRequest { uint32 blockheight = 1; optional uint32 timeout = 2; @@ -2327,6 +2775,536 @@ message WaitDetails { optional string out_channel = 12; } +message ListconfigsRequest { + optional string config = 1; +} + +message ListconfigsResponse { + optional ListconfigsConfigs configs = 1; + repeated ListconfigsPlugins plugins = 3; + repeated ListconfigsImportantplugins important_plugins = 4; + optional string conf = 5; + optional string lightning_dir = 6; + optional string network = 7; + optional bool allow_deprecated_apis = 8; + optional string rpc_file = 9; + repeated string disable_plugin = 10; + optional string bookkeeper_dir = 11; + optional string bookkeeper_db = 12; + optional bool always_use_proxy = 13; + optional bool daemon = 14; + optional string wallet = 15; + optional bool large_channels = 16; + optional bool experimental_dual_fund = 17; + optional bool experimental_splicing = 18; + optional bool experimental_onion_messages = 19; + optional bool experimental_offers = 20; + optional bool experimental_shutdown_wrong_funding = 21; + optional bool experimental_peer_storage = 22; + optional bool experimental_quiesce = 23; + optional bool experimental_upgrade_protocol = 24; + optional bool invoices_onchain_fallback = 25; + optional bool database_upgrade = 26; + optional bytes rgb = 27; + optional string alias = 28; + optional string pid_file = 29; + optional bool ignore_fee_limits = 30; + optional uint32 watchtime_blocks = 31; + optional uint32 max_locktime_blocks = 32; + optional uint32 funding_confirms = 33; + optional uint32 cltv_delta = 34; + optional uint32 cltv_final = 35; + optional uint32 commit_time = 36; + optional uint32 fee_base = 37; + optional sint64 rescan = 38; + optional uint32 fee_per_satoshi = 39; + optional uint32 max_concurrent_htlcs = 40; + optional Amount htlc_minimum_msat = 41; + optional Amount htlc_maximum_msat = 42; + optional Amount max_dust_htlc_exposure_msat = 43; + optional uint64 min_capacity_sat = 44; + optional string addr = 45; + optional string announce_addr = 46; + optional string bind_addr = 47; + optional bool offline = 48; + optional bool autolisten = 49; + optional string proxy = 50; + optional bool disable_dns = 51; + optional string announce_addr_discovered = 52; + optional sint64 announce_addr_discovered_port = 53; + optional bool encrypted_hsm = 54; + optional string rpc_file_mode = 55; + optional string log_level = 56; + optional string log_prefix = 57; + optional string log_file = 58; + optional bool log_timestamps = 59; + optional string force_feerates = 60; + optional string subdaemon = 61; + optional bool fetchinvoice_noconnect = 62; + optional string accept_htlc_tlv_types = 63; + optional string tor_service_password = 64; + optional bool dev_allowdustreserve = 65; + optional bool announce_addr_dns = 66; + optional bool require_confirmed_inputs = 67; + optional bool developer = 68; + optional uint64 commit_fee = 69; + optional Amount min_emergency_msat = 70; + optional uint32 commit_feerate_offset = 71; +} + +message ListconfigsConfigs { + optional ListconfigsConfigsConf conf = 1; + optional ListconfigsConfigsDeveloper developer = 2; + optional ListconfigsConfigsClearplugins clear_plugins = 3; + optional ListconfigsConfigsDisablempp disable_mpp = 4; + optional ListconfigsConfigsMainnet mainnet = 5; + optional ListconfigsConfigsRegtest regtest = 6; + optional ListconfigsConfigsSignet signet = 7; + optional ListconfigsConfigsTestnet testnet = 8; + optional ListconfigsConfigsImportantplugin important_plugin = 9; + optional ListconfigsConfigsPlugin plugin = 10; + optional ListconfigsConfigsPlugindir plugin_dir = 11; + optional ListconfigsConfigsLightningdir lightning_dir = 12; + optional ListconfigsConfigsNetwork network = 13; + optional ListconfigsConfigsAllowdeprecatedapis allow_deprecated_apis = 14; + optional ListconfigsConfigsRpcfile rpc_file = 15; + optional ListconfigsConfigsDisableplugin disable_plugin = 16; + optional ListconfigsConfigsAlwaysuseproxy always_use_proxy = 17; + optional ListconfigsConfigsDaemon daemon = 18; + optional ListconfigsConfigsWallet wallet = 19; + optional ListconfigsConfigsLargechannels large_channels = 20; + optional ListconfigsConfigsExperimentaldualfund experimental_dual_fund = 21; + optional ListconfigsConfigsExperimentalsplicing experimental_splicing = 22; + optional ListconfigsConfigsExperimentalonionmessages experimental_onion_messages = 23; + optional ListconfigsConfigsExperimentaloffers experimental_offers = 24; + optional ListconfigsConfigsExperimentalshutdownwrongfunding experimental_shutdown_wrong_funding = 25; + optional ListconfigsConfigsExperimentalpeerstorage experimental_peer_storage = 26; + optional ListconfigsConfigsExperimentalanchors experimental_anchors = 27; + optional ListconfigsConfigsDatabaseupgrade database_upgrade = 28; + optional ListconfigsConfigsRgb rgb = 29; + optional ListconfigsConfigsAlias alias = 30; + optional ListconfigsConfigsPidfile pid_file = 31; + optional ListconfigsConfigsIgnorefeelimits ignore_fee_limits = 32; + optional ListconfigsConfigsWatchtimeblocks watchtime_blocks = 33; + optional ListconfigsConfigsMaxlocktimeblocks max_locktime_blocks = 34; + optional ListconfigsConfigsFundingconfirms funding_confirms = 35; + optional ListconfigsConfigsCltvdelta cltv_delta = 36; + optional ListconfigsConfigsCltvfinal cltv_final = 37; + optional ListconfigsConfigsCommittime commit_time = 38; + optional ListconfigsConfigsFeebase fee_base = 39; + optional ListconfigsConfigsRescan rescan = 40; + optional ListconfigsConfigsFeepersatoshi fee_per_satoshi = 41; + optional ListconfigsConfigsMaxconcurrenthtlcs max_concurrent_htlcs = 42; + optional ListconfigsConfigsHtlcminimummsat htlc_minimum_msat = 43; + optional ListconfigsConfigsHtlcmaximummsat htlc_maximum_msat = 44; + optional ListconfigsConfigsMaxdusthtlcexposuremsat max_dust_htlc_exposure_msat = 45; + optional ListconfigsConfigsMincapacitysat min_capacity_sat = 46; + optional ListconfigsConfigsAddr addr = 47; + optional ListconfigsConfigsAnnounceaddr announce_addr = 48; + optional ListconfigsConfigsBindaddr bind_addr = 49; + optional ListconfigsConfigsOffline offline = 50; + optional ListconfigsConfigsAutolisten autolisten = 51; + optional ListconfigsConfigsProxy proxy = 52; + optional ListconfigsConfigsDisabledns disable_dns = 53; + optional ListconfigsConfigsAnnounceaddrdiscovered announce_addr_discovered = 54; + optional ListconfigsConfigsAnnounceaddrdiscoveredport announce_addr_discovered_port = 55; + optional ListconfigsConfigsEncryptedhsm encrypted_hsm = 56; + optional ListconfigsConfigsRpcfilemode rpc_file_mode = 57; + optional ListconfigsConfigsLoglevel log_level = 58; + optional ListconfigsConfigsLogprefix log_prefix = 59; + optional ListconfigsConfigsLogfile log_file = 60; + optional ListconfigsConfigsLogtimestamps log_timestamps = 61; + optional ListconfigsConfigsForcefeerates force_feerates = 62; + optional ListconfigsConfigsSubdaemon subdaemon = 63; + optional ListconfigsConfigsFetchinvoicenoconnect fetchinvoice_noconnect = 64; + optional ListconfigsConfigsAccepthtlctlvtypes accept_htlc_tlv_types = 65; + optional ListconfigsConfigsTorservicepassword tor_service_password = 66; + optional ListconfigsConfigsAnnounceaddrdns announce_addr_dns = 67; + optional ListconfigsConfigsRequireconfirmedinputs require_confirmed_inputs = 68; + optional ListconfigsConfigsCommitfee commit_fee = 69; + optional ListconfigsConfigsCommitfeerateoffset commit_feerate_offset = 70; +} + +message ListconfigsConfigsConf { + // ListConfigs.configs.conf.source + enum ListconfigsConfigsConfSource { + CMDLINE = 0; + } + string value_str = 1; + ListconfigsConfigsConfSource source = 2; +} + +message ListconfigsConfigsDeveloper { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsClearplugins { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsDisablempp { + bool set = 1; + string source = 2; + optional string plugin = 3; +} + +message ListconfigsConfigsMainnet { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsRegtest { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsSignet { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsTestnet { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsImportantplugin { + repeated string values_str = 1; + repeated string sources = 2; +} + +message ListconfigsConfigsPlugin { + repeated string values_str = 1; + repeated string sources = 2; +} + +message ListconfigsConfigsPlugindir { + repeated string values_str = 1; + repeated string sources = 2; +} + +message ListconfigsConfigsLightningdir { + string value_str = 1; + string source = 2; +} + +message ListconfigsConfigsNetwork { + string value_str = 1; + string source = 2; +} + +message ListconfigsConfigsAllowdeprecatedapis { + bool value_bool = 1; + string source = 2; +} + +message ListconfigsConfigsRpcfile { + string value_str = 1; + string source = 2; +} + +message ListconfigsConfigsDisableplugin { + repeated string values_str = 1; + repeated string sources = 2; +} + +message ListconfigsConfigsAlwaysuseproxy { + bool value_bool = 1; + string source = 2; +} + +message ListconfigsConfigsDaemon { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsWallet { + string value_str = 1; + string source = 2; +} + +message ListconfigsConfigsLargechannels { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsExperimentaldualfund { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsExperimentalsplicing { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsExperimentalonionmessages { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsExperimentaloffers { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsExperimentalshutdownwrongfunding { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsExperimentalpeerstorage { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsExperimentalanchors { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsDatabaseupgrade { + bool value_bool = 1; + string source = 2; +} + +message ListconfigsConfigsRgb { + bytes value_str = 1; + string source = 2; +} + +message ListconfigsConfigsAlias { + string value_str = 1; + string source = 2; +} + +message ListconfigsConfigsPidfile { + string value_str = 1; + string source = 2; +} + +message ListconfigsConfigsIgnorefeelimits { + bool value_bool = 1; + string source = 2; +} + +message ListconfigsConfigsWatchtimeblocks { + uint32 value_int = 1; + string source = 2; +} + +message ListconfigsConfigsMaxlocktimeblocks { + uint32 value_int = 1; + string source = 2; +} + +message ListconfigsConfigsFundingconfirms { + uint32 value_int = 1; + string source = 2; +} + +message ListconfigsConfigsCltvdelta { + uint32 value_int = 1; + string source = 2; +} + +message ListconfigsConfigsCltvfinal { + uint32 value_int = 1; + string source = 2; +} + +message ListconfigsConfigsCommittime { + uint32 value_int = 1; + string source = 2; +} + +message ListconfigsConfigsFeebase { + uint32 value_int = 1; + string source = 2; +} + +message ListconfigsConfigsRescan { + sint64 value_int = 1; + string source = 2; +} + +message ListconfigsConfigsFeepersatoshi { + uint32 value_int = 1; + string source = 2; +} + +message ListconfigsConfigsMaxconcurrenthtlcs { + uint32 value_int = 1; + string source = 2; +} + +message ListconfigsConfigsHtlcminimummsat { + Amount value_msat = 1; + string source = 2; +} + +message ListconfigsConfigsHtlcmaximummsat { + Amount value_msat = 1; + string source = 2; +} + +message ListconfigsConfigsMaxdusthtlcexposuremsat { + Amount value_msat = 1; + string source = 2; +} + +message ListconfigsConfigsMincapacitysat { + uint64 value_int = 1; + string source = 2; + optional bool dynamic = 3; +} + +message ListconfigsConfigsAddr { + repeated string values_str = 1; + repeated string sources = 2; +} + +message ListconfigsConfigsAnnounceaddr { + repeated string values_str = 1; + repeated string sources = 2; +} + +message ListconfigsConfigsBindaddr { + repeated string values_str = 1; + repeated string sources = 2; +} + +message ListconfigsConfigsOffline { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsAutolisten { + bool value_bool = 1; + string source = 2; +} + +message ListconfigsConfigsProxy { + string value_str = 1; + string source = 2; +} + +message ListconfigsConfigsDisabledns { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsAnnounceaddrdiscovered { + // ListConfigs.configs.announce-addr-discovered.value_str + enum ListconfigsConfigsAnnounceaddrdiscoveredValue_str { + TRUE = 0; + FALSE = 1; + AUTO = 2; + } + ListconfigsConfigsAnnounceaddrdiscoveredValue_str value_str = 1; + string source = 2; +} + +message ListconfigsConfigsAnnounceaddrdiscoveredport { + uint32 value_int = 1; + string source = 2; +} + +message ListconfigsConfigsEncryptedhsm { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsRpcfilemode { + string value_str = 1; + string source = 2; +} + +message ListconfigsConfigsLoglevel { + string value_str = 1; + string source = 2; +} + +message ListconfigsConfigsLogprefix { + string value_str = 1; + string source = 2; +} + +message ListconfigsConfigsLogfile { + repeated string values_str = 1; + repeated string sources = 2; +} + +message ListconfigsConfigsLogtimestamps { + bool value_bool = 1; + string source = 2; +} + +message ListconfigsConfigsForcefeerates { + string value_str = 1; + string source = 2; +} + +message ListconfigsConfigsSubdaemon { + repeated string values_str = 1; + repeated string sources = 2; +} + +message ListconfigsConfigsFetchinvoicenoconnect { + bool set = 1; + string source = 2; +} + +message ListconfigsConfigsAccepthtlctlvtypes { + string value_str = 1; + string source = 2; +} + +message ListconfigsConfigsTorservicepassword { + string value_str = 1; + string source = 2; +} + +message ListconfigsConfigsAnnounceaddrdns { + bool value_bool = 1; + string source = 2; +} + +message ListconfigsConfigsRequireconfirmedinputs { + bool value_bool = 1; + string source = 2; +} + +message ListconfigsConfigsCommitfee { + uint64 value_int = 1; + string source = 2; +} + +message ListconfigsConfigsCommitfeerateoffset { + uint32 value_int = 1; + string source = 2; +} + +message ListconfigsPlugins { + string path = 1; + string name = 2; + optional ListconfigsPluginsOptions options = 3; +} + +message ListconfigsPluginsOptions { +} + +message ListconfigsImportantplugins { + string path = 1; + string name = 2; + optional ListconfigsImportantpluginsOptions options = 3; +} + +message ListconfigsImportantpluginsOptions { +} + message StopRequest { } @@ -2338,17 +3316,37 @@ message StopResponse { optional StopResult result = 1; } +message HelpRequest { + optional string command = 1; +} + +message HelpResponse { + // Help.format-hint + enum HelpFormathint { + SIMPLE = 0; + } + repeated HelpHelp help = 1; + optional HelpFormathint format_hint = 2; +} + +message HelpHelp { + string command = 1; + string category = 2; + string description = 3; + string verbose = 4; +} + message PreapprovekeysendRequest { - optional bytes destination = 1; - optional bytes payment_hash = 2; - optional Amount amount_msat = 3; + bytes destination = 1; + bytes payment_hash = 2; + Amount amount_msat = 3; } message PreapprovekeysendResponse { } message PreapproveinvoiceRequest { - optional string bolt11 = 1; + string bolt11 = 1; } message PreapproveinvoiceResponse { @@ -2521,3 +3519,132 @@ message BkprlistincomeIncome_events { optional bytes txid = 9; optional bytes payment_id = 10; } + +message BlacklistruneRequest { + optional uint64 start = 1; + optional uint64 end = 2; +} + +message BlacklistruneResponse { + repeated BlacklistruneBlacklist blacklist = 1; +} + +message BlacklistruneBlacklist { + uint64 start = 1; + uint64 end = 2; +} + +message CheckruneRequest { + string rune = 1; + optional string nodeid = 2; + optional string method = 3; + repeated string params = 4; +} + +message CheckruneResponse { + bool valid = 1; +} + +message CreateruneRequest { + optional string rune = 1; + repeated string restrictions = 2; +} + +message CreateruneResponse { + string rune = 1; + string unique_id = 2; + optional string warning_unrestricted_rune = 3; +} + +message ShowrunesRequest { + optional string rune = 1; +} + +message ShowrunesResponse { + repeated ShowrunesRunes runes = 1; +} + +message ShowrunesRunes { + string rune = 1; + string unique_id = 2; + repeated ShowrunesRunesRestrictions restrictions = 3; + string restrictions_as_english = 4; + optional bool stored = 5; + optional bool blacklisted = 6; + optional double last_used = 7; + optional bool our_rune = 8; +} + +message ShowrunesRunesRestrictions { + repeated ShowrunesRunesRestrictionsAlternatives alternatives = 1; + string english = 2; +} + +message ShowrunesRunesRestrictionsAlternatives { + string fieldname = 1; + string value = 2; + string condition = 3; + string english = 4; +} + +message StreamBlockAddedRequest { +} + +message BlockAddedNotification { + bytes hash = 1; + uint32 height = 2; +} + +message StreamChannelOpenFailedRequest { +} + +message ChannelOpenFailedNotification { + bytes channel_id = 1; +} + +message StreamChannelOpenedRequest { +} + +message ChannelOpenedNotification { + optional bytes id = 1; + Amount funding_msat = 2; + bytes funding_txid = 3; + bool channel_ready = 4; +} + +message StreamConnectRequest { +} + +message PeerConnectNotification { + // connect.direction + enum PeerConnectDirection { + IN = 0; + OUT = 1; + } + bytes id = 1; + PeerConnectDirection direction = 2; + PeerConnectAddress address = 3; +} + +message PeerConnectAddress { + // connect.address.type + enum PeerConnectAddressType { + LOCAL_SOCKET = 0; + IPV4 = 1; + IPV6 = 2; + TORV2 = 3; + TORV3 = 4; + } + PeerConnectAddressType item_type = 1; + optional string socket = 2; + optional string address = 3; + optional uint32 port = 4; +} + +message StreamCustomMsgRequest { +} + +message CustomMsgNotification { + bytes peer_id = 1; + bytes payload = 2; +} \ No newline at end of file diff --git a/src/infra/lightning/cln/proto/primitives.proto b/src/infra/lightning/cln/proto/primitives.proto index 20d1cb2..2d95c0a 100644 --- a/src/infra/lightning/cln/proto/primitives.proto +++ b/src/infra/lightning/cln/proto/primitives.proto @@ -86,9 +86,9 @@ message OutputDesc { message RouteHop { bytes id = 1; - string short_channel_id = 2; + string scid = 2; Amount feebase = 3; - uint32 feeprop = 4; + uint32 feeprop = 4; uint32 expirydelta = 5; } message Routehint { @@ -98,6 +98,19 @@ message RoutehintList { repeated Routehint hints = 2; } +message DecodeRouteHop { + bytes pubkey = 1; + string short_channel_id = 2; + Amount fee_base_msat = 3; + uint32 fee_proportional_millionths = 4; + uint32 cltv_expiry_delta = 5; +} +message DecodeRoutehint { + repeated DecodeRouteHop hops = 1; +} +message DecodeRoutehintList { + repeated DecodeRoutehint hints = 2; +} message TlvEntry { uint64 type = 1; @@ -124,3 +137,11 @@ enum AutocleanSubsystem { PAIDINVOICES = 4; EXPIREDINVOICES = 5; } + +enum PluginSubcommand { + START = 0; + STOP = 1; + RESCAN = 2; + STARTDIR = 3; + LIST = 4; +} \ No newline at end of file diff --git a/src/infra/lightning/lightning.rs b/src/infra/lightning/ln_client.rs similarity index 100% rename from src/infra/lightning/lightning.rs rename to src/infra/lightning/ln_client.rs diff --git a/src/infra/lightning/mod.rs b/src/infra/lightning/mod.rs index 6b3f47e..ada998a 100644 --- a/src/infra/lightning/mod.rs +++ b/src/infra/lightning/mod.rs @@ -1,6 +1,6 @@ pub mod breez; pub mod cln; -mod lightning; +mod ln_client; mod types; -pub use lightning::*; +pub use ln_client::*; diff --git a/src/infra/lightning/types.rs b/src/infra/lightning/types.rs index c6d4466..8603490 100644 --- a/src/infra/lightning/types.rs +++ b/src/infra/lightning/types.rs @@ -7,50 +7,50 @@ use crate::{ domains::invoices::entities::{Invoice, LnInvoice}, }; -impl Into for Bolt11Invoice { - fn into(self) -> Invoice { - let payee_pubkey: String = match self.payee_pub_key() { +impl From for Invoice { + fn from(val: Bolt11Invoice) -> Self { + let payee_pubkey: String = match val.payee_pub_key() { Some(key) => key.to_hex(), - None => self.recover_payee_pub_key().to_hex(), + None => val.recover_payee_pub_key().to_hex(), }; let timestamp = Utc .timestamp_opt( - self.duration_since_epoch().as_secs() as i64, - self.duration_since_epoch().subsec_nanos(), + val.duration_since_epoch().as_secs() as i64, + val.duration_since_epoch().subsec_nanos(), ) .unwrap(); Invoice { - ledger: Ledger::LIGHTNING, - currency: self.currency().into(), - amount_msat: self.amount_milli_satoshis(), + ledger: Ledger::Lightning, + currency: val.currency().into(), + amount_msat: val.amount_milli_satoshis(), timestamp, - description: match self.description() { + description: match val.description() { Bolt11InvoiceDescription::Direct(msg) => Some(msg.to_string()), Bolt11InvoiceDescription::Hash(_) => None, }, lightning: Some(LnInvoice { - bolt11: self.to_string(), - payment_hash: self.payment_hash().to_hex(), + bolt11: val.to_string(), + payment_hash: val.payment_hash().to_hex(), payee_pubkey, - description_hash: match self.description() { + description_hash: match val.description() { Bolt11InvoiceDescription::Direct(_) => None, Bolt11InvoiceDescription::Hash(h) => Some(h.0.to_string()), }, - payment_secret: self.payment_secret().0.to_hex(), - min_final_cltv_expiry_delta: self.min_final_cltv_expiry_delta(), - expiry: self.expiry_time(), - expires_at: timestamp + self.expiry_time(), + payment_secret: val.payment_secret().0.to_hex(), + min_final_cltv_expiry_delta: val.min_final_cltv_expiry_delta(), + expiry: val.expiry_time(), + expires_at: timestamp + val.expiry_time(), }), ..Default::default() } } } -impl Into for LNInvoiceCurrency { - fn into(self) -> Currency { - match self { +impl From for Currency { + fn from(val: LNInvoiceCurrency) -> Self { + match val { LNInvoiceCurrency::Bitcoin => Currency::Bitcoin, LNInvoiceCurrency::Regtest => Currency::Regtest, LNInvoiceCurrency::Signet => Currency::Signet, diff --git a/src/main.rs b/src/main.rs index 56aab94..7685812 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,8 +13,8 @@ use tokio::signal::unix::SignalKind; use tracing::debug; use tracing::info; -use crate::infra::app::App; use crate::infra::app::AppState; +use crate::infra::app::Server; use crate::infra::config::config_rs::load_config; use crate::infra::logging::tracing::setup_tracing; @@ -44,7 +44,7 @@ async fn main() { } }; - let app = App::new(app_state.clone()); + let app = Server::new(app_state.clone()); if let Err(err) = app .start(&config.web.addr, shutdown_signal(app_state.clone())) .await From 32e337898a3832a80e511646299f3d83dccb14a0 Mon Sep 17 00:00:00 2001 From: Dario Anongba Varela Date: Tue, 2 Jul 2024 15:05:30 +0200 Subject: [PATCH 4/6] swissknife image working --- .dockerignore | 1 - .github/workflows/ci.yml | 29 +++++++++++++++++++++++++++++ Dockerfile | 5 +++++ Makefile | 7 ++++++- config/development.yml | 23 +++++++++++++++++++++++ deps/lightningd/regtest.conf | 22 ---------------------- docker-compose.yml | 31 ++++++++++++++++--------------- 7 files changed, 79 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 config/development.yml delete mode 100644 deps/lightningd/regtest.conf diff --git a/.dockerignore b/.dockerignore index 631575d..674f445 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,7 +9,6 @@ target certs deps storage -target .dockerignore .git .gitignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2c3ac57 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: 1.79 + components: clippy, rustfmt + - run: make lint + - run: make fmt + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - run: cargo test --all-features diff --git a/Dockerfile b/Dockerfile index a28d1da..aab361c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,12 @@ COPY . . RUN cargo chef prepare --recipe-path recipe.json FROM chef AS builder + +# Install required packages +RUN apt-get update && apt-get install -y protobuf-compiler + COPY --from=planner /app/recipe.json recipe.json +COPY ./migration ./migration # Fetch dependencies RUN cargo chef cook --release --recipe-path recipe.json diff --git a/Makefile b/Makefile index 1643c5e..290f5b3 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ COMPOSE := docker compose -f docker-compose.yml DB_SERVICE := postgres PGADMIN_SERVICE := pgadmin LIGHTNINGD_SERVICE := lightningd +SWISSKNIFE_SERVICE := swissknife IMAGE_NAME := swissknife:latest .PHONY: up up-lightningd up-postgres up-pgadmin shutdown down generate-certs build-docker run-docker @@ -10,6 +11,10 @@ up: @$(MAKE) down @$(MAKE) up-postgres +up-swissknife: + @$(COMPOSE) up -d $(SWISSKNIFE_SERVICE) + @until $(COMPOSE) logs $(SWISSKNIFE_SERVICE) | grep 'Listening on'; do sleep 1; done + up-lightningd: @$(COMPOSE) up -d $(LIGHTNINGD_SERVICE) @until $(COMPOSE) logs $(LIGHTNINGD_SERVICE) | grep 'lightningd: Server started'; do sleep 1; done @@ -58,5 +63,5 @@ deps-outdated: lint: @cargo clippy -lint-fix: +fmt: @cargo fmt \ No newline at end of file diff --git a/config/development.yml b/config/development.yml new file mode 100644 index 0000000..d38a485 --- /dev/null +++ b/config/development.yml @@ -0,0 +1,23 @@ +domain: "swissknife" +ln_provider: breez +auth_provider: bypass + +logging: + format: compact + ansi: true + level: trace + filter: swissknife=trace + +oauth2: + domain: "dev-z3xohtidpayxvzid.us.auth0.com" + +web: + addr: 0.0.0.0:3000 + request_timeout: 180s + +cln_rest_config: + endpoint: "http://127.0.0.1:8184" + +cln_config: + endpoint: "https://127.0.0.1:11004" + certs_dir: "/Users/darioanongbavarela/.polar/networks/2/volumes/c-lightning/dave/lightningd/regtest" diff --git a/deps/lightningd/regtest.conf b/deps/lightningd/regtest.conf deleted file mode 100644 index ac80b7b..0000000 --- a/deps/lightningd/regtest.conf +++ /dev/null @@ -1,22 +0,0 @@ -developer -bitcoin-rpcuser=polaruser -bitcoin-rpcpassword=polarpass -bitcoin-rpcconnect=polar-n1-backend1 -bitcoin-rpcport=18443 -bitcoin-retry-timeout=3600 -alias=NumeraireSwissKnife -rgb=55C692 -fee-base=800 -fee-per-satoshi=8 -min-capacity-sat=10000 -ignore-fee-limits=true -max-concurrent-htlcs=30 -funding-confirms=3 -dev-allowdustreserve=true -grpc-port=50051 -experimental-anchors -disable-dns -clnrest-port=3010 -clnrest-host=0.0.0.0 -clnrest-protocol=http -log-level=debug \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 91b4e45..911c38d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: postgres: - image: postgres:15.5 + image: postgres:16.3 environment: POSTGRES_USER: ${POSTGRES_USER:-postgres} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres} @@ -24,7 +24,7 @@ services: - "log_destination=stderr" # Send logs to stderr pgadmin: - image: dpage/pgadmin4:8.5 + image: dpage/pgadmin4:8.9 environment: PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org} PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin} @@ -37,23 +37,24 @@ services: depends_on: - postgres - lightningd: - image: elementsproject/lightningd:v24.05 + swissknife: + image: swissknife:latest environment: - LIGHTNINGD_NETWORK: "regtest" + RUN_MODE: ${RUN_MODE:-production} + SWISSKNIFE_DATABASE__URL: ${SWISSKNIFE_DATABASE__URL:-postgres://postgres:postgres@postgres/numeraire} + SWISSKNIFE_BREEZ_CONFIG__API_KEY: ${SWISSKNIFE_BREEZ_CONFIG__API_KEY:-} + SWISSKNIFE_BREEZ_CONFIG__SEED: ${SWISSKNIFE_BREEZ_CONFIG__SEED:-} + SWISSKNIFE_CLN_REST_CONFIG__RUNE: ${SWISSKNIFE_CLN_REST_CONFIG__RUNE:-} + SWISSKNIFE_JWT__PASSWORD: ${SWISSKNIFE_JWT__PASSWORD:-} + depends_on: + - postgres ports: - - 3010:3010 - - 50051:50051 + - "3000:3000" volumes: - - ./deps/lightningd/data:/root/.lightning/regtest - - ./deps/lightningd/regtest.conf:/root/.lightning/regtest/config - networks: - - polar-network-1_default + - ./config/development.yml:/config/development.yml + - ./certs/greenlight:/certs/greenlight + - ./storage/breez:/storage/breez volumes: db: pgadmin: - -networks: - polar-network-1_default: - external: true From b171250f135607cced3360a8bbd5426b591bbf08 Mon Sep 17 00:00:00 2001 From: Dario Anongba Varela Date: Tue, 2 Jul 2024 15:27:16 +0200 Subject: [PATCH 5/6] github action --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c3ac57..4712d65 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,7 @@ jobs: steps: - uses: actions/checkout@v4 + - run: sudo apt-get update && sudo apt-get install -y protobuf-compiler - uses: dtolnay/rust-toolchain@stable with: toolchain: 1.79 @@ -22,8 +23,10 @@ jobs: - run: make fmt test: + needs: lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - run: sudo apt-get update && sudo apt-get install -y protobuf-compiler - uses: dtolnay/rust-toolchain@stable - run: cargo test --all-features From 3e9888736d034a228e995ceb5c870185bc8e5cba Mon Sep 17 00:00:00 2001 From: Dario Anongba Varela Date: Tue, 2 Jul 2024 15:32:42 +0200 Subject: [PATCH 6/6] experimental protoc --- build.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build.rs b/build.rs index df26b4b..3ab4e12 100644 --- a/build.rs +++ b/build.rs @@ -1,8 +1,11 @@ fn main() -> Result<(), Box> { - tonic_build::configure().build_server(false).compile( - &["src/infra/lightning/cln/proto/node.proto"], - &["src/infra/lightning/cln/proto"], - )?; + tonic_build::configure() + .protoc_arg("--experimental_allow_proto3_optional") + .build_server(false) + .compile( + &["src/infra/lightning/cln/proto/node.proto"], + &["src/infra/lightning/cln/proto"], + )?; println!( "cargo:info=Generated CLN files from proto at {:?}", std::env::var("OUT_DIR").unwrap()