-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from Concordium/reading-writing-features
Reading/Writing Features
- Loading branch information
Showing
17 changed files
with
3,020 additions
and
1,153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React, { PropsWithChildren } from 'react'; | ||
|
||
type BoxProps = PropsWithChildren<{ | ||
header: string; | ||
}>; | ||
|
||
/** | ||
* A component that creates a box with a header and background/borderLine styling. | ||
*/ | ||
export default function Box(props: BoxProps) { | ||
const { children, header } = props; | ||
|
||
return ( | ||
<fieldset className="box"> | ||
<legend>{header}</legend> | ||
<div className="boxFields">{children}</div> | ||
<br /> | ||
</fieldset> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React from 'react'; | ||
|
||
function ccdScanUrl(isTestnet: boolean): string { | ||
return `https://${isTestnet ? `testnet.` : ``}ccdscan.io`; | ||
} | ||
|
||
interface TxHashLinkProps { | ||
isTestnet: boolean; | ||
txHash: string; | ||
message: string; | ||
} | ||
|
||
/** | ||
* A component that displays the CCDScan link of a transaction hash. | ||
* A message at the bottom can be used to add some custom description to the link. | ||
* If `isTestnet` is true, the testnet CCDScan link is displayed. | ||
* If `isTestnet` is false, the mainnet CCDScan link is displayed. | ||
*/ | ||
export const TxHashLink = function TxHashLink(props: TxHashLinkProps) { | ||
const { isTestnet, txHash, message } = props; | ||
|
||
return ( | ||
<> | ||
<div> | ||
Transaction hash:{' '} | ||
<a | ||
className="link" | ||
target="_blank" | ||
rel="noreferrer" | ||
href={`${ccdScanUrl(isTestnet)}/?dcount=1&dentity=transaction&dhash=${txHash}`} | ||
> | ||
{txHash} | ||
</a> | ||
</div> | ||
<br /> | ||
<div> | ||
CCDScan will take a moment to pick up the above transaction, hence the above link will work in a bit. | ||
</div> | ||
<div>{message}</div> | ||
</> | ||
); | ||
}; | ||
|
||
interface AccountLinkProps { | ||
isTestnet: boolean; | ||
account: string; | ||
} | ||
|
||
/** | ||
* A component that displays the CCDScan link to an account address. | ||
* If `isTestnet` is true, the testnet CCDScan link is displayed. | ||
* If `isTestnet` is false, the mainnet CCDScan link is displayed. | ||
*/ | ||
export const AccountLink = function AccountLink(props: AccountLinkProps) { | ||
const { isTestnet, account } = props; | ||
|
||
return ( | ||
<div> | ||
<a | ||
className="link" | ||
href={`${ccdScanUrl(isTestnet)}/?dcount=1&dentity=account&daddress=${account}`} | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
{account} | ||
</a> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.