@codex-data/sdk 1.0.24 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,9 @@ type Query {
25
25
  """limit: The maximum number of webhooks to return."""
26
26
  limit: Int
27
27
  ): GetWebhooksResponse
28
+ getNetworkConfigs(
29
+ networkIds: [Int!]
30
+ ): [NetworkConfig!]!
28
31
  """Returns an NFT pool."""
29
32
  getNftPool(
30
33
  """The contract address of the NFT pool."""
@@ -936,6 +939,27 @@ type ApiToken {
936
939
  remaining: String
937
940
  }
938
941
 
942
+ type AptosNetworkConfig {
943
+ id: ID!
944
+ networkId: Int!
945
+ baseTokenAddress: String!
946
+ baseTokenSymbol: String!
947
+ color: String
948
+ defaultPairAddress: String!
949
+ defaultPairQuoteToken: QuoteToken!
950
+ enabled: Boolean!
951
+ newTokensEnabled: Boolean
952
+ explorer: ExplorerConfig!
953
+ mainnet: Boolean!
954
+ name: String!
955
+ networkIconUrl: String!
956
+ networkName: String!
957
+ networkShortName: String!
958
+ networkType: NetworkConfigType!
959
+ stableCoinAddresses: [String!]
960
+ wrappedBaseTokenSymbol: String!
961
+ }
962
+
939
963
  type ArenaTradeData {
940
964
  """Protocol specific token ID"""
941
965
  tokenId: String
@@ -1949,6 +1973,27 @@ enum EventType {
1949
1973
  PoolBalanceChanged
1950
1974
  }
1951
1975
 
1976
+ type EvmNetworkConfig {
1977
+ id: ID!
1978
+ networkId: Int!
1979
+ baseTokenAddress: String!
1980
+ baseTokenSymbol: String!
1981
+ color: String
1982
+ defaultPairAddress: String!
1983
+ defaultPairQuoteToken: QuoteToken!
1984
+ enabled: Boolean!
1985
+ newTokensEnabled: Boolean
1986
+ explorer: ExplorerConfig!
1987
+ mainnet: Boolean!
1988
+ name: String!
1989
+ networkIconUrl: String!
1990
+ networkName: String!
1991
+ networkShortName: String!
1992
+ networkType: NetworkConfigType!
1993
+ stableCoinAddresses: [String!]
1994
+ wrappedBaseTokenSymbol: String!
1995
+ }
1996
+
1952
1997
  """Metadata for a decentralized exchange."""
1953
1998
  type Exchange {
1954
1999
  """The contract address of the exchange."""
@@ -2077,6 +2122,13 @@ enum ExchangeRankingAttribute {
2077
2122
  monthlyActiveUsers
2078
2123
  }
2079
2124
 
2125
+ type ExplorerConfig {
2126
+ checksummed: Boolean!
2127
+ icon: String!
2128
+ name: String!
2129
+ url: String!
2130
+ }
2131
+
2080
2132
  """Third party token data sourced from off chain."""
2081
2133
  type ExplorerTokenData {
2082
2134
  """The ID of the token (`address:networkId`)."""
@@ -2681,6 +2733,8 @@ enum LaunchpadTokenProtocol {
2681
2733
  Virtuals
2682
2734
  """Protocol name for Clanker."""
2683
2735
  Clanker
2736
+ """Protocol name for Heaven."""
2737
+ HeavenAMM
2684
2738
  }
2685
2739
 
2686
2740
  scalar link__Import
@@ -2966,6 +3020,37 @@ type NetworkBreakdown {
2966
3020
  statsYear1: WindowedWalletStats
2967
3021
  }
2968
3022
 
3023
+ union NetworkConfig = EvmNetworkConfig | SolanaNetworkConfig | SuiNetworkConfig | AptosNetworkConfig | StarknetNetworkConfig
3024
+
3025
+ interface NetworkConfigBase {
3026
+ id: ID!
3027
+ networkId: Int!
3028
+ baseTokenAddress: String!
3029
+ baseTokenSymbol: String!
3030
+ color: String
3031
+ defaultPairAddress: String!
3032
+ defaultPairQuoteToken: QuoteToken!
3033
+ enabled: Boolean!
3034
+ newTokensEnabled: Boolean
3035
+ explorer: ExplorerConfig!
3036
+ mainnet: Boolean!
3037
+ name: String!
3038
+ networkIconUrl: String!
3039
+ networkName: String!
3040
+ networkShortName: String!
3041
+ networkType: NetworkConfigType!
3042
+ wrappedBaseTokenSymbol: String!
3043
+ stableCoinAddresses: [String!]
3044
+ }
3045
+
3046
+ enum NetworkConfigType {
3047
+ SOLANA
3048
+ EVM
3049
+ SUI
3050
+ APTOS
3051
+ STARKNET
3052
+ }
3053
+
2969
3054
  """A connection of wallets matching a filter on a specific network."""
2970
3055
  type NetworkWalletFilterConnection {
2971
3056
  """The list of wallets matching the filter parameters."""
@@ -5599,9 +5684,9 @@ input OnLaunchpadTokenEventBatchInput {
5599
5684
  protocols: [LaunchpadTokenProtocol!]
5600
5685
  """The network ID that the token is deployed on."""
5601
5686
  networkId: Int
5602
- """The name of the launchpad. One of the following: Pump.fun, Bonk, Baseapp, Zora, Zora Creator, Four.meme, Believe, Moonshot, Jupiter Studio, boop, Virtuals, Clanker, ArenaTrade, Moonit, LaunchLab, MeteoraDBC, Vertigo, Cooking.City, time.fun, BAGS, Circus, Dealr, OhFuckFun, PrintFun, Trend, shout.fun, xApple, Sendshot, DubDub, cults."""
5687
+ """The name of the launchpad. One of the following: Pump.fun, Bonk, Baseapp, Zora, Zora Creator, Four.meme, Believe, Moonshot, Jupiter Studio, boop, Heaven, Virtuals, Clanker, ArenaTrade, Moonit, LaunchLab, MeteoraDBC, Vertigo, Cooking.City, time.fun, BAGS, Circus, Dealr, OhFuckFun, PrintFun, Trend, shout.fun, xApple, Sendshot, DubDub, cults."""
5603
5688
  launchpadName: String
5604
- """A list of launchpad names. Any of the following: Pump.fun, Bonk, Baseapp, Zora, Zora Creator, Four.meme, Believe, Moonshot, Jupiter Studio, boop, Virtuals, Clanker, ArenaTrade, Moonit, LaunchLab, MeteoraDBC, Vertigo, Cooking.City, time.fun, BAGS, Circus, Dealr, OhFuckFun, PrintFun, Trend, shout.fun, xApple, Sendshot, DubDub, cults."""
5689
+ """A list of launchpad names. Any of the following: Pump.fun, Bonk, Baseapp, Zora, Zora Creator, Four.meme, Believe, Moonshot, Jupiter Studio, boop, Heaven, Virtuals, Clanker, ArenaTrade, Moonit, LaunchLab, MeteoraDBC, Vertigo, Cooking.City, time.fun, BAGS, Circus, Dealr, OhFuckFun, PrintFun, Trend, shout.fun, xApple, Sendshot, DubDub, cults."""
5605
5690
  launchpadNames: [String!]
5606
5691
  """The type of event."""
5607
5692
  eventType: LaunchpadTokenEventType
@@ -5613,9 +5698,9 @@ input OnLaunchpadTokenEventInput {
5613
5698
  protocol: LaunchpadTokenProtocol
5614
5699
  """A list of launchpad protocols."""
5615
5700
  protocols: [LaunchpadTokenProtocol!]
5616
- """The name of the launchpad. One of the following: Pump.fun, Bonk, Baseapp, Zora, Zora Creator, Four.meme, Believe, Moonshot, Jupiter Studio, boop, Virtuals, Clanker, ArenaTrade, Moonit, LaunchLab, MeteoraDBC, Vertigo, Cooking.City, time.fun, BAGS, Circus, Dealr, OhFuckFun, PrintFun, Trend, shout.fun, xApple, Sendshot, DubDub, cults."""
5701
+ """The name of the launchpad. One of the following: Pump.fun, Bonk, Baseapp, Zora, Zora Creator, Four.meme, Believe, Moonshot, Jupiter Studio, boop, Heaven, Virtuals, Clanker, ArenaTrade, Moonit, LaunchLab, MeteoraDBC, Vertigo, Cooking.City, time.fun, BAGS, Circus, Dealr, OhFuckFun, PrintFun, Trend, shout.fun, xApple, Sendshot, DubDub, cults."""
5617
5702
  launchpadName: String
5618
- """A list of launchpad names. Any of the following: Pump.fun, Bonk, Baseapp, Zora, Zora Creator, Four.meme, Believe, Moonshot, Jupiter Studio, boop, Virtuals, Clanker, ArenaTrade, Moonit, LaunchLab, MeteoraDBC, Vertigo, Cooking.City, time.fun, BAGS, Circus, Dealr, OhFuckFun, PrintFun, Trend, shout.fun, xApple, Sendshot, DubDub, cults."""
5703
+ """A list of launchpad names. Any of the following: Pump.fun, Bonk, Baseapp, Zora, Zora Creator, Four.meme, Believe, Moonshot, Jupiter Studio, boop, Heaven, Virtuals, Clanker, ArenaTrade, Moonit, LaunchLab, MeteoraDBC, Vertigo, Cooking.City, time.fun, BAGS, Circus, Dealr, OhFuckFun, PrintFun, Trend, shout.fun, xApple, Sendshot, DubDub, cults."""
5619
5704
  launchpadNames: [String!]
5620
5705
  """The type of event."""
5621
5706
  eventType: LaunchpadTokenEventType
@@ -7220,6 +7305,27 @@ type SocialLinks {
7220
7305
  youtube: String
7221
7306
  }
7222
7307
 
7308
+ type SolanaNetworkConfig {
7309
+ id: ID!
7310
+ networkId: Int!
7311
+ baseTokenAddress: String!
7312
+ baseTokenSymbol: String!
7313
+ color: String
7314
+ defaultPairAddress: String!
7315
+ defaultPairQuoteToken: QuoteToken!
7316
+ enabled: Boolean!
7317
+ newTokensEnabled: Boolean
7318
+ explorer: ExplorerConfig!
7319
+ mainnet: Boolean!
7320
+ name: String!
7321
+ networkIconUrl: String!
7322
+ networkName: String!
7323
+ networkShortName: String!
7324
+ networkType: NetworkConfigType!
7325
+ stableCoinAddresses: [String!]
7326
+ wrappedBaseTokenSymbol: String!
7327
+ }
7328
+
7223
7329
  enum SparklineAttribute {
7224
7330
  PRICE
7225
7331
  }
@@ -7230,6 +7336,27 @@ type SparklineValue {
7230
7336
  value: Float!
7231
7337
  }
7232
7338
 
7339
+ type StarknetNetworkConfig {
7340
+ id: ID!
7341
+ networkId: Int!
7342
+ baseTokenAddress: String!
7343
+ baseTokenSymbol: String!
7344
+ color: String
7345
+ defaultPairAddress: String!
7346
+ defaultPairQuoteToken: QuoteToken!
7347
+ enabled: Boolean!
7348
+ newTokensEnabled: Boolean
7349
+ explorer: ExplorerConfig!
7350
+ mainnet: Boolean!
7351
+ name: String!
7352
+ networkIconUrl: String!
7353
+ networkName: String!
7354
+ networkShortName: String!
7355
+ networkType: NetworkConfigType!
7356
+ stableCoinAddresses: [String!]
7357
+ wrappedBaseTokenSymbol: String!
7358
+ }
7359
+
7233
7360
  """Currency stats."""
7234
7361
  input statsCurrency {
7235
7362
  """The volume over the time frame."""
@@ -7320,6 +7447,27 @@ input StringFilter {
7320
7447
  lt: String
7321
7448
  }
7322
7449
 
7450
+ type SuiNetworkConfig {
7451
+ id: ID!
7452
+ networkId: Int!
7453
+ baseTokenAddress: String!
7454
+ baseTokenSymbol: String!
7455
+ color: String
7456
+ defaultPairAddress: String!
7457
+ defaultPairQuoteToken: QuoteToken!
7458
+ enabled: Boolean!
7459
+ newTokensEnabled: Boolean
7460
+ explorer: ExplorerConfig!
7461
+ mainnet: Boolean!
7462
+ name: String!
7463
+ networkIconUrl: String!
7464
+ networkName: String!
7465
+ networkShortName: String!
7466
+ networkType: NetworkConfigType!
7467
+ stableCoinAddresses: [String!]
7468
+ wrappedBaseTokenSymbol: String!
7469
+ }
7470
+
7323
7471
  """Event data for a token swap event."""
7324
7472
  type SwapEventData {
7325
7473
  """The amount of `token0` involved in the swap. Only applicable for UniswapV3 events."""
@@ -7863,7 +8011,7 @@ input TokenFilters {
7863
8011
  creatorAddress: String
7864
8012
  """A list of launchpad protocols."""
7865
8013
  launchpadProtocol: [String!]
7866
- """A list of launchpad names. Any of the following: Pump.fun, Bonk, Baseapp, Zora, Zora Creator, Four.meme, Believe, Moonshot, Jupiter Studio, boop, Virtuals, Clanker, ArenaTrade, Moonit, LaunchLab, MeteoraDBC, Vertigo, Cooking.City, time.fun, BAGS, Circus, Dealr, OhFuckFun, PrintFun, Trend, shout.fun, xApple, Sendshot, DubDub, cults."""
8014
+ """A list of launchpad names. Any of the following: Pump.fun, Bonk, Baseapp, Zora, Zora Creator, Four.meme, Believe, Moonshot, Jupiter Studio, boop, Heaven, Virtuals, Clanker, ArenaTrade, Moonit, LaunchLab, MeteoraDBC, Vertigo, Cooking.City, time.fun, BAGS, Circus, Dealr, OhFuckFun, PrintFun, Trend, shout.fun, xApple, Sendshot, DubDub, cults."""
7867
8015
  launchpadName: [String!]
7868
8016
  """Indicates if the launchpad is completed"""
7869
8017
  launchpadCompleted: Boolean
@@ -0,0 +1,243 @@
1
+ import "dotenv/config";
2
+
3
+ import * as fs from "fs";
4
+ import { gql } from "graphql-tag";
5
+ import * as path from "path";
6
+
7
+ import { Codex } from "../sdk";
8
+
9
+ const apiKey = process.env.CODEX_API_KEY;
10
+
11
+ if (!apiKey) throw new Error("CODEX_API_KEY env variable not found");
12
+
13
+ const sdk = new Codex(apiKey);
14
+
15
+ const getNetworkConfigsQuery = gql`
16
+ query networkConfigs {
17
+ getNetworkConfigs {
18
+ ... on EvmNetworkConfig {
19
+ __typename
20
+ id
21
+ networkType
22
+ networkId
23
+ name
24
+ enabled
25
+ newTokensEnabled
26
+ mainnet
27
+ wrappedBaseTokenSymbol
28
+ baseTokenSymbol
29
+ baseTokenAddress
30
+ defaultPairAddress
31
+ defaultPairQuoteToken
32
+ stableCoinAddresses
33
+ networkIconUrl
34
+ color
35
+ networkShortName
36
+ networkName
37
+ explorer {
38
+ name
39
+ url
40
+ checksummed
41
+ icon
42
+ }
43
+ }
44
+ ... on SolanaNetworkConfig {
45
+ __typename
46
+ # --- Common fields
47
+ id
48
+ networkType
49
+ networkId
50
+ name
51
+ enabled
52
+ newTokensEnabled
53
+ mainnet
54
+ wrappedBaseTokenSymbol
55
+ baseTokenSymbol
56
+ baseTokenAddress
57
+ defaultPairAddress
58
+ defaultPairQuoteToken
59
+ stableCoinAddresses
60
+ networkIconUrl
61
+ color
62
+ networkShortName
63
+ networkName
64
+ explorer {
65
+ name
66
+ url
67
+ checksummed
68
+ icon
69
+ }
70
+ }
71
+ ... on SuiNetworkConfig {
72
+ __typename
73
+ # --- Common fields
74
+ id
75
+ networkType
76
+ networkId
77
+ name
78
+ enabled
79
+ newTokensEnabled
80
+ mainnet
81
+ wrappedBaseTokenSymbol
82
+ baseTokenSymbol
83
+ baseTokenAddress
84
+ defaultPairAddress
85
+ defaultPairQuoteToken
86
+ stableCoinAddresses
87
+ networkIconUrl
88
+ color
89
+ networkShortName
90
+ networkName
91
+ explorer {
92
+ name
93
+ url
94
+ checksummed
95
+ icon
96
+ }
97
+ }
98
+ ... on AptosNetworkConfig {
99
+ __typename
100
+ # --- Common fields
101
+ id
102
+ networkType
103
+ networkId
104
+ name
105
+ enabled
106
+ newTokensEnabled
107
+ mainnet
108
+ wrappedBaseTokenSymbol
109
+ baseTokenSymbol
110
+ baseTokenAddress
111
+ defaultPairAddress
112
+ defaultPairQuoteToken
113
+ stableCoinAddresses
114
+ networkIconUrl
115
+ color
116
+ networkShortName
117
+ networkName
118
+ explorer {
119
+ name
120
+ url
121
+ checksummed
122
+ icon
123
+ }
124
+ }
125
+ ... on StarknetNetworkConfig {
126
+ __typename
127
+ # --- Common fields
128
+ id
129
+ networkType
130
+ networkId
131
+ name
132
+ enabled
133
+ newTokensEnabled
134
+ mainnet
135
+ wrappedBaseTokenSymbol
136
+ baseTokenSymbol
137
+ baseTokenAddress
138
+ defaultPairAddress
139
+ defaultPairQuoteToken
140
+ stableCoinAddresses
141
+ networkIconUrl
142
+ color
143
+ networkShortName
144
+ networkName
145
+ explorer {
146
+ name
147
+ url
148
+ checksummed
149
+ icon
150
+ }
151
+ }
152
+ }
153
+ }
154
+ `;
155
+
156
+ const getTokensQuery = gql`
157
+ query getTokens($tokens: [String!]!) {
158
+ filterTokens(tokens: $tokens) {
159
+ results {
160
+ token {
161
+ name
162
+ id
163
+ decimals
164
+ }
165
+ }
166
+ }
167
+ }
168
+ `;
169
+
170
+ async function main() {
171
+ // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any
172
+ const data = await sdk.query<{ getNetworkConfigs: any }, {}>(
173
+ getNetworkConfigsQuery,
174
+ );
175
+ const networkConfigs = data.getNetworkConfigs;
176
+
177
+ // Get all base token addresses with their network IDs
178
+ const tokenIds: string[] = networkConfigs.map(
179
+ (config: { baseTokenAddress: string; networkId: number }) =>
180
+ `${config.baseTokenAddress}:${config.networkId}`,
181
+ );
182
+
183
+ // Fetch base token names
184
+ const tokenData = await sdk.query<
185
+ {
186
+ filterTokens: {
187
+ results: {
188
+ token: { id: string; name: string; decimals: number };
189
+ }[];
190
+ };
191
+ },
192
+ { tokens: string[] }
193
+ >(getTokensQuery, {
194
+ tokens: tokenIds,
195
+ });
196
+
197
+ // Create a map of address:networkId -> name
198
+ const tokenNameMap = new Map(
199
+ tokenData.filterTokens.results.map((result) => [
200
+ result.token.id,
201
+ result.token.name,
202
+ ]),
203
+ );
204
+ // Create a map of address:networkId -> decimals
205
+ const tokenDecimalsMap = new Map(
206
+ tokenData.filterTokens.results.map((result) => [
207
+ result.token.id,
208
+ result.token.decimals,
209
+ ]),
210
+ );
211
+
212
+ // Add baseTokenName to each network config
213
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
214
+ const enrichedConfigs = networkConfigs
215
+ .map((config: any) => ({
216
+ ...config,
217
+ baseTokenName:
218
+ tokenNameMap.get(`${config.baseTokenAddress}:${config.networkId}`) ||
219
+ config.baseTokenSymbol,
220
+ baseTokenDecimals:
221
+ tokenDecimalsMap.get(
222
+ `${config.baseTokenAddress}:${config.networkId}`,
223
+ ) || config.baseTokenDecimals,
224
+ }))
225
+ .sort((a: { name: string }, b: { name: string }) =>
226
+ a.name.localeCompare(b.name),
227
+ );
228
+ console.log(
229
+ `Fetched ${networkConfigs.length} network configs, writing them to generated files`,
230
+ );
231
+
232
+ const filePath = path.resolve(__dirname, "../resources/networkConfigs.json");
233
+
234
+ // Ensure the directory exists
235
+ const dirPath = path.dirname(filePath);
236
+ if (!fs.existsSync(dirPath)) {
237
+ fs.mkdirSync(dirPath, { recursive: true });
238
+ }
239
+
240
+ fs.writeFileSync(filePath, JSON.stringify(enrichedConfigs, null, 2));
241
+ }
242
+
243
+ main().catch(console.error);