Trade action.

Implements

Constructors

Properties

Constructors

Properties

argsSchema: ZodObject<
    {
        amount: ZodType<Amount, ZodTypeDef, Amount>;
        fromAssetId: ZodString;
        toAssetId: ZodString;
    },
    "strip",
    ZodTypeAny,
    { amount: Amount; fromAssetId: string; toAssetId: string },
    { amount: Amount; fromAssetId: string; toAssetId: string },
> = TradeInput

Schema for validating action arguments

description: string = TRADE_PROMPT

A description of what the action does

func: (
    wallet: Wallet,
    args: { amount: Amount; fromAssetId: string; toAssetId: string },
) => Promise<string> = trade

The function to execute for this action

Type declaration

    • (
          wallet: Wallet,
          args: { amount: Amount; fromAssetId: string; toAssetId: string },
      ): Promise<string>
    • Trades a specified amount of a from asset to a to asset for the wallet.

      Parameters

      • wallet: Wallet

        The wallet to trade the asset from.

      • args: { amount: Amount; fromAssetId: string; toAssetId: string }

        The input arguments for the action.

      Returns Promise<string>

      A message containing the trade details.

name: string = "trade"

The name of the action