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 web3jsV2 examples #610

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Woody4618
Copy link
Collaborator

Problem

Most examples in cookbook only have examples for web3.js@1. With @2 cominig it makes sense to have more examples in both versions of the library.

Summary of Changes

Added examples for:
get-account-balance
load-keypair-from-file
add-memo
add-priority-fees
calculate-cost

content/cookbook/accounts/get-account-balance.md Outdated Show resolved Hide resolved
content/cookbook/development/load-keypair-from-file.md Outdated Show resolved Hide resolved
content/cookbook/transactions/add-priority-fees.md Outdated Show resolved Hide resolved
content/cookbook/transactions/calculate-cost.md Outdated Show resolved Hide resolved
content/cookbook/transactions/add-priority-fees.md Outdated Show resolved Hide resolved
Comment on lines +110 to +112
// Figure out how many compute units to budget for this transaction
// so that you can right-size the compute budget to maximize the
// chance that it will be selected for inclusion into a block.
Copy link
Collaborator

Choose a reason for hiding this comment

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

since the real compute consumed could vary when it hits the network with more complicated programs, do you think its worth adding in some extra cus? iirc, the helpers library adds in some small amount of cus to add a little wiggle room (since that is what star atlas found to be effective)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm do you know what staratlas is doing there? Sounds pretty random to just add some number. The Helpers just simulate with a 1.4 mil cu. I was hoping the new function works better. At least this is what luscher recommended. Ill ask him

Copy link
Collaborator Author

@Woody4618 Woody4618 Nov 18, 2024

Choose a reason for hiding this comment

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

https://github.com/solana-labs/solana-web3.js/tree/master/packages/library#getcomputeunitestimatefortransactionmessagefactoryrpc Ah there is this which explains the problem. Still not sure what value i should recommend. Some random const, some random multiplier? Maybe just a link to the docs.

content/cookbook/transactions/calculate-cost.md Outdated Show resolved Hide resolved
content/cookbook/transactions/send-sol.md Outdated Show resolved Hide resolved
content/cookbook/transactions/send-sol.md Outdated Show resolved Hide resolved
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