Documentation ¶
Index ¶
- func AccountFromBase58(s string) (types.Account, error)
- func AccountFromString(s string) (types.Account, error)
- func AccountToBase58(a types.Account) string
- func DeriveAccountFromMnemonicBip44(mnemonic string) (types.Account, error)
- func DeriveTokenAccount(base58WalletAddr, base58MintAddr string) (common.PublicKey, error)
- func DeriveTokenAccountPubkey(wallet, mint common.PublicKey) (common.PublicKey, error)
- func NewAccount() types.Account
- func NewMnemonic(len MnemonicLength) (string, error)
- func PublicKeyFromBase58(s string) common.PublicKey
- func PublicKeyFromString(s string) common.PublicKey
- func ValidateSolanaWalletAddr(addr string) error
- type Client
- type MnemonicLength
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccountFromBase58 ¶
FromBase58 creates an Solana account from a base58 encoded string
func AccountFromString ¶
AccountFromString creates an Solana account from a base58 encoded string. Alias for AccountFromBase58
func AccountToBase58 ¶
ToBase58 converts an Solana account to a base58 encoded string
func DeriveAccountFromMnemonicBip44 ¶
DeriveAccountFromMnemonicBip44 derives an Solana account from a mnemonic phrase Compatible with BIP44 (phantom wallet, etc.)
func DeriveTokenAccount ¶
DeriveTokenAccount derives an associated token account from a Solana account and a mint address. This is a wrapper around the FindAssociatedTokenAddress function from the solana-go-sdk. base58WalletAddr is the base58 encoded address of the Solana account. base58MintAddr is the base58 encoded address of the token mint. The function returns the base58 encoded address of the token account or an error.
func DeriveTokenAccountPubkey ¶
DeriveTokenAccountPubkey derives an associated token account from a Solana account and a mint address. This is a wrapper around the FindAssociatedTokenAddress function from the solana-go-sdk.
func NewMnemonic ¶
func NewMnemonic(len MnemonicLength) (string, error)
NewMnemonic generates a new mnemonic phrase
func PublicKeyFromBase58 ¶
PublicKeyFromBase58 converts a base58 encoded public key to a PublicKey type Alias for PublicKeyFromString
func PublicKeyFromString ¶
PublicKeyFromString converts a string to a PublicKey type Wrapper around the common.PublicKeyFromString function from the solana-go-sdk
func ValidateSolanaWalletAddr ¶
ValidateSolanaWalletAddr validates a Solana wallet address. Returns an error if the address is invalid, nil otherwise.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main struct for the Solana client
func (*Client) DecryptMnemonic ¶
DecryptMnemonic decrypts a base58 encoded string with AES-256-GCM and returns the decrypted mnemonic phrase
type MnemonicLength ¶
type MnemonicLength int
Mnemonic length type
const ( MnemonicLength12 MnemonicLength = 128 // 128 bits of entropy, 12 words MnemonicLength24 MnemonicLength = 256 // 256 bits of entropy, 24 words )
Predefined mnemonic lengths