PHP WebShell

Текущая директория: /usr/lib/node_modules/bitgo/node_modules/@vechain/sdk-errors/dist

Просмотр файла: index.d.ts

/**
 * Function to stringify data correctly.
 * Some data types like Error, Map, Set, etc. are not stringified correctly by JSON.stringify.
 * This function handles those cases and avoids circular references.
 *
 * @param data - The data to be stringified.
 * @returns The stringified data.
 */
declare const stringifyData: (data: unknown) => string;
/**
 * Asserts that the given error is an instance of the Error class.
 * If the error is an instance of Error, it is returned.
 * If the error is not an instance of Error, a new Error object is created with a descriptive message.
 *
 * @param {unknown} error - The error to be asserted.
 * @return {Error} - The error if it is an instance of Error, or a new Error object if it is not.
 *
 * @remarks
 * **IMPORTANT: no sensitive data should be passed as any parameter.**
 */
declare function assertInnerError(error: unknown): Error;
/**
 * Function to build the error message.
 * Here, we can customize the error message format.
 *
 * @param methodName The name of the method that failed.
 * @param errorMessage The error message.
 * @param inputData The input data that caused the error.
 * @param innerError The inner error that caused the error.
 * @returns The error message as a string.
 */
declare function createErrorMessage<TErrorDataType>(methodName: string, errorMessage: string, inputData: TErrorDataType, innerError?: Error): string;

/**
 * Generic error class for SDK errors.
 *
 * Each error of SDK should extend this class.
 * And, then, error must redefine properly the TErrorDataType generic type.
 * In this way, the error will have a specific data type.
 */
declare class VechainSDKError<TErrorDataType> extends Error {
    readonly methodName: string;
    readonly errorMessage: string;
    readonly data: TErrorDataType;
    readonly innerError?: unknown;
    constructor(methodName: string, errorMessage: string, data: TErrorDataType, innerError?: unknown);
}

/**
 * Default Object error data type. it accepts any object.
 */
type ObjectErrorData = Record<string, unknown>;
type JSONRpcErrorCode =
    | -32700
    | -32600
    | -32601
    | -32602
    | -32603
    | -32000
    | -32004;

/**
 * Invalid data to encode/decode abi error
 *
 * WHEN TO USE:
 * * This error will be thrown when the data to encode or decode into abi is invalid.
 */
declare class InvalidAbiDataToEncodeOrDecode extends VechainSDKError<ObjectErrorData> {
}
/**
 * Invalid ABI item error
 *
 * WHEN TO USE:
 * * This error will be thrown when the ABI item is invalid.
 */
declare class InvalidAbiItem extends VechainSDKError<{
    type: 'function' | 'event';
    value: unknown;
}> {
}
/**
 * Invalid abi signature format error
 *
 * WHEN TO USE:
 * * This error will be thrown when the abi signature format is invalid.
 */
declare class InvalidAbiSignatureFormat extends VechainSDKError<{
    signatureFormat: string;
}> {
}

/**
 * Invalid address error
 *
 * WHEN TO USE:
 * * This error will be thrown when the address is invalid.
 */
declare class InvalidAddress extends VechainSDKError<{
    address: string;
}> {
}

/**
 * Invalid bloom error.
 *
 * WHEN TO USE:
 * * Error will be thrown when the bloom is invalid.
 */
declare class InvalidBloom extends VechainSDKError<ObjectErrorData> {
}
/**
 * Invalid bloom params error.
 *
 * WHEN TO USE:
 * * Error will be thrown when the bloom params are invalid.
 */
declare class InvalidBloomParams extends VechainSDKError<ObjectErrorData> {
}

/**
 * Certificate Signature error.
 *
 * WHEN TO USE:
 * * This error will be thrown when the certificate signature is invalid
 * OR the certificate is not signed, or has in general signature errors.
 */
declare class CertificateSignatureMismatch extends VechainSDKError<ObjectErrorData> {
}

/**
 * Cannot find transaction error.
 *
 * WHEN TO USE:
 * * Error will be thrown when the transaction is not into the blockchain.
 */
declare class ContractDeploymentFailed extends VechainSDKError<ObjectErrorData> {
}
/**
 * Error when calling a read function on a contract.
 *
 * WHEN TO USE:
 * * Error will be thrown when a read (call) operation fails.
 */
declare class ContractCallError extends VechainSDKError<ObjectErrorData> {
}

/**
 * Invalid data type error.
 *
 * WHEN TO USE:
 * * This error will be thrown when the data type is invalid.
 * -e.g.- when the data type is not a string, number, boolean, or object.
 */
declare class InvalidDataType extends VechainSDKError<ObjectErrorData> {
}
/**
 * Unsupported operation error.
 *
 * WHEN TO USE:
 * * This error will be thrown when an operation is not supported.
 * -e.g.- into the ethers adapter, when the runner does not support sending transactions.
 */
declare class UnsupportedOperation extends VechainSDKError<ObjectErrorData> {
}

/**
 * Invalid HDNode mnemonic error.
 *
 * WHEN TO USE:
 * * This error will be thrown when the HDKey mnemonic is invalid.
 *
 * @note Data (mnemonic) is undefined for security reasons, the mnemonic should not be logged!
 */
declare class InvalidHDKeyMnemonic extends VechainSDKError<undefined | {
    wordlistSize: number;
}> {
}
/**
 * Invalid HDNode error.
 *
 * WHEN TO USE:
 * * This error will be thrown when the HDKey is invalid (derivation path / chainCode / public key parameters).
 */
declare class InvalidHDKey extends VechainSDKError<{
    derivationPath?: string;
    chainCode?: Uint8Array;
    publicKey?: Uint8Array;
}> {
}

/**
 * Http invalid request error
 *
 * WHEN TO USE:
 * * Error will be thrown when an invalid HTTP request fails
 */
declare class InvalidHTTPRequest extends VechainSDKError<{
    method: string;
    url: string;
}> {
}
/**
 * Http invalid params error
 *
 * WHEN TO USE:
 * * Error will be thrown when HTTP request params are invalid
 */
declare class InvalidHTTPParams extends VechainSDKError<{
    method: string;
    url: string;
}> {
}

/**
 * Invalid keystore error.
 *
 * WHEN TO USE:
 * * Error will be thrown when the keystore is invalid.
 */
declare class InvalidKeystore extends VechainSDKError<ObjectErrorData> {
}
/**
 * Invalid keystore params error.
 *
 * WHEN TO USE:
 * * Error will be thrown when the keystore params are invalid.
 */
declare class InvalidKeystoreParams extends VechainSDKError<ObjectErrorData> {
}

/**
 * Poll execution error.
 *
 * WHEN TO USE:
 * * Error will be thrown when a poll execution of a function throw error
 */
declare class PollExecution extends VechainSDKError<{
    functionName: string;
}> {
}

/**
 * Provider method error.
 *
 * WHEN TO USE:
 * * This error will be thrown when a provider method has failed.
 */
declare class ProviderMethodError extends VechainSDKError<ObjectErrorData> {
}
/**
 * Provider generic error.
 *
 * WHEN TO USE:
 * * It is a subclass of all provider errors
 *
 * @see{https://www.jsonrpc.org/specification#error_object}
 */
declare class JSONRPCProviderError extends VechainSDKError<{
    code: JSONRpcErrorCode;
    message: string;
    data: ObjectErrorData;
}> {
    readonly methodName: string;
    readonly innerError?: unknown;
    constructor(methodName: string, code: JSONRpcErrorCode, message: string, data: ObjectErrorData, innerError?: unknown);
}
/**
 * Parse error.
 *
 * WHEN TO USE:
 * * Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.
 */
declare class JSONRPCParseError extends JSONRPCProviderError {
    readonly methodName: string;
    readonly innerError?: unknown;
    constructor(methodName: string, message: string, data: ObjectErrorData, innerError?: unknown);
}
/**
 * Invalid request.
 *
 * WHEN TO USE:
 * * The JSON sent is not a valid Request object.
 */
declare class JSONRPCInvalidRequest extends JSONRPCProviderError {
    readonly methodName: string;
    readonly innerError?: unknown;
    constructor(methodName: string, message: string, data: ObjectErrorData, innerError?: unknown);
}
/**
 * Method not found.
 *
 * WHEN TO USE:
 * * The method does not exist / is not available.
 */
