Skip to content

Commit

Permalink
Merge pull request #1479 from AmbireTech/fix/warnings-opensea
Browse files Browse the repository at this point in the history
Remove warnings
  • Loading branch information
stojnovsky authored Oct 27, 2023
2 parents 6e42204 + d1a400f commit 633b61f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/SignMessage/SignMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ export default function SignMessage({
})

const isDAppSupported =
dApp && (supportedDApps.includes(dApp.url) || supportedDApps.includes(`${dApp.url}/`))
dApp &&
(dApp.url.includes('opensea.io') ||
supportedDApps.includes(dApp.url) ||
supportedDApps.includes(`${dApp.url}/`))

const onScroll = (textArea) => {
if (textArea.scrollHeight - textArea.scrollTop - textArea.clientHeight < 1) {
Expand Down
23 changes: 23 additions & 0 deletions src/lib/humanizers/OpenSea.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
import { Interface } from 'ethers/lib/utils'
import { nativeToken, token } from 'lib/humanReadableTransactions'

const partialOpenSeaAbi = [
{
inputs: [
{ internalType: 'address', name: 'nftContract', type: 'address' },
{ internalType: 'address', name: 'feeRecipient', type: 'address' },
{ internalType: 'address', name: 'minterIfNotPayer', type: 'address' },
{ internalType: 'uint256', name: 'quantity', type: 'uint256' }
],
name: 'mintPublic',
outputs: [],
stateMutability: 'payable',
type: 'function'
}
]
const OpenSeaMapping = (humanizerInfo) => {
const WyvernExchange = new Interface(humanizerInfo.abis.WyvernExchange)
const OpenSeaInterface = new Interface(partialOpenSeaAbi)

return {
[WyvernExchange.getSighash('atomicMatch_')]: (txn, network, { extended = false }) => {
Expand Down Expand Up @@ -60,6 +75,14 @@ const OpenSeaMapping = (humanizerInfo) => {
'on OpenSea'
]
]
},
[OpenSeaInterface.getSighash('mintPublic')]: (txn, network, { extended = false }) => {
const { nftContract, feeRecipient, minterIfNotPayer, quantity } =
OpenSeaInterface.parseTransaction(txn).args

return !extended
? [`Mint ${quantity} NFT${quantity > 1 ? 's' : ''} on ${network}`]
: [['Mint', `${quantity} NFT${quantity > 1 ? 's' : ''}`, 'on OpenSea']]
}
}
}
Expand Down

0 comments on commit 633b61f

Please sign in to comment.