123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- 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();
- };
- // 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(Keys keys);
- };
- 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"
- };
|