Browse Source

refactor: remove bindings

thesimplekid 1 year ago
parent
commit
bba3189a2f
100 changed files with 1 additions and 4612 deletions
  1. 1 6
      Cargo.toml
  2. 0 8
      bindings/README.md
  3. 0 38
      bindings/cashu-ffi/.gitignore
  4. 0 20
      bindings/cashu-ffi/Cargo.toml
  5. 0 16
      bindings/cashu-ffi/bindings-python/.gitignore
  6. 0 2
      bindings/cashu-ffi/bindings-python/MANIFEST.in
  7. 0 46
      bindings/cashu-ffi/bindings-python/README.md
  8. 0 5
      bindings/cashu-ffi/bindings-python/examples/amount.py
  9. 0 29
      bindings/cashu-ffi/bindings-python/examples/token.py
  10. 0 7
      bindings/cashu-ffi/bindings-python/pyproject.toml
  11. 0 4
      bindings/cashu-ffi/bindings-python/requirements.txt
  12. 0 26
      bindings/cashu-ffi/bindings-python/setup.py
  13. 0 2
      bindings/cashu-ffi/bindings-python/src/cashu/__init__.py
  14. 0 3
      bindings/cashu-ffi/build.rs
  15. 0 17
      bindings/cashu-ffi/justfile
  16. 0 276
      bindings/cashu-ffi/src/cashu.udl
  17. 0 66
      bindings/cashu-ffi/src/error.rs
  18. 0 38
      bindings/cashu-ffi/src/lib.rs
  19. 0 9
      bindings/cashu-ffi/src/nuts/mod.rs
  20. 0 54
      bindings/cashu-ffi/src/nuts/nut00/blinded_message.rs
  21. 0 55
      bindings/cashu-ffi/src/nuts/nut00/blinded_signature.rs
  22. 0 56
      bindings/cashu-ffi/src/nuts/nut00/mint_proofs.rs
  23. 0 6
      bindings/cashu-ffi/src/nuts/nut00/mod.rs
  24. 0 78
      bindings/cashu-ffi/src/nuts/nut00/premint_secrets.rs
  25. 0 136
      bindings/cashu-ffi/src/nuts/nut00/proof.rs
  26. 0 106
      bindings/cashu-ffi/src/nuts/nut00/token.rs
  27. 0 26
      bindings/cashu-ffi/src/nuts/nut01/key_pair.rs
  28. 0 110
      bindings/cashu-ffi/src/nuts/nut01/keys.rs
  29. 0 4
      bindings/cashu-ffi/src/nuts/nut01/mod.rs
  30. 0 40
      bindings/cashu-ffi/src/nuts/nut01/public_key.rs
  31. 0 34
      bindings/cashu-ffi/src/nuts/nut01/secret_key.rs
  32. 0 113
      bindings/cashu-ffi/src/nuts/nut02/key_set.rs
  33. 0 35
      bindings/cashu-ffi/src/nuts/nut02/mint_keyset.rs
  34. 0 5
      bindings/cashu-ffi/src/nuts/nut02/mod.rs
  35. 0 82
      bindings/cashu-ffi/src/nuts/nut03/mod.rs
  36. 0 168
      bindings/cashu-ffi/src/nuts/nut04/mod.rs
  37. 0 143
      bindings/cashu-ffi/src/nuts/nut05/mod.rs
  38. 0 134
      bindings/cashu-ffi/src/nuts/nut06.rs
  39. 0 65
      bindings/cashu-ffi/src/nuts/nut07/mod.rs
  40. 0 112
      bindings/cashu-ffi/src/nuts/nut08/mod.rs
  41. 0 54
      bindings/cashu-ffi/src/types/amount.rs
  42. 0 43
      bindings/cashu-ffi/src/types/bolt11_invoice.rs
  43. 0 36
      bindings/cashu-ffi/src/types/keyset_info.rs
  44. 0 49
      bindings/cashu-ffi/src/types/melt_quote.rs
  45. 0 47
      bindings/cashu-ffi/src/types/mint_quote.rs
  46. 0 47
      bindings/cashu-ffi/src/types/mint_quote_info.rs
  47. 0 13
      bindings/cashu-ffi/src/types/mod.rs
  48. 0 44
      bindings/cashu-ffi/src/types/secret.rs
  49. 0 10
      bindings/cashu-ffi/uniffi.toml
  50. 0 2
      bindings/cashu-js/.cargo/config.toml
  51. 0 7
      bindings/cashu-js/.gitignore
  52. 0 12
      bindings/cashu-js/.npmignore
  53. 0 28
      bindings/cashu-js/Cargo.toml
  54. 0 29
      bindings/cashu-js/LICENSE
  55. 0 21
      bindings/cashu-js/LICENSES/NOSTR-MIT
  56. 0 12
      bindings/cashu-js/examples/amount.js
  57. 0 5
      bindings/cashu-js/justfile
  58. 0 44
      bindings/cashu-js/package.json
  59. 0 21
      bindings/cashu-js/scripts/LICENSE
  60. 0 35
      bindings/cashu-js/scripts/build.sh
  61. 0 10
      bindings/cashu-js/scripts/epilogue.d.ts
  62. 0 76
      bindings/cashu-js/scripts/epilogue.js
  63. 0 12
      bindings/cashu-js/src/error.rs
  64. 0 12
      bindings/cashu-js/src/lib.rs
  65. 0 20
      bindings/cashu-js/src/nuts/mod.rs
  66. 0 53
      bindings/cashu-js/src/nuts/nut00/blinded_message.rs
  67. 0 62
      bindings/cashu-js/src/nuts/nut00/blinded_messages.rs
  68. 0 35
      bindings/cashu-js/src/nuts/nut00/blinded_signature.rs
  69. 0 11
      bindings/cashu-js/src/nuts/nut00/mod.rs
  70. 0 65
      bindings/cashu-js/src/nuts/nut00/proof.rs
  71. 0 69
      bindings/cashu-js/src/nuts/nut00/token.rs
  72. 0 47
      bindings/cashu-js/src/nuts/nut01/key_pair.rs
  73. 0 51
      bindings/cashu-js/src/nuts/nut01/keys.rs
  74. 0 9
      bindings/cashu-js/src/nuts/nut01/mod.rs
  75. 0 41
      bindings/cashu-js/src/nuts/nut01/public_key.rs
  76. 0 31
      bindings/cashu-js/src/nuts/nut01/secret_key.rs
  77. 0 152
      bindings/cashu-js/src/nuts/nut02/keyset.rs
  78. 0 45
      bindings/cashu-js/src/nuts/nut02/mint_keyset.rs
  79. 0 5
      bindings/cashu-js/src/nuts/nut02/mod.rs
  80. 0 104
      bindings/cashu-js/src/nuts/nut03.rs
  81. 0 82
      bindings/cashu-js/src/nuts/nut04.rs
  82. 0 1
      bindings/cashu-js/src/nuts/nut05.rs
  83. 0 106
      bindings/cashu-js/src/nuts/nut06.rs
  84. 0 94
      bindings/cashu-js/src/nuts/nut07.rs
  85. 0 131
      bindings/cashu-js/src/nuts/nut08.rs
  86. 0 142
      bindings/cashu-js/src/nuts/nut09.rs
  87. 0 48
      bindings/cashu-js/src/types/amount.rs
  88. 0 50
      bindings/cashu-js/src/types/bolt11_invoice.rs
  89. 0 9
      bindings/cashu-js/src/types/mod.rs
  90. 0 48
      bindings/cashu-js/src/types/proofs_status.rs
  91. 0 44
      bindings/cashu-js/src/types/secret.rs
  92. 0 9
      bindings/cashu-js/tsconfig.json
  93. 0 30
      bindings/cashu-sdk-ffi/Cargo.toml
  94. 0 29
      bindings/cashu-sdk-ffi/LICENSE
  95. 0 21
      bindings/cashu-sdk-ffi/LICENSES/NOSTR_SDK_LICENSE_MIT
  96. 0 16
      bindings/cashu-sdk-ffi/bindings-python/.gitignore
  97. 0 29
      bindings/cashu-sdk-ffi/bindings-python/LICENSE
  98. 0 21
      bindings/cashu-sdk-ffi/bindings-python/LICENSES/NOSTR_SDK_MIT
  99. 0 3
      bindings/cashu-sdk-ffi/bindings-python/MANIFEST.in
  100. 0 50
      bindings/cashu-sdk-ffi/bindings-python/README.md

+ 1 - 6
Cargo.toml

@@ -3,11 +3,6 @@
 members = [
     "crates/cashu",
     "crates/cashu-sdk",
-    "bindings/uniffi-bindgen",
-    "bindings/cashu-ffi",
-    "bindings/cashu-sdk-ffi",
-    "bindings/cashu-js",
-    "bindings/cashu-sdk-js"
 ]
 resolver = "2"
 
@@ -22,7 +17,7 @@ authors = ["thesimplekid"]
 edition = "2021"
 description = "cashu-crab"
 readme = "README.md"
-repository = "https://github.com/thesimplekid/cashu-rs-mint"
+repository = "https://github.com/thesimplekid/cashu-crab"
 license-file = "LICENSE"
 keywords = ["bitcoin", "e-cash", "cashu"]
 

+ 0 - 8
bindings/README.md

@@ -1,8 +0,0 @@
-# Cashu bindings
-
-- UniFFI (Kotlin (soon), Swift (soon), Python):
-    * [cashu-ffi](./cashu-ffi/): UniFFI bindings of the [cashu] crate
-    * [cashu-sdk-ffi](./cashu-sdk-ffi/): UniFFI bindings of the [cashu-sdk] crate
-
-[cashu]: ../crates/cashu/
-[cashu-sdk]: ../crates/cashu-sdk/

+ 0 - 38
bindings/cashu-ffi/.gitignore

