Skip to content

Commit

Permalink
Merge pull request #1871 from aeternity/release/13.2.1
Browse files Browse the repository at this point in the history
Release 13.2.1
  • Loading branch information
davidyuk authored Jul 29, 2023
2 parents 3cf8c77 + e99d169 commit 5df22dd
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
7 changes: 7 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [13.2.1](https://github.com/aeternity/aepp-sdk-js/compare/v13.2.0...v13.2.1) (2023-07-28)


### Bug Fixes

* use `Number` instead of unary plus for BigInt ([33fcfb4](https://github.com/aeternity/aepp-sdk-js/commit/33fcfb452b7340b73a13300e19cfeb83a94406c2))

## [13.2.0](https://github.com/aeternity/aepp-sdk-js/compare/v13.1.0...v13.2.0) (2023-07-28)


Expand Down
4 changes: 2 additions & 2 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": "@aeternity/aepp-sdk",
"version": "13.2.0",
"version": "13.2.1",
"description": "SDK for the æternity blockchain",
"main": "dist/aepp-sdk.js",
"types": "es/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/contract/Contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ class Contract<M extends ContractMethodsBase> {

if (fn == null) throw new MissingFunctionNameError();
if (fn === 'init' && callStatic !== true) throw new InvalidMethodInvocationError('"init" can be called only via dryRun');
if (fn !== 'init' && opt.amount != null && +opt.amount > 0 && !fnAci.payable) {
if (fn !== 'init' && opt.amount != null && Number(opt.amount) > 0 && !fnAci.payable) {
throw new NotPayableFunctionError(opt.amount, fn);
}

Expand Down
2 changes: 1 addition & 1 deletion src/tx/builder/field-types/u-int.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { toBytes } from '../../../utils/bytes';

export default {
serialize(value: Int): Buffer {
if (+value < 0) throw new ArgumentError('value', 'greater or equal to 0', value);
if (Number(value) < 0) throw new ArgumentError('value', 'greater or equal to 0', value);
return toBytes(value, true);
},

Expand Down
9 changes: 9 additions & 0 deletions test/integration/contract-aci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,15 @@ describe('Contract instance', () => {
balanceAfter.should.be.equal(`${+contractBalance + 100}`);
});

it('pays to payable function using BigInt', async () => {
assertNotNull(testContract.$options.address);
const contractBalance = await aeSdk.getBalance(testContract.$options.address);
// bigint is not assignable to amount
await testContract.stringFn('test', { amount: 100n as unknown as string, callStatic: false });
const balanceAfter = await aeSdk.getBalance(testContract.$options.address);
balanceAfter.should.be.equal(`${+contractBalance + 100}`);
});

it('calls on specific account', async () => {
const onAccount = aeSdk.accounts[aeSdk.addresses()[1]];
const { result } = await testContract.intFn(123, { onAccount });
Expand Down

0 comments on commit 5df22dd

Please sign in to comment.