mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
add resolve by DTAddress
This commit is contained in:
parent
3a8e57e971
commit
c63b300668
@ -406,7 +406,7 @@ export class Aquarius {
|
|||||||
public getURI() {
|
public getURI() {
|
||||||
return `${this.url}`
|
return `${this.url}`
|
||||||
}
|
}
|
||||||
|
|
||||||
private transformResult(
|
private transformResult(
|
||||||
{ results, page, total_pages: totalPages, total_results: totalResults }: any = {
|
{ results, page, total_pages: totalPages, total_results: totalResults }: any = {
|
||||||
result: [],
|
result: [],
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { SearchQuery } from '../aquarius/Aquarius'
|
import { SearchQuery, QueryResult } from '../aquarius/Aquarius'
|
||||||
import { DDO } from '../ddo/DDO'
|
import { DDO } from '../ddo/DDO'
|
||||||
import { Metadata } from '../ddo/interfaces/Metadata'
|
import { Metadata } from '../ddo/interfaces/Metadata'
|
||||||
import { Service, ServiceAccess, ServiceComputePrivacy } from '../ddo/interfaces/Service'
|
import { Service, ServiceAccess, ServiceComputePrivacy } from '../ddo/interfaces/Service'
|
||||||
@ -196,14 +196,31 @@ export class Assets extends Instantiable {
|
|||||||
* @return {Promise<DDO>}
|
* @return {Promise<DDO>}
|
||||||
*/
|
*/
|
||||||
public async resolve(did: string): Promise<DDO> {
|
public async resolve(did: string): Promise<DDO> {
|
||||||
// TODO: get serviceEndpoint from datatoken
|
|
||||||
// const {
|
|
||||||
// serviceEndpoint
|
|
||||||
// } = await this.ocean.keeper.didRegistry.getAttributesByDid(did)
|
|
||||||
const serviceEndpoint = 'https://123.com'
|
const serviceEndpoint = 'https://123.com'
|
||||||
return this.ocean.aquarius.retrieveDDOByUrl(serviceEndpoint)
|
return this.ocean.aquarius.retrieveDDOByUrl(serviceEndpoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async resolveByDTAddress(
|
||||||
|
dtAddress: string,
|
||||||
|
offset?: number,
|
||||||
|
page? : number,
|
||||||
|
sort? : number,
|
||||||
|
query? : number
|
||||||
|
) : Promise<QueryResult> {
|
||||||
|
const searchQuery = {
|
||||||
|
offset: offset || 100,
|
||||||
|
page: page || 1,
|
||||||
|
query: {
|
||||||
|
value: query || 1
|
||||||
|
},
|
||||||
|
sort: {
|
||||||
|
value: sort || 1
|
||||||
|
},
|
||||||
|
text: dtAddress
|
||||||
|
} as SearchQuery
|
||||||
|
return this.ocean.aquarius.queryMetadata(searchQuery)
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Edit Metadata for a DDO.
|
* Edit Metadata for a DDO.
|
||||||
* @param {did} string DID.
|
* @param {did} string DID.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user