Skip to content

Commit

Permalink
add ownerAssets
Browse files Browse the repository at this point in the history
  • Loading branch information
0x3bfc committed Jul 3, 2020
1 parent 28d1775 commit d8dadf5
Show file tree
Hide file tree
Showing 5 changed files with 13,968 additions and 5 deletions.
14 changes: 14 additions & 0 deletions src/metadatastore/MetadataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,20 @@ export class MetadataStore {
return result
}

public async getOwnerAssets(owner: string): Promise<DDO[]> {
const query = {
offset: 100,
page: 1,
query: {
'publickey.id.owner': owner
},
sort: {
value: 1
}
}
return (await this.queryMetadata(query)).results
}

/**
* Edit Metadata for a DDO.
* @param {did} string DID.
Expand Down
6 changes: 2 additions & 4 deletions src/ocean/Assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,8 @@ export class Assets extends Instantiable {
* @param {string} owner Owner address.
* @return {Promise<string[]>} List of DIDs.
*/
public async ownerAssets(owner: string): Promise<string[]> {
// TODO:
// return this.ocean.keeper.didRegistry.getAttributesByOwner(owner)
return ['']
public async ownerAssets(owner: string): Promise<DDO[]> {
return this.ocean.metadatastore.getOwnerAssets(owner)
}

/**
Expand Down
1 change: 0 additions & 1 deletion test/integration/Marketplaceflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ describe('Marketplace flow', () => {

ocean = await Ocean.getInstance(config)
owner = (await ocean.accounts.list())[0]
console.log(owner.getId())
alice = (await ocean.accounts.list())[1]
bob = (await ocean.accounts.list())[2]
marketplace = (await ocean.accounts.list())[3]
Expand Down
Loading

0 comments on commit d8dadf5

Please sign in to comment.