@piprail/sdk 2.7.0 → 2.9.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 (35) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/README.md +5 -3
  3. package/dist/{algorand-WB6PBJU4.js → algorand-AA3WXKW4.js} +1 -1
  4. package/dist/{algorand-TMA62DN2.cjs → algorand-FCEECDG6.cjs} +32 -32
  5. package/dist/{aptos-JQMZNTMD.cjs → aptos-GHJPO6JJ.cjs} +31 -31
  6. package/dist/{aptos-QAAXIUY3.js → aptos-LY67Q6QF.js} +1 -1
  7. package/dist/{chunk-JG6KRAW6.cjs → chunk-MWBT7MCE.cjs} +13 -1
  8. package/dist/chunk-O4UQOZ4Z.cjs +14 -0
  9. package/dist/{chunk-7XK22JSQ.js → chunk-SC2ZYDHD.js} +12 -0
  10. package/dist/chunk-SK3CB7UA.js +14 -0
  11. package/dist/index.cjs +754 -238
  12. package/dist/index.d.cts +2386 -2577
  13. package/dist/index.d.ts +2386 -2577
  14. package/dist/index.js +595 -79
  15. package/dist/ledger-BtzrfO-3.d.cts +658 -0
  16. package/dist/ledger-BtzrfO-3.d.ts +658 -0
  17. package/dist/{near-H5AQ253I.cjs → near-6KAQVVG2.cjs} +26 -26
  18. package/dist/{near-OTPQD6BI.js → near-FZBUICCS.js} +1 -1
  19. package/dist/node.cjs +38 -0
  20. package/dist/node.d.cts +16 -0
  21. package/dist/node.d.ts +16 -0
  22. package/dist/node.js +38 -0
  23. package/dist/{solana-3FMCWSEE.js → solana-ELUWO6N5.js} +33 -2
  24. package/dist/{solana-M3VOHCMO.cjs → solana-MYF4HBO4.cjs} +64 -33
  25. package/dist/{stellar-U5NCRIOJ.js → stellar-BEMT7UYF.js} +1 -1
  26. package/dist/{stellar-FW6C6FBE.cjs → stellar-SUKASK4N.cjs} +20 -20
  27. package/dist/{sui-Y53M4GUM.js → sui-F5JQ2N6I.js} +1 -1
  28. package/dist/{sui-47C2KEZI.cjs → sui-VE5LT7BL.cjs} +16 -16
  29. package/dist/{ton-5ZPT5PSP.js → ton-7GKCTC5H.js} +11 -7
  30. package/dist/{ton-MMPKWT6N.cjs → ton-AOR3EURW.cjs} +25 -21
  31. package/dist/{tron-JOT4STIG.cjs → tron-EMFXDFHW.cjs} +24 -24
  32. package/dist/{tron-WYS4X2I5.js → tron-ZZZS3FNN.js} +1 -1
  33. package/dist/{xrpl-2MZEOIFY.js → xrpl-DD7TJL5L.js} +1 -1
  34. package/dist/{xrpl-PECT4IMX.cjs → xrpl-Y6SQNYLC.cjs} +20 -20
  35. package/package.json +11 -1
@@ -133,7 +133,16 @@ function rejectForeignToken(token, family, network) {
133
133
  }
134
134
 
135
135
  // src/util/units.ts
136
+ var MAX_DECIMALS = 100;
137
+ function assertValidDecimals(decimals, fn) {
138
+ if (!Number.isSafeInteger(decimals) || decimals < 0 || decimals > MAX_DECIMALS) {
139
+ throw new Error(
140
+ `${fn}: decimals must be a non-negative integer \u2264 ${MAX_DECIMALS} (got ${decimals}).`
141
+ );
142
+ }
143
+ }
136
144
  function parseUnits(value, decimals) {
145
+ assertValidDecimals(decimals, "parseUnits");
137
146
  if (!/^\d+(\.\d+)?$/.test(value)) {
138
147
  throw new Error(`parseUnits: "${value}" is not a non-negative decimal amount.`);
139
148
  }
@@ -147,6 +156,7 @@ function parseUnits(value, decimals) {
147
156
  return BigInt(whole + fracPadded);
148
157
  }
149
158
  function floorUnits(value, decimals) {
159
+ assertValidDecimals(decimals, "floorUnits");
150
160
  if (!/^\d+(\.\d+)?$/.test(value)) {
151
161
  throw new Error(`floorUnits: "${value}" is not a non-negative decimal amount.`);
152
162
  }
@@ -155,6 +165,7 @@ function floorUnits(value, decimals) {
155
165
  return BigInt(whole + fracTrunc);
156
166
  }
157
167
  function formatUnits(value, decimals) {
168
+ assertValidDecimals(decimals, "formatUnits");
158
169
  const negative = value < 0n;
159
170
  const digits = (negative ? -value : value).toString().padStart(decimals + 1, "0");
160
171
  const whole = digits.slice(0, digits.length - decimals);
@@ -208,6 +219,7 @@ export {
208
219
  UnsupportedNetworkError,
209
220
  assertNoLegacyWalletKey,
210
221
  rejectForeignToken,
222
+ MAX_DECIMALS,
211
223
  parseUnits,
212
224
  floorUnits,
213
225
  formatUnits,
@@ -0,0 +1,14 @@
1
+ // src/spendstore.ts
2
+ function memorySpendStore(seed = []) {
3
+ const records = [...seed];
4
+ return {
5
+ load: () => [...records],
6
+ append: (r) => {
7
+ records.push(r);
8
+ }
9
+ };
10
+ }
11
+
12
+ export {
13
+ memorySpendStore
14
+ };