openapi: 3.0.0
info:
    title: AdEx AURA API
    version: 1.1
servers:
    - url: https://aura.adex.network
paths:
    /api/portfolio/balances:
        get:
            tags:
                - portfolio balances
            summary: Get wallet's portfolio balances
            description: Retrieves the portfolio balances for a given address.
            parameters:
                - name: address
                  in: query
                  required: true
                  schema:
                      type: string
                  description: The address to process the portfolio for.
                - name: apiKey
                  in: query
                  schema:
                      type: string
                  description: API key for higher rate limits.
            responses:
                '200':
                    description: Successful response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/PortfolioBalancesResponse'
                '400':
                    description: General error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/ErrorResponse'
                '429':
                    description: Rate limit error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/ErrorResponse'
                '500':
                    description: Internal server error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/ErrorResponse'
    /api/portfolio/strategies:
        get:
            tags:
                - portfolio strategies
            summary: Get strategies based on wallet's portfolio
            description: Retrieves the portfolio and strategies for a given address.
            parameters:
                - name: address
                  in: query
                  required: true
                  schema:
                      type: string
                  description: The address to process the portfolio for.
                - name: apiKey
                  in: query
                  schema:
                      type: string
                  description: API key for higher rate limits.
            responses:
                '200':
                    description: Successful response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/PortfolioStrategiesResponse'
                '400':
                    description: General error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/ErrorResponse'
                '429':
                    description: Rate limit error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/ErrorResponse'
                '500':
                    description: Internal server error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/ErrorResponse'
