outsmart 2.0.0-alpha.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 (235) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +568 -0
  3. package/dist/cli.d.ts +44 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +1251 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/dex/byreal-clmm.d.ts +16 -0
  8. package/dist/dex/byreal-clmm.d.ts.map +1 -0
  9. package/dist/dex/byreal-clmm.js +39 -0
  10. package/dist/dex/byreal-clmm.js.map +1 -0
  11. package/dist/dex/dflow.d.ts +27 -0
  12. package/dist/dex/dflow.d.ts.map +1 -0
  13. package/dist/dex/dflow.js +200 -0
  14. package/dist/dex/dflow.js.map +1 -0
  15. package/dist/dex/fusion-amm.d.ts +44 -0
  16. package/dist/dex/fusion-amm.d.ts.map +1 -0
  17. package/dist/dex/fusion-amm.js +546 -0
  18. package/dist/dex/fusion-amm.js.map +1 -0
  19. package/dist/dex/futarchy-amm.d.ts +32 -0
  20. package/dist/dex/futarchy-amm.d.ts.map +1 -0
  21. package/dist/dex/futarchy-amm.js +443 -0
  22. package/dist/dex/futarchy-amm.js.map +1 -0
  23. package/dist/dex/futarchy-idl.d.ts +2568 -0
  24. package/dist/dex/futarchy-idl.d.ts.map +1 -0
  25. package/dist/dex/futarchy-idl.js +2570 -0
  26. package/dist/dex/futarchy-idl.js.map +1 -0
  27. package/dist/dex/futarchy-launchpad.d.ts +68 -0
  28. package/dist/dex/futarchy-launchpad.d.ts.map +1 -0
  29. package/dist/dex/futarchy-launchpad.js +377 -0
  30. package/dist/dex/futarchy-launchpad.js.map +1 -0
  31. package/dist/dex/index.d.ts +88 -0
  32. package/dist/dex/index.d.ts.map +1 -0
  33. package/dist/dex/index.js +159 -0
  34. package/dist/dex/index.js.map +1 -0
  35. package/dist/dex/jupiter-ultra.d.ts +27 -0
  36. package/dist/dex/jupiter-ultra.d.ts.map +1 -0
  37. package/dist/dex/jupiter-ultra.js +369 -0
  38. package/dist/dex/jupiter-ultra.js.map +1 -0
  39. package/dist/dex/meteora-damm-v1.d.ts +36 -0
  40. package/dist/dex/meteora-damm-v1.d.ts.map +1 -0
  41. package/dist/dex/meteora-damm-v1.js +314 -0
  42. package/dist/dex/meteora-damm-v1.js.map +1 -0
  43. package/dist/dex/meteora-damm-v2.d.ts +103 -0
  44. package/dist/dex/meteora-damm-v2.d.ts.map +1 -0
  45. package/dist/dex/meteora-damm-v2.js +1146 -0
  46. package/dist/dex/meteora-damm-v2.js.map +1 -0
  47. package/dist/dex/meteora-dbc.d.ts +38 -0
  48. package/dist/dex/meteora-dbc.d.ts.map +1 -0
  49. package/dist/dex/meteora-dbc.js +374 -0
  50. package/dist/dex/meteora-dbc.js.map +1 -0
  51. package/dist/dex/meteora-dlmm.d.ts +79 -0
  52. package/dist/dex/meteora-dlmm.d.ts.map +1 -0
  53. package/dist/dex/meteora-dlmm.js +735 -0
  54. package/dist/dex/meteora-dlmm.js.map +1 -0
  55. package/dist/dex/orca.d.ts +31 -0
  56. package/dist/dex/orca.d.ts.map +1 -0
  57. package/dist/dex/orca.js +536 -0
  58. package/dist/dex/orca.js.map +1 -0
  59. package/dist/dex/pancakeswap-clmm.d.ts +16 -0
  60. package/dist/dex/pancakeswap-clmm.d.ts.map +1 -0
  61. package/dist/dex/pancakeswap-clmm.js +39 -0
  62. package/dist/dex/pancakeswap-clmm.js.map +1 -0
  63. package/dist/dex/pumpfun-amm.d.ts +46 -0
  64. package/dist/dex/pumpfun-amm.d.ts.map +1 -0
  65. package/dist/dex/pumpfun-amm.js +692 -0
  66. package/dist/dex/pumpfun-amm.js.map +1 -0
  67. package/dist/dex/pumpfun.d.ts +41 -0
  68. package/dist/dex/pumpfun.d.ts.map +1 -0
  69. package/dist/dex/pumpfun.js +555 -0
  70. package/dist/dex/pumpfun.js.map +1 -0
  71. package/dist/dex/raydium-amm-v4.d.ts +11 -0
  72. package/dist/dex/raydium-amm-v4.d.ts.map +1 -0
  73. package/dist/dex/raydium-amm-v4.js +649 -0
  74. package/dist/dex/raydium-amm-v4.js.map +1 -0
  75. package/dist/dex/raydium-clmm.d.ts +12 -0
  76. package/dist/dex/raydium-clmm.d.ts.map +1 -0
  77. package/dist/dex/raydium-clmm.js +675 -0
  78. package/dist/dex/raydium-clmm.js.map +1 -0
  79. package/dist/dex/raydium-cpmm.d.ts +10 -0
  80. package/dist/dex/raydium-cpmm.d.ts.map +1 -0
  81. package/dist/dex/raydium-cpmm.js +613 -0
  82. package/dist/dex/raydium-cpmm.js.map +1 -0
  83. package/dist/dex/raydium-launchlab.d.ts +12 -0
  84. package/dist/dex/raydium-launchlab.d.ts.map +1 -0
  85. package/dist/dex/raydium-launchlab.js +530 -0
  86. package/dist/dex/raydium-launchlab.js.map +1 -0
  87. package/dist/dex/shared/clmm-base.d.ts +58 -0
  88. package/dist/dex/shared/clmm-base.d.ts.map +1 -0
  89. package/dist/dex/shared/clmm-base.js +891 -0
  90. package/dist/dex/shared/clmm-base.js.map +1 -0
  91. package/dist/dex/types.d.ts +601 -0
  92. package/dist/dex/types.d.ts.map +1 -0
  93. package/dist/dex/types.js +137 -0
  94. package/dist/dex/types.js.map +1 -0
  95. package/dist/dexscreener/index.d.ts +2 -0
  96. package/dist/dexscreener/index.d.ts.map +1 -0
  97. package/dist/dexscreener/index.js +18 -0
  98. package/dist/dexscreener/index.js.map +1 -0
  99. package/dist/dexscreener/info.d.ts +22 -0
  100. package/dist/dexscreener/info.d.ts.map +1 -0
  101. package/dist/dexscreener/info.js +104 -0
  102. package/dist/dexscreener/info.js.map +1 -0
  103. package/dist/helpers/check_balance.d.ts +10 -0
  104. package/dist/helpers/check_balance.d.ts.map +1 -0
  105. package/dist/helpers/check_balance.js +34 -0
  106. package/dist/helpers/check_balance.js.map +1 -0
  107. package/dist/helpers/config.d.ts +51 -0
  108. package/dist/helpers/config.d.ts.map +1 -0
  109. package/dist/helpers/config.js +118 -0
  110. package/dist/helpers/config.js.map +1 -0
  111. package/dist/helpers/index.d.ts +8 -0
  112. package/dist/helpers/index.d.ts.map +1 -0
  113. package/dist/helpers/index.js +29 -0
  114. package/dist/helpers/index.js.map +1 -0
  115. package/dist/helpers/logger.d.ts +27 -0
  116. package/dist/helpers/logger.d.ts.map +1 -0
  117. package/dist/helpers/logger.js +39 -0
  118. package/dist/helpers/logger.js.map +1 -0
  119. package/dist/helpers/token-2022.d.ts +32 -0
  120. package/dist/helpers/token-2022.d.ts.map +1 -0
  121. package/dist/helpers/token-2022.js +48 -0
  122. package/dist/helpers/token-2022.js.map +1 -0
  123. package/dist/helpers/unwrap_sol.d.ts +2 -0
  124. package/dist/helpers/unwrap_sol.d.ts.map +1 -0
  125. package/dist/helpers/unwrap_sol.js +67 -0
  126. package/dist/helpers/unwrap_sol.js.map +1 -0
  127. package/dist/helpers/util.d.ts +698 -0
  128. package/dist/helpers/util.d.ts.map +1 -0
  129. package/dist/helpers/util.js +181 -0
  130. package/dist/helpers/util.js.map +1 -0
  131. package/dist/helpers/utils.d.ts +10 -0
  132. package/dist/helpers/utils.d.ts.map +1 -0
  133. package/dist/helpers/utils.js +97 -0
  134. package/dist/helpers/utils.js.map +1 -0
  135. package/dist/helpers/wrap_sol.d.ts +3 -0
  136. package/dist/helpers/wrap_sol.d.ts.map +1 -0
  137. package/dist/helpers/wrap_sol.js +88 -0
  138. package/dist/helpers/wrap_sol.js.map +1 -0
  139. package/dist/index.d.ts +14 -0
  140. package/dist/index.d.ts.map +1 -0
  141. package/dist/index.js +32 -0
  142. package/dist/index.js.map +1 -0
  143. package/dist/transactions/bloXroute_tips_tx_executor.d.ts +4 -0
  144. package/dist/transactions/bloXroute_tips_tx_executor.d.ts.map +1 -0
  145. package/dist/transactions/bloXroute_tips_tx_executor.js +70 -0
  146. package/dist/transactions/bloXroute_tips_tx_executor.js.map +1 -0
  147. package/dist/transactions/index.d.ts +6 -0
  148. package/dist/transactions/index.d.ts.map +1 -0
  149. package/dist/transactions/index.js +30 -0
  150. package/dist/transactions/index.js.map +1 -0
  151. package/dist/transactions/jito_tips_tx_executor.d.ts +15 -0
  152. package/dist/transactions/jito_tips_tx_executor.d.ts.map +1 -0
  153. package/dist/transactions/jito_tips_tx_executor.js +99 -0
  154. package/dist/transactions/jito_tips_tx_executor.js.map +1 -0
  155. package/dist/transactions/landing/index.d.ts +30 -0
  156. package/dist/transactions/landing/index.d.ts.map +1 -0
  157. package/dist/transactions/landing/index.js +60 -0
  158. package/dist/transactions/landing/index.js.map +1 -0
  159. package/dist/transactions/landing/nonce-manager.d.ts +116 -0
  160. package/dist/transactions/landing/nonce-manager.d.ts.map +1 -0
  161. package/dist/transactions/landing/nonce-manager.js +393 -0
  162. package/dist/transactions/landing/nonce-manager.js.map +1 -0
  163. package/dist/transactions/landing/orchestrator.d.ts +104 -0
  164. package/dist/transactions/landing/orchestrator.d.ts.map +1 -0
  165. package/dist/transactions/landing/orchestrator.js +329 -0
  166. package/dist/transactions/landing/orchestrator.js.map +1 -0
  167. package/dist/transactions/landing/providers/astralane.d.ts +12 -0
  168. package/dist/transactions/landing/providers/astralane.d.ts.map +1 -0
  169. package/dist/transactions/landing/providers/astralane.js +132 -0
  170. package/dist/transactions/landing/providers/astralane.js.map +1 -0
  171. package/dist/transactions/landing/providers/blockrazor.d.ts +11 -0
  172. package/dist/transactions/landing/providers/blockrazor.d.ts.map +1 -0
  173. package/dist/transactions/landing/providers/blockrazor.js +134 -0
  174. package/dist/transactions/landing/providers/blockrazor.js.map +1 -0
  175. package/dist/transactions/landing/providers/bloxroute.d.ts +12 -0
  176. package/dist/transactions/landing/providers/bloxroute.d.ts.map +1 -0
  177. package/dist/transactions/landing/providers/bloxroute.js +102 -0
  178. package/dist/transactions/landing/providers/bloxroute.js.map +1 -0
  179. package/dist/transactions/landing/providers/flashblock.d.ts +10 -0
  180. package/dist/transactions/landing/providers/flashblock.d.ts.map +1 -0
  181. package/dist/transactions/landing/providers/flashblock.js +102 -0
  182. package/dist/transactions/landing/providers/flashblock.js.map +1 -0
  183. package/dist/transactions/landing/providers/helius-sender.d.ts +11 -0
  184. package/dist/transactions/landing/providers/helius-sender.d.ts.map +1 -0
  185. package/dist/transactions/landing/providers/helius-sender.js +101 -0
  186. package/dist/transactions/landing/providers/helius-sender.js.map +1 -0
  187. package/dist/transactions/landing/providers/jito.d.ts +16 -0
  188. package/dist/transactions/landing/providers/jito.d.ts.map +1 -0
  189. package/dist/transactions/landing/providers/jito.js +110 -0
  190. package/dist/transactions/landing/providers/jito.js.map +1 -0
  191. package/dist/transactions/landing/providers/nextblock.d.ts +11 -0
  192. package/dist/transactions/landing/providers/nextblock.d.ts.map +1 -0
  193. package/dist/transactions/landing/providers/nextblock.js +109 -0
  194. package/dist/transactions/landing/providers/nextblock.js.map +1 -0
  195. package/dist/transactions/landing/providers/node1.d.ts +11 -0
  196. package/dist/transactions/landing/providers/node1.d.ts.map +1 -0
  197. package/dist/transactions/landing/providers/node1.js +101 -0
  198. package/dist/transactions/landing/providers/node1.js.map +1 -0
  199. package/dist/transactions/landing/providers/nozomi.d.ts +11 -0
  200. package/dist/transactions/landing/providers/nozomi.d.ts.map +1 -0
  201. package/dist/transactions/landing/providers/nozomi.js +124 -0
  202. package/dist/transactions/landing/providers/nozomi.js.map +1 -0
  203. package/dist/transactions/landing/providers/soyas.d.ts +16 -0
  204. package/dist/transactions/landing/providers/soyas.d.ts.map +1 -0
  205. package/dist/transactions/landing/providers/soyas.js +192 -0
  206. package/dist/transactions/landing/providers/soyas.js.map +1 -0
  207. package/dist/transactions/landing/providers/stellium.d.ts +11 -0
  208. package/dist/transactions/landing/providers/stellium.d.ts.map +1 -0
  209. package/dist/transactions/landing/providers/stellium.js +102 -0
  210. package/dist/transactions/landing/providers/stellium.js.map +1 -0
  211. package/dist/transactions/landing/providers/zero-slot.d.ts +10 -0
  212. package/dist/transactions/landing/providers/zero-slot.d.ts.map +1 -0
  213. package/dist/transactions/landing/providers/zero-slot.js +92 -0
  214. package/dist/transactions/landing/providers/zero-slot.js.map +1 -0
  215. package/dist/transactions/landing/tip-accounts.d.ts +22 -0
  216. package/dist/transactions/landing/tip-accounts.d.ts.map +1 -0
  217. package/dist/transactions/landing/tip-accounts.js +140 -0
  218. package/dist/transactions/landing/tip-accounts.js.map +1 -0
  219. package/dist/transactions/landing/types.d.ts +98 -0
  220. package/dist/transactions/landing/types.d.ts.map +1 -0
  221. package/dist/transactions/landing/types.js +30 -0
  222. package/dist/transactions/landing/types.js.map +1 -0
  223. package/dist/transactions/nozomi/tx-submission.d.ts +14 -0
  224. package/dist/transactions/nozomi/tx-submission.d.ts.map +1 -0
  225. package/dist/transactions/nozomi/tx-submission.js +107 -0
  226. package/dist/transactions/nozomi/tx-submission.js.map +1 -0
  227. package/dist/transactions/send-rpc.d.ts +54 -0
  228. package/dist/transactions/send-rpc.d.ts.map +1 -0
  229. package/dist/transactions/send-rpc.js +126 -0
  230. package/dist/transactions/send-rpc.js.map +1 -0
  231. package/dist/transactions/simple_tx_executor.d.ts +10 -0
  232. package/dist/transactions/simple_tx_executor.d.ts.map +1 -0
  233. package/dist/transactions/simple_tx_executor.js +33 -0
  234. package/dist/transactions/simple_tx_executor.js.map +1 -0
  235. package/package.json +112 -0
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getRandomValidator = getRandomValidator;
7
+ exports.getNozomiConnection = getNozomiConnection;
8
+ exports.sendNozomiTx = sendNozomiTx;
9
+ const web3_js_1 = require("@solana/web3.js");
10
+ const config_1 = require("../../helpers/config");
11
+ const axios_1 = __importDefault(require("axios"));
12
+ // Nozomi tip account
13
+ const NOZOMI_TIP = new web3_js_1.PublicKey("TEMPaMeCRFAS9EKF53Jd6KpHxgL47uWLcpFArU1Fanq");
14
+ const listOfValidators = [
15
+ "TEMPaMeCRFAS9EKF53Jd6KpHxgL47uWLcpFArU1Fanq",
16
+ "noz3jAjPiHuBPqiSPkkugaJDkJscPuRhYnSpbi8UvC4",
17
+ "noz3str9KXfpKknefHji8L1mPgimezaiUyCHYMDv1GE",
18
+ "noz6uoYCDijhu1V7cutCpwxNiSovEwLdRHPwmgCGDNo",
19
+ "noz9EPNcT7WH6Sou3sr3GGjHQYVkN3DNirpbvDkv9YJ",
20
+ "nozc5yT15LazbLTFVZzoNZCwjh3yUtW86LoUyqsBu4L",
21
+ "nozFrhfnNGoyqwVuwPAW4aaGqempx4PU6g6D9CJMv7Z",
22
+ "nozievPk7HyK1Rqy1MPJwVQ7qQg2QoJGyP71oeDwbsu",
23
+ "noznbgwYnBLDHu8wcQVCEw6kDrXkPdKkydGJGNXGvL7",
24
+ "nozNVWs5N8mgzuD3qigrCG2UoKxZttxzZ85pvAQVrbP",
25
+ "nozpEGbwx4BcGp6pvEdAh1JoC2CQGZdU6HbNP1v2p6P",
26
+ "nozrhjhkCr3zXT3BiT4WCodYCUFeQvcdUkM7MqhKqge",
27
+ "nozrwQtWhEdrA6W8dkbt9gnUaMs52PdAv5byipnadq3",
28
+ "nozUacTVWub3cL4mJmGCYjKZTnE9RbdY5AP46iQgbPJ",
29
+ "nozWCyTPppJjRuw2fpzDhhWbW355fzosWSzrrMYB1Qk",
30
+ "nozWNju6dY353eMkMqURqwQEoM3SFgEKC6psLCSfUne",
31
+ "nozxNBgWohjR75vdspfxR5H9ceC7XXH99xpxhVGt3Bb",
32
+ ];
33
+ // Read API keys from environment -- NEVER hardcode
34
+ const NOZOMI_API_KEY = process.env.NOZOMI_API_KEY || "";
35
+ const NOZOMI_LOW_LATENCY_API_KEYS = (process.env.NOZOMI_LOW_LATENCY_API_KEY || "")
36
+ .split(",")
37
+ .filter(Boolean);
38
+ // Use HTTPS -- never plain HTTP for transaction submission
39
+ const NOZOMI_BASE_URL = process.env.NOZOMI_URL || "https://ams1.secure.nozomi.temporal.xyz/?c=";
40
+ function getRandomValidator() {
41
+ const randomIndex = Math.floor(Math.random() * listOfValidators.length);
42
+ return new web3_js_1.PublicKey(listOfValidators[randomIndex]);
43
+ }
44
+ function getRandomNozomiAPIKey() {
45
+ if (NOZOMI_LOW_LATENCY_API_KEYS.length > 0) {
46
+ return NOZOMI_LOW_LATENCY_API_KEYS[Math.floor(Math.random() * NOZOMI_LOW_LATENCY_API_KEYS.length)];
47
+ }
48
+ return NOZOMI_API_KEY;
49
+ }
50
+ function getNozomiConnection() {
51
+ const apiKey = getRandomNozomiAPIKey();
52
+ if (!apiKey) {
53
+ throw new Error("NOZOMI_API_KEY or NOZOMI_LOW_LATENCY_API_KEY not set. Configure via 'outsmart init' or .env");
54
+ }
55
+ return new web3_js_1.Connection(`${NOZOMI_BASE_URL}${apiKey}`);
56
+ }
57
+ /**
58
+ * Sends a transaction via Nozomi with tip.
59
+ * NOTE: Does NOT mutate the input ixs array.
60
+ */
61
+ async function sendNozomiTx(ixs, signer, blockhash, tipSol = config_1.jito_fee) {
62
+ const apiKey = getRandomNozomiAPIKey();
63
+ if (!apiKey) {
64
+ return { success: false, error: "Nozomi API key not configured" };
65
+ }
66
+ const validator = getRandomValidator();
67
+ // Build tip instruction
68
+ const tipIx = web3_js_1.SystemProgram.transfer({
69
+ fromPubkey: signer.publicKey,
70
+ toPubkey: validator,
71
+ lamports: Math.round(tipSol * web3_js_1.LAMPORTS_PER_SOL),
72
+ });
73
+ // Build transaction (don't mutate input array)
74
+ const allIxs = [...ixs, tipIx];
75
+ const tx = new web3_js_1.Transaction().add(...allIxs);
76
+ if (typeof blockhash === "string") {
77
+ tx.recentBlockhash = blockhash;
78
+ }
79
+ else {
80
+ tx.recentBlockhash = blockhash.blockhash;
81
+ tx.lastValidBlockHeight = blockhash.lastValidBlockHeight;
82
+ }
83
+ tx.feePayer = signer.publicKey;
84
+ tx.sign(signer);
85
+ const b64Tx = Buffer.from(tx.serialize()).toString("base64");
86
+ const url = `${NOZOMI_BASE_URL}${apiKey}`;
87
+ try {
88
+ const response = await axios_1.default.post(url, {
89
+ jsonrpc: "2.0",
90
+ id: 1,
91
+ method: "sendTransaction",
92
+ params: [b64Tx, { encoding: "base64" }],
93
+ }, { timeout: 10000 });
94
+ const signature = response.data?.result;
95
+ if (signature) {
96
+ console.log("Nozomi tx sent:", signature);
97
+ return { success: true, signature };
98
+ }
99
+ return { success: false, error: response.data?.error?.message || "Unknown Nozomi error" };
100
+ }
101
+ catch (error) {
102
+ const msg = error?.response?.data?.error?.message || error?.message || "Nozomi request failed";
103
+ console.error(`Nozomi error: ${msg}`);
104
+ return { success: false, error: msg };
105
+ }
106
+ }
107
+ //# sourceMappingURL=tx-submission.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tx-submission.js","sourceRoot":"","sources":["../../../src/transactions/nozomi/tx-submission.ts"],"names":[],"mappings":";;;;;AA6CA,gDAGC;AASD,kDAMC;AAYD,oCA6DC;AAxID,6CASyB;AACzB,iDAA+D;AAC/D,kDAA0B;AAE1B,qBAAqB;AACrB,MAAM,UAAU,GAAG,IAAI,mBAAS,CAAC,6CAA6C,CAAC,CAAC;AAEhF,MAAM,gBAAgB,GAAG;IACvB,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;IAC7C,6CAA6C;CAC9C,CAAC;AAEF,mDAAmD;AACnD,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC;AACxD,MAAM,2BAA2B,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,IAAI,EAAE,CAAC;KAC/E,KAAK,CAAC,GAAG,CAAC;KACV,MAAM,CAAC,OAAO,CAAC,CAAC;AAEnB,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E,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QACtC,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,IAAI,sBAAsB,EAAE,CAAC;IAC5F,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,GAAG,GAAG,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,IAAI,KAAK,EAAE,OAAO,IAAI,uBAAuB,CAAC;QAC/F,OAAO,CAAC,KAAK,CAAC,iBAAiB,GAAG,EAAE,CAAC,CAAC;QACtC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;IACxC,CAAC;AACH,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Simple RPC-based transaction submission with confirmation.
3
+ *
4
+ * Use this for normal swap operations (buy/sell/LP).
5
+ * For competitive/low-latency submissions (sniping), use the landing orchestrator.
6
+ *
7
+ * Two helpers:
8
+ * - sendAndConfirmVtx() — builds a V0 transaction from instructions, signs, sends, confirms
9
+ * - sendAndConfirmLegacyTx() — takes a pre-built legacy Transaction from an SDK, assigns fresh
10
+ * blockhash, signs, sends, confirms. Use this when the SDK returns a complete Transaction
11
+ * object (e.g. DLMM initializePositionAndAddLiquidityByStrategy).
12
+ */
13
+ import { Connection, Keypair, Transaction, TransactionInstruction, AddressLookupTableAccount } from "@solana/web3.js";
14
+ export interface SendRpcOptions {
15
+ /** Extra signers beyond the primary wallet */
16
+ extraSigners?: Keypair[];
17
+ /** Address lookup table accounts for V0 message compilation */
18
+ addressLookupTables?: AddressLookupTableAccount[];
19
+ /** Commitment level for confirmation (default: "confirmed") */
20
+ commitment?: "processed" | "confirmed" | "finalized";
21
+ /** Skip preflight simulation (default: true — we handle errors on-chain) */
22
+ skipPreflight?: boolean;
23
+ /** Max retries on blockhash expiry / confirmation timeout (default: 2, so 3 total attempts) */
24
+ maxRetries?: number;
25
+ }
26
+ export interface SendRpcResult {
27
+ txSignature: string;
28
+ confirmed: boolean;
29
+ error?: string;
30
+ }
31
+ /**
32
+ * Build, sign, send, and confirm a V0 transaction via the standard RPC.
33
+ *
34
+ * This is the simple path: sendRawTransaction + confirmTransaction.
35
+ * No tips, no multi-provider fanout — just your RPC node.
36
+ */
37
+ export declare function sendAndConfirmVtx(connection: Connection, ixs: TransactionInstruction[], signer: Keypair, opts?: SendRpcOptions): Promise<SendRpcResult>;
38
+ export interface SendLegacyTxOptions {
39
+ /** Extra signers beyond the primary wallet (e.g. new position keypair) */
40
+ extraSigners?: Keypair[];
41
+ /** Commitment level for confirmation (default: "confirmed") */
42
+ commitment?: "processed" | "confirmed" | "finalized";
43
+ }
44
+ /**
45
+ * Send a pre-built legacy Transaction from an SDK.
46
+ *
47
+ * Assigns a fresh blockhash right before sending so the TX doesn't expire
48
+ * even if the SDK took a long time to build it (e.g. DLMM LP operations).
49
+ *
50
+ * Use this instead of sendAndConfirmVtx when the SDK returns a complete
51
+ * Transaction object rather than raw instructions.
52
+ */
53
+ export declare function sendAndConfirmLegacyTx(connection: Connection, tx: Transaction, signer: Keypair, opts?: SendLegacyTxOptions): Promise<SendRpcResult>;
54
+ //# sourceMappingURL=send-rpc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-rpc.d.ts","sourceRoot":"","sources":["../../src/transactions/send-rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,UAAU,EACV,OAAO,EACP,WAAW,EACX,sBAAsB,EAGtB,yBAAyB,EAG1B,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,YAAY,CAAC,EAAE,OAAO,EAAE,CAAC;IACzB,+DAA+D;IAC/D,mBAAmB,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAClD,+DAA+D;IAC/D,UAAU,CAAC,EAAE,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;IACrD,4EAA4E;IAC5E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,+FAA+F;IAC/F,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,sBAAsB,EAAE,EAC7B,MAAM,EAAE,OAAO,EACf,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC,aAAa,CAAC,CA6ExB;AAMD,MAAM,WAAW,mBAAmB;IAClC,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,EAAE,CAAC;IACzB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;CACtD;AAED;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,WAAW,EACf,MAAM,EAAE,OAAO,EACf,IAAI,CAAC,EAAE,mBAAmB,GACzB,OAAO,CAAC,aAAa,CAAC,CAmCxB"}
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ /**
3
+ * Simple RPC-based transaction submission with confirmation.
4
+ *
5
+ * Use this for normal swap operations (buy/sell/LP).
6
+ * For competitive/low-latency submissions (sniping), use the landing orchestrator.
7
+ *
8
+ * Two helpers:
9
+ * - sendAndConfirmVtx() — builds a V0 transaction from instructions, signs, sends, confirms
10
+ * - sendAndConfirmLegacyTx() — takes a pre-built legacy Transaction from an SDK, assigns fresh
11
+ * blockhash, signs, sends, confirms. Use this when the SDK returns a complete Transaction
12
+ * object (e.g. DLMM initializePositionAndAddLiquidityByStrategy).
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.sendAndConfirmVtx = sendAndConfirmVtx;
16
+ exports.sendAndConfirmLegacyTx = sendAndConfirmLegacyTx;
17
+ const web3_js_1 = require("@solana/web3.js");
18
+ /**
19
+ * Build, sign, send, and confirm a V0 transaction via the standard RPC.
20
+ *
21
+ * This is the simple path: sendRawTransaction + confirmTransaction.
22
+ * No tips, no multi-provider fanout — just your RPC node.
23
+ */
24
+ async function sendAndConfirmVtx(connection, ixs, signer, opts) {
25
+ const totalAttempts = (opts?.maxRetries ?? 2) + 1;
26
+ for (let attempt = 1; attempt <= totalAttempts; attempt++) {
27
+ const blockhash = await connection.getLatestBlockhash("confirmed");
28
+ const message = new web3_js_1.TransactionMessage({
29
+ payerKey: signer.publicKey,
30
+ recentBlockhash: blockhash.blockhash,
31
+ instructions: ixs,
32
+ });
33
+ const lookupTables = opts?.addressLookupTables ?? [];
34
+ const messageV0 = message.compileToV0Message(lookupTables);
35
+ const tx = new web3_js_1.VersionedTransaction(messageV0);
36
+ const signers = [signer, ...(opts?.extraSigners ?? [])];
37
+ tx.sign(signers);
38
+ const sendOpts = {
39
+ skipPreflight: opts?.skipPreflight ?? true,
40
+ maxRetries: 3,
41
+ };
42
+ let signature;
43
+ try {
44
+ signature = await connection.sendRawTransaction(tx.serialize(), sendOpts);
45
+ }
46
+ catch (error) {
47
+ const errMsg = error instanceof Error ? error.message : String(error);
48
+ return { txSignature: "", confirmed: false, error: `Send failed: ${errMsg}` };
49
+ }
50
+ console.log(` TX sent: ${signature} — confirming...`);
51
+ try {
52
+ const commitment = opts?.commitment ?? "confirmed";
53
+ const confirmation = await connection.confirmTransaction({
54
+ signature,
55
+ blockhash: blockhash.blockhash,
56
+ lastValidBlockHeight: blockhash.lastValidBlockHeight,
57
+ }, commitment);
58
+ // Program errors are permanent — no retry
59
+ if (confirmation.value.err) {
60
+ return {
61
+ txSignature: signature,
62
+ confirmed: false,
63
+ error: JSON.stringify(confirmation.value.err),
64
+ };
65
+ }
66
+ return {
67
+ txSignature: signature,
68
+ confirmed: true,
69
+ };
70
+ }
71
+ catch (error) {
72
+ const errMsg = error instanceof Error ? error.message : String(error);
73
+ // Blockhash expiry / confirmation timeout — retry with fresh blockhash
74
+ if (attempt < totalAttempts) {
75
+ console.log(` TX expired, retrying (attempt ${attempt + 1}/${totalAttempts})...`);
76
+ continue;
77
+ }
78
+ return {
79
+ txSignature: signature,
80
+ confirmed: false,
81
+ error: `Confirmation failed: ${errMsg}`,
82
+ };
83
+ }
84
+ }
85
+ // Unreachable — the loop always returns — but satisfies the compiler
86
+ return { txSignature: "", confirmed: false, error: "Unexpected: exhausted retries" };
87
+ }
88
+ /**
89
+ * Send a pre-built legacy Transaction from an SDK.
90
+ *
91
+ * Assigns a fresh blockhash right before sending so the TX doesn't expire
92
+ * even if the SDK took a long time to build it (e.g. DLMM LP operations).
93
+ *
94
+ * Use this instead of sendAndConfirmVtx when the SDK returns a complete
95
+ * Transaction object rather than raw instructions.
96
+ */
97
+ async function sendAndConfirmLegacyTx(connection, tx, signer, opts) {
98
+ // Assign fresh blockhash right before sending
99
+ const blockhash = await connection.getLatestBlockhash("confirmed");
100
+ tx.recentBlockhash = blockhash.blockhash;
101
+ tx.feePayer = signer.publicKey;
102
+ const signers = [signer, ...(opts?.extraSigners ?? [])];
103
+ try {
104
+ const signature = await (0, web3_js_1.sendAndConfirmTransaction)(connection, tx, signers, {
105
+ commitment: opts?.commitment ?? "confirmed",
106
+ skipPreflight: true,
107
+ maxRetries: 3,
108
+ });
109
+ return {
110
+ txSignature: signature,
111
+ confirmed: true,
112
+ };
113
+ }
114
+ catch (error) {
115
+ // sendAndConfirmTransaction throws on failure — extract signature if possible
116
+ const errMsg = error instanceof Error ? error.message : String(error);
117
+ // Try to extract signature from error message
118
+ const sigMatch = errMsg.match(/[1-9A-HJ-NP-Za-km-z]{87,88}/);
119
+ return {
120
+ txSignature: sigMatch ? sigMatch[0] : "",
121
+ confirmed: false,
122
+ error: errMsg,
123
+ };
124
+ }
125
+ }
126
+ //# sourceMappingURL=send-rpc.js.map
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G,MAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAC7D,OAAO;YACL,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;YACxC,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,MAAM;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { BlockhashWithExpiryBlockHeight, Keypair, VersionedTransaction, Transaction } from "@solana/web3.js";
2
+ export interface SimpleResult {
3
+ confirmed: boolean;
4
+ signature: string;
5
+ }
6
+ /**
7
+ * Executes a transaction and confirms it on the Solana blockchain.
8
+ */
9
+ export declare function simple_executeAndConfirm(transaction: VersionedTransaction | Transaction, payer: Keypair, latestBlockhash: BlockhashWithExpiryBlockHeight): Promise<SimpleResult>;
10
+ //# sourceMappingURL=simple_tx_executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple_tx_executor.d.ts","sourceRoot":"","sources":["../../src/transactions/simple_tx_executor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,OAAO,EACP,oBAAoB,EACpB,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,oBAAoB,GAAG,WAAW,EAC/C,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,8BAA8B,GAC9C,OAAO,CAAC,YAAY,CAAC,CAKvB"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.simple_executeAndConfirm = simple_executeAndConfirm;
4
+ const web3_js_1 = require("@solana/web3.js");
5
+ const config_1 = require("../helpers/config");
6
+ /**
7
+ * Executes a transaction and confirms it on the Solana blockchain.
8
+ */
9
+ async function simple_executeAndConfirm(transaction, payer, latestBlockhash) {
10
+ console.log("Executing transaction...");
11
+ const signature = await simple_execute(transaction);
12
+ console.log("Transaction executed. Confirming transaction...");
13
+ return simple_confirm(signature, latestBlockhash);
14
+ }
15
+ async function simple_execute(transaction) {
16
+ const connection = (0, config_1.getConnection)();
17
+ return connection.sendRawTransaction(transaction instanceof web3_js_1.VersionedTransaction
18
+ ? transaction.serialize()
19
+ : transaction.serialize(), {
20
+ skipPreflight: true,
21
+ maxRetries: 2,
22
+ });
23
+ }
24
+ async function simple_confirm(signature, latestBlockhash) {
25
+ const connection = (0, config_1.getConnection)();
26
+ const confirmation = await connection.confirmTransaction({
27
+ signature,
28
+ lastValidBlockHeight: latestBlockhash.lastValidBlockHeight,
29
+ blockhash: latestBlockhash.blockhash,
30
+ }, "confirmed");
31
+ return { confirmed: !confirmation.value.err, signature };
32
+ }
33
+ //# sourceMappingURL=simple_tx_executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple_tx_executor.js","sourceRoot":"","sources":["../../src/transactions/simple_tx_executor.ts"],"names":[],"mappings":";;AAgBA,4DASC;AAzBD,6CAKyB;AACzB,8CAAkD;AAOlD;;GAEG;AACI,KAAK,UAAU,wBAAwB,CAC5C,WAA+C,EAC/C,KAAc,EACd,eAA+C;IAE/C,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IACxC,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC,WAAW,CAAC,CAAC;IACpD,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;IAC/D,OAAO,cAAc,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;AACpD,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,WAA+C;IAC3E,MAAM,UAAU,GAAG,IAAA,sBAAa,GAAE,CAAC;IACnC,OAAO,UAAU,CAAC,kBAAkB,CAClC,WAAW,YAAY,8BAAoB;QACzC,CAAC,CAAC,WAAW,CAAC,SAAS,EAAE;QACzB,CAAC,CAAC,WAAW,CAAC,SAAS,EAAE,EAC3B;QACE,aAAa,EAAE,IAAI;QACnB,UAAU,EAAE,CAAC;KACd,CACF,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,cAAc,CAC3B,SAAiB,EACjB,eAA+C;IAE/C,MAAM,UAAU,GAAG,IAAA,sBAAa,GAAE,CAAC;IACnC,MAAM,YAAY,GAAG,MAAM,UAAU,CAAC,kBAAkB,CACtD;QACE,SAAS;QACT,oBAAoB,EAAE,eAAe,CAAC,oBAAoB;QAC1D,SAAS,EAAE,eAAe,CAAC,SAAS;KACrC,EACD,WAAW,CACZ,CAAC;IACF,OAAO,EAAE,SAAS,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,CAAC;AAC3D,CAAC"}
package/package.json ADDED
@@ -0,0 +1,112 @@
1
+ {
2
+ "name": "outsmart",
3
+ "version": "2.0.0-alpha.0",
4
+ "description": "The most powerful Solana trading CLI. 19 DEXes, 12 TX landing providers.",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "bin": {
8
+ "outsmart": "./dist/cli.js"
9
+ },
10
+ "files": [
11
+ "dist/",
12
+ "bin/",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "scripts": {
17
+ "build": "npm run clean && npm run build:ts && npm run build:chmod",
18
+ "build:ts": "tsc -p tsconfig.build.json",
19
+ "build:chmod": "chmod +x dist/cli.js || true",
20
+ "clean": "rm -rf dist/",
21
+ "dev": "ts-node src/cli.ts",
22
+ "prepublishOnly": "npm run build",
23
+ "typecheck": "tsc --noEmit",
24
+ "test": "jest",
25
+ "test:registry": "jest --testPathPattern=registry",
26
+ "test:raydium": "jest --testPathPattern=raydium",
27
+ "test:meteora": "jest --testPathPattern=meteora",
28
+ "test:pumpfun": "jest --testPathPattern=pumpfun",
29
+ "test:orca": "jest --testPathPattern=orca",
30
+ "test:clmm": "jest --testPathPattern=clmm",
31
+ "test:fusion": "jest --testPathPattern=fusion-futarchy",
32
+ "test:api": "jest --testPathPattern=api-adapters",
33
+ "test:unit": "jest --testPathPattern=unit"
34
+ },
35
+ "keywords": [
36
+ "solana",
37
+ "trading",
38
+ "cli",
39
+ "dex",
40
+ "raydium",
41
+ "meteora",
42
+ "orca",
43
+ "jupiter",
44
+ "pancakeswap",
45
+ "sniper",
46
+ "swap",
47
+ "outsmart"
48
+ ],
49
+ "author": "vincentso",
50
+ "url": "https://github.com/outsmartchad/solana-trading-cli/issues",
51
+ "homepage": "https://github.com/outsmartchad/solana-trading-cli",
52
+ "license": "ISC",
53
+ "engines": {
54
+ "node": ">=20.0.0"
55
+ },
56
+ "dependencies": {
57
+ "@bloxroute/solana-trader-client-ts": "^2.1.6",
58
+ "@coral-xyz/anchor": "^0.29.0",
59
+ "@crypticdot/fusionamm-client": "^1.0.81",
60
+ "@crypticdot/fusionamm-core": "^1.0.81",
61
+ "@metaplex-foundation/js": "^0.20.1",
62
+ "@metaplex-foundation/mpl-token-metadata": "^3.2.1",
63
+ "@metaplex-foundation/umi": "^0.9.1",
64
+ "@metaplex-foundation/umi-bundle-defaults": "^0.9.1",
65
+ "@meteora-ag/cp-amm-sdk": "^1.3.4",
66
+ "@meteora-ag/dlmm": "^1.0.54",
67
+ "@meteora-ag/dynamic-amm-sdk": "^1.4.1",
68
+ "@meteora-ag/dynamic-bonding-curve-sdk": "^1.5.3",
69
+ "@orca-so/whirlpools": "^7.0.1",
70
+ "@raydium-io/raydium-sdk": "^1.3.1-beta.47",
71
+ "@raydium-io/raydium-sdk-v2": "^0.1.23-alpha",
72
+ "@shyft-to/solana-transaction-parser": "^1.1.17",
73
+ "@solana-program/memo": "^0.11.0",
74
+ "@solana-program/token": "^0.11.0",
75
+ "@solana-program/token-2022": "^0.9.0",
76
+ "@solana/kit": "^6.1.0",
77
+ "@solana/spl-token": "^0.4.0",
78
+ "@solana/web3.js": "^1.95.0",
79
+ "@triton-one/yellowstone-grpc": "^0.4.0",
80
+ "async-mutex": "^0.5.0",
81
+ "axios": "^1.6.8",
82
+ "bigint-buffer": "^1.1.5",
83
+ "bn.js": "^5.2.1",
84
+ "bs58": "^5.0.0",
85
+ "commander": "^12.1.0",
86
+ "decimal.js": "^10.4.3",
87
+ "dotenv": "^16.4.5",
88
+ "jito-ts": "^4.2.1",
89
+ "pino": "^8.18.0",
90
+ "pino-pretty": "^10.3.1",
91
+ "pumpdotfun-sdk": "^1.3.2",
92
+ "rpc-websockets": "7.10.0"
93
+ },
94
+ "overrides": {
95
+ "@solana/web3.js": "^1.95.0",
96
+ "axios": "^1.6.8",
97
+ "bigint-buffer": "^1.1.5"
98
+ },
99
+ "resolutions": {
100
+ "@solana/web3.js": "^1.95.0",
101
+ "axios": "^1.6.8",
102
+ "bigint-buffer": "^1.1.5"
103
+ },
104
+ "devDependencies": {
105
+ "@types/bn.js": "^5.2.0",
106
+ "@types/jest": "^30.0.0",
107
+ "@types/node": "^20.0.0",
108
+ "jest": "^29.7.0",
109
+ "ts-jest": "^29.4.6",
110
+ "typescript": "^5.5.4"
111
+ }
112
+ }