mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
signature test tweaks
This commit is contained in:
parent
9d95f149d5
commit
c772324b34
@ -17,7 +17,7 @@ describe('Signature', () => {
|
|||||||
;[consumer] = await ocean.accounts.list()
|
;[consumer] = await ocean.accounts.list()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should generate the correct signature', async () => {
|
it('hashServiceAgreement should generate the correct signature', () => {
|
||||||
const templateId = `0x${'f'.repeat(40)}`
|
const templateId = `0x${'f'.repeat(40)}`
|
||||||
const agreementId = `0x${'e'.repeat(64)}`
|
const agreementId = `0x${'e'.repeat(64)}`
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ describe('Signature', () => {
|
|||||||
const lockId = `0x${'b'.repeat(64)}`
|
const lockId = `0x${'b'.repeat(64)}`
|
||||||
const escrowId = `0x${'c'.repeat(64)}`
|
const escrowId = `0x${'c'.repeat(64)}`
|
||||||
|
|
||||||
const hash = await ocean.utils.agreements.hashServiceAgreement(
|
const hash = ocean.utils.agreements.hashServiceAgreement(
|
||||||
templateId,
|
templateId,
|
||||||
agreementId,
|
agreementId,
|
||||||
[accessId, lockId, escrowId],
|
[accessId, lockId, escrowId],
|
||||||
@ -36,11 +36,11 @@ describe('Signature', () => {
|
|||||||
assert.equal(
|
assert.equal(
|
||||||
hash,
|
hash,
|
||||||
'0x67901517c18a3d23e05806fff7f04235cc8ae3b1f82345b8bfb3e4b02b5800c7',
|
'0x67901517c18a3d23e05806fff7f04235cc8ae3b1f82345b8bfb3e4b02b5800c7',
|
||||||
'The signatuere is not correct.'
|
'The signature is not correct.'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should generate the correct signature', async () => {
|
it('signServiceAgreement should generate the correct signature', async () => {
|
||||||
const { templates } = ocean.keeper
|
const { templates } = ocean.keeper
|
||||||
|
|
||||||
const did = `did:op:${'c'.repeat(64)}`
|
const did = `did:op:${'c'.repeat(64)}`
|
||||||
@ -86,8 +86,8 @@ describe('Signature', () => {
|
|||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
signature,
|
signature,
|
||||||
'0x3aa8a1c48b8e582d694bbd4ba3a29fde573b78da9720dc48baeb831b2163e1fa6e10e983882ebf8a00f4124de2505136354fd146934053f0d58bba4eced5f8d000',
|
'0x3aa8a1c48b8e582d694bbd4ba3a29fde573b78da9720dc48baeb831b2163e1fa6e10e983882ebf8a00f4124de2505136354fd146934053f0d58bba4eced5f8d01b',
|
||||||
'The signatuere is not correct.'
|
'The signature is not correct.'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { LogLevel } from '../utils/Logger'
|
import { LogLevel } from '../utils/Logger'
|
||||||
import Web3 from 'web3'
|
|
||||||
export { LogLevel } from '../utils/Logger'
|
export { LogLevel } from '../utils/Logger'
|
||||||
|
|
||||||
export class Config {
|
export class Config {
|
||||||
|
@ -86,9 +86,7 @@ export class ServiceAgreement extends Instantiable {
|
|||||||
{ type: 'bytes32', value: zeroX(serviceAgreementId) }
|
{ type: 'bytes32', value: zeroX(serviceAgreementId) }
|
||||||
]
|
]
|
||||||
|
|
||||||
// return this.web3.utils.soliditySha3(...args).toString('hex')
|
return this.web3.utils.soliditySha3(...args)
|
||||||
const sha3 = this.web3.utils.soliditySha3(...args)
|
|
||||||
return this.web3.utils.toHex(sha3)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getTimeValuesFromService(
|
private getTimeValuesFromService(
|
||||||
|
Loading…
Reference in New Issue
Block a user