@codex-data/sdk 1.0.23 → 1.0.25
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.
- package/dist/resources/graphql.d.ts +33 -5
- package/dist/resources/graphql.d.ts.map +1 -1
- package/dist/resources/graphql.js +2 -0
- package/dist/resources/graphql.js.map +1 -1
- package/dist/sdk/Mutation.d.ts +2 -2
- package/dist/sdk/Mutation.d.ts.map +1 -1
- package/dist/sdk/Mutation.js +2 -2
- package/dist/sdk/Mutation.js.map +1 -1
- package/dist/sdk/Query.d.ts +48 -48
- package/dist/sdk/Query.d.ts.map +1 -1
- package/dist/sdk/Query.js +48 -48
- package/dist/sdk/Query.js.map +1 -1
- package/dist/sdk/Subscribe.d.ts +17 -17
- package/dist/sdk/Subscribe.d.ts.map +1 -1
- package/dist/sdk/Subscribe.js +82 -82
- package/dist/sdk/Subscribe.js.map +1 -1
- package/dist/sdk/generated/graphql.d.ts +33 -5
- package/dist/sdk/generated/graphql.d.ts.map +1 -1
- package/dist/sdk/generated/graphql.js +2 -0
- package/dist/sdk/generated/graphql.js.map +1 -1
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +1 -0
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/index.test.js +18 -0
- package/dist/sdk/index.test.js.map +1 -1
- package/package.json +1 -1
- package/src/resources/graphql.schema.json +171 -5
- package/src/resources/graphql.ts +33 -5
- package/src/resources/schema.graphql +33 -5
- package/src/sdk/Mutation.ts +5 -5
- package/src/sdk/Query.ts +103 -103
- package/src/sdk/Subscribe.ts +165 -165
- package/src/sdk/generated/graphql.ts +33 -5
- package/src/sdk/index.test.ts +25 -0
- package/src/sdk/index.ts +4 -0
|
@@ -1034,6 +1034,8 @@ export type EnhancedToken = {
|
|
|
1034
1034
|
name?: Maybe<Scalars['String']['output']>;
|
|
1035
1035
|
/** The network ID the token is deployed on. */
|
|
1036
1036
|
networkId: Scalars['Int']['output'];
|
|
1037
|
+
/** The pair that the token is contained in */
|
|
1038
|
+
pairId?: Maybe<Scalars['String']['output']>;
|
|
1037
1039
|
/**
|
|
1038
1040
|
* The amount of this token in the pair.
|
|
1039
1041
|
* @deprecated Pooled can be found on the pair instead
|
|
@@ -1624,6 +1626,8 @@ export type HoldersResponse = {
|
|
|
1624
1626
|
items: Array<Balance>;
|
|
1625
1627
|
/** Status of holder. Disabled if on unsupported network or there is insufficient holder data. */
|
|
1626
1628
|
status: HoldersStatus;
|
|
1629
|
+
/** the token Id */
|
|
1630
|
+
tokenId?: Maybe<Scalars['String']['output']>;
|
|
1627
1631
|
/** What percentage of the total supply do the top 10 holders hold. */
|
|
1628
1632
|
top10HoldersPercent?: Maybe<Scalars['Float']['output']>;
|
|
1629
1633
|
};
|
|
@@ -1954,6 +1958,8 @@ export enum LaunchpadTokenProtocol {
|
|
|
1954
1958
|
EgoTech = 'EgoTech',
|
|
1955
1959
|
/** Protocol name for Four.meme. */
|
|
1956
1960
|
FourMeme = 'FourMeme',
|
|
1961
|
+
/** Protocol name for Heaven. */
|
|
1962
|
+
HeavenAmm = 'HeavenAMM',
|
|
1957
1963
|
/** Protocol name for MeteoraDBC. */
|
|
1958
1964
|
MeteoraDbc = 'MeteoraDBC',
|
|
1959
1965
|
/** Protocol name for Moonit (formerly Moonshot). */
|
|
@@ -5059,9 +5065,9 @@ export type OnEventsCreatedByMakerInput = {
|
|
|
5059
5065
|
export type OnLaunchpadTokenEventBatchInput = {
|
|
5060
5066
|
/** The type of event. */
|
|
5061
5067
|
eventType?: InputMaybe<LaunchpadTokenEventType>;
|
|
5062
|
-
/** 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. */
|
|
5068
|
+
/** 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. */
|
|
5063
5069
|
launchpadName?: InputMaybe<Scalars['String']['input']>;
|
|
5064
|
-
/** 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. */
|
|
5070
|
+
/** 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. */
|
|
5065
5071
|
launchpadNames?: InputMaybe<Array<Scalars['String']['input']>>;
|
|
5066
5072
|
/** The network ID that the token is deployed on. */
|
|
5067
5073
|
networkId?: InputMaybe<Scalars['Int']['input']>;
|
|
@@ -5077,9 +5083,9 @@ export type OnLaunchpadTokenEventInput = {
|
|
|
5077
5083
|
address?: InputMaybe<Scalars['String']['input']>;
|
|
5078
5084
|
/** The type of event. */
|
|
5079
5085
|
eventType?: InputMaybe<LaunchpadTokenEventType>;
|
|
5080
|
-
/** 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. */
|
|
5086
|
+
/** 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. */
|
|
5081
5087
|
launchpadName?: InputMaybe<Scalars['String']['input']>;
|
|
5082
|
-
/** 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. */
|
|
5088
|
+
/** 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. */
|
|
5083
5089
|
launchpadNames?: InputMaybe<Array<Scalars['String']['input']>>;
|
|
5084
5090
|
/** The network ID that the token is deployed on. */
|
|
5085
5091
|
networkId?: InputMaybe<Scalars['Int']['input']>;
|
|
@@ -7949,6 +7955,8 @@ export type TokenFilterResult = {
|
|
|
7949
7955
|
liquidPair?: Maybe<Pair>;
|
|
7950
7956
|
/** The liquidity of the token's most liquid pair */
|
|
7951
7957
|
liquidPairLiquidity?: Maybe<Scalars['String']['output']>;
|
|
7958
|
+
/** The liquid pairs price in USD. */
|
|
7959
|
+
liquidPairPriceUSD?: Maybe<Scalars['String']['output']>;
|
|
7952
7960
|
/** Amount of liquidity in the token's top pair. */
|
|
7953
7961
|
liquidity?: Maybe<Scalars['String']['output']>;
|
|
7954
7962
|
/** The lowest price in USD in the past hour. */
|
|
@@ -8139,7 +8147,7 @@ export type TokenFilters = {
|
|
|
8139
8147
|
launchpadMigrated?: InputMaybe<Scalars['Boolean']['input']>;
|
|
8140
8148
|
/** The timestamp when the launchpad was migrated */
|
|
8141
8149
|
launchpadMigratedAt?: InputMaybe<NumberFilter>;
|
|
8142
|
-
/** 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. */
|
|
8150
|
+
/** 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. */
|
|
8143
8151
|
launchpadName?: InputMaybe<Array<Scalars['String']['input']>>;
|
|
8144
8152
|
/** A list of launchpad protocols. */
|
|
8145
8153
|
launchpadProtocol?: InputMaybe<Array<Scalars['String']['input']>>;
|
|
@@ -8558,14 +8566,24 @@ export type TokenSparkline = {
|
|
|
8558
8566
|
attribute?: Maybe<SparklineAttribute>;
|
|
8559
8567
|
/** The token id */
|
|
8560
8568
|
id: Scalars['String']['output'];
|
|
8569
|
+
/** The timeframe of the sparkline. */
|
|
8570
|
+
resolution: Scalars['String']['output'];
|
|
8561
8571
|
/** List of sparkline values to chart */
|
|
8562
8572
|
sparkline: Array<SparklineValue>;
|
|
8563
8573
|
};
|
|
8564
8574
|
|
|
8565
8575
|
/** Input type of `tokenSparkline`. */
|
|
8566
8576
|
export type TokenSparklineInput = {
|
|
8577
|
+
/** Whether to add empty bars to the response, populated with the previous bar's value. Default is `false` */
|
|
8578
|
+
fillMissingBars?: InputMaybe<Scalars['Boolean']['input']>;
|
|
8579
|
+
/** The unix timestamp for the start of the requested range. Defaults to 1 week ago. */
|
|
8580
|
+
from?: InputMaybe<Scalars['Int']['input']>;
|
|
8567
8581
|
/** The contract address & networkId of the token, joined by a colon. ex: 0xbe042e9d09cb588331ff911c2b46fd833a3e5bd6:1 */
|
|
8568
8582
|
ids: Array<Scalars['String']['input']>;
|
|
8583
|
+
/** The time frame for each candle. Available options are `1S`, `5S`, `15S`, `30S`, `1`, `5`, `15`, `30`, `60`, `240`, `720`, `1D`, `7D`. Defaults to `60` (1 hour) */
|
|
8584
|
+
resolution?: InputMaybe<Scalars['String']['input']>;
|
|
8585
|
+
/** The unix timestamp for the end of the requested range. Defaults to current time. */
|
|
8586
|
+
to?: InputMaybe<Scalars['Int']['input']>;
|
|
8569
8587
|
};
|
|
8570
8588
|
|
|
8571
8589
|
/** A top trader for a token. */
|
|
@@ -8929,16 +8947,26 @@ export type UnconfirmedResolutionBarData = {
|
|
|
8929
8947
|
__typename?: 'UnconfirmedResolutionBarData';
|
|
8930
8948
|
/** 1 minute resolution. */
|
|
8931
8949
|
r1?: Maybe<UnconfirmedIndividualBarData>;
|
|
8950
|
+
/** 1 day resolution. */
|
|
8951
|
+
r1D?: Maybe<UnconfirmedIndividualBarData>;
|
|
8932
8952
|
/** 1 second resolution. */
|
|
8933
8953
|
r1S?: Maybe<UnconfirmedIndividualBarData>;
|
|
8934
8954
|
/** 5 minute resolution. */
|
|
8935
8955
|
r5?: Maybe<UnconfirmedIndividualBarData>;
|
|
8936
8956
|
/** 5 second resolution. */
|
|
8937
8957
|
r5S?: Maybe<UnconfirmedIndividualBarData>;
|
|
8958
|
+
/** 1 week resolution. */
|
|
8959
|
+
r7D?: Maybe<UnconfirmedIndividualBarData>;
|
|
8938
8960
|
/** 15 minute resolution. */
|
|
8939
8961
|
r15?: Maybe<UnconfirmedIndividualBarData>;
|
|
8940
8962
|
/** 15 second resolution. */
|
|
8941
8963
|
r15S?: Maybe<UnconfirmedIndividualBarData>;
|
|
8964
|
+
/** 60 minute resolution. */
|
|
8965
|
+
r60?: Maybe<UnconfirmedIndividualBarData>;
|
|
8966
|
+
/** 4 hour resolution. */
|
|
8967
|
+
r240?: Maybe<UnconfirmedIndividualBarData>;
|
|
8968
|
+
/** 12 hour resolution. */
|
|
8969
|
+
r720?: Maybe<UnconfirmedIndividualBarData>;
|
|
8942
8970
|
};
|
|
8943
8971
|
|
|
8944
8972
|
/** Event data for a token swap event. */
|
package/src/sdk/index.test.ts
CHANGED
|
@@ -230,6 +230,31 @@ describe("Codex", () => {
|
|
|
230
230
|
});
|
|
231
231
|
});
|
|
232
232
|
|
|
233
|
+
describe("fetch override", () => {
|
|
234
|
+
it("should use the fetch override", async () => {
|
|
235
|
+
const fetchMock = jest.fn((input, init) => {
|
|
236
|
+
console.log("fetchMock", input, init);
|
|
237
|
+
return Promise.resolve(
|
|
238
|
+
new Response(
|
|
239
|
+
JSON.stringify({
|
|
240
|
+
data: { getNetworks: [] },
|
|
241
|
+
}),
|
|
242
|
+
{
|
|
243
|
+
status: 200,
|
|
244
|
+
headers: new Headers({
|
|
245
|
+
"Content-Type": "application/json",
|
|
246
|
+
}),
|
|
247
|
+
},
|
|
248
|
+
),
|
|
249
|
+
);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
const sdkWithFetch = new Codex("test-key", { fetch: fetchMock });
|
|
253
|
+
await sdkWithFetch.query(getNetworksDocument, {});
|
|
254
|
+
expect(fetchMock).toHaveBeenCalled();
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
|
|
233
258
|
describe("dispose", () => {
|
|
234
259
|
it("should dispose websocket client when it exists", async () => {
|
|
235
260
|
const mockDispose = jest.fn();
|
package/src/sdk/index.ts
CHANGED
|
@@ -33,6 +33,9 @@ export type ApiConfig = {
|
|
|
33
33
|
|
|
34
34
|
// Use this to apply dynamic headers to the requests
|
|
35
35
|
applyHeaders?: () => Promise<Record<string, string>>;
|
|
36
|
+
|
|
37
|
+
// Use this to override the default fetch implementation.
|
|
38
|
+
fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
36
39
|
};
|
|
37
40
|
|
|
38
41
|
const defaultConfig: ApiConfig = {
|
|
@@ -83,6 +86,7 @@ export class Codex {
|
|
|
83
86
|
"X-Apollo-Operation-Name": "query",
|
|
84
87
|
...config.headers,
|
|
85
88
|
}),
|
|
89
|
+
fetch: config.fetch,
|
|
86
90
|
});
|
|
87
91
|
}
|
|
88
92
|
|