WEarn
    WEarn
    • Quick Start
    • Use scenarios
    • Supported Network & Token
    • OpenApi
      • bridge
        • Bridge Generate Payload
        • Initiate Bridge
        • Verify Bridge Transaction
        • Estimate Receive Amount
      • swap
        • Swap Generate Payload
        • Initiate Swap
        • Verify Swap Transaction
        • Estimate Receive Amount
      • profit
        • Query Yield History
        • Query Yield To Claim
        • Claim Yield
        • Get Yield Rate

    Quick Start

    Earn low-risk interest with W Earn#

    W Earn is a product that can be used to earn low-risk interest, you can use usdt to swap wusd and earn daily income.
    For more details, please contact W Earn team via contact@stableflow.app to register your wallet and start earning.

    Environment URLs#

    Register a wallet#

    Transfer WUSD via swap or bridge
    Interest is calculated daily; no interest is accrued on the day of deposit or redemption

    Development Environment#

    API Base URL: https://openapi-devapi.swapflow.io/api
    OAuth URL: https://openapi-devapi.swapflow.io/api/oauth2/token

    Mainnet Environment#

    API Base URL: https://openapi-api.stableflow.app/api/
    OAuth URL: https://openapi-api.stableflow.app/api/oauth2/token

    Authentication#

    Before making API calls, you need to obtain an access token using OAuth 2.0 client credentials flow, and your server ip need to be whitelisted. The client ID and client secret are required for this process, which you can obtain from the Stableflow team. Use the OAuth2.0 endpoint provided above to obtain the access token, which is required for all API calls. The token is valid for 1 hour.

    Getting an Access Token#

    Example using curl:

    Using the Access Token#

    The access token must be included in the Authorization header for all API requests.
    Important notes about access tokens:
    1.
    Tokens expire after 1 hour
    2.
    Store tokens securely and never expose them in client-side code
    3.
    Implement token refresh logic for long-running applications
    4.
    Use environment variables for storing credentials
    5.
    Each API call must include the token in the Authorization header

    API URLs#

    Production: https://openapi.stableflow.app/api
    Testnet: https://openapi-devapi.swapflow.io/api
    Choose the appropriate API URL based on your environment. In the examples below, replace YOUR_API_URL with either the production or testnet URL.

    Prerequisites#

    1.
    Install the required dependency:
    2.
    Make sure you have:
    Access to an Ethereum RPC endpoint (e.g., Infura, Alchemy)
    A private key or wallet for signing transactions
    Access to the StableFlow API (use testnet API for development)
    Client ID and Client Secret for API authentication

    Swap Example Usage By Ether.js#

    Bridge Example Usage By Tronweb#

    Important Notes#

    1.
    API Responses
    All API responses follow the format: { code: number, data: T, message: string }
    Transaction payloads include all necessary fields for sending to the network
    Gas estimation is handled automatically by the provider
    2.
    Security Considerations
    Never share or commit your private key
    Use environment variables for sensitive data
    Test thoroughly on testnet before mainnet
    production environment testing is needed before openning to customers
    Verify token addresses and amounts before signing
    3.
    Gas and Network
    Ensure sufficient ETH/TRX for gas fees
    Network congestion can affect transaction times
    Consider implementing gas price strategies for mainnet
    Modified at 2025-07-31 06:23:08
    Next
    Use scenarios
    Built with