16 | POSTGRES_DB: governance-auth
17 | PGDATA: /var/lib/postgresql/data
18 | volumes:
19 | # persistent data locally
20 | - /var/polkassembly/auth-server/data:/var/lib/postgresql/data
21 |
--------------------------------------------------------------------------------
/front-end/src/components/AppLayout/query.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import gql from 'graphql-tag';
6 |
7 | export const LOGOUT = gql`
8 | mutation LOGOUT {
9 | logout {
10 | message
11 | }
12 | }
13 | `;
14 |
15 | export const BLOCKNUMBER = gql`
16 | query FetchLatestBlockNumber {
17 | blockNumbers(last: 1){
18 | number
19 | }
20 | }
21 | `;
22 |
--------------------------------------------------------------------------------
/front-end/src/screens/PreImages/index.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import React from 'react';
6 | import PreImagesTable from 'src/components/PreImagesTable';
7 |
8 | const PreImages = () => {
9 | return (
10 | <>
11 | Preimages
12 |
13 |
16 | >
17 | );
18 | };
19 |
20 | export default PreImages;
--------------------------------------------------------------------------------
/kubernetes/node-watcher/values-polkadot-prod.yaml:
--------------------------------------------------------------------------------
1 | # POLKADOT-PROD values for node-watcher.
2 | # Declare variables to be passed into your templates.
3 |
4 | chainName: polkadot
5 | nodeSelector: {}
6 |
7 | cloudsql:
8 | commandline:
9 | args: "-instances=premiurly-284711:europe-west1:polkassembly=tcp:5432"
10 |
11 | nodeWatcher:
12 | dbName: "polkadot-chain-db"
13 | dbUser: "chain-db"
14 | dbPassword: from-gitlab-vars
15 |
16 | harvester:
17 | config:
18 | ARCHIVE_NODE_ENDPOINT: wss://rpc.polkadot.io
19 | START_FROM: '11829055'
20 | BLOCK_IDENTIFIER: chain-tip-11829055
21 |
--------------------------------------------------------------------------------
/hasura/hasura-migrations/migrations/1653239697709_create_table_public_onchain_post_discussion_link/up.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE "public"."onchain_post_discussion_link"("id" serial NOT NULL, "onchain_link_id" integer NOT NULL, "discussion_post_id" integer NOT NULL, "author_id" integer NOT NULL, "created_at" Timestamp NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), PRIMARY KEY ("id") , FOREIGN KEY ("onchain_link_id") REFERENCES "public"."onchain_links"("id") ON UPDATE restrict ON DELETE restrict, FOREIGN KEY ("discussion_post_id") REFERENCES "public"."posts"("id") ON UPDATE restrict ON DELETE restrict);
2 |
--------------------------------------------------------------------------------
/auth-server/migrations/20200313181311_report_content_network.js:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 | exports.up = function(knex) {
5 | return knex.schema.table('content_report', (table) => {
6 | table.enu('network', ['kusama', 'polkadot']).defaultTo('kusama');
7 | });
8 | };
9 |
10 | exports.down = function(knex) {
11 | return knex.schema.table('content_report', function (table) {
12 | table.dropColumn('network');
13 | });
14 | };
15 |
--------------------------------------------------------------------------------
/auth-server/migrations/20220520102135_add_title_and_label.js:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 | exports.up = function(knex) {
5 | return knex.schema.table('profile', (table) => {
6 | table.text('title');
7 | table.text('badges');
8 | });
9 | };
10 |
11 | exports.down = function(knex) {
12 | return knex.schema.table('profile', function (table) {
13 | table.dropColumn('title');
14 | table.dropColumn('badges');
15 | });
16 | };
--------------------------------------------------------------------------------
/front-end/codegen.yml:
--------------------------------------------------------------------------------
1 | overwrite: true
2 | generates:
3 | src/generated/graphql.tsx:
4 | schema:
5 | - ${REACT_APP_HASURA_GRAPHQL_URL}:
6 | headers:
7 | X-Hasura-Admin-Secret: ${HASURA_GRAPHQL_ADMIN_SECRET}
8 | documents:
9 | - "src/**/*.{ts,tsx}"
10 | - "!src/services/*"
11 | - "!src/screens/Profile/CouncilVotes.tsx"
12 | plugins:
13 | - "typescript"
14 | - "typescript-operations"
15 | - "typescript-react-apollo"
16 | config:
17 | withComponent: false
18 | withHOC: false
19 | withHooks: true
20 | withResultType: true
21 |
--------------------------------------------------------------------------------
/front-end/src/global/post_categories.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | export enum PostCategory {
6 | DISCUSSION = 'discussion',
7 | REFERENDA = 'referenda',
8 | FELLOWSHIP_REFERENDA = 'fellowship-referenda',
9 | PROPOSAL = 'proposal',
10 | MOTION = 'motion',
11 | TREASURY_PROPOSAL = 'treasury proposal',
12 | TECH_COMMITTEE_PROPOSAL = 'tech committee proposal',
13 | BOUNTY = 'bounty',
14 | CHILD_BOUNTY = 'child bounty',
15 | TIP = 'tip'
16 | }
--------------------------------------------------------------------------------
/front-end/src/ui-components/CountBadgePill.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import React from 'react';
6 |
7 | const CountBadgePill = ({ className, label, count } : {className?:string, label?:string, count?: string}) =>
8 | {label && label}
9 | {count != null && count != undefined && ({count})}
10 |
;
11 |
12 | export default CountBadgePill;
--------------------------------------------------------------------------------
/auth-server/src/utils/getPostLink.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import { PostType } from '../types';
6 |
7 | /**
8 | * Get Post link type from an event
9 | */
10 | export default (type: PostType, id: number | string): string => {
11 | const DOMAIN = process.env.DOMAIN_NAME && process.env.DOMAIN_PROTOCOL ? `${process.env.DOMAIN_PROTOCOL}${process.env.DOMAIN_NAME}` : 'https://test.polkassembly.io';
12 | return `${DOMAIN}/${type}/${id}`;
13 | };
14 |
15 |
--------------------------------------------------------------------------------
/front-end/src/global/sortOptions.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | export const sortValues = {
6 | COMMENTED: 'commented',
7 | NEWEST: 'newest',
8 | OLDEST: 'oldest'
9 | };
10 |
11 | export const sortOptions = [
12 | { key: 'commented', text: 'Last Commented', value: sortValues.COMMENTED },
13 | { key: 'newest', text: 'Date Added (newest)', value: sortValues.NEWEST },
14 | { key: 'oldest', text: 'Date Added (oldest)', value: sortValues.OLDEST }
15 | ];
16 |
--------------------------------------------------------------------------------
/front-end/src/ui-components/Card.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import React, { ReactNode } from 'react';
6 |
7 | interface Props {
8 | className?: string;
9 | children: ReactNode;
10 | }
11 |
12 | const Card = ({ className, children }:Props ) => {
13 | return (
14 | {children}
15 | );
16 | };
17 |
18 | export default Card;
19 |
--------------------------------------------------------------------------------
/health-monitor/README.md:
--------------------------------------------------------------------------------
1 | ## health-monitor
2 |
3 | Health monitor service for Polkassembly. Provides a single API endpoint which checks the health of all Polkassembly components.
4 |
5 | ## Installation
6 |
7 | Configure environment variables with a .env file with following values.
8 |
9 | ```bash
10 | PORT=8034
11 | AUTH_SERVER="http://localhost:8010"
12 | HASURA_SERVER="http://localhost:8080"
13 | CHAIN_DB_WATCHER_SERVER="http://localhost:8019"
14 | CHAIN_DB_SERVER="http://0.0.0.0:4000"
15 | CHAIN_DB="http://0.0.0.0:4466"
16 | REACT_SERVER="http://localhost:3000"
17 | ARCHIVE_NODE_ENDPOINT="wss://kusama-rpc.polkadot.io"
18 | ```
19 |
20 |
--------------------------------------------------------------------------------
/front-end/src/util/getDefaultAddressField.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import getNetwork from './getNetwork';
6 |
7 | export default function(): 'kusama_default_address' | 'polkadot_default_address' {
8 | const network = getNetwork();
9 |
10 | switch (network) {
11 | case 'kusama':
12 | return 'kusama_default_address';
13 | case 'polkadot':
14 | return 'polkadot_default_address';
15 | default:
16 | return 'polkadot_default_address';
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/kubernetes/node-watcher/values-dashboards-cluster-1.yaml:
--------------------------------------------------------------------------------
1 | # DASHBOARDS-CLUSTER-1 values for node-watcher.
2 | # This is a YAML-formatted file.
3 | # Declare variables to be passed into your templates.
4 |
5 | chainName: kusama
6 | nodeSelector: {}
7 |
8 | cloudsql:
9 | commandline:
10 | args: "-instances=premiurly-284711:europe-west1:polkassembly=tcp:5432"
11 |
12 | nodeWatcher:
13 | dbName: "test-chain-db"
14 | dbUser: "chain-db"
15 | dbPassword: from-gitlab-vars
16 |
17 | harvester:
18 | config:
19 | ARCHIVE_NODE_ENDPOINT: wss://kusama-rpc.polkadot.io
20 | START_FROM: '15338399'
21 | BLOCK_IDENTIFIER: chain-tip-15338399
22 |
--------------------------------------------------------------------------------
/front-end/src/components/Post/ActionsBar/ReportButton/query.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import gql from 'graphql-tag';
6 |
7 | export const REPORT_CONTENT=gql`
8 | mutation ReportContent ($network: String!, $type: String!, $content_id: String!, $reason: String!, $comments: String!) {
9 | reportContent(network: $network, type: $type, content_id: $content_id, reason: $reason, comments: $comments) {
10 | message
11 | }
12 | }
13 | `;
14 |
--------------------------------------------------------------------------------
/front-end/src/ui-components/ErrorAlert.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 | import { Alert } from 'antd';
5 | import React from 'react';
6 | import cleanError from 'src/util/cleanError';
7 |
8 | interface Props {
9 | className?: string;
10 | errorMsg: string;
11 | }
12 |
13 | const ErrorAlert = ({ className, errorMsg } : Props) => {
14 | return (
15 |
16 | );
17 | };
18 |
19 | export default ErrorAlert;
--------------------------------------------------------------------------------
/kubernetes/node-watcher/values-parity-prod.yaml:
--------------------------------------------------------------------------------
1 | # DASHBOARDS-CLUSTER-1 values for node-watcher.
2 | # This is a YAML-formatted file.
3 | # Declare variables to be passed into your templates.
4 |
5 | chainName: kusama
6 | nodeSelector: {}
7 |
8 | cloudsql:
9 | commandline:
10 | args: "-instances=premiurly-284711:europe-west1:polkassembly=tcp:5432"
11 |
12 | nodeWatcher:
13 | dbName: "kusama-chain-db"
14 | dbUser: "chain-db"
15 | dbPassword: from-gitlab-vars
16 |
17 | harvester:
18 | config:
19 | ARCHIVE_NODE_ENDPOINT: wss://kusama.api.onfinality.io/public-ws
20 | START_FROM: '10418197'
21 | BLOCK_IDENTIFIER: chain-tip-10418197
22 |
--------------------------------------------------------------------------------
/front-end/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "Polkassembly",
3 | "name": "polkassembly, discussion platform for polkadot governance",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/auth-server/migrations/20220404102135_profile.js:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | exports.up = function(knex) {
6 | return knex.schema.createTable('profile', (table) => {
7 | table.increments('id').primary().notNullable();
8 | table.integer('user_id').notNullable();
9 | table.text('bio');
10 | table.text('image');
11 | table.timestamp('created_at').notNullable().defaultTo(knex.raw('now()'));
12 | });
13 | };
14 |
15 | exports.down = function(knex) {
16 | return knex.schema.dropTable('profile');
17 | };
--------------------------------------------------------------------------------
/chain-db-open-server/prisma/prisma.yml:
--------------------------------------------------------------------------------
1 | # Specifies the HTTP endpoint of your Prisma API (deployed to a Prisma Demo server).
2 | endpoint: ${env:PRISMA_ENDPOINT}
3 |
4 | # Defines your models, each model is mapped to the database as a table.
5 | datamodel: datamodel.prisma
6 |
7 | # Specifies the language and directory for the generated Prisma client.
8 | generate:
9 | - generator: typescript-client
10 | output: ../src/generated/prisma-client
11 |
12 | # Seed your service with initial data based on `seed.graphql`.
13 | # seed:
14 | # import: seed.graphql
15 |
16 | # Ensures Prisma client is re-generated after a datamodel change.
17 | hooks:
18 | post-deploy:
19 | - yarn prisma generate
--------------------------------------------------------------------------------
/auth-server/test/setup.spec.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 | import connection from '../src/model/connection';
5 |
6 | const knexCleaner = require('knex-cleaner');
7 |
8 | before(async () => {
9 | const options = {
10 | mode: 'delete',
11 | restartIdentity: true, // Used to tell PostgresSQL to reset the ID counter,
12 | ignoreTables: ['knex_migrations', 'knex_migrations_lock']
13 | };
14 |
15 | await knexCleaner.clean(connection, options);
16 | });
17 |
18 | after(async () => {
19 | await connection.destroy();
20 | });
21 |
--------------------------------------------------------------------------------
/front-end/src/reportWebVitals.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import { ReportHandler } from 'web-vitals';
6 |
7 | const reportWebVitals = (onPerfEntry?: ReportHandler) => {
8 | if (onPerfEntry && onPerfEntry instanceof Function) {
9 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
10 | getCLS(onPerfEntry);
11 | getFID(onPerfEntry);
12 | getFCP(onPerfEntry);
13 | getLCP(onPerfEntry);
14 | getTTFB(onPerfEntry);
15 | });
16 | }
17 | };
18 |
19 | export default reportWebVitals;
20 |
--------------------------------------------------------------------------------
/front-end/src/ui-components/FilteredError.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 | import { Alert } from 'antd';
5 | import React from 'react';
6 | import cleanError from 'src/util/cleanError';
7 |
8 | interface ErrorProps{
9 | text: string
10 | }
11 |
12 | const FilteredError = ({ text } : ErrorProps) => {
13 | return (
14 |
17 | );
18 | };
19 |
20 | export default FilteredError;
21 |
--------------------------------------------------------------------------------
/node-watcher/src/util/newProposalStatus.ts:
--------------------------------------------------------------------------------
1 | import { BlockNumber } from '@polkadot/types/interfaces';
2 |
3 | import { prisma } from "../generated/prisma-client";
4 |
5 | interface Props{
6 | blockNumber: BlockNumber
7 | proposalId: number
8 | status: string
9 | }
10 | export default async ({ blockNumber, proposalId, status }: Props) => {
11 | await prisma.createProposalStatus({
12 | blockNumber: {
13 | connect: {
14 | number: blockNumber.toNumber(),
15 | },
16 | },
17 | proposal: {
18 | connect: {
19 | proposalId,
20 | },
21 | },
22 | status,
23 | uniqueStatus: `${proposalId}_${status}`,
24 | });
25 | }
--------------------------------------------------------------------------------
/auth-server/src/utils/setRefreshTokenCookie.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import { Response } from 'express';
6 |
7 | /**
8 | * setRefrestTokenCookie
9 | * @param res http response
10 | * @param refreshToken refres token string
11 | */
12 | export default (res: Response, refreshToken: string): void => {
13 | res.cookie(
14 | 'refresh_token',
15 | refreshToken,
16 | {
17 | httpOnly: true,
18 | maxAge: 6 * 30 * 24 * 60 * 60 * 1000, // 6 months
19 | sameSite: 'strict',
20 | secure: true
21 | }
22 | );
23 | };
24 |
--------------------------------------------------------------------------------
/front-end/src/global/apiHeaders.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import { REACT_APP_SUBSCAN_API_KEY } from './apiKeys';
6 |
7 | export const subscanApiHeaders = {
8 | Accept: 'application/json',
9 | 'Content-Type': 'application/json',
10 | 'X-API-Key': REACT_APP_SUBSCAN_API_KEY || ''
11 | };
12 |
13 | export const subsquidApiHeaders = {
14 | 'Accept': 'application/json, multipart/mixed',
15 | 'Sec-Fetch-Dest': 'empty',
16 | 'Sec-Fetch-Mode': 'cors',
17 | 'Sec-Fetch-Site': 'same-origin',
18 | 'content-type': 'application/json'
19 | };
--------------------------------------------------------------------------------
/auth-server/src/utils/getUserFromUserId.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import { AuthenticationError } from 'apollo-server';
6 |
7 | import User from '../model/User';
8 | import messages from './messages';
9 |
10 | /**
11 | * Get User from userId
12 | */
13 | export default async (userId: number): Promise => {
14 | const user = await User
15 | .query()
16 | .where('id', userId)
17 | .first();
18 |
19 | if (!user) {
20 | throw new AuthenticationError(messages.USER_NOT_FOUND);
21 | }
22 |
23 | return user;
24 | };
25 |
26 |
--------------------------------------------------------------------------------
/auth-server/src/resolvers/mutation/editPostStart.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import AuthService from '../../services/auth';
6 | import { AddressArgs, ChallengeMessage } from '../../types';
7 | import messages from '../../utils/messages';
8 |
9 | export default async (parent: void, { address }: AddressArgs): Promise => {
10 | const authServiceInstance = new AuthService();
11 |
12 | return {
13 | message: messages.EDIT_POST_STARTED,
14 | signMessage: await authServiceInstance.EditPostStart(address)
15 | };
16 | };
17 |
--------------------------------------------------------------------------------
/auth-server/src/resolvers/mutation/createPostStart.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import AuthService from '../../services/auth';
6 | import { AddressArgs, ChallengeMessage } from '../../types';
7 | import messages from '../../utils/messages';
8 |
9 | export default async (parent: void, { address }: AddressArgs): Promise => {
10 | const authServiceInstance = new AuthService();
11 |
12 | return {
13 | message: messages.CREATE_POST_STARTED,
14 | signMessage: await authServiceInstance.CreatePostStart(address)
15 | };
16 | };
17 |
--------------------------------------------------------------------------------
/auth-server/src/routes.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | /* eslint-disable @typescript-eslint/no-misused-promises */
6 |
7 | import { Router } from 'express';
8 |
9 | import { commentCreateHook, onchainLinksCreateHook } from './controllers/eventsHook';
10 |
11 | const router = Router();
12 |
13 | router.get('/healthcheck', (req, res) => {
14 | res.end('ok');
15 | });
16 |
17 | router.post('/auth/event/comment/create', commentCreateHook);
18 | router.post('/auth/event/onchain_link/create', onchainLinksCreateHook);
19 |
20 | export default router;
21 |
--------------------------------------------------------------------------------
/util/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | All notable changes to this project will be documented in this file.
4 |
5 | ## 0.2.0 (2020-05-20)
6 | Add getFailingThreshold. Use the aye/nay without conviction. The guess on the threshold makes the assumption that all votes have a conviction of x1.
7 |
8 | ## 0.1.3 (2020-04-15)
9 | Fix a case were Supermajority threshold was not returning any value although a root was found.
10 |
11 | ## 0.1.2 (2020-04-13)
12 | `getPassingThreshold` returns an object `{ isValid: boolean, passingThreshold?: BN }` with `isValid` being true if a threshold was found.
13 |
14 | ## 0.1.1 (2020-04-13)
15 | Add function descriptions, fix typo in Readme and fix imports.
16 |
17 | ## 0.1.0 Initial release (2020-04-13)
--------------------------------------------------------------------------------
/auth-server/src/resolvers/mutation/addressSignupStart.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import AuthService from '../../services/auth';
6 | import { AddressArgs, ChallengeMessage } from '../../types';
7 | import messages from '../../utils/messages';
8 |
9 | export default async (parent: void, { address }: AddressArgs): Promise => {
10 | const authServiceInstance = new AuthService();
11 |
12 | return {
13 | message: messages.ADDRESS_SIGNUP_STARTED,
14 | signMessage: await authServiceInstance.AddressSignupStart(address)
15 | };
16 | };
17 |
--------------------------------------------------------------------------------
/auth-server/src/resolvers/mutation/setCredentialsStart.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import AuthService from '../../services/auth';
6 | import { AddressArgs, ChallengeMessage } from '../../types';
7 | import messages from '../../utils/messages';
8 |
9 | export default async (parent: void, { address }: AddressArgs): Promise => {
10 | const authServiceInstance = new AuthService();
11 |
12 | return {
13 | message: messages.ADDRESS_SIGNUP_STARTED,
14 | signMessage: await authServiceInstance.SetCredentialsStart(address)
15 | };
16 | };
17 |
--------------------------------------------------------------------------------
/auth-server/src/resolvers/mutation/multisigLinkStart.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import AuthService from '../../services/auth';
6 | import { AddressArgs, ChallengeMessage } from '../../types';
7 | import messages from '../../utils/messages';
8 |
9 | export default async (parent: void, { address }: AddressArgs): Promise => {
10 | const authServiceInstance = new AuthService();
11 |
12 | return {
13 | message: messages.ADDRESS_LINKING_STARTED,
14 | signMessage: await authServiceInstance.MultisigAddressSignupStart(address)
15 | };
16 | };
17 |
--------------------------------------------------------------------------------
/front-end/src/screens/Settings/Header.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 | import React, { FC } from 'react';
5 |
6 | interface Props {
7 | heading?: string;
8 | subHeading?: string;
9 | }
10 |
11 | const Header: FC = ({ heading, subHeading }) => {
12 | return (
13 |
14 |
15 | {heading}
16 |
17 |
18 | {subHeading}
19 |
20 |
21 | );
22 | };
23 |
24 | export default Header;
--------------------------------------------------------------------------------
/front-end/src/ui-components/AuthForm.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2019-2020 @Premiurly/polkassembly authors & contributors
2 | // This software may be modified and distributed under the terms
3 | // of the Apache-2.0 license. See the LICENSE file for details.
4 |
5 | import { Form } from 'antd';
6 | import React, { FC, PropsWithChildren } from 'react';
7 |
8 | interface Props extends PropsWithChildren{
9 | className?: string;
10 | onSubmit?: ((values: React.BaseSyntheticEvent