Contract: Aptos Vault Mint Token Submission

Submit deposit transaction from Aptos chain

Implementation

You will generate Aptos transaction payload and submit it on-chain

const mintTransactionPayload = {
    arguments: [
      amount, /// Mint token amount with decimal
      destinationChainId.toString(), /// Destination chain id
      Array.from(ethers.utils.arrayify(RECEIVER_ADDRESS)), /// Destination receiver address bytes
      nonce /// timestamp
    ],
    function: `0x${VAULT_CONTRACT_ADDRESS}::vault::deposit`,
    type: 'entry_function_payload',
    type_arguments: [MINT_TOKEN_ADDRESS], /// Mint token address
  };

Request Parameters

NameTypeDescription

amount

u64

Mint token amount

mint_chain_id

u64

Destination chain id

mint_addr

vector<U8>

Destination receiver address bytes

nonce

u64

Timestamp

TransferId Generation

import { ethers } from "ethers";

const receiverAddressWithout0x = "..." /// Receiver address on destination chain
const transferId = ethers.utils.solidityKeccak256(
    [
      "bytes32", 
      "string", 
      "uint64", 
      "uint64", 
      `bytes${Math.floor(receiverAddressWithout0x.length / 2)}`, 
      "uint64", 
      "uint64", 
      "bytes32", 
      "string"
    ],
    [
      "...", /// Aptos wallet address as sender, 32-byte hexString
      "..." /// Aptos token address
      "...", /// Transfer amount
      "...", /// Destination chain id
      `0x${receiverAddressWithout0x}`, /// Receiver address which length may vary based on different chains
      "...", /// Nonce
      "12360001", /// Source chain id
      `0x${this.contractAddress}`, /// Aptos contract address, 32-byte hexString
      "vault", /// hardcoded message 
    ],
);

Response

Since this function is an on-chain transaction, the response is the corresponding transaction response

Last updated