Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
update typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmurdoch committed Aug 5, 2023
1 parent 33ce830 commit 63e9836
Show file tree
Hide file tree
Showing 57 changed files with 813 additions and 812 deletions.
2 changes: 1 addition & 1 deletion docs/assets/js/ganache/ganache.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/js/ganache/ganache.min.js.map

Large diffs are not rendered by default.

194 changes: 97 additions & 97 deletions docs/index.html

Large diffs are not rendered by default.

712 changes: 356 additions & 356 deletions docs/typedoc/api.json

Large diffs are not rendered by default.

216 changes: 108 additions & 108 deletions docs/typedoc/classes/default.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"semver": "7.3.5",
"shx": "0.3.3",
"ts-node": "10.9.1",
"typescript": "4.7.4",
"typescript": "5.1.6",
"validate-npm-package-name": "3.0.0",
"yargs": "16.2.0"
},
Expand Down
16 changes: 8 additions & 8 deletions packages/cli/package-lock.json

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

2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"cross-env": "7.0.3",
"mocha": "9.1.3",
"ts-node": "10.9.1",
"typescript": "4.7.4"
"typescript": "5.1.6"
},
"dependencies": {
"@ganache/colors": "0.4.0",
Expand Down
16 changes: 8 additions & 8 deletions packages/colors/package-lock.json

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

2 changes: 1 addition & 1 deletion packages/colors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
"cross-env": "7.0.3",
"mocha": "9.1.3",
"ts-node": "10.9.1",
"typescript": "4.7.4"
"typescript": "5.1.6"
}
}
16 changes: 8 additions & 8 deletions packages/core/package-lock.json

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

2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"nyc": "15.1.0",
"superagent": "6.1.0",
"ts-node": "10.9.1",
"typescript": "4.7.4",
"typescript": "5.1.6",
"ws": "8.2.3"
}
}
16 changes: 8 additions & 8 deletions packages/ethereum/address/package-lock.json

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

2 changes: 1 addition & 1 deletion packages/ethereum/address/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"mocha": "9.1.3",
"nyc": "15.1.0",
"ts-node": "10.9.1",
"typescript": "4.7.4"
"typescript": "5.1.6"
},
"dependencies": {
"@ethereumjs/util": "8.0.5",
Expand Down
16 changes: 8 additions & 8 deletions packages/ethereum/block/package-lock.json

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

2 changes: 1 addition & 1 deletion packages/ethereum/block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"mocha": "9.1.3",
"nyc": "15.1.0",
"ts-node": "10.9.1",
"typescript": "4.7.4"
"typescript": "5.1.6"
},
"dependencies": {
"@ethereumjs/common": "3.1.1",
Expand Down
4 changes: 3 additions & 1 deletion packages/ethereum/block/src/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "@ganache/ethereum-transaction";
import type { Common } from "@ethereumjs/common";
import { encode, decode } from "@ganache/rlp";
import { BlockHeader, makeHeader } from "./runtime-block";
import { BlockHeader, makeHeader } from "./helpers";
import { keccak } from "@ganache/utils";
import {
BlockRawTransaction,
Expand All @@ -24,6 +24,8 @@ import {
} from "./serialize";
import { BlockParams } from "./block-params";

export type { BlockHeader } from "./helpers";

export type BaseFeeHeader = BlockHeader &
Required<Pick<BlockHeader, "baseFeePerGas">>;

Expand Down
50 changes: 50 additions & 0 deletions packages/ethereum/block/src/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { Data, Quantity } from "@ganache/utils";
import { EthereumRawBlockHeader } from "./serialize";

export type BlockHeader = {
parentHash: Data;
sha3Uncles: Data;
miner: Data;
stateRoot: Data;
transactionsRoot: Data;
receiptsRoot: Data;
logsBloom: Data;
difficulty: Quantity;
totalDifficulty: Quantity;
number: Quantity;
gasLimit: Quantity;
gasUsed: Quantity;
timestamp: Quantity;
extraData: Data;
mixHash: Data;
nonce: Data;
baseFeePerGas?: Quantity;
withdrawalsRoot?: Data;
};

export function makeHeader(
raw: EthereumRawBlockHeader,
totalDifficulty: Buffer
): BlockHeader {
return {
parentHash: Data.from(raw[0], 32),
sha3Uncles: Data.from(raw[1], 32),
miner: Data.from(raw[2], 20),
stateRoot: Data.from(raw[3], 32),
transactionsRoot: Data.from(raw[4], 32),
receiptsRoot: Data.from(raw[5], 32),
logsBloom: Data.from(raw[6], 256),
difficulty: Quantity.from(raw[7], false),
number: Quantity.from(raw[8], false),
gasLimit: Quantity.from(raw[9], false),
gasUsed: Quantity.from(raw[10], false),
timestamp: Quantity.from(raw[11], false),
extraData: Data.from(raw[12]),
mixHash: Data.from(raw[13], 32),
nonce: Data.from(raw[14], 8),
totalDifficulty: Quantity.from(totalDifficulty, false),
baseFeePerGas:
raw[15] === undefined ? undefined : Quantity.from(raw[15], false),
withdrawalsRoot: raw[16] === undefined ? undefined : Data.from(raw[16], 32)
};
}
Loading

0 comments on commit 63e9836

Please sign in to comment.