Using Seahorse
Accounts
Last Updated: October 24, 2024Account (Base type) By deriving from the base Account type, you can make your own program accounts. Usage: Right now, accounts (and other classes in Seahorse) can only define their underlying data type by using type-annotated fields with no default value. You’re also allowed to define enums to use in your accounts, like so: Built-in...
SPL tokens
Last Updated: October 24, 2024The SPL token program Solana’s standard way of creating new token types is by creating a new Mint with the SPL token program. Seahorse provides convenient built-in support for the SPL token program. You can see an example of creating and using a token mint here. TokenAccount Account that holds SPL tokens. Accounts of this...
Instructions
Last Updated: October 24, 2024The @instruction decorator Converting a function to an instruction is as simple as adding the @instruction decorator. The parameters of an instruction can include both accounts and regular parameters. On the Rust/Anchor side, accounts are separated and put into an accounts context struct. Debug logging with print You can write to Solana’s program log with...
Other CPIs
Last Updated: October 24, 2024Seahorse’s Program type is a special account that allows you to make any CPI call you want. However, you have to go through Solana’s low-level interface to get there, which might be a bit tedious. Make sure you know what you’re doing before you use this! CpiAccount Each account that gets passed into a Solana...
The Seahorse language
Last Updated: October 24, 2024Seahorse is based on Python 3, but only supports a subset of the full Python language. It has some additional constraints on what is and isn’t allowed. Limitations: a brief overview Seahorse tries as hard as possible to do everything that Python does. However, some things that Python can do aren’t very feasibly translated to...