🕵️Agent APIs

These are the available endpoints that you can call to invoke Brian's agent tools.

  • /transaction: Send Transactions from a prompt

  • /knowledge: get a textual response GPT like and the web3 docs used to generate the text

  • /smart-contracts: smart contract: input a prompt and get the solidity smart contract code (look at the smart contracts supported)

  • /parameters-extraction: input a prompt and get the extracted parameters for the user's intent

If you're from the US and experiencing latency issues, try using https://us-api.brianknows.org as the base URL for the APIs.

Generate transaction(s) from a prompt.

POST https://api.brianknows.org/api/v0/agent/transaction

Allows you to send a prompt to Brian and generate the all the needed calldata to send that given transaction(s).

The currently available actions are:

  • swap

  • bridge

  • crosschain swap

  • transfer

  • approve

  • wrap and unwrap native token

  • deposit and withdraw from defi protocols

  • ENS domain registration

  • ENS domain renewal

  • ENS checks actions (availability, expiration, forward and reverse resolution and check registration and renewal costs)

Headers

Request Body

If you don't pass the chainId in the body, the source chain will be deducted from the prompt, if available.

View below for some real examples.

{
  "result": [
    {
      "solver": "",
      "action": "",
      "type": "",
      "data": {
        "description": "",
        "steps": [
          {
            "chainId": ,
            "blockNumber": ,
            "from": "",
            "to": "",
            "gasLimit": "",
            "data": "",
            "value": "",
            "protocol": {
              "key": "",
              "name": "",
              "logoURI": ""
            }
          }
        ],
        "gasCostUSD": "",
        "fromChainId": ,
        "fromAmountUSD": ,
        "fromAmount": "",
        "fromToken": {
          "address": "",
          "chainId": ,
          "symbol": "",
          "decimals": ,
          "name": "",
          "coinKey": "",
          "logoURI": "",
          "priceUSD": ""
        },
        "fromAddress": "",
        "toChainId": ,
        "toAmountUSD": ,
        "toAmount": "",
        "toAmountMin": "",
        "toToken": {
          "address": "",
          "chainId": ,
          "symbol": "",
          "decimals": ,
          "name": "",
          "coinKey": "",
          "logoURI": "",
          "priceUSD": ""
        },
        "toAddress": ""
      }
    }
  ]
}

API examples

Here are some examples of calling the APIs described above.

Transfer native tokens

curl -XPOST "https://api.brianknows.org/api/v0/agent/transaction" -H "Content-Type: application/json" -H "x-brian-api-key: API_KEY" -d '{
    "prompt": "I want to transfer 10 MATIC to 0x9319b31838bba444CCeAeD025153a48AD6377471 on Polygon",
    "address": "0x9319b31838bba444CCeAeD025153a48AD6377471"
}'
Response
{
  "result": [
    {
      "solver": "Brian",
      "action": "transfer",
      "type": "write",
      "data": {
        "description": "You are about to send 10 MATIC ($7.31) to 0x9319...7471 on polygon.",
        "steps": [
          {
            "chainId": 137,
            "blockNumber": 56608747,
            "from": "0x9319b31838bba444CCeAeD025153a48AD6377471",
            "to": "0x9319b31838bba444CCeAeD025153a48AD6377471",
            "value": "10000000000000000000",
            "gasLimit": "21000"
          }
        ],
        "fromChainId": 137,
        "fromAmount": "10000000000000000000",
        "fromToken": {
          "address": "0x0000000000000000000000000000000000000000",
          "chainId": 137,
          "symbol": "MATIC",
          "decimals": 18,
          "name": "MATIC",
          "coinKey": "MATIC",
          "logoURI": "https://static.debank.com/image/matic_token/logo_url/matic/6f5a6b6f0732a7a235131bd7804d357c.png",
          "priceUSD": "0.730726"
        },
        "fromAddress": "0x9319b31838bba444CCeAeD025153a48AD6377471",
        "toChainId": 137,
        "toAmount": "10000000000000000000",
        "toAmountMin": "10000000000000000000",
        "toToken": {
          "address": "0x0000000000000000000000000000000000000000",
          "chainId": 137,
          "symbol": "MATIC",
          "decimals": 18,
          "name": "MATIC",
          "coinKey": "MATIC",
          "logoURI": "https://static.debank.com/image/matic_token/logo_url/matic/6f5a6b6f0732a7a235131bd7804d357c.png",
          "priceUSD": "0.730726"
        },
        "toAddress": "0x9319b31838bba444CCeAeD025153a48AD6377471"
      }
    }
  ]
}

