ghost-portal/packages/ui-react-app/src/Params/Param/Wasm.js
Jaco Greeff 072c5d73f1
Simplify app using setState (#23)
* Remove extra subjects from app-explorer

* Use bs58 addresses

* Base upgrades subject -> onChange

* app-storage & app-explorer works

* Remove useless placeholder

* Progres...

* Rename Submission -> Selection

* Baby steps... things display now...

* setState operational

* Explicit onChange

* Work around eslint issues (!!!)

* @flow fixes

* Small styling updates

* Small app content styling updates

* Simplify
2018-05-07 11:37:06 +02:00

30 lines
794 B
JavaScript

// Copyright 2017-2018 Jaco Greeff
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
// @flow
import type { Props } from '../types';
import React from 'react';
import bnToU8a from '@polkadot/util/bn/toU8a';
import u8aConcat from '@polkadot/util/u8a/concat';
import BytesFile from './File';
export default function Wasm ({ index, isError, label, onChange }: Props): React$Node {
// TODO: Validate that we have actual proper WASM code
const _onChange = (value: Uint8Array) =>
onChange(index, {
isValid: value.length !== 0,
value: u8aConcat(bnToU8a(value.length, 32, true), value)
});
return (
<BytesFile
isError={isError}
label={label}
onChange={_onChange}
/>
);
}