feat(sui-provider): upgrade sui dapp-kit to v2#662
Conversation
|
Hey! This is your new endpoint: https://900763d1.widget-lf17342upg.pages.dev |
Changes: - Add useEffect to keep internal client chains in sync after query - Add externalClient flag to query key to trigger refetch on client switch - Log token balance errors with console.warn instead of swallowing
Changes: - Pin use-sync-external-store to 1.4.0 - Pin @metamask/sdk to ~0.34.0
e221315 to
13362a9
Compare
Changes: - Replace custom hooks with dapp-kit-react exports - Extend library's CurrentAccountSigner in WalletSigner - Defer dappKit creation to useEffect to avoid render conflicts - Use DAppKitContext for external provider detection - Pin @lifi/sdk-provider-sui to 4.0.0-alpha.15 - Remove unused @mysten/dapp-kit from widget-playground
|
Hey! This is your new endpoint: https://bed7445d.widget-lf17342upg.pages.dev |
Changes: - Rename signer.ts to WalletSigner.ts and export from package index - Tighten null guard in SuiBaseProvider to avoid non-null assertion
|
Hey! This is your new endpoint: https://e028f1fd.widget-lf17342upg.pages.dev |
effie-ms
left a comment
There was a problem hiding this comment.
LGTM. But I guess we can merge it only after we have SDK ready with all the changes (alpha~19).
| }, | ||
| "peerDependencies": { | ||
| "@mysten/dapp-kit": "^0.19.11" | ||
| "@mysten/dapp-kit-react": "^2.0.0", |
There was a problem hiding this comment.
Shouldn't this stay as peer dependency?
There was a problem hiding this comment.
oh, the entire peer dependency block was removed, yes you're right, @mysten/dapp-kit-react should be as a peer dependency.
There was a problem hiding this comment.
I mean @mysten/dapp-kit-react should be a peer dependency if we still use their context, to avoid context duplication issue.
|
Hey! This is your new endpoint: https://1360b559.widget-lf17342upg.pages.dev |
|
Hey! This is your new endpoint: https://3b95c56e.widget-lf17342upg.pages.dev |
Which Jira task is linked to this PR?
https://lifi.atlassian.net/browse/LF-17342
Why was it implemented this way?
This PR upgrades the sui dappkit to v2, during development, some issues were encountered and required workarounds.
1. CurrentAccountSigner Override
The
@lifi/sdk-provider-suipackage now requires aclientand asigner.Before signing, the sdk checks the signer, it calls
signer.toSuiAddress()which internally callssigner.getPublicKey()and then derives the address from the public key.When testing with Phantom wallet, I was getting an error, investigations showed that Phantom wallet was returning an invalid public key, so the way to handle this was to override the CurrentAccountSinger
toSuiAddress()method to return the address from the account object directly instead of callinggetPublicKeyReference: https://forums.sui.io/t/phantom-wallet-sdk-connection/48983
I've opened a support ticket with Phantom, and they are currently working on it.
2. Noop polyfills
The@mysten/dappkit-reactships with a custom elements polyfill that breaks Reown custom elements.I added workarounds in vite and next js playgrounds to import an empty package instead of the actuall polyfill.
However, we cannot ship like this and expect our partners to all do this workaround, so I opened this issue to resolve it.
Fixed by MystenLabs/ts-sdks#902
Visual showcase (Screenshots or Videos)
If applicable, attach screenshots, GIFs, or videos to showcase the functionality, UI changes, or bug fixes.
Checklist before requesting a review