Transfer ERC-20 tokens

curl -XPOST "https://api.brianknows.org/api/v0/agent/transaction" -H "Content-Type: application/json" -H "x-brian-api-key: API_KEY" -d '{"prompt": "I want to transfer 10 USDC to 0x9319b31838bba444CCeAeD025153a48AD6377471 on Polygon",
    "address": "0x9319b31838bba444CCeAeD025153a48AD6377471"
}'
Response
{
  "result": [
    {
      "solver": "Brian",
      "action": "transfer",
      "type": "write",
      "data": {
        "description": "You are about to send 10 USDC ($10.00) to 0x9319...7471 on polygon.",
        "steps": [
          {
            "chainId": 137,
            "blockNumber": 56608767,
            "from": "0x9319b31838bba444CCeAeD025153a48AD6377471",
            "to": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
            "value": "0",
            "data": "0xa9059cbb0000000000000000000000009319b31838bba444cceaed025153a48ad63774710000000000000000000000000000000000000000000000000000000000989680",
            "gasLimit": "100000"
          }
        ],
        "fromChainId": 137,
        "fromAmount": "10000000",
        "fromToken": {
          "address": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
          "chainId": 137,
          "symbol": "USDC",
          "decimals": 6,
          "name": "USD Coin",
          "coinKey": "USDC",
          "logoURI": "https://static.debank.com/image/coin/logo_url/usdc/e87790bfe0b3f2ea855dc29069b38818.png",
          "priceUSD": "0.9995979052074536"
        },
        "fromAddress": "0x9319b31838bba444CCeAeD025153a48AD6377471",
        "toChainId": 137,
        "toAmount": "10000000",
        "toAmountMin": "10000000",
        "toToken": {
          "address": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
          "chainId": 137,
          "symbol": "USDC",
          "decimals": 6,
          "name": "USD Coin",
          "coinKey": "USDC",
          "logoURI": "https://static.debank.com/image/coin/logo_url/usdc/e87790bfe0b3f2ea855dc29069b38818.png",
          "priceUSD": "0.9995979052074536"
        },
        "toAddress": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"
      }
    }
  ]
}

Swap tokens

