Skip to content

Commit 7e809c5

Browse files
Arbitrary Contract Interaction (ACI) (#836)
* frontend with mocks * initial integration * API working * ACI Form with various entrypoints * Update node version * Fix for API in ACI * WIP - ACI Implementation Debugging * WIP - ACI Interaction (Pseudocode working) * Error handling + Params now being passed into generated lambda * Changes for adding ACI Executor and simplified UI components * Removed Cycle Ignore Option * Fixed prettier issues * Added ACI Contract within the form & fixed the "Submit" button. * Improved Components for ConfigProposalForm * Removed unused imports * Modal Improvements * Renamed simple lambda 3 to ACI_Executor * Fixed Other UI Issues --------- Co-authored-by: Ashutosh Kumar <ashutosh@w3dev.in> Co-authored-by: Ashutosh Kumar <ashutoshpw@users.noreply.github.com>
1 parent 9a97efb commit 7e809c5

39 files changed

Lines changed: 3411 additions & 450 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The following dependencies are required to run homebase-app:
1010

1111
| Dependency | Version |
1212
| ---------- | ------------------- |
13-
| Node | `v16.16.0` or above |
13+
| Node | `v18.20.0` or above |
1414
| Yarn | `v1.22.*` or above |
1515

1616
# Third Party Services

bun.lockb

963 KB
Binary file not shown.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@mui/material": "^5.14.14",
3030
"@mui/x-date-pickers": "^5.0.2",
3131
"@taquito/beacon-wallet": "^17.3.1",
32+
"@taquito/michel-codec": "^20.0.0",
3233
"@taquito/signer": "^17.3.1",
3334
"@taquito/taquito": "^17.3.1",
3435
"@taquito/tzip12": "^17.3.1",
@@ -39,6 +40,7 @@
3940
"@types/react-router-hash-link": "^2.4.5",
4041
"@types/valid-url": "^1.0.4",
4142
"assert": "^2.0.0",
43+
"assert-never": "^1.2.1",
4244
"bignumber.js": "^9.0.1",
4345
"blockies-ts": "^1.0.0",
4446
"crypto-browserify": "^3.12.0",
@@ -86,6 +88,7 @@
8688
"yup": "^0.32.9"
8789
},
8890
"devDependencies": {
91+
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
8992
"@types/jest": "^26.0.21",
9093
"@types/node": "^14.14.35",
9194
"@types/react": "^17.0.44",

src/components/ui/Button.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { styled, Button as MaterialButton } from "@material-ui/core"
2+
3+
export const Button = styled(MaterialButton)(({ theme }) => ({
4+
"fontSize": "14px",
5+
"justifyItems": "center",
6+
"color": "#000",
7+
"boxShadow": "0px 0px 7px -2px rgba(0, 0, 0, 0.2)",
8+
"transition": ".15s ease-in",
9+
"background": theme.palette.secondary.main,
10+
"textTransform": "none",
11+
"borderRadius": 4,
12+
"padding": "8px 15px",
13+
"marginRight": "8px",
14+
15+
"&$disabled": {
16+
boxShadow: "none"
17+
},
18+
19+
"&:hover": {
20+
boxShadow: "0px 0px 7px -2px rgba(0, 0, 0, 0.2)",
21+
backgroundColor: "#62eda5 !important",
22+
transition: ".15s ease-in"
23+
},
24+
25+
["@media (max-width:1030px)"]: {
26+
fontSize: "14px"
27+
}
28+
}))
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Grid, Typography, styled, CircularProgress } from "@material-ui/core"
2+
import { CheckOutlined } from "@material-ui/icons"
3+
4+
const StyledRow = styled(Grid)({
5+
marginTop: 30
6+
})
7+
8+
const LoadingContainer = styled(Grid)({
9+
minHeight: 651
10+
})
11+
12+
const LoadingStateLabel = styled(Typography)({
13+
marginTop: 40
14+
})
15+
16+
const CheckIcon = styled(CheckOutlined)({
17+
fontSize: 169
18+
})
19+
20+
export { StyledRow, LoadingContainer, LoadingStateLabel, CheckIcon }

