@sentio/cli 2.18.7 → 2.18.8-rc.2

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.
@@ -0,0 +1,19 @@
1
+ {
2
+ "private": true,
3
+ "name": "template-sui",
4
+ "version": "1.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "build": "sentio build",
8
+ "gen": "sentio gen",
9
+ "test": "sentio test",
10
+ "upload": "sentio upload"
11
+ },
12
+ "dependencies": {
13
+ "@sentio/sdk": "workspace:*"
14
+ },
15
+ "devDependencies": {
16
+ "@sentio/cli": "workspace:*",
17
+ "typescript": "^5.5.2"
18
+ }
19
+ }
@@ -0,0 +1,4 @@
1
+ project: sui
2
+ contracts:
3
+ - chain: sui_testnet
4
+ address: '0xebaa2ad3eacc230f309cd933958cc52684df0a41ae7ac214d186b80f830867d2'
@@ -0,0 +1,16 @@
1
+ import assert from 'assert'
2
+ import { before, describe, test } from 'node:test'
3
+ import { TestProcessorServer } from '@sentio/sdk/testing'
4
+
5
+ describe('Test Processor', () => {
6
+ const service = new TestProcessorServer(async () => await import('./processor.js'))
7
+
8
+ before(async () => {
9
+ await service.start()
10
+ })
11
+
12
+ test('has config', async () => {
13
+ const config = await service.getConfig({})
14
+ assert(config.contractConfigs.length > 0)
15
+ })
16
+ })
@@ -0,0 +1,30 @@
1
+ import { sui_system, validator } from '@sentio/sdk/sui/builtin/0x3'
2
+
3
+ import { SuiNetwork, SuiObjectProcessor, BUILTIN_TYPES } from '@sentio/sdk/sui'
4
+ import RequestAddStakePayload = sui_system.RequestAddStakePayload
5
+ import { single_collateral } from './types/sui/testnet/0xebaa2ad3eacc230f309cd933958cc52684df0a41ae7ac214d186b80f830867d2.js'
6
+
7
+ validator.bind({ network: SuiNetwork.TEST_NET }).onEventStakingRequestEvent(
8
+ (evt, ctx) => {
9
+ const amount_original = BigInt((evt.parsedJson as any).amount)
10
+ const amount = evt.data_decoded.amount
11
+ ctx.meter.Counter('amount').add(amount, { pool: evt.data_decoded.pool_id })
12
+ },
13
+ { allEvents: true }
14
+ )
15
+
16
+ sui_system.bind({ network: SuiNetwork.TEST_NET }).onEntryRequestAddStake((call: RequestAddStakePayload, ctx) => {
17
+ ctx.meter.Gauge('tmp').record(1, { coin: call.arguments_decoded[2] || '' })
18
+ })
19
+
20
+ SuiObjectProcessor.bind({
21
+ objectId: '0xa14f85860d6ce99154ecbb13570ba5fba1d8dc16b290de13f036b016fd19a29c'
22
+ }).onTimeInterval(async (self, objects, ctx) => {
23
+ const fields = await ctx.coder.getDynamicFields(
24
+ objects,
25
+ BUILTIN_TYPES.U64_TYPE,
26
+ single_collateral.PortfolioVault.type()
27
+ )
28
+
29
+ ctx.meter.Gauge('fields_count').record(fields.length)
30
+ })
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "importHelpers": true,
4
+ "alwaysStrict": true,
5
+ "sourceMap": true,
6
+ "target": "esnext",
7
+ "esModuleInterop": true,
8
+ "noImplicitReturns": true,
9
+ "noImplicitAny": true,
10
+ "module": "nodenext",
11
+ "moduleResolution": "nodenext",
12
+ "strictNullChecks": true,
13
+ "stripInternal": true,
14
+ "noFallthroughCasesInSwitch": true,
15
+ "noEmitOnError": false,
16
+ "rootDir": "./src",
17
+ "outDir": "./dist",
18
+ "skipLibCheck": true,
19
+ "experimentalDecorators": true,
20
+ "emitDecoratorMetadata": true
21
+ },
22
+ "exclude": ["dist"]
23
+ }