Skip to content

Commit

Permalink
witness cuts adds
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodolfo Miranda committed Sep 9, 2023
1 parent d3aaa49 commit 2530a0d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples/integration-scripts/witness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

}

0 comments on commit 2530a0d

Please sign in to comment.