Set up
- Create a new Solana keypair on your backend.
- Send only the public key to Trench.
- Trench adds the public key to the onchain
Configwhitelist. - Wait for Trench to confirm that the public key is ready.
Build a trade
Use the Trench IDL to build the existing trade instructions.
Set
authority to your approved partner public key.
Use one address from Config.fee_addresses for protocol_fee_recipient.
Both the user signer and the authority signer must sign the same transaction.
Referral accounts
Every trade must include the writabletrader_referral account meta from the IDL. Derive it with the user signer. Use buyer for buys and seller for sells.
trader_referral and do not add any remaining referral accounts.
Claim cashback
Buildclaim_trader_cashback from the IDL. Only the trader is a signer. This instruction does not use authority.