Commit Graph

29 Commits

Author SHA1 Message Date
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
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
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
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
003a8f1b47 feat: signature on mint witness 2024-12-23 10:25:42 -05:00
thesimplekid
bc490ed208 fix(wallet): stop sqlite from overwritting keyset counter 2024-12-02 19:38:28 +00:00
Pavol Rusnak
b507ce7201 NUT-06: add urls field 2024-10-11 14:54:39 +02: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
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
thesimplekid
bcb4a5927d refactor: remove the use of flat maps 2024-08-17 14:35:52 +02:00
Caleb Beery
40554987e1 feat: new struct 'MintUrl' which trims trailing slashes (#283)
https://github.com/cashubtc/nuts/pull/151/files
2024-08-12 19:32:44 +00:00
thesimplekid
e57c7f1e9d chore: fix formatting 2024-08-11 10:12:21 -04:00
Caleb Beery
da1acc4e6d feat: add mint_icon_url to mint details. (#282) 2024-08-10 17:57:02 -04:00
thesimplekid
fa3f6c4b38 chore: instrument logging on wallet db 2024-07-23 15:35:37 +01:00
thesimplekid
4f240f3953 refactor(wallet/database): get_proofs returns Vec<ProofInfo> instead of Option<Vec<ProofInfo>> 2024-07-16 15:03:05 +01:00
thesimplekid
17263b07f5 feat(NUT02): add input_fee_ppk
chore: instrument log on mint fns
2024-07-11 12:22:20 +01:00
thesimplekid
6a315fc3b9 feat: mintd axum server
feat: deafult NUT-04 and NUT-05 settings to enable bolt11 sats
2024-07-05 23:49:31 +01:00
thesimplekid
b528964fb6 chore: readmes
chore: doc comments on public
2024-06-28 15:37:10 +01:00
thesimplekid
7223c5bda8 feat(NUT05): update with quote state
feat(NUT04): update with quote state

feat: db migrations for mint state

chore: remove logging
2024-06-27 20:35:19 +01:00
thesimplekid
04a463be1f feat(wallet): make wallet single mint and unit
feat(wallet): cli use mint with one url and unit

feat(wallet): remove p2pk keys from wallet

feat(wallet): multimint wallet
2024-06-27 12:09:44 +01:00
thesimplekid
54c50c3724 feat(wallet): update mint url
feat(cli): add change mint
2024-06-25 10:44:59 +01:00
thesimplekid
5123571687 feat(cli): working dir 2024-06-24 12:20:35 +01:00
thesimplekid
971fd30d8d feat(wallet/sqlite): use sqlx migration 2024-06-12 15:43:37 +01:00
thesimplekid
e1506c4e34 feat: wallet sqlite 2024-06-08 11:37:48 +01:00
thesimplekid
bbc63306db feat: mint sqlite 2024-06-08 10:34:39 +01:00