GithubHelp home page GithubHelp logo

terrorizer1980 / neo-unified-dapi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from neo-ngd/neo-unified-dapi

0.0 0.0 0.0 10 KB

A unified dapi interface for neo dapi wallets

TypeScript 91.95% HTML 2.56% JavaScript 5.49%

neo-unified-dapi's Introduction

NEO Unified dApi (NUDApi)

Although neo now have a dApp Platform Provider Interface standard, A dApp that uses one dApi wallet cannot invoke another dApi wallet, which is not so convinient for dApp developers.

Purpose

Neo Unified dApi(NUDApi) is to enable dApp to use one unified interface to invoke all wallets that aggrees to the dApi standard.

  • PERFECT: As long as it's a dApi standard wallet, it can be invoked by NUDApi.
    • This is difficult because if all web plugin wallets injects into web same object, they will contradict with each other.
  • CONFIGURE: A dApi wallet need to add its configuration in this project to be involved.
    • This is what we should try to accomplish, currently O3, NEOLine and Teemo top level interfaces are not similar.
  • CODE-SPECIFIED: If top level interfaces are not similar, we need to specify the difference in code.

Suggestions Welcomed

Refer to MorganDream#1

How to Use

Prepare

NUDApi is just like a router for dApp to invoke different neo dapi wallet providers. If dApp developer plans to include O3, you need to prepare as instructed on https://neodapidocs.o3.network/#installation. For web plugin wallets NEOLine and Teemo, developer don't have to specify anything.

Installation

We have not released this, cdn and npm installations would be enabled after release.

Get available wallet APIs and select api

const apis = neoUnifiedDapi.getAvailableWalletAPIs();
console.log(apis);

// Choose API, developer could add some UI interface for users to choose
const useApi = neoUnifiedDapi.useAPI(apis[0]);

Invoke dApi

The invocation of dApi is just like what's in neo-project/proposals#69. Just pay attention: you have to choose api before you execute any invocations.

neoUnifiedDapi.getAccount().then(accountInfo => {
    console.log(accountInfo)
})

Event Listener

neoUnifiedDapi.addEventListener(neoUnifiedDapi.Events.READY, () => {
    neoUnifiedDapi.getAccount().then(accountInfo => {
        console.log(accountInfo)
    });
})

neo-unified-dapi's People

Contributors

morgandream avatar

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.