Skip to content

feat(sui-provider): upgrade sui dapp-kit to v2#662

Merged
chybisov merged 13 commits intomainfrom
LF-17342-upgrade-sui-kit
Mar 6, 2026
Merged

feat(sui-provider): upgrade sui dapp-kit to v2#662
chybisov merged 13 commits intomainfrom
LF-17342-upgrade-sui-kit

Conversation

@tomiiide
Copy link
Copy Markdown
Contributor

@tomiiide tomiiide commented Feb 26, 2026

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-sui package now requires a client and a signer.
Before signing, the sdk checks the signer, it calls signer.toSuiAddress() which internally calls signer.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 calling getPublicKey

Reference: 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-react ships 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

  • I have performed a self-review and testing of my code.
  • This pull request is focused and addresses a single problem.
  • If this PR modifies the Widget API or adds new features that require documentation, I have updated the documentation in the public-docs repository. - https://github.com/lifinance/public-docs/pull/107

@github-actions
Copy link
Copy Markdown

Hey! This is your new endpoint: https://900763d1.widget-lf17342upg.pages.dev

tomiiide added 6 commits March 2, 2026 17:19
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
@tomiiide tomiiide force-pushed the LF-17342-upgrade-sui-kit branch from e221315 to 13362a9 Compare March 2, 2026 17:24
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
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 2, 2026

Hey! This is your new endpoint: https://bed7445d.widget-lf17342upg.pages.dev

tomiiide added 2 commits March 3, 2026 10:53
Changes:
- Rename signer.ts to WalletSigner.ts and export from package index
- Tighten null guard in SuiBaseProvider to avoid non-null assertion
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 3, 2026

Hey! This is your new endpoint: https://e028f1fd.widget-lf17342upg.pages.dev

@tomiiide tomiiide marked this pull request as ready for review March 3, 2026 11:02
@tomiiide tomiiide requested review from chybisov and effie-ms March 3, 2026 11:03
Copy link
Copy Markdown
Contributor

@effie-ms effie-ms left a comment

Choose a reason for hiding this comment

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

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",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't this stay as peer dependency?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oh, the entire peer dependency block was removed, yes you're right, @mysten/dapp-kit-react should be as a peer dependency.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I mean @mysten/dapp-kit-react should be a peer dependency if we still use their context, to avoid context duplication issue.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 6, 2026

Hey! This is your new endpoint: https://1360b559.widget-lf17342upg.pages.dev

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 6, 2026

Hey! This is your new endpoint: https://3b95c56e.widget-lf17342upg.pages.dev

@chybisov chybisov merged commit 5cb8d88 into main Mar 6, 2026
2 checks passed
@chybisov chybisov deleted the LF-17342-upgrade-sui-kit branch March 6, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants