I dont think the hosted Polkadot JS UI supports Custom RPCs.
You need to follow the instructions for defining custom RPCs when initializing your own Polkadot JS instance as documented here:
https://polkadot.js.org/docs/api/start/rpc.custom
Custom definitions
RPCs are exposed as a method on a specific module. This means that
once available: you can call any rpc via
api.rpc.<module>.<method>(...params[])
. For example, you can define
a firstModule_testMethod
on the Rust node and if correctly defined
it will be callable via api.rpc.firstModule.testMethod(...
). To
supply custom RPC methods, you provide an rpc
object on the options
to the API.
...
const api = await ApiPromise.create({
rpc: {
firstModule: {
testMethod: {
description: 'Just a test method',
params: [
{
name: 'index',
type: 'u64'
},
{
name: 'at',
type: 'Hash',
isOptional: true
}
],
type: 'Balance'
},
anotherMethod: { ... },
...
},
anotherModule: { ... },
... },
... });
In the above example we have defined a new method, which is now
available on the API as api.rpc.firstModule.testMethod(index: u64, at?: Hash) => Promise<Balance>
. For the optional parameters, we added
isOptional: true
alongside the name
& type
in the parameter
definition.
Even if you define the method it will only appear on the API if it
appears in the list returned by api.rpc.rpc.methods()
, which is the
list of known RPCs the node exposes. So when making changes to the
node you should double-check that it does announce the RPC method and
that it conforms to the format <module>_<method>
. For example
foo_bar
is a valid name whereas bar
is not. I.E. Methods which do
not contain both a module
and method
component won't be detected
and cannot be decorated. If in doubt, follow the conventions in
Substrate master.