curl -XPOST "https://api.brianknows.org/api/v0/agent/transaction" -d '{"prompt": "I want to swap 10 USDC for ETH on base", "address": "0x9319b31838bba444CCeAeD025153a48AD6377471"}' -H "Content-Type: application/json" -H "x-brian-api-key: API_KEY"
Response
{
  "result": [
    {
      "solver": "Enso",
      "action": "swap",
      "type": "write",
      "data": {
        "description": "You are about to swap 10 USDC for 0.003187490961853524 ETH ($10) on base using Enso solver. The address receiver is 0x9319...7471.",
        "steps": [
          {
            "chainId": 8453,
            "blockNumber": 14064487,
            "from": "0x9319b31838bba444CCeAeD025153a48AD6377471",
            "to": "0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E",
            "gasLimit": "337728",
            "data": "0xb35d7e73000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda029130000000000000000000000000000000000000000000000000000000000989680000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000008a9059cbb010001ffffffffff833589fcd6edb6e08f4c7c32d4f71b54bda02913095ea7b3010203ffffffffff833589fcd6edb6e08f4c7c32d4f71b54bda0291319198595a30485ffffffff85111111125421ca6dc452d289314280a0f8842a659bd3b227018504ffffffff056675a323dedb77822fcf39eaa9d682f6abe72555ddcd52200105ffffffffff057e7d64d987cab6eed08a191c4c2459daf2f8ed0b19198595a30586ffffffffff9319b31838bba444cceaed025153a48ad63774716e7a43a3010507ffffffff057e7d64d987cab6eed08a191c4c2459daf2f8ed0b241c59120105ffffffffffff7e7d64d987cab6eed08a191c4c2459daf2f8ed0b000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000004a000000000000000000000000000000000000000000000000000000000000004c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000129b480ad625bcd1a5c3a1c10d708114726fa467000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000027100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000111111125421ca6dc452d289314280a0f8842a6500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000986f7000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022807ed2379000000000000000000000000e37e799d5077682fa0a244d46e5649f71457bd09000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000e37e799d5077682fa0a244d46e5649f71457bd090000000000000000000000007d585b0e27bbb3d981b7757115ec11f47c4769940000000000000000000000000000000000000000000000000000000000986f70000000000000000000000000000000000000000000000000000afc093482c81e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000d90000000000000000000000000000000000000000bb0000a100008b00004f02a0000000000000000000000000000000000000000000000000000afc093482c81eee63c1e50072ab388e2e2f6facef59e3c3fa2c4e29011c2d38833589fcd6edb6e08f4c7c32d4f71b54bda029134101420000000000000000000000000000000000000600042e1a7d4d0000000000000000000000000000000000000000000000000000000000000000c061111111125421ca6dc452d289314280a0f8842a6500206b4be0b9111111125421ca6dc452d289314280a0f8842a650000000000000097864b9100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000afc093482c81e",
            "value": "0",
            "protocol": {
              "key": "enso",
              "name": "enso",
              "logoURI": ""
            }
          }
        ],
        "gasCostUSD": "",
        "fromChainId": 8453,
        "fromAmountUSD": 10,
        "fromAmount": "10000000",
        "fromToken": {
          "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "chainId": 8453,
          "symbol": "USDC",
          "decimals": 6,
          "name": "USD Coin",
          "coinKey": "USDC",
          "logoURI": "https://static.debank.com/image/coin/logo_url/usdc/e87790bfe0b3f2ea855dc29069b38818.png",
          "priceUSD": "1"
        },
        "fromAddress": "0x9319b31838bba444CCeAeD025153a48AD6377471",
        "toChainId": 8453,
        "toAmountUSD": 10.012769733741619,
        "toAmount": "3187490961853524",
        "toAmountMin": "3187490961853524",
        "toToken": {
          "address": "0x0000000000000000000000000000000000000000",
          "chainId": 8453,
          "symbol": "ETH",
          "decimals": 18,
          "name": "ETH",
          "coinKey": "ETH",
          "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
          "priceUSD": "3141.27"
        },
        "toAddress": "0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E"
      }
    }
  ]
}

The steps array can contain a list of possible swap routes that the user can choose from. In some cases, it could return just one step.

Bridge tokens

curl -XPOST "https://api.brianknows.org/api/v0/agent/transaction" -d '{"prompt": "I want to bridge 10 USDC from Ethereum to Arbitrum", "address": "0x9319b31838bba444CCeAeD025153a48AD6377471"}' -H "Content-Type: application/json" -H "x-brian-api-key: API_KEY"
Response
{
  "result": [
    {
      "solver": "Enso",
      "action": "bridge",
      "type": "write",
      "data": {
        "description": "You are about to bridge 10 USDC for 9.58615 USDC ($10) from ethereum to arbitrum one using Enso solver. The address receiver is 0x9319...7471.",
        "steps": [
          {
            "chainId": 1,
            "blockNumber": 19804417,
            "from": "0x9319b31838bba444CCeAeD025153a48AD6377471",
            "to": "0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE",
            "gasLimit": "295149",
            "data": "0xe40f24600000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000006352f0000000000000000000000009319b31838bba444cceaed025153a48ad63774710000000000000000000000000000000000000000000000000000000000000006000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e583160c06432109116863d647634596eef7c36c4ed2f9867d92990fced705ed4a370000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000017adb18f35a75c6785cfe58e10c08266f3fc69e92fca5da99b4adbaff2c2ae857000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000009319b31838bba444cceaed025153a48ad63774710000000000000000000000000000000000000000000000000000000000989680000000000000000000000000000000000000000000000000000000000000a4b1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009616c6c627269646765000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000086c6966692d617069000000000000000000000000000000000000000000000000",
            "value": "0",
            "protocol": {
              "key": "enso",
              "name": "enso",
              "logoURI": ""
            }
          }
        ],
        "gasCostUSD": "",
        "fromChainId": 1,
        "fromAmountUSD": 10,
        "fromAmount": "10000000",
        "fromToken": {
          "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
          "chainId": 1,
          "symbol": "USDC",
          "decimals": 6,
          "name": "USD Coin",
          "coinKey": "USDC",
          "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
          "priceUSD": "1"
        },
        "fromAddress": "0x9319b31838bba444CCeAeD025153a48AD6377471",
        "toChainId": 42161,
        "toAmountUSD": 9.58615,
        "toAmount": "9586157",
        "toAmountMin": "9586157",
        "toToken": {
          "address": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
          "chainId": 42161,
          "symbol": "USDC",
          "decimals": 6,
          "name": "USD Coin",
          "coinKey": "USDC",
          "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
          "priceUSD": "1"
        },
        "toAddress": "0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE"
      }
    }
  ]
}

