Skip to content

Commit

Permalink
fix: Most polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
richtera committed Oct 6, 2023
1 parent 1c892d2 commit b4919b6
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.eslint.json",
"tsconfigRootDir": "./"
},
"env": { "es6": true },
"ignorePatterns": ["node_modules", "build", "coverage", "test", "jest.config.js", "tmp"],
"plugins": ["import", "eslint-comments"],
Expand Down
1 change: 0 additions & 1 deletion src/lib/classes/lsp7-digtal-asset.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
import { providers } from 'ethers';
/// reference types="@nomiclabs/hardhat-ethers/internal/type-extensions.d.ts" />
import { ethers } from 'hardhat';

import {
Expand Down
17 changes: 11 additions & 6 deletions src/lib/lsp-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export class LSPFactory {
provider = new ethers.providers.Web3Provider(rpcUrlOrProvider);
} else if (typeof rpcUrlOrProvider !== 'string') {
provider = rpcUrlOrProvider as providers.Web3Provider | providers.JsonRpcProvider;
} else {
throw new Error('Invalid provider');
}

if (!uploadProvider && privateKeyOrSigner && typeof privateKeyOrSigner === 'function') {
Expand All @@ -80,18 +82,21 @@ export class LSPFactory {
signer = provider.getSigner();
}
}
const finishInit: Promise<void> = chainId
? Promise.resolve()
: this.options.provider.getNetwork().then((network) => {
this.options.chainId = network.chainId;
});
this.options = {
signer,
provider,
uploadProvider,
chainId,
finishInit,
finishInit: Promise.resolve(),
};
// Must come after because this.options will otherwise be undefined,
// but finishInit needs to have a value before we can create this.options.
// The egg came first.
this.options.finishInit = chainId
? Promise.resolve()
: this.options.provider.getNetwork().then((network) => {
this.options.chainId = network.chainId;
});

this.UniversalProfile = new UniversalProfile(this.options);
this.LSP4DigitalAssetMetadata = new LSP4DigitalAssetMetadata(this.options);
Expand Down
48 changes: 48 additions & 0 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"compilerOptions": {
"incremental": true,
"target": "es2020",
"outDir": "build/main",
"rootDir": ".",
"moduleResolution": "node",
"module": "commonjs",
"declaration": true,
"inlineSourceMap": true,
"sourceMap": false,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
"resolveJsonModule": true /* Include modules imported with .json extension. */,

// "strict": true /* Enable all strict type-checking options. */,

/* 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": false /* 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. */,

/* Debugging Options */
"traceResolution": false /* Report module resolution log messages. */,
"listEmittedFiles": false /* Print names of generated files part of the compilation. */,
"listFiles": false /* Print names of files part of the compilation. */,
"pretty": true /* Stylize errors and messages using color and context. */,

/* Experimental Options */
// "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
// "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */,

"lib": ["es2017", "dom"],
"types": ["node", "jest", "@nomiclabs/hardhat-ethers"],
"typeRoots": ["node_modules/@types", "types"]
},
"include": ["src/**/*.ts", "types/ethers-v5/**/*.ts"],
"exclude": ["node_modules/**"],
"compileOnSave": false
}

0 comments on commit b4919b6

Please sign in to comment.