mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
optimize
This commit is contained in:
parent
076c2eb788
commit
db910aaaa2
@ -33,24 +33,14 @@ export default class ServiceAgreementTemplate extends OceanBase {
|
|||||||
templateOwner)
|
templateOwner)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the status of a service agreement template
|
|
||||||
*/
|
|
||||||
public async getStatus(): Promise<boolean> {
|
|
||||||
|
|
||||||
const serviceAgreement: ServiceAgreement = await ServiceAgreement.getInstance()
|
|
||||||
|
|
||||||
return serviceAgreement.getTemplateStatus(this.getId())
|
|
||||||
}
|
|
||||||
|
|
||||||
private static generateConditionsKeys(serviceAgreementTemplateId: string, methodReflections: MethodReflection[]):
|
private static generateConditionsKeys(serviceAgreementTemplateId: string, methodReflections: MethodReflection[]):
|
||||||
string[] {
|
string[] {
|
||||||
const conditions = []
|
const conditions = []
|
||||||
for (let i = 0; i < methodReflections.length; i++) {
|
for (const methodReflection of methodReflections) {
|
||||||
const values = [
|
const values = [
|
||||||
{type: "bytes32", value: serviceAgreementTemplateId},
|
{type: "bytes32", value: serviceAgreementTemplateId},
|
||||||
{type: "address", value: methodReflections[i].address},
|
{type: "address", value: methodReflection.address},
|
||||||
{type: "bytes4", value: methodReflections[i].signature},
|
{type: "bytes4", value: methodReflection.signature},
|
||||||
]
|
]
|
||||||
conditions.push(Web3Provider.getWeb3().utils.soliditySha3(...values).toString("hex"))
|
conditions.push(Web3Provider.getWeb3().utils.soliditySha3(...values).toString("hex"))
|
||||||
}
|
}
|
||||||
@ -61,6 +51,16 @@ export default class ServiceAgreementTemplate extends OceanBase {
|
|||||||
super(id)
|
super(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets the status of a service agreement template
|
||||||
|
*/
|
||||||
|
public async getStatus(): Promise<boolean> {
|
||||||
|
|
||||||
|
const serviceAgreement: ServiceAgreement = await ServiceAgreement.getInstance()
|
||||||
|
|
||||||
|
return serviceAgreement.getTemplateStatus(this.getId())
|
||||||
|
}
|
||||||
|
|
||||||
public getOwner(): Account {
|
public getOwner(): Account {
|
||||||
return this.owner
|
return this.owner
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user