Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Great clean up #51

Merged
merged 56 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
a786090
update: keyset id
thesimplekid Nov 18, 2023
614ae73
refactor: add symbol to keyset_info
thesimplekid Nov 25, 2023
989035e
refactor: add keyset_id to blinded_message
thesimplekid Nov 25, 2023
417e303
refactor: move nut06 to nut03
thesimplekid Nov 25, 2023
a8fb7f1
fix: 'SplitPayload' only for wallet feat
thesimplekid Nov 25, 2023
ff0fead
refactor: Keyset_id in proof is required
thesimplekid Nov 25, 2023
834834f
refactor: add unit to token
thesimplekid Nov 25, 2023
2c63263
refactor: rename 'symbol' to 'unit'
thesimplekid Nov 25, 2023
ab5fdc4
fix: add unit and memo to ffi function
thesimplekid Nov 26, 2023
08114cb
refactor: secret as 32 byte hex
thesimplekid Nov 26, 2023
78f35ed
refactor: Allow multiple active keysets
thesimplekid Nov 26, 2023
b92be03
refactor: rename 'BlindedMessages' to 'PreMintSecrets'
thesimplekid Nov 27, 2023
a69490f
refactor: rename "KeysetInfo" to "MintKeySetInfo"
thesimplekid Nov 28, 2023
210d615
refactor: remove nut06
thesimplekid Nov 28, 2023
ce0ff46
refactor: rename 'SplitPayload' to 'PreSplit'
thesimplekid Nov 28, 2023
e93fb50
improve: impl 'to_string()' on 'Token'
thesimplekid Dec 3, 2023
35db3fb
refactor: add cashuB token
thesimplekid Dec 3, 2023
c706e36
refactor: v1 MeltRequest
thesimplekid Dec 11, 2023
7008968
Merge: branch 'main' into great_clean_up
thesimplekid Dec 13, 2023
bfbe192
refactor: remove token B
thesimplekid Dec 13, 2023
681828b
refactor: cashu: nut-04 Mint V1
thesimplekid Dec 13, 2023
4191ea6
refactor: wallet for nut04 v1
thesimplekid Dec 14, 2023
66068e6
refactor: remove RequestMint
thesimplekid Dec 14, 2023
5248c76
refactor: rename split to swap
thesimplekid Dec 14, 2023
2a93c4f
refactor: MintInfo v1
thesimplekid Dec 16, 2023
5493745
fix: mint info v1 enpoint
thesimplekid Dec 17, 2023
bdb87dd
fix: add nut info struct
thesimplekid Dec 17, 2023
5d8f35c
refactor: add PaymentType enum
thesimplekid Dec 17, 2023
08a8368
chore: add moksha license:wq
thesimplekid Dec 17, 2023
e76a8b9
impove: add payment method display
thesimplekid Dec 17, 2023
5c5d0bf
refactor: remove bitcoin amount from Amount
thesimplekid Dec 17, 2023
299d4c9
refactor: rename proof to payment_preimage
thesimplekid Dec 18, 2023
69bdb18
refactor: skip serialization of feilds other then secret
thesimplekid Dec 18, 2023
93c2d47
refactor: rename id to keyset_id where relevant on structs
thesimplekid Dec 18, 2023
071dadb
refactor: wallet nut07 features for mint info
thesimplekid Dec 19, 2023
f192a53
chore: update nix flake
thesimplekid Dec 19, 2023
003ecb9
chore: update flakebox files
thesimplekid Dec 19, 2023
3b49289
refactor: cashu-js
thesimplekid Dec 19, 2023
dc988d1
refactor: wasm bindings
thesimplekid Dec 19, 2023
85df354
refactor: cashu-ffi some interfaces to v1
thesimplekid Dec 21, 2023
3301199
refactor: some cashu-sdk-ffi to v1
thesimplekid Dec 22, 2023
e557d3e
refactor: remove nut09 feature
thesimplekid Dec 22, 2023
8b16996
refactor: join_url accepts slice
thesimplekid Dec 22, 2023
69f03e1
chore: secret unused for now
thesimplekid Dec 22, 2023
ea25b35
refactor: update tests to v1
thesimplekid Dec 23, 2023
995a09f
refactor: add token prefix tests
thesimplekid Dec 25, 2023
775117c
refactor: add hash_to_curve test
thesimplekid Dec 25, 2023
f835ca6
refactor: add mint quote in sdk
thesimplekid Dec 25, 2023
1a0b0c2
refactor: mint tokens
thesimplekid Dec 26, 2023
40f6bc6
refactor: ffi for v1 mint
thesimplekid Dec 26, 2023
2508f4e
refactor: mint/quote v1 urls
thesimplekid Dec 27, 2023
dcc3509
refactor: bindings keyset response
thesimplekid Dec 27, 2023
754936d
refactor: melt quote and melt to v1 in wallet sdk
thesimplekid Dec 29, 2023
1c17c57
refactor: melt and mint quote in sdk-ffi
thesimplekid Dec 29, 2023
1df5909
chore: clippy
thesimplekid Dec 29, 2023
0fe7ccc
refactor: use async mutex
thesimplekid Dec 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .config/flakebox/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tmp/
2 changes: 1 addition & 1 deletion .config/flakebox/id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
437409787773bc012f713d609c43406e98174dca8d94911ed7905618cc62f2d026781205d6583645176c630878fe6a238e3a17b85254677c632ec4c25b699a4a
4554d31c5e79420d5b097aad56a49a1c61bb89f32d6b93fb5ff4d0677bc9b587e3426e881d01f5551ff816cfcec2941d0529130f491f6098abb64e6c28592c94
1 change: 1 addition & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ group_imports = "StdExternalCrate"
wrap_comments = true
format_code_in_doc_comments = true
imports_granularity = "Module"
edition = "2021"
1 change: 1 addition & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
extend-ignore-identifiers-re = [
# Ignore cashu tokens
"cashuA*",
"casshuAeyJ0b2tlbiI6W3sibWludCI6Imh0dHBzOi8vODMzMy5zcGFjZTozMzM4IiwicHJvb2ZzIjpbeyJhbW91bnQiOjIsImlkIjoiMDA5YTFmMjkzMjUzZTQxZSIsInNlY3JldCI6IjQwNzkxNWJjMjEyYmU2MWE3N2UzZTZkMmFlYjRjNzI3OTgwYmRhNTFjZDA2YTZhZmMyOWUyODYxNzY4YTc4MzciLCJDIjoiMDJiYzkwOTc5OTdkODFhZmIyY2M3MzQ2YjVlNDM0NWE5MzQ2YmQyYTUwNmViNzk1ODU5OGE3MmYwY2Y4NTE2M2VhIn0seyJhbW91bnQiOjgsImlkIjoiMDA5YTFmMjkzMjUzZTQxZSIsInNlY3JldCI6ImZlMTUxMDkzMTRlNjFkNzc1NmIwZjhlZTBmMjNhNjI0YWNhYTNmNGUwNDJmNjE0MzNjNzI4YzcwNTdiOTMxYmUiLCJDIjoiMDI5ZThlNTA1MGI4OTBhN2Q2YzA5NjhkYjE2YmMxZDVkNWZhMDQwZWExZGUyODRmNmVjNjlkNjEyOTlmNjcxMDU5In1dfV0sInVuaXQiOiJzYXQiLCJtZW1vIjoiVGhhbmsgeW91LiJ9"
]
21 changes: 21 additions & 0 deletions LICENSES/MOKSHA-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Steffen

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.
197 changes: 107 additions & 90 deletions bindings/cashu-ffi/src/cashu.udl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ interface CashuError {
};

