@clonegod/ttd-sol-common 1.0.189 → 1.0.192
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.
|
@@ -51,6 +51,16 @@ export declare class RpcClient {
|
|
|
51
51
|
sendSmartTransactionWithTipMixed(solana_trade_runtime: SolanaTradeRuntimeType, instructions: TransactionInstruction[], signers: Signer[], lookupTables?: AddressLookupTableAccount[], tipAmount?: number, region?: JitoRegion, feePayer?: Signer, lastValidBlockHeightOffset?: number): Promise<string>;
|
|
52
52
|
sendJitoTransaction(serializedTransaction: string, jitoApiUrl: string, encoding?: string): Promise<string>;
|
|
53
53
|
get_last_blockhash_slot(connections: Connection[]): Promise<RpcResponseAndContext<BlockhashWithExpiryBlockHeight>>;
|
|
54
|
+
getBlockhashBySlotOffset(targetSlotOffset?: number, limit?: number): Promise<{
|
|
55
|
+
key: string;
|
|
56
|
+
context: {
|
|
57
|
+
slot: number;
|
|
58
|
+
};
|
|
59
|
+
value: {
|
|
60
|
+
blockhash: string;
|
|
61
|
+
lastValidBlockHeight: number;
|
|
62
|
+
};
|
|
63
|
+
}>;
|
|
54
64
|
try_get_bundle_failed_result(txid: string, bundle_id: string, timeoutMs?: number): Promise<void>;
|
|
55
65
|
send_tx_to_all_jito_region(serializedTransaction: string, encoding: string): Promise<string>;
|
|
56
66
|
}
|
|
@@ -370,6 +370,22 @@ class RpcClient {
|
|
|
370
370
|
(0, dist_1.log_info)(`>>> getLatestBlockhashAndContext, start`);
|
|
371
371
|
const payerKey = feePayer ? feePayer.publicKey : signers[0].publicKey;
|
|
372
372
|
let { context: { slot: minContextSlot }, value: blockhash, } = yield this.get_last_blockhash_slot([solana_trade_runtime.connection, this.connection]);
|
|
373
|
+
let block_offset = solana_trade_runtime.settings.strategy.block_offset;
|
|
374
|
+
if (!isNaN(block_offset) && block_offset > 0) {
|
|
375
|
+
let blockhash_by_slot_offset = yield this.getBlockhashBySlotOffset(block_offset);
|
|
376
|
+
(0, dist_1.log_info)(`>>> getBlockhashBySlotOffset`, {
|
|
377
|
+
pre: {
|
|
378
|
+
minContextSlot,
|
|
379
|
+
blockhash,
|
|
380
|
+
},
|
|
381
|
+
new: {
|
|
382
|
+
minContextSlot: blockhash_by_slot_offset.context.slot,
|
|
383
|
+
blockhash: blockhash_by_slot_offset.value.blockhash,
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
blockhash = blockhash_by_slot_offset.value;
|
|
387
|
+
minContextSlot = blockhash_by_slot_offset.context.slot;
|
|
388
|
+
}
|
|
373
389
|
(0, dist_1.log_info)(`>>> getLatestBlockhashAndContext, end`);
|
|
374
390
|
const recentBlockhash = blockhash.blockhash;
|
|
375
391
|
const isVersioned = lookupTables.length > 0;
|
|
@@ -791,6 +807,21 @@ class RpcClient {
|
|
|
791
807
|
return last_blockhash_slot;
|
|
792
808
|
});
|
|
793
809
|
}
|
|
810
|
+
getBlockhashBySlotOffset() {
|
|
811
|
+
return __awaiter(this, arguments, void 0, function* (targetSlotOffset = 145, limit = 1) {
|
|
812
|
+
let appConfig = global.appConfig;
|
|
813
|
+
let { key, blocks } = yield appConfig.arb_cache.loading_cache.get_block_info(dist_1.CHAIN_ID.SOLANA, targetSlotOffset, limit);
|
|
814
|
+
let { slot, blockhash, blockHeight } = JSON.parse(blocks[0]);
|
|
815
|
+
return {
|
|
816
|
+
key,
|
|
817
|
+
context: { slot },
|
|
818
|
+
value: {
|
|
819
|
+
blockhash,
|
|
820
|
+
lastValidBlockHeight: blockHeight
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
});
|
|
824
|
+
}
|
|
794
825
|
try_get_bundle_failed_result(txid_1, bundle_id_1) {
|
|
795
826
|
return __awaiter(this, arguments, void 0, function* (txid, bundle_id, timeoutMs = 90000) {
|
|
796
827
|
let url = `https://bundles.jito.wtf/api/v1/bundles/get_bundle_error/${bundle_id}`;
|
|
@@ -87,7 +87,7 @@ class TransactionResultChecker {
|
|
|
87
87
|
check_tx_result_interval() {
|
|
88
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
89
|
const check_start_time = Date.now();
|
|
90
|
-
const check_interval = parseInt(process.env.CHECK_TX_RESULT_INTERVAL_MILLS || '
|
|
90
|
+
const check_interval = parseInt(process.env.CHECK_TX_RESULT_INTERVAL_MILLS || '3000');
|
|
91
91
|
const check_timeout = parseInt(process.env.CHECK_TX_RESULT_TIMEOUT_MILLS || '10000');
|
|
92
92
|
(0, dist_1.log_info)(`check transaction start: check_interval=${check_interval}, check_timeout=${check_timeout}`);
|
|
93
93
|
if (check_interval >= check_timeout) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clonegod/ttd-sol-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.192",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"push": "npm run build && npm publish"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@clonegod/ttd-common": "1.1.
|
|
16
|
+
"@clonegod/ttd-common": "1.1.47",
|
|
17
17
|
"@metaplex-foundation/mpl-token-metadata": "^2.5.2",
|
|
18
18
|
"@solana/web3.js": "1.91.6",
|
|
19
19
|
"rpc-websockets": "7.10.0",
|