I was looking for API that can call smart contract functionalities like transferFrom, mint or burn. We will give ownership of the ERC20 contract to FireBlocks custodian account and then we will need API that can call these functionalities.
Are there any API that can send transactions to ERC20 smart contract like transferFrom, mint or burn
Hi @shahzad73
You can call any method on any deployed contract on supported EVM networks via Fireblocks’ POST /v1/transactions endpoint. Set the operation
parameter to CONTRACT_CALL
, set the asset
to the base asset of the target blockchain, set the destination
to the address of the deployed contract, and pass the contract callData in extraParameters.contractCallData
. Here’s an example of what this would look like using our Javascript SDK:
fireblocksApiClient.createTransaction({
operation: TransactionOperation.CONTRACT_CALL,
assetId: "ETH",
source: {
type: PeerType.VAULT_ACCOUNT,
id: "0" /* Source Vault Account ID */
},
destination: {
type: PeerType.EXTERNAL_WALLET,
id: externalWalletId
},
note: "Contract Call Transaction",
amount: "0",
extraParameters: {
contractCallData: "0x38ed17390000000000000000000000000000000000000000000000000000000bb6c179cc" /* Data Payload */
}
});
Alternatively, you can develop your contract call logic with Hardhat, Truffle, Brownie, or Foundry, and send the transaction via Fireblocks. See this article for more information.
Just to add to what @alec mentioned, I also strongly recommend to check out our web3 provider:
If you’re working with web3.js or ethers.js - integrating with Fireblocks would be seamless using this tool.
If your stack is not in js/ts, you might also want to check out our local json RPC provider (last section of the guide from the above).
Also, we have abstracted the minting and burning operations in our API, so if you want to mint an ERC20 token via our API and you have the token listed in your workspace, you can simply call the create transaction API with operation: “MINT”
(the calling wallet should have minting permissions on the token).
yup that’s the one i was looking for and also familiar