diff --git a/package-lock.json b/package-lock.json index e20456ce45577d0ddf147fee6402096f140fd32f..0cb1a90782f26287b5d32cf76c4a74b9991f1cf7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,10 +1,12 @@ { "name": "squid", + "version": "0.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "squid", + "version": "0.1.2", "dependencies": { "@belopash/typeorm-store": "^1.2.1", "@subsquid/archive-registry": "^3.3.0", diff --git a/package.json b/package.json index ac14c3b85bac877e5c9f4e3a7905087c7a10650d..2bc59117c3fa71e3ce028f5923f97c71056e04ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "squid", - "version": "0.1.1", + "version": "0.1.2", "private": true, "engines": { "node": ">=20" diff --git a/src/data_handler.ts b/src/data_handler.ts index ecd173e4330c603fd2184e4cd496a34b43b04e76..fefb66366a4a8b9780d6f078640dec86c3f05a33 100644 --- a/src/data_handler.ts +++ b/src/data_handler.ts @@ -130,8 +130,7 @@ export class DataHandler { // Process identity owner key changes for (const idtyChange of newData.idtyChangedOwnerKey) { - const idty = await this.getIdtyByIndexOrFail(ctx, idtyChange.index); - + const idty = await this.getIdtyWithAccountByIndexOrFail(ctx, idtyChange.index); const new_account = await this.getOrCreateAccount(ctx, idtyChange.accountId); // add change owner key event this.data.changeOwnerKey.push( @@ -532,4 +531,13 @@ export class DataHandler { ctx.store.findOneByOrFail(Identity, { index }) ); } + + async getIdtyWithAccountByIndexOrFail(ctx: Ctx, index: IdtyIndex): Promise<Identity> { + return ( + this.data.identities.get(index) ?? + await ctx.store.findOneOrFail(Identity, { + relations: { account: true }, + where: { index: index }, + })) + } }