@moon-cx/sdk 0.0.0-stage → 2.0.1

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 (155) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +2 -2
  3. package/dist/adapters/sender.d.ts +88 -0
  4. package/dist/adapters/sender.d.ts.map +1 -0
  5. package/dist/adapters/sender.js +62 -0
  6. package/dist/adapters/sender.js.map +1 -0
  7. package/dist/adapters/tonclient.d.ts +13 -0
  8. package/dist/adapters/tonclient.d.ts.map +1 -0
  9. package/dist/adapters/tonclient.js +17 -0
  10. package/dist/adapters/tonclient.js.map +1 -0
  11. package/dist/api/index.d.ts +210 -0
  12. package/dist/api/index.d.ts.map +1 -0
  13. package/dist/api/index.js +364 -0
  14. package/dist/api/index.js.map +1 -0
  15. package/dist/codec/bins.d.ts +26 -0
  16. package/dist/codec/bins.d.ts.map +1 -0
  17. package/dist/codec/bins.js +67 -0
  18. package/dist/codec/bins.js.map +1 -0
  19. package/dist/codec/clmm.d.ts +87 -0
  20. package/dist/codec/clmm.d.ts.map +1 -0
  21. package/dist/codec/clmm.js +119 -0
  22. package/dist/codec/clmm.js.map +1 -0
  23. package/dist/codec/cpmm.d.ts +112 -0
  24. package/dist/codec/cpmm.d.ts.map +1 -0
  25. package/dist/codec/cpmm.js +146 -0
  26. package/dist/codec/cpmm.js.map +1 -0
  27. package/dist/codec/jetton.d.ts +30 -0
  28. package/dist/codec/jetton.d.ts.map +1 -0
  29. package/dist/codec/jetton.js +37 -0
  30. package/dist/codec/jetton.js.map +1 -0
  31. package/dist/codec/mempad.d.ts +109 -0
  32. package/dist/codec/mempad.d.ts.map +1 -0
  33. package/dist/codec/mempad.js +162 -0
  34. package/dist/codec/mempad.js.map +1 -0
  35. package/dist/core/amount.d.ts +33 -0
  36. package/dist/core/amount.d.ts.map +1 -0
  37. package/dist/core/amount.js +81 -0
  38. package/dist/core/amount.js.map +1 -0
  39. package/dist/core/asset.d.ts +82 -0
  40. package/dist/core/asset.d.ts.map +1 -0
  41. package/dist/core/asset.js +143 -0
  42. package/dist/core/asset.js.map +1 -0
  43. package/dist/core/errors.d.ts +70 -0
  44. package/dist/core/errors.d.ts.map +1 -0
  45. package/dist/core/errors.js +114 -0
  46. package/dist/core/errors.js.map +1 -0
  47. package/dist/core/fee.d.ts +36 -0
  48. package/dist/core/fee.d.ts.map +1 -0
  49. package/dist/core/fee.js +40 -0
  50. package/dist/core/fee.js.map +1 -0
  51. package/dist/core/gas.d.ts +112 -0
  52. package/dist/core/gas.d.ts.map +1 -0
  53. package/dist/core/gas.js +265 -0
  54. package/dist/core/gas.js.map +1 -0
  55. package/dist/core/percent.d.ts +27 -0
  56. package/dist/core/percent.d.ts.map +1 -0
  57. package/dist/core/percent.js +71 -0
  58. package/dist/core/percent.js.map +1 -0
  59. package/dist/core/tx.d.ts +36 -0
  60. package/dist/core/tx.d.ts.map +1 -0
  61. package/dist/core/tx.js +17 -0
  62. package/dist/core/tx.js.map +1 -0
  63. package/dist/index.d.ts +63 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +41 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/jetton/index.d.ts +53 -0
  68. package/dist/jetton/index.d.ts.map +1 -0
  69. package/dist/jetton/index.js +90 -0
  70. package/dist/jetton/index.js.map +1 -0
  71. package/dist/math/clmm-swap.d.ts +80 -0
  72. package/dist/math/clmm-swap.d.ts.map +1 -0
  73. package/dist/math/clmm-swap.js +277 -0
  74. package/dist/math/clmm-swap.js.map +1 -0
  75. package/dist/math/clmm.d.ts +234 -0
  76. package/dist/math/clmm.d.ts.map +1 -0
  77. package/dist/math/clmm.js +270 -0
  78. package/dist/math/clmm.js.map +1 -0
  79. package/dist/math/cpmm.d.ts +170 -0
  80. package/dist/math/cpmm.d.ts.map +1 -0
  81. package/dist/math/cpmm.js +175 -0
  82. package/dist/math/cpmm.js.map +1 -0
  83. package/dist/math/integer.d.ts +10 -0
  84. package/dist/math/integer.d.ts.map +1 -0
  85. package/dist/math/integer.js +44 -0
  86. package/dist/math/integer.js.map +1 -0
  87. package/dist/math/q128.d.ts +45 -0
  88. package/dist/math/q128.d.ts.map +1 -0
  89. package/dist/math/q128.js +108 -0
  90. package/dist/math/q128.js.map +1 -0
  91. package/dist/moon.d.ts +245 -0
  92. package/dist/moon.d.ts.map +1 -0
  93. package/dist/moon.js +332 -0
  94. package/dist/moon.js.map +1 -0
  95. package/dist/ops/jetton-input.d.ts +3 -0
  96. package/dist/ops/jetton-input.d.ts.map +1 -0
  97. package/dist/ops/jetton-input.js +8 -0
  98. package/dist/ops/jetton-input.js.map +1 -0
  99. package/dist/ops/liquidity.d.ts +157 -0
  100. package/dist/ops/liquidity.d.ts.map +1 -0
  101. package/dist/ops/liquidity.js +413 -0
  102. package/dist/ops/liquidity.js.map +1 -0
  103. package/dist/ops/mempad.d.ts +143 -0
  104. package/dist/ops/mempad.d.ts.map +1 -0
  105. package/dist/ops/mempad.js +248 -0
  106. package/dist/ops/mempad.js.map +1 -0
  107. package/dist/ops/pool.d.ts +75 -0
  108. package/dist/ops/pool.d.ts.map +1 -0
  109. package/dist/ops/pool.js +129 -0
  110. package/dist/ops/pool.js.map +1 -0
  111. package/dist/ops/position.d.ts +47 -0
  112. package/dist/ops/position.d.ts.map +1 -0
  113. package/dist/ops/position.js +73 -0
  114. package/dist/ops/position.js.map +1 -0
  115. package/dist/ops/swap.d.ts +104 -0
  116. package/dist/ops/swap.d.ts.map +1 -0
  117. package/dist/ops/swap.js +248 -0
  118. package/dist/ops/swap.js.map +1 -0
  119. package/dist/pool/amounts.d.ts +36 -0
  120. package/dist/pool/amounts.d.ts.map +1 -0
  121. package/dist/pool/amounts.js +68 -0
  122. package/dist/pool/amounts.js.map +1 -0
  123. package/dist/pool/assets.d.ts +45 -0
  124. package/dist/pool/assets.d.ts.map +1 -0
  125. package/dist/pool/assets.js +57 -0
  126. package/dist/pool/assets.js.map +1 -0
  127. package/dist/pool/clmm.d.ts +309 -0
  128. package/dist/pool/clmm.d.ts.map +1 -0
  129. package/dist/pool/clmm.js +561 -0
  130. package/dist/pool/clmm.js.map +1 -0
  131. package/dist/pool/cpmm.d.ts +228 -0
  132. package/dist/pool/cpmm.d.ts.map +1 -0
  133. package/dist/pool/cpmm.js +332 -0
  134. package/dist/pool/cpmm.js.map +1 -0
  135. package/dist/protocol/generated.d.ts +2752 -0
  136. package/dist/protocol/generated.d.ts.map +1 -0
  137. package/dist/protocol/generated.js +3564 -0
  138. package/dist/protocol/generated.js.map +1 -0
  139. package/dist/protocol/index.d.ts +19 -0
  140. package/dist/protocol/index.d.ts.map +1 -0
  141. package/dist/protocol/index.js +49 -0
  142. package/dist/protocol/index.js.map +1 -0
  143. package/dist/state/address.d.ts +121 -0
  144. package/dist/state/address.d.ts.map +1 -0
  145. package/dist/state/address.js +143 -0
  146. package/dist/state/address.js.map +1 -0
  147. package/dist/state/source.d.ts +26 -0
  148. package/dist/state/source.d.ts.map +1 -0
  149. package/dist/state/source.js +32 -0
  150. package/dist/state/source.js.map +1 -0
  151. package/dist/state/storage.d.ts +218 -0
  152. package/dist/state/storage.d.ts.map +1 -0
  153. package/dist/state/storage.js +273 -0
  154. package/dist/state/storage.js.map +1 -0
  155. package/package.json +74 -4
