mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Add event getter to agreementstoremanager, update the signature tests.
This commit is contained in:
parent
9fe9422ff7
commit
c7b41724ba
@ -60,13 +60,13 @@ describe('Signature', function () {
|
||||
});
|
||||
}); });
|
||||
it('hashServiceAgreement should generate the correct signature', function () {
|
||||
var templateId = "0x" + 'f'.repeat(40);
|
||||
var templateId = "0x" + 'f'.repeat(64);
|
||||
var agreementId = "0x" + 'e'.repeat(64);
|
||||
var accessId = "0x" + 'a'.repeat(64);
|
||||
var lockId = "0x" + 'b'.repeat(64);
|
||||
var escrowId = "0x" + 'c'.repeat(64);
|
||||
var hash = ocean.utils.agreements.hashServiceAgreement(templateId, agreementId, [lockId, accessId, escrowId], [0, 0, 0], [0, 0, 0]);
|
||||
chai_1.assert.equal(hash, '0x67901517c18a3d23e05806fff7f04235cc8ae3b1f82345b8bfb3e4b02b5800c7', 'The signature is not correct.');
|
||||
chai_1.assert.equal(hash, '0x464dac3b79a47f8acad54f67a0f4473249330f025c69687531e58c2e43b36437', 'The signature is not correct.');
|
||||
});
|
||||
it('signServiceAgreement should generate the correct signature', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var templates, did, templateId, agreementId, serviceAgreementTemplate, ddo, signature;
|
||||
@ -75,7 +75,7 @@ describe('Signature', function () {
|
||||
case 0:
|
||||
templates = ocean.keeper.templates;
|
||||
did = "did:op:" + 'c'.repeat(64);
|
||||
templateId = "0x" + 'f'.repeat(40);
|
||||
templateId = "0x" + 'f'.repeat(64);
|
||||
agreementId = "0x" + 'e'.repeat(64);
|
||||
return [4 /*yield*/, templates.escrowAccessSecretStoreTemplate.getServiceAgreementTemplate()];
|
||||
case 1:
|
||||
@ -107,7 +107,7 @@ describe('Signature', function () {
|
||||
return [4 /*yield*/, ocean.utils.agreements.signServiceAgreement(ddo, 0, agreementId, ["0x" + '1'.repeat(64), "0x" + '2'.repeat(64), "0x" + '3'.repeat(64)], consumer)];
|
||||
case 2:
|
||||
signature = _a.sent();
|
||||
chai_1.assert.equal(signature, '0x3aa8a1c48b8e582d694bbd4ba3a29fde573b78da9720dc48baeb831b2163e1fa6e10e983882ebf8a00f4124de2505136354fd146934053f0d58bba4eced5f8d01b', 'The signature is not correct.');
|
||||
chai_1.assert.equal(signature, '0xa04568fccdda7e1594e3e615f8d71b14733705aabe5294af0b7f46f0aedb9d5906a2caa6142ee4de10534a47c5a7083b21b2d3e9a96ac462bc0b9d25070e981e1c', 'The signature is not correct.');
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
|
@ -93,4 +93,11 @@ export class AgreementStoreManager extends ContractBase {
|
||||
agreementId: zeroX(agreementId)
|
||||
})
|
||||
}
|
||||
|
||||
public getAgreementActorAddedEvent(agreementId: string) {
|
||||
return this.getEvent('AgreementActorAdded', {
|
||||
agreementId: zeroX(agreementId)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user