New Features
#61 New SVM Tricks 🃏 The svm_setTokenAccount RPC method
This PR adds the second of our SVM Tricks RPC method: svm_setTokenAccount. This RPC allows overwriting the token account data for an associated token account in the SVM state.
The RPC method has the following arguments:
- The pubkey of the owner of the token account to update
- The pubkey of the token mint
- An object with any account fields:
amount,delegate,delegatedAmount,closeAuthority, andstate. - The token program address. The default is the Token 2020 program address.
Any of the fields specified in argument 3 will be applied onto the associated token account for the owner/token/token_program combination.
Here is an example RPC call:
{
"jsonrpc": "2.0",
"id": "1",
"method": "svm_setTokenAccount",
"params": [
"zbBjhHwuqyKMmz8ber5oUtJJ3ZV4B6ePmANfGyKzVGV",
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
{
"amount": 100000000000,
"closeAuthority": "zbBjhHwuqyKMmz8ber5oUtJJ3ZV4B6ePmANfGyKzVGV",
"delegate": "null",
"delegateAmount": 0
}
]
}Pro Tip: Supercharge your interactions with surfpool using txtx runbooks! Check out the latest txtx release which adds the svm::setup_surfnet action
#60 Native Program Support
Up to this point, the auto-generation of Runbooks has only applied for programs written with Anchor.
The release of txtx v0.2.15 enables the deployment of native rust programs as well!
This includes programs created with Pinocchio, Steel and just the solana-program dependency as well. For the fullest set of features, we recommend generating an IDL using Shank if you're writing native Rust programs.
To use this feature, simply run surfpool start in a program directory, and surfpool will create a deployment runbook for you, start your surfnet, and deploy the program to the surfnet!
Fixes
#62 fix(core/simnet): get program data accounts from remote during tx pre-process by @MicaiahReid
When you send a transaction to the surfnet, it is automatically pre-processed to make sure that all accounts referenced in the transaction are either available in the local svm store or are pulled from mainnet.
However, in the case that you are referencing a program that exists on mainnet, it's not enough to pull the program account for proper execution of the transaction. You also need to pull the program data account.
This PR fixes the surfnet behavior such that executable accounts automatically have their program data accounts pulled into the vm as well.
- Feat/native support by @MicaiahReid in #60
- feat(rpc): add svm_setTokenAccount rpc method #61
Full Changelog: v0.1.11...v0.1.12
Important
Surfpool is in pre-release—handle with care! It might wipe out or ride smoothly, depending on the swell.
Always stay on the latest version for the best ride.
# macOS (Homebrew)
brew reinstall txtx/taps/surfpool
# Linux (Snapstore)
snap upgrade surfpool