@@ -143,22 +143,38 @@ The endpoint returns a JSON object with the following structure:
143143
144144``` json
145145{
146- "ethereum" : {
147- "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" : " 1000000000000000000" ,
148- "0x6B175474E89094C44Da98b954EedeAC495271d0F" : " 2000000000000000000" ,
149- "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" : " 3000000000000000"
150- },
151- "polygon" : {
152- "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270" : " 4000000000000000000" ,
153- "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" : " 5000000000000000" ,
154- "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063" : " 6000000000000000000"
155- }
146+ "1" : {
147+ "chain_id" : " 1" ,
148+ "canonical_name" : " ethereum" ,
149+ "image_url" : " https://example.com/eth.png" ,
150+ "balances" : {
151+ "0x0000000000000000000000000000000000000000" : " 1000000000000000000" ,
152+ "0xdac17f958d2ee523a2206206994597c13d831ec7" : " 2000000000000000000" ,
153+ "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" : " 3000000000000000"
154+ }
155+ },
156+ "137" : {
157+ "chain_id" : " 137" ,
158+ "canonical_name" : " polygon" ,
159+ "image_url" : " https://example.com/matic.png" ,
160+ "balances" : {
161+ "0x0000000000000000000000000000000000000000" : " 4000000000000000000" ,
162+ "0x2791bca1f2de4661ed88a30c99a7a9449aa84174" : " 5000000000000000" ,
163+ "0xc2132d05d31c914a87c6611c10748aeb04b58e8f" : " 6000000000000000000"
164+ }
165+ }
156166}
157167```
158168
159169Where:
160- - Each blockchain object maps token contract addresses to their respective balances
161- - All balances are returned as strings in the token's smallest unit (e.g., wei for ETH)
170+ - The top-level keys are chain IDs (e.g. "1" for Ethereum, "137" for Polygon)
171+ - Each chain object contains:
172+ - ` chain_id ` : The chain identifier as a string
173+ - ` canonical_name ` : The human-readable name of the chain
174+ - ` image_url ` : URL to the chain's logo/image
175+ - ` balances ` : Map of token addresses to their balances
176+ - Native token (ETH, MATIC etc) is represented by the zero address: ` 0x0000000000000000000000000000000000000000 `
177+ - All balances are returned as strings in the token's smallest unit (e.g., wei for ETH)
162178
163179### Features
164180
@@ -172,27 +188,43 @@ Where:
172188curl " http://localhost:8080/balances?address=0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
173189```
174190
175- ### Contracts Config
191+ ### Contracts Config Structure
192+
193+ The ` contracts.json ` file should follow this structure:
194+
176195``` json
177196{
178- "ethereum" : {
179- "multicall3" : " 0xcA11bde05977b3631167028862bE2a173976CA11" ,
180- "tokens" : {
181- "WETH" : " 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" ,
182- "DAI" : " 0x6B175474E89094C44Da98b954EedeAC495271d0F" ,
183- "USDC" : " 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" ,
184- "USDT" : " 0xdAC17F958D2ee523a2206206994597C13D831ec7"
185- }
186- },
187- "polygon" : {
188- "multicall3" : " 0xcA11bde05977b3631167028862bE2a173976CA11" ,
189- "tokens" : {
190- "WMATIC" : " 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270" ,
191- "USDC" : " 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" ,
192- "DAI" : " 0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063" ,
193- "WETH" : " 0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619" ,
194- "USDT" : " 0xc2132D05D31c914a87C6611C10748AEb04B58e8F"
195- }
197+ "ethereum" : {
198+ "multicall3" : " 0xcA11bde05977b3631167028862bE2a173976CA11" ,
199+ "chain_id" : " 1" ,
200+ "name" : " Ethereum" ,
201+ "image_url" : " https://example.com/eth.png" ,
202+ "native_token" : " ETH" ,
203+ "tokens" : {
204+ "0xdac17f958d2ee523a2206206994597c13d831ec7" : " USDT" ,
205+ "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" : " USDC"
206+ }
207+ },
208+ "polygon" : {
209+ "multicall3" : " 0xcA11bde05977b3631167028862bE2a173976CA11" ,
210+ "chain_id" : " 137" ,
211+ "name" : " Polygon" ,
212+ "image_url" : " https://example.com/matic.png" ,
213+ "native_token" : " MATIC" ,
214+ "tokens" : {
215+ "0x2791bca1f2de4661ed88a30c99a7a9449aa84174" : " USDC" ,
216+ "0xc2132d05d31c914a87c6611c10748aeb04b58e8f" : " USDT"
196217 }
218+ }
197219}
198220```
221+
222+ Where:
223+ - Top-level keys are blockchain identifiers used internally
224+ - Each chain configuration contains:
225+ - ` multicall3 ` : Address of the Multicall3 contract on that chain
226+ - ` chain_id ` : The chain identifier (e.g. "1" for Ethereum)
227+ - ` name ` : Human-readable name of the chain
228+ - ` image_url ` : URL to the chain's logo/image
229+ - ` native_token ` : Symbol for the chain's native token (ETH, MATIC etc)
230+ - ` tokens ` : Map of token addresses to their symbols
0 commit comments