declare class JSONRPCMethodNotFound extends JSONRPCProviderError {
    readonly methodName: string;
    readonly innerError?: unknown;
    constructor(methodName: string, message: string, data: ObjectErrorData, innerError?: unknown);
}
/**
 * Invalid params.
 *
 * WHEN TO USE:
 * * Invalid method parameter(s).
 */
declare class JSONRPCInvalidParams extends JSONRPCProviderError {
    readonly methodName: string;
    readonly innerError?: unknown;
    constructor(methodName: string, message: string, data: ObjectErrorData, innerError?: unknown);
}
/**
 * Internal JSON-RPC error.
 *
 * WHEN TO USE:
 * * Internal JSON-RPC error.
 */
declare class JSONRPCInternalError extends JSONRPCProviderError {
    readonly methodName: string;
    readonly innerError?: unknown;
    constructor(methodName: string, message: string, data: ObjectErrorData, innerError?: unknown);
}
/**
 * Invalid default block.
 *
 * WHEN TO USE:
 * * When converting default block to vechain revision
 */
declare class JSONRPCInvalidDefaultBlock extends VechainSDKError<string> {
}
/**
 * Server error.
 *
 * WHEN TO USE:
 * * Reserved for implementation-defined server-errors.
 */
declare class JSONRPCServerError extends JSONRPCProviderError {
    readonly methodName: string;
    readonly innerError?: unknown;
    constructor(methodName: string, message: string, data: ObjectErrorData, innerError?: unknown);
}
/**
 * Method not implemented.
 *
 * WHEN TO USE:
 * * When a method is implemented but not yet supported by the provider.
 */
declare class JSONRPCMethodNotImplemented extends JSONRPCProviderError {
    readonly methodName: string;
    readonly innerError?: unknown;
    constructor(methodName: string, message: string, data: ObjectErrorData, innerError?: unknown);
}

/**
 * Invalid RLP error.
 *
 * WHEN TO USE:
 * * Error will be thrown when the RLP is invalid.
 */
declare class InvalidRLP extends VechainSDKError<{
    context: string;
    data: ObjectErrorData;
}> {
}

/**
 * Invalid command line arguments
 *
 * WHEN TO USE:
 * * When the RPC proxy is called with invalid command line arguments
 */
declare class InvalidCommandLineArguments extends VechainSDKError<{
    flag: string;
    value: string;
}> {
}
/**
 * Invalid configuration file path
 *
 * WHEN TO USE:
 * * When the configuration file path given as input is invalid
 */
declare class InvalidConfigurationFilePath extends VechainSDKError<{
    filePath: string;
}> {
}
/**
 * Invalid configuration file
 *
 * WHEN TO USE:
 * * When the configuration file given as input is invalid
 */
declare class InvalidConfigurationFile extends VechainSDKError<{
    filePath?: string;
    wrongField?: string;
    message?: string;
}> {
}

/**
 * Invalid secp256k1 private key error.
 *
 * WHEN TO USE:
 * * Error will be thrown when the secp256k1 private key is invalid.
 *
 * @note Data (private key) is undefined for security reasons, the private key should not be logged!
 */
declare class InvalidSecp256k1PrivateKey extends VechainSDKError<undefined> {
}
/**
 * Invalid secp256k1 message hash error.
 *
 * WHEN TO USE:
 * * Error will be thrown when the secp256k1 message hash is invalid.
 */
declare class InvalidSecp256k1MessageHash extends VechainSDKError<{
    messageHash: Uint8Array;
}> {
}
/**
 * Invalid secp256k1 signature error.
 *
 * WHEN TO USE:
 * * Error will be thrown when the secp256k1 signature is invalid.
 */
declare class InvalidSecp256k1Signature extends VechainSDKError<{
    signature: Uint8Array;
    recovery?: number;
}> {
}

/**
 * Signer method error.
 *
 * WHEN TO USE:
 * * This error will be thrown when a signer method has failed.
 */
declare class SignerMethodError extends VechainSDKError<ObjectErrorData> {
}

/**
 * Unavailable transaction field (field name) error.
 *
 * WHEN TO USE:
 * * Error will be thrown when a transaction (field name) in a transaction is unavailable.
 */
declare class UnavailableTransactionField extends VechainSDKError<{
    fieldName: string;
}> {
}
/**
 * Invalid transaction field (field name) error.
 *
 * WHEN TO USE:
 * * Error will be thrown when a transaction (field name) in a transaction is invalid.
 */
declare class InvalidTransactionField extends VechainSDKError<{
    fieldName: string;
} & ObjectErrorData> {
}
/**
 * Not delegated transaction error.
 *
 * WHEN TO USE:
 * * Error will be thrown when the transaction is not delegated.
 */
declare class NotDelegatedTransaction extends VechainSDKError<undefined | {
    gasPayerUrl: string;
}> {
}
/**
 * Cannot find transaction error.
 *
 * WHEN TO USE:
 * * Error will be thrown when the transaction is not into the blockchain.
 */
declare class CannotFindTransaction extends VechainSDKError<{
    transactionHash?: string;
    networkUrl?: string;
}> {
}
/**
 * Invalid transaction type error.
 *
 * WHEN TO USE:
 * * Error will be thrown when the transaction type is invalid.
 */
declare class InvalidTransactionType extends VechainSDKError<{
    transactionType?: string;
    validTypes?: string;
}> {
}

/**
 * Invalid cast type error.
 *
 * WHEN TO USE:
 * * Error will be thrown when a method call or property read fails.
 */
declare class InvalidOperation extends VechainSDKError<ObjectErrorData> {
}

type errors_CannotFindTransaction = CannotFindTransaction;
declare const errors_CannotFindTransaction: typeof CannotFindTransaction;
type errors_CertificateSignatureMismatch = CertificateSignatureMismatch;
declare const errors_CertificateSignatureMismatch: typeof CertificateSignatureMismatch;
type errors_ContractCallError = ContractCallError;
declare const errors_ContractCallError: typeof ContractCallError;
type errors_ContractDeploymentFailed = ContractDeploymentFailed;
declare const errors_ContractDeploymentFailed: typeof ContractDeploymentFailed;
type errors_InvalidAbiDataToEncodeOrDecode = InvalidAbiDataToEncodeOrDecode;
declare const errors_InvalidAbiDataToEncodeOrDecode: typeof InvalidAbiDataToEncodeOrDecode;
type errors_InvalidAbiItem = InvalidAbiItem;
declare const errors_InvalidAbiItem: typeof InvalidAbiItem;
type errors_InvalidAbiSignatureFormat = InvalidAbiSignatureFormat;
declare const errors_InvalidAbiSignatureFormat: typeof InvalidAbiSignatureFormat;
type errors_InvalidAddress = InvalidAddress;
declare const errors_InvalidAddress: typeof InvalidAddress;
type errors_InvalidBloom = InvalidBloom;
declare const errors_InvalidBloom: typeof InvalidBloom;
type errors_InvalidBloomParams = InvalidBloomParams;
declare const errors_InvalidBloomParams: typeof InvalidBloomParams;
type errors_InvalidCommandLineArguments = InvalidCommandLineArguments;
declare const errors_InvalidCommandLineArguments: typeof InvalidCommandLineArguments;
type errors_InvalidConfigurationFile = InvalidConfigurationFile;
declare const errors_InvalidConfigurationFile: typeof InvalidConfigurationFile;
type errors_InvalidConfigurationFilePath = InvalidConfigurationFilePath;
declare const errors_InvalidConfigurationFilePath: typeof InvalidConfigurationFilePath;
type errors_InvalidDataType = InvalidDataType;
declare const errors_InvalidDataType: typeof InvalidDataType;
type errors_InvalidHDKey = InvalidHDKey;
declare const errors_InvalidHDKey: typeof InvalidHDKey;
type errors_InvalidHDKeyMnemonic = InvalidHDKeyMnemonic;
declare const errors_InvalidHDKeyMnemonic: typeof InvalidHDKeyMnemonic;
type errors_InvalidHTTPParams = InvalidHTTPParams;
declare const errors_InvalidHTTPParams: typeof InvalidHTTPParams;
type errors_InvalidHTTPRequest = InvalidHTTPRequest;
declare const errors_InvalidHTTPRequest: typeof InvalidHTTPRequest;
type errors_InvalidKeystore = InvalidKeystore;
declare const errors_InvalidKeystore: typeof InvalidKeystore;
type errors_InvalidKeystoreParams = InvalidKeystoreParams;
declare const errors_InvalidKeystoreParams: typeof InvalidKeystoreParams;
type errors_InvalidOperation = InvalidOperation;
declare const errors_InvalidOperation: typeof InvalidOperation;
type errors_InvalidRLP = InvalidRLP;
declare const errors_InvalidRLP: typeof InvalidRLP;
type errors_InvalidSecp256k1MessageHash = InvalidSecp256k1MessageHash;
declare const errors_InvalidSecp256k1MessageHash: typeof InvalidSecp256k1MessageHash;
type errors_InvalidSecp256k1PrivateKey = InvalidSecp256k1PrivateKey;
declare const errors_InvalidSecp256k1PrivateKey: typeof InvalidSecp256k1PrivateKey;
type errors_InvalidSecp256k1Signature = InvalidSecp256k1Signature;
declare const errors_InvalidSecp256k1Signature: typeof InvalidSecp256k1Signature;
type errors_InvalidTransactionField = InvalidTransactionField;
declare const errors_InvalidTransactionField: typeof InvalidTransactionField;
type errors_InvalidTransactionType = InvalidTransactionType;
declare const errors_InvalidTransactionType: typeof InvalidTransactionType;
type errors_JSONRPCInternalError = JSONRPCInternalError;
declare const errors_JSONRPCInternalError: typeof JSONRPCInternalError;
type errors_JSONRPCInvalidDefaultBlock = JSONRPCInvalidDefaultBlock;
declare const errors_JSONRPCInvalidDefaultBlock: typeof JSONRPCInvalidDefaultBlock;
type errors_JSONRPCInvalidParams = JSONRPCInvalidParams;
declare const errors_JSONRPCInvalidParams: typeof JSONRPCInvalidParams;
type errors_JSONRPCInvalidRequest = JSONRPCInvalidRequest;
declare const errors_JSONRPCInvalidRequest: typeof JSONRPCInvalidRequest;
type errors_JSONRPCMethodNotFound = JSONRPCMethodNotFound;
declare const errors_JSONRPCMethodNotFound: typeof JSONRPCMethodNotFound;
type errors_JSONRPCMethodNotImplemented = JSONRPCMethodNotImplemented;
declare const errors_JSONRPCMethodNotImplemented: typeof JSONRPCMethodNotImplemented;
type errors_JSONRPCParseError = JSONRPCParseError;
declare const errors_JSONRPCParseError: typeof JSONRPCParseError;
type errors_JSONRPCProviderError = JSONRPCProviderError;
declare const errors_JSONRPCProviderError: typeof JSONRPCProviderError;
type errors_JSONRPCServerError = JSONRPCServerError;
declare const errors_JSONRPCServerError: typeof JSONRPCServerError;
type errors_JSONRpcErrorCode = JSONRpcErrorCode;
type errors_NotDelegatedTransaction = NotDelegatedTransaction;
declare const errors_NotDelegatedTransaction: typeof NotDelegatedTransaction;
type errors_ObjectErrorData = ObjectErrorData;
type errors_PollExecution = PollExecution;
declare const errors_PollExecution: typeof PollExecution;
type errors_ProviderMethodError = ProviderMethodError;
declare const errors_ProviderMethodError: typeof ProviderMethodError;
type errors_SignerMethodError = SignerMethodError;
declare const errors_SignerMethodError: typeof SignerMethodError;
type errors_UnavailableTransactionField = UnavailableTransactionField;
declare const errors_UnavailableTransactionField: typeof UnavailableTransactionField;
type errors_UnsupportedOperation = UnsupportedOperation;
declare const errors_UnsupportedOperation: typeof UnsupportedOperation;
type errors_VechainSDKError<TErrorDataType> = VechainSDKError<TErrorDataType>;
declare const errors_VechainSDKError: typeof VechainSDKError;
declare const errors_assertInnerError: typeof assertInnerError;
declare const errors_createErrorMessage: typeof createErrorMessage;
declare const errors_stringifyData: typeof stringifyData;
declare namespace errors {
  export { errors_CannotFindTransaction as CannotFindTransaction, errors_CertificateSignatureMismatch as CertificateSignatureMismatch, errors_ContractCallError as ContractCallError, errors_ContractDeploymentFailed as ContractDeploymentFailed, errors_InvalidAbiDataToEncodeOrDecode as InvalidAbiDataToEncodeOrDecode, errors_InvalidAbiItem as InvalidAbiItem, errors_InvalidAbiSignatureFormat as InvalidAbiSignatureFormat, errors_InvalidAddress as InvalidAddress, errors_InvalidBloom as InvalidBloom, errors_InvalidBloomParams as InvalidBloomParams, errors_InvalidCommandLineArguments as InvalidCommandLineArguments, errors_InvalidConfigurationFile as InvalidConfigurationFile, errors_InvalidConfigurationFilePath as InvalidConfigurationFilePath, errors_InvalidDataType as InvalidDataType, errors_InvalidHDKey as InvalidHDKey, errors_InvalidHDKeyMnemonic as InvalidHDKeyMnemonic, errors_InvalidHTTPParams as InvalidHTTPParams, errors_InvalidHTTPRequest as InvalidHTTPRequest, errors_InvalidKeystore as InvalidKeystore, errors_InvalidKeystoreParams as InvalidKeystoreParams, errors_InvalidOperation as InvalidOperation, errors_InvalidRLP as InvalidRLP, errors_InvalidSecp256k1MessageHash as InvalidSecp256k1MessageHash, errors_InvalidSecp256k1PrivateKey as InvalidSecp256k1PrivateKey, errors_InvalidSecp256k1Signature as InvalidSecp256k1Signature, errors_InvalidTransactionField as InvalidTransactionField, errors_InvalidTransactionType as InvalidTransactionType, errors_JSONRPCInternalError as JSONRPCInternalError, errors_JSONRPCInvalidDefaultBlock as JSONRPCInvalidDefaultBlock, errors_JSONRPCInvalidParams as JSONRPCInvalidParams, errors_JSONRPCInvalidRequest as JSONRPCInvalidRequest, errors_JSONRPCMethodNotFound as JSONRPCMethodNotFound, errors_JSONRPCMethodNotImplemented as JSONRPCMethodNotImplemented, errors_JSONRPCParseError as JSONRPCParseError, errors_JSONRPCProviderError as JSONRPCProviderError, errors_JSONRPCServerError as JSONRPCServerError, type errors_JSONRpcErrorCode as JSONRpcErrorCode, errors_NotDelegatedTransaction as NotDelegatedTransaction, type errors_ObjectErrorData as ObjectErrorData, errors_PollExecution as PollExecution, errors_ProviderMethodError as ProviderMethodError, errors_SignerMethodError as SignerMethodError, errors_UnavailableTransactionField as UnavailableTransactionField, errors_UnsupportedOperation as UnsupportedOperation, errors_VechainSDKError as VechainSDKError, errors_assertInnerError as assertInnerError, errors_createErrorMessage as createErrorMessage, errors_stringifyData as stringifyData };
}

