Skip to main content

Errors

CIP-30 defines several error types. Errors are thrown as objects with code and info (or message) properties.

APIError

General API errors use the following structure:

interface APIError {
code: APIErrorCode;
info: string;
}

enum APIErrorCode {
InvalidRequest = -1, // Inputs do not conform to spec or are invalid
InternalError = -2, // Error during execution
Refused = -3, // Request refused (e.g. wallet disconnected)
AccountChange = -4, // Account changed; call enable() to reconnect
}
CodeNameDescription
-1InvalidRequestInputs do not conform to this spec or are otherwise invalid.
-2InternalErrorAn error occurred during execution of this API call.
-3RefusedThe request was refused due to lack of access.
-4AccountChangeThe account has changed. Call enable() to reconnect.

DataSignError

Returned when signData fails:

interface DataSignError {
code: 1 | 2 | 3;
info: string;
}
CodeNameDescription
1ProofGenerationWallet could not sign (e.g. does not have the secret key).
2AddressNotPKAddress was not a P2PK address (no SK associated).
3UserDeclinedUser declined to sign the data.

TxSignError

Returned when signTx fails:

interface TxSignError {
code: 1 | 2;
info: string;
}
CodeNameDescription
1ProofGenerationWallet was unable to sign (e.g. missing private keys).
2UserDeclinedUser declined to sign the transaction.

TxSendError

Returned when submitTx fails:

interface TxSendError {
code: 1 | 2;
info: string;
}
CodeNameDescription
1RefusedWallet refuses to send (e.g. rate limiting).
2FailureWallet could not send (e.g. signature checks).

PaginateError

Returned when pagination parameters exceed wallet limits:

interface PaginateError {
maxSize: number;
}

maxSize is the maximum allowed page size. Requests outside this boundary will throw this error.