Skip to content

Commit

Permalink
Dont return proofs for /wallets
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksej-paschenko committed Aug 20, 2024
1 parent 9ff81f9 commit fadbb5d
Show file tree
Hide file tree
Showing 7 changed files with 366 additions and 36 deletions.
21 changes: 20 additions & 1 deletion api/claim-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,26 @@ components:
wallets:
type: array
items:
$ref: '#/components/schemas/WalletInfo'
type: object
required:
- owner
- compressed_info
properties:
owner:
type: string
compressed_info:
type: object
required:
- amount
- start_from
- expired_at
properties:
amount:
type: string
start_from:
type: string
expired_at:
type: string
next_from:
type: string
WalletInfo:
Expand Down
16 changes: 10 additions & 6 deletions pkg/api/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,19 +199,23 @@ func (h *Handler) GetWallets(ctx context.Context, params oas.GetWalletsParams) (
if resp.Err != nil {
return nil, InternalError(resp.Err)
}
infos := make([]oas.WalletInfo, 0, len(resp.WalletAirdrops))
items := make([]oas.WalletListWalletsItem, 0, len(resp.WalletAirdrops))
for _, walletAirdrop := range resp.WalletAirdrops {
info, err := h.convertToWalletInfo(walletAirdrop)
if err != nil {
return nil, InternalError(err)
item := oas.WalletListWalletsItem{
Owner: walletAirdrop.AccountID.ToRaw(),
CompressedInfo: oas.WalletListWalletsItemCompressedInfo{
Amount: strconv.FormatUint(uint64(walletAirdrop.Data.Amount), 10),
StartFrom: strconv.FormatUint(uint64(walletAirdrop.Data.StartFrom), 10),
ExpiredAt: strconv.FormatUint(uint64(walletAirdrop.Data.ExpireAt), 10),
},
}
infos = append(infos, *info)
items = append(items, item)
}
var nextFrom string
if !resp.NextFrom.IsZero() {
nextFrom = resp.NextFrom.ToRaw()
}
return &oas.WalletList{Wallets: infos, NextFrom: nextFrom}, nil
return &oas.WalletList{Wallets: items, NextFrom: nextFrom}, nil
}

}
245 changes: 243 additions & 2 deletions pkg/api/oas/oas_json_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fadbb5d

Please sign in to comment.