# fetchAccountHash

## Description

The `fetchAccountHash` function takes a public key as input, converts it to an account hash using a third-party API, and returns the account hash as a string.

## Parameters

| Name        | Type   | Description                         |
| ----------- | ------ | ----------------------------------- |
| `publicKey` | string | The public key of the user's wallet |

## Response

| Name          | Type   | Description                           |
| ------------- | ------ | ------------------------------------- |
| `accountHash` | string | The account hash of the user's wallet |

## Example Request and Response

### Prerequisites

Before making requests with Volary SDK, you must have it installed.

You can install Volary SDK using either **`npm`** or **`yarn`**. Use the following commands to install Volary SDK:

```sh
npm install @nest25/casper-lib
OR
yarn add @nest25/casper-lib
```

### Request

Here is an example of how to make a `fetchAccountHash` request using the Volary SDK:

```javascript

// import Nest25 Casper library
const { Casper } = require('@nest25/casper-lib');
// create a new Casper instance
const casper = new Casper();

async function main() {
  const publicKey = '013a156a50fc6284ba436aedeaf96b55ac1a0c57ee9f8a46bf1c6518afe9b2f56c';
  // fetch account hash from public key
  let accountHash = await casper.fetchAccountHash(publicKey);
  // print account hash
  console.log({ accountHash });
}
// call main function
main();
```

### Response

```sh
{
        accountHash: 'account-hash-6a43e8538b4b695b6670c30ecd1f9fea26400573954be066fda6314fc8e17f13'
}
```

## Use Cases

* **Crypto Wallets:** The function can be used by crypto wallets to retrieve the account hash of a user's wallet for transaction purposes.
* **Payment Gateways:** The function can be used by payment gateways to retrieve the account hash of a user's wallet for payment processing.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.volary.io/sdks-guide/blockchain-sdks/casper-sdk/fetchaccounthash.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
