@ocap/statedb

Defines the basic interface for OCAP StateDB

Usage no npm install needed!

<script type="module">
  import ocapStatedb from 'https://cdn.skypack.dev/@ocap/statedb';
</script>

README

OCAP StateDB

Defines the abstract interface of OCAP StateDB, must be implemented with an actual statedb, please checkout following packages:

  • @ocap/statedb-memory
  • @ocap/statedb-fs
  • @ocap/statedb-qldb

Usage

yarn add @ocap/statedb-memory

Then:

const MemoryStateDB = require('@ocap/statedb-memory');

const statedb = new MemoryStateDB();

statedb.account.create(address, attrs, context);
statedb.account.get(address);
statedb.account.update(address, updates, context);

statedb.asset.create(address, attrs, context);
statedb.asset.get(address);
statedb.asset.update(address, updates, context);

statedb.delegation.create(address, attrs, context);
statedb.delegation.get(address);
statedb.delegation.update(address, updates, context);

statedb.tx.create(hash, attrs, context);
statedb.tx.get(hash);
statedb.tx.find(conditions);