Commit Graph

22 Commits

Author SHA1 Message Date
David Caseria
fb07ec4b85 Include cargo config for cdk-ffi to enforce Android page sizes (#1241) 2025-10-30 09:41:29 -04:00
David Caseria
344b81a694 Update FFI Database Objects to Records (#1149) 2025-10-24 13:24:06 -04:00
David Caseria
5caa7d58ed Configure internal Wallets of a MultiMintWallet (#1177) 2025-10-13 09:53:48 +01:00
asmo
5fc38d5980 fi: add ws resource to ProtectedEndpoints (#1178)
* feat: add ws resource to ProtectedEndpoints
2025-10-10 12:53:07 +01:00
tsk
2c2fce9612 chore: remove ctor (#1168) 2025-10-08 15:18:06 +01:00
C
cdd59359b9 Introduce a generic pubsub mod in cdk-common (#1098)
* pubsub: consolidate into Spec, adopt Arc<SubscriptionId>, and wire through  wallet/mint/WS/FFI

Refactor the pub/sub engine to a single Spec trait, move Event alongside it,
and propagate Arc-backed subscription IDs across the stack. This simplifies
generics, clarifies responsibilities, and preserves coalescing +
latest-on-subscribe semantics.

-   **Single source of truth:** `Spec` owns `Topic`, `Event`, `SubscriptionId`,
    `Context`, new_instance, and fetch_events.
-   **Lean & explicit API:** Remove Topic trait split;
    `Subscriber::send(Event)` carries sub-ID internally.
-   **Performance/ergonomics:** `Arc<SubscriptionId>` avoids heavy clones and
    makes channel/task hops trivial.

-   Introduce `pub_sub/typ.rs` with:
    -   trait `Spec`
    -   trait `Event` colocated with Spec.
-   Remove `pub_sub/event.rs` fold `Event` into `typ.rs`.
-   Make `Pubsub<S>` generic over `Spec` and store `Arc<S>`.
-   The subscriber holds `Arc<SubscriptionId>` and deduplicates the latest
    entry per subscription.
-   SubscriptionRequest: rename SubscriptionName → SubscriptionId; return
    `Arc<...>` from `subscription_name()`.
-   Remote consumer (Transport) now parameterized by `Spec`; control types
    updated:
    -   `StreamCtrl<S>`, `SubscribeMessage<S>`, internal caches keyed by
        `S::Topic`.
-   Mint/wallet:
    -   Mint: `MintPubSubSpec` (Context = `DynMintDatabase`),
        `PubSubManager(Pubsub<MintPubSubSpec>)`.
    -   Wallet: lightweight MintSubTopics Spec with `Context = ()`.
-   IDs go Arc end-to-end:
    -   cdk-axum WS maps `HashMap<Arc<SubId>, JoinHandle<()>>`, publisher sends
        `(Arc<SubId>, NotificationPayload)`.
    -   `subscription::{Params, WalletParams}` now use `Arc<...>`.
    -   cdk-ffi conversions & wallet glue updated.
    -   Integration tests updated for new types.

-   Coalescing unchanged: multiple local subs to the same topic are combined
    into a single remote sub.
-   Backfill via `Spec::fetch_events(topics, Subscriber)`; Subscriber enforces
    latest-only dedupe per subscription.

**Result:** a slimmer, more maintainable pub/sub core that’s easier to embed
across mint, wallet, transports, and FFI without sacrificing performance or
semantics.


---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2025-10-08 09:33:45 +01:00
tsk
c5e5d71701 feat(cdk): add payment request and proof to transaction records (#1155)
Add payment_request and payment_proof fields to Transaction model to store Lightning invoice details and payment preimages. Update database migrations and all transaction creation points across wallet operations (mint, melt, send, receive) to populate these fields.
2025-10-06 14:40:21 +02:00
vnprc
1a493d61f8 feat: optimize SQL balance calculation (#1152)
* feat: optimize SQL balance calculation

replace proof-fetching approach with SUM aggregation

- add get_balance() method to Database trait
- implement SQL SUM aggregation in cdk-sql-common
- update total_balance() to use get_balance() instead of get_unspent_proofs()
- redb impl maintains existing behavior

---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
Co-authored-by: Cesar Rodas <cesar@rodasm.com.py>
2025-10-06 10:29:57 +02:00
David Caseria
a8c35dbef0 Split uniffi types into multiple mods (#1142) 2025-10-05 13:15:33 +02:00
David Caseria
ca3444939e Add MultiMintWallet check and wait for mint quotes (#1146)
* Add MultiMintWallet check and wait for mint quotes
2025-10-02 12:24:36 +01:00
asmo
cb2e534f81 feat: added postgres to ffi (#1117)
* feat: added postgres to ffi
2025-09-30 14:14:28 +01:00
lollerfirst
6d0003a4fc token: add spending-condition inspection helpers and token_secrets() (#1124)
* token: add Token::token_secrets() and spending-condition helpers

- New helpers on Token that do not require mint keysets:
  - spending_conditions()
  - p2pk_pubkeys()
  - p2pk_refund_pubkeys()
  - htlc_hashes()
  - locktimes()
- Introduce token_secrets() to unify V3/V4 proof traversal and avoid duplication
- Bypass short->long keyset-id mapping since only Secret is needed for conditions
- Use &Secret for TryFrom to fix compile error
2025-09-26 20:56:01 +01:00
David Caseria
f48660f344 Make Uniffi Records Codable in Swift (#1125) 2025-09-25 18:59:01 +01:00
C
0f0b78c0b0 Include supported amounts instead of assuming the power of 2 (#1055)
* Include supported amounts instead of assuming the power of 2

The mint's signatory defines the amounts and the wallet, and the mint, when
paying, should use them instead of assuming the supported amounts are
2^(0..32), which is not part of the spec.

* Introduce FeeAndAmount struct
2025-09-24 13:02:24 +01:00
thesimplekid
6ad2c3a67e chore: ffi to release 2025-09-23 14:59:29 +01:00
asmo
1e6102f494 add FFI types for NUT-04 and NUT-05 (#1101)
* feat: add FFI types and conversion logic for NUT-04 and NUT-05 settings in `cdk-ffi`

* feat: remove auth feature and deafult to having auth

---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
2025-09-23 11:44:11 +01:00
thesimplekid
6b80b74cb1 feat: remove features from auth (#1103) 2025-09-23 09:27:07 +01:00
thesimplekid
c1e35f964b Remove cashu ffi (#1102)
* feat: remove cdk-common and cashu from cdk-ffi
2025-09-22 16:50:51 +01:00
David Caseria
12164a0764 Fix Async FFI Constructors (#1085)
* Fix unused async in FFI

* Fix FFI async constructor

* Fix FFI MultiMintWallet async constructor
2025-09-18 20:42:00 +01:00
David Caseria
23cba67c3b MultiMintWallet Refactor (#1001) 2025-09-17 17:27:54 +01:00
C
c3c8e87164 Add resolve_dns_txt to HttpTransport and MintConnector (#1068)
* Add `resolve_dns_txt` to HttpTransport and MintConnector

Fixes #1036

* Use `hickory_resolver` to resolve DNS entries

* Remote default implementation of methods

* Fix build for wasm
2025-09-16 09:01:34 +01:00
David Caseria
21b4080810 FFI bindings for Wallet (#932)
* feat: Add initial CDK FFI bindings using UniFFI proc macros

* feat: Add complete Wallet methods to CDK FFI bindings
2025-09-10 09:56:55 +01:00