diff --git a/.changeset/large-melons-nail.md b/.changeset/large-melons-nail.md new file mode 100644 index 00000000..ac208c37 --- /dev/null +++ b/.changeset/large-melons-nail.md @@ -0,0 +1,5 @@ +--- +"sushi": patch +--- + +Adds missing `gasSpent` property to the `getQuote` result diff --git a/src/evm/api/quote.test.ts b/src/evm/api/quote.test.ts index 9d68624a..9eacba80 100644 --- a/src/evm/api/quote.test.ts +++ b/src/evm/api/quote.test.ts @@ -32,6 +32,16 @@ describe('getQuote', () => { } }) + it('should return gasSpent as a number on success', async () => { + const result = await getQuote(baseQuoteRequest) + + expect(result.status).toBe('Success') + if (result.status === 'Success') { + expect(result.gasSpent).toBeTypeOf('number') + expect(result.gasSpent).toBeGreaterThan(0) + } + }) + it.skip('should return a quote when url is set to staging', async () => { const result = await getQuote({ ...baseQuoteRequest, diff --git a/src/evm/api/quote.ts b/src/evm/api/quote.ts index 74ddbc5f..53a5c7d0 100644 --- a/src/evm/api/quote.ts +++ b/src/evm/api/quote.ts @@ -40,6 +40,8 @@ function quoteResponseSchema(visualize?: Visualize) { amountIn: z.string(), assumedAmountOut: z.string(), + + gasSpent: z.number(), }) .transform((data) => ({ ...data,