Using Onramp with https

Query Params

ParamsTypeDescription

env

string

Execute request on either staging or production env.

mode

string

For using contract interaction mode, value checkout|deposit

walletAddress

string

Address of the destination wallet

exchangeScreenTitle

string

title in header of widget

aarc_api_key

string

Api key obtained from Aarc to make this request

onrampWindow = window.open(`${onramp_base_url}?
env=${env}
&mode=${mode}
&walletAddress=${walletAddress}
&exchangeScreenTitle=${exchangeScreenTitle}
&aarc_api_key=${aarc_api_key}
`, '_blank')

For Contract interaction mode

ParamsTypeDescription

env

string

Execute request on either staging or production env.

mode

string

For using contract interaction mode, value checkout|deposit

walletAddress

string

Address of the destination wallet

smartContractAddress

string

Address of the smart contract

aarc_api_key

string

Api key obtained from Aarc to make this request

estimatedGasLimit

number

Gas limit for the transaction

sourceTokenData

SourceTokenData

JSON.stringify Token Data object containing the token code and amount

cryptoCurrencyData

CryptoCurrencyData

JSON.strinfigy Object containing details for onramp

callData

BytesLike

Calldata for onramp transaction

SourceTokenData {
  sourceTokenCode: string;
  sourceTokenAmount: number;
}

CryptoCurrencyData {
  cryptoCurrencyCode: string;
  cryptoCurrencyName: string;
  cryptoCurrencyImageURL: string;
}
onrampWindow = window.open(`
${onramp_base_url}?
env=${env}
&mode=${mode}
&walletAddress=${walletAddress}
&estimatedGasLimit=${estimatedGasLimit}
&smartContractAddress=${smartContractAddress}
&sourceTokenData=${JSON.stringify(sourceTokenData)}
&calldata=${callData}
&cryptoCurrencyData=${JSON.stringify(cryptoCurrencyData)}
&aarc_api_key=${aarc_api_key}
`, '_blank')

Create an event listner for listening to the onramp events

window.addEventListener("message",
            function (e: any) {
                <handle onramp events..>
            },
            false);
    }
        , []);

Event Types

  • ONRAMP_WIDGET_CLOSE

  • ONRAMP_ORDER_SUCCESSFUL

  • ONRAMP_ORDER_FAILED

Last updated