@sentio/sdk 0.6.3 → 1.0.0-development
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/base-processor-template.d.ts +20 -0
- package/dist/base-processor-template.js +75 -0
- package/dist/base-processor-template.js.map +1 -0
- package/dist/base-processor.d.ts +22 -0
- package/dist/base-processor.js +103 -0
- package/dist/base-processor.js.map +1 -0
- package/dist/bind-options.d.ts +17 -0
- package/dist/bind-options.js +38 -0
- package/dist/bind-options.js.map +1 -0
- package/dist/binds.d.ts +10 -0
- package/dist/binds.js +58 -0
- package/dist/binds.js.map +1 -0
- package/dist/builtin/erc20/index.d.ts +2 -0
- package/dist/builtin/erc20/index.js +22 -0
- package/dist/builtin/erc20/index.js.map +1 -0
- package/dist/builtin/internal/Erc20.d.ts +150 -0
- package/dist/builtin/internal/Erc20.js +3 -0
- package/dist/builtin/internal/Erc20.js.map +1 -0
- package/dist/builtin/internal/common.d.ts +22 -0
- package/dist/builtin/internal/common.js +3 -0
- package/dist/builtin/internal/common.js.map +1 -0
- package/dist/builtin/internal/erc20_processor.d.ts +38 -0
- package/dist/builtin/internal/erc20_processor.js +209 -0
- package/dist/builtin/internal/erc20_processor.js.map +1 -0
- package/dist/builtin/internal/factories/Erc20__factory.d.ts +35 -0
- package/dist/builtin/internal/factories/Erc20__factory.js +216 -0
- package/dist/builtin/internal/factories/Erc20__factory.js.map +1 -0
- package/dist/builtin/internal/factories/index.d.ts +1 -0
- package/dist/builtin/internal/factories/index.js +9 -0
- package/dist/builtin/internal/factories/index.js.map +1 -0
- package/dist/builtin/internal/index.d.ts +3 -0
- package/dist/builtin/internal/index.js +30 -0
- package/dist/builtin/internal/index.js.map +1 -0
- package/dist/cli/build.d.ts +3 -0
- package/dist/cli/build.js +161 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/cli.d.ts +2 -0
- package/dist/cli/cli.js +212 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/config.d.ts +14 -0
- package/dist/cli/config.js +24 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/key.d.ts +2 -0
- package/dist/cli/key.js +44 -0
- package/dist/cli/key.js.map +1 -0
- package/dist/cli/solana-code-gen.d.ts +2 -0
- package/dist/cli/solana-code-gen.js +19 -0
- package/dist/cli/solana-code-gen.js.map +1 -0
- package/dist/cli/upload.d.ts +2 -0
- package/dist/cli/upload.js +76 -0
- package/dist/cli/upload.js.map +1 -0
- package/dist/cli/webpack.config.js +41 -0
- package/dist/context.d.ts +39 -0
- package/dist/context.js +75 -0
- package/dist/context.js.map +1 -0
- package/dist/contract-namer.d.ts +6 -0
- package/dist/contract-namer.js +20 -0
- package/dist/contract-namer.js.map +1 -0
- package/dist/error.d.ts +2 -0
- package/dist/error.js +39 -0
- package/dist/error.js.map +1 -0
- package/dist/gen/builtin.d.ts +6 -0
- package/dist/gen/builtin.js +3 -0
- package/dist/gen/builtin.js.map +1 -0
- package/dist/gen/google/protobuf/empty.d.ts +16 -0
- package/dist/gen/google/protobuf/empty.js +47 -0
- package/dist/gen/google/protobuf/empty.js.map +1 -0
- package/dist/gen/processor/protos/processor.d.ts +598 -0
- package/dist/gen/processor/protos/processor.js +2424 -0
- package/dist/gen/processor/protos/processor.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/meter.d.ts +25 -0
- package/dist/meter.js +114 -0
- package/dist/meter.js.map +1 -0
- package/dist/numberish.d.ts +7 -0
- package/dist/numberish.js +74 -0
- package/dist/numberish.js.map +1 -0
- package/dist/numberish.test.d.ts +1 -0
- package/dist/numberish.test.js +54 -0
- package/dist/numberish.test.js.map +1 -0
- package/dist/processor-runner.d.ts +2 -0
- package/dist/processor-runner.js +66 -0
- package/dist/processor-runner.js.map +1 -0
- package/dist/processor-state.d.ts +16 -0
- package/dist/processor-state.js +20 -0
- package/dist/processor-state.js.map +1 -0
- package/dist/provider.d.ts +5 -0
- package/dist/provider.js +56 -0
- package/dist/provider.js.map +1 -0
- package/dist/service.d.ts +22 -0
- package/dist/service.js +361 -0
- package/dist/service.js.map +1 -0
- package/dist/solana/builtin/spl-token-processor.d.ts +25 -0
- package/dist/solana/builtin/spl-token-processor.js +152 -0
- package/dist/solana/builtin/spl-token-processor.js.map +1 -0
- package/dist/solana-processor.d.ts +28 -0
- package/dist/solana-processor.js +79 -0
- package/dist/solana-processor.js.map +1 -0
- package/dist/target-ethers-sentio/codegen.d.ts +3 -0
- package/dist/target-ethers-sentio/codegen.js +201 -0
- package/dist/target-ethers-sentio/codegen.js.map +1 -0
- package/dist/target-ethers-sentio/index.d.ts +6 -0
- package/dist/target-ethers-sentio/index.js +47 -0
- package/dist/target-ethers-sentio/index.js.map +1 -0
- package/dist/test-case/clean-test.d.ts +1 -0
- package/dist/test-case/clean-test.js +9 -0
- package/dist/test-case/clean-test.js.map +1 -0
- package/dist/test-case/erc20-template.d.ts +1 -0
- package/dist/test-case/erc20-template.js +23 -0
- package/dist/test-case/erc20-template.js.map +1 -0
- package/dist/test-case/erc20-template.test.d.ts +1 -0
- package/dist/test-case/erc20-template.test.js +69 -0
- package/dist/test-case/erc20-template.test.js.map +1 -0
- package/dist/test-case/erc20.d.ts +1 -0
- package/dist/test-case/erc20.js +42 -0
- package/dist/test-case/erc20.js.map +1 -0
- package/dist/test-case/erc20.test.d.ts +1 -0
- package/dist/test-case/erc20.test.js +154 -0
- package/dist/test-case/erc20.test.js.map +1 -0
- package/dist/test-case/mirrorworld.d.ts +1 -0
- package/dist/test-case/mirrorworld.js +42 -0
- package/dist/test-case/mirrorworld.js.map +1 -0
- package/dist/test-case/solana.test.d.ts +1 -0
- package/dist/test-case/solana.test.js +58 -0
- package/dist/test-case/solana.test.js.map +1 -0
- package/dist/test-case/types/game_wallet.d.ts +45 -0
- package/dist/test-case/types/game_wallet.js +1396 -0
- package/dist/test-case/types/game_wallet.js.map +1 -0
- package/dist/test-case/types/game_wallet_processor.d.ts +107 -0
- package/dist/test-case/types/game_wallet_processor.js +102 -0
- package/dist/test-case/types/game_wallet_processor.js.map +1 -0
- package/dist/test-case/types/wormhole_processor.d.ts +16 -0
- package/dist/test-case/types/wormhole_processor.js +192 -0
- package/dist/test-case/types/wormhole_processor.js.map +1 -0
- package/dist/test-case/wormhole-token-bridge.d.ts +1 -0
- package/dist/test-case/wormhole-token-bridge.js +7 -0
- package/dist/test-case/wormhole-token-bridge.js.map +1 -0
- package/dist/utils/chainmap.d.ts +4 -0
- package/dist/utils/chainmap.js +95 -0
- package/dist/utils/chainmap.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const command_line_args_1 = __importDefault(require("command-line-args"));
|
|
8
|
+
const nice_grpc_1 = require("nice-grpc");
|
|
9
|
+
const processor_1 = require("./gen/processor/protos/processor");
|
|
10
|
+
const service_1 = require("./service");
|
|
11
|
+
const provider_1 = require("./provider");
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
13
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
14
|
+
const processor_state_1 = require("./processor-state");
|
|
15
|
+
global.sentio_sdk = require('.');
|
|
16
|
+
global.PROCESSOR_STATE = new processor_state_1.ProcessorState();
|
|
17
|
+
function tryRequire(name) {
|
|
18
|
+
const req = eval('require');
|
|
19
|
+
try {
|
|
20
|
+
let path;
|
|
21
|
+
try {
|
|
22
|
+
path = req.resolve(name, { paths: [process.cwd()] });
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
path = req.resolve(name);
|
|
26
|
+
}
|
|
27
|
+
const module = { module: req(path), name, path };
|
|
28
|
+
console.log('Load successfully: ', name);
|
|
29
|
+
return module;
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
if (err instanceof Error && err.message.startsWith(`Cannot find module '${name}'`)) {
|
|
33
|
+
// this error is expected
|
|
34
|
+
console.log("Couldn't load (expected): ", name);
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
throw err;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const optionDefinitions = [
|
|
43
|
+
{ name: 'target', type: String, defaultOption: true },
|
|
44
|
+
{ name: 'port', alias: 'p', type: String, defaultValue: '4000' },
|
|
45
|
+
{ name: 'concurrency', type: Number, defaultValue: 4 },
|
|
46
|
+
{
|
|
47
|
+
name: 'chains-config',
|
|
48
|
+
alias: 'c',
|
|
49
|
+
type: String,
|
|
50
|
+
defaultValue: 'chains-config.json',
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
const options = (0, command_line_args_1.default)(optionDefinitions);
|
|
54
|
+
console.log('loading', options.target);
|
|
55
|
+
const fullPath = path_1.default.resolve(options['chains-config']);
|
|
56
|
+
const chainsConfig = fs_extra_1.default.readJsonSync(fullPath);
|
|
57
|
+
(0, provider_1.setProvider)(chainsConfig, options.concurrency);
|
|
58
|
+
tryRequire(options.target);
|
|
59
|
+
console.log('Start Server', options);
|
|
60
|
+
console.log(global.PROCESSOR_STATE.processors.length, ' processors loaded');
|
|
61
|
+
console.log(global.PROCESSOR_STATE.solanaProcessors.length, ' solana processors loaded');
|
|
62
|
+
const server = (0, nice_grpc_1.createServer)();
|
|
63
|
+
const service = new service_1.ProcessorServiceImpl(server.shutdown);
|
|
64
|
+
server.add(processor_1.ProcessorDefinition, service);
|
|
65
|
+
server.listen('0.0.0.0:' + options.port);
|
|
66
|
+
//# sourceMappingURL=processor-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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AAC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseProcessor } from './base-processor';
|
|
2
|
+
import { BaseContract } from 'ethers';
|
|
3
|
+
import { BoundContractView, ContractView } from './context';
|
|
4
|
+
import { BaseProcessorTemplate } from './base-processor-template';
|
|
5
|
+
import { TemplateInstance } from './gen/processor/protos/processor';
|
|
6
|
+
import { Provider } from '@ethersproject/providers';
|
|
7
|
+
import { SolanaBaseProcessor } from './solana-processor';
|
|
8
|
+
export declare class ProcessorState {
|
|
9
|
+
contracts: Map<string, ContractView<BaseContract>>;
|
|
10
|
+
processors: BaseProcessor<BaseContract, BoundContractView<BaseContract, any>>[];
|
|
11
|
+
processorMap: Map<string, BaseProcessor<any, any>>;
|
|
12
|
+
providers: Map<number, Provider>;
|
|
13
|
+
templates: BaseProcessorTemplate<BaseContract, BoundContractView<BaseContract, any>>[];
|
|
14
|
+
templatesInstances: TemplateInstance[];
|
|
15
|
+
solanaProcessors: SolanaBaseProcessor[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProcessorState = void 0;
|
|
4
|
+
class ProcessorState {
|
|
5
|
+
// from abiName_address_chainId => contract wrapper
|
|
6
|
+
contracts = new Map();
|
|
7
|
+
// all evm processors
|
|
8
|
+
processors = [];
|
|
9
|
+
// from abiName_options to contracts
|
|
10
|
+
processorMap = new Map();
|
|
11
|
+
// evm providers
|
|
12
|
+
providers = new Map();
|
|
13
|
+
// evm processor templates
|
|
14
|
+
templates = [];
|
|
15
|
+
// evm processor template instances spec
|
|
16
|
+
templatesInstances = [];
|
|
17
|
+
solanaProcessors = [];
|
|
18
|
+
}
|
|
19
|
+
exports.ProcessorState = ProcessorState;
|
|
20
|
+
//# sourceMappingURL=processor-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processor-state.js","sourceRoot":"","sources":["../src/processor-state.ts"],"names":[],"mappings":";;;AAQA,MAAa,cAAc;IACzB,mDAAmD;IACnD,SAAS,GAAG,IAAI,GAAG,EAAsC,CAAA;IACzD,qBAAqB;IACrB,UAAU,GAAwE,EAAE,CAAA;IACpF,oCAAoC;IACpC,YAAY,GAAG,IAAI,GAAG,EAAmC,CAAA;IACzD,gBAAgB;IAChB,SAAS,GAAG,IAAI,GAAG,EAAoB,CAAA;IACvC,0BAA0B;IAC1B,SAAS,GAAgF,EAAE,CAAA;IAC3F,wCAAwC;IACxC,kBAAkB,GAAuB,EAAE,CAAA;IAE3C,gBAAgB,GAA0B,EAAE,CAAA;CAC7C;AAfD,wCAeC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Provider, StaticJsonRpcProvider } from '@ethersproject/providers';
|
|
2
|
+
import { Networkish } from '@ethersproject/networks';
|
|
3
|
+
export declare const DummyProvider: StaticJsonRpcProvider;
|
|
4
|
+
export declare function getProvider(networkish?: Networkish): Provider;
|
|
5
|
+
export declare function setProvider(config: any, concurrency?: number): void;
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
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.setProvider = exports.getProvider = exports.DummyProvider = void 0;
|
|
7
|
+
const providers_1 = require("@ethersproject/providers");
|
|
8
|
+
const p_queue_1 = __importDefault(require("p-queue"));
|
|
9
|
+
exports.DummyProvider = new providers_1.StaticJsonRpcProvider(undefined, 1);
|
|
10
|
+
function getProvider(networkish) {
|
|
11
|
+
if (!networkish) {
|
|
12
|
+
networkish = 1;
|
|
13
|
+
}
|
|
14
|
+
const network = (0, providers_1.getNetwork)(networkish);
|
|
15
|
+
if (!global.PROCESSOR_STATE.providers) {
|
|
16
|
+
throw Error('Provider not found');
|
|
17
|
+
}
|
|
18
|
+
const value = global.PROCESSOR_STATE.providers.get(network.chainId);
|
|
19
|
+
if (value === undefined) {
|
|
20
|
+
throw Error('Provider not found');
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
exports.getProvider = getProvider;
|
|
25
|
+
function setProvider(config, concurrency = 4) {
|
|
26
|
+
global.PROCESSOR_STATE.providers = new Map();
|
|
27
|
+
for (const chainIdStr in config) {
|
|
28
|
+
if (isNaN(Number.parseInt(chainIdStr))) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const chainConfig = config[chainIdStr];
|
|
32
|
+
const chainId = Number(chainIdStr);
|
|
33
|
+
// let providers: StaticJsonRpcProvider[] = []
|
|
34
|
+
// for (const http of chainConfig.Https) {
|
|
35
|
+
// providers.push(new StaticJsonRpcProvider(http, chainId))
|
|
36
|
+
// }
|
|
37
|
+
// random shuffle
|
|
38
|
+
// providers = providers.sort(() => Math.random() - 0.5)
|
|
39
|
+
// const provider = new FallbackProvider(providers)
|
|
40
|
+
const idx = Math.floor(Math.random() * chainConfig.Https.length);
|
|
41
|
+
const provider = new QueuedStaticJsonRpcProvider(chainConfig.Https[idx], chainId, concurrency);
|
|
42
|
+
global.PROCESSOR_STATE.providers.set(chainId, provider);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.setProvider = setProvider;
|
|
46
|
+
class QueuedStaticJsonRpcProvider extends providers_1.StaticJsonRpcProvider {
|
|
47
|
+
executor;
|
|
48
|
+
constructor(url, network, concurrency) {
|
|
49
|
+
super(url, network);
|
|
50
|
+
this.executor = new p_queue_1.default({ concurrency: concurrency });
|
|
51
|
+
}
|
|
52
|
+
send(method, params) {
|
|
53
|
+
return this.executor.add(() => super.send(method, params));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sour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A;QAChE,MAAM,QAAQ,GAAG,IAAI,2BAA2B,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,CAAA;QAE9F,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;KACxD;AACH,CAAC;AAxBD,kCAwBC;AAED,MAAM,2BAA4B,SAAQ,iCAAqB;IAC7D,QAAQ,CAAQ;IAEhB,YAAY,GAA4B,EAAE,OAAmB,EAAE,WAAmB;QAChF,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAM,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAA;IAC1D,CAAC;IAED,IAAI,CAAC,MAAc,EAAE,MAAkB;QACrC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC5D,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CallContext } from 'nice-grpc';
|
|
2
|
+
import { ProcessBlockRequest, ProcessBlockResponse, ProcessBlocksRequest, ProcessBlocksResponse, ProcessConfigRequest, ProcessConfigResponse, ProcessInstructionRequest, ProcessInstructionResponse, ProcessLogRequest, ProcessLogResponse, ProcessorServiceImplementation, ProcessTransactionRequest, ProcessTransactionResponse, StartRequest } from './gen/processor/protos/processor';
|
|
3
|
+
import { DeepPartial } from './gen/builtin';
|
|
4
|
+
import { Empty } from './gen/google/protobuf/empty';
|
|
5
|
+
export declare class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
6
|
+
private eventHandlers;
|
|
7
|
+
private processorsByChainId;
|
|
8
|
+
private started;
|
|
9
|
+
private contractConfigs;
|
|
10
|
+
private templateInstances;
|
|
11
|
+
private readonly shutdownHandler?;
|
|
12
|
+
constructor(shutdownHandler?: () => void);
|
|
13
|
+
getConfig(request: ProcessConfigRequest, context: CallContext): Promise<DeepPartial<ProcessConfigResponse>>;
|
|
14
|
+
configure(): Promise<void>;
|
|
15
|
+
start(request: StartRequest, context: CallContext): Promise<DeepPartial<Empty>>;
|
|
16
|
+
stop(request: Empty, context: CallContext): Promise<DeepPartial<Empty>>;
|
|
17
|
+
processLog(request: ProcessLogRequest, context: CallContext): Promise<DeepPartial<ProcessLogResponse>>;
|
|
18
|
+
processTransaction(request: ProcessTransactionRequest, context: CallContext): Promise<DeepPartial<ProcessTransactionResponse>>;
|
|
19
|
+
processInstruction(request: ProcessInstructionRequest, context: CallContext): Promise<ProcessInstructionResponse>;
|
|
20
|
+
processBlocks(request: ProcessBlocksRequest, context: CallContext): Promise<DeepPartial<ProcessBlocksResponse>>;
|
|
21
|
+
processBlock(request: ProcessBlockRequest, context: CallContext): Promise<DeepPartial<ProcessBlockResponse>>;
|
|
22
|
+
}
|
package/dist/service.js
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
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.ProcessorServiceImpl = void 0;
|
|
7
|
+
const nice_grpc_1 = require("nice-grpc");
|
|
8
|
+
const processor_1 = require("./gen/processor/protos/processor");
|
|
9
|
+
const long_1 = __importDefault(require("long"));
|
|
10
|
+
const DEFAULT_MAX_BLOCK = long_1.default.ZERO;
|
|
11
|
+
class ProcessorServiceImpl {
|
|
12
|
+
eventHandlers = [];
|
|
13
|
+
// map from chain id to list of processors
|
|
14
|
+
// private blockHandlers = new Map<string, ((block: Block) => Promise<O11yResult>)[]>()
|
|
15
|
+
processorsByChainId = new Map();
|
|
16
|
+
started = false;
|
|
17
|
+
contractConfigs;
|
|
18
|
+
templateInstances;
|
|
19
|
+
shutdownHandler;
|
|
20
|
+
constructor(shutdownHandler) {
|
|
21
|
+
this.shutdownHandler = shutdownHandler;
|
|
22
|
+
}
|
|
23
|
+
async getConfig(request, context) {
|
|
24
|
+
if (!this.started) {
|
|
25
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.UNAVAILABLE, 'Service Not started.');
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
// TODO project setting
|
|
29
|
+
contractConfigs: this.contractConfigs,
|
|
30
|
+
templateInstances: this.templateInstances,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
async configure() {
|
|
34
|
+
this.eventHandlers = [];
|
|
35
|
+
this.templateInstances = [];
|
|
36
|
+
this.processorsByChainId.clear();
|
|
37
|
+
this.contractConfigs = [];
|
|
38
|
+
if (global.PROCESSOR_STATE.templatesInstances) {
|
|
39
|
+
this.templateInstances = [...global.PROCESSOR_STATE.templatesInstances];
|
|
40
|
+
}
|
|
41
|
+
if (global.PROCESSOR_STATE.processors) {
|
|
42
|
+
for (const processor of global.PROCESSOR_STATE.processors) {
|
|
43
|
+
// If server favor incremental update this need to change
|
|
44
|
+
// Start basic config for contract
|
|
45
|
+
const chainId = processor.getChainId();
|
|
46
|
+
this.processorsByChainId.set(chainId, processor);
|
|
47
|
+
const contractConfig = {
|
|
48
|
+
contract: {
|
|
49
|
+
name: processor.config.name,
|
|
50
|
+
chainId: chainId,
|
|
51
|
+
address: processor.config.address,
|
|
52
|
+
abi: '',
|
|
53
|
+
},
|
|
54
|
+
blockConfig: {
|
|
55
|
+
numHandlers: processor.blockHandlers.length,
|
|
56
|
+
},
|
|
57
|
+
logConfigs: [],
|
|
58
|
+
startBlock: processor.config.startBlock,
|
|
59
|
+
endBlock: DEFAULT_MAX_BLOCK,
|
|
60
|
+
instructionConfig: undefined,
|
|
61
|
+
};
|
|
62
|
+
if (processor.config.endBlock) {
|
|
63
|
+
contractConfig.endBlock = processor.config.endBlock;
|
|
64
|
+
}
|
|
65
|
+
// Prepare all the event handlers
|
|
66
|
+
for (const eventsHandler of processor.eventHandlers) {
|
|
67
|
+
// associate id with filter
|
|
68
|
+
const handlerId = this.eventHandlers.push(eventsHandler.handler) - 1;
|
|
69
|
+
const logConfig = {
|
|
70
|
+
handlerId: handlerId,
|
|
71
|
+
conditions: [],
|
|
72
|
+
};
|
|
73
|
+
for (const filter of eventsHandler.filters) {
|
|
74
|
+
if (!filter.topics) {
|
|
75
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INVALID_ARGUMENT, 'Topic should not be null');
|
|
76
|
+
}
|
|
77
|
+
const condition = {
|
|
78
|
+
topics: [],
|
|
79
|
+
};
|
|
80
|
+
for (const ts of filter.topics) {
|
|
81
|
+
let hashes = [];
|
|
82
|
+
if (Array.isArray(ts)) {
|
|
83
|
+
hashes = hashes.concat(ts);
|
|
84
|
+
}
|
|
85
|
+
else if (ts) {
|
|
86
|
+
hashes.push(ts);
|
|
87
|
+
}
|
|
88
|
+
condition.topics.push({ hashes: hashes });
|
|
89
|
+
}
|
|
90
|
+
logConfig.conditions.push(condition);
|
|
91
|
+
}
|
|
92
|
+
contractConfig.logConfigs.push(logConfig);
|
|
93
|
+
}
|
|
94
|
+
// Finish up a contract
|
|
95
|
+
this.contractConfigs.push(contractConfig);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (global.PROCESSOR_STATE.solanaProcessors) {
|
|
99
|
+
for (const solanaProcessor of global.PROCESSOR_STATE.solanaProcessors) {
|
|
100
|
+
const contractConfig = {
|
|
101
|
+
contract: {
|
|
102
|
+
name: solanaProcessor.contractName,
|
|
103
|
+
chainId: 'SOL:mainnet',
|
|
104
|
+
address: solanaProcessor.address,
|
|
105
|
+
abi: '',
|
|
106
|
+
},
|
|
107
|
+
blockConfig: undefined,
|
|
108
|
+
logConfigs: [],
|
|
109
|
+
startBlock: solanaProcessor.config.startSlot,
|
|
110
|
+
endBlock: DEFAULT_MAX_BLOCK,
|
|
111
|
+
instructionConfig: {
|
|
112
|
+
innerInstruction: solanaProcessor.processInnerInstruction,
|
|
113
|
+
parsedInstruction: solanaProcessor.fromParsedInstruction != null ? true : false,
|
|
114
|
+
rawDataInstruction: solanaProcessor.decodeInstruction != null ? true : false,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
this.contractConfigs.push(contractConfig);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async start(request, context) {
|
|
122
|
+
if (this.started) {
|
|
123
|
+
return {};
|
|
124
|
+
}
|
|
125
|
+
for (const instance of request.templateInstances) {
|
|
126
|
+
const template = global.PROCESSOR_STATE.templates[instance.templateId];
|
|
127
|
+
if (!template) {
|
|
128
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INVALID_ARGUMENT, 'Invalid template contract:' + instance);
|
|
129
|
+
}
|
|
130
|
+
if (!instance.contract) {
|
|
131
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INVALID_ARGUMENT, 'Contract Empty from:' + instance);
|
|
132
|
+
}
|
|
133
|
+
template.bind({
|
|
134
|
+
name: instance.contract.name,
|
|
135
|
+
address: instance.contract.address,
|
|
136
|
+
network: Number(instance.contract.chainId),
|
|
137
|
+
startBlock: instance.startBlock,
|
|
138
|
+
endBlock: instance.endBlock,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
await this.configure();
|
|
142
|
+
this.started = true;
|
|
143
|
+
return {};
|
|
144
|
+
}
|
|
145
|
+
async stop(request, context) {
|
|
146
|
+
console.log('Server Shutting down in 5 seconds');
|
|
147
|
+
if (this.shutdownHandler) {
|
|
148
|
+
setTimeout(this.shutdownHandler, 5000);
|
|
149
|
+
}
|
|
150
|
+
return {};
|
|
151
|
+
}
|
|
152
|
+
async processLog(request, context) {
|
|
153
|
+
if (!this.started) {
|
|
154
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.UNAVAILABLE, 'Service Not started.');
|
|
155
|
+
}
|
|
156
|
+
const resp = {
|
|
157
|
+
gauges: [],
|
|
158
|
+
counters: [],
|
|
159
|
+
};
|
|
160
|
+
const promises = [];
|
|
161
|
+
for (const l of request.logs) {
|
|
162
|
+
if (!l.log) {
|
|
163
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INVALID_ARGUMENT, "Log can't be null");
|
|
164
|
+
}
|
|
165
|
+
// const jsonString = Buffer.from(l.log.raw.buffer).toString("utf-8")
|
|
166
|
+
// const jsonString = String.fromCharCode.apply(null, l.log.raw)
|
|
167
|
+
try {
|
|
168
|
+
const jsonString = Utf8ArrayToStr(l.log.raw);
|
|
169
|
+
const log = JSON.parse(jsonString);
|
|
170
|
+
const handler = this.eventHandlers[l.handlerId];
|
|
171
|
+
const promise = handler(log).catch((e) => {
|
|
172
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INTERNAL, 'error processing log: ' + jsonString + '\n' + e.toString());
|
|
173
|
+
});
|
|
174
|
+
promises.push(promise);
|
|
175
|
+
}
|
|
176
|
+
catch (e) {
|
|
177
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INTERNAL, 'error parse log: ' + l);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const results = await Promise.all(promises);
|
|
181
|
+
for (const res of results) {
|
|
182
|
+
resp.counters = resp.counters.concat(res.counters);
|
|
183
|
+
resp.gauges = resp.gauges.concat(res.gauges);
|
|
184
|
+
}
|
|
185
|
+
let updated = false;
|
|
186
|
+
if (global.PROCESSOR_STATE.templatesInstances &&
|
|
187
|
+
this.templateInstances.length != global.PROCESSOR_STATE.templatesInstances.length) {
|
|
188
|
+
await this.configure();
|
|
189
|
+
updated = true;
|
|
190
|
+
}
|
|
191
|
+
recordRuntimeInfo(resp, processor_1.HandlerType.LOG);
|
|
192
|
+
return {
|
|
193
|
+
result: resp,
|
|
194
|
+
configUpdated: updated,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
async processTransaction(request, context) {
|
|
198
|
+
if (!this.started) {
|
|
199
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.UNAVAILABLE, 'Service not started.');
|
|
200
|
+
}
|
|
201
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.UNIMPLEMENTED, 'Processing transaction is not suppored.');
|
|
202
|
+
}
|
|
203
|
+
async processInstruction(request, context) {
|
|
204
|
+
if (!this.started) {
|
|
205
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.UNAVAILABLE, 'Service not started.');
|
|
206
|
+
}
|
|
207
|
+
const result = {
|
|
208
|
+
gauges: [],
|
|
209
|
+
counters: [],
|
|
210
|
+
};
|
|
211
|
+
// Only have instruction handlers for solana processors
|
|
212
|
+
if (global.PROCESSOR_STATE.solanaProcessors) {
|
|
213
|
+
for (const instruction of request.instructions) {
|
|
214
|
+
if (!instruction) {
|
|
215
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INVALID_ARGUMENT, 'instruction cannot be null');
|
|
216
|
+
}
|
|
217
|
+
for (const processor of global.PROCESSOR_STATE.solanaProcessors) {
|
|
218
|
+
if (processor.address === instruction.programAccountId) {
|
|
219
|
+
let res;
|
|
220
|
+
if (instruction.parsed) {
|
|
221
|
+
res = processor.handleInstruction(JSON.parse(instruction.parsed.toString()));
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
res = processor.handleInstruction(instruction.instructionData);
|
|
225
|
+
}
|
|
226
|
+
if (res) {
|
|
227
|
+
try {
|
|
228
|
+
res.gauges.forEach((g) => {
|
|
229
|
+
if (g.metadata) {
|
|
230
|
+
g.metadata.blockNumber = instruction.slot;
|
|
231
|
+
}
|
|
232
|
+
result.gauges.push(g);
|
|
233
|
+
});
|
|
234
|
+
res.counters.forEach((c) => {
|
|
235
|
+
if (c.metadata) {
|
|
236
|
+
c.metadata.blockNumber = instruction.slot;
|
|
237
|
+
}
|
|
238
|
+
result.counters.push(c);
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
catch (e) {
|
|
242
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INTERNAL, 'error processing instruction ' + e.toString());
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
console.error(`Failed to decode the instruction: ${instruction.instructionData} with slot: ${instruction.slot}`);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
recordRuntimeInfo(result, processor_1.HandlerType.INSTRUCTION);
|
|
253
|
+
return {
|
|
254
|
+
result,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
async processBlocks(request, context) {
|
|
258
|
+
const promises = request.requests.map((req) => this.processBlock(req, context));
|
|
259
|
+
const resp = await Promise.all(promises);
|
|
260
|
+
return {
|
|
261
|
+
response: resp,
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
async processBlock(request, context) {
|
|
265
|
+
if (!this.started) {
|
|
266
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.UNAVAILABLE, 'Service Not started.');
|
|
267
|
+
}
|
|
268
|
+
if (!request.block) {
|
|
269
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INVALID_ARGUMENT, "Block can't be empty");
|
|
270
|
+
}
|
|
271
|
+
const jsonString = Utf8ArrayToStr(request.block.raw);
|
|
272
|
+
const block = JSON.parse(jsonString);
|
|
273
|
+
const resp = {
|
|
274
|
+
gauges: [],
|
|
275
|
+
counters: [],
|
|
276
|
+
};
|
|
277
|
+
const promises = [];
|
|
278
|
+
for (const processor of global.PROCESSOR_STATE.processors) {
|
|
279
|
+
if (long_1.default.fromNumber(block.number) < processor.config.startBlock) {
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
if (processor.config.endBlock &&
|
|
283
|
+
processor.config.endBlock > long_1.default.ZERO &&
|
|
284
|
+
long_1.default.fromNumber(block.number) > processor.config.endBlock) {
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
// TODO maybe do a map and construct in start
|
|
288
|
+
const chainId = processor.getChainId();
|
|
289
|
+
if (chainId !== request.chainId) {
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
const blockPromises = Promise.all(processor.blockHandlers.map(function (handler) {
|
|
293
|
+
return handler(block).catch((e) => {
|
|
294
|
+
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INTERNAL, 'error processing block: ' + jsonString + +'\n' + e.toString());
|
|
295
|
+
});
|
|
296
|
+
}));
|
|
297
|
+
promises.push(blockPromises);
|
|
298
|
+
}
|
|
299
|
+
const allRes = (await Promise.all(promises)).flat();
|
|
300
|
+
for (const res of allRes) {
|
|
301
|
+
resp.counters = resp.counters.concat(res.counters);
|
|
302
|
+
resp.gauges = resp.gauges.concat(res.gauges);
|
|
303
|
+
}
|
|
304
|
+
recordRuntimeInfo(resp, processor_1.HandlerType.BLOCK);
|
|
305
|
+
return {
|
|
306
|
+
result: resp,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
exports.ProcessorServiceImpl = ProcessorServiceImpl;
|
|
311
|
+
// https://ourcodeworld.com/articles/read/164/how-to-convert-an-uint8array-to-string-in-javascript
|
|
312
|
+
/* eslint-disable */
|
|
313
|
+
function Utf8ArrayToStr(array) {
|
|
314
|
+
let out, i, len, c;
|
|
315
|
+
let char2, char3;
|
|
316
|
+
out = '';
|
|
317
|
+
len = array.length;
|
|
318
|
+
i = 0;
|
|
319
|
+
while (i < len) {
|
|
320
|
+
c = array[i++];
|
|
321
|
+
switch (c >> 4) {
|
|
322
|
+
case 0:
|
|
323
|
+
case 1:
|
|
324
|
+
case 2:
|
|
325
|
+
case 3:
|
|
326
|
+
case 4:
|
|
327
|
+
case 5:
|
|
328
|
+
case 6:
|
|
329
|
+
case 7:
|
|
330
|
+
// 0xxxxxxx
|
|
331
|
+
out += String.fromCharCode(c);
|
|
332
|
+
break;
|
|
333
|
+
case 12:
|
|
334
|
+
case 13:
|
|
335
|
+
// 110x xxxx 10xx xxxx
|
|
336
|
+
char2 = array[i++];
|
|
337
|
+
out += String.fromCharCode(((c & 0x1f) << 6) | (char2 & 0x3f));
|
|
338
|
+
break;
|
|
339
|
+
case 14:
|
|
340
|
+
// 1110 xxxx 10xx xxxx 10xx xxxx
|
|
341
|
+
char2 = array[i++];
|
|
342
|
+
char3 = array[i++];
|
|
343
|
+
out += String.fromCharCode(((c & 0x0f) << 12) | ((char2 & 0x3f) << 6) | ((char3 & 0x3f) << 0));
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return out;
|
|
348
|
+
}
|
|
349
|
+
function recordRuntimeInfo(results, handlerType) {
|
|
350
|
+
results.gauges.forEach((e) => {
|
|
351
|
+
e.runtimeInfo = {
|
|
352
|
+
from: handlerType,
|
|
353
|
+
};
|
|
354
|
+
});
|
|
355
|
+
results.counters.forEach((e) => {
|
|
356
|
+
e.runtimeInfo = {
|
|
357
|
+
from: handlerType,
|
|
358
|
+
};
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":";;;;;;AACA,yCAA4D;AAE5D,gEAqByC;AAIzC,gDAAuB;AAKvB,MAAM,iBAAiB,GAAG,cAAI,CAAC,IAAI,CAAA;AAEnC,MAAa,oBAAoB;IACvB,aAAa,GAA4C,EAAE,CAAA;IACnE,0CAA0C;IAC1C,uFAAuF;IAC/E,mBAAmB,GAAG,IAAI,GAAG,EAA6E,CAAA;IAE1G,OAAO,GAAG,KAAK,CAAA;IACf,eAAe,CAAkB;IACjC,iBAAiB,CAAoB;IAE5B,eAAe,CAAa;IAE7C,YAAY,eAA4B;QACtC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;IACxC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,OAA6B,EAAE,OAAoB;QACjE,IAAI,CAAC,IAAI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iB,CAAC,OAAmB,EAAE,WAAwB;IACtE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QAC3B,CAAC,CAAC,WAAW,GAAG;YACd,IAAI,EAAE,WAAW;SAClB,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7B,CAAC,CAAC,WAAW,GAAG;YACd,IAAI,EAAE,WAAW;SAClB,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SolanaBaseProcessor } from 'solana-processor';
|
|
2
|
+
import { ParsedInstruction } from '@solana/web3.js';
|
|
3
|
+
import { ApproveInstructionData, BurnInstructionData, CloseAccountInstructionData, FreezeAccountInstructionData, InitializeAccount2InstructionData, InitializeAccount3InstructionData, InitializeAccountInstructionData, InitializeMintInstructionData, InitializeMultisigInstructionData, MintToInstructionData, RevokeInstructionData, ThawAccountInstructionData, TransferInstructionData } from '@solana/spl-token';
|
|
4
|
+
import { SolanaContext } from 'context';
|
|
5
|
+
import { Instruction } from '@project-serum/anchor';
|
|
6
|
+
export declare class SPLTokenProcessor extends SolanaBaseProcessor {
|
|
7
|
+
private TokenInstructionMapCache;
|
|
8
|
+
static bind(address: string, endpoint: string, name?: string): SPLTokenProcessor;
|
|
9
|
+
fromParsedInstruction: (instruction: ParsedInstruction) => Instruction | null;
|
|
10
|
+
onInitializeMint(handler: (data: InitializeMintInstructionData, ctx: SolanaContext) => void): SPLTokenProcessor;
|
|
11
|
+
onInitializeAccount(hanlder: (data: InitializeAccountInstructionData, ctx: SolanaContext) => void): SPLTokenProcessor;
|
|
12
|
+
onInitializeAccount2(hanlder: (data: InitializeAccount2InstructionData, ctx: SolanaContext) => void): SPLTokenProcessor;
|
|
13
|
+
onInitializeAccount3(hanlder: (data: InitializeAccount3InstructionData, ctx: SolanaContext) => void): SPLTokenProcessor;
|
|
14
|
+
onInitializeMultisig(handler: (data: InitializeMultisigInstructionData, ctx: SolanaContext) => void): SPLTokenProcessor;
|
|
15
|
+
onTransfer(handler: (data: TransferInstructionData, ctx: SolanaContext) => void): SPLTokenProcessor;
|
|
16
|
+
onApprovend(handler: (data: ApproveInstructionData, ctx: SolanaContext) => void): SPLTokenProcessor;
|
|
17
|
+
onRevoke(handler: (data: RevokeInstructionData, ctx: SolanaContext) => void): SPLTokenProcessor;
|
|
18
|
+
onSetAuthority(handler: (data: any, ctx: SolanaContext) => void): SPLTokenProcessor;
|
|
19
|
+
onMintTo(handler: (data: MintToInstructionData, ctx: SolanaContext) => void): SPLTokenProcessor;
|
|
20
|
+
onBurn(handler: (data: BurnInstructionData, ctx: SolanaContext) => void): SPLTokenProcessor;
|
|
21
|
+
onCloseAccount(handler: (data: CloseAccountInstructionData, ctx: SolanaContext) => void): SPLTokenProcessor;
|
|
22
|
+
onFreezeAccount(handler: (data: FreezeAccountInstructionData, ctx: SolanaContext) => void): SPLTokenProcessor;
|
|
23
|
+
onThawAccount(handler: (data: ThawAccountInstructionData, ctx: SolanaContext) => void): SPLTokenProcessor;
|
|
24
|
+
private instructionTypeToTokenInstruction;
|
|
25
|
+
}
|