# Wallet Module

Wallet module handles operations related to wallet creation and balance retrieval.

To learn more about how to use the AI Agent SDK to interact with the wallet module, please visit [AI Agent SDK Wallet Management](/crypto.com-ai-agent-sdk/core-concepts-overview/blockchain-functions/wallet-management.md).

#### 1.1 Create Wallet

Creates a new wallet

{% tabs %}
{% tab title="Python" %}
Function Name

```python
create_wallet
```

{% tabs %}
{% tab title="Query" %}

* Example Code

  ```python
  from crypto_com_developer_platform_client import Wallet

  wallet = Wallet.create_wallet()
  print(wallet)
  ```

{% endtab %}

{% tab title="Response" %}

* Returns

  ```python
  The address of the new wallet.
  ```
* Errors

  ```python
  ValueError: If the Wallet class is not initialized with a Client instance.
  ```
* Example Return

  ```python
  {'status': 'Success', 'data': {'address': 'example-address', 'privateKey': 'example-private-key', 'mnemonic': 'example-mnemonic'}}
  ```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="TypeScript" %}
Function Name

```typescript
create
```

{% tabs %}
{% tab title="Query" %}

* Example Code

  ```typescript
  import { Wallet } from '@crypto.com/developer-platform-client';

  try {
    const wallet = await Wallet.create();
    console.log(wallet);
  }
  catch(err) {
    console.log(err);
  }
  ```

{% endtab %}

{% tab title="Response" %}

* Returns

  ```typescript
  {Promise<ApiResponse<CreateWalletData>>}: A promise that resolves to the newly created wallet details.
  ```
* Errors

  ```typescript
  {Error}: Throws an error if the request fails.
  ```
* Example Return

  ```typescript
  {
    status: 'Success',
    data: {
      address: 'example-address',
      privateKey:'example-private-key',
      mnemonic: 'example-mnemonic'
    }
  }
  ```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

#### 1.2 Get Wallet Balance

Retrieves the balance of the wallet for a specific address.

{% tabs %}
{% tab title="Python" %}
Function Name

```python
get_balance
```

{% tabs %}
{% tab title="Query" %}

* Arguments

  ```python
  wallet_address (str): The address to get the balance for (CronosIds with the `.cro` suffix are supported, e.g. `xyz.cro`)
  ```
* Example Code

  ```python
  from crypto_com_developer_platform_client import Wallet

  balance = Wallet.get_balance('example-wallet')
  print(balance)
  ```

{% endtab %}

{% tab title="Response" %}

* Returns

  ```python
  The balance of the wallet.
  ```
* Errors

  ```python
  ValueError: If the Wallet class is not initialized with a Client instance.
  ```
* Example Return

  ```python
  {'status': 'Success', 'data': {'balance': 'example-balance'}}
  ```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="TypeScript" %}
Function Name

```typescript
balance
```

{% tabs %}
{% tab title="Query" %}

* Arguments

  ```typescript
  {string} walletAddress: The wallet address to fetch the balance for (CronosIds with the `.cro` suffix are supported, e.g. `XXX.cro`)
  ```
* Example Code

  ```typescript
  import { Wallet } from '@crypto.com/developer-platform-client';

  try {
    const balance = await Wallet.balance('example-wallet');
    console.log(balance);
  }
  catch(err) {
    console.log(err);
  }
  ```

{% endtab %}

{% tab title="Response" %}

* Returns

  ```typescript
  {Promise<ApiResponse<Balance>>}: A promise that resolves to the balance of the wallet.
  ```
* Errors

  ```typescript
  {Error}: Throws an error if the request fails.
  ```
* Example Return

  ```typescript
  { status: 'Success', data: { balance: 'example-balance' } }
  ```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}


---

# 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://ai-agent-sdk-docs.crypto.com/crypto.com-developer-platform/on-chain-developer-platform-client-sdk/wallet-module.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.
