@clonegod/ttd-sui-common 1.0.76 → 1.0.78

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.
@@ -1,4 +1,5 @@
1
1
  import { GrpcConnection } from './grpc-connection';
2
+ import { ListOwnedObjectsResponse } from '../type/sui_object_types';
2
3
  export declare class LiveDataService {
3
4
  private liveDataClient;
4
5
  private connection;
@@ -6,5 +7,5 @@ export declare class LiveDataService {
6
7
  getBalance(owner: string, coinType: string): Promise<any>;
7
8
  listBalances(owner: string): Promise<unknown>;
8
9
  getCoinInfo(coinType: string): Promise<unknown>;
9
- listOwnedObjects(owner: string, coinType?: string, limit?: number, readMask?: string[]): Promise<unknown>;
10
+ listOwnedObjects(owner: string, coinType?: string, limit?: number, readMask?: string[]): Promise<ListOwnedObjectsResponse>;
10
11
  }
@@ -35,7 +35,7 @@ export declare abstract class AbstractSuiDexTradePlus extends AbastrcatTrade {
35
35
  protected getObjectInfo(objectId: string): Promise<PoolObjectInfo | null>;
36
36
  protected compareBigIntBalance(a: any, b: any): number;
37
37
  protected mergeTokenObjects(tx: Transaction, primaryCoin: any, objectsToMerge: any[], tokenSymbol: string): void;
38
- protected try_refresh_wallet_objects(wallet: string, txid: string, try_times?: number, try_delay_ms?: number): void;
38
+ protected try_refresh_wallet_objects(wallet: string, txid: string, context: TradeContext, try_times?: number, try_delay_ms?: number): void;
39
39
  abstract execute(context: TradeContext, retryCount?: number): Promise<string>;
40
40
  protected abstract initConfigs(): Promise<void>;
41
41
  }
@@ -316,12 +316,13 @@ class AbstractSuiDexTradePlus extends dist_1.AbastrcatTrade {
316
316
  tx.mergeCoins(primaryCoin, other_objects);
317
317
  (0, dist_1.log_info)(`✅ ${tokenSymbol} 进行对象合并,涉及 ${other_objects.length} 个对象`);
318
318
  }
319
- try_refresh_wallet_objects(wallet, txid, try_times = 2, try_delay_ms = 300) {
319
+ try_refresh_wallet_objects(wallet, txid, context, try_times = 2, try_delay_ms = 300) {
320
320
  setTimeout(() => {
321
321
  for (let i = 1; i <= try_times; i++) {
322
322
  setTimeout(() => {
323
323
  let group_id = this.appConfig.trade_runtime.group.id;
324
- this.appConfig.arb_cache.redis_event_publisher.publish_wallet_raw_tx_event(group_id, wallet, { group_id, wallet, txid, remark: `PRE_REFRESH_OBJECTS_${i}` });
324
+ let coin_types = [context.pool_info.tokenA.address, context.pool_info.tokenB.address];
325
+ this.appConfig.arb_cache.redis_event_publisher.publish_wallet_raw_tx_event(group_id, wallet, { group_id, wallet, txid, coin_types, remark: `PRE_REFRESH_OBJECTS_${i}` });
325
326
  }, i * try_delay_ms);
326
327
  }
327
328
  }, 0);
@@ -23,3 +23,4 @@ export interface PoolObjectInfo {
23
23
  initialSharedVersion?: string;
24
24
  }
25
25
  export * from './wallet_assets_type';
26
+ export * from './sui_object_types';
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./wallet_assets_type"), exports);
18
+ __exportStar(require("./sui_object_types"), exports);
@@ -0,0 +1,44 @@
1
+ export interface SuiObjectOwner {
2
+ kind: 'ADDRESS' | 'OBJECT' | 'SHARED' | 'IMMUTABLE';
3
+ address?: string;
4
+ object_id?: string;
5
+ initial_shared_version?: string;
6
+ }
7
+ export interface SuiObjectData {
8
+ object_id: string;
9
+ _object_id: string;
10
+ version: string;
11
+ _version: string;
12
+ digest: string;
13
+ _digest: string;
14
+ owner: SuiObjectOwner;
15
+ _owner: string;
16
+ object_type: string;
17
+ _object_type: string;
18
+ storage_rebate: string;
19
+ _storage_rebate: string;
20
+ balance: string;
21
+ _balance: string;
22
+ }
23
+ export interface ListOwnedObjectsResponse {
24
+ objects: SuiObjectData[];
25
+ next_cursor?: string;
26
+ has_next_page?: boolean;
27
+ }
28
+ export interface SimplifiedSuiObject {
29
+ objectId: string;
30
+ version: string;
31
+ digest: string;
32
+ raw_balance: string;
33
+ }
34
+ export declare enum SuiObjectKind {
35
+ ADDRESS = "ADDRESS",
36
+ OBJECT = "OBJECT",
37
+ SHARED = "SHARED",
38
+ IMMUTABLE = "IMMUTABLE"
39
+ }
40
+ export declare enum SuiObjectStatus {
41
+ EXISTS = "EXISTS",
42
+ NOT_EXISTS = "NOT_EXISTS",
43
+ DELETED = "DELETED"
44
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SuiObjectStatus = exports.SuiObjectKind = void 0;
4
+ var SuiObjectKind;
5
+ (function (SuiObjectKind) {
6
+ SuiObjectKind["ADDRESS"] = "ADDRESS";
7
+ SuiObjectKind["OBJECT"] = "OBJECT";
8
+ SuiObjectKind["SHARED"] = "SHARED";
9
+ SuiObjectKind["IMMUTABLE"] = "IMMUTABLE";
10
+ })(SuiObjectKind || (exports.SuiObjectKind = SuiObjectKind = {}));
11
+ var SuiObjectStatus;
12
+ (function (SuiObjectStatus) {
13
+ SuiObjectStatus["EXISTS"] = "EXISTS";
14
+ SuiObjectStatus["NOT_EXISTS"] = "NOT_EXISTS";
15
+ SuiObjectStatus["DELETED"] = "DELETED";
16
+ })(SuiObjectStatus || (exports.SuiObjectStatus = SuiObjectStatus = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sui-common",
3
- "version": "1.0.76",
3
+ "version": "1.0.78",
4
4
  "description": "Sui common library",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",