Kwil v2

Get Schemas and Accounts

Methods to view databases owned by an address and the schemas within each database.

List Databases

You can view the databases owned by an address by using the listDatabases method. This returns an array of the databases under the provided address.
const res = await kwil.listDatabases("0xOwner_address")
// = ["db1", "db2", "db3"]

Get Schema

You can get a database's schema by using the getSchema method on the Kwil object and passing in the DBID. This returns a JSON representation of the database schema.
const res = await kwil.getSchema("DBID")
/* = {
owner: "0xowner_address",
name: "database_name",
tables: [ tableObject1, tableObject2, tableObject3 ],
actions: [ action1, action2, action3 ]

Get Account

You can also see an account's balance and nonce by calling the getAccount method.
const res = await kwil.getAccount("0xOwner_address")
/* = {
address: "0xOwner_address",
balance: "token_balance",
nonce: "nonce_count"