-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbalances.json
More file actions
544 lines (544 loc) · 18.6 KB
/
balances.json
File metadata and controls
544 lines (544 loc) · 18.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
{
"openapi": "3.0.3",
"info": {
"title": "Sim API - Balances Endpoint",
"description": "This API provides realtime token balances for addresses across different EVM chains.",
"license": {
"name": ""
},
"version": "0.1.0"
},
"servers": [
{
"url": "https://api.sim.dune.com"
}
],
"paths": {
"/v1/evm/balances/{address}": {
"get": {
"tags": [
"balances"
],
"summary": "Get EVM token balances for a given address",
"description": "This endpoint returns EVM token balances for an address for any token that the address has interacted with",
"operationId": "getEvmBalances",
"parameters": [
{
"name": "X-Sim-Api-Key",
"in": "header",
"description": "Used for authenticating requests. Provide an API key with a purpose of `Sim API`. See [Authentication](/#authentication).",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "address",
"in": "path",
"description": "Wallet address to get balances for",
"required": true,
"schema": {
"type": "string",
"default": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
}
},
{
"name": "chain_ids",
"in": "query",
"required": false,
"description": "Filter by chain(s). Accepts numeric chain IDs and/or tags. Provide a single value (e.g. `?chain_ids=1` or `?chain_ids=mainnet`) or a comma-separated list (e.g. `?chain_ids=1,8543,testnet`). Chain names are not accepted. If this query parameter is omitted, results include balances from chains with the `default` tag. See the [Supported Chains Tags](/evm/supported-chains#tags) section.",
"schema": {
"type": "string"
}
},
{
"name": "filters",
"in": "query",
"description": "Specify `erc20` or `native` to get only ERC20 tokens or native assets, respectively",
"required": false,
"schema": {
"type": "string",
"enum": ["erc20", "native"]
}
},
{
"name": "metadata",
"in": "query",
"description": "A comma separated list of additional metadata fields to include for each token. Supported values: `logo`, `url`, `pools`",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "exclude_spam_tokens",
"in": "query",
"description": "When true, excludes tokens with less than 100 USD liquidity from the response. This differs from the `low_liquidity` field in the response.",
"required": false,
"schema": {
"type": "boolean",
"default": false
}
},
{
"name": "historical_prices",
"in": "query",
"description": "Historical price selection. Provide a single integer or a comma-separated list of up to 3 integers representing hours in the past (e.g. `168` for 1 week ago or `720,168,24` for 1 month, 1 week, and 1 day ago). When set, each balance includes a historical_prices array with one entry per offset.",
"required": false,
"schema": {
"type": "string"
},
"examples": {
"single_offset": {
"summary": "Single offset (1 week ago)",
"value": "168"
},
"three_offsets": {
"summary": "Three offsets (1 month, 1 week, 1 day ago)",
"value": "720,168,24"
}
}
},
{
"name": "offset",
"in": "query",
"description": "The offset to paginate through result sets. This is a cursor being passed from the previous response, only use what the backend returns here.",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "limit",
"in": "query",
"description": "Maximum number of balances to return. Default is 1000 when not provided. Values above 1000 are reduced to 1000.",
"required": false,
"schema": {
"type": "integer",
"format": "int32",
"minimum": 1,
"maximum": 1000,
"default": 1000
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BalancesResponse"
},
"examples": {
"success": {
"value": {
"wallet_address": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"balances": [
{
"chain": "ethereum",
"chain_id": 1,
"address": "0x0e36c45d16585d1801e37cfaa577a9ad39f9343a",
"amount": "45787557175393926414790300082",
"symbol": "Kendu",
"name": "Kendu of Bank",
"decimals": 18,
"price_usd": 1.233346836175539e+21,
"value_usd": 5.647193877847869e+31,
"pool_size": 1233.34683617554,
"low_liquidity": true
},
{
"chain": "ethereum",
"chain_id": 1,
"address": "0x113404d2003c4acf4231a3a62374bb503bff03d7",
"amount": "432599243131405501735524",
"symbol": "ALT",
"name": "AltLayer",
"decimals": 18,
"price_usd": 9.38838601200003e+18,
"value_usd": 4.061408683016688e+24,
"pool_size": 9.38838601200001,
"low_liquidity": true
}
],
"next_offset": "opaque-pagination-token",
"request_time": "2025-08-13T10:31:08Z",
"response_time": "2025-08-13T10:31:08Z"
}
}
}
}
}
},
"400": {
"description": "Bad Request. The request could not be understood by the server due to malformed data"
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error. A generic error occurred on the server."
}
}
}
},
"/v1/evm/balances/{address}/token/{token_address}": {
"get": {
"tags": ["balances"],
"summary": "Get a single token balance for a given address",
"description": "Returns the balance for a specific token (or native asset) for a wallet on a single specified chain. This sub-endpoint reuses the Balances response format.",
"operationId": "getEvmSingleTokenBalance",
"parameters": [
{
"name": "X-Sim-Api-Key",
"in": "header",
"description": "Used for authenticating requests. Provide an API key with a purpose of `Sim API`. See [Authentication](/#authentication).",
"required": true,
"schema": { "type": "string" }
},
{
"name": "address",
"in": "path",
"description": "Wallet address to get the token balance for",
"required": true,
"schema": { "type": "string", "default": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" }
},
{
"name": "token_address",
"in": "path",
"description": "Token contract address or `native` for the chain's native asset",
"required": true,
"schema": { "type": "string" }
},
{
"name": "chain_ids",
"in": "query",
"required": true,
"description": "Filter by chain(s). Accepts numeric chain IDs and/or tags. Provide a single value (e.g. `?chain_ids=1`) or a comma-separated list (e.g. `?chain_ids=1,8543,testnet`). Chain names are not accepted. If omitted, results include balances from chains with the \"default\" tag for the address. See the [Supported Chains Tags](/evm/supported-chains#tags) section.",
"schema": { "type": "string" }
},
{
"name": "metadata",
"in": "query",
"description": "A comma separated list of additional metadata fields to include for each token. Supported values: `logo`, `url`, `pools`",
"required": false,
"schema": { "type": "string" }
},
{
"name": "historical_prices",
"in": "query",
"description": "Historical price selection. Provide a single integer or a comma-separated list of up to 3 integers representing hours in the past (e.g. `168` for 1 week ago or `720,168,24` for 1 month, 1 week, and 1 day ago). When set, each balance includes a historical_prices array with one entry per offset.",
"required": false,
"schema": { "type": "string" },
"examples": {
"single_offset": { "summary": "Single offset (1 week ago)", "value": "168" },
"three_offsets": { "summary": "Three offsets (1 month, 1 week, 1 day ago)", "value": "720,168,24" }
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/SingleBalanceResponse" },
"examples": {
"success": {
"value": {
"request_time": "2025-10-07T13:18:14.789152386+00:00",
"response_time": "2025-10-07T13:18:14.850098525+00:00",
"wallet_address": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"balances": [
{
"chain": "ethereum",
"chain_id": 1,
"address": "0x146523e8db6337291243a63a5555f446fa6c279f",
"amount": "7156868995423049840501842481",
"symbol": "AiMeme",
"name": "Ai Meme",
"decimals": 18,
"price_usd": 129086.448055109,
"value_usd": 923854797814899,
"pool_size": 9.09741149400001,
"low_liquidity": true
}
]
}
}
}
}
}
},
"400": { "description": "Bad Request. The request could not be understood by the server due to malformed data" },
"404": { "description": "Not Found" },
"500": { "description": "Internal Server Error. A generic error occurred on the server." }
}
}
}
},
"components": {
"schemas": {
"HistoricalPricePoint": {
"type": "object",
"required": [
"offset_hours",
"price_usd"
],
"properties": {
"offset_hours": {
"type": "integer",
"format": "int32",
"minimum": 1
},
"price_usd": {
"type": "number",
"format": "double"
}
}
},
"PoolMetadata": {
"type": "object",
"required": [
"pool_type",
"address",
"token0",
"token1"
],
"properties": {
"pool_type": {
"type": "string",
"description": "The type of liquidity pool used for pricing (e.g., aerodrome_stable, uniswap_v2, uniswap_v3)"
},
"address": {
"type": "string",
"description": "The contract address of the liquidity pool"
},
"token0": {
"type": "string",
"description": "The contract address of the first token in the pool pair"
},
"token1": {
"type": "string",
"description": "The contract address of the second token in the pool pair"
}
}
},
"BalanceData": {
"type": "object",
"required": [
"chain",
"address",
"amount"
],
"properties": {
"address": {
"type": "string"
},
"amount": {
"type": "string"
},
"chain": {
"type": "string"
},
"chain_id": {
"type": "integer",
"format": "int64"
},
"decimals": {
"type": "integer",
"format": "int64"
},
"low_liquidity": {
"type": "boolean"
},
"name": {
"type": "string"
},
"pool_size": {
"type": "number",
"format": "double"
},
"price_usd": {
"type": "number",
"format": "double"
},
"historical_prices": {
"type": "array",
"items": {
"$ref": "#/components/schemas/HistoricalPricePoint"
},
"description": "Historical price points for the requested offsets. Only present when the historical_prices query parameter is provided."
},
"symbol": {
"type": "string"
},
"token_metadata": {
"type": "object",
"properties": {
"logo": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"pool": {
"allOf": [
{
"$ref": "#/components/schemas/PoolMetadata"
}
],
"description": "Liquidity pool information used for token pricing. Only present when metadata=pools is specified."
},
"value_usd": {
"type": "number",
"format": "double"
}
}
},
"BalanceErrorInformation": {
"type": "object",
"required": [
"chain_id",
"address"
],
"properties": {
"address": {
"type": "string"
},
"chain_id": {
"type": "integer",
"format": "int64"
},
"description": {
"type": "string"
}
}
},
"BalanceErrors": {
"type": "object",
"properties": {
"error_message": {
"type": "string"
},
"token_errors": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BalanceErrorInformation"
}
}
}
},
"Warning": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "string",
"description": "Warning code identifier",
"example": "UNSUPPORTED_CHAIN_IDS"
},
"message": {
"type": "string",
"description": "Human-readable warning message",
"example": "Some requested chain_ids are not supported. Balances are returned only for supported chains."
},
"chain_ids": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": "List of chain IDs that triggered this warning"
},
"docs_url": {
"type": "string",
"description": "URL to relevant documentation",
"example": "https://docs.sim.dune.com/evm/supported-chains"
}
}
},
"BalancesResponse": {
"type": "object",
"required": [
"wallet_address",
"balances"
],
"properties": {
"balances": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BalanceData"
}
},
"errors": {
"allOf": [
{
"$ref": "#/components/schemas/BalanceErrors"
}
]
},
"warnings": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Warning"
},
"description": "Array of warnings about the request. For example, warnings about unsupported chain IDs."
},
"next_offset": {
"type": "string",
"description": "Use this value as the `offset` in your next request to continue pagination. Not included when there are no more balances."
},
"request_time": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the request was received."
},
"response_time": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the response was generated."
},
"wallet_address": {
"type": "string",
"example": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
}
}
},
"SingleBalanceResponse": {
"type": "object",
"required": [
"wallet_address",
"balances"
],
"properties": {
"balances": {
"type": "array",
"items": { "$ref": "#/components/schemas/BalanceData" }
},
"warnings": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Warning"
},
"description": "Array of warnings about the request. For example, warnings about unsupported chain IDs."
},
"request_time": { "type": "string", "format": "date-time" },
"response_time": { "type": "string", "format": "date-time" },
"wallet_address": { "type": "string", "example": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045" }
}
}
}
},
"tags": [
{
"name": "balances",
"description": "Balances API"
}
]
}