Skip to content

Commit f98705f

Browse files
authored
Prepare the library for a v3.0.0 release. (#102)
* Upgrade all depenencies to their latest versions
1 parent 5dd43fb commit f98705f

File tree

4 files changed

+1034
-989
lines changed

4 files changed

+1034
-989
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,18 @@ project adheres to [Semantic Versioning](http://semver.org/).
66

77
## Unreleased
88

9+
10+
## [v3.0.0](https://github.com/stellar/js-xdr/compare/v2.0.0...v3.0.0)
11+
912
### Breaking Change
10-
- Add support for easily encoding integers larger than 32 bits ([#100](https://github.com/stellar/js-xdr/pull/100)).
13+
- Add support for easily encoding integers larger than 32 bits ([#100](https://github.com/stellar/js-xdr/pull/100)). This (partially) breaks the API for creating `Hyper` and `UnsignedHyper` instances. Previously, you would pass `low` and `high` parts to represent the lower and upper 32 bits. Now, you can pass the entire 64-bit value directly as a `bigint` or `string` instance, or as a list of "chunks" like before, e.g.:
14+
15+
```diff
16+
-new Hyper({ low: 1, high: 1 }); // representing (1 << 32) + 1 = 4294967297n
17+
+new Hyper(4294967297n);
18+
+new Hyper("4294967297");
19+
+new Hyper(1, 1);
20+
```
1121

1222

1323
## [v2.0.0](https://github.com/stellar/js-xdr/compare/v1.3.0...v2.0.0)

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,16 @@ xdr.Int.fromXDR([0xff, 0xff, 0xff, 0xff]); // returns -1
4848
xdr.UnsignedInt.fromXDR([0xff, 0xff, 0xff, 0xff]); // returns 4294967295
4949

5050
// XDR Hypers, however, cannot be safely represented in the 53-bits
51-
// of precision we get with javascript numbers, and so we have a custom class
52-
// for those numbers. Hyper and UnsignedHyper both use
53-
//https://www.npmjs.com/package/long to represent the 64-bit numbers
54-
51+
// of precision we get with a JavaScript `Number`, so we allow creation from big-endian arrays of numbers, strings, or bigints.
5552
var result = xdr.Hyper.fromXDR([0, 0, 0, 0, 0, 0, 0, 0]); // returns an instance of xdr.Hyper
53+
result = new xdr.Hyper(0); // equivalent
5654

5755
// convert the hyper to a string
5856
result.toString(); // return '0'
5957

6058
// math!
61-
var ten = result.add(10);
62-
var minusone = result.subtract(1);
59+
var ten = result.toBigInt() + 10;
60+
var minusone = result.toBigInt() - 1;
6361

6462
// construct a number from a string
6563
var big = xdr.Hyper.fromString('1099511627776');

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-xdr",
3-
"version": "2.0.0",
3+
"version": "3.0.0",
44
"description": "Read/write XDR encoded data structures (RFC 4506)",
55
"main": "lib/xdr.js",
66
"browser": "dist/xdr.js",
@@ -55,7 +55,7 @@
5555
"babel-loader": "^9.1.2",
5656
"buffer": "^6.0.3",
5757
"chai": "^4.3.7",
58-
"eslint": "^8.39.0",
58+
"eslint": "^8.43.0",
5959
"eslint-config-airbnb-base": "^15.0.0",
6060
"eslint-config-prettier": "^8.8.0",
6161
"eslint-plugin-import": "^2.27.5",
@@ -69,13 +69,13 @@
6969
"karma-mocha": "^2.0.1",
7070
"karma-sinon-chai": "^2.0.2",
7171
"karma-webpack": "^5.0.0",
72-
"lint-staged": "13.2.1",
72+
"lint-staged": "13.2.2",
7373
"mocha": "^10.2.0",
7474
"prettier": "^2.8.7",
75-
"sinon": "^15.0.4",
75+
"sinon": "^15.2.0",
7676
"sinon-chai": "^3.7.0",
7777
"terser-webpack-plugin": "^5.3.7",
78-
"webpack": "^5.80.0",
78+
"webpack": "^5.88.0",
7979
"webpack-cli": "^5.0.2"
8080
}
8181
}

0 commit comments

Comments
 (0)