Execute a swap task in the Pump AMM based on the given parameters.

Input: Pool address, input token amount, max allowed slippage, and swap direction.

Returns: Executes the swap operation in the Pump AMM with the given parameters.

Example: Swap 10 tokens from X to Y with a maximum slippage of 0.5%

{
"pumpAmmTask": {
"pool_address": "Gf7sXMoP8iRw4iiXmJ1nq4vxcRycbGXy5RL8a8LnTd3v",
"in_amount": "10",
"max_slippage": 0.5,
"is_x_for_y": true
}

Implements

Constructors

Properties

inAmount: number

Optional. The input token amount for the swap.

  • This value should in full units of the input token.
  • Default value: 1 (Swap 1 full token).
isXForY: boolean

Optional. Indicates the swap direction:

  • true: Swapping token X for token Y.
  • false: Swapping token Y for token X.
  • Default value: true.
maxSlippage: number

Optional. The maximum allowed slippage for the swap, expressed as a percentage.

  • Example: 0.5 represents 0.5% slippage tolerance.
  • Default value: 3 (3% slippage tolerance).
poolAddress: string

Required. The address of the liquidity pool in the Pump AMM.

Methods

  • Converts this PumpAmmTask to JSON.

    Returns { [k: string]: any }

    JSON object

  • Creates a new PumpAmmTask instance using the specified properties.

    Parameters

    Returns PumpAmmTask

    PumpAmmTask instance

  • Decodes a PumpAmmTask 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 PumpAmmTask

    PumpAmmTask

    If the payload is not a reader or valid buffer

    If required fields are missing

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

    Parameters

    • reader: Uint8Array<ArrayBufferLike> | Reader

      Reader or buffer to decode from

    Returns PumpAmmTask

    PumpAmmTask

    If the payload is not a reader or valid buffer

    If required fields are missing

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

    Parameters

    • message: IPumpAmmTask

      PumpAmmTask message or plain object to encode

    • Optionalwriter: Writer

      Writer to encode to

    Returns Writer

    Writer

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

    Parameters

    • message: IPumpAmmTask

      PumpAmmTask message or plain object to encode

    • Optionalwriter: Writer

      Writer to encode to

    Returns Writer

    Writer

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

    Parameters

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

      Plain object

    Returns PumpAmmTask

    PumpAmmTask

  • Gets the default type url for PumpAmmTask

    Parameters

    Returns string

    The default type url

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

    Parameters

    • message: PumpAmmTask

      PumpAmmTask

    • Optionaloptions: IConversionOptions

      Conversion options

    Returns { [k: string]: any }

    Plain object

  • Verifies a PumpAmmTask message.

    Parameters

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

      Plain object to verify

    Returns null | string

    null if valid, otherwise the reason why it is not