From aef2ef003b303cbbb3571349e2486a65f08a4675 Mon Sep 17 00:00:00 2001 From: Eugene Chybisov Date: Tue, 1 Oct 2024 10:07:52 +0200 Subject: [PATCH 1/4] feat: update quote request from amount and to amount types --- src/api.ts | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/api.ts b/src/api.ts index a1fcdbef..612b6001 100644 --- a/src/api.ts +++ b/src/api.ts @@ -258,11 +258,10 @@ export interface ToolConfiguration { preferExchanges?: string[] } -export interface QuoteRequest extends ToolConfiguration, TimingStrings { +export interface PartialQuoteRequest extends ToolConfiguration, TimingStrings { fromChain: number | string fromToken: string fromAddress: string - fromAmount: string toChain: number | string toToken: string @@ -274,7 +273,7 @@ export interface QuoteRequest extends ToolConfiguration, TimingStrings { referrer?: string fee?: number | string allowDestinationCall?: boolean // (default : true) // destination calls are enabled by default - fromAmountForGas?: string // the amount of token to convert to gas + maxPriceImpact?: number // hide routes with price impact greater than or equal to this value skipSimulation?: boolean @@ -284,11 +283,25 @@ export interface QuoteRequest extends ToolConfiguration, TimingStrings { insurance?: boolean // indicates whether the user wants a quote with bridge insurance } -export interface QuoteToAmountRequest - extends Omit { +export interface QuoteFromAmountRequest extends PartialQuoteRequest { + fromAmountForGas?: string // the amount of token to convert to gas + fromAmount: string +} + +export interface QuoteToAmountRequest extends PartialQuoteRequest { toAmount: string } +export type QuoteRequest = QuoteFromAmountRequest | QuoteToAmountRequest + +export const isQuoteRequestWithFromAmount = ( + r: QuoteRequest +): r is QuoteFromAmountRequest => 'fromAmount' in r + +export const isQuoteRequestWithToAmount = ( + r: QuoteRequest +): r is QuoteToAmountRequest => 'toAmount' in r + export interface ContractCall { fromAmount: string fromTokenAddress: string @@ -331,12 +344,13 @@ export type ContractCallsQuoteRequestFromAmount = export type ContractCallsQuoteRequest = | ContractCallsQuoteRequestFromAmount | ContractCallsQuoteRequestToAmount + export const isContractCallsRequestWithFromAmount = ( - r: ContractCallsQuoteRequestFromAmount | ContractCallsQuoteRequestToAmount + r: ContractCallsQuoteRequest ): r is ContractCallsQuoteRequestFromAmount => 'fromAmount' in r export const isContractCallsRequestWithToAmount = ( - r: ContractCallsQuoteRequestFromAmount | ContractCallsQuoteRequestToAmount + r: ContractCallsQuoteRequest ): r is ContractCallsQuoteRequestToAmount => 'toAmount' in r /* @deprecated */ From 8d1d54cd004213b2e23e80fcfff4bbf45645c032 Mon Sep 17 00:00:00 2001 From: Eugene Chybisov Date: Tue, 1 Oct 2024 10:09:09 +0200 Subject: [PATCH 2/4] chore(release): 15.16.0-alpha.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 90bad732..3e4a8e1c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lifi/types", - "version": "15.15.0", + "version": "15.16.0-alpha.0", "description": "Types for the LI.FI stack", "keywords": [ "sdk", From aafb28012e2ff25a593db8112aadf770cd29090b Mon Sep 17 00:00:00 2001 From: Eugene Chybisov Date: Tue, 1 Oct 2024 10:24:47 +0200 Subject: [PATCH 3/4] fix: remove insurance --- src/api.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api.ts b/src/api.ts index 612b6001..a8c79a0e 100644 --- a/src/api.ts +++ b/src/api.ts @@ -288,7 +288,8 @@ export interface QuoteFromAmountRequest extends PartialQuoteRequest { fromAmount: string } -export interface QuoteToAmountRequest extends PartialQuoteRequest { +export interface QuoteToAmountRequest + extends Omit { toAmount: string } From 2d30caf657db648710e9efc4b3aeeb902efa3719 Mon Sep 17 00:00:00 2001 From: Eugene Chybisov Date: Tue, 1 Oct 2024 10:24:52 +0200 Subject: [PATCH 4/4] chore(release): 15.16.0-alpha.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3e4a8e1c..b8f3a2a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lifi/types", - "version": "15.16.0-alpha.0", + "version": "15.16.0-alpha.1", "description": "Types for the LI.FI stack", "keywords": [ "sdk",