Skip to content

Commit

Permalink
fix: lucky drop schema (#6093)
Browse files Browse the repository at this point in the history
* chore: lucky drop schema

* chore: lucky drop schema

* chore: reply code review
  • Loading branch information
zhouhanseng authored Apr 18, 2022
1 parent 21d85c5 commit b6b6686
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
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"],
"required": ["address"],
"title": "token"
}
},
Expand Down

0 comments on commit b6b6686

Please sign in to comment.