Fetch the simulated swap price from Titan API.

Input: None

Returns: The swap price on Titan for a given input and output token mint address.

Example: Fetch the Titan price for exchanging 1 SOL into USDC.

{ "titanTask": { "inTokenAddress": "So11111111111111111111111111111111111111112", "outTokenAddress": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" } }

Example: Fetch the Titan price for exchanging 1000 SOL into USDC with slippage.

{ "titanTask": { "inTokenAddress": "So11111111111111111111111111111111111111112", "outTokenAddress": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "amount": "1000", "slippageBps": 50 } }

Implements

Constructors

Properties

accessToken: string

Optional API access token for authenticated requests

amount: string

The amount of tokens to swap (raw atoms, not scaled by decimals).

apiEndpoint: string

Optional API endpoint override (defaults to partners.api.titan.exchange)

If set, constrain quotes to the given set of DEXes.

excludeDexes?: null | OracleJob.TitanTask.IFilterList

If set, exclude the following DEXes when determining routes.

inTokenAddress: string

The input token mint address (base58 encoded).

onlyDirectRoutes: boolean

If set to true, only direct routes between the input and output mint will be considered.

outTokenAddress: string

The output token mint address (base58 encoded).

providers: string[]

If set, limit quotes to the given set of provider IDs.

slippageBps: number

Allowed slippage in basis points (e.g., 50 = 0.5%).

swapMode: SwapMode

Whether the amount is in terms of input or output token. Defaults to ExactIn.

userPublicKey: string

Optional user public key for transaction generation (base58 encoded).

Methods

  • Converts this TitanTask to JSON.

    Returns { [k: string]: any }

    JSON object

  • Decodes a TitanTask message from the specified reader or buffer.

    Parameters

    • reader: Uint8Array<ArrayBufferLike> | Reader

      Reader or buffer to decode from

    • Optionallength: number

      Message length if known beforehand

    Returns OracleJob.TitanTask

    TitanTask

    If the payload is not a reader or valid buffer

    If required fields are missing

  • Decodes a TitanTask message from the specified reader or buffer, length delimited.

    Parameters

    • reader: Uint8Array<ArrayBufferLike> | Reader

      Reader or buffer to decode from

    Returns OracleJob.TitanTask

    TitanTask

    If the payload is not a reader or valid buffer

    If required fields are missing

  • Encodes the specified TitanTask message. Does not implicitly {@apilink oracle_job.OracleJob.TitanTask.verify|verify} messages.

    Parameters

    • message: ITitanTask

      TitanTask message or plain object to encode

    • Optionalwriter: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Encodes the specified TitanTask message, length delimited. Does not implicitly {@apilink oracle_job.OracleJob.TitanTask.verify|verify} messages.

    Parameters

    • message: ITitanTask

      TitanTask message or plain object to encode

    • Optionalwriter: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Creates a TitanTask message from a plain object. Also converts values to their respective internal types.

    Parameters

    • object: { [k: string]: any }

      Plain object

    Returns OracleJob.TitanTask

    TitanTask

  • Gets the default type url for TitanTask

    Parameters

    Returns string

    The default type url

  • Creates a plain object from a TitanTask message. Also converts values to other types if specified.

    Parameters

    • message: OracleJob.TitanTask

      TitanTask

    • Optionaloptions: IConversionOptions

      Conversion options

    Returns { [k: string]: any }

    Plain object

  • Verifies a TitanTask message.

    Parameters

    • message: { [k: string]: any }

      Plain object to verify

    Returns null | string

    null if valid, otherwise the reason why it is not