From c05336ed8c0460448dfa26dc2eb1c5ba00de6160 Mon Sep 17 00:00:00 2001 From: Maciej Pilarczyk Date: Fri, 19 Nov 2021 15:11:37 +0100 Subject: [PATCH] Fix import as a module --- CHANGELOG.md | 7 ++++++- README.md | 24 ++++++++++++++++++++++++ package.json | 1 - rollup.config.js | 2 +- src/client.js | 2 +- 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdc2d4b..f8d59d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.1] - 2021-11-19 +### Fixed +- Import as a module + ## [1.0.0] - 2021-11-17 ### Added - Support for RPC commands: @@ -23,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Changelog - Contributing -[Unreleased]: https://github.com/adshares/ads-js-client/compare/v1.0.0...HEAD +[Unreleased]: https://github.com/adshares/ads-js-client/compare/v1.0.1...HEAD +[1.0.1]: https://github.com/adshares/ads-js/compare/v1.0.0...v1.0.1 [1.0.0]: https://github.com/adshares/ads-js-client/releases/tag/v1.0.0 diff --git a/README.md b/README.md index 9c0cebc..c3bb357 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,31 @@ ADS JS Client is an **JavaScript ES2015** client for the [ADS blockchain](https: The module can be used to send basic transactions. ADS JS Client is a free, open-source npm module. It supports both mainnet and testnet. +## Install +```bash +npm install @adshares/ads-client +``` +or +```bash +yarn add @adshares/ads-client +``` + +## Usage + +All methods return Promises. + +```js +import AdsClient from '@adshares/ads-client'; + +// pass true to enable testnet +const adsClient = new AdsClient(false); + +adsWallet.getInfo().then(info => {}) +adsWallet.getNodes().then(nodes => {}) +adsWallet.sendTransaction(_DATA_, _SIGNATURE_).then(response => {}) + +``` ### Contributing diff --git a/package.json b/package.json index 3e476a9..0418906 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "homepage": "https://github.com/adshares/ads-js-client#readme", "main": "dist/index.cjs.js", "module": "dist/index.esm.js", - "browser": "dist/index.js", "scripts": { "build": "rollup -c", "dev": "rollup -c -w --environment BUILD:dev", diff --git a/rollup.config.js b/rollup.config.js index 6792a49..4785560 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -18,7 +18,7 @@ export default [ input: 'src/client.js', output: { name: 'AdsClient', - file: pkg.browser, + file: 'dist/index.js', format: 'iife', globals: { crypto: 'Crypto' diff --git a/src/client.js b/src/client.js index 800dce9..6854a3c 100644 --- a/src/client.js +++ b/src/client.js @@ -162,7 +162,7 @@ export default class AdsClient { }) } - sendTransaction (data, signature, host) { + sendTransaction (data, signature) { const sender = Ads.Tx.decodeSender(data) return this.getNode(Ads.splitAddress(sender).nodeId) .then(node => {