@sentio/sdk 1.5.0 → 1.6.0
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/chain-config.d.ts +6 -0
- package/dist/chain-config.js +3 -0
- package/dist/chain-config.js.map +1 -0
- package/dist/cli/webpack.config.js +2 -1
- package/dist/gen/processor/protos/processor.d.ts +0 -11
- package/dist/gen/processor/protos/processor.js +2 -55
- package/dist/gen/processor/protos/processor.js.map +1 -1
- package/dist/numberish.d.ts +0 -2
- package/dist/numberish.js +1 -21
- package/dist/numberish.js.map +1 -1
- package/dist/numberish.test.js +8 -7
- package/dist/numberish.test.js.map +1 -1
- package/dist/provider.d.ts +2 -1
- package/dist/provider.js.map +1 -1
- package/dist/service.d.ts +6 -7
- package/dist/service.js +1 -0
- package/dist/service.js.map +1 -1
- package/dist/test/erc20-template.d.ts +1 -1
- package/dist/test/erc20-template.js +1 -1
- package/dist/test/erc20-template.js.map +1 -1
- package/dist/test/erc20-template.test.js +7 -37
- package/dist/test/erc20-template.test.js.map +1 -1
- package/dist/test/erc20.js +3 -3
- package/dist/test/erc20.test.js +25 -107
- package/dist/test/erc20.test.js.map +1 -1
- package/dist/test/generic-processor.test.js +11 -61
- package/dist/test/generic-processor.test.js.map +1 -1
- package/dist/test/index.d.ts +1 -0
- package/dist/test/index.js +6 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/solana.test.js +16 -18
- package/dist/test/solana.test.js.map +1 -1
- package/dist/test/test-processor-server.d.ts +34 -0
- package/dist/test/test-processor-server.js +211 -0
- package/dist/test/test-processor-server.js.map +1 -0
- package/dist/utils/chainmap.d.ts +1 -3
- package/dist/utils/chainmap.js.map +1 -1
- package/package.json +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic-processor.test.js","sourceRoot":"","sources":["../../src/test/generic-processor.test.ts"],"names":[],"mappings":";AAAA,gCAAgC
|
|
1
|
+
{"version":3,"file":"generic-processor.test.js","source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AAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAC1B,IAAA,aAAM,EAAC,IAAA,yCAAiB,EAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QAC7D,IAAA,aAAM,EAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,eAAW,CAAC,GAAG,CAAC,CAAA;IACjE,CAAC,CAAC,CAAA;IAEF,MAAM,OAAO,GAAG;QACd,WAAW,EAAE,QAAQ;QACrB,SAAS,EAAE,oEAAoE;QAC/E,gBAAgB,EAAE,GAAG;QACrB,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,4CAA4C;QACrD,IAAI,EAAE,oEAAoE;QAC1E,MAAM,EAAE;YACN,oEAAoE;YACpE,oEAAoE;YACpE,oEAAoE;SACrE;QACD,eAAe,EAAE,oEAAoE;QACrF,QAAQ,EAAE,GAAG;KACd,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TestProcessorServer } from './test-processor-server';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestProcessorServer = void 0;
|
|
4
|
+
var test_processor_server_1 = require("./test-processor-server");
|
|
5
|
+
Object.defineProperty(exports, "TestProcessorServer", { enumerable: true, get: function () { return test_processor_server_1.TestProcessorServer; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAApD,4HAAA,mBAAmB,OAAA"}
|
package/dist/test/solana.test.js
CHANGED
|
@@ -7,23 +7,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
const chai_1 = require("chai");
|
|
8
8
|
const __1 = require("..");
|
|
9
9
|
const long_1 = __importDefault(require("long"));
|
|
10
|
-
const clean_test_1 = require("./clean-test");
|
|
11
|
-
const numberish_1 = require("../numberish");
|
|
12
10
|
const util_1 = require("util");
|
|
11
|
+
const test_processor_server_1 = require("./test-processor-server");
|
|
13
12
|
describe('Test Solana Example', () => {
|
|
14
|
-
const service = new
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
(0, clean_test_1.cleanTest)();
|
|
13
|
+
const service = new test_processor_server_1.TestProcessorServer();
|
|
14
|
+
beforeAll(async () => {
|
|
15
|
+
await service.setup();
|
|
18
16
|
require('./mirrorworld');
|
|
19
17
|
require('./wormhole-token-bridge');
|
|
20
|
-
await service.start({ templateInstances: [] }
|
|
18
|
+
await service.start({ templateInstances: [] });
|
|
21
19
|
});
|
|
22
|
-
|
|
23
|
-
const config = await service.getConfig({}
|
|
20
|
+
test('check configuration ', async () => {
|
|
21
|
+
const config = await service.getConfig({});
|
|
24
22
|
(0, chai_1.expect)(config.contractConfigs).length(3);
|
|
25
23
|
});
|
|
26
|
-
|
|
24
|
+
test('Check mirrorworld instruction dispatch', async () => {
|
|
27
25
|
const request = {
|
|
28
26
|
instructions: [
|
|
29
27
|
{
|
|
@@ -33,12 +31,12 @@ describe('Test Solana Example', () => {
|
|
|
33
31
|
},
|
|
34
32
|
],
|
|
35
33
|
};
|
|
36
|
-
const res = await service.processInstructions(request
|
|
34
|
+
const res = await service.processInstructions(request);
|
|
37
35
|
(0, chai_1.expect)(res.result?.counters).length(3);
|
|
38
36
|
(0, chai_1.expect)(res.result?.gauges).length(0);
|
|
39
|
-
(0, chai_1.expect)((0,
|
|
37
|
+
(0, chai_1.expect)((0, test_processor_server_1.MetricValueToNumber)(res.result?.counters[0].metricValue)).equal(5000000000n);
|
|
40
38
|
});
|
|
41
|
-
|
|
39
|
+
test('Check wormhole token bridge instruction dispatch', async () => {
|
|
42
40
|
const request = {
|
|
43
41
|
instructions: [
|
|
44
42
|
{
|
|
@@ -53,14 +51,14 @@ describe('Test Solana Example', () => {
|
|
|
53
51
|
},
|
|
54
52
|
],
|
|
55
53
|
};
|
|
56
|
-
const res = await service.processInstructions(request
|
|
54
|
+
const res = await service.processInstructions(request);
|
|
57
55
|
(0, chai_1.expect)(res.result?.counters).length(2);
|
|
58
56
|
(0, chai_1.expect)(res.result?.gauges).length(0);
|
|
59
57
|
(0, chai_1.expect)(res.result?.counters[0].metadata?.blockNumber.toInt()).equal(0);
|
|
60
|
-
(0, chai_1.expect)((0,
|
|
58
|
+
(0, chai_1.expect)((0, test_processor_server_1.MetricValueToNumber)(res.result?.counters[0].metricValue)).equal(1000000n);
|
|
61
59
|
(0, chai_1.expect)(res.result?.counters[0].runtimeInfo?.from).equals(__1.HandlerType.INSTRUCTION);
|
|
62
60
|
});
|
|
63
|
-
|
|
61
|
+
test('Check SPLToken parsed instruction dispatch', async () => {
|
|
64
62
|
const parsedIns = {
|
|
65
63
|
info: {
|
|
66
64
|
account: '2SDN4vEJdCdW3pGyhx2km9gB3LeHzMGLrG2j4uVNZfrx',
|
|
@@ -80,11 +78,11 @@ describe('Test Solana Example', () => {
|
|
|
80
78
|
},
|
|
81
79
|
],
|
|
82
80
|
};
|
|
83
|
-
const res = await service.processInstructions(request
|
|
81
|
+
const res = await service.processInstructions(request);
|
|
84
82
|
(0, chai_1.expect)(res.result?.counters).length(1);
|
|
85
83
|
(0, chai_1.expect)(res.result?.gauges).length(0);
|
|
86
84
|
(0, chai_1.expect)(res.result?.counters[0].metadata?.blockNumber.toInt()).equal(0);
|
|
87
|
-
(0, chai_1.expect)((0,
|
|
85
|
+
(0, chai_1.expect)((0, test_processor_server_1.MetricValueToNumber)(res.result?.counters[0].metricValue)).equal(12000000000000);
|
|
88
86
|
(0, chai_1.expect)(res.result?.counters[0].runtimeInfo?.from).equals(__1.HandlerType.INSTRUCTION);
|
|
89
87
|
});
|
|
90
88
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solana.test.js","sourceRoot":"","sources":["../../src/test/solana.test.ts"],"names":[],"mappings":";AAAA,gCAAgC;;;;;AAEhC,+BAA6B;AAE7B,
|
|
1
|
+
{"version":3,"file":"solana.test.js","sourceRoot":"","sources":["../../src/test/solana.test.ts"],"names":[],"mappings":";AAAA,gCAAgC;;;;;AAEhC,+BAA6B;AAE7B,0BAA4D;AAE5D,gDAAuB;AACvB,+BAAkC;AAClC,mEAAkF;AAElF,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,MAAM,OAAO,GAAG,IAAI,2CAAmB,EAAE,CAAA;IAEzC,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,OAAO,CAAC,KAAK,EAAE,CAAA;QACrB,OAAO,CAAC,eAAe,CAAC,CAAA;QACxB,OAAO,CAAC,yBAAyB,CAAC,CAAA;QAClC,MAAM,OAAO,CAAC,KAAK,CAAC,EAAE,iBAAiB,EAAE,EAAE,EAAE,CAAC,CAAA;IAChD,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACtC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC1C,IAAA,aAAM,EAAC,MAAM,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;QACxD,MAAM,OAAO,GAA+B;YAC1C,YAAY,EAAE;gBACZ;oBACE,eAAe,EAAE,0CAA0C;oBAC3D,IAAI,EAAE,cAAI,CAAC,UAAU,CAAC,CAAC,CAAC;oBACxB,gBAAgB,EAAE,8CAA8C;iBACjE;aACF;SACF,CAAA;QACD,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAA;QACtD,IAAA,aAAM,EAAC,GAAG,CAAC,MAAM,EAA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M,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QACtF,IAAA,aAAM,EAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,eAAW,CAAC,WAAW,CAAC,CAAA;IACnF,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BlockBinding, ContractConfig, LogBinding, MetricValue, O11yResult, ProcessBlocksRequest, ProcessBlocksResponse, ProcessConfigRequest, ProcessConfigResponse, ProcessInstructionsRequest, ProcessInstructionsResponse, ProcessLogsRequest, ProcessLogsResponse, ProcessorServiceImpl, ProcessorServiceImplementation, ProcessTransactionsRequest, ProcessTransactionsResponse, StartRequest } from '@sentio/sdk';
|
|
2
|
+
import { CallContext } from 'nice-grpc-common';
|
|
3
|
+
import { Empty } from '../gen/google/protobuf/empty';
|
|
4
|
+
import { Numberish } from '../numberish';
|
|
5
|
+
import { Block, Log } from '@ethersproject/abstract-provider';
|
|
6
|
+
import { Networkish } from '@ethersproject/providers';
|
|
7
|
+
import { DeepPartial } from '../gen/builtin';
|
|
8
|
+
export declare class TestProcessorServer implements ProcessorServiceImplementation {
|
|
9
|
+
service: ProcessorServiceImpl;
|
|
10
|
+
contractConfig: ContractConfig[];
|
|
11
|
+
setup(httpEndpoints?: Record<string, string>): void;
|
|
12
|
+
start(request?: StartRequest, context?: CallContext): Promise<Empty>;
|
|
13
|
+
stop(request: Empty, context?: CallContext): Promise<Empty>;
|
|
14
|
+
getConfig(request: ProcessConfigRequest, context?: CallContext): Promise<ProcessConfigResponse>;
|
|
15
|
+
processBlocks(request: ProcessBlocksRequest, context?: CallContext): Promise<ProcessBlocksResponse>;
|
|
16
|
+
processInstructions(request: ProcessInstructionsRequest, context?: CallContext): Promise<ProcessInstructionsResponse>;
|
|
17
|
+
processLogs(request: ProcessLogsRequest, context?: CallContext): Promise<ProcessLogsResponse>;
|
|
18
|
+
processTransactions(request: ProcessTransactionsRequest, context?: CallContext): Promise<ProcessTransactionsResponse>;
|
|
19
|
+
testLog(log: Log, network?: Networkish): Promise<ProcessLogsResponse>;
|
|
20
|
+
testLogs(logs: Log[], network?: Networkish): Promise<ProcessLogsResponse>;
|
|
21
|
+
buildLogBinding(log: Log, network?: Networkish): LogBinding | undefined;
|
|
22
|
+
testBlock(block: Partial<Block> & {
|
|
23
|
+
number: number;
|
|
24
|
+
}, network?: Networkish): Promise<ProcessBlocksResponse>;
|
|
25
|
+
testBlocks(blocks: Partial<Block> & {
|
|
26
|
+
number: number;
|
|
27
|
+
}[], network?: Networkish): Promise<ProcessBlocksResponse>;
|
|
28
|
+
buildBlockBinding(block: Partial<Block> & {
|
|
29
|
+
number: number;
|
|
30
|
+
}, network?: Networkish): BlockBinding;
|
|
31
|
+
}
|
|
32
|
+
export declare function firstCounterValue(result: O11yResult | undefined, name: string): Numberish | undefined;
|
|
33
|
+
export declare function firstGaugeValue(result: O11yResult | undefined, name: string): Numberish | undefined;
|
|
34
|
+
export declare function MetricValueToNumber(v: DeepPartial<MetricValue> | undefined): Numberish | undefined;
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MetricValueToNumber = exports.firstGaugeValue = exports.firstCounterValue = exports.TestProcessorServer = void 0;
|
|
7
|
+
const sdk_1 = require("@sentio/sdk");
|
|
8
|
+
const chainmap_1 = require("../utils/chainmap");
|
|
9
|
+
const long_1 = __importDefault(require("long"));
|
|
10
|
+
const providers_1 = require("@ethersproject/providers");
|
|
11
|
+
const ethers_1 = require("ethers");
|
|
12
|
+
const TEST_CONTEXT = {};
|
|
13
|
+
function cleanTest() {
|
|
14
|
+
global.PROCESSOR_STATE = new sdk_1.ProcessorState();
|
|
15
|
+
}
|
|
16
|
+
class TestProcessorServer {
|
|
17
|
+
service = new sdk_1.ProcessorServiceImpl();
|
|
18
|
+
contractConfig;
|
|
19
|
+
setup(httpEndpoints = {}) {
|
|
20
|
+
cleanTest();
|
|
21
|
+
const dummyConfig = {};
|
|
22
|
+
for (const k in chainmap_1.CHAIN_MAP) {
|
|
23
|
+
const http = httpEndpoints[k] || '';
|
|
24
|
+
dummyConfig[k] = {
|
|
25
|
+
ChainID: k,
|
|
26
|
+
Https: [http],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
(0, sdk_1.setProvider)(dummyConfig);
|
|
30
|
+
// if (!Array.isArray(processorPath)) {
|
|
31
|
+
// processorPath = [processorPath]
|
|
32
|
+
// }
|
|
33
|
+
// for (const path of processorPath) {
|
|
34
|
+
// require(path)
|
|
35
|
+
// }
|
|
36
|
+
}
|
|
37
|
+
async start(request = { templateInstances: [] }, context = TEST_CONTEXT) {
|
|
38
|
+
const res = await this.service.start(request, context);
|
|
39
|
+
this.contractConfig = (await this.getConfig({})).contractConfigs;
|
|
40
|
+
return res;
|
|
41
|
+
}
|
|
42
|
+
stop(request, context = TEST_CONTEXT) {
|
|
43
|
+
return this.service.stop(request, context);
|
|
44
|
+
}
|
|
45
|
+
getConfig(request, context = TEST_CONTEXT) {
|
|
46
|
+
return this.service.getConfig(request, context);
|
|
47
|
+
}
|
|
48
|
+
processBlocks(request, context = TEST_CONTEXT) {
|
|
49
|
+
return this.service.processBlocks(request, context);
|
|
50
|
+
}
|
|
51
|
+
processInstructions(request, context = TEST_CONTEXT) {
|
|
52
|
+
return this.service.processInstructions(request, context);
|
|
53
|
+
}
|
|
54
|
+
processLogs(request, context = TEST_CONTEXT) {
|
|
55
|
+
return this.service.processLogs(request, context);
|
|
56
|
+
}
|
|
57
|
+
processTransactions(request, context = TEST_CONTEXT) {
|
|
58
|
+
return this.service.processTransactions(request, context);
|
|
59
|
+
}
|
|
60
|
+
testLog(log, network = 1) {
|
|
61
|
+
return this.testLogs([log], network);
|
|
62
|
+
}
|
|
63
|
+
testLogs(logs, network = 1) {
|
|
64
|
+
const bindings = [];
|
|
65
|
+
for (const log of logs) {
|
|
66
|
+
const binding = this.buildLogBinding(log, network);
|
|
67
|
+
if (!binding) {
|
|
68
|
+
throw Error('Invalid test log: ' + JSON.stringify(log));
|
|
69
|
+
}
|
|
70
|
+
bindings.push(binding);
|
|
71
|
+
}
|
|
72
|
+
return this.processLogs({
|
|
73
|
+
logBindings: bindings,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
buildLogBinding(log, network = 1) {
|
|
77
|
+
for (const contract of this.contractConfig) {
|
|
78
|
+
if (contract.contract?.chainId !== (0, providers_1.getNetwork)(network).chainId.toString()) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (log.address.toLowerCase() !== contract.contract?.address.toLowerCase()) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
for (const config of contract.logConfigs) {
|
|
85
|
+
for (const filter of config.filters) {
|
|
86
|
+
// if (filter.topics.length != log.topics.length) {
|
|
87
|
+
// continue
|
|
88
|
+
// }
|
|
89
|
+
let match = true;
|
|
90
|
+
for (const topicIdx in filter.topics) {
|
|
91
|
+
const logTopic = log.topics[topicIdx];
|
|
92
|
+
const possibleTopic = filter.topics[topicIdx].hashes;
|
|
93
|
+
if (possibleTopic.length === 0) {
|
|
94
|
+
// match all
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (possibleTopic.find((e) => e.toLowerCase() === logTopic.toLowerCase())) {
|
|
98
|
+
// find one
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
match = false;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
if (match) {
|
|
105
|
+
return {
|
|
106
|
+
log: {
|
|
107
|
+
raw: toBytes(log),
|
|
108
|
+
},
|
|
109
|
+
handlerId: config.handlerId,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
testBlock(block, network = 1) {
|
|
118
|
+
return this.testBlocks([block], network);
|
|
119
|
+
}
|
|
120
|
+
testBlocks(blocks, network = 1) {
|
|
121
|
+
const bindings = [];
|
|
122
|
+
for (const block of blocks) {
|
|
123
|
+
const binding = this.buildBlockBinding(block, network);
|
|
124
|
+
if (!binding) {
|
|
125
|
+
throw Error('Invalid test block: ' + JSON.stringify(block));
|
|
126
|
+
}
|
|
127
|
+
bindings.push(binding);
|
|
128
|
+
}
|
|
129
|
+
return this.processBlocks({
|
|
130
|
+
blockBindings: bindings,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
buildBlockBinding(block, network = 1) {
|
|
134
|
+
const binding = {
|
|
135
|
+
block: {
|
|
136
|
+
raw: toBytes(block),
|
|
137
|
+
},
|
|
138
|
+
handlerIds: [],
|
|
139
|
+
};
|
|
140
|
+
for (const contract of this.contractConfig) {
|
|
141
|
+
if (contract.contract?.chainId !== (0, providers_1.getNetwork)(network).chainId.toString()) {
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
const longBlockNumber = long_1.default.fromNumber(block.number);
|
|
145
|
+
if (longBlockNumber < contract.startBlock) {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (contract.endBlock !== long_1.default.ZERO && longBlockNumber >= contract.endBlock) {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
for (const config of contract.blockConfigs) {
|
|
152
|
+
binding.handlerIds.push(config.handlerId);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return binding;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
exports.TestProcessorServer = TestProcessorServer;
|
|
159
|
+
function firstCounterValue(result, name) {
|
|
160
|
+
if (!result) {
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
163
|
+
for (const counter of result.counters) {
|
|
164
|
+
if (counter.metadata?.name === name) {
|
|
165
|
+
return MetricValueToNumber(counter.metricValue);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
exports.firstCounterValue = firstCounterValue;
|
|
171
|
+
function firstGaugeValue(result, name) {
|
|
172
|
+
if (!result) {
|
|
173
|
+
return undefined;
|
|
174
|
+
}
|
|
175
|
+
for (const gauge of result.gauges) {
|
|
176
|
+
if (gauge.metadata?.name === name) {
|
|
177
|
+
return MetricValueToNumber(gauge.metricValue);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return undefined;
|
|
181
|
+
}
|
|
182
|
+
exports.firstGaugeValue = firstGaugeValue;
|
|
183
|
+
function toBytes(obj) {
|
|
184
|
+
const logJsonStr = JSON.stringify(obj);
|
|
185
|
+
const raw = new Uint8Array(logJsonStr.length);
|
|
186
|
+
for (let i = 0; i < logJsonStr.length; i++) {
|
|
187
|
+
raw[i] = logJsonStr.charCodeAt(i);
|
|
188
|
+
}
|
|
189
|
+
return raw;
|
|
190
|
+
}
|
|
191
|
+
function MetricValueToNumber(v) {
|
|
192
|
+
if (v === undefined) {
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
if (v.doubleValue !== undefined) {
|
|
196
|
+
return v.doubleValue;
|
|
197
|
+
}
|
|
198
|
+
if (v.bigInteger !== undefined) {
|
|
199
|
+
let intValue = ethers_1.BigNumber.from(v.bigInteger.data).toBigInt();
|
|
200
|
+
if (v.bigInteger.negative) {
|
|
201
|
+
intValue = -intValue;
|
|
202
|
+
}
|
|
203
|
+
return intValue;
|
|
204
|
+
}
|
|
205
|
+
if (v.bigDecimal !== undefined) {
|
|
206
|
+
return new sdk_1.BigDecimal(v.bigDecimal);
|
|
207
|
+
}
|
|
208
|
+
return undefined;
|
|
209
|
+
}
|
|
210
|
+
exports.MetricValueToNumber = MetricValueToNumber;
|
|
211
|
+
//# sourceMappingURL=test-processor-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-processor-server.js","sourceRoot":"","sources":["../../src/test/test-processor-server.ts"],"names":[],"mappings":";;;;;;AAAA,qCAsBoB;AAIpB,gDAA6C;AAG7C,gDAAuB;AACvB,wDAAiE;AAEjE,mCAAkC;AAElC,MAAM,YAAY,GAA6B,EAAE,CAAA;AAEjD,SAAS,SAAS;IAChB,MAAM,CAAC,eAAe,GAAG,IAAI,oBAAc,EAAE,CAAA;AAC/C,CAAC;AAED,MAAa,mBAAmB;IAC9B,OAAO,GAAG,IAAI,0BAAoB,EAAE,CAAA;IACpC,cAAc,CAAkB;IAEhC,KAAK,CAAC,gBAAwC,EAAE;QAC9C,SAAS,EAAE,CAAA;QACX,MAAM,WAAW,GAAgC,EAAE,CAAA;QAEnD,KAAK,MAAM,CAAC,IAAI,oBAAS,EAAE;YACzB,MAAM,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;YACnC,WAAW,CAAC,CAAC,CAAC,GAAG;gBACf,OAAO,EAAE,CAAC;gBACV,KAAK,EAAE,CAAC,IAAI,CAAC;aACd,CAAA;SACF;QAED,IAAA,iBAAW,EAAC,WAAW,CAAC,CAAA;QAExB,uCAAuC;QACvC,oCAAoC;QACpC,IAAI;QACJ,sCAAsC;QACtC,kBAAkB;QAClB,IAAI;IACN,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,UAAwB,EAAE,iBAAiB,EAAE,EAAE,EAAE,EAAE,OAAO,GAAG,YAAY;QACnF,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACtD,IAAI,CAAC,cAAc,GAAG,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,CAAA;QAChE,OAAO,GAAG,CAAA;IACZ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,CAAC,CAAA;IACtC,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;IAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,GAAG,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;KAClC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAgB,mBAAmB,CAAC,CAAuC;IACzE,IAAI,CAAC,KAAK,SAAS,EAAE;QACnB,OAAO,SAAS,CAAA;KACjB;IAED,IAAI,CAAC,CAAC,WAAW,KAAK,SAAS,EAAE;QAC/B,OAAO,CAAC,CAAC,WAAW,CAAA;KACrB;IACD,IAAI,CAAC,CAAC,UAAU,KAAK,SAAS,EAAE;QAC9B,IAAI,QAAQ,GAAG,kBAAS,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAA;QAC3D,IAAI,CAAC,CAAC,UAAU,CAAC,QAAQ,EAAE;YACzB,QAAQ,GAAG,CAAC,QAAQ,CAAA;SACrB;QACD,OAAO,QAAQ,CAAA;KAChB;IACD,IAAI,CAAC,CAAC,UAAU,KAAK,SAAS,EAAE;QAC9B,OAAO,IAAI,gBAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;KACpC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAnBD,kDAmBC"}
|
package/dist/utils/chainmap.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chainmap.js","sourceRoot":"","sources":["../../src/utils/chainmap.ts"],"names":[],"mappings":";AAAA,mFAAmF;AACnF,6EAA6E;;;AAEhE,QAAA,SAAS,
|
|
1
|
+
{"version":3,"file":"chainmap.js","sourceRoot":"","sources":["../../src/utils/chainmap.ts"],"names":[],"mappings":";AAAA,mFAAmF;AACnF,6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AS;IACf,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,OAAO;IACf,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,QAAQ;IACpB,UAAU,EAAE,SAAS;IACrB,WAAW,EAAE,MAAM;IACnB,eAAe,EAAE,OAAO;CACzB,CAAA;AAED,SAAgB,YAAY,CAAC,OAAe;IAC1C,MAAM,IAAI,GAAG,iBAAS,CAAC,OAAO,CAAC,CAAA;IAC/B,IAAI,IAAI,EAAE;QACR,OAAO,IAAI,CAAA;KACZ;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAND,oCAMC"}
|
package/package.json
CHANGED
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
"scripts": {
|
|
5
5
|
"compile_target": "yarn tsc -b src/target-ethers-sentio/tsconfig.json",
|
|
6
6
|
"compile": "tsc -p . && cp src/cli/webpack.config.js dist/cli",
|
|
7
|
-
"build": "yarn
|
|
7
|
+
"build": "yarn gen && yarn compile",
|
|
8
8
|
"start_ts": "ts-node --files src/processor-runner.ts ../examples/x2y2/src/processor.ts",
|
|
9
9
|
"start_ts_solana": "ts-node --files src/processor-runner.ts ../examples/mirrorworld/src/processor.ts",
|
|
10
10
|
"start": "ts-node --files src/processor-runner.ts ../examples/x2y2/dist/lib.js",
|
|
11
11
|
"start_js": "node dist/processor.js ../examples/x2y2/dist/lib.js",
|
|
12
12
|
"ts-start": "ts-node --files src/processor-runner.ts ./src/anyswap/src/processor.ts",
|
|
13
13
|
"cli": "yarn build && node dist/cli/cli.js",
|
|
14
|
-
"test": "
|
|
14
|
+
"test": "jest",
|
|
15
|
+
"gen": "yarn compile_target && yarn gen_bultin_evm && yarn gen_test_abi",
|
|
15
16
|
"gen_test_abi": "yarn gen_solana_abi",
|
|
16
17
|
"gen_bultin_evm": "typechain --target dist/target-ethers-sentio --out-dir src/builtin/internal 'src/abis/*.json'",
|
|
17
18
|
"gen_solana_abi": "ts-node src/cli/solana-code-gen.ts src/test types"
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
"processor-runner": "./dist/processor-runner.js",
|
|
21
22
|
"sentio": "./dist/cli/cli.js"
|
|
22
23
|
},
|
|
23
|
-
"version": "1.
|
|
24
|
+
"version": "1.6.0",
|
|
24
25
|
"dependencies": {
|
|
25
26
|
"@ethersproject/providers": "~5.7.0",
|
|
26
27
|
"@project-serum/anchor": "^0.25.0",
|
|
@@ -53,14 +54,14 @@
|
|
|
53
54
|
"@types/expect": "^24.3.0",
|
|
54
55
|
"@types/fs-extra": "^9.0.13",
|
|
55
56
|
"@types/google-protobuf": "^3.15.6",
|
|
57
|
+
"@types/jest": "^29.0.0",
|
|
56
58
|
"@types/js-yaml": "^4.0.5",
|
|
57
59
|
"@types/mkdirp": "^1.0.2",
|
|
58
|
-
"@types/mocha": "^9.1.1",
|
|
59
60
|
"@types/node": "^18.0.4",
|
|
60
61
|
"chai": "^4.3.6",
|
|
61
|
-
"
|
|
62
|
+
"jest": "^28.0.1",
|
|
62
63
|
"semantic-release": "^19.0.5",
|
|
63
|
-
"ts-
|
|
64
|
+
"ts-jest": "^28.0.8",
|
|
64
65
|
"ts-node": "^10.8.0",
|
|
65
66
|
"tsconfig-paths": "^4.0.0",
|
|
66
67
|
"typescript": "^4.8.0"
|