export { CannotFindTransaction, CertificateSignatureMismatch, ContractCallError, ContractDeploymentFailed, InvalidAbiDataToEncodeOrDecode, InvalidAbiItem, InvalidAbiSignatureFormat, InvalidAddress, InvalidBloom, InvalidBloomParams, InvalidCommandLineArguments, InvalidConfigurationFile, InvalidConfigurationFilePath, InvalidDataType, InvalidHDKey, InvalidHDKeyMnemonic, InvalidHTTPParams, InvalidHTTPRequest, InvalidKeystore, InvalidKeystoreParams, InvalidOperation, InvalidRLP, InvalidSecp256k1MessageHash, InvalidSecp256k1PrivateKey, InvalidSecp256k1Signature, InvalidTransactionField, InvalidTransactionType, JSONRPCInternalError, JSONRPCInvalidDefaultBlock, JSONRPCInvalidParams, JSONRPCInvalidRequest, JSONRPCMethodNotFound, JSONRPCMethodNotImplemented, JSONRPCParseError, JSONRPCProviderError, JSONRPCServerError, type JSONRpcErrorCode, NotDelegatedTransaction, type ObjectErrorData, PollExecution, ProviderMethodError, SignerMethodError, UnavailableTransactionField, UnsupportedOperation, VechainSDKError, assertInnerError, createErrorMessage, errors, stringifyData };

Выполнить команду


Для локальной разработки. Не используйте в интернете!