@clonegod/ttd-sui-common 1.0.36 → 1.0.37
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.
- package/dist/grpc/subscription-service.js +5 -0
- package/dist/test/test_checkpoint.js +9 -4
- package/package.json +1 -1
- package/dist/checkpoint_185049558.json +0 -13761
- package/dist/checkpoint_185049559.json +0 -7487
- package/dist/checkpoint_185093245_decoded.json +0 -4887
- package/dist/checkpoint_185093247_decoded.json +0 -2680
- package/dist/checkpoint_185093253_decoded.json +0 -3115
- package/dist/checkpoint_185094135_decoded.json +0 -4755
- package/dist/checkpoint_185094138_decoded.json +0 -3603
- package/dist/checkpoint_185094140_decoded.json +0 -6755
- package/dist/checkpoint_185096247_decoded.json +0 -7230
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.SubscriptionService = void 0;
|
|
37
37
|
const dotenv = __importStar(require("dotenv"));
|
|
38
38
|
dotenv.config();
|
|
39
|
+
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
39
40
|
class SubscriptionService {
|
|
40
41
|
constructor(connection) {
|
|
41
42
|
this.connection = connection;
|
|
@@ -52,6 +53,7 @@ class SubscriptionService {
|
|
|
52
53
|
];
|
|
53
54
|
}
|
|
54
55
|
request.read_mask = { paths: readMask };
|
|
56
|
+
(0, dist_1.log_info)('subscribeCheckpoints, readMask=', readMask);
|
|
55
57
|
const stream = this.subscriptionClient.SubscribeCheckpoints(request, this.connection.getMetadata());
|
|
56
58
|
stream.on('data', (response) => {
|
|
57
59
|
onCheckpoint(response);
|
|
@@ -62,6 +64,9 @@ class SubscriptionService {
|
|
|
62
64
|
});
|
|
63
65
|
stream.on('end', () => {
|
|
64
66
|
console.log('检查点流订阅结束');
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}, 1000);
|
|
65
70
|
});
|
|
66
71
|
return stream;
|
|
67
72
|
}
|
|
@@ -13,6 +13,7 @@ const dist_1 = require("@clonegod/ttd-core/dist");
|
|
|
13
13
|
const fs_1 = require("fs");
|
|
14
14
|
const grpc_connection_1 = require("../grpc/grpc-connection");
|
|
15
15
|
const subscription_service_1 = require("../grpc/subscription-service");
|
|
16
|
+
const utils_1 = require("../utils");
|
|
16
17
|
const grpc_endpoint = process.env.SUI_GRPC_ENDPOINT;
|
|
17
18
|
const grpc_token = process.env.SUI_GRPC_TOKEN;
|
|
18
19
|
const test_subscribe_checkpoints = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -45,14 +46,18 @@ const test_subscribe_checkpoints = () => __awaiter(void 0, void 0, void 0, funct
|
|
|
45
46
|
transactions: []
|
|
46
47
|
};
|
|
47
48
|
response.checkpoint.transactions.forEach((transaction) => {
|
|
48
|
-
|
|
49
|
+
const digest = transaction.digest;
|
|
50
|
+
let events = transaction.events.events.map((event) => event.event_type) || [];
|
|
51
|
+
console.log({
|
|
52
|
+
digest,
|
|
53
|
+
events
|
|
54
|
+
});
|
|
49
55
|
});
|
|
50
56
|
if (blockUpdateEvent.transactions.length > 0) {
|
|
51
|
-
(0, fs_1.writeFileSync)(`./dist/checkpoint_${response.cursor}_decoded.json`, JSON.stringify(response, null, 2));
|
|
52
|
-
console.dir(blockUpdateEvent, { depth: null });
|
|
57
|
+
(0, fs_1.writeFileSync)(`./dist/checkpoint_${response.cursor}_decoded.json`, JSON.stringify((0, utils_1.decodeBytes)(response), null, 2));
|
|
53
58
|
}
|
|
54
59
|
else {
|
|
55
|
-
console.log(`no liquidity related events: ${response.cursor}, ${response.checkpoint.digest}`);
|
|
60
|
+
console.log(`no liquidity related events, checkpoint: ${response.cursor}, digest: ${response.checkpoint.digest}`);
|
|
56
61
|
}
|
|
57
62
|
}, (error) => {
|
|
58
63
|
(0, dist_1.log_info)(`error`, error);
|