diff --git a/packages/app-rpc/src/Selection.tsx b/packages/app-rpc/src/Selection.tsx index 2f74f87f8c..c3f479e6a3 100644 --- a/packages/app-rpc/src/Selection.tsx +++ b/packages/app-rpc/src/Selection.tsx @@ -92,9 +92,10 @@ class Selection extends React.PureComponent { this.setState( (prevState: State): State => { const { rpc = prevState.rpc, nonce = prevState.nonce, publicKey = prevState.publicKey, values = prevState.values } = newState; + const hasNeededKey = rpc.isSigned !== true || (!!publicKey && publicKey.length === 32); const isValid = values.reduce((isValid, value) => { return isValid && value.isValid === true; - }, rpc.isSigned !== true || (!!publicKey && publicKey.length === 32)); + }, rpc.params.length === values.length && hasNeededKey); return { isValid, @@ -108,11 +109,17 @@ class Selection extends React.PureComponent { } onChangeAccount = (publicKey: Uint8Array | undefined | null, nonce: BN): void => { - this.nextState({ nonce, publicKey } as State); + this.nextState({ + nonce, + publicKey + } as State); } onChangeMethod = (rpc: SectionItem): void => { - this.nextState({ rpc } as State); + this.nextState({ + rpc, + values: [] as Array + } as State); } onChangeValues = (values: Array): void => {