# Wallet Integration

## Overview <a href="#overview" id="overview"></a>

Ramper supports many standardized methods, including: `signMessage` `signTransaction` `sendTransaction` `sendToken` `connect`

Get all dapps function from `useRamperService`

{% code title="container.tsx" %}

```jsx
import { useRamperService } from '@ramper/react-native-core'
const {
  network,
  userWallet,
  convertBalanceToWei,
  onOpenWallet,
  onLogout,
  signMessage,
  signTypedData,
  signTransaction,
  sendTransaction,
  approve,
} = useRamperService();
```

{% endcode %}

### Sign Message

{% code title="container.tsx" %}

```jsx
import { useRamperService } from '@ramper/react-native-core';
const { signMessage } = useRamperService();
 
/*
  signMessage(message: string)
*/
signMessage('Hello, world!');
```

{% endcode %}

### Sign Transaction

{% code title="container.tsx" %}

```jsx
import { useRamperService } from '@ramper/react-native-core';
const { signTransaction, userWallet } = useRamperService();
 
function handleSignTransaction() {
  const value = {
    from: userWallet?.wallets[0].address,
    to: transactionReceive,
    value: transactionAmount,
  };
  // Using serailized transaction as params
  const result = await signTransaction(JSON.stringify(value));
};
```

{% endcode %}

### Send Transaction

{% code title="container.tsx" %}

```jsx
import { useRamperService } from '@ramper/react-native-core';
const { sendTransaction } = useRamperService();
 
const transaction = {
  from: '0x1234567890123456789012345678901234567890',
  to: '0x1234567890123456789012345678901234567890',
  contractAddress: '0x0Fd0288AAAE91eaF935e2eC14b23486f86516c8C', // C98 token contract address
  amount: '100.0001',
};
const result = await sendTransaction(transaction);
```

{% endcode %}

Send transaction params:

| Param           | Type   | Description                                                                                    |
| --------------- | ------ | ---------------------------------------------------------------------------------------------- |
| from            | string | the sender address                                                                             |
| to              | string | the recipient address                                                                          |
| contractAddress | string | the token contract address, if not provided, it will be considered as send native token action |
| amount          | string | the amount of token to send, please using `.` to separate the integer and decimal              |

### Approve NFTs

{% code title="container.tsx" %}

```jsx
import { Web3 } from 'web3';
import { RPCS_DEFAULT } from '@ramper/react-native-core';
 
const { approve } = useRamperService();
 
function onApproveNFTs() {
  const client = new Web3(
    new Web3.providers.HttpProvider(network?.rpcURL),
  );
    const contract = new client.eth.Contract(
      ERC721FullABI,
      approveNFTContactAddress,
    );
 
    const rawData = contract.methods.approve(
      approveNFTSpender,
      approveNFTTokenId,
    );
    const value: ApproveTransaction = {
      data: rawData.encodeABI(),
      to: approveNFTContactAddress,
      type: 'nft',
    };
    const result = await approve(value);
}
```

{% endcode %}

### Approve NFT Collection

{% code title="container.tsx" %}

```jsx
import {useRamperService } from '@ramper/react-native-core';
const { approve, network } = useRamperService();
 
function onApproveNFTCollection() {
  const client = new Web3(
      new Web3.providers.HttpProvider(network?.rpcURL),
    );
    const contract = new client.eth.Contract(
      ERC721FullABI,
      approveNFTContactAddress,
    );
 
    const rawData = contract.methods.setApprovalForAll(approveNFTSpender, true);
    const value: ApproveTransaction = {
      data: rawData.encodeABI(),
      to: approveNFTContactAddress,
      type: 'nftCollection',
    };
  const result = await approve(value);
}
```

{% endcode %}


---

# 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-react-native-apps/wallet-integration.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.
