diff --git a/package-lock.json b/package-lock.json index 6c2d1a49..7a3ce04f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@multiversx/sdk-core", - "version": "13.8.0", + "version": "13.9.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@multiversx/sdk-core", - "version": "13.8.0", + "version": "13.9.0", "license": "MIT", "dependencies": { "@multiversx/sdk-transaction-decoder": "1.0.2", diff --git a/package.json b/package.json index a7e6e8b2..985a883c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@multiversx/sdk-core", - "version": "13.8.0", + "version": "13.9.0", "description": "MultiversX SDK for JavaScript and TypeScript", "author": "MultiversX", "homepage": "https://multiversx.com", diff --git a/src/smartcontracts/typesystem/abiRegistry.spec.ts b/src/smartcontracts/typesystem/abiRegistry.spec.ts index e7b43117..4832690f 100644 --- a/src/smartcontracts/typesystem/abiRegistry.spec.ts +++ b/src/smartcontracts/typesystem/abiRegistry.spec.ts @@ -203,4 +203,12 @@ describe("test abi registry", () => { assert.deepEqual(enumType.variants[1].name, "interrupted"); assert.deepEqual(enumType.variants[1].discriminant, 1); }); + + it("should load abi with title for endpoint", async () => { + const registry = await loadAbiRegistry("src/testdata/lottery-esdt.abi.json"); + + const endpoint = registry.getEndpoint("createLotteryPool"); + + assert.equal(endpoint.title, "Create lottery pool"); + }); }); diff --git a/src/smartcontracts/typesystem/abiRegistry.ts b/src/smartcontracts/typesystem/abiRegistry.ts index 25162de2..538c7d14 100644 --- a/src/smartcontracts/typesystem/abiRegistry.ts +++ b/src/smartcontracts/typesystem/abiRegistry.ts @@ -214,7 +214,7 @@ function mapEndpoint(endpoint: EndpointDefinition, mapper: TypeMapper): Endpoint (e) => new EndpointParameterDefinition(e.name, e.description, mapper.mapType(e.type)), ); - return new EndpointDefinition(endpoint.name, newInput, newOutput, endpoint.modifiers); + return new EndpointDefinition(endpoint.name, newInput, newOutput, endpoint.modifiers, endpoint.title); } function mapEvent(event: EventDefinition, mapper: TypeMapper): EventDefinition { diff --git a/src/smartcontracts/typesystem/endpoint.ts b/src/smartcontracts/typesystem/endpoint.ts index 9868b72d..90f5de39 100644 --- a/src/smartcontracts/typesystem/endpoint.ts +++ b/src/smartcontracts/typesystem/endpoint.ts @@ -6,6 +6,7 @@ const DescriptionPlaceholder = "N / A"; export class EndpointDefinition { readonly name: string; + readonly title: string; readonly input: EndpointParameterDefinition[] = []; readonly output: EndpointParameterDefinition[] = []; readonly modifiers: EndpointModifiers; @@ -15,8 +16,10 @@ export class EndpointDefinition { input: EndpointParameterDefinition[], output: EndpointParameterDefinition[], modifiers: EndpointModifiers, + title?: string, ) { this.name = name; + this.title = title || ""; this.input = input || []; this.output = output || []; this.modifiers = modifiers; @@ -28,6 +31,7 @@ export class EndpointDefinition { static fromJSON(json: { name: string; + title?: string; onlyOwner?: boolean; mutability: string; payableInTokens: string[]; @@ -36,6 +40,7 @@ export class EndpointDefinition { }): EndpointDefinition { json.name = json.name == null ? NamePlaceholder : json.name; json.onlyOwner = json.onlyOwner || false; + json.title = json.title || ""; json.payableInTokens = json.payableInTokens || []; json.inputs = json.inputs || []; json.outputs = json.outputs || []; @@ -44,7 +49,7 @@ export class EndpointDefinition { let output = json.outputs.map((param) => EndpointParameterDefinition.fromJSON(param)); let modifiers = new EndpointModifiers(json.mutability, json.payableInTokens, json.onlyOwner); - return new EndpointDefinition(json.name, input, output, modifiers); + return new EndpointDefinition(json.name, input, output, modifiers, json.title); } } diff --git a/src/testdata/lottery-esdt.abi.json b/src/testdata/lottery-esdt.abi.json index a9fa48c5..53be0bbe 100644 --- a/src/testdata/lottery-esdt.abi.json +++ b/src/testdata/lottery-esdt.abi.json @@ -68,6 +68,7 @@ }, { "name": "createLotteryPool", + "title": "Create lottery pool", "mutability": "mutable", "inputs": [ {