Kwil v2

Deploy New Database

With the Kwil JS SDK, you can deploy databases on Kwil using JSON from the Kwil Kuneiform IDE

New Database Setup

To deploy a new database, first use the Kwil Kuneiform IDE to define your database specifications. The Kwil Kuneiform language is easy to use - check out the syntax overview here.
Once you have defined your database, click the "export to JSON" button. The exported JSON will be used in the SDK to deploy the database.
Although you may deploy databases through the SDK, we strongly recommend managing the entire deployment process through the Kuneiform IDE.

Database Builder

Import the JSON object and use the kwil.dbBuilder() to begin building a database transaction. Chain the required methods to the database transaction to populate it with the required information.
import mydb from "./mydb.json";
const dbTx = await kwil
.signer(await provider.getSigner()) // can use any ethereum signer

Broadcast Transaction

To broadcast your transaction to the Kwil network, call kwil.broadcast() and pass the database transaction.
const res = await kwil.broadcast(dbTx)
/* = {
txHash: "0xsome_hash",
fee: "some_fee",
body: "data_here_if_action_returns_data"