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 integration #5991

Merged
merged 9 commits into from
Dec 18, 2024
Merged

feat: sbtc integration #5991

merged 9 commits into from
Dec 18, 2024

Conversation

kyranjamie
Copy link
Collaborator

@kyranjamie kyranjamie commented Nov 27, 2024

Try out Leather build bfcbe19Extension build, Test report, Storybook, Chromatic

This PR ensures sBTC displays correctly, with market data.

There are several design variants I'm not entirely sure which we should go for. No icon for now because apparently there's a new one on the way.

I'm a bit uncertain how we should handle sBTC specific behaviour. Either we can treat is separately from other SIP-10s or, manipulate the data/events we pass to the SIP-10 components such that it displays/behaves as we expect. Trying to avoid lots of if (symbol === 'sBTC')-like code.

@kyranjamie kyranjamie force-pushed the feat/display-sbtc branch 11 times, most recently from ac141e6 to 190d197 Compare November 29, 2024 15:06
package.json Outdated Show resolved Hide resolved
@markmhendrickson
Copy link
Collaborator

Let's link to an issue on the board?

@fbwoolf
Copy link
Contributor

fbwoolf commented Dec 2, 2024

Let's link to an issue on the board?

I'll look for an issue. I just stepped in to take this over, so I'm not sure what issue it relates to specifically. I think we are just trying to get a POC working for the sBTC deposit tx, and then we can apply that to swaps UI.

@fbwoolf
Copy link
Contributor

fbwoolf commented Dec 3, 2024

Just an update here, working branched off on adding all the stuff needed to the swaps UI while we wait on the sbtc pkg update. I think tracking all the changes needed to update the stacks.js pkgs with copying the code over will be quite a chunk of work, so stalling for the lib update from Hiro. I will circle back to tracking the updates if that lib doesn't move fwd in the next few days.

@fbwoolf
Copy link
Contributor

fbwoolf commented Dec 3, 2024

sbtc pkg was updated, so I'll update here and hopefully remove copied code 🤞 https://www.npmjs.com/package/sbtc

@fbwoolf
Copy link
Contributor

fbwoolf commented Dec 3, 2024

Made the update, but testnet client is still broken. Got to this point thou...

Screenshot 2024-12-03 at 2 03 59 PM

@fbwoolf
Copy link
Contributor

fbwoolf commented Dec 4, 2024

Swaps UI draft here: #5997

@fbwoolf
Copy link
Contributor

fbwoolf commented Dec 4, 2024

The sbtc pkg was updated again with new documentation, I think I got the start of the deposit tx working. I believe we just need to add the inputs to it...

Screenshot 2024-12-03 at 7 30 55 PM

@fbwoolf fbwoolf force-pushed the feat/display-sbtc branch 2 times, most recently from a72120a to dff2e4f Compare December 4, 2024 01:49
@fbwoolf
Copy link
Contributor

fbwoolf commented Dec 4, 2024

Ok, got the inputs and signed/finalized tx working... have not tried broadcasting yet.

Screenshot 2024-12-03 at 8 46 09 PM

@fbwoolf
Copy link
Contributor

fbwoolf commented Dec 5, 2024

As an update, currently stuck here and waiting for feedback... https://github.com/hirosystems/stacks.js/pull/1554/files#r1870157852

@fbwoolf fbwoolf changed the title Feat(sbtc): display sbtc balance market data feat: sbtc integration Dec 5, 2024
@fbwoolf fbwoolf force-pushed the feat/display-sbtc branch 3 times, most recently from 69a66fe to 96fcbfe Compare December 7, 2024 01:38
@fbwoolf
Copy link
Contributor

fbwoolf commented Dec 10, 2024

@kyranjamie we seem to be using both SBtc... and Sbtc in naming here, what is your pref? When I look up convention, I think SBtc is correct?

@markmhendrickson
Copy link
Collaborator

I'm wondering if we should hide this banner somehow once the user has enrolled (or if they're not interested). We could try to detect on-chain enrollment, though it may be easiest to add a simply dismiss option that saves its hidden state client-side in cache?

image

@markmhendrickson
Copy link
Collaborator

The BTC transaction to bridge appeared in activity for me, but I'm not seeing a separate bridging activity item on the Stacks side:

image

Comment on lines +39 to +44
useEffect(() => {
// Clear quote amount if quote asset is reset
if (isUndefined(values.swapAssetQuote)) {
void setFieldValue('swapAmountQuote', '');
}
}, [setFieldValue, values]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wonder if there are other ways we can do this. Seems kinda side effecty to have this component setting/updating state like this

const { balance } = useBtcCryptoAssetBalanceNativeSegwit(currentBitcoinAddress);
const bitcoinMarketData = useCryptoCurrencyMarketDataMeanAverage('BTC');

return useCallback((): SwapAsset => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Could be a useMemo?

@fbwoolf fbwoolf force-pushed the feat/display-sbtc branch 3 times, most recently from 85c4e68 to 7229768 Compare December 17, 2024 17:52
@camerow camerow closed this Dec 17, 2024
@fbwoolf fbwoolf reopened this Dec 17, 2024
@fbwoolf fbwoolf force-pushed the feat/display-sbtc branch 2 times, most recently from bbabe49 to c4c0b7a Compare December 17, 2024 19:31
@markmhendrickson
Copy link
Collaborator

Let's add "BTC" as a suffix here for max signer fee?

image

@fbwoolf fbwoolf merged commit cff46da into dev Dec 18, 2024
32 checks passed
@fbwoolf fbwoolf deleted the feat/display-sbtc branch December 18, 2024 16:24
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.

7 participants