1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

Detect the error when a condition is not correctly fulfilled.

This commit is contained in:
Pedro Gutiérrez 2019-07-09 11:39:22 +02:00
parent 031720ad5d
commit d3f15e361a

View File

@ -35,6 +35,7 @@ export class OceanAgreementsConditions extends Instantiable {
escrowReward
} = this.ocean.keeper.conditions
try {
await this.ocean.keeper.token.approve(
lockRewardCondition.getAddress(),
amount,
@ -47,7 +48,11 @@ export class OceanAgreementsConditions extends Instantiable {
amount,
from && from.getId()
)
return !!receipt.events.Fulfilled
} catch {
return false
}
}
/**
@ -63,6 +68,7 @@ export class OceanAgreementsConditions extends Instantiable {
grantee: string,
from?: Account
) {
try {
const { accessSecretStoreCondition } = this.ocean.keeper.conditions
const receipt = await accessSecretStoreCondition.fulfill(
@ -72,6 +78,9 @@ export class OceanAgreementsConditions extends Instantiable {
from && from.getId()
)
return !!receipt.events.Fulfilled
} catch {
return false
}
}
/**
@ -95,6 +104,7 @@ export class OceanAgreementsConditions extends Instantiable {
publisher: string,
from?: Account
) {
try {
const {
escrowReward,
accessSecretStoreCondition,
@ -122,5 +132,8 @@ export class OceanAgreementsConditions extends Instantiable {
from && from.getId()
)
return !!receipt.events.Fulfilled
} catch {
return false
}
}
}