# @moonup/viem

## @moonup/viem Package Documentation

The `@moonup/viem` package is a utility package that allows for the creation of a local account using the MoonSDK from the `@moonup/moon-sdk` package. This local account can be used with the `viem` library for signing messages, transactions, and typed data.=

## **Installing Moon Viem:**

To utilize the Moon Viem package, first install it to the desired directory of the project:

#### To install Moon Viem:

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

```bash
npm install @moonup/viem
```

{% endtab %}

{% tab title="yarn" %}

```bash
yarn install @moonup/viem
```

{% endtab %}

{% tab title="pnpm" %}

```bash
pnpm add @moonup/viem
```

{% endtab %}
{% endtabs %}

### Usage Examples

Here's a basic example of how to use the `createMoonAccount` function:

```javascript
import { MoonSDK } from '@moonup/moon-sdk';
import { createMoonAccount } from '@moonup/viem';

const sdk = new MoonSDK({ /* your configuration */ });
const ethereumAddress = '0xYourEthereumAddress';

const account = await createMoonAccount({ sdk, ethereumAddress });

// Now you can use the account with viem
```

### API Reference

#### `createMoonAccount`

Creates a local account using the MoonSDK.

**Parameters**

* `input` (Object)
  * `sdk` (MoonSDK): An instance of the MoonSDK.
  * `ethereumAddress` (string): The Ethereum address of the account.

**Returns**

A promise that resolves to a `LocalAccount` object.

**Example**

```javascript
const account = await createMoonAccount({ sdk, ethereumAddress });
```


---

# 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.usemoon.ai/additional-moon-packages-7ca327c0bb2846d88b8ba5bc6caeaead/moon-viem.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.
