# Get Started on Viction

#### Install Ramper Viction SDK <a href="#id-sdk-viction-installrampervictionsdk" id="id-sdk-viction-installrampervictionsdk"></a>

```
npm i @ramper/viction
```

or

```
yarn add @ramper/viction
```

#### User signup & login <a href="#id-sdk-viction-usersignup-and-login" id="id-sdk-viction-usersignup-and-login"></a>

```
import {
  init,
  AUTH_PROVIDERS,
  CHAIN,
  THEME,
  WALLET_PROVIDER,
  SUPPORTED_TOMO_NETWORKS
} from '@ramper/viction'
import { getWalletModel, User } from '@ramper/core'

init({
  appName: 'Viction Test App',
  authProviders: [
    AUTH_PROVIDER.GOOGLE,
    AUTH_PROVIDER.FACEBOOK,
    AUTH_PROVIDER.TWITTER,
    AUTH_PROVIDER.APPLE,
    AUTH_PROVIDER.EMAIL
  ],
  walletProviders: [WALLET_PROVIDER.METAMASK],
  network: SUPPORTED_TOMO_NETWORKS.MAINNET,
  theme: THEME.DARK,
})

const signInResult = await signIn()
```

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

#### Get logged-in user <a href="#id-sdk-viction-getlogged-inuser" id="id-sdk-viction-getlogged-inuser"></a>

```
import { getUser } from '@ramper/viction'

const user = getUser()
```

#### Send Token <a href="#id-sdk-viction-sendtoken" id="id-sdk-viction-sendtoken"></a>

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

```
import { sendToken } from '@ramper/viction'

try {
  const isSuccess = await sendToken({
    to: '0xa419dfa199Df8651c3f4476546AF5E4CC4E0F73F',
    value: '0.000001',
    network: 'mainnet'
  })
  console.log('sendToken result: ', isSuccess)
} catch (e) {
  console.error(e)
}
```

#### Get ethers.js compatible signer <a href="#id-sdk-viction-getethers.jscompatiblesigner" id="id-sdk-viction-getethers.jscompatiblesigner"></a>

Once you have obtained a Signer, you can use the familiar ethers.js functions to write your DApp. See <https://docs.ethers.io/v5/api/signer/> for reference if you aren't already familiar with ethers.js

`signTransaction`, `signMessage` and `sendTransaction` functions are implemented

```
import { sendTransaction, signTransaction, signMessage } from '@ramper/viction'

try {
  sendTransaction({
    from: wallet?.publicKey as string,
    data: '0x',
    gasLimit: gasLimit.toString(),
    nonce,
    to: transaction.receiver,
    value: transaction.amount,
  })
  
  signTransaction({
    from: wallet?.publicKey as string,
    data: '0x',
    gasLimit: gasLimit.toString(),
    nonce,
    to: transaction.receiver,
    value: transaction.amount,
  })
  
  signMessage(message)
} catch (e) {
  console.log(e)
}

```

We highly recommend you use Promise for the fields that need network access to be determined, such as nonce and gasLimit, etc.

If sendTransaction is triggered by a button, for example, and you perform all the accesses before actually calling sendTransaction, we've noticed the popup window for the user confirmation can be blocked by Safari.

#### Sign out <a href="#id-sdk-viction-signout" id="id-sdk-viction-signout"></a>

Users can log out or disconnect their wallet with:

```
import { signOut } from '@ramper/viction'

await signOut()
```

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](https://coin98.atlassian.net/#chat-with-us) for ways to reach us).

NPM Source: <https://www.npmjs.com/package/@ramper/viction>


---

# 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-viction.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.
