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:
parent
031720ad5d
commit
d3f15e361a
@ -35,6 +35,7 @@ export class OceanAgreementsConditions extends Instantiable {
|
|||||||
escrowReward
|
escrowReward
|
||||||
} = this.ocean.keeper.conditions
|
} = this.ocean.keeper.conditions
|
||||||
|
|
||||||
|
try {
|
||||||
await this.ocean.keeper.token.approve(
|
await this.ocean.keeper.token.approve(
|
||||||
lockRewardCondition.getAddress(),
|
lockRewardCondition.getAddress(),
|
||||||
amount,
|
amount,
|
||||||
@ -47,7 +48,11 @@ export class OceanAgreementsConditions extends Instantiable {
|
|||||||
amount,
|
amount,
|
||||||
from && from.getId()
|
from && from.getId()
|
||||||
)
|
)
|
||||||
|
|
||||||
return !!receipt.events.Fulfilled
|
return !!receipt.events.Fulfilled
|
||||||
|
} catch {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,6 +68,7 @@ export class OceanAgreementsConditions extends Instantiable {
|
|||||||
grantee: string,
|
grantee: string,
|
||||||
from?: Account
|
from?: Account
|
||||||
) {
|
) {
|
||||||
|
try {
|
||||||
const { accessSecretStoreCondition } = this.ocean.keeper.conditions
|
const { accessSecretStoreCondition } = this.ocean.keeper.conditions
|
||||||
|
|
||||||
const receipt = await accessSecretStoreCondition.fulfill(
|
const receipt = await accessSecretStoreCondition.fulfill(
|
||||||
@ -72,6 +78,9 @@ export class OceanAgreementsConditions extends Instantiable {
|
|||||||
from && from.getId()
|
from && from.getId()
|
||||||
)
|
)
|
||||||
return !!receipt.events.Fulfilled
|
return !!receipt.events.Fulfilled
|
||||||
|
} catch {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,6 +104,7 @@ export class OceanAgreementsConditions extends Instantiable {
|
|||||||
publisher: string,
|
publisher: string,
|
||||||
from?: Account
|
from?: Account
|
||||||
) {
|
) {
|
||||||
|
try {
|
||||||
const {
|
const {
|
||||||
escrowReward,
|
escrowReward,
|
||||||
accessSecretStoreCondition,
|
accessSecretStoreCondition,
|
||||||
@ -122,5 +132,8 @@ export class OceanAgreementsConditions extends Instantiable {
|
|||||||
from && from.getId()
|
from && from.getId()
|
||||||
)
|
)
|
||||||
return !!receipt.events.Fulfilled
|
return !!receipt.events.Fulfilled
|
||||||
|
} catch {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user