├── util ├── .eslintignore ├── .gitignore ├── tsconfig.json ├── src │ ├── index.ts │ └── types.ts ├── jest.config.js ├── CHANGELOG.md └── README.md ├── .gitignore ├── auth-server ├── test │ ├── .gitkeep │ ├── rewiremock.ts │ ├── setup.spec.ts │ └── utils │ │ └── validateEmail │ │ └── validateEmail.spec.ts ├── Procfile ├── .eslintignore ├── .dockerignore ├── .gitignore ├── .editorconfig ├── src │ ├── schema │ │ ├── query │ │ │ ├── token.ts │ │ │ ├── user.ts │ │ │ ├── profile.ts │ │ │ ├── userDetails.ts │ │ │ ├── about.ts │ │ │ ├── subscription.ts │ │ │ └── userWithUsername.ts │ │ ├── mutation │ │ │ ├── logout.ts │ │ │ ├── resendVerifyEmailToken.ts │ │ │ ├── deleteAccount.ts │ │ │ ├── postSubscribe.ts │ │ │ ├── postUnsubscribe.ts │ │ │ ├── verifyEmail.ts │ │ │ ├── addressUnlink.ts │ │ │ ├── editPostStart.ts │ │ │ ├── createPostStart.ts │ │ │ ├── requestResetPassword.ts │ │ │ ├── setDefaultAddress.ts │ │ │ ├── addressLoginStart.ts │ │ │ ├── addressSignupStart.ts │ │ │ ├── multisigLinkStart.ts │ │ │ ├── undoEmailChange.ts │ │ │ ├── login.ts │ │ │ ├── setCredentialsStart.ts │ │ │ ├── changeEmail.ts │ │ │ ├── updateProposalTracker.ts │ │ │ ├── addressLogin.ts │ │ │ ├── addressLinkStart.ts │ │ │ ├── changeUsername.ts │ │ │ ├── addressLinkConfirm.ts │ │ │ ├── changePassword.ts │ │ │ ├── signup.ts │ │ │ ├── resetPassword.ts │ │ │ ├── changeNotificationPreference.ts │ │ │ ├── addressSignupConfirm.ts │ │ │ ├── addProfile.ts │ │ │ ├── reportContent.ts │ │ │ ├── changeAbout.ts │ │ │ ├── createProposalTracker.ts │ │ │ ├── linkProxyAddress.ts │ │ │ ├── createPostConfirm.ts │ │ │ ├── setCredentialsConfirm.ts │ │ │ ├── editPostConfirm.ts │ │ │ └── multisigLinkConfirm.ts │ │ └── type │ │ │ ├── token.ts │ │ │ ├── message.ts │ │ │ ├── loginResponse.ts │ │ │ ├── publicUser.ts │ │ │ ├── subscription.ts │ │ │ ├── changeResponse.ts │ │ │ ├── addressLoginType.ts │ │ │ ├── addressLinkType.ts │ │ │ ├── address.ts │ │ │ ├── undoEmailChangeResponse.ts │ │ │ ├── about.ts │ │ │ ├── profile.ts │ │ │ ├── notificationPreferences.ts │ │ │ ├── notificationPreferencesInput.ts │ │ │ ├── notificationPreferencesType.ts │ │ │ └── user.ts │ ├── model │ │ └── connection.ts │ ├── utils │ │ ├── shortenHash.ts │ │ ├── validateEmail.ts │ │ ├── nameBlacklist.ts │ │ ├── getPublicKey.ts │ │ ├── validatePassword.ts │ │ ├── getUserFromUsername.ts │ │ ├── getAllAddressesFromUserId.ts │ │ ├── validateUsername.ts │ │ ├── verifySignature.ts │ │ ├── getPostLink.ts │ │ ├── setRefreshTokenCookie.ts │ │ ├── getUserFromUserId.ts │ │ ├── getPostCommentLink.ts │ │ └── getTokenFromReq.ts │ ├── resolvers │ │ ├── mutation │ │ │ ├── editPostStart.ts │ │ │ ├── createPostStart.ts │ │ │ ├── addressSignupStart.ts │ │ │ ├── setCredentialsStart.ts │ │ │ ├── multisigLinkStart.ts │ │ │ ├── verifyEmail.ts │ │ │ ├── addressLoginStart.ts │ │ │ ├── login.ts │ │ │ ├── undoEmailChange.ts │ │ │ ├── createPostConfirm.ts │ │ │ ├── addressLogin.ts │ │ │ ├── resendVerifyEmailToken.ts │ │ │ ├── deleteAccount.ts │ │ │ ├── resetPassword.ts │ │ │ ├── addressSignupConfirm.ts │ │ │ ├── editPostConfirm.ts │ │ │ ├── setDefaultAddress.ts │ │ │ ├── addressUnlink.ts │ │ │ ├── updateProposalTracker.ts │ │ │ ├── linkProxyAddress.ts │ │ │ └── logout.ts │ │ └── query │ │ │ ├── token.ts │ │ │ └── about.ts │ └── routes.ts ├── Dockerfile ├── test.Dockerfile ├── migrations │ ├── 20200219105704_refresh_tokens_index.js │ ├── 20200609211518_remove_name.js │ ├── 20200420130047_address_default.js │ ├── 20200504122444_user_web3signup.js │ ├── 20191127101810_users_verified.js │ ├── 20200219110001_password_reset_token_index.js │ ├── 20210614133714_address_sign_message.js │ ├── 20200219110317_undo_email_change_token_index.js │ ├── 20200219105905_email_verification_token_index.js │ ├── 20200219104712_users_index.js │ ├── 20200219110123_post_subscription_index.js │ ├── 20200313181311_report_content_network.js │ ├── 20220520102135_add_title_and_label.js │ ├── 20220404102135_profile.js │ ├── 20211019102135_about.js │ ├── 20180917160913_users.js │ ├── 20191231152732_post_subscription.js │ ├── 20200225193118_notification.js │ └── 20191120202513_refresh_token.js └── docker-compose.yaml.example ├── kusama-staging-front-end ├── front-end ├── .eslintignore ├── .vscode │ └── settings.json ├── .dockerignore ├── public │ ├── robots.txt │ ├── googled640a29aba27e89c.html │ ├── googledc863757e8d3b723.html │ ├── favicon.ico │ ├── logo192.png │ ├── logo512.png │ ├── broken-chain.png │ ├── security.txt │ └── manifest.json ├── .firebaserc ├── src │ ├── assets │ │ ├── nft-POC.png │ │ ├── InfoCircle.png │ │ ├── calendar.png │ │ ├── chain-link.png │ │ ├── gov2-info-bg.png │ │ ├── kusama-logo.gif │ │ ├── no-user-img.png │ │ ├── baby-robot-nft.webp │ │ ├── background-POC.png │ │ ├── calendar_today.png │ │ ├── frowning-face.png │ │ ├── gov2-info-bg-2.png │ │ ├── gov2-info-bg-3.png │ │ ├── pa-small-circle.png │ │ ├── parachains │ │ │ ├── live.png │ │ │ ├── chain.png │ │ │ ├── github.png │ │ │ ├── announced.png │ │ │ ├── auction.png │ │ │ ├── crowdloan.png │ │ │ ├── projects.png │ │ │ ├── testing.png │ │ │ ├── w3f-black.png │ │ │ ├── w3f-green.png │ │ │ ├── w3f-red.png │ │ │ └── chain-link.png │ │ ├── polkassembly-logo.png │ │ ├── latest-activity-comment.png │ │ ├── parachain-logos │ │ │ ├── gear-logo.jpg │ │ │ ├── kilt-logo.png │ │ │ ├── snow-logo.png │ │ │ ├── acuity-logo.jpg │ │ │ ├── astar-logo.png │ │ │ ├── chain-logo.jpg │ │ │ ├── heiko-logo.png │ │ │ ├── karura-logo.jpg │ │ │ ├── khala-logo.png │ │ │ ├── kusama-logo.gif │ │ │ ├── kylin-logo.png │ │ │ ├── manta-logo.jpg │ │ │ ├── shiden-logo.jpg │ │ │ ├── turing-logo.png │ │ │ ├── altair-logo.jpeg │ │ │ ├── amplitude-logo.png │ │ │ ├── automata-logo.jpg │ │ │ ├── basilisk-logo.jpg │ │ │ ├── calamari-logo.png │ │ │ ├── hydradx-logo.jpg │ │ │ ├── moonbase-logo.png │ │ │ ├── moonbeam-logo.png │ │ │ ├── moonriver-logo.png │ │ │ ├── parallel-logo.jpg │ │ │ ├── pendulum-logo.jpg │ │ │ ├── polkadex-logo.jpg │ │ │ ├── polkadot-logo.jpg │ │ │ ├── tanganika-logo.png │ │ │ ├── westend-logo.jpg │ │ │ ├── centrifuge-logo.png │ │ │ ├── robonomics-logo.jpg │ │ │ ├── bitcountrypioneer-logo.jpg │ │ │ └── composable-finance-logo.png │ │ ├── polkadot-logo-small-inverted.png │ │ ├── lottie-graphics │ │ │ └── Slash.svg │ │ ├── no-proposal.svg │ │ ├── sidebar │ │ │ ├── motions.svg │ │ │ ├── gov2_treasury_group.svg │ │ │ ├── parachains.svg │ │ │ └── referenda.svg │ │ ├── icons │ │ │ └── cube.svg │ │ └── wallet │ │ │ └── polkadotjs-icon.svg │ ├── themes │ │ ├── tailwindSetup.css │ │ ├── xstyled.d.ts │ │ └── customAntdTheme.less │ ├── react-app-env.d.ts │ ├── global │ │ ├── noTitle.ts │ │ ├── appName.ts │ │ ├── post_types.ts │ │ ├── apiKeys.ts │ │ ├── post_topics.ts │ │ ├── post_categories.ts │ │ ├── sortOptions.ts │ │ └── apiHeaders.ts │ ├── components │ │ ├── Post │ │ │ ├── ActionsBar │ │ │ │ ├── Reactionbar │ │ │ │ │ └── reactions.ts │ │ │ │ ├── ReportButton │ │ │ │ │ └── query.ts │ │ │ │ └── SubscriptionButton │ │ │ │ │ └── query.ts │ │ │ └── GovernanceSideBar │ │ │ │ └── query.ts │ │ ├── AppLayout │ │ │ └── query.ts │ │ ├── WalletButton │ │ │ └── index.tsx │ │ └── CreateTreasuryProposal │ │ │ └── query.ts │ ├── import-png.d.ts │ ├── polkassemblyutils │ │ ├── index.ts │ │ └── types.ts │ ├── util │ │ ├── cleanError.ts │ │ ├── checkGov2Route.ts │ │ ├── shortenAddress.ts │ │ ├── handlePaginationChange.tsx │ │ ├── getRelativeCreatedAt.ts │ │ ├── validation.ts │ │ ├── getDefaultAddressField.ts │ │ ├── __tests__ │ │ │ └── validation.test.ts │ │ ├── formatUSDWithUnits.ts │ │ ├── formatPostInfoArguments.ts │ │ ├── getDaysTimeObj.ts │ │ ├── getNetwork.ts │ │ └── getExtensionUrl.ts │ ├── app.less │ ├── fragments │ │ └── author.ts │ ├── screens │ │ ├── VerifyEmail │ │ │ └── query.ts │ │ ├── RequestResetPassword │ │ │ └── query.ts │ │ ├── UndoEmailChange │ │ │ └── query.ts │ │ ├── ResetPassword │ │ │ └── query.ts │ │ ├── Settings │ │ │ ├── Profile │ │ │ │ └── query.ts │ │ │ └── Header.tsx │ │ ├── PreImages │ │ │ └── index.tsx │ │ ├── NotificationSettings │ │ │ └── query.ts │ │ ├── Listing │ │ │ └── MemberTracks │ │ │ │ └── index.tsx │ │ └── NotFound.tsx │ ├── ui-components │ │ ├── InlineTag.tsx │ │ ├── CountBadgePill.tsx │ │ ├── Card.tsx │ │ ├── ErrorAlert.tsx │ │ ├── FilteredError.tsx │ │ ├── AuthForm.tsx │ │ ├── HelperTooltip.tsx │ │ ├── GovSidebarCard.tsx │ │ └── QueueNotification.tsx │ ├── hooks │ │ ├── index.ts │ │ └── usePollEndBlock.ts │ ├── reportWebVitals.ts │ └── index.tsx ├── postcss.config.js ├── nginx │ ├── polkassembly.conf │ └── default.conf ├── header.js ├── firebase.json ├── .gitignore ├── Dockerfile └── codegen.yml ├── health-monitor ├── .eslintignore ├── .dockerignore ├── .gitignore ├── .editorconfig ├── Dockerfile └── README.md ├── kusama-production-front-end ├── polkadot-production-front-end ├── chain-db-open-server ├── prisma │ ├── seed.graphql │ └── prisma.yml ├── .dockerignore ├── .prettierignore ├── .gitignore ├── .prettierrc ├── Dockerfile ├── kubernetes │ ├── nodewatcher-server-service.yaml │ ├── loadbalancer.yaml │ └── nodewatcher-server-ingress.yaml ├── .graphqlconfig.yml ├── src │ └── types.ts └── tsconfig.json ├── node-watcher ├── .dockerignore ├── .gitignore ├── .prettierignore ├── images │ ├── 10.k8check.png │ ├── 4.imagelist.png │ ├── 5.dockertag.png │ ├── 7.copysha.png │ ├── 8.pastesha.png │ ├── 9.k8create.png │ ├── 3.dockerbuild.png │ ├── 6.dockerpush.png │ └── 1.gcloudauthlist.png ├── .prettierrc ├── prisma.yml ├── Dockerfile ├── src │ ├── util │ │ ├── getEnvVars.ts │ │ ├── filterEvents.ts │ │ └── newProposalStatus.ts │ └── connection.ts ├── tsconfig.json └── docker-compose.yml ├── chain-db-watcher ├── .eslintignore ├── .dockerignore ├── .gitignore ├── Dockerfile └── codegen.yml ├── hasura ├── .gitignore └── hasura-migrations │ ├── metadata │ ├── allow_list.yaml │ ├── functions.yaml │ ├── actions.graphql │ ├── cron_triggers.yaml │ ├── query_collections.yaml │ ├── version.yaml │ ├── actions.yaml │ └── remote_schemas.yaml │ ├── migrations │ ├── 1643824981772_create_table_public_replies │ │ ├── down.sql │ │ └── up.sql │ ├── 1668264057338_create_table_public_track_info │ │ ├── down.sql │ │ └── up.sql │ ├── 1612721658997_create_table_public_option_poll │ │ └── down.sql │ ├── 1651910848330_create_table_public_calender_events │ │ ├── down.sql │ │ └── up.sql │ ├── 1612721932728_create_table_public_option_poll_votes │ │ └── down.sql │ ├── 1646242080392_create_table_public_blockchain_socials │ │ ├── down.sql │ │ └── up.sql │ ├── 1654027168741_create_table_public_proposal_tracker │ │ └── down.sql │ ├── 1646674760651_create_table_public_polkassembly_proposals │ │ ├── down.sql │ │ └── up.sql │ ├── 1653239697709_create_table_public_onchain_post_discussion_link │ │ ├── down.sql │ │ └── up.sql │ ├── 1594645939219_change_onchain_tip_id_to_text │ │ └── up.sql │ ├── 1612722737654_alter_table_public_option_poll_add_column_end_at │ │ ├── down.sql │ │ └── up.sql │ ├── 1668258355967_alter_table_public_onchain_links_add_column_track │ │ ├── down.sql │ │ └── up.sql │ ├── 1668258499553_alter_table_public_onchain_links_add_column_origin │ │ ├── down.sql │ │ └── up.sql │ ├── 1654797231902_alter_table_public_calender_events_add_column_status │ │ ├── down.sql │ │ └── up.sql │ ├── 1655491508812_alter_table_public_calender_events_add_column_user_id │ │ ├── down.sql │ │ └── up.sql │ ├── 1654797788806_alter_table_public_calender_events_add_column_event_id │ │ ├── down.sql │ │ └── up.sql │ ├── 1657902531705_alter_table_public_calender_events_add_column_location │ │ ├── down.sql │ │ └── up.sql │ ├── 1654797244076_alter_table_public_calender_events_add_column_event_type │ │ ├── down.sql │ │ └── up.sql │ ├── 1603643648961_alter_table_public_onchain_links_add_column_onchain_bounty_id │ │ ├── down.sql │ │ └── up.sql │ ├── 1655491065001_alter_table_public_calender_events_add_column_approval_status │ │ ├── down.sql │ │ └── up.sql │ ├── 1656011914850_alter_table_public_onchain_links_add_column_onchain_child_bounty_id │ │ ├── down.sql │ │ └── up.sql │ ├── 1668258338117_alter_table_public_onchain_links_add_column_onchain_referendumv2_id │ │ ├── down.sql │ │ └── up.sql │ ├── 1656011924381_alter_table_public_onchain_links_alter_column_onchain_bounty_id │ │ ├── up.sql │ │ └── down.sql │ ├── 1668258451894_alter_table_public_onchain_links_add_column_onchain_referendumv2_status │ │ ├── down.sql │ │ └── up.sql │ ├── 1623052227181_alter_table_public_onchain_links_add_column_onchain_tech_committee_proposal_id │ │ ├── down.sql │ │ └── up.sql │ ├── 1673290206430_alter_table_public_onchain_links_add_column_onchain_fellowship_referendum_id │ │ ├── down.sql │ │ └── up.sql │ └── 1673290226827_alter_table_public_onchain_links_add_column_onchain_fellowship_referendum_status │ │ ├── down.sql │ │ └── up.sql │ └── config.yaml ├── cloud-functions ├── functions │ ├── .gitignore │ └── package.json ├── .firebaserc └── firebase.json ├── docs └── Polkassembly Governance Platform.pptx ├── kubernetes ├── redis │ └── values │ │ ├── parity-prod.yaml │ │ ├── polkadot-prod.yaml │ │ └── dashboards-cluster-1.yaml ├── polkassembly │ ├── templates │ │ ├── hasura-secret.yaml │ │ ├── cloudsql-instance-credentials-secret.yaml │ │ ├── auth-server-secrets.yaml │ │ ├── hasura-config.yaml │ │ ├── auth-server-config.yaml │ │ ├── health-monitor-config.yaml │ │ ├── chain-db-watcher-config.yaml │ │ ├── hasura-service.yaml │ │ ├── health-monitor-service.yaml │ │ ├── auth-server-service.yaml │ │ ├── chain-db-watcher-service.yaml │ │ └── frontend-service.yaml │ └── .helmignore ├── node-watcher │ ├── templates │ │ ├── node-watcher-prisma-secret.yaml │ │ ├── harvester-config.yaml │ │ ├── chain-db-open-server-service.yaml │ │ └── node-watcher-service.yaml │ ├── values-polkadot-prod.yaml │ ├── values-dashboards-cluster-1.yaml │ └── values-parity-prod.yaml ├── init.yaml ├── init-test.yml └── init-polkadot.yml ├── polkassembly-alerts ├── .gitignore └── package.json ├── security.txt ├── header.js ├── api-bump.sh └── nginx ├── polkassembly.io └── README.md /util/.eslintignore: -------------------------------------------------------------------------------- 1 | build -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | deploy*.sh 2 | -------------------------------------------------------------------------------- /auth-server/test/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /kusama-staging-front-end: -------------------------------------------------------------------------------- 1 | front-end -------------------------------------------------------------------------------- /front-end/.eslintignore: -------------------------------------------------------------------------------- 1 | src/generated/* -------------------------------------------------------------------------------- /front-end/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | } -------------------------------------------------------------------------------- /health-monitor/.eslintignore: -------------------------------------------------------------------------------- 1 | build 2 | -------------------------------------------------------------------------------- /kusama-production-front-end: -------------------------------------------------------------------------------- 1 | front-end -------------------------------------------------------------------------------- /polkadot-production-front-end: -------------------------------------------------------------------------------- 1 | front-end -------------------------------------------------------------------------------- /auth-server/Procfile: -------------------------------------------------------------------------------- 1 | web: npm start 2 | -------------------------------------------------------------------------------- /chain-db-open-server/prisma/seed.graphql: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /node-watcher/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /auth-server/.eslintignore: -------------------------------------------------------------------------------- 1 | data 2 | build 3 | test -------------------------------------------------------------------------------- /chain-db-watcher/.eslintignore: -------------------------------------------------------------------------------- 1 | src/generated/* -------------------------------------------------------------------------------- /hasura/.gitignore: -------------------------------------------------------------------------------- 1 | data 2 | docker-compose.yaml -------------------------------------------------------------------------------- /chain-db-open-server/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /cloud-functions/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /hasura/hasura-migrations/metadata/allow_list.yaml: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/metadata/functions.yaml: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /util/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /node_modules 3 | *.log 4 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/metadata/actions.graphql: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/metadata/cron_triggers.yaml: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/metadata/query_collections.yaml: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/metadata/version.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | -------------------------------------------------------------------------------- /chain-db-watcher/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build 3 | .env 4 | -------------------------------------------------------------------------------- /front-end/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | data 3 | build 4 | .env 5 | -------------------------------------------------------------------------------- /health-monitor/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build 3 | .env 4 | -------------------------------------------------------------------------------- /auth-server/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | data 3 | build 4 | .env 5 | -------------------------------------------------------------------------------- /chain-db-watcher/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env 3 | *.log 4 | build 5 | -------------------------------------------------------------------------------- /node-watcher/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env 3 | *.log 4 | build 5 | lib -------------------------------------------------------------------------------- /front-end/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | -------------------------------------------------------------------------------- /node-watcher/.prettierignore: -------------------------------------------------------------------------------- 1 | .cache 2 | package.json 3 | package-lock.json 4 | public 5 | -------------------------------------------------------------------------------- /chain-db-open-server/.prettierignore: -------------------------------------------------------------------------------- 1 | .cache 2 | package.json 3 | package-lock.json 4 | public 5 | -------------------------------------------------------------------------------- /front-end/.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "polkassembly" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /front-end/public/googled640a29aba27e89c.html: -------------------------------------------------------------------------------- 1 | google-site-verification: googled640a29aba27e89c.html -------------------------------------------------------------------------------- /front-end/public/googledc863757e8d3b723.html: -------------------------------------------------------------------------------- 1 | google-site-verification: googledc863757e8d3b723.html -------------------------------------------------------------------------------- /cloud-functions/.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "polkassembly-home" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /health-monitor/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env 3 | data 4 | build 5 | *.sh 6 | *.log 7 | docker-compose.yaml 8 | -------------------------------------------------------------------------------- /front-end/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/public/favicon.ico -------------------------------------------------------------------------------- /front-end/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/public/logo192.png -------------------------------------------------------------------------------- /front-end/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/public/logo512.png -------------------------------------------------------------------------------- /front-end/src/assets/nft-POC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/nft-POC.png -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1643824981772_create_table_public_replies/down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE "public"."replies"; 2 | -------------------------------------------------------------------------------- /front-end/public/broken-chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/public/broken-chain.png -------------------------------------------------------------------------------- /front-end/src/assets/InfoCircle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/InfoCircle.png -------------------------------------------------------------------------------- /front-end/src/assets/calendar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/calendar.png -------------------------------------------------------------------------------- /front-end/src/assets/chain-link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/chain-link.png -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1668264057338_create_table_public_track_info/down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE "public"."track_info"; 2 | -------------------------------------------------------------------------------- /node-watcher/images/10.k8check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/node-watcher/images/10.k8check.png -------------------------------------------------------------------------------- /node-watcher/images/4.imagelist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/node-watcher/images/4.imagelist.png -------------------------------------------------------------------------------- /node-watcher/images/5.dockertag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/node-watcher/images/5.dockertag.png -------------------------------------------------------------------------------- /node-watcher/images/7.copysha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/node-watcher/images/7.copysha.png -------------------------------------------------------------------------------- /node-watcher/images/8.pastesha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/node-watcher/images/8.pastesha.png -------------------------------------------------------------------------------- /node-watcher/images/9.k8create.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/node-watcher/images/9.k8create.png -------------------------------------------------------------------------------- /chain-db-open-server/.gitignore: -------------------------------------------------------------------------------- 1 | .env* 2 | dist 3 | package-lock.json 4 | node_modules 5 | .idea 6 | .vscode 7 | *.log 8 | lib 9 | -------------------------------------------------------------------------------- /front-end/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /front-end/src/assets/gov2-info-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/gov2-info-bg.png -------------------------------------------------------------------------------- /front-end/src/assets/kusama-logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/kusama-logo.gif -------------------------------------------------------------------------------- /front-end/src/assets/no-user-img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/no-user-img.png -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1612721658997_create_table_public_option_poll/down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE "public"."option_poll"; 2 | -------------------------------------------------------------------------------- /node-watcher/images/3.dockerbuild.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/node-watcher/images/3.dockerbuild.png -------------------------------------------------------------------------------- /node-watcher/images/6.dockerpush.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/node-watcher/images/6.dockerpush.png -------------------------------------------------------------------------------- /auth-server/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env 3 | data 4 | build 5 | private.pem 6 | public.pem 7 | *.sh 8 | *.log 9 | docker-compose.yaml -------------------------------------------------------------------------------- /front-end/src/assets/baby-robot-nft.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/baby-robot-nft.webp -------------------------------------------------------------------------------- /front-end/src/assets/background-POC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/background-POC.png -------------------------------------------------------------------------------- /front-end/src/assets/calendar_today.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/calendar_today.png -------------------------------------------------------------------------------- /front-end/src/assets/frowning-face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/frowning-face.png -------------------------------------------------------------------------------- /front-end/src/assets/gov2-info-bg-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/gov2-info-bg-2.png -------------------------------------------------------------------------------- /front-end/src/assets/gov2-info-bg-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/gov2-info-bg-3.png -------------------------------------------------------------------------------- /front-end/src/assets/pa-small-circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/pa-small-circle.png -------------------------------------------------------------------------------- /front-end/src/assets/parachains/live.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachains/live.png -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1651910848330_create_table_public_calender_events/down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE "public"."calender_events"; 2 | -------------------------------------------------------------------------------- /node-watcher/images/1.gcloudauthlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/node-watcher/images/1.gcloudauthlist.png -------------------------------------------------------------------------------- /docs/Polkassembly Governance Platform.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/docs/Polkassembly Governance Platform.pptx -------------------------------------------------------------------------------- /front-end/nginx/polkassembly.conf: -------------------------------------------------------------------------------- 1 | server { 2 | server_name polkassembly.io; 3 | return 302 https://kusama.polkassembly.io; 4 | } 5 | -------------------------------------------------------------------------------- /front-end/src/assets/parachains/chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachains/chain.png -------------------------------------------------------------------------------- /front-end/src/assets/parachains/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachains/github.png -------------------------------------------------------------------------------- /front-end/src/assets/polkassembly-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/polkassembly-logo.png -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1612721932728_create_table_public_option_poll_votes/down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE "public"."option_poll_votes"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1646242080392_create_table_public_blockchain_socials/down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE "public"."blockchain_socials"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1654027168741_create_table_public_proposal_tracker/down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE "public"."proposal_tracker"; 2 | -------------------------------------------------------------------------------- /kubernetes/redis/values/parity-prod.yaml: -------------------------------------------------------------------------------- 1 | cluster: 2 | enabled: false 3 | 4 | usePassword: true 5 | 6 | metrics: 7 | enabled: false 8 | -------------------------------------------------------------------------------- /kubernetes/redis/values/polkadot-prod.yaml: -------------------------------------------------------------------------------- 1 | cluster: 2 | enabled: false 3 | 4 | usePassword: true 5 | 6 | metrics: 7 | enabled: false 8 | -------------------------------------------------------------------------------- /front-end/src/assets/parachains/announced.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachains/announced.png -------------------------------------------------------------------------------- /front-end/src/assets/parachains/auction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachains/auction.png -------------------------------------------------------------------------------- /front-end/src/assets/parachains/crowdloan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachains/crowdloan.png -------------------------------------------------------------------------------- /front-end/src/assets/parachains/projects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachains/projects.png -------------------------------------------------------------------------------- /front-end/src/assets/parachains/testing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachains/testing.png -------------------------------------------------------------------------------- /front-end/src/assets/parachains/w3f-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachains/w3f-black.png -------------------------------------------------------------------------------- /front-end/src/assets/parachains/w3f-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachains/w3f-green.png -------------------------------------------------------------------------------- /front-end/src/assets/parachains/w3f-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachains/w3f-red.png -------------------------------------------------------------------------------- /front-end/src/assets/parachains/chain-link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachains/chain-link.png -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1646674760651_create_table_public_polkassembly_proposals/down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE "public"."polkassembly_proposals"; 2 | -------------------------------------------------------------------------------- /kubernetes/redis/values/dashboards-cluster-1.yaml: -------------------------------------------------------------------------------- 1 | cluster: 2 | enabled: false 3 | 4 | usePassword: true 5 | 6 | metrics: 7 | enabled: false 8 | -------------------------------------------------------------------------------- /polkassembly-alerts/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env 3 | data 4 | build 5 | private.pem 6 | public.pem 7 | *.sh 8 | *.log 9 | docker-compose.yaml -------------------------------------------------------------------------------- /front-end/src/assets/latest-activity-comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/latest-activity-comment.png -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/gear-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/gear-logo.jpg -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/kilt-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/kilt-logo.png -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/snow-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/snow-logo.png -------------------------------------------------------------------------------- /front-end/src/themes/tailwindSetup.css: -------------------------------------------------------------------------------- 1 | @import "~tailwindcss/base.css"; 2 | @import "~tailwindcss/components.css"; 3 | @import "~tailwindcss/utilities.css"; -------------------------------------------------------------------------------- /hasura/hasura-migrations/metadata/actions.yaml: -------------------------------------------------------------------------------- 1 | actions: [] 2 | custom_types: 3 | enums: [] 4 | input_objects: [] 5 | objects: [] 6 | scalars: [] 7 | -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/acuity-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/acuity-logo.jpg -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/astar-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/astar-logo.png -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/chain-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/chain-logo.jpg -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/heiko-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/heiko-logo.png -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/karura-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/karura-logo.jpg -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/khala-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/khala-logo.png -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/kusama-logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/kusama-logo.gif -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/kylin-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/kylin-logo.png -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/manta-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/manta-logo.jpg -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/shiden-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/shiden-logo.jpg -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/turing-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/turing-logo.png -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1653239697709_create_table_public_onchain_post_discussion_link/down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE "public"."onchain_post_discussion_link"; 2 | -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/altair-logo.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/altair-logo.jpeg -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/amplitude-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/amplitude-logo.png -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/automata-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/automata-logo.jpg -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/basilisk-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/basilisk-logo.jpg -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/calamari-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/calamari-logo.png -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/hydradx-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/hydradx-logo.jpg -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/moonbase-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/moonbase-logo.png -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/moonbeam-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/moonbeam-logo.png -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/moonriver-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/moonriver-logo.png -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/parallel-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/parallel-logo.jpg -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/pendulum-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/pendulum-logo.jpg -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/polkadex-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/polkadex-logo.jpg -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/polkadot-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/polkadot-logo.jpg -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/tanganika-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/tanganika-logo.png -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/westend-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/westend-logo.jpg -------------------------------------------------------------------------------- /front-end/src/assets/polkadot-logo-small-inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/polkadot-logo-small-inverted.png -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1594645939219_change_onchain_tip_id_to_text/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" ALTER COLUMN "onchain_tip_id" TYPE text; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1612722737654_alter_table_public_option_poll_add_column_end_at/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."option_poll" DROP COLUMN "end_at"; 2 | -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/centrifuge-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/centrifuge-logo.png -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/robonomics-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/robonomics-logo.jpg -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1668258355967_alter_table_public_onchain_links_add_column_track/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" DROP COLUMN "track"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1668258499553_alter_table_public_onchain_links_add_column_origin/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" DROP COLUMN "origin"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1612722737654_alter_table_public_option_poll_add_column_end_at/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."option_poll" ADD COLUMN "end_at" integer NULL; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1654797231902_alter_table_public_calender_events_add_column_status/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."calender_events" DROP COLUMN "status"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1655491508812_alter_table_public_calender_events_add_column_user_id/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."calender_events" DROP COLUMN "user_id"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1654797231902_alter_table_public_calender_events_add_column_status/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."calender_events" ADD COLUMN "status" text NULL; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1654797788806_alter_table_public_calender_events_add_column_event_id/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."calender_events" DROP COLUMN "event_id"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1657902531705_alter_table_public_calender_events_add_column_location/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."calender_events" DROP COLUMN "location"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1668258355967_alter_table_public_onchain_links_add_column_track/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" ADD COLUMN "track" integer NULL; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1668258499553_alter_table_public_onchain_links_add_column_origin/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" ADD COLUMN "origin" text NULL; 2 | -------------------------------------------------------------------------------- /security.txt: -------------------------------------------------------------------------------- 1 | Contact: mailto:hello@polkassembly.io 2 | Expires: 2027-12-31T22:00:00.000Z 3 | Encryption: https://kusama.polkassembly.io/pgp-key.txt 4 | Preferred-Languages: en 5 | -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/bitcountrypioneer-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/bitcountrypioneer-logo.jpg -------------------------------------------------------------------------------- /front-end/src/assets/parachain-logos/composable-finance-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Premiurly/polkassembly/HEAD/front-end/src/assets/parachain-logos/composable-finance-logo.png -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1654797244076_alter_table_public_calender_events_add_column_event_type/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."calender_events" DROP COLUMN "event_type"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1655491508812_alter_table_public_calender_events_add_column_user_id/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."calender_events" ADD COLUMN "user_id" integer NULL; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1657902531705_alter_table_public_calender_events_add_column_location/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."calender_events" ADD COLUMN "location" text NULL; 2 | -------------------------------------------------------------------------------- /node-watcher/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "endOfLine": "lf", 3 | "jsxSingleQuote": true, 4 | "semi": true, 5 | "singleQuote": true, 6 | "tabWidth": 2, 7 | "trailingComma": "es5" 8 | } 9 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1654797244076_alter_table_public_calender_events_add_column_event_type/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."calender_events" ADD COLUMN "event_type" text NULL; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1654797788806_alter_table_public_calender_events_add_column_event_id/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."calender_events" ADD COLUMN "event_id" integer NULL; 2 | -------------------------------------------------------------------------------- /node-watcher/prisma.yml: -------------------------------------------------------------------------------- 1 | endpoint: ${env:PRISMA_ENDPOINT} 2 | datamodel: datamodel.prisma 3 | 4 | generate: 5 | - generator: typescript-client 6 | output: ./src/generated/prisma-client/ -------------------------------------------------------------------------------- /chain-db-open-server/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "endOfLine": "lf", 3 | "jsxSingleQuote": true, 4 | "semi": true, 5 | "singleQuote": true, 6 | "tabWidth": 2, 7 | "trailingComma": "es5" 8 | } 9 | -------------------------------------------------------------------------------- /front-end/public/security.txt: -------------------------------------------------------------------------------- 1 | Contact: mailto:hello@polkassembly.io 2 | Expires: 2027-12-31T22:00:00.000Z 3 | Encryption: https://kusama.polkassembly.io/pgp-key.txt 4 | Preferred-Languages: en 5 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1603643648961_alter_table_public_onchain_links_add_column_onchain_bounty_id/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" DROP COLUMN "onchain_bounty_id"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1655491065001_alter_table_public_calender_events_add_column_approval_status/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."calender_events" DROP COLUMN "approval_status"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1656011914850_alter_table_public_onchain_links_add_column_onchain_child_bounty_id/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" DROP COLUMN "onchain_child_bounty_id"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1668258338117_alter_table_public_onchain_links_add_column_onchain_referendumv2_id/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" DROP COLUMN "onchain_referendumv2_id"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/config.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | endpoint: http://localhost:8080 3 | metadata_directory: metadata 4 | actions: 5 | kind: synchronous 6 | handler_webhook_baseurl: http://localhost:3000 7 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1603643648961_alter_table_public_onchain_links_add_column_onchain_bounty_id/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" ADD COLUMN "onchain_bounty_id" integer NULL UNIQUE; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1656011914850_alter_table_public_onchain_links_add_column_onchain_child_bounty_id/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" ADD COLUMN "onchain_child_bounty_id" integer NULL; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1656011924381_alter_table_public_onchain_links_alter_column_onchain_bounty_id/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" DROP CONSTRAINT "onchain_links_onchain_bounty_id_key"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1668258451894_alter_table_public_onchain_links_add_column_onchain_referendumv2_status/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" DROP COLUMN "onchain_referendumv2_status"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1655491065001_alter_table_public_calender_events_add_column_approval_status/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."calender_events" ADD COLUMN "approval_status" text NOT NULL DEFAULT 'pending'; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1668258338117_alter_table_public_onchain_links_add_column_onchain_referendumv2_id/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" ADD COLUMN "onchain_referendumv2_id" integer NULL UNIQUE; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1668258451894_alter_table_public_onchain_links_add_column_onchain_referendumv2_status/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" ADD COLUMN "onchain_referendumv2_status" text NULL; 2 | -------------------------------------------------------------------------------- /header.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 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1623052227181_alter_table_public_onchain_links_add_column_onchain_tech_committee_proposal_id/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" DROP COLUMN "onchain_tech_committee_proposal_id"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1673290206430_alter_table_public_onchain_links_add_column_onchain_fellowship_referendum_id/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" DROP COLUMN "onchain_fellowship_referendum_id"; 2 | -------------------------------------------------------------------------------- /front-end/header.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 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1673290226827_alter_table_public_onchain_links_add_column_onchain_fellowship_referendum_status/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" DROP COLUMN "onchain_fellowship_referendum_status"; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1673290206430_alter_table_public_onchain_links_add_column_onchain_fellowship_referendum_id/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" ADD COLUMN "onchain_fellowship_referendum_id" integer NULL; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1673290226827_alter_table_public_onchain_links_add_column_onchain_fellowship_referendum_status/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" ADD COLUMN "onchain_fellowship_referendum_status" text NULL; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1623052227181_alter_table_public_onchain_links_add_column_onchain_tech_committee_proposal_id/up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" ADD COLUMN "onchain_tech_committee_proposal_id" integer NULL UNIQUE; 2 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1656011924381_alter_table_public_onchain_links_alter_column_onchain_bounty_id/down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "public"."onchain_links" ADD CONSTRAINT "onchain_links_onchain_bounty_id_key" UNIQUE ("onchain_bounty_id"); 2 | -------------------------------------------------------------------------------- /kubernetes/polkassembly/templates/hasura-secret.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: graphql-jwt-secret 5 | type: Opaque 6 | data: 7 | HASURA_GRAPHQL_JWT_SECRET: {{ .Values.hasura.secret.HASURA_GRAPHQL_JWT_SECRET }} 8 | -------------------------------------------------------------------------------- /chain-db-open-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/node:12.0.0-alpine 2 | 3 | WORKDIR /server 4 | 5 | COPY package.json . 6 | COPY yarn.lock . 7 | 8 | # Install dependencies 9 | RUN yarn 10 | 11 | COPY . . 12 | 13 | CMD ["yarn", "start"] 14 | -------------------------------------------------------------------------------- /auth-server/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org/ 2 | 3 | root = true 4 | 5 | [*] 6 | end_of_line = lf 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | charset = utf-8 10 | indent_style = tab 11 | indent_size = 4 12 | -------------------------------------------------------------------------------- /health-monitor/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org/ 2 | 3 | root = true 4 | 5 | [*] 6 | end_of_line = lf 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | charset = utf-8 10 | indent_style = tab 11 | indent_size = 4 12 | -------------------------------------------------------------------------------- /kubernetes/polkassembly/templates/cloudsql-instance-credentials-secret.yaml: -------------------------------------------------------------------------------- 1 | kind: Secret 2 | metadata: 3 | name: cloudsql-instance-credentials 4 | type: Opaque 5 | apiVersion: v1 6 | data: 7 | credentials.json: {{ .Values.cloudsql.instanceCredentials }} 8 | -------------------------------------------------------------------------------- /api-bump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd auth-server && yarn api:bump 4 | 5 | cd .. 6 | 7 | cd front-end && yarn api:bump 8 | 9 | cd .. 10 | 11 | cd health-monitor && yarn api:bump 12 | 13 | cd .. 14 | 15 | cd node-watcher && yarn api:bump 16 | 17 | cd .. 18 | -------------------------------------------------------------------------------- /front-end/src/react-app-env.d.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 | /// -------------------------------------------------------------------------------- /front-end/src/global/noTitle.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 noTitle = 'Untitled'; 6 | -------------------------------------------------------------------------------- /front-end/src/global/appName.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 APPNAME = 'polkassembly'; 6 | -------------------------------------------------------------------------------- /auth-server/src/schema/query/token.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 default ` 6 | token: Token 7 | `; 8 | -------------------------------------------------------------------------------- /kubernetes/polkassembly/templates/auth-server-secrets.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: auth-jwt-key 5 | type: Opaque 6 | data: 7 | JWT_PRIVATE_KEY: {{ .Values.authServer.secret.JWT_PRIVATE_KEY }} 8 | JWT_PUBLIC_KEY: {{ .Values.authServer.secret.JWT_PUBLIC_KEY }} 9 | -------------------------------------------------------------------------------- /auth-server/src/schema/query/user.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 default ` 6 | user(id: Int!): User 7 | `; 8 | -------------------------------------------------------------------------------- /kubernetes/node-watcher/templates/node-watcher-prisma-secret.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: prisma-config 5 | labels: 6 | {{- include "node-watcher.nodeWatcher.labels" . | nindent 4 }} 7 | data: 8 | prisma-config: {{ include "node-watcher.prisma-config" . | b64enc }} 9 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/logout.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 default ` 6 | logout: Message 7 | `; 8 | 9 | -------------------------------------------------------------------------------- /front-end/src/assets/lottie-graphics/Slash.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cloud-functions/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": [ 3 | { 4 | "source": "functions", 5 | "codebase": "default", 6 | "ignore": [ 7 | "node_modules", 8 | ".git", 9 | "firebase-debug.log", 10 | "firebase-debug.*.log" 11 | ] 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /auth-server/src/schema/query/profile.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 default ` 6 | profile(username: String!): User 7 | `; 8 | -------------------------------------------------------------------------------- /front-end/src/components/Post/ActionsBar/Reactionbar/reactions.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 reactions = ['👍', '👎']; 6 | -------------------------------------------------------------------------------- /front-end/src/global/post_types.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 post_type = { 6 | 'OFF_CHAIN': 1, 7 | 'ON_CHAIN': 2 8 | }; 9 | -------------------------------------------------------------------------------- /util/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./build", 4 | "declaration": true, 5 | "esModuleInterop": true, 6 | "module": "commonjs", 7 | "strict": true, 8 | "target": "es5" 9 | }, 10 | "include": ["./src"], 11 | "exclude": ["node_modules"] 12 | } -------------------------------------------------------------------------------- /auth-server/src/schema/query/userDetails.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 default ` 6 | userDetails(user_id: Int!): Profile 7 | `; 8 | -------------------------------------------------------------------------------- /auth-server/src/schema/query/about.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 default ` 6 | about(network: String!, address: String!): About 7 | `; 8 | -------------------------------------------------------------------------------- /auth-server/src/schema/query/subscription.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 default ` 6 | subscription(post_id: Int!): Subscription 7 | `; 8 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/token.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 default ` 6 | type Token { 7 | token: String 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /front-end/src/import-png.d.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 | declare module '*.png' { 6 | const value: any; 7 | export default value; 8 | } 9 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/resendVerifyEmailToken.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 default ` 6 | resendVerifyEmailToken: Message 7 | `; 8 | -------------------------------------------------------------------------------- /auth-server/src/schema/query/userWithUsername.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 | export default ` 5 | userWithUsername(username: String!): Profile 6 | `; 7 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/message.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 default ` 6 | type Message { 7 | message: String 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /front-end/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "hosting": { 3 | "public": "build", 4 | "ignore": [ 5 | "firebase.json", 6 | "**/.*", 7 | "**/node_modules/**" 8 | ], 9 | "rewrites": [ 10 | { 11 | "source": "**", 12 | "destination": "/index.html" 13 | } 14 | ] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1651910848330_create_table_public_calender_events/up.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE "public"."calender_events"("id" serial NOT NULL, "title" text NOT NULL, "content" text, "start_time" timestamptz NOT NULL, "end_time" timestamptz NOT NULL, "network" text NOT NULL, "module" text, "url" text, PRIMARY KEY ("id") ); 2 | -------------------------------------------------------------------------------- /auth-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/node:12 2 | 3 | RUN mkdir -p /opt/app 4 | 5 | RUN chown node:node /opt/app 6 | 7 | WORKDIR /opt/app 8 | 9 | COPY --chown=node:node package.json . 10 | COPY --chown=node:node yarn.lock . 11 | 12 | USER node 13 | 14 | RUN yarn 15 | 16 | COPY --chown=node:node . . 17 | 18 | CMD yarn start 19 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1646242080392_create_table_public_blockchain_socials/up.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE "public"."blockchain_socials"("network" text NOT NULL, "discord" text, "reddit" text, "github" text, "twitter" text, "youtube" text, "telegram" text, "homepage" text, "block_explorer" text, "id" serial NOT NULL, PRIMARY KEY ("id") ); 2 | -------------------------------------------------------------------------------- /chain-db-watcher/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/node:12 2 | 3 | RUN mkdir -p /opt/app 4 | 5 | RUN chown node:node /opt/app 6 | 7 | WORKDIR /opt/app 8 | 9 | COPY --chown=node:node package.json . 10 | COPY --chown=node:node yarn.lock . 11 | 12 | USER node 13 | 14 | RUN yarn 15 | 16 | COPY --chown=node:node . . 17 | 18 | CMD yarn start 19 | -------------------------------------------------------------------------------- /health-monitor/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/node:14 2 | 3 | RUN mkdir -p /opt/app 4 | 5 | RUN chown node:node /opt/app 6 | 7 | WORKDIR /opt/app 8 | 9 | COPY --chown=node:node package.json . 10 | COPY --chown=node:node yarn.lock . 11 | 12 | USER node 13 | 14 | RUN yarn 15 | 16 | COPY --chown=node:node . . 17 | 18 | CMD yarn start:prod 19 | -------------------------------------------------------------------------------- /util/src/index.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 * from './getThresholds'; 6 | export * from './newton-raphson'; 7 | export * from './solveQuadraticEquation'; 8 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/loginResponse.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 default ` 6 | type LoginResponse { 7 | token: String 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/publicUser.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 default ` 6 | type PublicUser { 7 | id: Int 8 | username: String 9 | } 10 | `; 11 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/subscription.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 default ` 6 | type Subscription { 7 | subscribed: Boolean 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /auth-server/test.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12 2 | 3 | RUN mkdir -p /opt/test 4 | 5 | RUN chown node:node /opt/test 6 | 7 | WORKDIR /opt/test 8 | 9 | COPY --chown=node:node package.json . 10 | 11 | COPY --chown=node:node yarn.lock . 12 | 13 | USER node 14 | 15 | RUN yarn 16 | 17 | COPY --chown=node:node . . 18 | 19 | CMD yarn test:dangerous 20 | -------------------------------------------------------------------------------- /auth-server/test/rewiremock.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 rewiremock from 'rewiremock'; 5 | 6 | rewiremock.overrideEntryPoint(module); 7 | 8 | export { rewiremock }; 9 | -------------------------------------------------------------------------------- /kubernetes/polkassembly/templates/hasura-config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: {{ .Values.hasura.name }}-config 5 | labels: 6 | {{- include "polkassembly.hasura.labels" . | nindent 4 }} 7 | data: 8 | {{- range $key, $val := .Values.hasura.config }} 9 | {{ $key }}: {{ $val | quote }} 10 | {{- end }} 11 | -------------------------------------------------------------------------------- /util/jest.config.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 | /* eslint-disable no-undef */ 6 | module.exports = { 7 | preset: 'ts-jest', 8 | testEnvironment: 'node' 9 | }; 10 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/deleteAccount.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 default ` 6 | deleteAccount( 7 | password: String! 8 | ): Message 9 | `; 10 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/postSubscribe.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 default ` 6 | postSubscribe( 7 | post_id: Int! 8 | ): Message 9 | `; 10 | -------------------------------------------------------------------------------- /chain-db-open-server/kubernetes/nodewatcher-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | app: nodewatcher-server 6 | name: nodewatcher-server 7 | spec: 8 | ports: 9 | - name: nodewatcher-server 10 | port: 4000 11 | protocol: TCP 12 | selector: 13 | app: nomidot-server 14 | type: ClusterIP 15 | -------------------------------------------------------------------------------- /kubernetes/node-watcher/templates/harvester-config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: {{ .Values.harvester.name }}-config 5 | labels: 6 | {{- include "node-watcher.harvester.labels" . | nindent 4 }} 7 | data: 8 | {{- range $key, $val := .Values.harvester.config }} 9 | {{ $key }}: {{ $val | quote }} 10 | {{- end }} 11 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/postUnsubscribe.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 default ` 6 | postUnsubscribe( 7 | post_id: Int! 8 | ): Message 9 | `; 10 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/verifyEmail.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 default ` 6 | verifyEmail( 7 | token: String! 8 | ): ChangeResponse 9 | `; 10 | -------------------------------------------------------------------------------- /front-end/src/polkassemblyutils/index.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 * from './getThresholds'; 6 | export * from './newton-raphson'; 7 | export * from './solveQuadraticEquation'; 8 | -------------------------------------------------------------------------------- /front-end/src/util/cleanError.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 default function (text:string): string { 6 | return text.replace(/Network error: |GraphQL error: /g,''); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/metadata/remote_schemas.yaml: -------------------------------------------------------------------------------- 1 | - name: auth 2 | definition: 3 | url_from_env: HASURA_AUTH_SERVER_REMOTE_SCHEMA 4 | timeout_seconds: 60 5 | forward_client_headers: true 6 | - name: chain-db 7 | definition: 8 | url_from_env: HASURA_CHAIN_DB_REMOTE_SCHEMA 9 | timeout_seconds: 60 10 | forward_client_headers: true 11 | -------------------------------------------------------------------------------- /kubernetes/polkassembly/templates/auth-server-config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: {{ .Values.authServer.name }}-config 5 | labels: 6 | {{- include "polkassembly.authServer.labels" . | nindent 4 }} 7 | data: 8 | {{- range $key, $val := .Values.authServer.config }} 9 | {{ $key }}: {{ $val | quote }} 10 | {{- end }} 11 | -------------------------------------------------------------------------------- /node-watcher/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/node:14 2 | 3 | # ENV PRISMA_ENDPOINT http://prisma:4466 4 | 5 | WORKDIR /node_watcher 6 | 7 | # To make the build fast 8 | COPY package.json . 9 | COPY yarn.lock . 10 | 11 | # Install dependencies 12 | RUN yarn 13 | 14 | COPY ./ ./ 15 | 16 | # Create the database schema 17 | CMD ["yarn", "prisma", "deploy"] 18 | 19 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/addressUnlink.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 default ` 6 | addressUnlink( 7 | address: String! 8 | ): ChangeResponse 9 | `; 10 | -------------------------------------------------------------------------------- /auth-server/src/schema/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 | export default ` 6 | editPostStart( 7 | address: String! 8 | ): AddressLoginType 9 | `; 10 | -------------------------------------------------------------------------------- /chain-db-open-server/.graphqlconfig.yml: -------------------------------------------------------------------------------- 1 | projects: 2 | app: 3 | schemaPath: src/schema.graphql 4 | extensions: null 5 | endpoints: null 6 | default: 'http://0.0.0.0:4000' 7 | prisma: 8 | schemaPath: src/generated/prisma.graphql 9 | extensions: 10 | endpoints: 11 | dev: 'http://127.0.0.1:4466' 12 | prisma: prisma/prisma.yml 13 | -------------------------------------------------------------------------------- /auth-server/src/model/connection.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 Knex from 'knex'; 6 | 7 | import connection from '../../knexfile'; 8 | 9 | export default Knex(connection); 10 | 11 | -------------------------------------------------------------------------------- /auth-server/src/schema/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 | export default ` 6 | createPostStart( 7 | address: String! 8 | ): AddressLoginType 9 | `; 10 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/requestResetPassword.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 default ` 6 | requestResetPassword( 7 | email: String! 8 | ): Message 9 | `; 10 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/setDefaultAddress.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 default ` 6 | setDefaultAddress( 7 | address: String! 8 | ): ChangeResponse 9 | `; 10 | -------------------------------------------------------------------------------- /auth-server/src/utils/shortenHash.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 default function (hash: string): string { 6 | return `${hash.substring(0, 3)}...${hash.substring(hash.length - 3)}`; 7 | } 8 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/addressLoginStart.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 default ` 6 | addressLoginStart( 7 | address: String! 8 | ): AddressLoginType 9 | `; 10 | -------------------------------------------------------------------------------- /auth-server/src/schema/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 | export default ` 6 | addressSignupStart( 7 | address: String! 8 | ): AddressLoginType 9 | `; 10 | -------------------------------------------------------------------------------- /auth-server/src/schema/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 | export default ` 6 | multisigLinkStart( 7 | address: String! 8 | ): AddressLoginType 9 | `; 10 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/undoEmailChange.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 default ` 6 | undoEmailChange( 7 | token: String! 8 | ): UndoEmailChangeResponse 9 | `; 10 | -------------------------------------------------------------------------------- /front-end/src/global/apiKeys.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 REACT_APP_SUBSCAN_API_KEY = '74d1845ab15f4b889a64dfef074ef222'; 6 | export const FIREBASE_API_KEY = process.env.FIREBASE_API_KEY; -------------------------------------------------------------------------------- /kubernetes/polkassembly/templates/health-monitor-config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: {{ .Values.healthMonitor.name }}-config 5 | labels: 6 | {{- include "polkassembly.healthMonitor.labels" . | nindent 4 }} 7 | data: 8 | {{- range $key, $val := .Values.healthMonitor.config }} 9 | {{ $key }}: {{ $val | quote }} 10 | {{- end }} 11 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/login.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 default ` 6 | login( 7 | username: String! 8 | password: String! 9 | ): LoginResponse 10 | `; 11 | -------------------------------------------------------------------------------- /auth-server/src/schema/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 | export default ` 6 | setCredentialsStart( 7 | address: String! 8 | ): AddressLoginType 9 | `; 10 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/changeResponse.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 default ` 6 | type ChangeResponse { 7 | message: String 8 | token: String 9 | } 10 | `; 11 | -------------------------------------------------------------------------------- /kubernetes/polkassembly/templates/chain-db-watcher-config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: {{ .Values.chainDbWatcher.name }}-config 5 | labels: 6 | {{- include "polkassembly.chainDbWatcher.labels" . | nindent 4 }} 7 | data: 8 | {{- range $key, $val := .Values.chainDbWatcher.config }} 9 | {{ $key }}: {{ $val | quote }} 10 | {{- end }} 11 | -------------------------------------------------------------------------------- /auth-server/src/utils/validateEmail.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 validator from 'validator'; 6 | 7 | export default (email: string): boolean => { 8 | return validator.isEmail(email); 9 | }; 10 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/changeEmail.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 default ` 6 | changeEmail( 7 | email: String! 8 | password: String! 9 | ): ChangeResponse 10 | `; 11 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/updateProposalTracker.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 default ` 6 | updateProposalTracker( 7 | id: Int!, 8 | status: String! 9 | ): Message 10 | `; 11 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/addressLoginType.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 default ` 6 | type AddressLoginType { 7 | message: String 8 | signMessage: String 9 | } 10 | `; 11 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/addressLogin.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 default ` 6 | addressLogin( 7 | address: String! 8 | signature: String! 9 | ): LoginResponse 10 | `; 11 | -------------------------------------------------------------------------------- /front-end/src/global/post_topics.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 post_topic = { 6 | 'COUNCIL': 2, 7 | 'DEMOCRACY': 1, 8 | 'GENERAL': 5, 9 | 'TECHNICAL_COMMITTEE': 3, 10 | 'TREASURY': 4 11 | }; 12 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/addressLinkStart.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 default ` 6 | addressLinkStart( 7 | network: String! 8 | address: String! 9 | ): AddressLinkType 10 | `; 11 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/changeUsername.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 default ` 6 | changeUsername( 7 | password: String! 8 | username: String! 9 | ): ChangeResponse 10 | `; 11 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/addressLinkConfirm.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 default ` 6 | addressLinkConfirm( 7 | address_id: Int! 8 | signature: String! 9 | ): ChangeResponse 10 | `; 11 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/changePassword.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 default ` 6 | changePassword( 7 | oldPassword: String! 8 | newPassword: String! 9 | ): Message 10 | `; 11 | 12 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/signup.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 default ` 6 | signup( 7 | email: String 8 | password: String! 9 | username: String! 10 | ): LoginResponse 11 | `; 12 | -------------------------------------------------------------------------------- /front-end/src/themes/xstyled.d.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 | declare module '@xstyled/styled-components' { 6 | import styled from 'styled-components'; 7 | export * from 'styled-components'; 8 | export default styled; 9 | } 10 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/resetPassword.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 default ` 6 | resetPassword( 7 | token: String! 8 | userId: Int! 9 | newPassword: String! 10 | ): Message 11 | `; 12 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/addressLinkType.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 default ` 6 | type AddressLinkType { 7 | sign_message: String 8 | message: String 9 | address_id: Int 10 | } 11 | `; 12 | -------------------------------------------------------------------------------- /chain-db-open-server/src/types.ts: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 @paritytech/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 { Prisma } from './generated/prisma-client'; 6 | 7 | export interface Context { 8 | prisma: Prisma; 9 | } 10 | 11 | export type Selectors = Record; 12 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1668264057338_create_table_public_track_info/up.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE "public"."track_info"("id" serial NOT NULL, "track_id" integer NOT NULL, "name" text NOT NULL, "max_deciding" integer NOT NULL, "decision_deposit" text NOT NULL, "prepare_period" integer NOT NULL, "decision_period" integer NOT NULL, "confirm_period" integer NOT NULL, "min_enactment_period" integer NOT NULL, PRIMARY KEY ("id") ); 2 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/address.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 default ` 6 | type Address { 7 | address: String 8 | public_key: String 9 | name: String 10 | source: String 11 | } 12 | `; 13 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/undoEmailChangeResponse.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 default ` 6 | type UndoEmailChangeResponse { 7 | message: String 8 | email: String 9 | token: String 10 | } 11 | `; 12 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/changeNotificationPreference.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 default ` 6 | changeNotificationPreference( 7 | notificationPreferences: NotificationPreferencesInput 8 | ): ChangeResponse 9 | `; 10 | -------------------------------------------------------------------------------- /front-end/src/app.less: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;1,200;1,300;1,400;1,500;1,600;1,700&display=swap"); 2 | @import url("https://fonts.googleapis.com/css?family=Roboto+Mono:400,500&display=swap"); 3 | @import url("https://fonts.googleapis.com/css?family=Work+Sans:500&display=swap"); 4 | @import "~antd/dist/antd.less"; 5 | @import "/src/themes/customAntdTheme.less"; 6 | -------------------------------------------------------------------------------- /node-watcher/src/util/getEnvVars.ts: -------------------------------------------------------------------------------- 1 | export default () => { 2 | return { 3 | ARCHIVE_NODE_ENDPOINT: process.env.ARCHIVE_NODE_ENDPOINT || "wss://kusama-rpc.polkadot.io/", 4 | BLOCK_IDENTIFIER: process.env.BLOCK_IDENTIFIER || "IDENTIFIER", 5 | MAX_LAG: parseInt(process.env.MAX_LAG || '0'), 6 | PRISMA_ENDPOINT: process.env.PRISMA_ENDPOINT, 7 | START_FROM: parseInt(process.env.START_FROM || '0') 8 | } 9 | } -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/addressSignupConfirm.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 default ` 6 | addressSignupConfirm( 7 | address: String! 8 | network: String! 9 | signature: String! 10 | ): LoginResponse 11 | `; 12 | -------------------------------------------------------------------------------- /node-watcher/src/connection.ts: -------------------------------------------------------------------------------- 1 | import { ApiPromise, WsProvider } from '@polkadot/api'; 2 | 3 | 4 | export async function nodeWatcher() { 5 | 6 | const provider = new WsProvider('ws://127.0.0.1:9944'); 7 | 8 | const api = await ApiPromise.create({ provider }); 9 | 10 | setInterval(async () => { 11 | console.log(api.isConnected) 12 | }, 1000); 13 | } 14 | 15 | nodeWatcher().then(() => console.log('done')).catch(console.error); -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/addProfile.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 default ` 6 | addProfile( 7 | user_id: Int! 8 | bio: String 9 | image: String 10 | title: String 11 | badges: String 12 | ): Message 13 | `; 14 | -------------------------------------------------------------------------------- /chain-db-open-server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "exclude": ["node_modules", "generated"], 3 | "include": ["./src"], 4 | "compilerOptions": { 5 | "baseUrl": ".", 6 | "declaration": true, 7 | "downlevelIteration": true, 8 | "esModuleInterop": true, 9 | "jsx": "react", 10 | "lib": ["dom", "esnext"], 11 | "outDir": "./lib", 12 | "skipLibCheck": true, 13 | "strict": true, 14 | "target": "es5" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/about.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 default ` 6 | type About { 7 | network: String 8 | address: String 9 | title: String 10 | description: String 11 | image: String 12 | } 13 | `; 14 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/profile.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 default ` 6 | type Profile { 7 | id: Int 8 | user_id: Int 9 | bio: String 10 | image: String 11 | title: String 12 | badges: String 13 | } 14 | `; 15 | -------------------------------------------------------------------------------- /kubernetes/polkassembly/templates/hasura-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ .Values.hasura.name }}-service 5 | labels: 6 | {{- include "polkassembly.hasura.labels" . | nindent 4 }} 7 | spec: 8 | type: {{ .Values.hasura.service.type }} 9 | ports: 10 | - port: {{ .Values.hasura.service.port }} 11 | protocol: TCP 12 | selector: 13 | {{- include "polkassembly.hasura.selectorLabels" . | nindent 4 }} 14 | -------------------------------------------------------------------------------- /node-watcher/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "exclude": ["**/generated/**/*", "node_modules", "public", ".cache"], 3 | "include": ["./src"], 4 | "compilerOptions": { 5 | "baseUrl": ".", 6 | "declaration": true, 7 | "downlevelIteration": true, 8 | "esModuleInterop": true, 9 | "jsx": "react", 10 | "lib": ["dom", "esnext"], 11 | "outDir": "./lib", 12 | "skipLibCheck": true, 13 | "strict": true, 14 | "target": "es5" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/reportContent.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 | export default ` 5 | reportContent( 6 | type: String! 7 | content_id: String! 8 | reason: String! 9 | comments: String 10 | network: String! 11 | ): Message 12 | `; 13 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/notificationPreferences.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 default ` 6 | type NotificationPreferences { 7 | postParticipated: Boolean 8 | postCreated: Boolean 9 | newProposal: Boolean 10 | ownProposal: Boolean 11 | } 12 | `; 13 | -------------------------------------------------------------------------------- /kubernetes/polkassembly/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *~ 18 | # Various IDEs 19 | .project 20 | .idea/ 21 | *.tmproj 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /kubernetes/polkassembly/templates/health-monitor-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ .Values.healthMonitor.name }}-service 5 | labels: 6 | {{- include "polkassembly.healthMonitor.labels" . | nindent 4 }} 7 | spec: 8 | type: ClusterIP 9 | ports: 10 | - port: {{ .Values.healthMonitor.config.PORT }} 11 | protocol: TCP 12 | selector: 13 | {{- include "polkassembly.healthMonitor.selectorLabels" . | nindent 4 }} 14 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/changeAbout.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 default ` 6 | changeAbout( 7 | network: String! 8 | address: String! 9 | title: String! 10 | description: String! 11 | image: String 12 | signature: String! 13 | ): Message 14 | `; 15 | -------------------------------------------------------------------------------- /front-end/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | .vscode 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | *.log 26 | 27 | .eslintcache -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/createProposalTracker.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 default ` 6 | createProposalTracker( 7 | onchain_proposal_id: Int!, 8 | status: String!, 9 | deadline: String!, 10 | network: String!, 11 | start_time: String! 12 | ): Message 13 | `; 14 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/linkProxyAddress.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 default ` 6 | linkProxyAddress( 7 | network: String! 8 | proxied: String! 9 | proxy: String! 10 | message: String! 11 | signature: String! 12 | ): ChangeResponse 13 | `; 14 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/notificationPreferencesInput.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 default ` 6 | input NotificationPreferencesInput { 7 | postParticipated: Boolean 8 | postCreated: Boolean 9 | newProposal: Boolean 10 | ownProposal: Boolean 11 | } 12 | `; 13 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/notificationPreferencesType.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 default ` 6 | input NotificationPreferencesType { 7 | postParticipated: Boolean 8 | postCreated: Boolean 9 | newProposal: Boolean 10 | ownProposal: Boolean 11 | } 12 | `; 13 | -------------------------------------------------------------------------------- /auth-server/src/utils/nameBlacklist.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 default [ 6 | 'administrator', 7 | 'admin', 8 | 'parity', 9 | 'web3foundation', 10 | 'polkadot', 11 | 'kusama', 12 | 'polkassembly', 13 | 'staff', 14 | 'gavinwood', 15 | 'gavwood', 16 | 'gavofyork' 17 | ]; 18 | 19 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/createPostConfirm.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 default ` 6 | createPostConfirm( 7 | network: String! 8 | address: String! 9 | title: String! 10 | content: String! 11 | signature: String! 12 | ): Message 13 | `; 14 | -------------------------------------------------------------------------------- /kubernetes/polkassembly/templates/auth-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ .Values.authServer.name }}-service 5 | labels: 6 | {{- include "polkassembly.authServer.labels" . | nindent 4 }} 7 | spec: 8 | type: {{ .Values.authServer.service.type }} 9 | ports: 10 | - port: {{ .Values.authServer.service.port }} 11 | protocol: TCP 12 | selector: 13 | {{- include "polkassembly.authServer.selectorLabels" . | nindent 4 }} 14 | -------------------------------------------------------------------------------- /kubernetes/polkassembly/templates/chain-db-watcher-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ .Values.chainDbWatcher.name }}-service 5 | labels: 6 | {{- include "polkassembly.chainDbWatcher.labels" . | nindent 4 }} 7 | spec: 8 | type: ClusterIP 9 | ports: 10 | - port: {{ .Values.chainDbWatcher.config.HEALTH_PORT }} 11 | protocol: TCP 12 | selector: 13 | {{- include "polkassembly.chainDbWatcher.selectorLabels" . | nindent 4 }} 14 | -------------------------------------------------------------------------------- /auth-server/src/schema/type/user.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 default ` 6 | type User { 7 | id: Int 8 | kusama_default_address: String 9 | polkadot_default_address: String 10 | email: String 11 | email_verified: Boolean 12 | username: String 13 | web3signup: Boolean 14 | } 15 | `; 16 | -------------------------------------------------------------------------------- /front-end/src/assets/no-proposal.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /front-end/src/fragments/author.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 authorFields = gql` 8 | fragment authorFields on User { 9 | id 10 | kusama_default_address 11 | polkadot_default_address 12 | username 13 | } 14 | `; 15 | -------------------------------------------------------------------------------- /kubernetes/node-watcher/templates/chain-db-open-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ .Values.chainDbOpenServer.name }}-service 5 | labels: 6 | {{- include "node-watcher.chainDbOpenServer.labels" . | nindent 4 }} 7 | spec: 8 | ports: 9 | - port: {{ .Values.chainDbOpenServer.service.port }} 10 | protocol: TCP 11 | selector: 12 | {{- include "node-watcher.chainDbOpenServer.selectorLabels" . | nindent 4 }} 13 | type: ClusterIP 14 | -------------------------------------------------------------------------------- /kubernetes/node-watcher/templates/node-watcher-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ .Values.nodeWatcher.name }}-service 5 | labels: 6 | {{- include "node-watcher.nodeWatcher.labels" . | nindent 4 }} 7 | spec: 8 | type: {{ .Values.nodeWatcher.service.type }} 9 | ports: 10 | - port: {{ .Values.nodeWatcher.service.port }} 11 | protocol: TCP 12 | selector: 13 | {{- include "node-watcher.nodeWatcher.selectorLabels" . | nindent 4 }} 14 | -------------------------------------------------------------------------------- /chain-db-open-server/kubernetes/loadbalancer.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: nomidot-server 5 | namespace: nomidot-staging 6 | labels: 7 | stage: staging 8 | name: nomidot-server 9 | app: nomidot-staging 10 | spec: 11 | loadBalancerIP: 35.189.196.74 12 | externalTrafficPolicy: Local 13 | type: LoadBalancer 14 | selector: 15 | app: nomidot-server 16 | ports: 17 | - protocol: TCP 18 | port: 4000 19 | targetPort: 4000 20 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/setCredentialsConfirm.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 default ` 6 | setCredentialsConfirm( 7 | address: String! 8 | email: String 9 | password: String! 10 | signature: String! 11 | username: String! 12 | ): ChangeResponse 13 | `; 14 | -------------------------------------------------------------------------------- /auth-server/src/utils/getPublicKey.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 { u8aToHex } from '@polkadot/util'; 6 | import { decodeAddress } from '@polkadot/util-crypto'; 7 | 8 | export default (address: string): string => { 9 | const publicKey = decodeAddress(address); 10 | 11 | return u8aToHex(publicKey); 12 | }; 13 | -------------------------------------------------------------------------------- /front-end/src/screens/VerifyEmail/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 MUTATION_VERIFY_EMAIL = gql` 8 | mutation verifyEmail($token: String!){ 9 | verifyEmail(token: $token){ 10 | message, 11 | token 12 | } 13 | } 14 | `; 15 | -------------------------------------------------------------------------------- /auth-server/src/utils/validatePassword.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 { UserInputError } from 'apollo-server'; 6 | 7 | import messages from './messages'; 8 | 9 | export default (password: string): void => { 10 | if (password.length < 6) { 11 | throw new UserInputError(messages.PASSWORD_LENGTH_ERROR); 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /front-end/src/assets/sidebar/motions.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1643824981772_create_table_public_replies/up.sql: -------------------------------------------------------------------------------- 1 | CREATE EXTENSION IF NOT EXISTS pgcrypto; 2 | CREATE TABLE "public"."replies"("id" uuid NOT NULL DEFAULT gen_random_uuid(), "content" text NOT NULL, "comment_id" uuid 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 ("comment_id") REFERENCES "public"."comments"("id") ON UPDATE restrict ON DELETE restrict, UNIQUE ("id")); 3 | -------------------------------------------------------------------------------- /front-end/src/screens/RequestResetPassword/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 MUTATION_RESET_PASSWORD_REQUEST = gql` 8 | mutation requestResetPassword($email: String!){ 9 | requestResetPassword(email: $email){ 10 | message 11 | } 12 | } 13 | `; 14 | -------------------------------------------------------------------------------- /front-end/src/util/checkGov2Route.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 { gov2Routes } from 'src/components/AppLayout/SwitchRoutes'; 6 | 7 | export default function checkGov2Route(pathname: string): boolean { 8 | if(pathname === '/referenda'){ 9 | return false; 10 | } 11 | 12 | return gov2Routes.includes(pathname.split('/')[1]); 13 | } -------------------------------------------------------------------------------- /front-end/src/ui-components/InlineTag.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 { Tag } from 'antd'; 5 | import React from 'react'; 6 | 7 | interface Props { 8 | className?: string 9 | topic: string 10 | } 11 | 12 | const InlineTag = ({ className, topic } : Props) => {topic}; 13 | 14 | export default InlineTag; -------------------------------------------------------------------------------- /front-end/src/util/shortenAddress.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 default (address: string, shortenAddressLength: number = 4) => { 6 | if (!address || address.length < 8) { 7 | return address; 8 | } 9 | 10 | return `${address.substring(0, shortenAddressLength)}...${address.substring(address.length - shortenAddressLength)}`; 11 | }; 12 | -------------------------------------------------------------------------------- /front-end/src/assets/icons/cube.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /front-end/src/components/Post/GovernanceSideBar/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 getCouncilMembers= gql` 8 | query getCouncilMembers{ 9 | councils(last: 1){ 10 | members { 11 | id 12 | address 13 | } 14 | } 15 | } 16 | `; 17 | -------------------------------------------------------------------------------- /front-end/src/util/handlePaginationChange.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 | interface Args { 6 | LIMIT: number; 7 | page:number; 8 | setOffset: (value: React.SetStateAction) => void; 9 | } 10 | export const handlePaginationChange = ({ LIMIT, page, setOffset }: Args) => { 11 | window.scrollTo(0, 300); 12 | setOffset(Math.ceil(LIMIT * (page - 1))); 13 | }; -------------------------------------------------------------------------------- /hasura/hasura-migrations/migrations/1646674760651_create_table_public_polkassembly_proposals/up.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE "public"."polkassembly_proposals"("id" serial NOT NULL, "author_id" integer NOT NULL, "proposal_id" integer NOT NULL, "proposer_address" text NOT NULL, "proposal_hash" text NOT NULL UNIQUE, "proposal_type" integer NOT NULL DEFAULT 0, "title" text NOT NULL, "content" text NOT NULL, "is_synced" boolean NOT NULL DEFAULT False, "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), PRIMARY KEY ("id") ); 2 | -------------------------------------------------------------------------------- /polkassembly-alerts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "polkassembly-alerts", 3 | "version": "1.0.0", 4 | "license": "MIT", 5 | "type": "module", 6 | "dependencies": { 7 | "@apollo/client": "^3.4.10", 8 | "@polkadot/api": "^5.8.3", 9 | "@sendgrid/mail": "^7.4.6", 10 | "apollo-boost": "^0.4.9", 11 | "apollo-cache-inmemory": "^1.6.6", 12 | "apollo-client": "^2.6.10", 13 | "apollo-link-http": "^1.5.17", 14 | "graphql": "^15.5.3", 15 | "graphql-tag": "^2.12.5", 16 | "node-fetch": "^3.0.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /auth-server/migrations/20200219105704_refresh_tokens_index.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('refresh_tokens', (table) => { 6 | table.index('token'); 7 | }); 8 | }; 9 | 10 | exports.down = function(knex) { 11 | return knex.schema.table('users', (table) => { 12 | table.dropIndex('token'); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/editPostConfirm.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 default ` 6 | editPostConfirm( 7 | network: String! 8 | address: String! 9 | title: String! 10 | content: String! 11 | signature: String! 12 | proposalType: String! 13 | proposalId: String! 14 | ): Message 15 | `; 16 | -------------------------------------------------------------------------------- /front-end/src/screens/UndoEmailChange/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 MUTATION_UNDO_EMAIL_CHANGE = gql` 8 | mutation undoEmailChange($token: String!){ 9 | undoEmailChange(token: $token){ 10 | message, 11 | token, 12 | email 13 | } 14 | } 15 | `; 16 | -------------------------------------------------------------------------------- /front-end/src/util/getRelativeCreatedAt.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 moment from 'moment'; 6 | 7 | export default function getRelativeCreatedAt (created_at?:Date) { 8 | return created_at ? 9 | moment(created_at).isAfter(moment().subtract(1, 'w')) 10 | ? moment(created_at).fromNow() : moment(created_at).format('Do MMM \'YY') : null; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /front-end/src/util/validation.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 username = { maxLength:30, minLength:3, pattern: /^[A-Za-z0-9._-]*$/, required: true }; 6 | export const email = { 7 | pattern: /^[A-Z0-9_'%=+!`#~$*?^{}&|-]+([.][A-Z0-9_'%=+!`#~$*?^{}&|-]+)*@[A-Z0-9-]+(\.[A-Z0-9-]+)+$/i 8 | }; 9 | export const password = { minLength: 6, required: true }; 10 | -------------------------------------------------------------------------------- /auth-server/migrations/20200609211518_remove_name.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.table('users', (table) => { 7 | table.dropColumn('name'); 8 | }); 9 | }; 10 | 11 | exports.down = function(knex) { 12 | return knex.schema.table('users', (table) => { 13 | table.boolean('name').defaultTo(false); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /auth-server/src/utils/getUserFromUsername.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 User from '../model/User'; 6 | 7 | /** 8 | * Get User from userId 9 | */ 10 | export default async (username: string): Promise => { 11 | const user = await User 12 | .query() 13 | .where('username', username) 14 | .first(); 15 | 16 | return user; 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /auth-server/src/schema/mutation/multisigLinkConfirm.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 default ` 6 | multisigLinkConfirm( 7 | network: String! 8 | address: String! 9 | addresses: String! 10 | ss58Prefix: Int! 11 | threshold: Int! 12 | signatory: String! 13 | signature: String! 14 | ): ChangeResponse 15 | `; 16 | -------------------------------------------------------------------------------- /auth-server/src/utils/getAllAddressesFromUserId.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 Address from '../model/Address'; 6 | 7 | /** 8 | * Get the default address from an array of addresses, if there is any 9 | */ 10 | 11 | export default async (userId: number): Promise => { 12 | return Address 13 | .query() 14 | .where('user_id', userId); 15 | }; 16 | 17 | -------------------------------------------------------------------------------- /front-end/src/hooks/index.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 { default as useBlockTime } from './useBlockTime'; 6 | export { default as useCurrentBlock } from './useCurrentBlock'; 7 | export { default as usePollEndBlock } from './usePollEndBlock'; 8 | export { default as useFetch } from './useFetch'; 9 | export { default as useGetAllAccounts } from './useGetAllAccounts'; 10 | -------------------------------------------------------------------------------- /front-end/src/assets/sidebar/gov2_treasury_group.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /auth-server/migrations/20200420130047_address_default.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.table('address', (table) => { 7 | table.boolean('default').defaultTo(false); 8 | }); 9 | }; 10 | 11 | exports.down = function(knex) { 12 | return knex.schema.table('address', (table) => { 13 | table.dropColumn('default'); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /chain-db-open-server/kubernetes/nodewatcher-server-ingress.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: extensions/v1beta1 3 | kind: Ingress 4 | metadata: 5 | name: nodewatcher-server-ingress 6 | labels: 7 | app: nodewatcher-server 8 | annotations: 9 | kubernetes.io/ingress.class: traefik 10 | traefik.frontend.entryPoints: "https,http" 11 | spec: 12 | rules: 13 | - host: test.nodewatcher-server.polkassembly.io 14 | http: 15 | paths: 16 | - backend: 17 | serviceName: nodewatcher-server 18 | servicePort: 4000 19 | path: / 20 | -------------------------------------------------------------------------------- /auth-server/migrations/20200504122444_user_web3signup.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.table('users', (table) => { 7 | table.boolean('web3signup').defaultTo(false); 8 | }); 9 | }; 10 | 11 | exports.down = function(knex) { 12 | return knex.schema.table('users', (table) => { 13 | table.dropColumn('web3signup'); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /front-end/src/screens/ResetPassword/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 MUTATION_RESET_PASSWORD = gql` 8 | mutation resetPassword($newPassword: String!, $userId: Int! $token: String!){ 9 | resetPassword(newPassword: $newPassword, userId: $userId, token: $token){ 10 | message 11 | } 12 | } 13 | `; 14 | -------------------------------------------------------------------------------- /front-end/src/screens/Settings/Profile/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 MUTATION_RESET_PASSWORD = gql` 8 | mutation resetPassword($newPassword: String!, $userId: Int! $token: String!){ 9 | resetPassword(newPassword: $newPassword, userId: $userId, token: $token){ 10 | message 11 | } 12 | } 13 | `; 14 | -------------------------------------------------------------------------------- /auth-server/migrations/20191127101810_users_verified.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('users', (table) => { 6 | table.boolean('email_verified').defaultTo(false); 7 | }); 8 | }; 9 | 10 | exports.down = function(knex) { 11 | return knex.schema.table('users', function (table) { 12 | table.dropColumn('email_verified'); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /auth-server/migrations/20200219110001_password_reset_token_index.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('password_reset_token', (table) => { 6 | table.index('token'); 7 | }); 8 | }; 9 | 10 | exports.down = function(knex) { 11 | return knex.schema.table('password_reset_token', (table) => { 12 | table.dropIndex('token'); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /auth-server/migrations/20210614133714_address_sign_message.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.table('address', (table) => { 7 | table.string('sign_message').alter(); 8 | }); 9 | }; 10 | 11 | exports.down = function(knex) { 12 | return knex.schema.table('address', (table) => { 13 | table.uuid('sign_message').alter(); 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /front-end/Dockerfile: -------------------------------------------------------------------------------- 1 | # Stage 1 - the build process 2 | FROM docker.io/node:14 as build-deps 3 | 4 | ARG REACT_APP_HASURA_GRAPHQL_URL 5 | ARG REACT_APP_JWT_PUBLIC_KEY 6 | ARG REACT_APP_NETWORK 7 | ARG REACT_APP_WS_PROVIDER 8 | 9 | WORKDIR /usr/src/app 10 | COPY package.json yarn.lock ./ 11 | RUN yarn 12 | COPY . ./ 13 | RUN yarn build 14 | 15 | # Stage 2 - the production environment 16 | FROM docker.io/nginx:1.12 17 | COPY nginx/*.conf /etc/nginx/conf.d/ 18 | COPY --from=build-deps /usr/src/app/build /usr/share/nginx/html 19 | EXPOSE 80 20 | CMD ["nginx", "-g", "daemon off;"] 21 | -------------------------------------------------------------------------------- /auth-server/migrations/20200219110317_undo_email_change_token_index.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('undo_email_change_token', (table) => { 6 | table.index('token'); 7 | }); 8 | }; 9 | 10 | exports.down = function(knex) { 11 | return knex.schema.table('undo_email_change_token', (table) => { 12 | table.dropIndex('token'); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /auth-server/src/utils/validateUsername.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 { UserInputError } from 'apollo-server'; 6 | 7 | import messages from './messages'; 8 | 9 | export default (username: string): void => { 10 | const regexp = /^[A-Za-z0-9]{1}[A-Za-z0-9.-_]{2,29}$/; 11 | 12 | if (!regexp.test(username)) { 13 | throw new UserInputError(messages.USERNAME_INVALID_ERROR); 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /auth-server/src/utils/verifySignature.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 { signatureVerify } from '@polkadot/util-crypto'; 6 | 7 | import getPublicKey from './getPublicKey'; 8 | 9 | export default (message: string, address: string, signature: string): boolean => { 10 | const publicKey = getPublicKey(address); 11 | 12 | return signatureVerify(message, signature, publicKey).isValid; 13 | }; 14 | -------------------------------------------------------------------------------- /auth-server/migrations/20200219105905_email_verification_token_index.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('email_verification_token', (table) => { 6 | table.index('token'); 7 | }); 8 | }; 9 | 10 | exports.down = function(knex) { 11 | return knex.schema.table('email_verification_token', (table) => { 12 | table.dropIndex('token'); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /kubernetes/polkassembly/templates/frontend-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ .Values.frontend.name }}-service 5 | labels: 6 | {{- include "polkassembly.frontend.labels" . | nindent 4 }} 7 | annotations: 8 | {{- toYaml .Values.frontend.service.annotations | nindent 4 }} 9 | 10 | spec: 11 | type: {{ .Values.frontend.service.type }} 12 | ports: 13 | - port: {{ .Values.frontend.service.port }} 14 | protocol: TCP 15 | name: http 16 | selector: 17 | {{- include "polkassembly.frontend.selectorLabels" . | nindent 4 }} 18 | -------------------------------------------------------------------------------- /node-watcher/src/util/filterEvents.ts: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 @paritytech/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 { EventRecord } from '@polkadot/types/interfaces'; 6 | 7 | export function filterEvents( 8 | events: EventRecord[], 9 | _section: string, 10 | _method: string 11 | ): EventRecord[] { 12 | return events.filter( 13 | ({ event: { method, section } }) => 14 | section === _section && method === _method 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /auth-server/migrations/20200219104712_users_index.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('users', (table) => { 6 | table.index('username'); 7 | table.index('email'); 8 | }); 9 | }; 10 | 11 | exports.down = function(knex) { 12 | return knex.schema.table('users', (table) => { 13 | table.dropIndex('username'); 14 | table.dropIndex('email'); 15 | }); 16 | }; 17 | -------------------------------------------------------------------------------- /auth-server/migrations/20200219110123_post_subscription_index.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('post_subscription', (table) => { 6 | table.index(['user_id', 'post_id']); 7 | }); 8 | }; 9 | 10 | exports.down = function(knex) { 11 | return knex.schema.table('post_subscription', (table) => { 12 | table.dropIndex(['user_id', 'post_id']); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /auth-server/docker-compose.yaml.example: -------------------------------------------------------------------------------- 1 | version: "3.6" 2 | services: 3 | redis: 4 | image: redis 5 | command: redis-server --requirepass 6 | ports: 7 | - "6379:6379" 8 | postgres: 9 | image: postgres 10 | restart: always 11 | ports: 12 | - "5431:5432" 13 | environment: 14 | POSTGRES_USER: 15 | POSTGRES_PASSWORD: 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 |
14 | 15 |
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 |
15 | 16 |
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 | undefined) => void); 11 | } 12 | 13 | const AuthForm: FC = ({ children, onSubmit, className }) => { 14 | return ( 15 |
16 | {children} 17 |
18 | ); 19 | }; 20 | 21 | export default AuthForm; -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/verifyEmail.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 { ChangeResponseType, VerifyEmailArgs } from '../../types'; 7 | import messages from '../../utils/messages'; 8 | 9 | export default async (parent: void, { token }: VerifyEmailArgs): Promise => { 10 | const authServiceInstance = new AuthService(); 11 | const updatedJWT = await authServiceInstance.VerifyEmail(token); 12 | 13 | return { message: messages.EMAIL_VERIFICATION_SUCCESSFUL, token: updatedJWT }; 14 | }; 15 | -------------------------------------------------------------------------------- /front-end/src/ui-components/HelperTooltip.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 { InfoCircleOutlined } from '@ant-design/icons'; 6 | import { Tooltip } from 'antd'; 7 | import React from 'react'; 8 | 9 | interface Props { 10 | className?: string; 11 | text: string; 12 | bgColor?: string; 13 | } 14 | 15 | const HelperTooltip = ({ className, text, bgColor='#E5007A' } : Props) => { 16 | return ( 17 | 18 | 19 | 20 | ); 21 | }; 22 | 23 | export default HelperTooltip; -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/addressLoginStart.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 { AddressSignupStartArgs, ChallengeMessage } from '../../types'; 7 | import messages from '../../utils/messages'; 8 | 9 | export default async (parent: void, { address }: AddressSignupStartArgs): Promise => { 10 | const authServiceInstance = new AuthService(); 11 | 12 | return { 13 | message: messages.ADDRESS_LOGIN_STARTED, 14 | signMessage: await authServiceInstance.AddressLoginStart(address) 15 | }; 16 | }; 17 | -------------------------------------------------------------------------------- /auth-server/src/resolvers/query/token.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 { Context, TokenType } from '../../types'; 7 | 8 | export default async (parent: void, args: void, ctx: Context): Promise => { 9 | const refreshToken = ctx.req.cookies.refresh_token; 10 | 11 | if (!refreshToken) { 12 | throw new Error('Refresh token not found'); 13 | } 14 | 15 | const authServiceInstance = new AuthService(); 16 | const token = await authServiceInstance.RefreshToken(refreshToken); 17 | 18 | return { token }; 19 | }; 20 | -------------------------------------------------------------------------------- /chain-db-watcher/codegen.yml: -------------------------------------------------------------------------------- 1 | overwrite: true 2 | generates: 3 | src/generated/chain-db-graphql.ts: 4 | schema: ${CHAIN_DB_GRAPHQL_URL} 5 | documents: 6 | - "src/**/chain-db.queries.ts" 7 | - "!src/generated/*" 8 | plugins: 9 | - "typescript" 10 | - "typescript-operations" 11 | - "typescript-graphql-request" 12 | src/generated/discussion-db-graphql.ts: 13 | schema: 14 | - ${REACT_APP_HASURA_GRAPHQL_URL}: 15 | headers: 16 | X-Hasura-Admin-Secret: ${HASURA_GRAPHQL_ADMIN_SECRET} 17 | documents: 18 | - "src/**/discussions-db.queries.ts" 19 | - "!src/generated/*" 20 | plugins: 21 | - "typescript" 22 | - "typescript-operations" 23 | - "typescript-graphql-request" -------------------------------------------------------------------------------- /cloud-functions/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "serve": "firebase emulators:start --only functions", 6 | "shell": "firebase functions:shell", 7 | "start": "npm run shell", 8 | "deploy": "firebase deploy --only functions", 9 | "logs": "firebase functions:log" 10 | }, 11 | "engines": { 12 | "node": "16" 13 | }, 14 | "main": "index.js", 15 | "dependencies": { 16 | "@polkadot/api": "^9.6.2", 17 | "@polkadot/api-augment": "^9.6.2", 18 | "firebase-admin": "^10.0.2", 19 | "firebase-functions": "^3.18.0" 20 | }, 21 | "devDependencies": { 22 | "firebase-functions-test": "^0.2.0" 23 | }, 24 | "private": true 25 | } 26 | -------------------------------------------------------------------------------- /front-end/src/hooks/usePollEndBlock.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 { useMemo } from 'react'; 6 | 7 | import useBlockTime from './useBlockTime'; 8 | import useCurrentBlock from './useCurrentBlock'; 9 | 10 | const TWO_WEEKS = 2 * 7 * 24 * 60 * 60 * 1000; 11 | 12 | export default function () { 13 | const { blocktime } = useBlockTime(); 14 | const currenBlockNumber = useCurrentBlock()?.toNumber(); 15 | const blockEnd = (currenBlockNumber || 0) + Math.floor(TWO_WEEKS / blocktime); 16 | 17 | return useMemo(() => { 18 | return blockEnd; 19 | }, [blockEnd]); 20 | } 21 | -------------------------------------------------------------------------------- /nginx/polkassembly.io: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name polkassembly.io; 4 | 5 | # authentication server 6 | location /auth { 7 | proxy_pass http://localhost:8010; 8 | } 9 | 10 | # hasura server 11 | location /v1/graphql { 12 | proxy_pass http://localhost:8080; 13 | } 14 | 15 | # frontend server 16 | location / { 17 | # development server 18 | proxy_pass http://localhost:5000; 19 | # production server 20 | # root /mnt/q/app/client/public; 21 | # try_files $uri $uri/ /index.html; 22 | # WebSocket support added 23 | proxy_http_version 1.1; 24 | proxy_set_header Upgrade $http_upgrade; 25 | proxy_set_header Connection "upgrade"; 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /front-end/src/ui-components/GovSidebarCard.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 { ReactNode } from 'react-markdown/lib/ast-to-react'; 7 | 8 | interface Props { 9 | className?: string; 10 | children?: ReactNode; 11 | } 12 | 13 | const GovSidebarCard = ({ className, children } : Props) => { 14 | return ( 15 |
16 | {children} 17 |
18 | ); 19 | }; 20 | 21 | export default GovSidebarCard; -------------------------------------------------------------------------------- /kubernetes/init.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Namespace 3 | apiVersion: v1 4 | metadata: 5 | name: polkassembly 6 | --- 7 | kind: ServiceAccount 8 | apiVersion: v1 9 | metadata: 10 | name: gitlab 11 | namespace: polkassembly 12 | --- 13 | kind: RoleBinding 14 | apiVersion: rbac.authorization.k8s.io/v1 15 | metadata: 16 | name: gitlab 17 | namespace: polkassembly 18 | subjects: 19 | - kind: ServiceAccount 20 | name: gitlab 21 | namespace: polkassembly 22 | roleRef: 23 | kind: ClusterRole 24 | name: admin 25 | apiGroup: rbac.authorization.k8s.io 26 | --- 27 | apiVersion: networking.gke.io/v1 28 | kind: ManagedCertificate 29 | metadata: 30 | name: kusama-polkassembly-io 31 | namespace: polkassembly 32 | spec: 33 | domains: 34 | - kusama.polkassembly.io 35 | -------------------------------------------------------------------------------- /auth-server/migrations/20211019102135_about.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('about', (table) => { 7 | table.increments('id').primary().notNullable(); 8 | table.string('network').notNullable(); 9 | table.string('address').notNullable(); 10 | table.text('title'); 11 | table.text('description'); 12 | table.string('image'); 13 | table.timestamp('created_at').notNullable().defaultTo(knex.raw('now()')); 14 | }); 15 | }; 16 | 17 | exports.down = function(knex) { 18 | return knex.schema.dropTable('about'); 19 | }; 20 | -------------------------------------------------------------------------------- /auth-server/migrations/20180917160913_users.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 = (knex) => { 5 | return knex.schema.createTable('users', (table) => { 6 | table.increments('id').primary(); 7 | table.string('email').nullable(); 8 | table.string('password').notNullable(); 9 | table.string('salt').notNullable(); 10 | table.string('username').unique().notNullable(); 11 | table.string('name').nullable(); 12 | table.timestamp('created_at').notNullable().defaultTo(knex.raw('now()')); 13 | }); 14 | }; 15 | 16 | exports.down = (knex) => { 17 | return knex.schema.dropTable('users'); 18 | }; 19 | -------------------------------------------------------------------------------- /front-end/src/util/__tests__/validation.test.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 { email, username } from '../validation'; 6 | 7 | test('Email validation pattern', () => { 8 | expect(email.pattern.test('polk@dot.com')).toBe(true); 9 | expect(email.pattern.test('polk@@dot.com')).toBe(false); 10 | expect(email.pattern.test('polk@dot..com')).toBe(false); 11 | }); 12 | 13 | test('Username validation pattern', () => { 14 | expect(username.pattern.test('Tim')).toBe(true); 15 | expect(username.pattern.test('Tim Cook')).toBe(false); 16 | expect(username.pattern.test('!?;')).toBe(false); 17 | }); 18 | -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/login.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 { Context, LoginArgs, TokenType } from '../../types'; 7 | import setRefreshTokenCookie from '../../utils/setRefreshTokenCookie'; 8 | 9 | export default async (parent: void, { username, password }: LoginArgs, ctx: Context): Promise => { 10 | const authServiceInstance = new AuthService(); 11 | const { token, refreshToken } = await authServiceInstance.Login(username, password); 12 | setRefreshTokenCookie(ctx.res, refreshToken); 13 | 14 | return { token }; 15 | }; 16 | -------------------------------------------------------------------------------- /kubernetes/init-test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Namespace 3 | apiVersion: v1 4 | metadata: 5 | name: test-polkassembly 6 | --- 7 | kind: ServiceAccount 8 | apiVersion: v1 9 | metadata: 10 | name: gitlab 11 | namespace: test-polkassembly 12 | --- 13 | kind: RoleBinding 14 | apiVersion: rbac.authorization.k8s.io/v1 15 | metadata: 16 | name: gitlab 17 | namespace: test-polkassembly 18 | subjects: 19 | - kind: ServiceAccount 20 | name: gitlab 21 | namespace: test-polkassembly 22 | roleRef: 23 | kind: ClusterRole 24 | name: admin 25 | apiGroup: rbac.authorization.k8s.io 26 | --- 27 | apiVersion: networking.gke.io/v1 28 | kind: ManagedCertificate 29 | metadata: 30 | name: test-polkassembly-io 31 | namespace: test-polkassembly 32 | spec: 33 | domains: 34 | - test.polkassembly.io 35 | -------------------------------------------------------------------------------- /auth-server/src/utils/getPostCommentLink.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 { CommentCreationHookDataType, PostType } from '../types'; 6 | 7 | /** 8 | * Get Post link type from an event 9 | */ 10 | export default (type: PostType, data: CommentCreationHookDataType): string => { 11 | if (!process.env.DOMAIN_NAME || !process.env.DOMAIN_PROTOCOL) { 12 | console.error('Environment variables DOMAIN_NAME or DOMAIN_PROTOCOL not set'); 13 | return ''; 14 | } 15 | const DOMAIN = `${process.env.DOMAIN_PROTOCOL}${process.env.DOMAIN_NAME}`; 16 | 17 | return `${DOMAIN}/${type}/${data.post_id}#${data.id}`; 18 | }; 19 | -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/undoEmailChange.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 { UndoEmailChangeArgs, UndoEmailChangeResponseType } from '../../types'; 7 | import messages from '../../utils/messages'; 8 | 9 | export default async (parent: void, { token }: UndoEmailChangeArgs): Promise => { 10 | const authServiceInstance = new AuthService(); 11 | const { updatedToken, email } = await authServiceInstance.UndoEmailChange(token); 12 | 13 | return { email, message: messages.EMAIL_UNDO_SUCCESSFUL, token: updatedToken }; 14 | }; 15 | -------------------------------------------------------------------------------- /front-end/src/components/WalletButton/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 { Button } from 'antd'; 6 | import React from 'react'; 7 | 8 | interface Props { 9 | onClick: (event: React.MouseEvent) => void 10 | icon?: JSX.Element 11 | name: string 12 | disabled: boolean 13 | } 14 | 15 | const WalletButton = ({ disabled, onClick, icon }: Props) => { 16 | return ( 17 | 20 | ); 21 | }; 22 | 23 | export default WalletButton; -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/createPostConfirm.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 { CreatePostArgs, MessageType } from '../../types'; 7 | 8 | export default async (parent: void, { 9 | network, 10 | address, 11 | title, 12 | content, 13 | signature 14 | }: CreatePostArgs): Promise => { 15 | const authServiceInstance = new AuthService(); 16 | 17 | await authServiceInstance.CreatePostConfirm( 18 | network, 19 | address, 20 | title, 21 | content, 22 | signature 23 | ); 24 | 25 | return { message: 'Post created successfully' }; 26 | }; 27 | -------------------------------------------------------------------------------- /auth-server/migrations/20191231152732_post_subscription.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.createTable('post_subscription', (table) => { 6 | table.increments('id').primary().notNullable(); 7 | table.integer('user_id').notNullable(); 8 | table.integer('post_id').notNullable(); 9 | table.timestamp('created_at').notNullable().defaultTo(knex.raw('now()')); 10 | table.foreign('user_id').references('id').inTable('users').onDelete('CASCADE').onUpdate('RESTRICT'); 11 | }); 12 | }; 13 | 14 | exports.down = function(knex) { 15 | return knex.schema.dropTable('post_subscription'); 16 | }; 17 | -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/addressLogin.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 { AddressLoginArgs, Context, TokenType } from '../../types'; 7 | import setRefreshTokenCookie from '../../utils/setRefreshTokenCookie'; 8 | 9 | export default async (parent: void, { address, signature }: AddressLoginArgs, ctx: Context): Promise => { 10 | const authServiceInstance = new AuthService(); 11 | 12 | const { token, refreshToken } = await authServiceInstance.AddressLogin(address, signature); 13 | setRefreshTokenCookie(ctx.res, refreshToken); 14 | 15 | return { token }; 16 | }; 17 | -------------------------------------------------------------------------------- /auth-server/src/resolvers/query/about.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 About from '../../model/About'; 6 | import { AboutArgs, AboutType } from '../../types'; 7 | 8 | export default async (parent: void, { network, address }: AboutArgs): Promise => { 9 | const about = await About 10 | .query() 11 | .where({ 12 | address, 13 | network 14 | }) 15 | .first(); 16 | 17 | if (!about) { 18 | return null; 19 | } 20 | 21 | return { 22 | address: about.address, 23 | description: about.description, 24 | image: about.image, 25 | network: about.network, 26 | title: about.title 27 | }; 28 | }; 29 | -------------------------------------------------------------------------------- /kubernetes/init-polkadot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Namespace 3 | apiVersion: v1 4 | metadata: 5 | name: polkadot-polkassembly 6 | --- 7 | kind: ServiceAccount 8 | apiVersion: v1 9 | metadata: 10 | name: gitlab 11 | namespace: polkadot-polkassembly 12 | --- 13 | kind: RoleBinding 14 | apiVersion: rbac.authorization.k8s.io/v1 15 | metadata: 16 | name: gitlab 17 | namespace: polkadot-polkassembly 18 | subjects: 19 | - kind: ServiceAccount 20 | name: gitlab 21 | namespace: polkadot-polkassembly 22 | roleRef: 23 | kind: ClusterRole 24 | name: admin 25 | apiGroup: rbac.authorization.k8s.io 26 | --- 27 | apiVersion: networking.gke.io/v1 28 | kind: ManagedCertificate 29 | metadata: 30 | name: polkadot-polkassembly-io 31 | namespace: polkadot-polkassembly 32 | spec: 33 | domains: 34 | - polkadot.polkassembly.io 35 | -------------------------------------------------------------------------------- /auth-server/test/utils/validateEmail/validateEmail.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 'mocha'; 5 | import { expect } from 'chai'; 6 | import validateEmail from '../../../src/utils/validateEmail'; 7 | 8 | describe('validateEmail util', () => { 9 | it('should validate a correct email', () => { 10 | expect(validateEmail('test@example.com')).to.be.true; 11 | }); 12 | 13 | it('should invalidate an incorrect email', () => { 14 | expect(validateEmail('incorrectemail')).to.be.false; 15 | }); 16 | 17 | it('should invalidate an email with no top level domain', () => { 18 | expect(validateEmail('test@root')).to.be.false; 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /front-end/nginx/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name _; 4 | 5 | location /healthcheck { 6 | return 200 "ok"; 7 | } 8 | 9 | location /healthmonitor { 10 | proxy_pass http://health-monitor-service:8034; 11 | } 12 | 13 | location /auth { 14 | proxy_pass http://auth-server-service:8010; 15 | } 16 | 17 | location /v1/graphql { 18 | proxy_pass http://hasura-service:8080; 19 | } 20 | 21 | location /v1/query { 22 | proxy_pass http://hasura-service:8080; 23 | } 24 | 25 | location / { 26 | root /usr/share/nginx/html; 27 | try_files $uri $uri/ /index.html; 28 | proxy_http_version 1.1; 29 | proxy_set_header Upgrade $http_upgrade; 30 | proxy_set_header Connection "upgrade"; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /front-end/src/components/CreateTreasuryProposal/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 ADD_POLKASSEMBLY_PROPOSAL = gql` 8 | 9 | mutation AddPolkassemblyProposal( $authorId: Int!, $proposalId:Int!, $proposalType: Int!, $proposalHash: String!, $title: String!, $content: String!, $proposerAddress: String! ) { 10 | __typename 11 | insert_polkassembly_proposals(objects: {author_id: $authorId, proposal_id: $proposalId, proposal_type: $proposalType, proposal_hash: $proposalHash, content: $content, title: $title, proposer_address: $proposerAddress}) { 12 | affected_rows 13 | } 14 | } 15 | `; -------------------------------------------------------------------------------- /front-end/src/util/formatUSDWithUnits.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 default function formatUSDWithUnits (usd:String) { 6 | // Nine Zeroes for Billions 7 | const formattedUSD = Math.abs(Number(usd)) >= 1.0e+9 8 | 9 | ? (Math.abs(Number(usd)) / 1.0e+9).toFixed(2) + 'B' 10 | // Six Zeroes for Millions 11 | : Math.abs(Number(usd)) >= 1.0e+6 12 | 13 | ? (Math.abs(Number(usd)) / 1.0e+6).toFixed(2) + 'M' 14 | // Three Zeroes for Thousands 15 | : Math.abs(Number(usd)) >= 1.0e+3 16 | 17 | ? (Math.abs(Number(usd)) / 1.0e+3).toFixed(2) + 'K' 18 | 19 | : Math.abs(Number(usd)); 20 | 21 | return formattedUSD.toString(); 22 | } 23 | -------------------------------------------------------------------------------- /util/src/types.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 BN from 'bn.js'; 6 | 7 | export enum VoteThresholdEnum { 8 | Supermajorityapproval = 'Supermajorityapproval', 9 | Supermajorityrejection = 'Supermajorityrejection', 10 | Simplemajority = 'Simplemajority' 11 | } 12 | 13 | export type VoteThreshold = keyof typeof VoteThresholdEnum; 14 | 15 | export interface BaseThresholdResult{ 16 | isValid: boolean; 17 | } 18 | 19 | export interface PassingThresholdResult extends BaseThresholdResult{ 20 | passingThreshold?: BN; 21 | } 22 | 23 | export interface FailingThresholdResult extends BaseThresholdResult{ 24 | failingThreshold?: BN; 25 | } 26 | -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/resendVerifyEmailToken.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 { Context, MessageType } from '../../types'; 7 | import getTokenFromReq from '../../utils/getTokenFromReq'; 8 | import messages from '../../utils/messages'; 9 | 10 | export default async (parent: void, args: void, ctx: Context): Promise => { 11 | const token = getTokenFromReq(ctx.req); 12 | 13 | const authServiceInstance = new AuthService(); 14 | await authServiceInstance.resendVerifyEmailToken(token); 15 | 16 | return { message: messages.RESEND_VERIFY_EMAIL_TOKEN_REQUEST_SUCCESSFUL }; 17 | }; 18 | -------------------------------------------------------------------------------- /front-end/src/assets/wallet/polkadotjs-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /front-end/src/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 ReactDOM from 'react-dom/client'; 7 | 8 | import App from './App'; 9 | import reportWebVitals from './reportWebVitals'; 10 | 11 | const root = ReactDOM.createRoot( 12 | document.getElementById('root') as HTMLElement 13 | ); 14 | root.render( 15 | 16 | 17 | 18 | ); 19 | 20 | // If you want to start measuring performance in your app, pass a function 21 | // to log results (for example: reportWebVitals(console.log)) 22 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 23 | reportWebVitals(); 24 | -------------------------------------------------------------------------------- /front-end/src/screens/NotificationSettings/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 CHANGE_NOTIFICATION_PREFERENCE = gql` 8 | mutation changeNotificationPreference( 9 | $postParticipated: Boolean 10 | $postCreated: Boolean 11 | $newProposal: Boolean 12 | $ownProposal: Boolean 13 | ) { 14 | changeNotificationPreference( 15 | notificationPreferences: { 16 | postParticipated: $postParticipated, 17 | postCreated: $postCreated, 18 | newProposal: $newProposal, 19 | ownProposal: $ownProposal 20 | } 21 | ) { 22 | message 23 | token 24 | } 25 | } 26 | `; 27 | -------------------------------------------------------------------------------- /nginx/README.md: -------------------------------------------------------------------------------- 1 | # nginx config 2 | 3 | nginx will be used to proxy pass traffic to the auth server, hasura, polkassembly front-end and any other services if needed. 4 | 5 | ## Local Setup Instructions 6 | 7 | Install nginx 8 | ```bash 9 | sudo apt install nginx 10 | ``` 11 | 12 | copy polkassembly.io file to /etc/nginx/sites-available/polkassembly.io 13 | 14 | ```bash 15 | cp polkassembly.io /etc/nginx/sites-available/polkassembly.io 16 | ``` 17 | 18 | create symlink from sites-enabled/polkassembly.io to sites-available/polkassembly.io 19 | 20 | ```bash 21 | ln -s /etc/nginx/sites-available/auth.polkassembly.io /etc/nginx/sites-enabled/ 22 | ``` 23 | 24 | Add this entry to /etc/hosts 25 | 26 | ``` 27 | 127.0.0.1 polkassembly.io 28 | ``` 29 | 30 | Reload nginx 31 | 32 | ```bash 33 | sudo nginx -t 34 | sudo ngix -s reload 35 | ``` 36 | -------------------------------------------------------------------------------- /auth-server/migrations/20200225193118_notification.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 = (knex) => { 5 | return knex.schema.createTable('notification', (table) => { 6 | table.increments('id').primary(); 7 | table.integer('user_id').notNullable(); 8 | table.boolean('post_participated').defaultTo(true); 9 | table.boolean('post_created').defaultTo(true); 10 | table.boolean('new_proposal').defaultTo(false); 11 | table.boolean('own_proposal').defaultTo(true); 12 | table.timestamp('created_at').notNullable().defaultTo(knex.raw('now()')); 13 | }); 14 | }; 15 | 16 | exports.down = (knex) => { 17 | return knex.schema.dropTable('notification'); 18 | }; 19 | -------------------------------------------------------------------------------- /front-end/src/screens/Listing/MemberTracks/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 AboutTrackCard from 'src/components/Listing/Tracks/AboutTrackCard'; 7 | import TrackListingCard from 'src/components/Listing/Tracks/TrackListingCard'; 8 | 9 | const TrackListing = ({ trackName, isMemberReferenda } : { trackName: string, isMemberReferenda?: boolean }) => { 10 | return ( 11 | <> 12 | 13 | 14 | 15 | ); 16 | }; 17 | 18 | export default TrackListing; -------------------------------------------------------------------------------- /front-end/src/themes/customAntdTheme.less: -------------------------------------------------------------------------------- 1 | @primary-color: #E5007A; // primary color for all components 2 | @link-color: #E5007A; // link color 3 | @success-color: #52c41a; // success state color 4 | @warning-color: #faad14; // warning state color 5 | @error-color: #f5222d; // error state color 6 | @font-size-base: 14px; // major text font size 7 | @heading-color: #334D6E; // heading text color 8 | @text-color: rgba(0, 0, 0, 0.65); // major text color 9 | @text-color-secondary: rgba(0, 0, 0, 0.45); // secondary text color 10 | @disabled-color: rgba(0, 0, 0, 0.25); // disable state color 11 | @border-radius-base: 2px; // major border radius 12 | @border-color-base: #d9d9d9; // major border color 13 | @box-shadow-base: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 14 | 0 9px 28px 8px rgba(0, 0, 0, 0.05); 15 | @segmented-bg: #fafafa; -------------------------------------------------------------------------------- /front-end/src/util/formatPostInfoArguments.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 default function (rawArguments: any): any[] { 6 | const argumentsArr: any[] = []; 7 | rawArguments?.forEach((obj: any) => { 8 | 9 | if(obj.name == 'code') { 10 | return false; 11 | } 12 | 13 | const argumentsObj: any = {}; 14 | delete obj.__typename; 15 | if (obj.id) { 16 | argumentsObj['id'] = obj.id; 17 | } 18 | argumentsObj['name'] = obj.name; 19 | try { 20 | argumentsObj['value'] = JSON.parse(obj.value); 21 | } catch { 22 | argumentsObj['value'] = obj.value; 23 | } 24 | argumentsArr.push(argumentsObj); 25 | }); 26 | 27 | return argumentsArr; 28 | } -------------------------------------------------------------------------------- /node-watcher/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | services: 3 | main: 4 | build: ./ 5 | postgres: 6 | image: postgres:12.1 7 | restart: always 8 | ports: 9 | - '5432:5432' 10 | environment: 11 | POSTGRES_USER: prisma 12 | POSTGRES_PASSWORD: prisma 13 | volumes: 14 | - postgres:/var/lib/postgresql/data 15 | prisma: 16 | image: prismagraphql/prisma:1.34 17 | restart: always 18 | ports: 19 | - '4466:4466' 20 | environment: 21 | PRISMA_CONFIG: | 22 | port: 4466 23 | databases: 24 | default: 25 | connector: postgres 26 | host: postgres 27 | user: prisma 28 | password: prisma 29 | rawAccess: true 30 | port: 5432 31 | migrations: true 32 | volumes: 33 | postgres: ~ 34 | -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/deleteAccount.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 { Context, DeleteAccountArgs, MessageType } from '../../types'; 7 | import getTokenFromReq from '../../utils/getTokenFromReq'; 8 | import messages from '../../utils/messages'; 9 | 10 | export default async (parent: void, { password }: DeleteAccountArgs, ctx: Context): Promise => { 11 | const token = getTokenFromReq(ctx.req); 12 | 13 | const authServiceInstance = new AuthService(); 14 | await authServiceInstance.DeleteAccount(token, password); 15 | 16 | return { message: messages.ACCOUNT_DELETE_SUCCESSFUL }; 17 | }; 18 | -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/resetPassword.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 { MessageType, ResetPasswordArgs } from '../../types'; 7 | import messages from '../../utils/messages'; 8 | import validatePassword from '../../utils/validatePassword'; 9 | 10 | export default async (parent: void, { token, userId, newPassword }: ResetPasswordArgs): Promise => { 11 | validatePassword(newPassword); 12 | 13 | const authServiceInstance = new AuthService(); 14 | await authServiceInstance.ResetPassword(token, userId, newPassword); 15 | 16 | return { message: messages.PASSWORD_RESET_SUCCESSFUL }; 17 | }; 18 | -------------------------------------------------------------------------------- /front-end/src/util/getDaysTimeObj.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 default function getDaysTimeObj(line: string) { 6 | const daysTimeObj = { d: 0, h: 0, m: 0 }; 7 | if (line && typeof line === 'string') { 8 | const words = line.split(' '); 9 | words.forEach((word) => { 10 | if (word && typeof word === 'string' && word.length > 1) { 11 | const lastChar = word.charAt(word.length - 1) as keyof typeof daysTimeObj; 12 | if (!['d', 'h', 'm'].includes(lastChar)) return; 13 | 14 | const num = Number(word.replace(lastChar, '')); 15 | if (isNaN(num)) return; 16 | daysTimeObj[lastChar] = num; 17 | } 18 | }); 19 | } 20 | return daysTimeObj; 21 | } -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/addressSignupConfirm.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 { AddressSignupConfirmArgs, Context, TokenType } from '../../types'; 7 | import setRefreshTokenCookie from '../../utils/setRefreshTokenCookie'; 8 | 9 | export default async (parent: void, { address, network, signature }: AddressSignupConfirmArgs, ctx: Context): Promise => { 10 | const authServiceInstance = new AuthService(); 11 | const { token, refreshToken } = await authServiceInstance.AddressSignupConfirm(network, address, signature); 12 | setRefreshTokenCookie(ctx.res, refreshToken); 13 | return { token }; 14 | }; 15 | -------------------------------------------------------------------------------- /front-end/src/polkassemblyutils/types.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 BN from 'bn.js'; 6 | 7 | export enum VoteThresholdEnum { 8 | Supermajorityapproval = 'Supermajorityapproval', 9 | Supermajorityrejection = 'Supermajorityrejection', 10 | Simplemajority = 'Simplemajority' 11 | } 12 | 13 | export type VoteThreshold = keyof typeof VoteThresholdEnum; 14 | 15 | export interface BaseThresholdResult{ 16 | isValid: boolean; 17 | } 18 | 19 | export interface PassingThresholdResult extends BaseThresholdResult{ 20 | passingThreshold?: BN; 21 | } 22 | 23 | export interface FailingThresholdResult extends BaseThresholdResult{ 24 | failingThreshold?: BN; 25 | } 26 | -------------------------------------------------------------------------------- /front-end/src/ui-components/QueueNotification.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 | /* eslint-disable sort-keys */ 6 | import { notification } from 'antd'; 7 | import { NotificationStatus } from 'src/types'; 8 | 9 | interface Props { 10 | header: string 11 | message?: string 12 | durationInSeconds?: number 13 | status: NotificationStatus 14 | } 15 | 16 | const queueNotification = ({ header, message, durationInSeconds = 4.5, status }: Props) => { 17 | const args = { 18 | message: header, 19 | description: message, 20 | duration: durationInSeconds 21 | }; 22 | 23 | // queues notifcation 24 | notification[status](args); 25 | }; 26 | 27 | export default queueNotification; -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/editPostConfirm.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 { EditPostArgs, MessageType } from '../../types'; 7 | 8 | export default async (parent: void, { 9 | network, 10 | address, 11 | title, 12 | content, 13 | signature, 14 | proposalType, 15 | proposalId 16 | }: EditPostArgs): Promise => { 17 | const authServiceInstance = new AuthService(); 18 | 19 | await authServiceInstance.EditPostConfirm( 20 | network, 21 | address, 22 | title, 23 | content, 24 | signature, 25 | proposalType, 26 | proposalId 27 | ); 28 | 29 | return { message: 'Post edited successfully' }; 30 | }; 31 | -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/setDefaultAddress.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, ChangeResponseType, Context } from '../../types'; 7 | import getTokenFromReq from '../../utils/getTokenFromReq'; 8 | import messages from '../../utils/messages'; 9 | 10 | export default async (parent: void, { address }: AddressArgs, ctx: Context): Promise => { 11 | const token = getTokenFromReq(ctx.req); 12 | const authServiceInstance = new AuthService(); 13 | 14 | return { 15 | message: messages.ADDRESS_DEFAULT_SUCCESS, 16 | token: await authServiceInstance.SetDefaultAddress(token, address) 17 | }; 18 | }; 19 | -------------------------------------------------------------------------------- /front-end/src/assets/sidebar/parachains.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /auth-server/src/utils/getTokenFromReq.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 | import { Request } from 'express'; 7 | 8 | /** 9 | * Get Token from request 10 | */ 11 | export default (req: Request): string => { 12 | // Authorization header is of format: 13 | // Authorization: Bearer $asdnkjadj32j23kj@#adslkads 14 | const authHeader = req.headers.authorization; 15 | 16 | if (!authHeader) { 17 | throw new AuthenticationError('Authorization header missing'); 18 | } 19 | 20 | const token = `${authHeader}`.split(' ')[1]; 21 | 22 | if (!token) { 23 | throw new AuthenticationError('token missing'); 24 | } 25 | 26 | return token; 27 | }; 28 | -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/addressUnlink.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, ChangeResponseType, Context } from '../../types'; 7 | import getTokenFromReq from '../../utils/getTokenFromReq'; 8 | import messages from '../../utils/messages'; 9 | 10 | export default async (parent: void, { address }: AddressArgs, ctx: Context): Promise => { 11 | const token = getTokenFromReq(ctx.req); 12 | const authServiceInstance = new AuthService(); 13 | 14 | const updatedJWT = await authServiceInstance.AddressUnlink(token, address); 15 | 16 | return { message: messages.ADDRESS_UNLINKING_SUCCESS, token: updatedJWT }; 17 | }; 18 | -------------------------------------------------------------------------------- /front-end/src/util/getNetwork.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 { network as networkConstants } from '../global/networkConstants'; 6 | import { Network } from '../types'; 7 | /** 8 | * Return the current network 9 | * 10 | */ 11 | 12 | export default function (): Network { 13 | const network = process.env.REACT_APP_NETWORK; 14 | 15 | if (!network) { 16 | throw Error('Please set the REACT_APP_NETWORK environment variable'); 17 | } 18 | 19 | const possibleNetworks = Object.values(networkConstants); 20 | 21 | if (!possibleNetworks.includes(network)) { 22 | throw Error(`REACT_APP_NETWORK environment variable must be one of ${possibleNetworks} `); 23 | } 24 | 25 | return network; 26 | } 27 | -------------------------------------------------------------------------------- /front-end/src/components/Post/ActionsBar/SubscriptionButton/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 POST_SUBSCRIBE=gql` 8 | mutation PostSubscribe ($postId: Int!) { 9 | postSubscribe(post_id: $postId) { 10 | message 11 | } 12 | } 13 | `; 14 | 15 | export const POST_UNSUBSCRIBE=gql` 16 | mutation PostUnsubscribe ($postId: Int!) { 17 | postUnsubscribe(post_id: $postId) { 18 | message 19 | } 20 | } 21 | `; 22 | 23 | export const SUBSCRIPTION=gql` 24 | query Subscription ($postId: Int!) { 25 | subscription(post_id: $postId) { 26 | subscribed 27 | } 28 | } 29 | `; 30 | -------------------------------------------------------------------------------- /front-end/src/screens/NotFound.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 { Result } from 'antd'; 5 | import React from 'react'; 6 | import { Link } from 'react-router-dom'; 7 | import nothingFound from 'src/assets/nothing-found.svg'; 8 | 9 | const NotFound = () => { 10 | return ( 11 | } 13 | title="Uh oh, it seems this route doesn't exist." 14 | extra={ 15 | 16 | Go To Home 17 | 18 | } 19 | /> 20 | ); 21 | }; 22 | 23 | export default NotFound; -------------------------------------------------------------------------------- /auth-server/migrations/20191120202513_refresh_token.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.createTable('refresh_tokens', (table) => { 6 | table.increments('id').primary().notNullable(); 7 | table.uuid('token').unique().notNullable(); 8 | table.integer('user_id').notNullable(); 9 | table.boolean('valid').notNullable(); 10 | table.datetime('expires').notNullable(); 11 | table.timestamp('created_at').notNullable().defaultTo(knex.raw('now()')); 12 | table.foreign('user_id').references('id').inTable('users').onDelete('CASCADE').onUpdate('RESTRICT'); 13 | }); 14 | }; 15 | 16 | exports.down = function(knex) { 17 | return knex.schema.dropTable('refresh_tokens'); 18 | }; 19 | -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/updateProposalTracker.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 { Context, MessageType, UpdateProposalTrackerArgs } from '../../types'; 7 | import getTokenFromReq from '../../utils/getTokenFromReq'; 8 | 9 | export default async ( 10 | parent: void, 11 | { 12 | id, 13 | status 14 | }: UpdateProposalTrackerArgs, 15 | ctx: Context): Promise => { 16 | const authServiceInstance = new AuthService(); 17 | const token = getTokenFromReq(ctx.req); 18 | 19 | await authServiceInstance.ProposalTrackerUpdate( 20 | id, 21 | status, 22 | token 23 | ); 24 | 25 | return { message: 'Status updated successfully' }; 26 | }; 27 | -------------------------------------------------------------------------------- /front-end/src/assets/sidebar/referenda.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /front-end/src/util/getExtensionUrl.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 { detect } from 'detect-browser'; 6 | 7 | const browser = detect(); 8 | 9 | const chromePolkadotExtension = 'https://chrome.google.com/webstore/detail/polkadot%7Bjs%7D-extension/mopnmbcafieddcagagdcbnhejhlodfdd?hl=en'; // TODO: add mozilla 10 | const mozillaPolkadotExtension = 'https://chrome.google.com/webstore/detail/polkadot%7Bjs%7D-extension/mopnmbcafieddcagagdcbnhejhlodfdd?hl=en'; 11 | 12 | export default () => { 13 | switch (browser && browser.name) { 14 | case 'chrome': 15 | return chromePolkadotExtension; 16 | case 'firefox': 17 | return mozillaPolkadotExtension; 18 | default: 19 | // not supported 20 | return ''; 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /util/README.md: -------------------------------------------------------------------------------- 1 | # @polkassembly/util 2 | 3 | A set of utility functions used in [Polkassembly](https://polkassembly.io). 4 | 5 | ## Usage 6 | 7 | Installation - 8 | 9 | ``` 10 | yarn add @polkssembly/util 11 | ``` 12 | 13 | Functions can be imported directly from the package, e.g. 14 | 15 | ```js 16 | import { getPassingThreshold } from '@polkassembly/util'; 17 | ``` 18 | 19 | ## Utility functions 20 | - `getPassingThreshold`: Get the amount of Aye needed for a referendum to pass. 21 | - `newtonRaphson`: This is a fork of [scijs/newton-raphson-method](https://github.com/scijs/newton-raphson-method) that uses bn.js instances instead of plain javascript numbers. It has been simplified and requires to pass the function and its derivative as argument. 22 | - `solveQuadraticEquation`: Get the roots of a polynomial function of degree 2 (`a*x^2 + b*x + c`) where the coeffiscients a, b and c are BN from bn.js. 23 | -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/linkProxyAddress.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 { ChangeResponseType, Context, LinkProxyAddressArgs } from '../../types'; 7 | import getTokenFromReq from '../../utils/getTokenFromReq'; 8 | 9 | export default async (parent: void, { network, proxied, proxy, message, signature }: LinkProxyAddressArgs, ctx: Context): Promise => { 10 | const token = getTokenFromReq(ctx.req); 11 | const authServiceInstance = new AuthService(); 12 | const updatedJWT = await authServiceInstance.LinkProxyAddress(token, network, proxied, proxy, message, signature); 13 | 14 | return { message: 'Proxied address linked', token: updatedJWT }; 15 | }; 16 | -------------------------------------------------------------------------------- /auth-server/src/resolvers/mutation/logout.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 { Context, MessageType } from '../../types'; 7 | import getTokenFromReq from '../../utils/getTokenFromReq'; 8 | import messages from '../../utils/messages'; 9 | 10 | export default async (parent: void, args: void, ctx: Context): Promise => { 11 | const token = getTokenFromReq(ctx.req); 12 | const refreshToken = ctx.req.cookies.refresh_token; 13 | 14 | ctx.res.cookie('refresh_token', '', { maxAge: 0 }); 15 | 16 | const authServiceInstance = new AuthService(); 17 | await authServiceInstance.Logout(token, refreshToken); 18 | 19 | return { message: messages.LOGOUT_SUCCESSFUL }; 20 | }; 21 | --------------------------------------------------------------------------------