• Delegates SOL to a validator using an existing stake account.

    Parameters

    • endpoint: string

      The Solana network endpoint to connect to.

    • authoritySecretString: string

      The secret key of the authority's wallet as a JSON string.

    • stakeAccountAddress: string

      The public key address of the stake account.

    • validatorVoteAccount: string

      The public key of the validator's vote account.

    Returns Promise<string>

    • A promise that returns signature if the transaction is successful.

    Throws

    • Throws an error if the transaction fails.

    Example

    const endpoint = 'https://api.mainnet-beta.solana.com'
    const authoritySecretString = process.env.AUTHORITY_SECRET_KEY || ''
    const stakeAccountAddress = 'StakeAccountPublicKeyHere'
    const validatorVoteAccount = 'ValidatorVoteAccountPublicKeyHere'

    try {
    const result = await delegateStake(endpoint, authoritySecretString, stakeAccountAddress, validatorVoteAccount)
    console.log('Stake delegation successful:', result)
    } catch (error) {
    console.error('Stake delegation failed:', error)
    }

Generated using TypeDoc