@adshares/ads-connector

Connector to ADS browser wallet.

Usage no npm install needed!

<script type="module">
  import adsharesAdsConnector from 'https://cdn.skypack.dev/@adshares/ads-connector';
</script>

README

Adshares

ADS Wallet Connector

Report bug · Request feature · Wiki


ADS Wallet Connector is an browser JavaScript connector to ADS Browser Wallet.

Getting Started

Place the following script near the end of your pages, right before the closing </body> tag, to enable ADS connector.

<script src="https://connect.adshares.net/dist/connector.min.js"></script>

npm module

npm install @adshares/ads-connector

yarn add @adshares/ads-connector

Usage

Browser

AdsConnector.ready(function() {
    var adsWallet = new AdsWallet();
});

npm module

import AdsWallet from '@adshares/ads-connector'
const adsWallet = new AdsWallet();

All methods return Promises.

const adsWallet = new AdsWallet(); // pass true to enable testnet

// check if wallet is installed
adsWallet.getInfo().then(info => alert(info.version), error => alert('Not installed'))

// authenticate
adsWallet.authenticate('message').then(response => {})

// broadcast
adsWallet.broadcast('4164736861726573').then(response => {})

// transfer
adsWallet.sendOne('0001-00000001-8B4E', 1.23, '4164736861726573').then(response => {})

Responses

// --- info ---
{
    id: string,
    name: string,
    version: string,
    description: string,
    author: string
}
// --- authenticate ---
{
    status: string,         // "accepted" or "rejected",
    testnet: boolean,
    signature: string,      // signature of the message with prefix "message:"
    account: {
        address: string,    // account address, eg. '0001-00000001-8B4E'
        publicKey: string,  // account public key
        balance: string,    // current accoun balance in ADS (float as string)
        messageId: integer, // current account message id
        hash: string        // current account hash
    }
}
// --- transactions ---
{
    status: string,         // 'accepted' or 'rejected',
    testnet: boolean,
    transaction: {
        id: string,         // transaction id, eg. '0001:00002361:0001'
        type: string,       // transaction type ('broadcast', 'send_one'),
        fee: string         // transaction fee in ADS (float as string)
    }
}

Contributing

Please follow our Contributing Guidelines

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

More info