Giter Site home page Giter Site logo

tesseract.js's Introduction

Tesseract dApps Platform SDK for JavaScript

GitHub license Build Status GitHub release npm version

Getting started

To use this library compatible wallet should be installed on the mobile device.

We released our own Tesseract Wallet as reference wallet implementation. Install it on your device to check provided examples.

Installation

npm install --save @tesseractjs/ethereum-web3 web3

This command will install latest Tesseract Ethereum Web3 library and Web3.js

Hello Tesseract, hello Web3.

Let's try to get Ethereum account balance.

import { Tesseract } from '@tesseractjs/ethereum-web3';

// Our HTTP RPC URL. Can be Infura
const rpcUrl = 'https://mainnet.infura.io/v3/{API-KEY}';

// Creating Web3 instance. Try to reuse existing instance of Web3 in your app.
const web3 = await Tesseract.Ethereum.Web3(rpcUrl);

// We can use read-only methods if Tesseract can't connect to the Wallet.
if (!web3.hasWallet) {
    console.log("Web3 doesn't have wallet. Can work in read-only mode");
    return;
}

// Obtaining account from the Wallet
const accounts = await web3.eth.getAccounts();

// Obtaining balance from the network
const balance = await web3.eth.getBalance(accounts[0]);

// Printing
console.log("Account:", accounts[0], "has balance:", balance);

More Examples

For more examples and Web3 documentation check Web3.js library used inside.

Ideology behind

Tesseract dApps Platform emerged from one simple vision - dApps should not store Private Keys inside.

With this vision we created Mobile-first platform. It allows app developers to write Native dApps and leave all key storage security tasks to Wallet developers.

We started with open protocol, which describes Wallet <-> dApp communication. It's called Open Wallet.

This SDK can interact with any Wallet which implemented this protocol. Ask your preferred Wallet to implement it :)

Author

License

Tesseract.js is available under the Apache 2.0 license. See the LICENSE file for more information.

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.