# Golang

No description provided (generated by Openapi Generator <https://github.com/openapitools/openapi-generator>)

## Overview

This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

* API version: 1.0.0
* Package version: 1.0.0
* Generator version: 7.4.0
* Build package: org.openapitools.codegen.languages.GoClientCodegen

## Installation

Install the following dependencies:

```sh
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
```

Put the package under your project folder and add the following in import:

```go
import moonsdk "github.com/moon-up/moon-sdk-go"
```

To use a proxy, set the environment variable `HTTP_PROXY`:

```go
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
```

## Configuration of Server URL

Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification.

### Select Server Configuration

For using other server than the one defined on index 0 set context value `moonsdk.ContextServerIndex` of type `int`.

```go
ctx := context.WithValue(context.Background(), moonsdk.ContextServerIndex, 1)
```

### Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value `moonsdk.ContextServerVariables` of type `map[string]string`.

```go
ctx := context.WithValue(context.Background(), moonsdk.ContextServerVariables, map[string]string{
	"basePath": "v2",
})
```

Note, enum values are always validated and all unused variables are silently ignored.

### URLs Configuration per Operation

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"{classname}Service.{nickname}"` string. Similar rules for overriding default operation server index and variables applies by using `moonsdk.ContextOperationServerIndices` and `moonsdk.ContextOperationServerVariables` context maps.

```go
ctx := context.WithValue(context.Background(), moonsdk.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), moonsdk.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})
```

## Documentation for API Endpoints

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

| Class                | Method                                   | HTTP request                                          | Description |
| -------------------- | ---------------------------------------- | ----------------------------------------------------- | ----------- |
| *AaveAPI*            | **Borrow**                               | **Post** /aave/{name}/borrow                          |             |
| *AaveAPI*            | **Lend**                                 | **Post** /aave/{name}/lend                            |             |
| *AaveAPI*            | **Repay**                                | **Post** /aave/{name}/repay                           |             |
| *AaveAPI*            | **UserReserveData**                      | **Post** /aave/{name}/user-reserve-data               |             |
| *AccountsAPI*        | **BroadcastTx**                          | **Post** /accounts/{accountName}/broadcast-tx         |             |
| *AccountsAPI*        | **CreateAccount**                        | **Post** /accounts                                    |             |
| *AccountsAPI*        | **DeleteAccount**                        | **Delete** /accounts/{accountName}                    |             |
| *AccountsAPI*        | **DeployContract**                       | **Post** /accounts/{accountName}/deploy               |             |
| *AccountsAPI*        | **GetAccount**                           | **Get** /accounts/{accountName}                       |             |
| *AccountsAPI*        | **GetBalance**                           | **Get** /accounts/{accountName}/balance               |             |
| *AccountsAPI*        | **GetNonce**                             | **Get** /accounts/{accountName}/nonce                 |             |
| *AccountsAPI*        | **ListAccounts**                         | **Get** /accounts                                     |             |
| *AccountsAPI*        | **SignMessage**                          | **Post** /accounts/{accountName}/sign-message         |             |
| *AccountsAPI*        | **SignTransaction**                      | **Post** /accounts/{accountName}/sign-transaction     |             |
| *AccountsAPI*        | **SignTypedData**                        | **Post** /accounts/{accountName}/sign-typed-data      |             |
| *AccountsAPI*        | **TransferEth**                          | **Post** /accounts/{accountName}/transfer-eth         |             |
| *BitcoinAPI*         | **CreateBitcoinAccount**                 | **Post** /bitcoin                                     |             |
| *BitcoinAPI*         | **GetBitcoinAccount**                    | **Get** /bitcoin/{accountName}                        |             |
| *BitcoinAPI*         | **ListBitcoinAccounts**                  | **Get** /bitcoin                                      |             |
| *BitcoinAPI*         | **SignBitcoinTransaction**               | **Post** /bitcoin/{accountName}/sign-tx               |             |
| *BitcoincashAPI*     | **CreateBitcoinCashAccount**             | **Post** /bitcoincash                                 |             |
| *BitcoincashAPI*     | **GetBitcoinCashAccount**                | **Get** /bitcoincash/{accountName}                    |             |
| *BitcoincashAPI*     | **ListBitcoinCashAccounts**              | **Get** /bitcoincash                                  |             |
| *BitcoincashAPI*     | **SignBitcoinCashTransaction**           | **Post** /bitcoincash/{accountName}/sign-tx           |             |
| *ConveyorFinanceAPI* | **Swap**                                 | **Post** /conveyorfinance/{name}/swap                 |             |
| *CosmosAPI*          | **CreateCosmosAccount**                  | **Post** /cosmos                                      |             |
| *CosmosAPI*          | **GetCosmosAccount**                     | **Get** /cosmos/{accountName}                         |             |
| *CosmosAPI*          | **ListCosmosAccounts**                   | **Get** /cosmos                                       |             |
| *CosmosAPI*          | **SignCosmosTransaction**                | **Post** /cosmos/{accountName}/sign-tx                |             |
| *DefaultAPI*         | **GetMessage**                           | **Get** /ping                                         |             |
| *DogeCoinAPI*        | **CreateDogeCoinAccount**                | **Post** /dogecoin                                    |             |
| *DogeCoinAPI*        | **GetDogeCoinAccount**                   | **Get** /dogecoin/{accountName}                       |             |
| *DogeCoinAPI*        | **ListDogeCoinAccounts**                 | **Get** /dogecoin                                     |             |
| *DogeCoinAPI*        | **SignDogeCoinTransaction**              | **Post** /dogecoin/{accountName}/sign-tx              |             |
| *ENSAPI*             | **Resolve**                              | **Post** /ens/resolve                                 |             |
| *ERC1155API*         | **BalanceOf**                            | **Post** /erc1155/{name}/balance-of                   |             |
| *ERC1155API*         | **BalanceOfBatch**                       | **Post** /erc1155/{name}/balance-of-batch             |             |
| *ERC1155API*         | **IsApprovedForAll**                     | **Post** /erc1155/{name}/is-approved-for-all          |             |
| *ERC1155API*         | **SafeBatchTransferFrom**                | **Post** /erc1155/{name}/safe-batch-transfer-from     |             |
| *ERC1155API*         | **SafeTransferFrom**                     | **Post** /erc1155/{name}/safe-transfer-from           |             |
| *ERC1155API*         | **SetApprovalForAll**                    | **Post** /erc1155/{name}/set-approval-for-all         |             |
| *EosAPI*             | **CreateEosAccount**                     | **Post** /eos                                         |             |
| *EosAPI*             | **GetEosAccount**                        | **Get** /eos/{accountName}                            |             |
| *EosAPI*             | **ListEosAccounts**                      | **Get** /eos                                          |             |
| *EosAPI*             | **SignEosTransaction**                   | **Post** /eos/{accountName}/sign-tx                   |             |
| *Erc20API*           | **AllowanceErc20**                       | **Post** /erc20/{name}/allowance                      |             |
| *Erc20API*           | **ApproveErc20**                         | **Post** /erc20/{name}/approve                        |             |
| *Erc20API*           | **BalanceOfErc20**                       | **Post** /erc20/{name}/balance-of                     |             |
| *Erc20API*           | **DecimalsErc20**                        | **Post** /erc20/{name}/decimals                       |             |
| *Erc20API*           | **NameErc20**                            | **Post** /erc20/{name}/name                           |             |
| *Erc20API*           | **SymbolErc20**                          | **Post** /erc20/{name}/symbol                         |             |
| *Erc20API*           | **TotalSupplyErc20**                     | **Post** /erc20/{name}/total-supply                   |             |
| *Erc20API*           | **TransferErc20**                        | **Post** /erc20/{name}/transfer                       |             |
| *Erc20API*           | **TransferFromErc20**                    | **Post** /erc20/{name}/transfer-from                  |             |
| *Erc721API*          | **Approve**                              | **Post** /erc721/{name}/approve                       |             |
| *Erc721API*          | **BalanceOf**                            | **Post** /erc721/{name}/balance-of                    |             |
| *Erc721API*          | **GetApproved**                          | **Post** /erc721/{name}/get-approved                  |             |
| *Erc721API*          | **IsApprovedForAll**                     | **Post** /erc721/{name}/is-approved-for-all           |             |
| *Erc721API*          | **Name**                                 | **Post** /erc721/{name}/name                          |             |
| *Erc721API*          | **OwnerOf**                              | **Post** /erc721/{name}/owner-of                      |             |
| *Erc721API*          | **SafeTransferFrom**                     | **Post** /erc721/{name}/safe-transfer-from            |             |
| *Erc721API*          | **SetApprovalForAll**                    | **Post** /erc721/{name}/set-approval-for-all          |             |
| *Erc721API*          | **Symbol**                               | **Post** /erc721/{name}/symbol                        |             |
| *Erc721API*          | **TokenUri**                             | **Post** /erc721/{name}/token-uri                     |             |
| *Erc721API*          | **Transfer**                             | **Post** /erc721/{name}/transfer                      |             |
| *Erc721API*          | **TransferFrom**                         | **Post** /erc721/{name}/transfer-from                 |             |
| *LitecoinAPI*        | **CreateLitecoinAccount**                | **Post** /litecoin                                    |             |
| *LitecoinAPI*        | **GetLitecoinAccount**                   | **Get** /litecoin/{accountName}                       |             |
| *LitecoinAPI*        | **ListLitecoinAccounts**                 | **Get** /litecoin                                     |             |
| *LitecoinAPI*        | **SignLitecoinTransaction**              | **Post** /litecoin/{accountName}/sign-tx              |             |
| *OneinchAPI*         | **ApproveCallData**                      | **Post** /oneinch/approve-call-data                   |             |
| *OneinchAPI*         | **ApproveSpender**                       | **Post** /oneinch/approve-spender                     |             |
| *OneinchAPI*         | **Protocols**                            | **Post** /oneinch/protocols                           |             |
| *OneinchAPI*         | **Quote**                                | **Post** /oneinch/quote                               |             |
| *OneinchAPI*         | **Swap**                                 | **Post** /oneinch/{accountName}/swap                  |             |
| *OneinchAPI*         | **Tokens**                               | **Post** /oneinch/tokens                              |             |
| *OnramperAPI*        | **OnRamperCheckout**                     | **Post** /onramper/fund/${accountName}                |             |
| *OnramperAPI*        | **OnRamperGetQuotesBuy**                 | **Get** /onramper/quotes/buy                          |             |
| *OnramperAPI*        | **OnRamperGetQuotesSell**                | **Get** /onramper/quotes/sell                         |             |
| *OnramperAPI*        | **OnRamperGetSupportedAssets**           | **Get** /onramper/assets                              |             |
| *OnramperAPI*        | **OnRamperGetSupportedCurrencies**       | **Get** /onramper/currencies                          |             |
| *OnramperAPI*        | **OnRamperGetSupportedDefaultsAll**      | **Get** /onramper/defaults                            |             |
| *OnramperAPI*        | **OnRamperGetSupportedOnRampsAll**       | **Get** /onramper/onramps                             |             |
| *OnramperAPI*        | **OnRamperGetSupportedPaymentTypes**     | **Get** /onramper/payment-types                       |             |
| *OnramperAPI*        | **OnRamperGetSupportedPaymentTypesFiat** | **Get** /onramper/payment-types/fiat                  |             |
| *RippleAPI*          | **CreateRippleAccount**                  | **Post** /ripple                                      |             |
| *RippleAPI*          | **GetRippleAccount**                     | **Get** /ripple/{accountName}                         |             |
| *RippleAPI*          | **ListRippleAccounts**                   | **Get** /ripple                                       |             |
| *RippleAPI*          | **SignRippleTransaction**                | **Post** /ripple/{accountName}/sign-tx                |             |
| *SolanaAPI*          | **CreateSolanaAccount**                  | **Post** /solana                                      |             |
| *SolanaAPI*          | **GetSolanaAccount**                     | **Get** /solana/{accountName}                         |             |
| *SolanaAPI*          | **ListSolanaAccounts**                   | **Get** /solana                                       |             |
| *SolanaAPI*          | **SignSolanaTransaction**                | **Post** /solana/{accountName}/sign-tx                |             |
| *TronAPI*            | **CreateTronAccount**                    | **Post** /tron                                        |             |
| *TronAPI*            | **GetTronAccount**                       | **Get** /tron/{accountName}                           |             |
| *TronAPI*            | **ListTronAccounts**                     | **Get** /tron                                         |             |
| *TronAPI*            | **SignTronTransaction**                  | **Post** /tron/{accountName}/sign-tx                  |             |
| *UniSwapAPI*         | **AddLiquidity**                         | **Post** /uniswap/{name}/add-liquidity                |             |
| *UniSwapAPI*         | **RemoveLiquidity**                      | **Post** /uniswap/{name}/remove-liquidity             |             |
| *UniSwapAPI*         | **SwapExactETHForTokens**                | **Post** /uniswap/{name}/swap-exact-eth-for-tokens    |             |
| *UniSwapAPI*         | **SwapExactTokensForTokens**             | **Post** /uniswap/{name}/swap-exact-tokens-for-tokens |             |
| *YearnAPI*           | **AddLiquidity**                         | **Post** /yearn/{name}/add-liquidity                  |             |
| *YearnAPI*           | **AddLiquidityWeth**                     | **Post** /yearn/{name}/add-liquidity-weth             |             |
| *YearnAPI*           | **RemoveLiquidity**                      | **Post** /yearn/{name}/remove-liquidity               |             |
| *YearnAPI*           | **RemoveLiquidityWeth**                  | **Post** /yearn/{name}/remove-liquidity-weth          |             |

## Documentation For Models

* AaveInput
* AaveReservesAPIResponse
* AaveReservesData
* AccountAPIResponse
* AccountData
* AccountResponse
* AvailablePaymentMethod
* BalanceAPIResponse
* BalanceResponse
* BitcoinAPIResponse
* BitcoinCashAPIResponse
* BitcoinCashInput
* BitcoinCashTransactionInput
* BitcoinCashTransactionOutput
* BitcoinInput
* BitcoinTransactionInput
* BitcoinTransactionOutput
* BroadCastRawTransactionAPIResponse
* BroadCastRawTransactionResponse
* BroadcastInput
* ConveyorFinanceControllerResponse
* CosmosAPIResponse
* CosmosInput
* CosmosTransactionInput
* CosmosTransactionOutput
* CreateAccountInput
* CryptoCurrency
* DeployInput
* DogeCoinAPIResponse
* DogeCoinInput
* DogeCoinTransactionInput
* DogeCoinTransactionOutput
* EnsResolveAPIResponse
* EnsResolveInput
* EnsResolveResponse
* EosAPIResponse
* EosInput
* EosTransactionInput
* EosTransactionOutput
* Erc1155Request
* Erc721Request
* FiatCurrency
* GetSupportedOnRampsResponse
* GetSupportedOnRampsResponseMessageInner
* GetSupportedOnRampsResponseMessageInnerIcons
* GetSupportedOnRampsResponseMessageInnerIconsPng
* GetSwapDto
* InputBody
* LitecoinAPIResponse
* LitecoinInput
* LitecoinTransactionInput
* LitecoinTransactionOutput
* Message
* NonceAPIResponse
* NonceResponse
* PaymentType
* PingResponse
* Quote
* RippleAPIResponse
* RippleInput
* RippleTransactionInput
* RippleTransactionOutput
* SellQuote
* SignMessage
* SignMessageAPIResponse
* SignTypedData
* SolanaAPIResponse
* SolanaInput
* SolanaTransactionInput
* SolanaTransactionOutput
* SupportedAssetResponse
* SupportedAssetResponseAssetsInner
* SupportedCurrenciesResponse
* SupportedDefaultResponse
* SupportedDefaultResponseDefaults
* SupportedDefaultResponseDefaultsId
* SupportedPaymentTypesCurrencyResponse
* SupportedPaymentTypesMessage
* TokenSwapParams
* Transaction
* TransactionAPIResponse
* TransactionData
* TransactionInput
* TransactionInputMetaData
* TransactionInputSupportedParams
* TransactionInputSupportedParamsPartnerData
* TransactionInputSupportedParamsPartnerDataRedirectUrl
* TransactionInputSupportedParamsTheme
* TransactionInputWallet
* TransactionRequest
* TransactionResponse
* TransactionResponseInfo
* TransactionResponseTx
* TronAPIResponse
* TronInput
* TronTransactionInput
* TronTransactionOutput
* Tx
* UniswapInput

## Documentation For Authorization

Authentication schemes defined for the API:

### BearerAuth

* **Type**: API key
* **API key parameter name**: Authorization
* **Location**: HTTP header

Note, each API key must be added to a map of `map[string]APIKey` where the key is: Authorization and passed in as the auth context for each request.

Example

```go
auth := context.WithValue(
		context.Background(),
		moonsdk.ContextAPIKeys,
		map[string]moonsdk.APIKey{
			"Authorization": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)
```

### OAuth2

* **Type**: OAuth
* **Flow**: password
* **Authorization URL**:
* **Scopes**:
* **authorization\_code**: grants authorization\_code

Example

```go
auth := context.WithValue(context.Background(), moonsdk.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)
```

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

```go
import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, moonsdk.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)
```

### ApiKeyAuth

* **Type**: API key
* **API key parameter name**: x-api-key
* **Location**: HTTP header

Note, each API key must be added to a map of `map[string]APIKey` where the key is: x-api-key and passed in as the auth context for each request.

Example

```go
auth := context.WithValue(
		context.Background(),
		moonsdk.ContextAPIKeys,
		map[string]moonsdk.APIKey{
			"x-api-key": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)
```

## Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

* `PtrBool`
* `PtrInt`
* `PtrInt32`
* `PtrInt64`
* `PtrFloat`
* `PtrFloat32`
* `PtrFloat64`
* `PtrString`
* `PtrTime`

## Author


---

# 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/golang.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.
