Skip to content

Commit afbc28f

Browse files
Merge pull request #55 from web3data/feat/transaction-getAll
Feat/transaction get all
2 parents 3ae03ba + 9c6ea18 commit afbc28f

File tree

6 files changed

+339
-1
lines changed

6 files changed

+339
-1
lines changed

dist/web3data.min.js

Lines changed: 1 addition & 1 deletion
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: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,39 @@ includePrice: true
11101110

11111111

11121112

1113+
#### getAll(filterOptions)
1114+
1115+
1116+
See 'getTransactions' for details.
1117+
1118+
1119+
1120+
1121+
##### Parameters
1122+
1123+
| Name | Type | Description | |
1124+
| ---- | ---- | ----------- | -------- |
1125+
| filterOptions | | |   |
1126+
1127+
1128+
1129+
1130+
##### Examples
1131+
1132+
```javascript
1133+
1134+
```
1135+
1136+
1137+
##### Returns
1138+
1139+
1140+
- `Void`
1141+
1142+
1143+
1144+
1145+
11131146
#### getTransaction(hash, filterOptions)
11141147

11151148

src/transaction.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ class Transaction {
4848
}).then(onFulfilled.bind({formatter: recordsFormatter}), onError)
4949
}
5050

51+
/**
52+
* See 'getTransactions' for details.
53+
*
54+
* @param filterOptions
55+
* @example
56+
*/
57+
getAll(filterOptions) {
58+
return this.getTransactions(filterOptions)
59+
}
60+
5161
/**
5262
* Retrieves the transaction data for the specified hash.
5363
*

test/recordings/transaction_1963546403/recording.har

Lines changed: 279 additions & 0 deletions
Large diffs are not rendered by default.

test/transaction.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,18 @@ test('Successfully calls getTransactions - with filters', async t => {
8383
t.is(pendingTxn.statusResult.name, 'pending')
8484
})
8585

86+
/*********** Test getAll() ***********/
87+
test('Successfully calls getAll', async t => {
88+
const [txn] = await t.context.web3data.transaction.getAll()
89+
t.true(txn.hasProp('hash'))
90+
})
91+
test('Successfully calls getAll - with filters', async t => {
92+
const [pendingTxn] = await t.context.web3data.transaction.getAll({status: 'pending'})
93+
t.true(pendingTxn.hasProp('statusResult'))
94+
t.true(pendingTxn.statusResult.hasProp('name'))
95+
t.is(pendingTxn.statusResult.name, 'pending')
96+
})
97+
8698
/*********** Test getTransaction() ***********/
8799
test(rejectsPromise, {method: 'getTransaction'}, NO_HASH)
88100
test('Successfully calls getTransaction', async t => {

0 commit comments

Comments
 (0)