GithubHelp home page GithubHelp logo

dbpunk-labs / db3.js Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 9.0 11.14 MB

DB3 Network Javascript API

Home Page: https://dbpunk-labs.github.io/db3.js/

License: Apache License 2.0

Makefile 0.17% TypeScript 99.79% Shell 0.05%
dapp document firebase html indexeddb javascript json npm typescript web3 web3js yarn

db3.js's People

Contributors

dependabot[bot] avatar imotai avatar jingchen2222 avatar jtsang4 avatar omahs avatar xiyangjun avatar xuman2019 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

db3.js's Issues

DB3 interface dependencies of stage 1

Implement IDBFactory and IDBRequest's onsuccess、onerror method

interface IDBFactoryOptions {
    sign(target: Uint8Array): Promise<[Uint8Array, Uint8Array]>;
    nonce(): number;
}
interface IDBFactory {
    /**
     * Compares two values as keys. Returns -1 if key1 precedes key2, 1 if key2 precedes key1, and 0 if the keys are equal.
     *
     * Throws a "DataError" DOMException if either input is not a valid key.
     */
    // cmp(first: any, second: any): number;
    databases(): Promise<IDBDatabaseInfo[]>;
    /** Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. */
    deleteDatabase(name: string): IDBOpenDBRequest;
    /** Attempts to open a connection to the named database with the current version, or 1 if it does not already exist. If the request is successful request's result will be the connection. */
    open(name: string, options: IDBFactoryOptions,  version?: number): IDBOpenDBRequest;
}

Test case
https://github.com/web-platform-tests/wpt/tree/master/IndexedDB
All idbfactory-*.html files in the repo

DB3 interface dependencies

  • create database
  • get database by name
  • get all database
  • delete database

WIP: Implement the db3js API of the IndexedDB specification

Motivations

  • Would you like to implement this feature? [y/n]

Interface implementation

  • IDBFactory Provides access to a database. 01.09
  • IDBOpenDBRequest Represents a request to open a database. 01.13
  • IDBDatabase Represents a connection to a database. It's the only way to get a transaction on the database. 01.16
  • IDBTransaction Represents a transaction. You create a transaction on a database, specify the scope, and determine the kind of access (read only or readwrite) that you want. 01.20
  • IDBRequest Generic interface that handles database requests and provides access to results. 01.31
  • IDBObjectStore Represents an object store that allows access to a set of data in an IndexedDB database, looked up via primary key. 02.06
  • IDBIndex Also allows access to a subset of data in an IndexedDB database, but uses an index to retrieve the record(s) rather than the primary key 02.08
  • IDBKeyRange Defines a key range that can be used to retrieve data from a database in a certain range. 02.13

Allow creating DB3 provider from a private key

Right now the only way to use DB3 server side is through a wallet that reads a mnemonic. Mnemonics give access to all of the user's accounts which is not very good for security. In ethers for example, to initiate a wallet you only need a private key.

So I suggest having it as an option for a provider. It could be used somehow like this:

const DB3 = DB3EOAWallet(process.env.PK)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.