0.14.13 • Published 2 years ago

@dash-incubator/dapp-sdk v0.14.13

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Dash dApp SDK

Wrapper for dashevo's dash npm package.

DApp projects require the same functions to interact with dash platform contracts, documents, and identities. Instead of sharing function between each project I bundled everything into a set of general utilities that can be used across any Dash DApp.

Usage

MetaMask restricts access to eth wallets to prevent DApps from hijacking the contents of the wallet in use. dapp-sdk provides similar functionality. Once the connection to the Dash network is made all interaction with the connected client is managed through the dapp-sdk package. Without direct access to the Dash client DApps can't request mnemonic or other sensitive information without the users permission.

As of 8/27/2021 this package does not include an extension. An extension or PWA installed on a web enabled device ( likely phone ) will provide the additional software required to bring full MetaMask like functionality to the Dash ecosystem.

Current usage of this package requires initialization of the Dash Client. This would not be required once the extension/PWA is complete.

import { config, user } from '@dash-incubator/dapp-sdk';

const init = async () => {
    config.useLocalStorage();

    // This step can be skipped in dapps once a metamask like
    // service is running for Dash.
    await user.init();

    let wallet = await user.wallet.read();

    // Can be skipped if the DApp doesn't need to register apps, etc.
    if (wallet.balance.confirmed > 0) {
        // Register required apps, etc.
    }
    else {
        setTimeout(init, (1000 * 45));
    }
};

Once wallet is initialized all Dash client interaction is done through the user variable.

user.contract.register(contractDefinitions)

Accepts Dash platform contract schema, returns Dash platform registration output

user.document.delete(documents)

Accepts a list of documents to delete

user.document.read(locator, query)

locator accepts a Dash platform record locator query accepts a Dash platform query object

user.document.save(documents, locator)

documents accepts a list of documents. If document data includes an id field it will attempt to update the document data, otherwise a new document will be created with the supplied data. locator accepts a Dash platform record locator

user.identity.get()

Returns the first identity found for the wallet, otherwise creates a new identity.

user.name.read(name)

Lookup Dash platform name

user.name.register(name)

Registers new Dash platform name

0.14.13

2 years ago

0.14.12

2 years ago

0.14.11

2 years ago

0.14.10

2 years ago

0.14.6

2 years ago

0.14.7

2 years ago

0.14.8

2 years ago

0.14.9

2 years ago

0.14.5

2 years ago

0.14.3

2 years ago

0.14.4

2 years ago

0.9.4

2 years ago

0.9.3

2 years ago

0.9.5

2 years ago

0.11.0

2 years ago

0.10.1

2 years ago

0.12.0

2 years ago

0.11.1

2 years ago

0.10.2

2 years ago

0.13.0

2 years ago

0.11.2

2 years ago

0.14.0

2 years ago

0.14.1

2 years ago

0.14.2

2 years ago

0.10.0

2 years ago

0.1.0

2 years ago

0.3.0

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.9.0

2 years ago

0.8.1

2 years ago

0.5.4

2 years ago

0.8.0

2 years ago

0.9.2

2 years ago

0.5.6

2 years ago

0.9.1

2 years ago

0.5.5

2 years ago

0.5.0

2 years ago

0.3.2

2 years ago

0.1.4

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.1.3

2 years ago

0.7.0

2 years ago

0.5.2

2 years ago

0.6.0

2 years ago

0.5.1

2 years ago

0.3.3

2 years ago

0.0.4

2 years ago