Reuse an Existing Deployment
If you’ve already registered a contract deployment, you can look it up and reuse it for calling or querying methods without registering again. This guide shows how to search and retrieve deployments by various filters.
Prerequisites
Section titled “Prerequisites”Before you begin, ensure:
- The contract deployment was registered previously
- You know at least one of the following:
name
,contractAddress
, orabiId
Step 1: Search for Deployments
Section titled “Step 1: Search for Deployments”Endpoint
Section titled “Endpoint”GET /v2/contract/deployment
Example Query
Section titled “Example Query”GET /v2/contract/deployment?name=MyContract&chainId=137&isShared=true
Example Request
Section titled “Example Request”```bashcurl -X GET "https://api.fsco.io/v2/contract/deployment?name=MyContract&chainId=137&isShared=true" \ -H "Authorization: Bearer $FSCO_API_KEY"
import axios from 'axios';
const FSCO_API_KEY = process.env.FSCO_API_KEY;
const searchDeployments = async () => { const response = await axios.get( 'https://api.fsco.io/v2/contract/deployment?name=MyContract&chainId=137&isShared=true', { headers: { Authorization: `Bearer ${FSCO_API_KEY}` } } );
console.log('Deployments found:', response.data);};
searchDeployments();
import requestsimport os
FSCO_API_KEY = os.getenv("FSCO_API_KEY")
headers = {"Authorization": f"Bearer {FSCO_API_KEY}"}
response = requests.get( "https://api.fsco.io/v2/contract/deployment?name=MyContract&chainId=137&isShared=true", headers=headers,)
print("Deployments found:", response.json())
using System;using System.Net.Http;using System.Net.Http.Headers;using System.Threading.Tasks;
class Program{ static async Task Main() { var apiKey = Environment.GetEnvironmentVariable("FSCO_API_KEY");
var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
var response = await client.GetAsync("https://api.fsco.io/v2/contract/deployment?name=MyContract&chainId=137&isShared=true"); var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine("Deployments found: " + responseString); }}
Response
Section titled “Response”{ "response": [ { "deploymentId": "{{deploymentId}}", "chainId": 1234, "abiId": "{{abiId}}", "contractAddress": "{{contractAddress}}", "name": "{{name}}" } ], "page": { "limit": 10, "offset": 0, "total": 1 }}
The search supports filters including:
name
: Partial or full match on deployment namecontractAddress
: One or more addresseschainId
: CAIP-compatible numeric chain IDabiId
: One or more ABI UUIDsisShared
: Whether to filter for shared deployments
Step 2: Retrieve the Deployment
Section titled “Step 2: Retrieve the Deployment”Endpoint
Section titled “Endpoint”GET /v2/contract/deployment/{deploymentId}
Example Request
Section titled “Example Request”curl -X GET https://api.fsco.io/v2/contract/deployment/{{deploymentId}} \ -H "Authorization: Bearer $FSCO_API_KEY"
import axios from 'axios';
const FSCO_API_KEY = process.env.FSCO_API_KEY;
const getDeployment = async () => { const response = await axios.get( 'https://api.fsco.io/v2/contract/deployment/{{deploymentId}}', { headers: { Authorization: `Bearer ${FSCO_API_KEY}` } } );
console.log('Deployment details:', response.data);};
getDeployment();
import requestsimport os
FSCO_API_KEY = os.getenv("FSCO_API_KEY")
headers = {"Authorization": f"Bearer {FSCO_API_KEY}"}
response = requests.get( "https://api.fsco.io/v2/contract/deployment/{{deploymentId}}", headers=headers)
print("Deployment details:", response.json())
using System;using System.Net.Http;using System.Net.Http.Headers;using System.Threading.Tasks;
class Program{ static async Task Main() { var apiKey = Environment.GetEnvironmentVariable("FSCO_API_KEY");
var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
var response = await client.GetAsync("https://api.fsco.io/v2/contract/deployment/{{deploymentId}}"); var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine("Deployment details: " + responseString); }}
Response
Section titled “Response”{ "deploymentId": "{{deploymentId}}", "chainId": 137, "abiId": "{{abiId}}", "contractAddress": "{{contractAddress}}", "name": "{{name}}"}
This provides all metadata needed to execute or query methods against the deployment, including abiId
, chainId
, contractAddress
, and name
.
Step 3: Call or Query Methods
Section titled “Step 3: Call or Query Methods”Now that you have the deployment details, you can use them to call or query methods.