The steps array can contain a list of possible swap routes that the user can choose from. In some cases, it could return just one step.

Approve tokens

curl -XPOST "https://api.brianknows.org/api/v0/agent/transaction" -d '{"prompt": "I want to approve 10 USDC spending for 0xA9bC8A58B39935BA3D8D1Ce4b0d3383153F184E1 on Polygon", "address": "0xA9bC8A58B39935BA3D8D1Ce4b0d3383153F184E1"}' -H "Content-Type: application/json" -H "x-brian-api-key: API_KEY"    
Response
{
  "result": [
    {
      "solver": "Brian",
      "action": "approve",
      "type": "write",
      "data": {
        "description": "You are about to approve 10 USDC for 0x9319b31838bba444CCeAeD025153a48AD6377471 to spend on polygon.",
        "steps": [
          {
            "chainId": 137,
            "blockNumber": 56608887,
            "from": "0x9319b31838bba444CCeAeD025153a48AD6377471",
            "to": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
            "value": "0",
            "data": "0x095ea7b3000000000000000000000000a9bc8a58b39935ba3d8d1ce4b0d3383153f184e10000000000000000000000000000000000000000000000000000000000989680",
            "gasLimit": "100000"
          }
        ],
        "fromChainId": 137,
        "fromAmount": "0",
        "fromToken": {
          "address": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
          "chainId": 137,
          "symbol": "USDC",
          "decimals": 6,
          "name": "USD Coin",
          "coinKey": "USDC",
          "logoURI": "https://static.debank.com/image/coin/logo_url/usdc/e87790bfe0b3f2ea855dc29069b38818.png",
          "priceUSD": "0.9995979052074536"
        },
        "fromAddress": "0x9319b31838bba444CCeAeD025153a48AD6377471",
        "toChainId": 137,
        "toAmount": "0",
        "toAmountMin": "0",
        "toToken": {
          "address": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
          "chainId": 137,
          "symbol": "USDC",
          "decimals": 6,
          "name": "USD Coin",
          "coinKey": "USDC",
          "logoURI": "https://static.debank.com/image/coin/logo_url/usdc/e87790bfe0b3f2ea855dc29069b38818.png",
          "priceUSD": "0.9995979052074536"
        },
        "toAddress": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"
      }
    }
  ]
}

Register an ENS domain

curl -XPOST "https://api.brianknows.org/api/v0/agent/transaction" -d '{"prompt": "Register limonee.eth for 2 years and set is as my primary domain name", "address": "0xA9bC8A58B39935BA3D8D1Ce4b0d3383153F184E1"}' -H "Content-Type: application/json" -H "x-brian-api-key: API_KEY"    
Response
{
  "result": [
    {
      "solver": "Brian",
      "action": "ENS Registration",
      "type": "write",
      "data": {
        "description": "You are about to register the ENS domain \"limonee.eth\" for 24 months. The ENS registration cost is 0.0032 ETH ($10.05). The operation is a two steps process. The first transaction will commit the registration and the second one will register the domain. Wait at least 1 minute for executing the second transaction.",
        "steps": [
          {
            "chainId": 1,
            "blockNumber": 19804441,
            "from": "0x9319b31838bba444CCeAeD025153a48AD6377471",
            "to": "0x253553366Da8546fC250F225fe3d25d0C782303b",
            "value": 0,
            "data": "0xf14fcbc871372c0a977c08357c569739b507372d9b0ef34f17875b656a9d264a92bbcd6e",
            "gasLimit": "200000"
          },
          {
            "chainId": 1,
            "blockNumber": 19804441,
            "from": "0x9319b31838bba444CCeAeD025153a48AD6377471",
            "to": "0x253553366Da8546fC250F225fe3d25d0C782303b",
            "value": "3513568763738783",
            "data": "0x74694a2b00000000000000000000000000000000000000000000000000000000000001000000000000000000000000009319b31838bba444cceaed025153a48ad63774710000000000000000000000000000000000000000000000000000000003c2670051ba771fcc67b8022466825620b13e9a73b2235a008be4773b4239dc9fe546290000000000000000000000004976fb03c32e5b8cfe2b6ccb31c09ba78ebaba4100000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000076c696d6f6e6565000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
          }
        ],
        "fromChainId": 1,
        "fromAmount": 0,
        "fromToken": {
          "address": "0x0000000000000000000000000000000000000000",
          "chainId": 1,
          "symbol": "ETH",
          "decimals": 18,
          "name": "ETH",
          "coinKey": "ETH",
          "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
          "priceUSD": "3147.37"
        },
        "fromAddress": "0x9319b31838bba444CCeAeD025153a48AD6377471",
        "toChainId": 1,
        "toAmount": 0,
        "toAmountMin": 0,
        "toToken": {
          "address": "0x0000000000000000000000000000000000000000",
          "chainId": 1,
          "symbol": "ETH",
          "decimals": 18,
          "name": "ETH",
          "coinKey": "ETH",
          "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
          "priceUSD": "3147.37"
        },
        "toAddress": "0x253553366Da8546fC250F225fe3d25d0C782303b"
      }
    }
  ]
}

