@sentio/cli 1.0.2 → 1.0.4

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.
Files changed (42) hide show
  1. package/package.json +4 -2
  2. package/src/commands/run-create.ts +6 -3
  3. package/src/utils.ts +1 -1
  4. package/templates/solana/.gitignore +107 -0
  5. package/templates/solana/jest.config.js +7 -0
  6. package/templates/solana/package.json +20 -0
  7. package/templates/solana/sentio.yaml +3 -0
  8. package/templates/solana/src/processor.test.ts +14 -0
  9. package/templates/solana/src/processor.ts +16 -0
  10. package/templates/solana/tsconfig.json +20 -0
  11. package/templates/solana/yarn.lock +4095 -0
  12. package/lib/build.d.ts +0 -2
  13. package/lib/build.js +0 -80
  14. package/lib/build.js.map +0 -1
  15. package/lib/cli.d.ts +0 -2
  16. package/lib/cli.js +0 -186
  17. package/lib/cli.js.map +0 -1
  18. package/lib/commands/login-server.d.ts +0 -7
  19. package/lib/commands/login-server.js +0 -133
  20. package/lib/commands/login-server.js.map +0 -1
  21. package/lib/commands/run-create.d.ts +0 -1
  22. package/lib/commands/run-create.js +0 -112
  23. package/lib/commands/run-create.js.map +0 -1
  24. package/lib/commands/run-login.d.ts +0 -1
  25. package/lib/commands/run-login.js +0 -136
  26. package/lib/commands/run-login.js.map +0 -1
  27. package/lib/commands/run-version.d.ts +0 -1
  28. package/lib/commands/run-version.js +0 -39
  29. package/lib/commands/run-version.js.map +0 -1
  30. package/lib/config.d.ts +0 -14
  31. package/lib/config.js +0 -64
  32. package/lib/config.js.map +0 -1
  33. package/lib/key.d.ts +0 -2
  34. package/lib/key.js +0 -44
  35. package/lib/key.js.map +0 -1
  36. package/lib/upload.d.ts +0 -2
  37. package/lib/upload.js +0 -189
  38. package/lib/upload.js.map +0 -1
  39. package/lib/utils.d.ts +0 -2
  40. package/lib/utils.js +0 -23
  41. package/lib/utils.js.map +0 -1
  42. package/lib/webpack.config.js +0 -47
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@sentio/cli",
3
3
  "license": "Apache-2.0",
4
- "version": "1.0.2",
4
+ "version": "1.0.4",
5
5
  "scripts": {
6
6
  "compile": "tsc -p . && cp src/webpack.config.js lib/",
7
7
  "build": "yarn compile",
8
8
  "postbuild": "../scripts/link-bin.sh",
9
9
  "cli": "ts-node src/cli.ts",
10
- "test": "jest"
10
+ "test": "jest",
11
+ "pub": "yarn publish --no-git-tag-version"
11
12
  },
