Refer User Without Deposit
Create a UserMetadata account with a referrer without requiring an initial deposit. This allows you to link a referrer to a user before they perform any lending operations.The referrer must be set when the UserMetadata account is created and cannot be changed afterward.
Import Dependencies
Import the required packages for Solana RPC communication, Kamino SDK operations, and Kit transaction building.Initialize RPC and Load Market
Set up configuration constants and initialize RPC connections.Update the
REFERRER address with the wallet address of the referrer who will earn commission from the user’s borrowing activity.Build User Metadata Setup Instructions
Generate instructions to create the UserMetadata account with the referrer.getUserLutAddressAndSetupIxs creates the necessary instructions to set up UserMetadata with a referrer without requiring a deposit operation.Send and Confirm Transaction
Send the transaction and confirm it using WebSocket.UserMetadata creation complete. The referrer is now permanently linked to the user and will earn commission from the user’s future borrowing activity.
When to Use This vs Deposit with Referral
When to Use This vs Deposit with Referral
Use this method when:
- You want to link a referrer to a user before they make their first deposit
- You’re creating UserMetadata as a separate step from deposit operations
- You have a simpler flow that doesn’t require immediate deposit
- You want to combine UserMetadata creation and deposit in a single transaction
- The user is ready to deposit immediately
- You want to minimize the number of transactions