Create a general EVM transaction using Fordefi, mainly for invoking smart contract calls.
Fordefi can handle any EVM transaction. While raw EVM transactions can be used to create transfers or revoke allowances, it is recommended to use their requests’ formats.
To invoke a call to a smart contract using the Fordefi platform, you can pass the information data
for the smart contract call either encoded (base64 or hex) or call a specific method and argument in the contract.
Following are examples of creating transaction requests, which will be translated to the same contract call using the three different supported formats.
Note
API users must strongly authenticate transaction requests that are created programmatically by signing them. Learn more.
Method and arguments
Insert this request inside the body, as demonstrated here.
{
"vault_id": "16b5aa12-509e-4944-b656-cf096515d627",
"note": "Mint 6 tokens",
"signer_type": "api_signer",
"type": "evm_transaction",
"details": {
"type": "evm_raw_transaction",
"use_secure_node": false,
"chain": "ethereum_mainnet",
"gas": {
"gas_limit": "263042",
"type": "custom",
"details": {
"type": "dynamic",
"max_priority_fee_per_gas": "14000000000",
"max_fee_per_gas": "14000000000"
}
},
"to": "0x565697B5DD1F7Bdc61f774807057D058E5A27cbC",
"value": "0",
"data": {
"type": "full_details",
"method_name": "mintPublic",
"method_arguments": [
"quantity": "6"
]
}
}
Hex data
The request should be inside the body, as demonstrated here.
{
"vault_id": "16b5aa12-509e-4944-b656-cf096515d627",
"note": "Mint 6 tokens",
"signer_type": "api_signer",
"type": "evm_transaction",
"details": {
"type": "evm_raw_transaction",
"use_secure_node": false,
"chain": "ethereum_mainnet",
"gas": {
"gas_limit": "263042",
"type": "custom",
"details": {
"type": "dynamic",
"max_priority_fee_per_gas": "14000000000",
"max_fee_per_gas": "14000000000"
}
},
"to": "0x565697B5DD1F7Bdc61f774807057D058E5A27cbC",
"value": "0",
"data": {
"type": "hex",
"hex_data": "0x0d1d7ae50000000000000000000000000000000000000000000000000000000000000006"
}
}
Base64 data
The request should be inside the body, as demonstrated here.
{
"vault_id": "16b5aa12-509e-4944-b656-cf096515d627",
"note": "Mint 6 tokens",
"signer_type": "api_signer",
"type": "evm_transaction",
"details": {
"type": "evm_raw_transaction",
"use_secure_node": false,
"chain": "ethereum_mainnet",
"gas": {
"gas_limit": "263042",
"type": "custom",
"details": {
"type": "dynamic",
"max_priority_fee_per_gas": "14000000000",
"max_fee_per_gas": "14000000000"
}
},
"to": "0x565697B5DD1F7Bdc61f774807057D058E5A27cbC",
"value": "0",
"data": {
"type": "base64",
"raw_data": "DR165QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG"
}
}