PreparedTransaction contract.
Auth
Use an API key:network to NETWORK_MAINNET or NETWORK_DEVNET for every route.
The API checks that the wallet config belongs to the API key’s organization.
If the wallet belongs to another organization, the API returns NOT_FOUND.
Routes
Lamport amounts are unsigned decimal strings in requests and responses.
Timestamps are RFC 3339 strings.
Wallet envelope
Deposit, exit, and withdrawal take awallet object. Its
swigConfigAddress must match the route.
Prepare a role
POST /api/yield/{swig_config_address}/role/prepare
roleId to select a candidate role for validation.
If you omit it, the API selects the qualifying role with the lowest role ID held by yieldAuthority.
maxDepositLamports must be greater than 0.
The validator must currently accept deposits.
The response is one of:
existing:{ "roleId": 2, "actions": [...] }. A role held byyieldAuthoritycan already deposit up tomaxDepositLamports, exit, and withdraw. Roles withAllorAllButManageAuthorityqualify. Other roles need the program permissions, a general SOL allowance without destination restrictions, andStakeAll. Finite stake limits do not qualify for reuse.create:{ "transaction": PreparedTransaction, "yieldAuthority": ..., "actions": [...] }. An unsigned AddRole transaction for a new role withProgram(System),Program(Stake),SolLimit(maxDepositLamports), andStakeAll. Use an Ed25519 or Secp256r1roleManagerAuthoritywith anAllorManageAuthorityrole. After the transaction confirms, call the route again withoutroleIdto find the new role.
Deposit
POST /api/yield/{swig_config_address}/deposit/prepare
transaction, positionAddress, validatorVoteAddress,
delegatedLamports, and rentLamports.
The API derives the position with createWithSeed(feePayer, positionSeed, Stake program).
The Swig wallet is the staker and withdrawer. The position has no lockup.
Use an ASCII positionSeed of 1–32 bytes. Keep the same seed when you retry.
If the address already exists, the API returns ALREADY_EXISTS.
The validator must currently accept deposits.
Exit
POST /api/yield/{swig_config_address}/exit/prepare
Full exit:
transaction, exitingPositionAddress,
deactivatingLamports, and additionalRentLamports.
A partial exit needs a fully active position.
The exiting stake and the remaining stake must each meet the network’s minimum delegation.
Positions can still exit after their validator stops accepting deposits.
The validator must remain on the allowlist for exit and withdrawal preparation.
For a partial exit, use an ASCII positionSeed of 1–32 bytes.
Keep the same seed when you retry.
If the split address already exists, the API returns ALREADY_EXISTS.
Withdraw
POST /api/yield/{swig_config_address}/withdraw/prepare
transaction, withdrawalLamports, and destinationWalletAddress.
The destination is the Swig wallet. The position must be fully inactive with no lockup in force.
The withdrawal currently leaves the position’s rent reserve in place.
Options and estimates
GET /api/yield/{swig_config_address}/options?network=NETWORK_MAINNET returns
options[] with voteAddress, name, acceptsDeposits, and rate.
The rate contains estimatedNetAprBps, commissionBps, and lastUpdatedAt.
The rate can be absent if the current network data cannot produce an annual
percentage rate (APR) for that validator.
GET /api/yield/{swig_config_address}/estimate?network=…&validatorVoteAddress=…&principalLamports=…&horizonDays=…
returns projection with estimatedRewardsLamports =
principal × net APR × days / 365, rounded down.
Set horizonDays to 1–365. principalLamports must be positive.
The validator must be on the allowlist.
Positions, summary, and rewards
GET …/positions?network=…&pageSize=…&pageToken=…returnspositions[],nextPageToken, andlastUpdatedAt. Positions sort by address. Each hasstate(YIELD_POSITION_STATE_ACTIVATING,_ACTIVE,_DEACTIVATING, or_INACTIVE),balanceLamports,rentLamports,positionLamports,withdrawableLamports, andearningLamports.GET …/summary?network=…returnstotalPositionLamports(excluding rent), indexedwithdrawableLamports, andrecordedRewardsLamports.GET …/rewards?network=…&pageSize=…&pageToken=…returnsrewards[]withpositionAddress,amountLamports, andearnedAt, ordered oldest first by credit time.
withdrawableLamports is the full balance, including rent.
In other states, it is only SOL above the delegation and rent reserve.
The withdrawal route needs an inactive position and keeps its rent reserve.
Use its withdrawalLamports for the amount the prepared transaction will return.
Each page has 50 entries by default, up to a maximum of 200.
A page token works only for its original organization, network, and wallet.

