-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle includeInactive
in ViewService#auctions
#1047
Changes from 8 commits
c2c8223
ea73c07
20f9fd2
969712f
7728139
2d65811
c59b57c
5e964c8
eca90c4
01bf241
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
CHAIN_ID=penumbra-testnet-deimos-7 | ||
IDB_VERSION=37 | ||
IDB_VERSION=38 | ||
MINIFRONT_URL=https://app.testnet.penumbra.zone | ||
PRAX=lkpmkhpnhknhmibgnmmhdhgdilepfghe |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,8 @@ const getBech32mAuctionId = ( | |
return captureGroups.auctionId; | ||
}; | ||
|
||
const isInactive = (seqNum?: bigint) => (seqNum === undefined ? false : seqNum > 0n); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why would the sequence number ever be undefined? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made it optional since |
||
|
||
const iterateAuctionsThisUserControls = async function* ( | ||
ctx: HandlerContext, | ||
accountFilter?: AddressIndex, | ||
|
@@ -49,17 +51,14 @@ export const auctions: Impl['auctions'] = async function* (req, ctx) { | |
if (queryLatestState) { | ||
throw new ConnectError('`queryLatestState` not yet implemented', Code.Unimplemented); | ||
} | ||
if (includeInactive) { | ||
throw new ConnectError('`includeInactive` not yet implemented', Code.Unimplemented); | ||
} | ||
|
||
const services = await ctx.values.get(servicesCtx)(); | ||
const { indexedDb } = await services.getWalletServices(); | ||
|
||
for await (const auctionId of iterateAuctionsThisUserControls(ctx, accountFilter)) { | ||
/** @todo: if (req.includeInactive && auctionIsInactive()) continue; */ | ||
const id = new AuctionId(auctionIdFromBech32(auctionId)); | ||
const value = await indexedDb.getAuction(id); | ||
if (!includeInactive && isInactive(value.seqNum)) continue; | ||
|
||
let noteRecord: SpendableNoteRecord | undefined; | ||
if (value.noteCommitment) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't this request metadata for closed auctions since it's passing in
seqNum
of 1? Shouldn't it passseqNum
of 0 for active auctions, and only after save the metadata and update the auction sequence number? Or does it not matter here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TalDerei
Correct — although it's not exactly requesting the metadata, but rather generating it. (
getAuctioNftMetadata()
calls a WASM function under the hood that generates metadata for an asset that doesn't exist yet.)Hm — we could request the NFT metadata for the open auction, and the modify its sequence number. But that feels a bit messy to me — if the algorithm for generating NFT metadata changes in the future such that closed-auction NFTs have different metadata than open-auction NFTs, this would break. Easier to just generate it from scratch for each auction state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah was thinking about that, I think generating the metadata is the right design choice here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong word choice here 😅