components:
    schemas:
        PortfolioBalancesResponse:
            title: PortfolioBalancesResponse
            type: object
            required:
                - address
                - portfolio
                - version
            properties:
                address:
                    type: string
                    description: The address for which the portfolio is processed.
                portfolio:
                    type: array
                    items:
                        $ref: '#/components/schemas/NetworkPortfolio'
                    description: The portfolio details across different networks.
                cached:
                    type: boolean
                    description: Indicates whether the response was cached.
                version:
                    type: string
                    description: The API version of the response.
        PortfolioStrategiesResponse:
            title: PortfolioStrategiesResponse
            type: object
            required:
                - address
                - portfolio
                - strategies
                - version
            properties:
                address:
                    type: string
                    description: The address for which the portfolio is processed.
                portfolio:
                    type: array
                    items:
                        $ref: '#/components/schemas/NetworkPortfolio'
                    description: The portfolio details across different networks.
                strategies:
                    type: array
                    items:
                        $ref: '#/components/schemas/Strategy'
                    description: The strategies suggested for the portfolio.
                cached:
                    type: boolean
                    description: Indicates whether the response was cached.
                version:
                    type: string
                    description: The API version of the response.
        NetworkPortfolio:
            title: NetworkPortfolio
            type: object
            required:
                - network
                - tokens
            properties:
                network:
                    $ref: '#/components/schemas/PortfolioNetworkInfo'
                    description: Information about the network.
                tokens:
                    type: array
                    items:
                        $ref: '#/components/schemas/PortfolioToken'
                    description: The tokens (assets) held on this network.
                positionTokens:
                    type: array
                    items:
                        $ref: '#/components/schemas/DeFiPositionToken'
                    description: The DeFi position tokens held on this network, if any.
        PortfolioNetworkInfo:
            title: PortfolioNetworkInfo
            type: object
            required:
                - name
                - chainId
                - platformId
                - explorerUrl
                - iconUrls
            properties:
                name:
                    type: string
                    description: The name of the network.
                chainId:
                    type: string
                    description: The chain id of the network.
                platformId:
                    type: string
                    description: Alias for the network.
                explorerUrl:
                    type: string
                    description: URL of block explorer for the network.
                iconUrls:
                    type: array
                    items:
                        type: string
                    description: URLs of icons for the network.
        PortfolioToken:
            title: PortfolioToken
            type: object
            required:
                - address
                - symbol
                - decimals
                - balance
                - balanceRaw
                - balanceUSD
            properties:
                address:
                    type: string
                    description: The contract address of the token.
                symbol:
                    type: string
                    description: The symbol of the token.
                decimals:
                    type: number
                    description: The number of decimals of the token.
                balance:
                    type: number
                    description: The balance in token units.
                balanceRaw:
                    type: string
                    description: The balance in raw units
                balanceUSD:
                    type: number
                    description: The USD value of the token balance.
        DeFiPositionToken:
            title: DeFiPositionToken
            type: object
            required:
                - address
                - symbol
                - decimals
                - balance
                - balanceRaw
                - balanceUSD
                - type
                - providerName
            properties:
                address:
                    type: string
                    description: The contract address of the token.
                symbol:
                    type: string
                    description: The symbol of the token.
                decimals:
                    type: number
                    description: The number of decimals of the token.
                balance:
                    type: number
                    description: The balance in token units.
                balanceRaw:
                    type: string
                    description: The balance in raw units
                balanceUSD:
                    type: number
                    description: The USD value of the token balance.
                type:
                    type: string
                    enum: [liquidity, collateral, borrow, reward]
                    description: The type of DeFi position, such as liquidity provision, collateral, borrow, or reward.
                providerName:
                    type: string
                    description: The name of the DeFi protocol or platform where the position is held.
                providerUrl:
                    type: string
                    description: The URL of the DeFi protocol or platform where the position is held.
                providerIconUrl:
                    type: string
                    description: The icon URL of  DeFthei protocol or platform where the position is held.
                chainId:
                    type: string
                    description: The chain id of the network where the position is held.
                action:
                    type: string
                    description: The action which this position is involved in, such as liquidity provision, staking, lending, borrowing, yield farming, etc.
                apy:
                    type: string
                    description: The annual percentage yield of the position, if applicable.
                healthRate:
                    type: number
                    description: The health rate of the position, if applicable
        Strategy:
            title: Strategy
            type: object
            required:
                - llm
                - response
            properties:
                llm:
                    type: object
                    properties:
                        provider:
                            type: string
                            description: The provider of the LLM.
                        model:
                            type: string
                            description: The model of the LLM.
                    description: Information about the LLM used.
                response:
                    type: array
                    items:
                        $ref: '#/components/schemas/StrategyResponse'
                    description: The strategy responses.
                responseTime:
                    type: number
                    description: The time taken to generate the response.
                error:
                    type: string
                    nullable: true
                    description: Any error message, or null if no error.
        StrategyResponse:
            title: StrategyResponse
            type: object
            required:
                - name
                - risk
                - actions
            properties:
                name:
                    type: string
                    description: The name of the strategy.
                risk:
                    type: string
                    description: The risk level of the strategy, low|moderate|high|opportunistic
                actions:
                    type: array
                    items:
                        $ref: '#/components/schemas/Action'
                    description: The actions involved in the strategy.
        Action:
            title: Action
            type: object
            required:
                - tokens
                - description
            properties:
                tokens:
                    type: string
                    description: Comma-separated list of tokens involved in the action.
                description:
                    type: string
                    description: A description of the action.
                platforms:
                    type: array
                    items:
                        $ref: '#/components/schemas/Platform'
                    description: The platforms where the action can be performed.
                networks:
                    type: array
                    items:
                        type: string
                    description: The networks on which the action is applicable.
                operations:
                    type: array
                    items:
                        type: string
                    description: The operations involved in the action.
                apy:
                    type: string
                    description: The annual percentage yield of the action.
        Platform:
            title: Platform
            type: object
            required:
                - name
                - url
            properties:
                name:
                    type: string
                    description: The name of the platform.
                url:
                    type: string
                    description: The URL of the platform.
        ErrorResponse:
            title: ErrorResponse
            type: object
            required:
                - message
            properties:
                message:
                    type: string
                    description: Information about the error.
