-
Notifications
You must be signed in to change notification settings - Fork 146
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
Feat/add ignore inscriptions UI #6028
Conversation
57bb153
to
175048f
Compare
if (!featureBuilt) return null; | ||
return ( | ||
<Box position="absolute" top="space.01" right="space.01"> | ||
<BasicTooltip label="This inscription has loads of BTC on it, remove protections? Click"> |
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.
Possibly specify the amount instead of "loads"?
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.
this is disabled for now, but yeah would be better to specify
src/app/features/discarded-inscriptions/use-inscribed-spendable-utxos.ts
Show resolved
Hide resolved
<styled.span ml="space.01"> | ||
<BasicTooltip | ||
side="right" | ||
label="Some funds may be unavailable to protect your collectible assets. Disable protection to access your remaining balance." |
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.
Maybe a bit more specificity on where: "... You can ensure those fund are available by disabling protection in the collectible menu."
This comment was marked as resolved.
This comment was marked as resolved.
db4f120
to
2164df7
Compare
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.
My biggest concern is the empty strings that we pass around. Other than that, looks awesome! 🚀
availableBalance, | ||
availableUsdBalance: i18nFormatCurrency( | ||
availableBalance, | ||
availableBalance.amount.isGreaterThanOrEqualTo(100_000) ? 0 : 2 |
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.
nit: move 100_000 to a constant
} | ||
|
||
export function HighSatValueUtxoWarning({ inscription }: HighSatValueUtxoProps) { | ||
if (Number(inscription.value) < 5_000) return null; |
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.
This 5_000 constant too. Should this be a part of a wallet config?
|
||
import { BasicTooltip } from '@app/ui/components/tooltip/basic-tooltip'; | ||
|
||
const featureBuilt = false; |
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.
seems like a good place for launch darkly
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.
I could delete this as we're not using it, but hoping to add some kind of warning when revisiting this
const content = useMemo(() => { | ||
const sharedProps = { onClickSend: () => openSendInscriptionModal() }; | ||
switch (inscription.mimeType) { | ||
case 'audio': | ||
return ( | ||
<CollectibleAudio | ||
icon={<OrdinalAvatarIcon size="lg" />} | ||
key={inscription.title} | ||
subtitle="Ordinal inscription" | ||
title={`# ${inscription.number}`} | ||
{...sharedProps} | ||
/> | ||
); | ||
case 'html': | ||
case 'svg': | ||
case 'video': | ||
case 'gltf': | ||
return ( | ||
<CollectibleIframe | ||
icon={<OrdinalAvatarIcon size="lg" />} | ||
key={inscription.title} | ||
src={inscription.src} | ||
subtitle="Ordinal inscription" | ||
title={`# ${inscription.number}`} |
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.
I'd suggest making this a separate component that receives inscription
instead of creating a component in useMemo
|
||
// Utxos but don't filter the inscribed ones | ||
const { data: nativeSegwitUtxos } = useNativeSegwitUtxosByAddress({ | ||
address: address ?? '', |
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.
I'd suggest using undefined or null instead of empty string here. Typescript can help us with null/undefined while it can't do so with empty strings
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.
Totally agree and only did this as I'm trying to get it done quickly before Christmas.
The way I see it, resorting to empty strings here (as done in many other places), is symptomatic of poor patterns around how we pass and handle state.
I've been thinking about this with this work. One solution would be to use feature container components to handle null cases, and set state in contexts state such that it can be consumed without the need to inline null fallbacks in every case.
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.
This is probably a type signature hole useNativeSegwitUtxosByAddress
, but I think we should address using placeholder values in the codebase (lots of those) in future by tightening up the contracts.
src/app/features/discarded-inscriptions/use-inscribed-spendable-utxos.ts
Outdated
Show resolved
Hide resolved
src/app/pages/home/home.tsx
Outdated
const { totalUsdBalance, availableUsdBalance, isPending, isLoadingAdditionalData } = | ||
useAvailableBalance({ | ||
btcAddress, | ||
stxAddress: account?.address || '', |
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.
Same here regarding the empty string
2164df7
to
d5a30dd
Compare
</CollectibleOther> | ||
); | ||
default: | ||
return null; |
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.
if mimeType exhaustiveness is important here, I added an assertUnreachable
to utils
package do make sure it errors for uncovered cases.
src/app/features/collectibles/components/bitcoin/inscription.tsx
Outdated
Show resolved
Hide resolved
|
||
// Utxos but don't filter the inscribed ones | ||
const { data: nativeSegwitUtxos } = useNativeSegwitUtxosByAddress({ | ||
address: address ?? '', |
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.
This is probably a type signature hole useNativeSegwitUtxosByAddress
, but I think we should address using placeholder values in the codebase (lots of those) in future by tightening up the contracts.
9cf5924
to
9f6a04a
Compare
9f6a04a
to
67589f4
Compare
Thanks for your reviews all, unaddressed feedback I will work on when refactoring this in the new year |
This PR adds more granular control for UTXOs. Now we track discarded UTXOs in setting slice, by
txid:vout:offset
.A user might discard an one inscription on a UTXO, but not the second one, on the same UTXO. A UTXO is only spendable if all inscriptions on it are discarded.
In the UI, there's a dropdown from which users can "unprotect" inscriptions. This helps users spend funds with trash BRC-20 inscriptions on them.
This feature only works for native segwit inscriptions. Protecting/unprotecting taproot inscriptions does nothing. The UI is functional but not perfect, e.g. how hover events work on the inscription cards.
Next year, I want to jump straight on a refactor of this work. Much code here should live elsewhere, and all UTXOs should be treated equal, regardless of payment type.