Skip to content

feat: generic tx toaster#264

Merged
sinzii merged 16 commits intomainfrom
feat/generic-tx-toaster
Sep 10, 2025
Merged

feat: generic tx toaster#264
sinzii merged 16 commits intomainfrom
feat/generic-tx-toaster

Conversation

@sinzii
Copy link
Member

@sinzii sinzii commented Sep 9, 2025

This work add a generic abstraction for tx toaster. The txToaster core logic now will be move to typink package. So dapp can import and use.

We also implement adapters for popular toaster libraries (sonnet, react-toastify and react-hot-toast) so we can set this up easily via the setupTxToaster method with other customizations.

E.g:

import { SonnerAdapter, setupTxToaster, ReactToastifyAdapter, ReactHotToastAdapter } from 'typink';
import { toast } from 'sonner';

setupTxToaster({
  adapter: new SonnerAdapter(toast), // ReactToastifyAdapter, ReactHotToastAdapter
  initialMessage: 'Signing Transaction...',
  autoCloseDelay: 5000, // ms,
  messages: { // customize the toast inner message as needed
     inProgress: 'Transaction In Progress',
     successful: 'Transaction Successful',
     failed: 'Transaction Failed',
  }
});

The ToastAdapter interface is keep minimal so devs can implement new different implement for other toast libraries as needed.


A demo to support multiple toast library in examples/demo-general dapp.

Screenshot 2025-09-10 at 23 07 07

@sinzii sinzii changed the title fea: generic tx toaster feat: generic tx toaster Sep 9, 2025
@sinzii
Copy link
Member Author

sinzii commented Sep 10, 2025

Merging this for now, we'll also need to update the templates to use this new txToaster logic as well but should be done in a different PR.

@sinzii sinzii merged commit 1ccfe14 into main Sep 10, 2025
4 checks passed
@sinzii sinzii deleted the feat/generic-tx-toaster branch September 10, 2025 16:35
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.

1 participant