Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"yarn": ">=999.0.0",
"npm": ">=999.0.0"
},
"version": "2.29.3",
"version": "2.30.0",
"private": true,
"license": "AGPL-3.0-or-later",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ export function FireflyRedpacketConfirmDialog({
gasOption,
(payload: RedPacketJSONPayload) => onCreated(payload, state?.url, value?.claimRequirements, value?.publicKey),
onClose,
currentAccount,
)

const popover = usePortalShadowRoot((container) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function useCreateParamsCallback(
})

return { gas: gas ? toFixed(gas) : undefined, params, paramsObj, gasError }
}, [redPacketSettings, account, redPacketContract])
}, [redPacketSettings, account, redPacketContract, publicKey])

return getCreateParams
}
Expand Down Expand Up @@ -147,7 +147,7 @@ export function useCreateCallback(
const getCreateParams = useCreateParamsCallback(expectedChainId, redPacketSettings, version, publicKey)

return useAsyncFn(async () => {
const { token } = redPacketSettings
const token = redPacketSettings.token
const createParams = await getCreateParams()
if (!token || !redPacketContract || !createParams) return

Expand Down Expand Up @@ -188,5 +188,5 @@ export function useCreateCallback(
}
}
return { hash, receipt }
}, [account, redPacketContract, redPacketSettings, gasOption, chainId])
}, [account, redPacketContract, redPacketSettings.token, gasOption, chainId, getCreateParams])
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { RedPacketJSONPayload, RedPacketRecord } from '@masknet/web3-provid
import { formatBalance } from '@masknet/web3-shared-base'
import { isNativeTokenAddress, useRedPacketConstants, type GasConfig } from '@masknet/web3-shared-evm'
import { BigNumber } from 'bignumber.js'
import { useCallback, useEffect, useRef } from 'react'
import { useCallback, useEffect, useMemo, useRef } from 'react'
import { RedPacketRPC } from '../../messages.js'
import { useCreateCallback, useCreateParams, type RedPacketSettings } from './useCreateCallback.js'

Expand All @@ -17,7 +17,6 @@ export function useCreateFTRedpacketCallback(
gasOption?: GasConfig,
onCreated?: (payload: RedPacketJSONPayload) => void,
onClose?: () => void,
currentAccount?: string,
) {
// password should remain the same rather than change each time when createState change,
// otherwise password in database would be different from creating red-packet.
Expand Down Expand Up @@ -52,9 +51,10 @@ export function useCreateFTRedpacketCallback(
{ significant: isNativeToken ? 3 : 0 },
)

const settingsWithTotal = useMemo(() => ({ ...settings, total }), [settings, total])
const [{ loading: isCreating }, createCallback] = useCreateCallback(
chainId,
{ ...settings, total, name: currentAccount || settings.name },
settingsWithTotal,
contract_version,
redpacketPubkey,
gasOption,
Expand Down Expand Up @@ -82,7 +82,7 @@ export function useCreateFTRedpacketCallback(
const redpacketPayload = {
sender: {
address: account,
name: currentAccount || settings.name,
name: settings.name,
message: settings.message,
},
is_random: settings.isRandom,
Expand All @@ -107,7 +107,7 @@ export function useCreateFTRedpacketCallback(

// output the redpacket as JSON payload
onCreated?.(payload.current)
}, [createCallback, settings, onCreated, currentAccount])
}, [createCallback, settings, onCreated])

const payload = useRef<RedPacketJSONPayload>({
network: EVMChainResolver.chainName(chainId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,10 @@ export function CreateERC20RedPacket() {
<button
type="button"
className={classes.deleteButton}
onClick={() => {
onClick={(event) => {
event.stopPropagation()
setCustomThemes((origins) => origins.filter((x) => x !== theme))
if (theme === selectedTheme) setTheme(undefined)
}}>
<Icons.Delete size={16} />
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ export function Erc20RedPacketConfirm() {
const wallet = useWallet()
const { value: smartPayChainId } = useAsync(async () => SmartPayBundler.getSupportedChainId(), [])

const loading = creatingPubkey || isCreating || isWaitGasBeMinus
const disabled = isBalanceInsufficient || loading
return (
<>
<div className={classes.settings}>
Expand Down Expand Up @@ -236,11 +238,7 @@ export function Erc20RedPacketConfirm() {
</div>
<PluginWalletStatusBar className={classes.controller}>
<ChainBoundary expectedPluginID={NetworkPluginID.PLUGIN_EVM} expectedChainId={chainId}>
<ActionButton
loading={creatingPubkey || isCreating || isWaitGasBeMinus}
fullWidth
onClick={createRedpacket}
disabled={isBalanceInsufficient || isWaitGasBeMinus || isCreating}>
<ActionButton loading={loading} fullWidth onClick={createRedpacket} disabled={disabled}>
{isCreating ?
<Trans>Confirming</Trans>
: <Trans>Confirm</Trans>}
Expand Down
2 changes: 0 additions & 2 deletions packages/shared/src/UI/components/UploadDropArea/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ export const UploadDropArea = memo(function UploadDropArea(props: Props) {
showMessage(101)
} else if (!omitSizeLimit && files[0].size > maxFileSize) {
showMessage(102)
} else if (accept && !accept.includes(files[0].type)) {
showMessage(103)
} else {
onSelectFile(files[0])
}
Expand Down
Loading