From fb6e915f838b31db1d1ecb32a6317d22bbc07209 Mon Sep 17 00:00:00 2001 From: Michael Merz Date: Tue, 19 Sep 2023 16:42:28 -0400 Subject: [PATCH 1/7] fix: include tax in max button calculation --- src/txs/Tx.tsx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/txs/Tx.tsx b/src/txs/Tx.tsx index 864c85465..cb383183d 100644 --- a/src/txs/Tx.tsx +++ b/src/txs/Tx.tsx @@ -187,13 +187,23 @@ function Tx(props: Props) { const gasAmount = getGasAmount(gasDenom) const gasFee = { amount: gasAmount, denom: gasDenom } + /* tax */ + const taxAmount = + token && amount && shouldTax + ? calcMinimumTaxAmount(amount, { rate: taxRate, cap: taxCap }) + : undefined + /* max */ const getNativeMax = () => { if (!balance) return return gasFee.denom === token - ? (Number(balance) - Number(gasFee.amount)).toFixed(0) + ? new BigNumber(balance) + .minus(gasFee.amount) + .minus(taxAmount ?? 0) + .toString() : balance } + const max = !gasFee.amount ? undefined : isDenom(token) @@ -205,12 +215,6 @@ function Tx(props: Props) { if (max && isMax && onChangeMax) onChangeMax(toInput(max, decimals)) }, [decimals, isMax, max, onChangeMax]) - /* tax */ - const taxAmount = - token && amount && shouldTax - ? calcMinimumTaxAmount(amount, { rate: taxRate, cap: taxCap }) - : undefined - /* (effect): Log error on console */ const failed = getErrorMessage(taxState.error ?? estimatedGasState.error) useEffect(() => { @@ -307,7 +311,7 @@ function Tx(props: Props) { amount && new BigNumber(balance) .minus(amount) - .minus(taxAmount ?? 0) + .minus(taxAmount ? (gasFee.denom === token ? taxAmount : 0) : 0) .minus((gasFee.denom === token && gasFee.amount) || 0) .toString() From ed6a2944a4556a5cf2bbb8c4d6eed46aacf82460 Mon Sep 17 00:00:00 2001 From: Michael Merz Date: Tue, 26 Sep 2023 14:37:48 -0400 Subject: [PATCH 2/7] fix: check for return type on osmosis api --- src/data/external/osmosis.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/data/external/osmosis.ts b/src/data/external/osmosis.ts index 8860c3a0e..0829fbdc2 100644 --- a/src/data/external/osmosis.ts +++ b/src/data/external/osmosis.ts @@ -43,6 +43,11 @@ export const useGammTokens = () => { "/pools/v2/all?low_liquidity=true", { baseURL: OSMOSIS_API_URL } ) + + if (!data || typeof data !== "object") { + throw new Error("Invalid API response format") + } + return data } catch (error) { console.error(error) From 638067cf254724ccb2af1d726617a61dd565e85f Mon Sep 17 00:00:00 2001 From: Michael Merz Date: Wed, 20 Sep 2023 11:47:34 -0400 Subject: [PATCH 3/7] feat: increment version to align with sprint 26 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index aa0449870..1aad62374 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "hompage": "https://station.money", "author": "Terra (https://station.money)", "repository": "github:terra-money/station", - "version": "7.3.3", + "version": "7.3.4", "license": "MIT", "scripts": { "start": "echo \"$CF_PAGES_COMMIT_SHA\" > public/commit_hash && react-scripts start", From be6f773fe786ea4d48721b521cccf538a1096142 Mon Sep 17 00:00:00 2001 From: plubber <51789398+ericHgorski@users.noreply.github.com> Date: Wed, 13 Sep 2023 11:28:16 -0400 Subject: [PATCH 4/7] Fix read decimals (#525) * feat: ReadToken component --- src/txs/Tx.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/txs/Tx.tsx b/src/txs/Tx.tsx index cb383183d..d558a1e62 100644 --- a/src/txs/Tx.tsx +++ b/src/txs/Tx.tsx @@ -203,7 +203,6 @@ function Tx(props: Props) { .toString() : balance } - const max = !gasFee.amount ? undefined : isDenom(token) From 6eca332c683706ae26278222ecfe511608468c17 Mon Sep 17 00:00:00 2001 From: plubber <51789398+ericHgorski@users.noreply.github.com> Date: Wed, 13 Sep 2023 11:29:11 -0400 Subject: [PATCH 5/7] fix: add pool asset length check for map (#526) From ef758f6cb82eb660b67ad5011a6837f969f6269a Mon Sep 17 00:00:00 2001 From: plubber <51789398+ericHgorski@users.noreply.github.com> Date: Wed, 13 Sep 2023 11:29:44 -0400 Subject: [PATCH 6/7] St 752 improve error hadnling (#527) * Display error messages * Improve error parsing * Fix user denied error * fix: typos --------- Co-authored-by: Alessandro Candeago <54709706+alecande11@users.noreply.github.com> Co-authored-by: Manuel Alessandro Collazo From 8b886d7550f8119110127eaff735963749163e42 Mon Sep 17 00:00:00 2001 From: Michael Merz Date: Wed, 13 Sep 2023 12:06:33 -0400 Subject: [PATCH 7/7] chore: increment version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1aad62374..f1583495e 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "hompage": "https://station.money", "author": "Terra (https://station.money)", "repository": "github:terra-money/station", - "version": "7.3.4", + "version": "7.3.5", "license": "MIT", "scripts": { "start": "echo \"$CF_PAGES_COMMIT_SHA\" > public/commit_hash && react-scripts start",