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
90c4ca73
Unverified
Commit
90c4ca73
authored
Feb 20, 2024
by
Igor Stuev
Committed by
GitHub
Feb 20, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1628 from blockscout/tom2drum/issue-1624
`outputs` field is not required for contract read method
parents
d20c632a
043609fb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
6 deletions
+8
-6
contract.ts
types/api/contract.ts
+1
-1
ContractMethodCallable.tsx
ui/address/contract/ContractMethodCallable.tsx
+5
-3
ContractRead.tsx
ui/address/contract/ContractRead.tsx
+1
-1
useContractAbi.tsx
ui/address/contract/useContractAbi.tsx
+1
-1
No files found.
types/api/contract.ts
View file @
90c4ca73
...
...
@@ -55,7 +55,7 @@ export interface SmartContractExternalLibrary {
export
interface
SmartContractMethodBase
{
inputs
:
Array
<
SmartContractMethodInput
>
;
outputs
:
Array
<
SmartContractMethodOutput
>
;
outputs
?
:
Array
<
SmartContractMethodOutput
>
;
constant
:
boolean
;
name
:
string
;
stateMutability
:
SmartContractMethodStateMutability
;
...
...
ui/address/contract/ContractMethodCallable.tsx
View file @
90c4ca73
...
...
@@ -82,6 +82,8 @@ const ContractMethodCallable = <T extends SmartContractMethod>({ data, onSubmit,
});
},
[
inputs
,
onSubmit
,
data
,
isWrite
]);
const
outputs
=
'
outputs
'
in
data
&&
data
.
outputs
?
data
.
outputs
:
[];
return
(
<
Box
>
<
FormProvider
{
...
formApi
}
>
...
...
@@ -163,16 +165,16 @@ const ContractMethodCallable = <T extends SmartContractMethod>({ data, onSubmit,
</
Button
>
</
chakra
.
form
>
</
FormProvider
>
{
'
outputs
'
in
data
&&
!
isWrite
&&
data
.
outputs
.
length
>
0
&&
(
{
!
isWrite
&&
outputs
.
length
>
0
&&
(
<
Flex
mt=
{
3
}
fontSize=
"sm"
>
<
IconSvg
name=
"arrows/down-right"
boxSize=
{
5
}
mr=
{
1
}
/>
<
p
>
{
data
.
outputs
.
map
(({
type
,
name
},
index
)
=>
{
{
outputs
.
map
(({
type
,
name
},
index
)
=>
{
return
(
<>
<
chakra
.
span
fontWeight=
{
500
}
>
{
name
}
</
chakra
.
span
>
<
span
>
{
name
?
`(${ type })`
:
type
}
</
span
>
{
index
<
data
.
outputs
.
length
-
1
&&
<
span
>
,
</
span
>
}
{
index
<
outputs
.
length
-
1
&&
<
span
>
,
</
span
>
}
</>
);
})
}
...
...
ui/address/contract/ContractRead.tsx
View file @
90c4ca73
...
...
@@ -63,7 +63,7 @@ const ContractRead = () => {
return
<
Alert
status=
"error"
fontSize=
"sm"
wordBreak=
"break-word"
>
{
item
.
error
}
</
Alert
>;
}
if
(
item
.
outputs
.
some
(({
value
})
=>
value
!==
undefined
&&
value
!==
null
))
{
if
(
item
.
outputs
?
.
some
(({
value
})
=>
value
!==
undefined
&&
value
!==
null
))
{
return
(
<
Flex
flexDir=
"column"
rowGap=
{
1
}
>
{
item
.
outputs
.
map
((
output
,
index
)
=>
<
ContractMethodConstant
key=
{
index
}
data=
{
output
}
/>)
}
...
...
ui/address/contract/useContractAbi.tsx
View file @
90c4ca73
...
...
@@ -50,7 +50,7 @@ export default function useContractAbi({ addressHash, isProxy, isCustomAbi }: Pa
}
if
(
isCustomAbi
)
{
return
customInfo
;
return
customInfo
as
Abi
;
}
return
contractInfo
?.
abi
??
undefined
;
...
...
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