@clonegod/ttd-sui-common 1.0.17 → 1.0.19

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.
@@ -3,3 +3,4 @@ export { LedgerService } from './ledger-service';
3
3
  export { LiveDataService } from './live-data-service';
4
4
  export { TransactionService } from './transaction-service';
5
5
  export { SubscriptionService } from './subscription-service';
6
+ export { SuiGrpcClient } from './sui-grpc-client';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubscriptionService = exports.TransactionService = exports.LiveDataService = exports.LedgerService = exports.GrpcConnection = void 0;
3
+ exports.SuiGrpcClient = exports.SubscriptionService = exports.TransactionService = exports.LiveDataService = exports.LedgerService = exports.GrpcConnection = void 0;
4
4
  var grpc_connection_1 = require("./grpc-connection");
5
5
  Object.defineProperty(exports, "GrpcConnection", { enumerable: true, get: function () { return grpc_connection_1.GrpcConnection; } });
6
6
  var ledger_service_1 = require("./ledger-service");
@@ -11,3 +11,5 @@ var transaction_service_1 = require("./transaction-service");
11
11
  Object.defineProperty(exports, "TransactionService", { enumerable: true, get: function () { return transaction_service_1.TransactionService; } });
12
12
  var subscription_service_1 = require("./subscription-service");
13
13
  Object.defineProperty(exports, "SubscriptionService", { enumerable: true, get: function () { return subscription_service_1.SubscriptionService; } });
14
+ var sui_grpc_client_1 = require("./sui-grpc-client");
15
+ Object.defineProperty(exports, "SuiGrpcClient", { enumerable: true, get: function () { return sui_grpc_client_1.SuiGrpcClient; } });
@@ -4,7 +4,7 @@ export declare class LedgerService {
4
4
  private connection;
5
5
  constructor(connection: GrpcConnection);
6
6
  getServiceInfo(): Promise<unknown>;
7
- getEpoch(epoch?: number, includeCommittee?: boolean): Promise<unknown>;
7
+ getEpoch(epoch?: number, includeGasPrice?: boolean): Promise<unknown>;
8
8
  getCheckpoint(checkpointId?: string): Promise<any>;
9
9
  getObject(objectId: string, readMask?: string[]): Promise<unknown>;
10
10
  batchGetObjects(objectIds: string[], readMask?: string[]): Promise<unknown>;
@@ -29,16 +29,18 @@ class LedgerService {
29
29
  });
30
30
  }
31
31
  getEpoch(epoch_1) {
32
- return __awaiter(this, arguments, void 0, function* (epoch, includeCommittee = false) {
32
+ return __awaiter(this, arguments, void 0, function* (epoch, includeGasPrice = true) {
33
33
  return new Promise((resolve, reject) => {
34
34
  const request = {};
35
35
  if (epoch)
36
36
  request.epoch = epoch;
37
- if (!includeCommittee) {
38
- request.read_mask = {
39
- paths: ['epoch']
40
- };
37
+ const paths = ['epoch'];
38
+ if (includeGasPrice) {
39
+ paths.push('reference_gas_price');
41
40
  }
41
+ request.read_mask = {
42
+ paths: paths
43
+ };
42
44
  this.ledgerClient.GetEpoch(request, this.connection.getMetadata(), (error, response) => {
43
45
  if (error)
44
46
  reject(error);
@@ -0,0 +1,12 @@
1
+ import { LedgerService } from "./ledger-service";
2
+ import { LiveDataService } from "./live-data-service";
3
+ import { SubscriptionService } from "./subscription-service";
4
+ import { TransactionService } from "./transaction-service";
5
+ export declare class SuiGrpcClient {
6
+ ledgerService: LedgerService;
7
+ transactionService: TransactionService;
8
+ liveDataService: LiveDataService;
9
+ subscriptionService: SubscriptionService;
10
+ constructor();
11
+ init(): void;
12
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SuiGrpcClient = void 0;
4
+ const grpc_connection_1 = require("./grpc-connection");
5
+ const ledger_service_1 = require("./ledger-service");
6
+ const live_data_service_1 = require("./live-data-service");
7
+ const subscription_service_1 = require("./subscription-service");
8
+ const transaction_service_1 = require("./transaction-service");
9
+ class SuiGrpcClient {
10
+ constructor() {
11
+ this.init();
12
+ }
13
+ init() {
14
+ const grpcClient = grpc_connection_1.GrpcConnection.getInstance(process.env.SUI_GRPC_ENDPOINT, process.env.SUI_GRPC_TOKEN);
15
+ this.ledgerService = new ledger_service_1.LedgerService(grpcClient);
16
+ this.transactionService = new transaction_service_1.TransactionService(grpcClient);
17
+ this.liveDataService = new live_data_service_1.LiveDataService(grpcClient);
18
+ this.subscriptionService = new subscription_service_1.SubscriptionService(grpcClient);
19
+ }
20
+ }
21
+ exports.SuiGrpcClient = SuiGrpcClient;
@@ -76,6 +76,7 @@ const test_list_owned_objects = (wallet_address) => __awaiter(void 0, void 0, vo
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();
79
80
  const wallet_address = '0x6367c8755b8c39cab7305bfa75cb17d050508d2e55f6862a7682377ad6d46ee7';
80
81
  const usdc_coin_type = '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC';
81
82
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sui-common",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "Sui common library",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",