canonical_name -> name.

pull/1170/head
Andrey 2025-02-05 18:50:23 +02:00
rodzic 2e515f6328
commit 6e6b077ca0
2 zmienionych plików z 11 dodań i 11 usunięć

Wyświetl plik

@ -145,7 +145,7 @@ The endpoint returns a JSON object with the following structure:
{
"1": {
"chain_id": "1",
"canonical_name": "ethereum",
"name": "ethereum",
"image_url": "https://example.com/eth.png",
"balances": {
"0x0000000000000000000000000000000000000000": "1000000000000000000",
@ -155,7 +155,7 @@ The endpoint returns a JSON object with the following structure:
},
"137": {
"chain_id": "137",
"canonical_name": "polygon",
"name": "polygon",
"image_url": "https://example.com/matic.png",
"balances": {
"0x0000000000000000000000000000000000000000": "4000000000000000000",
@ -170,7 +170,7 @@ Where:
- The top-level keys are chain IDs (e.g. "1" for Ethereum, "137" for Polygon)
- Each chain object contains:
- `chain_id`: The chain identifier as a string
- `canonical_name`: The human-readable name of the chain
- `name`: The human-readable name of the chain
- `image_url`: URL to the chain's logo/image
- `balances`: Map of token addresses to their balances
- Native token (ETH, MATIC etc) is represented by the zero address: `0x0000000000000000000000000000000000000000`

Wyświetl plik

@ -23,10 +23,10 @@ type TokenBalance struct {
type ChainBalances map[string]string
type ChainInfo struct {
ChainID string `json:"chain_id"`
CanonicalName string `json:"canonical_name"`
ImageURL string `json:"image_url"`
Balances ChainBalances `json:"balances"`
ChainID string `json:"chain_id"`
Name string `json:"name"`
ImageURL string `json:"image_url"`
Balances ChainBalances `json:"balances"`
}
// Map of blockchain -> token balances
@ -200,10 +200,10 @@ func getBalances(ctx context.Context, address string) (BalancesResponse, error)
}
if len(result.balances) > 0 {
response[contractsConfig[result.blockchain].ChainID] = ChainInfo{
ChainID: contractsConfig[result.blockchain].ChainID,
CanonicalName: result.blockchain,
ImageURL: contractsConfig[result.blockchain].ImageURL,
Balances: result.balances,
ChainID: contractsConfig[result.blockchain].ChainID,
Name: result.blockchain,
ImageURL: contractsConfig[result.blockchain].ImageURL,
Balances: result.balances,
}
}
}