@@ -3,9 +3,7 @@ import { QUERY_KEY_BLOCK_PREFIX } from "@galacticcouncil/utils"
33import { QueryKey , queryOptions } from "@tanstack/react-query"
44import Big from "big.js"
55
6- import { papiDryRunErrorQuery } from "@/api/dryRun"
76import { getTimeFrameMillis } from "@/components/TimeFrame/TimeFrame.utils"
8- import { ENV } from "@/config/env"
97import {
108 DcaFormValues ,
119 DcaOrdersMode ,
@@ -84,24 +82,17 @@ export const bestSellTxQuery = (
8482type BestSellWithTxArgs = BestSellArgs & {
8583 readonly slippage : number
8684 readonly address : string
87- readonly dryRun ?: boolean
8885}
8986
9087export const bestSellWithTxQuery = (
9188 rpc : TProviderContext ,
92- { slippage, address, dryRun , ...bestSellArgs } : BestSellWithTxArgs ,
89+ { slippage, address, ...bestSellArgs } : BestSellWithTxArgs ,
9390) => {
9491 const { queryClient } = rpc
9592 const bestSell = bestSellQuery ( rpc , bestSellArgs )
9693
9794 return queryOptions ( {
98- queryKey : [
99- QUERY_KEY_BLOCK_PREFIX ,
100- bestSell . queryKey ,
101- slippage ,
102- address ,
103- dryRun ,
104- ] ,
95+ queryKey : [ QUERY_KEY_BLOCK_PREFIX , bestSell . queryKey , slippage , address ] ,
10596 queryFn : async ( ) => {
10697 const swap = await queryClient . ensureQueryData ( bestSell )
10798
@@ -117,17 +108,9 @@ export const bestSellWithTxQuery = (
117108 ? await queryClient . ensureQueryData ( txQuery )
118109 : null
119110
120- const dryRunError =
121- tx && dryRun && ENV . VITE_DRY_RUN_ENABLED
122- ? await queryClient . ensureQueryData (
123- papiDryRunErrorQuery ( rpc , address , tx , bestSellArgs . debug ) ,
124- )
125- : null
126-
127111 return {
128112 swap,
129113 tx,
130- dryRunError,
131114 }
132115 } ,
133116 enabled : bestSell . enabled as boolean ,
@@ -189,7 +172,6 @@ type BestSellTwapWithTxArgs = BestSellTwapArgs & {
189172 readonly slippage : number
190173 readonly address : string
191174 readonly maxRetries : number
192- readonly dryRun ?: boolean
193175}
194176
195177export const bestSellTwapWithTxQuery = (
@@ -198,7 +180,6 @@ export const bestSellTwapWithTxQuery = (
198180 slippage,
199181 maxRetries,
200182 address,
201- dryRun,
202183 ...bestSellTwapArgs
203184 } : BestSellTwapWithTxArgs ,
204185 enabled = true ,
@@ -213,7 +194,6 @@ export const bestSellTwapWithTxQuery = (
213194 slippage ,
214195 maxRetries ,
215196 address ,
216- dryRun ,
217197 ] ,
218198 queryFn : async ( ) => {
219199 const twap = await queryClient . ensureQueryData ( bestSellTwap )
@@ -231,14 +211,7 @@ export const bestSellTwapWithTxQuery = (
231211 ? await queryClient . ensureQueryData ( txQuery )
232212 : null
233213
234- const dryRunError =
235- tx && dryRun && ENV . VITE_DRY_RUN_ENABLED
236- ? await queryClient . ensureQueryData (
237- papiDryRunErrorQuery ( rpc , address , tx ) ,
238- )
239- : null
240-
241- return { twap, tx, dryRunError }
214+ return { twap, tx }
242215 } ,
243216 enabled : enabled && ( bestSellTwap . enabled as boolean ) ,
244217 } )
@@ -303,24 +276,17 @@ export const bestBuyTxQuery = (
303276type BestBuyWithTxArgs = BestBuyArgs & {
304277 readonly slippage : number
305278 readonly address : string
306- readonly dryRun ?: boolean
307279}
308280
309281export const bestBuyWithTxQuery = (
310282 rpc : TProviderContext ,
311- { slippage, address, dryRun , ...bestBuyArgs } : BestBuyWithTxArgs ,
283+ { slippage, address, ...bestBuyArgs } : BestBuyWithTxArgs ,
312284) => {
313285 const { queryClient } = rpc
314286 const bestBuy = bestBuyQuery ( rpc , bestBuyArgs )
315287
316288 return queryOptions ( {
317- queryKey : [
318- QUERY_KEY_BLOCK_PREFIX ,
319- bestBuy . queryKey ,
320- slippage ,
321- address ,
322- dryRun ,
323- ] ,
289+ queryKey : [ QUERY_KEY_BLOCK_PREFIX , bestBuy . queryKey , slippage , address ] ,
324290 queryFn : async ( ) => {
325291 const swap = await queryClient . ensureQueryData ( bestBuy )
326292
@@ -336,17 +302,9 @@ export const bestBuyWithTxQuery = (
336302 ? await queryClient . ensureQueryData ( txQuery )
337303 : null
338304
339- const dryRunError =
340- tx && dryRun && ENV . VITE_DRY_RUN_ENABLED
341- ? await queryClient . ensureQueryData (
342- papiDryRunErrorQuery ( rpc , address , tx , bestBuyArgs . debug ) ,
343- )
344- : null
345-
346305 return {
347306 swap,
348307 tx,
349- dryRunError,
350308 }
351309 } ,
352310 enabled : bestBuy . enabled as boolean ,
@@ -408,18 +366,11 @@ type BestBuyTwapWithTxArgs = BestBuyTwapArgs & {
408366 readonly slippage : number
409367 readonly address : string
410368 readonly maxRetries : number
411- readonly dryRun ?: boolean
412369}
413370
414371export const bestBuyTwapWithTxQuery = (
415372 rpc : TProviderContext ,
416- {
417- slippage,
418- maxRetries,
419- address,
420- dryRun,
421- ...bestBuyTwapArgs
422- } : BestBuyTwapWithTxArgs ,
373+ { slippage, maxRetries, address, ...bestBuyTwapArgs } : BestBuyTwapWithTxArgs ,
423374 enabled = true ,
424375) => {
425376 const { queryClient } = rpc
@@ -432,7 +383,6 @@ export const bestBuyTwapWithTxQuery = (
432383 slippage ,
433384 maxRetries ,
434385 address ,
435- dryRun ,
436386 ] ,
437387 queryFn : async ( ) => {
438388 const twap = await queryClient . ensureQueryData ( bestBuyTwap )
@@ -450,14 +400,7 @@ export const bestBuyTwapWithTxQuery = (
450400 ? await queryClient . ensureQueryData ( txQuery )
451401 : null
452402
453- const dryRunError =
454- tx && dryRun && ENV . VITE_DRY_RUN_ENABLED
455- ? await queryClient . ensureQueryData (
456- papiDryRunErrorQuery ( rpc , address , tx ) ,
457- )
458- : null
459-
460- return { twap, tx, dryRunError }
403+ return { twap, tx }
461404 } ,
462405 enabled : enabled && ( bestBuyTwap . enabled as boolean ) ,
463406 } )
@@ -541,18 +484,17 @@ type DcaTradeOrderArgs = {
541484 readonly slippage : number
542485 readonly maxRetries : number
543486 readonly address : string
544- readonly dryRun ?: boolean
545487}
546488
547489export const dcaTradeOrderQuery = (
548490 rpc : TProviderContext ,
549- { form, slippage, maxRetries, address, dryRun } : DcaTradeOrderArgs ,
491+ { form, slippage, maxRetries, address } : DcaTradeOrderArgs ,
550492) => {
551493 const { queryClient } = rpc
552494 const dcaOrder = dcaOrderQuery ( rpc , form )
553495
554496 return queryOptions ( {
555- queryKey : [ ...dcaOrder . queryKey , slippage , maxRetries , address , dryRun ] ,
497+ queryKey : [ ...dcaOrder . queryKey , slippage , maxRetries , address ] ,
556498 queryFn : async ( ) => {
557499 const order = await queryClient . ensureQueryData ( dcaOrder )
558500
@@ -571,14 +513,7 @@ export const dcaTradeOrderQuery = (
571513 ? await queryClient . ensureQueryData ( txQuery )
572514 : null
573515
574- const dryRunError =
575- orderTx && dryRun && ENV . VITE_DRY_RUN_ENABLED
576- ? await queryClient . ensureQueryData (
577- papiDryRunErrorQuery ( rpc , address , orderTx ) ,
578- )
579- : null
580-
581- return { order, orderTx, dryRunError }
516+ return { order, orderTx }
582517 } ,
583518 enabled : dcaOrder . enabled as boolean ,
584519 } )
0 commit comments