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
98aced4d
Commit
98aced4d
authored
Feb 17, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix contract read issues
parent
bc44650f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
ContractRead.tsx
ui/address/contract/ContractRead.tsx
+6
-2
ContractReadResult.tsx
ui/address/contract/ContractReadResult.tsx
+2
-2
No files found.
ui/address/contract/ContractRead.tsx
View file @
98aced4d
...
...
@@ -35,6 +35,7 @@ const ContractRead = ({ isProxy, isCustomAbi }: Props) => {
pathParams
:
{
hash
:
addressHash
},
queryParams
:
{
is_custom_abi
:
isCustomAbi
?
'
true
'
:
'
false
'
,
from
:
userAddress
,
},
queryOptions
:
{
enabled
:
Boolean
(
addressHash
),
...
...
@@ -44,6 +45,9 @@ const ContractRead = ({ isProxy, isCustomAbi }: Props) => {
const
handleMethodFormSubmit
=
React
.
useCallback
(
async
(
item
:
SmartContractReadMethod
,
args
:
Array
<
string
|
Array
<
string
>>
)
=>
{
return
apiFetch
<
'
contract_method_query
'
,
SmartContractQueryMethodRead
>
(
'
contract_method_query
'
,
{
pathParams
:
{
hash
:
addressHash
},
queryParams
:
{
is_custom_abi
:
isCustomAbi
?
'
true
'
:
'
false
'
,
},
fetchParams
:
{
method
:
'
POST
'
,
body
:
{
...
...
@@ -54,11 +58,11 @@ const ContractRead = ({ isProxy, isCustomAbi }: Props) => {
},
},
});
},
[
addressHash
,
apiFetch
,
isProxy
,
userAddress
]);
},
[
addressHash
,
apiFetch
,
is
CustomAbi
,
is
Proxy
,
userAddress
]);
const
renderContent
=
React
.
useCallback
((
item
:
SmartContractReadMethod
,
index
:
number
,
id
:
number
)
=>
{
if
(
item
.
error
)
{
return
<
Alert
status=
"error"
fontSize=
"sm"
>
{
item
.
error
}
</
Alert
>;
return
<
Alert
status=
"error"
fontSize=
"sm"
wordBreak=
"break-word"
>
{
item
.
error
}
</
Alert
>;
}
if
(
item
.
outputs
.
some
(({
value
})
=>
value
))
{
...
...
ui/address/contract/ContractReadResult.tsx
View file @
98aced4d
...
...
@@ -18,12 +18,12 @@ const ContractReadResult = ({ item, result, onSettle }: Props) => {
},
[
onSettle
]);
if
(
'
status
'
in
result
)
{
return
<
Alert
status=
"error"
mt=
{
3
}
p=
{
4
}
borderRadius=
"md"
fontSize=
"sm"
>
{
result
.
statusText
}
</
Alert
>;
return
<
Alert
status=
"error"
mt=
{
3
}
p=
{
4
}
borderRadius=
"md"
fontSize=
"sm"
wordBreak=
"break-word"
>
{
result
.
statusText
}
</
Alert
>;
}
if
(
result
.
is_error
)
{
const
message
=
'
error
'
in
result
.
result
?
result
.
result
.
error
:
result
.
result
.
message
;
return
<
Alert
status=
"error"
mt=
{
3
}
p=
{
4
}
borderRadius=
"md"
fontSize=
"sm"
>
{
message
}
</
Alert
>;
return
<
Alert
status=
"error"
mt=
{
3
}
p=
{
4
}
borderRadius=
"md"
fontSize=
"sm"
wordBreak=
"break-word"
>
{
message
}
</
Alert
>;
}
return
(
...
...
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