Fetch the contract ABI
Fetch the ABI. If not found fetch the ABI from the block explorer
POST
/
tokenization
/
contracts
/
fetch_abi
TypeScript
const response: Promise<FireblocksResponse<ContractWithAbiDto>> = fireblocks.deployedContracts.fetchContractAbi(deployedContractsApiFetchContractAbiRequest);CompletableFuture<ApiResponse<ContractWithAbiDto>> response = fireblocks.deployedContracts().fetchContractAbi(fetchAbiRequestDto, idempotencyKey);response = fireblocks.deployed_contracts.fetch_contract_abi(fetch_abi_request_dto, idempotency_key);curl --request POST \
--url https://api.fireblocks.io/v1/tokenization/contracts/fetch_abi \
--header 'Content-Type: application/json' \
--data '
{
"baseAssetId": "ETH",
"contractAddress": "0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
baseAssetId: 'ETH',
contractAddress: '0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66'
})
};
fetch('https://api.fireblocks.io/v1/tokenization/contracts/fetch_abi', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fireblocks.io/v1/tokenization/contracts/fetch_abi",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'baseAssetId' => 'ETH',
'contractAddress' => '0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fireblocks.io/v1/tokenization/contracts/fetch_abi"
payload := strings.NewReader("{\n \"baseAssetId\": \"ETH\",\n \"contractAddress\": \"0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.fireblocks.io/v1/tokenization/contracts/fetch_abi")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"baseAssetId\": \"ETH\",\n \"contractAddress\": \"0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66\"\n}"
response = http.request(request)
puts response.read_body{
"contractAddress": "0xfff9976782d46cc05630d1f6ebab18b2324d6b14",
"baseAssetId": "ETH_TEST6",
"name": "WETH9",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function",
"name": "mint"
}
],
"isPublic": true,
"isProxy": true,
"implementation": "0xfff9976782d46cc05630d1f6ebab18b2324d6b14"
}{
"message": "<string>",
"code": 123
}Headers
Body
application/json
Response
Contract ABI found.
Was this page helpful?
⌘I
TypeScript
const response: Promise<FireblocksResponse<ContractWithAbiDto>> = fireblocks.deployedContracts.fetchContractAbi(deployedContractsApiFetchContractAbiRequest);CompletableFuture<ApiResponse<ContractWithAbiDto>> response = fireblocks.deployedContracts().fetchContractAbi(fetchAbiRequestDto, idempotencyKey);response = fireblocks.deployed_contracts.fetch_contract_abi(fetch_abi_request_dto, idempotency_key);curl --request POST \
--url https://api.fireblocks.io/v1/tokenization/contracts/fetch_abi \
--header 'Content-Type: application/json' \
--data '
{
"baseAssetId": "ETH",
"contractAddress": "0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
baseAssetId: 'ETH',
contractAddress: '0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66'
})
};
fetch('https://api.fireblocks.io/v1/tokenization/contracts/fetch_abi', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fireblocks.io/v1/tokenization/contracts/fetch_abi",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'baseAssetId' => 'ETH',
'contractAddress' => '0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fireblocks.io/v1/tokenization/contracts/fetch_abi"
payload := strings.NewReader("{\n \"baseAssetId\": \"ETH\",\n \"contractAddress\": \"0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.fireblocks.io/v1/tokenization/contracts/fetch_abi")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"baseAssetId\": \"ETH\",\n \"contractAddress\": \"0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66\"\n}"
response = http.request(request)
puts response.read_body{
"contractAddress": "0xfff9976782d46cc05630d1f6ebab18b2324d6b14",
"baseAssetId": "ETH_TEST6",
"name": "WETH9",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function",
"name": "mint"
}
],
"isPublic": true,
"isProxy": true,
"implementation": "0xfff9976782d46cc05630d1f6ebab18b2324d6b14"
}{
"message": "<string>",
"code": 123
}