@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
80 lines • 2.35 kB
TypeScript
/**
* Simplified Swap Error System
* Base error class and specific error types for swap transaction flows
*/
/**
* Base error class for all swap-related errors
* Contains error code and nested error information
*/
export declare class SwapError extends Error {
cause: {
swapCode: string;
[key: string]: string | Error | unknown | undefined;
};
message: string;
constructor(code?: string, nestedError?: Error);
}
/**
* Error during nonce/deviceTransactionId generation step
* Typically occurs when calling startSwap()
*/
export declare class NonceStepError extends SwapError {
constructor(nestedError?: Error);
}
/**
* Error during payload retrieval step
* Occurs when communicating with backend to get transaction payload
*/
export declare class PayloadStepError extends SwapError {
constructor(nestedError?: Error);
}
/**
* Error during transaction signature step
* Occurs when user rejects or device fails during completeSwap()
*/
export declare class SignatureStepError extends SwapError {
constructor(nestedError?: Error);
}
/**
* Special case: signature error that should be ignored/handled silently
* Used for expected user cancellations
*/
export declare class IgnoredSignatureStepError extends SwapError {
constructor(nestedError?: Error);
}
/**
* Error when user doesn't have sufficient funds
* Thrown during balance validation
*/
export declare class NotEnoughFunds extends SwapError {
constructor();
}
/**
* Error when unable to retrieve account list
* Occurs during account lookup phase
*/
export declare class ListAccountError extends SwapError {
constructor(nestedError?: Error);
}
/**
* Error when unable to retrieve currency information
* Occurs during currency lookup phase
*/
export declare class ListCurrencyError extends SwapError {
constructor(nestedError?: Error);
}
/**
* Error when specified account ID cannot be found
* Thrown when fromAccountId or toAccountId is invalid
*/
export declare class UnknownAccountError extends SwapError {
constructor(nestedError?: Error);
}
/**
* Error when extra identifier is required but missing
* Some chains require payinExtraId (e.g., XLM memo, XRP tag)
*/
export declare class PayinExtraIdError extends SwapError {
constructor(nestedError?: Error);
}
//# sourceMappingURL=SwapError.d.ts.map