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

Reading/Writing Features #123

Merged
merged 47 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
8cc065e
Add reading feature skeleton
DOBEN Oct 12, 2023
48f354e
Add support for input parameter when querying data from the blockchain
DOBEN Oct 12, 2023
7af8a55
Add write transaction flow
DOBEN Oct 15, 2023
6f6fa57
Remove placeholder values
DOBEN Oct 15, 2023
601a839
Use undefined instead of empty strings for defaults
DOBEN Oct 16, 2023
9361cf3
Use different entrypoint variables for read and write effects
DOBEN Oct 16, 2023
8eeea6a
Change just one connect button
DOBEN Oct 16, 2023
09a4dc8
Separate init, read, and write functions even further
DOBEN Oct 23, 2023
1e32e0f
Add write transaction outcome
DOBEN Oct 23, 2023
60e9e9d
Separate the contract name into a contract name for read, write, and …
DOBEN Oct 23, 2023
791d169
Fix schema upload
DOBEN Oct 24, 2023
341c4b6
Part 1: autofill read values from contract index
DOBEN Oct 24, 2023
f6cff46
Revised order
DOBEN Oct 24, 2023
3ca9fd0
Add automatic derive of schema, contract name, and entry point name f…
DOBEN Oct 24, 2023
d4bac6d
Add automatic derive of schema, contract name, and entry point name f…
DOBEN Oct 24, 2023
7442903
Fix edge cases
DOBEN Oct 25, 2023
4922ce4
Separate smart contract index between read and write functions
DOBEN Oct 25, 2023
69345da
Separate dropDown handling
DOBEN Oct 26, 2023
15a696f
Change input fields cCDAmount and maxEnergyExecutionCosts to number
DOBEN Oct 26, 2023
831a10b
Separate input parameter
DOBEN Oct 26, 2023
6df7edd
Improve textarea styling
DOBEN Oct 26, 2023
047be5d
Separate parsingError
DOBEN Oct 26, 2023
104f09f
Refactor
DOBEN Oct 26, 2023
004e15f
Small fixes
DOBEN Oct 27, 2023
258cd03
Use react-hook-form
DOBEN Oct 30, 2023
412a652
Use react-hook-form for read feature
DOBEN Oct 31, 2023
187d9b1
Remove old read feature
DOBEN Oct 31, 2023
1ba9993
Fix duplicate error
soerenbf Oct 31, 2023
9d70f2d
Fix linting
DOBEN Oct 31, 2023
bd1ca9c
Fix duplicated error fields
DOBEN Oct 31, 2023
836fda4
Add writeComponent
DOBEN Oct 31, 2023
9579278
Add readComponent
DOBEN Nov 1, 2023
f83d5a6
Use react-hook-form for initialization contract
DOBEN Nov 1, 2023
98bcca1
Use react-hook-form for deploy contract
DOBEN Nov 1, 2023
beecbb4
Add deployComponent
DOBEN Nov 1, 2023
ee97709
Add initComponent
DOBEN Nov 1, 2023
60747e2
Add CCDScanLinks component
DOBEN Nov 2, 2023
147cc4c
Add boxComponent
DOBEN Nov 2, 2023
89efac5
Move components into components folder
DOBEN Nov 2, 2023
709dcc9
Simplified naming
DOBEN Nov 2, 2023
e0d2735
Add onSubmit
DOBEN Nov 3, 2023
c8f8036
Address comments
DOBEN Nov 6, 2023
427672b
Address comments
DOBEN Nov 8, 2023
a14b8ea
Address comments
DOBEN Nov 8, 2023
6ae176d
Address comments
DOBEN Nov 9, 2023
a17f5fb
Address comments
DOBEN Nov 9, 2023
4ef17b4
Small fixes
DOBEN Nov 10, 2023
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
4 changes: 4 additions & 0 deletions front-end-tools/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Unreleased changes

## 3.0.0

- Add reading from smart contract and writing to smart contract feature

## 2.2.0

- Add warning box if module references in step 1 and step 2 are not the same. Add warning box if embedded schema indicates an input parameter but no input parameter is provided.
Expand Down
4 changes: 3 additions & 1 deletion front-end-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "front-end-tools",
"packageManager": "[email protected]",
"version": "2.2.0",
"version": "3.0.0",
"license": "Apache-2.0",
"engines": {
"node": ">=16.x"
Expand All @@ -15,6 +15,8 @@
"react": "^18.1.0",
"react-bootstrap": "^2.7.4",
"react-dom": "^18.1.0",
"react-hook-form": "^7.47.0",
"react-select": "^5.7.7",
"react-switch": "^7.0.0"
},
"devDependencies": {
Expand Down
1,077 changes: 86 additions & 991 deletions front-end-tools/src/Main.tsx
DOBEN marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions front-end-tools/src/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Main from './Main';
import { version } from '../package.json';

/**
* Connect to wallet, setup application state context, and render children when the wallet API is ready for use.
* Select mainnet/testnet and display WithWalletConnector component for respective network.
*/
export default function Root() {
const [isTestnet, setIsTestnet] = useState(true);
Expand Down Expand Up @@ -34,9 +34,17 @@ export default function Root() {
<div>Mainnet</div>
</div>
<br />
<WithWalletConnector network={isTestnet ? TESTNET : MAINNET}>
{(props) => <Main walletConnectionProps={props} isTestnet={isTestnet} />}
</WithWalletConnector>
{/* Changes to the network value will remove the activeConnector. We switch between components here without changing the network value. */}
{isTestnet && (
<WithWalletConnector network={TESTNET}>
{(props) => <Main walletConnectionProps={props} isTestnet={isTestnet} />}
</WithWalletConnector>
)}
{!isTestnet && (
<WithWalletConnector network={MAINNET}>
{(props) => <Main walletConnectionProps={props} isTestnet={isTestnet} />}
</WithWalletConnector>
)}
</main>
</div>
);
Expand Down
48 changes: 0 additions & 48 deletions front-end-tools/src/WalletConnectorTypeButton.tsx

This file was deleted.

18 changes: 18 additions & 0 deletions front-end-tools/src/components/Box.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-disable no-console */
import React, { PropsWithChildren } from 'react';

type BoxProps = PropsWithChildren<{
header: string;
}>;

export default function Box(props: BoxProps) {
DOBEN marked this conversation as resolved.
Show resolved Hide resolved
const { children, header } = props;

return (
<fieldset className="box">
<legend>{header}</legend>
<div className="boxFields">{children}</div>
<br />
</fieldset>
);
}
56 changes: 56 additions & 0 deletions front-end-tools/src/components/CCDScanLinks.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from 'react';

interface TxHashLinkProps {
isTestnet: boolean;
txHash: string;
message: string;
}

export const TxHashLink = function TxHashLink(props: TxHashLinkProps) {
const { isTestnet, txHash, message } = props;

return (
<>
<div>
Transaction hash:{' '}
<a
className="link"
target="_blank"
rel="noreferrer"
href={`https://${
isTestnet ? `testnet.` : ``
}ccdscan.io/?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;
}

export const AccountLink = function AccountLink(props: AccountLinkProps) {
const { isTestnet, account } = props;

return (
<div>
<a
className="link"
href={`https://${isTestnet ? `testnet.` : ``}ccdscan.io/?dcount=1&dentity=account&daddress=${account}`}
DOBEN marked this conversation as resolved.
Show resolved Hide resolved
target="_blank"
rel="noreferrer"
>
{account}
</a>
</div>
);
};
Loading