diff --git a/packages/polymath-issuer/src/actions/account.js b/packages/polymath-issuer/src/actions/account.js new file mode 100644 index 000000000..2bc2b578d --- /dev/null +++ b/packages/polymath-issuer/src/actions/account.js @@ -0,0 +1,17 @@ +import { SecurityTokenRegistry } from '@polymathnetwork/js'; + +export const TICKER_LIST = 'account/TICKER_LIST'; +export const getTickerList = tickers => ({ + type: TICKER_LIST, + tickers, +}); + +export const fetchTickerList = () => async ( + dispatch: Function, + getState: GetState +) => { + const str = await SecurityTokenRegistry.create(); + const walletAddress = getState().session.wallet.address; + const newTokens = await str.getTickersByOwner(walletAddress); + dispatch(getTickerList(newTokens)); +}; diff --git a/packages/polymath-issuer/src/pages/account/components/TickerCard.js b/packages/polymath-issuer/src/pages/account/components/TickerCard.js new file mode 100644 index 000000000..223fe1ed1 --- /dev/null +++ b/packages/polymath-issuer/src/pages/account/components/TickerCard.js @@ -0,0 +1,36 @@ +import React, { Component } from 'react'; +import { PageCentered, Button, Toaster, notify } from '@polymathnetwork/ui'; +import { Link } from 'react-router-dom'; + +export default class TickerCard extends Component { + render() { + const { ticker } = this.props; + return ( +
+ + + +
+- +
diff --git a/packages/polymath-issuer/src/pages/token/style.scss b/packages/polymath-issuer/src/pages/token/style.scss index b279896e9..44957cc7b 100644 --- a/packages/polymath-issuer/src/pages/token/style.scss +++ b/packages/polymath-issuer/src/pages/token/style.scss @@ -13,6 +13,10 @@ margin-top: 13px; } +.export-tokens-list-btn { + width: 100%; +} + .max-holders-count { .bx--form-item { float: left; diff --git a/packages/polymath-issuer/src/reducers/account.js b/packages/polymath-issuer/src/reducers/account.js new file mode 100644 index 000000000..a13dcd0b3 --- /dev/null +++ b/packages/polymath-issuer/src/reducers/account.js @@ -0,0 +1,16 @@ +import * as a from '../actions/account'; + +const defaultState = { + tickers: [], +}; + +export default (state = defaultState, action) => { + switch (action.type) { + case a.TICKER_LIST: + return { + tickers: [...action.tickers], + }; + default: + return state; + } +}; diff --git a/packages/polymath-issuer/src/redux/reducer.js b/packages/polymath-issuer/src/redux/reducer.js index 6d3794ab1..ed9b384b1 100644 --- a/packages/polymath-issuer/src/redux/reducer.js +++ b/packages/polymath-issuer/src/redux/reducer.js @@ -21,6 +21,7 @@ import whitelist from '../reducers/compliance'; import stoModules from '../reducers/stoModules'; import ui from '../reducers/ui'; import restrictions from '../reducers/restrictions'; +import account from '../reducers/account'; import type { ProvidersState } from '../reducers/providers'; import type { TokenState } from '../reducers/token'; @@ -47,6 +48,7 @@ export default history => app, session, restrictions, + account, router: connectRouter(history), }); diff --git a/packages/polymath-issuer/src/routes.js b/packages/polymath-issuer/src/routes.js index 049ef0874..f4caa19b2 100644 --- a/packages/polymath-issuer/src/routes.js +++ b/packages/polymath-issuer/src/routes.js @@ -19,11 +19,17 @@ import STOPage from './pages/sto/STOPage'; import DividendsPage from './pages/dividends/DividendsPage'; import DividendsWizardPage from './pages/dividends/DividendsWizardPage'; import DividendDetailsPage from './pages/dividends/DividendDetailsPage'; +import AccountPage from './pages/account'; export default [ { component: App, routes: [ + { + path: '/account', + component: AccountPage, + exact: true, + }, { path: '/ticker', component: TickerPage, diff --git a/packages/polymath-js/src/contracts/SecurityTokenRegistry.js b/packages/polymath-js/src/contracts/SecurityTokenRegistry.js index bbf83d014..693b8a2c0 100644 --- a/packages/polymath-js/src/contracts/SecurityTokenRegistry.js +++ b/packages/polymath-js/src/contracts/SecurityTokenRegistry.js @@ -289,6 +289,16 @@ class SecurityTokenRegistry extends Contract { return tokens; } + async getTickersByOwner(owner) { + const tickers = this._methods.getTickersByOwner(owner).call(); + const convertedTickers = tickers.reduce((pV, cV) => { + let ticker = this._toAscii(cV); + pV.push(ticker); + return pV; + }, []); + return convertedTickers; + } + async registerTicker(details: SymbolDetails): Promise