Skip to content

Commit

Permalink
fix: sort redpacket history via rpc (#11405)
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleBill authored and guanbinrui committed Feb 20, 2024
1 parent d48fdc5 commit 5262acc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/web3-providers/src/RedPacket/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import urlcat from 'urlcat'
import { mapKeys } from 'lodash-es'
import { mapKeys, sortBy } from 'lodash-es'
import type { AbiItem } from 'web3-utils'
import { createIndicator, createPageable, type PageIndicator, type Pageable } from '@masknet/shared-base'
import { type Transaction, attemptUntil, type NonFungibleCollection } from '@masknet/web3-shared-base'
Expand Down Expand Up @@ -46,16 +46,17 @@ class RedPacketAPI implements RedPacketBaseAPI.Provider<ChainId, SchemaType> {
)
return this.parseRedPacketCreationTransactions(transactions, senderAddress)
},
() => {
async () => {
// block range might be too large
return ContractRedPacket.getHistories(
const results = await ContractRedPacket.getHistories(
chainId,
senderAddress,
contractAddress,
methodId,
fromBlock,
endBlock,
)
return sortBy(results, (x) => -x.block_number!)
},
],
[],
Expand Down

0 comments on commit 5262acc

Please sign in to comment.