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

Add transaction send helpers #69

Merged
merged 3 commits into from
Jan 9, 2025
Merged

Conversation

Woody4618
Copy link
Contributor

@Woody4618 Woody4618 commented Jan 8, 2025

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.

  • prepareTransactionWithCompute
  • sendTransactionWithRetries

- prepareTransaction with compute
- sendTransactionWithRetries
@Woody4618 Woody4618 requested a review from heyAyushh January 8, 2025 13:46
Copy link
Member

@heyAyushh heyAyushh left a 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
Copy link
Member

Choose a reason for hiding this comment

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

This is super coool

@@ -52,6 +64,265 @@ export const getSimulationComputeUnits = async (
sigVerify: false,
});

getErrorFromRPCResponse(rpcResponse);
if (rpcResponse.value.err) {
Copy link
Member

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.

Copy link
Contributor Author

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

@heyAyushh heyAyushh merged commit 339092c into main Jan 9, 2025
1 check passed
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