12
13
  "dependencies": {
13
14
  "command-line-args": "^5.2.1",
@@ -16,6 +17,7 @@
16
17
  "form-data": "^4.0.0",
17
18
  "fs-extra": "^11.0.0",
18
19
  "js-yaml": "^4.1.0",
20
+ "latest-version": "^5.1.0",
19
21
  "node-fetch": "2",
20
22
  "open": "^8.4.0",
21
23
  "ts-loader": "^9.3.0",
@@ -4,8 +4,9 @@ import path from 'path'
4
4
  import fs from 'fs-extra'
5
5
  import chalk from 'chalk'
6
6
  import { getCliVersion } from '../utils'
7
+ import latestVersion from 'latest-version'
7
8
 
8
- export function runCreate(argv: string[]) {
9
+ export async function runCreate(argv: string[]) {
9
10
  const optionDefinitions = [
10
11
  {
11
12
  name: 'help',
@@ -30,7 +31,7 @@ export function runCreate(argv: string[]) {
30
31
  name: 'chain-type',
31
32
  alias: 'c',
32
33
  description:
33
- 'The type of project you want to create, can be evm, aptos, raw (if you want to start from scratch and support multiple types of chains)',
34
+ 'The type of project you want to create, can be evm, aptos, solana, raw (if you want to start from scratch and support multiple types of chains)',
34
35
  type: String,
35
36
  defaultValue: 'evm',
36
37
  },
@@ -59,6 +60,8 @@ export function runCreate(argv: string[]) {
59
60
  break
60
61
  case 'raw':
61
62
  break
63
+ case 'solana':
64
+ break
62
65
  default:
63
66
  console.error(chalk.red('non supported chain-type for template creation, use --help for more information.'))
64
67
  console.log(usage)
@@ -102,7 +105,7 @@ export function runCreate(argv: string[]) {
102
105
  cliVersion = '^' + cliVersion
103
106
  }
104
107
 
105
- packageJson.dependencies['@sentio/sdk'] = cliVersion
108
+ packageJson.dependencies['@sentio/sdk'] = '^' + (await latestVersion('@sentio/sdk'))
106
109
  packageJson.dependencies['@sentio/cli'] = cliVersion
107
110
  packageJson.name = projectName
108
111
 
package/src/utils.ts CHANGED
@@ -2,7 +2,7 @@ import fs from 'fs-extra'
2
2
  import path from 'path'
3
3
 
4
4
  export function getCliVersion() {
5
- const packageJsonPath = path.resolve(__dirname, '../../package.json')
5
+ const packageJsonPath = path.resolve(__dirname, '../package.json')
6
6
  const packageJsonContent = fs.readFileSync(packageJsonPath, 'utf-8')
7
7
  const packageJson = JSON.parse(packageJsonContent)
8
8
 
@@ -0,0 +1,107 @@
1
+ .idea
2
+ src/types
3
+
4
+ # Logs
5
+ logs
6
+ *.log
7
+ npm-debug.log*
8
+ yarn-debug.log*
9
+ yarn-error.log*
10
+ lerna-debug.log*
11
+
12
+ # Diagnostic reports (https://nodejs.org/api/report.html)
13
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
14
+
15
+ # Runtime data
16
+ pids
17
+ *.pid
18
+ *.seed
19
+ *.pid.lock
20
+
21
+ # Directory for instrumented libs generated by jscoverage/JSCover
22
+ lib-cov
23
+
24
+ # Coverage directory used by tools like istanbul
25
+ coverage
26
+ *.lcov
27
+
28
+ # nyc test coverage
29
+ .nyc_output
30
+
31
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
32
+ .grunt
33
+
34
+ # Bower dependency directory (https://bower.io/)
35
+ bower_components
36
+
37
+ # node-waf configuration
38
+ .lock-wscript
39
+
40
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
41
+ build/Release
42
+
43
+ # Dependency directories
44
+ node_modules/
45
+ jspm_packages/
46
+
47
+ # TypeScript v1 declaration files
48
+ typings/
49
+
50
+ # TypeScript cache
51
+ *.tsbuildinfo
52
+
53
+ # Optional npm cache directory
54
+ .npm
55
+
56
+ # Optional eslint cache
57
+ .eslintcache
58
+
59
+ # Microbundle cache
60
+ .rpt2_cache/
61
+ .rts2_cache_cjs/
62
+ .rts2_cache_es/
63
+ .rts2_cache_umd/
64
+
65
+ # Optional REPL history
66
+ .node_repl_history
67
+
68
+ # Output of 'npm pack'
69
+ *.tgz
70
+
71
+ # Yarn Integrity file
72
+ .yarn-integrity
73
+
74
+ # dotenv environment variables file
75
+ .env
76
+ .env.test
77
+
78
+ # parcel-bundler cache (https://parceljs.org/)
79
+ .cache
80
+
81
+ # Next.js build output
82
+ .next
83
+
84
+ # Nuxt.js build / generate output
85
+ .nuxt
86
+ dist
87
+
88
+ # Gatsby files
89
+ .cache/
90
+ # Comment in the public line in if your project uses Gatsby and *not* Next.js
91
+ # https://nextjs.org/blog/next-9-1#public-directory-support
92
+ # public
93
+
94
+ # vuepress build output
95
+ .vuepress/dist
96
+
97
+ # Serverless directories
98
+ .serverless/
99
+
100
+ # FuseBox cache
101
+ .fusebox/
102
+
103
+ # DynamoDB Local files
104
+ .dynamodb/
105
+
106
+ # TernJS port file
107
+ .tern-port
@@ -0,0 +1,7 @@
1
+ /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2
+
3
+ module.exports = {
4
+ preset: 'ts-jest',
5
+ testEnvironment: 'node',
6
+ modulePathIgnorePatterns: ["<rootDir>/dist/"]
7
+ };
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "template-solana",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "test": "jest",
7
+ "gen": "sentio gen",
8
+ "build": "sentio build",
9
+ "upload": "sentio upload"
10
+ },
11
+ "dependencies": {
12
+ "@sentio/sdk": "^1.0.0-development"
13
+ },
14
+ "devDependencies": {
15
+ "@types/jest": "^29.0.0",
16
+ "jest": "^29.0.0",
17
+ "ts-jest": "^29.0.0",
18
+ "typescript": "^4.7.2"
19
+ }
20
+ }
@@ -0,0 +1,3 @@
1
+ # Project name could be $org_or_user/$project_name or $project_name
2
+ # If latter, will be treated the owner as api key's owner
3
+ project: default
@@ -0,0 +1,14 @@
1
+ import { TestProcessorServer } from '@sentio/sdk/lib/testing'
2
+
3
+ describe('Test Processor', () => {
4
+ const service = new TestProcessorServer(() => require('./processor'))
5
+
6
+ beforeAll(async () => {
7
+ await service.start()
8
+ })
9
+
10
+ test('has valid config', async () => {
11
+ // const config = await service.getConfig({})
12
+ // expect(config.contractConfigs.length > 0).toBeTruthy()
13
+ })
14
+ })
@@ -0,0 +1,16 @@
1
+ import { SPLTokenProcessor } from '@sentio/sdk/lib/builtin/solana'
2
+
3
+ SPLTokenProcessor.bind({
4
+ address: 'wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb',
5
+ processInnerInstruction: true,
6
+ })
7
+ .onMintTo((data, ctx) => {
8
+ if (data.mint === '7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs') {
9
+ ctx.meter.Counter('totalWeth_supply').add(data.amount as number)
10
+ }
11
+ })
12
+ .onBurn((data, ctx) => {
13
+ if (data.mint === '7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs') {
14
+ ctx.meter.Counter('totalWeth_supply').sub(data.amount as number)
15
+ }
16
+ })
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "alwaysStrict": true,
4
+ "sourceMap": true,
5
+ "target": "esnext",
6
+ "esModuleInterop": true,
7
+ "noImplicitReturns": true,
8
+ "noImplicitAny": true,
9
+ "module": "commonjs",
10
+ "moduleResolution": "node",
11
+ "strictNullChecks": true,
12
+ "stripInternal": true,
13
+ "noFallthroughCasesInSwitch": true,
14
+ "noEmitOnError": true,
15
+ "outDir": "dist",
16
+ "rootDir": "./src",
17
+ "skipLibCheck": true
18
+ },
19
+ "exclude": ["dist"]
20
+ }