// Types

[Enum]
interface CurrencyUnit {
Sat();
Usd();
Custom(string unit);
};

interface Bolt11Invoice {
[Throws=CashuError]
Expand All @@ -15,12 +22,7 @@ interface Bolt11Invoice {
};

interface Amount {
u64 to_sat();
u64 to_msat();
[Name = from_sat]
constructor(u64 sat);
[Name = from_msat]
constructor(u64 msat);
constructor(u64 amount);
sequence<Amount> split();
};

Expand All @@ -29,13 +31,16 @@ interface Secret {
sequence<u8> as_bytes();
};

// NUT00
interface MintQuote {
constructor(string id, Amount amount, string unit, Bolt11Invoice request, boolean paid, u64 boolean);
};

interface Id {
[Throws=CashuError]
constructor(string id);
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);
Expand All @@ -50,22 +55,23 @@ interface SecretKey {
};

interface BlindedMessage {
constructor(Amount amount, PublicKey b);
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);
constructor(Amount amount, Secret secret, PublicKey c, Id id);
Amount amount();
Secret secret();
PublicKey c();
Id? id();
Id keyset_id();
};

interface BlindedSignature {
constructor(Id id, Amount amount, PublicKey c);
Id id();
constructor(Id keyset_id, Amount amount, PublicKey c);
Id keyset_id();
Amount amount();
PublicKey c();
};
Expand All @@ -75,7 +81,7 @@ interface MintProof {
Amount? amount();
Secret secret();
PublicKey? c();
Id? id();
Id? keyset_id();

};

Expand All @@ -88,27 +94,35 @@ interface MintProofs {

interface Token {
[Throws=CashuError]
constructor(string mint, sequence<Proof> token, string? memo);
constructor(string mint, sequence<Proof> token, string? memo, string? unit);
sequence<MintProofs> token();
string? memo();
[Throws=CashuError]
string as_string();
string? unit();
string to_string();
[Throws=CashuError, Name=from_string]
constructor(string token);

};

interface BlindedMessages {
interface PreMintSecrets {
[Throws=CashuError, Name=random]
constructor(Amount amount);
constructor(Id keyset_id, Amount amount);
[Throws=CashuError, Name=blank]
constructor(Amount fee_reserve);
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);
Expand All @@ -124,129 +138,132 @@ interface Keys {
};

interface KeySet {
constructor(Id id, Keys keys);
constructor(Id id, string unit, Keys keys);
Id id();
Keys keys();
};

interface MintKeySet {
[Name=generate]
constructor(string secret, string derivation_path, u8 max_order);
constructor(string secret, string unit, string derivation_path, u8 max_order);
};


interface KeysResponse {
constructor(Keys keys);
constructor(sequence<KeySet> keysets);
};

interface KeySetResponse {
constructor(sequence<Id> keyset_ids);
sequence<Id> keyset_ids();
constructor(sequence<KeySetInfo> keysets);
sequence<KeySetInfo> keysets();
};

interface RequestMintResponse {
[Throws=CashuError]
constructor(string invoice, string hash);
string invoice();
string hash();
};
// NUT-03

interface MintRequest {
constructor(sequence<BlindedMessage> outputs);
interface SwapRequest {
constructor(sequence<Proof> proofs, sequence<BlindedMessage> outputs);
sequence<Proof> proofs();
sequence<BlindedMessage> outputs();
Amount total_amount();
Amount proofs_amount();
Amount output_amount();
};

interface PostMintResponse {
interface SwapResponse {
constructor(sequence<BlindedSignature> promises);
sequence<BlindedSignature> promises();
sequence<BlindedSignature> signatures();
};

interface CheckFeesRequest {
[Throws=CashuError]
constructor(string invoice);
string invoice();
};
// NUT-04

interface CheckFeesResponse {
constructor(Amount amount);
interface MintQuoteBolt11Request {
constructor(Amount amount, string unit);
Amount amount();
};

interface Nut05MeltRequest {
[Throws=CashuError]
constructor(sequence<Proof> proofs, string Invoice);
sequence<Proof> proofs();
string invoice();
};

interface Nut05MeltResponse {
constructor(boolean paid, string? preimage);
interface MintQuoteBolt11Response {
constructor(string quote, string request, boolean paid, u64 expiry);
string quote();
string request();
boolean paid();
string? preimage();
u64 expiry();
};

interface SplitRequest {
constructor(sequence<Proof> proofs, sequence<BlindedMessage> outputs);
sequence<Proof> proofs();

interface MintBolt11Request {
constructor(string quote, sequence<BlindedMessage> outputs);
string quote();
sequence<BlindedMessage> outputs();
Amount proofs_amount();
Amount output_amount();
};

interface SplitResponse {
constructor(sequence<BlindedSignature> promises);
sequence<BlindedSignature> promises();
Amount? promises_amount();

interface MintBolt11Response {
constructor(sequence<BlindedSignature> signatures);
sequence<BlindedSignature> signatures();
};

interface CheckSpendableRequest {
constructor(sequence<MintProof> proofs);
sequence<MintProof> proofs();
// 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 CheckSpendableResponse {
constructor(sequence<boolean> spendable, sequence<boolean> pending);
sequence<boolean> spendable();
sequence<boolean> pending();
interface MeltQuoteBolt11Request {
[Throws=CashuError]
constructor(string request, string unit);
string request();
};

interface MeltRequest {
interface MeltBolt11Request {
[Throws=CashuError]
constructor(sequence<Proof> proofs, string Invoice, sequence<BlindedMessage>? outputs);
sequence<Proof> proofs();
string invoice();
sequence<BlindedMessage>? outputs();
constructor(string quote, sequence<Proof> inputs, sequence<BlindedMessage>? outputs);
sequence<Proof> inputs();
string quote();
};

interface MeltResponse {
constructor(boolean paid, string? preimage, sequence<BlindedSignature>? change);
interface MeltBolt11Response {
constructor(boolean paid, string? payment_preimage, sequence<BlindedSignature>? change);
string? payment_preimage();
boolean paid();
string? preimage();
sequence<BlindedSignature>? change();
};

interface MintVersion {
constructor(string name, string version);
string name();
string version();
};
// NUT-06

interface MintInfo {
constructor(string? name, PublicKey? pubkey, MintVersion? version, string? description, string? description_long, sequence<sequence<string>>? contact, sequence<string> nuts, string? motd);
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();
sequence<string> nuts();
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, u64 valid_from, u64? valid_to, string secret, string derivation_path, u8 max_order);
constructor(Id id, string unit);

};

Expand Down
Loading