From 2530a0d514e1f20761619f77959fb658f14b5c6e Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Sat, 9 Sep 2023 17:43:16 -0300 Subject: [PATCH] witness cuts adds --- examples/integration-scripts/witness.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/examples/integration-scripts/witness.ts b/examples/integration-scripts/witness.ts index e192a7b4..f542df91 100644 --- a/examples/integration-scripts/witness.ts +++ b/examples/integration-scripts/witness.ts @@ -50,5 +50,30 @@ async function run() { aid1 = await client1.identifiers().get("aid1") assert.equal(aid1.state.b.length, 1) assert.equal(aid1.state.b[0], witness) + + // Remove witness + icpResult1 = await client1.identifiers().rotate('aid1',{cuts: [witness]}) + + op1 = await icpResult1.op() + while (!op1["done"] ) { + op1 = await client1.operations().get(op1.name); + await new Promise(resolve => setTimeout(resolve, 1000)); + } + aid1 = await client1.identifiers().get("aid1") + assert.equal(aid1.state.b.length, 0) + + // Add witness again + + icpResult1 = await client1.identifiers().rotate('aid1',{adds: [witness]}) + + op1 = await icpResult1.op() + while (!op1["done"] ) { + op1 = await client1.operations().get(op1.name); + await new Promise(resolve => setTimeout(resolve, 1000)); + } + aid1 = await client1.identifiers().get("aid1") + assert.equal(aid1.state.b.length, 1) + assert.equal(aid1.state.b.length, 1) + assert.equal(aid1.state.b[0], witness) } \ No newline at end of file