-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Support BTreeMap and fix rpc optional #9911
base: master
Are you sure you want to change the base?
Support BTreeMap and fix rpc optional #9911
Conversation
@Neopallium I have this on my list to review, and will do it as soon as possible so we can get this in. |
@@ -61,9 +60,9 @@ function Vector ({ className = '', defaultValue, isDisabled = false, label, onCh | |||
useEffect((): void => { | |||
inputParams.length && | |||
setParams((prev) => | |||
getParams(inputParams, prev, isDisabled ? (defaultValue.value as RawParam[] || []).length : count) | |||
getParams(inputParams, prev, isDisabled ? values.length : count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh nice catch here 👍!
@@ -72,7 +72,7 @@ function Selection ({ queueRpc }: Props): React.ReactElement<Props> { | |||
(): void => queueRpc({ | |||
rpc, | |||
values: values | |||
.filter(({ value }) => !isNull(value)) | |||
.filter(({ value }, idx) => !rpc.params[idx].isOptional || !isNull(value)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies but can you give a brief explanation as to what this is fixing? Thanks again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isOptional
setting only really works for last parameters, not for a mix of Option and non-Option parameters. So the fix keeps null values for isOptional=false
parameters.
We are using this fix here: https://mainnet-app.polymesh.network/#/rpc
Open the asset.canTransferGranular
endpoint and just click the submit button (don't need to fill in values).
To see the error try the same endpoint using the Polkadot.js.org app without the fix: https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fmainnet-rpc.polymesh.network#/rpc
The error is:
1: asset.canTransferGranular: CanTransferGranularReturn
Expected 7 parameters (1 optional), 4 found instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh okay, thanks so much for the explanation. Makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, looks super solid Thanks so much for the PR! The BTreeMap Component is spot on, and the vector fix is awesome.
Just a small nit with the console, and a quick question about the rpc optional fix. Other than that it should be ready to go.
Just needs a |
Co-authored-by: Tarik Gul <47201679+TarikGul@users.noreply.github.com>
b478f4a
to
24f3f99
Compare
|
Closes issue #1723