ghost-portal/packages/app-example/src/comp-002.tsx
Jaco Greeff 3fb85094a6
Example & tutorial (#127)
* Add tutorial step 001

* Update LICENSE header

* Query storage via HOC

* Tut 003, read proposals

* Tut 004 replacing HOC

* Pull Intentions & Proposals together

* Add final image

* Cleanup unused methods

* Source links

* Remove unused var
2018-07-09 13:38:31 +02:00

24 lines
702 B
TypeScript

// Copyright 2017-2018 @polkadot/app-example authors & contributors
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import React from 'react';
import storage from '@polkadot/storage';
import withStorageDiv from '@polkadot/ui-react-rx/with/storageDiv';
import encodeAddress from '@polkadot/util-keyring/address/encode';
const method = storage.staking.public.intentions;
const Comp: React.ComponentType<any> = withStorageDiv(method)(
(value: Uint8Array[]): string => {
if (!value || !value.length) {
return 'No intentions found';
}
return value.map(encodeAddress).join(', ');
}
);
export default Comp;