Deposit on DeFi protocol

curl -XPOST "https://api.brianknows.org/api/v0/agent/transaction" -d '{"prompt": "deposit 100 usdc to aave protocol on Ethereum", "address": "0xA9bC8A58B39935BA3D8D1Ce4b0d3383153F184E1"}' -H "Content-Type: application/json" -H "x-brian-api-key: API_KEY"
Response
{
  "result": [
    {
      "solver": "Enso",
      "action": "deposit",
      "type": "write",
      "data": {
        "description": "You are about to deposit 100 USDC ($100) into aave-v3 protocol, obtaining 99.9 AETHUSDC on Ethereum. The address receiver is: 0x9319...7471.",
        "steps": [
          {
            "chainId": 1,
            "blockNumber": 19804449,
            "from": "0x9319b31838bba444CCeAeD025153a48AD6377471",
            "to": "0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E",
            "gasLimit": "350440",
            "data": "0xb35d7e73000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000005f5e100000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000009a9059cbb010001ffffffffffa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48095ea7b3010203ffffffffffa0b86991c6218b36c1d19d4a2e9eb0ce3606eb4870a082310104ffffffffff0298c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5ce8eda9df0105030406ffffff87870bca3f3fd6335c3f4ce8392d69350b4fa4e270a082310104ffffffffff0498c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5cb67d77c5010402ffffffff04ca99eaa38e8f37a168214a3a57c9a45a58563ed5a9059cbb010704ffffffffff98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c6e7a43a3010408ffffffff047e7d64d987cab6eed08a191c4c2459daf2f8ed0b241c59120104ffffffffffff7e7d64d987cab6eed08a191c4c2459daf2f8ed0b00000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000129b480ad625bcd1a5c3a1c10d708114726fa467000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000087870bca3f3fd6335c3f4ce8392d69350b4fa4e200000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000005f45a6000000000000000000000000000000000000000000000000000000000000000200000000000000000000000007d585b0e27bbb3d981b7757115ec11f47c4769940000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000009319b31838bba444cceaed025153a48ad637747100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000005c69f58",
            "value": "0",
            "protocol": {
              "key": "aave-v3",
              "name": "aave-v3",
              "logoURI": ""
            }
          }
        ],
        "gasCostUSD": "",
        "fromChainId": 1,
        "fromAmountUSD": 100,
        "fromAmount": "100000000",
        "fromToken": {
          "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
          "chainId": 1,
          "symbol": "USDC",
          "decimals": 6,
          "name": "USD Coin",
          "coinKey": "USDC",
          "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
          "priceUSD": "1"
        },
        "fromAddress": "0x9319b31838bba444CCeAeD025153a48AD6377471",
        "toChainId": 1,
        "toAmountUSD": 99.9,
        "toAmount": "100000000",
        "toAmountMin": "100000000",
        "toToken": {
          "address": "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c",
          "chainId": 1,
          "symbol": "aEthUSDC",
          "decimals": 6,
          "name": "Aave Ethereum USDC",
          "coinKey": "aEthUSDC",
          "logoURI": "https://static.debank.com/image/eth_token/logo_url/0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c/d1e0d14800c1e4657fb8c25e0f073cf0.png",
          "priceUSD": "1"
        },
        "toAddress": "0x80EbA3855878739F4710233A8a19d89Bdd2ffB8E"
      }
    }
  ]
}

