@stellar/stellar-base 14.0.3 → 14.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/address.js CHANGED
@@ -228,7 +228,10 @@ var Address = exports.Address = /*#__PURE__*/function () {
228
228
  return Address.muxedAccount(raw);
229
229
  }
230
230
  case _xdr["default"].ScAddressType.scAddressTypeClaimableBalance().value:
231
- return Address.claimableBalance(scAddress.claimableBalanceId());
231
+ {
232
+ var cbi = scAddress.claimableBalanceId();
233
+ return Address.claimableBalance(Buffer.concat([Buffer.from([cbi["switch"]().value]), cbi.v0()]));
234
+ }
232
235
  case _xdr["default"].ScAddressType.scAddressTypeLiquidityPool().value:
233
236
  return Address.liquidityPool(scAddress.liquidityPoolId());
234
237
  default:
package/lib/soroban.js CHANGED
@@ -38,6 +38,8 @@ var Soroban = exports.Soroban = /*#__PURE__*/function () {
38
38
  * @throws {TypeError} if the given amount has a decimal point already
39
39
  * @example
40
40
  * formatTokenAmount("123000", 4) === "12.3";
41
+ * formatTokenAmount("123000", 3) === "123.0";
42
+ * formatTokenAmount("123", 3) === "0.123";
41
43
  */
42
44
  function formatTokenAmount(amount, decimals) {
43
45
  if (amount.includes('.')) {
@@ -51,9 +53,9 @@ var Soroban = exports.Soroban = /*#__PURE__*/function () {
51
53
  formatted = [formatted.slice(0, -decimals), formatted.slice(-decimals)].join('.');
52
54
  }
53
55
  }
54
-
55
- // remove trailing zero if any
56
- return formatted.replace(/(\.\d*?)0+$/, '$1');
56
+ return formatted.replace(/(\.\d*?)0+$/, '$1') // strip trailing zeroes
57
+ .replace(/\.$/, '.0') // but keep at least one
58
+ .replace(/^\./, '0.'); // and a leading one
57
59
  }
58
60
 
59
61
  /**
@@ -84,7 +86,7 @@ var Soroban = exports.Soroban = /*#__PURE__*/function () {
84
86
  _value$split$slice2 = _toArray(_value$split$slice),
85
87
  whole = _value$split$slice2[0],
86
88
  fraction = _value$split$slice2[1],
87
- rest = _value$split$slice2.slice(2);
89
+ rest = _arrayLikeToArray(_value$split$slice2).slice(2);
88
90
  if (rest.length) {
89
91
  throw new Error("Invalid decimal value: ".concat(value));
90
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar/stellar-base",
3
- "version": "14.0.3",
3
+ "version": "14.0.4",
4
4
  "description": "Low-level support library for the Stellar network.",
5
5
  "main": "./lib/index.js",
6
6
  "browser": {
@@ -73,10 +73,10 @@
73
73
  "homepage": "https://github.com/stellar/js-stellar-base",
74
74
  "devDependencies": {
75
75
  "@babel/cli": "^7.28.3",
76
- "@babel/core": "^7.28.3",
77
- "@babel/eslint-parser": "^7.28.0",
76
+ "@babel/core": "^7.28.5",
77
+ "@babel/eslint-parser": "^7.28.5",
78
78
  "@babel/eslint-plugin": "^7.27.1",
79
- "@babel/preset-env": "^7.28.3",
79
+ "@babel/preset-env": "^7.28.5",
80
80
  "@babel/register": "^7.28.3",
81
81
  "@definitelytyped/dtslint": "^0.0.182",
82
82
  "@istanbuljs/nyc-config-babel": "3.0.0",
@@ -97,7 +97,7 @@
97
97
  "eslint-webpack-plugin": "^4.2.0",
98
98
  "ghooks": "^2.0.4",
99
99
  "husky": "^8.0.3",
100
- "jsdoc": "^4.0.4",
100
+ "jsdoc": "^4.0.5",
101
101
  "karma": "^6.4.4",
102
102
  "karma-chrome-launcher": "^3.1.0",
103
103
  "karma-coverage": "^2.2.1",
@@ -110,15 +110,15 @@
110
110
  "mocha": "^10.8.2",
111
111
  "node-polyfill-webpack-plugin": "^3.0.0",
112
112
  "nyc": "^15.1.0",
113
- "prettier": "^3.6.2",
113
+ "prettier": "^3.7.4",
114
114
  "randombytes": "^2.1.0",
115
115
  "sinon": "^16.1.0",
116
116
  "sinon-chai": "^3.7.0",
117
117
  "taffydb": "^2.7.3",
118
- "terser-webpack-plugin": "^5.3.14",
118
+ "terser-webpack-plugin": "^5.3.16",
119
119
  "ts-node": "^10.9.2",
120
120
  "typescript": "5.6.3",
121
- "webpack": "^5.101.2",
121
+ "webpack": "^5.104.1",
122
122
  "webpack-cli": "^5.1.1"
123
123
  },
124
124
  "dependencies": {