Commit Graph

851 Commits

Author SHA1 Message Date
thesimplekid
abf10da330 chore: update deps (#761) 2025-05-20 10:27:52 +01:00
thesimplekid
b63dc1045d refactor: nut04 and nut05 (#749) 2025-05-19 09:49:11 +01:00
thesimplekid
3920c6f9bc fix: nut18 payment request encoding/decoding (#758)
* fix: nut18 payment request encoding/decoding

* refactor: reorder nut18fns

* refactor: reorder nut18
2025-05-18 10:04:02 +01:00
thesimplekid
70944500fc chore: clippy mint_url (#759) 2025-05-18 09:05:44 +01:00
thesimplekid
c001375b32 fix: mint url trailing slash (#757) 2025-05-17 20:01:16 +01:00
thesimplekid
df0de05571 fix: get spendable to return witness (#756) 2025-05-17 20:00:49 +01:00
thesimplekid
67342ec793 feat: htlc from hash (#753)
* feat: htlc from hash

* chore: typos
2025-05-17 14:21:49 +01:00
thesimplekid
385ec4d295 feat: optional transport and nut10 secret on payment request (#744)
* feat: optional transport on payment request

* feat: create token for payment rquest

* feat: create payment request

* feat: arg append
2025-05-15 09:06:10 +01:00
thesimplekid
9ac387ae3d Ln use common (#751)
* chore: cdk-cln use common

* feat: lnd use common

* feat: lnbits use common
2025-05-14 17:29:58 +01:00
thesimplekid
e268866446 chore: clippy (#750)
* chore: clippy

* chore: fmt
2025-05-14 15:55:37 +01:00
lollerfirst
a4c2454e94 [PATCH + BUGFIX] Multinut LND re-query and use_mission_control (#746)
* patch LND re-query and use mission control + bugfix on the melt verification

* remove unusued import

* chore: fmt

---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2025-05-06 13:19:32 +01:00
thesimplekid
5a3a274875 fix: melt start up check (#745) 2025-05-06 11:33:24 +01:00
thesimplekid
34eb10fd9e Mpp cdk cli (#743)
* refactor: Extract user input logic into a helper function

* feat: get multiple quotes (hacky)

* refactor: cdk-cli

* refactor: cdk-cli

* feat: refactor balances
2025-05-05 08:41:54 +01:00
KnowWhoami
ffce3a8aef test: use expect/unwrap instead of anyhow 2025-05-01 03:29:43 +05:30
thesimplekid
d880bb13cc refactor: Update SupportedMethods with WsCommand enum and new constructor 2025-04-29 08:53:55 +01:00
thesimplekid
63e6a4d610 feat: use tsk testmint 2025-04-27 16:21:25 +01:00
thesimplekid
1fbb6c7aa9 fix: remove urls grpc 2025-04-23 17:05:26 +01:00
Darrell
bac711d9fd update lnbits-rs to 0.5.0 2025-04-23 16:44:59 +09:00
C
15e10c0e90 Merge pull request #730 from crodas/fix/race-condition-state-update
Fix race conditions with proof state updates.
2025-04-22 11:24:58 -04:00
Cesar Rodas
25fad98aa8 Fix formatting 2025-04-22 11:43:25 -03:00
C
5505f0b5d7 Apply suggestions from code review
Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2025-04-22 09:30:21 -04:00
thesimplekid
570782e3b6 chore: clippy 2025-04-22 11:29:36 +01:00
thesimplekid
8379da2655 fix: only could sigs from unique pubkeys 2025-04-22 11:29:36 +01:00
thesimplekid
48fd3c652b test: multiple sigs 2025-04-22 11:29:36 +01:00
Cesar Rodas
81a6d68ef3 Remove wallet states from check_state_transition 2025-04-20 11:17:03 -03:00
Cesar Rodas
abdde307c6 Fix race conditions with proof state updates.
Add a strict set of updates to prevent incorrect state changes and correct
usage. Supporting the transaction at the trait level prevented some cases, but
having a strict set of state change flows is better.

This bug was found while developing the signatory. The keys are read from
memory, triggering race conditions at the database, and some `Pending` states
are selected (instead of just selecting `Unspent`).

This PR also introduces a set of generic database tests to be executed for all
database implementations, this test suite will make sure writing and
maintaining new database drivers
2025-04-19 18:15:42 -03:00
thesimplekid
717742be05 fix: debug print of info 2025-04-13 22:21:43 +01:00
thesimplekid (aider)
f5f3e50507 fix: Correct mnemonic hashing in Debug implementation 2025-04-13 22:19:41 +01:00
thesimplekid
607cdf23d4 feat: Add robust mnemonic hashing and debug tests for Info struct 2025-04-13 22:19:39 +01:00
thesimplekid
7715d45f3b Merge pull request #724 from thesimplekid/token_value_uniqe
refactor: Ensure unique proofs when calculating token value
2025-04-11 10:03:57 +01:00
thesimplekid (aider)
3b5c8b5c5e refactor: Ensure unique proofs when calculating token value 2025-04-10 23:21:58 +01:00
thesimplekid
0d512c1d15 feat: mint should not enforce expiry 2025-04-10 22:59:49 +01:00
lollerfirst
dafdf757af CORS Headers in Responses (#719)
* access control headers for CORS request from in-browser wallets

* cargo fmt

* handle preflight requests
2025-04-10 13:47:35 +01:00
thesimplekid
db067a145d docs: Add README.md for cdk-mint-rpc crate (#717)
* docs: Add README.md for cdk-mint-rpc crate

* docs: auth readme
2025-04-09 15:29:03 +01:00
thesimplekid
f44f79d3e0 fix: grpc set mint urls, updating description and add get quote ttl (#716)
* fix: grpc set mint urls

* refactor: Extract payment processor retrieval into helper method

* fix: only allow updates to nut04/05 where there is a backend

* feat: Add GetQuoteTtl RPC method to retrieve quote TTL settings

* fix: update long desctiption
2025-04-09 15:28:25 +01:00
thesimplekid
e883d2d684 fix: amountless setting 2025-04-08 10:23:42 +01:00
David Caseria
3514f362eb Export MintDatabase traits in the cdk crate 2025-04-07 12:45:02 -04:00
thesimplekid
0b9ca1a474 Time time series (#708)
* feat: Add created_time and paid_time fields to MintQuote struct

* feat: Add serde default of 0 for created_time in MintQuote

* feat: Add created_time and paid_time to MintQuote and MeltQuote structs

* feat: Add paid_time update when setting melt quote state to Paid

* fix: Update melt quote state with current Unix timestamp

* feat: Add paid_time update for mint quote when state is set to Paid

* feat: Add issued_time field to MintQuote conversion from SQLite row

* feat: Add issued_time tracking for MintQuoteState::Issued state

* feat: Add migration script for mint time of quotes

* feat: Add timestamp columns to mint_quote and melt_quote tables

* feat: Add timestamp columns to `add_mint_quote` method

* refactor: Improve code formatting and readability in mint quote state update logic

* feat: Add created_time and paid_time columns to melt_quote query

* feat: time on mint and melt quotes

* feat: Add migration script for mint created time signature

feat: Add created_time column to blind_signature table

feat: Add created_time to blind_signature insertion

feat: Add created_time column to proof table and update insert query

feat: time on mint and melt quotes

* feat: Add new table to track blind signature creation time

* feat: Add timestamp tracking for proofs in ReDB database

* feat: redb proof time

* chore: fmt
2025-04-07 12:51:14 +01:00
C
43ab1fdde1 Do not create the wallet struct directly; instead, call new. (#707)
The bug comes with the SQLx-sqlite pool bug, where several connections are
created by default, but the `new` function takes care of that, fixing that bug
by making a single instance of the database.

If constructed directly, the pool would create several connections to the
database, which in most instances is fine, but with SQLite :memory: each
connection is entirely independent.

Also follow documentation to make sure that failed `acquire` will not end up
dropping connections by setting  test_before_acquire to false

     However, if your workload is sensitive to dropped connections such as using an in-memory
     SQLite database with a pool size of 1, you can pretty easily ensure that a cancelled
     `acquire()` call will never drop connections by tweaking your [`PoolOptions`]:

     * Set [`test_before_acquire(false)`][PoolOptions::test_before_acquire]
     * Never set [`before_acquire`][PoolOptions::before_acquire] or
       [`after_connect`][PoolOptions::after_connect].
2025-04-06 07:13:14 +01:00
thesimplekid
d224cc57b5 Melt to amountless invoice (#497)
* feat: melt token with amountless

* fix: docs

* fix: extra migration
2025-04-04 13:16:27 +01:00
thesimplekid
71bfe1ff9c fix: mint pending get mint info to create auth wallet 2025-04-03 13:19:39 +01:00
thesimplekid
d6d3955d50 fix: nutshell tests 2025-04-03 12:20:41 +01:00
David Caseria
b1dd321f0a Add transactions to database (#686) 2025-04-03 11:37:43 +01:00
thesimplekid
7fbe55ea02 Test fees (#698)
* feat: Add Docker container setup for Nutshell mint in test-nutshell recipe

* test: Add wait mechanism for Nutshell docker container startup

* test: Modify Nutshell wallet tests to run sequentially

* fix: mintd set input fee pkk

* feat: fee tests

* fix: melt returning fee in change

* fix: fee tests

* fix: fee tests
2025-04-03 00:30:50 +01:00
luozexuan
02fd849870 chore: fix some typos in comment
Signed-off-by: luozexuan <fetchcode@139.com>
2025-04-02 18:29:18 +08:00
thesimplekid
f4c857c3e7 Nutshell wallet (#695)
* chore: Add nutshell wallet integration test script

feat: Add MINT_URL configuration for docker container in nutshell wallet integration test script

chore: Make nutshell_wallet_itest.sh executable

fix: Update MINT_URL to use host.docker.internal for Docker container access

feat: Add Docker container startup for Cashu daemon in wallet integration test script

chore: Update Docker image to use Docker Hub repository

feat: Add cleanup trap to stop Docker container and unset variables

feat: Add initial test stub for nutshell wallet mint functionality

test: Add Cashu wallet mint integration test

feat: Add just command for nutshell wallet integration test

refactor: Organize imports and improve code formatting in nutshell wallet test

fix: Update Cashu Docker image and test URL for correct container access

fix: Update Docker container name and image for Cashu wallet test script

fix: Handle Docker container name conflict in nutshell wallet integration test

fix: Update Docker image to cashubtc/nutshell:latest in wallet integration test script

feat: Add support for running separate Nutshell mint and wallet containers

feat: Update Nutshell mint and wallet container configurations for integration testing

fix: Update wallet port and container configuration in integration test script

chore: Export MINT_URL and WALLET_URL as environment variables

fix: Update invoice creation and state checking in nutshell wallet test

fix: Update MINT_URL to use host.docker.internal for container access

fix: Update nutshell wallet mint test to handle invoice payment state

refactor: Improve Nutshell wallet test with better error handling and robustness

refactor: Improve code formatting and logging in nutshell wallet test

refactor: Replace anyhow with expect for error handling in Nutshell wallet test

refactor: Simplify error handling in Nutshell wallet mint test

refactor: Replace `?` with `expect()` in Nutshell wallet test

refactor: Simplify nutshell wallet test by removing unused code and improving error handling

refactor: Extract minting and balance helper functions in nutshell wallet test

feat: Add test for Nutshell wallet token swap functionality

fix: Trim quotes from token in nutshell wallet swap test

refactor: Remove debug print statements and improve code readability

refactor: Improve test_nutshell_wallet_melt with payment state checking and balance verification

refactor: Update Nutshell wallet integration test script configuration

feat: Extract common mint startup function into shared script

refactor: Simplify nutshell wallet integration test script and improve startup process

feat: Add mintd process termination and test status capture in integration test script

refactor: Capitalize env vars and ensure comprehensive cleanup in trap

feat: nutshell wallet test

* ci: Add test step for Nutshell wallet integration tests

* ci: Split Nutshell integration tests into separate jobs

* feat: nutshell wallet test

* ci: Add Docker setup and increase timeout for Nutshell wallet integration tests

* chore: Improve Nutshell wallet integration test script robustness

* fix: Remove -i flag from Nix develop and improve Docker accessibility check

* fix: payment processor

* fix: wallet tests

* feat: Add integration shell with Docker and Rust stable for testing

* ci: Simplify Nutshell wallet integration test workflow and script

* fix: Improve mintd endpoint detection and error handling in integration test script

* fix: wallet tests
2025-03-30 13:08:00 +01:00
ok300
0eb5805f6f Mint example config: remove stale cln_path reference (#694) 2025-03-30 10:30:58 +01:00
thesimplekid
52bfc8c9ce feat: nutshell itests (#691) 2025-03-29 22:04:43 +00:00
ok300
240e22c96a Remove stale crate references (#692) 2025-03-28 14:49:07 +00:00
thesimplekid
fa67271cca Int tests (#685)
* Here's a commit message for this change:

refactor: Move mint tests to fake_wallet.rs and add descriptive comments

refactor: pure wallet/mint does not need arc

refactor: Consolidate NUT-06 test into single function and remove redundant module

docs: Add comments explaining test purposes in integration tests file

refactor: Remove anyhow and replace with expect for error handling

refactor: use expect in pure tests

feat: Add configurable database type via environment variable for test mint and wallet

refactor: Update database initialization in test mint and wallet creation

feat: Add temporary directory support for redb and sqlite databases in tests

feat: Add database type argument to test commands in justfile

ci: Add build matrix for pure-itest with memory, sqlite, and redb databases

refactor: use expect in pure tests

refactor: Move and refactor `test_swap_unbalanced` from mint to integration tests pure

refactor: move mint tests to pure tests

docs: Add detailed comments explaining test file purposes for mint and integration tests

refactor: Extract keyset ID retrieval into a reusable function

test: Add concurrent double-spend test with 3 swap transactions

refactor: Simplify concurrent swap request processing and error handling

test: Add check to verify all proofs are marked as spent in concurrent double-spend test

refactor: Optimize proof state retrieval in concurrent double-spend test

feat: Add test for concurrent melt race condition with same proofs

fix: Update concurrent melt test to use melt quote and handle errors

refactor: melt concurrrent

refactor: Rename test function for clarity in concurrent double-spend scenario

refactor: Modify test_concurrent_double_spend_melt to manually create melt requests in mint tasks

feat: con melt test

refactor: Optimize proof state handling and error recovery in check_spendable

refactor: Extract helper method to reset proofs to original state

fix: reset y states

fix: reset y states

* fix: acces of priv feilds

* fix: add extra migrate
2025-03-27 12:48:36 +00:00