diff --git a/components/LibFuncTable/DocRowDetail.tsx b/components/LibFuncTable/DocRowDetail.tsx new file mode 100644 index 0000000..5790646 --- /dev/null +++ b/components/LibFuncTable/DocRowDetail.tsx @@ -0,0 +1,51 @@ +import cn from 'classnames' +import { MDXRemote } from 'next-mdx-remote' + +import { GITHUB_REPO_URL } from 'util/constants' + +import { Button } from 'components/ui' +import * as Doc from 'components/ui/Doc' + +const docComponents = { + h1: Doc.H1, + h2: Doc.H2, + h3: Doc.H3, + p: Doc.P, + ul: Doc.UL, + ol: Doc.OL, + li: Doc.LI, + table: Doc.Table, + th: Doc.TH, + td: Doc.TD, + a: Doc.A, + pre: Doc.Pre, +} + +const DocRowDetail = ({ mdxContent }: { mdxContent: any }) => { + return ( +
+
+ {mdxContent ? ( + + ) : ( +
+
+ This function is not yet documented. Feel free to help us + documenting it ! +
+ +
+ )} +
+
+ ) +} + +export default DocRowDetail diff --git a/components/Reference/Filters.tsx b/components/LibFuncTable/Filters.tsx similarity index 77% rename from components/Reference/Filters.tsx rename to components/LibFuncTable/Filters.tsx index 3729823..05b514b 100644 --- a/components/Reference/Filters.tsx +++ b/components/LibFuncTable/Filters.tsx @@ -10,10 +10,9 @@ const debounceTimeout = 100 // ms type Props = { onSetFilter: (columnId: string, value: string) => void - isPrecompiled?: boolean } -const Filters = ({ onSetFilter, isPrecompiled = false }: Props) => { +const Filters = ({ onSetFilter }: Props) => { const router = useRouter() const [searchKeyword, setSearchKeyword] = useState('') const [searchFilter, setSearchFilter] = useState({ @@ -23,14 +22,10 @@ const Filters = ({ onSetFilter, isPrecompiled = false }: Props) => { const filterByOptions = useMemo( () => [ - { - label: !isPrecompiled ? 'Opcode' : 'Address', - value: 'opcodeOrAddress', - }, { label: 'Name', value: 'name' }, - { label: 'Description', value: 'description' }, + { label: 'Description', value: 'shortDescription' }, ], - [isPrecompiled], + [], ) const inputRef = useRef(null) @@ -47,13 +42,6 @@ const Filters = ({ onSetFilter, isPrecompiled = false }: Props) => { setSearchFilter(option) } - const handleAltK = (event: KeyboardEvent) => { - if (event.altKey && event.key.toLowerCase() === 'k') { - inputRef.current?.focus() - inputRef.current?.value && inputRef.current.select() - } - } - // Change filter and search opcode according to query param useEffect(() => { const query = router.query @@ -66,10 +54,6 @@ const Filters = ({ onSetFilter, isPrecompiled = false }: Props) => { router.push(router) } - // Register and clean up Alt+K event listener - window.addEventListener('keydown', handleAltK) - return () => window.removeEventListener('keydown', handleAltK) - // eslint-disable-next-line react-hooks/exhaustive-deps }, [router.isReady]) @@ -93,7 +77,6 @@ const Filters = ({ onSetFilter, isPrecompiled = false }: Props) => { { setSearchKeyword(e.target.value) diff --git a/components/LibFuncTable/columns.tsx b/components/LibFuncTable/columns.tsx new file mode 100644 index 0000000..1e3093e --- /dev/null +++ b/components/LibFuncTable/columns.tsx @@ -0,0 +1,70 @@ +import { Row } from 'react-table' + +import { StackBox } from 'components/ui' + +type TableRow = Row> + +const filter = (rows: TableRow[], id: string, filterValue: string) => { + return rows.filter((row) => + row.original[id] + ?.toLocaleLowerCase() + .includes(filterValue.toLocaleLowerCase()), + ) +} + +const filterDescription = ( + rows: TableRow[], + id: string, + filterValue: string, +) => { + return rows.filter((row) => + (row.original[id] || '-') + ?.toLocaleLowerCase() + .includes(filterValue.toLocaleLowerCase()), + ) +} + +const refsRenderer = ({ value }: { value: string }) => + value ? ( + + ) : ( + '-' + ) + +const columns = [ + { + id: 'name', + Header: 'Name', + accessor: 'name', + filter, + }, + { + id: 'invokeRefs', + Header: 'Invoke Refs', + accessor: 'invokeRefs', + Cell: refsRenderer, + }, + { + id: 'resultRefs', + Header: 'Result Refs', + accessor: 'resultRefs', + Cell: refsRenderer, + }, + { + id: 'outputRefs', + Header: 'Output Refs', + accessor: 'outputRefs', + Cell: refsRenderer, + }, + { + id: 'shortDescription', + Header: 'Short Description', + accessor: (row: any) => (row.shortDescription ? row.shortDescription : '-'), + filterDescription, + }, +] + +export default columns diff --git a/components/LibFuncTable/index.tsx b/components/LibFuncTable/index.tsx new file mode 100644 index 0000000..df40e56 --- /dev/null +++ b/components/LibFuncTable/index.tsx @@ -0,0 +1,261 @@ +import { useMemo, Fragment, useRef, useState, useEffect } from 'react' + +import { + RiCheckLine, + RiLinksLine, + RiArrowUpSLine, + RiArrowDownSLine, +} from '@remixicon/react' +import cn from 'classnames' +import { useRouter } from 'next/router' +import { + useTable, + useExpanded, + useFilters, + Row, + Cell, + UseExpandedRowProps, +} from 'react-table' +import { ILibFuncDocs, ILibFuncDoc } from 'types' + +import { Button } from 'components/ui' + +import columnDefinition from './columns' +import DocRowDetail from './DocRowDetail' +import Filters from './Filters' + +const LibFuncTable = ({ docs }: { docs: ILibFuncDocs }) => { + const router = useRouter() + + const data = useMemo(() => docs, [docs]) + const columns = useMemo(() => columnDefinition, []) + + // FIXME: See: https://github.com/tannerlinsley/react-table/issues/3064 + // @ts-ignore: Waiting for 8.x of react-table to have better types + const table = useTable({ columns, data }, useExpanded, useFilters) + + const { + getTableProps, + getTableBodyProps, + headerGroups, + rows, + prepareRow, + // @ts-ignore: Waiting for 8.x of react-table to have better types + toggleAllRowsExpanded, + // @ts-ignore: Waiting for 8.x of react-table to have better types + isAllRowsExpanded, + // @ts-ignore: Waiting for 8.x of react-table to have better types + setFilter, + } = table + + const rowRefs = useRef([]) + const [focusedLibFuncIndex, setFocusedLibFuncIndex] = useState< + number | null + >() + + const [clickedPermalinks, setClickedPermalinks] = useState<{ + [key: string]: boolean + }>(docs.reduce((state, current) => ({ ...state, [current.name]: false }), {})) + + const handlePermalink = (libFuncName: string) => { + const pageUrl = `${window.location.origin}${window.location.pathname}` + const permalink = `${pageUrl}#${libFuncName}` + + navigator.clipboard.writeText(permalink) + + // make the permalinks temporary "clicked" to show a specific icon/message + setClickedPermalinks((previous) => ({ + ...previous, + [libFuncName]: true, + })) + setTimeout( + () => + setClickedPermalinks((previous) => ({ + ...previous, + [libFuncName]: false, + })), + 1000, + ) + } + + // Focus and expand anchored reference + useEffect(() => { + if (docs && rowRefs?.current) { + const libFuncIndex = docs.findIndex((item) => { + const re = new RegExp(`#${item.name}`, 'gi') + return router.asPath.match(re) + }) + + if (libFuncIndex >= 0) { + setFocusedLibFuncIndex(libFuncIndex) + setTimeout(() => { + if (rowRefs.current[libFuncIndex]) { + rowRefs.current[libFuncIndex].scrollIntoView({ behavior: 'smooth' }) + } + }, 300) + } + } + }, [docs, router.asPath]) + + const renderExpandButton = () => { + return ( +
+ +
+ ) + } + + if (docs.length === 0) { + return
No core libfunc yet :-/
+ } + + const renderHeader = () => { + return ( + + {headerGroups.map((headerGroup) => ( + + {headerGroup.headers.map((column: any, index: number) => { + const isLastColumn = index + 1 === headerGroup.headers.length + + return ( + +
+ {column.render('Header')} + {isLastColumn && renderExpandButton()} +
+ + ) + })} + + ))} + + ) + } + + const renderPermalinkCell = ( + listFuncName: string, + cell: Cell, + ) => { + return ( +
+ {clickedPermalinks[listFuncName] ? ( + <> + + copied ! + + ) : ( + <> + { + handlePermalink(listFuncName) + e.stopPropagation() + }} + /> + {cell.render('Cell')} + + )} +
+ ) + } + + const renderBody = () => { + return ( + + {rows.map((row: Row) => { + prepareRow(row) + + const expandedRow = row as Row & + UseExpandedRowProps + const rowId = parseInt(row.id) + const rowObject = row.original + const isExpanded = + expandedRow.isExpanded || focusedLibFuncIndex === rowId + + return ( + + { + if (el) { + rowRefs.current[row.index] = el + } + }} + className={cn('border-t cursor-pointer', { + 'border-gray-200 dark:border-black-500 hover:bg-gray-100 dark:hover:bg-black-600': + !isExpanded, + 'border-b border-indigo-100 dark:border-black-500': + isExpanded, + })} + // @ts-ignore: Waiting for 8.x of react-table to have better types + onClick={() => row.toggleRowExpanded()} + style={{ scrollMarginTop: '96px' }} + > + {row.cells.map((cell, cellIndex) => ( + + {cellIndex === 0 + ? renderPermalinkCell(rowObject.name, cell) + : cell.render('Cell')} + + ))} + + + {isExpanded ? ( + + + + + + ) : null} + + ) + })} + + ) + } + + return ( + <> +
+ +
+ + {renderHeader()} + {renderBody()} +
+ + ) +} + +export default LibFuncTable diff --git a/components/Reference/columns.tsx b/components/Reference/columns.tsx deleted file mode 100644 index dfa56f1..0000000 --- a/components/Reference/columns.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { Row } from 'react-table' - -import { StackBox } from 'components/ui' - -// Possible fields are defined in `Opcodes.json` -type OpcodeRow = Row> - -const filter = (rows: OpcodeRow[], id: string, filterValue: string) => { - return rows.filter((row) => - row.original[id] - ?.toLocaleLowerCase() - .includes(filterValue.toLocaleLowerCase()), - ) -} - -const columns = (isPrecompiled: boolean) => [ - { - Header: !isPrecompiled ? 'Opcode' : 'Address', - accessor: 'opcodeOrAddress', - className: !isPrecompiled ? 'uppercase' : undefined, - filter, - width: 48, - }, - { - Header: 'Name', - accessor: 'name', - filter, - width: 80, - }, - { - Header: 'Minimum Gas', - accessor: 'minimumFee', - width: 50, - }, - { - Header: !isPrecompiled ? 'Stack Input' : 'Input', - accessor: 'input', - Cell: ({ value }: { value: string }) => ( - - ), - width: 200, - className: 'hidden lg:table-cell', - }, - { - Header: !isPrecompiled ? 'Stack Output' : 'Output', - accessor: 'output', - Cell: ({ value }: { value: string }) => ( - - ), - width: 100, - className: 'hidden lg:table-cell', - }, - { - Header: 'Description', - accessor: 'description', - className: 'hidden md:table-cell', - }, -] - -export default columns diff --git a/components/layouts/Nav.tsx b/components/layouts/Nav.tsx index 9dbb104..e53d40a 100644 --- a/components/layouts/Nav.tsx +++ b/components/layouts/Nav.tsx @@ -25,7 +25,9 @@ const Nav = () => { '-left-full', )} style={{ top: 56 }} - > + > + Sierra LibFuncs +
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md deleted file mode 100644 index 6cc4ad4..0000000 --- a/docs/ARCHITECTURE.md +++ /dev/null @@ -1,20 +0,0 @@ -# Architecture - -evm.codes is a [NextJS](https://nextjs.org/) and [TailwindCSS](https://tailwindcss.com/) backed React application. Currently, it does not have any backend, so everything runs in the browser. It's written in TypeScript and uses the latest ES6 language features. - -Below is the structure of the app: - -``` -app -├── components - React components used throughout the application -|───── layouts - Layout components -|───── ui - Reusable UI components -├── context - Shared React Contexts for the application-wide state -├── docs - Documentation and MDX files used in the reference table -├── lib - Common libraries and reusable React hooks -├── pages - NextJS pages and server-side API routes -├── public - Public static assets -├── styles - Global CSS styles -├── types - TypeScript type definitions -└── utils - Utility methods -``` \ No newline at end of file diff --git a/docs/HOWTO.md b/docs/HOWTO.md new file mode 100644 index 0000000..462f158 --- /dev/null +++ b/docs/HOWTO.md @@ -0,0 +1,20 @@ +# Documentation How-To + +## Sierra LibFuncs + +Each Sierra libfunc is described in its own mdx file, where the filename is the name of the libfunc. For example,`alloc_local.mdx` for the `alloc_local` libfunc. + +Each mdx file is composed of: + +- a header of metadata with the following shape: + +``` +--- +shortDescription: A short description of the function +invokeRefs: A string of invokeRefs separated by a | (like "[0] | [1]") +resultRefs: see invokeRefs +ouputRefs: see invokeRefs +--- +``` + +- a content which is the body of the mdx file. diff --git a/docs/libfuncs/alloc_local.mdx b/docs/libfuncs/alloc_local.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/alloc_local.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/array_append.mdx b/docs/libfuncs/array_append.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/array_append.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/array_get.mdx b/docs/libfuncs/array_get.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/array_get.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/array_len.mdx b/docs/libfuncs/array_len.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/array_len.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/array_new.mdx b/docs/libfuncs/array_new.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/array_new.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/array_pop_front.mdx b/docs/libfuncs/array_pop_front.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/array_pop_front.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/array_snapshot_pop_front.mdx b/docs/libfuncs/array_snapshot_pop_front.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/array_snapshot_pop_front.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/bitwise.mdx b/docs/libfuncs/bitwise.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/bitwise.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/bool_and_impl.mdx b/docs/libfuncs/bool_and_impl.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/bool_and_impl.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/bool_not_impl.mdx b/docs/libfuncs/bool_not_impl.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/bool_not_impl.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/bool_or_impl.mdx b/docs/libfuncs/bool_or_impl.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/bool_or_impl.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/bool_to_felt252.mdx b/docs/libfuncs/bool_to_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/bool_to_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/bool_xor_impl.mdx b/docs/libfuncs/bool_xor_impl.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/bool_xor_impl.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/branch_align.mdx b/docs/libfuncs/branch_align.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/branch_align.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/call_contract_syscall.mdx b/docs/libfuncs/call_contract_syscall.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/call_contract_syscall.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/class_hash_const.mdx b/docs/libfuncs/class_hash_const.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/class_hash_const.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/class_hash_to_felt252.mdx b/docs/libfuncs/class_hash_to_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/class_hash_to_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/class_hash_try_from_felt252.mdx b/docs/libfuncs/class_hash_try_from_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/class_hash_try_from_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/contract_address_const.mdx b/docs/libfuncs/contract_address_const.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/contract_address_const.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/contract_address_to_felt252.mdx b/docs/libfuncs/contract_address_to_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/contract_address_to_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/contract_address_try_from_felt252.mdx b/docs/libfuncs/contract_address_try_from_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/contract_address_try_from_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/deploy_syscall.mdx b/docs/libfuncs/deploy_syscall.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/deploy_syscall.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/disable_ap_tracking.mdx b/docs/libfuncs/disable_ap_tracking.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/disable_ap_tracking.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/drop.mdx b/docs/libfuncs/drop.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/drop.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/dup.mdx b/docs/libfuncs/dup.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/dup.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/ec_neg.mdx b/docs/libfuncs/ec_neg.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/ec_neg.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/ec_point_from_x_nz.mdx b/docs/libfuncs/ec_point_from_x_nz.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/ec_point_from_x_nz.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/ec_point_is_zero.mdx b/docs/libfuncs/ec_point_is_zero.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/ec_point_is_zero.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/ec_point_try_new_nz.mdx b/docs/libfuncs/ec_point_try_new_nz.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/ec_point_try_new_nz.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/ec_point_unwrap.mdx b/docs/libfuncs/ec_point_unwrap.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/ec_point_unwrap.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/ec_point_zero.mdx b/docs/libfuncs/ec_point_zero.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/ec_point_zero.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/ec_state_add.mdx b/docs/libfuncs/ec_state_add.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/ec_state_add.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/ec_state_add_mul.mdx b/docs/libfuncs/ec_state_add_mul.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/ec_state_add_mul.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/ec_state_init.mdx b/docs/libfuncs/ec_state_init.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/ec_state_init.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/ec_state_try_finalize_nz.mdx b/docs/libfuncs/ec_state_try_finalize_nz.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/ec_state_try_finalize_nz.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/emit_event_syscall.mdx b/docs/libfuncs/emit_event_syscall.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/emit_event_syscall.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/enable_ap_tracking.mdx b/docs/libfuncs/enable_ap_tracking.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/enable_ap_tracking.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/enum_init.mdx b/docs/libfuncs/enum_init.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/enum_init.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/enum_match.mdx b/docs/libfuncs/enum_match.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/enum_match.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/enum_snapshot_match.mdx b/docs/libfuncs/enum_snapshot_match.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/enum_snapshot_match.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/felt252_add.mdx b/docs/libfuncs/felt252_add.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/felt252_add.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/felt252_const.mdx b/docs/libfuncs/felt252_const.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/felt252_const.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/felt252_dict_entry_finalize.mdx b/docs/libfuncs/felt252_dict_entry_finalize.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/felt252_dict_entry_finalize.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/felt252_dict_entry_get.mdx b/docs/libfuncs/felt252_dict_entry_get.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/felt252_dict_entry_get.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/felt252_dict_new.mdx b/docs/libfuncs/felt252_dict_new.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/felt252_dict_new.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/felt252_dict_squash.mdx b/docs/libfuncs/felt252_dict_squash.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/felt252_dict_squash.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/felt252_div.mdx b/docs/libfuncs/felt252_div.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/felt252_div.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/felt252_is_zero.mdx b/docs/libfuncs/felt252_is_zero.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/felt252_is_zero.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/felt252_mul.mdx b/docs/libfuncs/felt252_mul.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/felt252_mul.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/felt252_sub.mdx b/docs/libfuncs/felt252_sub.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/felt252_sub.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/finalize_locals.mdx b/docs/libfuncs/finalize_locals.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/finalize_locals.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/function_call.mdx b/docs/libfuncs/function_call.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/function_call.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/get_builtin_costs.mdx b/docs/libfuncs/get_builtin_costs.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/get_builtin_costs.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/get_execution_info_syscall.mdx b/docs/libfuncs/get_execution_info_syscall.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/get_execution_info_syscall.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/into_box.mdx b/docs/libfuncs/into_box.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/into_box.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/jump.mdx b/docs/libfuncs/jump.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/jump.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/library_call_syscall.mdx b/docs/libfuncs/library_call_syscall.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/library_call_syscall.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/match_nullable.mdx b/docs/libfuncs/match_nullable.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/match_nullable.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/null.mdx b/docs/libfuncs/null.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/null.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/nullable_from_box.mdx b/docs/libfuncs/nullable_from_box.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/nullable_from_box.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/pedersen.mdx b/docs/libfuncs/pedersen.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/pedersen.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/rename.mdx b/docs/libfuncs/rename.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/rename.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/replace_class_syscall.mdx b/docs/libfuncs/replace_class_syscall.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/replace_class_syscall.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/revoke_ap_tracking.mdx b/docs/libfuncs/revoke_ap_tracking.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/revoke_ap_tracking.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/send_message_to_l1_syscall.mdx b/docs/libfuncs/send_message_to_l1_syscall.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/send_message_to_l1_syscall.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/snapshot_take.mdx b/docs/libfuncs/snapshot_take.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/snapshot_take.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/storage_address_from_base.mdx b/docs/libfuncs/storage_address_from_base.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/storage_address_from_base.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/storage_address_from_base_and_offset.mdx b/docs/libfuncs/storage_address_from_base_and_offset.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/storage_address_from_base_and_offset.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/storage_address_to_felt252.mdx b/docs/libfuncs/storage_address_to_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/storage_address_to_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/storage_address_try_from_felt252.mdx b/docs/libfuncs/storage_address_try_from_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/storage_address_try_from_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/storage_base_address_const.mdx b/docs/libfuncs/storage_base_address_const.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/storage_base_address_const.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/storage_base_address_from_felt252.mdx b/docs/libfuncs/storage_base_address_from_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/storage_base_address_from_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/storage_read_syscall.mdx b/docs/libfuncs/storage_read_syscall.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/storage_read_syscall.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/storage_write_syscall.mdx b/docs/libfuncs/storage_write_syscall.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/storage_write_syscall.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/store_local.mdx b/docs/libfuncs/store_local.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/store_local.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/store_temp.mdx b/docs/libfuncs/store_temp.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/store_temp.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/struct_construct.mdx b/docs/libfuncs/struct_construct.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/struct_construct.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/struct_deconstruct.mdx b/docs/libfuncs/struct_deconstruct.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/struct_deconstruct.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/struct_snapshot_deconstruct.mdx b/docs/libfuncs/struct_snapshot_deconstruct.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/struct_snapshot_deconstruct.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u128_const.mdx b/docs/libfuncs/u128_const.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u128_const.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u128_eq.mdx b/docs/libfuncs/u128_eq.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u128_eq.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u128_guarantee_mul.mdx b/docs/libfuncs/u128_guarantee_mul.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u128_guarantee_mul.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u128_is_zero.mdx b/docs/libfuncs/u128_is_zero.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u128_is_zero.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u128_mul_guarantee_verify.mdx b/docs/libfuncs/u128_mul_guarantee_verify.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u128_mul_guarantee_verify.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u128_overflowing_add.mdx b/docs/libfuncs/u128_overflowing_add.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u128_overflowing_add.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u128_overflowing_sub.mdx b/docs/libfuncs/u128_overflowing_sub.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u128_overflowing_sub.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u128_safe_divmod.mdx b/docs/libfuncs/u128_safe_divmod.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u128_safe_divmod.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u128_to_felt252.mdx b/docs/libfuncs/u128_to_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u128_to_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u128s_from_felt252.mdx b/docs/libfuncs/u128s_from_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u128s_from_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u16_const.mdx b/docs/libfuncs/u16_const.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u16_const.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u16_eq.mdx b/docs/libfuncs/u16_eq.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u16_eq.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u16_is_zero.mdx b/docs/libfuncs/u16_is_zero.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u16_is_zero.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u16_overflowing_add.mdx b/docs/libfuncs/u16_overflowing_add.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u16_overflowing_add.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u16_overflowing_sub.mdx b/docs/libfuncs/u16_overflowing_sub.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u16_overflowing_sub.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u16_safe_divmod.mdx b/docs/libfuncs/u16_safe_divmod.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u16_safe_divmod.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u16_to_felt252.mdx b/docs/libfuncs/u16_to_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u16_to_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u16_try_from_felt252.mdx b/docs/libfuncs/u16_try_from_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u16_try_from_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u16_wide_mul.mdx b/docs/libfuncs/u16_wide_mul.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u16_wide_mul.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u32_const.mdx b/docs/libfuncs/u32_const.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u32_const.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u32_eq.mdx b/docs/libfuncs/u32_eq.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u32_eq.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u32_is_zero.mdx b/docs/libfuncs/u32_is_zero.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u32_is_zero.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u32_overflowing_add.mdx b/docs/libfuncs/u32_overflowing_add.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u32_overflowing_add.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u32_overflowing_sub.mdx b/docs/libfuncs/u32_overflowing_sub.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u32_overflowing_sub.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u32_safe_divmod.mdx b/docs/libfuncs/u32_safe_divmod.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u32_safe_divmod.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u32_to_felt252.mdx b/docs/libfuncs/u32_to_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u32_to_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u32_try_from_felt252.mdx b/docs/libfuncs/u32_try_from_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u32_try_from_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u32_wide_mul.mdx b/docs/libfuncs/u32_wide_mul.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u32_wide_mul.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u64_const.mdx b/docs/libfuncs/u64_const.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u64_const.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u64_eq.mdx b/docs/libfuncs/u64_eq.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u64_eq.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u64_is_zero.mdx b/docs/libfuncs/u64_is_zero.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u64_is_zero.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u64_overflowing_add.mdx b/docs/libfuncs/u64_overflowing_add.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u64_overflowing_add.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u64_overflowing_sub.mdx b/docs/libfuncs/u64_overflowing_sub.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u64_overflowing_sub.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u64_safe_divmod.mdx b/docs/libfuncs/u64_safe_divmod.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u64_safe_divmod.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u64_to_felt252.mdx b/docs/libfuncs/u64_to_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u64_to_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u64_try_from_felt252.mdx b/docs/libfuncs/u64_try_from_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u64_try_from_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u64_wide_mul.mdx b/docs/libfuncs/u64_wide_mul.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u64_wide_mul.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u8_const.mdx b/docs/libfuncs/u8_const.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u8_const.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u8_eq.mdx b/docs/libfuncs/u8_eq.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u8_eq.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u8_is_zero.mdx b/docs/libfuncs/u8_is_zero.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u8_is_zero.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u8_overflowing_add.mdx b/docs/libfuncs/u8_overflowing_add.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u8_overflowing_add.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u8_overflowing_sub.mdx b/docs/libfuncs/u8_overflowing_sub.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u8_overflowing_sub.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u8_safe_divmod.mdx b/docs/libfuncs/u8_safe_divmod.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u8_safe_divmod.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u8_to_felt252.mdx b/docs/libfuncs/u8_to_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u8_to_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u8_try_from_felt252.mdx b/docs/libfuncs/u8_try_from_felt252.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u8_try_from_felt252.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/u8_wide_mul.mdx b/docs/libfuncs/u8_wide_mul.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/u8_wide_mul.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/unbox.mdx b/docs/libfuncs/unbox.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/unbox.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/unwrap_non_zero.mdx b/docs/libfuncs/unwrap_non_zero.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/unwrap_non_zero.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/withdraw_gas.mdx b/docs/libfuncs/withdraw_gas.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/withdraw_gas.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/docs/libfuncs/withdraw_gas_all.mdx b/docs/libfuncs/withdraw_gas_all.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/docs/libfuncs/withdraw_gas_all.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/pages/libfuncs.tsx b/pages/libfuncs.tsx new file mode 100644 index 0000000..2c8fb48 --- /dev/null +++ b/pages/libfuncs.tsx @@ -0,0 +1,91 @@ +import fs from 'fs' +import path from 'path' + +import matter from 'gray-matter' +import type { NextPage } from 'next' +import getConfig from 'next/config' +import Head from 'next/head' +import { serialize } from 'next-mdx-remote/serialize' +import { ILibFuncDocs } from 'types' + +import ContributeBox from 'components/ContributeBox' +import HomeLayout from 'components/layouts/Home' +import LibFuncTable from 'components/LibFuncTable' +import { H1, Container } from 'components/ui' + +const { serverRuntimeConfig } = getConfig() + +const LibFuncPage = ({ libFuncDocs }: { libFuncDocs: ILibFuncDocs }) => { + return ( + <> + + + + + + +

Sierra LibFuncs Interactive Reference

+
+ +
+ + + +
+ +
+ +
+ + ) +} + +LibFuncPage.getLayout = function getLayout(page: NextPage) { + return {page} +} + +export const getStaticProps = async () => { + const docsPath = path.join(serverRuntimeConfig.APP_ROOT, 'docs/libfuncs') + const docs = fs.readdirSync(docsPath) + + const libFuncDocs: ILibFuncDocs = [] + + await Promise.all( + docs.map(async (docFile) => { + const docFileInfo = fs.statSync(path.join(docsPath, docFile)) + const libFuncName = path.parse(docFile).name.toLowerCase() + + try { + if (docFileInfo.isFile()) { + const mdxFileContent = fs.readFileSync( + path.join(docsPath, docFile), + 'utf-8', + ) + const { data: metadata, content } = matter(mdxFileContent) + + libFuncDocs.push({ + name: libFuncName, + shortDescription: metadata['shortDescription'] || null, + invokeRefs: metadata['invokeRefs'] || null, + resultRefs: metadata['resultRefs'] || null, + outputRefs: metadata['outputRefs'] || null, + mdxDescription: + content.length > 0 ? await serialize(content) : null, + }) + } + } catch (error) { + console.debug("Couldn't read the Markdown doc for the opcode", error) + } + }), + ) + return { + props: { + libFuncDocs, + }, + } +} + +export default LibFuncPage diff --git a/tools/generate_libfuncs/libfuncs.json b/tools/generate_libfuncs/libfuncs.json new file mode 100644 index 0000000..75c78f0 --- /dev/null +++ b/tools/generate_libfuncs/libfuncs.json @@ -0,0 +1,133 @@ +{ + "allowed_libfuncs": [ + "alloc_local", + "array_append", + "array_get", + "array_len", + "array_new", + "array_pop_front", + "array_snapshot_pop_front", + "bitwise", + "bool_and_impl", + "bool_not_impl", + "bool_or_impl", + "bool_to_felt252", + "bool_xor_impl", + "branch_align", + "call_contract_syscall", + "class_hash_const", + "class_hash_to_felt252", + "class_hash_try_from_felt252", + "contract_address_const", + "contract_address_to_felt252", + "contract_address_try_from_felt252", + "deploy_syscall", + "disable_ap_tracking", + "drop", + "dup", + "ec_neg", + "ec_point_from_x_nz", + "ec_point_is_zero", + "ec_point_try_new_nz", + "ec_point_unwrap", + "ec_point_zero", + "ec_state_add", + "ec_state_add_mul", + "ec_state_init", + "ec_state_try_finalize_nz", + "emit_event_syscall", + "enable_ap_tracking", + "enum_init", + "enum_match", + "enum_snapshot_match", + "felt252_add", + "felt252_const", + "felt252_dict_entry_finalize", + "felt252_dict_entry_get", + "felt252_dict_new", + "felt252_dict_squash", + "felt252_div", + "felt252_is_zero", + "felt252_mul", + "felt252_sub", + "finalize_locals", + "function_call", + "get_builtin_costs", + "get_execution_info_syscall", + "into_box", + "jump", + "library_call_syscall", + "match_nullable", + "null", + "nullable_from_box", + "pedersen", + "rename", + "replace_class_syscall", + "revoke_ap_tracking", + "send_message_to_l1_syscall", + "snapshot_take", + "storage_address_from_base", + "storage_address_from_base_and_offset", + "storage_address_to_felt252", + "storage_address_try_from_felt252", + "storage_base_address_const", + "storage_base_address_from_felt252", + "storage_read_syscall", + "storage_write_syscall", + "store_local", + "store_temp", + "struct_construct", + "struct_deconstruct", + "struct_snapshot_deconstruct", + "u128_const", + "u128_eq", + "u128_is_zero", + "u128_overflowing_add", + "u128_overflowing_sub", + "u128_safe_divmod", + "u128_to_felt252", + "u128_guarantee_mul", + "u128_mul_guarantee_verify", + "u128s_from_felt252", + "u16_const", + "u16_eq", + "u16_is_zero", + "u16_overflowing_add", + "u16_overflowing_sub", + "u16_safe_divmod", + "u16_to_felt252", + "u16_try_from_felt252", + "u16_wide_mul", + "u32_const", + "u32_eq", + "u32_is_zero", + "u32_overflowing_add", + "u32_overflowing_sub", + "u32_safe_divmod", + "u32_to_felt252", + "u32_try_from_felt252", + "u32_wide_mul", + "u64_const", + "u64_eq", + "u64_is_zero", + "u64_overflowing_add", + "u64_overflowing_sub", + "u64_safe_divmod", + "u64_to_felt252", + "u64_try_from_felt252", + "u64_wide_mul", + "u8_const", + "u8_eq", + "u8_is_zero", + "u8_overflowing_add", + "u8_overflowing_sub", + "u8_safe_divmod", + "u8_to_felt252", + "u8_try_from_felt252", + "u8_wide_mul", + "unbox", + "unwrap_non_zero", + "withdraw_gas", + "withdraw_gas_all" + ] +} diff --git a/tools/generate_libfuncs/main.js b/tools/generate_libfuncs/main.js new file mode 100644 index 0000000..33b379e --- /dev/null +++ b/tools/generate_libfuncs/main.js @@ -0,0 +1,18 @@ +/* eslint-disable */ +const fs = require('fs') +const path = require('path') + +const libFuncDocDir = path.normalize( + path.join(__dirname, '..', '..', 'docs', 'libfuncs'), +) +const libfuncList = require('./libfuncs.json') +const template = fs.readFileSync(path.join(__dirname, 'template.mdx'), 'utf8') + +libfuncList.allowed_libfuncs.forEach((f) => { + const filePath = path.join(libFuncDocDir, `${f}.mdx`) + + if (!fs.existsSync(filePath)) { + fs.writeFileSync(filePath, template) + console.log(`new file for [${f}]`) + } +}) diff --git a/tools/generate_libfuncs/template.mdx b/tools/generate_libfuncs/template.mdx new file mode 100644 index 0000000..199b40b --- /dev/null +++ b/tools/generate_libfuncs/template.mdx @@ -0,0 +1,6 @@ +--- +shortDescription: +invokeRefs: +resultRefs: +ouputRefs: +--- diff --git a/types/index.ts b/types/index.ts index 5d3d787..04bc586 100644 --- a/types/index.ts +++ b/types/index.ts @@ -68,6 +68,17 @@ export interface IChain { name: string } +export interface ILibFuncDoc { + name: string + shortDescription: string + invokeRefs: string + resultRefs: string + outputRefs: string + mdxDescription: any +} + +export type ILibFuncDocs = Array + export interface IDocMeta { fork: string group: string