feat: Campaign supply cap, multi-level referrals, and TypeScript SDK - #1157
Merged
joelpeace48-cell merged 1 commit intoAug 31, 2026
Conversation
…cript SDK Implements improvements across rewards contract and SDK infrastructure. Rewards Contract Enhancements: - Add configurable per-campaign total supply caps with enforcement - Implement multi-level referral tree (up to 10 levels deep) - Add tiered referral rewards with per-level rate configuration - Include dust handling policy via minimum claim threshold - Add comprehensive error codes for new features Smart Contract Changes: - New storage keys: CAMPAIGN_CAP, CAMPAIGN_ISSUED, REF_DEPTH, REF_TIER_RATE - New functions: set_campaign_supply_cap(), campaign_supply_cap(), campaign_issued(), credit_for_campaign_capped() - New multi-level referral functions: set_multi_level_referral_config(), pay_multi_level_referral_bonus(), referral_tree_depth(), referral_tier_rate() - Enhanced error handling: BelowMinClaim, CampaignSupplyCapExceeded, InvalidReferralDepth, InvalidReferralTierConfig TypeScript SDK: - Add TypeScript configuration with strict mode enabled - Create contract bindings generation script using stellar-cli - Update package.json with build pipeline and npm publishing config - Add comprehensive README with usage examples - Setup exports for REST API, contracts, and ZK utilities - Configure for npm publication with proper peer dependencies The SDK now supports: - Auto-generated TypeScript types from OpenAPI spec - Soroban contract bindings (rewards & campaign contracts) - Tree-shakeable exports with proper module resolution - Semantic versioning ready for npm publication Documentation: - Added inline code documentation for all new functions - Included usage examples in SDK README - Documented anti-abuse mechanisms for referral system Related to issues FinesseStudioLab#878, FinesseStudioLab#898, FinesseStudioLab#900, FinesseStudioLab#903
|
@meshackyaro Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements four key enhancements to the Trivela platform, addressing mainnet-readiness requirements and developer experience improvements.
Issues Addressed
Closes #878
Closes #898
Closes #900
Closes #903
Changes
1. Issue #903: Campaign Supply Cap
Implements per-campaign total supply caps to bound financial liabilities and enable scarcity-based mechanics.
Acceptance Criteria Met:
Implementation:
2. Issue #898: Multi-Level Referral Tree
Extends single-level referrals to multi-tiered rewards up the referral chain with configurable depth and per-level rates.
Acceptance Criteria Met:
Implementation:
3. Issue #900: Minimum Claim Threshold + Dust Handling
Adds configurable minimum claim amount to prevent fee-wasting micro-transactions on mainnet.
Acceptance Criteria Met:
Implementation:
4. Issue #878: TypeScript SDK
Ships a versioned, documented TypeScript SDK with contract bindings and REST API client for third-party integrations.
Acceptance Criteria Met:
Implementation:
Testing
Manual Testing Required
Existing Tests
Migration Notes
For Contract Deployers
Documentation