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
8d1769a8
Commit
8d1769a8
authored
Jan 06, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
amends
parent
961fb314
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
3 deletions
+20
-3
ContractMethodCallable.tsx
ui/address/contract/ContractMethodCallable.tsx
+3
-2
ContractMethodsAccordion.tsx
ui/address/contract/ContractMethodsAccordion.tsx
+16
-1
ContractWrite.tsx
ui/address/contract/ContractWrite.tsx
+1
-0
No files found.
ui/address/contract/ContractMethodCallable.tsx
View file @
8d1769a8
...
...
@@ -15,6 +15,7 @@ import ContractMethodField from './ContractMethodField';
interface
Props
<
T
extends
SmartContractMethod
>
{
data
:
T
;
caller
:
(
data
:
T
,
args
:
Array
<
string
>
)
=>
Promise
<
Array
<
Array
<
string
>>>
;
isWrite
?:
boolean
;
}
const
getFieldName
=
(
name
:
string
,
index
:
number
):
string
=>
name
||
String
(
index
);
...
...
@@ -35,7 +36,7 @@ const sortFields = (data: Array<SmartContractMethodInput>) => ([ a ]: [string, s
return
0
;
};
const
ContractMethodCallable
=
<
T
extends
SmartContractMethod
>
(
{
data
,
caller
}
: Props
<
T
>
) =
>
{
const
ContractMethodCallable
=
<
T
extends
SmartContractMethod
>
(
{
data
,
caller
,
isWrite
}
: Props
<
T
>
) =
>
{
const
inputs
=
React
.
useMemo
(()
=>
{
return
data
.
payable
&&
(
!
(
'
inputs
'
in
data
)
||
data
.
inputs
.
length
===
0
)
?
[
{
...
...
@@ -92,7 +93,7 @@ const ContractMethodCallable = <T extends SmartContractMethod>({ data, caller }:
flexShrink=
{
0
}
type=
"submit"
>
Query
{
isWrite
?
'
Write
'
:
'
Query
'
}
</
Button
>
</
chakra
.
form
>
{
'
outputs
'
in
data
&&
data
.
outputs
.
length
>
0
&&
(
...
...
ui/address/contract/ContractMethodsAccordion.tsx
View file @
8d1769a8
import
{
Accordion
,
AccordionButton
,
AccordionIcon
,
AccordionItem
,
AccordionPanel
,
Box
,
Flex
,
Link
}
from
'
@chakra-ui/react
'
;
import
{
Accordion
,
AccordionButton
,
AccordionIcon
,
AccordionItem
,
AccordionPanel
,
Box
,
Flex
,
Icon
,
Link
,
Tooltip
}
from
'
@chakra-ui/react
'
;
import
_range
from
'
lodash/range
'
;
import
React
from
'
react
'
;
import
type
{
SmartContractMethod
}
from
'
types/api/contract
'
;
import
infoIcon
from
'
icons/info.svg
'
;
interface
Props
<
T
extends
SmartContractMethod
>
{
data
:
Array
<
T
>
;
renderContent
:
(
item
:
T
,
index
:
number
,
id
:
number
)
=>
React
.
ReactNode
;
...
...
@@ -43,6 +45,19 @@ const ContractMethodsAccordion = <T extends SmartContractMethod>({ data, renderC
<
Box
as=
"span"
fontFamily=
"heading"
fontWeight=
{
500
}
fontSize=
"lg"
mr=
{
1
}
>
{
index
+
1
}
.
{
item
.
type
===
'
fallback
'
?
'
fallback
'
:
item
.
name
}
</
Box
>
{
item
.
type
===
'
fallback
'
&&
(
<
Tooltip
label=
{
`The fallback function is executed on a call to the contract if none of the other functions match
the given function signature, or if no data was supplied at all and there is no receive Ether function.
The fallback function always receives data, but in order to also receive Ether it must be marked payable.`
}
placement=
"top"
maxW=
"320px"
>
<
Box
cursor=
"pointer"
display=
"inherit"
>
<
Icon
as=
{
infoIcon
}
boxSize=
{
5
}
/>
</
Box
>
</
Tooltip
>
)
}
<
AccordionIcon
/>
</
AccordionButton
>
</
h2
>
...
...
ui/address/contract/ContractWrite.tsx
View file @
8d1769a8
...
...
@@ -41,6 +41,7 @@ const ContractWrite = () => {
key=
{
id
+
'
_
'
+
index
}
data=
{
item
}
caller=
{
contractCaller
}
isWrite
/>
);
},
[
contractCaller
]);
...
...
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