> For the complete documentation index, see [llms.txt](https://docs.cspr.click/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cspr.click/cspr.click-sdk/reference/types.md).

# Types

### AccountType

```
type AccountType = {
    provider: string,
    providerSupports: string[]|undefined,
    cspr_name: string | null,
    public_key: string | null,
    connected_at: Number,
    token: string | null,
    custom?: any,
    balance?: string,
    liquid_balance?: string;
    logo?: string;
}
```

<table><thead><tr><th width="201.33333333333331">Property</th><th>Description</th></tr></thead><tbody><tr><td>provider</td><td>The provider to which the account belongs to.</td></tr><tr><td>providerSupports</td><td>An array of supported capabilities in the connected wallet. Possible values: "sign-deploy", "sign-transactionv1", "sign-message".</td></tr><tr><td>cspr_name</td><td>CSPR.name name</td></tr><tr><td>public_key</td><td>The public key.</td></tr><tr><td>connected_at</td><td>Timestamp for the initial connection of the account</td></tr><tr><td>token</td><td>n/a (for future use)</td></tr><tr><td>custom</td><td>Custom data. Depends on the provider.</td></tr><tr><td>balance</td><td>Total balance of the account in CSPR motes (includes liquid +staked balance)</td></tr><tr><td>liquid_balance</td><td>Liquid balance of the account in CSPR motes (includes liquid +staked balance)</td></tr><tr><td>logo</td><td>A URL to the account avatar or logo.</td></tr></tbody></table>

### CsprClickInitOptions

```
type CsprClickInitOptions = {
    appName: string,
    appId: string,
    contentMode: 'iframe' | 'popup',
    casperNode?: string,
    chainName?: string,
    providers: Array<string>,
}
```

<table><thead><tr><th width="201.33333333333331">Property</th><th>Description</th></tr></thead><tbody><tr><td>appName</td><td>The name of your app as it will be shown in the pop-up windows.</td></tr><tr><td>appId</td><td>An application identifier. Read more about it <a href="/pages/XE4wdI9S2eIeAIJpWLRE">here</a>.</td></tr><tr><td>contentMode</td><td>Defines whether the sign in interface is shown within an iframe in your application or in external pop-up windows.</td></tr><tr><td>casperNode</td><td>The RPC endpoint CSPR.click uses to get information from the Casper network and to send deploys.</td></tr><tr><td>chainName</td><td>Use <code>casper</code> or <code>casper-test</code> to interact with Casper Mainnet or Casper Testnet, respectively.</td></tr><tr><td>providers</td><td>The list of providers (wallets) you want to allow in your application</td></tr><tr><td></td><td></td></tr></tbody></table>

The wallets you can add to the `providers` array are:

* `casper-wallet`
* `ledger`
* `metamask-snap`

### DecryptMessageResult

```
export type DecryptMessageResult = {
    cancelled: boolean;
    decryptedMessage: string | null;
    error: string | null;
}
```

<table><thead><tr><th width="200">Property</th><th>Description</th></tr></thead><tbody><tr><td>cancelled</td><td><code>true</code> when the user has declined the decryption of a message. <code>false</code> otherwise</td></tr><tr><td>decryptedMessage</td><td>String with the decrypted message.</td></tr><tr><td>error</td><td><code>null</code> if the message has been successfully decrypted. It contains an error message otherwise..</td></tr></tbody></table>

### EncryptMessageResult

```
export type EncryptMessageResult = {
    cancelled: boolean;
    encryptedMessage: string | null;
    error: string | null;
}
```

<table><thead><tr><th width="200">Property</th><th>Description</th></tr></thead><tbody><tr><td>cancelled</td><td><code>true</code> when the user has declined the encryption of a message. <code>false</code> otherwise</td></tr><tr><td>encryptedMessage</td><td>Hexadecimal string with the encrypted message bytes.</td></tr><tr><td>error</td><td><code>null</code> if the message has been successfully encrypted. It contains an error message otherwise..</td></tr></tbody></table>

### ProviderInfo

```
type ProviderInfo = {
    key: string,
    name: string,
    version: string,
    supports: Array<string>,
}
```

<table><thead><tr><th width="200">Property</th><th>Description</th></tr></thead><tbody><tr><td>key</td><td>Internal name of the provider (wallet).</td></tr><tr><td>name</td><td>Friendly/Huma readable name of the provider.</td></tr><tr><td>version</td><td>Version of the provider. Only available for some wallets, when they're installed and/or connected.</td></tr><tr><td>supports</td><td><p>Array of keys of the features supported. The values returned may depend on the connected version of the provider.</p><p>Currently, the possible supported features are: <code>sign-deploy</code>, <code>sign-transactionv1</code>, and <code>sign-message</code>.</p></td></tr></tbody></table>

### SendResult

```
type SendResult = {
    cancelled: boolean,
    deployHash: string | null,
    transactionHash: string | null,
    error: string | null,
    errorData: object | null,
    status: string | null;
    csprCloudTransaction: any;
}
```

<table><thead><tr><th width="200">Property</th><th>Description</th></tr></thead><tbody><tr><td>cancelled</td><td><code>true</code> when the user has declined the signature of the transaction. <code>false</code> otherwise</td></tr><tr><td>deployHash</td><td>The hash of the deploy signed and sent to the Casper network. <code>null</code> when the deploy signature has been cancelled or there was an error sending it to the network</td></tr><tr><td>error</td><td><code>null</code> if the deploy has been successfully signed and sent to the network. It contains an error message when the network rejects the deploy.</td></tr><tr><td>errorData</td><td>extra information on the error. It's usually a json object.</td></tr><tr><td>status</td><td>Indicates the status of the transaction sent. This property is helpful when used in combination with the `waitProcessing` in the `send()` method. Possible values: "sent", "processed", "created", "cancelled", "error", "timeout".</td></tr><tr><td>csprCloudTransaction</td><td>Raw json object returned by CSPR.cloud streaming API for a processed transaction. Check CSPR.cloud docs for detailed info on the contents.</td></tr></tbody></table>

### SignResult

```
type SignResult = {
    cancelled: boolean,
    signatureHex: string | null,
    signature: Uint8Array | null,
    deploy: object | null,
    transaction: object | null,
    error: string | null,
}
```

<table><thead><tr><th width="200">Property</th><th>Description</th></tr></thead><tbody><tr><td>cancelled</td><td><code>true</code> when the user has declined the signature of the transaction. <code>false</code> otherwise</td></tr><tr><td>signatureHex</td><td>An hexadecimal string with the crytpographic signature of the deploy.</td></tr><tr><td>signature</td><td>A byte array with the cryptographic signature of the deploy.</td></tr><tr><td>deploy</td><td>A json object containing the deploy with the user approval entry (i.e., the new signature).</td></tr><tr><td>error</td><td><code>null</code> if the deploy has been successfully signed. It contains an error message otherwise.</td></tr></tbody></table>

### SignTypedDataParams

```
type SignTypedDataParams = {
    typedData: {
        domain: Record<string, unknown>;
        types: Record<string, Array<{ name: string; type: string }>>;
        primaryType: string;
        message: Record<string, unknown>;
    };
    options?: {
        domainTypes?: Array<{ name: string; type: string }>;
        returnHashArtifacts?: boolean;
        rejectUnknownFields?: boolean;
    };
}
```

<table><thead><tr><th width="200">Property</th><th>Description</th></tr></thead><tbody><tr><td>typedData.domain</td><td>EIP-712 domain object (e.g. <code>name</code>, <code>version</code>, <code>chain_name</code>, and <code>contract_package_hash</code>).</td></tr><tr><td>typedData.types</td><td>Map of type names to their field definitions, following EIP-712 conventions.</td></tr><tr><td>typedData.primaryType</td><td>The top-level type to sign (must be a key in <code>types</code>).</td></tr><tr><td>typedData.message</td><td>The structured data object to sign, matching the schema of <code>primaryType</code>.</td></tr><tr><td>options.domainTypes</td><td>Optional explicit domain field definitions for hashing. When omitted, the wallet uses <code>typedData.types.EIP712Domain</code> if present.</td></tr><tr><td>options.returnHashArtifacts</td><td>When <code>true</code>, the response includes intermediate hash artifacts (domain separator, struct hash, etc.) in the <code>hashArtifacts</code> field of <a href="#signtypeddataresult">SignTypedDataResult</a>.</td></tr><tr><td>options.rejectUnknownFields</td><td>When <code>true</code>, the wallet MUST reject the request if the message contains fields not declared in <code>types</code>.</td></tr></tbody></table>

Example:

```json
{
    "typedData": {
        "domain": {
            "name": "Wrapped CSPR",
            "version": "1",
            "chain_name": "casper:casper-test",
            "contract_package_hash": "3d80df21ba4ee4d66a2a1f60c32570dd5685e4b279f6538162a5fd1314847c1e"
        },
        "types": {
            "TransferWithAuthorization": [
                {
                    "name": "from",
                    "type": "address"
                },
                {
                    "name": "to",
                    "type": "address"
                },
                {
                    "name": "value",
                    "type": "uint256"
                },
                {
                    "name": "validAfter",
                    "type": "uint256"
                },
                {
                    "name": "validBefore",
                    "type": "uint256"
                },
                {
                    "name": "nonce",
                    "type": "bytes32"
                }
            ]
        },
        "primaryType": "TransferWithAuthorization",
        "message": {
            "from": "00a13d2ae9e961c0f8abfca595d330511aa2b82acd8df6d1642dc80d3c7ca22977",
            "to": "00aa35d1c9dcaadea97c34d79b55b6af07aa9d760e5dd1aabf78a45fb39e0723fa",
            "value": 7500000000,
            "validAfter": 1780556982,
            "validBefore": 1780560582,
            "nonce": "17a0406a474c8dc0ac00889901001fdec05f21a0e204f99c8c5005c416bfe910"
        }
    },
    "options": {
        "returnHashArtifacts": true
    }
}
```

### SignTypedDataResult

```
type SignTypedDataResult = {
    cancelled: boolean;
    signatureHex: string | null;
    digest: string | null;
    publicKey: string | null;
    error: string | null;
    errorCode?: SignTypedDataErrorCode;
    hashArtifacts?: EIP712HashArtifacts;
}
```

<table><thead><tr><th width="200">Property</th><th>Description</th></tr></thead><tbody><tr><td>cancelled</td><td><code>true</code> when the user has declined the signing operation. <code>false</code> otherwise.</td></tr><tr><td>signatureHex</td><td>Prefixed signature hex (01 for ed25519, 02 for secp256k1) followed by the signature bytes, or <code>null</code> if cancelled or failed.</td></tr><tr><td>digest</td><td>0x-prefixed 32-byte hex digest that was signed, or <code>null</code> if cancelled or failed.</td></tr><tr><td>publicKey</td><td>Prefixed public key used for signing, or <code>null</code> if cancelled or failed.</td></tr><tr><td>error</td><td><code>null</code> if the operation succeeded. Contains an error message otherwise.</td></tr><tr><td>errorCode</td><td>Machine-readable error code. See <a href="#signtypeddataerrorcode">SignTypedDataErrorCode</a> for possible values.</td></tr><tr><td>hashArtifacts</td><td>Intermediate hash artifacts for debugging. Only present when <code>returnHashArtifacts</code> was <code>true</code> in the request options. See <a href="#eip712hashartifacts">EIP712HashArtifacts</a>.</td></tr></tbody></table>

### SignTypedDataErrorCode

A string union of machine-readable error codes returned in [SignTypedDataResult](#signtypeddataresult).

| Value                            | Description                                                       |
| -------------------------------- | ----------------------------------------------------------------- |
| `USER_REJECTED`                  | The user declined the signing request.                            |
| `INVALID_PARAMS`                 | The request parameters are malformed or missing required fields.  |
| `UNSUPPORTED_TYPE`               | The wallet does not support the requested type definition.        |
| `DOMAIN_TYPES_REQUIRED`          | Domain type definitions are required but were not provided.       |
| `SIGNATURE_SCHEME_NOT_SUPPORTED` | The account's key scheme is not supported for typed data signing. |
| `ACCOUNT_NOT_FOUND`              | The requested account could not be found in the wallet.           |
| `NOT_AUTHORIZED`                 | The wallet rejected the request due to an authorization failure.  |

### EIP712HashArtifacts

Intermediate hashing artifacts returned in [SignTypedDataResult](#signtypeddataresult) when `options.returnHashArtifacts` is `true`.

```
type EIP712HashArtifacts = {
    domainTypeString?: string;
    domain?: Record<string, unknown>;
    domainSeparator?: string;
    canonicalTypeString?: string;
    typeHash?: string;
    structHash?: string;
}
```

<table><thead><tr><th width="200">Property</th><th>Description</th></tr></thead><tbody><tr><td>domainTypeString</td><td>The encoded EIP-712 domain type string used for hashing.</td></tr><tr><td>domain</td><td>The domain object as used during hashing.</td></tr><tr><td>domainSeparator</td><td>0x-prefixed domain separator hash.</td></tr><tr><td>canonicalTypeString</td><td>Canonical type string for the primary type.</td></tr><tr><td>typeHash</td><td>0x-prefixed type hash.</td></tr><tr><td>structHash</td><td>0x-prefixed struct hash of the message.</td></tr></tbody></table>
