kopia lustrzana https://github.com/bugout-dev/moonstream
canonical_name -> name.
rodzic
2e515f6328
commit
6e6b077ca0
|
@ -145,7 +145,7 @@ The endpoint returns a JSON object with the following structure:
|
||||||
{
|
{
|
||||||
"1": {
|
"1": {
|
||||||
"chain_id": "1",
|
"chain_id": "1",
|
||||||
"canonical_name": "ethereum",
|
"name": "ethereum",
|
||||||
"image_url": "https://example.com/eth.png",
|
"image_url": "https://example.com/eth.png",
|
||||||
"balances": {
|
"balances": {
|
||||||
"0x0000000000000000000000000000000000000000": "1000000000000000000",
|
"0x0000000000000000000000000000000000000000": "1000000000000000000",
|
||||||
|
@ -155,7 +155,7 @@ The endpoint returns a JSON object with the following structure:
|
||||||
},
|
},
|
||||||
"137": {
|
"137": {
|
||||||
"chain_id": "137",
|
"chain_id": "137",
|
||||||
"canonical_name": "polygon",
|
"name": "polygon",
|
||||||
"image_url": "https://example.com/matic.png",
|
"image_url": "https://example.com/matic.png",
|
||||||
"balances": {
|
"balances": {
|
||||||
"0x0000000000000000000000000000000000000000": "4000000000000000000",
|
"0x0000000000000000000000000000000000000000": "4000000000000000000",
|
||||||
|
@ -170,7 +170,7 @@ Where:
|
||||||
- The top-level keys are chain IDs (e.g. "1" for Ethereum, "137" for Polygon)
|
- The top-level keys are chain IDs (e.g. "1" for Ethereum, "137" for Polygon)
|
||||||
- Each chain object contains:
|
- Each chain object contains:
|
||||||
- `chain_id`: The chain identifier as a string
|
- `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
|
- `image_url`: URL to the chain's logo/image
|
||||||
- `balances`: Map of token addresses to their balances
|
- `balances`: Map of token addresses to their balances
|
||||||
- Native token (ETH, MATIC etc) is represented by the zero address: `0x0000000000000000000000000000000000000000`
|
- Native token (ETH, MATIC etc) is represented by the zero address: `0x0000000000000000000000000000000000000000`
|
||||||
|
|
|
@ -23,10 +23,10 @@ type TokenBalance struct {
|
||||||
type ChainBalances map[string]string
|
type ChainBalances map[string]string
|
||||||
|
|
||||||
type ChainInfo struct {
|
type ChainInfo struct {
|
||||||
ChainID string `json:"chain_id"`
|
ChainID string `json:"chain_id"`
|
||||||
CanonicalName string `json:"canonical_name"`
|
Name string `json:"name"`
|
||||||
ImageURL string `json:"image_url"`
|
ImageURL string `json:"image_url"`
|
||||||
Balances ChainBalances `json:"balances"`
|
Balances ChainBalances `json:"balances"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map of blockchain -> token balances
|
// Map of blockchain -> token balances
|
||||||
|
@ -200,10 +200,10 @@ func getBalances(ctx context.Context, address string) (BalancesResponse, error)
|
||||||
}
|
}
|
||||||
if len(result.balances) > 0 {
|
if len(result.balances) > 0 {
|
||||||
response[contractsConfig[result.blockchain].ChainID] = ChainInfo{
|
response[contractsConfig[result.blockchain].ChainID] = ChainInfo{
|
||||||
ChainID: contractsConfig[result.blockchain].ChainID,
|
ChainID: contractsConfig[result.blockchain].ChainID,
|
||||||
CanonicalName: result.blockchain,
|
Name: result.blockchain,
|
||||||
ImageURL: contractsConfig[result.blockchain].ImageURL,
|
ImageURL: contractsConfig[result.blockchain].ImageURL,
|
||||||
Balances: result.balances,
|
Balances: result.balances,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue