forked from anza-xyz/agave
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] new JSON RPC API docs format (solana-labs#29772)
* feat: added api page * fix: api redirects * feat: websocket page and partials * feat: deprectated partials * feat: http method partials * fix: more deprecated partials * feat: codeblock component and styles * feat: api http methods page * feat: sidebar * refactor: proposal api links * refactor: internal linking * refactor: more internal links * refactor: internal link and note cards * refactor: local links * refactor: local links and auto save prettier * feat: added numNonVoteTransaction data details * fix: updated getRecentPrioritizationFees * fix: corrected wording * fix: version typo * fix: commitment links * fix: parsed response links * fix: dangling links * refactor: filter criteria * docs: removed jsonrpc-api.md file * fix: dangling links * style: removed whitespaces for CI * style: removed whitespace * style: fixed whitespaces
- Loading branch information
1 parent
23531fc
commit 9b27002
Showing
109 changed files
with
9,195 additions
and
5,589 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,161 @@ | ||
import React from "react"; | ||
import Link from "@docusaurus/Link"; | ||
// import clsx from "clsx"; | ||
import styles from "../src/pages/CodeDocBlock.module.css"; | ||
|
||
export function DocBlock({ children }) { | ||
return <section className={styles.DocBlock}>{children}</section>; | ||
} | ||
|
||
export function DocSideBySide({ children }) { | ||
return <section className={styles.DocSideBySide}>{children}</section>; | ||
} | ||
|
||
export function CodeParams({ children }) { | ||
return <section className={styles.CodeParams}>{children}</section>; | ||
} | ||
|
||
export function CodeSnippets({ children }) { | ||
return ( | ||
<section className={styles.CodeSnippets}> | ||
{/* <p className={styles.Heading}>Code Sample:</p> */} | ||
|
||
{children} | ||
</section> | ||
); | ||
} | ||
|
||
/* | ||
Display a single Parameter | ||
*/ | ||
export function Parameter(props) { | ||
const { | ||
name = null, | ||
type = null, | ||
required = null, | ||
optional = null, | ||
children, | ||
} = computeHeader(props); | ||
|
||
return ( | ||
<section className={styles.Parameter}> | ||
<p className={styles.ParameterHeader}> | ||
{name && name} {type && type} {required && required}{" "} | ||
{optional && optional} | ||
</p> | ||
|
||
{children} | ||
</section> | ||
); | ||
} | ||
|
||
/* | ||
Display a single Parameter's field data | ||
*/ | ||
export function Field(props) { | ||
const { | ||
name = null, | ||
type = null, | ||
values = null, | ||
required = null, | ||
defaultValue = null, | ||
optional = null, | ||
children, | ||
} = computeHeader(props); | ||
|
||
return ( | ||
<section className={styles.Field}> | ||
<p className={styles.ParameterHeader}> | ||
{name && name} {type && type} {required && required}{" "} | ||
{optional && optional} | ||
{defaultValue && defaultValue} | ||
</p> | ||
|
||
<section> | ||
{values && values} | ||
|
||
{children} | ||
</section> | ||
</section> | ||
); | ||
} | ||
|
||
/* | ||
Parse an array of string values to display | ||
*/ | ||
export function Values({ values = null }) { | ||
// format the Parameter's values | ||
if (values && Array.isArray(values) && values?.length) { | ||
values = values.map((value) => ( | ||
<code style={{ marginRight: ".5em" }} key={value}> | ||
{value} | ||
</code> | ||
)); | ||
} | ||
|
||
return ( | ||
<p style={{}}> | ||
<span className={styles.SubHeading}>Values:</span> {values} | ||
</p> | ||
); | ||
} | ||
|
||
/* | ||
Compute the formatted Parameter and Field component's header meta data | ||
*/ | ||
function computeHeader({ | ||
name = null, | ||
type = null, | ||
href = null, | ||
values = null, | ||
required = null, | ||
defaultValue = null, | ||
optional = null, | ||
children, | ||
}) { | ||
// format the Parameter's name | ||
if (name) { | ||
name = <span className={styles.ParameterName}>{name}</span>; | ||
|
||
if (href) name = <Link href={href}>{name}</Link>; | ||
} | ||
|
||
// format the Parameter's type | ||
if (type) type = <code>{type}</code>; | ||
|
||
// format the Parameter's values | ||
if (values && Array.isArray(values)) { | ||
values = values.map((value) => ( | ||
<code style={{ marginRight: ".5em" }}>{value}</code> | ||
)); | ||
} | ||
|
||
// format the `defaultValue` flag | ||
if (defaultValue) { | ||
defaultValue = ( | ||
<span className={styles.FlagItem}> | ||
Default: <code>{defaultValue.toString()}</code> | ||
</span> | ||
); | ||
} | ||
|
||
// format the `required` flag | ||
if (required) { | ||
required = <span className={styles.FlagItem}>required</span>; | ||
} | ||
// format the `optional` flag | ||
else if (optional) { | ||
optional = <span className={styles.FlagItem}>optional</span>; | ||
} | ||
|
||
return { | ||
name, | ||
type, | ||
href, | ||
values, | ||
required, | ||
defaultValue, | ||
optional, | ||
children, | ||
}; | ||
} |
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.