mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Generate fulfillmentIndices from service agreement conditions, set fulfillmentOperator to 1 (or
operator), fix typo.
This commit is contained in:
parent
779b5794d8
commit
1a3bb2f8b1
@ -11,13 +11,14 @@ export default class ServiceAgreement extends ContractBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async setupAgreementTemplate(templateId: string, methodReflections: MethodReflection[],
|
public async setupAgreementTemplate(templateId: string, methodReflections: MethodReflection[],
|
||||||
dependencyMatrix: number[], name: any, fulfilmentOperator: number,
|
dependencyMatrix: number[], name: any, fulfillmentIndices: number[],
|
||||||
|
fulfillmentOperator: number,
|
||||||
ownerAddress: string)
|
ownerAddress: string)
|
||||||
: Promise<Receipt> {
|
: Promise<Receipt> {
|
||||||
|
|
||||||
return this.send("setupAgreementTemplate", ownerAddress, [
|
return this.send("setupAgreementTemplate", ownerAddress, [
|
||||||
templateId, methodReflections.map((r) => r.address),
|
templateId, methodReflections.map((r) => r.address),
|
||||||
methodReflections.map((r) => r.signature), dependencyMatrix, name, [0], fulfilmentOperator,
|
methodReflections.map((r) => r.signature), dependencyMatrix, name, fulfillmentIndices, fulfillmentOperator,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,10 @@ export default class ServiceAgreementTemplate extends OceanBase {
|
|||||||
return this.compressDependencies(method.dependencies, method.dependencyTimeoutFlags)
|
return this.compressDependencies(method.dependencies, method.dependencyTimeoutFlags)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
const fulfillmentIndices: number[] = this.template.Methods
|
||||||
|
.map((method: Method, i: number) => method.isTerminalCondition ? i : undefined)
|
||||||
|
.filter((index: number) => index !== undefined)
|
||||||
|
|
||||||
const {serviceAgreement} = await Keeper.getInstance()
|
const {serviceAgreement} = await Keeper.getInstance()
|
||||||
|
|
||||||
const methodReflections = await this.getMethodReflections()
|
const methodReflections = await this.getMethodReflections()
|
||||||
@ -57,7 +61,9 @@ export default class ServiceAgreementTemplate extends OceanBase {
|
|||||||
methodReflections,
|
methodReflections,
|
||||||
dependencyMatrix,
|
dependencyMatrix,
|
||||||
Web3Provider.getWeb3().utils.fromAscii(this.template.templateName),
|
Web3Provider.getWeb3().utils.fromAscii(this.template.templateName),
|
||||||
this.template.fulfilmentOperator, templateOwnerAddress)
|
fulfillmentIndices,
|
||||||
|
this.template.fulfillmentOperator,
|
||||||
|
templateOwnerAddress)
|
||||||
|
|
||||||
const {serviceTemplateId, provider} = receipt.events.SetupAgreementTemplate.returnValues
|
const {serviceTemplateId, provider} = receipt.events.SetupAgreementTemplate.returnValues
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@ import Method from "../Method"
|
|||||||
export default abstract class TemplateBase {
|
export default abstract class TemplateBase {
|
||||||
public Methods: Method[]
|
public Methods: Method[]
|
||||||
public templateName: string
|
public templateName: string
|
||||||
public fulfilmentOperator: number = 0
|
public fulfillmentOperator: number = 1
|
||||||
public id: string = "0x00000000000000000000000000000000000000000000000000000000000000"
|
public id: string = "0x00000000000000000000000000000000000000000000000000000000000000"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user