# Get Started on Terra

{% hint style="info" %}
**Good to know:** Currently, Ramper's Terra SDK only supports React. A stand-alone version is under consideration.
{% endhint %}

## Overview

Ramper's Terra SDK provides an easy wallet solution for developers to integrate into their DApps. Once integrated, your users will be able to log in with a popular OAuth solution and instantly interact with a Terra wallet.

Ramper  SDK also provides [WalletView](/embedded-wallet-sdk/quickstart/for-web-apps/version-1/in-app-wallet-view/walletview.md) component, which provides the DApp with various wallet-related functionalities such as fiat-on-ramp, transaction history and token transfers.

In addition, Ramper's Terra SDK provides native support to connect your DApp with TerraStation and WalletConnect (more wallet supports coming soon) as well.

See these functions in action at <https://example.ramper.xyz/>

## Install Ramper SDK

#### Setup Terra's wallet provider

Terra's Wallet-Provider SDK provides access to TerraStation and WalletConnect. Ramper's SDK interfaces with Terra's Wallet-Provider to support both native wallets.

Follow these steps before continuing: <https://github.com/terra-money/wallet-provider/tree/main/packages/src/@terra-money/wallet-provider>

#### Install SDK

```jsx
$ yarn add @ramper/terra
```

or

```jsx
$ npm i @ramper/terra
```

#### User signup & login

```jsx
import { signIn } from '@ramper/terra'
import { useWallet } from '@terra/wallet-provider'

const walletToUse = useWallet()
const signInResult = await signIn(walletToUse)
```

Calling `await signIn(walletToUse)` will launch the log in dialog and return a signInResult when the user successfully logs in or connects an account.

#### Get logged in user

```jsx
import { getUser } from '@ramper/terra'

const user = getUser()
```

#### Check balance

Once logged in, you can check the current coins and tokens balance:

```jsx
import { getUserTokens } from '@ramper/terra'

await getUserTokens('testnet')
```

#### Send token

The following code demonstrates how to send a token from a wallet belonging to the signed in user or a connected wallet.

```jsx
import { sendToken } from '@ramper/terra'

...

try {
  const toAddress = 'terra123aqd9edra72sehg84jk93wq44kfh05s2w02aq'
  const isSuccess = await sendToken({
    to: toAddress,
    symbol: 'Luna',
    value: '0.01', 
    network: 'mainnet'
  })
} catch (ex) {
  console.error('Transaction failed')
}
```

#### Send transaction

The following code demonstrates how to send a transaction from a wallet belonging to the signed in user or a connected wallet.

```jsx
import { sendFromWallet } from '@ramper/terra'
import { useWallet } from '@terra/wallet-provider'
import { useConnectedWallet } from '@terra/wallet-provider'

const { status } = useWallet()
const connectedWallet = useConnectedWallet()
try {
  await sendFromWallet(toAddress, 'UST', 200, 'testnet', status, connectedWallet)
} catch (e) {
  console.error('Transaction failed')
}
```

#### Post Terra.js message transactions

Similar to terra.js CreateAndSignTx method and wallet-provider's post method, Ramper Connect SDK exposes a method called postTransaction to send custom transactions.

```jsx
import { Coin, CreateTxOptions, Fee, MsgSwap } from '@terra-money/terra.js'
import { postTransaction } from '@ramper/terra'
import { useWallet } from '@terra/wallet-provider'
import { useConnectedWallet } from '@terra/wallet-provider'

const { status } = useWallet()
const connectedWallet = useConnectedWallet()

const user = await getUser()

try {
  const res: TxResult = await postTransaction({
    msgs: [new MsgSwap(user.wallets['terra'].publicKey, new Coin('uusd', 1000000), 'ukrw')],
    memo: 'Swapping USD for KRW',
  }, 'testnet', status, connectedWallet)
} catch (ex) {
  console.error('Transaction failed')
}
```

More information on constructing custom transactions can be found here: <https://terra-money.github.io/terra.js/>

#### Sign out

Users can log out or disconnect their wallet with:

```jsx
import { signOut } from '@ramper/terra'
import { useWallet } from '@terra/wallet-provider'

const walletToUse = useWallet()
await signOut(walletToUse)
```

Yup, it really is just that easy!

If there's any feature you would like to see or design patterns you would like for the Ramper team to adopt, come chat with us (see [Introduction](/welcome.md#chat-with-us) for ways to reach us).


---

# 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.ramper.xyz/embedded-wallet-sdk/quickstart/for-web-apps/version-1/get-started-on-terra.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.
