Skip to content

Commit

Permalink
Merge pull request #90 from terra-money/feature/update_fn
Browse files Browse the repository at this point in the history
Feature/update fn
  • Loading branch information
simke9445 authored Sep 29, 2023
2 parents e7d371e + c74d7b0 commit 7e3dda3
Show file tree
Hide file tree
Showing 29 changed files with 288 additions and 362 deletions.
10 changes: 3 additions & 7 deletions apps/warp-protocol/src/pages/job-new/JobNew.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ import { ConditionForm } from './condition-form/ConditionForm';
import { DetailsForm } from './details-form/DetailsForm';
import styles from './JobNew.module.sass';
import { decodeMsg, useJobStorage } from './useJobStorage';
import { hydrateQueryVariablesWithStatics } from 'utils/variable';
import { VariableDrawer } from './variable-drawer/VariableDrawer';
import { useSearchParams } from 'react-router-dom';
import { useMemo } from 'react';
import { CachedVariablesSession } from './CachedVariablesSession';
import { DeveloperForm } from './developer-form/DeveloperForm';
import { filterUnreferencedVariablesInCosmosMsg } from 'utils/msgs';
import { filterUnreferencedVariables } from 'utils/msgs';
import { useNativeToken } from 'hooks/useNativeToken';

type JobNewProps = UIElementProps & {};
Expand Down Expand Up @@ -76,8 +75,7 @@ export const JobNew = (props: JobNewProps) => {
const { condition } = template;

const msgs = parseMsgs(message);
const referenced = filterUnreferencedVariablesInCosmosMsg(variables, msgs, condition!);
const vars = hydrateQueryVariablesWithStatics(referenced);
const vars = filterUnreferencedVariables(variables, msgs, condition!);

const resp = await createJobTx({
name,
Expand Down Expand Up @@ -113,9 +111,7 @@ export const JobNew = (props: JobNewProps) => {

const msgs = parseMsgs(message);

const referenced = filterUnreferencedVariablesInCosmosMsg(variables, msgs, cond);

const vars = hydrateQueryVariablesWithStatics(referenced);
const vars = filterUnreferencedVariables(variables, msgs, cond);

const resp = await createJobTx({
name,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,5 @@
position: relative

.expr_submenu
margin-top: -303px
margin-top: -253px
margin-left: 202px
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const DecimalExprNode = forwardRef((props: DecimalExprNodeProps, ref: Rea
}
}, [op, left, right, setExpr, expr]);

const Left = <ValueInput kind="decimal" variant="number" value={left} onChange={(v) => setLeft(v)} />;
const Left = <ValueInput kind="decimal" value={left} onChange={(v) => setLeft(v)} />;

const Op = (
<OperatorInput<warp_resolver.NumOp>
Expand All @@ -42,7 +42,7 @@ export const DecimalExprNode = forwardRef((props: DecimalExprNodeProps, ref: Rea
/>
);

const Right = <ValueInput kind="decimal" variant="number" value={right} onChange={(v) => setRight(v)} />;
const Right = <ValueInput kind="decimal" value={right} onChange={(v) => setRight(v)} />;

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,46 +27,33 @@ export const EmptyNode = forwardRef((props: EmptyNodeProps, ref: React.Ref<HTMLB
onClick={() =>
setCond({
expr: {
block_height: {
comparator: '',
op: 'eq',
},
bool: '',
},
})
}
>
Blockheight
Boolean
</MenuAction>
<MenuAction
onClick={() =>
setCond({
expr: {
timestamp: {
comparator: '',
op: 'gt',
decimal: {
left: { simple: '' },
right: { simple: '' },
op: 'eq',
},
},
})
}
>
Timestamp
</MenuAction>
<MenuAction
onClick={() =>
setCond({
expr: {
bool: '',
},
})
}
>
Boolean
Decimal
</MenuAction>
<MenuAction
onClick={() =>
setCond({
expr: {
decimal: {
uint: {
left: { simple: '' },
right: { simple: '' },
op: 'eq',
Expand All @@ -75,15 +62,15 @@ export const EmptyNode = forwardRef((props: EmptyNodeProps, ref: React.Ref<HTMLB
})
}
>
Decimal
Uint
</MenuAction>
<MenuAction
onClick={() =>
setCond({
expr: {
uint: {
left: { simple: '' },
right: { simple: '' },
int: {
left: { simple: '' as any },
right: { simple: '' as any },
op: 'eq',
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import { ReactComponent as TrashIcon } from 'components/assets/Trash.svg';
import { Button, Text } from 'components/primitives';
import { forwardRef } from 'react';
import { warp_resolver } from '@terra-money/warp-sdk';
import { BlockheightExprNode } from './BlockheightExprNode';
import { BoolExprNode } from './BoolExprNode';
import styles from './ConditionNode.module.sass';
import { DecimalExprNode } from './DecimalExprNode';
import { IntExprNode } from './IntExprNode';
import { UIntExprNode } from './UIntExprNode';
import { StringExprNode } from './StringExprNode';
import { TimestampExprNode } from './TimestampExprNode';
import { IntExprNode } from './IntExprNode';

type ExprNodeProps = UIElementProps & {
expr: warp_resolver.Expr;
Expand Down Expand Up @@ -41,10 +40,10 @@ export const ExprNode = forwardRef((props: ExprNodeProps, ref: React.Ref<HTMLDiv
return (
<div ref={ref} className={styles.expr_node}>
<Text className={styles.label} variant="label">
Integer expression
Uint expression
</Text>
<div className={styles.exprs}>
<IntExprNode expr={expr.uint} setExpr={(expr) => setCond({ expr: { uint: expr } })} />
<UIntExprNode expr={expr.uint} setExpr={(expr) => setCond({ expr: { uint: expr } })} />
<Button
className={styles.delete_btn}
icon={<TrashIcon onClick={() => setCond({} as any)} />}
Expand All @@ -55,14 +54,14 @@ export const ExprNode = forwardRef((props: ExprNodeProps, ref: React.Ref<HTMLDiv
);
}

if ('decimal' in expr) {
if ('int' in expr) {
return (
<div ref={ref} className={styles.expr_node}>
<Text className={styles.label} variant="label">
Decimal expression
Int expression
</Text>
<div className={styles.exprs}>
<DecimalExprNode expr={expr.decimal} setExpr={(expr) => setCond({ expr: { decimal: expr } })} />
<IntExprNode expr={expr.int} setExpr={(expr) => setCond({ expr: { int: expr } })} />
<Button
className={styles.delete_btn}
icon={<TrashIcon onClick={() => setCond({} as any)} />}
Expand All @@ -73,32 +72,14 @@ export const ExprNode = forwardRef((props: ExprNodeProps, ref: React.Ref<HTMLDiv
);
}

if ('timestamp' in expr) {
return (
<div ref={ref} className={styles.expr_node}>
<Text className={styles.label} variant="label">
Timestamp expression
</Text>
<div className={styles.exprs}>
<TimestampExprNode expr={expr.timestamp} setExpr={(expr) => setCond({ expr: { timestamp: expr } })} />
<Button
className={styles.delete_btn}
icon={<TrashIcon onClick={() => setCond({} as any)} />}
iconGap="none"
/>
</div>
</div>
);
}

if ('block_height' in expr) {
if ('decimal' in expr) {
return (
<div ref={ref} className={styles.expr_node}>
<Text className={styles.label} variant="label">
Blockheight expression
Decimal expression
</Text>
<div className={styles.exprs}>
<BlockheightExprNode expr={expr.block_height} setExpr={(expr) => setCond({ expr: { block_height: expr } })} />
<DecimalExprNode expr={expr.decimal} setExpr={(expr) => setCond({ expr: { decimal: expr } })} />
<Button
className={styles.delete_btn}
icon={<TrashIcon onClick={() => setCond({} as any)} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import styles from './ConditionNode.module.sass';
import { OperatorInput } from './operator-input/OperatorInput';
import { ValueInput } from './value-input/ValueInput';

type Expr = warp_resolver.GenExprFor_NumValueFor_Uint256And_NumExprOpAnd_IntFnOpAnd_NumOp;
type Value = warp_resolver.NumValueFor_Uint256And_NumExprOpAnd_IntFnOp;
type Expr = warp_resolver.GenExprFor_NumValueForInt128And_NumExprOpAnd_IntFnOpAnd_NumOp;
type Value = warp_resolver.NumValueForInt128And_NumExprOpAnd_IntFnOp;

type IntExprNodeProps = UIElementProps & {
expr: Expr;
Expand All @@ -30,7 +30,7 @@ export const IntExprNode = forwardRef((props: IntExprNodeProps, ref: React.Ref<H
}
}, [op, left, right, setExpr, expr]);

const Left = <ValueInput kind="int" variant="number" value={left} onChange={(v) => setLeft(v)} />;
const Left = <ValueInput kind="int" value={left} onChange={(v) => setLeft(v)} />;

const Op = (
<OperatorInput<warp_resolver.NumOp>
Expand All @@ -42,7 +42,7 @@ export const IntExprNode = forwardRef((props: IntExprNodeProps, ref: React.Ref<H
/>
);

const Right = <ValueInput kind="int" variant="number" value={right} onChange={(v) => setRight(v)} />;
const Right = <ValueInput kind="int" value={right} onChange={(v) => setRight(v)} />;

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const StringExprNode = forwardRef((props: StringExprNodeProps, ref: React
}
}, [op, left, right, setExpr, expr]);

const Left = <ValueInput kind="string" variant="text" value={left} onChange={(v) => setLeft(v)} />;
const Left = <ValueInput kind="string" value={left} onChange={(v) => setLeft(v)} />;

const Op = (
<OperatorInput<warp_resolver.StringOp>
Expand All @@ -42,7 +42,7 @@ export const StringExprNode = forwardRef((props: StringExprNodeProps, ref: React
/>
);

const Right = <ValueInput kind="string" variant="text" value={right} onChange={(v) => setRight(v)} />;
const Right = <ValueInput kind="string" value={right} onChange={(v) => setRight(v)} />;

return (
<>
Expand Down

This file was deleted.

Loading

0 comments on commit 7e3dda3

Please sign in to comment.