Kaynağa Gözat

Refactor code to match new types

Ricardo Maltez 4 yıl önce
ebeveyn
işleme
94a5b095af

+ 9 - 9
council/report-generator/package.json

@@ -1,5 +1,5 @@
 {
-  "name": "@joystream/api-examples",
+  "name": "report-generator",
   "version": "0.1.0",
   "main": "lib/index.js",
   "license": "MIT",
@@ -8,17 +8,17 @@
     "status": "node lib/status"
   },
   "dependencies": {
-    "@joystream/types": "^0.12.0",
-    "@polkadot/api": "^0.96.1",
-    "@polkadot/keyring": "^1.7.0-beta.5",
-    "@polkadot/types": "^0.96.1",
-    "@polkadot/util": "^1.7.0-beta.5",
-    "@polkadot/util-crypto": "^1.7.0-beta.5",
+    "@joystream/types": "^0.13.1",
+    "@polkadot/api": "1.26.1",
+    "@polkadot/keyring": "^3.0.1",
+    "@polkadot/types": "1.26.1",
+    "@polkadot/util": "^3.0.1",
+    "@polkadot/util-crypto": "^3.0.1",
     "@types/bn.js": "^4.11.5",
     "bn.js": "^4.11.8"
   },
   "devDependencies": {
-    "@polkadot/ts": "^0.3.40",
-    "typescript": "4.0.2"
+    "@polkadot/ts": "^0.1.56",
+    "typescript": "^3.9.7"
   }
 }

+ 93 - 86
council/report-generator/src/StatisticsData.ts

