@raydium-io/raydium-sdk-v2 0.1.35-alpha → 0.1.37-alpha
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/lib/api/api.js +1 -1
- package/lib/api/api.js.map +1 -1
- package/lib/api/api.mjs +1 -1
- package/lib/api/api.mjs.map +1 -1
- package/lib/api/index.js +1 -1
- package/lib/api/index.js.map +1 -1
- package/lib/api/index.mjs +1 -1
- package/lib/api/index.mjs.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/raydium/index.js +1 -1
- package/lib/raydium/index.js.map +1 -1
- package/lib/raydium/index.mjs +1 -1
- package/lib/raydium/index.mjs.map +1 -1
- package/lib/raydium/raydium.js +1 -1
- package/lib/raydium/raydium.js.map +1 -1
- package/lib/raydium/raydium.mjs +1 -1
- package/lib/raydium/raydium.mjs.map +1 -1
- package/lib/raydium/token/token.js.map +1 -1
- package/lib/raydium/token/token.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/api.ts +3 -3
- package/src/raydium/raydium.ts +31 -17
- package/src/raydium/token/token.ts +0 -2
package/package.json
CHANGED
package/src/api/api.ts
CHANGED
|
@@ -169,7 +169,7 @@ export class Api {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
async getJupTokenList(type?: JupTokenType): Promise<ApiV3Token[]> {
|
|
172
|
-
return this.api.get("
|
|
172
|
+
return this.api.get("", {
|
|
173
173
|
baseURL: (this.urlConfigs.JUP_TOKEN_LIST || API_URLS.JUP_TOKEN_LIST).replace("{type}", type || JupTokenType.ALL),
|
|
174
174
|
});
|
|
175
175
|
}
|
|
@@ -185,7 +185,7 @@ export class Api {
|
|
|
185
185
|
const { type = "all", sort = "liquidity", order = "desc", page = 0, pageSize = 100 } = props;
|
|
186
186
|
const res = await this.api.get<PoolsApiReturn>(
|
|
187
187
|
(this.urlConfigs.POOL_LIST || API_URLS.POOL_LIST) +
|
|
188
|
-
|
|
188
|
+
`?poolType=${type}&poolSortField=${sort}&sortType=${order}&page=${page}&pageSize=${pageSize}`,
|
|
189
189
|
);
|
|
190
190
|
return res.data;
|
|
191
191
|
}
|
|
@@ -246,7 +246,7 @@ export class Api {
|
|
|
246
246
|
|
|
247
247
|
const res = await this.api.get(
|
|
248
248
|
(this.urlConfigs.POOL_SEARCH_MINT || API_URLS.POOL_SEARCH_MINT) +
|
|
249
|
-
|
|
249
|
+
`?mint1=${baseMint}&mint2=${quoteMint}&poolType=${type}&poolSortField=${sort}&sortType=${order}&pageSize=100&page=${page}`,
|
|
250
250
|
);
|
|
251
251
|
return res.data;
|
|
252
252
|
}
|
package/src/raydium/raydium.ts
CHANGED
|
@@ -238,29 +238,43 @@ export class Raydium {
|
|
|
238
238
|
public async fetchV3TokenList(forceUpdate?: boolean): Promise<ApiV3TokenRes> {
|
|
239
239
|
if (this.apiData.tokenList && !this.isCacheInvalidate(this.apiData.tokenList.fetched) && !forceUpdate)
|
|
240
240
|
return this.apiData.tokenList.data;
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
241
|
+
try {
|
|
242
|
+
const raydiumList = await this.api.getTokenList();
|
|
243
|
+
const dataObject = {
|
|
244
|
+
fetched: Date.now(),
|
|
245
|
+
data: raydiumList,
|
|
246
|
+
};
|
|
247
|
+
this.apiData.tokenList = dataObject;
|
|
248
|
+
|
|
249
|
+
return dataObject.data;
|
|
250
|
+
} catch (e) {
|
|
251
|
+
console.error(e);
|
|
252
|
+
return {
|
|
253
|
+
mintList: [],
|
|
254
|
+
blacklist: [],
|
|
255
|
+
whiteList: [],
|
|
256
|
+
};
|
|
257
|
+
}
|
|
249
258
|
}
|
|
250
259
|
|
|
251
260
|
public async fetchJupTokenList(type: JupTokenType, forceUpdate?: boolean): Promise<ApiV3Token[]> {
|
|
252
261
|
const prevFetched = this.apiData.jupTokenList?.[type];
|
|
253
262
|
if (prevFetched && !this.isCacheInvalidate(prevFetched.fetched) && !forceUpdate) return prevFetched.data;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
263
|
+
try {
|
|
264
|
+
const jupList = await this.api.getJupTokenList(type);
|
|
265
|
+
this.apiData.jupTokenList = {
|
|
266
|
+
...this.apiData.jupTokenList,
|
|
267
|
+
[type]: {
|
|
268
|
+
fetched: Date.now(),
|
|
269
|
+
data: jupList,
|
|
270
|
+
},
|
|
271
|
+
};
|
|
262
272
|
|
|
263
|
-
|
|
273
|
+
return this.apiData.jupTokenList[type]!.data;
|
|
274
|
+
} catch (e) {
|
|
275
|
+
console.error(e);
|
|
276
|
+
return [];
|
|
277
|
+
}
|
|
264
278
|
}
|
|
265
279
|
|
|
266
280
|
get chainTimeData(): { offset: number; chainTime: number } | undefined {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
|
2
2
|
import { MintLayout, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID } from "@solana/spl-token";
|
|
3
3
|
|
|
4
|
-
import { Price, Token } from "@/module";
|
|
5
|
-
import { validateAndParsePublicKey, SOLMint } from "@/common/pubKey";
|
|
6
4
|
import { ApiV3Token, JupTokenType } from "@/api/type";
|
|
7
5
|
import ModuleBase, { ModuleBaseProps } from "../moduleBase";
|
|
8
6
|
import { LoadParams } from "../type";
|