Skip to content
Closed
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
11 changes: 4 additions & 7 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ const approvedList = new Map([
'https://github.com/ProjectWyvern/ethereumjs-abi.git',
],
],
[
'wyvern-js',
['git+https://github.com/ProjectOpenSea/wyvern-js.git#v3.2.1', 'github:ProjectOpenSea/wyvern-js#semver:^3.2.1'],
],
['wyvern-schemas', 'git+https://github.com/ProjectOpenSea/wyvern-schemas.git#v0.13.1'],
['wyvern-js', ['git+https://github.com/ProjectOpenSea/wyvern-js.git#josh/package-lock-npm']],
['wyvern-schemas', ['git+https://github.com/ProjectOpenSea/wyvern-schemas.git#josh/package-lock-npm2']],
/* cspell:disable-next-line */
['async-eventemitter', 'github:ahultgren/async-eventemitter#fa06e39e56786ba541c180061dbf2c0a5bbf951c'],
// opensea-js (v1), (and more, run `pnpm -r why web3@0.20.7`) -> web3
Expand Down Expand Up @@ -69,8 +66,8 @@ function validatePackage({ dependencies, devDependencies, optionalDependencies,
function lockPackage(pkg) {
if (pkg.name === 'opensea-js') {
const prefix = 'git+https://github.com/ProjectOpenSea/wyvern-'
pkg.dependencies['wyvern-js'] = `${prefix}js.git#fabb7660f23f2252c141077e32193d281036299e`
pkg.dependencies['wyvern-schemas'] = `${prefix}schemas.git#e1a08fcf8ce2b11a0fe9cbdc7c9f77c59fadef26`
pkg.dependencies['wyvern-js'] = `${prefix}js.git#a106e07cc5974ca295d25cf9be6f78e61b54d380`
pkg.dependencies['wyvern-schemas'] = `${prefix}schemas.git#db45776f81586494e036fe7f23abc63be3abc9c2`
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/mask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"json2csv": "^5.0.6",
"millify": "^4.0.0",
"next-tick": "^1.0.0",
"opensea-js": "^1.2.7",
"opensea-js": "2.0.1-beta.5",
"promievent": "^0.1.4",
"protobufjs": "^6.11.2",
"react-draggable": "^4.4.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export interface ActionButtonPromiseProps extends ButtonProps {
noUpdateEffect?: boolean
}
type ActionButtonPromiseState = 'init' | 'complete' | 'wait' | 'fail'

export function ActionButtonPromise(props: ActionButtonPromiseProps) {
const { classes } = useStyles()
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function MakeOfferDialog(props: MakeOfferDialogProps) {
expirationTime: !isAuction ? getUnixTime(expirationDateTime) : undefined,
paymentTokenAddress: token.value.type === EthereumTokenType.Native ? undefined : token.value.address,
})
}, [asset?.value, token, account, amount, expirationDateTime, isAuction])
}, [asset?.value, token.value, account, amount, expirationDateTime, isAuction])

const { setDialog: openSwapDialog } = useRemoteControlledDialog(PluginTraderMessages.swapDialogUpdated)

Expand Down Expand Up @@ -145,7 +145,7 @@ export function MakeOfferDialog(props: MakeOfferDialogProps) {
setInsufficientBalance(true)
return t('plugin_collectible_insufficient_balance')
}
if (!isAuction && expirationDateTime.getTime() - Date.now() <= 0)
if (!isAuction && expirationDateTime.getTime() - Date.now() <= 15 * 60 * 1000)
return t('plugin_collectible_invalid_expiration_date')
if (!isVerified && !unreviewedChecked) return t('plugin_collectible_ensure_unreviewed_item')
if (!ToS_Checked) return t('plugin_collectible_check_tos_document')
Expand Down
2 changes: 1 addition & 1 deletion packages/mask/src/plugins/Collectible/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const OpenSeaAccountURL = 'https://opensea.io/accounts/'
export const OpenSeaTraitURL =
'/assets/known-origin?search[stringTraits][0][name]=Tag&search[stringTraits][0][values][0]='
export const NullAddress = 'NullAddress'
export const ReferrerAddress = ''
export const ReferrerAddress = '0x934B510D4C9103E6a87AEf13b816fb080286D649'
export const OpenSeaMainnetURL = 'https://opensea.io'
export const OpenSeaTestnetURL = 'https://testnets.opensea.io'

Expand Down
21 changes: 5 additions & 16 deletions packages/mask/src/plugins/Collectible/types/opensea.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import type { OpenSeaPort } from 'opensea-js'
import type {
AssetContractType,
AuctionType,
OpenSeaAccount,
TokenStandardVersion,
WyvernSchemaName,
} from 'opensea-js/lib/types'
import type { AssetContractType, OpenSeaAccount, TokenStandardVersion, WyvernSchemaName } from 'opensea-js/lib/types'

export type CreateSellOrderPayload = Parameters<OpenSeaPort['createSellOrder']>[0]

Expand Down Expand Up @@ -34,15 +28,10 @@ export interface OpenSeaCustomCollection extends OpenSeaCollection {
slug: string
}

interface AssetToken {
address: string
decimals: number
eth_price: string
id: number
image_url: string
name: string
symbol: string
usd_price: string
export enum AuctionType {
Dutch = 'dutch',
English = 'english',
MinPrice = 'min_price',
}

export enum OpenSeaAssetEventType {
Expand Down
10 changes: 7 additions & 3 deletions packages/mask/src/plugins/MaskPluginWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from '@masknet/plugin-infra'

interface PluginWrapperProps extends React.PropsWithChildren<{}> {
open?: boolean
title: string
width?: number
action?: ReactNode
Expand Down Expand Up @@ -71,7 +72,7 @@ const useStyles = makeStyles()((theme) => {

export default function MaskPostExtraInfoWrapper(props: PluginWrapperProps) {
const { classes } = useStyles()
const { title, children, action, publisher, publisherLink } = props
const { open = true, title, children, action, publisher, publisherLink } = props
const personaConnectStatus = usePersonaConnectStatus()
const { t } = useI18N()

Expand Down Expand Up @@ -116,7 +117,10 @@ export default function MaskPostExtraInfoWrapper(props: PluginWrapperProps) {
}, [publisher, publisherLink])

const inner = (
<div className={classes.card} onClick={(ev) => ev.stopPropagation()}>
<div
className={classes.card}
style={{ display: open ? 'block' : 'none' }}
onClick={(ev) => ev.stopPropagation()}>
<div className={classes.header}>
<MaskIcon size={45} />
<div className={classes.title}>
Expand Down Expand Up @@ -153,9 +157,9 @@ export const MaskPostExtraPluginWrapper: PluginWrapperComponent<Plugin.SNSAdapto

useImperativeHandle(ref, () => refItem, [refItem])

if (!open) return <>{props.children}</>
return (
<MaskPostExtraInfoWrapper
open={open}
title={title || t(ID, name)}
width={width}
publisher={publisher ? <PluginI18NFieldRender pluginID={ID} field={publisher.name} /> : undefined}
Expand Down
4 changes: 1 addition & 3 deletions packages/mask/src/plugins/Wallet/apis/opensea.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ChainId } from '@masknet/web3-shared-evm'
import urlcat from 'urlcat'
import { OPENSEA_API_KEY } from '../constants'
import { ChainId } from '@masknet/web3-shared-evm'

interface AssetContract {
address: string
Expand Down Expand Up @@ -155,7 +154,6 @@ async function request<T>(chainId: ChainId, requestPath: string, params: object)
const response = await fetch(urlcat(domain, requestPath, params), {
method: 'GET',
mode: 'cors',
headers: { 'x-api-key': OPENSEA_API_KEY },
})
return response.json()
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export function createInjectHooksRenderer<PluginDefinition extends Plugin.Shared
const [ref, setRef] = useState<PluginWrapperMethods | null>(null)
if (PluginWrapperComponent) {
return (
<PluginWrapperComponent definition={plugin} ref={setRef}>
<PluginWrapperComponent
definition={plugin}
ref={(methods) => {
if (methods) setRef(methods)
}}>
{ref ? (
<PluginWrapperMethodsContext.Provider value={ref}>
{element}
Expand Down
4 changes: 2 additions & 2 deletions packages/web3-providers/src/opensea/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function fetchFromOpenSea<T>(url: string, chainId: ChainId, apiKey?: strin
try {
const response = await fetch(urlcat(OPENSEA_API_URL, url), {
method: 'GET',
headers: { 'x-api-key': apiKey ?? OPENSEA_API_KEY, Accept: 'application/json' },
headers: { 'X-API-KEY': apiKey ?? OPENSEA_API_KEY, Accept: 'application/json' },
...(!isProxyENV() && { mode: 'cors' }),
})
if (response.ok) {
Expand Down Expand Up @@ -142,7 +142,7 @@ function createNFTAsset(asset: OpenSeaResponse, chainId: ChainId): NonFungibleTo
link: createAssetLink(asset.creator),
},
token_id: asset.token_id,
token_address: asset.token_address,
token_address: asset.asset_contract.address || asset.token_address,
traits: asset.traits,
safelist_request_status: asset.collection?.safelist_request_status ?? '',
description: asset.description,
Expand Down
Loading