@@ -1,108 +1,108 @@
 export class StatisticsData {
-    councilRound: number;
-    councilMembers: number;
+    councilRound: number = 0;
+    councilMembers: number = 0;
 
-    electionApplicants: number;
+    electionApplicants: number = 0;
     electionAvgApplicants: number = 0;
-    perElectionApplicants: number;
+    perElectionApplicants: number = 0;
 
-    electionApplicantsStakes: number;
-    electionVotes: number;
-    avgVotePerApplicant: number;
+    electionApplicantsStakes: number = 0;
+    electionVotes: number = 0;
+    avgVotePerApplicant: number = 0;
 
-    dateStart: string;
-    dateEnd: string;
+    dateStart: string = "";
+    dateEnd: string = "";
 
-    startBlock: number;
-    endBlock: number;
-    percNewBlocks: number
+    startBlock: number = 0;
+    endBlock: number = 0;
+    percNewBlocks: number = 0;
 
-    newIssuance: number;
-    totalIssuance: number;
-    percNewIssuance: number;
+    newIssuance: number = 0;
+    totalIssuance: number = 0;
+    percNewIssuance: number = 0;
 
-    newMembers: number;
-    totalMembers: number;
-    percNewMembers: number;
+    newMembers: number = 0;
+    totalMembers: number = 0;
+    percNewMembers: number = 0;
 
-    newBlocks: number;
-    avgBlockProduction: number;
+    newBlocks: number = 0;
+    avgBlockProduction: number = 0;
 
-    avgValidators: number;
-    newValidatorReward: number;
+    avgValidators: number = 0;
+    newValidatorReward: number = 0;
 
-    newStorageProviderReward: number;
+    newStorageProviderReward: number = 0;
 
-    startThreads: number;
-    endThreads: number;
-    newThreads: number;
-    totalThreads: number;
-    percNewThreads: number;
+    startThreads: number = 0;
+    endThreads: number = 0;
+    newThreads: number = 0;
+    totalThreads: number = 0;
+    percNewThreads: number = 0;
 
-    startPosts: number;
-    // endPosts: number;
-    newPosts: number;
-    endPosts: number;
-    percNewPosts: number;
+    startPosts: number = 0;
+    // endPosts: number = 0;
+    newPosts: number = 0;
+    endPosts: number = 0;
+    percNewPosts: number = 0;
 
-    startCategories: number;
-    endCategories: number;
-    newCategories: number;
-    perNewCategories: number;
+    startCategories: number = 0;
+    endCategories: number = 0;
+    newCategories: number = 0;
+    perNewCategories: number = 0;
 
-    newProposals: number;
+    newProposals: number = 0;
 
-    newChannels: number;
-    totalChannels: number;
-    percNewChannels: number;
+    newChannels: number = 0;
+    totalChannels: number = 0;
+    percNewChannels: number = 0;
 
-    newMedia: number;
-    totalMedia: number;
-    percNewMedia: number;
+    newMedia: number = 0;
+    totalMedia: number = 0;
+    percNewMedia: number = 0;
 
-    deletedMedia: number;
-    newMints: number;
+    deletedMedia: number = 0;
+    newMints: number = 0;
 
-    startMinted: number;
-    totalMinted: number;
-    endMinted: number;
+    startMinted: number = 0;
+    totalMinted: number = 0;
+    endMinted: number = 0;
 
-    totalMintCapacityIncrease: number;
+    totalMintCapacityIncrease: number = 0;
 
-    startCouncilMinted: number;
-    endCouncilMinted: number;
-    newCouncilMinted: number;
-    percNewCouncilMinted: number;
+    startCouncilMinted: number = 0;
+    endCouncilMinted: number = 0;
+    newCouncilMinted: number = 0;
+    percNewCouncilMinted: number = 0;
 
-    startCuratorMinted: number;
-    endCuratorMinted: number;
-    newCuratorMinted: number;
-    percCuratorMinted: number;
+    startCuratorMinted: number = 0;
+    endCuratorMinted: number = 0;
+    newCuratorMinted: number = 0;
+    percCuratorMinted: number = 0;
 
-    startStorageMinted: number;
-    endStorageMinted: number;
-    newStorageMinted: number;
-    percStorageMinted: number;
+    startStorageMinted: number = 0;
+    endStorageMinted: number = 0;
+    newStorageMinted: number = 0;
+    percStorageMinted: number = 0;
 
 
-    newTokensBurn: number;
+    newTokensBurn: number = 0;
 
-    newUsedSpace: number;
-    totalUsedSpace: number;
-    percNewUsedSpace: number;
+    newUsedSpace: number = 0;
+    totalUsedSpace: number = 0;
+    percNewUsedSpace: number = 0;
 
-    avgNewSizePerContent: number;
-    totalAvgSizePerContent: number;
-    percAvgSizePerContent: number;
+    avgNewSizePerContent: number = 0;
+    totalAvgSizePerContent: number = 0;
+    percAvgSizePerContent: number = 0;
 
-    newStakes: number;
-    totalNewStakeValue: number;
+    newStakes: number = 0;
+    totalNewStakeValue: number = 0;
 
     newTextProposals: number = 0;
     newRuntimeUpgradeProposal: number = 0;
     newSetElectionParametersProposal: number = 0;
     newSpendingProposal: number = 0;
-    newSetLeadProposal:number = 0;
+    newSetLeadProposal: number = 0;
     newSetContentWorkingGroupMintCapacityProposal: number = 0;
     newEvictStorageProviderProposal: number = 0;
     newSetValidatorCountProposal: number = 0;
@@ -114,23 +114,23 @@ export class StatisticsData {
 
 }
 
-export class ValidatorReward{
-    sharedReward: number;
-    remainingReward: number;
-    validators: number;
-    slotStake: number;
-    blockNumber: number;
+export class ValidatorReward {
+    sharedReward: number = 0;
+    remainingReward: number = 0;
+    validators: number = 0;
+    slotStake: number = 0;
+    blockNumber: number = 0;
 }
 
-export class Exchange{
-    sender: string;
-    amount: number;
-    fees: number;
-    blockNumber: number;
+export class Exchange {
+    sender: string = "";
+    amount: number = 0;
+    fees: number = 0;
+    blockNumber: number = 0;
 }
 
 export enum ProposalTypes {
-    Text= "Text",
+    Text = "Text",
     RuntimeUpgrade = "RuntimeUpgrade",
     SetElectionParameters = "SetElectionParameters",
     Spending = "Spending",
@@ -141,10 +141,17 @@ export enum ProposalTypes {
     SetStorageRoleParameters = "SetStorageRoleParameters",
 }
 
-export class MintStatistics
-{
+export class MintStatistics {
     startMinted: number;
     endMinted: number;
     diffMinted: number;
     percMinted: number;
+
+    constructor(startMinted: number = 0, endMinted: number = 0, diffMinted: number = 0, percMinted: number = 0) {
+        this.startMinted = startMinted;
+        this.endMinted = endMinted;
+        this.diffMinted = diffMinted;
+        this.percMinted = percMinted;
+    }
+
 }

+ 85 - 87
council/report-generator/src/block-interval.ts

@@ -1,87 +1,85 @@
-import {ApiPromise, WsProvider} from "@polkadot/api";
-import {Hash, Header} from "@polkadot/types/interfaces/runtime";
-import {registerJoystreamTypes} from "@joystream/types/lib";
-
-async function main() {
-    let startDate = new Date(2020, 4, 20, 13, 0);
-    let endDate = new Date(2020, 4, 29, 23, 59);
-
-    // Initialise the provider to connect to the local node
-    const provider = new WsProvider('wss://rome-rpc-endpoint.joystream.org:9944');
-
-    // register types before creating the api
-    registerJoystreamTypes();
-
-    // Create the API and wait until ready
-    const api = await ApiPromise.create({provider});
-
-    let blockInterval = await getBlockInterval(api, startDate.getTime(), endDate.getTime());
-
-}
-
-async function getBlockInterval(api: ApiPromise, startTimestamp: number, endTimestamp: number) {
-
-    let approximateStartBlockHash = await getApproximatedBlockHash(api, startTimestamp);
-    let startBlock = await adjustApproximatedBlockHash(api, startTimestamp, approximateStartBlockHash);
-
-    let approximateEndBlockHash = await getApproximatedBlockHash(api, endTimestamp);
-    let endBlock = await adjustApproximatedBlockHash(api, endTimestamp, approximateEndBlockHash);
-
-    let startBlockHeader = await api.rpc.chain.getHeader(startBlock) as Header;
-    let endBlockHeader = await api.rpc.chain.getHeader(endBlock) as Header;
-
-    return {
-        'startBlock':
-            startBlockHeader.number.unwrap().toNumber(),
-        'endBlock':
-            endBlockHeader.number.unwrap().toNumber()
-    };
-}
-
-async function getApproximatedBlockHash(api: ApiPromise, timestampToFound: number): Promise<Hash> {
-    let lastHeader = await api.rpc.chain.getHeader();
-    let lastHash = lastHeader.hash.toString();
-    let lastTimestamp = parseInt((await api.query.timestamp.now.at(lastHash)).toString());
-
-    let prevousBlockHash = lastHeader.parentHash;
-    let previousBlockTimestamp = parseInt((await api.query.timestamp.now.at(prevousBlockHash)).toString());
-
-    let secondsPerBlock = lastTimestamp - previousBlockTimestamp;
-
-    let blocksDiff = Math.floor((lastTimestamp - timestampToFound) / secondsPerBlock);
-    let lastBlockNumber = lastHeader.number.unwrap();
-    let approximatedBlockNr = lastBlockNumber.toNumber() - blocksDiff;
-    return await api.rpc.chain.getBlockHash(approximatedBlockNr);
-}
-
-async function adjustApproximatedBlockHash(api: ApiPromise, timestamp: number, hash: Hash) {
-    let approximatedBlockTimestamp = parseInt((await api.query.timestamp.now.at(hash)).toString());
-
-    if (timestamp == approximatedBlockTimestamp) {
-        return hash;
-    }
-
-    let step = 1;
-    if (timestamp < approximatedBlockTimestamp) {
-        step = -1;
-    }
-
-    let approximatedBlockHeader = await api.rpc.chain.getHeader(hash);
-    let blockNumber = approximatedBlockHeader.number.unwrap().toNumber();
-    let lastHashFound = hash;
-    do {
-        blockNumber += step;
-        let nextBlockHash = await api.rpc.chain.getBlockHash(blockNumber);
-        let nextBlockTimeStamp = parseInt((await api.query.timestamp.now.at(nextBlockHash)).toString());
-
-        if (Math.abs(approximatedBlockTimestamp - timestamp) < Math.abs(nextBlockTimeStamp - timestamp)) {
-            return lastHashFound;
-        }
-
-        approximatedBlockTimestamp = nextBlockTimeStamp;
-        lastHashFound = nextBlockHash;
-
-    } while (true);
-}
-
-main();
+// import {ApiPromise, WsProvider} from "@polkadot/api";
+// import {Hash, Header} from "@polkadot/types/interfaces/runtime";
+// import { types } from '@joystream/types'
+//
+// async function main() {
+//     let startDate = new Date(2020, 4, 20, 13, 0);
+//     console.log(startDate);
+//     let endDate = new Date(2020, 4, 29, 23, 59);
+//
+//     // Initialise the provider to connect to the local node
+//     const provider = new WsProvider('wss://rome-rpc-endpoint.joystream.org:9944');
+//
+//     // Create the API and wait until ready
+//     const api = await ApiPromise.create({provider, types});
+//
+//     let blockInterval = await getBlockInterval(api, startDate.getTime(), endDate.getTime());
+//     console.log(blockInterval);
+// }
+//
+// async function getBlockInterval(api: ApiPromise, startTimestamp: number, endTimestamp: number) {
+//
+//     let approximateStartBlockHash = await getApproximatedBlockHash(api, startTimestamp);
+//     let startBlock = await adjustApproximatedBlockHash(api, startTimestamp, approximateStartBlockHash);
+//
+//     let approximateEndBlockHash = await getApproximatedBlockHash(api, endTimestamp);
+//     let endBlock = await adjustApproximatedBlockHash(api, endTimestamp, approximateEndBlockHash);
+//
+//     let startBlockHeader = await api.rpc.chain.getHeader(startBlock) as Header;
+//     let endBlockHeader = await api.rpc.chain.getHeader(endBlock) as Header;
+//
+//     return {
+//         'startBlock':
+//             startBlockHeader.number.unwrap().toNumber(),
+//         'endBlock':
+//             endBlockHeader.number.unwrap().toNumber()
+//     };
+// }
+//
+// async function getApproximatedBlockHash(api: ApiPromise, timestampToFound: number): Promise<Hash> {
+//     let lastHeader = await api.rpc.chain.getHeader();
+//     let lastHash = lastHeader.hash.toString();
+//     let lastTimestamp = parseInt((await api.query.timestamp.now.at(lastHash)).toString());
+//
+//     let prevousBlockHash = lastHeader.parentHash;
+//     let previousBlockTimestamp = parseInt((await api.query.timestamp.now.at(prevousBlockHash)).toString());
+//
+//     let secondsPerBlock = lastTimestamp - previousBlockTimestamp;
+//
+//     let blocksDiff = Math.floor((lastTimestamp - timestampToFound) / secondsPerBlock);
+//     let lastBlockNumber = lastHeader.number.unwrap();
+//     let approximatedBlockNr = lastBlockNumber.toNumber() - blocksDiff;
+//     return await api.rpc.chain.getBlockHash(approximatedBlockNr);
+// }
+//
+// async function adjustApproximatedBlockHash(api: ApiPromise, timestamp: number, hash: Hash) {
+//     let approximatedBlockTimestamp = parseInt((await api.query.timestamp.now.at(hash)).toString());
+//
+//     if (timestamp == approximatedBlockTimestamp) {
+//         return hash;
+//     }
+//
+//     let step = 1;
+//     if (timestamp < approximatedBlockTimestamp) {
+//         step = -1;
+//     }
+//
+//     let approximatedBlockHeader = await api.rpc.chain.getHeader(hash);
+//     let blockNumber = approximatedBlockHeader.number.unwrap().toNumber();
+//     let lastHashFound = hash;
+//     do {
+//         blockNumber += step;
+//         let nextBlockHash = await api.rpc.chain.getBlockHash(blockNumber);
+//         let nextBlockTimeStamp = parseInt((await api.query.timestamp.now.at(nextBlockHash)).toString());
+//
+//         if (Math.abs(approximatedBlockTimestamp - timestamp) < Math.abs(nextBlockTimeStamp - timestamp)) {
+//             return lastHashFound;
+//         }
+//
+//         approximatedBlockTimestamp = nextBlockTimeStamp;
+//         lastHashFound = nextBlockHash;
+//
+//     } while (true);
+// }
+//
+// main();

+ 13 - 20
council/report-generator/src/statistics.ts

@@ -1,20 +1,13 @@
-import {rpc} from "@polkadot/types/interfaces/definitions";
 import {ApiPromise, WsProvider} from "@polkadot/api";
-import {registerJoystreamTypes} from '@joystream/types';
+import { types } from '@joystream/types'
 import {AccountId, Balance, BlockNumber, EventRecord, Hash, Moment} from "@polkadot/types/interfaces";
 
 import {Exchange, MintStatistics, ProposalTypes, StatisticsData, ValidatorReward} from "./StatisticsData";
 
 import {u32, Vec} from "@polkadot/types";
 import {ElectionStake, Seats} from "@joystream/types/council";
-import {MemberId} from "@joystream/types/members";
-import {Stake, StakeId} from "@joystream/types/stake";
 import {Mint, MintId} from "@joystream/types/mint";
-import {ChannelId} from "@joystream/types/content-working-group";
 import {ContentId, DataObject} from "@joystream/types/media";
-import {PostId, ThreadId} from "@joystream/types/common";
-import {CategoryId} from "@joystream/types/forum";
-import {ProposalDetails} from "@joystream/types/proposals";
 import {RoleParameters} from "@joystream/types/roles";
 import {Entity, EntityId} from "@joystream/types/versioned-store";
 import Option from "@polkadot/types/codec/Option";
@@ -34,7 +27,7 @@ class Media {
 
 export class StatisticsCollector {
 
-    private api: ApiPromise;
+    private api?: ApiPromise;
 
     constructor() {
 
@@ -42,11 +35,10 @@ export class StatisticsCollector {
 
 
     async getStatistics(startBlock: number, endBlock: number): Promise<StatisticsData> {
-
         this.api = await StatisticsCollector.connectApi();
 
-        let startHash = await this.api.rpc.chain.getBlockHash(startBlock);
-        let endHash = await this.api.rpc.chain.getBlockHash(endBlock);
+        let startHash = await this.api.query.system.blockHash(startBlock) as Hash;
+        let endHash = await this.api.query.system.blockHash(endBlock) as Hash;
 
         let statistics = new StatisticsData();
 
@@ -56,7 +48,7 @@ export class StatisticsCollector {
         statistics.percNewBlocks = StatisticsCollector.convertToPercentage(statistics.newBlocks, endBlock);
         await this.fillBasicInfo(startHash, endHash, statistics);
         await this.fillMintsData(startHash, endHash, statistics);
-        await this.fillCouncilElectionInfo(startHash, endHash, startBlock, statistics);
+        // await this.fillCouncilElectionInfo(startHash, endHash, startBlock, statistics);
         this.api.disconnect();
         return statistics;
 
@@ -288,8 +280,8 @@ export class StatisticsCollector {
             statistics.totalMinted = parseInt(endMint.getField('total_minted').toString());
         }
 
-        let councilMint = await this.api.query.council.councilMint.at(endHash) as Option<MintId>;
-        let councilMintStatistics = await this.computeMintInfo(councilMint.unwrap(), startHash, endHash);
+        let councilMint = await this.api.query.council.councilMint.at(endHash) as MintId;
+        let councilMintStatistics = await this.computeMintInfo(councilMint, startHash, endHash);
 
         statistics.startCouncilMinted = councilMintStatistics.startMinted;
         statistics.endCouncilMinted = councilMintStatistics.endMinted
@@ -312,6 +304,9 @@ export class StatisticsCollector {
     }
 
     async computeMintInfo(mintId: MintId, startHash: Hash, endHash: Hash): Promise<MintStatistics> {
+        if (mintId.toString() == "0"){
+            return new MintStatistics(0, 0, 0);
+        }
         let startCouncilMintResult = await this.api.query.minting.mints.at(startHash, mintId) as unknown as [Mint, Linkage<MintId>];
         let startCouncilMint = startCouncilMintResult[0] as unknown as Mint;
 
@@ -334,7 +329,7 @@ export class StatisticsCollector {
         let applicants: Vec<AccountId>
         let currentSearchBlock = startBlock - 1;
         do {
-            let applicantHash = await this.api.rpc.chain.getBlockHash(currentSearchBlock);
+            let applicantHash = await this.api.query.system.blockHash(currentSearchBlock);
             applicants = await this.api.query.councilElection.applicants.at(applicantHash) as Vec<AccountId>;
             --currentSearchBlock;
         } while (applicants.length == 0);
@@ -356,7 +351,7 @@ export class StatisticsCollector {
             if (event.section === 'staking' && event.method === 'Reward') {
                 const sharedReward = event.data[0] as Balance;
                 const remainingReward = event.data[1] as Balance;
-                const oldHash: Hash = await api.rpc.chain.getBlockHash(blockNumber - 1)
+                const oldHash: Hash = await api.query.system.blockHash(blockNumber - 1);
                 const slotStake = await api.query.staking.slotStake.at(oldHash) as Balance;
                 const validatorInfo = await api.query.staking.currentElected.at(oldHash) as AccountId;
                 const valReward = new ValidatorReward();
@@ -457,11 +452,9 @@ export class StatisticsCollector {
     static async connectApi(): Promise<ApiPromise> {
         // const provider = new WsProvider('wss://testnet.joystream.org:9944');
         const provider = new WsProvider('wss://rome-rpc-endpoint.joystream.org:9944');
-        // register types before creating the api
-        registerJoystreamTypes();
 
         // Create the API and wait until ready
-        return await ApiPromise.create({provider});
+        return await ApiPromise.create({provider, types});
     }
 
 }

+ 25 - 62
council/report-generator/tsconfig.json

@@ -1,76 +1,39 @@
 {
-  "exclude": [
-  ],
   "compilerOptions": {
-    /* Basic Options */
-    "target": "esnext",                       /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
-    "module": "none",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
-    // "lib": [],                             /* Specify library files to be included in the compilation. */
-    // "allowJs": true,                       /* Allow javascript files to be compiled. */
-    // "checkJs": true,                       /* Report errors in .js files. */
-    "jsx": "preserve",                           /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
-    "declaration": true,                      /* Generates corresponding '.d.ts' file. */
-    // "declarationMap": true,                /* Generates a sourcemap for each corresponding '.d.ts' file. */
-     "sourceMap": true,                     /* Generates corresponding '.map' file. */
-    // "outFile": "./",                       /* Concatenate and emit output to single file. */
-    // "outDir": "build",                        /* Redirect output structure to the directory. */
-    // "rootDir": "./",                       /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
-    // "composite": true,                     /* Enable project compilation */
-    // "removeComments": true,                /* Do not emit comments to output. */
-    // "noEmit": true,                        /* Do not emit outputs. */
-    // "importHelpers": true,                 /* Import emit helpers from 'tslib'. */
-    // "downlevelIteration": true,            /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
-    // "isolatedModules": true,               /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
-
-    /* Strict Type-Checking Options */
-//    "strict": true,                           /* Enable all strict type-checking options. */
-    "noImplicitAny": true,                 /* Raise error on expressions and declarations with an implied 'any' type. */
-    // "strictNullChecks": true,              /* Enable strict null checks. */
-    // "strictFunctionTypes": true,           /* Enable strict checking of function types. */
-    // "strictPropertyInitialization": true,  /* Enable strict checking of property initialization in classes. */
-    // "noImplicitThis": true,                /* Raise error on 'this' expressions with an implied 'any' type. */
-    // "alwaysStrict": true,                  /* Parse in strict mode and emit "use strict" for each source file. */
-
-    /* Additional Checks */
-//    "noUnusedLocals": true,                /* Report errors on unused locals. */
-    // "noUnusedParameters": true,            /* Report errors on unused parameters. */
-    "noImplicitReturns": true,             /* Report error when not all code paths in function return a value. */
-    // "noFallthroughCasesInSwitch": true,    /* Report errors for fallthrough cases in switch statement. */
-
-    /* Module Resolution Options */
-    "moduleResolution": "node",            /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
-    // "baseUrl": "./",                       /* Base directory to resolve non-absolute module names. */
-    // "paths": {},                           /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
-    // "rootDirs": [],                        /* List of root folders whose combined content represents the structure of the project at runtime. */
-    // "typeRoots": [],                       /* List of folders to include type definitions from. */
-    // "types": [],                           /* Type declaration files to be included in compilation. */
+    "target": "esnext",
+    "module": "commonjs",
+    "strict": false,
+    "sourceMap": true,
+    "noImplicitAny": true,
+    "noUnusedLocals": false,
+    "noImplicitReturns": true,
+    "moduleResolution": "node",
     "allowSyntheticDefaultImports": true,     /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
     "esModuleInterop": true,                  /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
-    // "preserveSymlinks": true,              /* Do not resolve the real path of symlinks. */
-
-    /* Source Map Options */
-    // "sourceRoot": "./",                    /* Specify the location where debugger should locate TypeScript files instead of source locations. */
-    // "mapRoot": "./",                       /* Specify the location where debugger should locate map files instead of generated locations. */
-    // "inlineSourceMap": true,               /* Emit a single file with source maps instead of having a separate file. */
-     "inlineSources": true,                 /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
-
-    /* Experimental Options */
     "experimentalDecorators": true,           /* Enables experimental support for ES7 decorators. */
-    // "emitDecoratorMetadata": true,         /* Enables experimental support for emitting type metadata for decorators. */
-
-    /* Advanced Options */
-    "declarationDir": "lib",                /* Output directory for generated declaration files. */
-    "outDir": "lib",
+    "declaration": true,
+    "resolveJsonModule": true,
+    "types" : [
+      "node"
+    ],
+    "forceConsistentCasingInFileNames": true,
     "baseUrl": ".",
     "paths": {
+      "@polkadot/types/augment": ["./node_modules/@joystream/types/augment-codec/augment-types.ts"]
     },
     "typeRoots": [
       "./node_modules/@polkadot/ts",
-      "./node_modules/@types",
-      "./node_modules/@joystream/types/lib"
-    ]
+      "./node_modules/@types"
+    ],
+    "declarationDir": "lib",
+    "outDir": "lib"
   },
   "include": [
     "src/*.ts"
+  ],
+  "exclude": [
+    "node_modules",
+    "**/*.spec.ts",
+    "**/*.d.ts"
   ]
-}
+}