From cb6d4014ee785f534fac99f700a1a812fa094ab0 Mon Sep 17 00:00:00 2001 From: neeraj Date: Fri, 8 Mar 2024 14:29:32 +0530 Subject: [PATCH] Add prefix to public key --- src/account.ts | 2 +- src/sdk.test.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/account.ts b/src/account.ts index 1792870..ef3dfcc 100644 --- a/src/account.ts +++ b/src/account.ts @@ -114,7 +114,7 @@ export class Account { const [account] = await this._wallet.getAccounts(); this._address = account.address; - this._publicKeyLaconic2 = toHex(account.pubkey); + this._publicKeyLaconic2 = Buffer.from(AMINO_PREFIX + toHex(account.pubkey), 'hex').toString('base64'); // Generate public key. this._publicKey = secp256k1.publicKeyCreate(this._privateKey); diff --git a/src/sdk.test.ts b/src/sdk.test.ts index 67dbfb3..b1bbeb5 100644 --- a/src/sdk.test.ts +++ b/src/sdk.test.ts @@ -50,7 +50,7 @@ describe('Querying', () => { expect(records.length).toBeGreaterThanOrEqual(1); }); - xtest('Query records by reference.', async () => { + test('Query records by reference.', async () => { const { repo_registration_record_cid } = watcher.record; const records = await registry.queryRecords({ repo_registration_record_cid }, true); expect(records.length).toBeGreaterThanOrEqual(1); @@ -59,7 +59,7 @@ describe('Querying', () => { expect(repo_registration_record_cid).toStrictEqual(record_repo_registration_record_cid); }); - xtest('Query records by attributes.', async () => { + test('Query records by attributes.', async () => { const { version, url } = watcher.record; const records = await registry.queryRecords({ version, url, type: undefined }, true); expect(records.length).toBe(1); @@ -70,13 +70,13 @@ describe('Querying', () => { expect(recordName).toBe(url); }); - xtest('Query records by id.', async () => { + test('Query records by id.', async () => { const records = await registry.getRecordsByIds([watcher.id]); expect(records.length).toBe(1); expect(records[0].id).toBe(watcher.id); }); - xtest('Query records passing refs true.', async () => { + test('Query records passing refs true.', async () => { const [record] = await registry.getRecordsByIds([watcher.id], true); expect(record.id).toBe(watcher.id); // temp fix