diff --git a/.cargo/config.toml b/.cargo/config.toml
index 4a6a1ab..0f07734 100644
--- a/.cargo/config.toml
+++ b/.cargo/config.toml
@@ -1,2 +1,8 @@
[resolver]
incompatible-rust-versions = "fallback"
+
+[target.aarch64-unknown-linux-gnu]
+linker = "aarch64-linux-gnu-gcc"
+
+[target.armv7-unknown-linux-gnueabihf]
+linker = "arm-linux-gnueabihf-gcc"
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..083ac61
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,37 @@
+# To get started with Dependabot version updates, you'll need to specify which
+# package ecosystems to update and where the package manifests are located.
+# Please see the documentation for all configuration options:
+# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
+
+version: 2
+updates:
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "weekly"
+ - package-ecosystem: "cargo"
+ directory: "/"
+ schedule:
+ interval: "weekly"
+ day: "monday"
+ time: "06:00"
+ timezone: "UTC"
+
+ groups:
+ all-dependencies:
+ patterns:
+ - "*"
+
+ cooldown:
+ default-days: 7
+
+ open-pull-requests-limit: 1
+
+ versioning-strategy: "auto"
+
+ labels:
+ - "dependencies"
+ - "rust"
+
+ allow:
+ - dependency-type: "all"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f9e3ecb..3b0ca26 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -17,6 +17,12 @@ on:
tagged-release:
required: true
type: boolean
+ python-version-1:
+ required: true
+ type: string
+ python-version-2:
+ required: true
+ type: string
jobs:
build:
@@ -24,27 +30,25 @@ jobs:
strategy:
fail-fast: false
matrix:
- bitcoind-version: ["30.0"]
+ bitcoind-version: ["31.0"]
experimental: [1]
deprecated: [0]
- python-version: ["3.9", "3.13"]
+ python-version: [ "${{ inputs.python-version-1 }}", "${{ inputs.python-version-2 }}"]
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
- uses: actions/checkout@v4
+ uses: actions/checkout@v7
- name: Create cache paths
run: |
- sudo mkdir /usr/local/libexec
- sudo mkdir /usr/local/libexec/c-lightning
- sudo mkdir /usr/local/libexec/c-lightning/plugins
+ sudo mkdir -p /usr/local/libexec/c-lightning/plugins
sudo chown -R $USER /usr/local/libexec
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v5
+ uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
@@ -60,7 +64,7 @@ jobs:
- name: Restore CLN cache
id: cache-cln
- uses: actions/cache/restore@v4
+ uses: actions/cache/restore@v6
with:
path: |
/usr/local/bin/lightning*
@@ -69,13 +73,13 @@ jobs:
- name: Restore bitcoind cache
id: cache-bitcoind
- uses: actions/cache/restore@v4
+ uses: actions/cache/restore@v6
with:
path: /usr/local/bin/bitcoin*
key: cache-bitcoind-${{ matrix.bitcoind-version }}-${{ steps.exact_versions.outputs.os_version }}
- name: Install uv
- uses: astral-sh/setup-uv@v6
+ uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
@@ -85,15 +89,15 @@ jobs:
run: |
export BITCOIND_VERSION=${{ matrix.bitcoind-version }}
export TARGET_ARCH="x86_64-linux-gnu"
- wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIND_VERSION}/bitcoin-${BITCOIND_VERSION}-${TARGET_ARCH}.tar.gz
+ wget --tries=5 --waitretry=5 --retry-connrefused --timeout=20 --continue https://bitcoincore.org/bin/bitcoin-core-${BITCOIND_VERSION}/bitcoin-${BITCOIND_VERSION}-${TARGET_ARCH}.tar.gz
tar -xzf bitcoin-${BITCOIND_VERSION}-${TARGET_ARCH}.tar.gz
sudo mv bitcoin-${BITCOIND_VERSION}/bin/* /usr/local/bin
rm -rf bitcoin-${BITCOIND_VERSION}-${TARGET_ARCH}.tar.gz bitcoin-${BITCOIND_VERSION}
- name: Save bitcoind cache
id: save-cache-bitcoind
- if : ${{ always() && steps.cache-bitcoind.outputs.cache-hit != 'true'}}
- uses: actions/cache/save@v4
+ if : ${{ success() && steps.cache-bitcoind.outputs.cache-hit != 'true'}}
+ uses: actions/cache/save@v6
with:
path: /usr/local/bin/bitcoin*
key: ${{ steps.cache-bitcoind.outputs.cache-primary-key }}
@@ -104,14 +108,14 @@ jobs:
url=$(curl -f --retry 3 --retry-delay 3 -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/ElementsProject/lightning/releases/tags/${{ inputs.cln-version }} \
| jq '.assets[] | select(.name | contains("24.04")) | .browser_download_url' \
| tr -d '\"')
- wget $url
+ wget --tries=5 --waitretry=5 --retry-connrefused --timeout=20 --continue $url
sudo tar -xvf ${url##*/} -C /usr/local --strip-components=2
echo "CLN_VERSION=$(lightningd --version)" >> "$GITHUB_OUTPUT"
- name: Save CLN cache
id: save-cache-cln
- if : ${{ always() && steps.cache-cln.outputs.cache-hit != 'true' }}
- uses: actions/cache/save@v4
+ if : ${{ success() && steps.cache-cln.outputs.cache-hit != 'true' }}
+ uses: actions/cache/save@v6
with:
path: |
/usr/local/bin/lightning*
@@ -119,14 +123,22 @@ jobs:
key: ${{ steps.cache-cln.outputs.cache-primary-key }}
- name: Set up Rust
- if: ${{ inputs.tagged-release == false}}
+ if: ${{ inputs.tagged-release == false }}
uses: dtolnay/rust-toolchain@stable
- - name: Set up protoc
- if: ${{ inputs.tagged-release == false}} && ${{ steps.cache-cln.outputs.cache-hit != 'true' }}
- uses: arduino/setup-protoc@v3
- with:
- repo-token: ${{ secrets.GITHUB_TOKEN }}
+ - name: Install cargo-binstall
+ if: ${{ inputs.tagged-release == false }}
+ uses: taiki-e/install-action@cargo-binstall
+
+ - name: Install cargo-msrv
+ if: ${{ inputs.tagged-release == false }}
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
+ run: cargo binstall --no-confirm cargo-msrv
+
+ - name: Verify MSRV
+ if: ${{ inputs.tagged-release == false }}
+ run: cargo msrv verify
- name: Get plugin binary
run: |
@@ -139,7 +151,15 @@ jobs:
uv run python -m grpc_tools.protoc --proto_path="proto" --python_out="tests" --grpc_python_out="tests" proto/*.proto
fi
+ url=$(curl -f --retry 3 --retry-delay 3 -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/BoltzExchange/hold/releases/latest \
+ | jq '.assets[] | select(.name | endswith("linux-amd64.tar.gz")) | .browser_download_url' \
+ | tr -d '\"')
+ wget $url
+ tar -xvf ${url##*/} -C tests
+ mv "tests/build/hold-linux-amd64" "tests/hold"
+
cargo build
+ cargo test
fi
- name: Run tests
@@ -153,5 +173,7 @@ jobs:
export VALGRIND=0
export PYTEST_TIMEOUT=600
+ cd tests
+ tar -xf nostr-rs-relay.tar.gz
uv add --dev pyln-testing==${{ inputs.pyln-version }} pyln-client==${{ inputs.pyln-version }} pyln-proto==${{ inputs.pyln-version }}
- uv run -v pytest -n=10 tests/test_*.py
+ uv run -v pytest -n=10
diff --git a/.github/workflows/latest_v24.11.yml b/.github/workflows/latest_v24.11.yml
deleted file mode 100644
index 7174254..0000000
--- a/.github/workflows/latest_v24.11.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-name: Latest release on CLN v24.11.x
-
-on:
- release:
- types: [published, edited]
- workflow_dispatch:
-
-jobs:
- call-ci:
- uses: ./.github/workflows/ci.yml
- with:
- cln-version: "v24.11.2"
- pyln-version: "24.11.1"
- tagged-release: true
\ No newline at end of file
diff --git a/.github/workflows/latest_v25.02.yml b/.github/workflows/latest_v25.02.yml
deleted file mode 100644
index 6d8590c..0000000
--- a/.github/workflows/latest_v25.02.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-name: Latest release on CLN v25.02.x
-
-on:
- release:
- types: [published, edited]
- workflow_dispatch:
-
-jobs:
- call-ci:
- uses: ./.github/workflows/ci.yml
- with:
- cln-version: "v25.02.1"
- pyln-version: "25.2.1"
- tagged-release: true
\ No newline at end of file
diff --git a/.github/workflows/latest_v25.05.yml b/.github/workflows/latest_v25.05.yml
deleted file mode 100644
index b5502c9..0000000
--- a/.github/workflows/latest_v25.05.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-name: Latest release on CLN v25.05.x
-
-on:
- release:
- types: [published, edited]
- workflow_dispatch:
-
-jobs:
- call-ci:
- uses: ./.github/workflows/ci.yml
- with:
- cln-version: "v25.05"
- pyln-version: "25.5"
- tagged-release: true
\ No newline at end of file
diff --git a/.github/workflows/latest_v25.09.yml b/.github/workflows/latest_v25.09.yml
index 2926b68..d96d48d 100644
--- a/.github/workflows/latest_v25.09.yml
+++ b/.github/workflows/latest_v25.09.yml
@@ -9,6 +9,8 @@ jobs:
call-ci:
uses: ./.github/workflows/ci.yml
with:
- cln-version: "v25.09.2"
- pyln-version: "25.9.2"
+ cln-version: "v25.09.3"
+ pyln-version: "25.9.3"
tagged-release: true
+ python-version-1: "3.10"
+ python-version-2: "3.12"
diff --git a/.github/workflows/latest_v25.12.yml b/.github/workflows/latest_v25.12.yml
new file mode 100644
index 0000000..3a86b18
--- /dev/null
+++ b/.github/workflows/latest_v25.12.yml
@@ -0,0 +1,16 @@
+name: Latest release on CLN v25.12.x
+
+on:
+ release:
+ types: [published, edited]
+ workflow_dispatch:
+
+jobs:
+ call-ci:
+ uses: ./.github/workflows/ci.yml
+ with:
+ cln-version: "v25.12.1"
+ pyln-version: "25.12.1"
+ tagged-release: true
+ python-version-1: "3.10"
+ python-version-2: "3.12"
diff --git a/.github/workflows/latest_v26.04.yml b/.github/workflows/latest_v26.04.yml
new file mode 100644
index 0000000..a0dc3a0
--- /dev/null
+++ b/.github/workflows/latest_v26.04.yml
@@ -0,0 +1,16 @@
+name: Latest release on CLN v26.04.x
+
+on:
+ release:
+ types: [published, edited]
+ workflow_dispatch:
+
+jobs:
+ call-ci:
+ uses: ./.github/workflows/ci.yml
+ with:
+ cln-version: "v26.04"
+ pyln-version: "26.4"
+ tagged-release: true
+ python-version-1: "3.10"
+ python-version-2: "3.12"
diff --git a/.github/workflows/latest_v26.06.yml b/.github/workflows/latest_v26.06.yml
new file mode 100644
index 0000000..27edc2d
--- /dev/null
+++ b/.github/workflows/latest_v26.06.yml
@@ -0,0 +1,16 @@
+name: Latest release on CLN v26.06.x
+
+on:
+ release:
+ types: [published, edited]
+ workflow_dispatch:
+
+jobs:
+ call-ci:
+ uses: ./.github/workflows/ci.yml
+ with:
+ cln-version: "v26.06.6"
+ pyln-version: "26.6.6"
+ tagged-release: true
+ python-version-1: "3.10"
+ python-version-2: "3.14"
diff --git a/.github/workflows/main_v25.02.yml b/.github/workflows/master_v25.09.yml
similarity index 61%
rename from .github/workflows/main_v25.02.yml
rename to .github/workflows/master_v25.09.yml
index 1136903..1a73ecd 100644
--- a/.github/workflows/main_v25.02.yml
+++ b/.github/workflows/master_v25.09.yml
@@ -1,9 +1,9 @@
-name: main on CLN v25.02.x
+name: master on CLN v25.09.x
on:
push:
branches:
- - main
+ - master
paths-ignore:
- 'tools/**'
- 'CHANGELOG.md'
@@ -19,6 +19,8 @@ jobs:
call-ci:
uses: ./.github/workflows/ci.yml
with:
- cln-version: "v25.02.1"
- pyln-version: "25.2.1"
- tagged-release: false
\ No newline at end of file
+ cln-version: "v25.09.3"
+ pyln-version: "25.9.3"
+ tagged-release: false
+ python-version-1: "3.10"
+ python-version-2: "3.12"
diff --git a/.github/workflows/main_v24.11.yml b/.github/workflows/master_v25.12.yml
similarity index 61%
rename from .github/workflows/main_v24.11.yml
rename to .github/workflows/master_v25.12.yml
index 7078bd5..7e0ae62 100644
--- a/.github/workflows/main_v24.11.yml
+++ b/.github/workflows/master_v25.12.yml
@@ -1,9 +1,9 @@
-name: main on CLN v24.11.x
+name: master on CLN v25.12.x
on:
push:
branches:
- - main
+ - master
paths-ignore:
- 'tools/**'
- 'CHANGELOG.md'
@@ -19,6 +19,8 @@ jobs:
call-ci:
uses: ./.github/workflows/ci.yml
with:
- cln-version: "v24.11.2"
- pyln-version: "24.11.1"
- tagged-release: false
\ No newline at end of file
+ cln-version: "v25.12.1"
+ pyln-version: "25.12.1"
+ tagged-release: false
+ python-version-1: "3.10"
+ python-version-2: "3.12"
diff --git a/.github/workflows/main_v25.09.yml b/.github/workflows/master_v26.04.yml
similarity index 67%
rename from .github/workflows/main_v25.09.yml
rename to .github/workflows/master_v26.04.yml
index 7656576..82715be 100644
--- a/.github/workflows/main_v25.09.yml
+++ b/.github/workflows/master_v26.04.yml
@@ -1,9 +1,9 @@
-name: main on CLN v25.09.x
+name: master on CLN v26.04.x
on:
push:
branches:
- - main
+ - master
paths-ignore:
- 'tools/**'
- 'CHANGELOG.md'
@@ -19,6 +19,8 @@ jobs:
call-ci:
uses: ./.github/workflows/ci.yml
with:
- cln-version: "v25.09.2"
- pyln-version: "25.9.2"
+ cln-version: "v26.04"
+ pyln-version: "26.4"
tagged-release: false
+ python-version-1: "3.10"
+ python-version-2: "3.12"
diff --git a/.github/workflows/main_v25.05.yml b/.github/workflows/master_v26.06.yml
similarity index 61%
rename from .github/workflows/main_v25.05.yml
rename to .github/workflows/master_v26.06.yml
index e99fd3f..25fe3a8 100644
--- a/.github/workflows/main_v25.05.yml
+++ b/.github/workflows/master_v26.06.yml
@@ -1,9 +1,9 @@
-name: main on CLN v25.05.x
+name: master on CLN v26.06.x
on:
push:
branches:
- - main
+ - master
paths-ignore:
- 'tools/**'
- 'CHANGELOG.md'
@@ -19,6 +19,8 @@ jobs:
call-ci:
uses: ./.github/workflows/ci.yml
with:
- cln-version: "v25.05"
- pyln-version: "25.5"
- tagged-release: false
\ No newline at end of file
+ cln-version: "v26.06.6"
+ pyln-version: "26.6.6"
+ tagged-release: false
+ python-version-1: "3.10"
+ python-version-2: "3.14"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index daf7b14..39f2ae2 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -5,76 +5,128 @@ on:
- 'v*'
jobs:
- build:
- name: build release binaries on ${{ matrix.os }}
- strategy:
- fail-fast: false
- matrix:
- os: ["ubuntu-latest"]
- runs-on: ${{ matrix.os }}
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- - name: Install rust
- id: rust
- uses: dtolnay/rust-toolchain@stable
- - name: Install cross
- if: contains(matrix.os, 'ubuntu')
- run: |
- cargo install cross --git https://github.com/cross-rs/cross
- - name: Build unix
- id: unix_build
- if: contains(matrix.os, 'ubuntu')
- run: |
- cross build --profile optimized --locked --target x86_64-unknown-linux-gnu
- cross build --profile optimized --locked --target armv7-unknown-linux-gnueabihf
- cross build --profile optimized --locked --target aarch64-unknown-linux-gnu
- tar -czf "${{ github.event.repository.name }}-${{github.ref_name}}-aarch64-linux-gnu.tar.gz" --transform 's|.*/||' "target/aarch64-unknown-linux-gnu/optimized/${{ github.event.repository.name }}"
- tar -czf "${{ github.event.repository.name }}-${{github.ref_name}}-armv7-linux-gnueabihf.tar.gz" --transform 's|.*/||' "target/armv7-unknown-linux-gnueabihf/optimized/${{ github.event.repository.name }}"
- tar -czf "${{ github.event.repository.name }}-${{github.ref_name}}-x86_64-linux-gnu.tar.gz" --transform 's|.*/||' "target/x86_64-unknown-linux-gnu/optimized/${{ github.event.repository.name }}"
- ls -alh
- - name: Build macos
- id: macos_build
- if: contains(matrix.os, 'macos')
- run: |
- rustup target add aarch64-apple-darwin
- export CROSSBUILD_MACOS_SDK="macosx13.1"
- export SDKROOT=$(xcrun -sdk $CROSSBUILD_MACOS_SDK --show-sdk-path)
- export MACOSX_DEPLOYMENT_TARGET=12.0
- cargo build --profile optimized --locked --target=x86_64-apple-darwin
- cargo build --profile optimized --locked --target=aarch64-apple-darwin
- lipo -create -output target/${{ github.event.repository.name }} target/aarch64-apple-darwin/optimized/${{ github.event.repository.name }} target/x86_64-apple-darwin/optimized/${{ github.event.repository.name }}
- ditto -c -k --sequesterRsrc target/${{ github.event.repository.name }} ${{ github.event.repository.name }}-${{github.ref_name}}-universal-apple-darwin.zip
- otool -l target/aarch64-apple-darwin/optimized/${{ github.event.repository.name }} | grep -A 5 LC_BUILD_VERSION
- otool -l target/x86_64-apple-darwin/optimized/${{ github.event.repository.name }} | grep -A 5 LC_BUILD_VERSION
- echo "macos_version=$MACOSX_DEPLOYMENT_TARGET" >> "$GITHUB_OUTPUT"
- echo $(xcodebuild -showsdks)
- ls -alh
- - name: Upload unix artifacts
- uses: actions/upload-artifact@v4
- if: contains(matrix.os, 'ubuntu')
- with:
- name: unix-binaries
- path: |
- ${{ github.event.repository.name }}-${{github.ref_name}}-*.tar.gz
- - name: Upload macos artifacts
- uses: actions/upload-artifact@v4
- if: contains(matrix.os, 'macos')
- with:
- name: macos-binaries
- path: |
- ${{ github.event.repository.name }}-${{github.ref_name}}-universal-apple-darwin.zip
- - name: Get rust version
- id: rversion
- run: |
- echo "rust_version=$(rustc --version | awk '{print $2}')" >> "$GITHUB_OUTPUT"
- outputs:
- rust-version: ${{ steps.rversion.outputs.rust_version }}
- macos-version: ${{ steps.macos_build.outputs.macos_version }}
+ build-linux:
+ name: Build Linux binaries (glibc)
+ runs-on: ubuntu-22.04
+ outputs:
+ glibc-version: ${{ steps.versions.outputs.glibc-version }}
+ rust-version: ${{ steps.versions.outputs.rust-version }}
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v7
+
+ - name: Install Rust
+ uses: dtolnay/rust-toolchain@stable
+ with:
+ targets: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf
+
+ - name: Install cross-compilation dependencies
+ run: |
+ sudo apt update
+ sudo apt install -y gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf
+
+ - name: Build Linux binaries (release)
+ run: |
+ cargo build --profile optimized --locked --target x86_64-unknown-linux-gnu
+ cargo build --profile optimized --locked --target aarch64-unknown-linux-gnu
+ cargo build --profile optimized --locked --target armv7-unknown-linux-gnueabihf
+
+ tar -czf "${{ github.event.repository.name }}-${{github.ref_name}}-aarch64-linux-gnu.tar.gz" --transform 's|.*/||' "target/aarch64-unknown-linux-gnu/optimized/${{ github.event.repository.name }}"
+ tar -czf "${{ github.event.repository.name }}-${{github.ref_name}}-armv7-linux-gnueabihf.tar.gz" --transform 's|.*/||' "target/armv7-unknown-linux-gnueabihf/optimized/${{ github.event.repository.name }}"
+ tar -czf "${{ github.event.repository.name }}-${{github.ref_name}}-x86_64-linux-gnu.tar.gz" --transform 's|.*/||' "target/x86_64-unknown-linux-gnu/optimized/${{ github.event.repository.name }}"
+
+ ls -alh *.tar.gz
+
+ - name: Get versions
+ id: versions
+ run: |
+ echo "rust-version=$(rustc --version | awk '{print $2}')" >> "$GITHUB_OUTPUT"
+ GLIBC_VER=$(ldd --version | awk '/ldd/{print $NF}')
+ echo "glibc-version=$GLIBC_VER" >> "$GITHUB_OUTPUT"
+
+ - name: Upload Linux artifacts
+ uses: actions/upload-artifact@v7
+ with:
+ name: linux-binaries
+ path: |
+ ${{ github.event.repository.name }}-${{ github.ref_name }}-*.tar.gz
+ build-macos:
+ name: Build macOS universal binary
+ runs-on: macos-latest
+ outputs:
+ macos-deployment-target: ${{ steps.build.outputs.macos-deployment-target }}
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v7
+
+ - name: Install Rust
+ uses: dtolnay/rust-toolchain@stable
+ with:
+ targets: x86_64-apple-darwin, aarch64-apple-darwin
+
+ - name: Build macOS universal (release)
+ id: build
+ env:
+ MACOSX_DEPLOYMENT_TARGET: "11.0"
+ run: |
+ cargo build --profile optimized --locked --target x86_64-apple-darwin
+ cargo build --profile optimized --locked --target aarch64-apple-darwin
+
+ BINARY_NAME="${{ github.event.repository.name }}"
+ TAG="${{ github.ref_name }}"
+
+ lipo -create -output "${BINARY_NAME}" \
+ target/x86_64-apple-darwin/optimized/"${BINARY_NAME}" \
+ target/aarch64-apple-darwin/optimized/"${BINARY_NAME}"
+
+ zip "${BINARY_NAME}-${TAG}-universal-apple-darwin.zip" "${BINARY_NAME}"
+
+ echo "macos-deployment-target=$MACOSX_DEPLOYMENT_TARGET" >> "$GITHUB_OUTPUT"
+
+ ls -alh *.zip
+
+ - name: Verify macOS deployment target
+ env:
+ EXPECTED_TARGET: ${{ steps.build.outputs.macos-deployment-target }}
+ run: |
+ BINARY="${{ github.event.repository.name }}"
+
+ echo "Verifying deployment target for universal binary: $BINARY"
+ echo "Expected minimum macOS version: $EXPECTED_TARGET"
+ echo
+
+ # Check x86_64 slice
+ X86_MINOS=$(otool -l -arch x86_64 "$BINARY" | awk '
+ /LC_BUILD_VERSION/ || /LC_VERSION_MIN_MACOSX/ {getline; getline; getline; if ($1 == "minos") print $2}
+ ')
+ echo "x86_64 slice minos: $X86_MINOS"
+
+ # Check arm64 slice
+ ARM64_MINOS=$(otool -l -arch arm64 "$BINARY" | awk '
+ /LC_BUILD_VERSION/ || /LC_VERSION_MIN_MACOSX/ {getline; getline; getline; if ($1 == "minos") print $2}
+ ')
+ echo "arm64 slice minos: $ARM64_MINOS"
+
+ # Fail if either doesn't match
+ if [ "$X86_MINOS" != "$EXPECTED_TARGET" ] || [ "$ARM64_MINOS" != "$EXPECTED_TARGET" ]; then
+ echo "ERROR: Deployment target mismatch!"
+ echo "Expected: $EXPECTED_TARGET"
+ echo "Got: x86_64=$X86_MINOS, arm64=$ARM64_MINOS"
+ exit 1
+ fi
+
+ echo "Success: Both architectures have deployment target $EXPECTED_TARGET"
+
+ - name: Upload macOS artifacts
+ uses: actions/upload-artifact@v7
+ with:
+ name: macos-binaries
+ path: |
+ ${{ github.event.repository.name }}-${{ github.ref_name }}-universal-apple-darwin.zip
release:
name: Github Release
- needs: [build]
+ needs: [build-linux, build-macos]
runs-on: "ubuntu-latest"
permissions:
contents: write
@@ -83,7 +135,7 @@ jobs:
id: tag_name
run: echo "current_version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
- name: Checkout code
- uses: actions/checkout@v4
+ uses: actions/checkout@v7
- name: Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
@@ -92,7 +144,7 @@ jobs:
version: ${{ steps.tag_name.outputs.current_version }}
path: ./CHANGELOG.md
- name: Download Artifacts
- uses: actions/download-artifact@v4
+ uses: actions/download-artifact@v8
with:
merge-multiple: true
- name: Release
@@ -100,5 +152,6 @@ jobs:
with:
allowUpdates: false
artifactErrorsFailBuild: true
- body: "${{ steps.changelog_reader.outputs.changes }} \n\n### Release binaries info\n\n- Release binaries were built using rust ${{ needs.build.outputs.rust-version }}\n- Linux release binaries require glibc>=2.31"
- artifacts: "${{ github.event.repository.name }}-${{github.ref_name}}-*.tar.gz"
+ body: "${{ steps.changelog_reader.outputs.changes }} \n\n### Release binaries info\n\n- Release binaries were built using rust ${{ needs.build-linux.outputs.rust-version }}\n- Linux release binaries require glibc>=${{ needs.build-linux.outputs.glibc-version }} (check yours with ``ldd --version``)\n- macOS universal binary (x86_64 + aarch64), requires macOS >= ${{ needs.build-macos.outputs.macos-deployment-target }} (deployment target)"
+ artifacts: "${{ github.event.repository.name }}-${{github.ref_name}}-*.tar.gz,${{ github.event.repository.name }}-${{github.ref_name}}-*.zip"
+ immutableCreate: true
diff --git a/.gitignore b/.gitignore
index c702af1..9f63775 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
/result/
/tests/holdinvoice
/tests/hold
+/tests/nostr-rs-relay
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 11253d2..e77df0d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,40 @@
# Changelog
+## [0.2.0] 2026-08-09
+
+### Added
+- holdinvoice methods: ``make_hold_invoice``, ``cancel_hold_invoice``, ``settle_hold_invoice``
+- holdinvoice notification: ``hold_invoice_accepted``
+
+### Changed
+- there are now five default relays that will be used if ``nip47-relays`` is not set
+- `pay_keysend` will use the new CLN `xkeysend` command using CLN v26.06+
+- Budget is updated on demand instead of by a background task
+- `list_transactions` is bounded (at most 500 transactions and ~128kB response) to prevent DoS
+- Upgrade ``nostr_sdk`` and CLN dependencies
+
+### Removed
+- ``multi_pay_invoice`` and ``multi_pay_keysend``, they were removed from the spec
+
+### Fixed
+- ``nip47-create`` no longer fails if the NWC fails to start, the error is only logged, since the NWC at that point is already persisted to the DB
+- Paying amount-less invoices with a request amount
+- Legacy keysend TLV byte decoding
+- Report the correct error when the payment route is too expensive
+- Notifications are sent per client, so one failing client no longer prevents the others from receiving them
+- Available payment methods are now determined from the node's RPC instead of it's (custom) version string
+- Deduplication of request events instead of filtering unreliably
+
+## [0.1.9] 2026-04-23
+
+### Fixed
+- ``nip47-budget``: race condition where new budget settings would sometimes be ignored
+
+## [0.1.8] 2026-04-03
+
+### Changed
+- updated cln dependencies
+
## [0.1.7] 2025-11-27
### Fixed
diff --git a/Cargo.lock b/Cargo.lock
index 716c4c2..a6393f7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -25,30 +25,41 @@ dependencies = [
[[package]]
name = "aho-corasick"
-version = "1.1.4"
+version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
+checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"
dependencies = [
"memchr",
]
[[package]]
name = "anyhow"
-version = "1.0.100"
+version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
+checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"
[[package]]
name = "arrayvec"
-version = "0.7.6"
+version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
+checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"
+
+[[package]]
+name = "async-trait"
+version = "0.1.92"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.3",
+]
[[package]]
name = "async-utility"
-version = "0.3.1"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a34a3b57207a7a1007832416c3e4862378c8451b4e8e093e436f48c2d3d2c151"
+checksum = "188f83b9a198af8c336e505611edb00d6d2ac5c694241c5a4f9a12316938cfe9"
dependencies = [
"futures-util",
"gloo-timers",
@@ -58,28 +69,38 @@ dependencies = [
[[package]]
name = "async-wsocket"
-version = "0.13.1"
+version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a7d8c7d34a225ba919dd9ba44d4b9106d20142da545e086be8ae21d1897e043"
+checksum = "2c713e1f14c7b82e32ea159af1c6e2f070cfadbdf23fb2512acce9af0a26f1a2"
dependencies = [
- "async-utility",
"futures",
"futures-util",
"js-sys",
"tokio",
+ "tokio-happy-eyeballs",
"tokio-rustls",
"tokio-socks",
"tokio-tungstenite",
"url",
"wasm-bindgen",
+ "wasm-bindgen-futures",
"web-sys",
]
[[package]]
-name = "atomic-destructor"
-version = "0.3.0"
+name = "atomic-waker"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef49f5882e4b6afaac09ad239a4f8c70a24b8f2b0897edb1f706008efd109cf4"
+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
+
+[[package]]
+name = "base58ck"
+version = "0.1.101"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "365c0acd5b2e8dd0111a46c4faea83fb3cfb6e39a49a7c73a06e090db7b2eff0"
+dependencies = [
+ "bitcoin_hashes 0.14.101",
+]
[[package]]
name = "base64"
@@ -88,80 +109,86 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
-name = "base64ct"
-version = "1.8.0"
+name = "bech32"
+version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba"
+checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f"
[[package]]
name = "bech32"
-version = "0.10.0-beta"
+version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "98f7eed2b2781a6f0b5c903471d48e15f56fb4e1165df8a9a2337fd1a59d45ea"
-
-[[package]]
-name = "bech32"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d"
+checksum = "efbd3e1070bbdf4cd88a75264e18e8a26f7cb5c6949eadf0ceb85fb159cf08f8"
[[package]]
name = "bip39"
-version = "2.2.0"
+version = "2.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43d193de1f7487df1914d3a568b772458861d33f9c54249612cc2893d6915054"
+checksum = "90dbd31c98227229239363921e60fcf5e558e43ec69094d46fc4996f08d1d5bc"
dependencies = [
- "bitcoin_hashes 0.13.0",
+ "bitcoin_hashes 0.14.101",
"serde",
"unicode-normalization",
]
[[package]]
name = "bitcoin"
-version = "0.31.2"
+version = "0.32.102"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c85783c2fe40083ea54a33aa2f0ba58831d90fcd190f5bdc47e74e84d2a96ae"
+checksum = "bb0ce8bd5baaa0d303a19915a6d93afed161f528654e42da2a7a97d05c59499a"
dependencies = [
- "bech32 0.10.0-beta",
- "bitcoin-internals",
- "bitcoin_hashes 0.13.0",
- "hex-conservative 0.1.2",
+ "base58ck",
+ "bech32 0.11.1",
+ "bitcoin-io",
+ "bitcoin-units",
+ "bitcoin_hashes 0.14.101",
+ "hex-conservative 0.2.2",
"hex_lit",
- "secp256k1 0.28.2",
+ "secp256k1 0.29.1",
+ "serde",
+]
+
+[[package]]
+name = "bitcoin-consensus-encoding"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "207311705279250ba465076a1bac4b1ac982855fff73fc5f67e22158ac58cdc9"
+dependencies = [
+ "bitcoin-internals",
+ "hex-conservative 1.2.0",
"serde",
]
[[package]]
name = "bitcoin-internals"
-version = "0.2.0"
+version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb"
-dependencies = [
- "serde",
-]
+checksum = "d573f4cf32996a8dce612e4348cece65a241f1882ed594047c9ba348e8869fa5"
[[package]]
name = "bitcoin-io"
-version = "0.1.3"
+version = "0.1.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b47c4ab7a93edb0c7198c5535ed9b52b63095f4e9b45279c6736cec4b856baf"
+checksum = "bb5de036369d1ac59d3c1819ebc4d850f89466f5401c571a285b6ed564a4cb78"
+dependencies = [
+ "bitcoin-consensus-encoding",
+]
[[package]]
-name = "bitcoin_hashes"
-version = "0.13.0"
+name = "bitcoin-units"
+version = "0.1.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b"
+checksum = "9cb95693f371d089a4b5b6fc41c6f3ea6e01ee8c15388335dfac8ea685173b51"
dependencies = [
- "bitcoin-internals",
- "hex-conservative 0.1.2",
+ "bitcoin-consensus-encoding",
"serde",
]
[[package]]
name = "bitcoin_hashes"
-version = "0.14.0"
+version = "0.14.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16"
+checksum = "bca4c7abb40c8817d77403c880988cfd484f23ab2365726afb2f798363e2c4a2"
dependencies = [
"bitcoin-io",
"hex-conservative 0.2.2",
@@ -169,10 +196,22 @@ dependencies = [
]
[[package]]
-name = "bitflags"
-version = "2.10.0"
+name = "bitcoin_hashes"
+version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
+checksum = "5304e53726dbe5f93141535e102ed97b5bf4714fbecefdda8f9fb98d7fdaff0e"
+dependencies = [
+ "bitcoin-consensus-encoding",
+ "bitcoin-internals",
+ "hex-conservative 1.2.0",
+ "serde",
+]
+
+[[package]]
+name = "bitflags"
+version = "2.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
[[package]]
name = "block-buffer"
@@ -194,15 +233,21 @@ dependencies = [
[[package]]
name = "bumpalo"
-version = "3.19.0"
+version = "3.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
+checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
+
+[[package]]
+name = "byteorder"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
-version = "1.11.0"
+version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
+checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
[[package]]
name = "cbc"
@@ -215,9 +260,9 @@ dependencies = [
[[package]]
name = "cc"
-version = "1.2.47"
+version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cd405d82c84ff7f35739f175f67d8b9fb7687a0e84ccdc78bd3568839827cf07"
+checksum = "5d262e149917187838d5b42777c8253bcb64500067342904e7d429499a6f277e"
dependencies = [
"find-msvc-tools",
"shlex",
@@ -266,28 +311,35 @@ dependencies = [
[[package]]
name = "cln-nip47"
-version = "0.1.7"
+version = "0.2.0"
dependencies = [
"anyhow",
"cln-plugin",
"cln-rpc",
+ "futures",
"hex",
"log",
"log-panics",
+ "nostr",
"nostr-sdk",
"parking_lot",
+ "prost",
+ "protoc-bin-vendored",
"regex",
"serde",
"serde_json",
"tokio",
+ "tonic",
+ "tonic-prost",
+ "tonic-prost-build",
"uuid",
]
[[package]]
name = "cln-plugin"
-version = "0.5.0"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45a8becaecbc48715a1aa316910c02f890650fbe71aad14abff660f22fca1f7e"
+checksum = "b9a4bb9c7335040d49c51900305b91155303539e9f54839bb194e915277bf882"
dependencies = [
"anyhow",
"bytes",
@@ -304,9 +356,9 @@ dependencies = [
[[package]]
name = "cln-rpc"
-version = "0.5.0"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5411a3be72288226b28c694e633eb73edaacdc443a435c31daa72bc1919884b2"
+checksum = "5d9f5e26f0a2713ea1393eb3117c148295fa4c5f7db529713b20323ca7cc37aa"
dependencies = [
"anyhow",
"bitcoin",
@@ -336,15 +388,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
dependencies = [
"generic-array",
- "rand_core 0.6.4",
"typenum",
]
[[package]]
name = "data-encoding"
-version = "2.9.0"
+version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476"
+checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06"
[[package]]
name = "digest"
@@ -354,31 +405,80 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer",
"crypto-common",
- "subtle",
]
[[package]]
name = "displaydoc"
-version = "0.2.5"
+version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
+checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 3.0.3",
]
[[package]]
name = "either"
-version = "1.15.0"
+version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
+checksum = "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d"
+
+[[package]]
+name = "equivalent"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
+
+[[package]]
+name = "errno"
+version = "0.3.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
+dependencies = [
+ "libc",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "faster-hex"
+version = "0.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7223ae2d2f179b803433d9c830478527e92b8117eab39460edae7f1614d9fb73"
+dependencies = [
+ "heapless",
+ "serde",
+]
+
+[[package]]
+name = "fastrand"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
[[package]]
name = "find-msvc-tools"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "26b73573e6edcd2af0cdf47bd6cb58f0b3839491263c314eaad1ccf24430e1de"
+
+[[package]]
+name = "fixedbitset"
+version = "0.5.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99"
+
+[[package]]
+name = "fnv"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+
+[[package]]
+name = "foldhash"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844"
+checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
[[package]]
name = "form_urlencoded"
@@ -391,9 +491,9 @@ dependencies = [
[[package]]
name = "futures"
-version = "0.3.31"
+version = "0.3.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
+checksum = "a88cf1f829d945f548cf8fec32c61b1f202b6d93b45848602fc02af4b12ad218"
dependencies = [
"futures-channel",
"futures-core",
@@ -406,9 +506,9 @@ dependencies = [
[[package]]
name = "futures-channel"
-version = "0.3.31"
+version = "0.3.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
+checksum = "262590f4fe6afeb0bc83be1daa64e52657fe185690a958af7f3ad0e92085c5ae"
dependencies = [
"futures-core",
"futures-sink",
@@ -416,15 +516,15 @@ dependencies = [
[[package]]
name = "futures-core"
-version = "0.3.31"
+version = "0.3.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
+checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7"
[[package]]
name = "futures-executor"
-version = "0.3.31"
+version = "0.3.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f"
+checksum = "6754879cc9f2c66f88c6e5c35344bb0bdb0708b0352b1201815667c7eabc7458"
dependencies = [
"futures-core",
"futures-task",
@@ -433,38 +533,38 @@ dependencies = [
[[package]]
name = "futures-io"
-version = "0.3.31"
+version = "0.3.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
+checksum = "4577ecaa3c4f96589d473f679a71b596316f6641bc350038b962a5daf0085d7a"
[[package]]
name = "futures-macro"
-version = "0.3.31"
+version = "0.3.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
+checksum = "2d6d3cde68c518367be28956066ddfef33813991b77a55005a69dae04bf3b10b"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.119",
]
[[package]]
name = "futures-sink"
-version = "0.3.31"
+version = "0.3.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
+checksum = "e34418ac499d6305c2fb5ad0ed2f6ac998c5f8ca209b4510f7f94242c647e307"
[[package]]
name = "futures-task"
-version = "0.3.31"
+version = "0.3.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
+checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109"
[[package]]
name = "futures-util"
-version = "0.3.31"
+version = "0.3.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
+checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa"
dependencies = [
"futures-channel",
"futures-core",
@@ -474,7 +574,6 @@ dependencies = [
"futures-task",
"memchr",
"pin-project-lite",
- "pin-utils",
"slab",
]
@@ -490,15 +589,13 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.2.16"
+version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
dependencies = [
"cfg-if",
- "js-sys",
"libc",
"wasi",
- "wasm-bindgen",
]
[[package]]
@@ -509,10 +606,22 @@ checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
dependencies = [
"cfg-if",
"libc",
- "r-efi",
+ "r-efi 5.3.0",
"wasip2",
]
+[[package]]
+name = "getrandom"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "r-efi 6.0.0",
+ "rand_core 0.10.1",
+]
+
[[package]]
name = "gloo-timers"
version = "0.3.0"
@@ -525,18 +634,71 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "h2"
+version = "0.4.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6cb093c84e8bd9b188d4c4a8cb6579fc016968d14c99882163cd3ff402a4f155"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "fnv",
+ "futures-core",
+ "futures-sink",
+ "http",
+ "indexmap",
+ "slab",
+ "tokio",
+ "tokio-util",
+ "tracing",
+]
+
+[[package]]
+name = "hash32"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
+dependencies = [
+ "byteorder",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.15.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
+dependencies = [
+ "foldhash",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.17.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
+
+[[package]]
+name = "heapless"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
+dependencies = [
+ "hash32",
+ "stable_deref_trait",
+]
+
+[[package]]
+name = "heck"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
+
[[package]]
name = "hex"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
-[[package]]
-name = "hex-conservative"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20"
-
[[package]]
name = "hex-conservative"
version = "0.2.2"
@@ -546,37 +708,121 @@ dependencies = [
"arrayvec",
]
+[[package]]
+name = "hex-conservative"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "35431185f361ccf3ffc58254628af5f1f5d5f28531da2e02e5d6c82bbc282a10"
+dependencies = [
+ "arrayvec",
+]
+
[[package]]
name = "hex_lit"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd"
-[[package]]
-name = "hmac"
-version = "0.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
-dependencies = [
- "digest",
-]
-
[[package]]
name = "http"
-version = "1.4.0"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
+checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
dependencies = [
"bytes",
"itoa",
]
+[[package]]
+name = "http-body"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c"
+dependencies = [
+ "bytes",
+ "http",
+]
+
+[[package]]
+name = "http-body-util"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e9f41fd6a08e4d4ec69df65976da761afd5ad5e58a9d4acb46bd1c953a9e3ff2"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "http",
+ "http-body",
+ "pin-project-lite",
+]
+
[[package]]
name = "httparse"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
+[[package]]
+name = "httpdate"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
+
+[[package]]
+name = "hyper"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d22053281f852e11534f5198498373cbb59295120a20771d90f7ed1897490a72"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "futures-channel",
+ "futures-core",
+ "h2",
+ "http",
+ "http-body",
+ "httparse",
+ "httpdate",
+ "itoa",
+ "pin-project-lite",
+ "smallvec",
+ "tokio",
+ "want",
+]
+
+[[package]]
+name = "hyper-timeout"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0"
+dependencies = [
+ "hyper",
+ "hyper-util",
+ "pin-project-lite",
+ "tokio",
+ "tower-service",
+]
+
+[[package]]
+name = "hyper-util"
+version = "0.1.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
+dependencies = [
+ "bytes",
+ "futures-channel",
+ "futures-util",
+ "http",
+ "http-body",
+ "hyper",
+ "libc",
+ "pin-project-lite",
+ "socket2",
+ "tokio",
+ "tower-service",
+ "tracing",
+]
+
[[package]]
name = "icu_collections"
version = "2.1.1"
@@ -625,9 +871,9 @@ checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a"
[[package]]
name = "icu_properties"
-version = "2.1.1"
+version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99"
+checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec"
dependencies = [
"icu_collections",
"icu_locale_core",
@@ -639,9 +885,9 @@ dependencies = [
[[package]]
name = "icu_properties_data"
-version = "2.1.1"
+version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899"
+checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af"
[[package]]
name = "icu_provider"
@@ -679,6 +925,16 @@ dependencies = [
"icu_properties",
]
+[[package]]
+name = "indexmap"
+version = "2.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
+dependencies = [
+ "equivalent",
+ "hashbrown 0.17.1",
+]
+
[[package]]
name = "inout"
version = "0.1.4"
@@ -690,30 +946,28 @@ dependencies = [
]
[[package]]
-name = "instant"
-version = "0.1.13"
+name = "itertools"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222"
+checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
dependencies = [
- "cfg-if",
- "js-sys",
- "wasm-bindgen",
- "web-sys",
+ "either",
]
[[package]]
name = "itoa"
-version = "1.0.15"
+version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
[[package]]
name = "js-sys"
-version = "0.3.82"
+version = "0.3.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65"
+checksum = "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a"
dependencies = [
- "once_cell",
+ "cfg-if",
+ "futures-util",
"wasm-bindgen",
]
@@ -725,15 +979,21 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
-version = "0.2.177"
+version = "0.2.189"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
+checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
+
+[[package]]
+name = "linux-raw-sys"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
[[package]]
name = "litemap"
-version = "0.8.1"
+version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77"
+checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0"
[[package]]
name = "lock_api"
@@ -746,9 +1006,9 @@ dependencies = [
[[package]]
name = "log"
-version = "0.4.28"
+version = "0.4.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
+checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
[[package]]
name = "log-panics"
@@ -761,9 +1021,9 @@ dependencies = [
[[package]]
name = "lru"
-version = "0.16.2"
+version = "0.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96051b46fc183dc9cd4a223960ef37b9af631b55191852a8274bfef064cda20f"
+checksum = "5d2f2f9b4ba7e6b24d95e7e899329d35be83bcded72c8540cdd5368932d1d90a"
[[package]]
name = "matchers"
@@ -776,21 +1036,27 @@ dependencies = [
[[package]]
name = "memchr"
-version = "2.7.6"
+version = "2.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
+checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
[[package]]
name = "mio"
-version = "1.1.0"
+version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873"
+checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427"
dependencies = [
"libc",
"wasi",
"windows-sys 0.61.2",
]
+[[package]]
+name = "multimap"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084"
+
[[package]]
name = "negentropy"
version = "0.5.0"
@@ -799,80 +1065,71 @@ checksum = "f0efe882e02d206d8d279c20eb40e03baf7cb5136a1476dc084a324fbc3ec42d"
[[package]]
name = "nostr"
-version = "0.44.1"
+version = "0.45.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3595fecf0e0aaacb69a0dc0101a4453f3c76eda333d6bbc49f68f64390b3d85"
+checksum = "5dde8c76076d334409d86c2e1db3e97abe5deb8cb92744f939cbc1fa45bd69e7"
dependencies = [
"aes",
"base64",
- "bech32 0.11.0",
+ "bech32 0.12.0",
"bip39",
- "bitcoin_hashes 0.14.0",
+ "bitcoin_hashes 1.2.0",
"cbc",
"chacha20",
"chacha20poly1305",
- "getrandom 0.2.16",
- "hex",
- "instant",
- "scrypt",
- "secp256k1 0.29.1",
+ "faster-hex",
+ "opaquerr",
+ "rand 0.10.2",
+ "secp256k1 0.30.0",
"serde",
"serde_json",
"unicode-normalization",
+ "universal-time",
"url",
+ "zeroize",
]
[[package]]
name = "nostr-database"
-version = "0.44.0"
+version = "0.45.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7462c9d8ae5ef6a28d66a192d399ad2530f1f2130b13186296dbb11bdef5b3d1"
+checksum = "4b1fdb9fcba732e32719662afad1b267e50322dbe89e506017ec13f24361bddf"
dependencies = [
- "lru",
"nostr",
- "tokio",
+ "opaquerr",
]
[[package]]
name = "nostr-gossip"
-version = "0.44.0"
+version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ade30de16869618919c6b5efc8258f47b654a98b51541eb77f85e8ec5e3c83a6"
+checksum = "fa07539e52a71cb91fe0d693facaa298f03fcf9edcd66a521094e18e286e2336"
dependencies = [
"nostr",
-]
-
-[[package]]
-name = "nostr-relay-pool"
-version = "0.44.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4b1073ccfbaea5549fb914a9d52c68dab2aecda61535e5143dd73e95445a804b"
-dependencies = [
- "async-utility",
- "async-wsocket",
- "atomic-destructor",
- "hex",
- "lru",
- "negentropy",
- "nostr",
- "nostr-database",
- "tokio",
- "tracing",
+ "opaquerr",
]
[[package]]
name = "nostr-sdk"
-version = "0.44.1"
+version = "0.45.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "471732576710e779b64f04c55e3f8b5292f865fea228436daf19694f0bf70393"
+checksum = "26c86342f367bd9b173ec4a697e936e3a82d6dad5b4aa06c0d35d9b4f88a8e72"
dependencies = [
"async-utility",
+ "async-wsocket",
+ "faster-hex",
+ "futures",
+ "lru",
+ "negentropy",
"nostr",
"nostr-database",
"nostr-gossip",
- "nostr-relay-pool",
+ "opaquerr",
+ "rand 0.10.2",
"tokio",
+ "tokio-stream",
"tracing",
+ "universal-time",
]
[[package]]
@@ -886,9 +1143,9 @@ dependencies = [
[[package]]
name = "once_cell"
-version = "1.21.3"
+version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "opaque-debug"
@@ -896,6 +1153,12 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
+[[package]]
+name = "opaquerr"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4f933a4265d5cdad61d19bbdfc972ea5726d56cd8d3d57b8f2d3c365dd42bee9"
+
[[package]]
name = "parking_lot"
version = "0.12.5"
@@ -919,27 +1182,6 @@ dependencies = [
"windows-link",
]
-[[package]]
-name = "password-hash"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166"
-dependencies = [
- "base64ct",
- "rand_core 0.6.4",
- "subtle",
-]
-
-[[package]]
-name = "pbkdf2"
-version = "0.12.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
-dependencies = [
- "digest",
- "hmac",
-]
-
[[package]]
name = "percent-encoding"
version = "2.3.2"
@@ -947,16 +1189,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]]
-name = "pin-project-lite"
-version = "0.2.16"
+name = "petgraph"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
+checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455"
+dependencies = [
+ "fixedbitset",
+ "hashbrown 0.15.5",
+ "indexmap",
+]
[[package]]
-name = "pin-utils"
-version = "0.1.0"
+name = "pin-project"
+version = "1.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924"
+dependencies = [
+ "pin-project-internal",
+]
+
+[[package]]
+name = "pin-project-internal"
+version = "1.1.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
[[package]]
name = "poly1305"
@@ -971,9 +1238,9 @@ dependencies = [
[[package]]
name = "potential_utf"
-version = "0.1.4"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77"
+checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564"
dependencies = [
"zerovec",
]
@@ -988,19 +1255,166 @@ dependencies = [
]
[[package]]
-name = "proc-macro2"
-version = "1.0.103"
+name = "prettyplease"
+version = "0.2.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
+checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
+dependencies = [
+ "proc-macro2",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.107"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
dependencies = [
"unicode-ident",
]
[[package]]
-name = "quote"
-version = "1.0.42"
+name = "prost"
+version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
+checksum = "528ac67416ff8646872a3c02cad9cc4ee5dc9f9540c9b10771855c95cb2e5ae1"
+dependencies = [
+ "bytes",
+ "prost-derive",
+]
+
+[[package]]
+name = "prost-build"
+version = "0.14.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "03da047801ff44bb6a4d407d4860c05fd70bb81714e6b2f3812603d5b145b042"
+dependencies = [
+ "heck",
+ "itertools",
+ "log",
+ "multimap",
+ "petgraph",
+ "prettyplease",
+ "prost",
+ "prost-types",
+ "pulldown-cmark",
+ "pulldown-cmark-to-cmark",
+ "regex",
+ "syn 2.0.119",
+ "tempfile",
+]
+
+[[package]]
+name = "prost-derive"
+version = "0.14.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b570b25f7617e43d59005d0990ccb79e950a423952cea19671b7a876da390adf"
+dependencies = [
+ "anyhow",
+ "itertools",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "prost-types"
+version = "0.14.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f94967dc7688f3054c7fac87473ffae4cc4c3904800e2d9f5b857246d8963b0a"
+dependencies = [
+ "prost",
+]
+
+[[package]]
+name = "protoc-bin-vendored"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d1c381df33c98266b5f08186583660090a4ffa0889e76c7e9a5e175f645a67fa"
+dependencies = [
+ "protoc-bin-vendored-linux-aarch_64",
+ "protoc-bin-vendored-linux-ppcle_64",
+ "protoc-bin-vendored-linux-s390_64",
+ "protoc-bin-vendored-linux-x86_32",
+ "protoc-bin-vendored-linux-x86_64",
+ "protoc-bin-vendored-macos-aarch_64",
+ "protoc-bin-vendored-macos-x86_64",
+ "protoc-bin-vendored-win32",
+]
+
+[[package]]
+name = "protoc-bin-vendored-linux-aarch_64"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c350df4d49b5b9e3ca79f7e646fde2377b199e13cfa87320308397e1f37e1a4c"
+
+[[package]]
+name = "protoc-bin-vendored-linux-ppcle_64"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a55a63e6c7244f19b5c6393f025017eb5d793fd5467823a099740a7a4222440c"
+
+[[package]]
+name = "protoc-bin-vendored-linux-s390_64"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1dba5565db4288e935d5330a07c264a4ee8e4a5b4a4e6f4e83fad824cc32f3b0"
+
+[[package]]
+name = "protoc-bin-vendored-linux-x86_32"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8854774b24ee28b7868cd71dccaae8e02a2365e67a4a87a6cd11ee6cdbdf9cf5"
+
+[[package]]
+name = "protoc-bin-vendored-linux-x86_64"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b38b07546580df720fa464ce124c4b03630a6fb83e05c336fea2a241df7e5d78"
+
+[[package]]
+name = "protoc-bin-vendored-macos-aarch_64"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "89278a9926ce312e51f1d999fee8825d324d603213344a9a706daa009f1d8092"
+
+[[package]]
+name = "protoc-bin-vendored-macos-x86_64"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "81745feda7ccfb9471d7a4de888f0652e806d5795b61480605d4943176299756"
+
+[[package]]
+name = "protoc-bin-vendored-win32"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "95067976aca6421a523e491fce939a3e65249bac4b977adee0ee9771568e8aa3"
+
+[[package]]
+name = "pulldown-cmark"
+version = "0.13.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e9f068eba8e7071c5f9511831b44f32c740d5adf574e990f946ddb53db2f314e"
+dependencies = [
+ "bitflags",
+ "memchr",
+ "unicase",
+]
+
+[[package]]
+name = "pulldown-cmark-to-cmark"
+version = "22.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "50793def1b900256624a709439404384204a5dc3a6ec580281bfaac35e882e90"
+dependencies = [
+ "pulldown-cmark",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.47"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
dependencies = [
"proc-macro2",
]
@@ -1012,10 +1426,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
[[package]]
-name = "rand"
-version = "0.8.5"
+name = "r-efi"
+version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
+
+[[package]]
+name = "rand"
+version = "0.8.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "22f6172bdec972074665ed81ed53b71da00bfc44b65a753cfde883ec4c702a1a"
dependencies = [
"libc",
"rand_chacha 0.3.1",
@@ -1024,12 +1444,22 @@ dependencies = [
[[package]]
name = "rand"
-version = "0.9.2"
+version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
+checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41"
dependencies = [
"rand_chacha 0.9.0",
- "rand_core 0.9.3",
+ "rand_core 0.9.5",
+]
+
+[[package]]
+name = "rand"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80"
+dependencies = [
+ "getrandom 0.4.3",
+ "rand_core 0.10.1",
]
[[package]]
@@ -1049,7 +1479,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
dependencies = [
"ppv-lite86",
- "rand_core 0.9.3",
+ "rand_core 0.9.5",
]
[[package]]
@@ -1058,18 +1488,24 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
- "getrandom 0.2.16",
+ "getrandom 0.2.17",
]
[[package]]
name = "rand_core"
-version = "0.9.3"
+version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
+checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
dependencies = [
"getrandom 0.3.4",
]
+[[package]]
+name = "rand_core"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
+
[[package]]
name = "redox_syscall"
version = "0.5.18"
@@ -1081,9 +1517,9 @@ dependencies = [
[[package]]
name = "regex"
-version = "1.12.2"
+version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
+checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"
dependencies = [
"aho-corasick",
"memchr",
@@ -1093,9 +1529,9 @@ dependencies = [
[[package]]
name = "regex-automata"
-version = "0.4.13"
+version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
+checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
dependencies = [
"aho-corasick",
"memchr",
@@ -1104,9 +1540,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
-version = "0.8.8"
+version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
+checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
[[package]]
name = "ring"
@@ -1116,18 +1552,32 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
dependencies = [
"cc",
"cfg-if",
- "getrandom 0.2.16",
+ "getrandom 0.2.17",
"libc",
"untrusted",
"windows-sys 0.52.0",
]
[[package]]
-name = "rustls"
-version = "0.23.35"
+name = "rustix"
+version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f"
+checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
dependencies = [
+ "bitflags",
+ "errno",
+ "libc",
+ "linux-raw-sys",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "rustls"
+version = "0.23.43"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06"
+dependencies = [
+ "log",
"once_cell",
"ring",
"rustls-pki-types",
@@ -1138,18 +1588,18 @@ dependencies = [
[[package]]
name = "rustls-pki-types"
-version = "1.13.0"
+version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a"
+checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96"
dependencies = [
"zeroize",
]
[[package]]
name = "rustls-webpki"
-version = "0.103.8"
+version = "0.103.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52"
+checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e"
dependencies = [
"ring",
"rustls-pki-types",
@@ -1158,24 +1608,9 @@ dependencies = [
[[package]]
name = "rustversion"
-version = "1.0.22"
+version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
-
-[[package]]
-name = "ryu"
-version = "1.0.20"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
-
-[[package]]
-name = "salsa20"
-version = "0.10.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213"
-dependencies = [
- "cipher",
-]
+checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
[[package]]
name = "scopeguard"
@@ -1183,47 +1618,26 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
-[[package]]
-name = "scrypt"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f"
-dependencies = [
- "password-hash",
- "pbkdf2",
- "salsa20",
- "sha2",
-]
-
-[[package]]
-name = "secp256k1"
-version = "0.28.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10"
-dependencies = [
- "bitcoin_hashes 0.13.0",
- "secp256k1-sys 0.9.2",
- "serde",
-]
-
[[package]]
name = "secp256k1"
version = "0.29.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113"
dependencies = [
- "rand 0.8.5",
- "secp256k1-sys 0.10.1",
+ "bitcoin_hashes 0.14.101",
+ "secp256k1-sys",
"serde",
]
[[package]]
-name = "secp256k1-sys"
-version = "0.9.2"
+name = "secp256k1"
+version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb"
+checksum = "b50c5943d326858130af85e049f2661ba3c78b26589b8ab98e65e80ae44a1252"
dependencies = [
- "cc",
+ "bitcoin_hashes 0.14.101",
+ "rand 0.8.7",
+ "secp256k1-sys",
]
[[package]]
@@ -1237,9 +1651,9 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.228"
+version = "1.0.229"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
+checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
dependencies = [
"serde_core",
"serde_derive",
@@ -1247,53 +1661,42 @@ dependencies = [
[[package]]
name = "serde_core"
-version = "1.0.228"
+version = "1.0.229"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
+checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.228"
+version = "1.0.229"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
+checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 3.0.3",
]
[[package]]
name = "serde_json"
-version = "1.0.145"
+version = "1.0.151"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"
+checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
dependencies = [
"itoa",
"memchr",
- "ryu",
"serde",
"serde_core",
+ "zmij",
]
[[package]]
name = "sha1"
-version = "0.10.6"
+version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
-dependencies = [
- "cfg-if",
- "cpufeatures",
- "digest",
-]
-
-[[package]]
-name = "sha2"
-version = "0.10.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
+checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8"
dependencies = [
"cfg-if",
"cpufeatures",
@@ -1311,30 +1714,30 @@ dependencies = [
[[package]]
name = "shlex"
-version = "1.3.0"
+version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
[[package]]
name = "slab"
-version = "0.4.11"
+version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589"
+checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]]
name = "smallvec"
-version = "1.15.1"
+version = "1.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
+checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
[[package]]
name = "socket2"
-version = "0.6.1"
+version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881"
+checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
dependencies = [
"libc",
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -1351,15 +1754,32 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "syn"
-version = "2.0.111"
+version = "2.0.119"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87"
+checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
+[[package]]
+name = "syn"
+version = "3.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "sync_wrapper"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
+
[[package]]
name = "synstructure"
version = "0.13.2"
@@ -1368,7 +1788,20 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "tempfile"
+version = "3.27.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
+dependencies = [
+ "fastrand",
+ "getrandom 0.4.3",
+ "once_cell",
+ "rustix",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -1382,11 +1815,11 @@ dependencies = [
[[package]]
name = "thiserror"
-version = "2.0.17"
+version = "2.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
+checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"
dependencies = [
- "thiserror-impl 2.0.17",
+ "thiserror-impl 2.0.20",
]
[[package]]
@@ -1397,34 +1830,34 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.119",
]
[[package]]
name = "thiserror-impl"
-version = "2.0.17"
+version = "2.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
+checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 3.0.3",
]
[[package]]
name = "thread_local"
-version = "1.1.9"
+version = "1.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"
+checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070"
dependencies = [
"cfg-if",
]
[[package]]
name = "tinystr"
-version = "0.8.2"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869"
+checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d"
dependencies = [
"displaydoc",
"zerovec",
@@ -1432,9 +1865,9 @@ dependencies = [
[[package]]
name = "tinyvec"
-version = "1.10.0"
+version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa"
+checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f"
dependencies = [
"tinyvec_macros",
]
@@ -1447,9 +1880,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
-version = "1.48.0"
+version = "1.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408"
+checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed"
dependencies = [
"bytes",
"libc",
@@ -1461,14 +1894,23 @@ dependencies = [
]
[[package]]
-name = "tokio-macros"
-version = "2.6.0"
+name = "tokio-happy-eyeballs"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5"
+checksum = "8564c32dfb6f4257f8bc6edfc178a34af97520e0b7b9815500c55eb3d092f29f"
+dependencies = [
+ "tokio",
+]
+
+[[package]]
+name = "tokio-macros"
+version = "2.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 3.0.3",
]
[[package]]
@@ -1483,9 +1925,9 @@ dependencies = [
[[package]]
name = "tokio-socks"
-version = "0.5.2"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d4770b8024672c1101b3f6733eab95b18007dbe0847a8afe341fcf79e06043f"
+checksum = "a7e2948f60dbe26b35f2c7fb74ac2854c1fddded0fe9d7548fcc674a246f7615"
dependencies = [
"either",
"futures-util",
@@ -1495,20 +1937,21 @@ dependencies = [
[[package]]
name = "tokio-stream"
-version = "0.1.17"
+version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047"
+checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b"
dependencies = [
"futures-core",
"pin-project-lite",
"tokio",
+ "tokio-util",
]
[[package]]
name = "tokio-tungstenite"
-version = "0.26.2"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084"
+checksum = "d25a406cddcc431a75d3d9afc6a7c0f7428d4891dd973e4d54c56b46127bf857"
dependencies = [
"futures-util",
"log",
@@ -1522,22 +1965,122 @@ dependencies = [
[[package]]
name = "tokio-util"
-version = "0.7.17"
+version = "0.7.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594"
+checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
+ "libc",
"pin-project-lite",
"tokio",
]
[[package]]
-name = "tracing"
-version = "0.1.41"
+name = "tonic"
+version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
+checksum = "fec7c61a0695dc1887c1b53952990f3ad2e3a31453e1f49f10e75424943a93ec"
+dependencies = [
+ "async-trait",
+ "base64",
+ "bytes",
+ "h2",
+ "http",
+ "http-body",
+ "http-body-util",
+ "hyper",
+ "hyper-timeout",
+ "hyper-util",
+ "percent-encoding",
+ "pin-project",
+ "socket2",
+ "sync_wrapper",
+ "tokio",
+ "tokio-rustls",
+ "tokio-stream",
+ "tower",
+ "tower-layer",
+ "tower-service",
+ "tracing",
+]
+
+[[package]]
+name = "tonic-build"
+version = "0.14.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1882ac3bf5ef12877d7ed57aad87e75154c11931c2ba7e6cde5e22d63522c734"
+dependencies = [
+ "prettyplease",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "tonic-prost"
+version = "0.14.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a55376a0bbaa4975a3f10d009ad763d8f4108f067c7c2e74f3001fb49778d309"
+dependencies = [
+ "bytes",
+ "prost",
+ "tonic",
+]
+
+[[package]]
+name = "tonic-prost-build"
+version = "0.14.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f3144df636917574672e93d0f56d7edec49f90305749c668df5101751bb8f95a"
+dependencies = [
+ "prettyplease",
+ "proc-macro2",
+ "prost-build",
+ "prost-types",
+ "quote",
+ "syn 2.0.119",
+ "tempfile",
+ "tonic-build",
+]
+
+[[package]]
+name = "tower"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"
+dependencies = [
+ "futures-core",
+ "futures-util",
+ "indexmap",
+ "pin-project-lite",
+ "slab",
+ "sync_wrapper",
+ "tokio",
+ "tokio-util",
+ "tower-layer",
+ "tower-service",
+ "tracing",
+]
+
+[[package]]
+name = "tower-layer"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
+
+[[package]]
+name = "tower-service"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
+
+[[package]]
+name = "tracing"
+version = "0.1.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
dependencies = [
"log",
"pin-project-lite",
@@ -1553,14 +2096,14 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.119",
]
[[package]]
name = "tracing-core"
-version = "0.1.35"
+version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c"
+checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
dependencies = [
"once_cell",
"valuable",
@@ -1579,9 +2122,9 @@ dependencies = [
[[package]]
name = "tracing-subscriber"
-version = "0.3.20"
+version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
+checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319"
dependencies = [
"matchers",
"nu-ansi-term",
@@ -1596,35 +2139,47 @@ dependencies = [
]
[[package]]
-name = "tungstenite"
-version = "0.26.2"
+name = "try-lock"
+version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4793cb5e56680ecbb1d843515b23b6de9a75eb04b66643e256a396d43be33c13"
+checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
+
+[[package]]
+name = "tungstenite"
+version = "0.28.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8628dcc84e5a09eb3d8423d6cb682965dea9133204e8fb3efee74c2a0c259442"
dependencies = [
"bytes",
"data-encoding",
"http",
"httparse",
"log",
- "rand 0.9.2",
+ "rand 0.9.5",
"rustls",
"rustls-pki-types",
"sha1",
- "thiserror 2.0.17",
+ "thiserror 2.0.20",
"utf-8",
]
[[package]]
name = "typenum"
-version = "1.19.0"
+version = "1.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
+checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
+
+[[package]]
+name = "unicase"
+version = "2.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"
[[package]]
name = "unicode-ident"
-version = "1.0.22"
+version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
+checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
[[package]]
name = "unicode-normalization"
@@ -1645,6 +2200,12 @@ dependencies = [
"subtle",
]
+[[package]]
+name = "universal-time"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47a939edecc3c5a7b83c02e5f6b3c31d2bc69eabcc9a87ab12c6d37ee6dbc856"
+
[[package]]
name = "untrusted"
version = "0.9.0"
@@ -1653,14 +2214,15 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "url"
-version = "2.5.7"
+version = "2.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b"
+checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
"serde",
+ "serde_derive",
]
[[package]]
@@ -1677,11 +2239,11 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]]
name = "uuid"
-version = "1.18.1"
+version = "1.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2"
+checksum = "bf3923a6f5c4c6382e0b653c4117f48d631ea17f38ed86e2a828e6f7412f5239"
dependencies = [
- "getrandom 0.3.4",
+ "getrandom 0.4.3",
"js-sys",
"wasm-bindgen",
]
@@ -1698,6 +2260,15 @@ version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
+[[package]]
+name = "want"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
+dependencies = [
+ "try-lock",
+]
+
[[package]]
name = "wasi"
version = "0.11.1+wasi-snapshot-preview1"
@@ -1715,9 +2286,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen"
-version = "0.2.105"
+version = "0.2.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60"
+checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70"
dependencies = [
"cfg-if",
"once_cell",
@@ -1728,22 +2299,19 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.55"
+version = "0.4.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "551f88106c6d5e7ccc7cd9a16f312dd3b5d36ea8b4954304657d5dfba115d4a0"
+checksum = "6b7777d5cc23d0e91404e53ce2d5e8ec7acae3026b16233dba62cd3246457950"
dependencies = [
- "cfg-if",
"js-sys",
- "once_cell",
"wasm-bindgen",
- "web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.105"
+version = "0.2.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2"
+checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -1751,31 +2319,31 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.105"
+version = "0.2.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc"
+checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284"
dependencies = [
"bumpalo",
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.119",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.105"
+version = "0.2.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76"
+checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf"
dependencies = [
"unicode-ident",
]
[[package]]
name = "web-sys"
-version = "0.3.82"
+version = "0.3.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1"
+checksum = "c435338968042f4f59a557f690a253676d47ce13ceb55d70100e7facf6620a30"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -1787,14 +2355,14 @@ version = "0.26.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
dependencies = [
- "webpki-roots 1.0.4",
+ "webpki-roots 1.0.9",
]
[[package]]
name = "webpki-roots"
-version = "1.0.4"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e"
+checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a"
dependencies = [
"rustls-pki-types",
]
@@ -1811,16 +2379,7 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
- "windows-targets 0.52.6",
-]
-
-[[package]]
-name = "windows-sys"
-version = "0.60.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
-dependencies = [
- "windows-targets 0.53.5",
+ "windows-targets",
]
[[package]]
@@ -1838,31 +2397,14 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
- "windows_aarch64_gnullvm 0.52.6",
- "windows_aarch64_msvc 0.52.6",
- "windows_i686_gnu 0.52.6",
- "windows_i686_gnullvm 0.52.6",
- "windows_i686_msvc 0.52.6",
- "windows_x86_64_gnu 0.52.6",
- "windows_x86_64_gnullvm 0.52.6",
- "windows_x86_64_msvc 0.52.6",
-]
-
-[[package]]
-name = "windows-targets"
-version = "0.53.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"
-dependencies = [
- "windows-link",
- "windows_aarch64_gnullvm 0.53.1",
- "windows_aarch64_msvc 0.53.1",
- "windows_i686_gnu 0.53.1",
- "windows_i686_gnullvm 0.53.1",
- "windows_i686_msvc 0.53.1",
- "windows_x86_64_gnu 0.53.1",
- "windows_x86_64_gnullvm 0.53.1",
- "windows_x86_64_msvc 0.53.1",
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
]
[[package]]
@@ -1871,96 +2413,48 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
-[[package]]
-name = "windows_aarch64_gnullvm"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"
-
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
-[[package]]
-name = "windows_aarch64_msvc"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"
-
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
-[[package]]
-name = "windows_i686_gnu"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"
-
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
-[[package]]
-name = "windows_i686_gnullvm"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"
-
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
-[[package]]
-name = "windows_i686_msvc"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"
-
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
-[[package]]
-name = "windows_x86_64_gnu"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"
-
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
-[[package]]
-name = "windows_x86_64_gnullvm"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"
-
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
-[[package]]
-name = "windows_x86_64_msvc"
-version = "0.53.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
-
[[package]]
name = "wit-bindgen"
version = "0.46.0"
@@ -1969,15 +2463,15 @@ checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
[[package]]
name = "writeable"
-version = "0.6.2"
+version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
+checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
[[package]]
name = "yoke"
-version = "0.8.1"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954"
+checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
dependencies = [
"stable_deref_trait",
"yoke-derive",
@@ -1986,68 +2480,68 @@ dependencies = [
[[package]]
name = "yoke-derive"
-version = "0.8.1"
+version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"
+checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.119",
"synstructure",
]
[[package]]
name = "zerocopy"
-version = "0.8.30"
+version = "0.8.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ea879c944afe8a2b25fef16bb4ba234f47c694565e97383b36f3a878219065c"
+checksum = "556764e583adb45a9f8d413c2a147fa7e8d821e48e12b14fd560b607998b75eb"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
-version = "0.8.30"
+version = "0.8.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf955aa904d6040f70dc8e9384444cb1030aed272ba3cb09bbc4ab9e7c1f34f5"
+checksum = "f2ab42fc20575779bd240faa45f94a74256f755c0fa9e89f0ede20d91d0cdfc1"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.119",
]
[[package]]
name = "zerofrom"
-version = "0.1.6"
+version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
+checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
dependencies = [
"zerofrom-derive",
]
[[package]]
name = "zerofrom-derive"
-version = "0.1.6"
+version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
+checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.119",
"synstructure",
]
[[package]]
name = "zeroize"
-version = "1.8.2"
+version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"
+checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e"
[[package]]
name = "zerotrie"
-version = "0.2.3"
+version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851"
+checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf"
dependencies = [
"displaydoc",
"yoke",
@@ -2056,9 +2550,9 @@ dependencies = [
[[package]]
name = "zerovec"
-version = "0.11.5"
+version = "0.11.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002"
+checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239"
dependencies = [
"yoke",
"zerofrom",
@@ -2067,11 +2561,17 @@ dependencies = [
[[package]]
name = "zerovec-derive"
-version = "0.11.2"
+version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"
+checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.119",
]
+
+[[package]]
+name = "zmij"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
diff --git a/Cargo.toml b/Cargo.toml
index 4edc00f..a21e37a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,8 +1,8 @@
[package]
name = "cln-nip47"
-version = "0.1.7"
-edition = "2021"
-rust-version = "1.85"
+version = "0.2.0"
+edition = "2024"
+rust-version = "1.85.0"
[dependencies]
anyhow = "1"
@@ -12,14 +12,22 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["fs", "sync", "rt-multi-thread"] }
-cln-rpc = "0.5"
-# cln-rpc = { path = "../lightning/cln-rpc/", version = "^0.4" }
-cln-plugin = "0.5"
-# cln-plugin = { path = "../lightning/plugins/", version = "^0.4" }
+cln-rpc = "0.7"
+# cln-rpc = { path = "../lightning/cln-rpc/", version = "^0.6" }
+cln-plugin = "0.7"
+# cln-plugin = { path = "../lightning/plugins/", version = "^0.6" }
parking_lot = "0.12"
-# nostr-sdk = { git = "https://github.com/rust-nostr/nostr.git", rev = "f7122f5", features = ["nip47", "nip04", "nip44"]}
-nostr-sdk = { version = "0.44", features = ["nip47", "nip04", "nip44"] }
+# # nostr-sdk = { git = "https://github.com/rust-nostr/nostr.git", rev = "ff5be7d1416ea201887a02f648795010a3cbdf49" }
+# nostr = { git = "https://github.com/rust-nostr/nostr.git", rev = "ff5be7d1416ea201887a02f648795010a3cbdf49", features = [
+# "nip47",
+# "nip04",
+# "nip44",
+# ] }
+nostr = { version = "0.45.1", features = ["nip47", "nip04", "nip44"] }
+nostr-sdk = { version = "0.45.1" }
+
+futures = "0.3"
uuid = { version = "1", features = ["v4"] }
@@ -27,6 +35,18 @@ hex = "0.4"
regex = "1"
+tonic = { version = "0.14", default-features = false, features = [
+ "codegen",
+ "transport",
+ "tls-ring",
+] }
+prost = "0.14"
+tonic-prost = "0.14"
+
+[build-dependencies]
+tonic-prost-build = "0.14"
+protoc-bin-vendored = "3"
+
[profile.optimized]
inherits = "release"
diff --git a/README.md b/README.md
index 42fd960..5556fd0 100644
--- a/README.md
+++ b/README.md
@@ -1,49 +1,49 @@
-
-
-
-
-
- |
-
-
-
-
- |
-
-
-
-
-
-
- |
-
-
-
-
- |
-
-
-
-
-
-
- |
-
-
-
-
- |
-
-
+
|
-
-
+
+
+
+ |
+
+
+
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+
+
+
|
@@ -51,7 +51,7 @@
# cln-nip47
-A core lightning plugin to connect wallets via Nostr Wallet Connect (NWC) as specified in [NIP-47](https://github.com/nostr-protocol/nips/blob/master/47.md).
+A core lightning plugin to connect wallets via Nostr Wallet Connect (NWC) as specified in [NIP-47](https://github.com/nostr-protocol/nips/blob/master/47.md). It is intended to be used by a single user, since all notifications got to all NWC's.
* [Installation](#installation)
* [Building](#building)
@@ -64,11 +64,10 @@ Release binaries for
* x86_64-linux
* armv7-linux (Raspberry Pi 32bit)
* aarch64-linux (Raspberry Pi 64bit)
+* universal-apple-darwin (macOS)
can be found on the [release](https://github.com/daywalker90/cln-nip47/releases) page. If you are unsure about your architecture you can run ``uname -m``.
-They require ``glibc>=2.31``, which you can check with ``ldd --version``.
-
# Building
You can build the plugin yourself instead of using the release binaries.
First clone the repo:
@@ -85,7 +84,7 @@ cargo build --release
After that the binary will be here: ``target/release/cln-nip47``
-Note: Release binaries are built using ``cross`` and the ``optimized`` profile.
+Note: Release binaries are built with the ``optimized`` profile.
# Documentation
@@ -98,7 +97,12 @@ It is highly recommended to use your own private relay since public relays may l
For a private relay you can for example use [nostr-rs-relay](https://github.com/scsibug/nostr-rs-relay) with ``pubkey_whitelist`` set to both ``clientkey_public`` and ``walletkey_public`` (returned from ``nip47-create``/``nip47-list``).
## Options
-* ``nip47-relays``: Specify the relays that you want to use with your NWC. Can be set multiple times to use multiple relays. NWC's you create will save these and even if you add or remove relays keep the relays from the moment you created that NWC. You must set this atleast one time.
+* ``nip47-relays``: Specify the relays that you want to use with your NWC. Can be set multiple times to use multiple relays. NWC's you create will save these and even if you add or remove relays keep the relays from the moment you created that NWC. If you don't set this yourself these default relays will be used:
+ * ``wss://nos.lol``
+ * ``wss://relay.primal.net``
+ * ``wss://relay.getalby.com/v1``
+ * ``wss://relay.nostr.net``
+ * ``wss://relay.snort.social``
* ``nip47-notifications``: Enable/disable nip47 notifications. Default is enabled (``true``)
## Methods
@@ -127,20 +131,25 @@ For a private relay you can for example use [nostr-rs-relay](https://github.com/
* list all NWC configurations or just the one with ``label``
* ***label***: optional. The label the NWC was created with
+## Holdinvoice support
+For methods or notifications related to holdinvoices you need v0.3.2+ of [hold](https://github.com/BoltzExchange/hold) with enabled grpc (which is the default just make sure the port is free)
+
## Supported NWC methods
* ``pay_invoice``
-* ``multi_pay_invoice``
* ``pay_keysend`` (no ``preimage`` in request allowed since CLN only supports generating it itself)
-* ``multi_pay_keysend`` (no ``preimage`` in request allowed since CLN only supports generating it itself)
* ``make_invoice``
* ``lookup_invoice``
* ``list_transactions``
* ``get_balance``
* ``get_info`` (no ``block_hash``)
+* ``make_hold_invoice`` (requires [Holdinvoice support](#holdinvoice_support))
+* ``cancel_hold_invoice`` (requires [Holdinvoice support](#holdinvoice_support))
+* ``settle_hold_invoice`` (requires [Holdinvoice support](#holdinvoice_support))
## Supported NWC notifications
* ``payment_received``
* ``payment_sent``
+* ``hold_invoice_accepted`` (requires [Holdinvoice support](#holdinvoice_support))
## Supported content encryption:
* [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md)
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 0000000..9b5fbd8
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,27 @@
+# Security Policy
+
+## Supported Versions
+
+Only the latest version is supported.
+
+## Reporting a Vulnerability
+
+To report security vulnerabilities, please send an email to:
+- `daywalker990@gmx.de`
+
+Note: This email address is exclusively for vulnerability reporting.
+
+For all other inquiries/communication, please use the Github issues.
+
+## Signatures For Releases
+
+The following keys may be used to communicate sensitive information to
+developers:
+
+| Name | Email | Fingerprint |
+|------|-------|-------------|
+| daywalker90 | `daywalker990@gmx.de` | 8A07 9421 A871 D0B1 0835 1193 7AB4 802E D5A6 39F3 |
+
+You can import a key by running the following command with that individual’s fingerprint:
+`gpg --keyserver hkps://keys.openpgp.org --recv-keys ""`.
+Ensure that you put quotes around fingerprints containing spaces.
diff --git a/build.rs b/build.rs
new file mode 100644
index 0000000..04c8cef
--- /dev/null
+++ b/build.rs
@@ -0,0 +1,8 @@
+fn main() {
+ let protoc = protoc_bin_vendored::protoc_bin_path().unwrap();
+ unsafe { std::env::set_var("PROTOC", protoc) };
+ tonic_prost_build::configure()
+ .protoc_arg("--experimental_allow_proto3_optional")
+ .compile_protos(&["protos/hold.proto"], &["protos"])
+ .unwrap_or_else(|e| panic!("Could not build protos: {e}"));
+}
diff --git a/coffee.yml b/coffee.yml
index 43a88d2..fa75d76 100644
--- a/coffee.yml
+++ b/coffee.yml
@@ -1,6 +1,6 @@
plugin:
name: cln-nip47
- version: 0.1.7
+ version: 0.2.0
lang: rust
install: |
cargo build --release && cp target/release/cln-nip47 . && cargo clean
diff --git a/protos/hold.proto b/protos/hold.proto
new file mode 100644
index 0000000..e7ad240
--- /dev/null
+++ b/protos/hold.proto
@@ -0,0 +1,185 @@
+syntax = "proto3";
+
+package hold;
+
+service Hold {
+ rpc GetInfo (GetInfoRequest) returns (GetInfoResponse);
+
+ rpc Invoice (InvoiceRequest) returns (InvoiceResponse) {}
+ rpc Inject (InjectRequest) returns (InjectResponse) {}
+
+ rpc List (ListRequest) returns (ListResponse) {}
+
+ rpc Settle (SettleRequest) returns (SettleResponse) {}
+ rpc Cancel (CancelRequest) returns (CancelResponse) {}
+
+ // Cleans cancelled invoices
+ rpc Clean (CleanRequest) returns (CleanResponse) {}
+
+ rpc Track (TrackRequest) returns (stream TrackResponse) {}
+ rpc TrackAll (TrackAllRequest) returns (stream TrackAllResponse) {}
+
+ rpc OnionMessages (stream OnionMessageResponse) returns (stream OnionMessage) {}
+}
+
+enum HookAction {
+ Continue = 0;
+ Resolve = 1;
+}
+
+message GetInfoRequest {}
+message GetInfoResponse {
+ string version = 1;
+}
+
+message Hop {
+ bytes public_key = 1;
+ uint64 short_channel_id = 2;
+ uint64 base_fee = 3;
+ uint64 ppm_fee = 4;
+ uint64 cltv_expiry_delta = 5;
+}
+
+message RoutingHint {
+ repeated Hop hops = 1;
+}
+
+message InvoiceRequest {
+ bytes payment_hash = 1;
+ uint64 amount_msat = 2;
+
+ oneof description {
+ string memo = 3;
+ bytes hash = 4;
+ }
+
+ optional uint64 expiry = 5;
+ optional uint64 min_final_cltv_expiry = 6;
+ repeated RoutingHint routing_hints = 7;
+}
+message InvoiceResponse {
+ string bolt11 = 1;
+}
+
+message InjectRequest {
+ string invoice = 1;
+ optional uint64 min_cltv_expiry = 2;
+}
+message InjectResponse {}
+
+message ListRequest {
+ message Pagination {
+ // Inclusive
+ int64 index_start = 1;
+ uint64 limit = 2;
+ }
+
+ oneof constraint {
+ bytes payment_hash = 1;
+ Pagination pagination = 2;
+ }
+}
+
+enum InvoiceState {
+ UNPAID = 0;
+ ACCEPTED = 1;
+ PAID = 2;
+ CANCELLED = 3;
+}
+
+message Htlc {
+ int64 id = 1;
+ InvoiceState state = 2;
+ string scid = 3;
+ uint64 channel_id = 4;
+ uint64 msat = 5;
+ uint64 created_at = 6;
+ optional uint64 cltv_expiry = 7;
+}
+
+message Invoice {
+ int64 id = 1;
+ bytes payment_hash = 2;
+ optional bytes preimage = 3;
+ string invoice = 4;
+ InvoiceState state = 5;
+ uint64 created_at = 6;
+ optional uint64 settled_at = 8;
+
+ repeated Htlc htlcs = 7;
+
+ optional uint64 min_cltv_expiry = 9;
+}
+
+message ListResponse {
+ repeated Invoice invoices = 1;
+}
+
+message SettleRequest {
+ bytes payment_preimage = 1;
+}
+message SettleResponse {}
+
+message CancelRequest {
+ bytes payment_hash = 1;
+}
+message CancelResponse {}
+
+message CleanRequest {
+ // Clean everything older than age seconds
+ optional uint64 age = 1;
+}
+message CleanResponse {
+ uint64 cleaned = 1;
+}
+
+message TrackRequest {
+ bytes payment_hash = 1;
+}
+
+message TrackResponse {
+ InvoiceState state = 1;
+}
+
+message TrackAllRequest {
+ repeated bytes payment_hashes = 1;
+}
+
+message TrackAllResponse {
+ bytes payment_hash = 1;
+ string bolt11 = 2;
+ InvoiceState state = 3;
+}
+
+message OnionMessage {
+ message ReplyBlindedPath {
+ message Hop {
+ optional bytes blinded_node_id = 1;
+ optional bytes encrypted_recipient_data = 2;
+ }
+
+ optional bytes first_node_id = 1;
+ optional string first_scid = 2;
+ optional uint64 first_scid_dir = 3;
+ optional bytes first_path_key = 4;
+ repeated Hop hops = 5;
+ }
+
+ message UnknownField {
+ uint64 number = 1;
+ bytes value = 2;
+ }
+
+ uint64 id = 1;
+ optional bytes pathsecret = 2;
+ optional ReplyBlindedPath reply_blindedpath = 3;
+ optional bytes invoice_request = 4;
+ optional bytes invoice = 5;
+ optional bytes invoice_error = 6;
+ repeated UnknownField unknown_fields = 7;
+}
+
+message OnionMessageResponse {
+ uint64 id = 1;
+ HookAction action = 2;
+}
diff --git a/src/main.rs b/src/main.rs
index 1605f77..1c3323a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,21 +1,38 @@
-use std::{path::Path, time::Duration};
+use std::{
+ path::{Path, PathBuf},
+ str::FromStr,
+ time::Duration,
+};
use anyhow::anyhow;
use cln_plugin::{
- options::{ConfigOption, DefaultBooleanConfigOption, StringArrayConfigOption},
Builder,
Plugin,
+ options::{ConfigOption, DefaultBooleanConfigOption, StringArrayConfigOption},
};
-use cln_rpc::{model::requests::ListdatastoreRequest, ClnRpc};
-use nostr_sdk::nips::nip47;
+use cln_rpc::{
+ ClnRpc,
+ model::{
+ requests::{DecodeRequest, ListdatastoreRequest},
+ responses::DecodeType,
+ },
+};
+use nostr::nips::nip47;
use nwc::run_nwc;
use nwc_notifications::{payment_received_handler, payment_sent_handler};
use parse::read_startup_options;
use rpc::{nwc_budget, nwc_create, nwc_list, nwc_revoke};
+use serde_json::json;
use structs::PluginState;
use tokio::time;
+use tonic::transport::{Certificate, ClientTlsConfig, Endpoint, Identity};
use util::{load_nwc_store, update_nwc_store};
+use crate::{
+ hold::{InvoiceState, ListRequest, hold_client::HoldClient},
+ nwc_notifications::holdinvoice_accepted_handler,
+};
+
mod nwc;
mod nwc_balance;
mod nwc_hold;
@@ -32,6 +49,9 @@ mod tasks;
mod util;
pub const STARTUP_DELAY: u64 = 1;
+pub mod hold {
+ tonic::include_proto!("hold");
+}
const OPT_RELAYS: StringArrayConfigOption = ConfigOption::new_str_arr_no_default(
"nip47-relays",
@@ -43,30 +63,35 @@ const OPT_NOTIFICATIONS: DefaultBooleanConfigOption = ConfigOption::new_bool_wit
"Enable/disable nip47-notifications. Default is `true`",
);
pub const PLUGIN_NAME: &str = "cln-nip47";
-pub const WALLET_READ_METHODS: [nip47::Method; 5] = [
+pub const WALLET_READ_OR_RECEIVE_METHODS: [nip47::Method; 5] = [
nip47::Method::MakeInvoice,
nip47::Method::LookupInvoice,
nip47::Method::ListTransactions,
nip47::Method::GetBalance,
nip47::Method::GetInfo,
];
-pub const WALLET_PAY_METHODS: [nip47::Method; 4] = [
- nip47::Method::PayInvoice,
- nip47::Method::MultiPayInvoice,
- nip47::Method::PayKeysend,
- nip47::Method::MultiPayKeysend,
+pub const WALLET_PAY_METHODS: [nip47::Method; 2] =
+ [nip47::Method::PayInvoice, nip47::Method::PayKeysend];
+pub const WALLET_HOLD_METHODS: [nip47::Method; 3] = [
+ nip47::Method::MakeHoldInvoice,
+ nip47::Method::CancelHoldInvoice,
+ nip47::Method::SettleHoldInvoice,
];
pub const WALLET_NOTIFICATIONS: [nip47::NotificationType; 2] = [
nip47::NotificationType::PaymentReceived,
nip47::NotificationType::PaymentSent,
];
+pub const WALLET_HOLD_NOTIFICATIONS: [nip47::NotificationType; 1] =
+ [nip47::NotificationType::HoldInvoiceAccepted];
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
- std::env::set_var(
- "CLN_PLUGIN_LOG",
- "cln_plugin=info,cln_rpc=info,cln_nip47=debug,info",
- );
+ unsafe {
+ std::env::set_var(
+ "CLN_PLUGIN_LOG",
+ "cln_plugin=info,cln_rpc=info,cln_nip47=trace,info",
+ );
+ };
log_panics::init();
let state;
@@ -107,6 +132,16 @@ async fn main() -> Result<(), anyhow::Error> {
};
let plugin = confplugin.start(state).await?;
+ match check_hold_support(plugin.clone()).await {
+ Ok(()) => {
+ log::info!("Hold support activated, loading pending invoices...");
+ if let Err(e) = load_pending_hold_invoices(plugin.clone()).await {
+ log::error!("Error loading pending hold invoices: {e}");
+ }
+ }
+ Err(e) => log::info!("Hold support not activated: {e}"),
+ }
+
{
let mut rpc = plugin.state().rpc_lock.lock().await;
@@ -128,6 +163,16 @@ async fn main() -> Result<(), anyhow::Error> {
}
}
+ let plugin_clone_cleanup = plugin.clone();
+ tokio::spawn(async move {
+ loop {
+ if let Err(e) = tasks::cleanup_event_ids(plugin_clone_cleanup.clone()).await {
+ log::warn!("Error in cleanup_event_ids thread: {e}");
+ }
+ time::sleep(Duration::from_secs(10)).await;
+ }
+ });
+
plugin.join().await
}
@@ -136,8 +181,8 @@ async fn shutdown_handler(
_args: serde_json::Value,
) -> Result<(), anyhow::Error> {
let mut locked_handles = plugin.state().handles.lock().await;
- for (_x, (client, _client_pubkey)) in locked_handles.drain() {
- client.shutdown().await;
+ for (_x, wallet_service) in locked_handles.drain() {
+ wallet_service.client.shutdown().await;
}
std::process::exit(0)
}
@@ -161,7 +206,186 @@ async fn load_nwcs(plugin: Plugin, rpc: &mut ClnRpc) -> Result<(),
}
}
+ // We don't keep track of inflight payments succeeding
+ // while the plugin is dynamically restarted
+ if nwc_store.reserved_msat != 0 {
+ log::warn!(
+ "Releasing {} msat leftover budget reservation for {label}",
+ nwc_store.reserved_msat
+ );
+ nwc_store.reserved_msat = 0;
+ update_nwc_store(rpc, label, nwc_store.clone()).await?;
+ }
+
run_nwc(plugin.clone(), label.clone(), nwc_store.clone()).await?;
}
Ok(())
}
+
+async fn load_pending_hold_invoices(plugin: Plugin) -> Result<(), anyhow::Error> {
+ let mut hold_client = plugin.state().hold_client.lock().clone().unwrap();
+ let invoices_request = ListRequest { constraint: None };
+ let invoices = hold_client
+ .list(invoices_request)
+ .await?
+ .into_inner()
+ .invoices;
+
+ let mut rpc = plugin.state().rpc_lock.lock().await;
+
+ for invoice in invoices {
+ if invoice.state() == InvoiceState::Accepted || invoice.state() == InvoiceState::Unpaid {
+ // Bound the accepted handler by the invoice's expiry. The hold
+ // plugin has no expired state, so without this it would wait
+ // forever on an invoice that expires while Unpaid.
+ let invoice_decoded = rpc
+ .call_typed(&DecodeRequest {
+ string: invoice.invoice.clone(),
+ })
+ .await?;
+
+ if !invoice_decoded.valid {
+ log::warn!(
+ "Skipping hold invoice {}, could not decode it",
+ hex::encode(&invoice.payment_hash)
+ );
+ continue;
+ }
+
+ let (created_at, expiry) = match invoice_decoded.item_type {
+ DecodeType::BOLT12_INVOICE => (
+ invoice_decoded.invoice_created_at,
+ invoice_decoded.invoice_relative_expiry.map(u64::from),
+ ),
+ DecodeType::BOLT11_INVOICE => (invoice_decoded.created_at, invoice_decoded.expiry),
+ _ => continue,
+ };
+
+ let (Some(created_at), Some(expiry)) = (created_at, expiry) else {
+ log::warn!(
+ "Skipping hold invoice {}: missing creation time or expiry",
+ hex::encode(&invoice.payment_hash)
+ );
+ continue;
+ };
+ let expires_at = created_at.saturating_add(expiry);
+
+ log::debug!(
+ "Starting holdinvoice accepted handler for {}",
+ hex::encode(&invoice.payment_hash)
+ );
+ tokio::spawn(holdinvoice_accepted_handler(
+ plugin.clone(),
+ invoice.payment_hash,
+ expires_at,
+ ));
+ }
+ }
+
+ Ok(())
+}
+
+async fn check_hold_support(plugin: Plugin) -> Result<(), anyhow::Error> {
+ let mut rpc = plugin.state().rpc_lock.lock().await;
+ let hold_grpc_host_response: serde_json::Value = rpc
+ .call_raw("listconfigs", &json!({"config": "hold-grpc-host"}))
+ .await?;
+
+ let Some(hold_grpc_host_configs) = hold_grpc_host_response.get("configs") else {
+ return Err(anyhow!("Unsopprted listconfigs response!"));
+ };
+ let Some(hold_grpc_host_config) = hold_grpc_host_configs.get("hold-grpc-host") else {
+ return Err(anyhow!("hold-grpc-host config not found"));
+ };
+ let Some(hold_grpc_host_value) = hold_grpc_host_config.get("value_str") else {
+ return Err(anyhow!("hold-grpc-host config not a string"));
+ };
+ let Some(hold_grpc_host) = hold_grpc_host_value.as_str() else {
+ return Err(anyhow!("hold-grpc-host config not convertable to string"));
+ };
+
+ let hold_grpc_port_response: serde_json::Value = rpc
+ .call_raw("listconfigs", &json!({"config": "hold-grpc-port"}))
+ .await?;
+ let Some(hold_grpc_port_configs) = hold_grpc_port_response.get("configs") else {
+ return Err(anyhow!("Unsopprted listconfigs response!"));
+ };
+ let Some(hold_grpc_port_config) = hold_grpc_port_configs.get("hold-grpc-port") else {
+ return Err(anyhow!("hold-grpc-port config not found"));
+ };
+ let Some(hold_grpc_port_value) = hold_grpc_port_config.get("value_int") else {
+ return Err(anyhow!("hold-grpc-port config not a number"));
+ };
+ let hold_grpc_port = if let Some(hgh) = hold_grpc_port_value.as_u64() {
+ u16::try_from(hgh)?
+ } else {
+ return Err(anyhow!("hold-grpc-port config not convertable to integer"));
+ };
+
+ let cert_dir = PathBuf::from_str(&plugin.configuration().lightning_dir)?.join("hold");
+
+ log::debug!(
+ "Searching {} for hold plugin certs",
+ cert_dir.to_str().unwrap()
+ );
+
+ let cert_max_retries = 10;
+ let mut cert_retries = 0;
+ while cert_retries < cert_max_retries && !do_certificates_exist(&cert_dir) {
+ log::debug!("Hold certificates incomplete. Waiting...");
+ time::sleep(Duration::from_millis(500)).await;
+ cert_retries += 1;
+ }
+
+ let ca_cert = tokio::fs::read(cert_dir.join("ca.pem")).await?;
+ let client_cert = tokio::fs::read(cert_dir.join("client.pem")).await?;
+ let client_key = tokio::fs::read(cert_dir.join("client-key.pem")).await?;
+
+ let identity = Identity::from_pem(client_cert, client_key);
+
+ let ca = Certificate::from_pem(ca_cert);
+
+ let tls_config = ClientTlsConfig::new()
+ .ca_certificate(ca)
+ .identity(identity)
+ .domain_name("hold");
+
+ let endpoint = Endpoint::from_shared(format!("https://{hold_grpc_host}:{hold_grpc_port}"))?
+ .tls_config(tls_config)?
+ .keep_alive_while_idle(true)
+ .connect_timeout(Duration::from_secs(5));
+
+ let chan_max_retries = 20;
+ let mut chan_retries = 0;
+
+ let channel = loop {
+ match endpoint.connect().await {
+ Ok(channel) => break channel,
+ Err(e) if chan_retries < chan_max_retries => {
+ chan_retries += 1;
+
+ log::debug!(
+ "Hold gRPC server not ready, retrying ({chan_retries}/{chan_max_retries}): {e}"
+ );
+
+ time::sleep(Duration::from_millis(500)).await;
+ }
+ Err(e) => {
+ return Err(anyhow!("Hold gRPC server did not become ready: {e}"));
+ }
+ }
+ };
+
+ *plugin.state().hold_client.lock() = Some(HoldClient::new(channel));
+
+ Ok(())
+}
+
+fn do_certificates_exist(cert_dir: &Path) -> bool {
+ let required_files = ["client.pem", "client-key.pem", "ca.pem"];
+
+ required_files.iter().all(|file| {
+ let path = cert_dir.join(file);
+ path.exists() && path.metadata().is_ok_and(|m| m.len() > 0)
+ })
+}
diff --git a/src/nwc.rs b/src/nwc.rs
index 9e9b2fb..dfd0e2c 100644
--- a/src/nwc.rs
+++ b/src/nwc.rs
@@ -1,29 +1,24 @@
-use std::{borrow::Cow, time::Duration};
+use std::time::Duration;
use anyhow::anyhow;
use cln_plugin::Plugin;
-use nostr_sdk::{
- client,
+use futures::StreamExt;
+use nostr::{
+ event::{Event, EventBuilder, EventId, FinalizeEventAsync, Kind, Tag},
+ filter::Filter,
+ key::{Keys, PublicKey, SecretKey},
nips::{nip04, nip44, nip47},
- nostr::{Filter, Kind, Tag},
- Alphabet,
- Client,
- Event,
- EventBuilder,
- EventId,
- Keys,
- PublicKey,
- RelayPoolNotification,
- RelayStatus,
- SecretKey,
- SignerError,
- SingleLetterTag,
- TagKind,
- Timestamp,
+ types::Timestamp,
};
-use tokio::{sync::oneshot, time};
+use nostr_sdk::{
+ client::{self, Client, ClientNotification},
+ error::Error,
+ relay::RelayStatus,
+};
+use tokio::time;
use crate::{
+ OPT_NOTIFICATIONS,
nwc_balance::get_balance_response,
nwc_hold::{
cancel_hold_invoice_response,
@@ -32,52 +27,49 @@ use crate::{
},
nwc_info::get_info_response,
nwc_invoice::make_invoice_response,
- nwc_keysend::{multi_pay_keysend, pay_keysend_response},
+ nwc_keysend::pay_keysend_response,
nwc_lookups::{list_transactions_response, lookup_invoice_response},
- nwc_pay::{multi_pay_invoice, pay_invoice_response},
- structs::{NwcStore, PluginState},
- tasks::budget_task,
- util::{build_capabilities, build_notifications_vec, is_read_only_nwc},
- OPT_NOTIFICATIONS,
- STARTUP_DELAY,
+ nwc_pay::pay_invoice_response,
+ structs::{ID_MAX_AGE, NwcStore, PluginState, WalletService},
+ util::{build_capabilities, build_notifications_vec, is_read_only_nwc, save_event_id},
};
+#[allow(clippy::too_many_lines)]
pub async fn run_nwc(
plugin: Plugin,
label: String,
nwc_store: NwcStore,
-) -> Result<(), client::Error> {
+) -> Result<(), Error> {
let (method_capabilities, _) = build_capabilities(is_read_only_nwc(&nwc_store), &plugin);
- let wallet_keys = Keys::new(
- SecretKey::from_hex(&nwc_store.walletkey)
- .map_err(|e| client::Error::Signer(SignerError::backend(e)))?,
- );
- let client_pubkey = Keys::new(nwc_store.uri.secret.clone()).public_key();
+ let wallet_keys = Keys::new(SecretKey::from_hex(&nwc_store.walletkey)?);
+ let client_keys = Keys::new(nwc_store.uri.secret.clone());
- let client = Client::new(wallet_keys.clone());
+ let nostr_client = Client::new();
log::debug!("relay_count:{}", nwc_store.uri.relays.len());
for relay in &nwc_store.uri.relays {
log::debug!("Adding relay: {relay}");
- client.add_relay(relay).await?;
+ nostr_client.add_relay(relay).await?;
}
if nwc_store.interval_config.is_some() {
- start_nwc_budget_job(&plugin, label.clone());
+ log::debug!("NWC {label} uses an interval budget");
}
- let client_clone = client.clone();
+ let nostr_client_clone = nostr_client.clone();
let plugin_clone = plugin.clone();
let label_clone = label.clone();
+ let client_keys_clone = client_keys.clone();
+ let wallet_keys_clone = wallet_keys.clone();
tokio::spawn(async move {
loop {
- client_clone.connect().await;
- client_clone
- .wait_for_connection(Duration::from_secs(30))
+ nostr_client_clone
+ .connect()
+ .and_wait(Duration::from_secs(30))
.await;
- let relays = client_clone.relays().await;
+ let relays = nostr_client_clone.relays().await;
if relays.is_empty() {
log::info!("No more relays left, we probably shut down. Exiting...");
break;
@@ -98,62 +90,67 @@ pub async fn run_nwc(
if let Err(e) = send_nwc_info_event(
plugin_clone.clone(),
- client_clone.clone(),
+ nostr_client_clone.clone(),
method_capabilities.clone(),
- wallet_keys.clone(),
+ wallet_keys_clone.clone(),
)
.await
{
log::warn!("{e}");
- client_clone.disconnect().await;
+ nostr_client_clone.disconnect().await;
time::sleep(Duration::from_secs(5)).await;
continue;
}
let filter = Filter::new()
.kind(Kind::WalletConnectRequest)
- .author(client_pubkey)
- .since(Timestamp::now() - STARTUP_DELAY - 1);
+ .author(client_keys_clone.public_key());
- if let Err(e) = client_clone.subscribe(filter, None).await {
- log::warn!("Could not subscribe to nwc events! {e}");
- client_clone.disconnect().await;
- time::sleep(Duration::from_secs(5)).await;
- continue;
+ let mut notifications = nostr_client_clone.notifications();
+
+ match nostr_client_clone.subscribe(filter).await {
+ Ok(o) => {
+ if o.success.is_empty() {
+ log::warn!("Could not subscribe to any relay!");
+ nostr_client_clone.disconnect().await;
+ time::sleep(Duration::from_secs(5)).await;
+ continue;
+ }
+ }
+ Err(e) => {
+ log::warn!("Error subscribing to relays: {e}");
+ nostr_client_clone.disconnect().await;
+ time::sleep(Duration::from_secs(5)).await;
+ continue;
+ }
}
- let client_clone_handler = client_clone.clone();
- match client_clone
- .handle_notifications(|notification| {
- let client_clone_handler = client_clone_handler.clone();
- let plugin_clone = plugin_clone.clone();
- let label_clone = label_clone.clone();
- let wallet_keys_clone = wallet_keys.clone();
- nwc_request_handler(
- notification,
- client_clone_handler,
- plugin_clone,
- label_clone,
- wallet_keys_clone,
- client_pubkey,
- )
- })
+ while let Some(notification) = notifications.next().await {
+ if let Err(e) = nwc_request_handler(
+ notification,
+ &nostr_client_clone,
+ &plugin_clone,
+ &label_clone,
+ &wallet_keys_clone,
+ client_keys_clone.public_key(),
+ )
.await
- {
- Ok(()) => {
- log::info!("NWC handler for `{label_clone}` stopped");
- break;
+ {
+ log::warn!("NWC handler for `{label_clone}` had an error: {e}");
}
- Err(e) => log::warn!("NWC handler for `{label_clone}` had an error: {e}"),
- };
+ }
+
+ {};
}
});
let mut locked_handles = plugin.state().handles.lock().await;
- locked_handles.insert(
- label.clone(),
- (client, Keys::new(nwc_store.uri.secret).public_key()),
- );
+ let wallet_service = WalletService {
+ client: nostr_client,
+ client_pubkey: client_keys.public_key(),
+ wallet_secret: wallet_keys,
+ };
+ locked_handles.insert(label.clone(), wallet_service);
Ok(())
}
@@ -176,7 +173,7 @@ pub async fn send_nwc_info_event(
.tag(Tag::parse(vec!["notifications", ¬ification_capabilities]).unwrap());
}
- let info_event = match info_event_builder.sign_with_keys(&wallet_keys) {
+ let info_event = match info_event_builder.finalize_async(&wallet_keys).await {
Ok(o) => o,
Err(e) => {
return Err(anyhow!("Could not sign info_event! {e}"));
@@ -204,95 +201,103 @@ pub async fn send_nwc_info_event(
pub async fn stop_nwc(plugin: Plugin, label: &String) {
let mut locked_handles = plugin.state().handles.lock().await;
- if let Some((client, _client_pubkey)) = locked_handles.remove(label) {
- client.shutdown().await;
- }
-
- stop_nwc_budget_job(&plugin, label);
-}
-
-pub fn start_nwc_budget_job(plugin: &Plugin, label: String) {
- let (tx, rx) = oneshot::channel::<()>();
- tokio::spawn(budget_task(rx, plugin.clone(), label.clone()));
- plugin.state().budget_jobs.lock().insert(label, tx);
-}
-
-pub fn stop_nwc_budget_job(plugin: &Plugin, label: &String) {
- let mut budget_jobs = plugin.state().budget_jobs.lock();
- let job = budget_jobs.remove(label);
- if let Some(j) = job {
- let _ = j.send(());
+ if let Some(wallet_service) = locked_handles.remove(label) {
+ wallet_service.client.shutdown().await;
}
}
+#[allow(clippy::too_many_lines)]
async fn nwc_request_handler(
- notification: RelayPoolNotification,
- client: client::Client,
- plugin: Plugin,
- label: String,
- wallet_keys: Keys,
+ notification: ClientNotification,
+ nostr_client: &client::Client,
+ plugin: &Plugin,
+ label: &str,
+ wallet_keys: &Keys,
client_pubkey: PublicKey,
-) -> Result> {
+) -> Result<(), Box> {
let (relay_url, subscription_id, event) = match notification {
- RelayPoolNotification::Event {
+ ClientNotification::Event {
relay_url,
subscription_id,
event,
} => (relay_url, subscription_id, event),
- RelayPoolNotification::Message {
+ ClientNotification::Message {
relay_url: _,
message: _,
- } => return Ok(false),
- RelayPoolNotification::Shutdown => return Ok(true),
+ }
+ | ClientNotification::Shutdown => return Ok(()),
};
- if let Some(expi) = event.tags.expiration() {
- if *expi < Timestamp::now() {
- return Ok(false);
- }
- }
- log::debug!("relay_url:{relay_url} subscription_id:{subscription_id} {event:?}");
+ log::trace!("relay_url:{relay_url} subscription_id:{subscription_id} {event:?}");
let mut use_nip44 = check_nip44_support(&event);
- let request = decrypt_request(&event.content, &wallet_keys, &client_pubkey, &mut use_nip44)?;
+ let request = decrypt_request(&event.content, wallet_keys, &client_pubkey, &mut use_nip44)?;
- let responses = match request.params {
- nip47::RequestParams::PayInvoice(pay_invoice_request) => {
- pay_invoice_response(plugin.clone(), pay_invoice_request, &label).await
+ let responses = if event.tags.expiration().is_some()
+ && event.tags.expiration().unwrap() < Timestamp::now()
+ {
+ vec![(
+ nip47::Response {
+ result_type: request.method,
+ error: Some(nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: "Event expired".to_owned(),
+ }),
+ result: None,
+ },
+ None,
+ )]
+ } else if event.created_at.as_secs() < (Timestamp::now().as_secs() - ID_MAX_AGE) {
+ vec![(
+ nip47::Response {
+ result_type: request.method,
+ error: Some(nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: "Event created too far in the past".to_owned(),
+ }),
+ result: None,
+ },
+ None,
+ )]
+ } else {
+ {
+ let mut rpc = plugin.state().rpc_lock.lock().await;
+ save_event_id(&mut rpc, event.id.to_hex(), event.created_at).await?;
}
- nip47::RequestParams::MultiPayInvoice(multi_pay_invoice_request) => {
- multi_pay_invoice(plugin.clone(), multi_pay_invoice_request, &label).await
- }
- nip47::RequestParams::PayKeysend(pay_keysend_request) => {
- pay_keysend_response(plugin, pay_keysend_request, &label).await
- }
- nip47::RequestParams::MultiPayKeysend(multi_pay_keysend_request) => {
- multi_pay_keysend(plugin.clone(), multi_pay_keysend_request, &label).await
- }
- nip47::RequestParams::MakeInvoice(make_invoice_request) => {
- make_invoice_response(plugin.clone(), make_invoice_request).await
- }
- nip47::RequestParams::LookupInvoice(lookup_invoice_request) => {
- lookup_invoice_response(plugin.clone(), lookup_invoice_request).await
- }
- nip47::RequestParams::ListTransactions(list_transactions_request) => {
- list_transactions_response(plugin.clone(), list_transactions_request).await
- }
- nip47::RequestParams::GetBalance => get_balance_response(plugin.clone(), &label).await,
- nip47::RequestParams::GetInfo => get_info_response(plugin.clone(), &label).await,
- nip47::RequestParams::MakeHoldInvoice(make_hold_invoice_request) => {
- make_hold_invoice_response(plugin.clone(), make_hold_invoice_request, &label).await
- }
- nip47::RequestParams::CancelHoldInvoice(cancel_hold_invoice_request) => {
- cancel_hold_invoice_response(plugin.clone(), cancel_hold_invoice_request, &label).await
- }
- nip47::RequestParams::SettleHoldInvoice(settle_hold_invoice_request) => {
- settle_hold_invoice_response(plugin.clone(), settle_hold_invoice_request, &label).await
+
+ match request.params {
+ nip47::RequestParams::PayInvoice(pay_invoice_request) => {
+ pay_invoice_response(plugin.clone(), pay_invoice_request, label).await
+ }
+ nip47::RequestParams::PayKeysend(pay_keysend_request) => {
+ pay_keysend_response(plugin.clone(), pay_keysend_request, label).await
+ }
+ nip47::RequestParams::MakeInvoice(make_invoice_request) => {
+ make_invoice_response(plugin.clone(), make_invoice_request).await
+ }
+ nip47::RequestParams::LookupInvoice(lookup_invoice_request) => {
+ lookup_invoice_response(plugin.clone(), lookup_invoice_request).await
+ }
+ nip47::RequestParams::ListTransactions(list_transactions_request) => {
+ list_transactions_response(plugin.clone(), list_transactions_request).await
+ }
+ nip47::RequestParams::GetBalance => get_balance_response(plugin.clone(), label).await,
+ nip47::RequestParams::GetInfo => get_info_response(plugin.clone(), label).await,
+ nip47::RequestParams::MakeHoldInvoice(make_hold_invoice_request) => {
+ make_hold_invoice_response(plugin.clone(), make_hold_invoice_request).await
+ }
+ nip47::RequestParams::CancelHoldInvoice(cancel_hold_invoice_request) => {
+ cancel_hold_invoice_response(plugin.clone(), cancel_hold_invoice_request).await
+ }
+ nip47::RequestParams::SettleHoldInvoice(settle_hold_invoice_request) => {
+ settle_hold_invoice_response(plugin.clone(), settle_hold_invoice_request).await
+ }
}
};
+
for (response, id) in responses {
let content =
- match encrypt_response_content(&response, &wallet_keys, &client_pubkey, use_nip44) {
+ match encrypt_response_content(&response, wallet_keys, &client_pubkey, use_nip44) {
Ok(o) => o,
Err(e) => {
log::warn!("{e}");
@@ -301,7 +306,7 @@ async fn nwc_request_handler(
};
let response_event =
- match build_response_event(event.id, content, &wallet_keys, client_pubkey, id) {
+ match build_response_event(event.id, content, wallet_keys, client_pubkey, id).await {
Ok(o) => o,
Err(e) => {
log::warn!("Error signing reponse event! {e}");
@@ -309,7 +314,7 @@ async fn nwc_request_handler(
}
};
- let send_result = match client.send_event(&response_event).await {
+ let send_result = match nostr_client.send_event(&response_event).await {
Ok(o) => o,
Err(e) => {
log::warn!("Error sending response event! {e}");
@@ -327,20 +332,25 @@ async fn nwc_request_handler(
);
continue;
}
- log::debug!("SENT RESPONSE {response_event:?}");
+ for success in send_result.success {
+ log::trace!("Sent to {}", success.0);
+ }
+ for failure in send_result.failed {
+ log::trace!("Failed to send to {}: {}", failure.0, failure.1);
+ }
+ log::trace!("SENT RESPONSE {response_event:?}");
}
- Ok(false)
+ Ok(())
}
fn check_nip44_support(event: &Event) -> bool {
- if let Some(encryption_tag) = event
- .tags
- .find(TagKind::Custom(Cow::Borrowed("encryption")))
- {
- if let Some(enc_tag_content) = encryption_tag.content() {
- if enc_tag_content.contains("nip44_v2") {
- return true;
+ for tag in event.tags.iter() {
+ if tag.kind() == "encryption" {
+ if let Some(enc_tag_content) = tag.content() {
+ if enc_tag_content.contains("nip44_v2") {
+ return true;
+ }
}
}
}
@@ -388,7 +398,7 @@ fn decrypt_request(
}
}
};
- log::debug!("Decrypted (nip44_v2:{use_nip44}):{content}");
+ log::trace!("Decrypted (nip44_v2:{use_nip44}):{content}");
let request: nip47::Request = match serde_json::from_str(&content) {
Ok(o) => o,
Err(e) => {
@@ -411,7 +421,7 @@ fn encrypt_response_content(
return Err(anyhow!("Error serializing response! {e}"));
}
};
- log::debug!("RESPONSE:{response_str}");
+ log::trace!("RESPONSE:{response_str}");
if use_nip44 {
match nip44::encrypt(
wallet_keys.secret_key(),
@@ -430,7 +440,7 @@ fn encrypt_response_content(
}
}
-fn build_response_event(
+async fn build_response_event(
event_id: EventId,
content: String,
wallet_keys: &Keys,
@@ -441,15 +451,9 @@ fn build_response_event(
.tag(Tag::event(event_id))
.tag(Tag::public_key(client_pubkey));
if let Some(i) = id {
- response_builder = response_builder.tag(Tag::custom(
- TagKind::SingleLetter(SingleLetterTag {
- character: Alphabet::D,
- uppercase: false,
- }),
- vec![i],
- ));
+ response_builder = response_builder.tag(Tag::identifier(i));
}
- match response_builder.sign_with_keys(wallet_keys) {
+ match response_builder.finalize_async(wallet_keys).await {
Ok(o) => Ok(o),
Err(e) => Err(e.into()),
}
diff --git a/src/nwc_balance.rs b/src/nwc_balance.rs
index 1b347bf..2fde546 100644
--- a/src/nwc_balance.rs
+++ b/src/nwc_balance.rs
@@ -1,8 +1,11 @@
use cln_plugin::Plugin;
use cln_rpc::{model::requests::ListpeerchannelsRequest, primitives::ChannelState};
-use nostr_sdk::nips::nip47;
+use nostr::nips::nip47;
-use crate::{structs::PluginState, util::load_nwc_store};
+use crate::{
+ structs::PluginState,
+ util::{get_budget_msat, load_nwc_store},
+};
pub async fn get_balance_response(
plugin: Plugin,
@@ -40,13 +43,14 @@ async fn get_balance(
message: e.to_string(),
})?;
- let balance = if let Some(bdgt_amt) = nwc_store.budget_msat {
+ let balance = if let Some(bdgt_amt) = get_budget_msat(&nwc_store) {
bdgt_amt
} else {
let listpeerchannels = rpc
.call_typed(&ListpeerchannelsRequest {
id: None,
short_channel_id: None,
+ channel_id: None,
})
.await
.map_err(|e| nip47::NIP47Error {
diff --git a/src/nwc_hold.rs b/src/nwc_hold.rs
index e048d0c..4ce23a3 100644
--- a/src/nwc_hold.rs
+++ b/src/nwc_hold.rs
@@ -1,58 +1,248 @@
-use cln_plugin::Plugin;
-use nostr_sdk::nips::nip47;
+use std::str::FromStr;
-use crate::structs::PluginState;
+use cln_plugin::Plugin;
+use cln_rpc::primitives::Sha256;
+use nostr::{nips::nip47, types::Timestamp};
+
+use crate::{
+ hold::{CancelRequest, InvoiceRequest, SettleRequest, invoice_request::Description},
+ nwc_notifications::holdinvoice_accepted_handler,
+ structs::PluginState,
+};
pub async fn make_hold_invoice_response(
- _plugin: Plugin,
- _params: nip47::MakeHoldInvoiceRequest,
- _label: &str,
+ plugin: Plugin,
+ params: nip47::MakeHoldInvoiceRequest,
) -> Vec<(nip47::Response, Option)> {
- vec![(
- nip47::Response {
- result_type: nip47::Method::MakeHoldInvoice,
- error: Some(nip47::NIP47Error {
- code: nip47::ErrorCode::NotImplemented,
- message: "Not implemented".to_owned(),
- }),
- result: None,
- },
- None,
- )]
+ vec![match make_hold_invoice(plugin, params).await {
+ Ok(o) => (
+ nip47::Response {
+ result_type: nip47::Method::MakeHoldInvoice,
+ error: None,
+ result: Some(nip47::ResponseResult::MakeHoldInvoice(o)),
+ },
+ None,
+ ),
+ Err(e) => (
+ nip47::Response {
+ result_type: nip47::Method::MakeHoldInvoice,
+ error: Some(e),
+ result: None,
+ },
+ None,
+ ),
+ }]
+}
+
+async fn make_hold_invoice(
+ plugin: Plugin,
+ params: nip47::MakeHoldInvoiceRequest,
+) -> Result {
+ let Some(mut hold_client) = plugin.state().hold_client.lock().clone() else {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::NotImplemented,
+ message: "No hold plugin found".to_owned(),
+ });
+ };
+
+ let description: Option = if let Some(d_hash) = ¶ms.description_hash {
+ if let Some(description) = ¶ms.description {
+ let my_description_hash = Sha256::const_hash(description.as_bytes());
+ let description_hash = Sha256::from_str(d_hash).map_err(|e| nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: e.to_string(),
+ })?;
+ if my_description_hash != description_hash {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: "description_hash not matching description".to_owned(),
+ });
+ }
+ }
+
+ let desc_hash_bytes = match hex::decode(d_hash) {
+ Ok(p) => p,
+ Err(_e) => {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: "Could not convert description hash to bytes".to_owned(),
+ });
+ }
+ };
+ Some(Description::Hash(desc_hash_bytes))
+ } else {
+ params
+ .description
+ .as_ref()
+ .map(|desc| Description::Memo(desc.clone()))
+ };
+
+ let payment_hash = match hex::decode(¶ms.payment_hash) {
+ Ok(p) => p,
+ Err(_e) => {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: "Invalid payment hash".to_owned(),
+ });
+ }
+ };
+
+ let expiry = params.expiry.unwrap_or(60 * 60);
+
+ let holdinvoice_request = InvoiceRequest {
+ payment_hash: payment_hash.clone(),
+ amount_msat: params.amount,
+ expiry: Some(expiry),
+ min_final_cltv_expiry: params.min_cltv_expiry_delta.map(u64::from),
+ routing_hints: Vec::new(),
+ description,
+ };
+
+ let holdinvoice = hold_client
+ .invoice(holdinvoice_request)
+ .await
+ .map_err(|e| nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: format!("Error creating hold invoice: {e}"),
+ })?
+ .into_inner();
+
+ let expires_at = Timestamp::now() + expiry;
+
+ let response = nip47::MakeHoldInvoiceResponse {
+ invoice: Some(holdinvoice.bolt11),
+ transaction_type: nip47::TransactionType::Incoming,
+ description: params.description,
+ description_hash: params.description_hash,
+ amount: params.amount,
+ created_at: Timestamp::now(),
+ expires_at,
+ metadata: None,
+ payment_hash: params.payment_hash,
+ };
+
+ tokio::spawn(holdinvoice_accepted_handler(
+ plugin,
+ payment_hash,
+ expires_at.as_secs(),
+ ));
+ Ok(response)
}
pub async fn cancel_hold_invoice_response(
- _plugin: Plugin,
- _params: nip47::CancelHoldInvoiceRequest,
- _label: &str,
+ plugin: Plugin,
+ params: nip47::CancelHoldInvoiceRequest,
) -> Vec<(nip47::Response, Option)> {
- vec![(
- nip47::Response {
- result_type: nip47::Method::MakeHoldInvoice,
- error: Some(nip47::NIP47Error {
- code: nip47::ErrorCode::NotImplemented,
- message: "Not implemented".to_owned(),
- }),
- result: None,
- },
- None,
- )]
+ vec![match cancel_hold_invoice(plugin, params).await {
+ Ok(o) => (
+ nip47::Response {
+ result_type: nip47::Method::CancelHoldInvoice,
+ error: None,
+ result: Some(nip47::ResponseResult::CancelHoldInvoice(o)),
+ },
+ None,
+ ),
+ Err(e) => (
+ nip47::Response {
+ result_type: nip47::Method::CancelHoldInvoice,
+ error: Some(e),
+ result: None,
+ },
+ None,
+ ),
+ }]
+}
+
+async fn cancel_hold_invoice(
+ plugin: Plugin,
+ params: nip47::CancelHoldInvoiceRequest,
+) -> Result {
+ let Some(mut hold_client) = plugin.state().hold_client.lock().clone() else {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::NotImplemented,
+ message: "No hold plugin found".to_owned(),
+ });
+ };
+
+ let payment_hash = match hex::decode(¶ms.payment_hash) {
+ Ok(p) => p,
+ Err(_e) => {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: "Invalid payment hash".to_owned(),
+ });
+ }
+ };
+
+ let hold_cancel_request = CancelRequest { payment_hash };
+
+ let hold_cancel_response = hold_client.cancel(hold_cancel_request).await;
+
+ match hold_cancel_response {
+ Ok(_o) => Ok(nip47::CancelHoldInvoiceResponse {}),
+ Err(e) => Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: e.to_string(),
+ }),
+ }
}
pub async fn settle_hold_invoice_response(
- _plugin: Plugin,
- _params: nip47::SettleHoldInvoiceRequest,
- _label: &str,
+ plugin: Plugin,
+ params: nip47::SettleHoldInvoiceRequest,
) -> Vec<(nip47::Response, Option)> {
- vec![(
- nip47::Response {
- result_type: nip47::Method::MakeHoldInvoice,
- error: Some(nip47::NIP47Error {
- code: nip47::ErrorCode::NotImplemented,
- message: "Not implemented".to_owned(),
- }),
- result: None,
- },
- None,
- )]
+ vec![match settle_hold_invoice(plugin, params).await {
+ Ok(o) => (
+ nip47::Response {
+ result_type: nip47::Method::SettleHoldInvoice,
+ error: None,
+ result: Some(nip47::ResponseResult::SettleHoldInvoice(o)),
+ },
+ None,
+ ),
+ Err(e) => (
+ nip47::Response {
+ result_type: nip47::Method::SettleHoldInvoice,
+ error: Some(e),
+ result: None,
+ },
+ None,
+ ),
+ }]
+}
+
+async fn settle_hold_invoice(
+ plugin: Plugin,
+ params: nip47::SettleHoldInvoiceRequest,
+) -> Result {
+ let Some(mut hold_client) = plugin.state().hold_client.lock().clone() else {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::NotImplemented,
+ message: "No hold plugin found".to_owned(),
+ });
+ };
+
+ let preimage = match hex::decode(¶ms.preimage) {
+ Ok(p) => p,
+ Err(_e) => {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: "Invalid preimage".to_owned(),
+ });
+ }
+ };
+
+ let hold_settle_request = SettleRequest {
+ payment_preimage: preimage,
+ };
+
+ let hold_settle_response = hold_client.settle(hold_settle_request).await;
+
+ match hold_settle_response {
+ Ok(_o) => Ok(nip47::SettleHoldInvoiceResponse {}),
+ Err(e) => Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: e.to_string(),
+ }),
+ }
}
diff --git a/src/nwc_info.rs b/src/nwc_info.rs
index 050edf3..27e196a 100644
--- a/src/nwc_info.rs
+++ b/src/nwc_info.rs
@@ -1,6 +1,6 @@
use cln_plugin::Plugin;
use cln_rpc::model::requests::GetinfoRequest;
-use nostr_sdk::nips::nip47;
+use nostr::nips::nip47;
use crate::{
structs::PluginState,
@@ -64,7 +64,7 @@ async fn get_info(
let methods = build_methods_vec(is_read_only_nwc(&nwc_store), &plugin);
Ok(nip47::GetInfoResponse {
- alias: get_info.alias,
+ alias: Some(get_info.alias),
color: Some(get_info.color),
pubkey: Some(pubkey),
network: Some(network),
diff --git a/src/nwc_invoice.rs b/src/nwc_invoice.rs
index 654a0b0..f521673 100644
--- a/src/nwc_invoice.rs
+++ b/src/nwc_invoice.rs
@@ -5,7 +5,7 @@ use cln_rpc::{
model::requests::InvoiceRequest,
primitives::{Amount, AmountOrAny, Sha256},
};
-use nostr_sdk::nips::nip47;
+use nostr::{nips::nip47, types::Timestamp};
use uuid::Uuid;
use crate::structs::PluginState;
@@ -94,8 +94,8 @@ async fn make_invoice(
description_hash: params.description_hash,
preimage: None,
amount: Some(params.amount),
- created_at: Some(nostr_sdk::nostr::Timestamp::now()),
- expires_at: Some(nostr_sdk::nostr::Timestamp::from_secs(o.expires_at)),
+ created_at: Some(Timestamp::now()),
+ expires_at: Some(Timestamp::from_secs(o.expires_at)),
}),
Err(e) => Err(nip47::NIP47Error {
code: nip47::ErrorCode::Internal,
diff --git a/src/nwc_keysend.rs b/src/nwc_keysend.rs
index 477db88..aec724d 100644
--- a/src/nwc_keysend.rs
+++ b/src/nwc_keysend.rs
@@ -1,18 +1,30 @@
-use std::{str::FromStr, time::Duration};
+use std::{collections::HashMap, str::FromStr};
use cln_plugin::Plugin;
use cln_rpc::{
- model::requests::KeysendRequest,
- primitives::{Amount, PublicKey, TlvEntry, TlvStream},
+ ClnRpc,
+ RpcError,
+ model::requests::{KeysendRequest, XkeysendRequest},
+ primitives::{Amount, PublicKey, Secret, TlvEntry, TlvStream},
};
-use nostr_sdk::nips::nip47;
-use tokio::time;
+use nostr::nips::nip47::{self};
use crate::{
structs::PluginState,
- util::{budget_amount_check, load_nwc_store, update_nwc_store},
+ util::{
+ budget_amount_check,
+ get_budget_msat,
+ load_nwc_store,
+ payment_fee_reserve_msat,
+ refund_budget,
+ reserve_budget,
+ rpc_socket_path,
+ settle_budget,
+ },
};
+pub const XKEYSEND_COMMAND: &str = "xkeysend";
+
pub async fn pay_keysend_response(
plugin: Plugin,
params: nip47::PayKeysendRequest,
@@ -49,8 +61,6 @@ async fn pay_keysend(
params: nip47::PayKeysendRequest,
label: &str,
) -> Result {
- let mut rpc = plugin.state().rpc_lock.lock().await;
-
if params.preimage.is_some() {
return Err(nip47::NIP47Error {
code: nip47::ErrorCode::Other,
@@ -58,32 +68,142 @@ async fn pay_keysend(
});
}
- let mut nwc_store = load_nwc_store(&mut rpc, label)
- .await
- .map_err(|e| nip47::NIP47Error {
- code: nip47::ErrorCode::Internal,
- message: e.to_string(),
- })?;
-
- budget_amount_check(Some(params.amount), None, nwc_store.budget_msat).map_err(|e| {
- nip47::NIP47Error {
- code: nip47::ErrorCode::QuotaExceeded,
- message: e.to_string(),
- }
- })?;
-
let pubkey = PublicKey::from_str(¶ms.pubkey).map_err(|e| nip47::NIP47Error {
code: nip47::ErrorCode::Other,
message: e.to_string(),
})?;
+ let reservation = {
+ let mut rpc = plugin.state().rpc_lock.lock().await;
+
+ let nwc_store = load_nwc_store(&mut rpc, label)
+ .await
+ .map_err(|e| nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: e.to_string(),
+ })?;
+
+ budget_amount_check(Some(params.amount), None, get_budget_msat(&nwc_store)).map_err(
+ |e| nip47::NIP47Error {
+ code: nip47::ErrorCode::QuotaExceeded,
+ message: e.to_string(),
+ },
+ )?;
+
+ // Reserve amount plus worst case fee so concurrent payments can never
+ // exceed the budget.
+ if get_budget_msat(&nwc_store).unwrap_or(u64::MAX)
+ < params
+ .amount
+ .saturating_add(payment_fee_reserve_msat(params.amount))
+ {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::QuotaExceeded,
+ message: "Payment and estimated fees exceed the available budget".to_owned(),
+ });
+ }
+
+ reserve_budget(&mut rpc, label, &nwc_store, params.amount)
+ .await
+ .map_err(|e| nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: e.to_string(),
+ })?
+ };
+
+ let has_xkeysend = plugin.state().config.lock().has_xkeysend;
+ let mut pay_rpc =
+ ClnRpc::new(rpc_socket_path(&plugin))
+ .await
+ .map_err(|e| nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: format!("Could not connect to lightningd: {e}"),
+ })?;
+
+ let pay_result = if has_xkeysend {
+ xkeysend(&mut pay_rpc, ¶ms, pubkey).await
+ } else {
+ keysend(&mut pay_rpc, ¶ms, pubkey).await
+ };
+
+ match pay_result {
+ Ok((amount_sent_msat, amount_msat, preimage)) => {
+ let mut rpc = plugin.state().rpc_lock.lock().await;
+ if let Err(e) = settle_budget(&mut rpc, label, reservation, amount_sent_msat).await {
+ log::error!("Error updating budget after successful keysend: {e}");
+ }
+
+ let preimage = hex::encode(preimage.to_vec());
+ let fees_paid = amount_sent_msat.saturating_sub(amount_msat);
+
+ Ok(nip47::PayKeysendResponse {
+ preimage,
+ fees_paid: Some(fees_paid),
+ })
+ }
+ Err(e) => {
+ let mut rpc = plugin.state().rpc_lock.lock().await;
+ if let Err(refund_err) = refund_budget(&mut rpc, label, reservation).await {
+ log::error!(
+ "Error refunding budget reservation after failed keysend: {refund_err}"
+ );
+ }
+ Err(map_keysend_error(&e, has_xkeysend))
+ }
+ }
+}
+
+async fn xkeysend(
+ pay_rpc: &mut ClnRpc,
+ params: &nip47::PayKeysendRequest,
+ pubkey: PublicKey,
+) -> Result<(u64, u64, Secret), RpcError> {
+ let mut extratlvs = HashMap::with_capacity(params.tlv_records.len());
+ for tlv in ¶ms.tlv_records {
+ extratlvs.insert(tlv.tlv_type.to_string(), tlv.value.clone());
+ }
+ let extratlvs = if extratlvs.is_empty() {
+ None
+ } else {
+ Some(extratlvs)
+ };
+
+ let o = pay_rpc
+ .call_typed(&XkeysendRequest {
+ extratlvs,
+ label: None,
+ maxdelay: None,
+ maxfee: None,
+ retry_for: None,
+ layers: None,
+ amount_msat: Amount::from_msat(params.amount),
+ destination: pubkey,
+ })
+ .await?;
+
+ Ok((
+ o.amount_sent_msat.msat(),
+ o.amount_msat.msat(),
+ o.payment_preimage,
+ ))
+}
+
+async fn keysend(
+ pay_rpc: &mut ClnRpc,
+ params: &nip47::PayKeysendRequest,
+ pubkey: PublicKey,
+) -> Result<(u64, u64, Secret), RpcError> {
let mut extratlvs = TlvStream {
entries: Vec::new(),
};
- for tlv in params.tlv_records {
+ for tlv in ¶ms.tlv_records {
extratlvs.entries.push(TlvEntry {
typ: tlv.tlv_type,
- value: tlv.value.as_bytes().to_owned(),
+ value: hex::decode(&tlv.value).map_err(|e| RpcError {
+ code: Some(-32700),
+ message: format!("Could not decode tlv bytes: {e}"),
+ data: None,
+ })?,
});
}
let extratlvs = if extratlvs.entries.is_empty() {
@@ -92,7 +212,7 @@ async fn pay_keysend(
Some(extratlvs)
};
- match rpc
+ let o = pay_rpc
.call_typed(&KeysendRequest {
exemptfee: None,
extratlvs,
@@ -105,80 +225,48 @@ async fn pay_keysend(
amount_msat: Amount::from_msat(params.amount),
destination: pubkey,
})
- .await
- {
- Ok(o) => {
- if let Some(ref mut bdg) = nwc_store.budget_msat {
- *bdg = bdg.saturating_sub(o.amount_sent_msat.msat());
- update_nwc_store(&mut rpc, label, nwc_store)
- .await
- .map_err(|e| nip47::NIP47Error {
- code: nip47::ErrorCode::Internal,
- message: e.to_string(),
- })?;
- }
+ .await?;
- let preimage = hex::encode(o.payment_preimage.to_vec());
-
- let fees_paid = o.amount_sent_msat.msat() - o.amount_msat.msat();
-
- Ok(nip47::PayKeysendResponse {
- preimage,
- fees_paid: Some(fees_paid),
- })
- }
- Err(e) => match e.code {
- Some(c) => match c {
- 203 | 205 | 210 => Err(nip47::NIP47Error {
- code: nip47::ErrorCode::PaymentFailed,
- message: e.to_string(),
- }),
- 206 => Err(nip47::NIP47Error {
- code: nip47::ErrorCode::InsufficientBalance,
- message: e.to_string(),
- }),
- _ => Err(nip47::NIP47Error {
- code: nip47::ErrorCode::Internal,
- message: e.to_string(),
- }),
- },
- None => Err(nip47::NIP47Error {
- code: nip47::ErrorCode::Internal,
- message: e.to_string(),
- }),
- },
- }
+ Ok((
+ o.amount_sent_msat.msat(),
+ o.amount_msat.msat(),
+ o.payment_preimage,
+ ))
}
-pub async fn multi_pay_keysend(
- plugin: Plugin,
- params: nip47::MultiPayKeysendRequest,
- label: &str,
-) -> Vec<(nip47::Response, Option)> {
- let mut responses = Vec::new();
- for pay in params.keysends {
- let result = pay_keysend(plugin.clone(), pay.clone(), label).await;
- let id = if let Some(i) = pay.id { i } else { pay.pubkey };
- let response_res = match result {
- Ok(resp) => (
- nip47::Response {
- result_type: nip47::Method::MultiPayKeysend,
- error: None,
- result: Some(nip47::ResponseResult::MultiPayKeysend(resp)),
- },
- Some(id),
- ),
- Err(e) => (
- nip47::Response {
- result_type: nip47::Method::MultiPayKeysend,
- error: Some(e),
- result: None,
- },
- Some(id),
- ),
+fn map_keysend_error(e: &RpcError, is_xkeysend: bool) -> nip47::NIP47Error {
+ let Some(c) = e.code else {
+ return nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: e.to_string(),
};
- responses.push(response_res);
- time::sleep(Duration::from_millis(100)).await;
+ };
+
+ let failed_codes = if is_xkeysend {
+ vec![203, 205, 207, 219]
+ } else {
+ vec![203, 205, 210]
+ };
+
+ if failed_codes.contains(&c) {
+ nip47::NIP47Error {
+ code: nip47::ErrorCode::PaymentFailed,
+ message: e.to_string(),
+ }
+ } else if is_xkeysend && c == 209 {
+ nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: e.to_string(),
+ }
+ } else if !is_xkeysend && c == 206 {
+ nip47::NIP47Error {
+ code: nip47::ErrorCode::InsufficientBalance,
+ message: e.to_string(),
+ }
+ } else {
+ nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: e.to_string(),
+ }
}
- responses
}
diff --git a/src/nwc_lookups.rs b/src/nwc_lookups.rs
index 33bea1f..42ce1f6 100644
--- a/src/nwc_lookups.rs
+++ b/src/nwc_lookups.rs
@@ -2,9 +2,20 @@ use std::{cmp::Reverse, str::FromStr};
use cln_plugin::Plugin;
use cln_rpc::{
+ ClnRpc,
model::{
- requests::{DecodeRequest, ListinvoicesRequest, ListpaysRequest},
+ requests::{
+ DecodeRequest,
+ ListinvoicesIndex,
+ ListinvoicesRequest,
+ ListpaysRequest,
+ WaitIndexname,
+ WaitRequest,
+ WaitSubsystem,
+ },
responses::{
+ DecodeResponse,
+ DecodeType,
ListinvoicesInvoices,
ListinvoicesInvoicesStatus,
ListpaysPays,
@@ -12,11 +23,22 @@ use cln_rpc::{
},
},
primitives::Sha256,
- ClnRpc,
};
-use nostr_sdk::{nips::nip47, Timestamp};
+use nostr::{nips::nip47, types::Timestamp};
+use tonic::transport::Channel;
-use crate::structs::{PluginState, NOT_INV_ERR};
+use crate::{
+ hold::{self, ListRequest, hold_client::HoldClient, list_request::Constraint},
+ structs::{NOT_INV_ERR, PluginState},
+ util::rpc_socket_path,
+};
+
+#[allow(clippy::doc_markdown)]
+/// Hard bound on the number of transactions a single `list_transactions`
+/// request will fetch, decode and return (DoS protection).
+const MAX_TRANSACTIONS: usize = 500;
+/// Bound on the size of a `list_transactions` response in bytes.
+const RESPONSE_LIMIT_BYTES: usize = 127 * 1024;
pub async fn lookup_invoice_response(
plugin: Plugin,
@@ -58,7 +80,7 @@ async fn lookup_invoice(
let invoice = if params.payment_hash.is_some() && params.invoice.is_some() {
None
} else {
- params.invoice
+ params.invoice.clone()
};
let invoices = rpc
@@ -81,46 +103,275 @@ async fn lookup_invoice(
if invoices.len() == 1 {
let invoice_response = invoices.into_iter().next().unwrap();
- make_lookup_response_from_listinvoices(&mut rpc, invoice_response).await
+ return make_lookup_response_from_listinvoices(&mut rpc, invoice_response).await;
+ }
+
+ let payment_hash_hash = if let Some(hash) = ¶ms.payment_hash {
+ if let Ok(res) = Sha256::from_str(hash) {
+ Some(res)
+ } else {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: "Could not convert payment hash".to_owned(),
+ });
+ }
} else {
- let payment_hash_hash = if let Some(hash) = params.payment_hash {
- if let Ok(res) = Sha256::from_str(&hash) {
- Some(res)
+ None
+ };
+
+ let pays = rpc
+ .call_typed(&ListpaysRequest {
+ bolt11: invoice,
+ index: None,
+ limit: None,
+ payment_hash: payment_hash_hash,
+ start: None,
+ status: None,
+ })
+ .await
+ .map_err(|e| nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: e.to_string(),
+ })?
+ .pays;
+
+ if pays.len() == 1 {
+ let list_pay = pays.into_iter().next().unwrap();
+
+ return make_lookup_response_from_listpays(&mut rpc, list_pay).await;
+ }
+
+ let holdinvoice_support = plugin.state().hold_client.lock().is_some();
+
+ if holdinvoice_support {
+ let mut hold_client = plugin.state().hold_client.lock().clone().unwrap();
+ return lookup_holdinvoice(&mut hold_client, &mut rpc, params).await;
+ }
+
+ Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::NotFound,
+ message: "Transaction not found".to_owned(),
+ })
+}
+
+async fn lookup_holdinvoice(
+ hold_client: &mut HoldClient,
+ rpc: &mut ClnRpc,
+ params: nip47::LookupInvoiceRequest,
+) -> Result {
+ log::debug!("Looking up hold invoice for params {params:#?}");
+ let (hold_invoice, invoice_decoded) =
+ get_and_decode_holdinvoice(rpc, hold_client, params).await?;
+ let not_invoice_err = Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: NOT_INV_ERR.to_owned(),
+ });
+
+ let description = match invoice_decoded.item_type {
+ DecodeType::BOLT12_INVOICE => invoice_decoded.offer_description,
+ DecodeType::BOLT11_INVOICE => invoice_decoded.description,
+ _ => return not_invoice_err,
+ };
+ let description_hash = match invoice_decoded.item_type {
+ DecodeType::BOLT12_INVOICE => None,
+ DecodeType::BOLT11_INVOICE => invoice_decoded.description_hash.map(|h| h.to_string()),
+ _ => return not_invoice_err,
+ };
+
+ let created_at = match invoice_decoded.item_type {
+ DecodeType::BOLT12_INVOICE => {
+ Timestamp::from_secs(invoice_decoded.invoice_created_at.unwrap())
+ }
+ DecodeType::BOLT11_INVOICE => Timestamp::from_secs(invoice_decoded.created_at.unwrap()),
+ _ => return not_invoice_err,
+ };
+
+ let amount = match invoice_decoded.item_type {
+ DecodeType::BOLT12_INVOICE => invoice_decoded.invoice_amount_msat.unwrap().msat(),
+ DecodeType::BOLT11_INVOICE => {
+ if let Some(amt) = invoice_decoded.amount_msat {
+ amt.msat()
} else {
+ // amount: `any` but have to put a value...
+ 0
+ }
+ }
+ _ => return not_invoice_err,
+ };
+
+ let expires_at = match invoice_decoded.item_type {
+ DecodeType::BOLT12_INVOICE => invoice_decoded
+ .invoice_relative_expiry
+ .map(|e_at| created_at + Timestamp::from_secs(u64::from(e_at))),
+ DecodeType::BOLT11_INVOICE => invoice_decoded
+ .expiry
+ .map(|e_at| created_at + Timestamp::from_secs(e_at)),
+ _ => return not_invoice_err,
+ };
+
+ let state = match hold_invoice.state() {
+ hold::InvoiceState::Unpaid => nip47::TransactionState::Pending,
+ hold::InvoiceState::Accepted => nip47::TransactionState::Accepted,
+ hold::InvoiceState::Paid => nip47::TransactionState::Settled,
+ hold::InvoiceState::Cancelled => nip47::TransactionState::Expired,
+ };
+
+ let settled_at = if hold_invoice.settled_at() != 0 {
+ Some(Timestamp::from_secs(hold_invoice.settled_at()))
+ } else {
+ None
+ };
+
+ let preimage = if hold_invoice.state() == hold::InvoiceState::Paid {
+ Some(hex::encode(hold_invoice.preimage()))
+ } else {
+ None
+ };
+
+ Ok(nip47::LookupInvoiceResponse {
+ transaction_type: Some(nip47::TransactionType::Incoming),
+ invoice: Some(hold_invoice.invoice.clone()),
+ description,
+ description_hash,
+ preimage,
+ payment_hash: hex::encode(hold_invoice.payment_hash),
+ amount,
+ fees_paid: 0,
+ created_at,
+ expires_at,
+ settled_at,
+ metadata: None,
+ state: Some(state),
+ })
+}
+
+#[allow(clippy::too_many_lines)]
+async fn get_and_decode_holdinvoice(
+ rpc: &mut ClnRpc,
+ hold_client: &mut HoldClient,
+ params: nip47::LookupInvoiceRequest,
+) -> Result<(hold::Invoice, DecodeResponse), nip47::NIP47Error> {
+ if let Some(ph) = ¶ms.payment_hash {
+ let payment_hash_hash = match hex::decode(ph) {
+ Ok(p) => p,
+ Err(_e) => {
return Err(nip47::NIP47Error {
- code: nip47::ErrorCode::Internal,
- message: "Could not convert payment hash".to_owned(),
+ code: nip47::ErrorCode::Other,
+ message: "Invalid payment hash".to_owned(),
});
}
- } else {
- None
};
+ let list_request = ListRequest {
+ constraint: Some(Constraint::PaymentHash(payment_hash_hash)),
+ };
+ let hold_lookup = hold_client
+ .list(list_request)
+ .await
+ .map_err(|e| nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: format!("Could not fetch hold invoice: {e}"),
+ })?
+ .into_inner();
- let pays = rpc
- .call_typed(&ListpaysRequest {
- bolt11: invoice,
- index: None,
- limit: None,
- payment_hash: payment_hash_hash,
- start: None,
- status: None,
+ if hold_lookup.invoices.len() != 1 {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: "Transaction not found".to_owned(),
+ });
+ }
+
+ let hold_invoice = hold_lookup.invoices.into_iter().next().unwrap();
+ let invoice_decoded = rpc
+ .call_typed(&DecodeRequest {
+ string: hold_invoice.invoice.clone(),
})
.await
.map_err(|e| nip47::NIP47Error {
code: nip47::ErrorCode::Internal,
message: e.to_string(),
- })?
- .pays;
-
- if pays.len() != 1 {
+ })?;
+ if !invoice_decoded.valid {
return Err(nip47::NIP47Error {
- code: nip47::ErrorCode::NotFound,
+ code: nip47::ErrorCode::Other,
+ message: "Invalid invoice decoded".to_owned(),
+ });
+ }
+
+ Ok((hold_invoice, invoice_decoded))
+ } else {
+ let invoice_decoded = rpc
+ .call_typed(&DecodeRequest {
+ string: params.invoice.unwrap(),
+ })
+ .await
+ .map_err(|e| nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: e.to_string(),
+ })?;
+ if !invoice_decoded.valid {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: "Invalid invoice decoded".to_owned(),
+ });
+ }
+
+ let ph = match invoice_decoded.item_type {
+ DecodeType::BOLT12_INVOICE => invoice_decoded.invoice_payment_hash.unwrap(),
+ DecodeType::BOLT11_INVOICE => invoice_decoded.payment_hash.unwrap().to_string(),
+ _ => {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: "Not a supported invoice type".to_owned(),
+ });
+ }
+ };
+ let payment_hash_hash = match hex::decode(&ph) {
+ Ok(p) => p,
+ Err(_e) => {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: "Invalid payment hash in invoice".to_owned(),
+ });
+ }
+ };
+
+ let list_request = ListRequest {
+ constraint: Some(Constraint::PaymentHash(payment_hash_hash)),
+ };
+
+ let hold_lookup = hold_client
+ .list(list_request)
+ .await
+ .map_err(|e| nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: format!("Could not fetch hold invoice: {e}"),
+ })?
+ .into_inner();
+
+ if hold_lookup.invoices.len() != 1 {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
message: "Transaction not found".to_owned(),
});
}
- let list_pay = pays.into_iter().next().unwrap();
- make_lookup_response_from_listpays(&mut rpc, list_pay).await
+ let hold_invoice = hold_lookup.invoices.into_iter().next().unwrap();
+ let invoice_decoded = rpc
+ .call_typed(&DecodeRequest {
+ string: hold_invoice.invoice.clone(),
+ })
+ .await
+ .map_err(|e| nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: e.to_string(),
+ })?;
+ if !invoice_decoded.valid {
+ return Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: "Invalid invoice decoded".to_owned(),
+ });
+ }
+ Ok((hold_invoice, invoice_decoded))
}
}
@@ -152,7 +403,37 @@ async fn list_transactions(
plugin: Plugin,
params: nip47::ListTransactionsRequest,
) -> Result, nip47::NIP47Error> {
- let mut rpc = plugin.state().rpc_lock.lock().await;
+ if params.limit == Some(0) {
+ return Ok(Vec::new());
+ }
+
+ let mut rpc = ClnRpc::new(rpc_socket_path(&plugin))
+ .await
+ .map_err(|e| nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: format!("Could not connect to lightningd: {e}"),
+ })?;
+
+ let limit = usize::try_from(params.limit.unwrap_or(MAX_TRANSACTIONS as u64)).map_err(|e| {
+ nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: format!("32-bit usize limit exceeded: {e}"),
+ }
+ })?;
+ let offset = usize::try_from(params.offset.unwrap_or(0)).map_err(|e| nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: format!("32-bit usize limit exceeded: {e}"),
+ })?;
+ let want = limit.saturating_add(offset);
+ // Enough candidates from each source to satisfy the requested window even
+ // if some get filtered out again by `from`/`until`/`unpaid`.
+ let per_source = want
+ .saturating_mul(2)
+ .saturating_add(16)
+ .min(MAX_TRANSACTIONS);
+ let from = params.from.map(|t| t.as_secs());
+ let until = params.until.map(|t| t.as_secs());
+ let unpaid = params.unpaid.unwrap_or(false);
let (query_invoices, query_payments) = match params.transaction_type {
Some(t) => match t {
@@ -162,62 +443,29 @@ async fn list_transactions(
None => (true, true),
};
- let unpaid = params.unpaid.unwrap_or(false);
-
let mut transactions: Vec = Vec::new();
+
if query_invoices {
- let list_invoices = rpc
- .call_typed(&ListinvoicesRequest {
- index: None,
- invstring: None,
- label: None,
- limit: None,
- offer_id: None,
- payment_hash: None,
- start: None,
- })
- .await
- .map_err(|e| nip47::NIP47Error {
- code: nip47::ErrorCode::Internal,
- message: e.to_string(),
- })?
- .invoices;
+ let invoices = collect_invoices(&mut rpc, per_source, from, until, unpaid).await?;
+ transactions.extend(invoices);
- for list_invoice in list_invoices {
- if !unpaid && list_invoice.status == ListinvoicesInvoicesStatus::UNPAID {
- continue;
- }
-
- match make_lookup_response_from_listinvoices(&mut rpc, list_invoice).await {
- Ok(t) => transactions.push(t),
- Err(_e) => (),
- }
+ let hold_client = plugin.state().hold_client.lock().clone();
+ if let Some(mut hold_client) = hold_client {
+ list_holdinvoices_to_transactions(
+ &mut hold_client,
+ &mut rpc,
+ per_source,
+ from,
+ until,
+ &mut transactions,
+ )
+ .await?;
}
}
if query_payments {
- let list_pays = rpc
- .call_typed(&ListpaysRequest {
- bolt11: None,
- index: None,
- limit: None,
- payment_hash: None,
- start: None,
- status: None,
- })
- .await
- .map_err(|e| nip47::NIP47Error {
- code: nip47::ErrorCode::Internal,
- message: e.to_string(),
- })?
- .pays;
-
- for list_pay in list_pays {
- match make_lookup_response_from_listpays(&mut rpc, list_pay).await {
- Ok(t) => transactions.push(t),
- Err(_e) => (),
- }
- }
+ let pays = collect_pays(&mut rpc, per_source, from, until).await?;
+ transactions.extend(pays);
}
transactions.sort_by_key(|t| Reverse(t.created_at));
@@ -240,11 +488,354 @@ async fn list_transactions(
}
}
- transactions = trim_to_size(transactions, 127 * 1024);
+ transactions = trim_to_size(transactions, RESPONSE_LIMIT_BYTES);
Ok(transactions)
}
+async fn max_invoice_created_index(rpc: &mut ClnRpc) -> Result