@piprail/sdk 2.13.1 → 2.14.0

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/dist/{algorand-TQCYK2XT.js → algorand-6J3IABVF.js} +12 -11
  3. package/dist/{algorand-AQK5EAUF.cjs → algorand-QU6G2DQZ.cjs} +43 -42
  4. package/dist/{aptos-RYQOSFBQ.js → aptos-DHOMTBLZ.js} +11 -10
  5. package/dist/{aptos-65UX7GKA.cjs → aptos-LFTQGBBK.cjs} +41 -40
  6. package/dist/{chunk-DCOUJZPL.cjs → chunk-GYM46G5L.cjs} +16 -0
  7. package/dist/{chunk-O32N6MFN.js → chunk-PAMKCWVW.js} +16 -0
  8. package/dist/index.cjs +484 -231
  9. package/dist/index.d.cts +270 -7
  10. package/dist/index.d.ts +270 -7
  11. package/dist/index.js +280 -27
  12. package/dist/{ledger-mF_SoiDB.d.ts → ledger-uFtXlIHY.d.cts} +31 -1
  13. package/dist/{ledger-mF_SoiDB.d.cts → ledger-uFtXlIHY.d.ts} +31 -1
  14. package/dist/{near-VDATC5AV.js → near-5PXTVQ47.js} +14 -5
  15. package/dist/{near-UDPFA6SV.cjs → near-YNNK7RW7.cjs} +39 -30
  16. package/dist/node.d.cts +2 -2
  17. package/dist/node.d.ts +2 -2
  18. package/dist/{solana-VYLWFNAH.js → solana-HITVI3HF.js} +22 -7
  19. package/dist/{solana-RQNXFCZO.cjs → solana-N3UCNCYE.cjs} +54 -39
  20. package/dist/{stellar-KBR4V77T.js → stellar-2QT6YYKN.js} +4 -4
  21. package/dist/{stellar-OK2HW5PZ.cjs → stellar-Y3SQN7S5.cjs} +23 -23
  22. package/dist/{sui-SVFBJFW5.cjs → sui-4AL4E6XU.cjs} +35 -27
  23. package/dist/{sui-BXHB6D3W.js → sui-FV5L6WF5.js} +20 -12
  24. package/dist/{ton-NNKQFQ6U.js → ton-5FWDQ4QR.js} +18 -7
  25. package/dist/{ton-D7YN6BGR.cjs → ton-5HDVOTMR.cjs} +33 -22
  26. package/dist/{tron-W2D5PQXV.js → tron-AZDY7BMQ.js} +10 -10
  27. package/dist/{tron-WZFU57NX.cjs → tron-TX2B4N2A.cjs} +39 -39
  28. package/dist/{xrpl-5NHY3NEL.cjs → xrpl-5TYDLQFS.cjs} +31 -31
  29. package/dist/{xrpl-37E23W53.js → xrpl-UJL5J7CY.js} +13 -13
  30. package/package.json +1 -1
@@ -143,8 +143,23 @@ function assertValidDecimals(decimals, fn) {
143
143
  );
144
144
  }
145
145
  }
146
+ function expandScientific(value) {
147
+ const m = /^(\d+)(?:\.(\d+))?[eE]([+-]?\d+)$/.exec(value);
148
+ if (!m) return value;
149
+ const [, whole = "", frac = "", expStr = "0"] = m;
150
+ const exp = Number(expStr);
151
+ if (!Number.isFinite(exp) || Math.abs(exp) > 1e3) {
152
+ throw new Error(`expandScientific: exponent out of range in "${value}".`);
153
+ }
154
+ const digits = whole + frac;
155
+ const pointPos = whole.length + exp;
156
+ if (pointPos <= 0) return `0.${"0".repeat(-pointPos)}${digits}`;
157
+ if (pointPos >= digits.length) return digits + "0".repeat(pointPos - digits.length);
158
+ return `${digits.slice(0, pointPos)}.${digits.slice(pointPos)}`;
159
+ }
146
160
  function parseUnits(value, decimals) {
147
161
  assertValidDecimals(decimals, "parseUnits");
162
+ value = expandScientific(value);
148
163
  if (!/^\d+(\.\d+)?$/.test(value)) {
149
164
  throw new Error(`parseUnits: "${value}" is not a non-negative decimal amount.`);
150
165
  }
@@ -159,6 +174,7 @@ function parseUnits(value, decimals) {
159
174
  }
160
175
  function floorUnits(value, decimals) {
161
176
  assertValidDecimals(decimals, "floorUnits");
177
+ value = expandScientific(value);
162
178
  if (!/^\d+(\.\d+)?$/.test(value)) {
163
179
  throw new Error(`floorUnits: "${value}" is not a non-negative decimal amount.`);
164
180
  }
@@ -143,8 +143,23 @@ function assertValidDecimals(decimals, fn) {
143
143
  );
144
144
  }
145
145
  }
146
+ function expandScientific(value) {
147
+ const m = /^(\d+)(?:\.(\d+))?[eE]([+-]?\d+)$/.exec(value);
148
+ if (!m) return value;
149
+ const [, whole = "", frac = "", expStr = "0"] = m;
150
+ const exp = Number(expStr);
151
+ if (!Number.isFinite(exp) || Math.abs(exp) > 1e3) {
152
+ throw new Error(`expandScientific: exponent out of range in "${value}".`);
153
+ }
154
+ const digits = whole + frac;
155
+ const pointPos = whole.length + exp;
156
+ if (pointPos <= 0) return `0.${"0".repeat(-pointPos)}${digits}`;
157
+ if (pointPos >= digits.length) return digits + "0".repeat(pointPos - digits.length);
158
+ return `${digits.slice(0, pointPos)}.${digits.slice(pointPos)}`;
159
+ }
146
160
  function parseUnits(value, decimals) {
147
161
  assertValidDecimals(decimals, "parseUnits");
162
+ value = expandScientific(value);
148
163
  if (!/^\d+(\.\d+)?$/.test(value)) {
149
164
  throw new Error(`parseUnits: "${value}" is not a non-negative decimal amount.`);
150
165
  }
@@ -159,6 +174,7 @@ function parseUnits(value, decimals) {
159
174
  }
160
175
  function floorUnits(value, decimals) {
161
176
  assertValidDecimals(decimals, "floorUnits");
177
+ value = expandScientific(value);
162
178
  if (!/^\d+(\.\d+)?$/.test(value)) {
163
179
  throw new Error(`floorUnits: "${value}" is not a non-negative decimal amount.`);
164
180
  }