@clonegod/ttd-sui-common 1.0.21 → 1.0.22

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.
@@ -6,5 +6,5 @@ export declare class LiveDataService {
6
6
  getBalance(owner: string, coinType: string): Promise<any>;
7
7
  listBalances(owner: string): Promise<unknown>;
8
8
  getCoinInfo(coinType: string): Promise<unknown>;
9
- listOwnedObjects(owner: string, limit?: number, readMask?: string[]): Promise<unknown>;
9
+ listOwnedObjects(owner: string, coinType?: string, limit?: number, readMask?: string[]): Promise<unknown>;
10
10
  }
@@ -62,10 +62,16 @@ class LiveDataService {
62
62
  });
63
63
  });
64
64
  }
65
- listOwnedObjects(owner, limit, readMask) {
65
+ listOwnedObjects(owner, coinType, limit, readMask) {
66
66
  return __awaiter(this, void 0, void 0, function* () {
67
67
  return new Promise((resolve, reject) => {
68
68
  const request = { owner };
69
+ if (coinType) {
70
+ const objectType = coinType.startsWith('0x2::coin::Coin<')
71
+ ? coinType
72
+ : `0x2::coin::Coin<${coinType}>`;
73
+ request.object_type = objectType;
74
+ }
69
75
  if (limit)
70
76
  request.page_size = limit;
71
77
  if (readMask && readMask.length > 0) {
@@ -69,15 +69,16 @@ const test_get_coin_info = (coin_type) => __awaiter(void 0, void 0, void 0, func
69
69
  const coinInfo = yield liveDataService.getCoinInfo(coin_type);
70
70
  (0, dist_1.log_info)(`coinInfo`, coinInfo);
71
71
  });
72
- const test_list_owned_objects = (wallet_address) => __awaiter(void 0, void 0, void 0, function* () {
72
+ const test_list_owned_objects = (wallet_address, coin_type) => __awaiter(void 0, void 0, void 0, function* () {
73
73
  const connection = grpc_connection_1.GrpcConnection.getInstance(grpc_endpoint, grpc_token);
74
74
  const liveDataService = new live_data_service_1.LiveDataService(connection);
75
- const ownedObjects = yield liveDataService.listOwnedObjects(wallet_address);
75
+ const ownedObjects = yield liveDataService.listOwnedObjects(wallet_address, coin_type);
76
76
  (0, dist_1.log_info)(`ownedObjects`, ownedObjects);
77
77
  });
78
78
  const main = () => __awaiter(void 0, void 0, void 0, function* () {
79
- test_get_epoch();
80
79
  const wallet_address = '0x6367c8755b8c39cab7305bfa75cb17d050508d2e55f6862a7682377ad6d46ee7';
81
80
  const usdc_coin_type = '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC';
81
+ const take_coin_type = '0x76a49ebaf991fa2d4cb6a352af14425d453fe2ba6802b5ed2361b227150b6689::take::TAKE';
82
+ test_list_owned_objects(wallet_address, take_coin_type);
82
83
  });
83
84
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sui-common",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Sui common library",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",