-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add transaction send helpers #69
Conversation
- prepareTransaction with compute - sendTransactionWithRetries
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.
LGTM apart from error handling
* @property commitment - Desired commitment level for the transaction | ||
* @property skipPreflight - Whether to skip transaction simulation | ||
* @property onStatusUpdate - Callback function to receive transaction status updates |
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 super coool
src/lib/transaction.ts
Outdated
@@ -52,6 +64,265 @@ export const getSimulationComputeUnits = async ( | |||
sigVerify: false, | |||
}); | |||
|
|||
getErrorFromRPCResponse(rpcResponse); | |||
if (rpcResponse.value.err) { |
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.
imo these should be wrapped in try catch block,
in instances where rpcResponse.value
is undefined, it will throw an error and break.
for this specific error rpcResponse?.value?.err
makes sense.
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.
That makes sense! Thanks, updated
People have to write tons of boilerplate code to send transactions. This abstracts away most of it. Helping with simulating and setting compute budget and fee instructions and makes retry and confirmation easy.
Also better error handling which now shows the program logs when the simulation fails.