Skip to content

Commit

Permalink
feat: Update Odos API to include accountName in getQuote endpoint; re…
Browse files Browse the repository at this point in the history
…move deprecated QuoteRequestV2
  • Loading branch information
ewhal committed Sep 17, 2024
1 parent fa071ad commit f58f90f
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 117 deletions.
2 changes: 1 addition & 1 deletion packages/moon-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@moonup/moon-api",
"version": "0.0.35",
"version": "0.0.36",
"type": "commonjs",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
11 changes: 7 additions & 4 deletions packages/moon-api/src/lib/Odos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
GetSupportedTokensData,
GetSupportedTokensParams,
OdosSwapInputBody,
QuoteRequestV2,
SwapData,
} from './data-contracts';
import { ContentType, HttpClient, RequestParams } from './http-client';
Expand Down Expand Up @@ -142,12 +141,16 @@ export class Odos<SecurityDataType = unknown> {
*
* @tags Odos
* @name GetQuote
* @request POST:/odos/get-quote
* @request POST:/odos/{accountName}/get-quote
* @secure
*/
getQuote = (data: QuoteRequestV2, params: RequestParams = {}) =>
getQuote = (
accountName: string,
data: OdosSwapInputBody,
params: RequestParams = {}
) =>
this.http.request<GetQuoteResult, any>({
path: `/odos/get-quote`,
path: `/odos/${accountName}/get-quote`,
method: 'POST',
body: data,
secure: true,
Expand Down
9 changes: 5 additions & 4 deletions packages/moon-api/src/lib/OdosRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
GetSupportedChainsData,
GetSupportedTokensData,
OdosSwapInputBody,
QuoteRequestV2,
SwapData,
} from './data-contracts';

Expand Down Expand Up @@ -132,13 +131,15 @@ export namespace Odos {
* No description
* @tags Odos
* @name GetQuote
* @request POST:/odos/get-quote
* @request POST:/odos/{accountName}/get-quote
* @secure
*/
export namespace GetQuote {
export type RequestParams = {};
export type RequestParams = {
accountName: string;
};
export type RequestQuery = {};
export type RequestBody = QuoteRequestV2;
export type RequestBody = OdosSwapInputBody;
export type RequestHeaders = {
Authorization: string;
};
Expand Down
24 changes: 0 additions & 24 deletions packages/moon-api/src/lib/data-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2112,30 +2112,6 @@ export interface Quote {
type: string;
}

export interface QuoteRequestV2 {
/** @format double */
chainId: number;
compact?: boolean;
disableRFQs?: boolean;
/** @format double */
gasPrice?: number;
inputTokens: TokenAmount[];
likeAsset?: boolean;
outputTokens: TokenProportion[];
pathViz?: boolean;
pathVizImage?: boolean;
pathVizImageConfig?: PathVizImageConfig;
poolBlacklist?: string[];
/** @format double */
referralCode?: number;
simple?: boolean;
/** @format double */
slippageLimitPercent?: number;
sourceBlacklist?: string[];
sourceWhitelist?: string[];
userAddr?: string;
}

export type Quotes = Quote[];

export type RedeemData = ERC4626APIResponse;
Expand Down
93 changes: 10 additions & 83 deletions packages/moon-api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -4158,87 +4158,6 @@
"type": "object",
"additionalProperties": false
},
"QuoteRequestV2": {
"properties": {
"chainId": {
"type": "number",
"format": "double"
},
"inputTokens": {
"items": {
"$ref": "#/components/schemas/TokenAmount"
},
"type": "array"
},
"outputTokens": {
"items": {
"$ref": "#/components/schemas/TokenProportion"
},
"type": "array"
},
"gasPrice": {
"type": "number",
"format": "double"
},
"userAddr": {
"type": "string"
},
"slippageLimitPercent": {
"type": "number",
"format": "double"
},
"sourceBlacklist": {
"items": {
"type": "string"
},
"type": "array"
},
"sourceWhitelist": {
"items": {
"type": "string"
},
"type": "array"
},
"poolBlacklist": {
"items": {
"type": "string"
},
"type": "array"
},
"pathViz": {
"type": "boolean"
},
"pathVizImage": {
"type": "boolean"
},
"pathVizImageConfig": {
"$ref": "#/components/schemas/PathVizImageConfig"
},
"disableRFQs": {
"type": "boolean"
},
"referralCode": {
"type": "number",
"format": "double"
},
"compact": {
"type": "boolean"
},
"likeAsset": {
"type": "boolean"
},
"simple": {
"type": "boolean"
}
},
"required": [
"chainId",
"inputTokens",
"outputTokens"
],
"type": "object",
"additionalProperties": false
},
"AssembleRequest": {
"properties": {
"userAddr": {
Expand Down Expand Up @@ -14665,7 +14584,7 @@
}
}
},
"/odos/get-quote": {
"/odos/{accountName}/get-quote": {
"post": {
"operationId": "GetQuote",
"responses": {
Expand Down Expand Up @@ -14695,6 +14614,14 @@
}
],
"parameters": [
{
"in": "path",
"name": "accountName",
"required": true,
"schema": {
"type": "string"
}
},
{
"in": "header",
"name": "Authorization",
Expand All @@ -14709,7 +14636,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QuoteRequestV2"
"$ref": "#/components/schemas/OdosSwapInputBody"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/moon-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@moonup/moon-sdk",
"version": "1.0.24",
"version": "1.0.25",
"author": "0xEwhal <[email protected]>",
"type": "commonjs",
"main": "./dist/index.js",
Expand Down

0 comments on commit f58f90f

Please sign in to comment.