Ask a question to Brian.

POST https://api.brianknows.org/api/v0/agent/knowledge

Allows you to send a prompt to Brian and receive a response related to that prompt. You'll also get any relevant documents used to generated such response.

Headers

Request Body

Response
{
  "result": {
    "text": "string",
    "sourceDocuments": [
      {
        "pageContent": "string",
        "metadata": {
          "description": "string",
          "language": "string",
          "source": "string",
          "title": "string"
        }
      },
      ...
    ]
  }
}

Requesting information

curl -XPOST "https://api.brianknows.org/api/v0/agent/knowledge" -H "Content-Type: application/json" -H "x-brian-api-key: API_KEY" -d '{"prompt": "What is Uniswap?"}'
Response
{
  "result": {
    "text": "Uniswap is a decentralized protocol and an automated liquidity protocol that operates on the Ethereum blockchain. It allows users to trade various ERC-20 tokens directly from their Ethereum wallets without the need for intermediaries. Uniswap works on the principle of constant product market maker mechanism, where liquidity providers pool their tokens into smart contracts, which are then used to facilitate trades on the platform.\n\nThe protocol has two main functions: swaps and liquidity provision. Swaps enable users to trade tokens directly with each other by selecting the token they want to send and the token they want to receive. The protocol automatically calculates the exchange rate based on the liquidity available in the respective token pools. The fees earned from each trade are distributed to the liquidity providers in proportion to their contribution.\n\nLiquidity provision is another key feature of Uniswap. Users can become liquidity providers by depositing an equal value of two tokens into a liquidity pool. By doing so, they receive pool tokens representing their share of the liquidity pool. These pool tokens can be later redeemed for the underlying tokens along with a portion of the fees generated by the pool.\n\nUniswap has gained significant popularity in the decentralized finance (DeFi) space due to its user-friendly interface, open and permissionless nature, and its role in enabling efficient and decentralized token swaps. The protocol has also inspired the development of various other decentralized exchanges (DEXs) that implement similar automated market-making mechanisms.",
    "sourceDocuments": [
      {
        "pageContent": "Overview | Uniswap",
        "metadata": {
          "description": "Code",
          "language": "en",
          "source": "https://docs.uniswap.org/concepts/governance/overview",
          "title": "Overview | Uniswap"
        }
      },
      {
        "pageContent": "The Uniswap Protocol | Uniswap",
        "metadata": {
          "description": "Introduction",
          "language": "en",
          "source": "https://docs.uniswap.org/concepts/uniswap-protocol",
          "title": "The Uniswap Protocol | Uniswap"
        }
      },
      {
        "pageContent": "Swaps | Uniswap",
        "metadata": {
          "description": "Introduction",
          "language": "en",
          "source": "https://docs.uniswap.org/concepts/protocol/swaps",
          "title": "Swaps | Uniswap"
        }
      },
      {
        "pageContent": "Glossary | Uniswap",
        "metadata": {
          "description": "- UNI: An ERC-20 token that designates the weight of a user's voting rights. The more UNI a user has in their wallet, the more weight their delegation or vote on a proposal holds.",
          "language": "en",
          "source": "https://docs.uniswap.org/concepts/governance/glossary",
          "title": "Glossary | Uniswap"
        }
      }
    ]
  }
}

Generate solidity code from a prompt.

POST https://api.brianknows.org/api/v0/agent/smart-contracts

Allows you to send a prompt to Brian and generate a Solidity Smart Contract. The code is encapsulated in a markdown code tag.

Headers

Request Body

Response
{
  "result": "```solidity\nCODE_HERE```"
}

Extract parameters from a prompt.

POST https://api.brianknows.org/api/v0/agent/parameters-extraction

Allows you to send a prompt to Brian and return all the extracted parameters from the prompt.

Headers

Request Body

Response
{
  "result": {
    "prompt": "user prompt",
    "completion": [
      {
        "action": "action name",
        "token1": "string",
        "chain": "string",
        "amount": "string".
        ... // other parameters
      }
    ]
  }
}

Last updated