Installation
To install Reflect Whitelabel SDK within your development environment, run the following command:Overview
Use this SDK to interact with Reflect Proxy Program, an onchain infrastructure for minting and redeeming whitelabel yield-bearing stablecoins backed by collateral in Reflect. This SDK offers high-level functionality for creating a new proxy, issuing a branded stablecoin, minting, redeeming, and managing the integration.Quick Start
To create a new proxy, use the staticinitialize method on the Proxy class exported from the SDK. When creating a new proxy instance via constructor, the SDK expects onchain accounts to be already initialized and loads them silently. Only use the constructor after setting up the onchain proxy first.
initialize.ts
load.ts
loadFromMint method that will load your Proxy when provided with the mint address of your branded stablecoin.
loadFromMint.ts
Proxy Methods
initialize(params)
Creates a new proxy state account with the specified configuration.
Parameters:
signer: TransactionSigner- The transaction signer who will pay for the transactionauthority?: Address- Optional authority address (defaults to signer address)brandedMint: Address- The mint address of the branded tokenfeeBps: number- The fee in basis points (e.g., 100 = 1%)stablecoinMint: Address- The mint address of the underlying stablecoin
Promise<Instruction> - A create proxy instruction
loadFromMint(params)
Creates a new Proxy instance by deriving the proxy state address from a branded mint.
Parameters:
connection: Rpc<SolanaRpcApi>- The Solana RPC connectionbrandedMint: Address- The address of the branded mint
Promise<Proxy> - A new Proxy instance with loaded state data
load()
Reloads the proxy state data from the blockchain. It is lazily loaded when Proxy instance is initially created. Call to refresh the data.
Returns: Promise<void>
deposit(params)
Creates a deposit instruction that converts stablecoins to branded tokens.
Parameters:
signer: TransactionSigner- The transaction signer who owns the tokens being depositedamount: number- The amount of stablecoins to deposit
Promise<Instruction> - A deposit instruction
withdraw(params)
Creates a withdraw instruction that converts branded tokens back to stablecoins.
Parameters:
signer: TransactionSigner- The transaction signer who owns the branded tokensamount: number- The amount of branded tokens to withdraw
Promise<Instruction> - A withdraw instruction
claimFees()
Creates a claim fees instruction for the proxy authority to collect accumulated fees.
Returns: Promise<Instruction> - A claim fees instruction
PdaClient
Utility class for finding PDAs.deriveProxyState(brandedMint)
Derives the proxy state PDA from a branded mint address.
Parameters:
brandedMint: Address- The branded mint address
Promise<[Address, number]> - A tuple containing the PDA address and bump seed
Usage Examples
Creating a New Proxy
Loading and Using an Existing Proxy
Depositing Stablecoins
Withdrawing to Stablecoins
Claiming Fees (Authority Only)
Working with PDAs
Constants
The SDK exports the following constants:PROXY_STATE_SEED- The seed used for proxy state PDA derivationUSDC_PLUS_ORACLE- The oracle address tracking the real-time USDC+ exchange rateREFLECT_PROXY_PROGRAM_PROGRAM_ADDRESS- The program ID
Support
For issues, questions, or contributions:- Repository: https://github.com/palindrome-eng/reflect-proxy-program
- Authors: L0STE, stablecoinjesus @ Palindrome Engineering