@swapkit/helpers 1.0.0-rc.1 → 1.0.0-rc.100

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 (40) hide show
  1. package/dist/index.js +2452 -0
  2. package/dist/index.js.map +30 -0
  3. package/package.json +26 -36
  4. package/src/helpers/__tests__/asset.test.ts +149 -105
  5. package/src/helpers/__tests__/memo.test.ts +52 -40
  6. package/src/helpers/__tests__/others.test.ts +42 -37
  7. package/src/helpers/__tests__/validators.test.ts +24 -0
  8. package/src/helpers/asset.ts +139 -91
  9. package/src/helpers/derivationPath.ts +53 -0
  10. package/src/helpers/liquidity.ts +50 -43
  11. package/src/helpers/memo.ts +31 -28
  12. package/src/helpers/others.ts +35 -57
  13. package/src/helpers/validators.ts +15 -6
  14. package/src/helpers/web3wallets.ts +177 -0
  15. package/src/index.ts +14 -8
  16. package/src/modules/__tests__/assetValue.test.ts +420 -117
  17. package/src/modules/__tests__/bigIntArithmetics.test.ts +30 -0
  18. package/src/modules/__tests__/swapKitNumber.test.ts +351 -149
  19. package/src/modules/assetValue.ts +243 -171
  20. package/src/modules/bigIntArithmetics.ts +313 -153
  21. package/src/modules/requestClient.ts +39 -0
  22. package/src/modules/swapKitError.ts +33 -5
  23. package/src/modules/swapKitNumber.ts +6 -3
  24. package/src/types/abis/erc20.ts +99 -0
  25. package/src/types/abis/mayaEvmVaults.ts +331 -0
  26. package/src/types/abis/tcEthVault.ts +496 -0
  27. package/src/types/chains.ts +220 -0
  28. package/src/types/commonTypes.ts +119 -0
  29. package/src/types/derivationPath.ts +56 -0
  30. package/src/types/errors/apiV1.ts +0 -0
  31. package/src/types/index.ts +10 -0
  32. package/src/types/network.ts +43 -0
  33. package/src/types/sdk.ts +44 -0
  34. package/src/types/tokens.ts +30 -0
  35. package/src/types/wallet.ts +47 -0
  36. package/LICENSE +0 -201
  37. package/dist/index.cjs +0 -1
  38. package/dist/index.d.ts +0 -333
  39. package/dist/index.es.js +0 -661
  40. package/src/helpers/number.ts +0 -40
@@ -0,0 +1,30 @@
1
+ import { describe, expect, test } from "bun:test";
2
+
3
+ import { formatBigIntToSafeValue } from "../bigIntArithmetics.ts";
4
+
5
+ describe("BigIntArithmatics", () => {
6
+ describe("formatBigIntToSafeValue", () => {
7
+ test("parse bigint with decimals to string", () => {
8
+ const safeValue1 = formatBigIntToSafeValue({
9
+ value: BigInt(0),
10
+ decimal: 6,
11
+ bigIntDecimal: 6,
12
+ });
13
+ expect(safeValue1).toBe("0");
14
+
15
+ const safeValue2 = formatBigIntToSafeValue({
16
+ value: BigInt(15),
17
+ decimal: 0,
18
+ bigIntDecimal: 0,
19
+ });
20
+ expect(safeValue2).toBe("15");
21
+
22
+ const safeValue3 = formatBigIntToSafeValue({
23
+ value: BigInt(123456789),
24
+ decimal: 4,
25
+ bigIntDecimal: 4,
26
+ });
27
+ expect(safeValue3).toBe("12345.6789");
28
+ });
29
+ });
30
+ });