@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.
@@ -1,6 +1,6 @@
1
1
  import commandLineArgs from 'command-line-args'
2
2
  import commandLineUsage from 'command-line-usage'
3
- import { finalizeHost, FinalizeProjectName, SentioProjectConfig } from '../config.js'
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: SentioProjectConfig, argv: string[]) {
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: SentioProjectConfig, apiKey: string) {
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: SentioProjectConfig, apiKeyOverride: string) {
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 SentioProjectConfig {
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
- // targets: Target[]
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: SentioProjectConfig) {
65
+ export function finalizeHost(config: YamlProjectConfig) {
61
66
  config.host = getFinalizedHost(config.host)
62
67
  }
63
68
 
64
- export function FinalizeProjectName(config: SentioProjectConfig, owner: string | undefined, slug: string | undefined) {
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('/')) {