From c42804ef774090365cfccede9a06f1997284acda Mon Sep 17 00:00:00 2001 From: Jan Hoffmann Date: Tue, 18 Jan 2022 15:08:54 +0100 Subject: [PATCH 1/2] fix for newTransferWithOptionalTransferId logic --- package-lock.json | 6 ++---- src/lib/DeployUtil.ts | 2 +- test/lib/DeployUtil.test.ts | 13 +++++++++++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 745a15254..cee83ac24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "casper-js-sdk", - "version": "2.7.2", + "version": "2.7.5", "license": "Apache 2.0", "dependencies": { "@ethersproject/bignumber": "^5.0.8", @@ -14,6 +14,7 @@ "@ethersproject/constants": "^5.0.5", "@open-rpc/client-js": "^1.6.2", "@types/eccrypto": "^1.1.2", + "@types/ws": "^8.2.2", "blakejs": "^1.1.0", "eccrypto": "^1.1.6", "eslint-plugin-prettier": "^3.4.0", @@ -34,7 +35,6 @@ "@types/humanize-duration": "^3.18.1", "@types/mocha": "^5.2.7", "@types/node": "^14.14.31", - "@types/ws": "^8.2.2", "@typescript-eslint/eslint-plugin": "^4.16.1", "@typescript-eslint/parser": "^4.16.1", "assert": "^2.0.0", @@ -858,7 +858,6 @@ "version": "8.2.2", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz", "integrity": "sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg==", - "dev": true, "dependencies": { "@types/node": "*" } @@ -9964,7 +9963,6 @@ "version": "8.2.2", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz", "integrity": "sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg==", - "dev": true, "requires": { "@types/node": "*" } diff --git a/src/lib/DeployUtil.ts b/src/lib/DeployUtil.ts index 0994facce..ff030284c 100644 --- a/src/lib/DeployUtil.ts +++ b/src/lib/DeployUtil.ts @@ -801,7 +801,7 @@ export class ExecutableDeployItem implements ToBytes { } else { runtimeArgs.insert( 'id', - CLValueBuilder.option(Some(new CLU64(id!)), new CLU64Type()) + CLValueBuilder.option(None, CLTypeBuilder.u64()) ); } diff --git a/test/lib/DeployUtil.test.ts b/test/lib/DeployUtil.test.ts index 475094e64..4f8d03eb2 100644 --- a/test/lib/DeployUtil.test.ts +++ b/test/lib/DeployUtil.test.ts @@ -314,6 +314,19 @@ describe('DeployUtil', () => { expect(badFn).to.throw('transfer-id missing in new transfer.'); }); + it('Should be able create new transfer without providing transfer-id using newTransferWithOptionalTransferId()', () => { + const recipientKey = Keys.Ed25519.new(); + const transferAmount = 10; + + const goodFn = () => DeployUtil.ExecutableDeployItem.newTransferWithOptionalTransferId( + transferAmount, + recipientKey.publicKey, + ); + + expect(goodFn).to.not.throw(); + + }); + it('newTransferToUniqAddress should construct proper deploy', () => { const senderKey = Keys.Ed25519.new(); const recipientKey = Keys.Ed25519.new(); From 9424612b4459832a6b009900d87969b519692ac5 Mon Sep 17 00:00:00 2001 From: Jan Hoffmann Date: Tue, 18 Jan 2022 15:12:45 +0100 Subject: [PATCH 2/2] version bump --- CHANGELOG.md | 13 +++++++++++++ package-lock.json | 2 +- package.json | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b31212e07..581bc8d17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ All notable changes to casper-js-sdk. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 2.7.6 + +### Fixed + +- Fixes wrong logic in newTransferWithOptionalTransferId() method. + +## 2.7.5 + +### Fixed + +- Fixes problems with Lists containing multiple Keys containing Hash or ByteArray. +- Fixes problem with ByteArray with size different than 32 bytes. + ## 2.7.4 ### Fixed diff --git a/package-lock.json b/package-lock.json index cee83ac24..88a942c6f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "casper-js-sdk", - "version": "2.7.5", + "version": "2.7.6", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index e4723b414..d6707a869 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "casper-js-sdk", - "version": "2.7.5", + "version": "2.7.6", "license": "Apache 2.0", "description": "SDK to interact with the Casper blockchain", "homepage": "https://github.com/casper-ecosystem/casper-js-sdk#README.md",