@sentio/sdk 1.7.22 → 1.8.1
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/lib/base-processor.d.ts +3 -3
- package/lib/base-processor.js +3 -0
- package/lib/base-processor.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +123 -36
- package/lib/gen/processor/protos/processor.js +417 -53
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/meter.js +1 -1
- package/lib/meter.js.map +1 -1
- package/lib/service.d.ts +3 -2
- package/lib/service.js +11 -3
- package/lib/service.js.map +1 -1
- package/lib/solana-processor.d.ts +2 -2
- package/lib/solana-processor.js +1 -0
- package/lib/solana-processor.js.map +1 -1
- package/lib/test/erc20.test.js +9 -11
- package/lib/test/erc20.test.js.map +1 -1
- package/lib/test/index.d.ts +1 -0
- package/lib/test/index.js +3 -1
- package/lib/test/index.js.map +1 -1
- package/lib/test/metric-utils.d.ts +3 -3
- package/lib/test/metric-utils.js.map +1 -1
- package/lib/test/test-processor-server.d.ts +2 -1
- package/lib/test/test-processor-server.js +3 -0
- package/lib/test/test-processor-server.js.map +1 -1
- package/lib/test/test-provider.d.ts +1 -0
- package/lib/test/test-provider.js +25 -0
- package/lib/test/test-provider.js.map +1 -0
- package/lib/utils/chainmap.js +3 -3
- package/lib/utils/chainmap.js.map +1 -1
- package/lib/utils/erc20.test.js +6 -11
- package/lib/utils/erc20.test.js.map +1 -1
- package/package.json +1 -1
- package/src/base-processor.ts +6 -3
- package/src/gen/processor/protos/processor.ts +547 -83
- package/src/meter.ts +1 -1
- package/src/service.ts +25 -14
- package/src/solana-processor.ts +3 -2
- package/src/test/erc20.test.ts +9 -11
- package/src/test/index.ts +1 -0
- package/src/test/metric-utils.ts +3 -3
- package/src/test/test-processor-server.ts +6 -0
- package/src/test/test-provider.ts +25 -0
- package/src/utils/chainmap.ts +3 -3
- package/src/utils/erc20.test.ts +7 -12
package/lib/utils/erc20.test.js
CHANGED
|
@@ -2,23 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const sdk_1 = require("@sentio/sdk");
|
|
4
4
|
const erc20_1 = require("./erc20");
|
|
5
|
+
const test_1 = require("../test");
|
|
5
6
|
describe('erc20 tests', () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
ChainID: '1',
|
|
11
|
-
Https: ['https://eth-mainnet.alchemyapi.io/v2/Gk024pFA-64RaEPIawL40n__1esXJFb2'], // Use env
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
test('test bytes32', async () => {
|
|
7
|
+
global.PROCESSOR_STATE = new sdk_1.ProcessorState();
|
|
8
|
+
const haveProviders = (0, test_1.loadTestProvidersFromEnv)('1');
|
|
9
|
+
const testIf = haveProviders ? test : test.skip;
|
|
10
|
+
testIf('test bytes32', async () => {
|
|
16
11
|
const info = await (0, erc20_1.getERC20TokenInfo)('0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2');
|
|
17
12
|
expect(info.decimal).toEqual(18);
|
|
18
13
|
expect(info.symbol).toEqual('MKR');
|
|
19
14
|
expect(info.name).toEqual('Maker');
|
|
20
15
|
});
|
|
21
|
-
|
|
16
|
+
testIf('test normal', async () => {
|
|
22
17
|
const info = await (0, erc20_1.getERC20TokenInfo)('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48');
|
|
23
18
|
expect(info.decimal).toEqual(6);
|
|
24
19
|
expect(info.symbol).toEqual('USDC');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erc20.test.js","sourceRoot":"","sources":["../../src/utils/erc20.test.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"erc20.test.js","sourceRoot":"","sources":["../../src/utils/erc20.test.ts"],"names":[],"mappings":";;AAAA,qCAA4C;AAC5C,mCAA2C;AAC3C,kCAAkD;AAElD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,MAAM,CAAC,eAAe,GAAG,IAAI,oBAAc,EAAE,CAAA;IAC7C,MAAM,aAAa,GAAG,IAAA,+BAAwB,EAAC,GAAG,CAAC,CAAA;IAEnD,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA;IAE/C,MAAM,CAAC,cAAc,EAAE,KAAK,IAAI,EAAE;QAChC,MAAM,IAAI,GAAG,MAAM,IAAA,yBAAiB,EAAC,4CAA4C,CAAC,CAAA;QAElF,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QAChC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAClC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE;QAC/B,MAAM,IAAI,GAAG,MAAM,IAAA,yBAAiB,EAAC,4CAA4C,CAAC,CAAA;QAElF,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QAC/B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACnC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IACvC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { ProcessorState } from '@sentio/sdk'\nimport { getERC20TokenInfo } from './erc20'\nimport { loadTestProvidersFromEnv } from '../test'\n\ndescribe('erc20 tests', () => {\n global.PROCESSOR_STATE = new ProcessorState()\n const haveProviders = loadTestProvidersFromEnv('1')\n\n const testIf = haveProviders ? test : test.skip\n\n testIf('test bytes32', async () => {\n const info = await getERC20TokenInfo('0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2')\n\n expect(info.decimal).toEqual(18)\n expect(info.symbol).toEqual('MKR')\n expect(info.name).toEqual('Maker')\n })\n\n testIf('test normal', async () => {\n const info = await getERC20TokenInfo('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48')\n\n expect(info.decimal).toEqual(6)\n expect(info.symbol).toEqual('USDC')\n expect(info.name).toEqual('USD Coin')\n })\n})\n"]}
|
package/package.json
CHANGED
package/src/base-processor.ts
CHANGED
|
@@ -5,20 +5,20 @@ import { BaseContract, EventFilter } from '@ethersproject/contracts'
|
|
|
5
5
|
import Long from 'long'
|
|
6
6
|
|
|
7
7
|
import { BoundContractView, Context, ContractView } from './context'
|
|
8
|
-
import {
|
|
8
|
+
import { ProcessResult } from './gen/processor/protos/processor'
|
|
9
9
|
import { BindInternalOptions, BindOptions } from './bind-options'
|
|
10
10
|
import { PromiseOrVoid } from './promise-or-void'
|
|
11
11
|
|
|
12
12
|
export class EventsHandler {
|
|
13
13
|
filters: EventFilter[]
|
|
14
|
-
handler: (event: Log) => Promise<
|
|
14
|
+
handler: (event: Log) => Promise<ProcessResult>
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export abstract class BaseProcessor<
|
|
18
18
|
TContract extends BaseContract,
|
|
19
19
|
TBoundContractView extends BoundContractView<TContract, ContractView<TContract>>
|
|
20
20
|
> {
|
|
21
|
-
blockHandlers: ((block: Block) => Promise<
|
|
21
|
+
blockHandlers: ((block: Block) => Promise<ProcessResult>)[] = []
|
|
22
22
|
eventHandlers: EventsHandler[] = []
|
|
23
23
|
|
|
24
24
|
name: string
|
|
@@ -88,11 +88,13 @@ export abstract class BaseProcessor<
|
|
|
88
88
|
return {
|
|
89
89
|
gauges: ctx.gauges,
|
|
90
90
|
counters: ctx.counters,
|
|
91
|
+
logs: [],
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
return {
|
|
94
95
|
gauges: [],
|
|
95
96
|
counters: [],
|
|
97
|
+
logs: [],
|
|
96
98
|
}
|
|
97
99
|
},
|
|
98
100
|
})
|
|
@@ -109,6 +111,7 @@ export abstract class BaseProcessor<
|
|
|
109
111
|
return {
|
|
110
112
|
gauges: ctx.gauges,
|
|
111
113
|
counters: ctx.counters,
|
|
114
|
+
logs: [],
|
|
112
115
|
}
|
|
113
116
|
})
|
|
114
117
|
return this
|