Skip to content

Commit

Permalink
fix: After update lumos, the min_replace_fee field has transfer to …
Browse files Browse the repository at this point in the history
…`minReplaceFee ` (#3218)

* fix: After update lumos, the `min_replace_fee` field has transfer to `minReplaceFee `

* fix: Fix typo
  • Loading branch information
yanguoyu committed Aug 1, 2024
1 parent 79a8dc2 commit d4c3527
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ export const useInitialize = ({
const fetchInitData = useCallback(async () => {
const res = await getOnChainTransaction(tx.hash)
const {
// @ts-expect-error Replace-By-Fee (RBF)
min_replace_fee: minFee,
minReplaceFee,
transaction: { outputsData },
} = res

if (!minFee) {
if (!minReplaceFee) {
setIsConfirmedAlertShown(true)
}

Expand All @@ -60,8 +59,8 @@ export const useInitialize = ({
})

setSize(txResult.size)
if (minFee) {
const mPrice = ((BigInt(minFee) * BigInt(FEE_RATIO)) / BigInt(txResult.size)).toString()
if (minReplaceFee) {
const mPrice = ((BigInt(minReplaceFee) * BigInt(FEE_RATIO)) / BigInt(txResult.size)).toString()
setMinPrice(mPrice)
setPrice(mPrice)
}
Expand All @@ -83,9 +82,8 @@ export const useInitialize = ({

const onSubmit = useCallback(async () => {
try {
// @ts-expect-error Replace-By-Fee (RBF)
const { min_replace_fee: minFee } = await getOnChainTransaction(tx.hash)
if (!minFee) {
const { minReplaceFee } = await getOnChainTransaction(tx.hash)
if (!minReplaceFee) {
setIsConfirmedAlertShown(true)
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ $noticeHeight: 60px;
padding: 20px 16px 18px;
border-radius: 16px;
margin-bottom: 16px;
.addresstField {
font-family: 'JetBrains Mono';
}
.textFieldClass {
margin-bottom: 10px;
}
Expand Down
14 changes: 6 additions & 8 deletions packages/neuron-ui/src/components/AmendSUDTSend/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ export const useInitialize = ({

const fetchInitData = useCallback(async () => {
const {
// @ts-expect-error Replace-By-Fee (RBF)
min_replace_fee: minFee,
minReplaceFee,
transaction: { outputsData },
} = await getOnChainTransaction(hash)
if (!minFee) {
if (!minReplaceFee) {
setIsConfirmedAlertShown(true)
}

Expand All @@ -76,8 +75,8 @@ export const useInitialize = ({
setTransaction({ ...tx, outputsData })

setSize(tx.size)
if (minFee) {
const mPrice = ((BigInt(minFee) * BigInt(FEE_RATIO)) / BigInt(tx.size)).toString()
if (minReplaceFee) {
const mPrice = ((BigInt(minReplaceFee) * BigInt(FEE_RATIO)) / BigInt(tx.size)).toString()
setMinPrice(mPrice)
setPrice(mPrice)
}
Expand All @@ -98,9 +97,8 @@ export const useInitialize = ({
return
}
try {
// @ts-expect-error Replace-By-Fee (RBF)
const { min_replace_fee: minFee } = await getOnChainTransaction(hash)
if (!minFee) {
const { minReplaceFee } = await getOnChainTransaction(hash)
if (!minReplaceFee) {
setIsConfirmedAlertShown(true)
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ $noticeHeight: 60px;
padding: 20px 16px 18px;
border-radius: 16px;
margin-bottom: 16px;
.addresstField {
font-family: 'JetBrains Mono';
}
.textFieldClass {
margin-bottom: 10px;
}
Expand Down
14 changes: 6 additions & 8 deletions packages/neuron-ui/src/components/AmendSend/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ export const useInitialize = ({
const fetchInitData = useCallback(async () => {
const res = await getOnChainTransaction(hash)
const {
// @ts-expect-error Replace-By-Fee (RBF)
min_replace_fee: minFee,
minReplaceFee,
transaction: { outputsData },
} = res
if (!minFee) {
if (!minReplaceFee) {
setIsConfirmedAlertShown(true)
}

Expand All @@ -87,8 +86,8 @@ export const useInitialize = ({
})

setSize(tx.size)
if (minFee) {
const mPrice = ((BigInt(minFee) * BigInt(FEE_RATIO)) / BigInt(tx.size)).toString()
if (minReplaceFee) {
const mPrice = ((BigInt(minReplaceFee) * BigInt(FEE_RATIO)) / BigInt(tx.size)).toString()
setMinPrice(mPrice)
updateTransactionPrice(mPrice)
}
Expand All @@ -113,9 +112,8 @@ export const useInitialize = ({
return
}
try {
// @ts-expect-error Replace-By-Fee (RBF)
const { min_replace_fee: minFee } = await getOnChainTransaction(hash)
if (!minFee) {
const { minReplaceFee } = await getOnChainTransaction(hash)
if (!minReplaceFee) {
setIsConfirmedAlertShown(true)
return
}
Expand Down
3 changes: 1 addition & 2 deletions packages/neuron-ui/src/components/History/RowExtend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ const RowExtend = ({ column, columns, isMainnet, id, bestBlockNumber, isWatchOnl
setAmendabled(false)
if (status !== 'success' && column.type !== 'receive' && !isWatchOnly) {
getOnChainTransaction(hash).then(tx => {
// @ts-expect-error Replace-By-Fee (RBF)
const { min_replace_fee: minReplaceFee } = tx
const { minReplaceFee } = tx
if (minReplaceFee) {
setAmendabled(true)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-ui/src/components/SendFieldset/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const SendFieldset = ({
return (
<div className={clsx(styles.container, className)}>
<TextField
className={`${styles.addresstField} ${styles.textFieldClass}`}
className={`${styles.addressField} ${styles.textFieldClass}`}
placeholder={t('send.input-address')}
rows={item.address ? 2 : 1}
label={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $textfieldWidth: calc(100vw - 370px);
}
}

.addresstField {
.addressField {
font-family: 'JetBrains Mono';
}

Expand Down

0 comments on commit d4c3527

Please sign in to comment.