Skip to content

Commit 90a5413

Browse files
committed
feat(transactions): [getGasPercentiles] Merge master.
2 parents 1f1f64a + 30088f4 commit 90a5413

File tree

8 files changed

+162
-4052
lines changed

8 files changed

+162
-4052
lines changed

dist/web3data.min.js

Lines changed: 7 additions & 4020 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/web3data.min.js.map

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 123 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@
6060
"rimraf": "^3.0.0",
6161
"rollup": "^1.26.0",
6262
"rollup-plugin-commonjs": "^10.1.0",
63+
"rollup-plugin-filesize": "^6.2.1",
6364
"rollup-plugin-json": "^4.0.0",
6465
"rollup-plugin-node-builtins": "^2.1.2",
6566
"rollup-plugin-node-globals": "^1.4.0",
6667
"rollup-plugin-node-resolve": "^5.2.0",
67-
"rollup-plugin-filesize": "^6.2.1",
68+
"rollup-plugin-terser": "^5.1.2",
6869
"superstatic": "^6.0.4",
6970
"xo": "^0.24.0"
7071
},

rollup.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import json from 'rollup-plugin-json'
44
import builtins from 'rollup-plugin-node-builtins'
55
import globals from 'rollup-plugin-node-globals'
66
import filesize from 'rollup-plugin-filesize'
7+
import {terser} from 'rollup-plugin-terser'
78

89
// eslint-disable-next-line import/extensions
910
import pkg from './package.json'
@@ -13,6 +14,7 @@ export default {
1314
output: {
1415
name: 'web3data',
1516
file: pkg.browser,
17+
compact: true,
1618
format: 'umd',
1719
globals: {
1820
crypto: 'crypto'
@@ -29,6 +31,7 @@ export default {
2931
json(),
3032
builtins({crypto: false, https: false}),
3133
globals(),
32-
filesize()
34+
filesize(),
35+
terser()
3336
]
3437
}

src/transaction.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ const {
33
ERROR_MESSAGE_TRANSACTION_NO_HASH: NO_HASH
44
} = require('./constants')
55

6-
const {is, get, onFulfilled, onError, throwIf} = require('./utils')
6+
const {
7+
is,
8+
get,
9+
onFulfilled,
10+
onError,
11+
throwIf,
12+
recordsFormatter
13+
} = require('./utils')
714

815
class Transaction {
916
constructor(web3data) {
@@ -14,7 +21,7 @@ class Transaction {
1421
return get(this.web3data, {
1522
endpoint: ENDPOINT,
1623
filterOptions
17-
}).then(onFulfilled, onError)
24+
}).then(onFulfilled.bind({formatter: recordsFormatter}), onError)
1825
}
1926

2027
getTransaction(hash, filterOptions) {

test/transaction.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ const returnsTxnObject = async (t, { method, params = {} }) => {
5252
returnsTxnObject.title = (providedTitle = '', input) => `Successfully calls ${input.method} and returns valid txn object`
5353

5454
const returnsTxnObjects = async (t, { method }) => {
55-
const { records: transactions } = await t.context.web3data.transaction[method]()
55+
const transactions = await t.context.web3data.transaction[method]()
5656
t.true(transactions[0].hasProp('hash'))
5757
t.true(transactions.length > 0)
5858
}
5959
returnsTxnObjects.title = (providedTitle = '', input) => `Successfully calls ${input.method} and returns array of valid txn objects`
6060

6161
const returnsPendingTxnObjects = async (t, { method }) => {
62-
const { records: [pendingTxn]} = await t.context.web3data.transaction[method]()
62+
const [pendingTxn] = await t.context.web3data.transaction[method]()
6363

6464
t.is(pendingTxn.statusResult.name, 'pending')
6565
}
@@ -73,11 +73,11 @@ test([returnsTxnObjects, returnsPendingTxnObjects], {method:'getPendingTransacti
7373

7474
/*********** Test getTransactions() ***********/
7575
test('Successfully calls getTransactions', async t => {
76-
const {records: [txn]} = await t.context.web3data.transaction.getTransactions()
76+
const [txn] = await t.context.web3data.transaction.getTransactions()
7777
t.true(txn.hasProp('hash'))
7878
})
7979
test('Successfully calls getTransactions - with filters', async t => {
80-
const {records: [pendingTxn]} = await t.context.web3data.transaction.getTransactions({status: 'pending'})
80+
const [pendingTxn] = await t.context.web3data.transaction.getTransactions({status: 'pending'})
8181
t.true(pendingTxn.hasProp('statusResult'))
8282
t.true(pendingTxn.statusResult.hasProp('name'))
8383
t.is(pendingTxn.statusResult.name, 'pending')
@@ -96,7 +96,7 @@ test('Successfully calls getTransaction - with filters', async t => {
9696

9797
/*********** Test getPendingTransactions() ***********/
9898
test('Successfully calls getPendingTransactions', async t => {
99-
const {records: [pendingTxn]} = await t.context.web3data.transaction.getPendingTransactions()
99+
const [pendingTxn] = await t.context.web3data.transaction.getPendingTransactions()
100100
t.true(pendingTxn.hasProp('statusResult'))
101101
t.true(pendingTxn.statusResult.hasProp('name'))
102102
t.is(pendingTxn.statusResult.name, 'pending')

test/web3data.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ test('web3data.eth successfully calls method getTransactions', async t => {
107107
})
108108

109109
test('web3data.eth successfully calls method getPendingTransactions', async t => {
110-
const { records: pendTxns } = await t.context.web3data.eth.getPendingTransactions()
110+
const pendTxns = await t.context.web3data.eth.getPendingTransactions()
111111
t.true(pendTxns.length > 0)
112112
})
113113

0 commit comments

Comments
 (0)