Description:
The contract tracks referral counts per referral code (at lib.rs:915-920). When a freelancer submits an invoice with a referral code, the count for that code is incremented. The SDK does not expose a method to query these counts.
The contract implementation:
pub fn get_referral_stats(env: Env, code: BytesN<32>) -> u64 {
env.storage()
.persistent()
.get(&DataKey::ReferralCount(code))
.unwrap_or(0)
}
The referral code is a BytesN<32> (32-byte hash). The SDK method should:
- Accept a hex-encoded string referral code
- Convert it to
BytesN<32> for the contract call
- Return the count as a number
Why it matters: Referral tracking is a growth mechanism. Affiliates and marketing teams need to query referral performance to optimize campaigns.
Acceptance Criteria:
Relevant Files: contracts/invoice_liquidity/src/lib.rs:915-920, sdk/src/index.ts
Description:
The contract tracks referral counts per referral code (at
lib.rs:915-920). When a freelancer submits an invoice with a referral code, the count for that code is incremented. The SDK does not expose a method to query these counts.The contract implementation:
The referral code is a
BytesN<32>(32-byte hash). The SDK method should:BytesN<32>for the contract callWhy it matters: Referral tracking is a growth mechanism. Affiliates and marketing teams need to query referral performance to optimize campaigns.
Acceptance Criteria:
BytesN<32>using Stellar SDK utilitiesget_referral_statsviewPromise<number>Relevant Files:
contracts/invoice_liquidity/src/lib.rs:915-920,sdk/src/index.ts