updating generate command to generate deploy script
This commit is contained in:
parent
417bd0f5f8
commit
2bf34e9ff5
@ -76,7 +76,7 @@ function createAction(command: Command) {
|
||||
return new EvaluateValueAction();
|
||||
case Command.EvaluateFunction:
|
||||
return new EvaluateFunctionAction();
|
||||
case Command.GenerateCommand:
|
||||
case Command.GenerateDeployScript:
|
||||
return new GenerateDeployScript();
|
||||
default:
|
||||
throw new Error('Unsupported command');
|
||||
@ -113,7 +113,7 @@ export const ConfigureTabComponent = (props: {
|
||||
<Option value={Command.DryRun}>Dry Run</Option>
|
||||
<Option value={Command.EvaluateFunction}>Evaluate Function</Option>
|
||||
<Option value={Command.EvaluateValue}>Evaluate Value</Option>
|
||||
<Option value={Command.GenerateCommand}>Generate Command</Option>
|
||||
<Option value={Command.GenerateDeployScript}>Generate Deploy Script</Option>
|
||||
</SelectCommand>
|
||||
<RunButton
|
||||
id="run"
|
||||
@ -147,7 +147,7 @@ export const ConfigureTabComponent = (props: {
|
||||
(command === Command.EvaluateValue && (
|
||||
<EvaluateValuePaneComponent></EvaluateValuePaneComponent>
|
||||
)) ||
|
||||
(command === Command.GenerateCommand && (
|
||||
(command === Command.GenerateDeployScript && (
|
||||
<GenerateDeployScriptPane></GenerateDeployScriptPane>
|
||||
))}
|
||||
</Container>
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
ChangeEntrypointAction,
|
||||
ChangeStorageAction,
|
||||
ChangeToolAction,
|
||||
GenerateCommandState,
|
||||
GenerateDeployScriptState,
|
||||
} from '../../redux/generate-command';
|
||||
import { Tool, ToolCommand } from '../../redux/types';
|
||||
import { AccessFunctionLabel, Group, Input, Label, Textarea } from '../form/inputs';
|
||||
@ -21,20 +21,20 @@ const Container = styled.div`
|
||||
export const GenerateDeployScriptPane = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const tool = useSelector<AppState, GenerateCommandState['tool']>(
|
||||
state => state.generateCommand.tool
|
||||
const tool = useSelector<AppState, GenerateDeployScriptState['tool']>(
|
||||
state => state.generateDeployScript.tool
|
||||
);
|
||||
|
||||
const command = useSelector<AppState, GenerateCommandState['command']>(
|
||||
state => state.generateCommand.command
|
||||
const command = useSelector<AppState, GenerateDeployScriptState['command']>(
|
||||
state => state.generateDeployScript.command
|
||||
);
|
||||
|
||||
const entrypoint = useSelector<AppState, GenerateCommandState['entrypoint']>(
|
||||
state => state.generateCommand.entrypoint
|
||||
const entrypoint = useSelector<AppState, GenerateDeployScriptState['entrypoint']>(
|
||||
state => state.generateDeployScript.entrypoint
|
||||
);
|
||||
|
||||
const storage = useSelector<AppState, GenerateCommandState['storage']>(
|
||||
state => state.generateCommand.storage
|
||||
const storage = useSelector<AppState, GenerateDeployScriptState['storage']>(
|
||||
state => state.generateDeployScript.storage
|
||||
);
|
||||
|
||||
return (
|
||||
|
@ -55,7 +55,7 @@ export const OutputTab = (props: {
|
||||
return <CompileOutputPane></CompileOutputPane>;
|
||||
} else if (command === Command.Deploy) {
|
||||
return <DeployOutputPane></DeployOutputPane>;
|
||||
} else if (command === Command.GenerateCommand) {
|
||||
} else if (command === Command.GenerateDeployScript) {
|
||||
return <GenerateDeployScriptOutputPane></GenerateDeployScriptOutputPane>;
|
||||
}
|
||||
|
||||
|
@ -28,19 +28,19 @@ export class GenerateDeployScript extends CancellableAction {
|
||||
dispatch({ ...new UpdateLoadingAction('Compiling contract...') });
|
||||
|
||||
try {
|
||||
const { editor, generateCommand } = getState();
|
||||
const { editor, generateDeployScript } = getState();
|
||||
|
||||
const michelsonCodeJson = await compileContract(
|
||||
editor.language,
|
||||
editor.code,
|
||||
generateCommand.entrypoint,
|
||||
generateDeployScript.entrypoint,
|
||||
MichelsonFormat.Json
|
||||
);
|
||||
|
||||
const michelsonCode = await compileContract(
|
||||
editor.language,
|
||||
editor.code,
|
||||
generateCommand.entrypoint
|
||||
generateDeployScript.entrypoint
|
||||
);
|
||||
|
||||
if (this.isCancelled()) {
|
||||
@ -51,16 +51,16 @@ export class GenerateDeployScript extends CancellableAction {
|
||||
const michelsonStorageJson = await compileStorage(
|
||||
editor.language,
|
||||
editor.code,
|
||||
generateCommand.entrypoint,
|
||||
generateCommand.storage,
|
||||
generateDeployScript.entrypoint,
|
||||
generateDeployScript.storage,
|
||||
MichelsonFormat.Json
|
||||
);
|
||||
|
||||
const michelsonStorage = await compileStorage(
|
||||
editor.language,
|
||||
editor.code,
|
||||
generateCommand.entrypoint,
|
||||
generateCommand.storage
|
||||
generateDeployScript.entrypoint,
|
||||
generateDeployScript.storage
|
||||
);
|
||||
|
||||
if (this.isCancelled()) {
|
||||
@ -82,7 +82,7 @@ export class GenerateDeployScript extends CancellableAction {
|
||||
|
||||
const title = slugify(editor.title).toLowerCase() || 'untitled';
|
||||
const output = `tezos-client \\
|
||||
${generateCommand.command} \\
|
||||
${generateDeployScript.command} \\
|
||||
contract \\
|
||||
${title} \\
|
||||
transferring 0 \\
|
||||
@ -92,7 +92,7 @@ export class GenerateDeployScript extends CancellableAction {
|
||||
--burn-cap ${estimate.burnFeeMutez / 1000000}`;
|
||||
|
||||
dispatch({
|
||||
...new ChangeOutputAction(output, Command.GenerateCommand)
|
||||
...new ChangeOutputAction(output, Command.GenerateDeployScript)
|
||||
});
|
||||
} catch (ex) {
|
||||
if (this.isCancelled()) {
|
||||
@ -101,7 +101,7 @@ export class GenerateDeployScript extends CancellableAction {
|
||||
dispatch({
|
||||
...new ChangeOutputAction(
|
||||
`Error: ${getErrorMessage(ex)}`,
|
||||
Command.GenerateCommand
|
||||
Command.GenerateDeployScript
|
||||
)
|
||||
});
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import editor, { EditorState } from './editor';
|
||||
import evaluateFunction, { EvaluateFunctionState } from './evaluate-function';
|
||||
import evaluateValue, { EvaluateValueState } from './evaluate-value';
|
||||
import examples, { ExamplesState } from './examples';
|
||||
import generateCommand, { GenerateCommandState } from './generate-command';
|
||||
import generateDeployScript, { GenerateDeployScriptState } from './generate-command';
|
||||
import loading, { LoadingState } from './loading';
|
||||
import result, { ResultState } from './result';
|
||||
import share, { ShareState } from './share';
|
||||
@ -23,7 +23,7 @@ export interface AppState {
|
||||
deploy: DeployState;
|
||||
evaluateFunction: EvaluateFunctionState;
|
||||
evaluateValue: EvaluateValueState;
|
||||
generateCommand: GenerateCommandState;
|
||||
generateDeployScript: GenerateDeployScriptState;
|
||||
result: ResultState;
|
||||
command: CommandState;
|
||||
examples: ExamplesState;
|
||||
@ -38,7 +38,7 @@ export default combineReducers({
|
||||
deploy,
|
||||
evaluateFunction,
|
||||
evaluateValue,
|
||||
generateCommand,
|
||||
generateDeployScript,
|
||||
result,
|
||||
command,
|
||||
examples,
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { Tool, ToolCommand } from './types';
|
||||
|
||||
export enum ActionType {
|
||||
ChangeTool = 'generate-command-change-tool',
|
||||
ChangeCommand = 'generate-command-change-command',
|
||||
ChangeEntrypoint = 'generate-command-change-entrypoint',
|
||||
ChangeStorage = 'generate-command-change-storage'
|
||||
ChangeTool = 'generate-deploy-script-change-tool',
|
||||
ChangeCommand = 'generate-deploy-script-change-command',
|
||||
ChangeEntrypoint = 'generate-deploy-script-change-entrypoint',
|
||||
ChangeStorage = 'generate-deploy-script-change-storage'
|
||||
}
|
||||
|
||||
export interface GenerateCommandState {
|
||||
export interface GenerateDeployScriptState {
|
||||
tool: Tool;
|
||||
command: ToolCommand;
|
||||
entrypoint: string;
|
||||
@ -18,22 +18,22 @@ export interface GenerateCommandState {
|
||||
|
||||
export class ChangeToolAction {
|
||||
public readonly type = ActionType.ChangeTool;
|
||||
constructor(public payload: GenerateCommandState['tool']) {}
|
||||
constructor(public payload: GenerateDeployScriptState['tool']) {}
|
||||
}
|
||||
|
||||
export class ChangeCommandAction {
|
||||
public readonly type = ActionType.ChangeCommand;
|
||||
constructor(public payload: GenerateCommandState['command']) {}
|
||||
constructor(public payload: GenerateDeployScriptState['command']) {}
|
||||
}
|
||||
|
||||
export class ChangeEntrypointAction {
|
||||
public readonly type = ActionType.ChangeEntrypoint;
|
||||
constructor(public payload: GenerateCommandState['entrypoint']) {}
|
||||
constructor(public payload: GenerateDeployScriptState['entrypoint']) {}
|
||||
}
|
||||
|
||||
export class ChangeStorageAction {
|
||||
public readonly type = ActionType.ChangeStorage;
|
||||
constructor(public payload: GenerateCommandState['storage']) {}
|
||||
constructor(public payload: GenerateDeployScriptState['storage']) {}
|
||||
}
|
||||
|
||||
type Action =
|
||||
@ -42,7 +42,7 @@ type Action =
|
||||
| ChangeEntrypointAction
|
||||
| ChangeStorageAction;
|
||||
|
||||
const DEFAULT_STATE: GenerateCommandState = {
|
||||
const DEFAULT_STATE: GenerateDeployScriptState = {
|
||||
tool: Tool.TezosClient,
|
||||
command: ToolCommand.Originate,
|
||||
entrypoint: '',
|
||||
@ -54,7 +54,7 @@ const DEFAULT_STATE: GenerateCommandState = {
|
||||
export default (
|
||||
state = DEFAULT_STATE,
|
||||
action: Action
|
||||
): GenerateCommandState => {
|
||||
): GenerateDeployScriptState => {
|
||||
switch (action.type) {
|
||||
case ActionType.ChangeTool:
|
||||
return {
|
||||
|
@ -10,7 +10,7 @@ export enum Command {
|
||||
EvaluateValue = 'evaluate-value',
|
||||
EvaluateFunction = 'evaluate-function',
|
||||
Deploy = 'deploy',
|
||||
GenerateCommand = 'generate-command'
|
||||
GenerateDeployScript = 'generate-deploy-script'
|
||||
}
|
||||
|
||||
export enum Tool {
|
||||
|
Loading…
Reference in New Issue
Block a user