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
2feeaa51
Commit
2feeaa51
authored
Jan 19, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
custom methods
parent
d3785d84
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
8 deletions
+17
-8
ContractMethodField.tsx
ui/address/contract/ContractMethodField.tsx
+1
-1
ContractRead.tsx
ui/address/contract/ContractRead.tsx
+5
-1
ContractWrite.tsx
ui/address/contract/ContractWrite.tsx
+5
-1
Address.tsx
ui/pages/Address.tsx
+6
-5
No files found.
ui/address/contract/ContractMethodField.tsx
View file @
2feeaa51
...
...
@@ -27,7 +27,7 @@ const ContractMethodField = ({ control, name, placeholder, setValue, isDisabled,
const
renderInput
=
React
.
useCallback
(({
field
}:
{
field
:
ControllerRenderProps
<
MethodFormFields
>
})
=>
{
return
(
<
FormControl
id=
{
name
}
minW
=
{
{
base
:
'
100%
'
,
lg
:
'
calc((100% - 24px) / 3 - 65px)
'
}
}
w=
"auto"
flexGrow=
{
1
}
isDisabled=
{
isDisabled
}
>
<
FormControl
id=
{
name
}
flexBasis
=
{
{
base
:
'
100%
'
,
lg
:
'
calc((100% - 24px) / 3 - 65px)
'
}
}
w=
"auto"
flexGrow=
{
1
}
isDisabled=
{
isDisabled
}
>
<
InputGroup
size=
"xs"
>
<
Input
{
...
field
}
...
...
ui/address/contract/ContractRead.tsx
View file @
2feeaa51
...
...
@@ -19,9 +19,10 @@ import ContractReadResult from './ContractReadResult';
interface
Props
{
isProxy
?:
boolean
;
isCustomAbi
?:
boolean
;
}
const
ContractRead
=
({
isProxy
}:
Props
)
=>
{
const
ContractRead
=
({
isProxy
,
isCustomAbi
}:
Props
)
=>
{
const
router
=
useRouter
();
const
apiFetch
=
useApiFetch
();
const
{
address
:
userAddress
}
=
useAccount
();
...
...
@@ -30,6 +31,9 @@ const ContractRead = ({ isProxy }: Props) => {
const
{
data
,
isLoading
,
isError
}
=
useApiQuery
(
isProxy
?
'
contract_methods_read_proxy
'
:
'
contract_methods_read
'
,
{
pathParams
:
{
id
:
addressHash
},
queryParams
:
{
is_custom_abi
:
isCustomAbi
?
'
true
'
:
'
false
'
,
},
queryOptions
:
{
enabled
:
Boolean
(
router
.
query
.
id
),
},
...
...
ui/address/contract/ContractWrite.tsx
View file @
2feeaa51
...
...
@@ -20,9 +20,10 @@ import { getNativeCoinValue, isExtendedError } from './utils';
interface
Props
{
isProxy
?:
boolean
;
isCustomAbi
?:
boolean
;
}
const
ContractWrite
=
({
isProxy
}:
Props
)
=>
{
const
ContractWrite
=
({
isProxy
,
isCustomAbi
}:
Props
)
=>
{
const
router
=
useRouter
();
const
addressHash
=
router
.
query
.
id
?.
toString
();
...
...
@@ -31,6 +32,9 @@ const ContractWrite = ({ isProxy }: Props) => {
const
{
data
,
isLoading
,
isError
}
=
useApiQuery
(
isProxy
?
'
contract_methods_write_proxy
'
:
'
contract_methods_write
'
,
{
pathParams
:
{
id
:
addressHash
},
queryParams
:
{
is_custom_abi
:
isCustomAbi
?
'
true
'
:
'
false
'
,
},
queryOptions
:
{
enabled
:
Boolean
(
addressHash
),
},
...
...
ui/pages/Address.tsx
View file @
2feeaa51
...
...
@@ -53,9 +53,10 @@ const AddressPageContent = () => {
const
contractTabs
=
React
.
useMemo
(()
=>
{
return
[
{
id
:
'
contact_code
'
,
title
:
'
Code
'
,
component
:
<
ContractCode
/>
},
addressQuery
.
data
?.
has_decompiled_code
?
{
id
:
'
contact_decompiled_code
'
,
title
:
'
Decompiled code
'
,
component
:
<
div
>
Decompiled code
</
div
>
}
:
undefined
,
// this is not implemented in api yet
// addressQuery.data?.has_decompiled_code ?
// { id: 'contact_decompiled_code', title: 'Decompiled code', component: <div>Decompiled code</div> } :
// undefined,
addressQuery
.
data
?.
has_methods_read
?
{
id
:
'
read_contract
'
,
title
:
'
Read contract
'
,
component
:
<
ContractRead
/>
}
:
undefined
,
...
...
@@ -63,7 +64,7 @@ const AddressPageContent = () => {
{
id
:
'
read_proxy
'
,
title
:
'
Read proxy
'
,
component
:
<
ContractRead
isProxy
/>
}
:
undefined
,
addressQuery
.
data
?.
has_custom_methods_read
?
{
id
:
'
read_custom_methods
'
,
title
:
'
Read custom methods
'
,
component
:
<
div
>
Read custom methods
</
div
>
}
:
{
id
:
'
read_custom_methods
'
,
title
:
'
Read custom methods
'
,
component
:
<
ContractRead
isCustomAbi
/
>
}
:
undefined
,
addressQuery
.
data
?.
has_methods_write
?
{
id
:
'
write_contract
'
,
title
:
'
Write contract
'
,
component
:
<
ContractWrite
/>
}
:
...
...
@@ -72,7 +73,7 @@ const AddressPageContent = () => {
{
id
:
'
write_proxy
'
,
title
:
'
Write proxy
'
,
component
:
<
ContractWrite
isProxy
/>
}
:
undefined
,
addressQuery
.
data
?.
has_custom_methods_write
?
{
id
:
'
write_custom_methods
'
,
title
:
'
Write custom methods
'
,
component
:
<
div
>
Write custom methods
</
div
>
}
:
{
id
:
'
write_custom_methods
'
,
title
:
'
Write custom methods
'
,
component
:
<
ContractWrite
isCustomAbi
/
>
}
:
undefined
,
].
filter
(
notEmpty
);
},
[
addressQuery
.
data
]);
...
...
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