diff --git a/app/lib/cashu/error-codes.ts b/app/lib/cashu/error-codes.ts index 44037207f..65fb677c8 100644 --- a/app/lib/cashu/error-codes.ts +++ b/app/lib/cashu/error-codes.ts @@ -3,34 +3,40 @@ */ export enum CashuErrorCodes { /** - * Blinded message of output already signed - * Relevant nuts: @see [NUT-03](https://github.com/cashubtc/nuts/blob/main/03.md), [NUT-04](https://github.com/cashubtc/nuts/blob/main/04.md), [NUT-05](https://github.com/cashubtc/nuts/blob/main/05.md) + * Proof verification failed + * Relevant nuts: @see [NUT-03](https://github.com/cashubtc/nuts/blob/main/03.md), [NUT-05](https://github.com/cashubtc/nuts/blob/main/05.md) */ - OUTPUT_ALREADY_SIGNED = 10002, + TOKEN_VERIFICATION_FAILED = 10001, /** - * Token could not be verified + * Proofs already spent * Relevant nuts: @see [NUT-03](https://github.com/cashubtc/nuts/blob/main/03.md), [NUT-05](https://github.com/cashubtc/nuts/blob/main/05.md) */ - TOKEN_VERIFICATION_FAILED = 10003, + TOKEN_ALREADY_SPENT = 11001, /** - * Token is already spent + * Proofs are pending (in flight in a parallel operation) * Relevant nuts: @see [NUT-03](https://github.com/cashubtc/nuts/blob/main/03.md), [NUT-05](https://github.com/cashubtc/nuts/blob/main/05.md) */ - TOKEN_ALREADY_SPENT = 11001, + PROOFS_ARE_PENDING = 11002, /** - * Transaction is not balanced (inputs != outputs) - * Relevant nuts: @see [NUT-02](https://github.com/cashubtc/nuts/blob/main/02.md), [NUT-03](https://github.com/cashubtc/nuts/blob/main/03.md), [NUT-05](https://github.com/cashubtc/nuts/blob/main/05.md) + * Blinded message of output already signed + * Relevant nuts: @see [NUT-03](https://github.com/cashubtc/nuts/blob/main/03.md), [NUT-04](https://github.com/cashubtc/nuts/blob/main/04.md), [NUT-05](https://github.com/cashubtc/nuts/blob/main/05.md) */ - TRANSACTION_NOT_BALANCED = 11002, + OUTPUT_ALREADY_SIGNED = 11003, /** - * Unit in request is not supported - * Relevant nuts: @see [NUT-04](https://github.com/cashubtc/nuts/blob/main/04.md), [NUT-05](https://github.com/cashubtc/nuts/blob/main/05.md) + * Outputs are pending (in flight in a parallel operation) + * Relevant nuts: @see [NUT-03](https://github.com/cashubtc/nuts/blob/main/03.md), [NUT-04](https://github.com/cashubtc/nuts/blob/main/04.md), [NUT-05](https://github.com/cashubtc/nuts/blob/main/05.md) */ - UNIT_NOT_SUPPORTED = 11005, + OUTPUTS_ARE_PENDING = 11004, + + /** + * Transaction is not balanced (inputs != outputs) + * Relevant nuts: @see [NUT-02](https://github.com/cashubtc/nuts/blob/main/02.md), [NUT-03](https://github.com/cashubtc/nuts/blob/main/03.md), [NUT-05](https://github.com/cashubtc/nuts/blob/main/05.md) + */ + TRANSACTION_NOT_BALANCED = 11005, /** * Amount outside of limit range @@ -62,6 +68,46 @@ export enum CashuErrorCodes { */ UNIT_MISMATCH = 11010, + /** + * Amountless invoice is not supported + * Relevant nuts: @see [NUT-05](https://github.com/cashubtc/nuts/blob/main/05.md) + */ + AMOUNTLESS_INVOICE_UNSUPPORTED = 11011, + + /** + * Amount in request does not equal invoice amount + * Relevant nuts: @see [NUT-05](https://github.com/cashubtc/nuts/blob/main/05.md) + */ + AMOUNT_MISMATCH = 11012, + + /** + * Unit in request is not supported + * Relevant nuts: @see [NUT-04](https://github.com/cashubtc/nuts/blob/main/04.md), [NUT-05](https://github.com/cashubtc/nuts/blob/main/05.md) + */ + UNIT_NOT_SUPPORTED = 11013, + + /** + * Maximum number of inputs exceeded for a single request + * Relevant nuts: @see [NUT-03](https://github.com/cashubtc/nuts/blob/main/03.md), [NUT-05](https://github.com/cashubtc/nuts/blob/main/05.md) + */ + MAX_INPUTS_EXCEEDED = 11014, + + /** + * Maximum number of outputs exceeded for a single request + * Relevant nuts: @see [NUT-03](https://github.com/cashubtc/nuts/blob/main/03.md), [NUT-04](https://github.com/cashubtc/nuts/blob/main/04.md), [NUT-05](https://github.com/cashubtc/nuts/blob/main/05.md) + */ + MAX_OUTPUTS_EXCEEDED = 11015, + + /** + * Duplicate quote IDs provided in a batched request + */ + DUPLICATE_QUOTE_IDS = 11016, + + /** + * Maximum batch size exceeded for a batched request + */ + MAX_BATCH_SIZE_EXCEEDED = 11017, + /** * Keyset is not known * Relevant nuts: @see [NUT-02](https://github.com/cashubtc/nuts/blob/main/02.md), [NUT-04](https://github.com/cashubtc/nuts/blob/main/04.md) @@ -74,6 +120,12 @@ export enum CashuErrorCodes { */ KEYSET_INACTIVE = 12002, + /** + * Keyset has expired + * Relevant nuts: @see [NUT-02](https://github.com/cashubtc/nuts/blob/main/02.md) + */ + KEYSET_EXPIRED = 12003, + /** * Quote request is not paid * Relevant nuts: @see [NUT-04](https://github.com/cashubtc/nuts/blob/main/04.md)