1.9.1 • Published 9 months ago
@avalabs/vm-parser v1.9.1
Supported VMs
- MoveVM
Getting Started
npm install @avalabs/vm-parser
# or
yarn add @avalabs/vm-parser
# or
pnpm add @avalabs/vm-parser
Overview
// 1. Import modules.
import { createMoveVmConfig, DataDisplayFormat } from '@avalabs/vm-parser';
import {
Card,
CardTitle,
CardContent,
Chip,
TableContainer,
Table,
TableBody,
TableRow,
TableCell,
} from 'some-ui-library';
import useSWR from 'swr'; // Or your preferred data fetching library
const MOVE_RPC_URL =
'https://seed-node1-rpc.movementlabs.xyz/ext/bc/2gLyawqthdiyrJktJmdnDAb1XVc6xwJXU6iJKu3Uwj21F2mXAK/rpc';
// 2. Set up your config
const moveVmConfig = createMoveVmConfig(MOVE_RPC_URL);
const TransactionDetails = ({ txId }: { txId: string }) => {
// 2. Get the data from the config's `getPageData` function
const { data } = useSWR(txId, moveVmConfig.transactionDetails.getPageData);
// 3. Display the data dynamically based on the config's displayFormat.
return (
<>
{moveVmConfig.displayFormat.map(({ sectionTitle, fields }) => (
<Card>
<CardTitle>{sectionTitle}</CardTitle>
<CardContent>
<TableContainer>
<Table>
<TableBody>
{fields.map(({ name, displayValue, displayFormat }) => (
<TableRow>
<TableCell>{field.name}</TableCell>
<TableCell>
/* Display the field differently depending on its display formatter */
{field.displayFormat === DataDisplayFormat.CHIP ? (
<Chip>{field.displayValue}</Chip>
) : field.displayFormat === DataDisplayFormat.DATETIME ? (
new Date(field.displayValue).toLocaleString()
) : (
fields.displayValue
)}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</CardContent>
</Card>
))}
</>
);
};
0.0.0-open-source-status-20230829181550
9 months ago
1.9.1
9 months ago
0.0.0-repo-tweaks-20230829172510
9 months ago
1.9.0
9 months ago
0.0.0-test-changset-flow-20230817085501
9 months ago
0.0.0-test-changset-flow-20230817085340
9 months ago
0.0.0-linting-20230817084034
9 months ago
0.0.0-linting-20230817083855
9 months ago
0.0.0-linting-20230817083631
9 months ago
0.0.0-linting-20230817083508
9 months ago
0.0.0-20230817083324
9 months ago
0.0.0-linting-20230817082517
9 months ago
0.0.0-linting-20230817082337
9 months ago
0.0.0-linting-20230817082250
9 months ago
0.0.0-linting-20230817082144
9 months ago
0.0.0-linting-20230817081606
9 months ago
0.0.0-linting-20230817080811
9 months ago
0.0.0-linting-20230817080707
9 months ago
0.0.0-linting-20230817075011
9 months ago
0.0.0-canary-release-ci-2-20230817063155
9 months ago
0.0.0-bulbasaur-20230817061942
9 months ago
0.0.0-canary-release-ci-20230817055529
9 months ago
1.8.0-test-canary-2.0
9 months ago
1.7.0
9 months ago
1.7.0-next.0
9 months ago
1.6.0
9 months ago
1.5.0
9 months ago
1.4.0
9 months ago
1.3.0
9 months ago
1.2.0
9 months ago
1.1.0
9 months ago