Skip to content

Commit

Permalink
deps: Replace ethjs packages with @metamask/ forks (#115)
Browse files Browse the repository at this point in the history
- Replace ethjs with bn.js - it was only used for re-export
- ethjs-contract@^0.2.3 -> @metamask/ethjs-contract@^0.3.4
- [email protected] -> @metamask/ethjs-query@^0.5.2
  • Loading branch information
legobeat authored Nov 29, 2023
1 parent 6633512 commit 8e9405c
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 215 deletions.
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Eth = require('ethjs-query')
const EthContract = require('ethjs-contract')
const Eth = require('@metamask/ethjs-query')
const EthContract = require('@metamask/ethjs-contract')
const Token = require('./token')
const { PollingBlockTracker } = require('eth-block-tracker')
const abi = require('human-standard-token-abi')
Expand Down
2 changes: 1 addition & 1 deletion lib/token.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const BN = require('ethjs').BN
const BN = require('bn.js')
const util = require('./util')

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const BN = require('ethjs').BN
const BN = require('bn.js')
const zero = new BN(0)

module.exports = {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
"/lib"
],
"dependencies": {
"@metamask/ethjs-contract": "^0.3.4",
"@metamask/ethjs-query": "^0.5.2",
"@metamask/safe-event-emitter": "^3.0.0",
"bn.js": "^4.12.0",
"deep-equal": "^2.2.0",
"eth-block-tracker": "^8.0.0",
"ethjs": "^0.4.0",
"ethjs-contract": "^0.2.3",
"ethjs-query": "^0.3.8",
"human-standard-token-abi": "^2.0.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions test/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const assert = require('assert').strict
const fs = require('fs')
const path = require('path')
const ganache = require('ganache')
const Eth = require('ethjs-query')
const EthContract = require('ethjs-contract')
const Eth = require('@metamask/ethjs-query')
const EthContract = require('@metamask/ethjs-contract')
const solc = require('solc')

const source = fs.readFileSync(path.resolve(__dirname, 'contracts/Token.sol')).toString();
Expand Down
6 changes: 3 additions & 3 deletions test/integration/human-standard-token.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const provider = ganache.provider()

const solc = require('solc')
const TokenTracker = require('../../lib')
const BN = require('ethjs').BN
const BN = ('bn.js')

const Eth = require('ethjs-query')
const EthContract = require('ethjs-contract')
const Eth = require('@metamask/ethjs-query')
const EthContract = require('@metamask/ethjs-contract')
const eth = new Eth(provider)
const contract = new EthContract(eth)

Expand Down
2 changes: 1 addition & 1 deletion test/integration/simple-token.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const test = require('tape')

const BN = require('ethjs').BN
const BN = require('bn.js')

const TokenTracker = require('../../lib')
const { setupSimpleTokenEnvironment } = require('../helper')
Expand Down
6 changes: 3 additions & 3 deletions test/integration/token-precision.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const ganache = require('ganache')
const provider = ganache.provider()
const solc = require('solc')
const TokenTracker = require('../../lib')
const BN = require('ethjs').BN
const BN = require('bn.js')
const util = require('../../lib/util')

const Eth = require('ethjs-query')
const EthContract = require('ethjs-contract')
const Eth = require('@metamask/ethjs-query')
const EthContract = require('@metamask/ethjs-contract')
const eth = new Eth(provider)
const contract = new EthContract(eth)
let count = 0
Expand Down
2 changes: 1 addition & 1 deletion test/unit/token.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const test = require('tape')
const BN = require('ethjs').BN
const BN = require('bn.js')

const Token = require('../../lib/token')
const { setupSimpleTokenEnvironment } = require('../helper')
Expand Down
2 changes: 1 addition & 1 deletion test/unit/util.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const test = require('tape')
const BN = require('ethjs').BN
const BN = require('bn.js')
const util = require('../../lib/util')

test('token balance stringify 1', function (t) {
Expand Down
Loading

0 comments on commit 8e9405c

Please sign in to comment.