@@ -1,38 +0,0 @@
-target
-build
-.gradle
-wallet_db
-bdk_ffi_test
-local.properties
-*.log
-*.dylib
-*.so
-.DS_Store
-testdb
-xcuserdata
-.lsp
-.clj-kondo
-.idea/
-.editorconfig
-bdk.kt
-
-# Swift related
-/.build
-/.swiftpm
-/Packages
-/*.xcodeproj
-xcuserdata/
-DerivedData/
-.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
-bdkFFI.xcframework.zip
-bdkFFI
-libbdkffi.a
-bdkFFI.h
-BitcoinDevKit.swift
-bdk.swift
-.build
-
-# Python related
-__pycache__
-
-/ffi

+ 0 - 20
bindings/cashu-ffi/Cargo.toml

@@ -1,20 +0,0 @@
-[package]
-name = "cashu-ffi"
-version = "0.1.0"
-edition = "2021"
-publish = false
-rust-version.workspace = true
-
-
-[lib]
-name = "cashu_ffi"
-crate-type = ["lib", "cdylib", "staticlib"]
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
-[dependencies]
-cashu  = { path = "../../crates/cashu", features = ["wallet", "mint", "all-nuts"] }
-url = { workspace = true }
-uniffi = { workspace = true }
-
-[build-dependencies]
-uniffi = { workspace = true, features = ["build"] }

+ 0 - 16
bindings/cashu-ffi/bindings-python/.gitignore

@@ -1,16 +0,0 @@
-.tox/
-dist/
-cashu_protocol.egg-info/
-__pycache__/
-libcashu_ffi.dylib
-.idea/
-.DS_Store
-
-*.swp
-
-src/cashu/cashu.py
-src/cashu/*.so
-*.whl
-build/
-
-testing-setup-py-simple-example.py

+ 0 - 2
bindings/cashu-ffi/bindings-python/MANIFEST.in

@@ -1,2 +0,0 @@
-include ./src/cashu/libcashu_ffi.dylib
-include ./src/cashu/libcashu_ffi.so

+ 0 - 46
bindings/cashu-ffi/bindings-python/README.md

@@ -1,46 +0,0 @@
-Cashu Python bindings
-
-
-**ALPHA** This library is in early development, the api will change.
-
-## Supported Nuts:
-
-Check: [https://github.com/thesimplekid/cashu-crab#implemented-nuts](https://github.com/thesimplekid/cashu-crab#implemented-nuts)
-
-## Build the package
-
-```shell
-just python
-```
-
-## Getting Started
-
-For now this is not published as a package as it is still in early development. So you will have to build it as above. In the future this will be pulished and pip can be used to install. 
-
-```python
-from cashu_protocol import Token, Proof, PublicKey, Amount
-
-proof_one = Proof(Amount.from_sat(2), "EhpennC9qB3iFlW8FZ_pZw", PublicKey.from_hex("02c020067db727d586bc3183aecf97fcb800c3f4cc4759f69c626c9db5d8f5b5d4"), "DSAl9nvvyfva")
-
-proof_two = Proof(Amount.from_sat(8), "TmS6Cv0YT5PU_5ATVKnukw", PublicKey.from_hex("02ac910bef28cbe5d7325415d5c263026f15f9b967a079ca9779ab6e5c2db133a7"), "DSAl9nvvyfva")
-
-new_token = Token("https://8333.space:3338", [proof_one, proof_two], "Thank you.")
-
-print(new_token.as_string())
-
-```
-
-
-## License
-
-Code is under the [BSD 3-Clause License](LICENSE)
-
-## Contribution
-
-All contributions welcome.
-
-Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any additional terms or conditions.
-
-## Contact
-
-I can be contacted for comments or questions on nostr at _@thesimplekid.com (npub1qjgcmlpkeyl8mdkvp4s0xls4ytcux6my606tgfx9xttut907h0zs76lgjw) or via email tsk@thesimplekid.com.

+ 0 - 5
bindings/cashu-ffi/bindings-python/examples/amount.py

@@ -1,5 +0,0 @@
-from cashu_protocol import Amount
-
-amount = Amount().from_sat(10)
-
-print(amount.to_sat())

+ 0 - 29
bindings/cashu-ffi/bindings-python/examples/token.py

@@ -1,29 +0,0 @@
-from cashu_protocol import Token, Proof, PublicKey, Amount
-
-token_str = "cashuAeyJ0b2tlbiI6W3sibWludCI6Imh0dHBzOi8vODMzMy5zcGFjZTozMzM4IiwicHJvb2ZzIjpbeyJpZCI6IkRTQWw5bnZ2eWZ2YSIsImFtb3VudCI6Miwic2VjcmV0IjoiRWhwZW5uQzlxQjNpRmxXOEZaX3BadyIsIkMiOiIwMmMwMjAwNjdkYjcyN2Q1ODZiYzMxODNhZWNmOTdmY2I4MDBjM2Y0Y2M0NzU5ZjY5YzYyNmM5ZGI1ZDhmNWI1ZDQifSx7ImlkIjoiRFNBbDludnZ5ZnZhIiwiYW1vdW50Ijo4LCJzZWNyZXQiOiJUbVM2Q3YwWVQ1UFVfNUFUVktudWt3IiwiQyI6IjAyYWM5MTBiZWYyOGNiZTVkNzMyNTQxNWQ1YzI2MzAyNmYxNWY5Yjk2N2EwNzljYTk3NzlhYjZlNWMyZGIxMzNhNyJ9XX1dLCJtZW1vIjoiVGhhbmsgeW91LiJ9"
-
-token = Token.from_string(token_str)
-
-
-print(token.memo())
-for p in token.token():
-    print(p.url())
-    for proof in p.proofs():
-        print(proof.id())
-        print(proof.amount().to_sat())
-        print(proof.secret())
-        print(proof.c().to_hex())
-
-
-proof_one = Proof(Amount.from_sat(2), "EhpennC9qB3iFlW8FZ_pZw", PublicKey.from_hex("02c020067db727d586bc3183aecf97fcb800c3f4cc4759f69c626c9db5d8f5b5d4"), "DSAl9nvvyfva")
-
-proof_two = Proof(Amount.from_sat(8), "TmS6Cv0YT5PU_5ATVKnukw", PublicKey.from_hex("02ac910bef28cbe5d7325415d5c263026f15f9b967a079ca9779ab6e5c2db133a7"), "DSAl9nvvyfva")
-
-new_token = Token("https://8333.space:3338", [proof_one, proof_two], "Thank you.")
-
-print(new_token.as_string())
-
-# This is failing because of the url serialization.
-# https://github.com/thesimplekid/cashu-crab/issues/13
-# It is still a valid token, just does not match the reference
-print(new_token.as_string == token_str)

+ 0 - 7
bindings/cashu-ffi/bindings-python/pyproject.toml

@@ -1,7 +0,0 @@
-[build-system]
-requires = ["setuptools", "wheel"]
-
-[tool.pytest.ini_options]
-pythonpath = [
-  "."
-]

+ 0 - 4
bindings/cashu-ffi/bindings-python/requirements.txt

@@ -1,4 +0,0 @@
-semantic-version==2.9.0
-typing_extensions==4.0.1
-setuptools==67.4.0
-wheel==0.38.4

+ 0 - 26
bindings/cashu-ffi/bindings-python/setup.py

@@ -1,26 +0,0 @@
-#!/usr/bin/env python
-
-from setuptools import setup
-
-from pathlib import Path
-this_directory = Path(__file__).parent
-long_description = (this_directory / "README.md").read_text()
-
-setup(
-    name='cashu-protocol',
-    version='0.0.1',
-    description="Rust implementation of cashu.",
-    long_description=long_description,
-    long_description_content_type='text/markdown',
-    include_package_data = True,
-    zip_safe=False,
-    packages=['cashu_protocol'],
-    package_dir={'cashu_protocol': './src/cashu'},
-    package_data={'cashu_protocol': ['*.so', 'lib*']},
-    url="https://github.com/thesimplekid/cashu-crab",
-    author="thesimplekid <tsk@thesimplekid.com>",
-    license="BSD-3-Clause",
-     # This is required to ensure the library name includes the python version, abi, and platform tags
-    # See issue #350 for more information
-    has_ext_modules=lambda: True,
-)

+ 0 - 2
bindings/cashu-ffi/bindings-python/src/cashu/__init__.py

@@ -1,2 +0,0 @@
-from cashu_protocol.cashu import *
-

+ 0 - 3
bindings/cashu-ffi/build.rs

@@ -1,3 +0,0 @@
-fn main() {
-    uniffi::generate_scaffolding("./src/cashu.udl").expect("Building the UDL file failed");
-}

+ 0 - 17
bindings/cashu-ffi/justfile

@@ -1,17 +0,0 @@
-
-init:
-	rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim
-	rustup target add aarch64-apple-darwin x86_64-apple-darwin
-	rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
-	cargo install cbindgen
-	cargo install cargo-ndk
-
-python:
-	rm -rf dist
-	pip install -r bindings-python/requirements.txt
-	cargo build --release
-	cargo run -p uniffi-bindgen generate src/cashu.udl --language python --no-format -o bindings-python/src/cashu/
-	cp ../../target/release/libcashu_ffi.so bindings-python/src/cashu/
-	cp ../../target/release/libcashu_ffi.dylib bindings-python/src/cashu/ | true
-	cd bindings-python && pip wheel --no-deps -w dist .
-	pip install ./bindings-python/dist/cashu_protocol*.whl --force-reinstall

+ 0 - 276
bindings/cashu-ffi/src/cashu.udl

@@ -1,276 +0,0 @@
-namespace cashu {};
-
-[Error]
-interface CashuError {
-    Generic(string err);
-};
-
-// Types
-
-[Enum]
-interface CurrencyUnit {
-	Sat();
-	Usd();
-	Custom(string unit);
-};
- 
-interface Bolt11Invoice {
-    [Throws=CashuError]
-    constructor(string bolt11);
-	string as_string();
-	Amount? amount();
-};
-
-interface Amount {
-	constructor(u64 amount);
- 	sequence<Amount> split();
-};
-
-interface Secret {
-	constructor();
-	sequence<u8> as_bytes();	
-};
-
-interface MintQuote {
-	constructor(string id, Amount amount, string unit, Bolt11Invoice request, boolean paid, u64 boolean);
-};
-
-interface MeltQuote {
-	constructor(string id, Amount amount, string unit, Bolt11Invoice request, Amount fee_reserve, boolean paid, u64 boolean);
-};
-
-// NUT00
-
-interface PublicKey {
-    [Throws=CashuError, Name=from_hex]
-    constructor(string hex);
-    [Throws=CashuError]
-    string to_hex();
-};
-
-
-interface SecretKey {
-    [Throws=CashuError]
-    string to_hex();
-};
-
-interface BlindedMessage {
-	constructor(Id keyset_id, Amount amount, PublicKey b);
-	Amount amount();
-	Id keyset_id();
-	PublicKey b();	
-};
-
-interface Proof {
-	constructor(Amount amount, Secret secret, PublicKey c, Id id);
-	Amount amount();
-	Secret secret();
-	PublicKey c();
-	Id keyset_id();
-};
-
-interface BlindedSignature {
-	constructor(Id keyset_id, Amount amount, PublicKey c);
-	Id keyset_id();
-	Amount amount();
-	PublicKey c();
-};
-
-interface MintProof {
-	constructor(Amount? amount, Secret secret, PublicKey? c, Id? id);
-	Amount? amount();
-	Secret secret();
-	PublicKey? c();
-	Id? keyset_id();
-	
-};
-
-interface MintProofs {
-    [Throws=CashuError]
-	constructor(string mint, sequence<Proof> proofs);
-	string url();
-	sequence<Proof> proofs();
-};
-
-interface Token {
-    [Throws=CashuError]
-	constructor(string mint, sequence<Proof> token, string? memo, string? unit);
-	sequence<MintProofs> token();
-	string? memo();
-	string? unit();
-	string to_string();
-    [Throws=CashuError, Name=from_string]
-	constructor(string token);
-	
-};
-
-interface PreMintSecrets {
-    [Throws=CashuError, Name=random]
-	constructor(Id keyset_id, Amount amount);
-    [Throws=CashuError, Name=blank]
-	constructor(Id keyset_id, Amount amount);
-	sequence<BlindedMessage> blinded_messages();
-	sequence<Secret> secrets();
-	sequence<SecretKey> rs();
-	sequence<Amount> amounts();
-};
-
-
-// NUT-02
-
-interface Id {
-    [Throws=CashuError]
-	constructor(string id);
-};
-
-interface KeyPair {
-	[Name=from_secret_key]
-	constructor(SecretKey secret_key);
-	SecretKey secret_key();
-	PublicKey public_key();	
-};
-
-interface Keys {
-	constructor(record<string, PublicKey> keys);
-	record<string, PublicKey> keys();
-	record<string, string> as_hashmap();
-	PublicKey? amount_key(Amount amount);
-};
-
-interface KeySet {
-	constructor(Id id, string unit, Keys keys);
-	Id id();
-	Keys keys();
-};
-
-interface MintKeySet {
-	[Name=generate]
-	constructor(string secret, string unit, string derivation_path, u8 max_order);
-};
-
-interface KeysResponse {
-	constructor(sequence<KeySet> keysets);
-};
-
-interface KeySetResponse {
-	constructor(sequence<KeySetInfo> keysets);
-	sequence<KeySetInfo> keysets();
-};
-
-// NUT-03
-
-interface SwapRequest {
-	constructor(sequence<Proof> proofs, sequence<BlindedMessage> outputs);
-	sequence<Proof> proofs();
-	sequence<BlindedMessage> outputs();
-	Amount proofs_amount();
-	Amount output_amount();
-};
-
-interface SwapResponse {
-	constructor(sequence<BlindedSignature> promises);
-	sequence<BlindedSignature> signatures();
-};
-
-// NUT-04
-
-interface MintQuoteBolt11Request {
-	constructor(Amount amount, string unit);
-	Amount amount();
-};
-
-interface MintQuoteBolt11Response {
-	constructor(string quote, string request, boolean paid, u64 expiry);
-	string quote();
-	string request();
-	boolean paid();
-	u64 expiry();
-};
-
-
-interface MintBolt11Request {
-	constructor(string quote, sequence<BlindedMessage> outputs);
-	string quote();
-	sequence<BlindedMessage> outputs();
-};
-
-interface MintBolt11Response {
-	constructor(sequence<BlindedSignature> signatures);
-	sequence<BlindedSignature> signatures();
-};
-
-// NUT-05
-
-interface MeltQuoteBolt11Response {
-    [Throws=CashuError]
-	constructor(string quote, u64 amount, u64 fee_reserve, boolean paid, u64 expiry);
-	string quote();
-	u64 amount();
-	u64 fee_reserve();
-	boolean paid();
-	u64 expiry();
-};
-
-interface MeltQuoteBolt11Request {
-    [Throws=CashuError]
-	constructor(string request, string unit);
-	string request();
-};
-
-interface MeltBolt11Request {
-    [Throws=CashuError]
-	constructor(string quote, sequence<Proof> inputs, sequence<BlindedMessage>? outputs);
-	sequence<Proof> inputs();
-	string quote();
-};
-
-interface MeltBolt11Response {
-	constructor(boolean paid, string? payment_preimage, sequence<BlindedSignature>? change);
-	string? payment_preimage();
-	boolean paid();
-};
-
-// NUT-06
-
-interface MintInfo {
-	constructor(string? name, PublicKey? pubkey, MintVersion? version, string? description, string? description_long, sequence<sequence<string>>? contact, string nuts, string? motd);
-	string? name();
-	PublicKey? pubkey();
-	MintVersion? version();
-	string? description();
-	string? description_long();
-	sequence<sequence<string>>? contact();
-	string? motd();
-};
-
-// NUT-07
-
-interface CheckSpendableRequest {
-	constructor(sequence<MintProof> proofs);
-	sequence<MintProof> proofs();
-};
-
-interface CheckSpendableResponse {
-	constructor(sequence<boolean> spendable, sequence<boolean> pending);
-	sequence<boolean> spendable();
-	sequence<boolean> pending();	
-};
-
-interface MintVersion {
-	constructor(string name, string version);
-	string name();
-	string version();
-};
-
-interface KeySetInfo {
-	constructor(Id id, string unit);
-	
-};
-
-enum InvoiceStatus {
-	"Unpaid",
-	"Paid",
-	"Expired",
-	"InFlight"
-};
-

+ 0 - 66
bindings/cashu-ffi/src/error.rs

@@ -1,66 +0,0 @@
-use std::fmt;
-
-use cashu::lightning_invoice::ParseOrSemanticError;
-
-pub type Result<T, E = CashuError> = std::result::Result<T, E>;
-
-#[derive(Debug)]
-pub enum CashuError {
-    Generic { err: String },
-}
-
-impl fmt::Display for CashuError {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        match self {
-            Self::Generic { err } => write!(f, "{err}"),
-        }
-    }
-}
-
-impl From<cashu::error::Error> for CashuError {
-    fn from(err: cashu::error::Error) -> Self {
-        Self::Generic {
-            err: err.to_string(),
-        }
-    }
-}
-
-impl From<url::ParseError> for CashuError {
-    fn from(err: url::ParseError) -> Self {
-        Self::Generic {
-            err: err.to_string(),
-        }
-    }
-}
-
-impl From<cashu::error::wallet::Error> for CashuError {
-    fn from(err: cashu::error::wallet::Error) -> Self {
-        Self::Generic {
-            err: err.to_string(),
-        }
-    }
-}
-
-impl From<ParseOrSemanticError> for CashuError {
-    fn from(err: ParseOrSemanticError) -> Self {
-        Self::Generic {
-            err: err.to_string(),
-        }
-    }
-}
-
-impl From<cashu::nuts::nut02::Error> for CashuError {
-    fn from(err: cashu::nuts::nut02::Error) -> Self {
-        Self::Generic {
-            err: err.to_string(),
-        }
-    }
-}
-
-impl From<cashu::url::Error> for CashuError {
-    fn from(err: cashu::url::Error) -> Self {
-        Self::Generic {
-            err: err.to_string(),
-        }
-    }
-}

+ 0 - 38
bindings/cashu-ffi/src/lib.rs

@@ -1,38 +0,0 @@
-mod error;
-mod nuts;
-mod types;
-
-mod ffi {
-    pub use cashu::types::InvoiceStatus;
-
-    pub use crate::error::CashuError;
-    pub use crate::nuts::nut00::blinded_message::BlindedMessage;
-    pub use crate::nuts::nut00::blinded_signature::BlindedSignature;
-    pub use crate::nuts::nut00::mint_proofs::MintProofs;
-    pub use crate::nuts::nut00::premint_secrets::PreMintSecrets;
-    pub use crate::nuts::nut00::proof::mint::Proof as MintProof;
-    pub use crate::nuts::nut00::proof::Proof;
-    pub use crate::nuts::nut00::token::{CurrencyUnit, Token};
-    pub use crate::nuts::nut01::key_pair::KeyPair;
-    pub use crate::nuts::nut01::keys::{Keys, KeysResponse};
-    pub use crate::nuts::nut01::public_key::PublicKey;
-    pub use crate::nuts::nut01::secret_key::SecretKey;
-    pub use crate::nuts::nut02::{Id, KeySet, KeySetResponse, MintKeySet};
-    pub use crate::nuts::nut03::{SwapRequest, SwapResponse};
-    pub use crate::nuts::nut04::{
-        MintBolt11Request, MintBolt11Response, MintQuoteBolt11Request, MintQuoteBolt11Response,
-    };
-    pub use crate::nuts::nut05::{
-        MeltBolt11Request as Nut05MeltBolt11Request, MeltBolt11Response as Nut05MeltBolt11Response,
-        MeltQuoteBolt11Request, MeltQuoteBolt11Response,
-    };
-    pub use crate::nuts::nut06::{MintInfo, MintVersion};
-    pub use crate::nuts::nut07::{CheckSpendableRequest, CheckSpendableResponse};
-    pub use crate::nuts::nut08::{MeltBolt11Request, MeltBolt11Response};
-    pub use crate::types::{Amount, Bolt11Invoice, KeySetInfo, MeltQuote, MintQuote, Secret};
-
-    // UDL
-    uniffi::include_scaffolding!("cashu");
-}
-
-pub use ffi::*;

+ 0 - 9
bindings/cashu-ffi/src/nuts/mod.rs

@@ -1,9 +0,0 @@
-pub mod nut00;
-pub mod nut01;
-pub mod nut02;
-pub mod nut03;
-pub mod nut04;
-pub mod nut05;
-pub mod nut06;
-pub mod nut07;
-pub mod nut08;

+ 0 - 54
bindings/cashu-ffi/src/nuts/nut00/blinded_message.rs

@@ -1,54 +0,0 @@
-use std::ops::Deref;
-use std::sync::Arc;
-
-use cashu::nuts::BlindedMessage as BlindedMessageSdk;
-
-use crate::nuts::nut01::public_key::PublicKey;
-use crate::{Amount, Id};
-
-pub struct BlindedMessage {
-    inner: BlindedMessageSdk,
-}
-
-impl Deref for BlindedMessage {
-    type Target = BlindedMessageSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl BlindedMessage {
-    pub fn new(keyset_id: Arc<Id>, amount: Arc<Amount>, b: Arc<PublicKey>) -> Self {
-        Self {
-            inner: BlindedMessageSdk {
-                keyset_id: *keyset_id.as_ref().deref(),
-                amount: *amount.as_ref().deref(),
-                b: b.as_ref().into(),
-            },
-        }
-    }
-
-    pub fn amount(&self) -> Arc<Amount> {
-        Arc::new(self.inner.amount.into())
-    }
-
-    pub fn keyset_id(&self) -> Arc<Id> {
-        Arc::new(self.inner.keyset_id.into())
-    }
-
-    pub fn b(&self) -> Arc<PublicKey> {
-        Arc::new(self.inner.b.clone().into())
-    }
-}
-
-impl From<&BlindedMessage> for BlindedMessageSdk {
-    fn from(blinded_message: &BlindedMessage) -> BlindedMessageSdk {
-        blinded_message.inner.clone()
-    }
-}
-
-impl From<BlindedMessageSdk> for BlindedMessage {
-    fn from(inner: BlindedMessageSdk) -> BlindedMessage {
-        BlindedMessage { inner }
-    }
-}

+ 0 - 55
bindings/cashu-ffi/src/nuts/nut00/blinded_signature.rs

@@ -1,55 +0,0 @@
-use std::ops::Deref;
-use std::sync::Arc;
-
-use cashu::nuts::nut00::BlindedSignature as BlindedSignatureSdk;
-
-use crate::{Amount, Id, PublicKey};
-
-pub struct BlindedSignature {
-    inner: BlindedSignatureSdk,
-}
-
-impl Deref for BlindedSignature {
-    type Target = BlindedSignatureSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl BlindedSignature {
-    pub fn new(keyset_id: Arc<Id>, amount: Arc<Amount>, c: Arc<PublicKey>) -> Self {
-        Self {
-            inner: BlindedSignatureSdk {
-                keyset_id: *keyset_id.as_ref().deref(),
-                amount: *amount.as_ref().deref(),
-                c: c.as_ref().into(),
-            },
-        }
-    }
-
-    pub fn keyset_id(&self) -> Arc<Id> {
-        Arc::new(self.inner.keyset_id.into())
-    }
-
-    pub fn amount(&self) -> Arc<Amount> {
-        Arc::new(self.inner.amount.into())
-    }
-
-    pub fn c(&self) -> Arc<PublicKey> {
-        Arc::new(self.inner.c.clone().into())
-    }
-}
-
-impl From<&BlindedSignature> for BlindedSignatureSdk {
-    fn from(blinded_signature: &BlindedSignature) -> BlindedSignatureSdk {
-        blinded_signature.inner.clone()
-    }
-}
-
-impl From<BlindedSignatureSdk> for BlindedSignature {
-    fn from(blinded_signature: BlindedSignatureSdk) -> BlindedSignature {
-        BlindedSignature {
-            inner: blinded_signature,
-        }
-    }
-}

+ 0 - 56
bindings/cashu-ffi/src/nuts/nut00/mint_proofs.rs

@@ -1,56 +0,0 @@
-use std::ops::Deref;
-use std::str::FromStr;
-use std::sync::Arc;
-
-use cashu::nuts::nut00::MintProofs as MintProofsSdk;
-use cashu::url::UncheckedUrl;
-
-use crate::error::Result;
-use crate::Proof;
-
-pub struct MintProofs {
-    inner: MintProofsSdk,
-}
-
-impl Deref for MintProofs {
-    type Target = MintProofsSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl MintProofs {
-    pub fn new(mint: String, proofs: Vec<Arc<Proof>>) -> Result<Self> {
-        let mint = UncheckedUrl::from_str(&mint)?;
-        let proofs = proofs.iter().map(|p| p.as_ref().deref().clone()).collect();
-
-        Ok(Self {
-            inner: MintProofsSdk { mint, proofs },
-        })
-    }
-
-    pub fn url(&self) -> String {
-        self.inner.mint.to_string()
-    }
-
-    pub fn proofs(&self) -> Vec<Arc<Proof>> {
-        self.inner
-            .proofs
-            .clone()
-            .into_iter()
-            .map(|p| Arc::new(p.into()))
-            .collect()
-    }
-}
-
-impl From<&MintProofs> for MintProofsSdk {
-    fn from(mint_proofs: &MintProofs) -> MintProofsSdk {
-        mint_proofs.inner.clone()
-    }
-}
-
-impl From<MintProofsSdk> for MintProofs {
-    fn from(inner: MintProofsSdk) -> MintProofs {
-        MintProofs { inner }
-    }
-}

+ 0 - 6
bindings/cashu-ffi/src/nuts/nut00/mod.rs

@@ -1,6 +0,0 @@
-pub mod blinded_message;
-pub mod blinded_signature;
-pub mod mint_proofs;
-pub mod premint_secrets;
-pub mod proof;
-pub mod token;

+ 0 - 78
bindings/cashu-ffi/src/nuts/nut00/premint_secrets.rs

@@ -1,78 +0,0 @@
-use std::ops::Deref;
-use std::sync::Arc;
-
-use cashu::nuts::nut00::wallet::PreMintSecrets as PreMintSecretsSdk;
-
-use crate::error::Result;
-use crate::{Amount, BlindedMessage, Id, Secret, SecretKey};
-
-pub struct PreMintSecrets {
-    inner: PreMintSecretsSdk,
-}
-
-impl Deref for PreMintSecrets {
-    type Target = PreMintSecretsSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl PreMintSecrets {
-    pub fn random(keyset_id: Arc<Id>, amount: Arc<Amount>) -> Result<Self> {
-        Ok(Self {
-            inner: PreMintSecretsSdk::random(
-                *keyset_id.as_ref().deref(),
-                *amount.as_ref().deref(),
-            )?,
-        })
-    }
-
-    pub fn blank(keyset_id: Arc<Id>, fee_reserve: Arc<Amount>) -> Result<Self> {
-        Ok(Self {
-            inner: PreMintSecretsSdk::blank(
-                *keyset_id.as_ref().deref(),
-                *fee_reserve.as_ref().deref(),
-            )?,
-        })
-    }
-
-    pub fn blinded_messages(&self) -> Vec<Arc<BlindedMessage>> {
-        self.inner
-            .iter()
-            .map(|premint| Arc::new(premint.blinded_message.clone().into()))
-            .collect()
-    }
-
-    pub fn secrets(&self) -> Vec<Arc<Secret>> {
-        self.inner
-            .iter()
-            .map(|premint| Arc::new(premint.secret.clone().into()))
-            .collect()
-    }
-
-    pub fn rs(&self) -> Vec<Arc<SecretKey>> {
-        self.inner
-            .iter()
-            .map(|premint| Arc::new(premint.r.clone().into()))
-            .collect()
-    }
-
-    pub fn amounts(&self) -> Vec<Arc<Amount>> {
-        self.inner
-            .iter()
-            .map(|premint| Arc::new(premint.amount.into()))
-            .collect()
-    }
-}
-
-impl From<cashu::nuts::nut00::wallet::PreMintSecrets> for PreMintSecrets {
-    fn from(inner: cashu::nuts::nut00::wallet::PreMintSecrets) -> PreMintSecrets {
-        PreMintSecrets { inner }
-    }
-}
-
-impl From<PreMintSecrets> for cashu::nuts::nut00::wallet::PreMintSecrets {
-    fn from(blinded_messages: PreMintSecrets) -> cashu::nuts::nut00::wallet::PreMintSecrets {
-        blinded_messages.inner
-    }
-}

+ 0 - 136
bindings/cashu-ffi/src/nuts/nut00/proof.rs

@@ -1,136 +0,0 @@
-use std::ops::Deref;
-use std::sync::Arc;
-
-use cashu::nuts::nut00::Proof as ProofSdk;
-
-use crate::types::Secret;
-use crate::{Amount, Id, PublicKey};
-
-pub struct Proof {
-    inner: ProofSdk,
-}
-
-impl Deref for Proof {
-    type Target = ProofSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl Proof {
-    pub fn new(
-        amount: Arc<Amount>,
-        secret: Arc<Secret>,
-        c: Arc<PublicKey>,
-        keyset_id: Arc<Id>,
-    ) -> Self {
-        Self {
-            inner: ProofSdk {
-                amount: *amount.as_ref().deref(),
-                secret: secret.as_ref().deref().clone(),
-                c: c.as_ref().deref().clone(),
-                keyset_id: *keyset_id.as_ref().deref(),
-            },
-        }
-    }
-
-    pub fn amount(&self) -> Arc<Amount> {
-        Arc::new(self.inner.amount.into())
-    }
-
-    pub fn secret(&self) -> Arc<Secret> {
-        Arc::new(self.inner.secret.clone().into())
-    }
-
-    pub fn c(&self) -> Arc<PublicKey> {
-        Arc::new(self.inner.c.clone().into())
-    }
-
-    pub fn keyset_id(&self) -> Arc<Id> {
-        Arc::new(self.keyset_id.into())
-    }
-}
-
-impl From<&Proof> for ProofSdk {
-    fn from(proof: &Proof) -> ProofSdk {
-        ProofSdk {
-            amount: *proof.amount().as_ref().deref(),
-            secret: proof.secret().as_ref().deref().clone(),
-            c: proof.c().deref().into(),
-            keyset_id: proof.keyset_id,
-        }
-    }
-}
-
-impl From<ProofSdk> for Proof {
-    fn from(inner: ProofSdk) -> Proof {
-        Proof { inner }
-    }
-}
-
-pub mod mint {
-    use std::ops::Deref;
-    use std::sync::Arc;
-
-    use cashu::nuts::nut00::mint::Proof as ProofSdk;
-
-    use crate::types::Secret;
-    use crate::{Amount, Id, PublicKey};
-
-    pub struct Proof {
-        inner: ProofSdk,
-    }
-
-    impl Deref for Proof {
-        type Target = ProofSdk;
-        fn deref(&self) -> &Self::Target {
-            &self.inner
-        }
-    }
-
-    impl Proof {
-        pub fn new(
-            amount: Option<Arc<Amount>>,
-            secret: Arc<Secret>,
-            c: Option<Arc<PublicKey>>,
-            keyset_id: Option<Arc<Id>>,
-        ) -> Self {
-            Self {
-                inner: ProofSdk {
-                    amount: amount.map(|a| *a.as_ref().deref()),
-                    secret: secret.as_ref().deref().clone(),
-                    c: c.map(|c| c.as_ref().into()),
-                    keyset_id: keyset_id.map(|id| *id.as_ref().deref()),
-                },
-            }
-        }
-
-        pub fn amount(&self) -> Option<Arc<Amount>> {
-            self.inner.amount.map(|a| Arc::new(a.into()))
-        }
-
-        pub fn secret(&self) -> Arc<Secret> {
-            Arc::new(self.inner.secret.clone().into())
-        }
-
-        pub fn c(&self) -> Option<Arc<PublicKey>> {
-            self.inner.c.clone().map(|c| Arc::new(c.into()))
-        }
-
-        pub fn keyset_id(&self) -> Option<Arc<Id>> {
-            self.inner.keyset_id.map(|id| Arc::new(id.into()))
-        }
-    }
-
-    impl From<ProofSdk> for Proof {
-        fn from(proof: ProofSdk) -> Proof {
-            Proof { inner: proof }
-        }
-    }
-
-    impl From<&Proof> for ProofSdk {
-        fn from(proof: &Proof) -> ProofSdk {
-            proof.inner.clone()
-        }
-    }
-}

+ 0 - 106
bindings/cashu-ffi/src/nuts/nut00/token.rs

@@ -1,106 +0,0 @@
-use std::fmt;
-use std::str::FromStr;
-use std::sync::Arc;
-
-use cashu::nuts::nut00::wallet::Token as TokenSdk;
-use cashu::nuts::CurrencyUnit as CurrencyUnitSdk;
-use cashu::url::UncheckedUrl;
-
-use crate::error::Result;
-use crate::{MintProofs, Proof};
-
-pub enum CurrencyUnit {
-    Sat(),
-    Usd(),
-    Custom { unit: String },
-}
-
-impl From<&CurrencyUnit> for CurrencyUnitSdk {
-    fn from(unit: &CurrencyUnit) -> CurrencyUnitSdk {
-        match unit {
-            CurrencyUnit::Sat() => CurrencyUnitSdk::Sat,
-            CurrencyUnit::Usd() => CurrencyUnitSdk::Usd,
-            CurrencyUnit::Custom { unit } => CurrencyUnitSdk::Custom(unit.clone()),
-        }
-    }
-}
-
-impl From<CurrencyUnit> for CurrencyUnitSdk {
-    fn from(unit: CurrencyUnit) -> CurrencyUnitSdk {
-        match unit {
-            CurrencyUnit::Sat() => CurrencyUnitSdk::Sat,
-            CurrencyUnit::Usd() => CurrencyUnitSdk::Usd,
-            CurrencyUnit::Custom { unit } => CurrencyUnitSdk::Custom(unit.clone()),
-        }
-    }
-}
-
-impl From<CurrencyUnitSdk> for CurrencyUnit {
-    fn from(unit: CurrencyUnitSdk) -> CurrencyUnit {
-        match unit {
-            CurrencyUnitSdk::Sat => CurrencyUnit::Sat(),
-            CurrencyUnitSdk::Usd => CurrencyUnit::Usd(),
-            CurrencyUnitSdk::Custom(unit) => CurrencyUnit::Custom { unit: unit.clone() },
-        }
-    }
-}
-
-pub struct Token {
-    inner: TokenSdk,
-}
-
-impl Token {
-    pub fn new(
-        mint: String,
-        proofs: Vec<Arc<Proof>>,
-        memo: Option<String>,
-        unit: Option<String>,
-    ) -> Result<Self> {
-        let mint = UncheckedUrl::from_str(&mint)?;
-        let proofs = proofs.into_iter().map(|p| p.as_ref().into()).collect();
-
-        let unit = unit.map(|u| CurrencyUnitSdk::from_str(&u).unwrap_or_default());
-
-        Ok(Self {
-            inner: TokenSdk::new(mint, proofs, memo, unit)?,
-        })
-    }
-
-    pub fn token(&self) -> Vec<Arc<MintProofs>> {
-        self.inner
-            .token
-            .clone()
-            .into_iter()
-            .map(|p| Arc::new(p.into()))
-            .collect()
-    }
-
-    pub fn memo(&self) -> Option<String> {
-        self.inner.memo.clone()
-    }
-
-    pub fn unit(&self) -> Option<String> {
-        self.inner
-            .unit
-            .clone()
-            .map(|u| Into::<CurrencyUnitSdk>::into(u).to_string())
-    }
-
-    pub fn from_string(token: String) -> Result<Self> {
-        Ok(Self {
-            inner: TokenSdk::from_str(&token)?,
-        })
-    }
-}
-
-impl fmt::Display for Token {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        write!(f, "{}", self.inner)
-    }
-}
-
-impl From<cashu::nuts::nut00::wallet::Token> for Token {
-    fn from(inner: cashu::nuts::nut00::wallet::Token) -> Token {
-        Token { inner }
-    }
-}

+ 0 - 26
bindings/cashu-ffi/src/nuts/nut01/key_pair.rs

@@ -1,26 +0,0 @@
-use std::ops::Deref;
-use std::sync::Arc;
-
-use cashu::nuts::nut01::mint::KeyPair as KeyPairSdk;
-
-use crate::{PublicKey, SecretKey};
-
-pub struct KeyPair {
-    inner: KeyPairSdk,
-}
-
-impl KeyPair {
-    pub fn from_secret_key(secret_key: Arc<SecretKey>) -> Self {
-        Self {
-            inner: KeyPairSdk::from_secret_key(secret_key.as_ref().deref().clone()),
-        }
-    }
-
-    pub fn secret_key(&self) -> Arc<SecretKey> {
-        Arc::new(self.inner.secret_key.clone().into())
-    }
-
-    pub fn public_key(&self) -> Arc<PublicKey> {
-        Arc::new(self.inner.public_key.clone().into())
-    }
-}

+ 0 - 110
bindings/cashu-ffi/src/nuts/nut01/keys.rs

@@ -1,110 +0,0 @@
-use std::collections::HashMap;
-use std::ops::Deref;
-use std::sync::Arc;
-
-use cashu::nuts::nut01::{Keys as KeysSdk, KeysResponse as KeysResponseSdk};
-use cashu::Amount as AmountSdk;
-
-use crate::{Amount, KeySet, PublicKey};
-
-pub struct Keys {
-    inner: KeysSdk,
-}
-
-impl Deref for Keys {
-    type Target = KeysSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<Keys> for KeysSdk {
-    fn from(keys: Keys) -> KeysSdk {
-        keys.inner
-    }
-}
-
-impl From<KeysSdk> for Keys {
-    fn from(keys: KeysSdk) -> Keys {
-        let keys = keys
-            .keys()
-            .into_iter()
-            .map(|(amount, pk)| (u64::from(amount).to_string(), Arc::new(pk.into())))
-            .collect();
-
-        Keys::new(keys)
-    }
-}
-
-impl Keys {
-    pub fn new(keys: HashMap<String, Arc<PublicKey>>) -> Self {
-        let keys = keys
-            .into_iter()
-            .map(|(amount, pk)| {
-                (
-                    AmountSdk::from(amount.parse::<u64>().unwrap()),
-                    pk.as_ref().into(),
-                )
-            })
-            .collect();
-
-        Self {
-            inner: KeysSdk::new(keys),
-        }
-    }
-
-    pub fn keys(&self) -> HashMap<String, Arc<PublicKey>> {
-        self.inner
-            .keys()
-            .into_iter()
-            .map(|(amount, pk)| (u64::from(amount).to_string(), Arc::new(pk.into())))
-            .collect()
-    }
-
-    pub fn amount_key(&self, amount: Arc<Amount>) -> Option<Arc<PublicKey>> {
-        self.inner
-            .amount_key(*amount.as_ref().deref())
-            .map(|pk| Arc::new(pk.into()))
-    }
-
-    pub fn as_hashmap(&self) -> HashMap<String, String> {
-        self.inner
-            .as_hashmap()
-            .into_iter()
-            .map(|(amount, pk)| (u64::from(amount).to_string(), pk))
-            .collect()
-    }
-}
-
-pub struct KeysResponse {
-    inner: KeysResponseSdk,
-}
-
-impl Deref for KeysResponse {
-    type Target = KeysResponseSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<KeysResponse> for KeysResponseSdk {
-    fn from(keys: KeysResponse) -> KeysResponseSdk {
-        keys.inner
-    }
-}
-
-impl From<KeysResponseSdk> for KeysResponse {
-    fn from(keys: KeysResponseSdk) -> KeysResponse {
-        KeysResponse { inner: keys }
-    }
-}
-
-impl KeysResponse {
-    pub fn new(keysets: Vec<Arc<KeySet>>) -> Self {
-        Self {
-            inner: KeysResponseSdk {
-                keysets: keysets.iter().map(|k| k.as_ref().deref().clone()).collect(),
-            },
-        }
-    }
-}

+ 0 - 4
bindings/cashu-ffi/src/nuts/nut01/mod.rs

@@ -1,4 +0,0 @@
-pub mod key_pair;
-pub mod keys;
-pub mod public_key;
-pub mod secret_key;

+ 0 - 40
bindings/cashu-ffi/src/nuts/nut01/public_key.rs

@@ -1,40 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::nut01::PublicKey as PublicKeySdk;
-
-use crate::error::Result;
-
-pub struct PublicKey {
-    inner: PublicKeySdk,
-}
-
-impl From<PublicKeySdk> for PublicKey {
-    fn from(inner: PublicKeySdk) -> Self {
-        Self { inner }
-    }
-}
-
-impl From<&PublicKey> for PublicKeySdk {
-    fn from(pk: &PublicKey) -> PublicKeySdk {
-        pk.inner.clone()
-    }
-}
-
-impl Deref for PublicKey {
-    type Target = PublicKeySdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl PublicKey {
-    pub fn from_hex(hex: String) -> Result<Self> {
-        Ok(Self {
-            inner: PublicKeySdk::from_hex(hex)?,
-        })
-    }
-
-    pub fn to_hex(&self) -> Result<String> {
-        Ok(self.inner.to_hex())
-    }
-}

+ 0 - 34
bindings/cashu-ffi/src/nuts/nut01/secret_key.rs

@@ -1,34 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::nut01::SecretKey as SecretKeySdk;
-
-use crate::error::Result;
-
-pub struct SecretKey {
-    inner: SecretKeySdk,
-}
-
-impl Deref for SecretKey {
-    type Target = SecretKeySdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<SecretKeySdk> for SecretKey {
-    fn from(inner: SecretKeySdk) -> Self {
-        Self { inner }
-    }
-}
-
-impl From<SecretKey> for SecretKeySdk {
-    fn from(sk: SecretKey) -> SecretKeySdk {
-        sk.inner
-    }
-}
-
-impl SecretKey {
-    pub fn to_hex(&self) -> Result<String> {
-        Ok(self.inner.to_hex())
-    }
-}

+ 0 - 113
bindings/cashu-ffi/src/nuts/nut02/key_set.rs

@@ -1,113 +0,0 @@
-use std::ops::Deref;
-use std::str::FromStr;
-use std::sync::Arc;
-
-use cashu::nuts::{
-    CurrencyUnit, Id as IdSdk, KeySet as KeySetSdk, KeysetResponse as KeysetResponseSdk,
-};
-
-use crate::error::Result;
-use crate::nuts::nut01::keys::Keys;
-use crate::KeySetInfo;
-
-pub struct Id {
-    inner: IdSdk,
-}
-
-impl Deref for Id {
-    type Target = IdSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-impl Id {
-    pub fn new(id: String) -> Result<Self> {
-        Ok(Self {
-            inner: IdSdk::from_str(&id)?,
-        })
-    }
-}
-
-impl From<IdSdk> for Id {
-    fn from(inner: IdSdk) -> Id {
-        Id { inner }
-    }
-}
-
-impl From<Id> for IdSdk {
-    fn from(id: Id) -> IdSdk {
-        id.inner
-    }
-}
-
-pub struct KeySet {
-    inner: KeySetSdk,
-}
-
-impl Deref for KeySet {
-    type Target = KeySetSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl KeySet {
-    pub fn new(id: Arc<Id>, unit: String, keys: Arc<Keys>) -> Self {
-        Self {
-            inner: KeySetSdk {
-                id: *id.as_ref().deref(),
-                unit: CurrencyUnit::from_str(&unit).unwrap(),
-                keys: keys.as_ref().deref().clone(),
-            },
-        }
-    }
-
-    pub fn id(&self) -> Arc<Id> {
-        Arc::new(self.inner.id.into())
-    }
-
-    pub fn unit(&self) -> String {
-        self.inner.unit.clone().to_string()
-    }
-
-    pub fn keys(&self) -> Arc<Keys> {
-        Arc::new(self.inner.keys.clone().into())
-    }
-}
-
-impl From<cashu::nuts::nut02::KeySet> for KeySet {
-    fn from(inner: cashu::nuts::nut02::KeySet) -> KeySet {
-        KeySet { inner }
-    }
-}
-
-pub struct KeySetResponse {
-    inner: KeysetResponseSdk,
-}
-
-impl KeySetResponse {
-    pub fn new(keyset_ids: Vec<Arc<KeySetInfo>>) -> Self {
-        let keysets = keyset_ids
-            .into_iter()
-            .map(|ki| ki.as_ref().deref().clone())
-            .collect();
-        Self {
-            inner: KeysetResponseSdk { keysets },
-        }
-    }
-
-    pub fn keysets(&self) -> Vec<Arc<KeySetInfo>> {
-        self.inner
-            .clone()
-            .keysets
-            .into_iter()
-            .map(|keyset_info| Arc::new(keyset_info.into()))
-            .collect()
-    }
-}
-
-impl From<KeysetResponseSdk> for KeySetResponse {
-    fn from(inner: KeysetResponseSdk) -> KeySetResponse {
-        KeySetResponse { inner }
-    }
-}

+ 0 - 35
bindings/cashu-ffi/src/nuts/nut02/mint_keyset.rs

@@ -1,35 +0,0 @@
-use std::ops::Deref;
-use std::str::FromStr;
-
-use cashu::nuts::nut02::mint::KeySet as KeySetSdk;
-use cashu::nuts::CurrencyUnit;
-
-pub struct MintKeySet {
-    inner: KeySetSdk,
-}
-
-impl Deref for MintKeySet {
-    type Target = KeySetSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl MintKeySet {
-    pub fn generate(secret: String, unit: String, derivation_path: String, max_order: u8) -> Self {
-        Self {
-            inner: KeySetSdk::generate(
-                secret.as_bytes(),
-                CurrencyUnit::from_str(&unit).unwrap(),
-                &derivation_path,
-                max_order,
-            ),
-        }
-    }
-}
-
-impl From<cashu::nuts::nut02::mint::KeySet> for MintKeySet {
-    fn from(inner: cashu::nuts::nut02::mint::KeySet) -> MintKeySet {
-        MintKeySet { inner }
-    }
-}

+ 0 - 5
bindings/cashu-ffi/src/nuts/nut02/mod.rs

@@ -1,5 +0,0 @@
-pub mod key_set;
-pub mod mint_keyset;
-
-pub use key_set::{Id, KeySet, KeySetResponse};
-pub use mint_keyset::MintKeySet;

+ 0 - 82
bindings/cashu-ffi/src/nuts/nut03/mod.rs

@@ -1,82 +0,0 @@
-use std::ops::Deref;
-use std::sync::Arc;
-
-use cashu::nuts::{SwapRequest as SwapRequestSdk, SwapResponse as SwapResponseSdk};
-
-use crate::{Amount, BlindedMessage, BlindedSignature, Proof};
-
-pub struct SwapRequest {
-    inner: SwapRequestSdk,
-}
-
-impl Deref for SwapRequest {
-    type Target = SwapRequestSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl SwapRequest {
-    pub fn new(proofs: Vec<Arc<Proof>>, outputs: Vec<Arc<BlindedMessage>>) -> Self {
-        let proofs = proofs.into_iter().map(|p| p.as_ref().into()).collect();
-        let outputs = outputs.into_iter().map(|o| o.as_ref().into()).collect();
-
-        Self {
-            inner: SwapRequestSdk::new(proofs, outputs),
-        }
-    }
-
-    pub fn proofs(&self) -> Vec<Arc<Proof>> {
-        self.inner
-            .inputs
-            .clone()
-            .into_iter()
-            .map(|p| Arc::new(p.into()))
-            .collect()
-    }
-
-    pub fn outputs(&self) -> Vec<Arc<BlindedMessage>> {
-        self.inner
-            .outputs
-            .clone()
-            .into_iter()
-            .map(|o| Arc::new(o.into()))
-            .collect()
-    }
-
-    pub fn proofs_amount(&self) -> Arc<Amount> {
-        Arc::new(self.inner.input_amount().into())
-    }
-
-    pub fn output_amount(&self) -> Arc<Amount> {
-        Arc::new(self.inner.output_amount().into())
-    }
-}
-
-pub struct SwapResponse {
-    inner: SwapResponseSdk,
-}
-
-impl SwapResponse {
-    pub fn new(signatures: Vec<Arc<BlindedSignature>>) -> Self {
-        let signatures = signatures.into_iter().map(|p| p.as_ref().into()).collect();
-        Self {
-            inner: SwapResponseSdk::new(signatures),
-        }
-    }
-
-    pub fn signatures(&self) -> Vec<Arc<BlindedSignature>> {
-        self.inner
-            .signatures
-            .clone()
-            .into_iter()
-            .map(|p| Arc::new(p.into()))
-            .collect()
-    }
-}
-
-impl From<SwapResponseSdk> for SwapResponse {
-    fn from(inner: SwapResponseSdk) -> SwapResponse {
-        SwapResponse { inner }
-    }
-}

+ 0 - 168
bindings/cashu-ffi/src/nuts/nut04/mod.rs

@@ -1,168 +0,0 @@
-use std::ops::Deref;
-use std::str::FromStr;
-use std::sync::Arc;
-
-use cashu::nuts::{
-    CurrencyUnit, MintBolt11Request as MintBolt11RequestSdk,
-    MintBolt11Response as MintBolt11ResponseSdk,
-    MintQuoteBolt11Request as MintQuoteBolt11RequestSdk,
-    MintQuoteBolt11Response as MintQuoteBolt11ResponseSdk,
-};
-
-use crate::{Amount, BlindedMessage, BlindedSignature};
-
-pub struct MintQuoteBolt11Request {
-    inner: MintQuoteBolt11RequestSdk,
-}
-
-impl Deref for MintQuoteBolt11Request {
-    type Target = MintQuoteBolt11RequestSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl MintQuoteBolt11Request {
-    pub fn new(amount: Arc<Amount>, unit: String) -> Self {
-        Self {
-            inner: MintQuoteBolt11RequestSdk {
-                amount: *amount.as_ref().deref(),
-                unit: CurrencyUnit::from_str(&unit).unwrap(),
-            },
-        }
-    }
-
-    pub fn amount(&self) -> Arc<Amount> {
-        Arc::new(self.inner.amount.into())
-    }
-
-    pub fn unit(&self) -> Arc<CurrencyUnit> {
-        Arc::new(self.inner.clone().unit)
-    }
-}
-
-impl From<MintQuoteBolt11RequestSdk> for MintQuoteBolt11Request {
-    fn from(inner: MintQuoteBolt11RequestSdk) -> MintQuoteBolt11Request {
-        MintQuoteBolt11Request { inner }
-    }
-}
-
-pub struct MintQuoteBolt11Response {
-    inner: MintQuoteBolt11ResponseSdk,
-}
-
-impl Deref for MintQuoteBolt11Response {
-    type Target = MintQuoteBolt11ResponseSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl MintQuoteBolt11Response {
-    pub fn new(quote: String, request: String, paid: bool, expiry: u64) -> Self {
-        Self {
-            inner: MintQuoteBolt11ResponseSdk {
-                quote,
-                request,
-                paid,
-                expiry,
-            },
-        }
-    }
-
-    pub fn quote(&self) -> String {
-        self.quote.clone()
-    }
-
-    pub fn request(&self) -> String {
-        self.request.clone()
-    }
-
-    pub fn paid(&self) -> bool {
-        self.paid
-    }
-
-    pub fn expiry(&self) -> u64 {
-        self.expiry
-    }
-}
-
-impl From<MintQuoteBolt11ResponseSdk> for MintQuoteBolt11Response {
-    fn from(inner: MintQuoteBolt11ResponseSdk) -> MintQuoteBolt11Response {
-        MintQuoteBolt11Response { inner }
-    }
-}
-
-pub struct MintBolt11Request {
-    inner: MintBolt11RequestSdk,
-}
-
-impl Deref for MintBolt11Request {
-    type Target = MintBolt11RequestSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl MintBolt11Request {
-    pub fn new(quote: String, outputs: Vec<Arc<BlindedMessage>>) -> Self {
-        Self {
-            inner: MintBolt11RequestSdk {
-                quote,
-                outputs: outputs.iter().map(|o| o.as_ref().deref().clone()).collect(),
-            },
-        }
-    }
-
-    pub fn quote(&self) -> String {
-        self.quote.clone()
-    }
-
-    pub fn outputs(&self) -> Vec<Arc<BlindedMessage>> {
-        self.inner
-            .outputs
-            .clone()
-            .into_iter()
-            .map(|o| Arc::new(o.into()))
-            .collect()
-    }
-}
-
-pub struct MintBolt11Response {
-    inner: MintBolt11ResponseSdk,
-}
-
-impl Deref for MintBolt11Response {
-    type Target = MintBolt11ResponseSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl MintBolt11Response {
-    pub fn new(signatures: Vec<Arc<BlindedSignature>>) -> Self {
-        Self {
-            inner: MintBolt11ResponseSdk {
-                signatures: signatures
-                    .into_iter()
-                    .map(|s| s.as_ref().deref().clone())
-                    .collect(),
-            },
-        }
-    }
-
-    pub fn signatures(&self) -> Vec<Arc<BlindedSignature>> {
-        self.inner
-            .signatures
-            .clone()
-            .into_iter()
-            .map(|o| Arc::new(o.into()))
-            .collect()
-    }
-}
-
-impl From<MintBolt11ResponseSdk> for MintBolt11Response {
-    fn from(inner: MintBolt11ResponseSdk) -> MintBolt11Response {
-        MintBolt11Response { inner }
-    }
-}

+ 0 - 143
bindings/cashu-ffi/src/nuts/nut05/mod.rs

@@ -1,143 +0,0 @@
-use std::ops::Deref;
-use std::str::FromStr;
-use std::sync::Arc;
-
-use cashu::nuts::{
-    CurrencyUnit, MeltBolt11Request as MeltBolt11RequestSdk,
-    MeltBolt11Response as MeltBolt11ResponseSdk,
-    MeltQuoteBolt11Request as MeltQuoteBolt11RequestSdk,
-    MeltQuoteBolt11Response as MeltQuoteBolt11ResponseSdk,
-};
-use cashu::Bolt11Invoice;
-
-use crate::error::Result;
-use crate::{BlindedMessage, BlindedSignature, Proof};
-
-pub struct MeltQuoteBolt11Response {
-    inner: MeltQuoteBolt11ResponseSdk,
-}
-
-impl MeltQuoteBolt11Response {
-    pub fn new(
-        quote: String,
-        amount: u64,
-        fee_reserve: u64,
-        paid: bool,
-        expiry: u64,
-    ) -> Result<Self> {
-        Ok(Self {
-            inner: MeltQuoteBolt11ResponseSdk {
-                quote,
-                amount,
-                fee_reserve,
-                paid,
-                expiry,
-            },
-        })
-    }
-
-    pub fn quote(&self) -> String {
-        self.inner.quote.clone()
-    }
-
-    pub fn amount(&self) -> u64 {
-        self.inner.amount
-    }
-
-    pub fn fee_reserve(&self) -> u64 {
-        self.inner.fee_reserve
-    }
-
-    pub fn paid(&self) -> bool {
-        self.inner.paid
-    }
-
-    pub fn expiry(&self) -> u64 {
-        self.inner.expiry
-    }
-}
-
-pub struct MeltQuoteBolt11Request {
-    inner: MeltQuoteBolt11RequestSdk,
-}
-
-impl MeltQuoteBolt11Request {
-    pub fn new(request: String, unit: String) -> Result<Self> {
-        Ok(Self {
-            inner: MeltQuoteBolt11RequestSdk {
-                request: Bolt11Invoice::from_str(&request)?,
-                unit: CurrencyUnit::from_str(&unit)?,
-            },
-        })
-    }
-
-    pub fn request(&self) -> String {
-        self.inner.request.to_string()
-    }
-
-    pub fn unit(&self) -> String {
-        self.inner.unit.to_string()
-    }
-}
-
-pub struct MeltBolt11Request {
-    inner: MeltBolt11RequestSdk,
-}
-
-impl MeltBolt11Request {
-    pub fn new(
-        quote: String,
-        inputs: Vec<Arc<Proof>>,
-        outputs: Option<Vec<Arc<BlindedMessage>>>,
-    ) -> Result<Self> {
-        Ok(Self {
-            inner: MeltBolt11RequestSdk {
-                quote,
-                inputs: inputs.into_iter().map(|p| p.as_ref().into()).collect(),
-                outputs: outputs
-                    .map(|o| o.into_iter().map(|p| p.as_ref().deref().clone()).collect()),
-            },
-        })
-    }
-
-    pub fn inputs(&self) -> Vec<Arc<Proof>> {
-        self.inner
-            .inputs
-            .clone()
-            .into_iter()
-            .map(|p| Arc::new(p.into()))
-            .collect()
-    }
-
-    pub fn quote(&self) -> String {
-        self.inner.quote.clone()
-    }
-}
-
-pub struct MeltBolt11Response {
-    inner: MeltBolt11ResponseSdk,
-}
-
-impl MeltBolt11Response {
-    pub fn new(
-        paid: bool,
-        payment_preimage: Option<String>,
-        change: Option<Vec<Arc<BlindedSignature>>>,
-    ) -> Self {
-        Self {
-            inner: MeltBolt11ResponseSdk {
-                paid,
-                payment_preimage,
-                change: change.map(|c| c.into_iter().map(|b| b.as_ref().deref().clone()).collect()),
-            },
-        }
-    }
-
-    pub fn paid(&self) -> bool {
-        self.inner.paid
-    }
-
-    pub fn payment_preimage(&self) -> Option<String> {
-        self.inner.payment_preimage.clone()
-    }
-}

+ 0 - 134
bindings/cashu-ffi/src/nuts/nut06.rs

@@ -1,134 +0,0 @@
-use std::ops::Deref;
-use std::sync::Arc;
-
-use cashu::nuts::{MintInfo as MintInfoSdk, MintVersion as MintVersionSdk, Nuts as NutsSdk};
-
-use crate::PublicKey;
-
-pub struct MintVersion {
-    inner: MintVersionSdk,
-}
-
-impl MintVersion {
-    pub fn new(name: String, version: String) -> Self {
-        Self {
-            inner: MintVersionSdk { name, version },
-        }
-    }
-
-    pub fn name(&self) -> String {
-        self.inner.name.clone()
-    }
-
-    pub fn version(&self) -> String {
-        self.inner.version.clone()
-    }
-}
-
-impl From<&MintVersion> for MintVersionSdk {
-    fn from(mint_version: &MintVersion) -> MintVersionSdk {
-        mint_version.inner.clone()
-    }
-}
-
-impl From<MintVersionSdk> for MintVersion {
-    fn from(inner: MintVersionSdk) -> MintVersion {
-        MintVersion { inner }
-    }
-}
-
-impl Deref for MintVersion {
-    type Target = MintVersionSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-pub struct MintInfo {
-    inner: MintInfoSdk,
-}
-
-impl MintInfo {
-    #[allow(clippy::too_many_arguments)]
-    pub fn new(
-        name: Option<String>,
-        pubkey: Option<Arc<PublicKey>>,
-        version: Option<Arc<MintVersion>>,
-        description: Option<String>,
-        description_long: Option<String>,
-        contact: Option<Vec<Vec<String>>>,
-        // TODO: Should be a nuts type
-        _nuts: String,
-        motd: Option<String>,
-    ) -> Self {
-        let pubkey = pubkey.map(|p| p.as_ref().deref().clone());
-
-        Self {
-            inner: MintInfoSdk {
-                name,
-                pubkey,
-                version: version.map(|v| v.deref().into()),
-                description,
-                description_long,
-                contact,
-                nuts: NutsSdk::default(),
-                motd,
-            },
-        }
-    }
-
-    pub fn name(&self) -> Option<String> {
-        self.inner.name.clone()
-    }
-
-    pub fn pubkey(&self) -> Option<Arc<PublicKey>> {
-        self.inner.pubkey.clone().map(|p| Arc::new(p.into()))
-    }
-
-    pub fn version(&self) -> Option<Arc<MintVersion>> {
-        self.inner.version.clone().map(|v| Arc::new(v.into()))
-    }
-
-    pub fn description(&self) -> Option<String> {
-        self.inner.description.clone()
-    }
-
-    pub fn description_long(&self) -> Option<String> {
-        self.inner.description_long.clone()
-    }
-
-    pub fn contact(&self) -> Option<Vec<Vec<String>>> {
-        self.inner.contact.clone()
-    }
-
-    pub fn nuts(&self) -> Arc<Nuts> {
-        Arc::new(self.inner.nuts.clone().into())
-    }
-
-    pub fn motd(&self) -> Option<String> {
-        self.inner.motd.clone()
-    }
-}
-
-impl From<MintInfoSdk> for MintInfo {
-    fn from(inner: MintInfoSdk) -> MintInfo {
-        MintInfo { inner }
-    }
-}
-
-pub struct Nuts {
-    inner: NutsSdk,
-}
-
-impl Deref for Nuts {
-    type Target = NutsSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<NutsSdk> for Nuts {
-    fn from(inner: NutsSdk) -> Nuts {
-        Nuts { inner }
-    }
-}

+ 0 - 65
bindings/cashu-ffi/src/nuts/nut07/mod.rs

@@ -1,65 +0,0 @@
-use std::ops::Deref;
-use std::sync::Arc;
-
-use cashu::nuts::nut07::{
-    CheckSpendableRequest as CheckSpendableRequestSdk,
-    CheckSpendableResponse as CheckSpendableResponseSdk,
-};
-
-use crate::nuts::nut00::proof::mint::Proof;
-
-pub struct CheckSpendableRequest {
-    inner: CheckSpendableRequestSdk,
-}
-
-impl Deref for CheckSpendableRequest {
-    type Target = CheckSpendableRequestSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl CheckSpendableRequest {
-    pub fn new(proofs: Vec<Arc<Proof>>) -> Self {
-        Self {
-            inner: CheckSpendableRequestSdk {
-                proofs: proofs.into_iter().map(|p| p.as_ref().into()).collect(),
-            },
-        }
-    }
-
-    pub fn proofs(&self) -> Vec<Arc<Proof>> {
-        self.inner
-            .proofs
-            .clone()
-            .into_iter()
-            .map(|p| Arc::new(p.into()))
-            .collect()
-    }
-}
-
-pub struct CheckSpendableResponse {
-    inner: CheckSpendableResponseSdk,
-}
-
-impl CheckSpendableResponse {
-    pub fn new(spendable: Vec<bool>, pending: Vec<bool>) -> Self {
-        Self {
-            inner: CheckSpendableResponseSdk { spendable, pending },
-        }
-    }
-
-    pub fn spendable(&self) -> Vec<bool> {
-        self.inner.spendable.clone()
-    }
-
-    pub fn pending(&self) -> Vec<bool> {
-        self.inner.pending.clone()
-    }
-}
-
-impl From<cashu::nuts::nut07::CheckSpendableResponse> for CheckSpendableResponse {
-    fn from(inner: cashu::nuts::nut07::CheckSpendableResponse) -> CheckSpendableResponse {
-        CheckSpendableResponse { inner }
-    }
-}

+ 0 - 112
bindings/cashu-ffi/src/nuts/nut08/mod.rs

@@ -1,112 +0,0 @@
-use std::ops::Deref;
-use std::sync::Arc;
-
-use cashu::nuts::nut08::{
-    MeltBolt11Request as MeltBolt11RequestSdk, MeltBolt11Response as MeltBolt11ResponseSdk,
-};
-
-use crate::error::Result;
-use crate::{BlindedMessage, BlindedSignature, Proof};
-
-pub struct MeltBolt11Request {
-    inner: MeltBolt11RequestSdk,
-}
-
-impl Deref for MeltBolt11Request {
-    type Target = MeltBolt11RequestSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl MeltBolt11Request {
-    pub fn new(
-        quote: String,
-        proofs: Vec<Arc<Proof>>,
-        outputs: Option<Vec<Arc<BlindedMessage>>>,
-    ) -> Result<Self> {
-        Ok(Self {
-            inner: MeltBolt11RequestSdk {
-                quote,
-                inputs: proofs.iter().map(|p| p.as_ref().into()).collect(),
-                outputs: outputs
-                    .map(|outputs| outputs.into_iter().map(|o| o.as_ref().into()).collect()),
-            },
-        })
-    }
-
-    pub fn inputs(&self) -> Vec<Arc<Proof>> {
-        self.inner
-            .inputs
-            .clone()
-            .into_iter()
-            .map(|o| Arc::new(o.into()))
-            .collect()
-    }
-
-    pub fn quote(&self) -> String {
-        self.inner.quote.clone()
-    }
-
-    pub fn outputs(&self) -> Option<Vec<Arc<BlindedMessage>>> {
-        self.inner
-            .outputs
-            .clone()
-            .map(|outputs| outputs.into_iter().map(|o| Arc::new(o.into())).collect())
-    }
-}
-
-pub struct MeltBolt11Response {
-    inner: MeltBolt11ResponseSdk,
-}
-
-impl Deref for MeltBolt11Response {
-    type Target = MeltBolt11ResponseSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<cashu::nuts::nut08::MeltBolt11Response> for MeltBolt11Response {
-    fn from(inner: cashu::nuts::nut08::MeltBolt11Response) -> MeltBolt11Response {
-        MeltBolt11Response { inner }
-    }
-}
-
-impl From<MeltBolt11Response> for cashu::nuts::nut08::MeltBolt11Response {
-    fn from(res: MeltBolt11Response) -> cashu::nuts::nut08::MeltBolt11Response {
-        res.inner
-    }
-}
-
-impl MeltBolt11Response {
-    pub fn new(
-        paid: bool,
-        payment_preimage: Option<String>,
-        change: Option<Vec<Arc<BlindedSignature>>>,
-    ) -> Self {
-        Self {
-            inner: MeltBolt11ResponseSdk {
-                paid,
-                payment_preimage,
-                change: change
-                    .map(|change| change.into_iter().map(|bs| bs.as_ref().into()).collect()),
-            },
-        }
-    }
-
-    pub fn paid(&self) -> bool {
-        self.inner.paid
-    }
-
-    pub fn payment_preimage(&self) -> Option<String> {
-        self.inner.payment_preimage.clone()
-    }
-
-    pub fn change(&self) -> Option<Vec<Arc<BlindedSignature>>> {
-        self.inner
-            .change
-            .clone()
-            .map(|change| change.into_iter().map(|bs| Arc::new(bs.into())).collect())
-    }
-}

+ 0 - 54
bindings/cashu-ffi/src/types/amount.rs

@@ -1,54 +0,0 @@
-use std::ops::Deref;
-use std::sync::Arc;
-
-use cashu::Amount as AmountSdk;
-
-pub struct Amount {
-    inner: AmountSdk,
-}
-
-impl Deref for Amount {
-    type Target = AmountSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl Amount {
-    pub fn new(amount: u64) -> Self {
-        Self {
-            inner: AmountSdk::from(amount),
-        }
-    }
-
-    pub const ZERO: Amount = Amount {
-        inner: AmountSdk::ZERO,
-    };
-
-    /// Split into parts that are powers of two
-    pub fn split(&self) -> Vec<Arc<Self>> {
-        self.inner
-            .split()
-            .into_iter()
-            .map(|a| Arc::new(a.into()))
-            .collect()
-    }
-}
-
-impl From<AmountSdk> for Amount {
-    fn from(amount: AmountSdk) -> Amount {
-        Amount { inner: amount }
-    }
-}
-
-impl From<&Amount> for AmountSdk {
-    fn from(amount: &Amount) -> AmountSdk {
-        amount.inner
-    }
-}
-
-impl From<u64> for Amount {
-    fn from(amount: u64) -> Amount {
-        AmountSdk::from(amount).into()
-    }
-}

+ 0 - 43
bindings/cashu-ffi/src/types/bolt11_invoice.rs

@@ -1,43 +0,0 @@
-use std::ops::Deref;
-use std::str::FromStr;
-use std::sync::Arc;
-
-use cashu::Bolt11Invoice as Bolt11InvoiceSdk;
-
-use crate::error::Result;
-use crate::Amount;
-
-pub struct Bolt11Invoice {
-    inner: Bolt11InvoiceSdk,
-}
-
-impl Deref for Bolt11Invoice {
-    type Target = Bolt11InvoiceSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<Bolt11InvoiceSdk> for Bolt11Invoice {
-    fn from(inner: Bolt11InvoiceSdk) -> Bolt11Invoice {
-        Bolt11Invoice { inner }
-    }
-}
-
-impl Bolt11Invoice {
-    pub fn new(bolt11: String) -> Result<Self> {
-        Ok(Self {
-            inner: Bolt11InvoiceSdk::from_str(&bolt11)?,
-        })
-    }
-
-    pub fn as_string(&self) -> String {
-        self.inner.to_string()
-    }
-
-    pub fn amount(&self) -> Option<Arc<Amount>> {
-        self.inner
-            .amount_milli_satoshis()
-            .map(|a| Arc::new(Amount::from(a / 1000)))
-    }
-}

+ 0 - 36
bindings/cashu-ffi/src/types/keyset_info.rs

@@ -1,36 +0,0 @@
-use std::ops::Deref;
-use std::str::FromStr;
-use std::sync::Arc;
-
-use cashu::nuts::{CurrencyUnit, KeySetInfo as KeySetInfoSdk};
-
-use crate::Id;
-
-pub struct KeySetInfo {
-    inner: KeySetInfoSdk,
-}
-
-impl Deref for KeySetInfo {
-    type Target = KeySetInfoSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<KeySetInfoSdk> for KeySetInfo {
-    fn from(inner: KeySetInfoSdk) -> KeySetInfo {
-        KeySetInfo { inner }
-    }
-}
-
-impl KeySetInfo {
-    pub fn new(id: Arc<Id>, unit: String, active: bool) -> Self {
-        Self {
-            inner: KeySetInfoSdk {
-                id: *id.as_ref().deref(),
-                unit: CurrencyUnit::from_str(&unit).unwrap(),
-                active,
-            },
-        }
-    }
-}

+ 0 - 49
bindings/cashu-ffi/src/types/melt_quote.rs

@@ -1,49 +0,0 @@
-use std::ops::Deref;
-use std::str::FromStr;
-use std::sync::Arc;
-
-use cashu::nuts::CurrencyUnit;
-use cashu::types::MeltQuote as MeltQuoteSdk;
-
-use crate::{Amount, Bolt11Invoice};
-
-pub struct MeltQuote {
-    inner: MeltQuoteSdk,
-}
-
-impl Deref for MeltQuote {
-    type Target = MeltQuoteSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<MeltQuoteSdk> for MeltQuote {
-    fn from(inner: MeltQuoteSdk) -> MeltQuote {
-        MeltQuote { inner }
-    }
-}
-
-impl MeltQuote {
-    pub fn new(
-        id: String,
-        amount: Arc<Amount>,
-        unit: String,
-        request: Arc<Bolt11Invoice>,
-        fee_reserve: Arc<Amount>,
-        paid: bool,
-        expiry: u64,
-    ) -> Self {
-        Self {
-            inner: MeltQuoteSdk {
-                id,
-                amount: *amount.as_ref().deref(),
-                unit: CurrencyUnit::from_str(&unit).unwrap(),
-                request: request.as_ref().deref().clone(),
-                fee_reserve: *fee_reserve.as_ref().deref(),
-                paid,
-                expiry,
-            },
-        }
-    }
-}

+ 0 - 47
bindings/cashu-ffi/src/types/mint_quote.rs

@@ -1,47 +0,0 @@
-use std::ops::Deref;
-use std::str::FromStr;
-use std::sync::Arc;
-
-use cashu::nuts::CurrencyUnit;
-use cashu::types::MintQuote as MintQuoteSdk;
-
-use crate::{Amount, Bolt11Invoice};
-
-pub struct MintQuote {
-    inner: MintQuoteSdk,
-}
-
-impl Deref for MintQuote {
-    type Target = MintQuoteSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<MintQuoteSdk> for MintQuote {
-    fn from(inner: MintQuoteSdk) -> MintQuote {
-        MintQuote { inner }
-    }
-}
-
-impl MintQuote {
-    pub fn new(
-        id: String,
-        amount: Arc<Amount>,
-        unit: String,
-        request: Arc<Bolt11Invoice>,
-        paid: bool,
-        expiry: u64,
-    ) -> Self {
-        Self {
-            inner: MintQuoteSdk {
-                id,
-                amount: *amount.as_ref().deref(),
-                unit: CurrencyUnit::from_str(&unit).unwrap(),
-                request: request.as_ref().deref().clone(),
-                paid,
-                expiry,
-            },
-        }
-    }
-}

+ 0 - 47
bindings/cashu-ffi/src/types/mint_quote_info.rs

@@ -1,47 +0,0 @@
-use std::ops::Deref;
-use std::str::FromStr;
-use std::sync::Arc;
-
-use cashu::nuts::CurrencyUnit;
-use cashu::types::MintQuote as MintQuoteSdk;
-
-use crate::{Amount, Bolt11Invoice};
-
-pub struct MintQuote {
-    inner: MintQuoteSdk,
-}
-
-impl Deref for MintQuote {
-    type Target = MintQuoteSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<MintQuoteSdk> for MintQuote {
-    fn from(inner: MintQuoteSdk) -> MintQuote {
-        MintQuote { inner }
-    }
-}
-
-impl MintQuote {
-    pub fn new(
-        id: String,
-        amount: Arc<Amount>,
-        unit: String,
-        request: Arc<Bolt11Invoice>,
-        paid: bool,
-        expiry: u64,
-    ) -> Self {
-        Self {
-            inner: MintQuoteSdk {
-                id,
-                amount: amount.as_ref().deref().clone(),
-                unit: CurrencyUnit::from_str(&unit).unwrap(),
-                request: request.as_ref().deref().clone(),
-                paid,
-                expiry,
-            },
-        }
-    }
-}

+ 0 - 13
bindings/cashu-ffi/src/types/mod.rs

@@ -1,13 +0,0 @@
-pub mod amount;
-pub mod bolt11_invoice;
-pub mod keyset_info;
-pub mod melt_quote;
-pub mod mint_quote;
-pub mod secret;
-
-pub use amount::Amount;
-pub use bolt11_invoice::Bolt11Invoice;
-pub use keyset_info::KeySetInfo;
-pub use melt_quote::MeltQuote;
-pub use mint_quote::MintQuote;
-pub use secret::Secret;

+ 0 - 44
bindings/cashu-ffi/src/types/secret.rs

@@ -1,44 +0,0 @@
-use std::ops::Deref;
-
-use cashu::secret::Secret as SecretSdk;
-
-pub struct Secret {
-    inner: SecretSdk,
-}
-
-impl Deref for Secret {
-    type Target = SecretSdk;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl Default for Secret {
-    fn default() -> Self {
-        Self::new()
-    }
-}
-
-impl Secret {
-    pub fn new() -> Self {
-        Self {
-            inner: SecretSdk::new(),
-        }
-    }
-
-    pub fn as_bytes(&self) -> Vec<u8> {
-        self.inner.as_bytes().to_vec()
-    }
-}
-
-impl From<SecretSdk> for Secret {
-    fn from(inner: SecretSdk) -> Secret {
-        Secret { inner }
-    }
-}
-
-impl From<Secret> for SecretSdk {
-    fn from(secret: Secret) -> SecretSdk {
-        secret.inner
-    }
-}

+ 0 - 10
bindings/cashu-ffi/uniffi.toml

@@ -1,10 +0,0 @@
-[bindings.kotlin]
-package_name = "cashu"
-cdylib_name = "cashu_ffi"
-
-[bindings.swift]
-ffi_module_filename = "cashuFFI"
-cdylib_name = "cashu_ffi"
-
-[bindings.python]
-cdylib_name = "cashu_ffi"

+ 0 - 2
bindings/cashu-js/.cargo/config.toml

@@ -1,2 +0,0 @@
-[build]
-target = "wasm32-unknown-unknown"

+ 0 - 7
bindings/cashu-js/.gitignore

@@ -1,7 +0,0 @@
-/target
-**/*.rs.bk
-Cargo.lock
-bin/
-pkg/
-wasm-pack.log
-*.tgz

