@sentio/cli 2.4.0 → 2.5.0-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.
- package/lib/abi.d.ts +6 -0
- package/lib/abi.js +138 -0
- package/lib/abi.js.map +1 -0
- package/lib/chain.d.ts +98 -0
- package/lib/chain.js +198 -0
- package/lib/chain.js.map +1 -0
- package/lib/cli.js +5 -5
- package/lib/cli.js.map +1 -1
- package/lib/commands/build.d.ts +7 -1
- package/lib/commands/build.js +50 -8
- package/lib/commands/build.js.map +1 -1
- package/lib/commands/run-add.js +27 -82
- package/lib/commands/run-add.js.map +1 -1
- package/lib/commands/run-upload.d.ts +3 -3
- package/lib/commands/run-upload.js.map +1 -1
- package/lib/config.d.ts +9 -3
- package/lib/config.js.map +1 -1
- package/package.json +3 -4
- package/src/abi.ts +150 -0
- package/src/chain.ts +195 -0
- package/src/cli.ts +6 -6
- package/src/commands/build.ts +57 -8
- package/src/commands/run-add.ts +29 -84
- package/src/commands/run-upload.ts +4 -4
- package/src/config.ts +10 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import commandLineArgs from 'command-line-args'
|
|
2
2
|
import commandLineUsage from 'command-line-usage'
|
|
3
|
-
import { finalizeHost, FinalizeProjectName,
|
|
3
|
+
import { finalizeHost, FinalizeProjectName, YamlProjectConfig } from '../config.js'
|
|
4
4
|
import { URL } from 'url'
|
|
5
5
|
import fetch from 'node-fetch'
|
|
6
6
|
import { buildOptionDefinitions, buildProcessor } from './build.js'
|
|
@@ -67,7 +67,7 @@ function mergeOptions(options1: commandLineArgs.OptionDefinition[], options2: co
|
|
|
67
67
|
return res
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
export async function runUpload(processorConfig:
|
|
70
|
+
export async function runUpload(processorConfig: YamlProjectConfig, argv: string[]) {
|
|
71
71
|
const optionDefinitions = mergeOptions(uploadOptionDefinitions, buildOptionDefinitions)
|
|
72
72
|
|
|
73
73
|
const options = commandLineArgs(optionDefinitions, { argv })
|
|
@@ -109,7 +109,7 @@ export async function runUpload(processorConfig: SentioProjectConfig, argv: stri
|
|
|
109
109
|
return uploadFile(processorConfig, apiOverride)
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
async function createProject(options:
|
|
112
|
+
async function createProject(options: YamlProjectConfig, apiKey: string) {
|
|
113
113
|
const url = new URL('/api/v1/projects', options.host)
|
|
114
114
|
const [ownerName, slug] = options.project.includes('/') ? options.project.split('/') : [undefined, options.project]
|
|
115
115
|
return fetch(url.href, {
|
|
@@ -121,7 +121,7 @@ async function createProject(options: SentioProjectConfig, apiKey: string) {
|
|
|
121
121
|
})
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
export async function uploadFile(options:
|
|
124
|
+
export async function uploadFile(options: YamlProjectConfig, apiKeyOverride: string) {
|
|
125
125
|
console.log(chalk.blue('Prepare to upload'))
|
|
126
126
|
|
|
127
127
|
const PROCESSOR_FILE = path.join(process.cwd(), 'dist/lib.js')
|
package/src/config.ts
CHANGED
|
@@ -5,12 +5,17 @@ const HostMap: { [host: string]: string } = {
|
|
|
5
5
|
prod: 'https://app.sentio.xyz',
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export interface
|
|
8
|
+
export interface YamlContractConfig {
|
|
9
|
+
address: string
|
|
10
|
+
chain: string
|
|
11
|
+
name: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface YamlProjectConfig {
|
|
9
15
|
project: string
|
|
10
16
|
host: string
|
|
11
|
-
// source: string
|
|
12
17
|
build: boolean
|
|
13
|
-
|
|
18
|
+
contracts: YamlContractConfig[]
|
|
14
19
|
debug: boolean
|
|
15
20
|
}
|
|
16
21
|
|
|
@@ -57,11 +62,11 @@ export function getAuthConfig(host: string): {
|
|
|
57
62
|
return { domain, clientId, audience, redirectUri }
|
|
58
63
|
}
|
|
59
64
|
|
|
60
|
-
export function finalizeHost(config:
|
|
65
|
+
export function finalizeHost(config: YamlProjectConfig) {
|
|
61
66
|
config.host = getFinalizedHost(config.host)
|
|
62
67
|
}
|
|
63
68
|
|
|
64
|
-
export function FinalizeProjectName(config:
|
|
69
|
+
export function FinalizeProjectName(config: YamlProjectConfig, owner: string | undefined, slug: string | undefined) {
|
|
65
70
|
if (owner || slug) {
|
|
66
71
|
let name = config.project
|
|
67
72
|
if (name.includes('/')) {
|