# AccountsAPI

## AccountsAPI

All URIs are relative to *<https://beta.usemoon.ai>*

| Method              | HTTP request                                      | Description |
| ------------------- | ------------------------------------------------- | ----------- |
| **broadcastTx**     | **POST** /accounts/{accountName}/broadcast-tx     |             |
| **createAccount**   | **POST** /accounts                                |             |
| **deleteAccount**   | **DELETE** /accounts/{accountName}                |             |
| **deployContract**  | **POST** /accounts/{accountName}/deploy           |             |
| **getAccount**      | **GET** /accounts/{accountName}                   |             |
| **getBalance**      | **GET** /accounts/{accountName}/balance           |             |
| **getNonce**        | **GET** /accounts/{accountName}/nonce             |             |
| **listAccounts**    | **GET** /accounts                                 |             |
| **signMessage**     | **POST** /accounts/{accountName}/sign-message     |             |
| **signTransaction** | **POST** /accounts/{accountName}/sign-transaction |             |
| **signTypedData**   | **POST** /accounts/{accountName}/sign-typed-data  |             |
| **transferEth**     | **POST** /accounts/{accountName}/transfer-eth     |             |

## **broadcastTx**

```swift
    open class func broadcastTx(authorization: String, accountName: String, broadcastInput: BroadcastInput, completion: @escaping (_ data: BroadCastRawTransactionAPIResponse?, _ error: Error?) -> Void)
```

#### Example

```swift
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import OpenAPIClient

let authorization = "authorization_example" // String | 
let accountName = "accountName_example" // String | 
let broadcastInput = BroadcastInput(chainId: "chainId_example", rawTransaction: "rawTransaction_example") // BroadcastInput | 

AccountsAPI.broadcastTx(authorization: authorization, accountName: accountName, broadcastInput: broadcastInput) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}
```

#### Parameters

| Name               | Type               | Description | Notes |
| ------------------ | ------------------ | ----------- | ----- |
| **authorization**  | **String**         |             |       |
| **accountName**    | **String**         |             |       |
| **broadcastInput** | **BroadcastInput** |             |       |

#### Return type

**BroadCastRawTransactionAPIResponse**

#### Authorization

ApiKeyAuth, BearerAuth

#### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

[\[Back to top\]](broken://pages/fsHRo239jGfCahJWyk3z) \[Back to API list] \[Back to Model list] \[Back to README]

## **createAccount**

```swift
    open class func createAccount(authorization: String, createAccountInput: CreateAccountInput, completion: @escaping (_ data: AccountAPIResponse?, _ error: Error?) -> Void)
```

#### Example

```swift
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import OpenAPIClient

let authorization = "authorization_example" // String | 
let createAccountInput = CreateAccountInput(privateKey: "privateKey_example") // CreateAccountInput | 

AccountsAPI.createAccount(authorization: authorization, createAccountInput: createAccountInput) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}
```

#### Parameters

| Name                   | Type                   | Description | Notes |
| ---------------------- | ---------------------- | ----------- | ----- |
| **authorization**      | **String**             |             |       |
| **createAccountInput** | **CreateAccountInput** |             |       |

#### Return type

**AccountAPIResponse**

#### Authorization

ApiKeyAuth, BearerAuth

#### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

[\[Back to top\]](broken://pages/fsHRo239jGfCahJWyk3z) \[Back to API list] \[Back to Model list] \[Back to README]

## **deleteAccount**

```swift
    open class func deleteAccount(authorization: String, accountName: String, completion: @escaping (_ data: AccountAPIResponse?, _ error: Error?) -> Void)
```

#### Example

```swift
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import OpenAPIClient

let authorization = "authorization_example" // String | 
let accountName = "accountName_example" // String | 

AccountsAPI.deleteAccount(authorization: authorization, accountName: accountName) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}
```

#### Parameters

| Name              | Type       | Description | Notes |
| ----------------- | ---------- | ----------- | ----- |
| **authorization** | **String** |             |       |
| **accountName**   | **String** |             |       |

#### Return type

**AccountAPIResponse**

#### Authorization

ApiKeyAuth, BearerAuth

#### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

[\[Back to top\]](broken://pages/fsHRo239jGfCahJWyk3z) \[Back to API list] \[Back to Model list] \[Back to README]

## **deployContract**

```swift
    open class func deployContract(authorization: String, accountName: String, deployInput: DeployInput, completion: @escaping (_ data: TransactionAPIResponse?, _ error: Error?) -> Void)
```

#### Example

```swift
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import OpenAPIClient

let authorization = "authorization_example" // String | 
let accountName = "accountName_example" // String | 
let deployInput = DeployInput(chainId: "chainId_example", abi: "abi_example", bytecode: "bytecode_example", constructorArgs: "constructorArgs_example") // DeployInput | 

AccountsAPI.deployContract(authorization: authorization, accountName: accountName, deployInput: deployInput) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}
```

#### Parameters

| Name              | Type            | Description | Notes |
| ----------------- | --------------- | ----------- | ----- |
| **authorization** | **String**      |             |       |
| **accountName**   | **String**      |             |       |
| **deployInput**   | **DeployInput** |             |       |

#### Return type

**TransactionAPIResponse**

#### Authorization

ApiKeyAuth, BearerAuth

#### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

[\[Back to top\]](broken://pages/fsHRo239jGfCahJWyk3z) \[Back to API list] \[Back to Model list] \[Back to README]

## **getAccount**

```swift
    open class func getAccount(authorization: String, accountName: String, completion: @escaping (_ data: AccountAPIResponse?, _ error: Error?) -> Void)
```

#### Example

```swift
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import OpenAPIClient

let authorization = "authorization_example" // String | 
let accountName = "accountName_example" // String | 

AccountsAPI.getAccount(authorization: authorization, accountName: accountName) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}
```

#### Parameters

| Name              | Type       | Description | Notes |
| ----------------- | ---------- | ----------- | ----- |
| **authorization** | **String** |             |       |
| **accountName**   | **String** |             |       |

#### Return type

**AccountAPIResponse**

#### Authorization

ApiKeyAuth, BearerAuth

#### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

[\[Back to top\]](broken://pages/fsHRo239jGfCahJWyk3z) \[Back to API list] \[Back to Model list] \[Back to README]

## **getBalance**

```swift
    open class func getBalance(accountName: String, authorization: String, chainId: String, completion: @escaping (_ data: BalanceAPIResponse?, _ error: Error?) -> Void)
```

#### Example

```swift
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import OpenAPIClient

let accountName = "accountName_example" // String | 
let authorization = "authorization_example" // String | 
let chainId = "chainId_example" // String | 

AccountsAPI.getBalance(accountName: accountName, authorization: authorization, chainId: chainId) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}
```

#### Parameters

| Name              | Type       | Description | Notes |
| ----------------- | ---------- | ----------- | ----- |
| **accountName**   | **String** |             |       |
| **authorization** | **String** |             |       |
| **chainId**       | **String** |             |       |

#### Return type

**BalanceAPIResponse**

#### Authorization

ApiKeyAuth, BearerAuth

#### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

[\[Back to top\]](broken://pages/fsHRo239jGfCahJWyk3z) \[Back to API list] \[Back to Model list] \[Back to README]

## **getNonce**

```swift
    open class func getNonce(accountName: String, authorization: String, completion: @escaping (_ data: NonceAPIResponse?, _ error: Error?) -> Void)
```

#### Example

```swift
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import OpenAPIClient

let accountName = "accountName_example" // String | 
let authorization = "authorization_example" // String | 

AccountsAPI.getNonce(accountName: accountName, authorization: authorization) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}
```

#### Parameters

| Name              | Type       | Description | Notes |
| ----------------- | ---------- | ----------- | ----- |
| **accountName**   | **String** |             |       |
| **authorization** | **String** |             |       |

#### Return type

**NonceAPIResponse**

#### Authorization

ApiKeyAuth, BearerAuth

#### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

[\[Back to top\]](broken://pages/fsHRo239jGfCahJWyk3z) \[Back to API list] \[Back to Model list] \[Back to README]

## **listAccounts**

```swift
    open class func listAccounts(authorization: String, completion: @escaping (_ data: AccountAPIResponse?, _ error: Error?) -> Void)
```

#### Example

```swift
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import OpenAPIClient

let authorization = "authorization_example" // String | 

AccountsAPI.listAccounts(authorization: authorization) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}
```

#### Parameters

| Name              | Type       | Description | Notes |
| ----------------- | ---------- | ----------- | ----- |
| **authorization** | **String** |             |       |

#### Return type

**AccountAPIResponse**

#### Authorization

ApiKeyAuth, BearerAuth

#### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

[\[Back to top\]](broken://pages/fsHRo239jGfCahJWyk3z) \[Back to API list] \[Back to Model list] \[Back to README]

## **signMessage**

```swift
    open class func signMessage(accountName: String, authorization: String, signMessage: SignMessage, completion: @escaping (_ data: SignMessageAPIResponse?, _ error: Error?) -> Void)
```

#### Example

```swift
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import OpenAPIClient

let accountName = "accountName_example" // String | 
let authorization = "authorization_example" // String | 
let signMessage = SignMessage(name: "name_example", data: "data_example", encoding: "encoding_example", header: false, signtype: false) // SignMessage | 

AccountsAPI.signMessage(accountName: accountName, authorization: authorization, signMessage: signMessage) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}
```

#### Parameters

| Name              | Type            | Description | Notes |
| ----------------- | --------------- | ----------- | ----- |
| **accountName**   | **String**      |             |       |
| **authorization** | **String**      |             |       |
| **signMessage**   | **SignMessage** |             |       |

#### Return type

**SignMessageAPIResponse**

#### Authorization

ApiKeyAuth, BearerAuth

#### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

[\[Back to top\]](broken://pages/fsHRo239jGfCahJWyk3z) \[Back to API list] \[Back to Model list] \[Back to README]

## **signTransaction**

```swift
    open class func signTransaction(accountName: String, authorization: String, inputBody: InputBody, completion: @escaping (_ data: TransactionAPIResponse?, _ error: Error?) -> Void)
```

#### Example

```swift
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import OpenAPIClient

let accountName = "accountName_example" // String | 
let authorization = "authorization_example" // String | 
let inputBody = InputBody(to: "to_example", data: "data_example", input: "input_example", value: "value_example", nonce: "nonce_example", gas: "gas_example", gasPrice: "gasPrice_example", chainId: "chainId_example", encoding: "encoding_example", EOA: false, contractAddress: "contractAddress_example", tokenId: "tokenId_example", tokenIds: "tokenIds_example", approved: false, broadcast: false) // InputBody | 

AccountsAPI.signTransaction(accountName: accountName, authorization: authorization, inputBody: inputBody) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}
```

#### Parameters

| Name              | Type          | Description | Notes |
| ----------------- | ------------- | ----------- | ----- |
| **accountName**   | **String**    |             |       |
| **authorization** | **String**    |             |       |
| **inputBody**     | **InputBody** |             |       |

#### Return type

**TransactionAPIResponse**

#### Authorization

ApiKeyAuth, BearerAuth

#### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

[\[Back to top\]](broken://pages/fsHRo239jGfCahJWyk3z) \[Back to API list] \[Back to Model list] \[Back to README]

## **signTypedData**

```swift
    open class func signTypedData(accountName: String, authorization: String, signTypedData: SignTypedData, completion: @escaping (_ data: SignMessageAPIResponse?, _ error: Error?) -> Void)
```

#### Example

```swift
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import OpenAPIClient

let accountName = "accountName_example" // String | 
let authorization = "authorization_example" // String | 
let signTypedData = SignTypedData(data: "data_example") // SignTypedData | 

AccountsAPI.signTypedData(accountName: accountName, authorization: authorization, signTypedData: signTypedData) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}
```

#### Parameters

| Name              | Type              | Description | Notes |
| ----------------- | ----------------- | ----------- | ----- |
| **accountName**   | **String**        |             |       |
| **authorization** | **String**        |             |       |
| **signTypedData** | **SignTypedData** |             |       |

#### Return type

**SignMessageAPIResponse**

#### Authorization

ApiKeyAuth, BearerAuth

#### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

[\[Back to top\]](broken://pages/fsHRo239jGfCahJWyk3z) \[Back to API list] \[Back to Model list] \[Back to README]

## **transferEth**

```swift
    open class func transferEth(accountName: String, authorization: String, inputBody: InputBody, completion: @escaping (_ data: TransactionAPIResponse?, _ error: Error?) -> Void)
```

#### Example

```swift
// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import OpenAPIClient

let accountName = "accountName_example" // String | 
let authorization = "authorization_example" // String | 
let inputBody = InputBody(to: "to_example", data: "data_example", input: "input_example", value: "value_example", nonce: "nonce_example", gas: "gas_example", gasPrice: "gasPrice_example", chainId: "chainId_example", encoding: "encoding_example", EOA: false, contractAddress: "contractAddress_example", tokenId: "tokenId_example", tokenIds: "tokenIds_example", approved: false, broadcast: false) // InputBody | 

AccountsAPI.transferEth(accountName: accountName, authorization: authorization, inputBody: inputBody) { (response, error) in
    guard error == nil else {
        print(error)
        return
    }

    if (response) {
        dump(response)
    }
}
```

#### Parameters

| Name              | Type          | Description | Notes |
| ----------------- | ------------- | ----------- | ----- |
| **accountName**   | **String**    |             |       |
| **authorization** | **String**    |             |       |
| **inputBody**     | **InputBody** |             |       |

#### Return type

**TransactionAPIResponse**

#### Authorization

ApiKeyAuth, BearerAuth

#### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

[\[Back to top\]](broken://pages/fsHRo239jGfCahJWyk3z) \[Back to API list] \[Back to Model list] \[Back to README]


---

# 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/sdks/swift/accountsapi.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.
