diff --git a/.cargo/config.toml b/.cargo/config.toml
deleted file mode 100644
index 0f07734..0000000
--- a/.cargo/config.toml
+++ /dev/null
@@ -1,8 +0,0 @@
-[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
deleted file mode 100644
index 083ac61..0000000
--- a/.github/dependabot.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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 3b0ca26..ddffd74 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -17,12 +17,6 @@ on:
tagged-release:
required: true
type: boolean
- python-version-1:
- required: true
- type: string
- python-version-2:
- required: true
- type: string
jobs:
build:
@@ -30,25 +24,27 @@ jobs:
strategy:
fail-fast: false
matrix:
- bitcoind-version: ["31.0"]
+ bitcoind-version: ["29.0"]
experimental: [1]
deprecated: [0]
- python-version: [ "${{ inputs.python-version-1 }}", "${{ inputs.python-version-2 }}"]
- os: ["ubuntu-latest"]
+ python-version: ["3.9", "3.12"]
+ os: ["ubuntu-24.04"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
- uses: actions/checkout@v7
+ uses: actions/checkout@v4
- name: Create cache paths
run: |
- sudo mkdir -p /usr/local/libexec/c-lightning/plugins
+ sudo mkdir /usr/local/libexec
+ sudo mkdir /usr/local/libexec/c-lightning
+ sudo mkdir /usr/local/libexec/c-lightning/plugins
sudo chown -R $USER /usr/local/libexec
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v7
+ uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
@@ -62,104 +58,120 @@ jobs:
echo "OS version: $OS_VERSION"
echo "os_version=$OS_VERSION" >> $GITHUB_OUTPUT
- - name: Restore CLN cache
+ - name: Cache CLN
id: cache-cln
- uses: actions/cache/restore@v6
+ uses: actions/cache@v4
with:
path: |
/usr/local/bin/lightning*
/usr/local/libexec/c-lightning
key: cache-cln-${{ inputs.cln-version }}-${{ steps.exact_versions.outputs.os_version }}
- - name: Restore bitcoind cache
+ - name: Cache bitcoind
id: cache-bitcoind
- uses: actions/cache/restore@v6
+ uses: actions/cache@v4
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@v7
+ - name: Cache python dependencies
+ id: cache-python
+ uses: actions/cache@v4
with:
- enable-cache: true
- cache-dependency-glob: "**/pyproject.toml"
+ path: venv
+ key: cache-python-${{ steps.exact_versions.outputs.python_version }}-${{ steps.exact_versions.outputs.os_version }}-${{ inputs.pyln-version }}-${{ hashFiles('tests/requirements.txt') }}
- name: Download Bitcoin ${{ matrix.bitcoind-version }} & install binaries
if: ${{ steps.cache-bitcoind.outputs.cache-hit != 'true' }}
run: |
export BITCOIND_VERSION=${{ matrix.bitcoind-version }}
- export TARGET_ARCH="x86_64-linux-gnu"
- 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
+ if [[ "${{ matrix.os }}" =~ "ubuntu" ]]; then
+ export TARGET_ARCH="x86_64-linux-gnu"
+ fi
+ if [[ "${{ matrix.os }}" =~ "macos" ]]; then
+ export TARGET_ARCH="x86_64-apple-darwin"
+ fi
+ wget 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 : ${{ 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 }}
-
- name: Download Core Lightning ${{ inputs.cln-version }} & install binaries
if: ${{ contains(matrix.os, 'ubuntu') && steps.cache-cln.outputs.cache-hit != 'true' }}
run: |
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 --tries=5 --waitretry=5 --retry-connrefused --timeout=20 --continue $url
+ wget $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 : ${{ success() && steps.cache-cln.outputs.cache-hit != 'true' }}
- uses: actions/cache/save@v6
- with:
- path: |
- /usr/local/bin/lightning*
- /usr/local/libexec/c-lightning
- 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: Install cargo-binstall
- if: ${{ inputs.tagged-release == false }}
- uses: taiki-e/install-action@cargo-binstall
+ - name: Set up protoc
+ if: ${{ inputs.tagged-release == false}} || contains(matrix.os, 'macos') && ${{ steps.cache-cln.outputs.cache-hit != 'true' }}
+ uses: arduino/setup-protoc@v3
+ with:
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
- - name: Install cargo-msrv
- if: ${{ inputs.tagged-release == false }}
- env:
- GITHUB_TOKEN: ${{ github.token }}
- run: cargo binstall --no-confirm cargo-msrv
+ - name: Checkout Core Lightning ${{ inputs.cln-version }}
+ if: ${{ contains(matrix.os, 'macos') && steps.cache-cln.outputs.cache-hit != 'true' }}
+ uses: actions/checkout@v4
+ with:
+ repository: 'ElementsProject/lightning'
+ path: 'lightning'
+ ref: ${{ inputs.cln-version }}
+ submodules: 'recursive'
- - name: Verify MSRV
- if: ${{ inputs.tagged-release == false }}
- run: cargo msrv verify
+ - name: Install System dependencies
+ run: |
+ if [[ "${{ matrix.os }}" =~ "macos" ]]; then
+ brew install autoconf automake libtool gnu-sed gettext libsodium sqlite
+ fi
+
+ - name: Install Python dependencies
+ if: ${{ steps.cache-python.outputs.cache-hit != 'true' }}
+ run: |
+ python -m venv venv
+ source venv/bin/activate
+ python -m pip install -U pip poetry wheel
+ pip3 install "pyln-proto<=${{ inputs.pyln-version }}" "pyln-client<=${{ inputs.pyln-version }}" "pyln-testing<=${{ inputs.pyln-version }}"
+ pip3 install pytest-xdist pytest-test-groups pytest-timeout
+ if [ -f "tests/requirements.txt" ]; then
+ pip3 install -r tests/requirements.txt
+ fi
+
+ - name: Compile Core Lightning ${{ inputs.cln-version }} & install binaries
+ if: ${{ contains(matrix.os, 'macos') && steps.cache-cln.outputs.cache-hit != 'true' }}
+ run: |
+ export EXPERIMENTAL_FEATURES=${{ matrix.experimental }}
+ export COMPAT=${{ matrix.deprecated }}
+ export VALGRIND=0
+ source venv/bin/activate
+
+ cd lightning
+
+ poetry lock
+ poetry install
+ ./configure --disable-valgrind
+ poetry run make
+ sudo make install
- name: Get plugin binary
run: |
+ source venv/bin/activate
if ${{ inputs.tagged-release }}; then
cd tests
./setup.sh
cd ..
else
if [ -d "proto" ]; then
- uv run python -m grpc_tools.protoc --proto_path="proto" --python_out="tests" --grpc_python_out="tests" proto/*.proto
+ 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
@@ -172,8 +184,5 @@ jobs:
export TRAVIS=1
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
+ source venv/bin/activate
+ pytest -n=5 tests/test_*.py
diff --git a/.github/workflows/latest_v24.08.yml b/.github/workflows/latest_v24.08.yml
new file mode 100644
index 0000000..1db4db9
--- /dev/null
+++ b/.github/workflows/latest_v24.08.yml
@@ -0,0 +1,14 @@
+name: Latest release on CLN v24.08.x
+
+on:
+ release:
+ types: [published, edited]
+ workflow_dispatch:
+
+jobs:
+ call-ci:
+ uses: ./.github/workflows/ci.yml
+ with:
+ cln-version: "v24.08.2"
+ pyln-version: "24.8.2"
+ tagged-release: true
\ No newline at end of file
diff --git a/.github/workflows/latest_v24.11.yml b/.github/workflows/latest_v24.11.yml
new file mode 100644
index 0000000..7174254
--- /dev/null
+++ b/.github/workflows/latest_v24.11.yml
@@ -0,0 +1,14 @@
+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
new file mode 100644
index 0000000..6d8590c
--- /dev/null
+++ b/.github/workflows/latest_v25.02.yml
@@ -0,0 +1,14 @@
+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
new file mode 100644
index 0000000..b5502c9
--- /dev/null
+++ b/.github/workflows/latest_v25.05.yml
@@ -0,0 +1,14 @@
+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
deleted file mode 100644
index d96d48d..0000000
--- a/.github/workflows/latest_v25.09.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-name: Latest release on CLN v25.09.x
-
-on:
- release:
- types: [published, edited]
- workflow_dispatch:
-
-jobs:
- call-ci:
- uses: ./.github/workflows/ci.yml
- with:
- 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
deleted file mode 100644
index 3a86b18..0000000
--- a/.github/workflows/latest_v25.12.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index a0dc3a0..0000000
--- a/.github/workflows/latest_v26.04.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index 27edc2d..0000000
--- a/.github/workflows/latest_v26.06.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-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/master_v26.04.yml b/.github/workflows/main_v24.08.yml
similarity index 61%
rename from .github/workflows/master_v26.04.yml
rename to .github/workflows/main_v24.08.yml
index 82715be..1036fbb 100644
--- a/.github/workflows/master_v26.04.yml
+++ b/.github/workflows/main_v24.08.yml
@@ -1,9 +1,9 @@
-name: master on CLN v26.04.x
+name: main on CLN v24.08.x
on:
push:
branches:
- - master
+ - main
paths-ignore:
- 'tools/**'
- 'CHANGELOG.md'
@@ -19,8 +19,6 @@ jobs:
call-ci:
uses: ./.github/workflows/ci.yml
with:
- cln-version: "v26.04"
- pyln-version: "26.4"
- tagged-release: false
- python-version-1: "3.10"
- python-version-2: "3.12"
+ cln-version: "v24.08.2"
+ pyln-version: "24.8.2"
+ tagged-release: false
\ No newline at end of file
diff --git a/.github/workflows/master_v25.09.yml b/.github/workflows/main_v24.11.yml
similarity index 61%
rename from .github/workflows/master_v25.09.yml
rename to .github/workflows/main_v24.11.yml
index 1a73ecd..7078bd5 100644
--- a/.github/workflows/master_v25.09.yml
+++ b/.github/workflows/main_v24.11.yml
@@ -1,9 +1,9 @@
-name: master on CLN v25.09.x
+name: main on CLN v24.11.x
on:
push:
branches:
- - master
+ - main
paths-ignore:
- 'tools/**'
- 'CHANGELOG.md'
@@ -19,8 +19,6 @@ jobs:
call-ci:
uses: ./.github/workflows/ci.yml
with:
- cln-version: "v25.09.3"
- pyln-version: "25.9.3"
- tagged-release: false
- python-version-1: "3.10"
- python-version-2: "3.12"
+ cln-version: "v24.11.2"
+ pyln-version: "24.11.1"
+ tagged-release: false
\ No newline at end of file
diff --git a/.github/workflows/master_v26.06.yml b/.github/workflows/main_v25.02.yml
similarity index 61%
rename from .github/workflows/master_v26.06.yml
rename to .github/workflows/main_v25.02.yml
index 25fe3a8..1136903 100644
--- a/.github/workflows/master_v26.06.yml
+++ b/.github/workflows/main_v25.02.yml
@@ -1,9 +1,9 @@
-name: master on CLN v26.06.x
+name: main on CLN v25.02.x
on:
push:
branches:
- - master
+ - main
paths-ignore:
- 'tools/**'
- 'CHANGELOG.md'
@@ -19,8 +19,6 @@ jobs:
call-ci:
uses: ./.github/workflows/ci.yml
with:
- cln-version: "v26.06.6"
- pyln-version: "26.6.6"
- tagged-release: false
- python-version-1: "3.10"
- python-version-2: "3.14"
+ cln-version: "v25.02.1"
+ pyln-version: "25.2.1"
+ tagged-release: false
\ No newline at end of file
diff --git a/.github/workflows/master_v25.12.yml b/.github/workflows/main_v25.05.yml
similarity index 61%
rename from .github/workflows/master_v25.12.yml
rename to .github/workflows/main_v25.05.yml
index 7e0ae62..e99fd3f 100644
--- a/.github/workflows/master_v25.12.yml
+++ b/.github/workflows/main_v25.05.yml
@@ -1,9 +1,9 @@
-name: master on CLN v25.12.x
+name: main on CLN v25.05.x
on:
push:
branches:
- - master
+ - main
paths-ignore:
- 'tools/**'
- 'CHANGELOG.md'
@@ -19,8 +19,6 @@ jobs:
call-ci:
uses: ./.github/workflows/ci.yml
with:
- cln-version: "v25.12.1"
- pyln-version: "25.12.1"
- tagged-release: false
- python-version-1: "3.10"
- python-version-2: "3.12"
+ cln-version: "v25.05"
+ pyln-version: "25.5"
+ tagged-release: false
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 39f2ae2..a4fbf8d 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -5,129 +5,77 @@ on:
- 'v*'
jobs:
- 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
+ build:
+ name: build release binaries on ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: ["ubuntu-24.04"]
+ 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 }}
release:
name: Github Release
- needs: [build-linux, build-macos]
- runs-on: "ubuntu-latest"
+ needs: [build]
+ runs-on: "ubuntu-24.04"
permissions:
contents: write
steps:
@@ -135,7 +83,7 @@ jobs:
id: tag_name
run: echo "current_version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
- name: Checkout code
- uses: actions/checkout@v7
+ uses: actions/checkout@v4
- name: Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
@@ -144,7 +92,7 @@ jobs:
version: ${{ steps.tag_name.outputs.current_version }}
path: ./CHANGELOG.md
- name: Download Artifacts
- uses: actions/download-artifact@v8
+ uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Release
@@ -152,6 +100,5 @@ 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-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
+ 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"
diff --git a/.gitignore b/.gitignore
index 9f63775..026fddc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,4 @@
/tests/__pycache__/
/venv/
/result/
-/tests/holdinvoice
-/tests/hold
-/tests/nostr-rs-relay
+/tests/holdinvoice
\ No newline at end of file
diff --git a/.rustfmt.toml b/.rustfmt.toml
deleted file mode 100644
index 9e2662a..0000000
--- a/.rustfmt.toml
+++ /dev/null
@@ -1,4 +0,0 @@
-imports_granularity = "Crate"
-group_imports = "StdExternalCrate"
-imports_layout = "HorizontalVertical"
-unstable_features = true
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e77df0d..96f3e59 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,66 +1,5 @@
# 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
-- If there were failed payment attempts before success the ``payment_sent`` notification might not have been sent
-
-## [0.1.6] 2025-11-10
-
-### Added
-- Include pending and failed payments in ``list_transactions``, now that ``state`` exists wallets can display these more meaningfully
-- Include expired invoices in ``list_transactions``, now that ``state`` exists wallets can display these more meaningfully
-
-### Changed
-- Upgrade ``nostr_sdk`` to ``v0.44`` and implement new fields in sync with the ``nip47`` spec, e.g. ``state`` for transactions
-- Only process events that were created after ``cln-nip47`` started so it does not sent duplicate responses
-
-### Fixed
-- Some minor fixes around ``bolt11`` invoices with 0 amount (aka any amount)
-- Don't ignore `offset` parameter in ``list_transactions``
-- Also add ``notifications`` to the ``info_event``'s ``content`` if enabled to be in line with the spec
-
-## [0.1.5] 2025-07-24
-
-### Changed
-
-- cap `list_transactions` to under 128kB since more can lead to incompatibilities with certain wallets
-
## [0.1.4] 2025-07-24
### Fixed
diff --git a/Cargo.lock b/Cargo.lock
index a6393f7..c3b18e4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,6 +1,21 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
-version = 4
+version = 3
+
+[[package]]
+name = "addr2line"
+version = "0.24.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
+dependencies = [
+ "gimli",
+]
+
+[[package]]
+name = "adler2"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]]
name = "aead"
@@ -25,41 +40,30 @@ dependencies = [
[[package]]
name = "aho-corasick"
-version = "1.1.5"
+version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"
+checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "anyhow"
-version = "1.0.104"
+version = "1.0.98"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"
+checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
[[package]]
name = "arrayvec"
-version = "0.7.8"
+version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-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",
-]
+checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
[[package]]
name = "async-utility"
-version = "0.3.2"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "188f83b9a198af8c336e505611edb00d6d2ac5c694241c5a4f9a12316938cfe9"
+checksum = "a34a3b57207a7a1007832416c3e4862378c8451b4e8e093e436f48c2d3d2c151"
dependencies = [
"futures-util",
"gloo-timers",
@@ -69,37 +73,48 @@ dependencies = [
[[package]]
name = "async-wsocket"
-version = "0.17.0"
+version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c713e1f14c7b82e32ea159af1c6e2f070cfadbdf23fb2512acce9af0a26f1a2"
+checksum = "9a7d8c7d34a225ba919dd9ba44d4b9106d20142da545e086be8ae21d1897e043"
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-waker"
-version = "1.1.2"
+name = "atomic-destructor"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
+checksum = "ef49f5882e4b6afaac09ad239a4f8c70a24b8f2b0897edb1f706008efd109cf4"
[[package]]
-name = "base58ck"
-version = "0.1.101"
+name = "autocfg"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "365c0acd5b2e8dd0111a46c4faea83fb3cfb6e39a49a7c73a06e090db7b2eff0"
+checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
+
+[[package]]
+name = "backtrace"
+version = "0.3.74"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a"
dependencies = [
- "bitcoin_hashes 0.14.101",
+ "addr2line",
+ "cfg-if",
+ "libc",
+ "miniz_oxide",
+ "object",
+ "rustc-demangle",
+ "windows-targets",
]
[[package]]
@@ -109,109 +124,91 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
-name = "bech32"
-version = "0.11.1"
+name = "base64ct"
+version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f"
+checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
[[package]]
name = "bech32"
-version = "0.12.0"
+version = "0.10.0-beta"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "efbd3e1070bbdf4cd88a75264e18e8a26f7cb5c6949eadf0ceb85fb159cf08f8"
+checksum = "98f7eed2b2781a6f0b5c903471d48e15f56fb4e1165df8a9a2337fd1a59d45ea"
+
+[[package]]
+name = "bech32"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d"
[[package]]
name = "bip39"
-version = "2.2.2"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90dbd31c98227229239363921e60fcf5e558e43ec69094d46fc4996f08d1d5bc"
+checksum = "43d193de1f7487df1914d3a568b772458861d33f9c54249612cc2893d6915054"
dependencies = [
- "bitcoin_hashes 0.14.101",
+ "bitcoin_hashes 0.13.0",
"serde",
"unicode-normalization",
]
[[package]]
name = "bitcoin"
-version = "0.32.102"
+version = "0.31.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb0ce8bd5baaa0d303a19915a6d93afed161f528654e42da2a7a97d05c59499a"
-dependencies = [
- "base58ck",
- "bech32 0.11.1",
- "bitcoin-io",
- "bitcoin-units",
- "bitcoin_hashes 0.14.101",
- "hex-conservative 0.2.2",
- "hex_lit",
- "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"
+checksum = "6c85783c2fe40083ea54a33aa2f0ba58831d90fcd190f5bdc47e74e84d2a96ae"
dependencies = [
+ "bech32 0.10.0-beta",
"bitcoin-internals",
- "hex-conservative 1.2.0",
+ "bitcoin_hashes 0.13.0",
+ "hex-conservative 0.1.2",
+ "hex_lit",
+ "secp256k1 0.28.2",
"serde",
]
[[package]]
name = "bitcoin-internals"
-version = "0.6.0"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d573f4cf32996a8dce612e4348cece65a241f1882ed594047c9ba348e8869fa5"
+checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb"
+dependencies = [
+ "serde",
+]
[[package]]
name = "bitcoin-io"
-version = "0.1.101"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb5de036369d1ac59d3c1819ebc4d850f89466f5401c571a285b6ed564a4cb78"
-dependencies = [
- "bitcoin-consensus-encoding",
-]
+checksum = "0b47c4ab7a93edb0c7198c5535ed9b52b63095f4e9b45279c6736cec4b856baf"
[[package]]
-name = "bitcoin-units"
-version = "0.1.101"
+name = "bitcoin_hashes"
+version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9cb95693f371d089a4b5b6fc41c6f3ea6e01ee8c15388335dfac8ea685173b51"
+checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b"
dependencies = [
- "bitcoin-consensus-encoding",
+ "bitcoin-internals",
+ "hex-conservative 0.1.2",
"serde",
]
[[package]]
name = "bitcoin_hashes"
-version = "0.14.101"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bca4c7abb40c8817d77403c880988cfd484f23ab2365726afb2f798363e2c4a2"
+checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16"
dependencies = [
"bitcoin-io",
- "hex-conservative 0.2.2",
- "serde",
-]
-
-[[package]]
-name = "bitcoin_hashes"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5304e53726dbe5f93141535e102ed97b5bf4714fbecefdda8f9fb98d7fdaff0e"
-dependencies = [
- "bitcoin-consensus-encoding",
- "bitcoin-internals",
- "hex-conservative 1.2.0",
+ "hex-conservative 0.2.1",
"serde",
]
[[package]]
name = "bitflags"
-version = "2.13.1"
+version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
+checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
[[package]]
name = "block-buffer"
@@ -233,21 +230,15 @@ dependencies = [
[[package]]
name = "bumpalo"
-version = "3.20.3"
+version = "3.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
-
-[[package]]
-name = "byteorder"
-version = "1.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
+checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
[[package]]
name = "bytes"
-version = "1.12.1"
+version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
+checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
[[package]]
name = "cbc"
@@ -260,19 +251,18 @@ dependencies = [
[[package]]
name = "cc"
-version = "1.4.2"
+version = "1.2.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d262e149917187838d5b42777c8253bcb64500067342904e7d429499a6f277e"
+checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7"
dependencies = [
- "find-msvc-tools",
"shlex",
]
[[package]]
name = "cfg-if"
-version = "1.0.4"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
+checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
[[package]]
name = "chacha20"
@@ -311,35 +301,28 @@ dependencies = [
[[package]]
name = "cln-nip47"
-version = "0.2.0"
+version = "0.1.4"
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.7.0"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9a4bb9c7335040d49c51900305b91155303539e9f54839bb194e915277bf882"
+checksum = "74a0f6827e3c3dfa7f2e92bb0591b5be44c82b945ff88f534857b185810414ce"
dependencies = [
"anyhow",
"bytes",
@@ -356,9 +339,9 @@ dependencies = [
[[package]]
name = "cln-rpc"
-version = "0.7.0"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d9f5e26f0a2713ea1393eb3117c148295fa4c5f7db529713b20323ca7cc37aa"
+checksum = "f4436e58f1fccb1faf69df9ac436ae9304b5c200c7d92e6c4229826bdd0a8d0d"
dependencies = [
"anyhow",
"bitcoin",
@@ -383,19 +366,20 @@ dependencies = [
[[package]]
name = "crypto-common"
-version = "0.1.7"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
+checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
"generic-array",
+ "rand_core 0.6.4",
"typenum",
]
[[package]]
name = "data-encoding"
-version = "2.11.1"
+version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06"
+checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476"
[[package]]
name = "digest"
@@ -405,68 +389,25 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer",
"crypto-common",
+ "subtle",
]
[[package]]
name = "displaydoc"
-version = "0.2.7"
+version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"
+checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
dependencies = [
"proc-macro2",
"quote",
- "syn 3.0.3",
+ "syn",
]
[[package]]
name = "either"
-version = "1.17.0"
+version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-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"
+checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
[[package]]
name = "fnv"
@@ -474,26 +415,20 @@ 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 = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
-
[[package]]
name = "form_urlencoded"
-version = "1.2.2"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
+checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
dependencies = [
"percent-encoding",
]
[[package]]
name = "futures"
-version = "0.3.33"
+version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a88cf1f829d945f548cf8fec32c61b1f202b6d93b45848602fc02af4b12ad218"
+checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
dependencies = [
"futures-channel",
"futures-core",
@@ -506,9 +441,9 @@ dependencies = [
[[package]]
name = "futures-channel"
-version = "0.3.33"
+version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "262590f4fe6afeb0bc83be1daa64e52657fe185690a958af7f3ad0e92085c5ae"
+checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
dependencies = [
"futures-core",
"futures-sink",
@@ -516,15 +451,15 @@ dependencies = [
[[package]]
name = "futures-core"
-version = "0.3.33"
+version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7"
+checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
[[package]]
name = "futures-executor"
-version = "0.3.33"
+version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6754879cc9f2c66f88c6e5c35344bb0bdb0708b0352b1201815667c7eabc7458"
+checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f"
dependencies = [
"futures-core",
"futures-task",
@@ -533,38 +468,38 @@ dependencies = [
[[package]]
name = "futures-io"
-version = "0.3.33"
+version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4577ecaa3c4f96589d473f679a71b596316f6641bc350038b962a5daf0085d7a"
+checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
[[package]]
name = "futures-macro"
-version = "0.3.33"
+version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d6d3cde68c518367be28956066ddfef33813991b77a55005a69dae04bf3b10b"
+checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.119",
+ "syn",
]
[[package]]
name = "futures-sink"
-version = "0.3.33"
+version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e34418ac499d6305c2fb5ad0ed2f6ac998c5f8ca209b4510f7f94242c647e307"
+checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
[[package]]
name = "futures-task"
-version = "0.3.33"
+version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109"
+checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
[[package]]
name = "futures-util"
-version = "0.3.33"
+version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa"
+checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
dependencies = [
"futures-channel",
"futures-core",
@@ -574,6 +509,7 @@ dependencies = [
"futures-task",
"memchr",
"pin-project-lite",
+ "pin-utils",
"slab",
]
@@ -589,38 +525,34 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.2.17"
+version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
+checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
dependencies = [
"cfg-if",
+ "js-sys",
"libc",
- "wasi",
+ "wasi 0.11.1+wasi-snapshot-preview1",
+ "wasm-bindgen",
]
[[package]]
name = "getrandom"
-version = "0.3.4"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
+checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
dependencies = [
"cfg-if",
"libc",
- "r-efi 5.3.0",
- "wasip2",
+ "r-efi",
+ "wasi 0.14.2+wasi-0.2.4",
]
[[package]]
-name = "getrandom"
-version = "0.4.3"
+name = "gimli"
+version = "0.31.1"
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",
-]
+checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
[[package]]
name = "gloo-timers"
@@ -634,65 +566,6 @@ 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"
@@ -701,18 +574,15 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "hex-conservative"
-version = "0.2.2"
+version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fda06d18ac606267c40c04e41b9947729bf8b9efe74bd4e82b61a5f26a510b9f"
-dependencies = [
- "arrayvec",
-]
+checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20"
[[package]]
name = "hex-conservative"
-version = "1.2.0"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "35431185f361ccf3ffc58254628af5f1f5d5f28531da2e02e5d6c82bbc282a10"
+checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd"
dependencies = [
"arrayvec",
]
@@ -723,124 +593,49 @@ 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.5.0"
+version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
+checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565"
dependencies = [
"bytes",
+ "fnv",
"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"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43"
+checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526"
dependencies = [
"displaydoc",
- "potential_utf",
"yoke",
"zerofrom",
"zerovec",
]
[[package]]
-name = "icu_locale_core"
-version = "2.1.1"
+name = "icu_locid"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6"
+checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637"
dependencies = [
"displaydoc",
"litemap",
@@ -850,65 +645,103 @@ dependencies = [
]
[[package]]
-name = "icu_normalizer"
-version = "2.1.1"
+name = "icu_locid_transform"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599"
+checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e"
dependencies = [
+ "displaydoc",
+ "icu_locid",
+ "icu_locid_transform_data",
+ "icu_provider",
+ "tinystr",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_locid_transform_data"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d"
+
+[[package]]
+name = "icu_normalizer"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f"
+dependencies = [
+ "displaydoc",
"icu_collections",
"icu_normalizer_data",
"icu_properties",
"icu_provider",
"smallvec",
+ "utf16_iter",
+ "utf8_iter",
+ "write16",
"zerovec",
]
[[package]]
name = "icu_normalizer_data"
-version = "2.1.1"
+version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a"
+checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7"
[[package]]
name = "icu_properties"
-version = "2.1.2"
+version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec"
+checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5"
dependencies = [
+ "displaydoc",
"icu_collections",
- "icu_locale_core",
+ "icu_locid_transform",
"icu_properties_data",
"icu_provider",
- "zerotrie",
+ "tinystr",
"zerovec",
]
[[package]]
name = "icu_properties_data"
-version = "2.1.2"
+version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af"
+checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2"
[[package]]
name = "icu_provider"
-version = "2.1.1"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614"
+checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9"
dependencies = [
"displaydoc",
- "icu_locale_core",
+ "icu_locid",
+ "icu_provider_macros",
+ "stable_deref_trait",
+ "tinystr",
"writeable",
"yoke",
"zerofrom",
- "zerotrie",
"zerovec",
]
[[package]]
-name = "idna"
-version = "1.1.0"
+name = "icu_provider_macros"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
+checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "idna"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e"
dependencies = [
"idna_adapter",
"smallvec",
@@ -917,24 +750,14 @@ dependencies = [
[[package]]
name = "idna_adapter"
-version = "1.2.1"
+version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344"
+checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71"
dependencies = [
"icu_normalizer",
"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"
@@ -946,28 +769,41 @@ dependencies = [
]
[[package]]
-name = "itertools"
-version = "0.14.0"
+name = "instant"
+version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
+checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222"
dependencies = [
- "either",
+ "cfg-if",
+ "js-sys",
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
+name = "io-uring"
+version = "0.7.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4"
+dependencies = [
+ "bitflags",
+ "cfg-if",
+ "libc",
]
[[package]]
name = "itoa"
-version = "1.0.18"
+version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
+checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
[[package]]
name = "js-sys"
-version = "0.3.104"
+version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a"
+checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
dependencies = [
- "cfg-if",
- "futures-util",
+ "once_cell",
"wasm-bindgen",
]
@@ -979,36 +815,31 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
-version = "0.2.189"
+version = "0.2.174"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
-
-[[package]]
-name = "linux-raw-sys"
-version = "0.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
+checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
[[package]]
name = "litemap"
-version = "0.8.2"
+version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0"
+checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
[[package]]
name = "lock_api"
-version = "0.4.14"
+version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
+checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765"
dependencies = [
+ "autocfg",
"scopeguard",
]
[[package]]
name = "log"
-version = "0.4.33"
+version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
+checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
[[package]]
name = "log-panics"
@@ -1021,41 +852,44 @@ dependencies = [
[[package]]
name = "lru"
-version = "0.18.2"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d2f2f9b4ba7e6b24d95e7e899329d35be83bcded72c8540cdd5368932d1d90a"
+checksum = "9f8cc7106155f10bdf99a6f379688f543ad6596a415375b36a59a054ceda1198"
[[package]]
name = "matchers"
-version = "0.2.0"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9"
+checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
dependencies = [
- "regex-automata",
+ "regex-automata 0.1.10",
]
[[package]]
name = "memchr"
-version = "2.8.3"
+version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
+checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
[[package]]
-name = "mio"
-version = "1.2.2"
+name = "miniz_oxide"
+version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427"
+checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
dependencies = [
- "libc",
- "wasi",
- "windows-sys 0.61.2",
+ "adler2",
]
[[package]]
-name = "multimap"
-version = "0.10.1"
+name = "mio"
+version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084"
+checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c"
+dependencies = [
+ "libc",
+ "wasi 0.11.1+wasi-snapshot-preview1",
+ "windows-sys 0.59.0",
+]
[[package]]
name = "negentropy"
@@ -1065,87 +899,95 @@ checksum = "f0efe882e02d206d8d279c20eb40e03baf7cb5136a1476dc084a324fbc3ec42d"
[[package]]
name = "nostr"
-version = "0.45.1"
+version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5dde8c76076d334409d86c2e1db3e97abe5deb8cb92744f939cbc1fa45bd69e7"
+checksum = "d193102a62a22b61f9a61b9df54fb19ebab8c1763d088fbb9a6f0f57000fba2d"
dependencies = [
"aes",
"base64",
- "bech32 0.12.0",
+ "bech32 0.11.0",
"bip39",
- "bitcoin_hashes 1.2.0",
+ "bitcoin_hashes 0.14.0",
"cbc",
"chacha20",
"chacha20poly1305",
- "faster-hex",
- "opaquerr",
- "rand 0.10.2",
- "secp256k1 0.30.0",
+ "getrandom 0.2.16",
+ "instant",
+ "regex",
+ "scrypt",
+ "secp256k1 0.29.1",
"serde",
"serde_json",
"unicode-normalization",
- "universal-time",
"url",
- "zeroize",
]
[[package]]
name = "nostr-database"
-version = "0.45.1"
+version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4b1fdb9fcba732e32719662afad1b267e50322dbe89e506017ec13f24361bddf"
+checksum = "b6aafe85dc7c039c399796043b76009fa744c3a45ac073a023932f7b7d91b1e7"
dependencies = [
+ "lru",
"nostr",
- "opaquerr",
+ "tokio",
]
[[package]]
-name = "nostr-gossip"
-version = "0.45.0"
+name = "nostr-relay-pool"
+version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa07539e52a71cb91fe0d693facaa298f03fcf9edcd66a521094e18e286e2336"
-dependencies = [
- "nostr",
- "opaquerr",
-]
-
-[[package]]
-name = "nostr-sdk"
-version = "0.45.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26c86342f367bd9b173ec4a697e936e3a82d6dad5b4aa06c0d35d9b4f88a8e72"
+checksum = "df4d5628d2444349570fb185b0c2d92cfdb7e68d62b13bf3e8a4348b5de7430b"
dependencies = [
"async-utility",
"async-wsocket",
- "faster-hex",
- "futures",
+ "atomic-destructor",
"lru",
"negentropy",
"nostr",
"nostr-database",
- "nostr-gossip",
- "opaquerr",
- "rand 0.10.2",
"tokio",
- "tokio-stream",
"tracing",
- "universal-time",
+]
+
+[[package]]
+name = "nostr-sdk"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1e928ba9ac2695fbe10b8aefda59f2abfeb23c10a0e86a0b3e0f6a27bb274a2"
+dependencies = [
+ "async-utility",
+ "nostr",
+ "nostr-database",
+ "nostr-relay-pool",
+ "tokio",
+ "tracing",
]
[[package]]
name = "nu-ansi-term"
-version = "0.50.3"
+version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
+checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
dependencies = [
- "windows-sys 0.61.2",
+ "overload",
+ "winapi",
+]
+
+[[package]]
+name = "object"
+version = "0.36.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87"
+dependencies = [
+ "memchr",
]
[[package]]
name = "once_cell"
-version = "1.21.4"
+version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
+checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "opaque-debug"
@@ -1154,16 +996,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
[[package]]
-name = "opaquerr"
-version = "0.2.0"
+name = "overload"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4f933a4265d5cdad61d19bbdfc972ea5726d56cd8d3d57b8f2d3c365dd42bee9"
+checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]]
name = "parking_lot"
-version = "0.12.5"
+version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
+checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13"
dependencies = [
"lock_api",
"parking_lot_core",
@@ -1171,59 +1013,55 @@ dependencies = [
[[package]]
name = "parking_lot_core"
-version = "0.9.12"
+version = "0.9.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
+checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
- "windows-link",
+ "windows-targets",
+]
+
+[[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"
+version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
-
-[[package]]
-name = "petgraph"
-version = "0.8.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455"
-dependencies = [
- "fixedbitset",
- "hashbrown 0.15.5",
- "indexmap",
-]
-
-[[package]]
-name = "pin-project"
-version = "1.1.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-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",
-]
+checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "pin-project-lite"
-version = "0.2.17"
+version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
+checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
+
+[[package]]
+name = "pin-utils"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "poly1305"
@@ -1236,15 +1074,6 @@ dependencies = [
"universal-hash",
]
-[[package]]
-name = "potential_utf"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564"
-dependencies = [
- "zerovec",
-]
-
[[package]]
name = "ppv-lite86"
version = "0.2.21"
@@ -1254,167 +1083,20 @@ dependencies = [
"zerocopy",
]
-[[package]]
-name = "prettyplease"
-version = "0.2.37"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
-dependencies = [
- "proc-macro2",
- "syn 2.0.119",
-]
-
[[package]]
name = "proc-macro2"
-version = "1.0.107"
+version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
+checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
dependencies = [
"unicode-ident",
]
-[[package]]
-name = "prost"
-version = "0.14.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-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"
+version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
+checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
@@ -1425,17 +1107,11 @@ version = "5.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
-[[package]]
-name = "r-efi"
-version = "6.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
-
[[package]]
name = "rand"
-version = "0.8.7"
+version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22f6172bdec972074665ed81ed53b71da00bfc44b65a753cfde883ec4c702a1a"
+checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha 0.3.1",
@@ -1444,22 +1120,12 @@ dependencies = [
[[package]]
name = "rand"
-version = "0.9.5"
+version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41"
+checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
dependencies = [
"rand_chacha 0.9.0",
- "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",
+ "rand_core 0.9.3",
]
[[package]]
@@ -1479,7 +1145,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
dependencies = [
"ppv-lite86",
- "rand_core 0.9.5",
+ "rand_core 0.9.3",
]
[[package]]
@@ -1488,61 +1154,70 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
- "getrandom 0.2.17",
+ "getrandom 0.2.16",
]
[[package]]
name = "rand_core"
-version = "0.9.5"
+version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
+checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
dependencies = [
- "getrandom 0.3.4",
+ "getrandom 0.3.3",
]
-[[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"
+version = "0.5.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
+checksum = "7e8af0dde094006011e6a740d4879319439489813bd0bcdc7d821beaeeff48ec"
dependencies = [
"bitflags",
]
[[package]]
name = "regex"
-version = "1.13.1"
+version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"
+checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
dependencies = [
"aho-corasick",
"memchr",
- "regex-automata",
- "regex-syntax",
+ "regex-automata 0.4.9",
+ "regex-syntax 0.8.5",
]
[[package]]
name = "regex-automata"
-version = "0.4.18"
+version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
+checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
+dependencies = [
+ "regex-syntax 0.6.29",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.4.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
dependencies = [
"aho-corasick",
"memchr",
- "regex-syntax",
+ "regex-syntax 0.8.5",
]
[[package]]
name = "regex-syntax"
-version = "0.8.11"
+version = "0.6.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
+checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
+
+[[package]]
+name = "regex-syntax"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "ring"
@@ -1552,32 +1227,24 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
dependencies = [
"cc",
"cfg-if",
- "getrandom 0.2.17",
+ "getrandom 0.2.16",
"libc",
"untrusted",
"windows-sys 0.52.0",
]
[[package]]
-name = "rustix"
-version = "1.1.4"
+name = "rustc-demangle"
+version = "0.1.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
-dependencies = [
- "bitflags",
- "errno",
- "libc",
- "linux-raw-sys",
- "windows-sys 0.61.2",
-]
+checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f"
[[package]]
name = "rustls"
-version = "0.23.43"
+version = "0.23.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06"
+checksum = "2491382039b29b9b11ff08b76ff6c97cf287671dbb74f0be44bda389fffe9bd1"
dependencies = [
- "log",
"once_cell",
"ring",
"rustls-pki-types",
@@ -1588,18 +1255,18 @@ dependencies = [
[[package]]
name = "rustls-pki-types"
-version = "1.15.1"
+version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96"
+checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79"
dependencies = [
"zeroize",
]
[[package]]
name = "rustls-webpki"
-version = "0.103.13"
+version = "0.103.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e"
+checksum = "0a17884ae0c1b773f1ccd2bd4a8c72f16da897310a98b0e84bf349ad5ead92fc"
dependencies = [
"ring",
"rustls-pki-types",
@@ -1608,9 +1275,24 @@ dependencies = [
[[package]]
name = "rustversion"
-version = "1.0.23"
+version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
+checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d"
+
+[[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",
+]
[[package]]
name = "scopeguard"
@@ -1619,25 +1301,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
-name = "secp256k1"
-version = "0.29.1"
+name = "scrypt"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113"
+checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f"
dependencies = [
- "bitcoin_hashes 0.14.101",
- "secp256k1-sys",
+ "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.30.0"
+version = "0.29.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b50c5943d326858130af85e049f2661ba3c78b26589b8ab98e65e80ae44a1252"
+checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113"
dependencies = [
- "bitcoin_hashes 0.14.101",
- "rand 0.8.7",
- "secp256k1-sys",
+ "rand 0.8.5",
+ "secp256k1-sys 0.10.1",
+ "serde",
+]
+
+[[package]]
+name = "secp256k1-sys"
+version = "0.9.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb"
+dependencies = [
+ "cc",
]
[[package]]
@@ -1651,52 +1354,52 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.229"
+version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
-dependencies = [
- "serde_core",
- "serde_derive",
-]
-
-[[package]]
-name = "serde_core"
-version = "1.0.229"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
+checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.229"
+version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
+checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
dependencies = [
"proc-macro2",
"quote",
- "syn 3.0.3",
+ "syn",
]
[[package]]
name = "serde_json"
-version = "1.0.151"
+version = "1.0.141"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
+checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3"
dependencies = [
"itoa",
"memchr",
+ "ryu",
"serde",
- "serde_core",
- "zmij",
]
[[package]]
name = "sha1"
-version = "0.10.7"
+version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8"
+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"
dependencies = [
"cfg-if",
"cpufeatures",
@@ -1714,37 +1417,37 @@ dependencies = [
[[package]]
name = "shlex"
-version = "2.0.1"
+version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "slab"
-version = "0.4.12"
+version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
+checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d"
[[package]]
name = "smallvec"
-version = "1.15.2"
+version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
+checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "socket2"
-version = "0.6.5"
+version = "0.5.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
+checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678"
dependencies = [
"libc",
- "windows-sys 0.61.2",
+ "windows-sys 0.52.0",
]
[[package]]
name = "stable_deref_trait"
-version = "1.2.1"
+version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
+checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "subtle"
@@ -1754,32 +1457,15 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "syn"
-version = "2.0.119"
+version = "2.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
+checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
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"
@@ -1788,20 +1474,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
dependencies = [
"proc-macro2",
"quote",
- "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",
+ "syn",
]
[[package]]
@@ -1815,11 +1488,11 @@ dependencies = [
[[package]]
name = "thiserror"
-version = "2.0.20"
+version = "2.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"
+checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
dependencies = [
- "thiserror-impl 2.0.20",
+ "thiserror-impl 2.0.12",
]
[[package]]
@@ -1830,34 +1503,34 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.119",
+ "syn",
]
[[package]]
name = "thiserror-impl"
-version = "2.0.20"
+version = "2.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
+checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
dependencies = [
"proc-macro2",
"quote",
- "syn 3.0.3",
+ "syn",
]
[[package]]
name = "thread_local"
-version = "1.1.10"
+version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070"
+checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"
dependencies = [
"cfg-if",
]
[[package]]
name = "tinystr"
-version = "0.8.3"
+version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d"
+checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f"
dependencies = [
"displaydoc",
"zerovec",
@@ -1865,9 +1538,9 @@ dependencies = [
[[package]]
name = "tinyvec"
-version = "1.12.0"
+version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f"
+checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71"
dependencies = [
"tinyvec_macros",
]
@@ -1880,44 +1553,38 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
-version = "1.53.1"
+version = "1.46.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed"
+checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17"
dependencies = [
+ "backtrace",
"bytes",
+ "io-uring",
"libc",
"mio",
"pin-project-lite",
+ "slab",
"socket2",
"tokio-macros",
- "windows-sys 0.61.2",
-]
-
-[[package]]
-name = "tokio-happy-eyeballs"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8564c32dfb6f4257f8bc6edfc178a34af97520e0b7b9815500c55eb3d092f29f"
-dependencies = [
- "tokio",
+ "windows-sys 0.52.0",
]
[[package]]
name = "tokio-macros"
-version = "2.7.2"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"
+checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
dependencies = [
"proc-macro2",
"quote",
- "syn 3.0.3",
+ "syn",
]
[[package]]
name = "tokio-rustls"
-version = "0.26.4"
+version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61"
+checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b"
dependencies = [
"rustls",
"tokio",
@@ -1925,9 +1592,9 @@ dependencies = [
[[package]]
name = "tokio-socks"
-version = "0.5.3"
+version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a7e2948f60dbe26b35f2c7fb74ac2854c1fddded0fe9d7548fcc674a246f7615"
+checksum = "0d4770b8024672c1101b3f6733eab95b18007dbe0847a8afe341fcf79e06043f"
dependencies = [
"either",
"futures-util",
@@ -1937,21 +1604,20 @@ dependencies = [
[[package]]
name = "tokio-stream"
-version = "0.1.19"
+version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b"
+checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047"
dependencies = [
"futures-core",
"pin-project-lite",
"tokio",
- "tokio-util",
]
[[package]]
name = "tokio-tungstenite"
-version = "0.28.0"
+version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d25a406cddcc431a75d3d9afc6a7c0f7428d4891dd973e4d54c56b46127bf857"
+checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084"
dependencies = [
"futures-util",
"log",
@@ -1965,122 +1631,22 @@ dependencies = [
[[package]]
name = "tokio-util"
-version = "0.7.19"
+version = "0.7.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52"
+checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
- "libc",
"pin-project-lite",
"tokio",
]
-[[package]]
-name = "tonic"
-version = "0.14.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-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"
+version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
+checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
dependencies = [
"log",
"pin-project-lite",
@@ -2090,20 +1656,20 @@ dependencies = [
[[package]]
name = "tracing-attributes"
-version = "0.1.31"
+version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
+checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.119",
+ "syn",
]
[[package]]
name = "tracing-core"
-version = "0.1.36"
+version = "0.1.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
+checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
dependencies = [
"once_cell",
"valuable",
@@ -2122,14 +1688,14 @@ dependencies = [
[[package]]
name = "tracing-subscriber"
-version = "0.3.23"
+version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319"
+checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008"
dependencies = [
"matchers",
"nu-ansi-term",
"once_cell",
- "regex-automata",
+ "regex",
"sharded-slab",
"smallvec",
"thread_local",
@@ -2138,54 +1704,42 @@ dependencies = [
"tracing-log",
]
-[[package]]
-name = "try-lock"
-version = "0.2.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
-
[[package]]
name = "tungstenite"
-version = "0.28.0"
+version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8628dcc84e5a09eb3d8423d6cb682965dea9133204e8fb3efee74c2a0c259442"
+checksum = "4793cb5e56680ecbb1d843515b23b6de9a75eb04b66643e256a396d43be33c13"
dependencies = [
"bytes",
"data-encoding",
"http",
"httparse",
"log",
- "rand 0.9.5",
+ "rand 0.9.2",
"rustls",
"rustls-pki-types",
"sha1",
- "thiserror 2.0.20",
+ "thiserror 2.0.12",
"utf-8",
]
[[package]]
name = "typenum"
-version = "1.20.1"
+version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
-
-[[package]]
-name = "unicase"
-version = "2.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"
+checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
[[package]]
name = "unicode-ident"
-version = "1.0.24"
+version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
+checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
name = "unicode-normalization"
-version = "0.1.25"
+version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8"
+checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
dependencies = [
"tinyvec",
]
@@ -2200,12 +1754,6 @@ 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"
@@ -2214,15 +1762,14 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "url"
-version = "2.5.8"
+version = "2.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
+checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60"
dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
"serde",
- "serde_derive",
]
[[package]]
@@ -2231,6 +1778,12 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
+[[package]]
+name = "utf16_iter"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246"
+
[[package]]
name = "utf8_iter"
version = "1.0.4"
@@ -2239,11 +1792,11 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]]
name = "uuid"
-version = "1.24.0"
+version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bf3923a6f5c4c6382e0b653c4117f48d631ea17f38ed86e2a828e6f7412f5239"
+checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d"
dependencies = [
- "getrandom 0.4.3",
+ "getrandom 0.3.3",
"js-sys",
"wasm-bindgen",
]
@@ -2260,15 +1813,6 @@ 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"
@@ -2276,42 +1820,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]]
-name = "wasip2"
-version = "1.0.1+wasi-0.2.4"
+name = "wasi"
+version = "0.14.2+wasi-0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7"
+checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
dependencies = [
- "wit-bindgen",
+ "wit-bindgen-rt",
]
[[package]]
name = "wasm-bindgen"
-version = "0.2.127"
+version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70"
+checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
dependencies = [
"cfg-if",
"once_cell",
"rustversion",
"wasm-bindgen-macro",
+]
+
+[[package]]
+name = "wasm-bindgen-backend"
+version = "0.2.100"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
+dependencies = [
+ "bumpalo",
+ "log",
+ "proc-macro2",
+ "quote",
+ "syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.77"
+version = "0.4.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6b7777d5cc23d0e91404e53ce2d5e8ec7acae3026b16233dba62cd3246457950"
+checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61"
dependencies = [
+ "cfg-if",
"js-sys",
+ "once_cell",
"wasm-bindgen",
+ "web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.127"
+version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1"
+checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -2319,31 +1879,31 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.127"
+version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284"
+checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
dependencies = [
- "bumpalo",
"proc-macro2",
"quote",
- "syn 2.0.119",
+ "syn",
+ "wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.127"
+version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf"
+checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
dependencies = [
"unicode-ident",
]
[[package]]
name = "web-sys"
-version = "0.3.104"
+version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c435338968042f4f59a557f690a253676d47ce13ceb55d70100e7facf6620a30"
+checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -2355,23 +1915,39 @@ version = "0.26.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
dependencies = [
- "webpki-roots 1.0.9",
+ "webpki-roots 1.0.2",
]
[[package]]
name = "webpki-roots"
-version = "1.0.9"
+version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a"
+checksum = "7e8983c3ab33d6fb807cfcdad2491c4ea8cbc8ed839181c7dfd9c67c83e261b2"
dependencies = [
"rustls-pki-types",
]
[[package]]
-name = "windows-link"
-version = "0.2.1"
+name = "winapi"
+version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
@@ -2384,11 +1960,11 @@ dependencies = [
[[package]]
name = "windows-sys"
-version = "0.61.2"
+version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
- "windows-link",
+ "windows-targets",
]
[[package]]
@@ -2456,23 +2032,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
-name = "wit-bindgen"
-version = "0.46.0"
+name = "wit-bindgen-rt"
+version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
+checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
+dependencies = [
+ "bitflags",
+]
+
+[[package]]
+name = "write16"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936"
[[package]]
name = "writeable"
-version = "0.6.3"
+version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
+checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
[[package]]
name = "yoke"
-version = "0.8.3"
+version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
+checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40"
dependencies = [
+ "serde",
"stable_deref_trait",
"yoke-derive",
"zerofrom",
@@ -2480,79 +2066,68 @@ dependencies = [
[[package]]
name = "yoke-derive"
-version = "0.8.2"
+version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
+checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.119",
+ "syn",
"synstructure",
]
[[package]]
name = "zerocopy"
-version = "0.8.56"
+version = "0.8.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "556764e583adb45a9f8d413c2a147fa7e8d821e48e12b14fd560b607998b75eb"
+checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
-version = "0.8.56"
+version = "0.8.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2ab42fc20575779bd240faa45f94a74256f755c0fa9e89f0ede20d91d0cdfc1"
+checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.119",
+ "syn",
]
[[package]]
name = "zerofrom"
-version = "0.1.8"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
+checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e"
dependencies = [
"zerofrom-derive",
]
[[package]]
name = "zerofrom-derive"
-version = "0.1.7"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
+checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.119",
+ "syn",
"synstructure",
]
[[package]]
name = "zeroize"
-version = "1.9.0"
+version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e"
-
-[[package]]
-name = "zerotrie"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf"
-dependencies = [
- "displaydoc",
- "yoke",
- "zerofrom",
-]
+checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
[[package]]
name = "zerovec"
-version = "0.11.6"
+version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239"
+checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079"
dependencies = [
"yoke",
"zerofrom",
@@ -2561,17 +2136,11 @@ dependencies = [
[[package]]
name = "zerovec-derive"
-version = "0.11.3"
+version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555"
+checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.119",
+ "syn",
]
-
-[[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 a21e37a..258d24c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,8 +1,8 @@
[package]
name = "cln-nip47"
-version = "0.2.0"
-edition = "2024"
-rust-version = "1.85.0"
+version = "0.1.4"
+edition = "2021"
+rust-version = "1.75"
[dependencies]
anyhow = "1"
@@ -12,22 +12,14 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["fs", "sync", "rt-multi-thread"] }
-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" }
+cln-rpc = "0.4"
+# cln-rpc = { path="../../lightning/cln-rpc/", version = "^0.4" }
+cln-plugin = "0.4"
+# cln-plugin = { path="../../lightning/plugins/", version = "^0.4" }
parking_lot = "0.12"
-# # 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"
+# nostr-sdk = { git = "https://github.com/rust-nostr/nostr.git", rev = "f7122f5", features = ["nip47", "nip04", "nip44"]}
+nostr-sdk = { version = "0.42", features = ["nip47", "nip04", "nip44"] }
uuid = { version = "1", features = ["v4"] }
@@ -35,18 +27,6 @@ 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 5556fd0..2de2927 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). It is intended to be used by a single user, since all notifications got to all NWC's.
+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).
* [Installation](#installation)
* [Building](#building)
@@ -64,10 +64,11 @@ 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:
@@ -84,7 +85,7 @@ cargo build --release
After that the binary will be here: ``target/release/cln-nip47``
-Note: Release binaries are built with the ``optimized`` profile.
+Note: Release binaries are built using ``cross`` and the ``optimized`` profile.
# Documentation
@@ -97,12 +98,7 @@ 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. 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-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-notifications``: Enable/disable nip47 notifications. Default is enabled (``true``)
## Methods
@@ -131,26 +127,21 @@ 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)
-* [NIP-44v2](https://github.com/nostr-protocol/nips/blob/master/44.md)
+* [NIP-44v2](https://github.com/nostr-protocol/nips/blob/master/44.md)
\ No newline at end of file
diff --git a/SECURITY.md b/SECURITY.md
deleted file mode 100644
index 9b5fbd8..0000000
--- a/SECURITY.md
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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
deleted file mode 100644
index 04c8cef..0000000
--- a/build.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-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 fa75d76..2221faf 100644
--- a/coffee.yml
+++ b/coffee.yml
@@ -1,6 +1,6 @@
plugin:
name: cln-nip47
- version: 0.2.0
+ version: 0.1.4
lang: rust
install: |
cargo build --release && cp target/release/cln-nip47 . && cargo clean
diff --git a/flake.lock b/flake.lock
index 87c96f0..4df37d2 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,12 +1,17 @@
{
"nodes": {
"crane": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
"locked": {
- "lastModified": 1755993354,
- "narHash": "sha256-FCRRAzSaL/+umLIm3RU3O/+fJ2ssaPHseI2SSFL8yZU=",
+ "lastModified": 1721058578,
+ "narHash": "sha256-fs/PVa3H5dS1//4BjecWi3nitXm5fRObx0JxXIAo+JA=",
"owner": "ipetkov",
"repo": "crane",
- "rev": "25bd41b24426c7734278c2ff02e53258851db914",
+ "rev": "17e5109bb1d9fb393d70fba80988f7d70d1ded1a",
"type": "github"
},
"original": {
@@ -20,11 +25,11 @@
"systems": "systems"
},
"locked": {
- "lastModified": 1731533236,
- "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+ "lastModified": 1710146030,
+ "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
- "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+ "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
@@ -35,11 +40,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1756159630,
- "narHash": "sha256-ohMvsjtSVdT/bruXf5ClBh8ZYXRmD4krmjKrXhEvwMg=",
+ "lastModified": 1721116560,
+ "narHash": "sha256-++TYlGMAJM1Q+0nMVaWBSEvEUjRs7ZGiNQOpqbQApCU=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "84c256e42600cb0fdf25763b48d28df2f25a0c8b",
+ "rev": "9355fa86e6f27422963132c2c9aeedb0fb963d93",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
index 247270f..a533264 100644
--- a/flake.nix
+++ b/flake.nix
@@ -4,7 +4,10 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
- crane.url = "github:ipetkov/crane";
+ crane = {
+ url = "github:ipetkov/crane";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
flake-utils.url = "github:numtide/flake-utils";
};
diff --git a/protos/hold.proto b/protos/hold.proto
deleted file mode 100644
index e7ad240..0000000
--- a/protos/hold.proto
+++ /dev/null
@@ -1,185 +0,0 @@
-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 1c3323a..dd6ded4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,41 +1,23 @@
-use std::{
- path::{Path, PathBuf},
- str::FromStr,
- time::Duration,
-};
+use std::{path::Path, time::Duration};
use anyhow::anyhow;
use cln_plugin::{
- Builder,
- Plugin,
options::{ConfigOption, DefaultBooleanConfigOption, StringArrayConfigOption},
+ Builder, Plugin,
};
-use cln_rpc::{
- ClnRpc,
- model::{
- requests::{DecodeRequest, ListdatastoreRequest},
- responses::DecodeType,
- },
-};
-use nostr::nips::nip47;
+use cln_rpc::{model::requests::ListdatastoreRequest, ClnRpc};
+
+use nostr_sdk::*;
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;
mod nwc_info;
mod nwc_invoice;
mod nwc_keysend;
@@ -48,11 +30,6 @@ mod structs;
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",
"Nostr relays used for nwc. Can be stated multiple times.",
@@ -63,35 +40,31 @@ 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_OR_RECEIVE_METHODS: [nip47::Method; 5] = [
- nip47::Method::MakeInvoice,
- nip47::Method::LookupInvoice,
- nip47::Method::ListTransactions,
- nip47::Method::GetBalance,
- nip47::Method::GetInfo,
+pub const WALLET_READ_METHODS: [&str; 5] = [
+ "make_invoice",
+ "lookup_invoice",
+ "list_transactions",
+ "get_balance",
+ "get_info",
];
-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_ALL_METHODS: [&str; 9] = [
+ "pay_invoice",
+ "multi_pay_invoice",
+ "pay_keysend",
+ "multi_pay_keysend",
+ WALLET_READ_METHODS[0],
+ WALLET_READ_METHODS[1],
+ WALLET_READ_METHODS[2],
+ WALLET_READ_METHODS[3],
+ WALLET_READ_METHODS[4],
];
-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> {
- unsafe {
- std::env::set_var(
- "CLN_PLUGIN_LOG",
- "cln_plugin=info,cln_rpc=info,cln_nip47=trace,info",
- );
- };
+ std::env::set_var(
+ "CLN_PLUGIN_LOG",
+ "cln_plugin=info,cln_rpc=info,cln_nip47=debug,info",
+ );
log_panics::init();
let state;
@@ -117,13 +90,13 @@ async fn main() -> Result<(), anyhow::Error> {
Ok(state) => state,
Err(e) => {
return plugin
- .disable(format!("Error connecting to cln rpc: {e}").as_str())
+ .disable(format!("Error connecting to cln rpc: {}", e).as_str())
.await;
}
};
match read_startup_options(&plugin, &state).await {
Ok(()) => &(),
- Err(e) => return plugin.disable(format!("{e}").as_str()).await,
+ Err(e) => return plugin.disable(format!("{}", e).as_str()).await,
};
log::debug!("read startup options done");
plugin
@@ -132,25 +105,15 @@ 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;
// Make sure incase of rapid nip47-create and plugin restarts info_events
// have a different timestamp and therefore ID so relays don't disconnect us
- time::sleep(Duration::from_secs(STARTUP_DELAY)).await;
+ time::sleep(Duration::from_secs(1)).await;
match load_nwcs(plugin.clone(), &mut rpc).await {
- Ok(()) => log::info!("All NWC's loaded"),
+ Ok(_) => log::info!("All NWC's loaded"),
Err(e) => {
println!(
"{}",
@@ -163,16 +126,6 @@ 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
}
@@ -181,8 +134,8 @@ async fn shutdown_handler(
_args: serde_json::Value,
) -> Result<(), anyhow::Error> {
let mut locked_handles = plugin.state().handles.lock().await;
- for (_x, wallet_service) in locked_handles.drain() {
- wallet_service.client.shutdown().await;
+ for (_x, (client, _client_pubkey)) in locked_handles.drain() {
+ client.shutdown().await;
}
std::process::exit(0)
}
@@ -193,7 +146,7 @@ async fn load_nwcs(plugin: Plugin, rpc: &mut ClnRpc) -> Result<(),
key: Some(vec![PLUGIN_NAME.to_owned()]),
})
.await?;
- for datastore in labels.datastore {
+ for datastore in labels.datastore.into_iter() {
let label = datastore.key.last().unwrap();
let mut nwc_store = load_nwc_store(rpc, label).await?;
@@ -206,186 +159,7 @@ 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 dfd0e2c..338ddad 100644
--- a/src/nwc.rs
+++ b/src/nwc.rs
@@ -1,75 +1,63 @@
use std::time::Duration;
+use crate::nwc_balance::get_balance;
+use crate::nwc_info::get_info;
+use crate::nwc_invoice::make_invoice;
+use crate::nwc_keysend::{multi_pay_keysend, pay_keysend};
+use crate::nwc_lookups::{list_transactions, lookup_invoice};
+use crate::nwc_pay::{multi_pay_invoice, pay_invoice};
+use crate::structs::{NwcStore, PluginState};
+use crate::tasks::budget_task;
+use crate::util::is_read_only_nwc;
+use crate::{OPT_NOTIFICATIONS, WALLET_ALL_METHODS, WALLET_READ_METHODS};
use anyhow::anyhow;
use cln_plugin::Plugin;
-use futures::StreamExt;
-use nostr::{
- event::{Event, EventBuilder, EventId, FinalizeEventAsync, Kind, Tag},
- filter::Filter,
- key::{Keys, PublicKey, SecretKey},
- nips::{nip04, nip44, nip47},
- types::Timestamp,
-};
-use nostr_sdk::{
- client::{self, Client, ClientNotification},
- error::Error,
- relay::RelayStatus,
-};
+use nostr_sdk::nips::*;
+use nostr_sdk::Client;
+use nostr_sdk::*;
+use tokio::sync::oneshot;
use tokio::time;
-use crate::{
- OPT_NOTIFICATIONS,
- nwc_balance::get_balance_response,
- nwc_hold::{
- cancel_hold_invoice_response,
- make_hold_invoice_response,
- settle_hold_invoice_response,
- },
- nwc_info::get_info_response,
- nwc_invoice::make_invoice_response,
- nwc_keysend::pay_keysend_response,
- nwc_lookups::{list_transactions_response, lookup_invoice_response},
- 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<(), Error> {
- let (method_capabilities, _) = build_capabilities(is_read_only_nwc(&nwc_store), &plugin);
+) -> Result<(), client::Error> {
+ let capabilities = if is_read_only_nwc(&nwc_store) {
+ WALLET_READ_METHODS.join(" ")
+ } else {
+ WALLET_ALL_METHODS.join(" ")
+ };
- let wallet_keys = Keys::new(SecretKey::from_hex(&nwc_store.walletkey)?);
- let client_keys = Keys::new(nwc_store.uri.secret.clone());
+ 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 nostr_client = Client::new();
+ let client = Client::new(wallet_keys.clone());
log::debug!("relay_count:{}", nwc_store.uri.relays.len());
- for relay in &nwc_store.uri.relays {
- log::debug!("Adding relay: {relay}");
- nostr_client.add_relay(relay).await?;
+ for relay in nwc_store.uri.relays.iter() {
+ log::debug!("Adding relay: {}", relay);
+ client.add_relay(relay).await?;
}
if nwc_store.interval_config.is_some() {
- log::debug!("NWC {label} uses an interval budget");
+ start_nwc_budget_job(plugin.clone(), label.clone());
}
- let nostr_client_clone = nostr_client.clone();
+ let client_clone = 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 {
- nostr_client_clone
- .connect()
- .and_wait(Duration::from_secs(30))
+ client_clone.connect().await;
+ client_clone
+ .wait_for_connection(Duration::from_secs(30))
.await;
- let relays = nostr_client_clone.relays().await;
+ let relays = client_clone.relays().await;
if relays.is_empty() {
log::info!("No more relays left, we probably shut down. Exiting...");
break;
@@ -79,7 +67,7 @@ pub async fn run_nwc(
if relay.status() == RelayStatus::Connected {
connected = true;
} else {
- log::info!("Could not connect to {url}");
+ log::info!("Could not connect to {}", url)
}
}
if !connected {
@@ -89,101 +77,90 @@ pub async fn run_nwc(
}
if let Err(e) = send_nwc_info_event(
- plugin_clone.clone(),
- nostr_client_clone.clone(),
- method_capabilities.clone(),
- wallet_keys_clone.clone(),
+ client_clone.clone(),
+ plugin_clone.option(&OPT_NOTIFICATIONS).unwrap(),
+ capabilities.clone(),
+ wallet_keys.clone(),
)
.await
{
- log::warn!("{e}");
- nostr_client_clone.disconnect().await;
+ log::warn!("{}", e);
+ client_clone.disconnect().await;
time::sleep(Duration::from_secs(5)).await;
continue;
}
let filter = Filter::new()
.kind(Kind::WalletConnectRequest)
- .author(client_keys_clone.public_key());
+ .author(client_pubkey);
- let mut notifications = nostr_client_clone.notifications();
+ 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;
+ };
- 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;
- }
- }
-
- 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(),
- )
+ 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,
+ )
+ })
.await
- {
- log::warn!("NWC handler for `{label_clone}` had an error: {e}");
+ {
+ Ok(()) => {
+ log::info!("NWC handler for `{}` stopped", label_clone);
+ break;
}
- }
-
- {};
+ Err(e) => log::warn!("NWC handler for `{}` had an error: {}", label_clone, e),
+ };
}
});
let mut locked_handles = plugin.state().handles.lock().await;
- let wallet_service = WalletService {
- client: nostr_client,
- client_pubkey: client_keys.public_key(),
- wallet_secret: wallet_keys,
- };
- locked_handles.insert(label.clone(), wallet_service);
+ locked_handles.insert(
+ label.clone(),
+ (client, Keys::new(nwc_store.uri.secret).public_key()),
+ );
Ok(())
}
pub async fn send_nwc_info_event(
- plugin: Plugin,
client: Client,
+ notifications: bool,
capabilities: String,
wallet_keys: Keys,
) -> Result<(), anyhow::Error> {
- let mut capabilities = capabilities;
- if plugin.option(&OPT_NOTIFICATIONS).unwrap() {
- capabilities.push_str(" notifications");
- }
- let mut info_event_builder = EventBuilder::new(Kind::WalletConnectInfo, capabilities)
+ let mut info_event_builder = EventBuilder::new(Kind::WalletConnectInfo, capabilities.clone())
.tag(Tag::parse(vec!["encryption", "nip44_v2 nip04"]).unwrap());
- if plugin.option(&OPT_NOTIFICATIONS).unwrap() {
- let notification_capabilities = build_notifications_vec(&plugin).join(" ");
+ if notifications {
info_event_builder = info_event_builder
- .tag(Tag::parse(vec!["notifications", ¬ification_capabilities]).unwrap());
+ .tag(Tag::parse(vec!["notifications", "payment_received payment_sent"]).unwrap())
}
- let info_event = match info_event_builder.finalize_async(&wallet_keys).await {
+ let info_event = match info_event_builder.sign_with_keys(&wallet_keys) {
Ok(o) => o,
Err(e) => {
- return Err(anyhow!("Could not sign info_event! {e}"));
+ return Err(anyhow!("Could not sign info_event! {}", e));
}
};
- log::debug!("info_event:{info_event:?}");
+ log::debug!("info_event:{:?}", info_event);
let send_result = match client.send_event(&info_event).await {
Ok(o) => o,
Err(e) => {
- return Err(anyhow!("Could not send info_event! {e}"));
+ return Err(anyhow!("Could not send info_event! {}", e));
}
};
if send_result.success.is_empty() {
@@ -201,123 +178,306 @@ 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(wallet_service) = locked_handles.remove(label) {
- wallet_service.client.shutdown().await;
+ if let Some((client, _client_pubkey)) = locked_handles.remove(label) {
+ client.shutdown().await;
+ }
+
+ stop_nwc_budget_job(plugin.clone(), 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(());
}
}
-#[allow(clippy::too_many_lines)]
async fn nwc_request_handler(
- notification: ClientNotification,
- nostr_client: &client::Client,
- plugin: &Plugin,
- label: &str,
- wallet_keys: &Keys,
+ notification: RelayPoolNotification,
+ client: client::Client,
+ plugin: Plugin,
+ label: String,
+ wallet_keys: Keys,
client_pubkey: PublicKey,
-) -> Result<(), Box> {
+) -> Result {
let (relay_url, subscription_id, event) = match notification {
- ClientNotification::Event {
+ RelayPoolNotification::Event {
relay_url,
subscription_id,
event,
} => (relay_url, subscription_id, event),
- ClientNotification::Message {
+ RelayPoolNotification::Message {
relay_url: _,
message: _,
- }
- | ClientNotification::Shutdown => return Ok(()),
+ } => return Ok(false),
+ RelayPoolNotification::Shutdown => return Ok(true),
};
- 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 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?;
+ if let Some(expi) = event.tags.expiration() {
+ if *expi < Timestamp::now() {
+ return Ok(false);
}
-
- 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
+ }
+ log::debug!(
+ "relay_url:{} subscription_id:{} {:?}",
+ relay_url,
+ subscription_id,
+ event
+ );
+ let use_nip44;
+ let content = match nip44::decrypt(wallet_keys.secret_key(), &client_pubkey, &event.content) {
+ Ok(o) => {
+ use_nip44 = true;
+ o
+ }
+ Err(e) => {
+ log::debug!("Could not decrypt using NIP-44:{}. Trying NIP-04", e);
+ match nip04::decrypt(wallet_keys.secret_key(), &client_pubkey, &event.content) {
+ Ok(o) => {
+ use_nip44 = false;
+ o
+ }
+ Err(e) => {
+ log::warn!("Could not decrypt using NIP-04 or NIP-44:{}", e);
+ return Ok(false);
+ }
}
}
};
+ log::debug!("Decrypted:{}", content);
+ let request: nip47::Request = match serde_json::from_str(&content) {
+ Ok(o) => o,
+ Err(e) => {
+ log::warn!("Error parsing nip47::Request! {}", e);
+ return Ok(false);
+ }
+ };
- for (response, id) in responses {
- let content =
- match encrypt_response_content(&response, wallet_keys, &client_pubkey, use_nip44) {
- Ok(o) => o,
- Err(e) => {
- log::warn!("{e}");
- continue;
- }
+ let responses = match request.params {
+ nip47::RequestParams::PayInvoice(pay_invoice_request) => {
+ vec![
+ match pay_invoice(plugin.clone(), pay_invoice_request, &label).await {
+ Ok((o, id)) => (
+ nip47::Response {
+ result_type: nip47::Method::PayInvoice,
+ error: None,
+ result: Some(nip47::ResponseResult::PayInvoice(o)),
+ },
+ id,
+ ),
+ Err((e, id)) => (
+ nip47::Response {
+ result_type: nip47::Method::PayInvoice,
+ error: Some(e),
+ result: None,
+ },
+ id,
+ ),
+ },
+ ]
+ }
+ nip47::RequestParams::MultiPayInvoice(multi_pay_invoice_request) => {
+ multi_pay_invoice(plugin.clone(), multi_pay_invoice_request, &label).await
+ }
+ nip47::RequestParams::PayKeysend(pay_keysend_request) => {
+ let id = if let Some(i) = pay_keysend_request.id.clone() {
+ i
+ } else {
+ pay_keysend_request.pubkey.clone()
};
-
- let response_event =
- 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}");
- continue;
- }
- };
-
- let send_result = match nostr_client.send_event(&response_event).await {
+ vec![
+ match pay_keysend(plugin.clone(), pay_keysend_request, &label).await {
+ Ok(o) => (
+ nip47::Response {
+ result_type: nip47::Method::PayKeysend,
+ error: None,
+ result: Some(nip47::ResponseResult::PayKeysend(o)),
+ },
+ id,
+ ),
+ Err(e) => (
+ nip47::Response {
+ result_type: nip47::Method::PayKeysend,
+ error: Some(e),
+ result: None,
+ },
+ id,
+ ),
+ },
+ ]
+ }
+ nip47::RequestParams::MultiPayKeysend(multi_pay_keysend_request) => {
+ multi_pay_keysend(plugin.clone(), multi_pay_keysend_request, &label).await
+ }
+ nip47::RequestParams::MakeInvoice(make_invoice_request) => {
+ vec![
+ match make_invoice(plugin.clone(), make_invoice_request).await {
+ Ok(o) => (
+ nip47::Response {
+ result_type: nip47::Method::MakeInvoice,
+ error: None,
+ result: Some(nip47::ResponseResult::MakeInvoice(o)),
+ },
+ String::new(),
+ ),
+ Err(e) => (
+ nip47::Response {
+ result_type: nip47::Method::MakeInvoice,
+ error: Some(e),
+ result: None,
+ },
+ String::new(),
+ ),
+ },
+ ]
+ }
+ nip47::RequestParams::LookupInvoice(lookup_invoice_request) => {
+ vec![
+ match lookup_invoice(plugin.clone(), lookup_invoice_request).await {
+ Ok(o) => (
+ nip47::Response {
+ result_type: nip47::Method::LookupInvoice,
+ error: None,
+ result: Some(nip47::ResponseResult::LookupInvoice(o)),
+ },
+ String::new(),
+ ),
+ Err(e) => (
+ nip47::Response {
+ result_type: nip47::Method::LookupInvoice,
+ error: Some(e),
+ result: None,
+ },
+ String::new(),
+ ),
+ },
+ ]
+ }
+ nip47::RequestParams::ListTransactions(list_transactions_request) => {
+ vec![
+ match list_transactions(plugin.clone(), list_transactions_request).await {
+ Ok(o) => (
+ nip47::Response {
+ result_type: nip47::Method::ListTransactions,
+ error: None,
+ result: Some(nip47::ResponseResult::ListTransactions(o)),
+ },
+ String::new(),
+ ),
+ Err(e) => (
+ nip47::Response {
+ result_type: nip47::Method::ListTransactions,
+ error: Some(e),
+ result: None,
+ },
+ String::new(),
+ ),
+ },
+ ]
+ }
+ nip47::RequestParams::GetBalance => {
+ vec![match get_balance(plugin.clone(), &label).await {
+ Ok(o) => (
+ nip47::Response {
+ result_type: nip47::Method::GetBalance,
+ error: None,
+ result: Some(nip47::ResponseResult::GetBalance(o)),
+ },
+ String::new(),
+ ),
+ Err(e) => (
+ nip47::Response {
+ result_type: nip47::Method::GetBalance,
+ error: Some(e),
+ result: None,
+ },
+ String::new(),
+ ),
+ }]
+ }
+ nip47::RequestParams::GetInfo => {
+ vec![match get_info(plugin.clone(), &label).await {
+ Ok(o) => (
+ nip47::Response {
+ result_type: nip47::Method::GetInfo,
+ error: None,
+ result: Some(nip47::ResponseResult::GetInfo(o)),
+ },
+ String::new(),
+ ),
+ Err(e) => (
+ nip47::Response {
+ result_type: nip47::Method::GetInfo,
+ error: Some(e),
+ result: None,
+ },
+ String::new(),
+ ),
+ }]
+ }
+ };
+ for (response, id) in responses.into_iter() {
+ let response_str = match serde_json::to_string(&response) {
Ok(o) => o,
Err(e) => {
- log::warn!("Error sending response event! {e}");
+ log::warn!("Error serializing response! {}", e);
+ continue;
+ }
+ };
+ log::debug!("RESPONSE:{}", response_str);
+
+ let content = if use_nip44 {
+ match nip44::encrypt(
+ wallet_keys.secret_key(),
+ &client_pubkey,
+ response_str,
+ nip44::Version::V2,
+ ) {
+ Ok(o) => o,
+ Err(e) => {
+ log::warn!("Error encrypting response with nip44! {}", e);
+ continue;
+ }
+ }
+ } else {
+ match nip04::encrypt(wallet_keys.secret_key(), &client_pubkey, response_str) {
+ Ok(o) => o,
+ Err(e) => {
+ log::warn!("Error encrypting response with nip04! {}", e);
+ continue;
+ }
+ }
+ };
+ let mut response_builder = EventBuilder::new(Kind::WalletConnectResponse, content)
+ .tag(Tag::event(event.id))
+ .tag(Tag::public_key(client_pubkey));
+ if !id.is_empty() {
+ response_builder = response_builder.tag(Tag::custom(
+ TagKind::SingleLetter(SingleLetterTag {
+ character: Alphabet::D,
+ uppercase: false,
+ }),
+ vec![id],
+ ));
+ }
+ let response_event = match response_builder.sign_with_keys(&wallet_keys) {
+ Ok(o) => o,
+ Err(e) => {
+ log::warn!("Error signing reponse event! {}", e);
+ continue;
+ }
+ };
+ let send_result = match client.send_event(&response_event).await {
+ Ok(o) => o,
+ Err(e) => {
+ log::warn!("Error sending response event! {}", e);
continue;
}
};
@@ -332,129 +492,8 @@ async fn nwc_request_handler(
);
continue;
}
- 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:?}");
+ log::debug!("SENT RESPONSE {:?}", response_event);
}
- Ok(())
-}
-
-fn check_nip44_support(event: &Event) -> bool {
- 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;
- }
- }
- }
- }
- false
-}
-
-fn decrypt_request(
- event_content: &str,
- wallet_keys: &Keys,
- client_pubkey: &PublicKey,
- use_nip44: &mut bool,
-) -> Result {
- let content = if *use_nip44 {
- match nip44::decrypt(wallet_keys.secret_key(), client_pubkey, event_content) {
- Ok(o) => o,
- Err(e) => {
- log::debug!("Could not decrypt using NIP-44:{e}. Trying NIP-04");
- match nip04::decrypt(wallet_keys.secret_key(), client_pubkey, event_content) {
- Ok(o) => {
- *use_nip44 = false;
- o
- }
- Err(e) => {
- log::warn!("Could not decrypt using NIP-04 or NIP-44:{e}");
- return Err(e.into());
- }
- }
- }
- }
- } else {
- match nip04::decrypt(wallet_keys.secret_key(), client_pubkey, event_content) {
- Ok(o) => o,
- Err(e) => {
- log::debug!("Could not decrypt using NIP-04:{e}. Trying NIP-44");
- match nip44::decrypt(wallet_keys.secret_key(), client_pubkey, event_content) {
- Ok(o) => {
- *use_nip44 = true;
- o
- }
- Err(e) => {
- log::warn!("Could not decrypt using NIP-04 or NIP-44:{e}");
- return Err(e.into());
- }
- }
- }
- }
- };
- log::trace!("Decrypted (nip44_v2:{use_nip44}):{content}");
- let request: nip47::Request = match serde_json::from_str(&content) {
- Ok(o) => o,
- Err(e) => {
- log::warn!("Error parsing nip47::Request! {e}");
- return Err(e.into());
- }
- };
- Ok(request)
-}
-
-fn encrypt_response_content(
- response: &nip47::Response,
- wallet_keys: &Keys,
- client_pubkey: &PublicKey,
- use_nip44: bool,
-) -> Result {
- let response_str = match serde_json::to_string(&response) {
- Ok(o) => o,
- Err(e) => {
- return Err(anyhow!("Error serializing response! {e}"));
- }
- };
- log::trace!("RESPONSE:{response_str}");
- if use_nip44 {
- match nip44::encrypt(
- wallet_keys.secret_key(),
- client_pubkey,
- response_str,
- nip44::Version::V2,
- ) {
- Ok(o) => Ok(o),
- Err(e) => Err(anyhow!("Error encrypting response with nip44! {e}")),
- }
- } else {
- match nip04::encrypt(wallet_keys.secret_key(), client_pubkey, response_str) {
- Ok(o) => Ok(o),
- Err(e) => Err(anyhow!("Error encrypting response with nip04! {e}")),
- }
- }
-}
-
-async fn build_response_event(
- event_id: EventId,
- content: String,
- wallet_keys: &Keys,
- client_pubkey: PublicKey,
- id: Option,
-) -> Result {
- let mut response_builder = EventBuilder::new(Kind::WalletConnectResponse, content)
- .tag(Tag::event(event_id))
- .tag(Tag::public_key(client_pubkey));
- if let Some(i) = id {
- response_builder = response_builder.tag(Tag::identifier(i));
- }
- match response_builder.finalize_async(wallet_keys).await {
- Ok(o) => Ok(o),
- Err(e) => Err(e.into()),
- }
+ Ok(false)
}
diff --git a/src/nwc_balance.rs b/src/nwc_balance.rs
index 2fde546..f95d17c 100644
--- a/src/nwc_balance.rs
+++ b/src/nwc_balance.rs
@@ -1,38 +1,12 @@
use cln_plugin::Plugin;
use cln_rpc::{model::requests::ListpeerchannelsRequest, primitives::ChannelState};
-use nostr::nips::nip47;
+use nostr_sdk::nips::*;
-use crate::{
- structs::PluginState,
- util::{get_budget_msat, load_nwc_store},
-};
+use crate::{structs::PluginState, util::load_nwc_store};
-pub async fn get_balance_response(
+pub async fn get_balance(
plugin: Plugin,
- label: &str,
-) -> Vec<(nip47::Response, Option)> {
- vec![match get_balance(plugin, label).await {
- Ok(o) => (
- nip47::Response {
- result_type: nip47::Method::GetBalance,
- error: None,
- result: Some(nip47::ResponseResult::GetBalance(o)),
- },
- None,
- ),
- Err(e) => (
- nip47::Response {
- result_type: nip47::Method::GetBalance,
- error: Some(e),
- result: None,
- },
- None,
- ),
- }]
-}
-async fn get_balance(
- plugin: Plugin,
- label: &str,
+ label: &String,
) -> Result {
let mut rpc = plugin.state().rpc_lock.lock().await;
@@ -43,15 +17,11 @@ async fn get_balance(
message: e.to_string(),
})?;
- let balance = if let Some(bdgt_amt) = get_budget_msat(&nwc_store) {
+ let balance = if let Some(bdgt_amt) = nwc_store.budget_msat {
bdgt_amt
} else {
let listpeerchannels = rpc
- .call_typed(&ListpeerchannelsRequest {
- id: None,
- short_channel_id: None,
- channel_id: None,
- })
+ .call_typed(&ListpeerchannelsRequest { id: None })
.await
.map_err(|e| nip47::NIP47Error {
code: nip47::ErrorCode::Internal,
@@ -64,7 +34,7 @@ async fn get_balance(
|| chan.state == ChannelState::CHANNELD_AWAITING_SPLICE
{
if let Some(spend) = chan.spendable_msat {
- amount_msat += spend.msat();
+ amount_msat += spend.msat()
}
}
}
diff --git a/src/nwc_hold.rs b/src/nwc_hold.rs
deleted file mode 100644
index 4ce23a3..0000000
--- a/src/nwc_hold.rs
+++ /dev/null
@@ -1,248 +0,0 @@
-use std::str::FromStr;
-
-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,
-) -> Vec<(nip47::Response, Option)> {
- 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,
-) -> Vec<(nip47::Response, Option)> {
- 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,
-) -> Vec<(nip47::Response, Option)> {
- 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 27e196a..4a7ac4c 100644
--- a/src/nwc_info.rs
+++ b/src/nwc_info.rs
@@ -1,39 +1,17 @@
+use std::str::FromStr;
+
use cln_plugin::Plugin;
use cln_rpc::model::requests::GetinfoRequest;
-use nostr::nips::nip47;
+use nostr_sdk::nips::*;
+use nostr_sdk::*;
-use crate::{
- structs::PluginState,
- util::{build_methods_vec, build_notifications_vec, is_read_only_nwc, load_nwc_store},
-};
+use crate::structs::PluginState;
+use crate::util::{is_read_only_nwc, load_nwc_store};
+use crate::{OPT_NOTIFICATIONS, WALLET_ALL_METHODS, WALLET_READ_METHODS};
-pub async fn get_info_response(
+pub async fn get_info(
plugin: Plugin,
- label: &str,
-) -> Vec<(nip47::Response, Option)> {
- vec![match get_info(plugin, label).await {
- Ok(o) => (
- nip47::Response {
- result_type: nip47::Method::GetInfo,
- error: None,
- result: Some(nip47::ResponseResult::GetInfo(o)),
- },
- None,
- ),
- Err(e) => (
- nip47::Response {
- result_type: nip47::Method::GetInfo,
- error: Some(e),
- result: None,
- },
- None,
- ),
- }]
-}
-
-async fn get_info(
- plugin: Plugin,
- label: &str,
+ label: &String,
) -> Result {
let mut rpc = plugin.state().rpc_lock.lock().await;
@@ -45,12 +23,23 @@ async fn get_info(
message: e.to_string(),
})?;
- let pubkey = get_info.id.to_string();
+ let pubkey =
+ nostr_sdk::secp256k1::PublicKey::from_str(&get_info.id.to_string()).map_err(|e| {
+ nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: e.to_string(),
+ }
+ })?;
let network = match get_info.network.as_str() {
"bitcoin" => "mainnet".to_owned(),
_ => get_info.network,
};
+ let notifications = if plugin.option(&OPT_NOTIFICATIONS).unwrap() {
+ vec!["payment_received".to_owned(), "payment_sent".to_owned()]
+ } else {
+ vec![]
+ };
let nwc_store = load_nwc_store(&mut rpc, label)
.await
@@ -59,12 +48,20 @@ async fn get_info(
message: e.to_string(),
})?;
- let notifications = build_notifications_vec(&plugin);
-
- let methods = build_methods_vec(is_read_only_nwc(&nwc_store), &plugin);
+ let methods = if is_read_only_nwc(&nwc_store) {
+ WALLET_READ_METHODS
+ .into_iter()
+ .map(|s| s.to_owned())
+ .collect()
+ } else {
+ WALLET_ALL_METHODS
+ .into_iter()
+ .map(|s| s.to_owned())
+ .collect()
+ };
Ok(nip47::GetInfoResponse {
- alias: Some(get_info.alias),
+ alias: 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 f521673..98a06be 100644
--- a/src/nwc_invoice.rs
+++ b/src/nwc_invoice.rs
@@ -5,36 +5,12 @@ use cln_rpc::{
model::requests::InvoiceRequest,
primitives::{Amount, AmountOrAny, Sha256},
};
-use nostr::{nips::nip47, types::Timestamp};
+use nostr_sdk::nips::*;
use uuid::Uuid;
use crate::structs::PluginState;
-pub async fn make_invoice_response(
- plugin: Plugin,
- params: nip47::MakeInvoiceRequest,
-) -> Vec<(nip47::Response, Option)> {
- vec![match make_invoice(plugin, params).await {
- Ok(o) => (
- nip47::Response {
- result_type: nip47::Method::MakeInvoice,
- error: None,
- result: Some(nip47::ResponseResult::MakeInvoice(o)),
- },
- None,
- ),
- Err(e) => (
- nip47::Response {
- result_type: nip47::Method::MakeInvoice,
- error: Some(e),
- result: None,
- },
- None,
- ),
- }]
-}
-
-async fn make_invoice(
+pub async fn make_invoice(
plugin: Plugin,
params: nip47::MakeInvoiceRequest,
) -> Result {
@@ -42,7 +18,7 @@ async fn make_invoice(
let mut deschashonly = None;
- if let Some(d_hash) = ¶ms.description_hash {
+ if let Some(d_hash) = params.description_hash {
if params.description.is_none() {
return Err(nip47::NIP47Error {
code: nip47::ErrorCode::Other,
@@ -51,7 +27,7 @@ async fn make_invoice(
}
let description = params.description.as_ref().unwrap();
let my_description_hash = Sha256::const_hash(description.as_bytes());
- let description_hash = Sha256::from_str(d_hash).map_err(|e| nip47::NIP47Error {
+ let description_hash = Sha256::from_str(&d_hash).map_err(|e| nip47::NIP47Error {
code: nip47::ErrorCode::Internal,
message: e.to_string(),
})?;
@@ -61,15 +37,9 @@ async fn make_invoice(
message: "description_hash not matching description".to_owned(),
});
}
- deschashonly = Some(true);
+ deschashonly = Some(true)
}
- let amount_msat = if params.amount == 0 {
- AmountOrAny::Any
- } else {
- AmountOrAny::Amount(Amount::from_msat(params.amount))
- };
-
match rpc
.call_typed(&InvoiceRequest {
cltv: None,
@@ -78,24 +48,15 @@ async fn make_invoice(
preimage: None,
exposeprivatechannels: None,
fallbacks: None,
- amount_msat,
- description: params
- .description
- .clone()
- .unwrap_or("NWC make_invoice".to_owned()),
+ amount_msat: AmountOrAny::Amount(Amount::from_msat(params.amount)),
+ description: params.description.unwrap_or("NWC make_invoice".to_owned()),
label: Uuid::new_v4().to_string(),
})
.await
{
Ok(o) => Ok(nip47::MakeInvoiceResponse {
invoice: o.bolt11,
- payment_hash: Some(o.payment_hash.to_string()),
- description: params.description,
- description_hash: params.description_hash,
- preimage: None,
- amount: Some(params.amount),
- created_at: Some(Timestamp::now()),
- expires_at: Some(Timestamp::from_secs(o.expires_at)),
+ payment_hash: o.payment_hash.to_string(),
}),
Err(e) => Err(nip47::NIP47Error {
code: nip47::ErrorCode::Internal,
diff --git a/src/nwc_keysend.rs b/src/nwc_keysend.rs
index aec724d..836985b 100644
--- a/src/nwc_keysend.rs
+++ b/src/nwc_keysend.rs
@@ -1,66 +1,25 @@
-use std::{collections::HashMap, str::FromStr};
+use std::{str::FromStr, time::Duration};
use cln_plugin::Plugin;
use cln_rpc::{
- ClnRpc,
- RpcError,
- model::requests::{KeysendRequest, XkeysendRequest},
- primitives::{Amount, PublicKey, Secret, TlvEntry, TlvStream},
+ model::requests::KeysendRequest,
+ primitives::{Amount, PublicKey, TlvEntry, TlvStream},
};
-use nostr::nips::nip47::{self};
+use nostr_sdk::nips::*;
+use tokio::time;
use crate::{
structs::PluginState,
- util::{
- budget_amount_check,
- get_budget_msat,
- load_nwc_store,
- payment_fee_reserve_msat,
- refund_budget,
- reserve_budget,
- rpc_socket_path,
- settle_budget,
- },
+ util::{budget_amount_check, load_nwc_store, update_nwc_store},
};
-pub const XKEYSEND_COMMAND: &str = "xkeysend";
-
-pub async fn pay_keysend_response(
+pub async fn pay_keysend(
plugin: Plugin,
params: nip47::PayKeysendRequest,
- label: &str,
-) -> Vec<(nip47::Response, Option)> {
- let id = if let Some(i) = params.id.clone() {
- i
- } else {
- params.pubkey.clone()
- };
-
- vec![match pay_keysend(plugin, params, label).await {
- Ok(o) => (
- nip47::Response {
- result_type: nip47::Method::PayKeysend,
- error: None,
- result: Some(nip47::ResponseResult::PayKeysend(o)),
- },
- Some(id),
- ),
- Err(e) => (
- nip47::Response {
- result_type: nip47::Method::PayKeysend,
- error: Some(e),
- result: None,
- },
- Some(id),
- ),
- }]
-}
-
-async fn pay_keysend(
- plugin: Plugin,
- params: nip47::PayKeysendRequest,
- label: &str,
+ label: &String,
) -> Result {
+ let mut rpc = plugin.state().rpc_lock.lock().await;
+
if params.preimage.is_some() {
return Err(nip47::NIP47Error {
code: nip47::ErrorCode::Other,
@@ -68,142 +27,32 @@ 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 ¶ms.tlv_records {
+ for tlv in params.tlv_records {
extratlvs.entries.push(TlvEntry {
typ: tlv.tlv_type,
- value: hex::decode(&tlv.value).map_err(|e| RpcError {
- code: Some(-32700),
- message: format!("Could not decode tlv bytes: {e}"),
- data: None,
- })?,
+ value: tlv.value.as_bytes().to_owned(),
});
}
let extratlvs = if extratlvs.entries.is_empty() {
@@ -212,7 +61,7 @@ async fn keysend(
Some(extratlvs)
};
- let o = pay_rpc
+ match rpc
.call_typed(&KeysendRequest {
exemptfee: None,
extratlvs,
@@ -225,48 +74,74 @@ async fn keysend(
amount_msat: Amount::from_msat(params.amount),
destination: pubkey,
})
- .await?;
+ .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(),
+ })?;
+ }
- Ok((
- o.amount_sent_msat.msat(),
- o.amount_msat.msat(),
- o.payment_preimage,
- ))
-}
-
-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(),
- };
- };
-
- 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(),
+ let preimage = hex::encode(o.payment_preimage.to_vec());
+ Ok(nip47::PayKeysendResponse { preimage })
}
+ 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(),
+ }),
+ },
}
}
+
+pub async fn multi_pay_keysend(
+ plugin: Plugin,
+ params: nip47::MultiPayKeysendRequest,
+ label: &String,
+) -> Vec<(nip47::Response, String)> {
+ 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)),
+ },
+ id,
+ ),
+ Err(e) => (
+ nip47::Response {
+ result_type: nip47::Method::MultiPayKeysend,
+ error: Some(e),
+ result: None,
+ },
+ id,
+ ),
+ };
+ responses.push(response_res);
+ time::sleep(Duration::from_millis(100)).await;
+ }
+ responses
+}
diff --git a/src/nwc_lookups.rs b/src/nwc_lookups.rs
index 42ce1f6..b3b97ce 100644
--- a/src/nwc_lookups.rs
+++ b/src/nwc_lookups.rs
@@ -2,69 +2,18 @@ use std::{cmp::Reverse, str::FromStr};
use cln_plugin::Plugin;
use cln_rpc::{
- ClnRpc,
model::{
- requests::{
- DecodeRequest,
- ListinvoicesIndex,
- ListinvoicesRequest,
- ListpaysRequest,
- WaitIndexname,
- WaitRequest,
- WaitSubsystem,
- },
- responses::{
- DecodeResponse,
- DecodeType,
- ListinvoicesInvoices,
- ListinvoicesInvoicesStatus,
- ListpaysPays,
- ListpaysPaysStatus,
- },
+ requests::{DecodeRequest, ListinvoicesRequest, ListpaysRequest},
+ responses::{ListinvoicesInvoicesStatus, ListpaysPaysStatus},
},
primitives::Sha256,
};
-use nostr::{nips::nip47, types::Timestamp};
-use tonic::transport::Channel;
+use nostr_sdk::nips::*;
+use nostr_sdk::*;
-use crate::{
- hold::{self, ListRequest, hold_client::HoldClient, list_request::Constraint},
- structs::{NOT_INV_ERR, PluginState},
- util::rpc_socket_path,
-};
+use crate::structs::PluginState;
-#[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,
- params: nip47::LookupInvoiceRequest,
-) -> Vec<(nip47::Response, Option)> {
- vec![match lookup_invoice(plugin, params).await {
- Ok(o) => (
- nip47::Response {
- result_type: nip47::Method::LookupInvoice,
- error: None,
- result: Some(nip47::ResponseResult::LookupInvoice(o)),
- },
- None,
- ),
- Err(e) => (
- nip47::Response {
- result_type: nip47::Method::LookupInvoice,
- error: Some(e),
- result: None,
- },
- None,
- ),
- }]
-}
-
-async fn lookup_invoice(
+pub async fn lookup_invoice(
plugin: Plugin,
params: nip47::LookupInvoiceRequest,
) -> Result {
@@ -77,10 +26,15 @@ async fn lookup_invoice(
});
}
+ let not_invoice_err = Err(nip47::NIP47Error {
+ code: nip47::ErrorCode::Other,
+ message: "Not an invoice or invalid invoice".to_owned(),
+ });
+
let invoice = if params.payment_hash.is_some() && params.invoice.is_some() {
None
} else {
- params.invoice.clone()
+ params.invoice
};
let invoices = rpc
@@ -101,339 +55,214 @@ async fn lookup_invoice(
.invoices;
if invoices.len() == 1 {
- let invoice_response = invoices.into_iter().next().unwrap();
-
- 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)
+ let invoice_response = invoices.first().cloned().unwrap();
+ let invstring = if invoice_response.bolt11.is_some() {
+ invoice_response.bolt11.unwrap()
} else {
- return Err(nip47::NIP47Error {
+ invoice_response.bolt12.unwrap()
+ };
+ let invoice_decoded = rpc
+ .call_typed(&DecodeRequest {
+ string: invstring.clone(),
+ })
+ .await
+ .map_err(|e| nip47::NIP47Error {
code: nip47::ErrorCode::Internal,
- message: "Could not convert payment hash".to_owned(),
- });
- }
- } else {
- None
- };
+ message: e.to_string(),
+ })?;
- let pays = rpc
- .call_typed(&ListpaysRequest {
- bolt11: invoice,
- index: None,
- limit: None,
- payment_hash: payment_hash_hash,
- start: None,
- status: None,
+ if !invoice_decoded.valid {
+ return not_invoice_err;
+ }
+
+ let description = match invoice_decoded.item_type {
+ cln_rpc::model::responses::DecodeType::BOLT12_INVOICE => {
+ invoice_decoded.offer_description
+ }
+ cln_rpc::model::responses::DecodeType::BOLT11_INVOICE => invoice_decoded.description,
+ _ => return not_invoice_err,
+ };
+ let description_hash = match invoice_decoded.item_type {
+ cln_rpc::model::responses::DecodeType::BOLT12_INVOICE => None,
+ cln_rpc::model::responses::DecodeType::BOLT11_INVOICE => {
+ invoice_decoded.description_hash.map(|h| h.to_string())
+ }
+ _ => return not_invoice_err,
+ };
+
+ let amount = match invoice_decoded.item_type {
+ cln_rpc::model::responses::DecodeType::BOLT12_INVOICE => {
+ invoice_decoded.invoice_amount_msat.unwrap().msat()
+ }
+ cln_rpc::model::responses::DecodeType::BOLT11_INVOICE => {
+ if let Some(amt) = invoice_decoded.amount_msat {
+ amt.msat()
+ } else if let Some(a) = invoice_response.amount_msat {
+ a.msat()
+ } else {
+ // amount: `any` but have to put a value...
+ 0
+ }
+ }
+ _ => return not_invoice_err,
+ };
+
+ let created_at = match invoice_decoded.item_type {
+ cln_rpc::model::responses::DecodeType::BOLT12_INVOICE => {
+ Timestamp::from_secs(invoice_decoded.invoice_created_at.unwrap())
+ }
+ cln_rpc::model::responses::DecodeType::BOLT11_INVOICE => {
+ Timestamp::from_secs(invoice_decoded.created_at.unwrap())
+ }
+ _ => return not_invoice_err,
+ };
+
+ let preimage = invoice_response
+ .payment_preimage
+ .map(|p| hex::encode(p.to_vec()));
+
+ Ok(nip47::LookupInvoiceResponse {
+ transaction_type: Some(nip47::TransactionType::Incoming),
+ invoice: Some(invstring),
+ description,
+ description_hash,
+ preimage,
+ payment_hash: invoice_response.payment_hash.to_string(),
+ amount,
+ fees_paid: 0,
+ created_at,
+ expires_at: Some(Timestamp::from_secs(invoice_response.expires_at)),
+ settled_at: invoice_response.paid_at.map(Timestamp::from_secs),
+ metadata: 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 {
+ let payment_hash_hash = if let Some(hash) = params.payment_hash {
+ if let Ok(res) = Sha256::from_str(&hash) {
+ Some(res)
} 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::Other,
- message: "Invalid payment hash".to_owned(),
+ code: nip47::ErrorCode::Internal,
+ message: "Could not convert 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)
+
+ 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::Other,
- message: format!("Could not fetch hold invoice: {e}"),
+ code: nip47::ErrorCode::Internal,
+ message: e.to_string(),
})?
- .into_inner();
+ .pays;
- if hold_lookup.invoices.len() != 1 {
+ if pays.len() != 1 {
return Err(nip47::NIP47Error {
- code: nip47::ErrorCode::Other,
+ code: nip47::ErrorCode::NotFound,
message: "Transaction not found".to_owned(),
});
}
+ let list_pay = pays.first().unwrap().clone();
+ let invstring = if list_pay.bolt11.is_some() {
+ list_pay.bolt11
+ } else {
+ list_pay.bolt12
+ };
- 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(),
- });
+ let invoice_decoded = if let Some(invstr) = &invstring {
+ Some(
+ rpc.call_typed(&DecodeRequest {
+ string: invstr.clone(),
+ })
+ .await
+ .map_err(|e| nip47::NIP47Error {
+ code: nip47::ErrorCode::Internal,
+ message: e.to_string(),
+ })?,
+ )
+ } else {
+ None
+ };
+
+ if invoice_decoded.is_some() && !invoice_decoded.as_ref().unwrap().valid {
+ return not_invoice_err;
}
- 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 description_hash = if let Some(inv_dec) = &invoice_decoded {
+ match inv_dec.item_type {
+ cln_rpc::model::responses::DecodeType::BOLT12_INVOICE => None,
+ cln_rpc::model::responses::DecodeType::BOLT11_INVOICE => {
+ inv_dec.description_hash.map(|h| h.to_string())
+ }
+ _ => return not_invoice_err,
}
+ } else {
+ None
};
- 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 amount = if let Some(amt) = list_pay.amount_msat {
+ amt.msat()
+ } else if let Some(inv_dec) = &invoice_decoded {
+ match inv_dec.item_type {
+ cln_rpc::model::responses::DecodeType::BOLT12_INVOICE => {
+ inv_dec.invoice_amount_msat.unwrap().msat()
+ }
+ cln_rpc::model::responses::DecodeType::BOLT11_INVOICE => {
+ if let Some(amt) = inv_dec.amount_msat {
+ amt.msat()
+ } else {
+ return not_invoice_err;
+ }
+ }
+ _ => return not_invoice_err,
}
+ } else {
+ return not_invoice_err;
};
- let list_request = ListRequest {
- constraint: Some(Constraint::PaymentHash(payment_hash_hash)),
+ let description = if let Some(inv_dec) = invoice_decoded {
+ match inv_dec.item_type {
+ cln_rpc::model::responses::DecodeType::BOLT12_INVOICE => inv_dec.offer_description,
+ cln_rpc::model::responses::DecodeType::BOLT11_INVOICE => inv_dec.description,
+ _ => return not_invoice_err,
+ }
+ } else {
+ list_pay.description
};
- 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 fees_paid = list_pay.amount_sent_msat.unwrap().msat() - amount;
+ let preimage = list_pay.preimage.map(|p| hex::encode(p.to_vec()));
- 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(),
- })?;
- if !invoice_decoded.valid {
- return Err(nip47::NIP47Error {
- code: nip47::ErrorCode::Other,
- message: "Invalid invoice decoded".to_owned(),
- });
- }
- Ok((hold_invoice, invoice_decoded))
+ Ok(nip47::LookupInvoiceResponse {
+ transaction_type: Some(nip47::TransactionType::Outgoing),
+ invoice: invstring,
+ description,
+ description_hash,
+ preimage,
+ payment_hash: list_pay.payment_hash.to_string(),
+ amount,
+ fees_paid,
+ created_at: Timestamp::from_secs(list_pay.created_at),
+ expires_at: None,
+ settled_at: list_pay.completed_at.map(Timestamp::from_secs),
+ metadata: None,
+ })
}
}
-pub async fn list_transactions_response(
- plugin: Plugin,
- params: nip47::ListTransactionsRequest,
-) -> Vec<(nip47::Response, Option)> {
- vec![match list_transactions(plugin, params).await {
- Ok(o) => (
- nip47::Response {
- result_type: nip47::Method::ListTransactions,
- error: None,
- result: Some(nip47::ResponseResult::ListTransactions(o)),
- },
- None,
- ),
- Err(e) => (
- nip47::Response {
- result_type: nip47::Method::ListTransactions,
- error: Some(e),
- result: None,
- },
- None,
- ),
- }]
-}
-
-async fn list_transactions(
+pub async fn list_transactions(
plugin: Plugin,
params: nip47::ListTransactionsRequest,
) -> Result, nip47::NIP47Error> {
- 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 mut rpc = plugin.state().rpc_lock.lock().await;
let (query_invoices, query_payments) = match params.transaction_type {
Some(t) => match t {
@@ -443,140 +272,21 @@ async fn list_transactions(
None => (true, true),
};
+ let from = params.from.map(|f| f.as_u64());
+ let until = params.until.map(|f| f.as_u64());
+ let unpaid = params.unpaid.unwrap_or(false);
+
let mut transactions: Vec = Vec::new();
-
if query_invoices {
- let invoices = collect_invoices(&mut rpc, per_source, from, until, unpaid).await?;
- transactions.extend(invoices);
-
- 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 pays = collect_pays(&mut rpc, per_source, from, until).await?;
- transactions.extend(pays);
- }
-
- transactions.sort_by_key(|t| Reverse(t.created_at));
-
- if let Some(offset) = params.offset {
- let len = transactions.len() as u64;
- if offset >= len {
- transactions.clear();
- } else {
- let off = usize::try_from(offset).unwrap();
- transactions.drain(0..off);
- }
- }
-
- if let Some(limit) = params.limit {
- let len = transactions.len() as u64;
- if limit < len {
- let l = usize::try_from(limit).unwrap();
- transactions = transactions.drain(0..l).collect();
- }
- }
-
- transactions = trim_to_size(transactions, RESPONSE_LIMIT_BYTES);
-
- Ok(transactions)
-}
-
-async fn max_invoice_created_index(rpc: &mut ClnRpc) -> Result