Skip to content
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: sbtc token support #6014

Closed
wants to merge 4 commits into from
Closed

feat: sbtc token support #6014

wants to merge 4 commits into from

Conversation

fbwoolf
Copy link
Contributor

@fbwoolf fbwoolf commented Dec 17, 2024

Try out Leather build 928f436Extension build, Test report, Storybook, Chromatic

This PR separates out some of the initial work for sBTC support:

  • Adds sBTC USD prices
  • Adds sBTC to wallet config
  • Adds promo card with a link to earn
  • Adds sBTC to the default managed tokens
  • And, sorts sBTC to the top of the token list

cc @kyranjamie as this was mostly your work

@fbwoolf
Copy link
Contributor Author

fbwoolf commented Dec 17, 2024

Screenshot 2024-12-16 at 8 23 35 PM Screenshot 2024-12-16 at 8 23 21 PM Screenshot 2024-12-16 at 8 24 38 PM

@fbwoolf
Copy link
Contributor Author

fbwoolf commented Dec 17, 2024

We would only need to add 'mainnet' to the wallet config to show the promo card.

const network = useCurrentNetwork();

return useMemo(() => {
const displayPromoCardOnNetworks = (sbtc as any)?.showPromoLinkOnNetworks ?? [];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to cast as any? I made a comment I deleted thinking this was for all config properties, but I see below we can have some type safety on sbtc.enabled - would love to see that here too for refactorability and not surprising ourselves with small avoidable bugs in the future.

@@ -70,11 +70,11 @@ function useCreateSwapAsset(address: string) {
...swapAsset,
balance: availableBalance ?? createMoney(0, token.symbol, token.tokenDecimals),
marketData: availableBalance
? priceAsMarketData(swapAsset.principal, availableBalance.symbol)
: priceAsMarketData(swapAsset.principal, token.symbol),
? getTokenMarketData(swapAsset.principal, availableBalance.symbol)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't token.symbol and availableBlance.symbol the same? Thinking that because of this logic:

const availableBalance = sip10Tokens.find(
        sip10Token => getPrincipalFromContractId(sip10Token.info.contractId) === token.tokenContract
      )?.balance.availableBalance;

Where the contract info is matched on the token.tokenContract

Copy link
Collaborator

@camerow camerow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple comments, nothing major - approving to help move things along but feel free to wait for a more qualified teammate 😁

@camerow
Copy link
Collaborator

camerow commented Dec 17, 2024

Closing in favor of feature branch #5991

@camerow camerow closed this Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants