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
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ export function RedPacket(props: RedPacketProps) {
: EthereumTokenType.ERC20),
payload.token?.address ?? payload.token_address ?? '',
)
const token = payload.token ?? tokenDetailed
const token =
payload.token && ['chainId', 'decimal', 'symbol'].every((k) => Reflect.has(payload.token ?? {}, k))
? payload.token
: tokenDetailed
// #endregion

const { canFetch, canClaim, canRefund, listOfStatus } = availabilityComputed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import {
FungibleTokenDetailed,
useFungibleTokenDetailed,
useTokenConstants,
ERC20TokenDetailed,
NativeTokenDetailed,
} from '@masknet/web3-shared-evm'
import { dateTimeFormat } from '../../ITO/assets/formatDate'
import ActionButton from '../../../extension/options-page/DashboardComponents/ActionButton'
Expand Down Expand Up @@ -208,7 +210,10 @@ export function RedPacketInHistoryList(props: RedPacketInHistoryListProps) {
tokenAddress ?? '',
)

const historyToken = (history as RedPacketJSONPayload).token ?? tokenDetailed
const historyToken =
(history as RedPacketJSONPayload).token ??
tokenDetailed ??
({ address: history.token_address } as ERC20TokenDetailed | NativeTokenDetailed)

// #region remote controlled transaction dialog
const { setDialog: setTransactionDialog } = useRemoteControlledDialog(
Expand Down
2 changes: 1 addition & 1 deletion packages/mask/src/plugins/RedPacket/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"title": "symbol"
}
},
"required": ["address", "decimals", "name", "symbol"],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

"decimals", "name", "symbol" can be fetched later, since sheer size of payload would cause encoded image not work.

"required": ["address"],
"title": "token"
}
},
Expand Down