feat(wallet) return offset in the activity result
Updates status-desktop #10994
This commit is contained in:
parent
37653638bc
commit
4c8fd538ba
|
@ -4,9 +4,9 @@
|
|||
|
||||
| | Buy | Swap | Bridge | Send/Receive |
|
||||
| ------------- | -------------- | -------------- | ------------- | ------------- |
|
||||
| Activity data | ~~API~~ ~~DB~~ | ~~API~~ ~~DB~~ | _API_ _DB_ | _API_ _DB_ |
|
||||
| Raw data | ~~API~~ ~~DB~~ | ~~API~~ ~~DB~~ | _API_ _DB_ | _API_ _DB_ |
|
||||
| Pending data | ~~API~~ ~~DB~~ | ~~API~~ ~~DB~~ | _API_ _DB_ | _API_ _DB_ |
|
||||
| Activity data | ~~API~~ ~~DB~~ | ~~API~~ DB | _API_ DB | _API_ DB |
|
||||
| Raw data | ~~API~~ ~~DB~~ | ~~API~~ DB | _API_ DB | _API_ DB |
|
||||
| Pending data | ~~API~~ ~~DB~~ | ~~API~~ DB | _API_ DB | _API_ DB |
|
||||
|
||||
Legend:
|
||||
|
||||
|
@ -37,8 +37,8 @@ Filter requirements
|
|||
- [x] `finalized`: similar to `complete` for `Send`, `Receive`
|
||||
- all sub-transactions are `complete` for `Buy`, `Swap`, `Bridge`
|
||||
- [x] `failed`: extract from `status` for all sub-transactions
|
||||
- [ ] `chainID`: aggregate data for activity entries `Bridge`, `Buy`, `Swap`
|
||||
- [ ] `tokenCode` for activity entries `Send`, `Receive`
|
||||
- [x] `chainID`: aggregate data for activity entries `Bridge`, `Buy`, `Swap`
|
||||
- [x] `tokenCode` for activity entries `Send`, `Receive`
|
||||
- For `Bridge` its already there and `Buy`, `Swap` is coming soon
|
||||
- [ ] `collectibles`: require adding collectible attributes to activity data (probably `token_address` and `tokenId`)
|
||||
|
||||
|
|
|
@ -48,7 +48,10 @@ const (
|
|||
|
||||
type FilterResponse struct {
|
||||
Activities []Entry `json:"activities"`
|
||||
ThereMightBeMore bool `json:"thereMightBeMore"`
|
||||
Offset int `json:"offset"`
|
||||
// Used to indicate that there might be more entries that were not returned
|
||||
// based on a simple heuristic
|
||||
HasMore bool `json:"hasMore"`
|
||||
ErrorCode ErrorCode `json:"errorCode"`
|
||||
}
|
||||
|
||||
|
@ -72,6 +75,7 @@ func (s *Service) FilterActivityAsync(ctx context.Context, addresses []common.Ad
|
|||
s.context, s.cancelFn = context.WithCancel(context.Background())
|
||||
|
||||
s.wg.Add(1)
|
||||
|
||||
go func() {
|
||||
defer s.wg.Done()
|
||||
defer func() {
|
||||
|
@ -88,7 +92,8 @@ func (s *Service) FilterActivityAsync(ctx context.Context, addresses []common.Ad
|
|||
res.ErrorCode = ErrorCodeFilterCanceled
|
||||
} else if err == nil {
|
||||
res.Activities = activities
|
||||
res.ThereMightBeMore = len(activities) == limit
|
||||
res.Offset = offset
|
||||
res.HasMore = len(activities) == limit
|
||||
res.ErrorCode = ErrorCodeSuccess
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue