From 9816c8d1e9a6a81139e7850570c9cc43651c59e5 Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Wed, 24 Sep 2025 14:27:59 +0200 Subject: [PATCH 1/2] Token API With Generated Spec --- generated/.openapi-generator/FILES | 7 + generated/apis/TokenApi.ts | 218 +++++++++++ generated/apis/index.ts | 1 + generated/models/ErrorResponse.ts | 66 ++++ generated/models/MintInformation.ts | 360 +++++++++++++++++ generated/models/MintInformationAudit.ts | 105 +++++ generated/models/MintInformationFirstPool.ts | 73 ++++ generated/models/SearchTokens400Response.ts | 66 ++++ generated/models/SwapStats.ts | 161 ++++++++ generated/models/index.ts | 6 + src/index.ts | 41 +- swagger.yaml | 388 +++++++++++++++++++ 12 files changed, 1484 insertions(+), 8 deletions(-) create mode 100644 generated/apis/TokenApi.ts create mode 100644 generated/models/ErrorResponse.ts create mode 100644 generated/models/MintInformation.ts create mode 100644 generated/models/MintInformationAudit.ts create mode 100644 generated/models/MintInformationFirstPool.ts create mode 100644 generated/models/SearchTokens400Response.ts create mode 100644 generated/models/SwapStats.ts diff --git a/generated/.openapi-generator/FILES b/generated/.openapi-generator/FILES index e0266f1..f12e43a 100644 --- a/generated/.openapi-generator/FILES +++ b/generated/.openapi-generator/FILES @@ -1,12 +1,18 @@ apis/SwapApi.ts +apis/TokenApi.ts apis/index.ts index.ts models/AccountMeta.ts +models/ErrorResponse.ts models/IndexedRouteMapResponse.ts models/Instruction.ts +models/MintInformation.ts +models/MintInformationAudit.ts +models/MintInformationFirstPool.ts models/PlatformFee.ts models/QuoteResponse.ts models/RoutePlanStep.ts +models/SearchTokens400Response.ts models/SwapInfo.ts models/SwapInstructionsResponse.ts models/SwapMode.ts @@ -14,5 +20,6 @@ models/SwapRequest.ts models/SwapRequestPrioritizationFeeLamports.ts models/SwapRequestPrioritizationFeeLamportsPriorityLevelWithMaxLamports.ts models/SwapResponse.ts +models/SwapStats.ts models/index.ts runtime.ts diff --git a/generated/apis/TokenApi.ts b/generated/apis/TokenApi.ts new file mode 100644 index 0000000..2c192ea --- /dev/null +++ b/generated/apis/TokenApi.ts @@ -0,0 +1,218 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + ErrorResponse, + MintInformation, + SearchTokens400Response, +} from '../models/index'; +import { + ErrorResponseFromJSON, + ErrorResponseToJSON, + MintInformationFromJSON, + MintInformationToJSON, + SearchTokens400ResponseFromJSON, + SearchTokens400ResponseToJSON, +} from '../models/index'; + +export interface GetCategoryByIntervalRequest { + category: GetCategoryByIntervalCategoryEnum; + interval: GetCategoryByIntervalIntervalEnum; + limit?: number; +} + +export interface GetTokensByTagRequest { + query: GetTokensByTagQueryEnum; +} + +export interface SearchTokensRequest { + query: string; +} + +/** + * + */ +export class TokenApi extends runtime.BaseAPI { + + /** + * Returns an array of mints and their information for the given category and interval :::note - Refer to [Token API doc](/docs/token-api/v2) for more information ::: + * category + */ + async getCategoryByIntervalRaw(requestParameters: GetCategoryByIntervalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + if (requestParameters.category === null || requestParameters.category === undefined) { + throw new runtime.RequiredError('category','Required parameter requestParameters.category was null or undefined when calling getCategoryByInterval.'); + } + + if (requestParameters.interval === null || requestParameters.interval === undefined) { + throw new runtime.RequiredError('interval','Required parameter requestParameters.interval was null or undefined when calling getCategoryByInterval.'); + } + + const queryParameters: any = {}; + + if (requestParameters.limit !== undefined) { + queryParameters['limit'] = requestParameters.limit; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/{category}/{interval}`.replace(`{${"category"}}`, encodeURIComponent(String(requestParameters.category))).replace(`{${"interval"}}`, encodeURIComponent(String(requestParameters.interval))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(MintInformationFromJSON)); + } + + /** + * Returns an array of mints and their information for the given category and interval :::note - Refer to [Token API doc](/docs/token-api/v2) for more information ::: + * category + */ + async getCategoryByInterval(requestParameters: GetCategoryByIntervalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const response = await this.getCategoryByIntervalRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Returns an array of mints that recently had their **first created pool** - Default to 30 mints in response :::note - Refer to [Token API doc](/docs/token-api/v2) for more information ::: + * recent + */ + async getRecentTokensRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/recent`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(MintInformationFromJSON)); + } + + /** + * Returns an array of mints that recently had their **first created pool** - Default to 30 mints in response :::note - Refer to [Token API doc](/docs/token-api/v2) for more information ::: + * recent + */ + async getRecentTokens(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const response = await this.getRecentTokensRaw(initOverrides); + return await response.value(); + } + + /** + * Request an array of mints and their information by a tag - Note that this will return the entire array of existing mints that belongs to the tag. :::note - Refer to [Token API doc](/docs/token-api/v2) for more information ::: + * tag + */ + async getTokensByTagRaw(requestParameters: GetTokensByTagRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + if (requestParameters.query === null || requestParameters.query === undefined) { + throw new runtime.RequiredError('query','Required parameter requestParameters.query was null or undefined when calling getTokensByTag.'); + } + + const queryParameters: any = {}; + + if (requestParameters.query !== undefined) { + queryParameters['query'] = requestParameters.query; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/tag`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(MintInformationFromJSON)); + } + + /** + * Request an array of mints and their information by a tag - Note that this will return the entire array of existing mints that belongs to the tag. :::note - Refer to [Token API doc](/docs/token-api/v2) for more information ::: + * tag + */ + async getTokensByTag(requestParameters: GetTokensByTagRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const response = await this.getTokensByTagRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Request a search by token\'s symbol, name or mint address :::note - Refer to [Token API doc](/docs/token-api/v2) for more information ::: + * search + */ + async searchTokensRaw(requestParameters: SearchTokensRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + if (requestParameters.query === null || requestParameters.query === undefined) { + throw new runtime.RequiredError('query','Required parameter requestParameters.query was null or undefined when calling searchTokens.'); + } + + const queryParameters: any = {}; + + if (requestParameters.query !== undefined) { + queryParameters['query'] = requestParameters.query; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/search`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(MintInformationFromJSON)); + } + + /** + * Request a search by token\'s symbol, name or mint address :::note - Refer to [Token API doc](/docs/token-api/v2) for more information ::: + * search + */ + async searchTokens(requestParameters: SearchTokensRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const response = await this.searchTokensRaw(requestParameters, initOverrides); + return await response.value(); + } + +} + +/** + * @export + */ +export const GetCategoryByIntervalCategoryEnum = { + Toporganicscore: 'toporganicscore', + Toptraded: 'toptraded', + Toptrending: 'toptrending' +} as const; +export type GetCategoryByIntervalCategoryEnum = typeof GetCategoryByIntervalCategoryEnum[keyof typeof GetCategoryByIntervalCategoryEnum]; +/** + * @export + */ +export const GetCategoryByIntervalIntervalEnum = { + _5m: '5m', + _1h: '1h', + _6h: '6h', + _24h: '24h' +} as const; +export type GetCategoryByIntervalIntervalEnum = typeof GetCategoryByIntervalIntervalEnum[keyof typeof GetCategoryByIntervalIntervalEnum]; +/** + * @export + */ +export const GetTokensByTagQueryEnum = { + Lst: 'lst', + Verified: 'verified' +} as const; +export type GetTokensByTagQueryEnum = typeof GetTokensByTagQueryEnum[keyof typeof GetTokensByTagQueryEnum]; diff --git a/generated/apis/index.ts b/generated/apis/index.ts index 103ad5b..283d79f 100644 --- a/generated/apis/index.ts +++ b/generated/apis/index.ts @@ -1,3 +1,4 @@ /* tslint:disable */ /* eslint-disable */ export * from './SwapApi'; +export * from './TokenApi'; diff --git a/generated/models/ErrorResponse.ts b/generated/models/ErrorResponse.ts new file mode 100644 index 0000000..31fb846 --- /dev/null +++ b/generated/models/ErrorResponse.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface ErrorResponse + */ +export interface ErrorResponse { + /** + * + * @type {string} + * @memberof ErrorResponse + */ + error: string; +} + +/** + * Check if a given object implements the ErrorResponse interface. + */ +export function instanceOfErrorResponse(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "error" in value; + + return isInstance; +} + +export function ErrorResponseFromJSON(json: any): ErrorResponse { + return ErrorResponseFromJSONTyped(json, false); +} + +export function ErrorResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ErrorResponse { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'error': json['error'], + }; +} + +export function ErrorResponseToJSON(value?: ErrorResponse | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'error': value.error, + }; +} + diff --git a/generated/models/MintInformation.ts b/generated/models/MintInformation.ts new file mode 100644 index 0000000..4f75106 --- /dev/null +++ b/generated/models/MintInformation.ts @@ -0,0 +1,360 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { MintInformationAudit } from './MintInformationAudit'; +import { + MintInformationAuditFromJSON, + MintInformationAuditFromJSONTyped, + MintInformationAuditToJSON, +} from './MintInformationAudit'; +import type { MintInformationFirstPool } from './MintInformationFirstPool'; +import { + MintInformationFirstPoolFromJSON, + MintInformationFirstPoolFromJSONTyped, + MintInformationFirstPoolToJSON, +} from './MintInformationFirstPool'; +import type { SwapStats } from './SwapStats'; +import { + SwapStatsFromJSON, + SwapStatsFromJSONTyped, + SwapStatsToJSON, +} from './SwapStats'; + +/** + * + * @export + * @interface MintInformation + */ +export interface MintInformation { + /** + * The token's mint address + * @type {string} + * @memberof MintInformation + */ + id?: string; + /** + * + * @type {string} + * @memberof MintInformation + */ + name?: string; + /** + * + * @type {string} + * @memberof MintInformation + */ + symbol?: string; + /** + * + * @type {string} + * @memberof MintInformation + */ + icon?: string | null; + /** + * + * @type {number} + * @memberof MintInformation + */ + decimals?: number; + /** + * + * @type {string} + * @memberof MintInformation + */ + twitter?: string | null; + /** + * + * @type {string} + * @memberof MintInformation + */ + telegram?: string | null; + /** + * + * @type {string} + * @memberof MintInformation + */ + website?: string | null; + /** + * The token's developer address + * @type {string} + * @memberof MintInformation + */ + dev?: string | null; + /** + * + * @type {number} + * @memberof MintInformation + */ + circSupply?: number | null; + /** + * + * @type {number} + * @memberof MintInformation + */ + totalSupply?: number | null; + /** + * The token program address + * @type {string} + * @memberof MintInformation + */ + tokenProgram?: string; + /** + * + * @type {string} + * @memberof MintInformation + */ + launchpad?: string | null; + /** + * + * @type {string} + * @memberof MintInformation + */ + partnerConfig?: string | null; + /** + * + * @type {string} + * @memberof MintInformation + */ + graduatedPool?: string | null; + /** + * + * @type {string} + * @memberof MintInformation + */ + graduatedAt?: string | null; + /** + * + * @type {number} + * @memberof MintInformation + */ + holderCount?: number | null; + /** + * + * @type {number} + * @memberof MintInformation + */ + fdv?: number | null; + /** + * + * @type {number} + * @memberof MintInformation + */ + mcap?: number | null; + /** + * + * @type {number} + * @memberof MintInformation + */ + usdPrice?: number | null; + /** + * + * @type {number} + * @memberof MintInformation + */ + priceBlockId?: number | null; + /** + * + * @type {number} + * @memberof MintInformation + */ + liquidity?: number | null; + /** + * + * @type {SwapStats} + * @memberof MintInformation + */ + stats5m?: SwapStats; + /** + * + * @type {SwapStats} + * @memberof MintInformation + */ + stats1h?: SwapStats; + /** + * + * @type {SwapStats} + * @memberof MintInformation + */ + stats6h?: SwapStats; + /** + * + * @type {SwapStats} + * @memberof MintInformation + */ + stats24h?: SwapStats; + /** + * + * @type {MintInformationFirstPool} + * @memberof MintInformation + */ + firstPool?: MintInformationFirstPool | null; + /** + * + * @type {MintInformationAudit} + * @memberof MintInformation + */ + audit?: MintInformationAudit | null; + /** + * + * @type {number} + * @memberof MintInformation + */ + organicScore?: number; + /** + * + * @type {string} + * @memberof MintInformation + */ + organicScoreLabel?: MintInformationOrganicScoreLabelEnum; + /** + * + * @type {boolean} + * @memberof MintInformation + */ + isVerified?: boolean | null; + /** + * + * @type {Array} + * @memberof MintInformation + */ + cexes?: Array | null; + /** + * + * @type {Array} + * @memberof MintInformation + */ + tags?: Array | null; + /** + * + * @type {Date} + * @memberof MintInformation + */ + updatedAt?: Date; +} + + +/** + * @export + */ +export const MintInformationOrganicScoreLabelEnum = { + High: 'high', + Medium: 'medium', + Low: 'low' +} as const; +export type MintInformationOrganicScoreLabelEnum = typeof MintInformationOrganicScoreLabelEnum[keyof typeof MintInformationOrganicScoreLabelEnum]; + + +/** + * Check if a given object implements the MintInformation interface. + */ +export function instanceOfMintInformation(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function MintInformationFromJSON(json: any): MintInformation { + return MintInformationFromJSONTyped(json, false); +} + +export function MintInformationFromJSONTyped(json: any, ignoreDiscriminator: boolean): MintInformation { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'id': !exists(json, 'id') ? undefined : json['id'], + 'name': !exists(json, 'name') ? undefined : json['name'], + 'symbol': !exists(json, 'symbol') ? undefined : json['symbol'], + 'icon': !exists(json, 'icon') ? undefined : json['icon'], + 'decimals': !exists(json, 'decimals') ? undefined : json['decimals'], + 'twitter': !exists(json, 'twitter') ? undefined : json['twitter'], + 'telegram': !exists(json, 'telegram') ? undefined : json['telegram'], + 'website': !exists(json, 'website') ? undefined : json['website'], + 'dev': !exists(json, 'dev') ? undefined : json['dev'], + 'circSupply': !exists(json, 'circSupply') ? undefined : json['circSupply'], + 'totalSupply': !exists(json, 'totalSupply') ? undefined : json['totalSupply'], + 'tokenProgram': !exists(json, 'tokenProgram') ? undefined : json['tokenProgram'], + 'launchpad': !exists(json, 'launchpad') ? undefined : json['launchpad'], + 'partnerConfig': !exists(json, 'partnerConfig') ? undefined : json['partnerConfig'], + 'graduatedPool': !exists(json, 'graduatedPool') ? undefined : json['graduatedPool'], + 'graduatedAt': !exists(json, 'graduatedAt') ? undefined : json['graduatedAt'], + 'holderCount': !exists(json, 'holderCount') ? undefined : json['holderCount'], + 'fdv': !exists(json, 'fdv') ? undefined : json['fdv'], + 'mcap': !exists(json, 'mcap') ? undefined : json['mcap'], + 'usdPrice': !exists(json, 'usdPrice') ? undefined : json['usdPrice'], + 'priceBlockId': !exists(json, 'priceBlockId') ? undefined : json['priceBlockId'], + 'liquidity': !exists(json, 'liquidity') ? undefined : json['liquidity'], + 'stats5m': !exists(json, 'stats5m') ? undefined : SwapStatsFromJSON(json['stats5m']), + 'stats1h': !exists(json, 'stats1h') ? undefined : SwapStatsFromJSON(json['stats1h']), + 'stats6h': !exists(json, 'stats6h') ? undefined : SwapStatsFromJSON(json['stats6h']), + 'stats24h': !exists(json, 'stats24h') ? undefined : SwapStatsFromJSON(json['stats24h']), + 'firstPool': !exists(json, 'firstPool') ? undefined : MintInformationFirstPoolFromJSON(json['firstPool']), + 'audit': !exists(json, 'audit') ? undefined : MintInformationAuditFromJSON(json['audit']), + 'organicScore': !exists(json, 'organicScore') ? undefined : json['organicScore'], + 'organicScoreLabel': !exists(json, 'organicScoreLabel') ? undefined : json['organicScoreLabel'], + 'isVerified': !exists(json, 'isVerified') ? undefined : json['isVerified'], + 'cexes': !exists(json, 'cexes') ? undefined : json['cexes'], + 'tags': !exists(json, 'tags') ? undefined : json['tags'], + 'updatedAt': !exists(json, 'updatedAt') ? undefined : (new Date(json['updatedAt'])), + }; +} + +export function MintInformationToJSON(value?: MintInformation | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'id': value.id, + 'name': value.name, + 'symbol': value.symbol, + 'icon': value.icon, + 'decimals': value.decimals, + 'twitter': value.twitter, + 'telegram': value.telegram, + 'website': value.website, + 'dev': value.dev, + 'circSupply': value.circSupply, + 'totalSupply': value.totalSupply, + 'tokenProgram': value.tokenProgram, + 'launchpad': value.launchpad, + 'partnerConfig': value.partnerConfig, + 'graduatedPool': value.graduatedPool, + 'graduatedAt': value.graduatedAt, + 'holderCount': value.holderCount, + 'fdv': value.fdv, + 'mcap': value.mcap, + 'usdPrice': value.usdPrice, + 'priceBlockId': value.priceBlockId, + 'liquidity': value.liquidity, + 'stats5m': SwapStatsToJSON(value.stats5m), + 'stats1h': SwapStatsToJSON(value.stats1h), + 'stats6h': SwapStatsToJSON(value.stats6h), + 'stats24h': SwapStatsToJSON(value.stats24h), + 'firstPool': MintInformationFirstPoolToJSON(value.firstPool), + 'audit': MintInformationAuditToJSON(value.audit), + 'organicScore': value.organicScore, + 'organicScoreLabel': value.organicScoreLabel, + 'isVerified': value.isVerified, + 'cexes': value.cexes, + 'tags': value.tags, + 'updatedAt': value.updatedAt === undefined ? undefined : (value.updatedAt.toISOString()), + }; +} + diff --git a/generated/models/MintInformationAudit.ts b/generated/models/MintInformationAudit.ts new file mode 100644 index 0000000..2afddaa --- /dev/null +++ b/generated/models/MintInformationAudit.ts @@ -0,0 +1,105 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface MintInformationAudit + */ +export interface MintInformationAudit { + /** + * + * @type {boolean} + * @memberof MintInformationAudit + */ + isSus?: boolean | null; + /** + * + * @type {boolean} + * @memberof MintInformationAudit + */ + mintAuthorityDisabled?: boolean | null; + /** + * + * @type {boolean} + * @memberof MintInformationAudit + */ + freezeAuthorityDisabled?: boolean | null; + /** + * + * @type {number} + * @memberof MintInformationAudit + */ + topHoldersPercentage?: number | null; + /** + * + * @type {number} + * @memberof MintInformationAudit + */ + devBalancePercentage?: number | null; + /** + * + * @type {number} + * @memberof MintInformationAudit + */ + devMigrations?: number | null; +} + +/** + * Check if a given object implements the MintInformationAudit interface. + */ +export function instanceOfMintInformationAudit(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function MintInformationAuditFromJSON(json: any): MintInformationAudit { + return MintInformationAuditFromJSONTyped(json, false); +} + +export function MintInformationAuditFromJSONTyped(json: any, ignoreDiscriminator: boolean): MintInformationAudit { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'isSus': !exists(json, 'isSus') ? undefined : json['isSus'], + 'mintAuthorityDisabled': !exists(json, 'mintAuthorityDisabled') ? undefined : json['mintAuthorityDisabled'], + 'freezeAuthorityDisabled': !exists(json, 'freezeAuthorityDisabled') ? undefined : json['freezeAuthorityDisabled'], + 'topHoldersPercentage': !exists(json, 'topHoldersPercentage') ? undefined : json['topHoldersPercentage'], + 'devBalancePercentage': !exists(json, 'devBalancePercentage') ? undefined : json['devBalancePercentage'], + 'devMigrations': !exists(json, 'devMigrations') ? undefined : json['devMigrations'], + }; +} + +export function MintInformationAuditToJSON(value?: MintInformationAudit | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'isSus': value.isSus, + 'mintAuthorityDisabled': value.mintAuthorityDisabled, + 'freezeAuthorityDisabled': value.freezeAuthorityDisabled, + 'topHoldersPercentage': value.topHoldersPercentage, + 'devBalancePercentage': value.devBalancePercentage, + 'devMigrations': value.devMigrations, + }; +} + diff --git a/generated/models/MintInformationFirstPool.ts b/generated/models/MintInformationFirstPool.ts new file mode 100644 index 0000000..bbb2fbe --- /dev/null +++ b/generated/models/MintInformationFirstPool.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface MintInformationFirstPool + */ +export interface MintInformationFirstPool { + /** + * + * @type {string} + * @memberof MintInformationFirstPool + */ + id?: string; + /** + * + * @type {string} + * @memberof MintInformationFirstPool + */ + createdAt?: string; +} + +/** + * Check if a given object implements the MintInformationFirstPool interface. + */ +export function instanceOfMintInformationFirstPool(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function MintInformationFirstPoolFromJSON(json: any): MintInformationFirstPool { + return MintInformationFirstPoolFromJSONTyped(json, false); +} + +export function MintInformationFirstPoolFromJSONTyped(json: any, ignoreDiscriminator: boolean): MintInformationFirstPool { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'id': !exists(json, 'id') ? undefined : json['id'], + 'createdAt': !exists(json, 'createdAt') ? undefined : json['createdAt'], + }; +} + +export function MintInformationFirstPoolToJSON(value?: MintInformationFirstPool | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'id': value.id, + 'createdAt': value.createdAt, + }; +} + diff --git a/generated/models/SearchTokens400Response.ts b/generated/models/SearchTokens400Response.ts new file mode 100644 index 0000000..ac0eb68 --- /dev/null +++ b/generated/models/SearchTokens400Response.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface SearchTokens400Response + */ +export interface SearchTokens400Response { + /** + * + * @type {string} + * @memberof SearchTokens400Response + */ + error: string; +} + +/** + * Check if a given object implements the SearchTokens400Response interface. + */ +export function instanceOfSearchTokens400Response(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "error" in value; + + return isInstance; +} + +export function SearchTokens400ResponseFromJSON(json: any): SearchTokens400Response { + return SearchTokens400ResponseFromJSONTyped(json, false); +} + +export function SearchTokens400ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): SearchTokens400Response { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'error': json['error'], + }; +} + +export function SearchTokens400ResponseToJSON(value?: SearchTokens400Response | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'error': value.error, + }; +} + diff --git a/generated/models/SwapStats.ts b/generated/models/SwapStats.ts new file mode 100644 index 0000000..c1d98ad --- /dev/null +++ b/generated/models/SwapStats.ts @@ -0,0 +1,161 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface SwapStats + */ +export interface SwapStats { + /** + * + * @type {number} + * @memberof SwapStats + */ + priceChange?: number | null; + /** + * + * @type {number} + * @memberof SwapStats + */ + holderChange?: number | null; + /** + * + * @type {number} + * @memberof SwapStats + */ + liquidityChange?: number | null; + /** + * + * @type {number} + * @memberof SwapStats + */ + volumeChange?: number | null; + /** + * + * @type {number} + * @memberof SwapStats + */ + buyVolume?: number | null; + /** + * + * @type {number} + * @memberof SwapStats + */ + sellVolume?: number | null; + /** + * + * @type {number} + * @memberof SwapStats + */ + buyOrganicVolume?: number | null; + /** + * + * @type {number} + * @memberof SwapStats + */ + sellOrganicVolume?: number | null; + /** + * + * @type {number} + * @memberof SwapStats + */ + numBuys?: number | null; + /** + * + * @type {number} + * @memberof SwapStats + */ + numSells?: number | null; + /** + * + * @type {number} + * @memberof SwapStats + */ + numTraders?: number | null; + /** + * + * @type {number} + * @memberof SwapStats + */ + numOrganicBuyers?: number | null; + /** + * + * @type {number} + * @memberof SwapStats + */ + numNetBuyers?: number | null; +} + +/** + * Check if a given object implements the SwapStats interface. + */ +export function instanceOfSwapStats(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function SwapStatsFromJSON(json: any): SwapStats { + return SwapStatsFromJSONTyped(json, false); +} + +export function SwapStatsFromJSONTyped(json: any, ignoreDiscriminator: boolean): SwapStats { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'priceChange': !exists(json, 'priceChange') ? undefined : json['priceChange'], + 'holderChange': !exists(json, 'holderChange') ? undefined : json['holderChange'], + 'liquidityChange': !exists(json, 'liquidityChange') ? undefined : json['liquidityChange'], + 'volumeChange': !exists(json, 'volumeChange') ? undefined : json['volumeChange'], + 'buyVolume': !exists(json, 'buyVolume') ? undefined : json['buyVolume'], + 'sellVolume': !exists(json, 'sellVolume') ? undefined : json['sellVolume'], + 'buyOrganicVolume': !exists(json, 'buyOrganicVolume') ? undefined : json['buyOrganicVolume'], + 'sellOrganicVolume': !exists(json, 'sellOrganicVolume') ? undefined : json['sellOrganicVolume'], + 'numBuys': !exists(json, 'numBuys') ? undefined : json['numBuys'], + 'numSells': !exists(json, 'numSells') ? undefined : json['numSells'], + 'numTraders': !exists(json, 'numTraders') ? undefined : json['numTraders'], + 'numOrganicBuyers': !exists(json, 'numOrganicBuyers') ? undefined : json['numOrganicBuyers'], + 'numNetBuyers': !exists(json, 'numNetBuyers') ? undefined : json['numNetBuyers'], + }; +} + +export function SwapStatsToJSON(value?: SwapStats | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'priceChange': value.priceChange, + 'holderChange': value.holderChange, + 'liquidityChange': value.liquidityChange, + 'volumeChange': value.volumeChange, + 'buyVolume': value.buyVolume, + 'sellVolume': value.sellVolume, + 'buyOrganicVolume': value.buyOrganicVolume, + 'sellOrganicVolume': value.sellOrganicVolume, + 'numBuys': value.numBuys, + 'numSells': value.numSells, + 'numTraders': value.numTraders, + 'numOrganicBuyers': value.numOrganicBuyers, + 'numNetBuyers': value.numNetBuyers, + }; +} + diff --git a/generated/models/index.ts b/generated/models/index.ts index f6a7db6..cde2f16 100644 --- a/generated/models/index.ts +++ b/generated/models/index.ts @@ -1,11 +1,16 @@ /* tslint:disable */ /* eslint-disable */ export * from './AccountMeta'; +export * from './ErrorResponse'; export * from './IndexedRouteMapResponse'; export * from './Instruction'; +export * from './MintInformation'; +export * from './MintInformationAudit'; +export * from './MintInformationFirstPool'; export * from './PlatformFee'; export * from './QuoteResponse'; export * from './RoutePlanStep'; +export * from './SearchTokens400Response'; export * from './SwapInfo'; export * from './SwapInstructionsResponse'; export * from './SwapMode'; @@ -13,3 +18,4 @@ export * from './SwapRequest'; export * from './SwapRequestPrioritizationFeeLamports'; export * from './SwapRequestPrioritizationFeeLamportsPriorityLevelWithMaxLamports'; export * from './SwapResponse'; +export * from './SwapStats'; diff --git a/src/index.ts b/src/index.ts index 58edb4d..3595057 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,27 +1,52 @@ +import { TokenApi } from "generated/apis"; import { SwapApi } from "../generated/apis/SwapApi"; import { ConfigurationParameters, Configuration } from "../generated/runtime"; +interface UrlConfig { + PUBLIC: string; + API_KEY: string; +} + // Define server URLs -const PUBLIC_SERVER_URL = "https://lite-api.jup.ag/swap/v1"; -const API_KEY_SERVER_URL = "https://api.jup.ag/swap/v1"; +const serverUrls: Record = { + swap: { + PUBLIC: "https://lite-api.jup.ag/swap/v1", + API_KEY: "https://api.jup.ag/swap/v1", + }, + token: { + PUBLIC: "https://lite-api.jup.ag/tokens/v2", + API_KEY: "https://api.jup.ag/tokens/v2", + }, +} /** * Creates a Jupiter API client with optional API key support * @param config Configuration parameters - * @returns SwapApi instance + * @returns Jupiter API instance partitioned by category */ export const createJupiterApiClient = (config?: ConfigurationParameters) => { + return { + swap: new SwapApi(urlConfig(serverUrls.swap, config)), + token: new TokenApi(urlConfig(serverUrls.token, config)) + } +}; + +/** + * Attaches Server Urls to optional ConfigurationParameters + * @param urls Server Urls (i.e. API Routes) + * @param config Configuration parameters + * @returns Api Configuration with Server Urls + */ +const urlConfig = (urls: UrlConfig, config?: ConfigurationParameters): Configuration => { // Determine which server URL to use based on whether an API key is provided const hasApiKey = config?.apiKey !== undefined; - // Create a new configuration with the appropriate base path const configWithServer: ConfigurationParameters = { ...config, - basePath: hasApiKey ? API_KEY_SERVER_URL : PUBLIC_SERVER_URL, + basePath: hasApiKey ? urls.API_KEY : urls.PUBLIC, headers: hasApiKey ? { 'x-api-key': config?.apiKey as string } : undefined }; - - return new SwapApi(new Configuration(configWithServer)); -}; + return new Configuration(configWithServer); +} export * from "../generated"; diff --git a/swagger.yaml b/swagger.yaml index 67f384e..51492ef 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -22,6 +22,7 @@ servers: description: Paid tier API endpoint with higher rate limits to be used with an API Key paths: + # SwapAPI /quote: get: operationId: QuoteGet @@ -124,6 +125,212 @@ paths: type: object additionalProperties: type: string + + # TokenAPI + /search: + get: + tags: + - Token + operationId: searchTokens + summary: search + description: | + Request a search by token's symbol, name or mint address + + :::note + - Refer to [Token API doc](/docs/token-api/v2) for more information + ::: + parameters: + - in: query + name: query + schema: + type: string + required: true + description: | + - Search for a token and its information by its symbol, name or mint address + - Comma-separate to ONLY search for multiple mint addresses + - Limit to 100 mint addresses in query + - Default to 20 mints in response when searching via symbol or name + responses: + "200": + description: Successful response + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/MintInformation" + "400": + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + required: + - error + "500": + description: Internal server error + content: + application/json: + schema: + type: object + properties: + error: + type: string + required: + - error + /tag: + get: + tags: + - Token + operationId: getTokensByTag + summary: tag + description: | + Request an array of mints and their information by a tag + - Note that this will return the entire array of existing mints that belongs to the tag. + + :::note + - Refer to [Token API doc](/docs/token-api/v2) for more information + ::: + parameters: + - in: query + name: query + schema: + type: string + enum: + - lst + - verified + required: true + responses: + "200": + description: Successful response + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/MintInformation" + "400": + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + required: + - error + "500": + description: Internal server error + content: + application/json: + schema: + type: object + properties: + error: + type: string + required: + - error + /{category}/{interval}: + get: + tags: + - Token + operationId: getCategoryByInterval + summary: category + description: | + Returns an array of mints and their information for the given category and interval + + :::note + - Refer to [Token API doc](/docs/token-api/v2) for more information + ::: + parameters: + - in: path + name: category + required: true + schema: + type: string + enum: [toporganicscore, toptraded, toptrending] + description: | + - Top tokens in different trading categories + - The result filters out generic top tokens like SOL, USDC, etc + - Default to 50 mints in response + - in: path + name: interval + required: true + schema: + type: string + enum: [5m, 1h, 6h, 24h] + description: | + - Query by time interval for more accuracy + - in: query + name: limit + schema: + type: integer + minimum: 1 + maximum: 100 + required: false + description: | + - Maximum number of results to return (default 50, max 100) + responses: + "200": + description: Successful response + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/MintInformation" + "400": + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "500": + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + /recent: + get: + tags: + - Token + operationId: getRecentTokens + summary: recent + description: | + Returns an array of mints that recently had their **first created pool** + - Default to 30 mints in response + + :::note + - Refer to [Token API doc](/docs/token-api/v2) for more information + ::: + + responses: + "200": + description: Successful response + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/MintInformation" + "400": + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "500": + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + components: schemas: @@ -456,6 +663,187 @@ components: - 3 - 4 + ErrorResponse: + type: object + properties: + error: + type: string + required: [error] + + MintInformation: + type: object + properties: + id: + type: string + description: The token's mint address + name: + type: string + symbol: + type: string + icon: + type: string + nullable: true + decimals: + type: number + twitter: + type: string + nullable: true + telegram: + type: string + nullable: true + website: + type: string + nullable: true + dev: + type: string + nullable: true + description: The token's developer address + circSupply: + type: number + nullable: true + totalSupply: + type: number + nullable: true + tokenProgram: + type: string + description: The token program address + launchpad: + type: string + nullable: true + partnerConfig: + type: string + nullable: true + graduatedPool: + type: string + nullable: true + graduatedAt: + type: string + nullable: true + holderCount: + type: integer + nullable: true + fdv: + type: number + nullable: true + mcap: + type: number + nullable: true + usdPrice: + type: number + nullable: true + priceBlockId: + type: integer + nullable: true + liquidity: + type: number + nullable: true + stats5m: + $ref: "#/components/schemas/SwapStats" + nullable: true + stats1h: + $ref: "#/components/schemas/SwapStats" + nullable: true + stats6h: + $ref: "#/components/schemas/SwapStats" + nullable: true + stats24h: + $ref: "#/components/schemas/SwapStats" + nullable: true + firstPool: + type: object + nullable: true + properties: + id: + type: string + createdAt: + type: string + audit: + type: object + nullable: true + properties: + isSus: + type: boolean + nullable: true + mintAuthorityDisabled: + type: boolean + nullable: true + freezeAuthorityDisabled: + type: boolean + nullable: true + topHoldersPercentage: + type: number + nullable: true + devBalancePercentage: + type: number + nullable: true + devMigrations: + type: number + nullable: true + organicScore: + type: number + organicScoreLabel: + type: string + enum: [high, medium, low] + isVerified: + type: boolean + nullable: true + cexes: + type: array + items: + type: string + nullable: true + tags: + type: array + items: + type: string + nullable: true + updatedAt: + type: string + format: date-time + + SwapStats: + type: object + properties: + priceChange: + type: number + nullable: true + holderChange: + type: number + nullable: true + liquidityChange: + type: number + nullable: true + volumeChange: + type: number + nullable: true + buyVolume: + type: number + nullable: true + sellVolume: + type: number + nullable: true + buyOrganicVolume: + type: number + nullable: true + sellOrganicVolume: + type: number + nullable: true + numBuys: + type: integer + nullable: true + numSells: + type: integer + nullable: true + numTraders: + type: integer + nullable: true + numOrganicBuyers: + type: integer + nullable: true + numNetBuyers: + type: integer + nullable: true + parameters: InputMintParameter: name: inputMint From b7170ad9be56586c36b8c625ee7864b6fc47b0f6 Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Wed, 8 Oct 2025 14:35:45 +0200 Subject: [PATCH 2/2] Ultra API (#1) Migrated from https://github.com/jup-ag/docs/blob/main/openapi/ultra.yaml Added operationId and tag to each route. Solved a few swagger errors on the generator. Extend the exported client with an "ultra" route. Adjusted a test that should have been done in the previous PR). --- generated/.openapi-generator/FILES | 18 +- generated/apis/TokenApi.ts | 6 +- generated/apis/UltraApi.ts | 323 ++++++++ generated/apis/index.ts | 1 + generated/models/GetOrder200Response.ts | 375 +++++++++ .../models/GetOrder200ResponsePlatformFee.ts | 75 ++ .../GetOrder200ResponseRoutePlanInner.ts | 91 +++ ...tOrder200ResponseRoutePlanInnerSwapInfo.ts | 129 ++++ ...s400Response.ts => GetOrder400Response.ts} | 18 +- .../models/GetRouters200ResponseInner.ts | 96 +++ generated/models/GetSheild200Response.ts | 73 ++ .../GetSheild200ResponseWarningsValueInner.ts | 136 ++++ generated/models/GetShield200Response.ts | 73 ++ .../GetShield200ResponseWarningsValueInner.ts | 136 ++++ generated/models/HoldingsResponse.ts | 100 +++ generated/models/NativeHoldingsResponse.ts | 84 ++ generated/models/PostExecute200Response.ts | 157 ++++ .../PostExecute200ResponseSwapEventsInner.ts | 93 +++ generated/models/PostExecute400Response.ts | 75 ++ generated/models/PostExecuteRequest.ts | 77 ++ generated/models/TokenAccount.ts | 129 ++++ generated/models/index.ts | 17 +- package.json | 4 +- src/index.ts | 8 +- swagger.yaml | 718 +++++++++++++++++- tests/index.test.ts | 4 +- 26 files changed, 2966 insertions(+), 50 deletions(-) create mode 100644 generated/apis/UltraApi.ts create mode 100644 generated/models/GetOrder200Response.ts create mode 100644 generated/models/GetOrder200ResponsePlatformFee.ts create mode 100644 generated/models/GetOrder200ResponseRoutePlanInner.ts create mode 100644 generated/models/GetOrder200ResponseRoutePlanInnerSwapInfo.ts rename generated/models/{SearchTokens400Response.ts => GetOrder400Response.ts} (67%) create mode 100644 generated/models/GetRouters200ResponseInner.ts create mode 100644 generated/models/GetSheild200Response.ts create mode 100644 generated/models/GetSheild200ResponseWarningsValueInner.ts create mode 100644 generated/models/GetShield200Response.ts create mode 100644 generated/models/GetShield200ResponseWarningsValueInner.ts create mode 100644 generated/models/HoldingsResponse.ts create mode 100644 generated/models/NativeHoldingsResponse.ts create mode 100644 generated/models/PostExecute200Response.ts create mode 100644 generated/models/PostExecute200ResponseSwapEventsInner.ts create mode 100644 generated/models/PostExecute400Response.ts create mode 100644 generated/models/PostExecuteRequest.ts create mode 100644 generated/models/TokenAccount.ts diff --git a/generated/.openapi-generator/FILES b/generated/.openapi-generator/FILES index f12e43a..e5f3839 100644 --- a/generated/.openapi-generator/FILES +++ b/generated/.openapi-generator/FILES @@ -1,18 +1,31 @@ apis/SwapApi.ts apis/TokenApi.ts +apis/UltraApi.ts apis/index.ts index.ts models/AccountMeta.ts models/ErrorResponse.ts -models/IndexedRouteMapResponse.ts +models/GetOrder200Response.ts +models/GetOrder200ResponsePlatformFee.ts +models/GetOrder200ResponseRoutePlanInner.ts +models/GetOrder200ResponseRoutePlanInnerSwapInfo.ts +models/GetOrder400Response.ts +models/GetRouters200ResponseInner.ts +models/GetShield200Response.ts +models/GetShield200ResponseWarningsValueInner.ts +models/HoldingsResponse.ts models/Instruction.ts models/MintInformation.ts models/MintInformationAudit.ts models/MintInformationFirstPool.ts +models/NativeHoldingsResponse.ts models/PlatformFee.ts +models/PostExecute200Response.ts +models/PostExecute200ResponseSwapEventsInner.ts +models/PostExecute400Response.ts +models/PostExecuteRequest.ts models/QuoteResponse.ts models/RoutePlanStep.ts -models/SearchTokens400Response.ts models/SwapInfo.ts models/SwapInstructionsResponse.ts models/SwapMode.ts @@ -21,5 +34,6 @@ models/SwapRequestPrioritizationFeeLamports.ts models/SwapRequestPrioritizationFeeLamportsPriorityLevelWithMaxLamports.ts models/SwapResponse.ts models/SwapStats.ts +models/TokenAccount.ts models/index.ts runtime.ts diff --git a/generated/apis/TokenApi.ts b/generated/apis/TokenApi.ts index 2c192ea..de12e73 100644 --- a/generated/apis/TokenApi.ts +++ b/generated/apis/TokenApi.ts @@ -16,16 +16,16 @@ import * as runtime from '../runtime'; import type { ErrorResponse, + GetOrder400Response, MintInformation, - SearchTokens400Response, } from '../models/index'; import { ErrorResponseFromJSON, ErrorResponseToJSON, + GetOrder400ResponseFromJSON, + GetOrder400ResponseToJSON, MintInformationFromJSON, MintInformationToJSON, - SearchTokens400ResponseFromJSON, - SearchTokens400ResponseToJSON, } from '../models/index'; export interface GetCategoryByIntervalRequest { diff --git a/generated/apis/UltraApi.ts b/generated/apis/UltraApi.ts new file mode 100644 index 0000000..c31286b --- /dev/null +++ b/generated/apis/UltraApi.ts @@ -0,0 +1,323 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + GetOrder200Response, + GetOrder400Response, + GetRouters200ResponseInner, + GetShield200Response, + HoldingsResponse, + NativeHoldingsResponse, + PostExecute200Response, + PostExecute400Response, + PostExecuteRequest, +} from '../models/index'; +import { + GetOrder200ResponseFromJSON, + GetOrder200ResponseToJSON, + GetOrder400ResponseFromJSON, + GetOrder400ResponseToJSON, + GetRouters200ResponseInnerFromJSON, + GetRouters200ResponseInnerToJSON, + GetShield200ResponseFromJSON, + GetShield200ResponseToJSON, + HoldingsResponseFromJSON, + HoldingsResponseToJSON, + NativeHoldingsResponseFromJSON, + NativeHoldingsResponseToJSON, + PostExecute200ResponseFromJSON, + PostExecute200ResponseToJSON, + PostExecute400ResponseFromJSON, + PostExecute400ResponseToJSON, + PostExecuteRequestFromJSON, + PostExecuteRequestToJSON, +} from '../models/index'; + +export interface GetHoldingsRequest { + address: string; +} + +export interface GetNativeHoldingsRequest { + address: string; +} + +export interface GetOrderRequest { + inputMint: string; + outputMint: string; + amount: string; + taker?: string; + referralAccount?: string; + referralFee?: number; + excludeRouters?: GetOrderExcludeRoutersEnum; + excludeDexes?: string; +} + +export interface GetShieldRequest { + mints: string; +} + +export interface PostExecuteOperationRequest { + postExecuteRequest?: PostExecuteRequest; +} + +/** + * + */ +export class UltraApi extends runtime.BaseAPI { + + /** + * Request for detailed token holdings of an account including token account information :::note - Refer to [Ultra API doc](/docs/ultra-api/get-holdings) for more information ::: + * holdings + */ + async getHoldingsRaw(requestParameters: GetHoldingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.address === null || requestParameters.address === undefined) { + throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling getHoldings.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/holdings/{address}`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => HoldingsResponseFromJSON(jsonValue)); + } + + /** + * Request for detailed token holdings of an account including token account information :::note - Refer to [Ultra API doc](/docs/ultra-api/get-holdings) for more information ::: + * holdings + */ + async getHoldings(requestParameters: GetHoldingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getHoldingsRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Request for native SOL holdings only, without other tokens :::note - This is a more efficient endpoint when you only need SOL balance - Refer to [Ultra API doc](/docs/ultra-api/get-holdings) for more information ::: + * holdings (native) + */ + async getNativeHoldingsRaw(requestParameters: GetNativeHoldingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.address === null || requestParameters.address === undefined) { + throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling getNativeHoldings.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/holdings/{address}/native`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => NativeHoldingsResponseFromJSON(jsonValue)); + } + + /** + * Request for native SOL holdings only, without other tokens :::note - This is a more efficient endpoint when you only need SOL balance - Refer to [Ultra API doc](/docs/ultra-api/get-holdings) for more information ::: + * holdings (native) + */ + async getNativeHoldings(requestParameters: GetNativeHoldingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getNativeHoldingsRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Request for a base64-encoded unsigned swap transaction to be used in `POST /ultra/v1/execute` :::note - Refer to [Ultra API doc](/docs/ultra-api/get-order) for more information ::: + * order + */ + async getOrderRaw(requestParameters: GetOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.inputMint === null || requestParameters.inputMint === undefined) { + throw new runtime.RequiredError('inputMint','Required parameter requestParameters.inputMint was null or undefined when calling getOrder.'); + } + + if (requestParameters.outputMint === null || requestParameters.outputMint === undefined) { + throw new runtime.RequiredError('outputMint','Required parameter requestParameters.outputMint was null or undefined when calling getOrder.'); + } + + if (requestParameters.amount === null || requestParameters.amount === undefined) { + throw new runtime.RequiredError('amount','Required parameter requestParameters.amount was null or undefined when calling getOrder.'); + } + + const queryParameters: any = {}; + + if (requestParameters.inputMint !== undefined) { + queryParameters['inputMint'] = requestParameters.inputMint; + } + + if (requestParameters.outputMint !== undefined) { + queryParameters['outputMint'] = requestParameters.outputMint; + } + + if (requestParameters.amount !== undefined) { + queryParameters['amount'] = requestParameters.amount; + } + + if (requestParameters.taker !== undefined) { + queryParameters['taker'] = requestParameters.taker; + } + + if (requestParameters.referralAccount !== undefined) { + queryParameters['referralAccount'] = requestParameters.referralAccount; + } + + if (requestParameters.referralFee !== undefined) { + queryParameters['referralFee'] = requestParameters.referralFee; + } + + if (requestParameters.excludeRouters !== undefined) { + queryParameters['excludeRouters'] = requestParameters.excludeRouters; + } + + if (requestParameters.excludeDexes !== undefined) { + queryParameters['excludeDexes'] = requestParameters.excludeDexes; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/order`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => GetOrder200ResponseFromJSON(jsonValue)); + } + + /** + * Request for a base64-encoded unsigned swap transaction to be used in `POST /ultra/v1/execute` :::note - Refer to [Ultra API doc](/docs/ultra-api/get-order) for more information ::: + * order + */ + async getOrder(requestParameters: GetOrderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getOrderRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Request for the list of routers available in the routing engine of Ultra, which is [Juno](/docs/routing#juno-liquidity-engine) + * routers + */ + async getRoutersRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/order/routers`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(GetRouters200ResponseInnerFromJSON)); + } + + /** + * Request for the list of routers available in the routing engine of Ultra, which is [Juno](/docs/routing#juno-liquidity-engine) + * routers + */ + async getRouters(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const response = await this.getRoutersRaw(initOverrides); + return await response.value(); + } + + /** + * Request for token information and warnings of mints :::note - Refer to [Ultra API doc](/docs/ultra-api/get-shield) for more information ::: + * shield + */ + async getShieldRaw(requestParameters: GetShieldRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.mints === null || requestParameters.mints === undefined) { + throw new runtime.RequiredError('mints','Required parameter requestParameters.mints was null or undefined when calling getShield.'); + } + + const queryParameters: any = {}; + + if (requestParameters.mints !== undefined) { + queryParameters['mints'] = requestParameters.mints; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/shield`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => GetShield200ResponseFromJSON(jsonValue)); + } + + /** + * Request for token information and warnings of mints :::note - Refer to [Ultra API doc](/docs/ultra-api/get-shield) for more information ::: + * shield + */ + async getShield(requestParameters: GetShieldRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getShieldRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Execute the signed transaction and get the execution status :::note - Do note that the `requestId` is found in the response of `/order` - Refer to [Ultra API doc](/docs/ultra-api/execute-order) for more information ::: + * execute + */ + async postExecuteRaw(requestParameters: PostExecuteOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + const response = await this.request({ + path: `/execute`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: PostExecuteRequestToJSON(requestParameters.postExecuteRequest), + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => PostExecute200ResponseFromJSON(jsonValue)); + } + + /** + * Execute the signed transaction and get the execution status :::note - Do note that the `requestId` is found in the response of `/order` - Refer to [Ultra API doc](/docs/ultra-api/execute-order) for more information ::: + * execute + */ + async postExecute(requestParameters: PostExecuteOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.postExecuteRaw(requestParameters, initOverrides); + return await response.value(); + } + +} + +/** + * @export + */ +export const GetOrderExcludeRoutersEnum = { + Metis: 'metis', + Jupiterz: 'jupiterz', + Dflow: 'dflow', + Okx: 'okx' +} as const; +export type GetOrderExcludeRoutersEnum = typeof GetOrderExcludeRoutersEnum[keyof typeof GetOrderExcludeRoutersEnum]; diff --git a/generated/apis/index.ts b/generated/apis/index.ts index 283d79f..2a168c8 100644 --- a/generated/apis/index.ts +++ b/generated/apis/index.ts @@ -2,3 +2,4 @@ /* eslint-disable */ export * from './SwapApi'; export * from './TokenApi'; +export * from './UltraApi'; diff --git a/generated/models/GetOrder200Response.ts b/generated/models/GetOrder200Response.ts new file mode 100644 index 0000000..123b84e --- /dev/null +++ b/generated/models/GetOrder200Response.ts @@ -0,0 +1,375 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { GetOrder200ResponsePlatformFee } from './GetOrder200ResponsePlatformFee'; +import { + GetOrder200ResponsePlatformFeeFromJSON, + GetOrder200ResponsePlatformFeeFromJSONTyped, + GetOrder200ResponsePlatformFeeToJSON, +} from './GetOrder200ResponsePlatformFee'; +import type { GetOrder200ResponseRoutePlanInner } from './GetOrder200ResponseRoutePlanInner'; +import { + GetOrder200ResponseRoutePlanInnerFromJSON, + GetOrder200ResponseRoutePlanInnerFromJSONTyped, + GetOrder200ResponseRoutePlanInnerToJSON, +} from './GetOrder200ResponseRoutePlanInner'; + +/** + * + * @export + * @interface GetOrder200Response + */ +export interface GetOrder200Response { + /** + * - Either 'manual' or 'ultra', defaults to `ultra` + * - Defaults to `ultra`, unless manual parameters are defined which is not the intended use of the API + * + * @type {string} + * @memberof GetOrder200Response + */ + mode: string; + /** + * + * @type {string} + * @memberof GetOrder200Response + */ + inputMint: string; + /** + * + * @type {string} + * @memberof GetOrder200Response + */ + outputMint: string; + /** + * + * @type {string} + * @memberof GetOrder200Response + */ + inAmount: string; + /** + * + * @type {string} + * @memberof GetOrder200Response + */ + outAmount: string; + /** + * + * @type {string} + * @memberof GetOrder200Response + */ + otherAmountThreshold: string; + /** + * + * @type {string} + * @memberof GetOrder200Response + */ + swapMode: string; + /** + * + * @type {number} + * @memberof GetOrder200Response + */ + slippageBps: number; + /** + * + * @type {number} + * @memberof GetOrder200Response + */ + inUsdValue?: number; + /** + * + * @type {number} + * @memberof GetOrder200Response + */ + outUsdValue?: number; + /** + * + * @type {number} + * @memberof GetOrder200Response + */ + priceImpact?: number; + /** + * + * @type {number} + * @memberof GetOrder200Response + */ + swapUsdValue?: number; + /** + * - Please use `priceImpact` field instead, this is still available only for backwards compatibility + * + * @type {string} + * @memberof GetOrder200Response + */ + priceImpactPct: string; + /** + * + * @type {Array} + * @memberof GetOrder200Response + */ + routePlan: Array; + /** + * + * @type {string} + * @memberof GetOrder200Response + */ + feeMint?: string; + /** + * + * @type {number} + * @memberof GetOrder200Response + */ + feeBps: number; + /** + * - The number of lamports the taker has to pay as a base network fee, if a valid transaction is returned. This may be 0 if the transaction is gasless, in which case the gas payer will cover this fee. + * + * @type {number} + * @memberof GetOrder200Response + */ + signatureFeeLamports: number; + /** + * - The number of lamports the taker has to pay for higher priority landing, if a valid transaction is returned. Includes priority fees and tips for services such as Jito, if any. This may be 0 if the transaction is gasless, in which case the gas payer will cover this fee. + * + * @type {number} + * @memberof GetOrder200Response + */ + prioritizationFeeLamports: number; + /** + * - The number of lamports the taker has to pay for rent, if a valid transaction is returned. This may be 0 if the transaction is gasless, in which case the gas payer will cover this fee. Note that this value is just an estimate. + * + * @type {number} + * @memberof GetOrder200Response + */ + rentFeeLamports: number; + /** + * - Deprecated, in favour of router + * + * @type {string} + * @memberof GetOrder200Response + */ + swapType: string; + /** + * + * @type {string} + * @memberof GetOrder200Response + */ + router: GetOrder200ResponseRouterEnum; + /** + * - Unsigned base-64 encoded transaction to be signed and used in `/execute` + * - If `taker` is null, this field will be null. Else, it will either be a valid base64 encoded transaction or the empty string + * + * @type {string} + * @memberof GetOrder200Response + */ + transaction: string | null; + /** + * + * @type {boolean} + * @memberof GetOrder200Response + */ + gasless: boolean; + /** + * - Required to make a request to `/execute` + * + * @type {string} + * @memberof GetOrder200Response + */ + requestId: string; + /** + * + * @type {number} + * @memberof GetOrder200Response + */ + totalTime: number; + /** + * + * @type {string} + * @memberof GetOrder200Response + */ + taker: string | null; + /** + * + * @type {string} + * @memberof GetOrder200Response + */ + quoteId?: string; + /** + * + * @type {string} + * @memberof GetOrder200Response + */ + maker?: string; + /** + * + * @type {string} + * @memberof GetOrder200Response + */ + expireAt?: string; + /** + * + * @type {GetOrder200ResponsePlatformFee} + * @memberof GetOrder200Response + */ + platformFee?: GetOrder200ResponsePlatformFee; + /** + * - This field will be present if `taker` is defined and `transaction` is the empty string + * - It is unique for each error scenarios + * + * @type {number} + * @memberof GetOrder200Response + */ + errorCode?: number; + /** + * - This field will be present if `taker` is defined and `transaction` is the empty string + * - This field can still return despite having a valid order/quote + * - This is meant for display purposes only and it is discouraged to match these error messages as they could be parameterized + * + * @type {string} + * @memberof GetOrder200Response + */ + errorMessage?: string; +} + + +/** + * @export + */ +export const GetOrder200ResponseRouterEnum = { + Aggregator: 'aggregator', + Jupiterz: 'jupiterz', + Dflow: 'dflow', + Okx: 'okx' +} as const; +export type GetOrder200ResponseRouterEnum = typeof GetOrder200ResponseRouterEnum[keyof typeof GetOrder200ResponseRouterEnum]; + + +/** + * Check if a given object implements the GetOrder200Response interface. + */ +export function instanceOfGetOrder200Response(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "mode" in value; + isInstance = isInstance && "inputMint" in value; + isInstance = isInstance && "outputMint" in value; + isInstance = isInstance && "inAmount" in value; + isInstance = isInstance && "outAmount" in value; + isInstance = isInstance && "otherAmountThreshold" in value; + isInstance = isInstance && "swapMode" in value; + isInstance = isInstance && "slippageBps" in value; + isInstance = isInstance && "priceImpactPct" in value; + isInstance = isInstance && "routePlan" in value; + isInstance = isInstance && "feeBps" in value; + isInstance = isInstance && "signatureFeeLamports" in value; + isInstance = isInstance && "prioritizationFeeLamports" in value; + isInstance = isInstance && "rentFeeLamports" in value; + isInstance = isInstance && "swapType" in value; + isInstance = isInstance && "router" in value; + isInstance = isInstance && "transaction" in value; + isInstance = isInstance && "gasless" in value; + isInstance = isInstance && "requestId" in value; + isInstance = isInstance && "totalTime" in value; + isInstance = isInstance && "taker" in value; + + return isInstance; +} + +export function GetOrder200ResponseFromJSON(json: any): GetOrder200Response { + return GetOrder200ResponseFromJSONTyped(json, false); +} + +export function GetOrder200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetOrder200Response { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'mode': json['mode'], + 'inputMint': json['inputMint'], + 'outputMint': json['outputMint'], + 'inAmount': json['inAmount'], + 'outAmount': json['outAmount'], + 'otherAmountThreshold': json['otherAmountThreshold'], + 'swapMode': json['swapMode'], + 'slippageBps': json['slippageBps'], + 'inUsdValue': !exists(json, 'inUsdValue') ? undefined : json['inUsdValue'], + 'outUsdValue': !exists(json, 'outUsdValue') ? undefined : json['outUsdValue'], + 'priceImpact': !exists(json, 'priceImpact') ? undefined : json['priceImpact'], + 'swapUsdValue': !exists(json, 'swapUsdValue') ? undefined : json['swapUsdValue'], + 'priceImpactPct': json['priceImpactPct'], + 'routePlan': ((json['routePlan'] as Array).map(GetOrder200ResponseRoutePlanInnerFromJSON)), + 'feeMint': !exists(json, 'feeMint') ? undefined : json['feeMint'], + 'feeBps': json['feeBps'], + 'signatureFeeLamports': json['signatureFeeLamports'], + 'prioritizationFeeLamports': json['prioritizationFeeLamports'], + 'rentFeeLamports': json['rentFeeLamports'], + 'swapType': json['swapType'], + 'router': json['router'], + 'transaction': json['transaction'], + 'gasless': json['gasless'], + 'requestId': json['requestId'], + 'totalTime': json['totalTime'], + 'taker': json['taker'], + 'quoteId': !exists(json, 'quoteId') ? undefined : json['quoteId'], + 'maker': !exists(json, 'maker') ? undefined : json['maker'], + 'expireAt': !exists(json, 'expireAt') ? undefined : json['expireAt'], + 'platformFee': !exists(json, 'platformFee') ? undefined : GetOrder200ResponsePlatformFeeFromJSON(json['platformFee']), + 'errorCode': !exists(json, 'errorCode') ? undefined : json['errorCode'], + 'errorMessage': !exists(json, 'errorMessage') ? undefined : json['errorMessage'], + }; +} + +export function GetOrder200ResponseToJSON(value?: GetOrder200Response | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'mode': value.mode, + 'inputMint': value.inputMint, + 'outputMint': value.outputMint, + 'inAmount': value.inAmount, + 'outAmount': value.outAmount, + 'otherAmountThreshold': value.otherAmountThreshold, + 'swapMode': value.swapMode, + 'slippageBps': value.slippageBps, + 'inUsdValue': value.inUsdValue, + 'outUsdValue': value.outUsdValue, + 'priceImpact': value.priceImpact, + 'swapUsdValue': value.swapUsdValue, + 'priceImpactPct': value.priceImpactPct, + 'routePlan': ((value.routePlan as Array).map(GetOrder200ResponseRoutePlanInnerToJSON)), + 'feeMint': value.feeMint, + 'feeBps': value.feeBps, + 'signatureFeeLamports': value.signatureFeeLamports, + 'prioritizationFeeLamports': value.prioritizationFeeLamports, + 'rentFeeLamports': value.rentFeeLamports, + 'swapType': value.swapType, + 'router': value.router, + 'transaction': value.transaction, + 'gasless': value.gasless, + 'requestId': value.requestId, + 'totalTime': value.totalTime, + 'taker': value.taker, + 'quoteId': value.quoteId, + 'maker': value.maker, + 'expireAt': value.expireAt, + 'platformFee': GetOrder200ResponsePlatformFeeToJSON(value.platformFee), + 'errorCode': value.errorCode, + 'errorMessage': value.errorMessage, + }; +} + diff --git a/generated/models/GetOrder200ResponsePlatformFee.ts b/generated/models/GetOrder200ResponsePlatformFee.ts new file mode 100644 index 0000000..5f3f97b --- /dev/null +++ b/generated/models/GetOrder200ResponsePlatformFee.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface GetOrder200ResponsePlatformFee + */ +export interface GetOrder200ResponsePlatformFee { + /** + * + * @type {string} + * @memberof GetOrder200ResponsePlatformFee + */ + amount: string; + /** + * + * @type {number} + * @memberof GetOrder200ResponsePlatformFee + */ + feeBps: number; +} + +/** + * Check if a given object implements the GetOrder200ResponsePlatformFee interface. + */ +export function instanceOfGetOrder200ResponsePlatformFee(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "amount" in value; + isInstance = isInstance && "feeBps" in value; + + return isInstance; +} + +export function GetOrder200ResponsePlatformFeeFromJSON(json: any): GetOrder200ResponsePlatformFee { + return GetOrder200ResponsePlatformFeeFromJSONTyped(json, false); +} + +export function GetOrder200ResponsePlatformFeeFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetOrder200ResponsePlatformFee { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'amount': json['amount'], + 'feeBps': json['feeBps'], + }; +} + +export function GetOrder200ResponsePlatformFeeToJSON(value?: GetOrder200ResponsePlatformFee | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'amount': value.amount, + 'feeBps': value.feeBps, + }; +} + diff --git a/generated/models/GetOrder200ResponseRoutePlanInner.ts b/generated/models/GetOrder200ResponseRoutePlanInner.ts new file mode 100644 index 0000000..bd85b3c --- /dev/null +++ b/generated/models/GetOrder200ResponseRoutePlanInner.ts @@ -0,0 +1,91 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { GetOrder200ResponseRoutePlanInnerSwapInfo } from './GetOrder200ResponseRoutePlanInnerSwapInfo'; +import { + GetOrder200ResponseRoutePlanInnerSwapInfoFromJSON, + GetOrder200ResponseRoutePlanInnerSwapInfoFromJSONTyped, + GetOrder200ResponseRoutePlanInnerSwapInfoToJSON, +} from './GetOrder200ResponseRoutePlanInnerSwapInfo'; + +/** + * + * @export + * @interface GetOrder200ResponseRoutePlanInner + */ +export interface GetOrder200ResponseRoutePlanInner { + /** + * + * @type {GetOrder200ResponseRoutePlanInnerSwapInfo} + * @memberof GetOrder200ResponseRoutePlanInner + */ + swapInfo: GetOrder200ResponseRoutePlanInnerSwapInfo; + /** + * + * @type {number} + * @memberof GetOrder200ResponseRoutePlanInner + */ + percent: number; + /** + * + * @type {number} + * @memberof GetOrder200ResponseRoutePlanInner + */ + bps: number; +} + +/** + * Check if a given object implements the GetOrder200ResponseRoutePlanInner interface. + */ +export function instanceOfGetOrder200ResponseRoutePlanInner(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "swapInfo" in value; + isInstance = isInstance && "percent" in value; + isInstance = isInstance && "bps" in value; + + return isInstance; +} + +export function GetOrder200ResponseRoutePlanInnerFromJSON(json: any): GetOrder200ResponseRoutePlanInner { + return GetOrder200ResponseRoutePlanInnerFromJSONTyped(json, false); +} + +export function GetOrder200ResponseRoutePlanInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetOrder200ResponseRoutePlanInner { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'swapInfo': GetOrder200ResponseRoutePlanInnerSwapInfoFromJSON(json['swapInfo']), + 'percent': json['percent'], + 'bps': json['bps'], + }; +} + +export function GetOrder200ResponseRoutePlanInnerToJSON(value?: GetOrder200ResponseRoutePlanInner | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'swapInfo': GetOrder200ResponseRoutePlanInnerSwapInfoToJSON(value.swapInfo), + 'percent': value.percent, + 'bps': value.bps, + }; +} + diff --git a/generated/models/GetOrder200ResponseRoutePlanInnerSwapInfo.ts b/generated/models/GetOrder200ResponseRoutePlanInnerSwapInfo.ts new file mode 100644 index 0000000..8117b24 --- /dev/null +++ b/generated/models/GetOrder200ResponseRoutePlanInnerSwapInfo.ts @@ -0,0 +1,129 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface GetOrder200ResponseRoutePlanInnerSwapInfo + */ +export interface GetOrder200ResponseRoutePlanInnerSwapInfo { + /** + * + * @type {string} + * @memberof GetOrder200ResponseRoutePlanInnerSwapInfo + */ + ammKey: string; + /** + * + * @type {string} + * @memberof GetOrder200ResponseRoutePlanInnerSwapInfo + */ + label: string; + /** + * + * @type {string} + * @memberof GetOrder200ResponseRoutePlanInnerSwapInfo + */ + inputMint: string; + /** + * + * @type {string} + * @memberof GetOrder200ResponseRoutePlanInnerSwapInfo + */ + outputMint: string; + /** + * + * @type {string} + * @memberof GetOrder200ResponseRoutePlanInnerSwapInfo + */ + inAmount: string; + /** + * + * @type {string} + * @memberof GetOrder200ResponseRoutePlanInnerSwapInfo + */ + outAmount: string; + /** + * + * @type {string} + * @memberof GetOrder200ResponseRoutePlanInnerSwapInfo + */ + feeAmount: string; + /** + * + * @type {string} + * @memberof GetOrder200ResponseRoutePlanInnerSwapInfo + */ + feeMint: string; +} + +/** + * Check if a given object implements the GetOrder200ResponseRoutePlanInnerSwapInfo interface. + */ +export function instanceOfGetOrder200ResponseRoutePlanInnerSwapInfo(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "ammKey" in value; + isInstance = isInstance && "label" in value; + isInstance = isInstance && "inputMint" in value; + isInstance = isInstance && "outputMint" in value; + isInstance = isInstance && "inAmount" in value; + isInstance = isInstance && "outAmount" in value; + isInstance = isInstance && "feeAmount" in value; + isInstance = isInstance && "feeMint" in value; + + return isInstance; +} + +export function GetOrder200ResponseRoutePlanInnerSwapInfoFromJSON(json: any): GetOrder200ResponseRoutePlanInnerSwapInfo { + return GetOrder200ResponseRoutePlanInnerSwapInfoFromJSONTyped(json, false); +} + +export function GetOrder200ResponseRoutePlanInnerSwapInfoFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetOrder200ResponseRoutePlanInnerSwapInfo { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'ammKey': json['ammKey'], + 'label': json['label'], + 'inputMint': json['inputMint'], + 'outputMint': json['outputMint'], + 'inAmount': json['inAmount'], + 'outAmount': json['outAmount'], + 'feeAmount': json['feeAmount'], + 'feeMint': json['feeMint'], + }; +} + +export function GetOrder200ResponseRoutePlanInnerSwapInfoToJSON(value?: GetOrder200ResponseRoutePlanInnerSwapInfo | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'ammKey': value.ammKey, + 'label': value.label, + 'inputMint': value.inputMint, + 'outputMint': value.outputMint, + 'inAmount': value.inAmount, + 'outAmount': value.outAmount, + 'feeAmount': value.feeAmount, + 'feeMint': value.feeMint, + }; +} + diff --git a/generated/models/SearchTokens400Response.ts b/generated/models/GetOrder400Response.ts similarity index 67% rename from generated/models/SearchTokens400Response.ts rename to generated/models/GetOrder400Response.ts index ac0eb68..948774d 100644 --- a/generated/models/SearchTokens400Response.ts +++ b/generated/models/GetOrder400Response.ts @@ -16,32 +16,32 @@ import { exists, mapValues } from '../runtime'; /** * * @export - * @interface SearchTokens400Response + * @interface GetOrder400Response */ -export interface SearchTokens400Response { +export interface GetOrder400Response { /** * * @type {string} - * @memberof SearchTokens400Response + * @memberof GetOrder400Response */ error: string; } /** - * Check if a given object implements the SearchTokens400Response interface. + * Check if a given object implements the GetOrder400Response interface. */ -export function instanceOfSearchTokens400Response(value: object): boolean { +export function instanceOfGetOrder400Response(value: object): boolean { let isInstance = true; isInstance = isInstance && "error" in value; return isInstance; } -export function SearchTokens400ResponseFromJSON(json: any): SearchTokens400Response { - return SearchTokens400ResponseFromJSONTyped(json, false); +export function GetOrder400ResponseFromJSON(json: any): GetOrder400Response { + return GetOrder400ResponseFromJSONTyped(json, false); } -export function SearchTokens400ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): SearchTokens400Response { +export function GetOrder400ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetOrder400Response { if ((json === undefined) || (json === null)) { return json; } @@ -51,7 +51,7 @@ export function SearchTokens400ResponseFromJSONTyped(json: any, ignoreDiscrimina }; } -export function SearchTokens400ResponseToJSON(value?: SearchTokens400Response | null): any { +export function GetOrder400ResponseToJSON(value?: GetOrder400Response | null): any { if (value === undefined) { return undefined; } diff --git a/generated/models/GetRouters200ResponseInner.ts b/generated/models/GetRouters200ResponseInner.ts new file mode 100644 index 0000000..caebb0f --- /dev/null +++ b/generated/models/GetRouters200ResponseInner.ts @@ -0,0 +1,96 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface GetRouters200ResponseInner + */ +export interface GetRouters200ResponseInner { + /** + * + * @type {string} + * @memberof GetRouters200ResponseInner + */ + id: string; + /** + * + * @type {string} + * @memberof GetRouters200ResponseInner + */ + name: GetRouters200ResponseInnerNameEnum; + /** + * + * @type {string} + * @memberof GetRouters200ResponseInner + */ + icon?: string; +} + + +/** + * @export + */ +export const GetRouters200ResponseInnerNameEnum = { + MetisV16: 'Metis v1.6', + JupiterZ: 'JupiterZ', + DFlow: 'DFlow', + OkxDexRouter: 'OKX DEX Router' +} as const; +export type GetRouters200ResponseInnerNameEnum = typeof GetRouters200ResponseInnerNameEnum[keyof typeof GetRouters200ResponseInnerNameEnum]; + + +/** + * Check if a given object implements the GetRouters200ResponseInner interface. + */ +export function instanceOfGetRouters200ResponseInner(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "id" in value; + isInstance = isInstance && "name" in value; + + return isInstance; +} + +export function GetRouters200ResponseInnerFromJSON(json: any): GetRouters200ResponseInner { + return GetRouters200ResponseInnerFromJSONTyped(json, false); +} + +export function GetRouters200ResponseInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetRouters200ResponseInner { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'id': json['id'], + 'name': json['name'], + 'icon': !exists(json, 'icon') ? undefined : json['icon'], + }; +} + +export function GetRouters200ResponseInnerToJSON(value?: GetRouters200ResponseInner | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'id': value.id, + 'name': value.name, + 'icon': value.icon, + }; +} + diff --git a/generated/models/GetSheild200Response.ts b/generated/models/GetSheild200Response.ts new file mode 100644 index 0000000..b8fe88c --- /dev/null +++ b/generated/models/GetSheild200Response.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { GetSheild200ResponseWarningsValueInner } from './GetSheild200ResponseWarningsValueInner'; +import { + GetSheild200ResponseWarningsValueInnerFromJSON, + GetSheild200ResponseWarningsValueInnerFromJSONTyped, + GetSheild200ResponseWarningsValueInnerToJSON, +} from './GetSheild200ResponseWarningsValueInner'; + +/** + * + * @export + * @interface GetSheild200Response + */ +export interface GetSheild200Response { + /** + * + * @type {{ [key: string]: Array; }} + * @memberof GetSheild200Response + */ + warnings: { [key: string]: Array; }; +} + +/** + * Check if a given object implements the GetSheild200Response interface. + */ +export function instanceOfGetSheild200Response(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "warnings" in value; + + return isInstance; +} + +export function GetSheild200ResponseFromJSON(json: any): GetSheild200Response { + return GetSheild200ResponseFromJSONTyped(json, false); +} + +export function GetSheild200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetSheild200Response { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'warnings': json['warnings'], + }; +} + +export function GetSheild200ResponseToJSON(value?: GetSheild200Response | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'warnings': value.warnings, + }; +} + diff --git a/generated/models/GetSheild200ResponseWarningsValueInner.ts b/generated/models/GetSheild200ResponseWarningsValueInner.ts new file mode 100644 index 0000000..d6e1faf --- /dev/null +++ b/generated/models/GetSheild200ResponseWarningsValueInner.ts @@ -0,0 +1,136 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface GetSheild200ResponseWarningsValueInner + */ +export interface GetSheild200ResponseWarningsValueInner { + /** + * - Type of warning for the token + * + * @type {string} + * @memberof GetSheild200ResponseWarningsValueInner + */ + type?: GetSheild200ResponseWarningsValueInnerTypeEnum; + /** + * - Human-readable warning message + * + * @type {string} + * @memberof GetSheild200ResponseWarningsValueInner + */ + message?: string; + /** + * - Severity level of the warning + * + * @type {string} + * @memberof GetSheild200ResponseWarningsValueInner + */ + severity?: GetSheild200ResponseWarningsValueInnerSeverityEnum; + /** + * - Optional external source of the warning + * + * @type {string} + * @memberof GetSheild200ResponseWarningsValueInner + */ + source?: GetSheild200ResponseWarningsValueInnerSourceEnum; +} + + +/** + * @export + */ +export const GetSheild200ResponseWarningsValueInnerTypeEnum = { + NotVerified: 'NOT_VERIFIED', + LowLiquidity: 'LOW_LIQUIDITY', + NotSellable: 'NOT_SELLABLE', + LowOrganicActivity: 'LOW_ORGANIC_ACTIVITY', + HasMintAuthority: 'HAS_MINT_AUTHORITY', + HasFreezeAuthority: 'HAS_FREEZE_AUTHORITY', + HasPermanentDelegate: 'HAS_PERMANENT_DELEGATE', + NewListing: 'NEW_LISTING', + VeryLowTradingActivity: 'VERY_LOW_TRADING_ACTIVITY', + HighSupplyConcentration: 'HIGH_SUPPLY_CONCENTRATION', + NonTransferable: 'NON_TRANSFERABLE', + MutableTransferFees: 'MUTABLE_TRANSFER_FEES', + SuspiciousDevActivity: 'SUSPICIOUS_DEV_ACTIVITY', + SuspiciousTopHolderActivity: 'SUSPICIOUS_TOP_HOLDER_ACTIVITY', + HighSingleOwnership: 'HIGH_SINGLE_OWNERSHIP', + TransferFees: '{}%_TRANSFER_FEES' +} as const; +export type GetSheild200ResponseWarningsValueInnerTypeEnum = typeof GetSheild200ResponseWarningsValueInnerTypeEnum[keyof typeof GetSheild200ResponseWarningsValueInnerTypeEnum]; + +/** + * @export + */ +export const GetSheild200ResponseWarningsValueInnerSeverityEnum = { + Info: 'info', + Warning: 'warning', + Critical: 'critical' +} as const; +export type GetSheild200ResponseWarningsValueInnerSeverityEnum = typeof GetSheild200ResponseWarningsValueInnerSeverityEnum[keyof typeof GetSheild200ResponseWarningsValueInnerSeverityEnum]; + +/** + * @export + */ +export const GetSheild200ResponseWarningsValueInnerSourceEnum = { + RugCheck: 'RugCheck' +} as const; +export type GetSheild200ResponseWarningsValueInnerSourceEnum = typeof GetSheild200ResponseWarningsValueInnerSourceEnum[keyof typeof GetSheild200ResponseWarningsValueInnerSourceEnum]; + + +/** + * Check if a given object implements the GetSheild200ResponseWarningsValueInner interface. + */ +export function instanceOfGetSheild200ResponseWarningsValueInner(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function GetSheild200ResponseWarningsValueInnerFromJSON(json: any): GetSheild200ResponseWarningsValueInner { + return GetSheild200ResponseWarningsValueInnerFromJSONTyped(json, false); +} + +export function GetSheild200ResponseWarningsValueInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetSheild200ResponseWarningsValueInner { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'type': !exists(json, 'type') ? undefined : json['type'], + 'message': !exists(json, 'message') ? undefined : json['message'], + 'severity': !exists(json, 'severity') ? undefined : json['severity'], + 'source': !exists(json, 'source') ? undefined : json['source'], + }; +} + +export function GetSheild200ResponseWarningsValueInnerToJSON(value?: GetSheild200ResponseWarningsValueInner | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'type': value.type, + 'message': value.message, + 'severity': value.severity, + 'source': value.source, + }; +} + diff --git a/generated/models/GetShield200Response.ts b/generated/models/GetShield200Response.ts new file mode 100644 index 0000000..aa98333 --- /dev/null +++ b/generated/models/GetShield200Response.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { GetShield200ResponseWarningsValueInner } from './GetShield200ResponseWarningsValueInner'; +import { + GetShield200ResponseWarningsValueInnerFromJSON, + GetShield200ResponseWarningsValueInnerFromJSONTyped, + GetShield200ResponseWarningsValueInnerToJSON, +} from './GetShield200ResponseWarningsValueInner'; + +/** + * + * @export + * @interface GetShield200Response + */ +export interface GetShield200Response { + /** + * + * @type {{ [key: string]: Array; }} + * @memberof GetShield200Response + */ + warnings: { [key: string]: Array; }; +} + +/** + * Check if a given object implements the GetShield200Response interface. + */ +export function instanceOfGetShield200Response(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "warnings" in value; + + return isInstance; +} + +export function GetShield200ResponseFromJSON(json: any): GetShield200Response { + return GetShield200ResponseFromJSONTyped(json, false); +} + +export function GetShield200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetShield200Response { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'warnings': json['warnings'], + }; +} + +export function GetShield200ResponseToJSON(value?: GetShield200Response | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'warnings': value.warnings, + }; +} + diff --git a/generated/models/GetShield200ResponseWarningsValueInner.ts b/generated/models/GetShield200ResponseWarningsValueInner.ts new file mode 100644 index 0000000..dbcbfcb --- /dev/null +++ b/generated/models/GetShield200ResponseWarningsValueInner.ts @@ -0,0 +1,136 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface GetShield200ResponseWarningsValueInner + */ +export interface GetShield200ResponseWarningsValueInner { + /** + * - Type of warning for the token + * + * @type {string} + * @memberof GetShield200ResponseWarningsValueInner + */ + type?: GetShield200ResponseWarningsValueInnerTypeEnum; + /** + * - Human-readable warning message + * + * @type {string} + * @memberof GetShield200ResponseWarningsValueInner + */ + message?: string; + /** + * - Severity level of the warning + * + * @type {string} + * @memberof GetShield200ResponseWarningsValueInner + */ + severity?: GetShield200ResponseWarningsValueInnerSeverityEnum; + /** + * - Optional external source of the warning + * + * @type {string} + * @memberof GetShield200ResponseWarningsValueInner + */ + source?: GetShield200ResponseWarningsValueInnerSourceEnum; +} + + +/** + * @export + */ +export const GetShield200ResponseWarningsValueInnerTypeEnum = { + NotVerified: 'NOT_VERIFIED', + LowLiquidity: 'LOW_LIQUIDITY', + NotSellable: 'NOT_SELLABLE', + LowOrganicActivity: 'LOW_ORGANIC_ACTIVITY', + HasMintAuthority: 'HAS_MINT_AUTHORITY', + HasFreezeAuthority: 'HAS_FREEZE_AUTHORITY', + HasPermanentDelegate: 'HAS_PERMANENT_DELEGATE', + NewListing: 'NEW_LISTING', + VeryLowTradingActivity: 'VERY_LOW_TRADING_ACTIVITY', + HighSupplyConcentration: 'HIGH_SUPPLY_CONCENTRATION', + NonTransferable: 'NON_TRANSFERABLE', + MutableTransferFees: 'MUTABLE_TRANSFER_FEES', + SuspiciousDevActivity: 'SUSPICIOUS_DEV_ACTIVITY', + SuspiciousTopHolderActivity: 'SUSPICIOUS_TOP_HOLDER_ACTIVITY', + HighSingleOwnership: 'HIGH_SINGLE_OWNERSHIP', + TransferFees: '{}%_TRANSFER_FEES' +} as const; +export type GetShield200ResponseWarningsValueInnerTypeEnum = typeof GetShield200ResponseWarningsValueInnerTypeEnum[keyof typeof GetShield200ResponseWarningsValueInnerTypeEnum]; + +/** + * @export + */ +export const GetShield200ResponseWarningsValueInnerSeverityEnum = { + Info: 'info', + Warning: 'warning', + Critical: 'critical' +} as const; +export type GetShield200ResponseWarningsValueInnerSeverityEnum = typeof GetShield200ResponseWarningsValueInnerSeverityEnum[keyof typeof GetShield200ResponseWarningsValueInnerSeverityEnum]; + +/** + * @export + */ +export const GetShield200ResponseWarningsValueInnerSourceEnum = { + RugCheck: 'RugCheck' +} as const; +export type GetShield200ResponseWarningsValueInnerSourceEnum = typeof GetShield200ResponseWarningsValueInnerSourceEnum[keyof typeof GetShield200ResponseWarningsValueInnerSourceEnum]; + + +/** + * Check if a given object implements the GetShield200ResponseWarningsValueInner interface. + */ +export function instanceOfGetShield200ResponseWarningsValueInner(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function GetShield200ResponseWarningsValueInnerFromJSON(json: any): GetShield200ResponseWarningsValueInner { + return GetShield200ResponseWarningsValueInnerFromJSONTyped(json, false); +} + +export function GetShield200ResponseWarningsValueInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetShield200ResponseWarningsValueInner { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'type': !exists(json, 'type') ? undefined : json['type'], + 'message': !exists(json, 'message') ? undefined : json['message'], + 'severity': !exists(json, 'severity') ? undefined : json['severity'], + 'source': !exists(json, 'source') ? undefined : json['source'], + }; +} + +export function GetShield200ResponseWarningsValueInnerToJSON(value?: GetShield200ResponseWarningsValueInner | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'type': value.type, + 'message': value.message, + 'severity': value.severity, + 'source': value.source, + }; +} + diff --git a/generated/models/HoldingsResponse.ts b/generated/models/HoldingsResponse.ts new file mode 100644 index 0000000..e4b4e38 --- /dev/null +++ b/generated/models/HoldingsResponse.ts @@ -0,0 +1,100 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { TokenAccount } from './TokenAccount'; +import { + TokenAccountFromJSON, + TokenAccountFromJSONTyped, + TokenAccountToJSON, +} from './TokenAccount'; + +/** + * + * @export + * @interface HoldingsResponse + */ +export interface HoldingsResponse { + /** + * Total SOL in lamports + * @type {string} + * @memberof HoldingsResponse + */ + amount: string; + /** + * Total SOL in UI units after applying decimals + * @type {number} + * @memberof HoldingsResponse + */ + uiAmount: number; + /** + * Total SOL as string in UI units after applying decimals + * @type {string} + * @memberof HoldingsResponse + */ + uiAmountString: string; + /** + * Other token holdings organized by mint address as keys + * @type {{ [key: string]: Array; }} + * @memberof HoldingsResponse + */ + tokens: { [key: string]: Array; }; +} + +/** + * Check if a given object implements the HoldingsResponse interface. + */ +export function instanceOfHoldingsResponse(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "amount" in value; + isInstance = isInstance && "uiAmount" in value; + isInstance = isInstance && "uiAmountString" in value; + isInstance = isInstance && "tokens" in value; + + return isInstance; +} + +export function HoldingsResponseFromJSON(json: any): HoldingsResponse { + return HoldingsResponseFromJSONTyped(json, false); +} + +export function HoldingsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): HoldingsResponse { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'amount': json['amount'], + 'uiAmount': json['uiAmount'], + 'uiAmountString': json['uiAmountString'], + 'tokens': json['tokens'], + }; +} + +export function HoldingsResponseToJSON(value?: HoldingsResponse | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'amount': value.amount, + 'uiAmount': value.uiAmount, + 'uiAmountString': value.uiAmountString, + 'tokens': value.tokens, + }; +} + diff --git a/generated/models/NativeHoldingsResponse.ts b/generated/models/NativeHoldingsResponse.ts new file mode 100644 index 0000000..03a3fd1 --- /dev/null +++ b/generated/models/NativeHoldingsResponse.ts @@ -0,0 +1,84 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface NativeHoldingsResponse + */ +export interface NativeHoldingsResponse { + /** + * Total SOL in lamports + * @type {string} + * @memberof NativeHoldingsResponse + */ + amount: string; + /** + * Total SOL in UI units after applying decimals + * @type {number} + * @memberof NativeHoldingsResponse + */ + uiAmount: number; + /** + * Total SOL as string in UI units after applying decimals + * @type {string} + * @memberof NativeHoldingsResponse + */ + uiAmountString: string; +} + +/** + * Check if a given object implements the NativeHoldingsResponse interface. + */ +export function instanceOfNativeHoldingsResponse(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "amount" in value; + isInstance = isInstance && "uiAmount" in value; + isInstance = isInstance && "uiAmountString" in value; + + return isInstance; +} + +export function NativeHoldingsResponseFromJSON(json: any): NativeHoldingsResponse { + return NativeHoldingsResponseFromJSONTyped(json, false); +} + +export function NativeHoldingsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): NativeHoldingsResponse { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'amount': json['amount'], + 'uiAmount': json['uiAmount'], + 'uiAmountString': json['uiAmountString'], + }; +} + +export function NativeHoldingsResponseToJSON(value?: NativeHoldingsResponse | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'amount': value.amount, + 'uiAmount': value.uiAmount, + 'uiAmountString': value.uiAmountString, + }; +} + diff --git a/generated/models/PostExecute200Response.ts b/generated/models/PostExecute200Response.ts new file mode 100644 index 0000000..d0958fa --- /dev/null +++ b/generated/models/PostExecute200Response.ts @@ -0,0 +1,157 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { PostExecute200ResponseSwapEventsInner } from './PostExecute200ResponseSwapEventsInner'; +import { + PostExecute200ResponseSwapEventsInnerFromJSON, + PostExecute200ResponseSwapEventsInnerFromJSONTyped, + PostExecute200ResponseSwapEventsInnerToJSON, +} from './PostExecute200ResponseSwapEventsInner'; + +/** + * + * @export + * @interface PostExecute200Response + */ +export interface PostExecute200Response { + /** + * + * @type {string} + * @memberof PostExecute200Response + */ + status: PostExecute200ResponseStatusEnum; + /** + * + * @type {string} + * @memberof PostExecute200Response + */ + signature?: string; + /** + * + * @type {string} + * @memberof PostExecute200Response + */ + slot?: string; + /** + * + * @type {string} + * @memberof PostExecute200Response + */ + error?: string; + /** + * + * @type {number} + * @memberof PostExecute200Response + */ + code: number; + /** + * + * @type {string} + * @memberof PostExecute200Response + */ + totalInputAmount?: string; + /** + * + * @type {string} + * @memberof PostExecute200Response + */ + totalOutputAmount?: string; + /** + * + * @type {string} + * @memberof PostExecute200Response + */ + inputAmountResult?: string; + /** + * + * @type {string} + * @memberof PostExecute200Response + */ + outputAmountResult?: string; + /** + * + * @type {Array} + * @memberof PostExecute200Response + */ + swapEvents?: Array; +} + + +/** + * @export + */ +export const PostExecute200ResponseStatusEnum = { + Success: 'Success', + Failed: 'Failed' +} as const; +export type PostExecute200ResponseStatusEnum = typeof PostExecute200ResponseStatusEnum[keyof typeof PostExecute200ResponseStatusEnum]; + + +/** + * Check if a given object implements the PostExecute200Response interface. + */ +export function instanceOfPostExecute200Response(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "status" in value; + isInstance = isInstance && "code" in value; + + return isInstance; +} + +export function PostExecute200ResponseFromJSON(json: any): PostExecute200Response { + return PostExecute200ResponseFromJSONTyped(json, false); +} + +export function PostExecute200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): PostExecute200Response { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'status': json['status'], + 'signature': !exists(json, 'signature') ? undefined : json['signature'], + 'slot': !exists(json, 'slot') ? undefined : json['slot'], + 'error': !exists(json, 'error') ? undefined : json['error'], + 'code': json['code'], + 'totalInputAmount': !exists(json, 'totalInputAmount') ? undefined : json['totalInputAmount'], + 'totalOutputAmount': !exists(json, 'totalOutputAmount') ? undefined : json['totalOutputAmount'], + 'inputAmountResult': !exists(json, 'inputAmountResult') ? undefined : json['inputAmountResult'], + 'outputAmountResult': !exists(json, 'outputAmountResult') ? undefined : json['outputAmountResult'], + 'swapEvents': !exists(json, 'swapEvents') ? undefined : ((json['swapEvents'] as Array).map(PostExecute200ResponseSwapEventsInnerFromJSON)), + }; +} + +export function PostExecute200ResponseToJSON(value?: PostExecute200Response | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'status': value.status, + 'signature': value.signature, + 'slot': value.slot, + 'error': value.error, + 'code': value.code, + 'totalInputAmount': value.totalInputAmount, + 'totalOutputAmount': value.totalOutputAmount, + 'inputAmountResult': value.inputAmountResult, + 'outputAmountResult': value.outputAmountResult, + 'swapEvents': value.swapEvents === undefined ? undefined : ((value.swapEvents as Array).map(PostExecute200ResponseSwapEventsInnerToJSON)), + }; +} + diff --git a/generated/models/PostExecute200ResponseSwapEventsInner.ts b/generated/models/PostExecute200ResponseSwapEventsInner.ts new file mode 100644 index 0000000..3870e9b --- /dev/null +++ b/generated/models/PostExecute200ResponseSwapEventsInner.ts @@ -0,0 +1,93 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface PostExecute200ResponseSwapEventsInner + */ +export interface PostExecute200ResponseSwapEventsInner { + /** + * + * @type {string} + * @memberof PostExecute200ResponseSwapEventsInner + */ + inputMint: string; + /** + * + * @type {string} + * @memberof PostExecute200ResponseSwapEventsInner + */ + inputAmount: string; + /** + * + * @type {string} + * @memberof PostExecute200ResponseSwapEventsInner + */ + outputMint: string; + /** + * + * @type {string} + * @memberof PostExecute200ResponseSwapEventsInner + */ + outputAmount: string; +} + +/** + * Check if a given object implements the PostExecute200ResponseSwapEventsInner interface. + */ +export function instanceOfPostExecute200ResponseSwapEventsInner(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "inputMint" in value; + isInstance = isInstance && "inputAmount" in value; + isInstance = isInstance && "outputMint" in value; + isInstance = isInstance && "outputAmount" in value; + + return isInstance; +} + +export function PostExecute200ResponseSwapEventsInnerFromJSON(json: any): PostExecute200ResponseSwapEventsInner { + return PostExecute200ResponseSwapEventsInnerFromJSONTyped(json, false); +} + +export function PostExecute200ResponseSwapEventsInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): PostExecute200ResponseSwapEventsInner { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'inputMint': json['inputMint'], + 'inputAmount': json['inputAmount'], + 'outputMint': json['outputMint'], + 'outputAmount': json['outputAmount'], + }; +} + +export function PostExecute200ResponseSwapEventsInnerToJSON(value?: PostExecute200ResponseSwapEventsInner | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'inputMint': value.inputMint, + 'inputAmount': value.inputAmount, + 'outputMint': value.outputMint, + 'outputAmount': value.outputAmount, + }; +} + diff --git a/generated/models/PostExecute400Response.ts b/generated/models/PostExecute400Response.ts new file mode 100644 index 0000000..091bd01 --- /dev/null +++ b/generated/models/PostExecute400Response.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface PostExecute400Response + */ +export interface PostExecute400Response { + /** + * + * @type {string} + * @memberof PostExecute400Response + */ + error: string; + /** + * + * @type {number} + * @memberof PostExecute400Response + */ + code: number; +} + +/** + * Check if a given object implements the PostExecute400Response interface. + */ +export function instanceOfPostExecute400Response(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "error" in value; + isInstance = isInstance && "code" in value; + + return isInstance; +} + +export function PostExecute400ResponseFromJSON(json: any): PostExecute400Response { + return PostExecute400ResponseFromJSONTyped(json, false); +} + +export function PostExecute400ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): PostExecute400Response { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'error': json['error'], + 'code': json['code'], + }; +} + +export function PostExecute400ResponseToJSON(value?: PostExecute400Response | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'error': value.error, + 'code': value.code, + }; +} + diff --git a/generated/models/PostExecuteRequest.ts b/generated/models/PostExecuteRequest.ts new file mode 100644 index 0000000..1b7dfcc --- /dev/null +++ b/generated/models/PostExecuteRequest.ts @@ -0,0 +1,77 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface PostExecuteRequest + */ +export interface PostExecuteRequest { + /** + * - The signed transaction to execute + * + * @type {string} + * @memberof PostExecuteRequest + */ + signedTransaction: string; + /** + * - Found in response of `/order` + * + * @type {string} + * @memberof PostExecuteRequest + */ + requestId: string; +} + +/** + * Check if a given object implements the PostExecuteRequest interface. + */ +export function instanceOfPostExecuteRequest(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "signedTransaction" in value; + isInstance = isInstance && "requestId" in value; + + return isInstance; +} + +export function PostExecuteRequestFromJSON(json: any): PostExecuteRequest { + return PostExecuteRequestFromJSONTyped(json, false); +} + +export function PostExecuteRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): PostExecuteRequest { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'signedTransaction': json['signedTransaction'], + 'requestId': json['requestId'], + }; +} + +export function PostExecuteRequestToJSON(value?: PostExecuteRequest | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'signedTransaction': value.signedTransaction, + 'requestId': value.requestId, + }; +} + diff --git a/generated/models/TokenAccount.ts b/generated/models/TokenAccount.ts new file mode 100644 index 0000000..cacb346 --- /dev/null +++ b/generated/models/TokenAccount.ts @@ -0,0 +1,129 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Swap API + * The heart and soul of Jupiter lies in the Quote and Swap API. ### API Rate Limit Since 1 December 2024, we have updated our API structure. Please refer to [Developer Docs](https://dev.jup.ag/docs/) for further details on usage and rate limits. ### API Usage - API Wrapper Typescript [@jup-ag/api](https://github.com/jup-ag/jupiter-quote-api-node) ### Data Types To Note - Public keys are base58 encoded strings - Raw data such as Vec are base64 encoded strings + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface TokenAccount + */ +export interface TokenAccount { + /** + * The token account address + * @type {string} + * @memberof TokenAccount + */ + account: string; + /** + * Token amount in atomic/raw units + * @type {string} + * @memberof TokenAccount + */ + amount: string; + /** + * Token amount in UI units after applying decimals + * @type {number} + * @memberof TokenAccount + */ + uiAmount: number; + /** + * Token amount as string in UI units after applying decimals + * @type {string} + * @memberof TokenAccount + */ + uiAmountString: string; + /** + * Whether the token account is frozen + * @type {boolean} + * @memberof TokenAccount + */ + isFrozen: boolean; + /** + * Whether this is an associated token account + * @type {boolean} + * @memberof TokenAccount + */ + isAssociatedTokenAccount: boolean; + /** + * Number of decimal places for the token + * @type {number} + * @memberof TokenAccount + */ + decimals: number; + /** + * The token program ID + * @type {string} + * @memberof TokenAccount + */ + programId: string; +} + +/** + * Check if a given object implements the TokenAccount interface. + */ +export function instanceOfTokenAccount(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "account" in value; + isInstance = isInstance && "amount" in value; + isInstance = isInstance && "uiAmount" in value; + isInstance = isInstance && "uiAmountString" in value; + isInstance = isInstance && "isFrozen" in value; + isInstance = isInstance && "isAssociatedTokenAccount" in value; + isInstance = isInstance && "decimals" in value; + isInstance = isInstance && "programId" in value; + + return isInstance; +} + +export function TokenAccountFromJSON(json: any): TokenAccount { + return TokenAccountFromJSONTyped(json, false); +} + +export function TokenAccountFromJSONTyped(json: any, ignoreDiscriminator: boolean): TokenAccount { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'account': json['account'], + 'amount': json['amount'], + 'uiAmount': json['uiAmount'], + 'uiAmountString': json['uiAmountString'], + 'isFrozen': json['isFrozen'], + 'isAssociatedTokenAccount': json['isAssociatedTokenAccount'], + 'decimals': json['decimals'], + 'programId': json['programId'], + }; +} + +export function TokenAccountToJSON(value?: TokenAccount | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'account': value.account, + 'amount': value.amount, + 'uiAmount': value.uiAmount, + 'uiAmountString': value.uiAmountString, + 'isFrozen': value.isFrozen, + 'isAssociatedTokenAccount': value.isAssociatedTokenAccount, + 'decimals': value.decimals, + 'programId': value.programId, + }; +} + diff --git a/generated/models/index.ts b/generated/models/index.ts index cde2f16..50239c6 100644 --- a/generated/models/index.ts +++ b/generated/models/index.ts @@ -2,15 +2,27 @@ /* eslint-disable */ export * from './AccountMeta'; export * from './ErrorResponse'; -export * from './IndexedRouteMapResponse'; +export * from './GetOrder200Response'; +export * from './GetOrder200ResponsePlatformFee'; +export * from './GetOrder200ResponseRoutePlanInner'; +export * from './GetOrder200ResponseRoutePlanInnerSwapInfo'; +export * from './GetOrder400Response'; +export * from './GetRouters200ResponseInner'; +export * from './GetShield200Response'; +export * from './GetShield200ResponseWarningsValueInner'; +export * from './HoldingsResponse'; export * from './Instruction'; export * from './MintInformation'; export * from './MintInformationAudit'; export * from './MintInformationFirstPool'; +export * from './NativeHoldingsResponse'; export * from './PlatformFee'; +export * from './PostExecute200Response'; +export * from './PostExecute200ResponseSwapEventsInner'; +export * from './PostExecute400Response'; +export * from './PostExecuteRequest'; export * from './QuoteResponse'; export * from './RoutePlanStep'; -export * from './SearchTokens400Response'; export * from './SwapInfo'; export * from './SwapInstructionsResponse'; export * from './SwapMode'; @@ -19,3 +31,4 @@ export * from './SwapRequestPrioritizationFeeLamports'; export * from './SwapRequestPrioritizationFeeLamportsPriorityLevelWithMaxLamports'; export * from './SwapResponse'; export * from './SwapStats'; +export * from './TokenAccount'; diff --git a/package.json b/package.json index 8035c28..631fb21 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "@jup-ag/api", - "version": "6.0.44", + "name": "jup-fork", + "version": "6.0.46", "description": "## Generate typescript types from swagger schema", "main": "dist/index.js", "module": "dist/index.mjs", diff --git a/src/index.ts b/src/index.ts index 3595057..db83848 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,4 @@ -import { TokenApi } from "generated/apis"; -import { SwapApi } from "../generated/apis/SwapApi"; +import { SwapApi, TokenApi, UltraApi } from "generated/apis"; import { ConfigurationParameters, Configuration } from "../generated/runtime"; interface UrlConfig { @@ -9,6 +8,10 @@ interface UrlConfig { // Define server URLs const serverUrls: Record = { + ultra: { + PUBLIC: "https://lite-api.jup.ag/ultra/v1", + API_KEY: "https://api.jup.ag/ultra/v1", + }, swap: { PUBLIC: "https://lite-api.jup.ag/swap/v1", API_KEY: "https://api.jup.ag/swap/v1", @@ -26,6 +29,7 @@ const serverUrls: Record = { */ export const createJupiterApiClient = (config?: ConfigurationParameters) => { return { + ultra: new UltraApi(urlConfig(serverUrls.ultra, config)), swap: new SwapApi(urlConfig(serverUrls.swap, config)), token: new TokenApi(urlConfig(serverUrls.token, config)) } diff --git a/swagger.yaml b/swagger.yaml index 51492ef..efe0d80 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -22,6 +22,616 @@ servers: description: Paid tier API endpoint with higher rate limits to be used with an API Key paths: + # UltraAPI + /order: + get: + tags: + - Ultra + operationId: getOrder + summary: order + description: | + Request for a base64-encoded unsigned swap transaction to be used in `POST /ultra/v1/execute` + + :::note + - Refer to [Ultra API doc](/docs/ultra-api/get-order) for more information + ::: + responses: + '200': + description: Successful response + content: + application/json: + schema: + type: object + properties: + mode: + type: string + description: | + - Either 'manual' or 'ultra', defaults to `ultra` + - Defaults to `ultra`, unless manual parameters are defined which is not the intended use of the API + inputMint: + type: string + outputMint: + type: string + inAmount: + type: string + outAmount: + type: string + otherAmountThreshold: + type: string + swapMode: + type: string + slippageBps: + type: number + inUsdValue: + type: number + outUsdValue: + type: number + priceImpact: + type: number + swapUsdValue: + type: number + priceImpactPct: + type: string + description: | + - Please use `priceImpact` field instead, this is still available only for backwards compatibility + routePlan: + type: array + items: + type: object + properties: + swapInfo: + type: object + properties: + ammKey: + type: string + label: + type: string + inputMint: + type: string + outputMint: + type: string + inAmount: + type: string + outAmount: + type: string + feeAmount: + type: string + feeMint: + type: string + required: + - ammKey + - label + - inputMint + - outputMint + - inAmount + - outAmount + - feeAmount + - feeMint + percent: + type: number + bps: + type: number + required: + - swapInfo + - percent + - bps + feeMint: + type: string + feeBps: + type: number + signatureFeeLamports: + type: number + description: | + - The number of lamports the taker has to pay as a base network fee, if a valid transaction is returned. This may be 0 if the transaction is gasless, in which case the gas payer will cover this fee. + prioritizationFeeLamports: + type: number + description: | + - The number of lamports the taker has to pay for higher priority landing, if a valid transaction is returned. Includes priority fees and tips for services such as Jito, if any. This may be 0 if the transaction is gasless, in which case the gas payer will cover this fee. + rentFeeLamports: + type: number + description: | + - The number of lamports the taker has to pay for rent, if a valid transaction is returned. This may be 0 if the transaction is gasless, in which case the gas payer will cover this fee. Note that this value is just an estimate. + swapType: + type: string + description: | + - Deprecated, in favour of router + router: + type: string + enum: + - aggregator + - jupiterz + - dflow + - okx + transaction: + type: string + nullable: true + description: | + - Unsigned base-64 encoded transaction to be signed and used in `/execute` + - If `taker` is null, this field will be null. Else, it will either be a valid base64 encoded transaction or the empty string + gasless: + type: boolean + requestId: + description: | + - Required to make a request to `/execute` + type: string + totalTime: + type: number + taker: + type: string + nullable: true + quoteId: + type: string + maker: + type: string + expireAt: + type: string + platformFee: + type: object + properties: + amount: + type: string + feeBps: + type: number + required: + - amount + - feeBps + errorCode: + type: number + description: | + - This field will be present if `taker` is defined and `transaction` is the empty string + - It is unique for each error scenarios + errorMessage: + type: string + description: | + - This field will be present if `taker` is defined and `transaction` is the empty string + - This field can still return despite having a valid order/quote + - This is meant for display purposes only and it is discouraged to match these error messages as they could be parameterized + required: + - mode + - inputMint + - outputMint + - inAmount + - outAmount + - otherAmountThreshold + - priceImpactPct + - swapMode + - slippageBps + - routePlan + - feeBps + - signatureFeeLamports + - prioritizationFeeLamports + - rentFeeLamports + - swapType + - router + - transaction + - gasless + - requestId + - totalTime + - taker + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + required: + - error + '500': + description: Internal server error + content: + application/json: + schema: + type: object + properties: + error: + type: string + required: + - error + parameters: + - in: query + name: inputMint + schema: + type: string + required: true + - in: query + name: outputMint + schema: + type: string + required: true + - in: query + name: amount + schema: + type: string + required: true + - in: query + name: taker + schema: + type: string + required: false + - in: query + name: referralAccount + schema: + type: string + required: false + - in: query + name: referralFee + schema: + type: number + minimum: 50 + maximum: 255 + required: false + - in: query + name: excludeRouters + schema: + type: string + enum: + - metis + - jupiterz + - dflow + - okx + required: false + - in: query + name: excludeDexes + description: | + - [Full list of DEXes here](https://lite-api.jup.ag/swap/v1/program-id-to-label), for example: `excludeDexes=Raydium,Orca+V2,Meteora+DLMM` + - **Important**: This only excludes DEXes on the Metis router, does not apply to other routers + - For example: + - **Exclude** Raydium: `excludeRouters=` and `excludeDexes=Raydium` + - **Only include** Meteora DLMM: `excludeRouters=` and `excludeDexes=` + schema: + type: string + /execute: + post: + tags: + - Ultra + operationId: postExecute + summary: execute + description: | + Execute the signed transaction and get the execution status + + :::note + - Do note that the `requestId` is found in the response of `/order` + - Refer to [Ultra API doc](/docs/ultra-api/execute-order) for more information + ::: + responses: + '200': + description: Successful response + content: + application/json: + schema: + type: object + properties: + status: + type: string + enum: + - Success + - Failed + signature: + type: string + slot: + type: string + error: + type: string + code: + type: number + totalInputAmount: + type: string + totalOutputAmount: + type: string + inputAmountResult: + type: string + outputAmountResult: + type: string + swapEvents: + type: array + items: + type: object + properties: + inputMint: + type: string + inputAmount: + type: string + outputMint: + type: string + outputAmount: + type: string + required: + - inputMint + - inputAmount + - outputMint + - outputAmount + required: + - status + - code + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + code: + type: number + required: + - error + - code + '500': + description: Internal server error + content: + application/json: + schema: + type: object + properties: + error: + type: string + code: + type: number + required: + - error + - code + requestBody: + content: + application/json: + schema: + type: object + properties: + signedTransaction: + type: string + description: | + - The signed transaction to execute + requestId: + type: string + description: | + - Found in response of `/order` + required: + - signedTransaction + - requestId + /holdings/{address}: + get: + tags: + - Ultra + operationId: getHoldings + summary: holdings + description: | + Request for detailed token holdings of an account including token account information + + :::note + - Refer to [Ultra API doc](/docs/ultra-api/get-holdings) for more information + ::: + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: "#/components/schemas/HoldingsResponse" + parameters: + - schema: + type: string + in: path + name: address + required: true + description: The wallet address to get holdings for + /holdings/{address}/native: + get: + tags: + - Ultra + operationId: getNativeHoldings + summary: holdings (native) + description: | + Request for native SOL holdings only, without other tokens + + :::note + - This is a more efficient endpoint when you only need SOL balance + - Refer to [Ultra API doc](/docs/ultra-api/get-holdings) for more information + ::: + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: "#/components/schemas/NativeHoldingsResponse" + parameters: + - schema: + type: string + in: path + name: address + required: true + description: The wallet address to get native SOL balance for + + /shield: + get: + tags: + - Ultra + operationId: getShield + summary: shield + description: | + Request for token information and warnings of mints + + :::note + - Refer to [Ultra API doc](/docs/ultra-api/get-shield) for more information + ::: + responses: + '200': + description: Successful response + content: + application/json: + schema: + type: object + properties: + warnings: + type: object + additionalProperties: + description: | + - Token mint address as key + type: array + items: + type: object + properties: + type: + type: string + enum: + - NOT_VERIFIED + - LOW_LIQUIDITY + - NOT_SELLABLE + - LOW_ORGANIC_ACTIVITY + - HAS_MINT_AUTHORITY + - HAS_FREEZE_AUTHORITY + - HAS_PERMANENT_DELEGATE + - NEW_LISTING + - VERY_LOW_TRADING_ACTIVITY + - HIGH_SUPPLY_CONCENTRATION + - NON_TRANSFERABLE + - MUTABLE_TRANSFER_FEES + - SUSPICIOUS_DEV_ACTIVITY + - SUSPICIOUS_TOP_HOLDER_ACTIVITY + - HIGH_SINGLE_OWNERSHIP + - "{}%_TRANSFER_FEES" + description: | + - Type of warning for the token + message: + type: string + description: | + - Human-readable warning message + severity: + type: string + enum: + - info + - warning + - critical + description: | + - Severity level of the warning + source: + type: string + enum: + - RugCheck + description: | + - Optional external source of the warning + required: + - warnings + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + required: + - error + '500': + description: Internal server error + content: + application/json: + schema: + type: object + properties: + error: + type: string + required: + - error + parameters: + - in: query + name: mints + schema: + type: string + required: true + description: | + - Comma separated list of mints to get information for + /order/routers: + get: + tags: + - Ultra + operationId: getRouters + summary: routers + description: | + Request for the list of routers available in the routing engine of Ultra, which is [Juno](/docs/routing#juno-liquidity-engine) + responses: + '200': + description: Successful response + content: + application/json: + schema: + type: array + items: + type: object + properties: + id: + type: string + name: + type: string + enum: + - Metis v1.6 + - JupiterZ + - DFlow + - OKX DEX Router + icon: + type: string + required: + - id + - name + # /search: + # get: + # tags: + # - Ultra + # operationId: searchTokensUltra + # summary: search + # description: | + # Request a search by token's symbol, name or mint address + + # :::note + # - Refer to [Ultra API doc](/docs/ultra-api/search-token) for more information + # ::: + # responses: + # '200': + # description: Successful response + # content: + # application/json: + # schema: + # type: array + # items: + # "$ref": "#/components/schemas/MintInformation" + # '400': + # description: Bad request + # content: + # application/json: + # schema: + # type: object + # properties: + # error: + # type: string + # required: + # - error + # '500': + # description: Internal server error + # content: + # application/json: + # schema: + # type: object + # properties: + # error: + # type: string + # required: + # - error + # parameters: + # - in: query + # name: query + # schema: + # type: string + # required: true + # description: | + # - Search for a token and its information by its symbol, name or mint address + # - Comma-separate to search for multiple + # - Limit to 100 mint addresses in query + # - Default to 20 mints in response when searching via symbol or name + # SwapAPI /quote: get: @@ -635,34 +1245,6 @@ components: - swapInstruction - addressLookupTableAddresses - IndexedRouteMapResponse: - type: object - required: - - mintKeys - - indexedRouteMap - properties: - mintKeys: - type: array - items: - type: string - description: All the mints that are indexed to match in indexedRouteMap - indexedRouteMap: - type: object - description: All the possible route and their corresponding output mints - additionalProperties: - type: array - items: - type: number - example: - '1': - - 2 - - 3 - - 4 - '2': - - 1 - - 3 - - 4 - ErrorResponse: type: object properties: @@ -844,6 +1426,86 @@ components: type: integer nullable: true + HoldingsResponse: + type: object + properties: + amount: + type: string + description: Total SOL in lamports + uiAmount: + type: number + description: Total SOL in UI units after applying decimals + uiAmountString: + type: string + description: Total SOL as string in UI units after applying decimals + tokens: + type: object + description: Other token holdings organized by mint address as keys + additionalProperties: + description: Token mint address as key + type: array + items: + $ref: "#/components/schemas/TokenAccount" + required: + - amount + - uiAmount + - uiAmountString + - tokens + + NativeHoldingsResponse: + type: object + properties: + amount: + type: string + description: Total SOL in lamports + uiAmount: + type: number + description: Total SOL in UI units after applying decimals + uiAmountString: + type: string + description: Total SOL as string in UI units after applying decimals + required: + - amount + - uiAmount + - uiAmountString + + TokenAccount: + type: object + properties: + account: + type: string + description: The token account address + amount: + type: string + description: Token amount in atomic/raw units + uiAmount: + type: number + description: Token amount in UI units after applying decimals + uiAmountString: + type: string + description: Token amount as string in UI units after applying decimals + isFrozen: + type: boolean + description: Whether the token account is frozen + isAssociatedTokenAccount: + type: boolean + description: Whether this is an associated token account + decimals: + type: number + description: Number of decimal places for the token + programId: + type: string + description: The token program ID + required: + - account + - amount + - uiAmount + - uiAmountString + - isFrozen + - isAssociatedTokenAccount + - decimals + - programId + parameters: InputMintParameter: name: inputMint diff --git a/tests/index.test.ts b/tests/index.test.ts index 3e23cb1..362ae35 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,7 +1,7 @@ import { ResponseError, createJupiterApiClient } from "src"; import { describe, expect, it } from "vitest"; -describe("api", () => { - const apiClient = createJupiterApiClient(); +describe("SwapAPI", () => { + const apiClient = createJupiterApiClient().swap; it("success state", async () => { await apiClient.quoteGet({ inputMint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",