From 2b76effed980e5ce23f7bcdf47028798e01bedb6 Mon Sep 17 00:00:00 2001 From: Petteri Stenius Date: Fri, 19 Jan 2024 17:30:18 +0200 Subject: [PATCH 1/4] fix signature of KeyStates.query --- src/keri/app/coring.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/keri/app/coring.ts b/src/keri/app/coring.ts index f96901ef..09349d15 100644 --- a/src/keri/app/coring.ts +++ b/src/keri/app/coring.ts @@ -166,14 +166,14 @@ export class KeyStates { } /** - * Query the key state of an identifier for a given sequence number or anchor SAID + * Query the key state of an identifier for a given sequence number or anchor * @async * @param {string} pre Identifier prefix * @param {number} [sn] Optional sequence number - * @param {string} [anchor] Optional anchor SAID + * @param {any} [anchor] Optional anchor * @returns {Promise} A promise to the long-running operation */ - async query(pre: string, sn?: string, anchor?: string): Promise { + async query(pre: string, sn?: string, anchor?: any): Promise { const path = `/queries`; const data: any = { pre: pre, From 11bf30b8f9a64049f7dbdab2cadfeb11a4b3598e Mon Sep 17 00:00:00 2001 From: Petteri Stenius Date: Fri, 19 Jan 2024 17:30:59 +0200 Subject: [PATCH 2/4] uses KeyStates.query with seal --- examples/integration-scripts/singlesig-dip.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/integration-scripts/singlesig-dip.test.ts b/examples/integration-scripts/singlesig-dip.test.ts index 626b494d..cc8ef8ac 100644 --- a/examples/integration-scripts/singlesig-dip.test.ts +++ b/examples/integration-scripts/singlesig-dip.test.ts @@ -41,6 +41,7 @@ describe('singlesig-dip', () => { result = await client1.identifiers().interact('name1', seal); let op1 = await result.op(); + // refresh keystate to sn=1 let op2 = await client2.keyStates().query(name1_id, '1'); await Promise.all([ @@ -74,7 +75,8 @@ describe('singlesig-dip', () => { result = await client1.identifiers().interact('name1', seal); op1 = await result.op(); - op2 = await client2.keyStates().query(name1_id, '2'); + // refresh keystate to seal event + op2 = await client2.keyStates().query(name1_id, undefined, seal); await Promise.all([ (op = await waitOperation(client2, op)), From 0d3212fd6c4cbb057377fe1b38f80069f291deb9 Mon Sep 17 00:00:00 2001 From: Petteri Stenius Date: Sat, 20 Jan 2024 09:58:47 +0200 Subject: [PATCH 3/4] add one more query test --- examples/integration-scripts/singlesig-dip.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/integration-scripts/singlesig-dip.test.ts b/examples/integration-scripts/singlesig-dip.test.ts index cc8ef8ac..0858ee66 100644 --- a/examples/integration-scripts/singlesig-dip.test.ts +++ b/examples/integration-scripts/singlesig-dip.test.ts @@ -87,5 +87,9 @@ describe('singlesig-dip', () => { // delegate waits for completion delegate2 = await client2.identifiers().get('delegate2'); expect(delegate2.prefix).toEqual(op.response.i); + + // make sure query with seal is idempotent + op = await client2.keyStates().query(name1_id, undefined, seal); + await waitOperation(client2, op) }); }); From 12c53ab6e4ba0f413c7a4022962de4c2bbf133f5 Mon Sep 17 00:00:00 2001 From: Petteri Stenius Date: Tue, 23 Jan 2024 14:55:44 +0200 Subject: [PATCH 4/4] run npm pretty --- examples/integration-scripts/singlesig-dip.test.ts | 2 +- src/keri/app/coring.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/integration-scripts/singlesig-dip.test.ts b/examples/integration-scripts/singlesig-dip.test.ts index 0858ee66..857f1e99 100644 --- a/examples/integration-scripts/singlesig-dip.test.ts +++ b/examples/integration-scripts/singlesig-dip.test.ts @@ -90,6 +90,6 @@ describe('singlesig-dip', () => { // make sure query with seal is idempotent op = await client2.keyStates().query(name1_id, undefined, seal); - await waitOperation(client2, op) + await waitOperation(client2, op); }); }); diff --git a/src/keri/app/coring.ts b/src/keri/app/coring.ts index 09349d15..3cfce93e 100644 --- a/src/keri/app/coring.ts +++ b/src/keri/app/coring.ts @@ -166,11 +166,11 @@ export class KeyStates { } /** - * Query the key state of an identifier for a given sequence number or anchor + * Query the key state of an identifier for a given sequence number or anchor * @async * @param {string} pre Identifier prefix * @param {number} [sn] Optional sequence number - * @param {any} [anchor] Optional anchor + * @param {any} [anchor] Optional anchor * @returns {Promise} A promise to the long-running operation */ async query(pre: string, sn?: string, anchor?: any): Promise {