diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a754a55..f5e7b9d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how ## Unreleased - TBD +## 10.1.2 + - [Fix ABI endpoint definition: attribute "mutability"](https://github.com/ElrondNetwork/elrond-sdk-erdjs/pull/200) + ## 10.1.1 - [Add missing package "blake2b" (removed by mistake)](https://github.com/ElrondNetwork/elrond-sdk-erdjs/pull/199) diff --git a/package-lock.json b/package-lock.json index 1f76a88d..dd4a93f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@elrondnetwork/erdjs", - "version": "10.1.1", + "version": "10.1.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@elrondnetwork/erdjs", - "version": "10.1.1", + "version": "10.1.2", "license": "GPL-3.0-or-later", "dependencies": { "@elrondnetwork/transaction-decoder": "0.1.0", @@ -2069,9 +2069,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.111", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.111.tgz", - "integrity": "sha512-/s3+fwhKf1YK4k7btOImOzCQLpUjS6MaPf0ODTNuT4eTM1Bg4itBpLkydhOzJmpmH6Z9eXFyuuK5czsmzRzwtw==", + "version": "1.4.113", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.113.tgz", + "integrity": "sha512-s30WKxp27F3bBH6fA07FYL2Xm/FYnYrKpMjHr3XVCTUb9anAyZn/BeZfPWgTZGAbJeT4NxNwISSbLcYZvggPMA==", "dev": true }, "node_modules/elliptic": { @@ -7422,9 +7422,9 @@ } }, "electron-to-chromium": { - "version": "1.4.111", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.111.tgz", - "integrity": "sha512-/s3+fwhKf1YK4k7btOImOzCQLpUjS6MaPf0ODTNuT4eTM1Bg4itBpLkydhOzJmpmH6Z9eXFyuuK5czsmzRzwtw==", + "version": "1.4.113", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.113.tgz", + "integrity": "sha512-s30WKxp27F3bBH6fA07FYL2Xm/FYnYrKpMjHr3XVCTUb9anAyZn/BeZfPWgTZGAbJeT4NxNwISSbLcYZvggPMA==", "dev": true }, "elliptic": { diff --git a/package.json b/package.json index d00a4d82..4214aaa6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@elrondnetwork/erdjs", - "version": "10.1.1", + "version": "10.1.2", "description": "Smart Contracts interaction framework", "main": "out/index.js", "types": "out/index.d.js", diff --git a/src/smartcontracts/typesystem/abiRegistry.spec.ts b/src/smartcontracts/typesystem/abiRegistry.spec.ts index 30e41de6..fb2cd76e 100644 --- a/src/smartcontracts/typesystem/abiRegistry.spec.ts +++ b/src/smartcontracts/typesystem/abiRegistry.spec.ts @@ -30,6 +30,10 @@ describe("test abi registry", () => { let start = lottery.getEndpoint("start"); let getStatus = lottery.getEndpoint("status"); let getLotteryInfo = lottery.getEndpoint("getLotteryInfo"); + + assert.isFalse(start.modifiers.isReadonly()); + assert.isTrue(getStatus.modifiers.isReadonly()); + assert.isTrue(getLotteryInfo.modifiers.isReadonly()); assert.instanceOf(start.input[0].type, BytesType); assert.instanceOf(start.input[1].type, TokenIdentifierType); assert.instanceOf(start.input[2].type, BigUIntType); diff --git a/src/smartcontracts/typesystem/endpoint.ts b/src/smartcontracts/typesystem/endpoint.ts index 280c2333..a87f56ac 100644 --- a/src/smartcontracts/typesystem/endpoint.ts +++ b/src/smartcontracts/typesystem/endpoint.ts @@ -23,7 +23,7 @@ export class EndpointDefinition { static fromJSON(json: { name: string, - storageModifier: string, + mutability: string, payableInTokens: string[], inputs: any[], outputs: [] @@ -35,18 +35,18 @@ export class EndpointDefinition { let input = json.inputs.map(param => EndpointParameterDefinition.fromJSON(param)); let output = json.outputs.map(param => EndpointParameterDefinition.fromJSON(param)); - let modifiers = new EndpointModifiers(json.storageModifier, json.payableInTokens); + let modifiers = new EndpointModifiers(json.mutability, json.payableInTokens); return new EndpointDefinition(json.name, input, output, modifiers); } } export class EndpointModifiers { - readonly storageModifier: string; + readonly mutability: string; readonly payableInTokens: string[]; - constructor(storageModifier: string, payableInTokens: string[]) { - this.storageModifier = storageModifier || ""; + constructor(mutability: string, payableInTokens: string[]) { + this.mutability = mutability || ""; this.payableInTokens = payableInTokens || []; } @@ -75,7 +75,7 @@ export class EndpointModifiers { } isReadonly() { - return this.storageModifier == "readonly"; + return this.mutability == "readonly"; } }