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

Mv constants to own file #179

Merged
merged 1 commit into from
Feb 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import BN = require('bn.js')

/**
* The max integer that this VM can handle
*/
export const MAX_INTEGER: BN = new BN(
'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
16,
)

/**
* 2^256
*/
export const TWO_POW256: BN = new BN(
'10000000000000000000000000000000000000000000000000000000000000000',
16,
)

/**
* Keccak-256 hash of null
*/
export const KECCAK256_NULL_S: string =
'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'

/**
* Keccak-256 hash of null
*/
export const KECCAK256_NULL: Buffer = Buffer.from(KECCAK256_NULL_S, 'hex')

/**
* Keccak-256 of an RLP of an empty array
*/
export const KECCAK256_RLP_ARRAY_S: string =
'1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'

/**
* Keccak-256 of an RLP of an empty array
*/
export const KECCAK256_RLP_ARRAY: Buffer = Buffer.from(KECCAK256_RLP_ARRAY_S, 'hex')

/**
* Keccak-256 hash of the RLP of null
*/
export const KECCAK256_RLP_S: string =
'56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'

/**
* Keccak-256 hash of the RLP of null
*/
export const KECCAK256_RLP: Buffer = Buffer.from(KECCAK256_RLP_S, 'hex')
48 changes: 2 additions & 46 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,53 +15,9 @@ export interface ECDSASignature {
}

/**
* The max integer that this VM can handle
* Constants
*/
export const MAX_INTEGER: BN = new BN(
'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
16,
)

/**
* 2^256
*/
export const TWO_POW256: BN = new BN(
'10000000000000000000000000000000000000000000000000000000000000000',
16,
)

/**
* Keccak-256 hash of null
*/
export const KECCAK256_NULL_S: string =
'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'

/**
* Keccak-256 hash of null
*/
export const KECCAK256_NULL: Buffer = Buffer.from(KECCAK256_NULL_S, 'hex')

/**
* Keccak-256 of an RLP of an empty array
*/
export const KECCAK256_RLP_ARRAY_S: string =
'1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'

/**
* Keccak-256 of an RLP of an empty array
*/
export const KECCAK256_RLP_ARRAY: Buffer = Buffer.from(KECCAK256_RLP_ARRAY_S, 'hex')

/**
* Keccak-256 hash of the RLP of null
*/
export const KECCAK256_RLP_S: string =
'56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'

/**
* Keccak-256 hash of the RLP of null
*/
export const KECCAK256_RLP: Buffer = Buffer.from(KECCAK256_RLP_S, 'hex')
export * from './constants'

/**
* [`BN`](https://github.com/indutny/bn.js)
Expand Down