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

Update keyState call to use hex string instead of int for sequence number. #195

Merged
merged 2 commits into from
Jan 16, 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
2 changes: 1 addition & 1 deletion examples/integration-scripts/delegation-multisig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ test('delegation-multisig', async () => {
// Client 0 approves delegation
const anchor = {
i: delegatePrefix,
s: 0,
s: '0',
d: delegatePrefix,
};
await client0.identifiers().interact('delegator', anchor);
Expand Down
2 changes: 1 addition & 1 deletion examples/integration-scripts/delegation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ test('delegation', async () => {
// Client 1 approves deletation
const anchor = {
i: delegatePrefix,
s: 0,
s: '0',
d: delegatePrefix,
};
await client1.identifiers().interact('delegator', anchor);
Expand Down
26 changes: 13 additions & 13 deletions examples/integration-scripts/multisig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
]);

// Create four identifiers, one for each client
let [aid1, aid2, aid3, aid4] = await Promise.all([

Check warning on line 32 in examples/integration-scripts/multisig.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.12.1 and macOS-latest

'aid4' is never reassigned. Use 'const' instead

Check warning on line 32 in examples/integration-scripts/multisig.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.12.1 and ubuntu-latest

'aid4' is never reassigned. Use 'const' instead
createAID(client1, 'member1', WITNESS_AIDS),
createAID(client2, 'member2', WITNESS_AIDS),
createAID(client3, 'member3', WITNESS_AIDS),
Expand Down Expand Up @@ -592,29 +592,29 @@
console.log('Member3 rotated keys');

// Update new key states
op1 = await client1.keyStates().query(aid2.prefix, 1);
op1 = await client1.keyStates().query(aid2.prefix, '1');
op1 = await waitOperation(client1, op1);
const aid2State = op1['response'];
op1 = await client1.keyStates().query(aid3.prefix, 1);
op1 = await client1.keyStates().query(aid3.prefix, '1');
op1 = await waitOperation(client1, op1);
const aid3State = op1['response'];

op2 = await client2.keyStates().query(aid3.prefix, 1);
op2 = await client2.keyStates().query(aid3.prefix, '1');
op2 = await waitOperation(client2, op2);
op2 = await client2.keyStates().query(aid1.prefix, 1);
op2 = await client2.keyStates().query(aid1.prefix, '1');
op2 = await waitOperation(client2, op2);
const aid1State = op2['response'];

op3 = await client3.keyStates().query(aid1.prefix, 1);
op3 = await client3.keyStates().query(aid1.prefix, '1');
op3 = await waitOperation(client3, op3);
op3 = await client3.keyStates().query(aid2.prefix, 1);
op3 = await client3.keyStates().query(aid2.prefix, '1');
op3 = await waitOperation(client3, op3);

op4 = await client4.keyStates().query(aid1.prefix, 1);
op4 = await client4.keyStates().query(aid1.prefix, '1');
op4 = await waitOperation(client4, op4);
op4 = await client4.keyStates().query(aid2.prefix, 1);
op4 = await client4.keyStates().query(aid2.prefix, '1');
op4 = await waitOperation(client4, op4);
op4 = await client4.keyStates().query(aid3.prefix, 1);
op4 = await client4.keyStates().query(aid3.prefix, '1');
op4 = await waitOperation(client4, op4);

rstates = [aid1State, aid2State, aid3State];
Expand Down Expand Up @@ -945,14 +945,14 @@
const m = await client1.identifiers().get('multisig');

// Update states
op1 = await client1.keyStates().query(m.prefix, 4);
op1 = await client1.keyStates().query(m.prefix, '4');
op1 = await waitOperation(client1, op1);
op2 = await client2.keyStates().query(m.prefix, 4);
op2 = await client2.keyStates().query(m.prefix, '4');
op2 = await waitOperation(client2, op2);
op3 = await client3.keyStates().query(m.prefix, 4);
op3 = await client3.keyStates().query(m.prefix, '4');
op3 = await waitOperation(client3, op3);

Check warning on line 953 in examples/integration-scripts/multisig.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.12.1 and macOS-latest

'op3' is assigned a value but never used

Check warning on line 953 in examples/integration-scripts/multisig.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.12.1 and ubuntu-latest

'op3' is assigned a value but never used
op4 = await client4.keyStates().query(m.prefix, 4);
op4 = await client4.keyStates().query(m.prefix, '4');
op4 = await waitOperation(client4, op4);

Check warning on line 955 in examples/integration-scripts/multisig.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.12.1 and macOS-latest

'op4' is assigned a value but never used

Check warning on line 955 in examples/integration-scripts/multisig.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.12.1 and ubuntu-latest

'op4' is assigned a value but never used

// IPEX grant message
console.log('Starting grant message');
Expand Down
2 changes: 1 addition & 1 deletion examples/integration-scripts/singlesig-ixn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
interface KeyState {
i: string;
s: string;
[property: string]: any;

Check warning on line 26 in examples/integration-scripts/singlesig-ixn.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.12.1 and macOS-latest

Unexpected any. Specify a different type

Check warning on line 26 in examples/integration-scripts/singlesig-ixn.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.12.1 and ubuntu-latest

Unexpected any. Specify a different type
}

describe('singlesig-ixn', () => {
Expand Down Expand Up @@ -70,7 +70,7 @@
// refresh remote keystate
let op = await client2
.keyStates()
.query(contact1_id, parseInt(keystate1.s), undefined);
.query(contact1_id, keystate1.s, undefined);
op = await waitOperation(client2, op);
const keystate3: KeyState = op.response;
// local and remote keystate match
Expand Down
2 changes: 1 addition & 1 deletion examples/integration-scripts/singlesig-rot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
s: string;
k: string[];
n: string[];
[property: string]: any;

Check warning on line 28 in examples/integration-scripts/singlesig-rot.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.12.1 and macOS-latest

Unexpected any. Specify a different type

Check warning on line 28 in examples/integration-scripts/singlesig-rot.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.12.1 and ubuntu-latest

Unexpected any. Specify a different type
}

describe('singlesig-rot', () => {
Expand Down Expand Up @@ -79,7 +79,7 @@
// refresh remote keystate
let op = await client2
.keyStates()
.query(contact1_id, parseInt(keystate1.s), undefined);
.query(contact1_id, keystate1.s, undefined);
op = await waitOperation(client2, op);
const keystate3: KeyState = op.response;
// local and remote keystate match
Expand Down
2 changes: 1 addition & 1 deletion src/keri/app/coring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export class KeyStates {
* @param {string} [anchor] Optional anchor SAID
* @returns {Promise<any>} A promise to the long-running operation
*/
async query(pre: string, sn?: number, anchor?: string): Promise<any> {
async query(pre: string, sn?: string, anchor?: string): Promise<any> {
const path = `/queries`;
const data: any = {
pre: pre,
Expand Down
4 changes: 2 additions & 2 deletions test/app/coring.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ describe('Coring', () => {

await keyStates.query(
'EP10ooRj0DJF0HWZePEYMLPl-arMV-MAoTKK-o3DXbgX',
1,
'1',
'EBfdlu8R27Fbx-ehrqwImnK-8Cm79sqbAQ4MmvEAYqao'
);
lastCall = fetchMock.mock.calls[fetchMock.mock.calls.length - 1]!;
Expand All @@ -272,7 +272,7 @@ describe('Coring', () => {
lastBody.pre,
'EP10ooRj0DJF0HWZePEYMLPl-arMV-MAoTKK-o3DXbgX'
);
assert.equal(lastBody.sn, 1);
assert.equal(lastBody.sn, '1');
assert.equal(
lastBody.anchor,
'EBfdlu8R27Fbx-ehrqwImnK-8Cm79sqbAQ4MmvEAYqao'
Expand Down
Loading