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
043609fb
Commit
043609fb
authored
Feb 20, 2024
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
`outputs` field is not required for contract read method
Fixes #1624
parent
e5224836
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 @
043609fb
...
@@ -55,7 +55,7 @@ export interface SmartContractExternalLibrary {
...
@@ -55,7 +55,7 @@ export interface SmartContractExternalLibrary {
export
interface
SmartContractMethodBase
{
export
interface
SmartContractMethodBase
{
inputs
:
Array
<
SmartContractMethodInput
>
;
inputs
:
Array
<
SmartContractMethodInput
>
;
outputs
:
Array
<
SmartContractMethodOutput
>
;
outputs
?
:
Array
<
SmartContractMethodOutput
>
;
constant
:
boolean
;
constant
:
boolean
;
name
:
string
;
name
:
string
;
stateMutability
:
SmartContractMethodStateMutability
;
stateMutability
:
SmartContractMethodStateMutability
;
...
...
ui/address/contract/ContractMethodCallable.tsx
View file @
043609fb
...
@@ -82,6 +82,8 @@ const ContractMethodCallable = <T extends SmartContractMethod>({ data, onSubmit,
...
@@ -82,6 +82,8 @@ const ContractMethodCallable = <T extends SmartContractMethod>({ data, onSubmit,
});
});
},
[
inputs
,
onSubmit
,
data
,
isWrite
]);
},
[
inputs
,
onSubmit
,
data
,
isWrite
]);
const
outputs
=
'
outputs
'
in
data
&&
data
.
outputs
?
data
.
outputs
:
[];
return
(
return
(
<
Box
>
<
Box
>
<
FormProvider
{
...
formApi
}
>
<
FormProvider
{
...
formApi
}
>
...
@@ -163,16 +165,16 @@ const ContractMethodCallable = <T extends SmartContractMethod>({ data, onSubmit,
...
@@ -163,16 +165,16 @@ const ContractMethodCallable = <T extends SmartContractMethod>({ data, onSubmit,
</
Button
>
</
Button
>
</
chakra
.
form
>
</
chakra
.
form
>
</
FormProvider
>
</
FormProvider
>
{
'
outputs
'
in
data
&&
!
isWrite
&&
data
.
outputs
.
length
>
0
&&
(
{
!
isWrite
&&
outputs
.
length
>
0
&&
(
<
Flex
mt=
{
3
}
fontSize=
"sm"
>
<
Flex
mt=
{
3
}
fontSize=
"sm"
>
<
IconSvg
name=
"arrows/down-right"
boxSize=
{
5
}
mr=
{
1
}
/>
<
IconSvg
name=
"arrows/down-right"
boxSize=
{
5
}
mr=
{
1
}
/>
<
p
>
<
p
>
{
data
.
outputs
.
map
(({
type
,
name
},
index
)
=>
{
{
outputs
.
map
(({
type
,
name
},
index
)
=>
{
return
(
return
(
<>
<>
<
chakra
.
span
fontWeight=
{
500
}
>
{
name
}
</
chakra
.
span
>
<
chakra
.
span
fontWeight=
{
500
}
>
{
name
}
</
chakra
.
span
>
<
span
>
{
name
?
`(${ type })`
:
type
}
</
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 @
043609fb
...
@@ -63,7 +63,7 @@ const ContractRead = () => {
...
@@ -63,7 +63,7 @@ const ContractRead = () => {
return
<
Alert
status=
"error"
fontSize=
"sm"
wordBreak=
"break-word"
>
{
item
.
error
}
</
Alert
>;
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
(
return
(
<
Flex
flexDir=
"column"
rowGap=
{
1
}
>
<
Flex
flexDir=
"column"
rowGap=
{
1
}
>
{
item
.
outputs
.
map
((
output
,
index
)
=>
<
ContractMethodConstant
key=
{
index
}
data=
{
output
}
/>)
}
{
item
.
outputs
.
map
((
output
,
index
)
=>
<
ContractMethodConstant
key=
{
index
}
data=
{
output
}
/>)
}
...
...
ui/address/contract/useContractAbi.tsx
View file @
043609fb
...
@@ -50,7 +50,7 @@ export default function useContractAbi({ addressHash, isProxy, isCustomAbi }: Pa
...
@@ -50,7 +50,7 @@ export default function useContractAbi({ addressHash, isProxy, isCustomAbi }: Pa
}
}
if
(
isCustomAbi
)
{
if
(
isCustomAbi
)
{
return
customInfo
;
return
customInfo
as
Abi
;
}
}
return
contractInfo
?.
abi
??
undefined
;
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