diff --git a/src/keeper/contracts/DIDRegistry.ts b/src/keeper/contracts/DIDRegistry.ts index 2608d5f..d60d16d 100644 --- a/src/keeper/contracts/DIDRegistry.ts +++ b/src/keeper/contracts/DIDRegistry.ts @@ -15,21 +15,21 @@ export default class DIDRegistry extends ContractBase { value: string, ownerAddress: string): Promise { return this.send("registerAttribute", - ownerAddress, [did, type, Web3Provider.getWeb3().utils.fromAscii(key), value], + ownerAddress, ["0x" + did, type, Web3Provider.getWeb3().utils.fromAscii(key), value], ) } public async getOwner(did: string): Promise { return this.call("getOwner", - [did], + ["0x" + did], ) } public async getUpdateAt(did: string): Promise { const blockNum = await this.call("getUpdateAt", - [did], + ["0x" + did], ) return parseInt(blockNum, 10) diff --git a/src/keeper/contracts/ServiceAgreement.ts b/src/keeper/contracts/ServiceAgreement.ts index 0b5d624..c2637b4 100644 --- a/src/keeper/contracts/ServiceAgreement.ts +++ b/src/keeper/contracts/ServiceAgreement.ts @@ -49,7 +49,7 @@ export default class ServiceAgreement extends ContractBase { return this.send("executeAgreement", publisherAddress, [ serviceAgreementTemplateId, serviceAgreementSignatureHash, consumerAddress, valueHashes, - timeoutValues, serviceAgreementId, did.replace("did:op:", ""), + timeoutValues, serviceAgreementId, "0x" + did.replace("did:op:", ""), ]) } } diff --git a/src/keeper/contracts/conditions/AccessConditions.ts b/src/keeper/contracts/conditions/AccessConditions.ts index b02f998..9eacfea 100644 --- a/src/keeper/contracts/conditions/AccessConditions.ts +++ b/src/keeper/contracts/conditions/AccessConditions.ts @@ -14,7 +14,7 @@ export default class AccessConditions extends ContractBase { public async grantAccess(serviceAgreementId: any, assetId: any, documentKeyId: any, publisherAddress: string) : Promise { return this.send("grantAccess", publisherAddress, [ - serviceAgreementId, assetId, documentKeyId, + serviceAgreementId, "0x" + assetId, "0x" + documentKeyId, ]) } } diff --git a/src/keeper/contracts/conditions/PaymentConditions.ts b/src/keeper/contracts/conditions/PaymentConditions.ts index 7cc045a..40656cc 100644 --- a/src/keeper/contracts/conditions/PaymentConditions.ts +++ b/src/keeper/contracts/conditions/PaymentConditions.ts @@ -12,7 +12,7 @@ export default class PaymentConditions extends ContractBase { public async lockPayment(serviceAgreementId: string, assetId: string, price: number, consumerAddress: string) : Promise { return this.send("lockPayment", consumerAddress, [ - serviceAgreementId, assetId, price, + serviceAgreementId, "0x" + assetId, price, ]) } } diff --git a/src/ocean/IdGenerator.ts b/src/ocean/IdGenerator.ts index a740f6d..9fc37f9 100644 --- a/src/ocean/IdGenerator.ts +++ b/src/ocean/IdGenerator.ts @@ -1,4 +1,4 @@ -import { v4 } from "uuid" +import {v4} from "uuid" export default class IdGenerator { public static generateId(): string { diff --git a/src/ocean/Ocean.ts b/src/ocean/Ocean.ts index d51808a..8c29fae 100644 --- a/src/ocean/Ocean.ts +++ b/src/ocean/Ocean.ts @@ -66,7 +66,7 @@ export default class Ocean { const aquarius = AquariusProvider.getAquarius() const brizo = BrizoProvider.getBrizo() - const assetId: string = IdGenerator.generatePrefixedId() + const assetId: string = IdGenerator.generateId() const did: string = `did:op:${assetId}` const accessServiceDefinitionId: string = "0" const computeServiceDefintionId: string = "1" diff --git a/test/keeper/DIDRegistry.test.ts b/test/keeper/DIDRegistry.test.ts index 6768cd7..3b9b17b 100644 --- a/test/keeper/DIDRegistry.test.ts +++ b/test/keeper/DIDRegistry.test.ts @@ -26,7 +26,7 @@ describe("DIDRegistry", () => { it("should register an attribute in a new did", async () => { const ownerAccount: Account = (await ocean.getAccounts())[0] - const did = IdGenerator.generatePrefixedId() + const did = IdGenerator.generateId() const providerKey = Web3Provider.getWeb3().utils.fromAscii("provider") const data = "my nice provider, is nice" const receipt = await didRegistry.registerAttribute(did, ValueType.DID, providerKey, @@ -37,7 +37,7 @@ describe("DIDRegistry", () => { it("should register another attribute in the same did", async () => { const ownerAccount: Account = (await ocean.getAccounts())[0] - const did = IdGenerator.generatePrefixedId() + const did = IdGenerator.generateId() { // register the first attribute const providerKey = Web3Provider.getWeb3().utils.fromAscii("provider") @@ -62,7 +62,7 @@ describe("DIDRegistry", () => { it("should get the owner of a did properly", async () => { const ownerAccount: Account = (await ocean.getAccounts())[0] - const did = IdGenerator.generatePrefixedId() + const did = IdGenerator.generateId() const providerKey = Web3Provider.getWeb3().utils.fromAscii("provider") const data = "my nice provider, is nice" await didRegistry.registerAttribute(did, ValueType.DID, providerKey, @@ -74,7 +74,7 @@ describe("DIDRegistry", () => { }) it("should get 0x00.. for a not registered did", async () => { - const owner = await didRegistry.getOwner("0x1234") + const owner = await didRegistry.getOwner("1234") assert(owner === "0x0000000000000000000000000000000000000000") }) @@ -84,7 +84,7 @@ describe("DIDRegistry", () => { it("should the block number of the last update of the did attribute", async () => { const ownerAccount: Account = (await ocean.getAccounts())[0] - const did = IdGenerator.generatePrefixedId() + const did = IdGenerator.generateId() const providerKey = Web3Provider.getWeb3().utils.fromAscii("provider") const data = "my nice provider, is nice" await didRegistry.registerAttribute(did, ValueType.DID, providerKey, diff --git a/test/ocean/ServiceAgreement.test.ts b/test/ocean/ServiceAgreement.test.ts index d8a64c4..c68ba7e 100644 --- a/test/ocean/ServiceAgreement.test.ts +++ b/test/ocean/ServiceAgreement.test.ts @@ -23,7 +23,7 @@ let consumerAccount: Account let accessService: Service let metaDataService: Service -const assetId: string = IdGenerator.generatePrefixedId() +const assetId: string = IdGenerator.generateId() describe("ServiceAgreement", () => {