ClassCasperWallet

Constructors

Methods

  • Signs a deploy with the provided or active public key.

    This function requests a connection to the wallet, retrieves the public key (either provided or active), serializes the deploy, signs it, and returns the signed deploy.

    Arguments

    • deploy - The deploy object to be signed.
    • public_key - An optional public key string. If None, the active public key is used.

    Returns

    • Ok(Deploy) - The signed deploy object.
    • Err(JsError) - An error if the connection fails, the public key retrieval fails, the serialization fails, the signing fails, or if the signing is cancelled.

    Errors

    This function returns a JsError if:

    • The connection to the wallet could not be established.
    • The public key could not be retrieved.
    • The deploy serialization fails.
    • The signing operation fails.
    • The signing is cancelled by the user.

    Parameters

    • deploy: Deploy
    • Optionalpublic_key: string

    Returns Promise<Deploy>

  • Alias for the sign_message function, specifically for signing deploy hashes.

    This function calls sign_message to sign the provided deploy hash with the given or active public key.

    Arguments

    • deploy_hash - The deploy hash string to be signed.
    • public_key - An optional public key string. If None, the active public key is used.

    Returns

    • Ok(String) - The signature string.
    • Err(JsError) - An error if the signing process fails.

    Parameters

    • deploy_hash: string
    • Optionalpublic_key: string

    Returns Promise<string>

  • Signs a message with the provided or active public key.

    This function requests a connection to the wallet, retrieves the public key (either provided or active), signs the message, and returns the signature.

    Arguments

    • message - The message string to be signed.
    • public_key - An optional public key string. If None, the active public key is used.

    Returns

    • Ok(String) - The signature string.
    • Err(JsError) - An error if the connection fails, the public key retrieval fails, the signing fails, or if the signing is cancelled.

    Errors

    This function returns a JsError if:

    • The connection to the wallet could not be established.
    • The public key could not be retrieved.
    • The signing operation fails.
    • The signing is cancelled by the user.

    Parameters

    • message: string
    • Optionalpublic_key: string

    Returns Promise<string>

  • Alias for the sign_message function, specifically for signing transaction hashes.

    This function calls sign_message to sign the provided transaction hash with the given or active public key.

    Arguments

    • transaction_hash - The transaction hash string to be signed.
    • public_key - An optional public key string. If None, the active public key is used.

    Returns

    • Ok(String) - The signature string.
    • Err(JsError) - An error if the signing process fails.

    Parameters

    • transaction_hash: string
    • Optionalpublic_key: string

    Returns Promise<string>