Skip to main content

Intent structure

TIM intents are expressed in XML. Every intent has a <type>, a <chain_id>, and type-specific fields.
<intent>
  <type>IMMEDIATE | CONDITIONAL_ENTRY | CLOSE_POSITION</type>
  <chain_id>solana:mainnet-beta</chain_id>
  <entry>
    <condition>...</condition>
    <action>...</action>
  </entry>
  <exit>...</exit>
</intent>
The <entry> block defines what triggers the trade and what action to take. The <exit> block is optional and defines take-profit/stop-loss conditions.

Buy semantics

A <buy> action spends quote tokens to acquire base tokens.
  • <amount> is the number of quote tokens to spend
  • <quote> is the token you are spending (address or AIUSD)
  • <base> is the token you are buying (address or symbol)
<action>
  <buy>
    <amount>1</amount>
    <quote>EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v</quote>
    <base>trump</base>
  </buy>
</action>
This spends 1 USDC to buy TRUMP on Solana.
<buy> does not support <relative> or percentage amounts. To buy with your full balance, query your portfolio first and use the absolute amount.

Sell semantics

A <sell> action sells base tokens to receive quote tokens.
  • <amount> is the number of base tokens to sell
  • <quote> is the token you receive
  • <base> is the token you are selling
<action>
  <sell>
    <amount>1000.5</amount>
    <quote>So11111111111111111111111111111111111111112</quote>
    <base>EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v</base>
  </sell>
</action>

Sell all

Use <amount>all</amount> to sell your entire balance:
<action>
  <sell>
    <amount>all</amount>
    <quote>EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v</quote>
    <base>JUP</base>
  </sell>
</action>

Sell percentage

Use <relative> to sell a percentage of your balance (sell only):
<action>
  <sell>
    <relative><percentage>50.0</percentage></relative>
    <quote>So11111111111111111111111111111111111111112</quote>
    <base>EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v</base>
  </sell>
</action>

Default quote token

When the user does not specify a quote token, default to USDC on the target chain. For example:
  • “sell TRUMP” uses USDC as quote
  • “sell TRUMP for AIUSD” uses AIUSD as quote
  • “buy TRUMP with SOL” uses SOL as quote

Exit strategies

Attach an <exit> block to set take-profit and stop-loss conditions:
<exit>
  <conditions>
    <profit_percent>10</profit_percent>
    <loss_percent>5</loss_percent>
  </conditions>
  <logic>OR</logic>
</exit>
FieldMeaning
profit_percentSell when PnL reaches +X%
loss_percentSell when PnL reaches -X%
logicOR (default — either condition triggers) or AND (both must be true)

Intent type examples

IMMEDIATE — buy with USDC

<intent>
  <type>IMMEDIATE</type>
  <chain_id>solana:mainnet-beta</chain_id>
  <entry>
    <condition><immediate>true</immediate></condition>
    <action>
      <buy>
        <amount>1</amount>
        <quote>EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v</quote>
        <base>trump</base>
      </buy>
    </action>
  </entry>
</intent>

IMMEDIATE — buy with SOL

<intent>
  <type>IMMEDIATE</type>
  <chain_id>solana:mainnet-beta</chain_id>
  <entry>
    <condition><immediate>true</immediate></condition>
    <action>
      <buy>
        <amount>0.001</amount>
        <quote>So11111111111111111111111111111111111111112</quote>
        <base>pump</base>
      </buy>
    </action>
  </entry>
</intent>

IMMEDIATE — sell all

<intent>
  <type>IMMEDIATE</type>
  <chain_id>solana:mainnet-beta</chain_id>
  <entry>
    <condition><immediate>true</immediate></condition>
    <action>
      <sell>
        <amount>all</amount>
        <quote>EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v</quote>
        <base>JUP</base>
      </sell>
    </action>
  </entry>
</intent>

IMMEDIATE — sell percentage

<intent>
  <type>IMMEDIATE</type>
  <chain_id>solana:mainnet-beta</chain_id>
  <entry>
    <condition><immediate>true</immediate></condition>
    <action>
      <sell>
        <relative><percentage>50.0</percentage></relative>
        <quote>So11111111111111111111111111111111111111112</quote>
        <base>EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v</base>
      </sell>
    </action>
  </entry>
</intent>

