@clonegod/ttd-core 2.0.98 → 2.0.99

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.
@@ -59,4 +59,9 @@ export declare class LoadingCache {
59
59
  [x: string]: string;
60
60
  };
61
61
  }>;
62
+ push_block_info(chain_id: CHAIN_ID, block_info: string): Promise<boolean>;
63
+ get_block_info(chain_id: CHAIN_ID, offset: number, limit?: number): Promise<{
64
+ key: string;
65
+ blocks: string[];
66
+ }>;
62
67
  }
@@ -229,5 +229,27 @@ class LoadingCache {
229
229
  return data;
230
230
  });
231
231
  }
232
+ push_block_info(chain_id, block_info) {
233
+ return __awaiter(this, void 0, void 0, function* () {
234
+ const key = this.get_key(chain_id, 'b', 'block');
235
+ yield this.redis_client.lPush(key, block_info);
236
+ this.redis_client.lTrim(key, 0, 149).then(res => {
237
+ (0, index_1.log_info)(`push_block_info, res=${res}`);
238
+ }).catch(err => {
239
+ (0, index_1.log_warn)(`push_block_info, err=${err.message}`);
240
+ });
241
+ return true;
242
+ });
243
+ }
244
+ get_block_info(chain_id_1, offset_1) {
245
+ return __awaiter(this, arguments, void 0, function* (chain_id, offset, limit = 1) {
246
+ const key = this.get_key(chain_id, 'b', 'block');
247
+ const blocks = yield this.redis_client.lRange(key, offset, offset + limit - 1);
248
+ return {
249
+ key,
250
+ blocks
251
+ };
252
+ });
253
+ }
232
254
  }
233
255
  exports.LoadingCache = LoadingCache;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-core",
3
- "version": "2.0.98",
3
+ "version": "2.0.99",
4
4
  "description": "Common types and utilities for trading systems - use `npm run push` to publish",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",
package/types/index.d.ts CHANGED
@@ -168,6 +168,7 @@ export interface TradeStrategyType {
168
168
  fee_max_cap: number, // 动态GAS的上限
169
169
  tip_ratio: number // tip 占总gas的比例(gas=priority_fee + tip_fee)
170
170
  tip_up_ratio: number // tip上浮比例
171
+ block_offset?: number // Solana特定:交易在提交之后的指定slot偏移内有效
171
172
  // evm chain
172
173
  evm_gas_limit: number // 300000
173
174
  evm_gas_price_gwei: number // 1.1 Gwei
@@ -742,6 +743,11 @@ export declare class LoadingCache {
742
743
  [x: string]: string;
743
744
  };
744
745
  }>;
746
+ push_block_info(chain_id: CHAIN_ID, block_info: string): Promise<boolean>;
747
+ get_block_info(chain_id: CHAIN_ID, offset: number, limit?: number): Promise<{
748
+ key: string;
749
+ blocks: string[];
750
+ }>;
745
751
  }
746
752
 
747
753
  export declare class RedisCommand {