Skip to content

Commit

Permalink
fix: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
devchenyan committed May 13, 2024
1 parent 2c92bb4 commit d8f0cff
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export const useOutputs = ({

return inputsCapacity - outputsCapacity - fee
}
return -1
return undefined
}, [transaction, fee, outputsCapacity])

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const AmendPendingTransactionDialog = ({ tx, onClose }: { tx: State.Transaction;
)

useEffect(() => {
if (transaction) {
if (transaction && lastOutputsCapacity !== undefined) {
const outputs = items.map(item => {
const capacity = item.isLastOutput ? lastOutputsCapacity.toString() : item.capacity
if (item.output.data === DAO_DATA) {
Expand All @@ -86,7 +86,13 @@ const AmendPendingTransactionDialog = ({ tx, onClose }: { tx: State.Transaction;
}
}, [lastOutputsCapacity, transaction, items, setGeneratedTx])

const disabled = !!(isSending || !generatedTx || priceError || lastOutputsCapacity < MIN_AMOUNT)
const disabled = !!(
isSending ||
!generatedTx ||
priceError ||
lastOutputsCapacity === undefined ||
lastOutputsCapacity < MIN_AMOUNT
)

return (
<>
Expand Down
5 changes: 3 additions & 2 deletions packages/neuron-ui/src/components/AmendSUDTSend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const AmendSUDTSend = () => {
}, [transaction?.outputs])

useEffect(() => {
if (transaction) {
if (transaction && lastOutputsCapacity !== undefined) {
const outputs = items.map(item => {
const capacity = item.isLastOutput ? lastOutputsCapacity.toString() : item.capacity
return {
Expand All @@ -126,7 +126,8 @@ const AmendSUDTSend = () => {
}
}, [lastOutputsCapacity, transaction, items, dispatch, experimental?.params?.description, description])

const disabled = sending || !experimental?.tx || priceError || lastOutputsCapacity < 0
const disabled =
sending || !experimental?.tx || priceError || lastOutputsCapacity === undefined || lastOutputsCapacity < 0

return (
<PageContainer
Expand Down
7 changes: 4 additions & 3 deletions packages/neuron-ui/src/components/AmendSend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ const AmendSend = () => {

return inputsCapacity - outputsCapacity - fee
}
return -1
return undefined
}, [transaction, fee, outputsCapacity])

useEffect(() => {
if (transaction) {
if (transaction && lastOutputsCapacity !== undefined) {
const outputs = items.map(item => {
const capacity = item.isLastOutput ? lastOutputsCapacity.toString() : item.capacity
return {
Expand All @@ -158,7 +158,8 @@ const AmendSend = () => {
}
}, [lastOutputsCapacity, transaction, items, dispatch])

const disabled = sending || !send.generatedTx || priceError || lastOutputsCapacity < MIN_AMOUNT
const disabled =
sending || !send.generatedTx || priceError || lastOutputsCapacity === undefined || lastOutputsCapacity < MIN_AMOUNT

return (
<PageContainer
Expand Down

1 comment on commit d8f0cff

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Packaging for test is done in 9058527253

Please sign in to comment.