Skip to content

Commit 33dd73a

Browse files
committed
clean up require usage
1 parent 35f1747 commit 33dd73a

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

src/account.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
import assert from 'assert'
22
import BN from 'bn.js'
33
import * as rlp from 'rlp'
4+
import {
5+
privateKeyVerify,
6+
publicKeyCreate,
7+
publicKeyVerify,
8+
publicKeyConvert
9+
} from 'ethereum-cryptography/secp256k1'
410
import { stripHexPrefix } from 'ethjs-util'
511
import { KECCAK256_RLP, KECCAK256_NULL } from './constants'
612
import { zeros, bufferToHex, toBuffer } from './bytes'
713
import { keccak, keccak256, keccakFromString, rlphash } from './hash'
814
import { assertIsHexString, assertIsBuffer } from './helpers'
915
import { BNLike, BufferLike, bnToRlp, toType, TypeOutput } from './types'
1016

11-
const {
12-
privateKeyVerify,
13-
publicKeyCreate,
14-
publicKeyVerify,
15-
publicKeyConvert
16-
} = require('ethereum-cryptography/secp256k1')
17-
1817
export interface AccountData {
1918
nonce?: BNLike
2019
balance?: BNLike

src/address.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const assert = require('assert')
2-
import BN = require('bn.js')
1+
import assert from 'assert'
2+
import BN from 'bn.js'
33
import { toBuffer, zeros } from './bytes'
44
import {
55
isValidAddress,

src/externals.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
* @packageDocumentation
55
*/
66

7-
// TODO: This can be replaced with a normal ESM import once
8-
// the new major version of the typescript config package
9-
// is released and adopted here.
10-
import BN = require('bn.js')
11-
import rlp = require('rlp')
7+
import BN from 'bn.js'
8+
import * as rlp from 'rlp'
129

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

src/hash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { keccak224, keccak384, keccak256: k256, keccak512 } = require('ethereum-cryptography/keccak')
1+
import { keccak224, keccak384, keccak256 as k256, keccak512 } from 'ethereum-cryptography/keccak'
22
const createHash = require('create-hash')
33
import * as rlp from 'rlp'
44
import { toBuffer, setLengthLeft } from './bytes'

0 commit comments

Comments
 (0)