Reference Data
List Assets
List all supported assets and their network availability
GET
/
assets
List Assets
curl --request GET \
--url https://api.example.com/assetsimport requests
url = "https://api.example.com/assets"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/assets', 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.example.com/assets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/assets"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/assets")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/assets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyList Assets
Returns all assets supported by Legend, including their decimals and which networks they’re available on.Request
GET /assets
Examples
curl https://prime-api.legend.xyz/assets \
-H "Authorization: Bearer $LEGEND_QUERY_KEY"
const { assets } = await client.assets();
result = await client.assets()
assets = result["assets"]
let assets = client.assets().await?;
Response
{
"assets": {
"USDC": {
"name": "USD Coin",
"decimals": 6,
"networks": {
"mainnet": { "chain_id": 1, "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" },
"base": { "chain_id": 8453, "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913" },
"arbitrum": { "chain_id": 42161, "address": "0xaf88d065e77c8cc2239327c5edb3a432268e5831" }
}
},
"USDT": {
"name": "Tether",
"decimals": 6,
"networks": {
"mainnet": { "chain_id": 1, "address": "0xdac17f958d2ee523a2206206994597c13d831ec7" }
}
},
"WETH": {
"name": "Wrapped Ether",
"decimals": 18,
"networks": {
"mainnet": { "chain_id": 1, "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" },
"base": { "chain_id": 8453, "address": "0x4200000000000000000000000000000000000006" }
}
}
}
}
Response fields
| Field | Type | Description |
|---|---|---|
assets | object | Map of asset symbol to asset details |
assets[symbol].name | string | Human-readable asset name |
assets[symbol].decimals | integer | Number of decimal places (use to convert amounts) |
assets[symbol].networks | object | Map of network name to contract details |
assets[symbol].networks[network].chain_id | integer | EVM chain ID |
assets[symbol].networks[network].address | string | Token contract address on that network |
Notes
- Use the
decimalsfield to convert between human-readable amounts and API amounts. For example, 1 USDC =1000000(10^6) in API calls. - An asset is available for earn/withdraw/transfer on a network only if it appears in that asset’s
networksmap.
⌘I
List Assets
curl --request GET \
--url https://api.example.com/assetsimport requests
url = "https://api.example.com/assets"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/assets', 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.example.com/assets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/assets"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/assets")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/assets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body