fix(getTransactions()): Adding pagination to tx history

This commit is contained in:
Chris Troutner
2022-01-27 17:47:03 -08:00
parent 74fb65df72
commit 7a89a06ddb
3 changed files with 1570 additions and 44 deletions
+1561 -42
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -24,7 +24,7 @@
},
"repository": "Permissionless-Software-Foundation/ipfs-bch-wallet-service",
"dependencies": {
"@psf/bch-js": "5.2.3",
"@psf/bch-js": "5.3.0",
"axios": "0.25.0",
"bcryptjs": "2.4.3",
"glob": "7.1.6",
+8 -1
View File
@@ -31,6 +31,10 @@ class BCHUseCases {
if (!sortOrder) sortOrder = 'DESCENDING'
// console.log('sortOrder: ', sortOrder)
// Default to page 1
let page = rpcData.payload.params.sortOrder
if (!page) page = 0
// Get the transaction history for the list of addresses.
const data = await this.bchjs.Electrumx.transactions([addr])
console.log(`data: ${JSON.stringify(data, null, 2)}`)
@@ -47,9 +51,12 @@ class BCHUseCases {
)
console.log(`txsArr: ${JSON.stringify(txsArr, null, 2)}`)
// Paginate the results
const pagedResults = this.bchjs.Util.chunk100(txsArr)
const retObj = {
address: addr,
txs: txsArr,
txs: pagedResults[page],
status: 200,
success: true
}