From b0d380c86dc5afe3729cdf402d6d51f0ef99b0d2 Mon Sep 17 00:00:00 2001 From: Prashant Bajpai <34747455+prashantasdeveloper@users.noreply.github.com> Date: Wed, 27 Nov 2024 15:40:32 +0530 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Use=20`getLegsFromChain`?= =?UTF-8?q?=20for=20getting=20legs=20after=20creation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AccountsService | 0 package.json | 2 +- src/settlements/settlements.controller.spec.ts | 2 +- src/settlements/settlements.controller.ts | 2 +- src/settlements/venues.controller.spec.ts | 2 +- src/settlements/venues.controller.ts | 2 +- src/test-utils/mocks.ts | 1 + yarn.lock | 8 ++++---- 8 files changed, 10 insertions(+), 9 deletions(-) delete mode 100644 AccountsService diff --git a/AccountsService b/AccountsService deleted file mode 100644 index e69de29b..00000000 diff --git a/package.json b/package.json index d45aaac1..fc86f43e 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "@polymeshassociation/fireblocks-signing-manager": "^2.5.0", "@polymeshassociation/hashicorp-vault-signing-manager": "^3.4.0", "@polymeshassociation/local-signing-manager": "^3.3.0", - "@polymeshassociation/polymesh-sdk": "27.0.0-alpha.4", + "@polymeshassociation/polymesh-sdk": "^27.0.0-alpha.5", "@polymeshassociation/signing-manager-types": "^3.2.0", "class-transformer": "0.5.1", "class-validator": "^0.14.0", diff --git a/src/settlements/settlements.controller.spec.ts b/src/settlements/settlements.controller.spec.ts index ea8ec517..45517aa4 100644 --- a/src/settlements/settlements.controller.spec.ts +++ b/src/settlements/settlements.controller.spec.ts @@ -329,7 +329,7 @@ describe('SettlementsController', () => { it('should create an instruction and return the data returned by the service', async () => { const mockInstruction = new MockInstruction(); - when(mockInstruction.getLegs).calledWith().mockResolvedValue({ data: [] }); + when(mockInstruction.getLegsFromChain).calledWith().mockResolvedValue({ data: [] }); const mockData = { ...txResult, diff --git a/src/settlements/settlements.controller.ts b/src/settlements/settlements.controller.ts index 31c26e5a..87f77c71 100644 --- a/src/settlements/settlements.controller.ts +++ b/src/settlements/settlements.controller.ts @@ -410,7 +410,7 @@ export class SettlementsController { transactions, details, }) => { - const { data: legs } = await instruction.getLegs(); + const { data: legs } = await instruction.getLegsFromChain(); return new CreatedInstructionModel({ instruction, diff --git a/src/settlements/venues.controller.spec.ts b/src/settlements/venues.controller.spec.ts index c29a26cf..cbd4cb27 100644 --- a/src/settlements/venues.controller.spec.ts +++ b/src/settlements/venues.controller.spec.ts @@ -91,7 +91,7 @@ describe('VenuesController', () => { it('should create an instruction and return the data returned by the service', async () => { const mockInstruction = new MockInstruction(); - when(mockInstruction.getLegs).calledWith().mockResolvedValue({ data: [] }); + when(mockInstruction.getLegsFromChain).calledWith().mockResolvedValue({ data: [] }); const mockData = { ...txResult, diff --git a/src/settlements/venues.controller.ts b/src/settlements/venues.controller.ts index eba1a2ac..e9d3a415 100644 --- a/src/settlements/venues.controller.ts +++ b/src/settlements/venues.controller.ts @@ -186,7 +186,7 @@ export class VenuesController { transactions, details, }) => { - const { data: legs } = await instruction.getLegs(); + const { data: legs } = await instruction.getLegsFromChain(); return new CreatedInstructionModel({ instruction, diff --git a/src/test-utils/mocks.ts b/src/test-utils/mocks.ts index 760f6766..82045a69 100644 --- a/src/test-utils/mocks.ts +++ b/src/test-utils/mocks.ts @@ -264,6 +264,7 @@ export class MockInstruction { public reject = jest.fn(); public details = jest.fn(); public getLegs = jest.fn(); + public getLegsFromChain = jest.fn(); public getAffirmations = jest.fn(); public getOffChainAffirmations = jest.fn(); public getOffChainAffirmationForLeg = jest.fn(); diff --git a/yarn.lock b/yarn.lock index 9770c1e9..fb856057 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1954,10 +1954,10 @@ dependencies: "@polymeshassociation/signing-manager-types" "^3.3.0" -"@polymeshassociation/polymesh-sdk@27.0.0-alpha.4": - version "27.0.0-alpha.4" - resolved "https://registry.yarnpkg.com/@polymeshassociation/polymesh-sdk/-/polymesh-sdk-27.0.0-alpha.4.tgz#999da175d0fed8e075a34fe58fc3b5dd108cdd0b" - integrity sha512-i/FT36KsdeKntKpVD6V+H+MszTog0yC6JDM/tbRtZls71wmZClfMz1jC4ihdnfF02+DVlKvKWH1oEIv1AImJgg== +"@polymeshassociation/polymesh-sdk@^27.0.0-alpha.5": + version "27.0.0-alpha.5" + resolved "https://registry.yarnpkg.com/@polymeshassociation/polymesh-sdk/-/polymesh-sdk-27.0.0-alpha.5.tgz#0e8c1318d0632c535ffa5e89808dcfdb03440578" + integrity sha512-Dgb9vz9c7O+gzuZX+TSx62N/UPeO3TyqkdJ2lF+S6xxDpswBPhWvBtpxwFTyHYnOrBFlXG4APLy5C2T+1526bw== dependencies: "@apollo/client" "^3.8.1" "@polkadot/api" "11.2.1"