namespace cashu_sdk {}; // Cashu [Error] interface CashuError { Generic(string err); }; // Types interface Bolt11Invoice { [Throws=CashuError] constructor(string bolt11); string as_string(); Amount? amount(); }; interface Amount { u64 to_sat(); u64 to_msat(); [Name = from_sat] constructor(u64 sat); [Name = from_msat] constructor(u64 msat); sequence split(); }; interface Secret { constructor(); sequence as_bytes(); }; interface Id { [Throws=CashuError] constructor(string id); }; 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(); PublicKey b(); }; interface Proof { constructor(Amount amount, Secret secret, PublicKey c, Id id); Amount amount(); Secret secret(); PublicKey c(); Id id(); }; interface BlindedSignature { constructor(Id id, Amount amount, PublicKey c); Id id(); Amount amount(); PublicKey c(); }; interface MintProof { constructor(Amount? amount, Secret secret, PublicKey? c, Id? id); Amount? amount(); Secret secret(); PublicKey? c(); Id? id(); }; interface MintProofs { [Throws=CashuError] constructor(string mint, sequence proofs); string url(); sequence proofs(); }; interface Token { [Throws=CashuError] constructor(string mint, sequence token, string? memo); sequence token(); string? memo(); [Throws=CashuError] string as_string(); [Throws=CashuError, Name=from_string] constructor(string token); }; interface BlindedMessages { [Throws=CashuError, Name=random] constructor(Id keyset_id, Amount amount); [Throws=CashuError, Name=blank] constructor(Id keyset_id, Amount amount); sequence blinded_messages(); sequence secrets(); sequence rs(); sequence amounts(); }; interface KeyPair { [Name=from_secret_key] constructor(SecretKey secret_key); SecretKey secret_key(); PublicKey public_key(); }; interface Keys { constructor(record keys); record keys(); record as_hashmap(); PublicKey? amount_key(Amount amount); }; interface KeySet { constructor(Id id, string symbol, Keys keys); Id id(); Keys keys(); }; interface MintKeySet { [Name=generate] constructor(string secret, string symbol, string derivation_path, u8 max_order); }; interface KeysResponse { constructor(Keys keys); }; interface KeySetResponse { constructor(sequence keysets); sequence keysets(); }; interface RequestMintResponse { [Throws=CashuError] constructor(string invoice, string hash); string invoice(); string hash(); }; interface MintRequest { constructor(sequence outputs); sequence outputs(); Amount total_amount(); }; interface PostMintResponse { constructor(sequence promises); sequence promises(); }; interface CheckFeesRequest { [Throws=CashuError] constructor(string invoice); string invoice(); }; interface CheckFeesResponse { constructor(Amount amount); Amount amount(); }; interface Nut05MeltRequest { [Throws=CashuError] constructor(sequence proofs, string Invoice); sequence proofs(); string invoice(); }; interface Nut05MeltResponse { constructor(boolean paid, string? preimage); boolean paid(); string? preimage(); }; interface SplitRequest { constructor(sequence proofs, sequence outputs); sequence proofs(); sequence outputs(); Amount proofs_amount(); Amount output_amount(); }; interface SplitResponse { constructor(sequence promises); sequence promises(); Amount? promises_amount(); }; interface CheckSpendableRequest { constructor(sequence proofs); sequence proofs(); }; interface CheckSpendableResponse { constructor(sequence spendable, sequence pending); sequence spendable(); sequence pending(); }; interface MeltRequest { [Throws=CashuError] constructor(sequence proofs, string Invoice, sequence? outputs); sequence proofs(); string invoice(); sequence? outputs(); }; interface MeltResponse { constructor(boolean paid, string? preimage, sequence? change); boolean paid(); string? preimage(); sequence? change(); }; interface MintVersion { constructor(string name, string version); string name(); string version(); }; interface MintInfo { constructor(string? name, PublicKey? pubkey, MintVersion? version, string? description, string? description_long, sequence>? contact, sequence nuts, string? motd); string? name(); PublicKey? pubkey(); MintVersion? version(); string? description(); string? description_long(); sequence>? contact(); sequence nuts(); string? motd(); }; enum InvoiceStatus { "Unpaid", "Paid", "Expired", "InFlight" }; interface ProofsStatus { constructor(sequence spendable, sequence spent); sequence spendable(); sequence spent(); }; interface KeySetInfo { constructor(Id id, string symbol); }; // Cashu Sdk interface MintKeySetInfo { constructor(Id id, string symbol, u64 valid_from, u64? valid_to, string derivation_path, u8 max_order); }; [Error] interface CashuSdkError { Generic(string err); }; interface SendProofs { constructor(sequence change_proofs, sequence send_proofs); sequence send_proofs(); sequence change_proofs(); }; interface Melted { constructor(boolean paid, string? preimage, sequence? change); string? preimage(); boolean paid(); sequence? change(); }; interface Wallet { // [Throws=CashuSdkError] // ProofsStatus check_proofs_spent(sequence proofs); [Throws=CashuSdkError] RequestMintResponse request_mint(Amount amount); [Throws=CashuSdkError] Token mint_token(Amount amount, string hash); [Throws=CashuSdkError] sequence mint(Amount amount, string hash); [Throws=CashuSdkError] Amount check_fee(Bolt11Invoice invoice); [Throws=CashuSdkError] sequence receive(string encoded_token); [Throws=CashuSdkError] sequence process_split_response(BlindedMessages blinded_messages, sequence promises); [Throws=CashuSdkError] SendProofs send(Amount amount, sequence proofs); [Throws=CashuSdkError] Melted melt(Bolt11Invoice invoice, sequence proofs, Amount fee_reserve); [Throws=CashuSdkError] string proof_to_token(sequence proof, string? memo); }; interface Mint { [Throws=CashuSdkError] constructor(string secret, MintKeySetInfo active_keyset_info, sequence inactive_keysets, sequence spent_secrets, Amount min_fee_reserve, f32 percent_fee_reserve); KeysResponse active_keyset_pubkeys(); KeySetResponse keysets(); MintKeySet active_keyset(); KeySet? keyset(Id id); [Throws=CashuSdkError] PostMintResponse process_mint_request(MintRequest mint_request); [Throws=CashuSdkError] SplitResponse process_split_request(SplitRequest split_request); [Throws=CashuSdkError] void verify_melt_request(MeltRequest melt_request); [Throws=CashuSdkError] MeltResponse process_melt_request(MeltRequest melt_request, string preimage, Amount totoal_spent); };