mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
display published
This commit is contained in:
parent
cd03398dcf
commit
43d0847d48
2012
package-lock.json
generated
2012
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@oceanprotocol/art": "^2.2.0",
|
"@oceanprotocol/art": "^2.2.0",
|
||||||
"@oceanprotocol/squid": "^0.3.1",
|
"@oceanprotocol/squid": "^0.4.0",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"is-url": "^1.2.4",
|
"is-url": "^1.2.4",
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.24.0",
|
||||||
@ -29,7 +29,7 @@
|
|||||||
"react-router-dom": "^4.3.1",
|
"react-router-dom": "^4.3.1",
|
||||||
"react-transition-group": "^2.6.0",
|
"react-transition-group": "^2.6.0",
|
||||||
"slugify": "^1.3.4",
|
"slugify": "^1.3.4",
|
||||||
"web3": "^1.0.0-beta.46"
|
"web3": "^1.0.0-beta.48"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/classnames": "^2.2.7",
|
"@types/classnames": "^2.2.7",
|
||||||
|
@ -2,8 +2,10 @@ import React, { Component } from 'react'
|
|||||||
import Route from '../components/templates/Route'
|
import Route from '../components/templates/Route'
|
||||||
import { User } from '../context/User'
|
import { User } from '../context/User'
|
||||||
import Asset from '../components/molecules/Asset'
|
import Asset from '../components/molecules/Asset'
|
||||||
|
import { Logger } from '@oceanprotocol/squid';
|
||||||
import styles from './Search.module.scss'
|
import styles from './Search.module.scss'
|
||||||
|
|
||||||
|
|
||||||
interface InvoicesState {
|
interface InvoicesState {
|
||||||
results: any[]
|
results: any[]
|
||||||
}
|
}
|
||||||
@ -12,27 +14,31 @@ export default class Invoices extends Component<{}, InvoicesState> {
|
|||||||
public state = { results: [] }
|
public state = { results: [] }
|
||||||
|
|
||||||
public async componentDidMount() {
|
public async componentDidMount() {
|
||||||
/*
|
|
||||||
TODO:
|
// this is currently my published assets
|
||||||
- squid-js with exposed contracts
|
this.context.ocean.keeper.didRegistry.contract.getPastEvents('DIDAttributeRegistered', {
|
||||||
- request user to sign (unlock account) to get public key? retrieve it form previous signatures?
|
filter: {_owner:this.context.account},
|
||||||
- subscribe to the `AccessSecretStoreCondition.Fulfill` event filtering by `_grantee` : https://github.com/oceanprotocol/keeper-contracts/blob/release/v0.8/contracts/conditions/AccessSecretStoreCondition.sol#L13
|
fromBlock: 0,
|
||||||
AccessSecretStoreCondition.Fulfill({_grantee: 'public key'}, { fromBlock: 0, toBlock: 'latest' }).get((error, eventResult) => {
|
toBlock: 'latest'
|
||||||
if (error)
|
}, async (error: any, events: any) => {
|
||||||
console.log('Error in myEvent event handler: ' + error);
|
if (error) {
|
||||||
else
|
Logger.log('error retrieving', error)
|
||||||
console.log('events: ' + JSON.stringify(eventResult.args));
|
} else {
|
||||||
});
|
const results = []
|
||||||
*/
|
for (const event of events) {
|
||||||
const assets = await this.context.ocean.assets.search('')
|
const ddo = await this.context.ocean.resolveDID(`did:op:${event.returnValues._did.substring(2)}`)
|
||||||
this.setState({ results: assets })
|
results.push(ddo)
|
||||||
|
}
|
||||||
|
this.setState({ results })
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public renderResults = () =>
|
public renderResults = () =>
|
||||||
this.state.results.length ? (
|
this.state.results.length ? (
|
||||||
<div className={styles.results}>
|
<div className={styles.results}>
|
||||||
{this.state.results.map(asset => (
|
{this.state.results.map((asset, index) => (
|
||||||
<Asset key={asset} asset={asset} />
|
<Asset key={index} asset={asset} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user