Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes KeyStates.query with seal parameter #199

Merged
merged 4 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion examples/integration-scripts/singlesig-dip.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down Expand Up @@ -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)),
Expand All @@ -85,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);
});
});
6 changes: 3 additions & 3 deletions src/keri/app/coring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>} A promise to the long-running operation
*/
async query(pre: string, sn?: string, anchor?: string): Promise<any> {
async query(pre: string, sn?: string, anchor?: any): Promise<any> {
const path = `/queries`;
const data: any = {
pre: pre,
Expand Down
Loading