IMMEDIATE — buy with exit strategy

<intent>
  <type>IMMEDIATE</type>
  <chain_id>solana:mainnet-beta</chain_id>
  <entry>
    <condition><immediate>true</immediate></condition>
    <action>
      <buy>
        <amount>1</amount>
        <quote>EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v</quote>
        <base>trump</base>
      </buy>
    </action>
  </entry>
  <exit>
    <conditions>
      <profit_percent>10</profit_percent>
      <loss_percent>5</loss_percent>
    </conditions>
    <logic>OR</logic>
  </exit>
</intent>

CONDITIONAL_ENTRY — event-triggered buy

Register a rule that triggers when PumpFun posts a bullish signal:
<intent>
  <type>CONDITIONAL_ENTRY</type>
  <chain_id>solana:mainnet-beta</chain_id>
  <entry>
    <condition>
      <event_trigger>
        <event_type>token_listing</event_type>
        <exchange>PUMPFUN</exchange>
        <sub_event_type>PUMPFUN_BULLISH</sub_event_type>
      </event_trigger>
    </condition>
    <action>
      <buy>
        <budget_aiusd>10</budget_aiusd>
        <base_from_event>contract_address</base_from_event>
      </buy>
    </action>
  </entry>
  <exit>
    <conditions>
      <profit_percent>50</profit_percent>
      <loss_percent>30</loss_percent>
    </conditions>
    <logic>OR</logic>
  </exit>
</intent>
For CONDITIONAL_ENTRY, the buy action uses:
  • <budget_aiusd> — amount in AIUSD to spend per matching event
  • <base_from_event> — must be contract_address (token resolved from the event)
The response includes a rule_id. The rule stays active and triggers on each matching event until cancelled.

CLOSE_POSITION — close by position ID

<intent>
  <type>CLOSE_POSITION</type>
  <chain_id>solana:mainnet-beta</chain_id>
  <position_id>pos_abc123</position_id>
</intent>
The response includes cancelled_orders (any exit orders that were removed) and realized_pnl.

Token addressing

Follow this priority order when specifying tokens:
  1. Contract address provided — use it directly
  2. Common tokens — use the known addresses from the table below
  3. Other tokens — use the symbol (e.g., trump, JUP). TIM resolves it automatically.

Common token addresses

ChainNativeUSDCUSDT
SolanaSo11111111111111111111111111111111111111112EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1vEs9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
Ethereum0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB480xdAC17F958D2ee523a2206206994597C13D831ec7
BSC0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d0x55d398326f99059fF775485246999027B3197955
Base0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
Arbitrum0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0xaf88d065e77c8cC2239327C5EDb3A432268e58310xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9
Amounts are always in human-readable decimal format (e.g., 0.170324), not raw smallest-unit integers.

CAIP-2 chain IDs

ChainID
Solanasolana:mainnet-beta
Ethereumeip155:1
BSCeip155:56
Baseeip155:8453
Arbitrumeip155:42161

AIUSD trading rules

  • Buy AIUSD: use a <sell> action with <quote>AIUSD</quote>. Any token can be sold for AIUSD.
  • Sell AIUSD: use a <buy> action with <quote>AIUSD</quote>. The base token must be a stablecoin: USDC, USDT, or USD1.
To buy non-stablecoins with AIUSD, run two intents:
  1. Convert AIUSD to USDC (<buy> with <quote>AIUSD</quote> and <base> = USDC address)
  2. Swap USDC for the target token (<buy> with <quote> = USDC address)

Buy AIUSD (sell a token to get AIUSD)

<intent>
  <type>IMMEDIATE</type>
  <chain_id>solana:mainnet-beta</chain_id>
  <entry>
    <condition><immediate>true</immediate></condition>
    <action>
      <sell>
        <amount>100</amount>
        <quote>AIUSD</quote>
        <base>trump</base>
      </sell>
    </action>
  </entry>
</intent>

Sell AIUSD for USDC

<intent>
  <type>IMMEDIATE</type>
  <chain_id>solana:mainnet-beta</chain_id>
  <entry>
    <condition><immediate>true</immediate></condition>
    <action>
      <buy>
        <amount>100</amount>
        <quote>AIUSD</quote>
        <base>EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v</base>
      </buy>
    </action>
  </entry>
</intent>