+ 0 - 12
bindings/cashu-js/.npmignore

@@ -1,12 +0,0 @@
-.cargo/
-target/
-src/
-scripts/
-examples/
-pkg/package.json
-pkg/*.md
-pkg/*.wasm
-.gitignore
-Cargo.toml
-Cargo.lock
-*.tgz

+ 0 - 28
bindings/cashu-js/Cargo.toml

@@ -1,28 +0,0 @@
-[package]
-name = "cashu-js"
-version = "0.1.0"
-edition = "2021"
-description = "Cashu rust implementation, for JavaScript"
-authors = ["thesimplekid <tsk@thesimplekid.com>"]
-publish = false
-repository.workspace = true
-license.workspace = true
-
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-[lib]
-crate-type = ["lib", "cdylib"]
-
-[dependencies]
-cashu = { path = "../../crates/cashu", features = ["nut08"] }
-js-sys = "0.3.64"
-serde-wasm-bindgen = "0.6.0"
-serde_json.workspace = true
-serde.workspace = true
-wasm-bindgen = { version = "0.2.87", features = ["serde-serialize"] }
-wasm-bindgen-futures = "0.4.37"
-console_error_panic_hook = "0.1"
-
-
-
-[package.metadata.wasm-pack.profile.release]
-wasm-opt = true

+ 0 - 29
bindings/cashu-js/LICENSE

@@ -1,29 +0,0 @@
-BSD 3-Clause License
-
-Copyright (c) 2023, thesimplekid
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this
-   list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice,
-   this list of conditions and the following disclaimer in the documentation
-   and/or other materials provided with the distribution.
-
-3. Neither the name of the copyright holder nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 0 - 21
bindings/cashu-js/LICENSES/NOSTR-MIT

@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2022-2023 Yuki Kishimoto
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.

+ 0 - 12
bindings/cashu-js/examples/amount.js

@@ -1,12 +0,0 @@
-const {Amount, loadWasmAsync, loadWasmSync } = require("..");
-
-
-function main() {
-  loadWasmSync();
-
-  let amount = Amount.fromSat(BigInt(10));
-
-  console.log(amount.toSat())
-}
-
-main();

+ 0 - 5
bindings/cashu-js/justfile

@@ -1,5 +0,0 @@
-build:
-	wasm-pack build
-
-pack:
-	npm run package

+ 0 - 44
bindings/cashu-js/package.json

@@ -1,44 +0,0 @@
-{
-  "name": "@rust-cashu/cashu",
-  "version": "0.0.1",
-  "description": "Cashu protocol implementation, for JavaScript",
-  "keywords": [
-    "cashu",
-    "protocol",
-    "rust",
-    "bindings"
-  ],
-  "license": "BSD-3-Clause",
-  "homepage": "https://github.com/thesimplekid/cashu-crab",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/thesimplekid/cashu-crab"
-  },
-  "bugs": {
-    "url": "https://github.com/thesimplekid/cashu-crab/issues"
-  },
-  "author": {
-    "name": "thesimplekid",
-    "email": "tsk@thesimplekid.com",
-    "url": "https://github.com/thesimplekid"
-  },
-  "main": "pkg/cashu_js.js",
-  "types": "pkg/cashu_js.d.ts",
-  "files": [
-      "pkg/cashu_js_bg.wasm.js",
-      "pkg/cashu_js_bg.wasm.d.ts",
-      "pkg/cashu_js.js",
-      "pkg/cashu_js.d.ts"
-  ],
-  "devDependencies": {
-    "wasm-pack": "^0.10.2"
-  },
-  "engines": {
-    "node": ">= 10"
-  },
-  "scripts": {
-    "build": "WASM_PACK_ARGS=--release ./scripts/build.sh",
-    "build:dev": "WASM_PACK_ARGS=--dev ./scripts/build.sh",
-    "package": "npm run build && npm pack"
-  }
-}

+ 0 - 21
bindings/cashu-js/scripts/LICENSE

@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2022-2023 Yuki Kishimoto
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.

+ 0 - 35
bindings/cashu-js/scripts/build.sh

@@ -1,35 +0,0 @@
-#!/bin/bash
-#
-# Build the JavaScript modules
-#
-# This script is really a workaround for https://github.com/rustwasm/wasm-pack/issues/1074.
-#
-# Currently, the only reliable way to load WebAssembly in all the JS
-# environments we want to target (web-via-webpack, web-via-browserify, jest)
-# seems to be to pack the WASM into base64, and then unpack it and instantiate
-# it at runtime.
-#
-# Hopefully one day, https://github.com/rustwasm/wasm-pack/issues/1074 will be
-# fixed and this will be unnecessary.
-
-set -e
-
-cd "$(dirname "$0")"/..
-
-WASM_BINDGEN_WEAKREF=1 wasm-pack build --target nodejs --scope rust-cashu --out-dir pkg "${WASM_PACK_ARGS[@]}"
-
-# Convert the Wasm into a JS file that exports the base64'ed Wasm.
-echo "module.exports = \`$(base64 pkg/cashu_js_bg.wasm)\`;" > pkg/cashu_js_bg.wasm.js
-
-# In the JavaScript:
-#  1. Strip out the lines that load the WASM, and our new epilogue.
-#  2. Remove the imports of `TextDecoder` and `TextEncoder`. We rely on the global defaults.
-{
-  sed -e '/Text..coder.*= require(.util.)/d' \
-      -e '/^const path = /,$d' pkg/cashu_js.js
-  cat scripts/epilogue.js
-} > pkg/cashu_js.js.new
-mv pkg/cashu_js.js.new pkg/cashu_js.js
-
-# also extend the typescript
-cat scripts/epilogue.d.ts >> pkg/cashu_js.d.ts

+ 0 - 10
bindings/cashu-js/scripts/epilogue.d.ts

@@ -1,10 +0,0 @@
-/**
- * Load the WebAssembly module in the background, if it has not already been loaded.
- *
- * Returns a promise which will resolve once the other methods are ready.
- *
- * @returns {Promise<void>}
- */
- export function loadWasmAsync(): Promise<void>;
-
- export function loadWasmSync(): void;

+ 0 - 76
bindings/cashu-js/scripts/epilogue.js

@@ -1,76 +0,0 @@
-let inited = false;
-module.exports.loadWasmSync = function () {
-    if (inited) {
-        return;
-    }
-    if (initPromise) {
-        throw new Error("Asynchronous initialisation already in progress: cannot initialise synchronously");
-    }
-    const bytes = unbase64(require("./cashu_js_bg.wasm.js"));
-    const mod = new WebAssembly.Module(bytes);
-    const instance = new WebAssembly.Instance(mod, imports);
-    wasm = instance.exports;
-    wasm.__wbindgen_start();
-    inited = true;
-};
-
-let initPromise = null;
-
-/**
- * Load the WebAssembly module in the background, if it has not already been loaded.
- *
- * Returns a promise which will resolve once the other methods are ready.
- *
- * @returns {Promise<void>}
- */
-module.exports.loadWasmAsync = function () {
-    if (inited) {
-        return Promise.resolve();
-    }
-    if (!initPromise) {
-        initPromise = Promise.resolve()
-            .then(() => require("./cashu_js_bg.wasm.js"))
-            .then((b64) => WebAssembly.instantiate(unbase64(b64), imports))
-            .then((result) => {
-                wasm = result.instance.exports;
-                wasm.__wbindgen_start();
-                inited = true;
-            });
-    }
-    return initPromise;
-};
-
-const b64lookup = new Uint8Array([
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 62, 0, 62, 0, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7,
-    8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 63, 0, 26, 27, 28, 29, 30, 31, 32,
-    33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
-]);
-
-// base64 decoder, based on the code at https://developer.mozilla.org/en-US/docs/Glossary/Base64#solution_2_%E2%80%93_rewriting_atob_and_btoa_using_typedarrays_and_utf-8
-function unbase64(sBase64) {
-    const sB64Enc = sBase64.replace(/[^A-Za-z0-9+/]/g, "");
-    const nInLen = sB64Enc.length;
-    const nOutLen = (nInLen * 3 + 1) >> 2;
-    const taBytes = new Uint8Array(nOutLen);
-
-    let nMod3;
-    let nMod4;
-    let nUint24 = 0;
-    let nOutIdx = 0;
-    for (let nInIdx = 0; nInIdx < nInLen; nInIdx++) {
-        nMod4 = nInIdx & 3;
-        nUint24 |= b64lookup[sB64Enc.charCodeAt(nInIdx)] << (6 * (3 - nMod4));
-        if (nMod4 === 3 || nInLen - nInIdx === 1) {
-            nMod3 = 0;
-            while (nMod3 < 3 && nOutIdx < nOutLen) {
-                taBytes[nOutIdx] = (nUint24 >>> ((16 >>> nMod3) & 24)) & 255;
-                nMod3++;
-                nOutIdx++;
-            }
-            nUint24 = 0;
-        }
-    }
-
-    return taBytes;
-}

+ 0 - 12
bindings/cashu-js/src/error.rs

@@ -1,12 +0,0 @@
-use wasm_bindgen::JsValue;
-
-pub type Result<T, E = JsValue> = std::result::Result<T, E>;
-
-/// Helper to replace the `E` to `Error` to `napi::Error` conversion.
-#[inline]
-pub fn into_err<E>(error: E) -> JsValue
-where
-    E: std::error::Error,
-{
-    JsValue::from_str(&error.to_string())
-}

+ 0 - 12
bindings/cashu-js/src/lib.rs

@@ -1,12 +0,0 @@
-use wasm_bindgen::prelude::*;
-
-pub mod error;
-pub mod nuts;
-mod types;
-
-pub use self::types::{JsAmount, JsBolt11Invoice, JsProofsStatus, JsSecret};
-
-#[wasm_bindgen(start)]
-pub fn start() {
-    console_error_panic_hook::set_once();
-}

+ 0 - 20
bindings/cashu-js/src/nuts/mod.rs

@@ -1,20 +0,0 @@
-pub mod nut00;
-pub mod nut01;
-pub mod nut02;
-pub mod nut03;
-pub mod nut04;
-pub mod nut05;
-#[cfg(feature = "nut07")]
-pub mod nut07;
-pub mod nut08;
-#[cfg(feature = "nut09")]
-pub mod nut09;
-
-pub use nut00::{JsBlindedMessage, JsBlindedMessages, JsBlindedSignature, JsProof, JsToken};
-pub use nut01::{JsKeyPair, JsKeys, JsPublicKey, JsSecretKey};
-pub use nut02::{JsId, JsKeySet, JsKeySetsResponse, JsKeysResponse, JsMintKeySet};
-pub use nut03::{JsSwapRequest, JsSwapResponse};
-pub use nut04::{JsMintBolt11Request, JsMintBolt11Response};
-#[cfg(feature = "nut07")]
-pub use nut07::{JsCheckSpendableRequest, JsCheckSpendableResponse};
-pub use nut08::{JsMeltBolt11Request, JsMeltBolt11Response};

+ 0 - 53
bindings/cashu-js/src/nuts/nut00/blinded_message.rs

@@ -1,53 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::nut00::BlindedMessage;
-use wasm_bindgen::prelude::*;
-
-use crate::nuts::nut01::JsPublicKey;
-use crate::nuts::nut02::JsId;
-use crate::types::amount::JsAmount;
-
-#[wasm_bindgen(js_name = BlindedMessage)]
-pub struct JsBlindedMessage {
-    inner: BlindedMessage,
-}
-
-impl Deref for JsBlindedMessage {
-    type Target = BlindedMessage;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<BlindedMessage> for JsBlindedMessage {
-    fn from(inner: BlindedMessage) -> JsBlindedMessage {
-        JsBlindedMessage { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = BlindedMessage)]
-impl JsBlindedMessage {
-    #[allow(clippy::new_without_default)]
-    #[wasm_bindgen(constructor)]
-    pub fn new(keyset_id: JsId, amount: JsAmount, b: JsPublicKey) -> Self {
-        Self {
-            inner: BlindedMessage {
-                keyset_id: *keyset_id.deref(),
-                amount: *amount.deref(),
-                b: b.deref().clone(),
-            },
-        }
-    }
-
-    /// Amount
-    #[wasm_bindgen(getter)]
-    pub fn amount(&self) -> JsAmount {
-        self.inner.amount.into()
-    }
-
-    /// B
-    #[wasm_bindgen(getter)]
-    pub fn b(&self) -> JsPublicKey {
-        self.inner.b.clone().into()
-    }
-}

+ 0 - 62
bindings/cashu-js/src/nuts/nut00/blinded_messages.rs

@@ -1,62 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::nut00::wallet::PreMintSecrets;
-use wasm_bindgen::prelude::*;
-
-use crate::error::{into_err, Result};
-use crate::nuts::nut02::JsId;
-use crate::types::JsAmount;
-
-#[wasm_bindgen(js_name = BlindedMessages)]
-pub struct JsBlindedMessages {
-    inner: PreMintSecrets,
-}
-
-impl Deref for JsBlindedMessages {
-    type Target = PreMintSecrets;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-#[wasm_bindgen(js_class = BlindedMessages)]
-impl JsBlindedMessages {
-    #[wasm_bindgen(js_name = random)]
-    pub fn random(keyset_id: JsId, amount: JsAmount) -> Result<JsBlindedMessages> {
-        Ok(JsBlindedMessages {
-            inner: PreMintSecrets::random(*keyset_id.deref(), *amount.deref()).map_err(into_err)?,
-        })
-    }
-
-    #[wasm_bindgen(js_name = blank)]
-    pub fn blank(keyset_id: JsId, fee_reserve: JsAmount) -> Result<JsBlindedMessages> {
-        Ok(JsBlindedMessages {
-            inner: PreMintSecrets::blank(*keyset_id.deref(), *fee_reserve.deref())
-                .map_err(into_err)?,
-        })
-    }
-
-    /// Blinded Messages
-    #[wasm_bindgen(getter)]
-    pub fn blinded_messages(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.blinded_messages()).map_err(into_err)
-    }
-
-    /// Secrets
-    #[wasm_bindgen(getter)]
-    pub fn secrets(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.secrets()).map_err(into_err)
-    }
-
-    /// rs
-    #[wasm_bindgen(getter)]
-    pub fn rs(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.rs()).map_err(into_err)
-    }
-
-    /// Amounts
-    #[wasm_bindgen(getter)]
-    pub fn amounts(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.amounts()).map_err(into_err)
-    }
-}

+ 0 - 35
bindings/cashu-js/src/nuts/nut00/blinded_signature.rs

@@ -1,35 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::nut00::BlindedSignature;
-use wasm_bindgen::prelude::*;
-
-use crate::nuts::nut01::JsPublicKey;
-use crate::nuts::nut02::JsId;
-use crate::types::JsAmount;
-
-#[wasm_bindgen(js_name = BlindedSignature)]
-pub struct JsBlindedSignature {
-    inner: BlindedSignature,
-}
-
-impl Deref for JsBlindedSignature {
-    type Target = BlindedSignature;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-#[wasm_bindgen(js_class = BlindedSignature)]
-impl JsBlindedSignature {
-    #[allow(clippy::new_without_default)]
-    #[wasm_bindgen(constructor)]
-    pub fn new(keyset_id: JsId, amount: JsAmount, c: JsPublicKey) -> Self {
-        Self {
-            inner: BlindedSignature {
-                keyset_id: *keyset_id.deref(),
-                amount: *amount.deref(),
-                c: c.deref().clone(),
-            },
-        }
-    }
-}

+ 0 - 11
bindings/cashu-js/src/nuts/nut00/mod.rs

@@ -1,11 +0,0 @@
-mod blinded_message;
-mod blinded_messages;
-mod blinded_signature;
-mod proof;
-mod token;
-
-pub use blinded_message::JsBlindedMessage;
-pub use blinded_messages::JsBlindedMessages;
-pub use blinded_signature::JsBlindedSignature;
-pub use proof::JsProof;
-pub use token::JsToken;

+ 0 - 65
bindings/cashu-js/src/nuts/nut00/proof.rs

@@ -1,65 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::nut00::Proof;
-use wasm_bindgen::prelude::*;
-
-use crate::nuts::nut01::JsPublicKey;
-use crate::nuts::nut02::JsId;
-use crate::types::{JsAmount, JsSecret};
-
-#[wasm_bindgen(js_name = Proof)]
-pub struct JsProof {
-    inner: Proof,
-}
-
-impl Deref for JsProof {
-    type Target = Proof;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<Proof> for JsProof {
-    fn from(inner: Proof) -> JsProof {
-        JsProof { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = Proof)]
-impl JsProof {
-    #[wasm_bindgen(constructor)]
-    pub fn new(amount: JsAmount, secret: JsSecret, c: JsPublicKey, keyset_id: JsId) -> JsProof {
-        Self {
-            inner: Proof {
-                amount: *amount.deref(),
-                secret: secret.deref().clone(),
-                c: c.deref().clone(),
-                keyset_id: *keyset_id.deref(),
-            },
-        }
-    }
-
-    /// Amount
-    #[wasm_bindgen(getter)]
-    pub fn amount(&self) -> JsAmount {
-        self.inner.amount.into()
-    }
-
-    /// Secret
-    #[wasm_bindgen(getter)]
-    pub fn secret(&self) -> JsSecret {
-        self.inner.secret.clone().into()
-    }
-
-    /// C
-    #[wasm_bindgen(getter)]
-    pub fn c(&self) -> JsPublicKey {
-        self.inner.c.clone().into()
-    }
-
-    /// Keyset Id
-    #[wasm_bindgen(getter)]
-    pub fn keyset_id(&self) -> JsId {
-        self.inner.keyset_id.into()
-    }
-}

+ 0 - 69
bindings/cashu-js/src/nuts/nut00/token.rs

@@ -1,69 +0,0 @@
-use std::ops::Deref;
-use std::str::FromStr;
-
-use cashu::nuts::nut00::wallet::Token;
-use cashu::nuts::CurrencyUnit;
-use cashu::url::UncheckedUrl;
-use wasm_bindgen::prelude::*;
-
-use crate::error::{into_err, Result};
-
-#[wasm_bindgen(js_name = Token)]
-pub struct JsToken {
-    inner: Token,
-}
-
-impl Deref for JsToken {
-    type Target = Token;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<Token> for JsToken {
-    fn from(inner: Token) -> JsToken {
-        JsToken { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = Token)]
-impl JsToken {
-    #[wasm_bindgen(constructor)]
-    pub fn new(
-        mint: String,
-        proofs: JsValue,
-        memo: Option<String>,
-        unit: Option<String>,
-    ) -> Result<JsToken> {
-        let mint = UncheckedUrl::from_str(&mint).map_err(into_err)?;
-        let proofs = serde_wasm_bindgen::from_value(proofs).map_err(into_err)?;
-        let unit = unit.map(|u| {
-            CurrencyUnit::from_str(&u)
-                .map_err(into_err)
-                .unwrap_or_default()
-        });
-        Ok(Self {
-            inner: Token::new(mint, proofs, memo, unit).map_err(into_err)?,
-        })
-    }
-
-    /// Memo
-    #[wasm_bindgen(getter)]
-    pub fn memo(&self) -> Option<String> {
-        self.inner.memo.clone()
-    }
-
-    /// From String
-    #[wasm_bindgen(js_name = fromString)]
-    pub fn from_string(token: String) -> Result<JsToken> {
-        Ok(JsToken {
-            inner: Token::from_str(&token).map_err(into_err)?,
-        })
-    }
-
-    /// As String
-    #[wasm_bindgen(js_name = asString)]
-    pub fn as_string(&self) -> String {
-        self.inner.to_string()
-    }
-}

+ 0 - 47
bindings/cashu-js/src/nuts/nut01/key_pair.rs

@@ -1,47 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::nut01::mint::KeyPair;
-use wasm_bindgen::prelude::*;
-
-use super::{JsPublicKey, JsSecretKey};
-
-#[wasm_bindgen(js_name = KeyPair)]
-pub struct JsKeyPair {
-    inner: KeyPair,
-}
-
-impl Deref for JsKeyPair {
-    type Target = KeyPair;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<KeyPair> for JsKeyPair {
-    fn from(inner: KeyPair) -> JsKeyPair {
-        JsKeyPair { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = KeyPair)]
-impl JsKeyPair {
-    /// From Hex
-    #[wasm_bindgen(js_name = fromSecretKey)]
-    pub fn from_secret_key(secret_key: JsSecretKey) -> JsKeyPair {
-        Self {
-            inner: KeyPair::from_secret_key(secret_key.deref().clone()),
-        }
-    }
-
-    /// Secret Key
-    #[wasm_bindgen(getter)]
-    pub fn secret_key(&self) -> JsSecretKey {
-        self.inner.secret_key.clone().into()
-    }
-
-    /// Public Key
-    #[wasm_bindgen(getter)]
-    pub fn public_key(&self) -> JsPublicKey {
-        self.inner.public_key.clone().into()
-    }
-}

+ 0 - 51
bindings/cashu-js/src/nuts/nut01/keys.rs

@@ -1,51 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::nut01::Keys;
-use wasm_bindgen::prelude::*;
-
-use super::JsPublicKey;
-use crate::error::{into_err, Result};
-use crate::types::JsAmount;
-
-#[wasm_bindgen(js_name = Keys)]
-pub struct JsKeys {
-    inner: Keys,
-}
-
-impl Deref for JsKeys {
-    type Target = Keys;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<Keys> for JsKeys {
-    fn from(inner: Keys) -> JsKeys {
-        JsKeys { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = Keys)]
-impl JsKeys {
-    /// From Hex
-    #[wasm_bindgen(constructor)]
-    pub fn new(keys: JsValue) -> Result<JsKeys> {
-        let keys = serde_wasm_bindgen::from_value(keys).map_err(into_err)?;
-
-        Ok(JsKeys {
-            inner: Keys::new(keys),
-        })
-    }
-
-    /// Keys
-    #[wasm_bindgen(js_name = keys)]
-    pub fn keys(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.keys()).map_err(into_err)
-    }
-
-    /// Amount Key
-    #[wasm_bindgen(js_name = amountKey)]
-    pub fn amount_key(&self, amount: JsAmount) -> Option<JsPublicKey> {
-        self.inner.amount_key(*amount.deref()).map(|k| k.into())
-    }
-}

+ 0 - 9
bindings/cashu-js/src/nuts/nut01/mod.rs

@@ -1,9 +0,0 @@
-mod key_pair;
-mod keys;
-mod public_key;
-mod secret_key;
-
-pub use key_pair::JsKeyPair;
-pub use keys::JsKeys;
-pub use public_key::JsPublicKey;
-pub use secret_key::JsSecretKey;

+ 0 - 41
bindings/cashu-js/src/nuts/nut01/public_key.rs

@@ -1,41 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::nut01::PublicKey;
-use wasm_bindgen::prelude::*;
-
-use crate::error::{into_err, Result};
-
-#[wasm_bindgen(js_name = PublicKey)]
-pub struct JsPublicKey {
-    inner: PublicKey,
-}
-
-impl Deref for JsPublicKey {
-    type Target = PublicKey;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<PublicKey> for JsPublicKey {
-    fn from(inner: PublicKey) -> JsPublicKey {
-        JsPublicKey { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = PublicKey)]
-impl JsPublicKey {
-    /// From Hex
-    #[wasm_bindgen(js_name = fromHex)]
-    pub fn from_hex(hex: String) -> Result<JsPublicKey> {
-        Ok(Self {
-            inner: PublicKey::from_hex(hex).map_err(into_err)?,
-        })
-    }
-
-    /// To Hex
-    #[wasm_bindgen(js_name = toHex)]
-    pub fn to_hex(&self) -> String {
-        self.inner.to_hex()
-    }
-}

+ 0 - 31
bindings/cashu-js/src/nuts/nut01/secret_key.rs

@@ -1,31 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::nut01::SecretKey;
-use wasm_bindgen::prelude::*;
-
-#[wasm_bindgen(js_name = SecretKey)]
-pub struct JsSecretKey {
-    inner: SecretKey,
-}
-
-impl Deref for JsSecretKey {
-    type Target = SecretKey;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<SecretKey> for JsSecretKey {
-    fn from(inner: SecretKey) -> JsSecretKey {
-        JsSecretKey { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = SecretKey)]
-impl JsSecretKey {
-    /// To Hex
-    #[wasm_bindgen(js_name = toHex)]
-    pub fn to_hex(&self) -> String {
-        self.inner.to_hex()
-    }
-}

+ 0 - 152
bindings/cashu-js/src/nuts/nut02/keyset.rs

@@ -1,152 +0,0 @@
-use std::ops::Deref;
-use std::str::FromStr;
-
-use cashu::nuts::{CurrencyUnit, Id, KeySet, KeysResponse, KeysetResponse};
-use wasm_bindgen::prelude::*;
-
-use crate::error::{into_err, Result};
-use crate::nuts::nut01::JsKeys;
-
-#[wasm_bindgen(js_name = Id)]
-pub struct JsId {
-    inner: Id,
-}
-
-impl Deref for JsId {
-    type Target = Id;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<Id> for JsId {
-    fn from(inner: Id) -> JsId {
-        JsId { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = Id)]
-impl JsId {
-    /// Try From Base 64 String
-    #[wasm_bindgen(js_name = tryFromBase64)]
-    pub fn try_from_base64(id: String) -> Result<JsId> {
-        Ok(JsId {
-            inner: Id::from_str(&id).map_err(into_err)?,
-        })
-    }
-
-    /// As String
-    #[wasm_bindgen(js_name = asString)]
-    pub fn as_string(&self) -> String {
-        self.inner.to_string()
-    }
-}
-
-#[wasm_bindgen(js_name = KeySet)]
-pub struct JsKeySet {
-    inner: KeySet,
-}
-
-impl Deref for JsKeySet {
-    type Target = KeySet;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<KeySet> for JsKeySet {
-    fn from(inner: KeySet) -> JsKeySet {
-        JsKeySet { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = KeyPair)]
-impl JsKeySet {
-    /// From Hex
-    #[wasm_bindgen(constructor)]
-    pub fn new(id: JsId, unit: String, keys: JsKeys) -> JsKeySet {
-        Self {
-            inner: KeySet {
-                id: *id.deref(),
-                unit: CurrencyUnit::from_str(&unit).unwrap(),
-                keys: keys.deref().clone(),
-            },
-        }
-    }
-
-    #[wasm_bindgen(getter)]
-    pub fn id(&self) -> JsId {
-        self.inner.id.into()
-    }
-
-    #[wasm_bindgen(getter)]
-    pub fn keys(&self) -> JsKeys {
-        self.inner.keys.clone().into()
-    }
-}
-
-#[wasm_bindgen(js_name = KeySetsResponse)]
-pub struct JsKeySetsResponse {
-    inner: KeysetResponse,
-}
-
-impl Deref for JsKeySetsResponse {
-    type Target = KeysetResponse;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<KeysetResponse> for JsKeySetsResponse {
-    fn from(inner: KeysetResponse) -> JsKeySetsResponse {
-        JsKeySetsResponse { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = KeySetsResponse)]
-impl JsKeySetsResponse {
-    #[wasm_bindgen(constructor)]
-    pub fn new(keysets: JsValue) -> Result<JsKeySetsResponse> {
-        let response = serde_wasm_bindgen::from_value(keysets).map_err(into_err)?;
-        Ok(Self { inner: response })
-    }
-
-    /// Get KeySets
-    #[wasm_bindgen(getter)]
-    pub fn keys(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.keysets).map_err(into_err)
-    }
-}
-
-#[wasm_bindgen(js_name = KeysResponse)]
-pub struct JsKeysResponse {
-    inner: KeysResponse,
-}
-
-impl Deref for JsKeysResponse {
-    type Target = KeysResponse;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<KeysResponse> for JsKeysResponse {
-    fn from(inner: KeysResponse) -> JsKeysResponse {
-        JsKeysResponse { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = KeysResponse)]
-impl JsKeysResponse {
-    #[wasm_bindgen(constructor)]
-    pub fn new(keysets: JsValue) -> Result<JsKeysResponse> {
-        let response = serde_wasm_bindgen::from_value(keysets).map_err(into_err)?;
-        Ok(Self { inner: response })
-    }
-
-    /// Get Keys
-    #[wasm_bindgen(getter)]
-    pub fn keysets(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.keysets).map_err(into_err)
-    }
-}

+ 0 - 45
bindings/cashu-js/src/nuts/nut02/mint_keyset.rs

@@ -1,45 +0,0 @@
-use std::ops::Deref;
-use std::str::FromStr;
-
-use cashu::nuts::nut02::mint::KeySet;
-use cashu::nuts::CurrencyUnit;
-use wasm_bindgen::prelude::*;
-
-#[wasm_bindgen(js_name = MintKeySet)]
-pub struct JsMintKeySet {
-    inner: KeySet,
-}
-
-impl Deref for JsMintKeySet {
-    type Target = KeySet;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<KeySet> for JsMintKeySet {
-    fn from(inner: KeySet) -> JsMintKeySet {
-        JsMintKeySet { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = MintKeyPair)]
-impl JsMintKeySet {
-    /// Generate
-    #[wasm_bindgen(constructor)]
-    pub fn generate(
-        secret: String,
-        unit: String,
-        derivation_path: String,
-        max_order: u8,
-    ) -> JsMintKeySet {
-        Self {
-            inner: KeySet::generate(
-                secret.as_bytes(),
-                CurrencyUnit::from_str(&unit).unwrap(),
-                &derivation_path,
-                max_order,
-            ),
-        }
-    }
-}

+ 0 - 5
bindings/cashu-js/src/nuts/nut02/mod.rs

@@ -1,5 +0,0 @@
-mod keyset;
-mod mint_keyset;
-
-pub use keyset::{JsId, JsKeySet, JsKeySetsResponse, JsKeysResponse};
-pub use mint_keyset::JsMintKeySet;

+ 0 - 104
bindings/cashu-js/src/nuts/nut03.rs

@@ -1,104 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::{SwapRequest, SwapResponse};
-use wasm_bindgen::prelude::*;
-
-use crate::error::{into_err, Result};
-use crate::types::JsAmount;
-
-#[wasm_bindgen(js_name = SwapRequest)]
-pub struct JsSwapRequest {
-    inner: SwapRequest,
-}
-
-impl Deref for JsSwapRequest {
-    type Target = SwapRequest;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<SwapRequest> for JsSwapRequest {
-    fn from(inner: SwapRequest) -> JsSwapRequest {
-        JsSwapRequest { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = SwapRequest)]
-impl JsSwapRequest {
-    #[wasm_bindgen(constructor)]
-    pub fn new(inputs: JsValue, outputs: JsValue) -> Result<JsSwapRequest> {
-        let inputs = serde_wasm_bindgen::from_value(inputs).map_err(into_err)?;
-        let outputs = serde_wasm_bindgen::from_value(outputs).map_err(into_err)?;
-
-        Ok(JsSwapRequest {
-            inner: SwapRequest { inputs, outputs },
-        })
-    }
-
-    /// Get Proofs
-    #[wasm_bindgen(getter)]
-    pub fn proofs(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.inputs).map_err(into_err)
-    }
-
-    /// Get Outputs
-    #[wasm_bindgen(getter)]
-    pub fn outputs(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.outputs).map_err(into_err)
-    }
-
-    /// Proofs Amount
-    #[wasm_bindgen(js_name = proofsAmount)]
-    pub fn proofs_amount(&self) -> JsAmount {
-        self.inner.input_amount().into()
-    }
-
-    /// Output Amount
-    #[wasm_bindgen(js_name = outputAmount)]
-    pub fn output_amount(&self) -> JsAmount {
-        self.inner.output_amount().into()
-    }
-}
-
-#[wasm_bindgen(js_name = SplitResponse)]
-pub struct JsSwapResponse {
-    inner: SwapResponse,
-}
-
-impl Deref for JsSwapResponse {
-    type Target = SwapResponse;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<SwapResponse> for JsSwapResponse {
-    fn from(inner: SwapResponse) -> JsSwapResponse {
-        JsSwapResponse { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = SplitResponse)]
-impl JsSwapResponse {
-    #[wasm_bindgen(constructor)]
-    pub fn new(signatures: JsValue) -> Result<JsSwapResponse> {
-        let signatures = serde_wasm_bindgen::from_value(signatures).map_err(into_err)?;
-
-        Ok(JsSwapResponse {
-            inner: SwapResponse { signatures },
-        })
-    }
-
-    /// Get Promises
-    #[wasm_bindgen(getter)]
-    pub fn signatures(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.signatures).map_err(into_err)
-    }
-
-    /// Promises Amount
-    #[wasm_bindgen(js_name = promisesAmount)]
-    pub fn promises_amount(&self) -> JsAmount {
-        self.inner.promises_amount().into()
-    }
-}

+ 0 - 82
bindings/cashu-js/src/nuts/nut04.rs

@@ -1,82 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::nut04::{MintBolt11Request, MintBolt11Response};
-use wasm_bindgen::prelude::*;
-
-use crate::error::{into_err, Result};
-use crate::types::JsAmount;
-
-#[wasm_bindgen(js_name = MintBolt11Request)]
-pub struct JsMintBolt11Request {
-    inner: MintBolt11Request,
-}
-
-impl Deref for JsMintBolt11Request {
-    type Target = MintBolt11Request;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<MintBolt11Request> for JsMintBolt11Request {
-    fn from(inner: MintBolt11Request) -> JsMintBolt11Request {
-        JsMintBolt11Request { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = MintBolt11Request)]
-impl JsMintBolt11Request {
-    /// Try From Base 64 String
-    #[wasm_bindgen(constructor)]
-    pub fn new(quote: String, outputs: JsValue) -> Result<JsMintBolt11Request> {
-        let outputs = serde_wasm_bindgen::from_value(outputs).map_err(into_err)?;
-        Ok(JsMintBolt11Request {
-            inner: MintBolt11Request { quote, outputs },
-        })
-    }
-
-    #[wasm_bindgen(getter)]
-    pub fn outputs(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.outputs).map_err(into_err)
-    }
-
-    #[wasm_bindgen(js_name = totalAmount)]
-    pub fn totoal_amount(&self) -> JsAmount {
-        self.inner.total_amount().into()
-    }
-}
-
-#[wasm_bindgen(js_name = PostMintResponse)]
-pub struct JsMintBolt11Response {
-    inner: MintBolt11Response,
-}
-
-impl Deref for JsMintBolt11Response {
-    type Target = MintBolt11Response;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<MintBolt11Response> for JsMintBolt11Response {
-    fn from(inner: MintBolt11Response) -> JsMintBolt11Response {
-        JsMintBolt11Response { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = PostMintResponse)]
-impl JsMintBolt11Response {
-    /// Try From Base 64 String
-    #[wasm_bindgen(constructor)]
-    pub fn new(signatures: JsValue) -> Result<JsMintBolt11Response> {
-        let signatures = serde_wasm_bindgen::from_value(signatures).map_err(into_err)?;
-        Ok(JsMintBolt11Response {
-            inner: MintBolt11Response { signatures },
-        })
-    }
-
-    #[wasm_bindgen(getter)]
-    pub fn signatures(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.signatures).map_err(into_err)
-    }
-}

+ 0 - 1
bindings/cashu-js/src/nuts/nut05.rs

@@ -1 +0,0 @@
-

+ 0 - 106
bindings/cashu-js/src/nuts/nut06.rs

@@ -1,106 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::{SplitRequest, SplitResponse};
-use wasm_bindgen::prelude::*;
-
-use crate::error::{into_err, Result};
-use crate::types::JsAmount;
-
-#[wasm_bindgen(js_name = SplitRequest)]
-pub struct JsSplitRequest {
-    inner: SplitRequest,
-}
-
-impl Deref for JsSplitRequest {
-    type Target = SplitRequest;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<SplitRequest> for JsSplitRequest {
-    fn from(inner: SplitRequest) -> JsSplitRequest {
-        JsSplitRequest { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = SplitRequest)]
-impl JsSplitRequest {
-    #[wasm_bindgen(constructor)]
-    pub fn new(inputs: JsValue, outputs: JsValue) -> Result<JsSplitRequest> {
-        let inputs = serde_wasm_bindgen::from_value(inputs).map_err(into_err)?;
-        let outputs = serde_wasm_bindgen::from_value(outputs).map_err(into_err)?;
-
-        Ok(JsSplitRequest {
-            inner: SplitRequest { inputs, outputs },
-        })
-    }
-
-    /// Get Proofs
-    #[wasm_bindgen(getter)]
-    pub fn proofs(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.inputs).map_err(into_err)
-    }
-
-    /// Get Outputs
-    #[wasm_bindgen(getter)]
-    pub fn outputs(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.outputs).map_err(into_err)
-    }
-
-    /// Proofs Amount
-    #[wasm_bindgen(js_name = proofsAmount)]
-    pub fn proofs_amount(&self) -> JsAmount {
-        self.inner.input_amount().into()
-    }
-
-    /// Output Amount
-    #[wasm_bindgen(js_name = outputAmount)]
-    pub fn output_amount(&self) -> JsAmount {
-        self.inner.output_amount().into()
-    }
-}
-
-#[wasm_bindgen(js_name = SplitResponse)]
-pub struct JsSplitResponse {
-    inner: SplitResponse,
-}
-
-impl Deref for JsSplitResponse {
-    type Target = SplitResponse;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<SplitResponse> for JsSplitResponse {
-    fn from(inner: SplitResponse) -> JsSplitResponse {
-        JsSplitResponse { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = SplitResponse)]
-impl JsSplitResponse {
-    #[wasm_bindgen(constructor)]
-    pub fn new(promises: JsValue) -> Result<JsSplitResponse> {
-        let promises = serde_wasm_bindgen::from_value(promises).map_err(into_err)?;
-
-        Ok(JsSplitResponse {
-            inner: SplitResponse {
-                promises: Some(promises),
-            },
-        })
-    }
-
-    /// Get Promises
-    #[wasm_bindgen(getter)]
-    pub fn promises(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.promises).map_err(into_err)
-    }
-
-    /// Promises Amount
-    #[wasm_bindgen(js_name = promisesAmount)]
-    pub fn promises_amount(&self) -> Option<JsAmount> {
-        self.inner.promises_amount().map(|a| a.into())
-    }
-}

+ 0 - 94
bindings/cashu-js/src/nuts/nut07.rs

@@ -1,94 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::nut07::{CheckSpendableRequest, CheckSpendableResponse};
-use wasm_bindgen::prelude::*;
-
-use crate::error::{into_err, Result};
-
-#[wasm_bindgen(js_name = CheckSpendableRequest)]
-pub struct JsCheckSpendableRequest {
-    inner: CheckSpendableRequest,
-}
-
-impl Deref for JsCheckSpendableRequest {
-    type Target = CheckSpendableRequest;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<CheckSpendableRequest> for JsCheckSpendableRequest {
-    fn from(inner: CheckSpendableRequest) -> JsCheckSpendableRequest {
-        JsCheckSpendableRequest { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = CheckSpendable)]
-impl JsCheckSpendableRequest {
-    #[wasm_bindgen(constructor)]
-    pub fn new(proofs: JsValue) -> Result<JsCheckSpendableRequest> {
-        let proofs = serde_wasm_bindgen::from_value(proofs).map_err(into_err)?;
-
-        Ok(JsCheckSpendableRequest {
-            inner: CheckSpendableRequest { proofs },
-        })
-    }
-
-    /// Get Proofs
-    #[wasm_bindgen(getter)]
-    pub fn proofs(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.proofs).map_err(into_err)
-    }
-}
-
-#[wasm_bindgen(js_name = CheckSpendableResponse)]
-pub struct JsCheckSpendableResponse {
-    inner: CheckSpendableResponse,
-}
-
-impl Deref for JsCheckSpendableResponse {
-    type Target = CheckSpendableResponse;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<CheckSpendableResponse> for JsCheckSpendableResponse {
-    fn from(inner: CheckSpendableResponse) -> JsCheckSpendableResponse {
-        JsCheckSpendableResponse { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = CheckSpendableResponse)]
-impl JsCheckSpendableResponse {
-    #[wasm_bindgen(constructor)]
-    pub fn new(spendable: JsValue, pending: JsValue) -> Result<JsCheckSpendableResponse> {
-        let spendable = serde_wasm_bindgen::from_value(spendable).map_err(into_err)?;
-
-        let pending = serde_wasm_bindgen::from_value(pending).map_err(into_err)?;
-
-        Ok(JsCheckSpendableResponse {
-            inner: CheckSpendableResponse { spendable, pending },
-        })
-    }
-
-    /// Get Pending
-    #[wasm_bindgen(getter)]
-    pub fn pending(&self) -> Box<[JsValue]> {
-        self.inner
-            .pending
-            .iter()
-            .map(|p| JsValue::from_bool(*p))
-            .collect()
-    }
-
-    /// Get Spendable
-    #[wasm_bindgen(getter)]
-    pub fn spendable(&self) -> Box<[JsValue]> {
-        self.inner
-            .spendable
-            .iter()
-            .map(|s| JsValue::from_bool(*s))
-            .collect()
-    }
-}

+ 0 - 131
bindings/cashu-js/src/nuts/nut08.rs

@@ -1,131 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::nut00::{BlindedMessage, BlindedSignature, Proof};
-use cashu::nuts::nut08::{MeltBolt11Request, MeltBolt11Response};
-use wasm_bindgen::prelude::*;
-
-use crate::error::{into_err, Result};
-use crate::types::JsAmount;
-
-#[wasm_bindgen(js_name = MeltRequest)]
-pub struct JsMeltBolt11Request {
-    inner: MeltBolt11Request,
-}
-
-impl Deref for JsMeltBolt11Request {
-    type Target = MeltBolt11Request;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<MeltBolt11Request> for JsMeltBolt11Request {
-    fn from(inner: MeltBolt11Request) -> JsMeltBolt11Request {
-        JsMeltBolt11Request { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = MeltBolt11Request)]
-impl JsMeltBolt11Request {
-    #[wasm_bindgen(constructor)]
-    pub fn new(quote: String, inputs: JsValue, outputs: JsValue) -> Result<JsMeltBolt11Request> {
-        let inputs: Vec<Proof> = serde_wasm_bindgen::from_value(inputs).map_err(into_err)?;
-        let outputs: Option<Vec<BlindedMessage>> = if !outputs.is_null() {
-            Some(serde_wasm_bindgen::from_value(outputs).map_err(into_err)?)
-        } else {
-            None
-        };
-
-        Ok(JsMeltBolt11Request {
-            inner: MeltBolt11Request {
-                quote,
-                inputs,
-                outputs,
-            },
-        })
-    }
-
-    /// Get Proofs
-    #[wasm_bindgen(getter)]
-    pub fn inputs(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.inputs).map_err(into_err)
-    }
-
-    /// Get Invoice
-    #[wasm_bindgen(getter)]
-    pub fn quote(&self) -> String {
-        self.inner.quote.clone()
-    }
-
-    /// Get outputs
-    #[wasm_bindgen(getter)]
-    pub fn outputs(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.outputs).map_err(into_err)
-    }
-}
-
-#[wasm_bindgen(js_name = MeltResponse)]
-pub struct JsMeltBolt11Response {
-    inner: MeltBolt11Response,
-}
-
-impl Deref for JsMeltBolt11Response {
-    type Target = MeltBolt11Response;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<MeltBolt11Response> for JsMeltBolt11Response {
-    fn from(inner: MeltBolt11Response) -> JsMeltBolt11Response {
-        JsMeltBolt11Response { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = MeltBolt11Response)]
-impl JsMeltBolt11Response {
-    #[wasm_bindgen(constructor)]
-    pub fn new(
-        paid: bool,
-        payment_preimage: Option<String>,
-        change: JsValue,
-    ) -> Result<JsMeltBolt11Response> {
-        let change: Option<Vec<BlindedSignature>> = if change.is_null() {
-            Some(serde_wasm_bindgen::from_value(change).map_err(into_err)?)
-        } else {
-            None
-        };
-
-        Ok(JsMeltBolt11Response {
-            inner: MeltBolt11Response {
-                payment_preimage,
-                paid,
-                change,
-            },
-        })
-    }
-
-    /// Get Paid
-    #[wasm_bindgen(getter)]
-    pub fn paid(&self) -> bool {
-        self.inner.paid
-    }
-
-    /// Get Preimage
-    #[wasm_bindgen(getter)]
-    pub fn payment_preimage(&self) -> Option<String> {
-        self.inner.payment_preimage.clone()
-    }
-
-    /// Get Change
-    #[wasm_bindgen(getter)]
-    pub fn change(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.change).map_err(into_err)
-    }
-
-    /// Change Amount
-    #[wasm_bindgen(js_name = "changeAmount")]
-    pub fn change_amount(&self) -> Option<JsAmount> {
-        self.inner.change_amount().map(|a| a.into())
-    }
-}

+ 0 - 142
bindings/cashu-js/src/nuts/nut09.rs

@@ -1,142 +0,0 @@
-use std::ops::Deref;
-
-use cashu::nuts::nut09::{MintInfo, MintVersion};
-use wasm_bindgen::prelude::*;
-
-use super::nut01::JsPublicKey;
-use crate::error::{into_err, Result};
-
-#[wasm_bindgen(js_name = MintVersion)]
-pub struct JsMintVersion {
-    inner: MintVersion,
-}
-
-impl Deref for JsMintVersion {
-    type Target = MintVersion;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<MintVersion> for JsMintVersion {
-    fn from(inner: MintVersion) -> JsMintVersion {
-        JsMintVersion { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = MintVersion)]
-impl JsMintVersion {
-    #[wasm_bindgen(constructor)]
-    pub fn new(name: String, version: String) -> Result<JsMintVersion> {
-        Ok(JsMintVersion {
-            inner: MintVersion { name, version },
-        })
-    }
-
-    /// Get Name
-    #[wasm_bindgen(getter)]
-    pub fn name(&self) -> String {
-        self.inner.name.clone()
-    }
-
-    /// Get Version
-    #[wasm_bindgen(getter)]
-    pub fn version(&self) -> String {
-        self.inner.version.clone()
-    }
-}
-
-#[wasm_bindgen(js_name = MintInfo)]
-pub struct JsMintInfo {
-    inner: MintInfo,
-}
-
-impl Deref for JsMintInfo {
-    type Target = MintInfo;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<MintInfo> for JsMintInfo {
-    fn from(inner: MintInfo) -> JsMintInfo {
-        JsMintInfo { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = MintInfo)]
-impl JsMintInfo {
-    #[wasm_bindgen(constructor)]
-    #[allow(clippy::too_many_arguments)]
-    pub fn new(
-        name: Option<String>,
-        pubkey: Option<JsPublicKey>,
-        version: Option<JsMintVersion>,
-        description: Option<String>,
-        description_long: Option<String>,
-        contact: JsValue,
-        nuts: JsValue,
-        motd: Option<String>,
-    ) -> Result<JsMintInfo> {
-        Ok(JsMintInfo {
-            inner: MintInfo {
-                name,
-                pubkey: pubkey.map(|p| p.deref().clone()),
-                version: version.map(|v| v.deref().clone()),
-                description,
-                description_long,
-                contact: serde_wasm_bindgen::from_value(contact).map_err(into_err)?,
-                nuts: serde_wasm_bindgen::from_value(nuts).map_err(into_err)?,
-                motd,
-            },
-        })
-    }
-
-    /// Get Name
-    #[wasm_bindgen(getter)]
-    pub fn name(&self) -> Option<String> {
-        self.inner.name.clone()
-    }
-
-    /// Get Pubkey
-    #[wasm_bindgen(getter)]
-    pub fn pubkey(&self) -> Option<JsPublicKey> {
-        self.inner.pubkey.clone().map(|p| p.into())
-    }
-
-    /// Get Version
-    #[wasm_bindgen(getter)]
-    pub fn version(&self) -> Option<JsMintVersion> {
-        self.inner.version.clone().map(|v| v.into())
-    }
-
-    /// Get description
-    #[wasm_bindgen(getter)]
-    pub fn description(&self) -> Option<String> {
-        self.inner.description.clone()
-    }
-
-    /// Get description long
-    #[wasm_bindgen(getter)]
-    pub fn description_long(&self) -> Option<String> {
-        self.inner.description_long.clone()
-    }
-
-    /// Get contact
-    #[wasm_bindgen(getter)]
-    pub fn contact(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.contact).map_err(into_err)
-    }
-
-    /// Get supported nuts
-    #[wasm_bindgen(getter)]
-    pub fn nuts(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.nuts).map_err(into_err)
-    }
-
-    /// Get motd
-    #[wasm_bindgen(getter)]
-    pub fn motd(&self) -> Option<String> {
-        self.inner.motd.clone()
-    }
-}

+ 0 - 48
bindings/cashu-js/src/types/amount.rs

@@ -1,48 +0,0 @@
-use std::ops::Deref;
-
-use cashu::Amount;
-use wasm_bindgen::prelude::*;
-
-use crate::error::{into_err, Result};
-
-#[wasm_bindgen(js_name = Amount)]
-pub struct JsAmount {
-    inner: Amount,
-}
-
-impl Deref for JsAmount {
-    type Target = Amount;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<Amount> for JsAmount {
-    fn from(inner: Amount) -> JsAmount {
-        JsAmount { inner }
-    }
-}
-
-impl From<u64> for JsAmount {
-    fn from(amount: u64) -> JsAmount {
-        JsAmount {
-            inner: Amount::from(amount),
-        }
-    }
-}
-
-#[wasm_bindgen(js_class = Amount)]
-impl JsAmount {
-    #[wasm_bindgen(constructor)]
-    pub fn new(sats: u32) -> Self {
-        Self {
-            inner: Amount::from(sats as u64),
-        }
-    }
-
-    /// Split amount returns sat vec of sats
-    #[wasm_bindgen(js_name = split)]
-    pub fn split(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.split()).map_err(into_err)
-    }
-}

+ 0 - 50
bindings/cashu-js/src/types/bolt11_invoice.rs

@@ -1,50 +0,0 @@
-use std::ops::Deref;
-use std::str::FromStr;
-
-use cashu::Bolt11Invoice;
-use wasm_bindgen::prelude::*;
-
-use crate::error::{into_err, Result};
-use crate::types::JsAmount;
-
-#[wasm_bindgen(js_name = Bolt11Invoice)]
-pub struct JsBolt11Invoice {
-    inner: Bolt11Invoice,
-}
-
-impl Deref for JsBolt11Invoice {
-    type Target = Bolt11Invoice;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<Bolt11Invoice> for JsBolt11Invoice {
-    fn from(inner: Bolt11Invoice) -> JsBolt11Invoice {
-        JsBolt11Invoice { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = Bolt11Invoice)]
-impl JsBolt11Invoice {
-    #[wasm_bindgen(constructor)]
-    pub fn new(invoice: String) -> Result<JsBolt11Invoice> {
-        Ok(JsBolt11Invoice {
-            inner: Bolt11Invoice::from_str(&invoice).map_err(into_err)?,
-        })
-    }
-
-    /// Amount
-    #[wasm_bindgen(getter)]
-    pub fn amount(&self) -> Option<JsAmount> {
-        self.inner
-            .amount_milli_satoshis()
-            .map(|a| JsAmount::from(a / 1000))
-    }
-
-    /// Invoice as string
-    #[wasm_bindgen(js_name = asString)]
-    pub fn as_string(&self) -> String {
-        self.inner.to_string()
-    }
-}

+ 0 - 9
bindings/cashu-js/src/types/mod.rs

@@ -1,9 +0,0 @@
-pub mod amount;
-pub mod bolt11_invoice;
-pub mod proofs_status;
-pub mod secret;
-
-pub use amount::JsAmount;
-pub use bolt11_invoice::JsBolt11Invoice;
-pub use proofs_status::JsProofsStatus;
-pub use secret::JsSecret;

+ 0 - 48
bindings/cashu-js/src/types/proofs_status.rs

@@ -1,48 +0,0 @@
-use std::ops::Deref;
-
-use cashu::types::ProofsStatus;
-use wasm_bindgen::prelude::*;
-
-use crate::error::{into_err, Result};
-
-#[wasm_bindgen(js_name = ProofsStatus)]
-pub struct JsProofsStatus {
-    inner: ProofsStatus,
-}
-
-impl Deref for JsProofsStatus {
-    type Target = ProofsStatus;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<ProofsStatus> for JsProofsStatus {
-    fn from(inner: ProofsStatus) -> JsProofsStatus {
-        JsProofsStatus { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = ProofsStatus)]
-impl JsProofsStatus {
-    #[wasm_bindgen(constructor)]
-    pub fn new(spent_proofs: JsValue, spendable_proofs: JsValue) -> Result<JsProofsStatus> {
-        let spent = serde_wasm_bindgen::from_value(spent_proofs).map_err(into_err)?;
-        let spendable = serde_wasm_bindgen::from_value(spendable_proofs).map_err(into_err)?;
-        Ok(JsProofsStatus {
-            inner: ProofsStatus { spent, spendable },
-        })
-    }
-
-    /// Get Spendable Proofs
-    #[wasm_bindgen(getter)]
-    pub fn spendable(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.spendable).map_err(into_err)
-    }
-
-    /// Get Spent Proofs
-    #[wasm_bindgen(getter)]
-    pub fn spent_proofs(&self) -> Result<JsValue> {
-        serde_wasm_bindgen::to_value(&self.inner.spent).map_err(into_err)
-    }
-}

+ 0 - 44
bindings/cashu-js/src/types/secret.rs

@@ -1,44 +0,0 @@
-use std::ops::Deref;
-
-use cashu::secret::Secret;
-use wasm_bindgen::prelude::*;
-
-#[wasm_bindgen(js_name = Secret)]
-pub struct JsSecret {
-    inner: Secret,
-}
-
-impl Default for JsSecret {
-    fn default() -> Self {
-        Self::new()
-    }
-}
-
-impl Deref for JsSecret {
-    type Target = Secret;
-    fn deref(&self) -> &Self::Target {
-        &self.inner
-    }
-}
-
-impl From<Secret> for JsSecret {
-    fn from(inner: Secret) -> JsSecret {
-        JsSecret { inner }
-    }
-}
-
-#[wasm_bindgen(js_class = Secret)]
-impl JsSecret {
-    #[wasm_bindgen(constructor)]
-    pub fn new() -> JsSecret {
-        Self {
-            inner: Secret::new(),
-        }
-    }
-
-    /// As Bytes
-    #[wasm_bindgen(js_name = asBytes)]
-    pub fn as_bytes(&self) -> Vec<u8> {
-        self.inner.as_bytes().to_vec()
-    }
-}

+ 0 - 9
bindings/cashu-js/tsconfig.json

@@ -1,9 +0,0 @@
-{
-    "compilerOptions": {
-        "strict": true
-    },
-    "typedocOptions": {
-        "entryPoints": ["pkg/cashu_js.d.ts"],
-        "readme": "README.md"
-    }
-}

+ 0 - 30
bindings/cashu-sdk-ffi/Cargo.toml

@@ -1,30 +0,0 @@
-[package]
-name = "cashu-sdk-ffi"
-version = "0.1.0"
-edition = "2021"
-publish = false
-rust-version.workspace = true
-
-[lib]
-name = "cashu_sdk_ffi"
-crate-type = ["cdylib", "staticlib"]
-
-
-[dependencies]
-cashu-ffi = { path = "../cashu-ffi" }
-cashu-sdk = { path = "../../crates/cashu-sdk", default-features = false, features = ["wallet", "mint", "all-nuts"] }
-tracing = { workspace = true }
-tracing-subscriber = { workspace = true }
-uniffi = { workspace = true }
-futures = { version= "0.3.29", feature = "executor" }
-once_cell = { version = "1.17" }
-
-[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
-tokio = { workspace = true, features = ["rt-multi-thread", "time", "macros", "sync"] }
-
-[target.'cfg(target_arch = "wasm32")'.dependencies]
-tokio = { workspace = true, features = ["rt", "macros", "sync", "time"] }
-
-[build-dependencies]
-uniffi = { workspace = true, features = ["build"] }
-

+ 0 - 29
bindings/cashu-sdk-ffi/LICENSE

@@ -1,29 +0,0 @@
-BSD 3-Clause License
-
-Copyright (c) 2023, thesimplekid
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this
-   list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice,
-   this list of conditions and the following disclaimer in the documentation
-   and/or other materials provided with the distribution.
-
-3. Neither the name of the copyright holder nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 0 - 21
bindings/cashu-sdk-ffi/LICENSES/NOSTR_SDK_LICENSE_MIT

@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2022-2023 Yuki Kishimoto
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.

+ 0 - 16
bindings/cashu-sdk-ffi/bindings-python/.gitignore

@@ -1,16 +0,0 @@
-.tox/
-dist/
-cashu_sdk.egg-info/
-__pycache__/
-libnostr_sdk_ffi.dylib
-.idea/
-.DS_Store
-
-*.swp
-
-src/cashu-sdk/cashu_sdk.py
-src/cashu-sdk/*.so
-*.whl
-build/
-
-

+ 0 - 29
bindings/cashu-sdk-ffi/bindings-python/LICENSE

@@ -1,29 +0,0 @@
-BSD 3-Clause License
-
-Copyright (c) 2023, thesimplekid
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this
-   list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice,
-   this list of conditions and the following disclaimer in the documentation
-   and/or other materials provided with the distribution.
-
-3. Neither the name of the copyright holder nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 0 - 21
bindings/cashu-sdk-ffi/bindings-python/LICENSES/NOSTR_SDK_MIT

@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2022-2023 Yuki Kishimoto
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.

+ 0 - 3
bindings/cashu-sdk-ffi/bindings-python/MANIFEST.in

@@ -1,3 +0,0 @@
-include ./src/cashu-sdk/libcashu_sdk_ffi.dylib
-include ./src/cashu-sdk/libcashu_sdk_ffi.so
-

+ 0 - 50
bindings/cashu-sdk-ffi/bindings-python/README.md

@@ -1,50 +0,0 @@
-Cashu Sdk Python bindings
-
-
-**ALPHA** This library is in early development, the api will change.
-
-## Supported Nuts:
-
-Check: [https://github.com/thesimplekid/cashu-crab#implemented-nuts](https://github.com/thesimplekid/cashu-crab#implemented-nuts)
-
-## Build the package
-
-```shell
-just python
-```
-
-## Getting Started
-
-For now this is not published as a package as it is still in early development. So you will have to build it as above. In the future this will be pulished and pip can be used to install. 
-
-```python
-from cashu_sdk import Wallet, Client, Amount
-
-client = Client("https://mutinynet-cashu.thesimplekid.space")
-
-mint_keys = client.get_keys()
-
-wallet = Wallet(client, mint_keys)
-
-mint_request = wallet.request_mint(Amount.from_sat(10))
-
-print(mint_request.invoice())
-
-print(mint_request.hash())
-
-```
-
-
-## License
-
-Code is under the [BSD 3-Clause License](LICENSE)
-
-## Contribution
-
-All contributions welcome.
-
-Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any additional terms or conditions.
-
-## Contact
-
-I can be contacted for comments or questions on nostr at _@thesimplekid.com (npub1qjgcmlpkeyl8mdkvp4s0xls4ytcux6my606tgfx9xttut907h0zs76lgjw) or via email tsk@thesimplekid.com.

Some files were not shown because too many files changed in this diff