Ramper Documentation
  • 🌟WELCOME
  • 👨‍💻Developer Guide
    • Developer Dashboard
  • 🔐EMBEDDED WALLET SDK
    • Quickstart
      • For Web Apps
        • Multichain Supported
          • Wallet Integration
          • Approve NFT
          • Approve Token
          • Sign Typed
        • Get Started on Viction
      • For Unity Apps
      • For Telegram Mini Apps
        • Set up Telegram bot
        • Implement Ramper Telegram SDK
      • For React Native Apps
        • Installation
        • Getting Started
        • Wallet Integration
        • Sign Typed
        • Approve
    • Terms & Conditions
    • Privacy Policy
  • 💜RAMPER WALLET
    • About Ramper Wallet
    • 📖User Guides
      • Authentication
      • How to send NFTs
      • How to sign in to a new account
      • Wallet settings
      • How to Send & Receive tokens
      • How to add custom tokens
      • Manage Tokens
      • General settings
      • How to send assets via email
      • How to use Vault
      • How to send assets via OneID
      • How to migrate accounts from Old version to New version
    • ❓User FAQs
      • Which networks are supported on Ramper?
      • What social accounts can I use to log in to Ramper?
      • What is the difference between a Password and a Passphrase?
      • Zero-gas transactions
      • Does Ramper hold my funds?
      • Can I import my wallet from Ramper to another Web3 wallet?
      • Can I import my wallet to Ramper?
      • Why can't I see my assets?
      • What is gas fee?
      • Can I get my assets back if I send them to the wrong addresses?
      • I forgot the password of my social accounts. How can I access my funds on Ramper?
      • What happens if my social account is compromised?
      • Can I recover my wallet if I lose my social account?
      • Can I change the email that is associated with my wallet address?
      • I can't find the answer to my question. How can I get support?
      • What is a Protected Account?
      • I forgot the PIN code to log in to Ramper Wallet. How can I access my funds?
      • Which email domains are blocked?
    • Ramper Wallet (Extension) Integration
      • EVM Dapp Integration
      • Sei Dapp Integration
    • Privacy Policy
    • Terms of Service
  • 💸NFT CHECKOUT SDK
    • About Ramper NFT Checkout
    • Get Started on EVM
    • Get Started on NEAR
    • Setting Up Your Collection
    • Moving Your Collection to Production
    • Purchase History
    • Terms of Service
    • Privacy Policy
  • Import
Powered by GitBook
On this page
  • Overview
  • Sign Message
  • Sign Transaction
  • Send Transaction
  • Approve NFTs
  • Approve NFT Collection
  1. EMBEDDED WALLET SDK
  2. Quickstart
  3. For React Native Apps

Wallet Integration

Overview

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

Get all dapps function from useRamperService

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

Sign Message

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

Sign Transaction

container.tsx
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));
};

Send Transaction

container.tsx
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);

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

container.tsx
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);
}

Approve NFT Collection

container.tsx
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);
}
PreviousGetting StartedNextSign Typed

Last updated 2 months ago

🔐