Skip to content

convertTokenToEUR (On-Ramp)

This method estimates a token's value in EUR before initiating an on-ramp. convertTokenToEUR can also be used in scenarios where the token to be sent is preset and not user-selectable.

Usage

typescript
import { Network } from '@holyheld/sdk';

const data = await holyheldSDK.evm.onRamp.convertTokenToEUR({
  tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
  tokenNetwork: Network.ethereum,
  amount: '11.11',
});

Parameters

ParameterTypeRequiredDescription
tokenAddressstringYesContract address of the token to convert.
tokenNetworkNetworkYesThe chain the token belongs to.
amountstringYesToken amount to convert, as a decimal string.

Token Address

Address of the token

  • Type: string
typescript
import { Network } from '@holyheld/sdk';

const data = await holyheldSDK.evm.onRamp.convertTokenToEUR({
  tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 
  tokenNetwork: Network.ethereum,
  amount: '11.11',
});

Token Network

Token's network

  • Type: Network
typescript
import { Network } from '@holyheld/sdk';

const data = await holyheldSDK.evm.onRamp.convertTokenToEUR({
  tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
  tokenNetwork: Network.ethereum, 
  amount: '11.11',
});

Amount

Native token amount in Units

  • Type: String
typescript
import { Network } from '@holyheld/sdk';

const data = await holyheldSDK.evm.onRamp.convertTokenToEUR({
  tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
  tokenNetwork: Network.ethereum,
  amount: '11.11'
});

Returns

  • Type: String

EUR equivalent of the given token amount, as a decimal string (e.g. "11.23").