Link a contract
Link an a contract
const response: Promise<FireblocksResponse<TokenLinkDto>> = fireblocks.tokenization.link(tokenizationApiLinkRequest);CompletableFuture<ApiResponse<TokenLinkDto>> response = fireblocks.tokenization().link(tokenLinkRequestDto, idempotencyKey);response = fireblocks.tokenization.link(token_link_request_dto, idempotency_key);curl --request POST \
--url https://api.fireblocks.io/v1/tokenization/tokens/link \
--header 'Content-Type: application/json' \
--data '
{
"refId": "USDC_ETH_TEST3_1XF5",
"displayName": "My Simple ERC20 Token",
"baseAssetId": "ETH_TEST3",
"contractAddress": "0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
refId: 'USDC_ETH_TEST3_1XF5',
displayName: 'My Simple ERC20 Token',
baseAssetId: 'ETH_TEST3',
contractAddress: '0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66'
})
};
fetch('https://api.fireblocks.io/v1/tokenization/tokens/link', 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/tokens/link",
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([
'refId' => 'USDC_ETH_TEST3_1XF5',
'displayName' => 'My Simple ERC20 Token',
'baseAssetId' => 'ETH_TEST3',
'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/tokens/link"
payload := strings.NewReader("{\n \"refId\": \"USDC_ETH_TEST3_1XF5\",\n \"displayName\": \"My Simple ERC20 Token\",\n \"baseAssetId\": \"ETH_TEST3\",\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/tokens/link")
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 \"refId\": \"USDC_ETH_TEST3_1XF5\",\n \"displayName\": \"My Simple ERC20 Token\",\n \"baseAssetId\": \"ETH_TEST3\",\n \"contractAddress\": \"0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66\"\n}"
response = http.request(request)
puts response.read_body{
"id": "fbfbfbfb-fbfb-fbfb-fbfb-fbfbfbfbfbfb",
"status": "COMPLETED",
"type": "NON_FUNGIBLE_TOKEN",
"refId": "BQ5R_MY_TOKEN",
"displayName": "My Simple ERC20 Token",
"tokenMetadata": {
"assetId": "BQ5R_MY_TOKEN",
"name": "MyToken",
"symbol": "MYT",
"networkProtocol": "ETH",
"totalSupply": "1000000000000000",
"holdersCount": "6",
"type": "ERC20",
"contractAddress": "0x1234567890abcdef1234567890abcdef12345678",
"issuerAddress": "rGyXjc5d7s17vvt3NtKKascvJrnSxV21kQ",
"testnet": true,
"blockchain": "ETH_TEST5",
"decimals": 18,
"vaultAccountId": "0"
}
}{
"id": "fbfbfbfb-fbfb-fbfb-fbfb-fbfbfbfbfbfb",
"status": "COMPLETED",
"type": "NON_FUNGIBLE_TOKEN",
"refId": "BQ5R_MY_TOKEN",
"displayName": "My Simple ERC20 Token",
"tokenMetadata": {
"assetId": "BQ5R_MY_TOKEN",
"name": "MyToken",
"symbol": "MYT",
"networkProtocol": "ETH",
"totalSupply": "1000000000000000",
"holdersCount": "6",
"type": "ERC20",
"contractAddress": "0x1234567890abcdef1234567890abcdef12345678",
"issuerAddress": "rGyXjc5d7s17vvt3NtKKascvJrnSxV21kQ",
"testnet": true,
"blockchain": "ETH_TEST5",
"decimals": 18,
"vaultAccountId": "0"
}
}{
"statusCode": 409,
"message": "<string>",
"error": "Conflict"
}{
"message": "<string>",
"code": 123
}Headers
A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours.
Body
The type of token being linked
FUNGIBLE_TOKEN, NON_FUNGIBLE_TOKEN, TOKEN_UTILITY, TOKEN_EXTENSION The Fireblocks' token link reference id. For example, 'BQ5R_BDESC_ABC' if it's a fungible asset
"USDC_ETH_TEST3_1XF5"
The token display name
"My Simple ERC20 Token"
The blockchain base assetId
"ETH_TEST3"
The contract's onchain address
"0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66"
Response
Token linked successfully
The token link id
"fbfbfbfb-fbfb-fbfb-fbfb-fbfbfbfbfbfb"
The token status
PENDING, COMPLETED "COMPLETED"
The type of token
FUNGIBLE_TOKEN, NON_FUNGIBLE_TOKEN, TOKEN_UTILITY, TOKEN_EXTENSION "NON_FUNGIBLE_TOKEN"
The Fireblocks' reference id
"BQ5R_MY_TOKEN"
The token display name. If was not provided, would be taken from the contract template
"My Simple ERC20 Token"
The token's metadata
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Was this page helpful?
const response: Promise<FireblocksResponse<TokenLinkDto>> = fireblocks.tokenization.link(tokenizationApiLinkRequest);CompletableFuture<ApiResponse<TokenLinkDto>> response = fireblocks.tokenization().link(tokenLinkRequestDto, idempotencyKey);response = fireblocks.tokenization.link(token_link_request_dto, idempotency_key);curl --request POST \
--url https://api.fireblocks.io/v1/tokenization/tokens/link \
--header 'Content-Type: application/json' \
--data '
{
"refId": "USDC_ETH_TEST3_1XF5",
"displayName": "My Simple ERC20 Token",
"baseAssetId": "ETH_TEST3",
"contractAddress": "0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
refId: 'USDC_ETH_TEST3_1XF5',
displayName: 'My Simple ERC20 Token',
baseAssetId: 'ETH_TEST3',
contractAddress: '0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66'
})
};
fetch('https://api.fireblocks.io/v1/tokenization/tokens/link', 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/tokens/link",
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([
'refId' => 'USDC_ETH_TEST3_1XF5',
'displayName' => 'My Simple ERC20 Token',
'baseAssetId' => 'ETH_TEST3',
'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/tokens/link"
payload := strings.NewReader("{\n \"refId\": \"USDC_ETH_TEST3_1XF5\",\n \"displayName\": \"My Simple ERC20 Token\",\n \"baseAssetId\": \"ETH_TEST3\",\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/tokens/link")
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 \"refId\": \"USDC_ETH_TEST3_1XF5\",\n \"displayName\": \"My Simple ERC20 Token\",\n \"baseAssetId\": \"ETH_TEST3\",\n \"contractAddress\": \"0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66\"\n}"
response = http.request(request)
puts response.read_body{
"id": "fbfbfbfb-fbfb-fbfb-fbfb-fbfbfbfbfbfb",
"status": "COMPLETED",
"type": "NON_FUNGIBLE_TOKEN",
"refId": "BQ5R_MY_TOKEN",
"displayName": "My Simple ERC20 Token",
"tokenMetadata": {
"assetId": "BQ5R_MY_TOKEN",
"name": "MyToken",
"symbol": "MYT",
"networkProtocol": "ETH",
"totalSupply": "1000000000000000",
"holdersCount": "6",
"type": "ERC20",
"contractAddress": "0x1234567890abcdef1234567890abcdef12345678",
"issuerAddress": "rGyXjc5d7s17vvt3NtKKascvJrnSxV21kQ",
"testnet": true,
"blockchain": "ETH_TEST5",
"decimals": 18,
"vaultAccountId": "0"
}
}{
"id": "fbfbfbfb-fbfb-fbfb-fbfb-fbfbfbfbfbfb",
"status": "COMPLETED",
"type": "NON_FUNGIBLE_TOKEN",
"refId": "BQ5R_MY_TOKEN",
"displayName": "My Simple ERC20 Token",
"tokenMetadata": {
"assetId": "BQ5R_MY_TOKEN",
"name": "MyToken",
"symbol": "MYT",
"networkProtocol": "ETH",
"totalSupply": "1000000000000000",
"holdersCount": "6",
"type": "ERC20",
"contractAddress": "0x1234567890abcdef1234567890abcdef12345678",
"issuerAddress": "rGyXjc5d7s17vvt3NtKKascvJrnSxV21kQ",
"testnet": true,
"blockchain": "ETH_TEST5",
"decimals": 18,
"vaultAccountId": "0"
}
}{
"statusCode": 409,
"message": "<string>",
"error": "Conflict"
}{
"message": "<string>",
"code": 123
}