Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix types warnings #123

Merged
merged 10 commits into from
May 16, 2022
103 changes: 65 additions & 38 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"prettier-plugin-organize-imports": "^2.3.4",
"ts-jest": "^27.1.4",
"ts-node": "^10.2.1",
"typedoc": "^0.22.15",
"typescript": "^4.6.4",
"web3": "^1.7.3"
},
Expand All @@ -68,9 +69,7 @@
"@types/big.js": "^6.1.3",
"big.js": "^6.1.1",
"isomorphic-unfetch": "^3.1.0",
"sha3": "^2.1.4",
"typedoc": "^0.22.15",
"typedoc-plugin-missing-exports": "^0.22.6"
"sha3": "^2.1.4"
},
"lint-staged": {
"*.{js,jsx,ts,tsx,css,scss,md,json,html,yml,yaml}": [
Expand Down
26 changes: 23 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
import { Contract } from './classes/Contract';
import { FallthroughProvider } from './providers/FallthroughProvider';
import {
ConstructorOptions,
FallthroughProvider,
} from './providers/FallthroughProvider';
import { JsonRpcProvider, jsonRpcProvider } from './providers/JsonRpcProvider';
import { tinyBig, TinyBig } from './shared/tiny-big/tiny-big';
import { BlockResponse } from './types/Block.types';
import { BlockResponse, BlockTag, RPCBlock } from './types/Block.types';
import {
ContractTypes,
JSONABI,
JSONABIArgument,
} from './types/Contract.types';
import { Network } from './types/Network.types';
import { TransactionResponse } from './types/Transaction.types';
import {
BlockTransactionResponse,
Log,
RPCLog,
RPCTransaction,
RPCTransactionReceipt,
TransactionReceipt,
TransactionResponse,
} from './types/Transaction.types';
import { computeAddress } from './utils/compute-address';
import { computePublicKey } from './utils/compute-public-key';
import { etherToGwei } from './utils/ether-to-gwei';
Expand Down Expand Up @@ -52,4 +63,13 @@ export {
JSONABIArgument,
Network,
TransactionResponse,
RPCBlock,
RPCTransaction,
RPCTransactionReceipt,
TransactionReceipt,
BlockTag,
RPCLog,
Log,
BlockTransactionResponse,
ConstructorOptions,
};
2 changes: 1 addition & 1 deletion src/providers/FallthroughProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const promiseTimeout = (prom: Promise<any>, time: number) =>
),
]);

interface ConstructorOptions {
export interface ConstructorOptions {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dawsbot I figured this type was worth exporting, but it can be ignored if not

timeoutDuration?: number;
}
const DEFAULT_TIMEOUT_DURATION = 8000;
Expand Down
1 change: 1 addition & 0 deletions src/types/Block.types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BlockTransactionResponse, RPCTransaction } from './Transaction.types';

type Modify<T, R> = Omit<T, keyof R> & R;

export type BlockResponse = Modify<
RPCBlock,
{
Expand Down
1 change: 1 addition & 0 deletions src/types/Transaction.types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { TinyBig } from '../shared/tiny-big/tiny-big';

type Modify<T, R> = Omit<T, keyof R> & R;

export interface RPCTransaction extends RPCBlockTransaction {
// not in getBlock transactions, only in getTransaction response
maxFeePerGas: string /* "0xfc21e1832", */;
Expand Down
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"typedocOptions": {
"entryPoints": ["src/index.ts"],
"json": "scripts/markdown-magic/typedoc.out.json",
"plugin": ["typedoc-plugin-missing-exports"]
"intentionallyNotExported": [
"src/types/Transaction.types.ts:Modify",
"src/types/Block.types.ts:Modify",
]
}
Copy link
Contributor

@arimgibson arimgibson May 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty option is enabled by default with typedoc, could be expressly defined though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's great!

}