From c5e78899f09676a650f561e2d8dadaee16f07f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Guti=C3=A9rrez?= Date: Mon, 25 Mar 2019 13:47:21 +0100 Subject: [PATCH] Upgrade to Keeper 0.8.7 --- integration/config/config.json | 1 + .../ocean/RegisterEscrowAccessSecretStoreTemplate.test.ts | 4 ++-- integration/ocean/Signature.test.ts | 4 ++-- library.json | 4 ++-- package-lock.json | 6 +++--- package.json | 2 +- src/keeper/contracts/DIDRegistry.ts | 4 ++-- src/models/Config.ts | 2 ++ src/ocean/OceanAssets.ts | 1 + test/keeper/DIDRegistry.test.ts | 6 +++--- 10 files changed, 19 insertions(+), 15 deletions(-) diff --git a/integration/config/config.json b/integration/config/config.json index 7476a6e..c5a349c 100644 --- a/integration/config/config.json +++ b/integration/config/config.json @@ -2,6 +2,7 @@ "nodeUri": "http://localhost:8545", "aquariusUri": "http://172.15.0.15:5000", "brizoUri": "http://localhost:8030", + "brizoAddress": "0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e", "parityUri": "http://localhost:9545", "secretStoreUri": "http://localhost:12001", "threshold": 0, diff --git a/integration/ocean/RegisterEscrowAccessSecretStoreTemplate.test.ts b/integration/ocean/RegisterEscrowAccessSecretStoreTemplate.test.ts index fd5f452..3c4d1a4 100644 --- a/integration/ocean/RegisterEscrowAccessSecretStoreTemplate.test.ts +++ b/integration/ocean/RegisterEscrowAccessSecretStoreTemplate.test.ts @@ -64,7 +64,7 @@ describe("Register Escrow Access Secret Store Template", () => { let conditionIdEscrow: string it("should register a DID", async () => { - await keeper.didRegistry.registerAttribute(did, checksum, url, publisher.getId()) + await keeper.didRegistry.registerAttribute(did, checksum, [], url, publisher.getId()) }) it("should generate the condition IDs", async () => { @@ -169,7 +169,7 @@ describe("Register Escrow Access Secret Store Template", () => { it("should register a DID", async () => { // This part is executed inside Ocean.assets.create() - await keeper.didRegistry.registerAttribute(did, checksum, url, publisher.getId()) + await keeper.didRegistry.registerAttribute(did, checksum, [], url, publisher.getId()) }) it("should create a new agreement (short way)", async () => { diff --git a/integration/ocean/Signature.test.ts b/integration/ocean/Signature.test.ts index 64ed982..0d70a48 100644 --- a/integration/ocean/Signature.test.ts +++ b/integration/ocean/Signature.test.ts @@ -82,14 +82,14 @@ describe("Signature", () => { ddo, serviceDefinitionId, agreementId, - agreementConditionIds, + [`0x${"1".repeat(64)}`, `0x${"2".repeat(64)}`, `0x${"3".repeat(64)}`], consumer, ) assert.equal( signature, // tslint:disable-next-line - "0x2164dd54b1df9908b3aa31a2d195c3e3a244ff62b51b0403958234f50cb313615ac5ca6660f7a76957612deeca84e6953f2ce74f56def351d9eb0f155a4eddff1c", + "0xc12b8773a330fd01c7fc057e31475e5fc849eba1896cffb102881a6a45aac5fd7342069e578bbe0e1c8c95aa33a53451ac03ae1433f96928cd614c986742578e1b", "The signatuere is not correct.", ) }) diff --git a/library.json b/library.json index 4a64e38..69911ec 100644 --- a/library.json +++ b/library.json @@ -7,11 +7,11 @@ "dependencies": [ { "name": "keeper-contracts", - "version": "~0.8.6" + "version": "~0.8.7" }, { "name": "brizo", - "version": "~0.2.3" + "version": ">0.2.3" } ] } diff --git a/package-lock.json b/package-lock.json index f5abc36..082413a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -129,9 +129,9 @@ } }, "@oceanprotocol/keeper-contracts": { - "version": "0.8.6", - "resolved": "https://registry.npmjs.org/@oceanprotocol/keeper-contracts/-/keeper-contracts-0.8.6.tgz", - "integrity": "sha512-WdIDedXZSS+AG3/K+issOJQ4Jmg0UtdNPpi1Ogo+sFogmYIa21m06pqvuAKK8tGG2o+KBW8nBUMyyA3mR2j+vg==" + "version": "0.8.7", + "resolved": "https://registry.npmjs.org/@oceanprotocol/keeper-contracts/-/keeper-contracts-0.8.7.tgz", + "integrity": "sha512-lrX7isgUYHspQ0/xUtQzugZyZYRncT/TWLom30RGBoHNgy9ZWXYupXULHQdCXq19Hjy7EMYV2sm4HVddB5hz3w==" }, "@oceanprotocol/secret-store-client": { "version": "0.0.14", diff --git a/package.json b/package.json index 3d21a92..88c7754 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ }, "homepage": "https://github.com/oceanprotocol/squid-js#readme", "dependencies": { - "@oceanprotocol/keeper-contracts": "^0.8.6", + "@oceanprotocol/keeper-contracts": "^0.8.7", "@oceanprotocol/secret-store-client": "~0.0.14", "bignumber.js": "^8.0.1", "deprecated-decorator": "^0.1.6", diff --git a/src/keeper/contracts/DIDRegistry.ts b/src/keeper/contracts/DIDRegistry.ts index cd5ac68..3b2a4d8 100644 --- a/src/keeper/contracts/DIDRegistry.ts +++ b/src/keeper/contracts/DIDRegistry.ts @@ -11,8 +11,8 @@ export default class DIDRegistry extends ContractBase { return didRegistry } - public async registerAttribute(did: string, checksum: string, value: string, ownerAddress: string) { - return this.send("registerAttribute", ownerAddress, [zeroX(did), Web3Provider.getWeb3().utils.fromAscii(checksum), value]) + public async registerAttribute(did: string, checksum: string, providers: string[], value: string, ownerAddress: string) { + return this.send("registerAttribute", ownerAddress, [zeroX(did), Web3Provider.getWeb3().utils.fromAscii(checksum), providers.map(zeroX), value]) } public async getDIDOwner(did: string): Promise { diff --git a/src/models/Config.ts b/src/models/Config.ts index e618073..9704fa1 100644 --- a/src/models/Config.ts +++ b/src/models/Config.ts @@ -9,6 +9,8 @@ export class Config { /* Brizo Config */ // the url to the brizo public brizoUri: string + // the address of brizo + public brizoAddress?: string /* Keeper Config */ // the uri to the node we want to connect to, not need if web3Provider is set diff --git a/src/ocean/OceanAssets.ts b/src/ocean/OceanAssets.ts index 6f989d5..c217359 100644 --- a/src/ocean/OceanAssets.ts +++ b/src/ocean/OceanAssets.ts @@ -141,6 +141,7 @@ export class OceanAssets extends Instantiable { await didRegistry.registerAttribute( did.getId(), ddo.getChecksum(), + [this.config.brizoAddress], serviceEndpoint, publisher.getId(), ) diff --git a/test/keeper/DIDRegistry.test.ts b/test/keeper/DIDRegistry.test.ts index 112c9ec..2c33ddb 100644 --- a/test/keeper/DIDRegistry.test.ts +++ b/test/keeper/DIDRegistry.test.ts @@ -23,7 +23,7 @@ describe("DIDRegistry", () => { const ownerAccount: Account = (await ocean.accounts.list())[0] const did = generateId() const data = "my nice provider, is nice" - const receipt = await didRegistry.registerAttribute(did, `0123456789abcdef`, data, ownerAccount.getId()) + const receipt = await didRegistry.registerAttribute(did, `0123456789abcdef`, [], data, ownerAccount.getId()) assert(receipt.status) assert(receipt.events.DIDAttributeRegistered) }) @@ -34,12 +34,12 @@ describe("DIDRegistry", () => { { // register the first attribute const data = "my nice provider, is nice" - await didRegistry.registerAttribute(did, "0123456789abcdef", data, ownerAccount.getId()) + await didRegistry.registerAttribute(did, "0123456789abcdef", [], data, ownerAccount.getId()) } { // register the second attribute with the same did const data = "asdsad" - const receipt = await didRegistry.registerAttribute(did, "0123456789abcdef", data, ownerAccount.getId()) + const receipt = await didRegistry.registerAttribute(did, "0123456789abcdef", [], data, ownerAccount.getId()) assert(receipt.status) assert(receipt.events.DIDAttributeRegistered) }