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 split(); }; interface Secret { constructor(); sequence as_bytes(); }; // 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 proofs); string url(); sequence proofs(); }; interface Token { [Throws=CashuError] constructor(string mint, sequence token, string? memo, string? unit); sequence 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 blinded_messages(); sequence secrets(); sequence rs(); sequence 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 keys); record keys(); record 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(Keys keys); }; interface KeySetResponse { constructor(sequence keysets); sequence keysets(); }; // NUT-03 interface SwapRequest { constructor(sequence proofs, sequence outputs); sequence proofs(); sequence outputs(); Amount proofs_amount(); Amount output_amount(); }; interface SwapResponse { constructor(sequence promises); sequence 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 outputs); string quote(); sequence outputs(); }; interface MintBolt11Response { constructor(sequence signatures); sequence 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 inputs, sequence? outputs); sequence inputs(); string quote(); }; interface MeltBolt11Response { constructor(boolean paid, string? payment_preimage, sequence? change); string? payment_preimage(); boolean paid(); }; // NUT-06 interface MintInfo { constructor(string? name, PublicKey? pubkey, MintVersion? version, string? description, string? description_long, sequence>? contact, string nuts, string? motd); string? name(); PublicKey? pubkey(); MintVersion? version(); string? description(); string? description_long(); sequence>? contact(); string? motd(); }; // NUT-07 interface CheckSpendableRequest { constructor(sequence proofs); sequence proofs(); }; interface CheckSpendableResponse { constructor(sequence spendable, sequence pending); sequence spendable(); sequence 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" };