Either I'm using the sdk wrong, or Session.deposit does not take the PowDepth of the operator into account when waiting on the deposit stage. This code works correctly if the operator is configured with PowDepth==0, but not with a PowDepth>0.
See below for the OpClientConfig struct sent by the operator and the javascript I used to wait until the deposit is finished.
// OpClientConfig describes the part of the client's configuration which is sent
// to connecting clients by the operator.
type OpClientConfig struct {
NetworkID int64 `json:"networkID,string"` // Network-ID
Contract common.Address `json:"contract"`
POWDepth uint64 `json:"powDepth"`
}
async function deposit(erdSession, token, amount) {
let { stages } = await erdSession.deposit(new Assets({
token: token,
asset: new Amount(amount)
}))
for await (const [_name , stage] of stages) {
console.log("DEPOSIT: Waiting on", _name, "stage")
const ctx = await stage.wait()
if (ctx.status !== 0x1) {
console.log("DEPOSIT: Stage", _name, "failed with status", ctx.status)
} else {
console.log("DEPOSIT: Stage", _name, "successfully finished")
}
}
}
Either I'm using the sdk wrong, or
Session.deposit
does not take the PowDepth of the operator into account when waiting on the deposit stage. This code works correctly if the operator is configured withPowDepth==0
, but not with aPowDepth>0
.See below for the
OpClientConfig
struct sent by the operator and the javascript I used to wait until the deposit is finished.