Get Schemas and Accounts
Methods to view databases owned by an address and the schemas within each database.
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")
// res.data = ["db1", "db2", "db3"]
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")
/*
res.data = {
owner: "0xowner_address",
name: "database_name",
tables: [ tableObject1, tableObject2, tableObject3 ],
actions: [ action1, action2, action3 ]
}
*/
You can also see an account's balance and nonce by calling the getAccount method.
const res = await kwil.getAccount("0xOwner_address")
/*
res.data = {
address: "0xOwner_address",
balance: "token_balance",
nonce: "nonce_count"
}
*/
Last modified 20d ago