-
Notifications
You must be signed in to change notification settings - Fork 25
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 #1179 from kadena-community/feat/graph-client/esti…
…mate-gas-limit-clean [@kadena/graph] , [@kadena/graph-client] Estimate transaction gas limit (Feat)
- Loading branch information
Showing
28 changed files
with
303 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@kadena/graph': patch | ||
--- | ||
|
||
Added gas estimation query and adjusted folder structure for devnet files |
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,6 @@ | ||
--- | ||
'@kadena/graph-client': patch | ||
--- | ||
|
||
Created gas estimation page and ajusted header component to incorporate option | ||
for gas. Also added necessary graph references to consume the endpoint |
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
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
66 changes: 66 additions & 0 deletions
66
packages/apps/graph-client/src/pages/gas/estimation/index.tsx
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,66 @@ | ||
import { useEstimateGasLimitQuery } from '@/__generated__/sdk'; | ||
import Loader from '@/components/Common/loader/loader'; | ||
import { mainStyle } from '@/components/Common/main/styles.css'; | ||
import { ErrorBox } from '@/components/error-box/error-box'; | ||
import routes from '@/constants/routes'; | ||
import { Box, Breadcrumbs, Table } from '@kadena/react-ui'; | ||
import { useRouter } from 'next/router'; | ||
import React from 'react'; | ||
|
||
const GasEstimation: React.FC = () => { | ||
const router = useRouter(); | ||
const { cmd, hash, sigs } = router.query; | ||
|
||
const cmdString = cmd as string; | ||
const hashString = hash as string; | ||
const sigsString = sigs as string; | ||
const sigsArray = sigsString ? sigsString.split(',') : []; | ||
|
||
const { loading, data, error } = useEstimateGasLimitQuery({ | ||
variables: { | ||
transaction: { cmd: cmdString, hash: hashString, sigs: sigsArray }, | ||
}, | ||
}); | ||
|
||
return ( | ||
<div style={{ padding: '0 50px 30px 50px' }}> | ||
<Breadcrumbs.Root> | ||
<Breadcrumbs.Item href={`${routes.HOME}`}>Home</Breadcrumbs.Item> | ||
<Breadcrumbs.Item>Gas Estimation</Breadcrumbs.Item> | ||
</Breadcrumbs.Root> | ||
|
||
<Box marginBottom="$8" /> | ||
|
||
<main className={mainStyle}> | ||
<div> | ||
{loading && ( | ||
<div style={{ display: 'flex', alignItems: 'center' }}> | ||
<Loader /> <span>Waiting for gas estimation...</span> | ||
</div> | ||
)} | ||
{error && <ErrorBox error={error} />} | ||
<Table.Root wordBreak="break-all"> | ||
<Table.Head> | ||
<Table.Tr> | ||
<Table.Th>Label</Table.Th> | ||
<Table.Th>Value</Table.Th> | ||
</Table.Tr> | ||
</Table.Head> | ||
<Table.Body> | ||
<Table.Tr> | ||
<Table.Td>Cmd</Table.Td> | ||
<Table.Td>{cmdString}</Table.Td> | ||
</Table.Tr> | ||
<Table.Tr> | ||
<Table.Td>Gas Estimate</Table.Td> | ||
<Table.Td>{data?.gasLimitEstimate}</Table.Td> | ||
</Table.Tr> | ||
</Table.Body> | ||
</Table.Root> | ||
</div> | ||
</main> | ||
</div> | ||
); | ||
}; | ||
|
||
export default GasEstimation; |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ges/apps/graph/src/scripts/devnet/file.ts → .../apps/graph/src/devnet/simulation/file.ts
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
4 changes: 2 additions & 2 deletions
4
...es/apps/graph/src/scripts/devnet/index.ts → ...apps/graph/src/devnet/simulation/index.ts
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
Oops, something went wrong.