UNPKG

@0xobedient/memetus-pumpfun-sdk

Version:
147 lines 4.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MemetusPumpfun = void 0; const endpoint_1 = require("../shared/constants/endpoint"); const query_1 = require("../shared/utils/query"); class MemetusPumpfun { constructor() { } async fetchRecentTokens(params) { try { let query = (0, query_1.toQueryString)(params); const response = await fetch(endpoint_1.BASE_ENDPOINT + endpoint_1.RECENTS + query); return (await response.json()); } catch (error) { throw error; } } async fetchOldestTokens(params) { try { let query = (0, query_1.toQueryString)(params); const response = await fetch(endpoint_1.BASE_ENDPOINT + endpoint_1.OLDESTS + query); return (await response.json()); } catch (error) { throw error; } } async fetchTokenByAddress(mint) { try { const response = await fetch(endpoint_1.BASE_ENDPOINT + endpoint_1.MINT_ADDRESS + mint); return (await response.json()); } catch (error) { throw error; } } async fetchTokenByCreator(account) { try { const response = await fetch(endpoint_1.BASE_ENDPOINT + endpoint_1.CREATOR_ADDRESS + account); return (await response.json()); } catch (error) { throw error; } } async fetchTokenByInitializer(account) { try { const response = await fetch(endpoint_1.BASE_ENDPOINT + endpoint_1.INITIALIZER_ADDRESS + account); return (await response.json()); } catch (error) { throw error; } } async fetchTokenBySignature(signature) { try { const response = await fetch(endpoint_1.BASE_ENDPOINT + endpoint_1.SIGNATURE + signature); return (await response.json()); } catch (error) { throw error; } } async fetchTokensByMetadata(params) { try { let query = (0, query_1.toQueryString)(params); const response = await fetch(endpoint_1.BASE_ENDPOINT + endpoint_1.METADATA + query); return (await response.json()); } catch (error) { throw error; } } async fetchTokensByDuration(params) { try { let query = (0, query_1.toQueryString)(params); const response = await fetch(endpoint_1.BASE_ENDPOINT + endpoint_1.DURATION + query); return (await response.json()); } catch (error) { throw error; } } async fetchTokensByMarketCap(params) { try { let query = (0, query_1.toQueryString)(params); const response = await fetch(endpoint_1.BASE_ENDPOINT + endpoint_1.MARKET_CAP + query); return (await response.json()); } catch (error) { throw error; } } async fetchTokensByAddresses(addresses) { try { const response = await fetch(endpoint_1.BASE_ENDPOINT + endpoint_1.MINTS, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ addresses, }), }); return (await response.json()); } catch (error) { throw error; } } async fetchTokensByCreators(params) { try { const response = await fetch(endpoint_1.BASE_ENDPOINT + endpoint_1.CREATORS, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ ...params, }), }); return (await response.json()); } catch (error) { throw error; } } async fetchTokensByInitializers(params) { try { const response = await fetch(endpoint_1.INITIALIZERS, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ ...params, }), }); return (await response.json()); } catch (error) { throw error; } } } exports.MemetusPumpfun = MemetusPumpfun; //# sourceMappingURL=MemetusPumpfun.js.map