@@ -0,0 +1,44 @@
1
+ /** Integer arithmetic matching the on-chain math bit for bit. */
2
+ /** On-chain `mulDivFloor`: full-precision multiply, then floor division. */
3
+ export function mulDivFloor(a, b, denominator) {
4
+ if (denominator === 0n)
5
+ throw new RangeError('division by zero');
6
+ return (a * b) / denominator;
7
+ }
8
+ /** Like {@link mulDivFloor}, but rounds up. */
9
+ export function mulDivCeil(a, b, denominator) {
10
+ if (denominator === 0n)
11
+ throw new RangeError('division by zero');
12
+ const product = a * b;
13
+ return product / denominator + (product % denominator === 0n ? 0n : 1n);
14
+ }
15
+ /** Integer square root: the largest `r` such that `r² ≤ value`. */
16
+ export function isqrt(value) {
17
+ if (value < 0n)
18
+ throw new RangeError('square root of a negative number');
19
+ if (value < 2n)
20
+ return value;
21
+ // Start at or above the root: 2^ceil(bits/2) ≥ sqrt(value).
22
+ let guess = 1n << (BigInt(value.toString(2).length) / 2n + 1n);
23
+ let previous = 0n;
24
+ // Newton decreases monotonically from above; stop once it stops decreasing.
25
+ while (guess !== previous) {
26
+ previous = guess;
27
+ guess = (guess + value / guess) / 2n;
28
+ if (guess >= previous)
29
+ break;
30
+ }
31
+ let result = previous < guess ? previous : guess;
32
+ while (result * result > value)
33
+ result -= 1n;
34
+ while ((result + 1n) * (result + 1n) <= value)
35
+ result += 1n;
36
+ return result;
37
+ }
38
+ export function min(a, b) {
39
+ return a < b ? a : b;
40
+ }
41
+ export function max(a, b) {
42
+ return a > b ? a : b;
43
+ }
44
+ //# sourceMappingURL=integer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integer.js","sourceRoot":"","sources":["../../src/math/integer.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAEjE,4EAA4E;AAC5E,MAAM,UAAU,WAAW,CAAC,CAAS,EAAE,CAAS,EAAE,WAAmB;IACnE,IAAI,WAAW,KAAK,EAAE;QAAE,MAAM,IAAI,UAAU,CAAC,kBAAkB,CAAC,CAAA;IAChE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAA;AAC9B,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,UAAU,CAAC,CAAS,EAAE,CAAS,EAAE,WAAmB;IAClE,IAAI,WAAW,KAAK,EAAE;QAAE,MAAM,IAAI,UAAU,CAAC,kBAAkB,CAAC,CAAA;IAChE,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,CAAA;IACrB,OAAO,OAAO,GAAG,WAAW,GAAG,CAAC,OAAO,GAAG,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AACzE,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,KAAK,CAAC,KAAa;IACjC,IA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ions used on chain.
3
+ *
4
+ * CLMM stores prices as 128-bit fixed-point square roots, and the rounding
5
+ * mode of every operation is part of the protocol: the range uses `MULRSHIFTR#`
6
+ * (nearest) in one place and `MULRSHIFT#` (floor) in another, and swapping them
7
+ * moves bin boundaries. Each function below states which instruction it mirrors.
8
+ */
9
+ export declare const SCALE_BITS = 128n;
10
+ /** 2^128 — one, in Q128. */
11
+ export declare const SCALE: bigint;
12
+ /** Division that rounds toward negative infinity, as TVM's `DIV` does. */
13
+ export declare function floorDiv(a: bigint, b: bigint): bigint;
14
+ /** On-chain `mulDivFloor`. */
15
+ export declare function mulDivFloor(a: bigint, b: bigint, d: bigint): bigint;
16
+ /** On-chain `mulDivCeil`. */
17
+ export declare function mulDivCeil(a: bigint, b: bigint, d: bigint): bigint;
18
+ /** `q128Mul` — `128 MULRSHIFTR#`, rounds to nearest. */
19
+ export declare function q128Mul(a: bigint, b: bigint): bigint;
20
+ /** `q128MulFloor` — `128 MULRSHIFT#`. */
21
+ export declare function q128MulFloor(a: bigint, b: bigint): bigint;
22
+ /** `q128MulCeil`. */
23
+ export declare function q128MulCeil(a: bigint, b: bigint): bigint;
24
+ /** `q128Div` — `128 LSHIFT#DIVR`, rounds to nearest. */
25
+ export declare function q128Div(a: bigint, b: bigint): bigint;
26
+ /** `q128DivFloor` — `128 LSHIFT#DIV`. */
27
+ export declare function q128DivFloor(a: bigint, b: bigint): bigint;
28
+ /** `q128DivCeil` — `128 LSHIFT#DIVC`. */
29
+ export declare function q128DivCeil(a: bigint, b: bigint): bigint;
30
+ /**
31
+ * `q128Pow` — binary exponentiation in Q128, negative exponents inverted.
32
+ *
33
+ * Rounding accumulates across the squarings exactly as on chain; this is
34
+ * deliberate, matching the range matters more than matching the real value.
35
+ */
36
+ export declare function q128Pow(base: bigint, exponent: bigint): bigint;
37
+ /**
38
+ * `q128Sqrt` — square root in Q128.
39
+ *
40
+ * Mirrors the on-chain routine literally, including the fixed count of six
41
+ * Newton steps. The loop does not run to convergence, so replacing it with a
42
+ * converging one would give a different answer from the range on some inputs.
43
+ */
44
+ export declare function q128Sqrt(raw: bigint): bigint;
45
+ //# sourceMappingURL=q128.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"q128.d.ts","sourceRoot":"","sources":["../../src/math/q128.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,UAAU,OAAO,CAAA;AAC9B,4BAA4B;AAC5B,eAAO,MAAM,KAAK,QAAmB,CAAA;AAErC,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAIrD;AAaD,8BAA8B;AAC9B,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,6BAA6B;AAC7B,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wDAAwD;AACxD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,yCAAyC;AACzC,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,qBAAqB;AACrB,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wDAAwD;AACxD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,yCAAyC;AACzC,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,yCAAyC;AACzC,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAExD;AAQD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAY9D;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAa5C"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Q128 fixed-point arithmetic, matching the TVM instructions used on chain.
3
+ *
4
+ * CLMM stores prices as 128-bit fixed-point square roots, and the rounding
5
+ * mode of every operation is part of the protocol: the range uses `MULRSHIFTR#`
6
+ * (nearest) in one place and `MULRSHIFT#` (floor) in another, and swapping them
7
+ * moves bin boundaries. Each function below states which instruction it mirrors.
8
+ */
9
+ export const SCALE_BITS = 128n;
10
+ /** 2^128 — one, in Q128. */
11
+ export const SCALE = 1n << SCALE_BITS;
12
+ /** Division that rounds toward negative infinity, as TVM's `DIV` does. */
13
+ export function floorDiv(a, b) {
14
+ if (b === 0n)
15
+ throw new RangeError('division by zero');
16
+ const quotient = a / b;
17
+ return (a % b !== 0n) && (a < 0n) !== (b < 0n) ? quotient - 1n : quotient;
18
+ }
19
+ /** Rounds to nearest, halves away from negative infinity — TVM's `R` modes. */
20
+ function divRound(a, b) {
21
+ if (b === 0n)
22
+ throw new RangeError('division by zero');
23
+ return floorDiv(2n * a + b, 2n * b);
24
+ }
25
+ function divCeil(a, b) {
26
+ if (b === 0n)
27
+ throw new RangeError('division by zero');
28
+ return -floorDiv(-a, b);
29
+ }
30
+ /** On-chain `mulDivFloor`. */
31
+ export function mulDivFloor(a, b, d) {
32
+ return floorDiv(a * b, d);
33
+ }
34
+ /** On-chain `mulDivCeil`. */
35
+ export function mulDivCeil(a, b, d) {
36
+ return divCeil(a * b, d);
37
+ }
38
+ /** `q128Mul` — `128 MULRSHIFTR#`, rounds to nearest. */
39
+ export function q128Mul(a, b) {
40
+ return divRound(a * b, SCALE);
41
+ }
42
+ /** `q128MulFloor` — `128 MULRSHIFT#`. */
43
+ export function q128MulFloor(a, b) {
44
+ return floorDiv(a * b, SCALE);
45
+ }
46
+ /** `q128MulCeil`. */
47
+ export function q128MulCeil(a, b) {
48
+ return mulDivCeil(a, b, SCALE);
49
+ }
50
+ /** `q128Div` — `128 LSHIFT#DIVR`, rounds to nearest. */
51
+ export function q128Div(a, b) {
52
+ return divRound(a << SCALE_BITS, b);
53
+ }
54
+ /** `q128DivFloor` — `128 LSHIFT#DIV`. */
55
+ export function q128DivFloor(a, b) {
56
+ return floorDiv(a << SCALE_BITS, b);
57
+ }
58
+ /** `q128DivCeil` — `128 LSHIFT#DIVC`. */
59
+ export function q128DivCeil(a, b) {
60
+ return divCeil(a << SCALE_BITS, b);
61
+ }
62
+ /** Bit length, as TVM's `UBITSIZE`. */
63
+ function bitLength(value) {
64
+ if (value < 0n)
65
+ throw new RangeError('bit length of a negative number');
66
+ return BigInt(value.toString(2).length);
67
+ }
68
+ /**
69
+ * `q128Pow` — binary exponentiation in Q128, negative exponents inverted.
70
+ *
71
+ * Rounding accumulates across the squarings exactly as on chain; this is
72
+ * deliberate, matching the range matters more than matching the real value.
73
+ */
74
+ export function q128Pow(base, exponent) {
75
+ if (exponent < 0n)
76
+ return q128Div(SCALE, q128Pow(base, -exponent));
77
+ let exp = exponent;
78
+ let acc = base;
79
+ let result = SCALE;
80
+ while (exp > 0n) {
81
+ if ((exp & 1n) !== 0n)
82
+ result = q128Mul(result, acc);
83
+ acc = q128Mul(acc, acc);
84
+ exp >>= 1n;
85
+ }
86
+ return result;
87
+ }
88
+ /**
89
+ * `q128Sqrt` — square root in Q128.
90
+ *
91
+ * Mirrors the on-chain routine literally, including the fixed count of six
92
+ * Newton steps. The loop does not run to convergence, so replacing it with a
93
+ * converging one would give a different answer from the range on some inputs.
94
+ */
95
+ export function q128Sqrt(raw) {
96
+ if (raw === 0n)
97
+ return 0n;
98
+ if (raw < 0n)
99
+ throw new RangeError('square root of a negative number');
100
+ const s = bitLength(raw);
101
+ const t = SCALE_BITS + 1n;
102
+ let x = s === t ? floorDiv(raw - SCALE, 2n) + SCALE : 1n << ((s + t) / 2n);
103
+ for (let i = 0; i < 6; i++) {
104
+ x += floorDiv(mulDivCeil(raw, SCALE, x) - x, 2n);
105
+ }
106
+ return x;
107
+ }
108
+ //# sourceMappingURL=q128.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"q128.js","sourceRoot":"","sources":["../../src/math/q128.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAA;AAC9B,4BAA4B;AAC5B,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,IAAI,UAAU,CAAA;AAErC,0EAA0E;AAC1E,MAAM,UAAU,QAAQ,CAAC,CAAS,EAAE,CAAS;IAC3C,IAAI,CAAC,KAAK,EAAE;QAAE,MAAM,IAAI,UAAU,CAAC,kBAAkB,CAAC,CAAA;IACtD,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,CAAA;IACtB,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAA;AAC3E,CAAC;AAED,+EAA+E;AAC/E,SAAS,QAAQ,CAAC,CAAS,EAAE,CAAS;IACpC,IAAI,CAAC,KAAK,EAAE;QAAE,MAAM,IAAI,UAAU,CAAC,kBAAkB,CAAC,CAAA;IACtD,OAAO,QAAQ,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAA;AACrC,CAAC;AAED,SAAS,OAAO,CAAC,CAAS,EAAE,CAAS;IACnC,IAAI,CAAC,KAAK,EAAE;QAAE,MAAM,IAAI,UAAU,CAAC,kBAAkB,CAAC,CAAA;IACtD,OAAO,CAAC,QAAQ,C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AI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAA;IAE1E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAA;IAClD,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC"}
package/dist/moon.d.ts ADDED
@@ -0,0 +1,245 @@
1
+ import { Address } from '@ton/core';
2
+ import { Asset } from './core/asset.ts';
3
+ import { MoonApi, type MoonApiOptions, type PoolInfo, type PoolList, type PoolProtocol, type PositionRecord } from './api/index.ts';
4
+ import type { CpmmPosition } from './pool/cpmm.ts';
5
+ import type { ClmmPosition } from './pool/clmm.ts';
6
+ import { type BinStep } from './math/clmm.ts';
7
+ import type { GasPrices } from './core/gas.ts';
8
+ import { type CpmmFeeBps, type CpmmPoolCreation, type ClmmPoolCreation } from './ops/pool.ts';
9
+ import { type CurveBuy, type CurveCreation, type CurveSell, type MempadFeeBps } from './ops/mempad.ts';
10
+ import type { LaunchMetadata } from './codec/mempad.ts';
11
+ import { type Operation, type Sender } from './adapters/sender.ts';
12
+ import { type TonClientLike } from './adapters/tonclient.ts';
13
+ import type { StateSource } from './state/source.ts';
14
+ import { CpmmPool } from './pool/cpmm.ts';
15
+ import { ClmmPool } from './pool/clmm.ts';
16
+ import { Jettons, type OpenableClient } from './jetton/index.ts';
17
+ export type MoonOptions = {
18
+ /**
19
+ * Where on-chain state comes from: a TonClient, or anything with `getAccountState`.
20
+ * A client that can also `open` jetton masters and wallets (TonClient can) enables
21
+ * jetton lookups: decimals, symbols and the sender's jetton wallets are read from
22
+ * the chain.
23
+ */
24
+ client: (TonClientLike | StateSource) | (TonClientLike & OpenableClient);
25
+ /**
26
+ * Pool discovery and, unless `factories` is set, the factory addresses for
27
+ * create* calls. Optional — pass `false` to work purely from addresses.
28
+ * The API is never used for quotes or transaction bodies.
29
+ */
30
+ api?: MoonApi | MoonApiOptions | false;
31
+ /**
32
+ * Factory addresses. By default each create* call reads them from `api`; pin them
33
+ * here to take the API out of deciding where create* funds go, or when `api: false`.
34
+ * Not bundled in the package: they are deployment configuration and differ per
35
+ * network. Every `create*` method also accepts `factory` to override.
36
+ */
37
+ factories?: {
38
+ cpmm?: Address;
39
+ clmm?: Address;
40
+ mempad?: Address;
41
+ };
42
+ /**
43
+ * Jetton lookups to use instead of the ones built from `client`.
44
+ *
45
+ * Off-chain jetton metadata means an HTTP or IPFS fetch with no timeout of its own;
46
+ * pass `new Jettons(client, { contentResolver })` to bound or redirect it. Also lets
47
+ * a bare state-source `client` read decimals from the chain.
48
+ */
49
+ jettons?: Jettons;
50
+ };
51
+ /**
52
+ * The entry point.
53
+ *
54
+ * ```ts
55
+ * const moon = new Moon({ client: new TonClient({ endpoint, apiKey }) })
56
+ * const [info] = await moon.api.findPools(TON, USDT, 'cpmm')
57
+ * const pool = await moon.cpmmPool(info)
58
+ * ```
59
+ */
60
+ export declare class Moon {
61
+ #private;
62
+ readonly state: StateSource;
63
+ /** Pool and position discovery. Throws when created with `api: false`. */
64
+ get api(): MoonApi;
65
+ /** Whether pool discovery is available at all. */
66
+ get hasApi(): boolean;
67
+ /**
68
+ * Jetton metadata and wallet lookups: `options.jettons`, or built from a client that
69
+ * can open jetton masters and wallets. `null` for a bare state source without
70
+ * `jettons`; then supply decimals and jetton wallet addresses yourself.
71
+ */
72
+ readonly jettons: Jettons | null;
73
+ /**
74
+ * The asset at this master, with decimals, symbol, name and image read from
75
+ * the chain through this Moon's client. Cached per master for the life of
76
+ * the Moon; a failed read is not cached.
77
+ *
78
+ * `null` or `'TON'` gives native TON without a request.
79
+ *
80
+ * @throws BuildError when the client cannot open jetton masters (a bare state
81
+ * source) and no `jettons` were given — build the asset yourself with
82
+ * `Asset.jetton(master, { decimals })`
83
+ * @throws JettonLookupError when the master cannot be read
84
+ */
85
+ asset(master: Address | string | null): Promise<Asset>;
86
+ /** Factory addresses given at construction. Per-call `factory` wins over these. */
87
+ readonly factories: {
88
+ cpmm?: Address;
89
+ clmm?: Address;
90
+ mempad?: Address;
91
+ };
92
+ constructor(options: MoonOptions);
93
+ /**
94
+ * The factory a create* call will use: the one passed to the call, else the one
95
+ * given to the constructor, else the one the API publishes (read per call).
96
+ * Throws a BuildError when none is available.
97
+ *
98
+ * An API-provided factory is only checked to parse as a factory, not to be the
99
+ * genuine moon.cx factory; pin `factories` to avoid trusting the API.
100
+ */
101
+ factoryAddress(protocol: 'cpmm' | 'clmm' | 'mempad', given?: Address): Promise<Address>;
102
+ /**
103
+ * Opens a CPMM pool by address, or by an entry from the listing.
104
+ *
105
+ * Token decimals are read from the jetton masters when this Moon has jetton lookups.
106
+ * Otherwise a listing entry's decimals are only used for display: they are `'listed'`
107
+ * in `pool.decimalsSource`, and amounts on those sides must be raw `bigint`.
108
+ *
109
+ * A listing entry must name the pool's own tokens in the pool's x/y order, or this throws.
110
+ */
111
+ cpmmPool(pool: Address | PoolInfo): Promise<CpmmPool>;
112
+ /**
113
+ * Opens a CLMM pool by address, or by an entry from the listing. Decimals
114
+ * and the entry's tokens are handled as in {@link cpmmPool}.
115
+ */
116
+ clmmPool(pool: Address | PoolInfo): Promise<ClmmPool>;
117
+ /**
118
+ * Opens a position from a listing record, resolving its pool and, for CLMM, its
119
+ * range from the bins it holds.
120
+ */
121
+ openPosition(record: PositionRecord): Promise<CpmmPosition | ClmmPosition>;
122
+ /**
123
+ * Creates a CPMM pool; the future pool address is returned in `details`.
124
+ *
125
+ * The pool address depends on the signing wallet, so pass `wallet`, or `sender`
126
+ * when signing elsewhere.
127
+ */
128
+ createCpmmPool(args: {
129
+ /** Defaults to `factories.cpmm`, else the factory the API publishes (see {@link Moon.factoryAddress}). */
130
+ factory?: Address;
131
+ assetA: Asset;
132
+ assetB: Asset;
133
+ /**
134
+ * Basis points: 10 = 0.10%, 20 = 0.20%, 30 = 0.30%, 50 = 0.50%,
135
+ * 100 = 1.00%, 200 = 2.00%. Write the number, or `FeeTier.Bps30`.
136
+ * Fixed forever at creation; there is no default.
137
+ */
138
+ feeBps: CpmmFeeBps;
139
+ wallet?: Sender;
140
+ /** The creating wallet, when it is not `wallet.address`. */
141
+ sender?: Address;
142
+ queryId?: bigint;
143
+ }): Promise<Operation<CpmmPoolCreation & {
144
+ poolAddress: Address;
145
+ }>>;
146
+ /**
147
+ * Creates a CLMM pool at a starting price. `price` is units of `assetB` per one
148
+ * `assetA`; it is inverted if the factory orders the pair the other way.
149
+ */
150
+ createClmmPool(args: {
151
+ /** Defaults to `factories.clmm`, else the factory the API publishes (see {@link Moon.factoryAddress}). */
152
+ factory?: Address;
153
+ assetA: Asset;
154
+ assetB: Asset;
155
+ /**
156
+ * Basis points per bin: 25 = 0.25%, 50 = 0.50%, 100 = 1.00%, 200 = 2.00%.
157
+ * Write the number, or `BinStep.Bps25`.
158
+ */
159
+ binStep: BinStep;
160
+ price: number;
161
+ wallet?: Sender;
162
+ queryId?: bigint;
163
+ }): Promise<Operation<ClmmPoolCreation & {
164
+ poolAddress: Address;
165
+ }>>;
166
+ /**
167
+ * Launches a token on a bonding curve.
168
+ *
169
+ * Reads the launch fee and curve code from the factory, then refuses if the curve
170
+ * address is already taken: a repeated `(factory, creator, salt)` is not refused on
171
+ * chain, and the factory keeps the fee.
172
+ */
173
+ createCurve(args: {
174
+ /** Defaults to `factories.mempad`, else the factory the API publishes (see {@link Moon.factoryAddress}). */
175
+ factory?: Address;
176
+ /**
177
+ * Basis points: 10 = 0.10%, 20 = 0.20%, 30 = 0.30%, 50 = 0.50%,
178
+ * 100 = 1.00%, 200 = 2.00%. Write the number, or `FeeTier.Bps30`.
179
+ *
180
+ * On a launch this is the fee of the CPMM pool the curve graduates
181
+ * into, and it also sets the creator's cut — see `MEMPAD_FEE_TIERS`.
182
+ */
183
+ feeBps: MempadFeeBps;
184
+ metadata: LaunchMetadata;
185
+ /** Exactly 0, or at least 0.01 GRAM. Anything between is exit 700. */
186
+ initialBuy?: bigint;
187
+ salt?: bigint;
188
+ wallet?: Sender;
189
+ /** The creating wallet, when it is not `wallet.address`. It fixes the address. */
190
+ sender?: Address;
191
+ queryId?: bigint;
192
+ }): Promise<Operation<CurveCreation & {
193
+ curveAddress: Address;
194
+ }>>;
195
+ /**
196
+ * Buys on a curve. Refuses locally when the curve is no longer trading, which on
197
+ * chain would fail with `WRONG_STATE` (555) after gas is spent.
198
+ */
199
+ curveBuy(args: {
200
+ curve: Address;
201
+ /**
202
+ * Purchase amount in nanograms that reaches the curve; gas is attached on top.
203
+ * With `gasIncluded: true` it is the whole message value instead.
204
+ */
205
+ value: bigint;
206
+ /** `value` is the whole message value, gas deducted from it, not the purchase amount. */
207
+ gasIncluded?: boolean;
208
+ minOut?: bigint;
209
+ /** Only for a chain whose config 21 is not mainnet's. */
210
+ prices?: GasPrices;
211
+ wallet?: Sender;
212
+ queryId?: bigint;
213
+ }): Promise<Operation<CurveBuy>>;
214
+ /**
215
+ * Sells back to a curve. Derives the seller's jetton wallet from the curve's own
216
+ * stored code (not the factory's), which the curve checks the sender against.
217
+ */
218
+ curveSell(args: {
219
+ curve: Address;
220
+ amount: bigint;
221
+ minOut?: bigint;
222
+ attach?: bigint;
223
+ wallet?: Sender;
224
+ /** The seller, when it is not `wallet.address`. */
225
+ sender?: Address;
226
+ queryId?: bigint;
227
+ }): Promise<Operation<CurveSell & {
228
+ jettonWallet: Address;
229
+ }>>;
230
+ /**
231
+ * Fetches the pool listing. One request; query the result locally.
232
+ *
233
+ * ```ts
234
+ * const pools = await moon.loadPools() // one request
235
+ * const info = pools.best(TON, USDT, 'cpmm') // in memory
236
+ * ```
237
+ *
238
+ * Throws `PoolIndexWarmingError` (retryable, carries `retryAfterMs`) while the
239
+ * backend is still listing a requested protocol.
240
+ */
241
+ loadPools(protocol?: PoolProtocol): Promise<PoolList>;
242
+ /** Opens the deepest pool for a pair from a listing you already hold, without fetching. */
243
+ openPair(pools: PoolList, a: Asset, b: Asset, protocol: PoolProtocol): Promise<CpmmPool | ClmmPool>;
244
+ }
245
+ //# sourceMappingURL=moon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moon.d.ts","sourceRoot":"","sources":["../src/moon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAEvC,OAAO,EACL,OAAO,EAIP,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAGzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAG7C,KAAK,gBAAgB,EAEtB,MAAM,eAAe,CAAA;AAOtB,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAQvD,OAAO,EAA2B,KAAK,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC3F,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA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