@openpump/sdk 0.1.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/http.ts","../src/resources/wallets.ts","../src/resources/tokens.ts","../src/resources/trading.ts","../src/resources/jobs.ts","../src/resources/creator-fees.ts","../src/resources/bundles.ts","../src/client.ts"],"sourcesContent":["// Client\nexport { OpenPump } from './client.js';\nexport type { OpenPumpConfig } from './client.js';\n\n// Errors\nexport {\n OpenPumpError,\n AuthenticationError,\n RateLimitError,\n ValidationError,\n NotFoundError,\n InsufficientFundsError,\n TransactionError,\n} from './errors.js';\n\n// Resource types (re-export for consumer convenience)\nexport type {\n Wallets,\n CreateWalletOptions,\n WalletInfo,\n WalletBalance,\n DepositInstructions,\n TransferOptions,\n TransferResult,\n TransactionListOptions,\n TransactionListResult,\n} from './resources/wallets.js';\nexport type {\n Tokens,\n CreateTokenOptions,\n CreateTokenResult,\n TokenListItem,\n CurveState,\n} from './resources/tokens.js';\nexport type {\n Trading,\n BuyOptions,\n BuyResult,\n SellOptions,\n SellResult,\n QuoteOptions,\n QuoteResult,\n QuoteBuyCostOptions,\n QuoteBuyCostResult,\n BundleSellOptions,\n BundleSellResult,\n BundleSellEntry,\n PriorityLevel,\n} from './resources/trading.js';\nexport type { Jobs, JobStatus, PollOptions } from './resources/jobs.js';\nexport type {\n CreatorFees,\n AccumulatedFees,\n ClaimFeesResult,\n} from './resources/creator-fees.js';\nexport type {\n Bundles,\n BundleLaunchOptions,\n BundleLaunchResult,\n} from './resources/bundles.js';\n","/**\n * Base error class for all OpenPump SDK errors.\n * All API errors are converted to typed exceptions.\n */\nexport class OpenPumpError extends Error {\n override readonly name: string = 'OpenPumpError';\n\n constructor(\n public readonly code: string,\n message: string,\n public readonly status: number,\n public readonly details?: unknown,\n ) {\n super(message);\n // Maintain proper prototype chain for instanceof checks\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Thrown when the API key is invalid or missing (HTTP 401). */\nexport class AuthenticationError extends OpenPumpError {\n override readonly name = 'AuthenticationError';\n\n constructor(code: string, message: string, status: number, details?: unknown) {\n super(code, message, status, details);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Thrown when the rate limit is exceeded (HTTP 429). */\nexport class RateLimitError extends OpenPumpError {\n override readonly name = 'RateLimitError';\n\n constructor(code: string, message: string, status: number, details?: unknown) {\n super(code, message, status, details);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Thrown when request validation fails (HTTP 422). */\nexport class ValidationError extends OpenPumpError {\n override readonly name = 'ValidationError';\n\n constructor(code: string, message: string, status: number, details?: unknown) {\n super(code, message, status, details);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Thrown when the requested resource is not found (HTTP 404). */\nexport class NotFoundError extends OpenPumpError {\n override readonly name = 'NotFoundError';\n\n constructor(code: string, message: string, status: number, details?: unknown) {\n super(code, message, status, details);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Thrown when the wallet has insufficient SOL or tokens for an operation. */\nexport class InsufficientFundsError extends OpenPumpError {\n override readonly name = 'InsufficientFundsError';\n\n constructor(code: string, message: string, status: number, details?: unknown) {\n super(code, message, status, details);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Thrown when an on-chain transaction fails (signature error, simulation failure, etc.). */\nexport class TransactionError extends OpenPumpError {\n override readonly name = 'TransactionError';\n\n constructor(code: string, message: string, status: number, details?: unknown) {\n super(code, message, status, details);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n","import {\n OpenPumpError,\n AuthenticationError,\n RateLimitError,\n ValidationError,\n NotFoundError,\n} from './errors.js';\n\nexport interface HttpClientConfig {\n apiKey: string;\n baseUrl: string;\n timeout: number;\n}\n\nexport class HttpClient {\n private readonly _apiKey: string;\n private readonly _baseUrl: string;\n private readonly _timeout: number;\n\n constructor(config: HttpClientConfig) {\n this._apiKey = config.apiKey;\n // Strip trailing slash to normalise base URL\n this._baseUrl = config.baseUrl.replace(/\\/+$/, '');\n this._timeout = config.timeout;\n }\n\n async get<T>(path: string, query?: Record<string, string>): Promise<T> {\n let url = `${this._baseUrl}${path}`;\n if (query && Object.keys(query).length > 0) {\n const params = new URLSearchParams(query);\n url += `?${params.toString()}`;\n }\n const response = await fetch(url, {\n headers: this._headers(),\n signal: AbortSignal.timeout(this._timeout),\n });\n return this._handleResponse<T>(response);\n }\n\n async post<T>(path: string, body?: unknown): Promise<T> {\n const init: RequestInit = {\n method: 'POST',\n headers: {\n ...this._headers(),\n 'Content-Type': 'application/json',\n },\n signal: AbortSignal.timeout(this._timeout),\n };\n if (body !== undefined) {\n init.body = JSON.stringify(body);\n }\n const response = await fetch(`${this._baseUrl}${path}`, init);\n return this._handleResponse<T>(response);\n }\n\n async patch<T>(path: string, body: unknown): Promise<T> {\n const response = await fetch(`${this._baseUrl}${path}`, {\n method: 'PATCH',\n headers: {\n ...this._headers(),\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body),\n signal: AbortSignal.timeout(this._timeout),\n });\n return this._handleResponse<T>(response);\n }\n\n async delete<T>(path: string): Promise<T> {\n const response = await fetch(`${this._baseUrl}${path}`, {\n method: 'DELETE',\n headers: this._headers(),\n signal: AbortSignal.timeout(this._timeout),\n });\n return this._handleResponse<T>(response);\n }\n\n private _headers(): Record<string, string> {\n return { Authorization: `Bearer ${this._apiKey}` };\n }\n\n private async _handleResponse<T>(response: Response): Promise<T> {\n if (!response.ok) {\n await this._throwApiError(response);\n }\n const json = (await response.json()) as Record<string, unknown>;\n // API wraps responses in { data: T } -- unwrap if present\n if (json !== null && typeof json === 'object' && 'data' in json) {\n return json['data'] as T;\n }\n return json as T;\n }\n\n private async _throwApiError(response: Response): Promise<never> {\n let body: { error?: string; code?: string; message?: string; details?: unknown } = {};\n try {\n body = (await response.json()) as typeof body;\n } catch {\n // Non-JSON error body -- use status text\n }\n\n const code = body.code ?? body.error ?? 'UNKNOWN_ERROR';\n const message = body.message ?? response.statusText;\n const details = body.details;\n\n switch (response.status) {\n case 401: {\n throw new AuthenticationError(code, message, 401, details);\n }\n case 404: {\n throw new NotFoundError(code, message, 404, details);\n }\n case 422: {\n throw new ValidationError(code, message, 422, details);\n }\n case 429: {\n throw new RateLimitError(code, message, 429, details);\n }\n default: {\n throw new OpenPumpError(code, message, response.status, details);\n }\n }\n }\n}\n","import type { HttpClient } from '../http.js';\n\nexport interface CreateWalletOptions {\n label?: string;\n}\n\nexport interface WalletInfo {\n id: string;\n publicKey: string;\n walletIndex: number;\n label: string;\n createdAt: string;\n}\n\nexport interface WalletBalance {\n nativeSol: { lamports: string; sol: string };\n tokens: Array<{\n mint: string;\n symbol: string | null;\n amount: string;\n decimals: number;\n uiAmount: number;\n }>;\n}\n\nexport interface DepositInstructions {\n depositAddress: string;\n minimums: { tokenCreation: string; bundleBuy: string; standardBuy: string };\n instructions: string[];\n disclaimer: string;\n network: string;\n}\n\nexport interface TransferOptions {\n toAddress: string;\n amountLamports: string;\n mint?: string | null;\n memo?: string;\n priorityFeeMicroLamports?: number;\n}\n\nexport interface TransferResult {\n signature: string;\n amountLamports: string;\n fee: string;\n}\n\nexport interface TransactionListOptions {\n type?: 'buy' | 'sell' | 'transfer';\n limit?: number;\n offset?: number;\n}\n\nexport interface TransactionListResult {\n transactions: Array<Record<string, unknown>>;\n total: number;\n limit: number;\n offset: number;\n}\n\nexport class Wallets {\n constructor(private readonly _http: HttpClient) {}\n\n /** List all active wallets for the authenticated user. */\n async list(): Promise<WalletInfo[]> {\n return this._http.get<WalletInfo[]>('/api/wallets');\n }\n\n /** Create a new wallet with an optional label. */\n async create(options?: CreateWalletOptions): Promise<WalletInfo> {\n return this._http.post<WalletInfo>('/api/wallets', options ?? {});\n }\n\n /** Get a single wallet by ID. */\n async get(walletId: string): Promise<WalletInfo> {\n return this._http.get<WalletInfo>(`/api/wallets/${walletId}`);\n }\n\n /** Get SOL + token balances for a wallet. */\n async getBalance(walletId: string): Promise<WalletBalance> {\n return this._http.get<WalletBalance>(`/api/wallets/${walletId}/balance`);\n }\n\n /** Get deposit address and SOL minimums for a wallet. */\n async getDepositInstructions(walletId: string): Promise<DepositInstructions> {\n return this._http.get<DepositInstructions>(`/api/wallets/${walletId}/deposit-instructions`);\n }\n\n /** Force a live RPC balance refresh, bypassing the 30s cache. */\n async refreshBalance(walletId: string): Promise<WalletBalance> {\n return this._http.post<WalletBalance>(`/api/wallets/${walletId}/refresh-balance`);\n }\n\n /**\n * Execute an on-chain SOL or SPL token transfer.\n *\n * @example\n * ```ts\n * const result = await op.wallets.transfer('wallet-id', {\n * toAddress: 'recipient-public-key',\n * amountLamports: '100000000',\n * });\n * console.log(result.signature);\n * ```\n */\n async transfer(walletId: string, options: TransferOptions): Promise<TransferResult> {\n return this._http.post<TransferResult>(`/api/wallets/${walletId}/transfer`, options);\n }\n\n /** Get paginated transfer history for a wallet. */\n async getTransactions(\n walletId: string,\n options?: TransactionListOptions,\n ): Promise<TransactionListResult> {\n const query: Record<string, string> = {};\n if (options?.type !== undefined) query['type'] = options.type;\n if (options?.limit !== undefined) query['limit'] = String(options.limit);\n if (options?.offset !== undefined) query['offset'] = String(options.offset);\n return this._http.get<TransactionListResult>(`/api/wallets/${walletId}/transactions`, query);\n }\n}\n","import type { HttpClient } from '../http.js';\n\nexport interface CreateTokenOptions {\n walletIndex?: number;\n name: string;\n symbol: string;\n description: string;\n imageBase64: string;\n imageType: 'image/png' | 'image/jpeg' | 'image/jpg' | 'image/gif' | 'image/webp';\n initialBuyAmountSol?: number;\n twitter?: string;\n telegram?: string;\n website?: string;\n}\n\nexport interface CreateTokenResult {\n tokenId: string;\n mint: string;\n signature: string;\n metadataUri: string;\n bondingCurveAccount: string;\n}\n\nexport interface TokenListItem {\n id: string;\n mintAddress: string;\n name: string;\n symbol: string;\n graduationStatus: string;\n metadataUri: string;\n creatorAddress: string;\n createdAt: string;\n}\n\nexport interface CurveState {\n mint: string;\n virtualTokenReserves: string;\n virtualSolReserves: string;\n realTokenReserves: string;\n realSolReserves: string;\n tokenTotalSupply: string;\n complete: boolean;\n isMayhemMode: boolean;\n currentPriceSOL: number;\n marketCapSOL: number;\n graduationPercent: number;\n}\n\nexport class Tokens {\n constructor(private readonly _http: HttpClient) {}\n\n /** List tokens created by the authenticated user. */\n async list(): Promise<TokenListItem[]> {\n return this._http.get<TokenListItem[]>('/api/tokens');\n }\n\n /**\n * Create a new PumpFun token with IPFS metadata upload.\n *\n * @example\n * ```ts\n * const token = await op.tokens.create({\n * name: 'My Token',\n * symbol: 'MTK',\n * description: 'A cool token',\n * imageBase64: 'base64-encoded-image...',\n * imageType: 'image/png',\n * });\n * console.log(token.mint);\n * ```\n */\n async create(options: CreateTokenOptions): Promise<CreateTokenResult> {\n return this._http.post<CreateTokenResult>('/api/tokens/create', options);\n }\n\n /** Get market info for a token (mainnet only, returns null on devnet). */\n async getMarketInfo(mint: string): Promise<Record<string, unknown> | null> {\n return this._http.get<Record<string, unknown> | null>(`/api/tokens/${mint}/market-info`);\n }\n\n /** Get bonding curve state including price, market cap, and graduation progress. */\n async getCurveState(mint: string): Promise<CurveState> {\n return this._http.get<CurveState>(`/api/tokens/${mint}/curve-state`);\n }\n}\n","import type { HttpClient } from '../http.js';\n\nexport type PriorityLevel = 'economy' | 'normal' | 'fast' | 'turbo';\n\nexport interface QuoteOptions {\n action: 'buy' | 'sell';\n solAmount?: string;\n tokenAmount?: string;\n}\n\nexport interface QuoteResult {\n route: 'bonding_curve' | 'pumpswap';\n expectedTokens?: string;\n expectedSol?: string;\n priceImpact: number;\n fee: number;\n disclaimer: string;\n}\n\nexport interface QuoteBuyCostOptions {\n tokenAmount: string;\n}\n\nexport interface QuoteBuyCostResult {\n solCostLamports: string;\n route: 'bonding_curve' | 'pumpswap';\n disclaimer: string;\n}\n\nexport interface BuyOptions {\n walletId: string;\n amountLamports: string;\n slippageBps?: number;\n priorityLevel?: PriorityLevel;\n}\n\nexport interface BuyResult {\n signature: string;\n estimatedTokenAmount: string;\n solSpent: string;\n route: 'bonding_curve' | 'pumpswap';\n disclaimer: string;\n}\n\nexport interface SellOptions {\n walletId: string;\n tokenAmount: string;\n slippageBps?: number;\n priorityLevel?: PriorityLevel;\n}\n\nexport interface SellResult {\n signature: string;\n estimatedSolReceived: string;\n tokensSold: string;\n route: 'bonding_curve' | 'pumpswap';\n disclaimer: string;\n}\n\nexport interface BundleSellEntry {\n walletId: string;\n tokenAmount: string;\n}\n\nexport interface BundleSellOptions {\n walletSells: BundleSellEntry[];\n tipWalletId?: string;\n tipLamports?: number;\n slippageBps?: number;\n priorityLevel?: PriorityLevel;\n}\n\nexport interface BundleSellResult {\n bundleResults: Array<{\n bundleId: string;\n status: 'Landed' | 'Failed' | 'Timeout';\n signatures?: string[];\n walletsIncluded: string[];\n }>;\n warnings: Array<{ walletId: string; reason: string }>;\n}\n\nexport class Trading {\n constructor(private readonly _http: HttpClient) {}\n\n /**\n * Get a price quote for buying or selling a token.\n *\n * @example\n * ```ts\n * const quote = await op.trading.getQuote('So11...', {\n * action: 'buy',\n * solAmount: '1000000000',\n * });\n * console.log(quote.expectedTokens);\n * ```\n */\n async getQuote(mint: string, options: QuoteOptions): Promise<QuoteResult> {\n const query: Record<string, string> = { action: options.action };\n if (options.solAmount !== undefined) query['solAmount'] = options.solAmount;\n if (options.tokenAmount !== undefined) query['tokenAmount'] = options.tokenAmount;\n return this._http.get<QuoteResult>(`/api/tokens/${mint}/quote`, query);\n }\n\n /** Get the SOL cost to buy a specific number of tokens (inverse quote). */\n async getQuoteBuyCost(\n mint: string,\n options: QuoteBuyCostOptions,\n ): Promise<QuoteBuyCostResult> {\n return this._http.get<QuoteBuyCostResult>(`/api/tokens/${mint}/quote-buy-cost`, {\n tokenAmount: options.tokenAmount,\n });\n }\n\n /** Execute a buy transaction for a token. */\n async buy(mint: string, options: BuyOptions): Promise<BuyResult> {\n return this._http.post<BuyResult>(`/api/tokens/${mint}/buy`, options);\n }\n\n /** Execute a sell transaction for a token. */\n async sell(mint: string, options: SellOptions): Promise<SellResult> {\n return this._http.post<SellResult>(`/api/tokens/${mint}/sell`, options);\n }\n\n /** Multi-wallet sell packed into Jito bundles. */\n async bundleSell(mint: string, options: BundleSellOptions): Promise<BundleSellResult> {\n return this._http.post<BundleSellResult>(`/api/tokens/${mint}/bundle-sell`, options);\n }\n}\n","import type { HttpClient } from '../http.js';\n\nexport interface JobStatus {\n jobId: string;\n status: 'waiting' | 'active' | 'completed' | 'failed';\n progress: number;\n result?: {\n bundleStatuses: Array<{\n bundleId: string;\n status: 'Pending' | 'Landed' | 'Failed' | 'Timeout';\n signatures?: string[];\n }>;\n };\n warnings?: Array<{ walletId: string; reason: string }>;\n error?: string;\n}\n\nexport interface PollOptions {\n /** Polling interval in milliseconds. Default: 1000 */\n intervalMs?: number;\n /** Maximum time to wait in milliseconds. Default: 30000 */\n timeoutMs?: number;\n /** AbortSignal for cancellation. */\n signal?: AbortSignal;\n /** Callback invoked on each poll with current status. */\n onProgress?: (status: JobStatus) => void;\n}\n\nexport class Jobs {\n constructor(private readonly _http: HttpClient) {}\n\n /** Get the current status of a job. */\n async get(jobId: string): Promise<JobStatus> {\n return this._http.get<JobStatus>(`/api/jobs/${jobId}`);\n }\n\n /**\n * Poll a job until it completes or the timeout is reached.\n *\n * @param jobId - The job ID to poll.\n * @param options - Polling configuration.\n * @returns The final job status (completed).\n * @throws {Error} If the job fails or the timeout is reached.\n *\n * @example\n * ```ts\n * const launch = await op.bundles.launch({ ... });\n * const result = await op.jobs.poll(launch.jobId, {\n * intervalMs: 2000,\n * timeoutMs: 60000,\n * onProgress: (s) => console.log(`Progress: ${s.progress}%`),\n * });\n * ```\n */\n async poll(jobId: string, options?: PollOptions): Promise<JobStatus> {\n const intervalMs = options?.intervalMs ?? 1000;\n const timeoutMs = options?.timeoutMs ?? 30_000;\n const signal = options?.signal;\n const onProgress = options?.onProgress;\n\n const deadline = Date.now() + timeoutMs;\n\n while (Date.now() < deadline) {\n if (signal?.aborted) {\n throw new Error('Job polling aborted');\n }\n\n const status = await this.get(jobId);\n onProgress?.(status);\n\n if (status.status === 'completed') {\n return status;\n }\n\n if (status.status === 'failed') {\n throw new Error(status.error ?? `Job ${jobId} failed`);\n }\n\n // Wait before next poll\n await new Promise<void>((resolve, reject) => {\n const timer = setTimeout(resolve, intervalMs);\n signal?.addEventListener(\n 'abort',\n () => {\n clearTimeout(timer);\n reject(new Error('Job polling aborted'));\n },\n { once: true },\n );\n });\n }\n\n throw new Error(`Job ${jobId} polling timed out after ${timeoutMs}ms`);\n }\n}\n","import type { HttpClient } from '../http.js';\n\nexport interface AccumulatedFees {\n creatorAddress: string;\n accumulatedLamports: string;\n accumulatedSOL: number;\n creatorVaultAddress: string;\n}\n\nexport interface ClaimFeesResult {\n signature: string;\n amountClaimed: string;\n amountClaimedSOL: number;\n}\n\nexport class CreatorFees {\n constructor(private readonly _http: HttpClient) {}\n\n /** Get accumulated creator fees for a given creator address. */\n async getAccumulatedFees(address: string): Promise<AccumulatedFees> {\n return this._http.get<AccumulatedFees>('/api/creator-fees', { address });\n }\n\n /** Claim accumulated creator fees for a wallet you own. */\n async claim(creatorAddress: string): Promise<ClaimFeesResult> {\n return this._http.post<ClaimFeesResult>('/api/creator-fees/claim', { creatorAddress });\n }\n}\n","import type { HttpClient } from '../http.js';\n\nexport interface BundleLaunchOptions {\n devWalletId: string;\n buyWalletIds: string[];\n name: string;\n symbol: string;\n description?: string;\n imageBase64: string;\n imageType: 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp';\n devBuyAmountLamports?: string;\n walletBuyAmounts: string[];\n tipLamports?: number;\n twitter?: string;\n telegram?: string;\n website?: string;\n}\n\nexport interface BundleLaunchResult {\n jobId: string;\n}\n\nexport class Bundles {\n constructor(private readonly _http: HttpClient) {}\n\n /**\n * Launch a coordinated token creation + multi-wallet bundle buy.\n * Returns a job ID for polling.\n *\n * @example\n * ```ts\n * const { jobId } = await op.bundles.launch({\n * devWalletId: 'wallet-1',\n * buyWalletIds: ['wallet-2', 'wallet-3'],\n * name: 'My Token',\n * symbol: 'MTK',\n * imageBase64: '...',\n * imageType: 'image/png',\n * walletBuyAmounts: ['500000000', '500000000'],\n * });\n * const result = await op.jobs.poll(jobId);\n * ```\n */\n async launch(options: BundleLaunchOptions): Promise<BundleLaunchResult> {\n return this._http.post<BundleLaunchResult>('/api/tokens/bundle-launch', options);\n }\n}\n","import { HttpClient } from './http.js';\nimport { Wallets } from './resources/wallets.js';\nimport { Tokens } from './resources/tokens.js';\nimport { Trading } from './resources/trading.js';\nimport { Jobs } from './resources/jobs.js';\nimport { CreatorFees } from './resources/creator-fees.js';\nimport { Bundles } from './resources/bundles.js';\n\nexport interface OpenPumpConfig {\n /** API key (op_sk_live_...) */\n apiKey: string;\n /** Base URL of the OpenPump API. Defaults to https://api.openpump.io */\n baseUrl?: string;\n /** Request timeout in milliseconds. Defaults to 30_000 */\n timeout?: number;\n}\n\n/**\n * OpenPump SDK client with resource-namespaced API methods.\n *\n * @example\n * ```ts\n * import { OpenPump } from '@openpump/sdk';\n *\n * const op = new OpenPump({ apiKey: 'op_sk_live_...' });\n *\n * // List wallets\n * const wallets = await op.wallets.list();\n *\n * // Create a token\n * const token = await op.tokens.create({ ... });\n *\n * // Buy tokens\n * const trade = await op.trading.buy('mint-address', { ... });\n *\n * // Poll a bundle launch job\n * const job = await op.jobs.poll('job-id', { timeoutMs: 60_000 });\n * ```\n */\nexport class OpenPump {\n readonly wallets: Wallets;\n readonly tokens: Tokens;\n readonly trading: Trading;\n readonly jobs: Jobs;\n readonly creatorFees: CreatorFees;\n readonly bundles: Bundles;\n\n private readonly _http: HttpClient;\n\n constructor(config: OpenPumpConfig) {\n if (!config.apiKey) {\n throw new Error('apiKey is required');\n }\n\n this._http = new HttpClient({\n apiKey: config.apiKey,\n baseUrl: config.baseUrl ?? 'https://api.openpump.io',\n timeout: config.timeout ?? 30_000,\n });\n\n this.wallets = new Wallets(this._http);\n this.tokens = new Tokens(this._http);\n this.trading = new Trading(this._http);\n this.jobs = new Jobs(this._http);\n this.creatorFees = new CreatorFees(this._http);\n this.bundles = new Bundles(this._http);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAGvC,YACkB,MAChB,SACgB,QACA,SAChB;AACA,UAAM,OAAO;AALG;AAEA;AACA;AAIhB,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AAAA,EAXkB,OAAe;AAYnC;AAGO,IAAM,sBAAN,cAAkC,cAAc;AAAA,EACnC,OAAO;AAAA,EAEzB,YAAY,MAAc,SAAiB,QAAgB,SAAmB;AAC5E,UAAM,MAAM,SAAS,QAAQ,OAAO;AACpC,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AACF;AAGO,IAAM,iBAAN,cAA6B,cAAc;AAAA,EAC9B,OAAO;AAAA,EAEzB,YAAY,MAAc,SAAiB,QAAgB,SAAmB;AAC5E,UAAM,MAAM,SAAS,QAAQ,OAAO;AACpC,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AACF;AAGO,IAAM,kBAAN,cAA8B,cAAc;AAAA,EAC/B,OAAO;AAAA,EAEzB,YAAY,MAAc,SAAiB,QAAgB,SAAmB;AAC5E,UAAM,MAAM,SAAS,QAAQ,OAAO;AACpC,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AACF;AAGO,IAAM,gBAAN,cAA4B,cAAc;AAAA,EAC7B,OAAO;AAAA,EAEzB,YAAY,MAAc,SAAiB,QAAgB,SAAmB;AAC5E,UAAM,MAAM,SAAS,QAAQ,OAAO;AACpC,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AACF;AAGO,IAAM,yBAAN,cAAqC,cAAc;AAAA,EACtC,OAAO;AAAA,EAEzB,YA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ACA;AAAA,EACA;AAAA,EACA;AAAA,EAEQ;AAAA,EAEjB,YAAY,QAAwB;AAClC,QAAI,CAAC,OAAO,QAAQ;AAClB,YAAM,IAAI,MAAM,oBAAoB;AAAA,IACtC;AAEA,SAAK,QAAQ,IAAI,WAAW;AAAA,MAC1B,QAAQ,OAAO;AAAA,MACf,SAAS,OAAO,WAAW;AAAA,MAC3B,SAAS,OAAO,WAAW;AAAA,IAC7B,CAAC;AAED,SAAK,UAAU,IAAI,QAAQ,KAAK,KAAK;AACrC,SAAK,SAAS,IAAI,OAAO,KAAK,KAAK;AACnC,SAAK,UAAU,IAAI,QAAQ,KAAK,KAAK;AACrC,SAAK,OAAO,IAAI,KAAK,KAAK,KAAK;AAC/B,SAAK,cAAc,IAAI,YAAY,KAAK,KAAK;AAC7C,SAAK,UAAU,IAAI,QAAQ,KAAK,KAAK;AAAA,EACvC;AACF;","names":[]}
@@ -0,0 +1,473 @@
1
+ interface HttpClientConfig {
2
+ apiKey: string;
3
+ baseUrl: string;
4
+ timeout: number;
5
+ }
6
+ declare class HttpClient {
7
+ private readonly _apiKey;
8
+ private readonly _baseUrl;
9
+ private readonly _timeout;
10
+ constructor(config: HttpClientConfig);
11
+ get<T>(path: string, query?: Record<string, string>): Promise<T>;
12
+ post<T>(path: string, body?: unknown): Promise<T>;
13
+ patch<T>(path: string, body: unknown): Promise<T>;
14
+ delete<T>(path: string): Promise<T>;
15
+ private _headers;
16
+ private _handleResponse;
17
+ private _throwApiError;
18
+ }
19
+
20
+ interface CreateWalletOptions {
21
+ label?: string;
22
+ }
23
+ interface WalletInfo {
24
+ id: string;
25
+ publicKey: string;
26
+ walletIndex: number;
27
+ label: string;
28
+ createdAt: string;
29
+ }
30
+ interface WalletBalance {
31
+ nativeSol: {
32
+ lamports: string;
33
+ sol: string;
34
+ };
35
+ tokens: Array<{
36
+ mint: string;
37
+ symbol: string | null;
38
+ amount: string;
39
+ decimals: number;
40
+ uiAmount: number;
41
+ }>;
42
+ }
43
+ interface DepositInstructions {
44
+ depositAddress: string;
45
+ minimums: {
46
+ tokenCreation: string;
47
+ bundleBuy: string;
48
+ standardBuy: string;
49
+ };
50
+ instructions: string[];
51
+ disclaimer: string;
52
+ network: string;
53
+ }
54
+ interface TransferOptions {
55
+ toAddress: string;
56
+ amountLamports: string;
57
+ mint?: string | null;
58
+ memo?: string;
59
+ priorityFeeMicroLamports?: number;
60
+ }
61
+ interface TransferResult {
62
+ signature: string;
63
+ amountLamports: string;
64
+ fee: string;
65
+ }
66
+ interface TransactionListOptions {
67
+ type?: 'buy' | 'sell' | 'transfer';
68
+ limit?: number;
69
+ offset?: number;
70
+ }
71
+ interface TransactionListResult {
72
+ transactions: Array<Record<string, unknown>>;
73
+ total: number;
74
+ limit: number;
75
+ offset: number;
76
+ }
77
+ declare class Wallets {
78
+ private readonly _http;
79
+ constructor(_http: HttpClient);
80
+ /** List all active wallets for the authenticated user. */
81
+ list(): Promise<WalletInfo[]>;
82
+ /** Create a new wallet with an optional label. */
83
+ create(options?: CreateWalletOptions): Promise<WalletInfo>;
84
+ /** Get a single wallet by ID. */
85
+ get(walletId: string): Promise<WalletInfo>;
86
+ /** Get SOL + token balances for a wallet. */
87
+ getBalance(walletId: string): Promise<WalletBalance>;
88
+ /** Get deposit address and SOL minimums for a wallet. */
89
+ getDepositInstructions(walletId: string): Promise<DepositInstructions>;
90
+ /** Force a live RPC balance refresh, bypassing the 30s cache. */
91
+ refreshBalance(walletId: string): Promise<WalletBalance>;
92
+ /**
93
+ * Execute an on-chain SOL or SPL token transfer.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * const result = await op.wallets.transfer('wallet-id', {
98
+ * toAddress: 'recipient-public-key',
99
+ * amountLamports: '100000000',
100
+ * });
101
+ * console.log(result.signature);
102
+ * ```
103
+ */
104
+ transfer(walletId: string, options: TransferOptions): Promise<TransferResult>;
105
+ /** Get paginated transfer history for a wallet. */
106
+ getTransactions(walletId: string, options?: TransactionListOptions): Promise<TransactionListResult>;
107
+ }
108
+
109
+ interface CreateTokenOptions {
110
+ walletIndex?: number;
111
+ name: string;
112
+ symbol: string;
113
+ description: string;
114
+ imageBase64: string;
115
+ imageType: 'image/png' | 'image/jpeg' | 'image/jpg' | 'image/gif' | 'image/webp';
116
+ initialBuyAmountSol?: number;
117
+ twitter?: string;
118
+ telegram?: string;
119
+ website?: string;
120
+ }
121
+ interface CreateTokenResult {
122
+ tokenId: string;
123
+ mint: string;
124
+ signature: string;
125
+ metadataUri: string;
126
+ bondingCurveAccount: string;
127
+ }
128
+ interface TokenListItem {
129
+ id: string;
130
+ mintAddress: string;
131
+ name: string;
132
+ symbol: string;
133
+ graduationStatus: string;
134
+ metadataUri: string;
135
+ creatorAddress: string;
136
+ createdAt: string;
137
+ }
138
+ interface CurveState {
139
+ mint: string;
140
+ virtualTokenReserves: string;
141
+ virtualSolReserves: string;
142
+ realTokenReserves: string;
143
+ realSolReserves: string;
144
+ tokenTotalSupply: string;
145
+ complete: boolean;
146
+ isMayhemMode: boolean;
147
+ currentPriceSOL: number;
148
+ marketCapSOL: number;
149
+ graduationPercent: number;
150
+ }
151
+ declare class Tokens {
152
+ private readonly _http;
153
+ constructor(_http: HttpClient);
154
+ /** List tokens created by the authenticated user. */
155
+ list(): Promise<TokenListItem[]>;
156
+ /**
157
+ * Create a new PumpFun token with IPFS metadata upload.
158
+ *
159
+ * @example
160
+ * ```ts
161
+ * const token = await op.tokens.create({
162
+ * name: 'My Token',
163
+ * symbol: 'MTK',
164
+ * description: 'A cool token',
165
+ * imageBase64: 'base64-encoded-image...',
166
+ * imageType: 'image/png',
167
+ * });
168
+ * console.log(token.mint);
169
+ * ```
170
+ */
171
+ create(options: CreateTokenOptions): Promise<CreateTokenResult>;
172
+ /** Get market info for a token (mainnet only, returns null on devnet). */
173
+ getMarketInfo(mint: string): Promise<Record<string, unknown> | null>;
174
+ /** Get bonding curve state including price, market cap, and graduation progress. */
175
+ getCurveState(mint: string): Promise<CurveState>;
176
+ }
177
+
178
+ type PriorityLevel = 'economy' | 'normal' | 'fast' | 'turbo';
179
+ interface QuoteOptions {
180
+ action: 'buy' | 'sell';
181
+ solAmount?: string;
182
+ tokenAmount?: string;
183
+ }
184
+ interface QuoteResult {
185
+ route: 'bonding_curve' | 'pumpswap';
186
+ expectedTokens?: string;
187
+ expectedSol?: string;
188
+ priceImpact: number;
189
+ fee: number;
190
+ disclaimer: string;
191
+ }
192
+ interface QuoteBuyCostOptions {
193
+ tokenAmount: string;
194
+ }
195
+ interface QuoteBuyCostResult {
196
+ solCostLamports: string;
197
+ route: 'bonding_curve' | 'pumpswap';
198
+ disclaimer: string;
199
+ }
200
+ interface BuyOptions {
201
+ walletId: string;
202
+ amountLamports: string;
203
+ slippageBps?: number;
204
+ priorityLevel?: PriorityLevel;
205
+ }
206
+ interface BuyResult {
207
+ signature: string;
208
+ estimatedTokenAmount: string;
209
+ solSpent: string;
210
+ route: 'bonding_curve' | 'pumpswap';
211
+ disclaimer: string;
212
+ }
213
+ interface SellOptions {
214
+ walletId: string;
215
+ tokenAmount: string;
216
+ slippageBps?: number;
217
+ priorityLevel?: PriorityLevel;
218
+ }
219
+ interface SellResult {
220
+ signature: string;
221
+ estimatedSolReceived: string;
222
+ tokensSold: string;
223
+ route: 'bonding_curve' | 'pumpswap';
224
+ disclaimer: string;
225
+ }
226
+ interface BundleSellEntry {
227
+ walletId: string;
228
+ tokenAmount: string;
229
+ }
230
+ interface BundleSellOptions {
231
+ walletSells: BundleSellEntry[];
232
+ tipWalletId?: string;
233
+ tipLamports?: number;
234
+ slippageBps?: number;
235
+ priorityLevel?: PriorityLevel;
236
+ }
237
+ interface BundleSellResult {
238
+ bundleResults: Array<{
239
+ bundleId: string;
240
+ status: 'Landed' | 'Failed' | 'Timeout';
241
+ signatures?: string[];
242
+ walletsIncluded: string[];
243
+ }>;
244
+ warnings: Array<{
245
+ walletId: string;
246
+ reason: string;
247
+ }>;
248
+ }
249
+ declare class Trading {
250
+ private readonly _http;
251
+ constructor(_http: HttpClient);
252
+ /**
253
+ * Get a price quote for buying or selling a token.
254
+ *
255
+ * @example
256
+ * ```ts
257
+ * const quote = await op.trading.getQuote('So11...', {
258
+ * action: 'buy',
259
+ * solAmount: '1000000000',
260
+ * });
261
+ * console.log(quote.expectedTokens);
262
+ * ```
263
+ */
264
+ getQuote(mint: string, options: QuoteOptions): Promise<QuoteResult>;
265
+ /** Get the SOL cost to buy a specific number of tokens (inverse quote). */
266
+ getQuoteBuyCost(mint: string, options: QuoteBuyCostOptions): Promise<QuoteBuyCostResult>;
267
+ /** Execute a buy transaction for a token. */
268
+ buy(mint: string, options: BuyOptions): Promise<BuyResult>;
269
+ /** Execute a sell transaction for a token. */
270
+ sell(mint: string, options: SellOptions): Promise<SellResult>;
271
+ /** Multi-wallet sell packed into Jito bundles. */
272
+ bundleSell(mint: string, options: BundleSellOptions): Promise<BundleSellResult>;
273
+ }
274
+
275
+ interface JobStatus {
276
+ jobId: string;
277
+ status: 'waiting' | 'active' | 'completed' | 'failed';
278
+ progress: number;
279
+ result?: {
280
+ bundleStatuses: Array<{
281
+ bundleId: string;
282
+ status: 'Pending' | 'Landed' | 'Failed' | 'Timeout';
283
+ signatures?: string[];
284
+ }>;
285
+ };
286
+ warnings?: Array<{
287
+ walletId: string;
288
+ reason: string;
289
+ }>;
290
+ error?: string;
291
+ }
292
+ interface PollOptions {
293
+ /** Polling interval in milliseconds. Default: 1000 */
294
+ intervalMs?: number;
295
+ /** Maximum time to wait in milliseconds. Default: 30000 */
296
+ timeoutMs?: number;
297
+ /** AbortSignal for cancellation. */
298
+ signal?: AbortSignal;
299
+ /** Callback invoked on each poll with current status. */
300
+ onProgress?: (status: JobStatus) => void;
301
+ }
302
+ declare class Jobs {
303
+ private readonly _http;
304
+ constructor(_http: HttpClient);
305
+ /** Get the current status of a job. */
306
+ get(jobId: string): Promise<JobStatus>;
307
+ /**
308
+ * Poll a job until it completes or the timeout is reached.
309
+ *
310
+ * @param jobId - The job ID to poll.
311
+ * @param options - Polling configuration.
312
+ * @returns The final job status (completed).
313
+ * @throws {Error} If the job fails or the timeout is reached.
314
+ *
315
+ * @example
316
+ * ```ts
317
+ * const launch = await op.bundles.launch({ ... });
318
+ * const result = await op.jobs.poll(launch.jobId, {
319
+ * intervalMs: 2000,
320
+ * timeoutMs: 60000,
321
+ * onProgress: (s) => console.log(`Progress: ${s.progress}%`),
322
+ * });
323
+ * ```
324
+ */
325
+ poll(jobId: string, options?: PollOptions): Promise<JobStatus>;
326
+ }
327
+
328
+ interface AccumulatedFees {
329
+ creatorAddress: string;
330
+ accumulatedLamports: string;
331
+ accumulatedSOL: number;
332
+ creatorVaultAddress: string;
333
+ }
334
+ interface ClaimFeesResult {
335
+ signature: string;
336
+ amountClaimed: string;
337
+ amountClaimedSOL: number;
338
+ }
339
+ declare class CreatorFees {
340
+ private readonly _http;
341
+ constructor(_http: HttpClient);
342
+ /** Get accumulated creator fees for a given creator address. */
343
+ getAccumulatedFees(address: string): Promise<AccumulatedFees>;
344
+ /** Claim accumulated creator fees for a wallet you own. */
345
+ claim(creatorAddress: string): Promise<ClaimFeesResult>;
346
+ }
347
+
348
+ interface BundleLaunchOptions {
349
+ devWalletId: string;
350
+ buyWalletIds: string[];
351
+ name: string;
352
+ symbol: string;
353
+ description?: string;
354
+ imageBase64: string;
355
+ imageType: 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp';
356
+ devBuyAmountLamports?: string;
357
+ walletBuyAmounts: string[];
358
+ tipLamports?: number;
359
+ twitter?: string;
360
+ telegram?: string;
361
+ website?: string;
362
+ }
363
+ interface BundleLaunchResult {
364
+ jobId: string;
365
+ }
366
+ declare class Bundles {
367
+ private readonly _http;
368
+ constructor(_http: HttpClient);
369
+ /**
370
+ * Launch a coordinated token creation + multi-wallet bundle buy.
371
+ * Returns a job ID for polling.
372
+ *
373
+ * @example
374
+ * ```ts
375
+ * const { jobId } = await op.bundles.launch({
376
+ * devWalletId: 'wallet-1',
377
+ * buyWalletIds: ['wallet-2', 'wallet-3'],
378
+ * name: 'My Token',
379
+ * symbol: 'MTK',
380
+ * imageBase64: '...',
381
+ * imageType: 'image/png',
382
+ * walletBuyAmounts: ['500000000', '500000000'],
383
+ * });
384
+ * const result = await op.jobs.poll(jobId);
385
+ * ```
386
+ */
387
+ launch(options: BundleLaunchOptions): Promise<BundleLaunchResult>;
388
+ }
389
+
390
+ interface OpenPumpConfig {
391
+ /** API key (op_sk_live_...) */
392
+ apiKey: string;
393
+ /** Base URL of the OpenPump API. Defaults to https://api.openpump.io */
394
+ baseUrl?: string;
395
+ /** Request timeout in milliseconds. Defaults to 30_000 */
396
+ timeout?: number;
397
+ }
398
+ /**
399
+ * OpenPump SDK client with resource-namespaced API methods.
400
+ *
401
+ * @example
402
+ * ```ts
403
+ * import { OpenPump } from '@openpump/sdk';
404
+ *
405
+ * const op = new OpenPump({ apiKey: 'op_sk_live_...' });
406
+ *
407
+ * // List wallets
408
+ * const wallets = await op.wallets.list();
409
+ *
410
+ * // Create a token
411
+ * const token = await op.tokens.create({ ... });
412
+ *
413
+ * // Buy tokens
414
+ * const trade = await op.trading.buy('mint-address', { ... });
415
+ *
416
+ * // Poll a bundle launch job
417
+ * const job = await op.jobs.poll('job-id', { timeoutMs: 60_000 });
418
+ * ```
419
+ */
420
+ declare class OpenPump {
421
+ readonly wallets: Wallets;
422
+ readonly tokens: Tokens;
423
+ readonly trading: Trading;
424
+ readonly jobs: Jobs;
425
+ readonly creatorFees: CreatorFees;
426
+ readonly bundles: Bundles;
427
+ private readonly _http;
428
+ constructor(config: OpenPumpConfig);
429
+ }
430
+
431
+ /**
432
+ * Base error class for all OpenPump SDK errors.
433
+ * All API errors are converted to typed exceptions.
434
+ */
435
+ declare class OpenPumpError extends Error {
436
+ readonly code: string;
437
+ readonly status: number;
438
+ readonly details?: unknown | undefined;
439
+ readonly name: string;
440
+ constructor(code: string, message: string, status: number, details?: unknown | undefined);
441
+ }
442
+ /** Thrown when the API key is invalid or missing (HTTP 401). */
443
+ declare class AuthenticationError extends OpenPumpError {
444
+ readonly name = "AuthenticationError";
445
+ constructor(code: string, message: string, status: number, details?: unknown);
446
+ }
447
+ /** Thrown when the rate limit is exceeded (HTTP 429). */
448
+ declare class RateLimitError extends OpenPumpError {
449
+ readonly name = "RateLimitError";
450
+ constructor(code: string, message: string, status: number, details?: unknown);
451
+ }
452
+ /** Thrown when request validation fails (HTTP 422). */
453
+ declare class ValidationError extends OpenPumpError {
454
+ readonly name = "ValidationError";
455
+ constructor(code: string, message: string, status: number, details?: unknown);
456
+ }
457
+ /** Thrown when the requested resource is not found (HTTP 404). */
458
+ declare class NotFoundError extends OpenPumpError {
459
+ readonly name = "NotFoundError";
460
+ constructor(code: string, message: string, status: number, details?: unknown);
461
+ }
462
+ /** Thrown when the wallet has insufficient SOL or tokens for an operation. */
463
+ declare class InsufficientFundsError extends OpenPumpError {
464
+ readonly name = "InsufficientFundsError";
465
+ constructor(code: string, message: string, status: number, details?: unknown);
466
+ }
467
+ /** Thrown when an on-chain transaction fails (signature error, simulation failure, etc.). */
468
+ declare class TransactionError extends OpenPumpError {
469
+ readonly name = "TransactionError";
470
+ constructor(code: string, message: string, status: number, details?: unknown);
471
+ }
472
+
473
+ export { type AccumulatedFees, AuthenticationError, type BundleLaunchOptions, type BundleLaunchResult, type BundleSellEntry, type BundleSellOptions, type BundleSellResult, Bundles, type BuyOptions, type BuyResult, type ClaimFeesResult, type CreateTokenOptions, type CreateTokenResult, type CreateWalletOptions, CreatorFees, type CurveState, type DepositInstructions, InsufficientFundsError, type JobStatus, Jobs, NotFoundError, OpenPump, type OpenPumpConfig, OpenPumpError, type PollOptions, type PriorityLevel, type QuoteBuyCostOptions, type QuoteBuyCostResult, type QuoteOptions, type QuoteResult, RateLimitError, type SellOptions, type SellResult, type TokenListItem, Tokens, Trading, TransactionError, type TransactionListOptions, type TransactionListResult, type TransferOptions, type TransferResult, ValidationError, type WalletBalance, type WalletInfo, Wallets };