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

transaction cleanup

This commit is contained in:
mihaisc 2020-05-26 16:42:45 +03:00
parent a94d1e73e9
commit 3a00ef0b0d
4 changed files with 33 additions and 48 deletions

30
package-lock.json generated
View File

@ -3397,38 +3397,14 @@
"integrity": "sha512-915dcnzCHEuvsmRKqVj0RxHT3T386lSJh8WREe4dsnrXHsi1ULNYxX0Ts/cvalv6bRL+aqyaZ6gN3l3nkfwEDg=="
},
"@oceanprotocol/react": {
"version": "0.0.9",
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.0.9.tgz",
"integrity": "sha512-wCaBAHufEhhWApWHZucOXgEjyEUnuGG6OdBdkQjoPpLatkNs8X8tEpqMN6pZQoTIXyC6rYnnBPnrURiFW1RDHg==",
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.0.10.tgz",
"integrity": "sha512-tkNmKTFvHgZC1cU8JiZ85z+msGjc5lzO1kbcgYCLHtuqAhSKFkMZl6j87XpM147hBqJBg3mE5J5OrRrbN5SedA==",
"requires": {
"@oceanprotocol/squid": "^2.2.0",
"axios": "^0.19.2",
"react": "^16.13.1",
"web3connect": "^1.0.0-beta.33"
},
"dependencies": {
"@oceanprotocol/squid": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@oceanprotocol/squid/-/squid-2.2.0.tgz",
"integrity": "sha512-ISI+8mGl5lCPqLw/YPS/e0PhaqgexuGiwxKcCGAMSo1p8sgunr6FOrMVoYhYr52QpfodxOY8Iiy3zv4HC8O2Mg==",
"requires": {
"@ethereum-navigator/navigator": "^0.5.0",
"@oceanprotocol/keeper-contracts": "^0.13.2",
"@oceanprotocol/secret-store-client": "^0.0.15",
"bignumber.js": "^9.0.0",
"deprecated-decorator": "^0.1.6",
"node-fetch": "^2.6.0",
"save-file": "^2.3.1",
"uuid": "^8.0.0",
"web3": "^1.2.6",
"whatwg-url": "^8.0.0"
}
},
"uuid": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz",
"integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw=="
}
}
},
"@oceanprotocol/secret-store-client": {

View File

@ -19,7 +19,7 @@
},
"dependencies": {
"@oceanprotocol/art": "^2.2.0",
"@oceanprotocol/react": "0.0.9",
"@oceanprotocol/react": "0.0.10",
"@oceanprotocol/squid": "^2.2.0",
"@oceanprotocol/typographies": "^0.1.0",
"@sindresorhus/slugify": "^1.0.0",

View File

@ -1,11 +1,18 @@
import React, { useEffect, useState } from 'react'
import Loader from '../atoms/Loader'
import { useWeb3, useOcean, OceanConnectionStatus } from '@oceanprotocol/react'
import {
useOcean,
OceanConnectionStatus,
useSearch
} from '@oceanprotocol/react'
import Table from '../atoms/Table'
import Price from '../atoms/Price'
import { fromWei } from 'web3-utils'
import DateCell from '../atoms/Table/DateCell'
import DdoLinkCell from '../atoms/Table/DdoLinkCell'
import { DDO, MetaDataMain } from '@oceanprotocol/squid'
import { findServiceByType } from '../../utils'
import { config } from '../../config/ocean'
const consumedColumns = [
{
@ -35,9 +42,9 @@ const consumedColumns = [
]
export default function ConsumedList() {
const { account } = useWeb3()
const { ocean, status } = useOcean()
const { ocean, status, accountId, account } = useOcean()
const [consumedList, setConsumedList] = useState<any>([])
const { getConsumedList } = useSearch()
const [isLoading, setIsLoading] = useState(false)
useEffect(() => {
@ -46,10 +53,11 @@ export default function ConsumedList() {
return
setIsLoading(true)
// const consumedItems = await getConsumedList()
// TODO: test this before updating react lib and after backend workd properly
const consumedItems = await getConsumedList()
// console.log('react cosume',consumedItemsT)
// // TODO: test this before updating react lib and after backend workd properly
// const consumed = await ocean.assets.consumerAssets(accountId)
// console.log(consumed)
// const consumedItemss = await Promise.all(
// consumed.map(async (did) => {
// const ddo = await ocean.assets.resolve(did)
@ -65,20 +73,21 @@ export default function ConsumedList() {
// )
// const consumedItems = (consumedItemss.filter(value => typeof value !== 'undefined')) as DDO[]
// console.log('consumedss', consumedItems)
if (!consumedItems) return
// const data = consumedItems.map((ddo) => {
// const { attributes } = findServiceByType(ddo, 'metadata')
// const { name, price, datePublished } = attributes.main as MetaDataMain
// return {
// published: datePublished,
// name: name,
// price: price
// }
// })
const data = [
{ published: '2020-05-14T10:00:49Z', name: 'asdf', price: '0', id: 1 },
{ published: '2020-05-21T10:00:49Z', name: 'test', price: '0', id: 2 }
]
const data = consumedItems.map(ddo => {
const { attributes } = findServiceByType(ddo, 'metadata')
const { name, price, datePublished } = attributes.main as MetaDataMain
return {
published: datePublished,
name: name,
price: price
}
})
// const data = [
// { published: '2020-05-14T10:00:49Z', name: 'asdf', price: '0', id: 1 },
// { published: '2020-05-21T10:00:49Z', name: 'test', price: '0', id: 2 }
// ]
setConsumedList(data)
setIsLoading(false)
}

View File

@ -74,7 +74,7 @@ export default function JobsList() {
setUserAgreed(true)
try {
const computeItems = await getComputeItems()
if (!computeItems) return
const data = computeItems.map(item => {
const { attributes } = findServiceByType(item.ddo, 'metadata')
const { name, price } = attributes.main as MetaDataMain