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
1413d1f2
Commit
1413d1f2
authored
Jan 03, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add creation bytecode and deployed bytecode fields
parent
8b15c118
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
2 deletions
+105
-2
resources.ts
lib/api/resources.ts
+7
-0
contract.ts
types/api/contract.ts
+5
-0
AddressContract.tsx
ui/address/AddressContract.tsx
+1
-1
ContractCode.tsx
ui/address/contract/ContractCode.tsx
+90
-0
Address.tsx
ui/pages/Address.tsx
+2
-1
No files found.
lib/api/resources.ts
View file @
1413d1f2
...
...
@@ -14,6 +14,7 @@ import type {
}
from
'
types/api/address
'
;
import
type
{
BlocksResponse
,
BlockTransactionsResponse
,
Block
,
BlockFilters
}
from
'
types/api/block
'
;
import
type
{
ChartMarketResponse
,
ChartTransactionResponse
}
from
'
types/api/charts
'
;
import
type
{
SmartContract
}
from
'
types/api/contract
'
;
import
type
{
IndexingStatus
}
from
'
types/api/indexingStatus
'
;
import
type
{
InternalTransactionsResponse
}
from
'
types/api/internalTransaction
'
;
import
type
{
JsonRpcUrlResponse
}
from
'
types/api/jsonRpcUrl
'
;
...
...
@@ -162,6 +163,11 @@ export const RESOURCES = {
filterFields
:
[
],
},
// CONTRACT
contract
:
{
path
:
'
/api/v2/smart-contracts/:id
'
,
},
// HOMEPAGE
homepage_stats
:
{
path
:
'
/api/v2/stats
'
,
...
...
@@ -259,6 +265,7 @@ Q extends 'address_coin_balance' ? AddressCoinBalanceHistoryResponse :
Q
extends
'
address_coin_balance_chart
'
?
AddressCoinBalanceHistoryChart
:
Q
extends
'
address_logs
'
?
LogsResponseAddress
:
Q
extends
'
config_json_rpc
'
?
JsonRpcUrlResponse
:
Q
extends
'
contract
'
?
SmartContract
:
never
;
/* eslint-enable @typescript-eslint/indent */
...
...
types/api/contract.ts
0 → 100644
View file @
1413d1f2
export
interface
SmartContract
{
deployed_bytecode
:
string
|
null
;
creation_bytecode
:
string
|
null
;
is_self_destructed
:
boolean
;
}
ui/address/AddressContract.tsx
View file @
1413d1f2
...
...
@@ -12,4 +12,4 @@ const AddressContract = ({ tabs }: Props) => {
return
<
RoutedTabs
tabs=
{
tabs
}
variant=
"outline"
colorScheme=
"gray"
size=
"sm"
tabListProps=
{
{
columnGap
:
3
}
}
/>;
};
export
default
AddressContract
;
export
default
React
.
memo
(
AddressContract
)
;
ui/address/contract/ContractCode.tsx
0 → 100644
View file @
1413d1f2
import
{
Box
,
Text
,
Flex
,
Skeleton
,
Textarea
,
Button
}
from
'
@chakra-ui/react
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
link
from
'
lib/link/link
'
;
import
CopyToClipboard
from
'
ui/shared/CopyToClipboard
'
;
import
DataFetchAlert
from
'
ui/shared/DataFetchAlert
'
;
const
ContractCode
=
()
=>
{
const
router
=
useRouter
();
const
{
data
,
isLoading
,
isError
}
=
useApiQuery
(
'
contract
'
,
{
pathParams
:
{
id
:
router
.
query
.
id
?.
toString
()
},
queryOptions
:
{
enabled
:
Boolean
(
router
.
query
.
id
),
},
});
if
(
isError
)
{
return
<
DataFetchAlert
/>;
}
if
(
isLoading
)
{
return
(
<>
<
Flex
justifyContent=
"space-between"
mb=
{
2
}
>
<
Skeleton
w=
"180px"
h=
{
5
}
borderRadius=
"full"
/>
<
Skeleton
w=
{
5
}
h=
{
5
}
/>
</
Flex
>
<
Skeleton
w=
"100%"
h=
"250px"
borderRadius=
"md"
/>
<
Flex
justifyContent=
"space-between"
mb=
{
2
}
mt=
{
6
}
>
<
Skeleton
w=
"180px"
h=
{
5
}
borderRadius=
"full"
/>
<
Skeleton
w=
{
5
}
h=
{
5
}
/>
</
Flex
>
<
Skeleton
w=
"100%"
h=
"400px"
borderRadius=
"md"
/>
</>
);
}
return
(
<>
{
data
.
creation_bytecode
&&
(
<
Box
>
<
Flex
alignItems=
"center"
mb=
{
3
}
>
<
Text
fontWeight=
{
500
}
>
Contract creation code
</
Text
>
<
Button
size=
"sm"
ml=
"auto"
mr=
{
3
}
as=
"a"
href=
{
link
(
'
address_contract_verification
'
,
{
id
:
router
.
query
.
id
?.
toString
()
})
}
>
Verify
&
publish
</
Button
>
<
CopyToClipboard
text=
{
data
.
creation_bytecode
}
/>
</
Flex
>
<
Textarea
variant=
"filledInactive"
p=
{
4
}
minHeight=
"400px"
value=
{
data
.
creation_bytecode
}
fontSize=
"sm"
borderRadius=
"md"
readOnly
/>
</
Box
>
)
}
{
data
.
deployed_bytecode
&&
(
<
Box
mt=
{
6
}
>
<
Flex
justifyContent=
"space-between"
mb=
{
3
}
>
<
Text
fontWeight=
{
500
}
>
Deployed ByteCode
</
Text
>
<
CopyToClipboard
text=
{
data
.
deployed_bytecode
}
/>
</
Flex
>
<
Textarea
variant=
"filledInactive"
p=
{
4
}
minHeight=
"400px"
value=
{
data
.
deployed_bytecode
}
fontSize=
"sm"
borderRadius=
"md"
readOnly
/>
</
Box
>
)
}
</>
);
};
export
default
ContractCode
;
ui/pages/Address.tsx
View file @
1413d1f2
...
...
@@ -14,6 +14,7 @@ import AddressInternalTxs from 'ui/address/AddressInternalTxs';
import
AddressLogs
from
'
ui/address/AddressLogs
'
;
import
AddressTokenTransfers
from
'
ui/address/AddressTokenTransfers
'
;
import
AddressTxs
from
'
ui/address/AddressTxs
'
;
import
ContractCode
from
'
ui/address/contract/ContractCode
'
;
import
TextAd
from
'
ui/shared/ad/TextAd
'
;
import
Page
from
'
ui/shared/Page/Page
'
;
import
PageTitle
from
'
ui/shared/Page/PageTitle
'
;
...
...
@@ -21,7 +22,7 @@ import RoutedTabs from 'ui/shared/RoutedTabs/RoutedTabs';
import
SkeletonTabs
from
'
ui/shared/skeletons/SkeletonTabs
'
;
const
CONTRACT_TABS
=
[
{
id
:
'
contact_code
'
,
title
:
'
Code
'
,
component
:
<
div
>
Code
</
div
>
},
{
id
:
'
contact_code
'
,
title
:
'
Code
'
,
component
:
<
ContractCode
/
>
},
{
id
:
'
contact_decompiled_code
'
,
title
:
'
Decompiled code
'
,
component
:
<
div
>
Decompiled code
</
div
>
},
{
id
:
'
read_contract
'
,
title
:
'
Read contract
'
,
component
:
<
div
>
Read contract
</
div
>
},
{
id
:
'
read_proxy
'
,
title
:
'
Read proxy
'
,
component
:
<
div
>
Read proxy
</
div
>
},
...
...
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