Skip to content

Commit

Permalink
Merge branch 'main' into add-blink
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Feb 17, 2024
2 parents f839ec5 + 94db0fc commit 18f7b4d
Show file tree
Hide file tree
Showing 40 changed files with 1,533 additions and 278 deletions.
16 changes: 14 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ NOSTR_RELAYS=["wss://nostr-pub.wellorder.net"]
# Wallet API port
API_PORT=4448

# Wallet default unit
WALLET_UNIT="sat"

# --------- MINT ---------

# Network
Expand All @@ -38,8 +41,17 @@ MINT_INFO_CONTACT=[["email","[email protected]"], ["twitter","@me"], ["nostr", "np
MINT_INFO_MOTD="Message to users"

MINT_PRIVATE_KEY=supersecretprivatekey
# increment derivation path to rotate to a new keyset
MINT_DERIVATION_PATH="0/0/0/0"

# Increment derivation path to rotate to a new keyset
# Example: m/0'/0'/0' -> m/0'/0'/1'
MINT_DERIVATION_PATH="m/0'/0'/0'"

# Multiple derivation paths and units. Unit is parsed from the derivation path.
# m/0'/0'/0' is "sat" (default)
# m/0'/1'/0' is "msat"
# m/0'/2'/0' is "usd"
# In this example, we have 2 keysets for sat, 1 for msat and 1 for usd
# MINT_DERIVATION_PATH_LIST=["m/0'/0'/0'", "m/0'/0'/1'", "m/0'/1'/0'", "m/0'/2'/0'"]

MINT_DATABASE=data/mint

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ jobs:
poetry-version: ["1.7.1"]
mint-cache-secrets: ["false", "true"]
mint-only-deprecated: ["false", "true"]
# db-url: ["", "postgres://cashu:cashu@localhost:5432/test"] # TODO: Postgres test not working
db-url: [""]
mint-database: ["./test_data/test_mint", "postgres://cashu:cashu@localhost:5432/cashu"]
backend-wallet-class: ["FakeWallet"]
uses: ./.github/workflows/tests.yml
with:
Expand All @@ -27,6 +26,7 @@ jobs:
poetry-version: ${{ matrix.poetry-version }}
mint-cache-secrets: ${{ matrix.mint-cache-secrets }}
mint-only-deprecated: ${{ matrix.mint-only-deprecated }}
mint-database: ${{ matrix.mint-database }}
regtest:
uses: ./.github/workflows/regtest.yml
strategy:
Expand All @@ -38,3 +38,4 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
backend-wallet-class: ${{ matrix.backend-wallet-class }}
mint-database: "./test_data/test_mint"
38 changes: 38 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Docker Build

on:
push:
release:
types: [published]

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Determine Tag
id: get_tag
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
echo "::set-output name=tag::latest"
elif [[ "${{ github.event_name }}" == "release" ]]; then
echo "::set-output name=tag::${{ github.event.release.tag_name }}"
fi
- name: Build and push on release
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name == 'release' }}
tags: ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:${{ steps.get_tag.outputs.tag }}
18 changes: 16 additions & 2 deletions .github/workflows/regtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
os-version:
default: "ubuntu-latest"
type: string
db-url:
mint-database:
default: ""
type: string
backend-wallet-class:
Expand All @@ -23,6 +23,20 @@ jobs:
regtest:
runs-on: ${{ inputs.os-version }}
timeout-minutes: 10
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: cashu
POSTGRES_PASSWORD: cashu
POSTGRES_DB: cashu
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3

Expand All @@ -47,7 +61,7 @@ jobs:
WALLET_NAME: test_wallet
MINT_HOST: localhost
MINT_PORT: 3337
MINT_DATABASE: ${{ inputs.db-url }}
MINT_TEST_DATABASE: ${{ inputs.mint-database }}
TOR: false
MINT_LIGHTNING_BACKEND: ${{ inputs.backend-wallet-class }}
MINT_LNBITS_ENDPOINT: http://localhost:5001
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
poetry-version:
default: "1.7.1"
type: string
db-url:
mint-database:
default: ""
type: string
os:
Expand All @@ -24,7 +24,7 @@ on:

jobs:
poetry:
name: Run (mint-cache-secrets ${{ inputs.mint-cache-secrets }}, mint-only-deprecated ${{ inputs.mint-only-deprecated }})
name: Run (mint-cache-secrets ${{ inputs.mint-cache-secrets }}, mint-only-deprecated ${{ inputs.mint-only-deprecated }}, mint-database ${{ inputs.mint-database }})
runs-on: ${{ inputs.os }}
services:
postgres:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
WALLET_NAME: test_wallet
MINT_HOST: localhost
MINT_PORT: 3337
MINT_DATABASE: ${{ inputs.db-url }}
MINT_TEST_DATABASE: ${{ inputs.mint-database }}
MINT_CACHE_SECRETS: ${{ inputs.mint-cache-secrets }}
DEBUG_MINT_ONLY_DEPRECATED: ${{ inputs.mint-only-deprecated }}
TOR: false
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-slim
FROM python:3.10-slim
RUN apt-get update
RUN apt-get install -y curl python3-dev autoconf g++
RUN apt-get install -y libpq-dev
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,11 @@ install-pre-commit-hook:

pre-commit:
poetry run pre-commit run --all-files

docker-build:
rm -rf docker-build || true
mkdir -p docker-build
git clone . docker-build
cd docker-build
docker buildx build -f Dockerfile -t cashubtc/nutshell:0.15.0 --platform linux/amd64 .
# docker push cashubtc/nutshell:0.15.0
Loading

0 comments on commit 18f7b4d

Please sign in to comment.