Commit Graph

86 Commits

Author SHA1 Message Date
David Caseria
db1db86509 Prepared Send (#596)
Co-authored-by: thesimplekid <tsk@thesimplekid.com>
Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
2025-03-20 11:44:44 +00:00
benthecarman
8cd4ea301a chore: Update sqlx to 0.7.4 2025-03-10 19:01:57 -05:00
thesimplekid
162507c492 feat: payment processor 2025-03-10 14:44:57 +00:00
ok300
1131711d91 Drop nostr_last_checked table, remove references (#647)
* cdk-sqlite: Drop unused table nostr_last_checked

* cdk-rexie: Drop unused object store nostr_last_checked

* cdk-redb: Remove unused table ref nostr_last_checked
2025-03-10 13:37:20 +00:00
thesimplekid (aider)
cb87fefacd refactor: Remove nostr last checked methods from database trait and implementations 2025-03-09 23:11:02 +00:00
benthecarman
40c53e83df feat: Add support for sqlcipher 2025-03-09 15:08:43 -05:00
thesimplekid
467cc0a027 feat: Add migration for keyset_id as foreign key in SQLite database (#634) 2025-03-08 22:46:12 +00:00
NodlAndHodl
fcf2e9d603 feat: adding tos to mint (#604)
* feat: adding tos(terms of service) to mint and update cdk-sqlite migration
2025-03-07 20:29:10 +00:00
ok300
5a7362c09f Simplify process_swap_request (#631)
* Simplify process_swap_request

* Fix occasional test_swap_to_send wallet errors
2025-03-06 15:08:59 +00:00
thesimplekid (aider)
d41d3a7c94 refactor: Add state check before deleting proofs to prevent removing spent proofs 2025-03-06 09:23:40 +00:00
thesimplekid
e84d6ea7ab chore: Update rust-version (MSRV) to 1.75.0 (#623) 2025-03-05 10:32:41 +00:00
C
f7d9a1b5db Drop the in-memory database (#613)
* Drop the in-memory database

Fixes #607

This PR drops the implementation of in-memory database traits.

They are useful for testing purposes since the tests should test our codebase
and assume the database works as expected (although a follow-up PR should write
a sanity test suite for all database trait implementors).

As complexity is worth with database requirements to simplify complexity and
add more robustness, for instance, with the following plans to add support for
transactions or buffered writes, it would become more complex and
time-consuming to support a correct database trait. This PR drops the
implementation and replaces it with a SQLite memory instance

* Remove OnceCell<Mint>

Without this change, a single Mint is shared for all tests, and the first tests
to run and shutdown makes the other databases (not-reachable, as dropping the
tokio engine would also drop the database instance).

There is no real reason, other than perhaps performance. The mint should
perhaps run in their own tokio engine and share channels as API interfaces, or
a new instance should be created in each tests

* Fixed bug with foreign keys

[1] https://gist.github.com/crodas/bad00997c63bd5ac58db3c5bd90747ed

* Show more debug on failure

* Remove old code

* Remove old references to WalletMemoryDatabase
2025-03-04 19:44:34 +00:00
C
63393056a0 Do not use INSERT OR REPLACE in SQLite. (#620)
Instead, use `INSERT` and `ON CONFLICT`.  The reason is that in case of
conflicts, the `REPLACE` will trigger a DELETE and then perform an INSERT, as
outlined in the documentation[1], and that may cause a cascade of deletion due
to our FOREIGN KEYs.

Here is the official documentation:

```
When a UNIQUE or PRIMARY KEY constraint violation occurs, the REPLACE algorithm
deletes pre-existing rows that are causing the constraint violation prior to
inserting or updating the current row and the command continues executing
normally. If a NOT NULL constraint violation occurs, the REPLACE conflict
resolution replaces the NULL value with the default value for that column, or
if the column has no default value, then the ABORT algorithm is used. If
a CHECK constraint or foreign key constraint violation occurs, the REPLACE
conflict resolution algorithm works like ABORT.  When the REPLACE conflict
resolution strategy deletes rows in order to satisfy a constraint, delete
triggers fire if and only if recursive triggers are enabled.  The update
hook is not invoked for rows that are deleted by the REPLACE conflict
resolution strategy. Nor does REPLACE increment the change counter. The
exceptional behaviors defined in this paragraph might change in a future
release.
```

[1] https://www.sqlite.org/lang_conflict.html
2025-02-28 11:35:29 +00:00
thesimplekid
7b7def17ee chore: release v0.7.1 2025-02-13 10:44:09 +00:00
callebtc
b818054f9a Add filtering for mint quote states in database (#586)
* filter for mint quote states in db

---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
2025-02-08 09:28:54 +00:00
thesimplekid
be5e5d2371 chore: prepare v0.7.0 2025-02-06 13:12:16 +00:00
thesimplekid
7b69aa966a feat: add remove proofs to mint db 2025-02-05 10:48:33 +00:00
thesimplekid
c455809812 refactor: move quote_ttl to database 2025-01-29 23:58:13 +00:00
thesimplekid
5481286ec9 refactor: move mint_info to database 2025-01-29 23:29:25 +00:00
thesimplekid
0674144001 refactor: remove mint url from config 2025-01-29 20:38:53 +00:00
C
8fe0982c6d Introduce cashu to host the shared types, traits and other common code (#519)
---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2025-01-12 12:50:05 +00:00
thesimplekid
6a8a5a7941 fix: mpp (#523) 2025-01-05 14:42:44 +00:00
thesimplekid
003a8f1b47 feat: signature on mint witness 2024-12-23 10:25:42 -05:00
thesimplekid
0e12314643 chore: Release 0.6.0 2024-12-17 08:18:32 -05:00
Timothée Delabrouille
7d87c4806c feat: use Uuid as mint and melt quote ids (#469) 2024-12-05 09:58:53 +00:00
thesimplekid
bc490ed208 fix(wallet): stop sqlite from overwritting keyset counter 2024-12-02 19:38:28 +00:00
Cesar Rodas
af2fe580f4 Minor improvement in the SQLite crate
This is a minor improvement over the SQLite crate, which performs fewer SQL
statements and fetches multiple results instead.

This will also remove some redundant commit() and rollback calls. Rollback
already happens on drop, and there is no need for a commit if the database
hasn't changed, as the transaction is used as a locking mechanism in this
context.
2024-11-27 08:33:16 +00:00
thesimplekid
d1b03d39c5 chore: update to 0.5.0 2024-11-19 09:55:46 +00:00
thesimplekid
479b4e78e5 Merge pull request #398 from prusnak/mint-info-urls
NUT-06: add urls field
2024-11-06 10:44:09 +00:00
ok300
f6533a08de Add Proofs trait to consolidate aggregate fns 2024-10-17 23:28:56 +01:00
Pavol Rusnak
b507ce7201 NUT-06: add urls field 2024-10-11 14:54:39 +02:00
thesimplekid
7ea568e615 feat: sql store signatures dleq 2024-09-30 12:20:43 +02:00
thesimplekid
ca6fdb5bff feat: return change in check quote 2024-09-30 09:47:23 +02:00
thesimplekid
5139c47dac feat: check outgoing payment status flow 2024-09-25 20:28:05 +02:00
thesimplekid
974796400d feat: get proofs for quote id 2024-09-23 14:05:28 +02:00
thesimplekid
fa8776998a feat(mint): store mint_quote_id for blind sig 2024-09-21 11:13:30 +02:00
thesimplekid
117443d126 feat: store melt_quote_id for proof 2024-09-21 11:13:30 +02:00
thesimplekid
f2867188a8 fix: sqlx sqlite settings
feat: use transactions in all sql fns
2024-09-21 11:10:38 +02:00
Pavol Rusnak
1021ec5299 chore: bump bitcoin + lightning-invoice deps 2024-09-09 12:09:46 +01:00
thesimplekid
3bf1a3b28f chore: version cdk in other crates 2024-09-08 22:12:06 +01:00
thesimplekid
f7e4ea3a6c Release 0.4.0 2024-09-08 21:48:51 +01:00
thesimplekid
2fdf48cc72 feat: remove mint and wallet errors 2024-09-08 11:48:52 +01:00
thesimplekid
c4925aae9f fix: sqlx msrv 2024-09-04 16:27:43 +01:00
Pavol Rusnak
5a14ddbc67 nut06: mint_icon_url -> icon_url 2024-09-04 12:08:19 +01:00
Pavol Rusnak
e67dc15ce6 feat: implement nut-06 time 2024-09-03 17:00:57 +01:00
thesimplekid
1eb14703a5 refactor: cdk MSRV 2024-09-03 12:35:35 +01:00
thesimplekid
5f87df2cef refactor: use MintUrl::from_str 2024-09-03 11:36:28 +01:00
David Caseria
d0d7281c77 Modify WalletDatabase trait to better support db transactions 2024-08-24 17:32:59 +03:00
Pavol Rusnak
9eff00bcaf fix: make capitalization of error messages consistent 2024-08-19 13:53:26 +02:00
thesimplekid
bcb4a5927d refactor: remove the use of flat maps 2024-08-17 14:35:52 +02:00