-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
There was a problem hiding this 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') { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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!, { |
There was a problem hiding this comment.
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.
412b52d
to
6f30fd1
Compare
I'll incorporate suggestions on my next PR - after further testing with the payment app. |
No description provided.