How Referral Codes Work
Kamino’s referral system allows referrers to earn commission from the borrowing activity of referred users. Each referrer creates a unique referral code that can be shared publicly without revealing a wallet address, providing a user-friendly way to distribute referral codes.In the SDK, the
shortUrl field represents the referral code.- TypeScript
- Rust
1
Import Dependencies
2
Initialize RPC
3
Create Referrer State with Short URL
Check the referral code is free, then create the referrer state and short URL.The short URL must be unique, at most 32 characters, and use only ASCII letters, digits, underscore and hyphen.
isShortUrlAvailable checks both. Each wallet gets one code.4
Build the Transaction
5
Sign and Send
6
Verify Short URL Resolution
Referrer setup complete. The short URL is active and can be shared with users to establish referral relationships.