diff --git a/integration/ocean/AssetOwners.test.ts b/integration/ocean/AssetOwners.test.ts index dbdd624..1eea73a 100644 --- a/integration/ocean/AssetOwners.test.ts +++ b/integration/ocean/AssetOwners.test.ts @@ -37,6 +37,16 @@ describe('Asset Owners', () => { assert.isTrue(isProvider) }) + it('should be added correctly a permission on an asset', async () => { + const ddo = await ocean.assets.create(metadata as any, account1) + + assert.isFalse(await ocean.keeper.didRegistry.getPermission(ddo.id, account2.getId())) + + await ocean.keeper.didRegistry.grantPermission(ddo.id, account2.getId(), account1.getId()) + + assert.isTrue(await ocean.keeper.didRegistry.getPermission(ddo.id, account2.getId())) + }) + it('should get the assets owned by a user', async () => { const { length: initialLength } = await ocean.assets.ownerAssets(account2.getId()) diff --git a/src/keeper/contracts/DIDRegistry.ts b/src/keeper/contracts/DIDRegistry.ts index 90e6883..13f29e1 100644 --- a/src/keeper/contracts/DIDRegistry.ts +++ b/src/keeper/contracts/DIDRegistry.ts @@ -50,7 +50,7 @@ export default class DIDRegistry extends ContractBase { } public async grantPermission(did: string, grantee: string, ownerAddress: string) { - return this.send('grantPermission', ownerAddress, [zeroX(did), zeroX(grantee)]) + return this.send('grantPermission', ownerAddress, [didZeroX(did), zeroX(grantee)]) } public async revokePermission(did: string, grantee: string, ownerAddress: string) {