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

wip: added multichain api methods for test #1683

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions src/components/CustomReferencePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useLocation } from "@docusaurus/router";
import { prepareLinkItems, MM_REF_PATH } from '@site/src/plugins/plugin-json-rpc';
import styles from "./styles.module.css";
const sidebar = require("../../../wallet-sidebar.js");
import AdmonitionWrapper from '@site/src/theme/Admonition';

function transformItems(items, dynamicItems) {
return items.map(item => {
Expand Down Expand Up @@ -41,6 +42,12 @@ function transformItems(items, dynamicItems) {
});
}

const NoteMsg = () => (
<AdmonitionWrapper type="note" title="note">
<p>MetaMask doesn't support session IDs.</p>
</AdmonitionWrapper>
);

const CustomReferencePage = (props) => {
const customData = props.route.customData;
const { pathname } = useLocation();
Expand All @@ -61,6 +68,7 @@ const CustomReferencePage = (props) => {
<ParserOpenRPC
network={customData.networkName}
method={customData.name}
extraContent={<NoteMsg />}
/>
</div>
</div>
Expand Down
11 changes: 6 additions & 5 deletions src/components/ParserOpenRPC/DetailsBox/RenderParams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ const getRefSchemaFromComponents = (initRef, components) => {
return components[ref];
};

const renderSchema = (schemaItem, schemas, name) => {
const renderSchema = (schemaItem, schemas, name, mainDescr = "") => {
if (!schemaItem) return <div>Invalid schema</div>;

const resolveRef = (ref) => {
const mainDescr = schemaItem.description;
const newSchema = getRefSchemaFromComponents(ref, schemas);
return renderSchema(newSchema, schemas, name);
return renderSchema(newSchema, schemas, name, mainDescr);
};

if (schemaItem?.schema?.$ref) return resolveRef(schemaItem.schema.$ref);
Expand All @@ -25,7 +26,7 @@ const renderSchema = (schemaItem, schemas, name) => {
title={itemName || item.title}
type="object"
required={schemaItem.required || !!item.required}
description={item.description || item.title || ""}
description={mainDescr || schemaItem.description || item.description || item.title || ""}
pattern={item.pattern}
defaultVal={item.default}
/>
Expand Down Expand Up @@ -130,7 +131,7 @@ const renderSchema = (schemaItem, schemas, name) => {
type={schemaItem.schema.enum ? "enum" : schemaItem.schema.type}
required={!!schemaItem.required}
description={
schemaItem.description || schemaItem.schema.description || schemaItem.schema.title || ""
mainDescr || schemaItem.description || schemaItem.schema.description || schemaItem.schema.title || ""
}
pattern={schemaItem.schema.pattern || schemaItem.pattern}
defaultVal={schemaItem.schema.default || schemaItem.default}
Expand All @@ -146,7 +147,7 @@ const renderSchema = (schemaItem, schemas, name) => {
title={name || schemaItem.title}
type={schemaItem.enum ? "enum" : schemaItem.type}
required={!!schemaItem.required}
description={schemaItem.description || schemaItem.title}
description={mainDescr || schemaItem.description || schemaItem.title}
pattern={schemaItem.pattern}
defaultVal={schemaItem.default}
/>
Expand Down
Loading
Loading