|
| 1 | +using System.Numerics; |
| 2 | +using Newtonsoft.Json; |
| 3 | +using Newtonsoft.Json.Linq; |
| 4 | + |
| 5 | +namespace Thirdweb.Indexer; |
| 6 | + |
| 7 | +/// <summary> |
| 8 | +/// Represents the response model wrapping the result of an API call. |
| 9 | +/// </summary> |
| 10 | +/// <typeparam name="T">The type of the result.</typeparam> |
| 11 | +internal class ResponseModel<T> |
| 12 | +{ |
| 13 | + /// <summary> |
| 14 | + /// The result returned by the API. |
| 15 | + /// </summary> |
| 16 | + [JsonProperty("data")] |
| 17 | + internal T[] Data { get; set; } |
| 18 | + |
| 19 | + [JsonProperty("aggregations")] |
| 20 | + public object Aggregations { get; set; } = null!; |
| 21 | + |
| 22 | + [JsonProperty("meta")] |
| 23 | + public Meta Meta { get; set; } = null!; |
| 24 | +} |
| 25 | + |
| 26 | +public class Token |
| 27 | +{ |
| 28 | + [JsonProperty("chainId", Required = Required.Always)] |
| 29 | + public BigInteger ChainId { get; set; } |
| 30 | + |
| 31 | + [JsonProperty("balance", Required = Required.Always)] |
| 32 | + public BigInteger Balance { get; set; } |
| 33 | + |
| 34 | + [JsonProperty("tokenAddress", Required = Required.Always)] |
| 35 | + public string TokenAddress { get; set; } |
| 36 | +} |
| 37 | + |
| 38 | +public class Token_ERC20 : Token { } |
| 39 | + |
| 40 | +public class Token_ERC721 : Token { } |
| 41 | + |
| 42 | +public class Token_ERC1155 : Token |
| 43 | +{ |
| 44 | + [JsonProperty("tokenId", Required = Required.Always)] |
| 45 | + public BigInteger TokenId { get; set; } |
| 46 | +} |
| 47 | + |
| 48 | +public class Event |
| 49 | +{ |
| 50 | + [JsonProperty("chain_id")] |
| 51 | + public BigInteger ChainId { get; set; } |
| 52 | + |
| 53 | + [JsonProperty("block_number")] |
| 54 | + public string BlockNumber { get; set; } = null!; |
| 55 | + |
| 56 | + [JsonProperty("block_hash")] |
| 57 | + public string BlockHash { get; set; } = null!; |
| 58 | + |
| 59 | + [JsonProperty("block_timestamp")] |
| 60 | + public string BlockTimestamp { get; set; } = null!; |
| 61 | + |
| 62 | + [JsonProperty("transaction_hash")] |
| 63 | + public string TransactionHash { get; set; } = null!; |
| 64 | + |
| 65 | + [JsonProperty("transaction_index")] |
| 66 | + public BigInteger TransactionIndex { get; set; } |
| 67 | + |
| 68 | + [JsonProperty("log_index")] |
| 69 | + public BigInteger LogIndex { get; set; } |
| 70 | + |
| 71 | + [JsonProperty("address")] |
| 72 | + public string Address { get; set; } = null!; |
| 73 | + |
| 74 | + [JsonProperty("data")] |
| 75 | + public string Data { get; set; } = null!; |
| 76 | + |
| 77 | + [JsonProperty("topics")] |
| 78 | + public List<string> Topics { get; set; } = new(); |
| 79 | + |
| 80 | + [JsonProperty("decoded")] |
| 81 | + public Decoded Decoded { get; set; } = null!; |
| 82 | +} |
| 83 | + |
| 84 | +public class Decoded |
| 85 | +{ |
| 86 | + [JsonProperty("name")] |
| 87 | + public string Name { get; set; } = null!; |
| 88 | + |
| 89 | + [JsonProperty("signature")] |
| 90 | + public string Signature { get; set; } = null!; |
| 91 | + |
| 92 | + [JsonProperty("indexedParams")] |
| 93 | + public JObject IndexedParams { get; set; } = new(); |
| 94 | + |
| 95 | + [JsonProperty("nonIndexedParams")] |
| 96 | + public JObject NonIndexedParams { get; set; } = new(); |
| 97 | +} |
| 98 | + |
| 99 | +public class Meta |
| 100 | +{ |
| 101 | + [JsonProperty("chain_ids", Required = Required.Always)] |
| 102 | + public List<BigInteger> ChainIds { get; set; } = new(); |
| 103 | + |
| 104 | + [JsonProperty("address")] |
| 105 | + public string Address { get; set; } |
| 106 | + |
| 107 | + [JsonProperty("signature")] |
| 108 | + public string Signature { get; set; } |
| 109 | + |
| 110 | + [JsonProperty("page", Required = Required.Always)] |
| 111 | + public BigInteger Page { get; set; } |
| 112 | + |
| 113 | + [JsonProperty("limit_per_chain", Required = Required.Always)] |
| 114 | + public BigInteger LimitPerChain { get; set; } |
| 115 | + |
| 116 | + [JsonProperty("total_items", Required = Required.Always)] |
| 117 | + public BigInteger TotalItems { get; set; } |
| 118 | + |
| 119 | + [JsonProperty("total_pages", Required = Required.Always)] |
| 120 | + public BigInteger TotalPages { get; set; } |
| 121 | +} |
0 commit comments