Skip to content

Latest commit

 

History

History
649 lines (510 loc) · 10.9 KB

api.md

File metadata and controls

649 lines (510 loc) · 10.9 KB

GET /api

Returns information of the operate daemon

Response
{
  "name": "Operate HTTP server",
  "version": "0.1.0.rc0",
  "account": {
    "key": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb9226a"
  },
  "home": "/Users/virajpatel/valory/olas-operate-app/.operate"
}

GET /api/account

Returns account status

Before setup
{
  "is_setup": false
}
After setup
{
  "is_setup": true
}

POST /api/account

Create a local user account

Request
{
  "password": "Hello,World!",
}
Response
{
  "error": null
}

If account already exists

Response
{
  "error": "Account already exists"
}

PUT /api/account

Update password

Request
{
  "old_password": "Hello,World!",
  "new_password": "Hello,World",
}
Response
{
  "error": null
}

Old password is not valid

Response
{
  "error": "Old password is not valid",
  "traceback": "..."
}

POST /api/account/login

Login and create a session

Request
{
  "password": "Hello,World",
}
Response
{
  "message": "Login successful"
}

GET /api/wallet

Returns a list of available wallets

Response
[
  {
    "address": "0xFafd5cb31a611C5e5aa65ea8c6226EB4328175E7",
    "safe_chains": [
      2
    ],
    "ledger_type": 0,
    "safe": "0xd56fb274ce2C66008D5c4C09980c4f36Ab81ff23",
    "safe_nonce": 110558881674480320952254000342160989674913430251257716940579305238321962891821
  }
]

POST /api/wallet

Creates a master key for given chain type.

Request
{
  "chain_type": ChainType,
}
Response
{
  "wallet": {
    "address": "0xAafd5cb31a611C5e5aa65ea8c6226EB4328175E1",
    "safe_chains": [],
    "ledger_type": 0,
    "safe": null,
    "safe_nonce": null
  },
  "mnemonic": [...]
}

PUT /api/wallet

Creates a gnosis safe for given chain type.

Request
{
  "chain_type": ChainType,
}
Response
{
  "address": "0xaaFd5cb31A611C5e5aa65ea8c6226EB4328175E3",
  "safe_chains": [
    2
  ],
  "ledger_type": 0,
  "safe": "0xe56fb574ce2C66008d5c4C09980c4f36Ab81ff22",
  "safe_nonce": 110558881674480320952254000342160989674913430251157716140571305138121962898821
}

GET /api/services

Returns the list of services

Response
[
  {
    "hash": "bafybeiha6dxygx2ntgjxhs6zzymgqk3s5biy3ozeqw6zuhr6yxgjlebfmq",
    "keys": [
      {
        "ledger": 0,
        "address": "0x6Db941e0e82feA3c02Ba83B20e3fB5Ea6ee539cf",
        "private_key": "0x34f58dcc11acec007644e49921fd81b9c8a959f651d6d66a42242a1b2dbaf4be"
      }
    ],
    "ledger_config": {
      "rpc": "http://localhost:8545",
      "type": 0,
      "chain": 2
    },
    "chain_data": {
      "instances": [
        "0x6Db941e0e82feA3c02Ba83B20e3fB5Ea6ee539cf"
      ],
      "token": 380,
      "multisig": "0x7F3e460Cf596E783ca490791643C0055Fa2034AC",
      "staked": false,
      "on_chain_state": 6,
      "user_params": {
        "nft": "bafybeig64atqaladigoc3ds4arltdu63wkdrk3gesjfvnfdmz35amv7faq",
        "agent_id": 14,
        "threshold": 1,
        "use_staking": false,
        "cost_of_bond": 10000000000000000,
        "olas_cost_of_bond": 10000000000000000000,
        "olas_required_to_stake": 10000000000000000000,
        "fund_requirements": {
          "agent": 0.1,
          "safe": 0.5
        }
      }
    },
    "path": "/Users/virajpatel/valory/olas-operate-app/.operate/services/bafybeiha6dxygx2ntgjxhs6zzymgqk3s5biy3ozeqw6zuhr6yxgjlebfmq",
    "service_path": "/Users/virajpatel/valory/olas-operate-app/.operate/services/bafybeiha6dxygx2ntgjxhs6zzymgqk3s5biy3ozeqw6zuhr6yxgjlebfmq/trader_omen_gnosis",
    "name": "valory/trader_omen_gnosis"
  }
]

POST /api/services

Create a service using the service template

Request
{
  "name": "Trader Agent",
  "description": "Trader agent for omen prediction markets",
  "hash": "bafybeiha6dxygx2ntgjxhs6zzymgqk3s5biy3ozeqw6zuhr6yxgjlebfmq",
  "image": "https://operate.olas.network/_next/image?url=%2Fimages%2Fprediction-agent.png&w=3840&q=75",
  "configuration": {
    "nft": "bafybeig64atqaladigoc3ds4arltdu63wkdrk3gesjfvnfdmz35amv7faq",
    "rpc": "http://localhost:8545",
    "agent_id": 14,
    "threshold": 1,
    "use_staking": false,
    "cost_of_bond": 10000000000000000,
    "olas_cost_of_bond": 10000000000000000000,
    "olas_required_to_stake": 10000000000000000000,
    "fund_requirements": {
      "agent": 0.1,
      "safe": 0.5
    }
  }
}

Optionally you can add deploy parameter and set it to true for a full deployment in a single request.

