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

Commit

Permalink
fix(cli): Fix group generator for contract position groups (#898)
Browse files Browse the repository at this point in the history
  • Loading branch information
immasandwich authored Jul 18, 2022
1 parent d763d21 commit 3295bd3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
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

0 comments on commit 3295bd3

Please sign in to comment.