mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Update templateId type in agreement hash, fix signature and consumeasset tests. Update readme file regarding running integration tests.
This commit is contained in:
parent
aae8172993
commit
9fe9422ff7
@ -160,6 +160,8 @@ export SEED_WORDS="taxi music thumb unique chat sand crew more leg another off l
|
|||||||
Once everything is up, run the integration tests:
|
Once everything is up, run the integration tests:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# integration tests work with the spree network and the SEED_WORDS in previous step are required.
|
||||||
|
# Make sure to reset `ETH_PORT` to 8545 (or whatever port is used in `spree1)
|
||||||
npm run integration
|
npm run integration
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -97,6 +97,9 @@ describe('Consume Asset', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should get the agreement conditions status not fulfilled', async () => {
|
it('should get the agreement conditions status not fulfilled', async () => {
|
||||||
|
// Wait for the agreement event
|
||||||
|
await ocean.keeper.agreementStoreManager
|
||||||
|
.getAgreementCreatedEvent(serviceAgreementSignatureResult.agreementId).once()
|
||||||
const status = await ocean.agreements.status(
|
const status = await ocean.agreements.status(
|
||||||
serviceAgreementSignatureResult.agreementId
|
serviceAgreementSignatureResult.agreementId
|
||||||
)
|
)
|
||||||
|
@ -18,7 +18,7 @@ describe('Signature', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('hashServiceAgreement should generate the correct signature', () => {
|
it('hashServiceAgreement should generate the correct signature', () => {
|
||||||
const templateId = `0x${'f'.repeat(40)}`
|
const templateId = `0x${'f'.repeat(64)}`
|
||||||
const agreementId = `0x${'e'.repeat(64)}`
|
const agreementId = `0x${'e'.repeat(64)}`
|
||||||
|
|
||||||
const accessId = `0x${'a'.repeat(64)}`
|
const accessId = `0x${'a'.repeat(64)}`
|
||||||
@ -35,7 +35,7 @@ describe('Signature', () => {
|
|||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
hash,
|
hash,
|
||||||
'0x67901517c18a3d23e05806fff7f04235cc8ae3b1f82345b8bfb3e4b02b5800c7',
|
'0x464dac3b79a47f8acad54f67a0f4473249330f025c69687531e58c2e43b36437',
|
||||||
'The signature is not correct.'
|
'The signature is not correct.'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -44,7 +44,7 @@ describe('Signature', () => {
|
|||||||
const { templates } = ocean.keeper
|
const { templates } = ocean.keeper
|
||||||
|
|
||||||
const did = `did:op:${'c'.repeat(64)}`
|
const did = `did:op:${'c'.repeat(64)}`
|
||||||
const templateId = `0x${'f'.repeat(40)}`
|
const templateId = `0x${'f'.repeat(64)}`
|
||||||
const agreementId = `0x${'e'.repeat(64)}`
|
const agreementId = `0x${'e'.repeat(64)}`
|
||||||
|
|
||||||
const serviceAgreementTemplate = await templates.escrowAccessSecretStoreTemplate.getServiceAgreementTemplate()
|
const serviceAgreementTemplate = await templates.escrowAccessSecretStoreTemplate.getServiceAgreementTemplate()
|
||||||
@ -84,7 +84,7 @@ describe('Signature', () => {
|
|||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
signature,
|
signature,
|
||||||
'0x3aa8a1c48b8e582d694bbd4ba3a29fde573b78da9720dc48baeb831b2163e1fa6e10e983882ebf8a00f4124de2505136354fd146934053f0d58bba4eced5f8d01b',
|
'0xa04568fccdda7e1594e3e615f8d71b14733705aabe5294af0b7f46f0aedb9d5906a2caa6142ee4de10534a47c5a7083b21b2d3e9a96ac462bc0b9d25070e981e1c',
|
||||||
'The signature is not correct.'
|
'The signature is not correct.'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -149,6 +149,12 @@ export class OceanAgreements extends Instantiable {
|
|||||||
const { templateId } = await this.ocean.keeper.agreementStoreManager.getAgreement(
|
const { templateId } = await this.ocean.keeper.agreementStoreManager.getAgreement(
|
||||||
agreementId
|
agreementId
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (templateId === `0x${'0'.repeat(64)}`) {
|
||||||
|
console.error('agreement is not found: ' + agreementId + ' ' + templateId)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const fullStatus = await this.ocean.keeper
|
const fullStatus = await this.ocean.keeper
|
||||||
.getTemplateById(templateId)
|
.getTemplateById(templateId)
|
||||||
.getAgreementStatus(agreementId, this.ocean.keeper.conditionStoreManager)
|
.getAgreementStatus(agreementId, this.ocean.keeper.conditionStoreManager)
|
||||||
|
@ -76,7 +76,7 @@ export class ServiceAgreement extends Instantiable {
|
|||||||
timeouts: number[]
|
timeouts: number[]
|
||||||
): string {
|
): string {
|
||||||
const args: any = [
|
const args: any = [
|
||||||
{ type: 'address', value: zeroX(serviceAgreementTemplateId) },
|
{ type: 'bytes32', value: zeroX(serviceAgreementTemplateId) },
|
||||||
{ type: 'bytes32[]', value: valueHashes.map(zeroX) },
|
{ type: 'bytes32[]', value: valueHashes.map(zeroX) },
|
||||||
{ type: 'uint256[]', value: timelocks },
|
{ type: 'uint256[]', value: timelocks },
|
||||||
{ type: 'uint256[]', value: timeouts },
|
{ type: 'uint256[]', value: timeouts },
|
||||||
|
Loading…
Reference in New Issue
Block a user