Response
{
  "hash": "bafybeiha6dxygx2ntgjxhs6zzymgqk3s5biy3ozeqw6zuhr6yxgjlebfmq",
  "keys": [
    {
      "ledger": 0,
      "address": "0x10EB940024913dfCAE95D21E04Ba662cdfB79fF0",
      "private_key": "0x00000000000000000000000000000000000000000000000000000000000000000"
    }
  ],
  "ledger_config": {
    "rpc": "http: //localhost:8545",
    "type": 0,
    "chain": 2
  },
  "chain_data": {
    "instances": [
      "0x10EB940024913dfCAE95D21E04Ba662cdfB79fF0"
    ],
    "token": 382,
    "multisig": "0xf21d8A424e83BBa2588306D1C574FE695AD410b5",
    "staked": false,
    "on_chain_state": 4,
    "user_params": {
      "nft": "bafybeig64atqaladigoc3ds4arltdu63wkdrk3gesjfvnfdmz35amv7faq",
      "agent_id": 14,
      "threshold": 1,
      "use_staking": false,
      "cost_of_bond": 10000000000000000,
      "olas_cost_of_bond": 10000000000000000000,
      "olas_required_to_stake": 10000000000000000000,
      "fund_requirements": {
        "agent": 0.1,
        "safe": 0.5
      }
    }
  },
  "path": "~/.operate/services/bafybeiha6dxygx2ntgjxhs6zzymgqk3s5biy3ozeqw6zuhr6yxgjlebfmq",
  "service_path": "~/.operate/services/bafybeiha6dxygx2ntgjxhs6zzymgqk3s5biy3ozeqw6zuhr6yxgjlebfmq/trader_omen_gnosis",
  "name": "valory/trader_omen_gnosis"
}

PUT /api/services

Update a service

Request
{
    "old_service_hash": "bafybeiha6dxygx2ntgjxhs6zzymgqk3s5biy3ozeqw6zuhr6yxgjlebfmq",
    "new_service_hash": "bafybeicxdpkuk5z5zfbkso7v5pywf4v7chxvluyht7dtgalg6dnhl7ejoe",
}

Optionally you can add deploy parameter and set it to true for a full deployment in a single request.

Response
{
  "hash": "bafybeicxdpkuk5z5zfbkso7v5pywf4v7chxvluyht7dtgalg6dnhl7ejoe",
  "keys": [
    {
      "ledger": 0,
      "address": "0x10EB940024913dfCAE95D21E04Ba662cdfB79fF0",
      "private_key": "0x00000000000000000000000000000000000000000000000000000000000000000"
    }
  ],
  "ledger_config": {
    "rpc": "http: //localhost:8545",
    "type": 0,
    "chain": 2
  },
  "chain_data": {
    "instances": [
      "0x10EB940024913dfCAE95D21E04Ba662cdfB79fF0"
    ],
    "token": 382,
    "multisig": "0xf21d8A424e83BBa2588306D1C574FE695AD410b5",
    "staked": false,
    "on_chain_state": 4,
    "user_params": {
      "nft": "bafybeig64atqaladigoc3ds4arltdu63wkdrk3gesjfvnfdmz35amv7faq",
      "agent_id": 14,
      "threshold": 1,
      "use_staking": false,
      "cost_of_bond": 10000000000000000,
      "olas_cost_of_bond": 10000000000000000000,
      "olas_required_to_stake": 10000000000000000000,
      "fund_requirements": {
        "agent": 0.1,
        "safe": 0.5
      }
    }
  },
  "path": "~/.operate/services/bafybeicxdpkuk5z5zfbkso7v5pywf4v7chxvluyht7dtgalg6dnhl7ejoe",
  "service_path": "~/.operate/services/bafybeicxdpkuk5z5zfbkso7v5pywf4v7chxvluyht7dtgalg6dnhl7ejoe/trader_omen_gnosis",
  "name": "valory/trader_omen_gnosis"
}

GET /api/services/{service}

Response
{
  "hash": "{service}",
  "keys": [
    {
      "ledger": 0,
      "address": "0x10EB940024913dfCAE95D21E04Ba662cdfB79fF0",
      "private_key": "0x00000000000000000000000000000000000000000000000000000000000000000"
    }
  ],
  "ledger_config": {
    "rpc": "http: //localhost:8545",
    "type": 0,
    "chain": 2
  },
  "chain_data": {
    "instances": [
      "0x10EB940024913dfCAE95D21E04Ba662cdfB79fF0"
    ],
    "token": 382,
    "multisig": "0xf21d8A424e83BBa2588306D1C574FE695AD410b5",
    "staked": false,
    "on_chain_state": 4,
    "user_params": {
      "nft": "bafybeig64atqaladigoc3ds4arltdu63wkdrk3gesjfvnfdmz35amv7faq",
      "agent_id": 14,
      "threshold": 1,
      "use_staking": false,
      "cost_of_bond": 10000000000000000,
      "olas_cost_of_bond": 10000000000000000000,
      "olas_required_to_stake": 10000000000000000000,
      "fund_requirements": {
        "agent": 0.1,
        "safe": 0.5
      }
    }
  },
  "path": "~/.operate/services/{service}",
  "service_path": "~/.operate/services/{service}/trader_omen_gnosis",
  "name": "valory/trader_omen_gnosis"
}

POST /api/services/{service}/onchain/deploy

Deploy service on-chain

Request
Response

POST /api/services/{service}/onchain/stop

Stop service on-chain

Request
Response

GET /api/services/{service}/deployment

Response
{
  "status": 1,
  "nodes": {
    "agent": [
      "traderomengnosis_abci_0"
    ],
    "tendermint": [
      "traderomengnosis_tm_0"
    ]
  }
}

POST /api/services/{service}/deployment/build

Build service locally

Request
Response

POST /api/services/{service}/deployment/start

Start agent

Request
Response

POST /api/services/{service}/deployment/stop

Stop agent


POST /api/services/{service}/deployment/delete

Delete local deployment

Request
Response