Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
01e266df
Commit
01e266df
authored
Dec 12, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update format for call output
parent
05e389dd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
56 deletions
+58
-56
Alert.ts
theme/components/Alert/Alert.ts
+1
-1
ContractMethodCallable.tsx
ui/address/contract/ContractMethodCallable.tsx
+56
-53
ContractMethodsAccordionItem.tsx
ui/address/contract/ContractMethodsAccordionItem.tsx
+1
-1
ContractWriteResultDumb.tsx
ui/address/contract/ContractWriteResultDumb.tsx
+0
-1
No files found.
theme/components/Alert/Alert.ts
View file @
01e266df
...
@@ -13,7 +13,7 @@ function getBg(props: StyleFunctionProps) {
...
@@ -13,7 +13,7 @@ function getBg(props: StyleFunctionProps) {
const
{
theme
,
colorScheme
:
c
}
=
props
;
const
{
theme
,
colorScheme
:
c
}
=
props
;
const
darkBg
=
transparentize
(
`
${
c
}
.200`
,
0.16
)(
theme
);
const
darkBg
=
transparentize
(
`
${
c
}
.200`
,
0.16
)(
theme
);
return
{
return
{
light
:
`colors.
${
c
}
.
100
`
,
light
:
`colors.
${
c
}
.
${
c
===
'
red
'
?
'
50
'
:
'
100
'
}
`
,
dark
:
darkBg
,
dark
:
darkBg
,
};
};
}
}
...
...
ui/address/contract/ContractMethodCallable.tsx
View file @
01e266df
import
{
Box
,
Button
,
chakra
,
Flex
,
Icon
,
Text
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Button
,
chakra
,
Flex
,
Grid
,
Icon
,
Text
}
from
'
@chakra-ui/react
'
;
// import _fromPairs from 'lodash/fromPairs';
// import _fromPairs from 'lodash/fromPairs';
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
SubmitHandler
}
from
'
react-hook-form
'
;
import
type
{
SubmitHandler
}
from
'
react-hook-form
'
;
...
@@ -136,62 +136,65 @@ const ContractMethodCallable = <T extends SmartContractMethod>({ data, onSubmit,
...
@@ -136,62 +136,65 @@ const ContractMethodCallable = <T extends SmartContractMethod>({ data, onSubmit,
<
FormProvider
{
...
formApi
}
>
<
FormProvider
{
...
formApi
}
>
<
chakra
.
form
<
chakra
.
form
noValidate
noValidate
display=
"grid"
columnGap=
{
3
}
rowGap=
{
{
base
:
2
,
lg
:
3
}
}
gridTemplateColumns=
{
{
base
:
'
minmax(0, 1fr)
'
,
lg
:
'
minmax(min-content, 250px) minmax(0, 1fr)
'
}
}
onSubmit=
{
formApi
.
handleSubmit
(
onFormSubmit
)
}
onSubmit=
{
formApi
.
handleSubmit
(
onFormSubmit
)
}
onChange=
{
handleFormChange
}
onChange=
{
handleFormChange
}
>
>
{
inputs
.
map
((
input
,
index
)
=>
{
<
Grid
const
fieldName
=
getFormFieldName
(
input
.
name
,
index
);
columnGap=
{
3
}
rowGap=
{
{
base
:
2
,
lg
:
3
}
}
gridTemplateColumns=
{
{
base
:
'
minmax(0, 1fr)
'
,
lg
:
'
minmax(min-content, 250px) minmax(0, 1fr)
'
}
}
mb=
{
3
}
_empty=
{
{
display
:
'
none
'
}
}
>
{
inputs
.
map
((
input
,
index
)
=>
{
const
fieldName
=
getFormFieldName
(
input
.
name
,
index
);
if
(
input
.
type
===
'
tuple
'
&&
input
.
components
)
{
return
(
<
React
.
Fragment
key=
{
fieldName
}
>
{
index
!==
0
&&
<><
Box
h=
{
{
base
:
0
,
lg
:
3
}
}
/><
div
/></>
}
<
Box
fontWeight=
{
500
}
lineHeight=
"20px"
py=
{
{
lg
:
'
6px
'
}
}
fontSize=
"sm"
wordBreak=
"break-word"
>
{
input
.
name
}
(
{
input
.
type
}
)
</
Box
>
<
div
/>
{
input
.
components
.
map
((
component
,
componentIndex
)
=>
{
const
fieldName
=
getFormFieldName
(
component
.
name
,
componentIndex
,
input
.
name
);
return
(
<
ContractMethodCallableRow
key=
{
fieldName
}
fieldName=
{
fieldName
}
argName=
{
component
.
name
}
argType=
{
component
.
type
}
isDisabled=
{
isLoading
}
onChange=
{
handleFormChange
}
isGrouped
/>
);
})
}
{
index
!==
inputs
.
length
-
1
&&
<><
Box
h=
{
{
base
:
0
,
lg
:
3
}
}
/><
div
/></>
}
</
React
.
Fragment
>
);
}
if
(
input
.
type
===
'
tuple
'
&&
input
.
components
)
{
return
(
return
(
<
React
.
Fragment
key=
{
fieldName
}
>
<
ContractMethodCallableRow
{
index
!==
0
&&
<><
Box
h=
{
{
base
:
0
,
lg
:
3
}
}
/><
div
/></>
}
key=
{
fieldName
}
<
Box
fieldName=
{
fieldName
}
fontWeight=
{
500
}
argName=
{
input
.
name
}
lineHeight=
"20px"
argType=
{
input
.
type
}
py=
{
{
lg
:
'
6px
'
}
}
isDisabled=
{
isLoading
}
fontSize=
"sm"
onChange=
{
handleFormChange
}
wordBreak=
"break-word"
/>
>
{
input
.
name
}
(
{
input
.
type
}
)
</
Box
>
<
div
/>
{
input
.
components
.
map
((
component
,
componentIndex
)
=>
{
const
fieldName
=
getFormFieldName
(
component
.
name
,
componentIndex
,
input
.
name
);
return
(
<
ContractMethodCallableRow
key=
{
fieldName
}
fieldName=
{
fieldName
}
argName=
{
component
.
name
}
argType=
{
component
.
type
}
isDisabled=
{
isLoading
}
onChange=
{
handleFormChange
}
isGrouped
/>
);
})
}
{
index
!==
inputs
.
length
-
1
&&
<><
Box
h=
{
{
base
:
0
,
lg
:
3
}
}
/><
div
/></>
}
</
React
.
Fragment
>
);
);
}
})
}
</
Grid
>
return
(
<
ContractMethodCallableRow
key=
{
fieldName
}
fieldName=
{
fieldName
}
argName=
{
input
.
name
}
argType=
{
input
.
type
}
isDisabled=
{
isLoading
}
onChange=
{
handleFormChange
}
/>
);
})
}
<
div
/>
<
Button
<
Button
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
loadingText=
{
isWrite
?
'
Write
'
:
'
Read
'
}
loadingText=
{
isWrite
?
'
Write
'
:
'
Read
'
}
...
@@ -207,9 +210,9 @@ const ContractMethodCallable = <T extends SmartContractMethod>({ data, onSubmit,
...
@@ -207,9 +210,9 @@ const ContractMethodCallable = <T extends SmartContractMethod>({ data, onSubmit,
</
chakra
.
form
>
</
chakra
.
form
>
</
FormProvider
>
</
FormProvider
>
{
'
outputs
'
in
data
&&
!
isWrite
&&
data
.
outputs
.
length
>
0
&&
(
{
'
outputs
'
in
data
&&
!
isWrite
&&
data
.
outputs
.
length
>
0
&&
(
<
Flex
mt=
{
3
}
>
<
Flex
mt=
{
3
}
fontSize=
"sm"
>
<
Icon
as=
{
arrowIcon
}
boxSize=
{
5
}
mr=
{
1
}
/>
<
Icon
as=
{
arrowIcon
}
boxSize=
{
5
}
mr=
{
1
}
/>
<
Text
>
{
data
.
outputs
.
map
(({
type
})
=>
type
).
join
(
'
,
'
)
}
</
Text
>
<
Text
>
{
data
.
outputs
.
map
(({
type
,
name
})
=>
[
name
,
type
].
join
(
'
'
)
).
join
(
'
,
'
)
}
</
Text
>
</
Flex
>
</
Flex
>
)
}
)
}
{
result
&&
<
ResultComponent
item=
{
data
}
result=
{
result
}
onSettle=
{
handleTxSettle
}
/>
}
{
result
&&
<
ResultComponent
item=
{
data
}
result=
{
result
}
onSettle=
{
handleTxSettle
}
/>
}
...
...
ui/address/contract/ContractMethodsAccordionItem.tsx
View file @
01e266df
...
@@ -85,7 +85,7 @@ const ContractMethodsAccordionItem = <T extends SmartContractMethod>({ data, ind
...
@@ -85,7 +85,7 @@ const ContractMethodsAccordionItem = <T extends SmartContractMethod>({ data, ind
<
AccordionIcon
/>
<
AccordionIcon
/>
</
AccordionButton
>
</
AccordionButton
>
</
Element
>
</
Element
>
<
AccordionPanel
pb=
{
4
}
p
x=
{
0
}
>
<
AccordionPanel
pb=
{
4
}
p
r=
{
0
}
pl=
"28px"
>
{
renderContent
(
data
,
index
,
id
)
}
{
renderContent
(
data
,
index
,
id
)
}
</
AccordionPanel
>
</
AccordionPanel
>
</
AccordionItem
>
</
AccordionItem
>
...
...
ui/address/contract/ContractWriteResultDumb.tsx
View file @
01e266df
...
@@ -82,7 +82,6 @@ const ContractWriteResultDumb = ({ result, onSettle, txInfo }: Props) => {
...
@@ -82,7 +82,6 @@ const ContractWriteResultDumb = ({ result, onSettle, txInfo }: Props) => {
return
(
return
(
<
Box
<
Box
fontSize=
"sm"
fontSize=
"sm"
pl=
{
3
}
mt=
{
3
}
mt=
{
3
}
alignItems=
"center"
alignItems=
"center"
whiteSpace=
"pre-wrap"
whiteSpace=
"pre-wrap"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment