Generate a stake transaction payload containing one or more instructions. Possible instruction types and inputs are described below:
This returns a serialized transaction which can be deserialized, signed and submitted to the network.
See @solana/web.js docs for deserializing Versioned Messages and working with Versioned Transactions
N.B any instructions operating on an existing stake account must specify target stakePubkey in the request body seperate to the instructions
Create and delegate new stake account
{
type: 'createAndDelegate'
input: {
fromPubkey: pubkey of funding address,
stakeAuthority: address authorized to delegate and undelegate stake,
withdrawAuthority: address authorized to withdraw stake,
lamports: amount of lamports to stake (1 sol = 1000000000 lamports),
reference: an arbitrary reference used to identify/group the stake within the Pier Two platform,
label: an arbitrary label/memo for use within the Pier Two platform
}
}
Create a new stake account (same input data as 'createAndDelegate')
{
type: 'create'
input: {
fromPubkey: pubkey of funding address,
stakeAuthority: address authorized to delegate and undelegate stake,
withdrawAuthority: address authorized to withdraw stake,
lamports: amount of lamports to stake (1 sol = 1000000000 lamports),
reference: an arbitrary reference used to identify/group the stake within the Pier Two platform,
label: an arbitrary label/memo for use within the Pier Two platform
}
}
Delegate an existing stake account
{
type: 'delegate'
input: {
authorizedPubkey: address authorized to delegate and undelegate stake
}
}
Undelegate (deactivate) an existing stake account
{
type: 'undelegate'
input: {
authorizedPubkey: address authorized to delegate and undelegate stake
}
}
Withdraw inactive stake (deactivated stake balance or any other excess SOL held by account)
{
type: 'withdraw'
input: {
toPubkey: recipient of withdrawn funds,
authorizedPubkey: address authorized to withdraw stake,
lamports: amount of lamports to withdraw (1 sol = 1000000000 lamports),
}
}
Merge an eligible stake account into target stake account
An eligible stake account must have the same stakeAuthority and withdrawAuthority and have been active for an entire epoch and earned rewards
{
type: 'merge'
input: {
sourceStakePubkey: address of stake account to merge (this account will be dissolved/closed onchain),
authorizedPubkey: address authorized to delegate and undelegate
}
}