src/components/ui/Table.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { styled, Grid, Theme } from "@material-ui/core"
2+
3+
export const ContentContainer = styled(Grid)(({ theme }) => ({
4+
borderRadius: 8,
5+
background: "#24282D"
6+
}))
7+
8+
export const TableHeader = styled(Grid)(({ theme }: { theme: Theme }) => ({
9+
padding: "16px 46px",
10+
minHeight: 34,
11+
[theme.breakpoints.down("sm")]: {
12+
gap: 10
13+
}
14+
}))
15+
16+
export const TableContainer = styled(ContentContainer)({
17+
width: "100%"
18+
})

src/config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const AppConfig = {
2+
env: process.env.REACT_APP_ENV,
3+
CONST: {
4+
ARBITRARY_CONTRACT_INTERACTION: "arbitrary_contract_interaction"
5+
},
6+
ACI: {
7+
EXECUTOR_FUNCTION_NAME: "aci_executor",
8+
EXECUTOR_LAMBDA: {
9+
code: `(Left (Left (Pair (Pair { UNPAIR; UNPAIR; SWAP; UNPACK (pair (lambda %code (pair (pair (map %handler_storage string bytes) (bytes %packed_argument)) (pair %proposal_info (address %from) (nat %frozen_token) (bytes %proposal_metadata))) (pair (pair (option %guardian address) (map %handler_storage string bytes)) (list %operations operation))) (bytes %packed_argument)); ASSERT_SOME; UNPAIR; DIP{ SWAP; PAIR; PAIR}; SWAP; EXEC} {DROP; UNIT}) "aci_executor")))`,
10+
type: `(or (or (pair %add_handler (pair (lambda %code (pair (pair (map %handler_storage string bytes) (bytes %packed_argument)) (pair %proposal_info (address %from) (nat %frozen_token) (bytes %proposal_metadata))) (pair (pair (option %guardian address) (map %handler_storage string bytes)) (list %operations operation))) (lambda %handler_check (pair bytes (map string bytes)) unit)) (string %name)) (pair %execute_handler (string %handler_name) (bytes %packed_argument))) (string %remove_handler))`
11+
}
12+
}
13+
}
14+
15+
export default AppConfig

src/models/Contract.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
export interface ArbitraryContract {
2+
counter: number
3+
name: string
4+
type: string
5+
children: ContractChild[]
6+
}
7+
8+
interface ContractChild {
9+
counter: number
10+
name: string
11+
type: string
12+
children: ParametersList[]
13+
placeholder: string
14+
validate: any
15+
initValue: string
16+
}
17+
18+
interface ParametersList {
19+
counter: number
20+
name: string
21+
type: string
22+
children: ParametersList[]
23+
placeholder: string
24+
validate: any
25+
initValue: string
26+
}

src/modules/common/SmallButton.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,27 @@ export const SmallButton = styled(Button)({
2121
transition: ".15s ease-in"
2222
}
2323
})
24+
25+
export const SmallButtonDialog = styled(Button)({
26+
"justifyItems": "center",
27+
"fontSize": "16px",
28+
"boxShadow": "0px 0px 7px -2px rgba(0, 0, 0, 0.2)",
29+
"transition": ".15s ease-out",
30+
"textTransform": "capitalize",
31+
"borderRadius": 8,
32+
"backgroundColor": "#81feb7 !important",
33+
"color": "#1c1f23",
34+
"padding": "8px 16px",
35+
36+
"&$disabled": {
37+
boxShadow: "none",
38+
backgroundColor: "#474E55 !important",
39+
border: "none"
40+
},
41+
42+
"&:hover": {
43+
boxShadow: "0px 0px 7px -2px rgba(0, 0, 0, 0.2)",
44+
backgroundColor: "#62eda5 !important",
45+
transition: ".15s ease-in"
46+
}
47+
})
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { styled } from "@material-ui/core"
2+
import { MainButton } from "./MainButton"
3+
4+
const StyledSendButton = styled(MainButton)(({ theme }) => ({
5+
"width": 101,
6+
"color": "#1C1F23",
7+
"&$disabled": {
8+
opacity: 0.5,
9+
boxShadow: "none",
10+
cursor: "not-allowed"
11+
}
12+
}))
13+
14+
export { StyledSendButton }

0 commit comments

Comments
 (0)