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: add subscribe to payment #9

Merged
merged 8 commits into from
Jan 18, 2024
Merged

Conversation

janndriessen
Copy link
Owner

No description provided.

Copy link
Collaborator

@ckoopmann ckoopmann left a comment

Choose a reason for hiding this comment

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

Good stuff.
As mentioned I suggest testing with the existing app and see if it works.

Also added a few comments on potential improvements.

}
const taskStatus = await relay.getTaskStatus(taskId)
console.log('Gelato task status:', taskStatus)
if (taskStatus?.taskState == 'ExecSuccess') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are a few steps in between, that you will see in the log statements.
It might be even better if we could track those intermediate steps between gelato task submission and the ExecSuccess result, to give the user a more fine grained progress update.

Copy link
Collaborator

Choose a reason for hiding this comment

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

For example you could make this function accept a callback function as a parameter that gets called on every update, that can then be used in react to update the state / progress.

TransactionStatusResponse,
} from '@gelatonetwork/relay-sdk'

export async function awaitGelatoTask(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is probably going to be used both in the app as well as the shop so at some point we might want to move this into a shared sdk, but not necessary for the first version.


useEffect(() => {
console.log('Connecting to pusher:...')
const pusher = new Pusher(process.env.NEXT_PUBLIC_PUSHER_APP_KEY!, {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might want to move this into a "pusher.ts" file for consistency / redability. And then have a function awaitPusherTaskMessage to use similarily to how we wait for the gelato updates.

@janndriessen janndriessen marked this pull request as ready for review January 18, 2024 19:24
@janndriessen janndriessen force-pushed the feat/add-subscribe-to-payment branch from 412b52d to 6f30fd1 Compare January 18, 2024 19:25
@janndriessen
Copy link
Owner Author

I'll incorporate suggestions on my next PR - after further testing with the payment app.

@janndriessen janndriessen merged commit e60a45d into main Jan 18, 2024
1 check passed
@janndriessen janndriessen deleted the feat/add-subscribe-to-payment branch January 18, 2024 19:27
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.

2 participants