@adshares/ads-wallet

JavaScript ES2015 client for the ADS browser wallet.

Usage no npm install needed!

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

README

Adshares

ADS JS Wallet Client

Report bug · Request feature · Wiki


ADS JS Wallet Client is an JavaScript ES2015 client for the ADS Browser Wallet.

If you want to integrate your website with ADS Wallet, use ADS Wallet Connector.

Install

npm install @adshares/ads-wallet

or

yarn add @adshares/ads-wallet

Usage

All methods return Promises.

import AdsWallet from '@adshares/ads-wallet';

// pass true to enable testnet
const adsWallet = new AdsWallet('CHROME_EXTENSION_ID', 'MOZILLA_EXTENSION_ID', false);

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

// authenticate
adsWallet.authenticate('message', window.location.hostname).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