1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

package updates, merge fixes

This commit is contained in:
Matthias Kretschmann 2023-02-03 14:28:25 +00:00
parent 258a470939
commit 769d1eef94
Signed by: m
GPG Key ID: 606EEEF3C479A91F
10 changed files with 530 additions and 1073 deletions

1562
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -31,15 +31,15 @@
"@oceanprotocol/use-dark-mode": "^2.4.3",
"@tippyjs/react": "^4.2.6",
"@urql/exchange-refocus": "^1.0.0",
"@web3modal/ethereum": "^2.0.0-rc.3",
"@web3modal/react": "^2.0.0-rc.3",
"@web3modal/ethereum": "^2.1.1",
"@web3modal/react": "^2.1.1",
"axios": "^1.2.0",
"classnames": "^2.3.2",
"date-fns": "^2.29.3",
"decimal.js": "^10.4.2",
"dom-confetti": "^0.2.2",
"dotenv": "^16.0.3",
"ethers": "^5.7.2",
"ethers": "^6.0.0",
"filesize": "^10.0.5",
"formik": "^2.2.9",
"gray-matter": "^4.0.3",
@ -68,7 +68,7 @@
"slugify": "^1.6.5",
"swr": "^1.3.0",
"urql": "^3.0.3",
"wagmi": "^0.10.11",
"wagmi": "^0.11.3",
"yup": "^0.32.11"
},
"devDependencies": {

View File

@ -18,7 +18,7 @@ import {
import axios, { CancelToken } from 'axios'
import { useMarketMetadata } from '../MarketMetadata'
import { getEnsProfile } from '@utils/ens'
import { isAddress } from 'ethers/lib/utils'
import { isAddress } from 'ethers'
interface ProfileProviderValue {
profile: Profile

View File

@ -8,7 +8,7 @@ import { configureChains, createClient, erc20ABI } from 'wagmi'
import { mainnet, polygon, bsc, goerli, polygonMumbai } from 'wagmi/chains'
import { publicProvider } from 'wagmi/providers/public'
import { infuraProvider } from 'wagmi/providers/infura'
import { ethers, utils } from 'ethers'
import { ethers, formatEther, Provider } from 'ethers'
// Wagmi client
export const { chains, provider } = configureChains(
@ -24,7 +24,11 @@ export const { chains, provider } = configureChains(
export const wagmiClient = createClient({
autoConnect: true,
connectors: modalConnectors({ appName: 'Ocean Market', chains }),
connectors: modalConnectors({
appName: 'Ocean Market',
version: '2',
chains
}),
provider
})
@ -78,7 +82,7 @@ export async function getTokenBalance(
accountId: string,
decimals: number,
tokenAddress: string,
web3Provider: ethers.providers.Provider
web3Provider: Provider
): Promise<string> {
if (!web3Provider) return
@ -86,7 +90,7 @@ export async function getTokenBalance(
const token = new ethers.Contract(tokenAddress, erc20ABI, web3Provider)
const balance = await token.balanceOf(accountId)
const adjustedDecimalsBalance = `${balance}${'0'.repeat(18 - decimals)}`
return utils.formatEther(adjustedDecimalsBalance)
return formatEther(adjustedDecimalsBalance)
} catch (e) {
LoggerInstance.error(`ERROR: Failed to get the balance: ${e.message}`)
}

View File

@ -7,11 +7,10 @@ import { Asset, Datatoken, LoggerInstance } from '@oceanprotocol/lib'
import { useWeb3Legacy } from '@context/Web3Legacy'
export default function MetaFull({ ddo }: { ddo: Asset }): ReactElement {
const { isInPurgatory } = useAsset()
const { isInPurgatory, assetState } = useAsset()
const { web3 } = useWeb3Legacy()
const [paymentCollector, setPaymentCollector] = useState<string>()
const { isInPurgatory, assetState } = useAsset()
useEffect(() => {
if (!ddo || !web3) return

View File

@ -1,6 +1,6 @@
import { FileInfo } from '@oceanprotocol/lib'
import * as Yup from 'yup'
import { isAddress } from 'ethers/lib/utils'
import { isAddress } from 'ethers'
import { testLinks } from '../../../@utils/yup'
export const validationSchema = Yup.object().shape({

View File

@ -4,6 +4,7 @@ import { wizardSteps, initialPublishFeedback } from './_constants'
import { FormPublishData, PublishFeedback } from './_types'
import { getOceanConfig } from '@utils/ocean'
import { useAccount, useNetwork } from 'wagmi'
import { useMarketMetadata } from '@context/MarketMetadata'
export function Steps({
feedback
@ -12,6 +13,7 @@ export function Steps({
}): ReactElement {
const { address: accountId } = useAccount()
const { chain } = useNetwork()
const { approvedBaseTokens } = useMarketMetadata()
const { values, setFieldValue, touched, setTouched } =
useFormikContext<FormPublishData>()
@ -38,7 +40,7 @@ export function Steps({
if (isBaseTokenSet) return
setFieldValue('pricing.baseToken', defaultBaseToken)
}, [approvedBaseTokens])
}, [approvedBaseTokens, values?.pricing?.baseToken?.address])
// auto-sync publish feedback into form data values
useEffect(() => {

View File

@ -27,7 +27,7 @@ import {
} from '../../../app.config'
import { sanitizeUrl } from '@utils/url'
import { getContainerChecksum } from '@utils/docker'
import { utils } from 'ethers'
import { parseEther } from 'ethers'
function getUrlFileExtension(fileUrl: string): string {
const splittedFileUrl = fileUrl.split('.')
@ -273,8 +273,8 @@ export async function createTokensAndPricing(
// both will be just 1 for the market
const dispenserParams: DispenserCreationParams = {
dispenserAddress: config.dispenserAddress,
maxTokens: utils.parseEther('1').toString(),
maxBalance: utils.parseEther('1').toString(),
maxTokens: parseEther('1').toString(),
maxBalance: parseEther('1').toString(),
withMint: true,
allowedSwapper: ZERO_ADDRESS
}

View File

@ -6,7 +6,7 @@ import ProfileProvider from '@context/Profile'
import { getEnsAddress, getEnsName } from '@utils/ens'
import { useRouter } from 'next/router'
import { useAccount, useEnsName } from 'wagmi'
import { isAddress } from 'ethers/lib/utils'
import { isAddress } from 'ethers'
export default function PageProfile(): ReactElement {
const router = useRouter()

View File

@ -4,7 +4,7 @@ import Page from '@shared/Page'
import { accountTruncate } from '@utils/wallet'
import { MAXIMUM_NUMBER_OF_PAGES_WITH_RESULTS } from '@utils/aquarius'
import { useRouter } from 'next/router'
import { isAddress } from 'ethers/lib/utils'
import { isAddress } from 'ethers'
export default function PageSearch(): ReactElement {
const router = useRouter()