Preview Release See the table of contents

TypeScript, JavaScript & HTTP

Most of the examples in our API documentation actually use our TypeScript SDK. We know that lots of app developers build with JavaScript (and TypeScript!), so we shipped a friendly SDK for those languages on day one.

Of course, under the hood, BeQue is an HTTP API. Everything you can do with our TypeScript SDK, you can do from other programming languages by making direct HTTP requests. The good news is that it’s an easy translation.

For instance, take this query that gets the total amount sent from account1 to account2 in the last week:

import { Account, Transaction } from "@beque/base";

const account1 = new Account(ADDRESS_1);
const account2 = new Account(ADDRESS_2);
const total = await Transaction.query()
  .where("date", ">=", ONE_WEEK_AGO)
  .where("from", account1)
  .where("to", account2);

We can translate this directly to an HTTP request. We’ll POST a JSON blob to https://api.beque.xyz/base/transaction/:

{
  "filters": [
    {
      "col": "date",
      "op": ">=",
      "rhs": "2021-12-13T00:09:19.832Z"
    },
    {
      "col": "from",
      "rhs": "0x..."
    },
    {
      "col": "to",
      "rhs": "0x..."
    }
  ]
}

More documentation on direct use of our HTTP API is forthcoming. If you have any questions, or if you’d like to see an SDK for your favorite language, please send us an email and let us know.