Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Update RPC docs for clarify on deprecation of postional array and cos…
Browse files Browse the repository at this point in the history
…ts (#721)

* Update RPC docs for clarify on deprecation of postional array and costs

* Update description on costs

* Update in JSON-RPC info

* Update transaction desc

* Add build file

* remove an extra file

* modify the patch for the openrpc react package

this will display our custom note following the parameters heading
and before any of the named parameters are listed

* remove the notes about by-name parameters in transaction params

* add `deprecated` to the `cost` object in the tx simulation result

* add the built `openrpc.json` file

---------

Co-authored-by: Jane Wang <[email protected]>
Co-authored-by: Elliot Voris <[email protected]>
  • Loading branch information
3 people authored Feb 15, 2024
1 parent ab6b117 commit b2d694b
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 3 deletions.
8 changes: 8 additions & 0 deletions api/json-rpc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ To interact with soroban-rpc from inside a JavaScript application, use the [Java

When XDR is passed as a parameter or returned, it is always a string encoded using standard base64.

:::info

Please note that parameter structure must contain named parameters as a by-name
object, and not as positional arguments as a by-position array. Positional
arguments as a by-position array will be deprecated in future RPC releases.

:::

## Open-RPC Specification

Soroban-RPC provides an [OpenRPC] specification document that can be used to mock, build, and/or validate both server and client software implementations. This document is used to generate all of our [methods] documentation pages. You can view the full [specification document here]. Additionally, you can experiment with this specificaiton document in the [OpenRPC Playground].
Expand Down
3 changes: 2 additions & 1 deletion openrpc/src/methods/simulateTransaction.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
},
"cost": {
"type": "object",
"description": "(optional) - Information about instructions used, etc. Not present in case of error.",
"description": "(optional) - The cost object is legacy, inaccurate, and will be deprecated in future RPC releases. Please decode transactionData XDR to retrieve the correct resources.",
"deprecated": true,
"properties": {
"cpuInsns": {
"type": "string",
Expand Down
38 changes: 37 additions & 1 deletion patches/@metamask+open-rpc-docs-react+0.1.2.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/@metamask/open-rpc-docs-react/dist/ExamplePairing/ExamplePairing.js b/node_modules/@metamask/open-rpc-docs-react/dist/ExamplePairing/ExamplePairing.js
index 354ce73..5e07a7f 100644
index 354ce73..129371f 100644
--- a/node_modules/@metamask/open-rpc-docs-react/dist/ExamplePairing/ExamplePairing.js
+++ b/node_modules/@metamask/open-rpc-docs-react/dist/ExamplePairing/ExamplePairing.js
@@ -45,10 +45,37 @@ class ExamplePairing extends react_1.Component {
Expand Down Expand Up @@ -93,3 +93,39 @@ index b8b0f3d..9a49549 100644
};
onExamplePairingChange?: (examplePairing: ExamplePairingObject | undefined) => void;
reactJsonOptions?: object;
diff --git a/node_modules/@metamask/open-rpc-docs-react/dist/Params/Params.js b/node_modules/@metamask/open-rpc-docs-react/dist/Params/Params.js
index 4b059a6..b5dafce 100644
--- a/node_modules/@metamask/open-rpc-docs-react/dist/Params/Params.js
+++ b/node_modules/@metamask/open-rpc-docs-react/dist/Params/Params.js
@@ -34,17 +34,20 @@ class Params extends react_1.Component {
if (!params || params.length === 0) {
return null;
}
- return (params.map((row, i) => react_1.default.createElement("section", null,
- react_1.default.createElement("h3", null,
- i + 1,
- ". ",
- row.name,
- (row.required === undefined ||
- row.required === true) &&
- react_1.default.createElement("span", { className: "content-descriptor-summary" },
- react_1.default.createElement("i", null,
- react_1.default.createElement("small", null, " (required)")))),
- react_1.default.createElement(ContentDescriptor_1.default, { key: row.name, contentDescriptor: row, uiSchema: uiSchema }))));
+ return (
+ [react_1.default.createElement("p", { key: "param-structure", className: "param-structure-requirement" }, "Please note that parameter structure within the request must contain named parameters as a by-name object, and not as positional arguments in a by-position array"),
+ ...params.map((row, i) => react_1.default.createElement("section", null,
+ react_1.default.createElement("h3", null,
+ i + 1,
+ ". ",
+ row.name,
+ (row.required === undefined ||
+ row.required === true) &&
+ react_1.default.createElement("span", { className: "content-descriptor-summary" },
+ react_1.default.createElement("i", null,
+ react_1.default.createElement("small", null, " (required)")))),
+ react_1.default.createElement(ContentDescriptor_1.default, { key: row.name, contentDescriptor: row, uiSchema: uiSchema })))]
+ );
}
}
exports.default = Params;
3 changes: 2 additions & 1 deletion static/openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,8 @@
},
"cost": {
"type": "object",
"description": "(optional) - Information about instructions used, etc. Not present in case of error.",
"description": "(optional) - The cost object is legacy, inaccurate, and will be deprecated in future RPC releases. Please decode transactionData XDR to retrieve the correct resources.",
"deprecated": true,
"required": [
"cpuInsns",
"memBytes"
Expand Down

0 comments on commit b2d694b

Please sign in to comment.