1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

Upgrade to Keeper 0.8.7

This commit is contained in:
Pedro Gutiérrez 2019-03-25 13:47:21 +01:00 committed by Pedro Gutiérrez
parent a931fe5a42
commit c5e78899f0
10 changed files with 19 additions and 15 deletions

View File

@ -2,6 +2,7 @@
"nodeUri": "http://localhost:8545", "nodeUri": "http://localhost:8545",
"aquariusUri": "http://172.15.0.15:5000", "aquariusUri": "http://172.15.0.15:5000",
"brizoUri": "http://localhost:8030", "brizoUri": "http://localhost:8030",
"brizoAddress": "0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e",
"parityUri": "http://localhost:9545", "parityUri": "http://localhost:9545",
"secretStoreUri": "http://localhost:12001", "secretStoreUri": "http://localhost:12001",
"threshold": 0, "threshold": 0,

View File

@ -64,7 +64,7 @@ describe("Register Escrow Access Secret Store Template", () => {
let conditionIdEscrow: string let conditionIdEscrow: string
it("should register a DID", async () => { 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 () => { it("should generate the condition IDs", async () => {
@ -169,7 +169,7 @@ describe("Register Escrow Access Secret Store Template", () => {
it("should register a DID", async () => { it("should register a DID", async () => {
// This part is executed inside Ocean.assets.create() // 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 () => { it("should create a new agreement (short way)", async () => {

View File

@ -82,14 +82,14 @@ describe("Signature", () => {
ddo, ddo,
serviceDefinitionId, serviceDefinitionId,
agreementId, agreementId,
agreementConditionIds, [`0x${"1".repeat(64)}`, `0x${"2".repeat(64)}`, `0x${"3".repeat(64)}`],
consumer, consumer,
) )
assert.equal( assert.equal(
signature, signature,
// tslint:disable-next-line // tslint:disable-next-line
"0x2164dd54b1df9908b3aa31a2d195c3e3a244ff62b51b0403958234f50cb313615ac5ca6660f7a76957612deeca84e6953f2ce74f56def351d9eb0f155a4eddff1c", "0xc12b8773a330fd01c7fc057e31475e5fc849eba1896cffb102881a6a45aac5fd7342069e578bbe0e1c8c95aa33a53451ac03ae1433f96928cd614c986742578e1b",
"The signatuere is not correct.", "The signatuere is not correct.",
) )
}) })

View File

@ -7,11 +7,11 @@
"dependencies": [ "dependencies": [
{ {
"name": "keeper-contracts", "name": "keeper-contracts",
"version": "~0.8.6" "version": "~0.8.7"
}, },
{ {
"name": "brizo", "name": "brizo",
"version": "~0.2.3" "version": ">0.2.3"
} }
] ]
} }

6
package-lock.json generated
View File

@ -129,9 +129,9 @@
} }
}, },
"@oceanprotocol/keeper-contracts": { "@oceanprotocol/keeper-contracts": {
"version": "0.8.6", "version": "0.8.7",
"resolved": "https://registry.npmjs.org/@oceanprotocol/keeper-contracts/-/keeper-contracts-0.8.6.tgz", "resolved": "https://registry.npmjs.org/@oceanprotocol/keeper-contracts/-/keeper-contracts-0.8.7.tgz",
"integrity": "sha512-WdIDedXZSS+AG3/K+issOJQ4Jmg0UtdNPpi1Ogo+sFogmYIa21m06pqvuAKK8tGG2o+KBW8nBUMyyA3mR2j+vg==" "integrity": "sha512-lrX7isgUYHspQ0/xUtQzugZyZYRncT/TWLom30RGBoHNgy9ZWXYupXULHQdCXq19Hjy7EMYV2sm4HVddB5hz3w=="
}, },
"@oceanprotocol/secret-store-client": { "@oceanprotocol/secret-store-client": {
"version": "0.0.14", "version": "0.0.14",

View File

@ -59,7 +59,7 @@
}, },
"homepage": "https://github.com/oceanprotocol/squid-js#readme", "homepage": "https://github.com/oceanprotocol/squid-js#readme",
"dependencies": { "dependencies": {
"@oceanprotocol/keeper-contracts": "^0.8.6", "@oceanprotocol/keeper-contracts": "^0.8.7",
"@oceanprotocol/secret-store-client": "~0.0.14", "@oceanprotocol/secret-store-client": "~0.0.14",
"bignumber.js": "^8.0.1", "bignumber.js": "^8.0.1",
"deprecated-decorator": "^0.1.6", "deprecated-decorator": "^0.1.6",

View File

@ -11,8 +11,8 @@ export default class DIDRegistry extends ContractBase {
return didRegistry return didRegistry
} }
public async registerAttribute(did: string, checksum: string, value: string, ownerAddress: string) { 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), value]) return this.send("registerAttribute", ownerAddress, [zeroX(did), Web3Provider.getWeb3().utils.fromAscii(checksum), providers.map(zeroX), value])
} }
public async getDIDOwner(did: string): Promise<string> { public async getDIDOwner(did: string): Promise<string> {

View File

@ -9,6 +9,8 @@ export class Config {
/* Brizo Config */ /* Brizo Config */
// the url to the brizo // the url to the brizo
public brizoUri: string public brizoUri: string
// the address of brizo
public brizoAddress?: string
/* Keeper Config */ /* Keeper Config */
// the uri to the node we want to connect to, not need if web3Provider is set // the uri to the node we want to connect to, not need if web3Provider is set

View File

@ -141,6 +141,7 @@ export class OceanAssets extends Instantiable {
await didRegistry.registerAttribute( await didRegistry.registerAttribute(
did.getId(), did.getId(),
ddo.getChecksum(), ddo.getChecksum(),
[this.config.brizoAddress],
serviceEndpoint, serviceEndpoint,
publisher.getId(), publisher.getId(),
) )

View File

@ -23,7 +23,7 @@ describe("DIDRegistry", () => {
const ownerAccount: Account = (await ocean.accounts.list())[0] const ownerAccount: Account = (await ocean.accounts.list())[0]
const did = generateId() const did = generateId()
const data = "my nice provider, is nice" 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.status)
assert(receipt.events.DIDAttributeRegistered) assert(receipt.events.DIDAttributeRegistered)
}) })
@ -34,12 +34,12 @@ describe("DIDRegistry", () => {
{ {
// register the first attribute // register the first attribute
const data = "my nice provider, is nice" 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 // register the second attribute with the same did
const data = "asdsad" 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.status)
assert(receipt.events.DIDAttributeRegistered) assert(receipt.events.DIDAttributeRegistered)
} }