JSPM

@dashevo/dapi-client

2.2.0-dev.2
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 724
    • Score
      100M100P100Q104485F
    • License MIT

    Client library used to access Dash DAPI endpoints

    Package Exports

    • @dashevo/dapi-client
    • @dashevo/dapi-client/lib/BlockHeadersProvider/BlockHeadersProvider
    • @dashevo/dapi-client/lib/BlockHeadersProvider/BlockHeadersProvider.js
    • @dashevo/dapi-client/lib/index.js
    • @dashevo/dapi-client/lib/methods/core/getTransaction/GetTransactionResponse
    • @dashevo/dapi-client/lib/methods/core/getTransaction/GetTransactionResponse.js
    • @dashevo/dapi-client/lib/methods/platform/getDataContract/GetDataContractResponse
    • @dashevo/dapi-client/lib/methods/platform/getDataContract/GetDataContractResponse.js
    • @dashevo/dapi-client/lib/methods/platform/getDataContractHistory/GetDataContractHistoryResponse
    • @dashevo/dapi-client/lib/methods/platform/getDataContractHistory/GetDataContractHistoryResponse.js
    • @dashevo/dapi-client/lib/methods/platform/getDocuments/GetDocumentsResponse
    • @dashevo/dapi-client/lib/methods/platform/getDocuments/GetDocumentsResponse.js
    • @dashevo/dapi-client/lib/methods/platform/getIdentity/GetIdentityResponse
    • @dashevo/dapi-client/lib/methods/platform/getIdentity/GetIdentityResponse.js
    • @dashevo/dapi-client/lib/methods/platform/response/Metadata
    • @dashevo/dapi-client/lib/methods/platform/response/Metadata.js
    • @dashevo/dapi-client/lib/transport/GrpcTransport/createGrpcTransportError
    • @dashevo/dapi-client/lib/transport/GrpcTransport/createGrpcTransportError.js
    • @dashevo/dapi-client/lib/transport/GrpcTransport/errors/NotFoundError
    • @dashevo/dapi-client/lib/transport/GrpcTransport/errors/NotFoundError.js
    • @dashevo/dapi-client/lib/transport/ReconnectableStream
    • @dashevo/dapi-client/lib/transport/ReconnectableStream.js
    • @dashevo/dapi-client/lib/transport/errors/response/InvalidRequestDPPError
    • @dashevo/dapi-client/lib/transport/errors/response/InvalidRequestDPPError.js
    • @dashevo/dapi-client/lib/transport/errors/response/ResponseError
    • @dashevo/dapi-client/lib/transport/errors/response/ResponseError.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@dashevo/dapi-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    DAPI Client

    NPM Version Build Status Release Date standard-readme compliant

    Client library used to access Dash DAPI endpoints

    This library enables HTTP-based interaction with the Dash blockchain and Dash Platform via the decentralized API (DAPI) hosted on Dash masternodes.

    • DAPI-Client provides automatic server (masternode) discovery using either a default seed node or a user-supplied one
    • DAPI-Client maps to DAPI's RPC and gRPC endpoints

    Table of Contents

    Install

    npm install @dashevo/dapi-client

    Usage

    Basic

    const DAPIClient = require('@dashevo/dapi-client');
    const client = new DAPIClient();
    
    client.core.getStatus().then((coreStatus) => {
      console.dir(coreStatus);
    });

    Custom seed node

    Custom seed nodes are necessary for connecting the client to devnets since the client library is unaware of them otherwise.

    const DAPIClient = require('@dashevo/dapi-client');
    
    var client = new DAPIClient({
      seeds: [{
         host: 'seed-1.evonet.networks.dash.org',
         port: 443,
      }],
    });
    
    client.core.getBestBlockHash().then((r) => {
      console.log(r);
    });

    Note: The seed node shown above (seed-1.evonet.networks.dash.org) is for the Dash Evonet testing network.

    Custom addresses

    Custom addresses may be directly specified in cases where it is beneficial to know exactly what node(s) are being accessed (e.g. debugging, local development, etc.).

    const DAPIClient = require('@dashevo/dapi-client');
    
    var client = new DAPIClient({
      dapiAddresses: [
        '127.0.0.1:443',
        '127.0.0.2:443',
      ],
    });
    
    client.core.getBestBlockHash().then((r) => {
      console.log(r);
    });

    Command specific options

    DAPI Client options can be passed directly to any command to override any predefined client options and modify the client's behavior for that specific call.

    const DAPIClient = require('@dashevo/dapi-client');
    
    // Set options to direct the request to a specific address and disable retries
    const options = {
      dapiAddresses: ['127.0.0.1'],
      retries: 0,
    };
    
    client.core.getBestBlockHash(options).then((r) => {
      console.log(r);
    });

    Documentation

    More extensive documentation available at https://dashpay.github.io/platform/DAPI-Client/.

    Contributing

    Feel free to dive in! Open an issue or submit PRs.

    License

    MIT © Dash Core Group, Inc.