Send generic transactions on Aptos

Send generic transactions

POST /unity/txn2

This endpoint allows the user to send generic transactions on the Aptos blockchain, including transferring tokens, interacting with smart contracts, or any other custom transaction type. Users must provide the necessary transaction details, such as the contract address, contract name, function name, arguments, and parameters for smart contract interactions.

Headers

Name
Value

Content-Type

application/json

x-api-key

<Your_X_API_Key)

Body

Name
Type
Description

contractAddress

string

Contract address

contractName

string

Name of contract

functionName

string

Function you want to do mint transaction on

privateAddress

string

User's private key

arguments

Array of objects

Object of { argument: string, type: number } If the function accepts any arguments

network

number

1 or 2 (1 for Mainnet & 2 for Testnet)

usePaymaster

boolean

true to sponsor the transaction or false if user pays for the transaction

Response

{
  "success": true,
  "status": 200,
  "message": "success",
  "data": {
    "transactionHash": "<transaction hash of successfull mint transaction>",
  }
}

Example Request Body

{
  "network": 2,
  "contractName": "LyncNFTCollection721A",
  "contractAddress": "0x55a5d8e2588d84ef1e9dbe4e8fba38ab0cd2cc54c35987856caece4d971c3ff5",
  "functionName": "mint_nft",
  "privateAddress": "0x55a5d8e2588d84ef1e9dbe4e8fba38ab0cd2cc54c35987856caece4d971c3ff5",
  "arguments": [
    {
      "argument": "1",
      "type": 1 // (string: 0, number: 1, byte_array: 3, signature: 4)
    },
  ],
  "usePaymaster": true,
}

Last updated