Interface

TransferERC20Params

TransferERC20Params

Properties:
Name Type Attributes Description
senderWalletAddress string

Wallet address of sender

senderPublicKey string

Public stark key of sender

receiverPublicKey string

Public stark key of receiver

tokenAddress string

Smart contract address of ERC-20 token

groupRequestId string <optional>

Unique group request ID for the transaction

partnerRefId string <optional>

Unique partner group request ID. Should be Project ID in Myria system

quantizedAmount string

Quantized amount for transferred token (calculated amount based Myria system rule)

  • If token type is ETH / ERC20 (ERC20, MINTABLE_ERC20)
  • 1 - Converter for Quantized Amount: It is calculated based on standard rule: (amount * 10^18) / 10 ^ 10
  • 2 - The calculate rule is convert the pure amount of token to WEI (10^10), then devide it to 10^10 (QUANTUM number defined between Myria and Starkware system)

View Source types/TransactionTypes.ts, line 90

Example

Example of the converter

  function convertAmountToQuantizedAmount(amount: number | string): number {
    const wei = convertNormalAmountToWei(String(amount));
    const QUANTUM = '10000000000'; // 10^10
    return BigNumber.from(wei).div(BigNumber.from(QUANTUM)).toNumber();
  }

  function convertNormalAmountToWei(amount: string): string {
    return ethers.utils.parseEther(String(amount)).toString();
  }