1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

squid-js use new functions

This commit is contained in:
Jernej Pregelj 2019-03-25 15:22:45 +01:00
parent b823078bab
commit 5aa574455a
5 changed files with 7 additions and 7 deletions

View File

@ -161,7 +161,7 @@ class App extends Component<{}, AppState> {
ocean ocean
}) })
// TODO: squid-js balance retrieval fix // TODO: squid-js balance retrieval fix
const accounts = await ocean.getAccounts() const accounts = await ocean.accounts.list()
const balance = await accounts[0].getBalance() const balance = await accounts[0].getBalance()
this.setState({ balance }) this.setState({ balance })
// TODO: squid-js expose keeper for getNetworkName // TODO: squid-js expose keeper for getNetworkName

View File

@ -28,7 +28,7 @@ export default class AssetsUser extends PureComponent {
} else { } else {
const results = [] const results = []
for (const event of events) { for (const event of events) {
const ddo = await this.context.ocean.resolveDID( const ddo = await this.context.ocean.assets.resolve(
`did:op:${event.returnValues._did.substring(2)}` `did:op:${event.returnValues._did.substring(2)}`
) )
results.push(ddo) results.push(ddo)

View File

@ -21,7 +21,7 @@ export default class Details extends Component<DetailsProps, DetailsState> {
public state = { ddo: {}, metadata: { base: { name: '' } } } public state = { ddo: {}, metadata: { base: { name: '' } } }
public async componentDidMount() { public async componentDidMount() {
const ddo = await this.context.ocean.resolveDID( const ddo = await this.context.ocean.assets.resolve(
this.props.match.params.did this.props.match.params.did
) )
const { metadata } = ddo.findServiceByType('Metadata') const { metadata } = ddo.findServiceByType('Metadata')
@ -30,7 +30,7 @@ export default class Details extends Component<DetailsProps, DetailsState> {
private purchaseAsset = async (ddo: any) => { private purchaseAsset = async (ddo: any) => {
try { try {
const account = await this.context.ocean.getAccounts() const account = await this.context.ocean.accounts.list()
const accessService = ddo.findServiceByType('Access') const accessService = ddo.findServiceByType('Access')
const agreementId = await this.context.ocean.assets.order( const agreementId = await this.context.ocean.assets.order(
ddo.id, ddo.id,

View File

@ -27,7 +27,7 @@ export default class Invoices extends Component<{}, InvoicesState> {
} else { } else {
const results = [] const results = []
for (const event of events) { for (const event of events) {
const ddo = await this.context.ocean.resolveDID( const ddo = await this.context.ocean.assets.resolve(
`did:op:${event.returnValues._did.substring(2)}` `did:op:${event.returnValues._did.substring(2)}`
) )
results.push(ddo) results.push(ddo)

View File

@ -243,7 +243,7 @@ class Publish extends Component<{}, PublishState> {
isPublishing: true isPublishing: true
}) })
const { ocean } = this.context const { ocean } = this.context
const account = await ocean.getAccounts() const account = await ocean.accounts.list()
const newAsset = { const newAsset = {
// OEP-08 Attributes // OEP-08 Attributes
// https://github.com/oceanprotocol/OEPs/tree/master/8 // https://github.com/oceanprotocol/OEPs/tree/master/8
@ -273,7 +273,7 @@ class Publish extends Component<{}, PublishState> {
} }
try { try {
const asset = await ocean.registerAsset(newAsset, account[0]) const asset = await this.context.ocean.assets.create(newAsset, account[0])
this.setState({ this.setState({
publishedDid: asset.id, publishedDid: asset.id,
isPublished: true isPublished: true