Android SDK

Import

import network.ramp.instantsdk.R
import network.ramp.instantsdk.facade.RampInstantSDK

Constructor

class RampInstantSDK(
    context: Context,
    userAddress: String,
    hostLogoUrl: String,
    hostAppName: String,
    swapAsset: String = "",
    swapAmount: String = "",
    webhookStatusUrl: String = ""
)

Example

widget = RampInstantSDK(
  this,
  swapAsset: "ETH",
  swapAmount: "1500000000000000000", // 1.5 ETH in wei
  userAddress: "0xab5801a7d398351b8be11c439e05c5b3259aec9b",
  hostLogoUrl: "https://yourdapp.com/yourlogo.png",
  hostAppName: "Your Dapp",
  webhookStatusUrl: "https://my.domain/callback/123/"
)

Creates an instance of the widget.

Config parameters

RampInstantSDK class needs to be filled with all the information necessary for Ramp Instant to initialize. Its parameters are as follows:

  • hostLogoUrl URL to your app's logo
  • hostAppName your app's name
  • userAddress 0x-prefixed ETH address of the buyer
  • swapAsset 'ETH' or 'DAI' (optional)
  • swapAmount int string - wei or token units (optional)
  • webhookStatusUrl your URL for webhook updates (optional)
  • url allows to provide an alternative URL to load a non-production version of the widget (optional)

Methods

show()

show()

Initializes the widget and starts widget activity.

Note: this can be only called once - if you want to open the widget again, you need to create a new widget object.