Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show no admin and correctly handle explorer link by address type #115

Merged
merged 7 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Improvements

- [#115](https://github.com/alleslabs/celatone-frontend/pull/115) (Contract Details Page) Show no admin and correctly handle explorer link by address type
- [#64](https://github.com/alleslabs/celatone-frontend/pull/64) Add address validation functions for contract and user addresses
- [#52](https://github.com/alleslabs/celatone-frontend/pull/52) Create a component for disconnected State and apply to contract, code, past tx
- [#56](https://github.com/alleslabs/celatone-frontend/pull/56) Refactor offchain form component by not receiving nameField and descriptionField
Expand Down
26 changes: 20 additions & 6 deletions src/lib/pages/contract-details/components/InstantiateInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export const InstantiateInfo = ({ contractData }: InstantiateInfoProps) => {
const instantiatorType = getAddressType(
contractData.instantiateInfo.instantiator
);
const adminType = getAddressType(
contractData.instantiateInfo.admin ?? ""
);
return (
<>
<LabelText label="Network">{contractData.chainId}</LabelText>
Expand All @@ -36,15 +39,26 @@ export const InstantiateInfo = ({ contractData }: InstantiateInfoProps) => {
/>
</LabelText>

{contractData.instantiateInfo.admin && (
<LabelText label="Admin Address">
<LabelText
label="Admin Address"
helperText1={
contractData.instantiateInfo.admin
? getAddressTypeText(adminType)
: undefined
}
>
{contractData.instantiateInfo.admin ? (
<ExplorerLink
type="user_address"
type={adminType}
value={contractData.instantiateInfo.admin}
canCopyWithHover
/>
</LabelText>
)}
) : (
<Text variant="body2" color="text.dark">
No Admin
</Text>
)}
</LabelText>

<Divider border="1px solid" borderColor="divider.main" />

Expand Down Expand Up @@ -78,7 +92,7 @@ export const InstantiateInfo = ({ contractData }: InstantiateInfoProps) => {
helperText1={getAddressTypeText(instantiatorType)}
>
<ExplorerLink
type="user_address"
type={instantiatorType}
value={contractData.instantiateInfo.instantiator}
canCopyWithHover
/>
Expand Down