Skip to main content

Deposit SDK (Web)

Overview

The Deposit SDK provides a simple way to integrate the onramp service into your application efficiently. This feature allows users to buy cryptocurrency through multiple service providers like Transak, Moonpay, Ramp, Onmeta or Onramper without leaving your application.

deposit-pop-updeposit-pop-up

Prerequisites

  • Initialize and set up configuration for your project following this guideline

Installation

To install the SDK, use the following command:

npm install @sky-mavis/waypoint

Usage

Initialize

import { Deposit } from "@sky-mavis/waypoint/deposit";

const deposit = new Deposit({
clientId: "<client_id>",
redirectUri: "<redirect_uri>",
});

Parameters for the Deposit class include:

FieldRequired?Description
clientIdRequiredThe client ID from the Ronin Developer Console. For more information, see Ronin Waypoint settings.
redirectUriRequiredEquivalent to the REDIRECT URI configured in Ronin Waypoint settings.
waypointOriginOptionalThe Waypoint service origin URL. Default is the production Ronin Waypoint origin.
originOptionalThe origin configured in Waypoint service settings.
environmentOptionaldevelopment or production.
themeOptionalThe theme of the deposit modal. Available values are light and dark.
onramperOptionsOptionalConfiguration options for Onramper provider. See Onramper Options.

Onramper Options

FieldTypeDescription
referencesobjectAdditional references for the onramp.
references.swapActionstringIdentifier for the swap action.
redirectAtCheckoutbooleanWhether to redirect after checkout.

Starting the deposit process

In your application, you can use the deposit object to call the start method to open the deposit popup modal.

const result = await deposit.start({
walletAddress: "<wallet_address>",
fiatCurrency: "<fiat_currency>",
...
});

The start method accepts an object with the following optional parameters:

FieldTypeRequired?Description
emailstringOptionalThe user's email address.
walletAddressstringOptionalThe Ronin wallet address of the customer.
fiatCurrencystringOptionalThe code of the fiat currency you want the customer to buy cryptocurrency.
fiatAmountnumberOptionalThe initial amount of fiat currency you want the customer to buy cryptocurrency.
cryptoCurrencyobjectOptionalThe cryptocurrency to deposit. See CryptoCurrency Object.
onramperParamsobjectOptionalOnramper-specific parameters. See Onramper Parameters.
roninDepositParamsobjectOptionalRonin deposit-specific parameters.
warning

In the Ramp provider, when a user enters their wallet address manually, the address must include the ronin: prefix. For example, ronin:1234567890abcdef1234567890abcdef12345678.

CryptoCurrency Object

FieldTypeRequired?Description
networkstringRequiredThe blockchain network: ronin, ethereum, bsc, polygon, arbitrum, base, or solana.
symbolstringRequiredThe cryptocurrency symbol (e.g., AXS, RON, ETH).
addressstringOptionalThe token contract address on the specified network.
chainIdnumberOptionalThe chain ID of the network.

Onramper Parameters

FieldTypeDescription
networkWalletsobjectWallet addresses for different networks (ronin, ethereum, bsc, polygon, arbitrum, base, solana).

Ronin Deposit Parameters

FieldTypeDescription
walletAddressstringThe user's wallet address for Ronin network.

Success Response

The start method returns a Promise that resolves with an object containing the transaction details when the deposit is successful.

FieldTypeDescription
providerstringThe provider used for the transaction.
transactionHashstringThe hash of the transaction.
fiatCurrencystringThe fiat currency used in the transaction.
cryptoCurrencystringThe cryptocurrency used in the transaction.
fiatAmountnumberThe amount of fiat currency involved in the transaction.
cryptoAmountnumberThe amount of cryptocurrency involved in the transaction.

Error Response

If the transaction is failed or cancelled, the Promise will reject with an object containing the error details.

FieldTypeDescription
codenumberThe error code indicating the type of error.
messagestringThe reason for the error or cancellation.

The deposit error codes are as follows:

CodeDescription
4001The user has closed the deposit pop-up.
-32603The deposit transaction has failed.

Dry Run

You can use the dryRun method to preview the deposit URL without opening a popup. This is useful for debugging, testing, or sharing the deposit URL.

const url = deposit.dryRun({
walletAddress: "<wallet_address>",
fiatCurrency: "<fiat_currency>",
...
});

console.log(url); // Returns the full URL string that would be opened

The dryRun method accepts the same parameters as start and returns a string containing the complete deposit URL with all query parameters properly encoded.

Examples

Basic Usage

Here is an example of how to implement the onramp service in your application:

Step 1: Initialize an instance from the Deposit class

import {Deposit} from '@sky-mavis/waypoint/deposit';

export const deposit = new Deposit({
clientId: '4d24b378-aa36-4952-8faa-bda63c9a4932',
redirectUri:'https://docs.skymavis.com'
});

Step 2: Open the deposit pop-up

Live Editor
function StartDeposit() {
  const [result, setResult] = useState(null);

  const handleDeposit = async () => {
    try {
      const result = await deposit.start({
        fiatCurrency: 'USD',
        cryptoCurrency: {
          network: 'ronin',
          symbol: 'AXS',
        },
        fiatAmount: 100,
      });
      setResult(result);
    } catch (error) {
      alert(error);
    }
  };

  return (
    <LayoutBox>
      <Button label="Deposit with Ronin Waypoint" onClick={handleDeposit} />
      {result && (
        <span>{`You have deposited ${result.cryptoAmount} ${result.cryptoCurrency} to your Wallet`}</span>
      )}
    </LayoutBox>
  );
}
Result
Loading...

Additional Information

Supported crypto currencies

Details
CryptocurrencyCode
RoninRON
Axie Infinity ShardAXS
Smooth Love PotionSLP
USD CoinUSDC
Ronin Wrapped EtherWETH
PIXELPIXEL
BANANABANANA
ApeirosAPRS

Supported fiat currencies

Details
Currency NameCurrency Code
US DollarUSD
British PoundGBP
Indian RupeeINR
EuroEUR
Swiss FrancCHF
Swedish KronaSEK
Polish ZlotyPLN
Norwegian KroneNOK
Danish KroneDKK
New Zealand DollarNZD
Mexican PesoMXN
Canadian DollarCAD
Australian DollarAUD
Argentine PesoARS
Brazilian RealBRL
Chilean PesoCLP
Costa Rican ColonCRC
Dominican PesoDOP
Indonesian RupiahIDR
Israeli ShekelILS
Japanese YenJPY
South Korean WonKRW
Malaysian RinggitMYR
Paraguayan GuaraniPYG
Peruvian SolPEN
Philippine PesoPHP
Singapore DollarSGD
Fiji DollarFJD
ForintHUF
Kenyan ShillingKES
Moldovan LeuMDL
Bermudian DollarBMD
Falkland Islands PoundFKP
Czech KorunaCZK
Iceland KronaISK
Romanian LeuRON
KwanzaAOA
Belize DollarBZD
Brunei DollarBND
Comoro FrancKMF
Djibouti FrancDJF
East Caribbean DollarXCD
LariGEL
QuetzalGTQ
LempiraHNL
Hong Kong DollarHKD
TengeKZT
SomKGS
Malagasy AriaryMGA
KwachaMWK
OuguiyaMRU
Rial OmaniOMR
KinaPGK
Rwanda FrancRWF
DobraSTN
Seychelles RupeeSCR
Solomon Islands DollarSBD
Surinam DollarSRD
LilangeniSZL
SomoniTJS
Pa’angaTOP
Turkmenistan New ManatTMT
Peso UruguayoUYU
Colombian PesoCOP
Taiwanese DollarTWD
Ghanaian CediGHS
UAE DirhamAED
Cambodian RielKHR
Serbian DinarRSD
Bahraini DinarBHD
Macedonian DenarMKD
Kuwaiti DinarKWD
Armenian DramAMD
Netherlands Antilles GuilderANG
Azerbaijani ManatAZN
Bahamian DollarBSD
Cayman Islands DollarKYD
Cape Verdean EscudoCVE
BH Convertible MarkBAM
Jordanian DinarJOD
Trinidad & Tobago DollarTTD
Panamanian BalboaPAB
Algerian DinarDZD
Bulgarian LevBGN
Egyptian PoundEGP
Sri Lankan RupeeLKR
Nigerian NairaNGN
Thai BahtTHB
Turkish LiraTRY
Vietnamese DongVND
South African RandZAR
Botswana PulaBWP
Mozambican MeticalMZN
Lao KipLAK