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.
- package/LICENSE +21 -0
- package/README.md +568 -0
- package/dist/cli.d.ts +44 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1251 -0
- package/dist/cli.js.map +1 -0
- package/dist/dex/byreal-clmm.d.ts +16 -0
- package/dist/dex/byreal-clmm.d.ts.map +1 -0
- package/dist/dex/byreal-clmm.js +39 -0
- package/dist/dex/byreal-clmm.js.map +1 -0
- package/dist/dex/dflow.d.ts +27 -0
- package/dist/dex/dflow.d.ts.map +1 -0
- package/dist/dex/dflow.js +200 -0
- package/dist/dex/dflow.js.map +1 -0
- package/dist/dex/fusion-amm.d.ts +44 -0
- package/dist/dex/fusion-amm.d.ts.map +1 -0
- package/dist/dex/fusion-amm.js +546 -0
- package/dist/dex/fusion-amm.js.map +1 -0
- package/dist/dex/futarchy-amm.d.ts +32 -0
- package/dist/dex/futarchy-amm.d.ts.map +1 -0
- package/dist/dex/futarchy-amm.js +443 -0
- package/dist/dex/futarchy-amm.js.map +1 -0
- package/dist/dex/futarchy-idl.d.ts +2568 -0
- package/dist/dex/futarchy-idl.d.ts.map +1 -0
- package/dist/dex/futarchy-idl.js +2570 -0
- package/dist/dex/futarchy-idl.js.map +1 -0
- package/dist/dex/futarchy-launchpad.d.ts +68 -0
- package/dist/dex/futarchy-launchpad.d.ts.map +1 -0
- package/dist/dex/futarchy-launchpad.js +377 -0
- package/dist/dex/futarchy-launchpad.js.map +1 -0
- package/dist/dex/index.d.ts +88 -0
- package/dist/dex/index.d.ts.map +1 -0
- package/dist/dex/index.js +159 -0
- package/dist/dex/index.js.map +1 -0
- package/dist/dex/jupiter-ultra.d.ts +27 -0
- package/dist/dex/jupiter-ultra.d.ts.map +1 -0
- package/dist/dex/jupiter-ultra.js +369 -0
- package/dist/dex/jupiter-ultra.js.map +1 -0
- package/dist/dex/meteora-damm-v1.d.ts +36 -0
- package/dist/dex/meteora-damm-v1.d.ts.map +1 -0
- package/dist/dex/meteora-damm-v1.js +314 -0
- package/dist/dex/meteora-damm-v1.js.map +1 -0
- package/dist/dex/meteora-damm-v2.d.ts +103 -0
- package/dist/dex/meteora-damm-v2.d.ts.map +1 -0
- package/dist/dex/meteora-damm-v2.js +1146 -0
- package/dist/dex/meteora-damm-v2.js.map +1 -0
- package/dist/dex/meteora-dbc.d.ts +38 -0
- package/dist/dex/meteora-dbc.d.ts.map +1 -0
- package/dist/dex/meteora-dbc.js +374 -0
- package/dist/dex/meteora-dbc.js.map +1 -0
- package/dist/dex/meteora-dlmm.d.ts +79 -0
- package/dist/dex/meteora-dlmm.d.ts.map +1 -0
- package/dist/dex/meteora-dlmm.js +735 -0
- package/dist/dex/meteora-dlmm.js.map +1 -0
- package/dist/dex/orca.d.ts +31 -0
- package/dist/dex/orca.d.ts.map +1 -0
- package/dist/dex/orca.js +536 -0
- package/dist/dex/orca.js.map +1 -0
- package/dist/dex/pancakeswap-clmm.d.ts +16 -0
- package/dist/dex/pancakeswap-clmm.d.ts.map +1 -0
- package/dist/dex/pancakeswap-clmm.js +39 -0
- package/dist/dex/pancakeswap-clmm.js.map +1 -0
- package/dist/dex/pumpfun-amm.d.ts +46 -0
- package/dist/dex/pumpfun-amm.d.ts.map +1 -0
- package/dist/dex/pumpfun-amm.js +692 -0
- package/dist/dex/pumpfun-amm.js.map +1 -0
- package/dist/dex/pumpfun.d.ts +41 -0
- package/dist/dex/pumpfun.d.ts.map +1 -0
- package/dist/dex/pumpfun.js +555 -0
- package/dist/dex/pumpfun.js.map +1 -0
- package/dist/dex/raydium-amm-v4.d.ts +11 -0
- package/dist/dex/raydium-amm-v4.d.ts.map +1 -0
- package/dist/dex/raydium-amm-v4.js +649 -0
- package/dist/dex/raydium-amm-v4.js.map +1 -0
- package/dist/dex/raydium-clmm.d.ts +12 -0
- package/dist/dex/raydium-clmm.d.ts.map +1 -0
- package/dist/dex/raydium-clmm.js +675 -0
- package/dist/dex/raydium-clmm.js.map +1 -0
- package/dist/dex/raydium-cpmm.d.ts +10 -0
- package/dist/dex/raydium-cpmm.d.ts.map +1 -0
- package/dist/dex/raydium-cpmm.js +613 -0
- package/dist/dex/raydium-cpmm.js.map +1 -0
- package/dist/dex/raydium-launchlab.d.ts +12 -0
- package/dist/dex/raydium-launchlab.d.ts.map +1 -0
- package/dist/dex/raydium-launchlab.js +530 -0
- package/dist/dex/raydium-launchlab.js.map +1 -0
- package/dist/dex/shared/clmm-base.d.ts +58 -0
- package/dist/dex/shared/clmm-base.d.ts.map +1 -0
- package/dist/dex/shared/clmm-base.js +891 -0
- package/dist/dex/shared/clmm-base.js.map +1 -0
- package/dist/dex/types.d.ts +601 -0
- package/dist/dex/types.d.ts.map +1 -0
- package/dist/dex/types.js +137 -0
- package/dist/dex/types.js.map +1 -0
- package/dist/dexscreener/index.d.ts +2 -0
- package/dist/dexscreener/index.d.ts.map +1 -0
- package/dist/dexscreener/index.js +18 -0
- package/dist/dexscreener/index.js.map +1 -0
- package/dist/dexscreener/info.d.ts +22 -0
- package/dist/dexscreener/info.d.ts.map +1 -0
- package/dist/dexscreener/info.js +104 -0
- package/dist/dexscreener/info.js.map +1 -0
- package/dist/helpers/check_balance.d.ts +10 -0
- package/dist/helpers/check_balance.d.ts.map +1 -0
- package/dist/helpers/check_balance.js +34 -0
- package/dist/helpers/check_balance.js.map +1 -0
- package/dist/helpers/config.d.ts +51 -0
- package/dist/helpers/config.d.ts.map +1 -0
- package/dist/helpers/config.js +118 -0
- package/dist/helpers/config.js.map +1 -0
- package/dist/helpers/index.d.ts +8 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +29 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/logger.d.ts +27 -0
- package/dist/helpers/logger.d.ts.map +1 -0
- package/dist/helpers/logger.js +39 -0
- package/dist/helpers/logger.js.map +1 -0
- package/dist/helpers/token-2022.d.ts +32 -0
- package/dist/helpers/token-2022.d.ts.map +1 -0
- package/dist/helpers/token-2022.js +48 -0
- package/dist/helpers/token-2022.js.map +1 -0
- package/dist/helpers/unwrap_sol.d.ts +2 -0
- package/dist/helpers/unwrap_sol.d.ts.map +1 -0
- package/dist/helpers/unwrap_sol.js +67 -0
- package/dist/helpers/unwrap_sol.js.map +1 -0
- package/dist/helpers/util.d.ts +698 -0
- package/dist/helpers/util.d.ts.map +1 -0
- package/dist/helpers/util.js +181 -0
- package/dist/helpers/util.js.map +1 -0
- package/dist/helpers/utils.d.ts +10 -0
- package/dist/helpers/utils.d.ts.map +1 -0
- package/dist/helpers/utils.js +97 -0
- package/dist/helpers/utils.js.map +1 -0
- package/dist/helpers/wrap_sol.d.ts +3 -0
- package/dist/helpers/wrap_sol.d.ts.map +1 -0
- package/dist/helpers/wrap_sol.js +88 -0
- package/dist/helpers/wrap_sol.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/transactions/bloXroute_tips_tx_executor.d.ts +4 -0
- package/dist/transactions/bloXroute_tips_tx_executor.d.ts.map +1 -0
- package/dist/transactions/bloXroute_tips_tx_executor.js +70 -0
- package/dist/transactions/bloXroute_tips_tx_executor.js.map +1 -0
- package/dist/transactions/index.d.ts +6 -0
- package/dist/transactions/index.d.ts.map +1 -0
- package/dist/transactions/index.js +30 -0
- package/dist/transactions/index.js.map +1 -0
- package/dist/transactions/jito_tips_tx_executor.d.ts +15 -0
- package/dist/transactions/jito_tips_tx_executor.d.ts.map +1 -0
- package/dist/transactions/jito_tips_tx_executor.js +99 -0
- package/dist/transactions/jito_tips_tx_executor.js.map +1 -0
- package/dist/transactions/landing/index.d.ts +30 -0
- package/dist/transactions/landing/index.d.ts.map +1 -0
- package/dist/transactions/landing/index.js +60 -0
- package/dist/transactions/landing/index.js.map +1 -0
- package/dist/transactions/landing/nonce-manager.d.ts +116 -0
- package/dist/transactions/landing/nonce-manager.d.ts.map +1 -0
- package/dist/transactions/landing/nonce-manager.js +393 -0
- package/dist/transactions/landing/nonce-manager.js.map +1 -0
- package/dist/transactions/landing/orchestrator.d.ts +104 -0
- package/dist/transactions/landing/orchestrator.d.ts.map +1 -0
- package/dist/transactions/landing/orchestrator.js +329 -0
- package/dist/transactions/landing/orchestrator.js.map +1 -0
- package/dist/transactions/landing/providers/astralane.d.ts +12 -0
- package/dist/transactions/landing/providers/astralane.d.ts.map +1 -0
- package/dist/transactions/landing/providers/astralane.js +132 -0
- package/dist/transactions/landing/providers/astralane.js.map +1 -0
- package/dist/transactions/landing/providers/blockrazor.d.ts +11 -0
- package/dist/transactions/landing/providers/blockrazor.d.ts.map +1 -0
- package/dist/transactions/landing/providers/blockrazor.js +134 -0
- package/dist/transactions/landing/providers/blockrazor.js.map +1 -0
- package/dist/transactions/landing/providers/bloxroute.d.ts +12 -0
- package/dist/transactions/landing/providers/bloxroute.d.ts.map +1 -0
- package/dist/transactions/landing/providers/bloxroute.js +102 -0
- package/dist/transactions/landing/providers/bloxroute.js.map +1 -0
- package/dist/transactions/landing/providers/flashblock.d.ts +10 -0
- package/dist/transactions/landing/providers/flashblock.d.ts.map +1 -0
- package/dist/transactions/landing/providers/flashblock.js +102 -0
- package/dist/transactions/landing/providers/flashblock.js.map +1 -0
- package/dist/transactions/landing/providers/helius-sender.d.ts +11 -0
- package/dist/transactions/landing/providers/helius-sender.d.ts.map +1 -0
- package/dist/transactions/landing/providers/helius-sender.js +101 -0
- package/dist/transactions/landing/providers/helius-sender.js.map +1 -0
- package/dist/transactions/landing/providers/jito.d.ts +16 -0
- package/dist/transactions/landing/providers/jito.d.ts.map +1 -0
- package/dist/transactions/landing/providers/jito.js +110 -0
- package/dist/transactions/landing/providers/jito.js.map +1 -0
- package/dist/transactions/landing/providers/nextblock.d.ts +11 -0
- package/dist/transactions/landing/providers/nextblock.d.ts.map +1 -0
- package/dist/transactions/landing/providers/nextblock.js +109 -0
- package/dist/transactions/landing/providers/nextblock.js.map +1 -0
- package/dist/transactions/landing/providers/node1.d.ts +11 -0
- package/dist/transactions/landing/providers/node1.d.ts.map +1 -0
- package/dist/transactions/landing/providers/node1.js +101 -0
- package/dist/transactions/landing/providers/node1.js.map +1 -0
- package/dist/transactions/landing/providers/nozomi.d.ts +11 -0
- package/dist/transactions/landing/providers/nozomi.d.ts.map +1 -0
- package/dist/transactions/landing/providers/nozomi.js +124 -0
- package/dist/transactions/landing/providers/nozomi.js.map +1 -0
- package/dist/transactions/landing/providers/soyas.d.ts +16 -0
- package/dist/transactions/landing/providers/soyas.d.ts.map +1 -0
- package/dist/transactions/landing/providers/soyas.js +192 -0
- package/dist/transactions/landing/providers/soyas.js.map +1 -0
- package/dist/transactions/landing/providers/stellium.d.ts +11 -0
- package/dist/transactions/landing/providers/stellium.d.ts.map +1 -0
- package/dist/transactions/landing/providers/stellium.js +102 -0
- package/dist/transactions/landing/providers/stellium.js.map +1 -0
- package/dist/transactions/landing/providers/zero-slot.d.ts +10 -0
- package/dist/transactions/landing/providers/zero-slot.d.ts.map +1 -0
- package/dist/transactions/landing/providers/zero-slot.js +92 -0
- package/dist/transactions/landing/providers/zero-slot.js.map +1 -0
- package/dist/transactions/landing/tip-accounts.d.ts +22 -0
- package/dist/transactions/landing/tip-accounts.d.ts.map +1 -0
- package/dist/transactions/landing/tip-accounts.js +140 -0
- package/dist/transactions/landing/tip-accounts.js.map +1 -0
- package/dist/transactions/landing/types.d.ts +98 -0
- package/dist/transactions/landing/types.d.ts.map +1 -0
- package/dist/transactions/landing/types.js +30 -0
- package/dist/transactions/landing/types.js.map +1 -0
- package/dist/transactions/nozomi/tx-submission.d.ts +14 -0
- package/dist/transactions/nozomi/tx-submission.d.ts.map +1 -0
- package/dist/transactions/nozomi/tx-submission.js +107 -0
- package/dist/transactions/nozomi/tx-submission.js.map +1 -0
- package/dist/transactions/send-rpc.d.ts +54 -0
- package/dist/transactions/send-rpc.d.ts.map +1 -0
- package/dist/transactions/send-rpc.js +126 -0
- package/dist/transactions/send-rpc.js.map +1 -0
- package/dist/transactions/simple_tx_executor.d.ts +10 -0
- package/dist/transactions/simple_tx_executor.d.ts.map +1 -0
- package/dist/transactions/simple_tx_executor.js +33 -0
- package/dist/transactions/simple_tx_executor.js.map +1 -0
- package/package.json +112 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/helpers/util.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAU3E,OAAO,EACL,UAAU,EAGX,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM;;;GAiBrD;AAED;;GAEG;AACH,wBAAsB,MAAM,CAC1B,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,CAAC,oBAAoB,GAAG,GAAG,CAAC,EAAE,EACnC,OAAO,CAAC,EAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GACzD,OAAO,CAAC,MAAM,EAAE,CAAC,CAiBnB;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
@@ -0,0 +1,181 @@
|
|
|
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.sleep = void 0;
|
|
7
|
+
exports.getTokenMetadata = getTokenMetadata;
|
|
8
|
+
exports.sendTx = sendTx;
|
|
9
|
+
exports.getWalletTokenAccount = getWalletTokenAccount;
|
|
10
|
+
exports.buildAndSendTx = buildAndSendTx;
|
|
11
|
+
exports.sleepTime = sleepTime;
|
|
12
|
+
exports.loadOrCreateKeypair_wallet = loadOrCreateKeypair_wallet;
|
|
13
|
+
exports.isBlockhashExpired = isBlockhashExpired;
|
|
14
|
+
exports.checkTx = checkTx;
|
|
15
|
+
exports.getDecimals = getDecimals;
|
|
16
|
+
const raydium_sdk_1 = require("@raydium-io/raydium-sdk");
|
|
17
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
18
|
+
const config_1 = require("./config");
|
|
19
|
+
const js_1 = require("@metaplex-foundation/js");
|
|
20
|
+
const fs_1 = __importDefault(require("fs"));
|
|
21
|
+
const web3_js_2 = require("@solana/web3.js");
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves the metadata of a token based on its address.
|
|
24
|
+
*/
|
|
25
|
+
async function getTokenMetadata(address) {
|
|
26
|
+
const connection = (0, config_1.getConnection)();
|
|
27
|
+
const metaplex = js_1.Metaplex.make(connection);
|
|
28
|
+
const mintAddress = new web3_js_1.PublicKey(address);
|
|
29
|
+
let tokenName;
|
|
30
|
+
let tokenSymbol;
|
|
31
|
+
const metadataAccount = metaplex.nfts().pdas().metadata({ mint: mintAddress });
|
|
32
|
+
const metadataAccountInfo = await connection.getAccountInfo(metadataAccount);
|
|
33
|
+
if (metadataAccountInfo) {
|
|
34
|
+
const token = await metaplex.nfts().findByMint({ mintAddress });
|
|
35
|
+
tokenName = token.name;
|
|
36
|
+
tokenSymbol = token.symbol;
|
|
37
|
+
}
|
|
38
|
+
return { tokenName, tokenSymbol };
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Sends multiple transactions to the Solana blockchain.
|
|
42
|
+
*/
|
|
43
|
+
async function sendTx(connection, payer, txs, options) {
|
|
44
|
+
const txids = [];
|
|
45
|
+
for (const iTx of txs) {
|
|
46
|
+
try {
|
|
47
|
+
if (iTx instanceof web3_js_1.VersionedTransaction) {
|
|
48
|
+
iTx.sign([payer]);
|
|
49
|
+
txids.push(await connection.sendRawTransaction(iTx.serialize(), options));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
txids.push(await connection.sendTransaction(iTx, [payer], options));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
console.error("sendTx error on transaction:", e);
|
|
57
|
+
// Continue with remaining transactions but surface the error
|
|
58
|
+
throw e;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return txids;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves the token account associated with a wallet.
|
|
65
|
+
*/
|
|
66
|
+
async function getWalletTokenAccount(localconnection, localwallet) {
|
|
67
|
+
const walletTokenAccount = await localconnection.getTokenAccountsByOwner(localwallet, {
|
|
68
|
+
programId: raydium_sdk_1.TOKEN_PROGRAM_ID,
|
|
69
|
+
});
|
|
70
|
+
return walletTokenAccount.value.map((i) => ({
|
|
71
|
+
pubkey: i.pubkey,
|
|
72
|
+
programId: i.account.owner,
|
|
73
|
+
accountInfo: raydium_sdk_1.SPL_ACCOUNT_LAYOUT.decode(i.account.data),
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Builds and sends a transaction with configurable compute budget.
|
|
78
|
+
*/
|
|
79
|
+
async function buildAndSendTx(innerSimpleV0Transaction, options, computeUnits = 101337, priorityFeeMicroLamports = 421197) {
|
|
80
|
+
const connection = (0, config_1.getConnection)();
|
|
81
|
+
const wallet = (0, config_1.getWallet)();
|
|
82
|
+
try {
|
|
83
|
+
const recentBlockhash = await connection.getLatestBlockhash("confirmed");
|
|
84
|
+
const priority_fee_arr = [
|
|
85
|
+
web3_js_2.ComputeBudgetProgram.setComputeUnitLimit({ units: computeUnits }),
|
|
86
|
+
web3_js_2.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: priorityFeeMicroLamports }),
|
|
87
|
+
];
|
|
88
|
+
const original_inner_instructions = innerSimpleV0Transaction[0].instructions;
|
|
89
|
+
innerSimpleV0Transaction[0].instructions = [...priority_fee_arr, ...original_inner_instructions];
|
|
90
|
+
const willSendTx = await (0, raydium_sdk_1.buildSimpleTransaction)({
|
|
91
|
+
connection,
|
|
92
|
+
makeTxVersion: config_1.makeTxVersion,
|
|
93
|
+
payer: wallet.publicKey,
|
|
94
|
+
innerTransactions: innerSimpleV0Transaction,
|
|
95
|
+
addLookupTableInfo: config_1.addLookupTableInfo,
|
|
96
|
+
});
|
|
97
|
+
return await sendTx(connection, wallet, willSendTx, options);
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
console.error("buildAndSendTx error:", e);
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Sleeps for a specified amount of time.
|
|
106
|
+
*/
|
|
107
|
+
async function sleepTime(ms) {
|
|
108
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Loads or creates a Solana keypair from a file.
|
|
112
|
+
*/
|
|
113
|
+
async function loadOrCreateKeypair_wallet(filepath) {
|
|
114
|
+
try {
|
|
115
|
+
const keypairString = fs_1.default.readFileSync(filepath, { encoding: "utf8" });
|
|
116
|
+
return web3_js_1.Keypair.fromSecretKey(Uint8Array.from(JSON.parse(keypairString)));
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
const newKeypair = web3_js_1.Keypair.generate();
|
|
120
|
+
fs_1.default.writeFileSync(filepath, JSON.stringify(Array.from(newKeypair.secretKey)), { mode: 0o600 });
|
|
121
|
+
console.log(`New keypair created and saved to ${filepath}`);
|
|
122
|
+
return newKeypair;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
async function isBlockhashExpired(lastValidBlockHeight) {
|
|
126
|
+
const connection = (0, config_1.getConnection)();
|
|
127
|
+
const currentBlockHeight = await connection.getBlockHeight("finalized");
|
|
128
|
+
return currentBlockHeight > lastValidBlockHeight - 150;
|
|
129
|
+
}
|
|
130
|
+
const sleep = (ms) => {
|
|
131
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
132
|
+
};
|
|
133
|
+
exports.sleep = sleep;
|
|
134
|
+
/**
|
|
135
|
+
* Polls transaction status until confirmed or blockhash expires.
|
|
136
|
+
*/
|
|
137
|
+
async function checkTx(txId) {
|
|
138
|
+
const connection = (0, config_1.getConnection)();
|
|
139
|
+
const blockhashResponse = await connection.getLatestBlockhashAndContext("finalized");
|
|
140
|
+
const lastValidHeight = blockhashResponse.value.lastValidBlockHeight;
|
|
141
|
+
let hashExpired = false;
|
|
142
|
+
let txSuccess = false;
|
|
143
|
+
const maxPolls = 60;
|
|
144
|
+
let polls = 0;
|
|
145
|
+
while (!hashExpired && !txSuccess && polls < maxPolls) {
|
|
146
|
+
polls++;
|
|
147
|
+
const { value: status } = await connection.getSignatureStatus(txId);
|
|
148
|
+
if (status &&
|
|
149
|
+
(status.confirmationStatus === "confirmed" || status.confirmationStatus === "finalized")) {
|
|
150
|
+
txSuccess = true;
|
|
151
|
+
console.log(`Transaction confirmed.`);
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
hashExpired = await isBlockhashExpired(lastValidHeight);
|
|
155
|
+
if (hashExpired) {
|
|
156
|
+
console.log(`Blockhash has expired.`);
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
await (0, exports.sleep)(2500);
|
|
160
|
+
}
|
|
161
|
+
if (polls >= maxPolls) {
|
|
162
|
+
console.log(`Transaction status polling timed out after ${maxPolls} attempts.`);
|
|
163
|
+
}
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Gets the decimals for a given SPL token mint.
|
|
168
|
+
*/
|
|
169
|
+
async function getDecimals(mintAddress) {
|
|
170
|
+
const connection = (0, config_1.getConnection)();
|
|
171
|
+
const info = await connection.getParsedAccountInfo(mintAddress);
|
|
172
|
+
if (!info.value || !info.value.data) {
|
|
173
|
+
throw new Error(`Could not find mint account: ${mintAddress.toBase58()}`);
|
|
174
|
+
}
|
|
175
|
+
const parsed = info.value.data;
|
|
176
|
+
if (!parsed.parsed?.info?.decimals && parsed.parsed?.info?.decimals !== 0) {
|
|
177
|
+
throw new Error(`Could not parse decimals for mint: ${mintAddress.toBase58()}`);
|
|
178
|
+
}
|
|
179
|
+
return parsed.parsed.info.decimals;
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/helpers/util.ts"],"names":[],"mappings":";;;;;;AAwBA,4CAiBC;AAKD,wBAsBC;AAKD,sDASC;AAKD,wCA8BC;AAKD,8BAEC;AAKD,gEAUC;AAED,gDAIC;AASD,0BAqCC;AAKD,kCAWC;AA/MD,yDAIiC;AACjC,6CAA2E;AAC3E,qCAMkB;AAClB,gDAAmD;AACnD,4CAAoB;AACpB,6CAIyB;AAEzB;;GAEG;AACI,KAAK,UAAU,gBAAgB,CAAC,OAAe;IACpD,MAAM,UAAU,GAAG,IAAA,sBAAa,GAAE,CAAC;IACnC,MAAM,QAAQ,GAAG,aAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC3C,MAAM,WAAW,GAAG,IAAI,mBAAS,CAAC,OAAO,CAAC,CAAC;IAE3C,IAAI,SAA6B,CAAC;IAClC,IAAI,WAA+B,CAAC;IAEpC,MAAM,eAAe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BAAkB,CAAC,eAAe,CAAC,CAAC;QAExD,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;YACtC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,IAAA,aAAK,EAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,IAAI,KAAK,IAAI,QAAQ,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,8CAA8C,QAAQ,YAAY,CAAC,CAAC;IAClF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,WAAW,CAAC,WAAsB;IACtD,MAAM,UAAU,GAAG,IAAA,sBAAa,GAAE,CAAC;IACnC,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAChE,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,gCAAgC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAW,CAAC;IACtC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,KAAK,CAAC,EAAE,CAAC;QAC1E,MAAM,IAAI,KAAK,CAAC,sCAAsC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAClF,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Logger } from "pino";
|
|
2
|
+
import { Keypair, Connection, PublicKey } from "@solana/web3.js";
|
|
3
|
+
export declare const retrieveEnvVariable: (variableName: string, logger: Logger) => string;
|
|
4
|
+
export declare function getKeypairByJsonPath(jsonPath: string): Keypair | undefined;
|
|
5
|
+
export declare function printSOLBalance(connection: Connection, pubKey: PublicKey, info?: string): Promise<void>;
|
|
6
|
+
export declare function getSPLBalance(connection: Connection, mintAddress: PublicKey, pubKey: PublicKey, allowOffCurve?: boolean): Promise<number>;
|
|
7
|
+
export declare function printSPLBalance(connection: Connection, mintAddress: PublicKey, user: PublicKey, info?: string): Promise<void>;
|
|
8
|
+
export declare function retrieveWalletState(walletAddress: string): Promise<Record<string, number>>;
|
|
9
|
+
export declare const retriveWalletState: typeof retrieveWalletState;
|
|
10
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/helpers/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,OAAO,EAAoB,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAInF,eAAO,MAAM,mBAAmB,GAAI,cAAc,MAAM,EAAE,QAAQ,MAAM,KAAG,MAQ1E,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAS1E;AAED,wBAAsB,eAAe,CACnC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,SAAS,EACjB,IAAI,SAAK,GACR,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAsB,aAAa,CACjC,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,SAAS,EACtB,MAAM,EAAE,SAAS,EACjB,aAAa,UAAQ,GACpB,OAAO,CAAC,MAAM,CAAC,CAajB;AAED,wBAAsB,eAAe,CACnC,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,SAAS,EACtB,IAAI,EAAE,SAAS,EACf,IAAI,SAAK,GACR,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAsB,mBAAmB,CACvC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA4BjC;AAGD,eAAO,MAAM,kBAAkB,4BAAsB,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
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.retriveWalletState = exports.retrieveEnvVariable = void 0;
|
|
7
|
+
exports.getKeypairByJsonPath = getKeypairByJsonPath;
|
|
8
|
+
exports.printSOLBalance = printSOLBalance;
|
|
9
|
+
exports.getSPLBalance = getSPLBalance;
|
|
10
|
+
exports.printSPLBalance = printSPLBalance;
|
|
11
|
+
exports.retrieveWalletState = retrieveWalletState;
|
|
12
|
+
const fs_1 = __importDefault(require("fs"));
|
|
13
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
14
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
15
|
+
const config_1 = require("./config");
|
|
16
|
+
const retrieveEnvVariable = (variableName, logger) => {
|
|
17
|
+
const variable = process.env[variableName] || "";
|
|
18
|
+
if (!variable) {
|
|
19
|
+
// Don't hard-exit. Log and throw so callers can handle gracefully.
|
|
20
|
+
logger.error(`${variableName} is not set`);
|
|
21
|
+
throw new Error(`Required environment variable ${variableName} is not set`);
|
|
22
|
+
}
|
|
23
|
+
return variable;
|
|
24
|
+
};
|
|
25
|
+
exports.retrieveEnvVariable = retrieveEnvVariable;
|
|
26
|
+
function getKeypairByJsonPath(jsonPath) {
|
|
27
|
+
try {
|
|
28
|
+
const keypairJson = fs_1.default.readFileSync(jsonPath, "utf-8");
|
|
29
|
+
const data = JSON.parse(keypairJson);
|
|
30
|
+
return web3_js_1.Keypair.fromSecretKey(Uint8Array.from(data));
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
console.log(`Error loading keypair from ${jsonPath}:`, e);
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async function printSOLBalance(connection, pubKey, info = "") {
|
|
38
|
+
const balance = await connection.getBalance(pubKey);
|
|
39
|
+
console.log(`${info ? info + " " : ""}${pubKey.toBase58()}:`, balance / web3_js_1.LAMPORTS_PER_SOL, `SOL`);
|
|
40
|
+
}
|
|
41
|
+
async function getSPLBalance(connection, mintAddress, pubKey, allowOffCurve = false) {
|
|
42
|
+
try {
|
|
43
|
+
const ata = (0, spl_token_1.getAssociatedTokenAddressSync)(mintAddress, pubKey, allowOffCurve);
|
|
44
|
+
const balance = await connection.getTokenAccountBalance(ata, "processed");
|
|
45
|
+
return balance.value.uiAmount || 0;
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
// Only swallow "account not found" errors -- re-throw network errors
|
|
49
|
+
if (e?.message?.includes("could not find account") || e?.message?.includes("Invalid param")) {
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
console.error(`Error fetching SPL balance for ${mintAddress.toBase58()}:`, e?.message);
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async function printSPLBalance(connection, mintAddress, user, info = "") {
|
|
57
|
+
const balance = await getSPLBalance(connection, mintAddress, user);
|
|
58
|
+
if (balance === 0) {
|
|
59
|
+
console.log(`${info ? info + " " : ""}${user.toBase58()}:`, "0 (No Account or Empty)");
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
console.log(`${info ? info + " " : ""}${user.toBase58()}:`, balance);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function retrieveWalletState(walletAddress) {
|
|
66
|
+
const connection = (0, config_1.getConnection)();
|
|
67
|
+
try {
|
|
68
|
+
const filters = [
|
|
69
|
+
{ dataSize: 165 },
|
|
70
|
+
{
|
|
71
|
+
memcmp: {
|
|
72
|
+
offset: 32,
|
|
73
|
+
bytes: walletAddress,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
const TOKEN_PROGRAM = new web3_js_1.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
|
|
78
|
+
const accounts = await connection.getParsedProgramAccounts(TOKEN_PROGRAM, { filters });
|
|
79
|
+
const results = {};
|
|
80
|
+
const solBalance = await connection.getBalance(new web3_js_1.PublicKey(walletAddress));
|
|
81
|
+
accounts.forEach((account) => {
|
|
82
|
+
const parsedData = account.account.data;
|
|
83
|
+
const mintAddress = parsedData["parsed"]["info"]["mint"];
|
|
84
|
+
const tokenBalance = parsedData["parsed"]["info"]["tokenAmount"]["uiAmount"];
|
|
85
|
+
results[mintAddress] = tokenBalance;
|
|
86
|
+
});
|
|
87
|
+
results["SOL"] = solBalance / web3_js_1.LAMPORTS_PER_SOL;
|
|
88
|
+
return results;
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
console.log(e);
|
|
92
|
+
}
|
|
93
|
+
return {};
|
|
94
|
+
}
|
|
95
|
+
// Backward compatibility alias
|
|
96
|
+
exports.retriveWalletState = retrieveWalletState;
|
|
97
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/helpers/utils.ts"],"names":[],"mappings":";;;;;;AAgBA,oDASC;AAED,0CAWC;AAED,sCAkBC;AAED,0CAYC;AAED,kDA8BC;AAvGD,4CAAoB;AACpB,6CAAmF;AACnF,iDAAkE;AAClE,qCAAyC;AAElC,MAAM,mBAAmB,GAAG,CAAC,YAAoB,EAAE,MAAc,EAAU,EAAE;IAClF,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IACjD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,mEAAmE;QACnE,MAAM,CAAC,KAAK,CAAC,GAAG,YA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AED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAKxD"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wrap_sol = wrap_sol;
|
|
4
|
+
exports.check_wsol_balance = check_wsol_balance;
|
|
5
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
6
|
+
const config_1 = require("./config");
|
|
7
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
8
|
+
const check_balance_1 = require("./check_balance");
|
|
9
|
+
const jito_tips_tx_executor_1 = require("../transactions/jito_tips_tx_executor");
|
|
10
|
+
async function wrap_sol(amount) {
|
|
11
|
+
const wallet = (0, config_1.getWallet)();
|
|
12
|
+
const connection = (0, config_1.getConnection)();
|
|
13
|
+
if (amount <= 0) {
|
|
14
|
+
console.log("Amount must be greater than 0");
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
// wSol ATA
|
|
18
|
+
const wSolAta = await (0, spl_token_1.getOrCreateAssociatedTokenAccount)(connection, wallet, spl_token_1.NATIVE_MINT, wallet.publicKey);
|
|
19
|
+
console.log(`wsol ATA: ${wSolAta.address.toBase58()}`);
|
|
20
|
+
// wrap Sol
|
|
21
|
+
const lamports = Math.round(amount * web3_js_1.LAMPORTS_PER_SOL);
|
|
22
|
+
let transaction = new web3_js_1.Transaction().add(web3_js_1.SystemProgram.transfer({
|
|
23
|
+
fromPubkey: wallet.publicKey,
|
|
24
|
+
toPubkey: wSolAta.address,
|
|
25
|
+
lamports,
|
|
26
|
+
}), (0, spl_token_1.createSyncNativeInstruction)(wSolAta.address));
|
|
27
|
+
let latestBlockhash = await connection.getLatestBlockhash();
|
|
28
|
+
const messageV0 = new web3_js_1.TransactionMessage({
|
|
29
|
+
payerKey: wallet.publicKey,
|
|
30
|
+
recentBlockhash: latestBlockhash.blockhash,
|
|
31
|
+
instructions: [
|
|
32
|
+
web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 70000 }),
|
|
33
|
+
...transaction.instructions,
|
|
34
|
+
],
|
|
35
|
+
}).compileToV0Message();
|
|
36
|
+
const tx = new web3_js_1.VersionedTransaction(messageV0);
|
|
37
|
+
tx.sign([wallet]);
|
|
38
|
+
let attempts = 0;
|
|
39
|
+
const maxAttempts = 3;
|
|
40
|
+
while (attempts < maxAttempts) {
|
|
41
|
+
attempts++;
|
|
42
|
+
try {
|
|
43
|
+
const res = await (0, jito_tips_tx_executor_1.jito_executeAndConfirm)(tx, wallet, latestBlockhash, config_1.jito_fee);
|
|
44
|
+
const signature = res.signature;
|
|
45
|
+
if (signature) {
|
|
46
|
+
console.log(`Transaction successful: ${signature}`);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
console.log("jito fee transaction failed");
|
|
51
|
+
console.log(`Retry attempt ${attempts}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
console.log(e);
|
|
56
|
+
}
|
|
57
|
+
latestBlockhash = await connection.getLatestBlockhash();
|
|
58
|
+
}
|
|
59
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
60
|
+
await check_wsol_balance();
|
|
61
|
+
}
|
|
62
|
+
async function check_wsol_balance() {
|
|
63
|
+
const wallet = (0, config_1.getWallet)();
|
|
64
|
+
const connection = (0, config_1.getConnection)();
|
|
65
|
+
const wsolBalance = await (0, check_balance_1.getSPLTokenBalance)(connection, spl_token_1.NATIVE_MINT, wallet.publicKey);
|
|
66
|
+
console.log(`new wsol balance: ${wsolBalance}`);
|
|
67
|
+
}
|
|
68
|
+
// CLI entry point -- only runs when executed directly
|
|
69
|
+
if (require.main === module) {
|
|
70
|
+
const { program } = require("commander");
|
|
71
|
+
const { logger } = require("./logger");
|
|
72
|
+
program
|
|
73
|
+
.option("-s, --size <size>", "size of sol to wrap")
|
|
74
|
+
.option("-h, --help", "display help for command")
|
|
75
|
+
.action(async (options) => {
|
|
76
|
+
if (options.help) {
|
|
77
|
+
logger.info("ts-node src/helpers/wrap_sol.ts --size <size>");
|
|
78
|
+
process.exit(0);
|
|
79
|
+
}
|
|
80
|
+
if (!options.size) {
|
|
81
|
+
console.error("Missing required option: --size");
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
await wrap_sol(parseFloat(options.size));
|
|
85
|
+
});
|
|
86
|
+
program.parse();
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=wrap_sol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap_sol.js","sourceRoot":"","sources":["../../src/helpers/wrap_sol.ts"],"names":[],"mappings":";;AAMA,4BA6DC;AAED,gDAKC;AA1ED,iDAAgH;AAChH,qCAA8D;AAC9D,6CAA+I;AAC/I,mDAAqD;AACrD,iFAA+E;AAExE,KAAK,UAAU,QAAQ,CAAC,MAAc;IAC3C,MAAM,MAAM,GAAG,IAAA,kBAAS,GAAE,CAAC;IAC3B,MAAM,UAAU,GAAG,IAAA,sBAAa,GAAE,CAAC;IAEnC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAC7C,OAAO;IACT,CAAC;IAED,WAAW;IACX,MAAM,OAAO,GAAG,MAAM,IAAA,6CAAiC,EAAC,UAAU,EAAE,MAAM,EAAE,uBAAW,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;IAC3G,OAAO,CAAC,GAAG,CAAC,aAAa,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEvD,WAAW;IACX,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,0BAAgB,CAAC,CAAC;IACvD,IAAI,WAAW,GAAG,IAAI,qBAAW,EAAE,CAAC,GAAG,CACrC,uBAAa,CAAC,QAAQ,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC,SAAS;QAC5B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;QACD,MAAM,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEL,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* outsmart — Programmatic API
|
|
3
|
+
*
|
|
4
|
+
* This is the library entry point for consumers who `import { ... } from "outsmart"`.
|
|
5
|
+
* Re-exports the DEX registry, types, and landing layer for programmatic use.
|
|
6
|
+
*
|
|
7
|
+
* For CLI usage, run `outsmart` directly (see src/cli.ts).
|
|
8
|
+
*/
|
|
9
|
+
export { DexRegistry, getRegistry, getDexAdapter, listDexAdapters, registerAdapter, } from "./dex";
|
|
10
|
+
export type { IDexAdapter, DexAdapterInfo, DexCapabilities, BuyParams, SellParams, SnipeParams, SwapOpts, SwapResult, PoolInfo, PriceInfo, TxResult, BuildSwapIxsResult, AddLiquidityParams, RemoveLiquidityParams, SwapSide, } from "./dex/types";
|
|
11
|
+
export { UnsupportedOperationError, PoolNotFoundError, defaultCapabilities, WSOL_MINT, USDC_MINT, USDT_MINT, DEFAULT_SLIPPAGE_BPS, DEFAULT_PRIORITY_FEE_MICRO_LAMPORTS, DEFAULT_COMPUTE_UNIT_LIMIT, } from "./dex/types";
|
|
12
|
+
export type { ILandingProvider, LandingResult, SubmitOptions, SubmissionStrategy, OrchestratorConfig, TipAccount, } from "./transactions/landing/types";
|
|
13
|
+
export { getInfoFromDexscreener } from "./dexscreener/info";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,eAAe,EACf,eAAe,GAChB,MAAM,OAAO,CAAC;AAEf,YAAY,EACV,WAAW,EACX,cAAc,EACd,eAAe,EACf,SAAS,EACT,UAAU,EACV,WAAW,EACX,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,QAAQ,GACT,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,SAAS,EACT,SAAS,EACT,oBAAoB,EACpB,mCAAmC,EACnC,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,GACX,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* outsmart — Programmatic API
|
|
4
|
+
*
|
|
5
|
+
* This is the library entry point for consumers who `import { ... } from "outsmart"`.
|
|
6
|
+
* Re-exports the DEX registry, types, and landing layer for programmatic use.
|
|
7
|
+
*
|
|
8
|
+
* For CLI usage, run `outsmart` directly (see src/cli.ts).
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.getInfoFromDexscreener = exports.DEFAULT_COMPUTE_UNIT_LIMIT = exports.DEFAULT_PRIORITY_FEE_MICRO_LAMPORTS = exports.DEFAULT_SLIPPAGE_BPS = exports.USDT_MINT = exports.USDC_MINT = exports.WSOL_MINT = exports.defaultCapabilities = exports.PoolNotFoundError = exports.UnsupportedOperationError = exports.registerAdapter = exports.listDexAdapters = exports.getDexAdapter = exports.getRegistry = exports.DexRegistry = void 0;
|
|
12
|
+
// DEX adapter layer
|
|
13
|
+
var dex_1 = require("./dex");
|
|
14
|
+
Object.defineProperty(exports, "DexRegistry", { enumerable: true, get: function () { return dex_1.DexRegistry; } });
|
|
15
|
+
Object.defineProperty(exports, "getRegistry", { enumerable: true, get: function () { return dex_1.getRegistry; } });
|
|
16
|
+
Object.defineProperty(exports, "getDexAdapter", { enumerable: true, get: function () { return dex_1.getDexAdapter; } });
|
|
17
|
+
Object.defineProperty(exports, "listDexAdapters", { enumerable: true, get: function () { return dex_1.listDexAdapters; } });
|
|
18
|
+
Object.defineProperty(exports, "registerAdapter", { enumerable: true, get: function () { return dex_1.registerAdapter; } });
|
|
19
|
+
var types_1 = require("./dex/types");
|
|
20
|
+
Object.defineProperty(exports, "UnsupportedOperationError", { enumerable: true, get: function () { return types_1.UnsupportedOperationError; } });
|
|
21
|
+
Object.defineProperty(exports, "PoolNotFoundError", { enumerable: true, get: function () { return types_1.PoolNotFoundError; } });
|
|
22
|
+
Object.defineProperty(exports, "defaultCapabilities", { enumerable: true, get: function () { return types_1.defaultCapabilities; } });
|
|
23
|
+
Object.defineProperty(exports, "WSOL_MINT", { enumerable: true, get: function () { return types_1.WSOL_MINT; } });
|
|
24
|
+
Object.defineProperty(exports, "USDC_MINT", { enumerable: true, get: function () { return types_1.USDC_MINT; } });
|
|
25
|
+
Object.defineProperty(exports, "USDT_MINT", { enumerable: true, get: function () { return types_1.USDT_MINT; } });
|
|
26
|
+
Object.defineProperty(exports, "DEFAULT_SLIPPAGE_BPS", { enumerable: true, get: function () { return types_1.DEFAULT_SLIPPAGE_BPS; } });
|
|
27
|
+
Object.defineProperty(exports, "DEFAULT_PRIORITY_FEE_MICRO_LAMPORTS", { enumerable: true, get: function () { return types_1.DEFAULT_PRIORITY_FEE_MICRO_LAMPORTS; } });
|
|
28
|
+
Object.defineProperty(exports, "DEFAULT_COMPUTE_UNIT_LIMIT", { enumerable: true, get: function () { return types_1.DEFAULT_COMPUTE_UNIT_LIMIT; } });
|
|
29
|
+
// DexScreener utility
|
|
30
|
+
var info_1 = require("./dexscreener/info");
|
|
31
|
+
Object.defineProperty(exports, "getInfoFromDexscreener", { enumerable: true, get: function () { return info_1.getInfoFromDexscreener; } });
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,oBAAoB;AACpB,6BAMe;AALb,kGAAA,WAAW,OAAA;AACX,kGAAA,WAAW,OAAA;AACX,oGAAA,aAAa,OAAA;AACb,sGAAA,eAAe,OAAA;AACf,sGAAA,eAAe,OAAA;AAqBjB,qCAUqB;AATnB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,4GAAA,mBAAmB,OAAA;AACnB,kGAAA,SAAS,OAAA;AACT,kGAAA,SAAS,OAAA;AACT,kGAAA,SAAS,OAAA;AACT,6GAAA,oBAAoB,OAAA;AACpB,4HAAA,mCAAmC,OAAA;AACnC,mHAAA,0BAA0B,OAAA;AAa5B,sBAAsB;AACtB,2CAA4D;AAAnD,8GAAA,sBAAsB,OAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PublicKey, Keypair, Transaction } from "@solana/web3.js";
|
|
2
|
+
export declare function CreateTraderAPITipTransaction(senderAddress: PublicKey, tipAmountInLamports: number): Promise<Transaction>;
|
|
3
|
+
export declare function bloXroute_executeAndConfirm(transaction: Transaction, signers: Keypair[]): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=bloXroute_tips_tx_executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bloXroute_tips_tx_executor.d.ts","sourceRoot":"","sources":["../../src/transactions/bloXroute_tips_tx_executor.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,SAAS,EACT,OAAO,EAEP,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAkBzB,wBAAsB,6BAA6B,CACjD,aAAa,EAAE,SAAS,EACxB,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,WAAW,CAAC,CAStB;AAED,wBAAsB,2BAA2B,CAC/C,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAAE,GACjB,OAAO,CAAC,IAAI,CAAC,CAyCf"}
|
|
@@ -0,0 +1,70 @@
|
|
|
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.CreateTraderAPITipTransaction = CreateTraderAPITipTransaction;
|
|
7
|
+
exports.bloXroute_executeAndConfirm = bloXroute_executeAndConfirm;
|
|
8
|
+
const solana_trader_client_ts_1 = require("@bloxroute/solana-trader-client-ts");
|
|
9
|
+
const config_1 = require("../helpers/config");
|
|
10
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
11
|
+
const bs58_1 = __importDefault(require("bs58"));
|
|
12
|
+
const TRADER_API_TIP_WALLET = "HWEoBxYs7ssKuudEjzjmpfJVX7Dvi7wescFsVx2L5yoY";
|
|
13
|
+
// Lazy provider initialization
|
|
14
|
+
let _provider = null;
|
|
15
|
+
function getProvider() {
|
|
16
|
+
if (!_provider) {
|
|
17
|
+
if (!config_1.bloXRoute_auth_header) {
|
|
18
|
+
throw new Error("BLOXROUTE_AUTH_HEADER not set. Configure via 'outsmart init' or .env");
|
|
19
|
+
}
|
|
20
|
+
const privateKey = process.env.PRIVATE_KEY || "";
|
|
21
|
+
_provider = new solana_trader_client_ts_1.HttpProvider(config_1.bloXRoute_auth_header, privateKey, solana_trader_client_ts_1.MAINNET_API_UK_HTTP);
|
|
22
|
+
}
|
|
23
|
+
return _provider;
|
|
24
|
+
}
|
|
25
|
+
async function CreateTraderAPITipTransaction(senderAddress, tipAmountInLamports) {
|
|
26
|
+
const tipAddress = new web3_js_1.PublicKey(TRADER_API_TIP_WALLET);
|
|
27
|
+
return new web3_js_1.Transaction().add(web3_js_1.SystemProgram.transfer({
|
|
28
|
+
fromPubkey: senderAddress,
|
|
29
|
+
toPubkey: tipAddress,
|
|
30
|
+
lamports: tipAmountInLamports,
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
async function bloXroute_executeAndConfirm(transaction, signers) {
|
|
34
|
+
const provider = getProvider();
|
|
35
|
+
const memo = (0, solana_trader_client_ts_1.createTraderAPIMemoInstruction)("Powered by bloXroute Trader Api");
|
|
36
|
+
const privateKey = process.env.PRIVATE_KEY || "";
|
|
37
|
+
const wallet = web3_js_1.Keypair.fromSecretKey(bs58_1.default.decode(privateKey));
|
|
38
|
+
const recentBlockhash = await provider.getRecentBlockHash({});
|
|
39
|
+
let tx = new web3_js_1.Transaction({
|
|
40
|
+
recentBlockhash: recentBlockhash.blockHash,
|
|
41
|
+
feePayer: wallet.publicKey,
|
|
42
|
+
});
|
|
43
|
+
const fee = Math.round(config_1.bloXroute_fee * web3_js_1.LAMPORTS_PER_SOL);
|
|
44
|
+
tx.add(transaction);
|
|
45
|
+
tx.add(memo);
|
|
46
|
+
tx.add(await CreateTraderAPITipTransaction(wallet.publicKey, fee));
|
|
47
|
+
tx.sign(wallet);
|
|
48
|
+
const serializeTxBytes = tx.serialize();
|
|
49
|
+
const buffTx = Buffer.from(serializeTxBytes);
|
|
50
|
+
const encodedTx = buffTx.toString("base64");
|
|
51
|
+
console.log("Submitting transaction to bloXroute...");
|
|
52
|
+
try {
|
|
53
|
+
const response = await provider.postSubmit({
|
|
54
|
+
transaction: { content: encodedTx, isCleanup: false },
|
|
55
|
+
skipPreFlight: false,
|
|
56
|
+
frontRunningProtection: false,
|
|
57
|
+
useStakedRPCs: true,
|
|
58
|
+
});
|
|
59
|
+
if (response.signature) {
|
|
60
|
+
console.log(`txn landed successfully\nSignature: https://solscan.io/tx/${response.signature}`);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
console.log("Transaction failed");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
console.error("bloXroute submission error:", e?.message || e);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=bloXroute_tips_tx_executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bloXroute_tips_tx_executor.js","sourceRoot":"","sources":["../../src/transactions/bloXroute_tips_tx_executor.ts"],"names":[],"mappings":";;;;;AA+BA,sEAYC;AAED,kEA4CC;AAzFD,gFAK4C;AAC5C,8CAAyE;AACzE,6CAMyB;AACzB,gDAA0B;AAE1B,MAAM,qBAAqB,GAAG,8CAA8C,CAAC;AAE7E,+BAA+B;AAC/B,IAAI,SAAS,GAAwB,IAAI,CAAC;AAC1C,SAAS,WAAW;IAClB,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,IAAI,CAAC,8BAAqB,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;QAC1F,CAAC;QACD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;QACjD,SAAS,GAAG,IAAI,sCAAY,CAAC,8BAAqB,EAAE,UAAU,EAAE,6CAAmB,CAAC,CAAC;IACvF,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAEM,KAAK,UAAU,6BAA6B,CACjD,aAAwB,EACxB,mBAA2B;IAE3B,MAAM,UAAU,GAAG,IAAI,mBAAS,CAAC,qBAAqB,CAAC,CAAC;IACxD,OAAO,IAAI,qBAAW,EAAE,CAAC,GAAG,CAC1B,uBAAa,CAAC,QAAQ,CAAC;QACrB,UAAU,EAAE,aAAa;QACzB,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,mBAAmB;KAC9B,CAAC,CACH,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,2BAA2B,CAC/C,WAAwB,EACxB,OAAkB;IAElB,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAE/B,MAAM,IAAI,GAAG,IAAA,wD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EH,IAAI,QAAQ,CAAC,SAAS,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,6DAA6D,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;QACjG,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,CAAC,EAAE,OAAO,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./bloXroute_tips_tx_executor";
|
|
2
|
+
export * from "./simple_tx_executor";
|
|
3
|
+
export { getRandomValidator, type JitoResult, jito_executeAndConfirm, jito_confirm } from "./jito_tips_tx_executor";
|
|
4
|
+
export { getNozomiConnection, type NozomiResult, sendNozomiTx, getRandomValidator as getRandomNozomiValidator } from "./nozomi/tx-submission";
|
|
5
|
+
export * from "./landing";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transactions/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,KAAK,UAAU,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACpH,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,YAAY,EAAE,kBAAkB,IAAI,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAG9I,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getRandomNozomiValidator = exports.sendNozomiTx = exports.getNozomiConnection = exports.jito_confirm = exports.jito_executeAndConfirm = exports.getRandomValidator = void 0;
|
|
18
|
+
__exportStar(require("./bloXroute_tips_tx_executor"), exports);
|
|
19
|
+
__exportStar(require("./simple_tx_executor"), exports);
|
|
20
|
+
var jito_tips_tx_executor_1 = require("./jito_tips_tx_executor");
|
|
21
|
+
Object.defineProperty(exports, "getRandomValidator", { enumerable: true, get: function () { return jito_tips_tx_executor_1.getRandomValidator; } });
|
|
22
|
+
Object.defineProperty(exports, "jito_executeAndConfirm", { enumerable: true, get: function () { return jito_tips_tx_executor_1.jito_executeAndConfirm; } });
|
|
23
|
+
Object.defineProperty(exports, "jito_confirm", { enumerable: true, get: function () { return jito_tips_tx_executor_1.jito_confirm; } });
|
|
24
|
+
var tx_submission_1 = require("./nozomi/tx-submission");
|
|
25
|
+
Object.defineProperty(exports, "getNozomiConnection", { enumerable: true, get: function () { return tx_submission_1.getNozomiConnection; } });
|
|
26
|
+
Object.defineProperty(exports, "sendNozomiTx", { enumerable: true, get: function () { return tx_submission_1.sendNozomiTx; } });
|
|
27
|
+
Object.defineProperty(exports, "getRandomNozomiValidator", { enumerable: true, get: function () { return tx_submission_1.getRandomValidator; } });
|
|
28
|
+
// Unified TX landing layer (12 providers + orchestrator)
|
|
29
|
+
__exportStar(require("./landing"), exports);
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transactions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+DAA6C;AAC7C,uDAAqC;AACrC,iEAAoH;AAA3G,2HAAA,kBAAkB,OAAA;AAAmB,+HAAA,sBAAsB,OAAA;AAAE,qHAAA,YAAY,OAAA;AAClF,wDAA8I;AAArI,oHAAA,mBAAmB,OAAA;AAAqB,6GAAA,YAAY,OAAA;AAAE,yHAAA,kBAAkB,OAA4B;AAE7G,yDAAyD;AACzD,4CAA0B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BlockhashWithExpiryBlockHeight, Keypair, PublicKey, VersionedTransaction, Transaction } from "@solana/web3.js";
|
|
2
|
+
export declare function getRandomValidator(): PublicKey;
|
|
3
|
+
export interface JitoResult {
|
|
4
|
+
confirmed: boolean;
|
|
5
|
+
signature: string | null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Executes and confirms a Jito bundle transaction.
|
|
9
|
+
*/
|
|
10
|
+
export declare function jito_executeAndConfirm(transaction: VersionedTransaction | Transaction, payer: Keypair, latestBlockhash: BlockhashWithExpiryBlockHeight, jitofee: number): Promise<JitoResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Confirms a transaction on the Solana blockchain.
|
|
13
|
+
*/
|
|
14
|
+
export declare function jito_confirm(signature: string, latestBlockhash: BlockhashWithExpiryBlockHeight): Promise<JitoResult>;
|
|
15
|
+
//# sourceMappingURL=jito_tips_tx_executor.d.ts.map
|