Skip to content

Commit

Permalink
feat: tackle review commentaroos
Browse files Browse the repository at this point in the history
  • Loading branch information
gomesalexandre committed Sep 20, 2024
1 parent 5d7b4ba commit 1fbaa78
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export const Withdraw: React.FC<WithdrawProps> = ({ accountId, fromAddress, onNe
const {
estimatedFeesData,
isEstimatedFeesDataLoading,
dustAmountCryptoBaseUnitOrDefault: dustAmountCryptoBaseUnit,
dustAmountCryptoBaseUnit,
outboundFeeCryptoBaseUnit,
} = useSendThorTx({
assetId,
Expand Down
10 changes: 5 additions & 5 deletions src/lib/utils/thorchain/hooks/useSendThorTx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type UseSendThorTxProps = {
disableEstimateFeesRefetch?: boolean
fromAddress: string | null
memo: string | null
dustAmountCryptoBaseUnit?: string | null
dustAmountCryptoBaseUnit?: string
}

export const useSendThorTx = ({
Expand Down Expand Up @@ -104,17 +104,17 @@ export const useSendThorTx = ({

// Either a fall through of the passed dustAmountCryptoBaseUnit, or the default dust amount for that feeAsset
// @TODO: test this with RUNEPool, might not work properly due to mapping for LPs
const dustAmountCryptoBaseUnitOrDefault = useMemo(() => {
const dustAmountCryptoBaseUnit = useMemo(() => {
return _dustAmountCryptoBaseUnit
? _dustAmountCryptoBaseUnit
: THORCHAIN_SAVERS_DUST_THRESHOLDS_CRYPTO_BASE_UNIT[feeAsset?.assetId ?? ''] ?? '0'
}, [_dustAmountCryptoBaseUnit, feeAsset?.assetId])

const amountOrDustCryptoBaseUnit = useMemo(() => {
return shouldUseDustAmount
? bnOrZero(dustAmountCryptoBaseUnitOrDefault).toFixed(0)
? bnOrZero(dustAmountCryptoBaseUnit).toFixed(0)
: bnOrZero(amountCryptoBaseUnit).toFixed(0)
}, [shouldUseDustAmount, dustAmountCryptoBaseUnitOrDefault, amountCryptoBaseUnit])
}, [shouldUseDustAmount, dustAmountCryptoBaseUnit, amountCryptoBaseUnit])

const transactionType = useMemo(() => {
return asset ? getThorchainTransactionType(asset.chainId) : undefined
Expand Down Expand Up @@ -454,7 +454,7 @@ export const useSendThorTx = ({
isEstimatedFeesDataError,
txId,
serializedTxIndex,
dustAmountCryptoBaseUnitOrDefault,
dustAmountCryptoBaseUnit,
outboundFeeCryptoBaseUnit,
inboundAddress,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export const RemoveLiquidityInput: React.FC<RemoveLiquidityInputProps> = ({
estimatedFeesData: estimatedRuneFeesData,
isEstimatedFeesDataLoading: isEstimatedRuneFeesDataLoading,
isEstimatedFeesDataError: isEstimatedRuneFeesDataError,
dustAmountCryptoBaseUnitOrDefault: runeDustAmountCryptoBaseUnit,
dustAmountCryptoBaseUnit: runeDustAmountCryptoBaseUnit,
} = useSendThorTx({
assetId: thorchainAssetId,
accountId: positionRuneAccountId ?? null,
Expand Down Expand Up @@ -416,7 +416,7 @@ export const RemoveLiquidityInput: React.FC<RemoveLiquidityInputProps> = ({
estimatedFeesData: estimatedPoolAssetFeesData,
isEstimatedFeesDataLoading: isEstimatedPoolAssetFeesDataLoading,
isEstimatedFeesDataError: isEstimatedPoolAssetFeesDataError,
dustAmountCryptoBaseUnitOrDefault: poolAssetFeeAssetDustAmountCryptoBaseUnit,
dustAmountCryptoBaseUnit: poolAssetFeeAssetDustAmountCryptoBaseUnit,
outboundFeeCryptoBaseUnit,
} = useSendThorTx({
// Asym asset withdraws are the only ones occurring an asset Tx - both sym and asym RUNE side withdraws occur a RUNE Tx instead
Expand Down

0 comments on commit 1fbaa78

Please sign in to comment.