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

Fund button - setupOnrampEventListeners util for setting up onSuccess, onEvent and onExit callbacks #1626

Merged
merged 4 commits into from
Nov 19, 2024

Conversation

rustam-cb
Copy link
Contributor

What changed? Why?
Added util function setupEventSubscriptions that is used to specify onEvent, onExit and onSuccess callbacks

Notes to reviewers
Example of usage of setupOnrampEventListeners

import { setupOnrampEventListeners } from '@onchainkit/utils';

setupOnrampEventListeners({
  onEvent: (event: EventMetadata) => {
    console.log('Event received', event.eventName);
  },
  onExit: () => {
    console.log('Exit event received');
  },
  onSuccess: () => {
    console.log('Success event received');
  } ,
  host: 'https://somthing.coinbase.com', // Optional: The host of the Coinbase Onramp widget. Defaults to https://pay.coinbase.com.
});

How has it been tested?
Unit tests added

src/fund/types.ts Outdated Show resolved Hide resolved
Copy link

vercel bot commented Nov 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
onchainkit-coverage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 15, 2024 9:09pm
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 15, 2024 9:09pm
onchainkit-routes ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 15, 2024 9:09pm

Copy link
Contributor

@alessey alessey left a comment

Choose a reason for hiding this comment

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

lgtm

@rustam-cb rustam-cb merged commit 77a31d7 into main Nov 19, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants