Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

fix(cli): Fix group generator for contract position groups #898

Merged
merged 1 commit into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions cli/commands/create-contract-position-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

import { Command } from '@oclif/core';

import { GroupType } from '../../src/app/app.interface';
import { AppGroup, GroupType } from '../../src/app/app.interface';
import { addGroupToAppDefinition } from '../generators/generate-app-definition';
import { addContractPositionFetcherToAppModule } from '../generators/generate-app-module';
import { generateContractPositionFetcher } from '../generators/generate-contract-position-fetcher';
import { loadAppDefinition } from '../generators/utils';
import { promptAppGroupId, promptAppNetwork, promptNewGroupId, promptNewGroupLabel } from '../prompts';
import {
promptAppGroupId,
promptAppNetwork,
promptNewGroupId,
promptNewGroupLabel,
promptNewGroupType,
} from '../prompts';

export default class CreateContractPositionFetcher extends Command {
static description = 'Creates a contract position fetcher in a given app';
Expand All @@ -24,11 +30,12 @@ export default class CreateContractPositionFetcher extends Command {
const networks = Object.keys(definition.supportedNetworks);

let groupId = await promptAppGroupId(groupIds);
let group = null;
let group: AppGroup | null = null;
if (!groupId) {
const newGroupId = await promptNewGroupId(groupIds);
const newGroupLabel = await promptNewGroupLabel();
group = { id: newGroupId, label: newGroupLabel, type: GroupType.TOKEN };
const newGroupType = await promptNewGroupType();
group = { id: newGroupId, label: newGroupLabel, type: GroupType.POSITION };
groupId = newGroupId;
}

Expand Down
4 changes: 2 additions & 2 deletions cli/commands/create-token-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { Command } from '@oclif/core';

import { GroupType } from '../../src/app/app.interface';
import { AppGroup, GroupType } from '../../src/app/app.interface';
import { addGroupToAppDefinition } from '../generators/generate-app-definition';
import { addTokenFetcherToAppModule } from '../generators/generate-app-module';
import { generateTokenFetcher } from '../generators/generate-token-fetcher';
Expand Down Expand Up @@ -32,7 +32,7 @@ export default class CreateTokenFetcher extends Command {
const networks = Object.keys(definition.supportedNetworks);

let groupId = await promptAppGroupId(groupIds);
let group = null;
let group: AppGroup | null = null;
if (!groupId) {
const newGroupId = await promptNewGroupId(groupIds);
const newGroupLabel = await promptNewGroupLabel();
Expand Down