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
181 changes: 173 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"prepare": "husky install",
"version": "npx genversion --es6 src/logger/package-version.ts && git add src/logger/package-version.ts",
"postversion": "git push --follow-tags",
"prepublishOnly": "npm run build"
"prepublishOnly": "npm run build",
"doc": "typedoc"
},
"devDependencies": {
"@types/body-parser": "^1.19.1",
Expand Down Expand Up @@ -59,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 Down
2 changes: 1 addition & 1 deletion scripts/markdown-magic/build-readme.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
npx typedoc --json scripts/markdown-magic/typedoc.out.json --pretty src/index.ts
npm run doc
npx markdown-magic
# add a newline above all markdown magic comments
# This was breaking the docusaurus jsx rendering otherwise
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
Loading