Every example starts from a
WrapperContext for your wrapper. Read a wrapper shows how to get one with your xToken mint.
Read your earnings
Your fees sit in the wrapper’s vault as jlTokens until you claim them, and they keep earning Jupiter Lend yield with no partner fee on them. Where fees sit until you claim explains why. Your balance is what the vault holds beyond the users’ and Jupiter’s balances. The stored books leave out the fee since the last checkpoint, so project them withsimulateAccrue before you compute the balance.
Claim fees
claimPartnerFees pays your balance to the fee recipient stored on the wrapper. The program accepts no other destination. amount: "all" claims the whole balance, and a bigint claims that many jlToken atoms.
Who can trigger the claim depends on your claim policy. With no claim authority set, anyone can, and the fees still go only to your recipient. With one set, only the claim authority, the wrapper authority or the owner of the fee recipient account can.
Run accrue
accrue checkpoints the wrapper’s fees: it refreshes the Jupiter Lend price and charges the partner fee on the users’ yield since the last checkpoint. Every deposit, withdrawal, claim and partner fee change already does this first, so a wrapper with user activity needs no extra calls.
Anyone can run it. The instruction has no signer account, so only the transaction fee payer signs. Run it in two cases:
- After Jupiter changes the protocol share. A change reaches each wrapper at its next accrue, so
accrueapplies it right away. An idle wrapper keeps the old share until its next activity. - To checkpoint an idle wrapper before you read or report its books.
Change the partner fee
updatePartnerFee sets a new fee from 0 to 1,000 bps (0% to 10% of yield). The protocol share comes out of this fee, not on top of it. The instruction first accrues at the old fee, so the new fee applies to future yield only. It takes effect in the same transaction, with no delay.
Change the fee recipient
The fee recipient must be an existing jlToken token account under the market’s token program. It cannot be a wallet address, an account for another mint, or the wrapper’s vault. To pay fees to a wallet or a multisig, create its jlToken ATA first. This example uses@solana-program/token for the ATA, which the SDK also depends on.
Restrict who can claim
By default anyone can trigger a claim, and the fees go only to your recipient. To limit who can trigger it, set a claim authority. Then only the claim authority, the wrapper authority, or the owner of the fee recipient account can claim. Other signers fail withInvalidClaimAuthority (7013).
Rename the xToken
getUpdateXTokenMetadataInstructionAsync rewrites the xToken’s Metaplex metadata. The name is at most 32 bytes, the symbol at most 10 bytes, and the URI at most 200 bytes. The URI points to the Metaplex JSON file, which you host or Jupiter hosts for you.
Transfer the wrapper authority
The new authority takes effect in the same transaction and needs no acceptance step. Prefer a multisig as the wrapper authority.Sign with a multisig
When a multisig is the wrapper authority, the multisig signs on chain. Pass the SDK a noop signer for the multisig’s address withcreateNoopSigner(multisigAddress) as authority or signer, then hand the instructions to the multisig. For a Squads vault, convert each Kit instruction to a @solana/web3.js TransactionInstruction and pass them to @sqds/multisig as the vault transaction’s instructions. The Squads tab in Sign from your app has the full example.