From a8785290f2663748ce31f6722a74b39f5852d5fe Mon Sep 17 00:00:00 2001 From: Jose Felix Date: Tue, 26 Nov 2024 16:38:28 -0400 Subject: [PATCH 1/5] feat: split txs for Ledger --- packages/stores/src/account/base.ts | 4 +- .../web/hooks/limit-orders/use-place-limit.ts | 155 ++++++++---- packages/web/hooks/use-swap.tsx | 239 +++++++++++++----- 3 files changed, 288 insertions(+), 110 deletions(-) diff --git a/packages/stores/src/account/base.ts b/packages/stores/src/account/base.ts index ba5a5ab90d..4b9dc1218a 100644 --- a/packages/stores/src/account/base.ts +++ b/packages/stores/src/account/base.ts @@ -515,7 +515,7 @@ export class AccountStore[] = []> { fee?: StdFee, signOptions?: SignOptions, onTxEvents?: - | ((tx: DeliverTxResponse) => void) + | ((tx: DeliverTxResponse) => void | Promise) | { onBroadcastFailed?: (e?: Error) => void; onBroadcasted?: (txHash: Uint8Array) => void; @@ -709,7 +709,7 @@ export class AccountStore[] = []> { } if (onFulfill) { - onFulfill(tx); + await onFulfill(tx); } } catch (e) { const error = e as Error | AccountStoreNoBroadcastErrorEvent; diff --git a/packages/web/hooks/limit-orders/use-place-limit.ts b/packages/web/hooks/limit-orders/use-place-limit.ts index 964ed0108a..0df9e5e25b 100644 --- a/packages/web/hooks/limit-orders/use-place-limit.ts +++ b/packages/web/hooks/limit-orders/use-place-limit.ts @@ -288,11 +288,14 @@ export const usePlaceLimit = ({ const { oneClickMessages, isLoadingOneClickMessages, shouldSend1CTTx } = use1CTSwapReviewMessages(); + const isLedger = true ?? account?.walletInfo?.mode === "ledger"; + const limitMessages = useMemo(() => { + if (isLedger) return encodedMsg && !isMarket ? [encodedMsg] : []; return encodedMsg && !isMarket ? [encodedMsg, ...(oneClickMessages?.msgs ?? [])] : []; - }, [encodedMsg, isMarket, oneClickMessages?.msgs]); + }, [encodedMsg, isLedger, isMarket, oneClickMessages?.msgs]); const placeLimit = useCallback(async () => { const quantity = paymentTokenValue?.toCoin().amount ?? "0"; @@ -375,50 +378,116 @@ export const usePlaceLimit = ({ try { logEvent([EventName.LimitOrder.placeOrderStarted, baseEvent]); - await accountStore.signAndBroadcast( - accountStore.osmosisChainId, - "executeWasm", - limitMessages, - "", - undefined, - undefined, - (tx) => { - if (!tx.code) { - if ( - shouldSend1CTTx && - oneClickMessages && - oneClickMessages.type === "create-1ct-session" - ) { - onAdd1CTSession({ - privateKey: oneClickMessages.key, - tx, - userOsmoAddress: account?.address ?? "", - fallbackGetAuthenticatorId: - apiUtils.local.oneClickTrading.getSessionAuthenticator.fetch, - accountStore, - allowedMessages: oneClickMessages.allowedMessages, - sessionPeriod: oneClickMessages.sessionPeriod, - spendLimitTokenDecimals: - oneClickMessages.spendLimitTokenDecimals, - transaction1CTParams: oneClickMessages.transaction1CTParams, - allowedAmount: oneClickMessages.allowedAmount, - t, - logEvent, - }); - } else if ( - shouldSend1CTTx && - oneClickMessages && - oneClickMessages.type === "remove-1ct-session" - ) { - onEnd1CTSession({ - accountStore, - authenticatorId: oneClickMessages.authenticatorId, - logEvent, - }); + /** + * If it's ledger and we have one-click messages, we need to add a 1CT session + * before broadcasting the transaction as there is a payload limit on ledger + */ + if ( + isLedger && + oneClickMessages && + oneClickMessages.msgs && + shouldSend1CTTx + ) { + await accountStore.signAndBroadcast( + accountStore.osmosisChainId, + "Add 1CT session", + oneClickMessages.msgs, + undefined, + undefined, + undefined, + async (tx) => { + const { code } = tx; + if (code) { + throw new Error("Failed to send swap exact amount in message"); + } else { + if ( + oneClickMessages && + oneClickMessages.type === "create-1ct-session" + ) { + await onAdd1CTSession({ + privateKey: oneClickMessages.key, + tx, + userOsmoAddress: account?.address ?? "", + fallbackGetAuthenticatorId: + apiUtils.local.oneClickTrading.getSessionAuthenticator + .fetch, + accountStore, + allowedMessages: oneClickMessages.allowedMessages, + sessionPeriod: oneClickMessages.sessionPeriod, + spendLimitTokenDecimals: + oneClickMessages.spendLimitTokenDecimals, + transaction1CTParams: oneClickMessages.transaction1CTParams, + allowedAmount: oneClickMessages.allowedAmount, + t, + logEvent, + }); + } else if ( + shouldSend1CTTx && + oneClickMessages && + oneClickMessages.type === "remove-1ct-session" + ) { + await onEnd1CTSession({ + accountStore, + authenticatorId: oneClickMessages.authenticatorId, + logEvent, + }); + } } } - } - ); + ); + + await accountStore.signAndBroadcast( + accountStore.osmosisChainId, + "executeWasm", + limitMessages + ); + } else { + await accountStore.signAndBroadcast( + accountStore.osmosisChainId, + "executeWasm", + limitMessages, + "", + undefined, + undefined, + (tx) => { + if (!tx.code) { + if ( + shouldSend1CTTx && + oneClickMessages && + oneClickMessages.type === "create-1ct-session" + ) { + onAdd1CTSession({ + privateKey: oneClickMessages.key, + tx, + userOsmoAddress: account?.address ?? "", + fallbackGetAuthenticatorId: + apiUtils.local.oneClickTrading.getSessionAuthenticator + .fetch, + accountStore, + allowedMessages: oneClickMessages.allowedMessages, + sessionPeriod: oneClickMessages.sessionPeriod, + spendLimitTokenDecimals: + oneClickMessages.spendLimitTokenDecimals, + transaction1CTParams: oneClickMessages.transaction1CTParams, + allowedAmount: oneClickMessages.allowedAmount, + t, + logEvent, + }); + } else if ( + shouldSend1CTTx && + oneClickMessages && + oneClickMessages.type === "remove-1ct-session" + ) { + onEnd1CTSession({ + accountStore, + authenticatorId: oneClickMessages.authenticatorId, + logEvent, + }); + } + } + } + ); + } logEvent([EventName.LimitOrder.placeOrderCompleted, baseEvent]); } catch (error) { console.error("Error attempting to broadcast place limit tx", error); diff --git a/packages/web/hooks/use-swap.tsx b/packages/web/hooks/use-swap.tsx index bdb92ceb74..a44e2d44ab 100644 --- a/packages/web/hooks/use-swap.tsx +++ b/packages/web/hooks/use-swap.tsx @@ -334,9 +334,12 @@ export function useSwap( const { oneClickMessages, isLoadingOneClickMessages, shouldSend1CTTx } = use1CTSwapReviewMessages(); + const isLedger = account?.walletInfo?.mode === "ledger"; + const messages = useMemo(() => { + if (isLedger) return quote?.messages ?? []; return [...(quote?.messages ?? []), ...(oneClickMessages?.msgs ?? [])]; - }, [quote?.messages, oneClickMessages?.msgs]); + }, [isLedger, quote?.messages, oneClickMessages?.msgs]); const { data: networkFee, @@ -520,73 +523,177 @@ export function useSwap( const { routes } = txParams; const typedRoutes = routes as SwapTxRouteOutGivenIn[]; - accountStore - .signAndBroadcast( - chainStore.osmosis.chainId, - quoteType === "out-given-in" - ? routes.length === 1 - ? "swapExactAmountIn" - : "splitRouteSwapExactAmountIn" - : routes.length === 1 - ? "swapExactAmountOut" - : "splitRouteSwapExactAmountOut", - messages, - undefined, - signOptions?.fee, - signOptions, - (tx) => { - const { code } = tx; - if (code) { - reject( - new Error("Failed to send swap exact amount in message") - ); - } else { - if ( - shouldSend1CTTx && - oneClickMessages && - oneClickMessages.type === "create-1ct-session" - ) { - onAdd1CTSession({ - privateKey: oneClickMessages.key, - tx, - userOsmoAddress: account?.address ?? "", - fallbackGetAuthenticatorId: - apiUtils.local.oneClickTrading.getSessionAuthenticator - .fetch, - accountStore, - allowedMessages: oneClickMessages.allowedMessages, - sessionPeriod: oneClickMessages.sessionPeriod, - spendLimitTokenDecimals: - oneClickMessages.spendLimitTokenDecimals, - transaction1CTParams: - oneClickMessages.transaction1CTParams, - allowedAmount: oneClickMessages.allowedAmount, - t, - logEvent, - }); - } else if ( - shouldSend1CTTx && - oneClickMessages && - oneClickMessages.type === "remove-1ct-session" - ) { - onEnd1CTSession({ - accountStore, - authenticatorId: oneClickMessages.authenticatorId, - logEvent, - }); + + /** + * If it's ledger and we have one-click messages, we need to add a 1CT session + * before broadcasting the transaction as there is a payload limit on ledger + */ + if ( + isLedger && + oneClickMessages && + oneClickMessages.msgs && + shouldSend1CTTx + ) { + await accountStore + .signAndBroadcast( + chainStore.osmosis.chainId, + "Add 1CT session", + oneClickMessages.msgs, + undefined, + undefined, + undefined, + async (tx) => { + const { code } = tx; + if (code) { + reject( + new Error("Failed to send swap exact amount in message") + ); + } else { + if ( + oneClickMessages && + oneClickMessages.type === "create-1ct-session" + ) { + await onAdd1CTSession({ + privateKey: oneClickMessages.key, + tx, + userOsmoAddress: account?.address ?? "", + fallbackGetAuthenticatorId: + apiUtils.local.oneClickTrading.getSessionAuthenticator + .fetch, + accountStore, + allowedMessages: oneClickMessages.allowedMessages, + sessionPeriod: oneClickMessages.sessionPeriod, + spendLimitTokenDecimals: + oneClickMessages.spendLimitTokenDecimals, + transaction1CTParams: + oneClickMessages.transaction1CTParams, + allowedAmount: oneClickMessages.allowedAmount, + t, + logEvent, + }); + } else if ( + shouldSend1CTTx && + oneClickMessages && + oneClickMessages.type === "remove-1ct-session" + ) { + await onEnd1CTSession({ + accountStore, + authenticatorId: oneClickMessages.authenticatorId, + logEvent, + }); + } } + } + ) + .catch(reject); - resolve( - routes.length === 1 - ? typedRoutes[0].pools.length === 1 - ? "exact-in" - : "multihop" - : "multiroute" - ); + await accountStore + .signAndBroadcast( + chainStore.osmosis.chainId, + quoteType === "out-given-in" + ? routes.length === 1 + ? "swapExactAmountIn" + : "splitRouteSwapExactAmountIn" + : routes.length === 1 + ? "swapExactAmountOut" + : "splitRouteSwapExactAmountOut", + messages, + undefined, + undefined, + { + ...signOptions, + useOneClickTrading: + await accountStore.shouldBeSignedWithOneClickTrading({ + messages, + }), + }, + (tx) => { + const { code } = tx; + if (code) { + reject( + new Error("Failed to send swap exact amount in message") + ); + } else { + resolve( + routes.length === 1 + ? typedRoutes[0].pools.length === 1 + ? "exact-in" + : "multihop" + : "multiroute" + ); + } + } + ) + .catch(reject); + } else { + accountStore + .signAndBroadcast( + chainStore.osmosis.chainId, + quoteType === "out-given-in" + ? routes.length === 1 + ? "swapExactAmountIn" + : "splitRouteSwapExactAmountIn" + : routes.length === 1 + ? "swapExactAmountOut" + : "splitRouteSwapExactAmountOut", + messages, + undefined, + signOptions?.fee, + signOptions, + (tx) => { + const { code } = tx; + if (code) { + reject( + new Error("Failed to send swap exact amount in message") + ); + } else { + if ( + shouldSend1CTTx && + oneClickMessages && + oneClickMessages.type === "create-1ct-session" + ) { + onAdd1CTSession({ + privateKey: oneClickMessages.key, + tx, + userOsmoAddress: account?.address ?? "", + fallbackGetAuthenticatorId: + apiUtils.local.oneClickTrading.getSessionAuthenticator + .fetch, + accountStore, + allowedMessages: oneClickMessages.allowedMessages, + sessionPeriod: oneClickMessages.sessionPeriod, + spendLimitTokenDecimals: + oneClickMessages.spendLimitTokenDecimals, + transaction1CTParams: + oneClickMessages.transaction1CTParams, + allowedAmount: oneClickMessages.allowedAmount, + t, + logEvent, + }); + } else if ( + shouldSend1CTTx && + oneClickMessages && + oneClickMessages.type === "remove-1ct-session" + ) { + onEnd1CTSession({ + accountStore, + authenticatorId: oneClickMessages.authenticatorId, + logEvent, + }); + } + + resolve( + routes.length === 1 + ? typedRoutes[0].pools.length === 1 + ? "exact-in" + : "multihop" + : "multiroute" + ); + } } - } - ) - .catch(reject); + ) + .catch(reject); + } } ).finally(() => { inAmountInput.reset(); @@ -600,7 +707,9 @@ export function useSwap( featureFlags.swapToolSimulateFee, hasOverSpendLimitError, inAmountInput, + isLedger, isOneClickTradingEnabled, + logEvent, maxSlippage, messages, networkFee, From 56d31c0e711041b14cb92ac889a96dc7b2827ba3 Mon Sep 17 00:00:00 2001 From: Jose Felix Date: Tue, 26 Nov 2024 16:41:14 -0400 Subject: [PATCH 2/5] fix: wrong override --- packages/web/hooks/limit-orders/use-place-limit.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web/hooks/limit-orders/use-place-limit.ts b/packages/web/hooks/limit-orders/use-place-limit.ts index 0df9e5e25b..e25993daa9 100644 --- a/packages/web/hooks/limit-orders/use-place-limit.ts +++ b/packages/web/hooks/limit-orders/use-place-limit.ts @@ -288,7 +288,7 @@ export const usePlaceLimit = ({ const { oneClickMessages, isLoadingOneClickMessages, shouldSend1CTTx } = use1CTSwapReviewMessages(); - const isLedger = true ?? account?.walletInfo?.mode === "ledger"; + const isLedger = account?.walletInfo?.mode === "ledger"; const limitMessages = useMemo(() => { if (isLedger) return encodedMsg && !isMarket ? [encodedMsg] : []; From fcf421cc150c4102af2f3b9271afa2ac90ba38fd Mon Sep 17 00:00:00 2001 From: Jose Felix Date: Tue, 26 Nov 2024 17:11:37 -0400 Subject: [PATCH 3/5] feat: default to non ledger behavior --- .../web/hooks/limit-orders/use-place-limit.ts | 33 ++++++++++++++----- packages/web/hooks/use-swap.tsx | 30 +++++++++++++---- 2 files changed, 48 insertions(+), 15 deletions(-) diff --git a/packages/web/hooks/limit-orders/use-place-limit.ts b/packages/web/hooks/limit-orders/use-place-limit.ts index e25993daa9..8840d31f27 100644 --- a/packages/web/hooks/limit-orders/use-place-limit.ts +++ b/packages/web/hooks/limit-orders/use-place-limit.ts @@ -290,12 +290,28 @@ export const usePlaceLimit = ({ const isLedger = account?.walletInfo?.mode === "ledger"; + /** + * Compute the negative first so we can default to the ledger case, + * just in case the wallet does not return the correct value + */ + const { value: isNotLedger } = useAsync(async () => { + const result = await account?.client?.getAccount?.( + accountStore.osmosisChainId + ); + return !(result?.isNanoLedger ?? false); + // Disable deps to include account address in order to recompute the value as the other are memoized mobx values + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [account, account?.address, accountStore.osmosisChainId]); + const limitMessages = useMemo(() => { - if (isLedger) return encodedMsg && !isMarket ? [encodedMsg] : []; - return encodedMsg && !isMarket - ? [encodedMsg, ...(oneClickMessages?.msgs ?? [])] - : []; - }, [encodedMsg, isLedger, isMarket, oneClickMessages?.msgs]); + if (isNotLedger) { + return encodedMsg && !isMarket + ? [encodedMsg, ...(oneClickMessages?.msgs ?? [])] + : []; + } + + return encodedMsg && !isMarket ? [encodedMsg] : []; + }, [encodedMsg, isNotLedger, isMarket, oneClickMessages?.msgs]); const placeLimit = useCallback(async () => { const quantity = paymentTokenValue?.toCoin().amount ?? "0"; @@ -383,7 +399,7 @@ export const usePlaceLimit = ({ * before broadcasting the transaction as there is a payload limit on ledger */ if ( - isLedger && + !isNotLedger && oneClickMessages && oneClickMessages.msgs && shouldSend1CTTx @@ -513,9 +529,10 @@ export const usePlaceLimit = ({ feeUsdValue, marketState, logEvent, - accountStore, - shouldSend1CTTx, + isNotLedger, oneClickMessages, + shouldSend1CTTx, + accountStore, account?.address, apiUtils.local.oneClickTrading.getSessionAuthenticator.fetch, t, diff --git a/packages/web/hooks/use-swap.tsx b/packages/web/hooks/use-swap.tsx index a44e2d44ab..b9f44de764 100644 --- a/packages/web/hooks/use-swap.tsx +++ b/packages/web/hooks/use-swap.tsx @@ -334,12 +334,25 @@ export function useSwap( const { oneClickMessages, isLoadingOneClickMessages, shouldSend1CTTx } = use1CTSwapReviewMessages(); - const isLedger = account?.walletInfo?.mode === "ledger"; + /** + * Compute the negative first so we can default to the ledger case, + * just in case the wallet does not return the correct value + */ + const { value: isNotLedger } = useAsync(async () => { + const result = await account?.client?.getAccount?.( + accountStore.osmosisChainId + ); + return !(result?.isNanoLedger ?? false); + // Disable deps to include account address in order to recompute the value as the other are memoized mobx values + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [account, account?.address, accountStore.osmosisChainId]); const messages = useMemo(() => { - if (isLedger) return quote?.messages ?? []; - return [...(quote?.messages ?? []), ...(oneClickMessages?.msgs ?? [])]; - }, [isLedger, quote?.messages, oneClickMessages?.msgs]); + if (isNotLedger) { + return [...(quote?.messages ?? []), ...(oneClickMessages?.msgs ?? [])]; + } + return quote?.messages ?? []; + }, [isNotLedger, quote?.messages, oneClickMessages?.msgs]); const { data: networkFee, @@ -529,7 +542,7 @@ export function useSwap( * before broadcasting the transaction as there is a payload limit on ledger */ if ( - isLedger && + !isNotLedger && oneClickMessages && oneClickMessages.msgs && shouldSend1CTTx @@ -585,7 +598,10 @@ export function useSwap( } } ) - .catch(reject); + .catch((e) => { + reject(e); + throw e; + }); await accountStore .signAndBroadcast( @@ -707,7 +723,7 @@ export function useSwap( featureFlags.swapToolSimulateFee, hasOverSpendLimitError, inAmountInput, - isLedger, + isNotLedger, isOneClickTradingEnabled, logEvent, maxSlippage, From c4d257c2df6ba420bdd8e4d7a31ff019eb244aea Mon Sep 17 00:00:00 2001 From: Jose Felix Date: Tue, 26 Nov 2024 17:14:28 -0400 Subject: [PATCH 4/5] improvement: naming --- .../web/hooks/limit-orders/use-place-limit.ts | 26 +++++++++---------- packages/web/hooks/use-swap.tsx | 20 +++++++------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/packages/web/hooks/limit-orders/use-place-limit.ts b/packages/web/hooks/limit-orders/use-place-limit.ts index 8840d31f27..afe1540bb7 100644 --- a/packages/web/hooks/limit-orders/use-place-limit.ts +++ b/packages/web/hooks/limit-orders/use-place-limit.ts @@ -288,30 +288,28 @@ export const usePlaceLimit = ({ const { oneClickMessages, isLoadingOneClickMessages, shouldSend1CTTx } = use1CTSwapReviewMessages(); - const isLedger = account?.walletInfo?.mode === "ledger"; - /** - * Compute the negative first so we can default to the ledger case, - * just in case the wallet does not return the correct value + * Default isLedger to True, just in case the wallet does + * not return the correct value */ - const { value: isNotLedger } = useAsync(async () => { + const { value: isLedger } = useAsync(async () => { const result = await account?.client?.getAccount?.( accountStore.osmosisChainId ); - return !(result?.isNanoLedger ?? false); + return result?.isNanoLedger ?? true; // Disable deps to include account address in order to recompute the value as the other are memoized mobx values // eslint-disable-next-line react-hooks/exhaustive-deps }, [account, account?.address, accountStore.osmosisChainId]); const limitMessages = useMemo(() => { - if (isNotLedger) { - return encodedMsg && !isMarket - ? [encodedMsg, ...(oneClickMessages?.msgs ?? [])] - : []; + if (isLedger) { + return encodedMsg && !isMarket ? [encodedMsg] : []; } - return encodedMsg && !isMarket ? [encodedMsg] : []; - }, [encodedMsg, isNotLedger, isMarket, oneClickMessages?.msgs]); + return encodedMsg && !isMarket + ? [encodedMsg, ...(oneClickMessages?.msgs ?? [])] + : []; + }, [encodedMsg, isLedger, isMarket, oneClickMessages?.msgs]); const placeLimit = useCallback(async () => { const quantity = paymentTokenValue?.toCoin().amount ?? "0"; @@ -399,7 +397,7 @@ export const usePlaceLimit = ({ * before broadcasting the transaction as there is a payload limit on ledger */ if ( - !isNotLedger && + isLedger && oneClickMessages && oneClickMessages.msgs && shouldSend1CTTx @@ -529,7 +527,7 @@ export const usePlaceLimit = ({ feeUsdValue, marketState, logEvent, - isNotLedger, + isLedger, oneClickMessages, shouldSend1CTTx, accountStore, diff --git a/packages/web/hooks/use-swap.tsx b/packages/web/hooks/use-swap.tsx index b9f44de764..d88aaf79d5 100644 --- a/packages/web/hooks/use-swap.tsx +++ b/packages/web/hooks/use-swap.tsx @@ -335,24 +335,24 @@ export function useSwap( use1CTSwapReviewMessages(); /** - * Compute the negative first so we can default to the ledger case, - * just in case the wallet does not return the correct value + * Default isLedger to True, just in case the wallet does + * not return the correct value */ - const { value: isNotLedger } = useAsync(async () => { + const { value: isLedger } = useAsync(async () => { const result = await account?.client?.getAccount?.( accountStore.osmosisChainId ); - return !(result?.isNanoLedger ?? false); + return result?.isNanoLedger ?? true; // Disable deps to include account address in order to recompute the value as the other are memoized mobx values // eslint-disable-next-line react-hooks/exhaustive-deps }, [account, account?.address, accountStore.osmosisChainId]); const messages = useMemo(() => { - if (isNotLedger) { - return [...(quote?.messages ?? []), ...(oneClickMessages?.msgs ?? [])]; + if (isLedger) { + return quote?.messages ?? []; } - return quote?.messages ?? []; - }, [isNotLedger, quote?.messages, oneClickMessages?.msgs]); + return [...(quote?.messages ?? []), ...(oneClickMessages?.msgs ?? [])]; + }, [isLedger, quote?.messages, oneClickMessages?.msgs]); const { data: networkFee, @@ -542,7 +542,7 @@ export function useSwap( * before broadcasting the transaction as there is a payload limit on ledger */ if ( - !isNotLedger && + isLedger && oneClickMessages && oneClickMessages.msgs && shouldSend1CTTx @@ -723,7 +723,7 @@ export function useSwap( featureFlags.swapToolSimulateFee, hasOverSpendLimitError, inAmountInput, - isNotLedger, + isLedger, isOneClickTradingEnabled, logEvent, maxSlippage, From e1e4008fbc7701c583f5bf6109443926f5fed076 Mon Sep 17 00:00:00 2001 From: Jose Felix Date: Tue, 26 Nov 2024 17:22:34 -0400 Subject: [PATCH 5/5] improvement: typos --- packages/web/hooks/limit-orders/use-place-limit.ts | 4 ++-- packages/web/hooks/use-swap.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/web/hooks/limit-orders/use-place-limit.ts b/packages/web/hooks/limit-orders/use-place-limit.ts index afe1540bb7..3bf52fa05c 100644 --- a/packages/web/hooks/limit-orders/use-place-limit.ts +++ b/packages/web/hooks/limit-orders/use-place-limit.ts @@ -289,7 +289,7 @@ export const usePlaceLimit = ({ use1CTSwapReviewMessages(); /** - * Default isLedger to True, just in case the wallet does + * Default isLedger to true, just in case the wallet does * not return the correct value */ const { value: isLedger } = useAsync(async () => { @@ -297,7 +297,7 @@ export const usePlaceLimit = ({ accountStore.osmosisChainId ); return result?.isNanoLedger ?? true; - // Disable deps to include account address in order to recompute the value as the other are memoized mobx values + // Disable deps to include account address in order to recompute the value as the others are memoized mobx values // eslint-disable-next-line react-hooks/exhaustive-deps }, [account, account?.address, accountStore.osmosisChainId]); diff --git a/packages/web/hooks/use-swap.tsx b/packages/web/hooks/use-swap.tsx index d88aaf79d5..fcf94c6a8f 100644 --- a/packages/web/hooks/use-swap.tsx +++ b/packages/web/hooks/use-swap.tsx @@ -335,7 +335,7 @@ export function useSwap( use1CTSwapReviewMessages(); /** - * Default isLedger to True, just in case the wallet does + * Default isLedger to true, just in case the wallet does * not return the correct value */ const { value: isLedger } = useAsync(async () => { @@ -343,7 +343,7 @@ export function useSwap( accountStore.osmosisChainId ); return result?.isNanoLedger ?? true; - // Disable deps to include account address in order to recompute the value as the other are memoized mobx values + // Disable deps to include account address in order to recompute the value as the others are memoized mobx values // eslint-disable-next-line react-hooks/exhaustive-deps }, [account, account?.address, accountStore.osmosisChainId]);