Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 4 additions & 0 deletions src/smartcontracts/typesystem/abiRegistry.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions src/smartcontracts/typesystem/endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class EndpointDefinition {

static fromJSON(json: {
name: string,
storageModifier: string,
mutability: string,
payableInTokens: string[],
inputs: any[],
outputs: []
Expand All @@ -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 || [];
}

Expand Down Expand Up @@ -75,7 +75,7 @@ export class EndpointModifiers {
}

isReadonly() {
return this.storageModifier == "readonly";
return this.mutability == "readonly";
}
}

Expand Down