Skip to content
This repository was archived by the owner on Jun 17, 2021. It is now read-only.

Commit e48478d

Browse files
committed
more docs, fixups
1 parent b0aacc0 commit e48478d

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

src/account.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ export class Account {
109109

110110
/**
111111
* Returns a `Boolean` determining if the account is empty.
112+
* For more details about account emptiness see [EIP-161](https://eips.ethereum.org/EIPS/eip-161).
113+
* Note: The stateRoot is also checked to be empty since in Frontier it was possible to create a contract with no code where nonce remained 0 but some values were written to storage in the constructor (thus stateRoot is not KECCAK256_RLP).
112114
*/
113115
isEmpty(): boolean {
114116
return (
@@ -133,7 +135,7 @@ export const isValidAddress = function(hexAddress: string): boolean {
133135
*
134136
* If a eip1191ChainId is provided, the chainId will be included in the checksum calculation. This
135137
* has the effect of checksummed addresses for one chain having invalid checksums for others.
136-
* For more details, consult EIP-1191.
138+
* For more details see [EIP-1191](https://eips.ethereum.org/EIPS/eip-1191).
137139
*
138140
* WARNING: Checksums with and without the chainId will differ. As of 2019-06-26, the most commonly
139141
* used variation in Ethereum was without the chainId. This may change in the future.
@@ -285,7 +287,7 @@ export const importPublic = function(publicKey: Buffer): Buffer {
285287
}
286288

287289
/**
288-
* Returns a zero address.
290+
* Returns the zero address.
289291
*/
290292
export const zeroAddress = function(): string {
291293
const addressLength = 20
@@ -294,7 +296,7 @@ export const zeroAddress = function(): string {
294296
}
295297

296298
/**
297-
* Checks if a given address is a zero address.
299+
* Checks if a given address is the zero address.
298300
*/
299301
export const isZeroAddress = function(hexAddress: string): boolean {
300302
assertIsHexString(hexAddress)

src/types.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
11
import * as BN from 'bn.js'
22
import { unpadBuffer } from './bytes'
33

4+
/*
5+
* A type that represents a BNLike input that can be converted to a BN.
6+
*/
47
export type BNLike = BN | string | number
58

6-
export type BufferLike = Buffer | TransformableToBuffer | PrefixedHexString | number
9+
/*
10+
* A type that represents a BufferLike input that can be converted to a Buffer.
11+
*/
12+
export type BufferLike =
13+
| Buffer
14+
| Uint8Array
15+
| number[]
16+
| number
17+
| BN
18+
| TransformableToBuffer
19+
| PrefixedHexString
720

21+
/*
22+
* A type that represents a `0x`-prefixed hex string.
23+
*/
824
export type PrefixedHexString = string
925

26+
/*
27+
* A type that represents an object that has a `toBuffer()` method.
28+
*/
1029
export interface TransformableToBuffer {
1130
toBuffer(): Buffer
1231
}

0 commit comments

Comments
 (0)