Skip to content

Commit 83f3aa9

Browse files
authored
2.3.0 (#7)
* Updates for 2.2.0 * This is a simple smart contract used for testing. * Updating for TN-2.2.0 * DG-943 (#5) * Initial Browserify commit * Initial JS-SDK file commit * Auto-compile of DisJS, map file, minor bug fixes * Browser examples output to document instead of console * Update config to restore stage env * DG-943 (JS files) (#6) * Initial Browserify commit * Initial JS-SDK file commit * Auto-compile of DisJS, map file, minor bug fixes * Browser examples output to document instead of console * Update config to restore stage env * Update JS files * Align version number to disco version
1 parent fc73e30 commit 83f3aa9

19 files changed

+31936
-2388
lines changed

.verb.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,38 @@
1+
## CDN
2+
3+
The JavaScript version of the SDK may be included on the pae with the following CDN location:
4+
5+
```html
6+
<script src="https://cdn.jsdelivr.net/npm/@dispatchlabs/disnode-sdk/dist/disJS.js"></script>
7+
```
8+
19
## Usage
210

11+
Node:
12+
313
```js
4-
var DisNodeSDK = require('{%= name %}');
14+
var DisNodeSDK = require('@dispatchlabs/disnode-sdk');
15+
```
16+
17+
JavaScript:
18+
19+
For JavaScript, the top-level object is `DisJS`. Any of the models and methods below (unless otherwise stated) can be used in the browser by replacing `DisNodeSDK` with `DisJS`. For example;
20+
21+
```js
22+
// Create an empty account
23+
var account = new DisJS.Account();
524
```
625

726
### Running examples
827

9-
Examples are contained in the [examples folder](examples) and can be executed using:
28+
Examples are contained in the [examples folder](examples) and can be executed in Node using:
1029

1130
```sh
1231
$ npm install && npm run examples
1332
```
1433

34+
To execute the JavaScript examples, open the `examples/js/index.html` file in a browser window.
35+
1536
# Models
1637

1738
## Account

README.md

Lines changed: 59 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# @dispatchlabs/disnode-sdk [![NPM version](https://img.shields.io/npm/v/@dispatchlabs/disnode-sdk.svg?style=flat)](https://www.npmjs.com/package/@dispatchlabs/disnode-sdk) [![NPM monthly downloads](https://img.shields.io/npm/dm/@dispatchlabs/disnode-sdk.svg?style=flat)](https://npmjs.org/package/@dispatchlabs/disnode-sdk) [![NPM total downloads](https://img.shields.io/npm/dt/@dispatchlabs/disnode-sdk.svg?style=flat)](https://npmjs.org/package/@dispatchlabs/disnode-sdk) [![Linux Build Status](https://img.shields.io/travis/dispatchlabs/dispatchlabs.svg?style=flat&label=Travis)](https://travis-ci.org/dispatchlabs/dispatchlabs)
1+
# @dispatchlabs/disnode-sdk [![NPM version](https://img.shields.io/npm/v/@dispatchlabs/disnode-sdk.svg?style=flat)](https://www.npmjs.com/package/@dispatchlabs/disnode-sdk) [![NPM monthly downloads](https://img.shields.io/npm/dm/@dispatchlabs/disnode-sdk.svg?style=flat)](https://npmjs.org/package/@dispatchlabs/disnode-sdk) [![NPM total downloads](https://img.shields.io/npm/dt/@dispatchlabs/disnode-sdk.svg?style=flat)](https://npmjs.org/package/@dispatchlabs/disnode-sdk) [![Linux Build Status](https://img.shields.io/travis/dispatchlabs/dispatchlabs.svg?style=flat&label=Travis)](https://travis-ci.org/dispatchlabs/dispatchlabs)
22

3-
> The Dispatch SDK for Node developers.
3+
> The Dispatch SDK for Node and JavaScript developers.
4+
5+
Please consider following this project's author, [Dispatch Labs](https://github.com/David Hutchings), and consider starring the project to show your :heart: and support.
46

57
## Install
68

@@ -10,26 +12,41 @@ Install with [npm](https://www.npmjs.com/):
1012
$ npm install --save @dispatchlabs/disnode-sdk
1113
```
1214

13-
Install with [yarn](https://yarnpkg.com):
15+
## CDN
1416

15-
```sh
16-
$ yarn add @dispatchlabs/disnode-sdk
17+
The JavaScript version of the SDK may be included on the pae with the following CDN location:
18+
19+
```html
20+
<script src="https://cdn.jsdelivr.net/npm/@dispatchlabs/disnode-sdk/dist/disJS.js"></script>
1721
```
1822

1923
## Usage
2024

25+
Node:
26+
2127
```js
2228
var DisNodeSDK = require('@dispatchlabs/disnode-sdk');
2329
```
2430

31+
JavaScript:
32+
33+
For JavaScript, the top-level object is `DisJS`. Any of the models and methods below (unless otherwise stated) can be used in the browser by replacing `DisNodeSDK` with `DisJS`. For example;
34+
35+
```js
36+
// Create an empty account
37+
var account = new DisJS.Account();
38+
```
39+
2540
### Running examples
2641

27-
Examples are contained in the [examples folder](examples) and can be executed using:
42+
Examples are contained in the [examples folder](examples) and can be executed in Node using:
2843

2944
```sh
3045
$ npm install && npm run examples
3146
```
3247

48+
To execute the JavaScript examples, open the `examples/js/index.html` file in a browser window.
49+
3350
# Models
3451

3552
## Account
@@ -61,7 +78,7 @@ let account = new DisNodeSDK.Account({
6178
});
6279
```
6380

64-
### [refresh](lib/models/Account.js#L166)
81+
### [refresh](lib/models/Account.js#L172)
6582

6683
Refreshes the account balance and access info (created and updated dates) from a delegate.
6784

@@ -80,7 +97,7 @@ account.refresh()
8097
});
8198
```
8299

83-
### [init](lib/models/Account.js#L208)
100+
### [init](lib/models/Account.js#L225)
84101

85102
Generaes a new private key for the account object (replacing one if present).
86103

@@ -94,14 +111,14 @@ account.init();
94111
console.log(account);
95112
```
96113

97-
### [sendTokens](lib/models/Account.js#L237)
114+
### [sendTokens](lib/models/Account.js#L254)
98115

99116
Creates and sends a transaction that will transfer tokens from the source account, to the target account.
100117

101118
**Params**
102119

103120
* **{string|Account}**: to - The address or Account to send the tokens to.
104-
* **{number}**: tokens - The number of tokens to send.
121+
* **{number}**: value - The number of tokens to send.
105122
* `returns` **{Transaction}**: Returns a transaction which has already been sent.
106123

107124
**Example**
@@ -112,15 +129,15 @@ let account = new DisNodeSDK.Account('fa61c18114f8ff8aafbeb5d32e1b108e3f6cf30d')
112129
let tx = account.sendTokens(new DisNodeSDK.Account().init(), 1);
113130
```
114131

115-
### [createContract](lib/models/Account.js#L272)
132+
### [createContract](lib/models/Account.js#L293)
116133

117134
Creates and sends a transaction from the account that will create a new Smart Contract.
118135

119136
**Params**
120137

121138
* **{string}**: code - Bytecode of a compiled contract.
122139
* **{string|array}**: code - The ABI of the contract.
123-
* **{number}**: tokens - The number of tokens to seed the contract with.
140+
* **{number}**: value - The number of tokens to seed the contract with.
124141
* `returns` **{Transaction}**: Returns a transaction which has already been sent.
125142

126143
**Example**
@@ -131,7 +148,7 @@ let compiled = DisNodeSDK.Transaction.compileSource('contract x { function g() {
131148
let contract = account.createContract(compiled.contracts[0].bytecode, compiled.contracts[0].abi, 5);
132149
```
133150

134-
### [executeContract](lib/models/Account.js#L323)
151+
### [executeContract](lib/models/Account.js#L343)
135152

136153
Creates and sends a transaction from the account that will execute a method on an existing Smart Contract.
137154

@@ -140,8 +157,7 @@ Creates and sends a transaction from the account that will execute a method on a
140157
* **{string|Account|Transaction}**: to - The address of an existing contract, an Account representing the contract, or the contract creation Transaction.
141158
* **{string}**: method - The method in the contract to call.
142159
* **{array}**: params - The parameters to use during the method call.
143-
* **{string|array}**: code - The ABI of the contract being called.
144-
* **{number}**: tokens - The number of tokens to send to the contract for the method call.
160+
* **{number}**: value - The number of tokens to send to the contract for the method call.
145161
* `returns` **{Transaction}**: Returns a transaction which has already been sent.
146162

147163
**Example**
@@ -175,7 +191,7 @@ let account = new DisNodeSDK.Account().init();
175191
let tx = new DisNodeSDK.Transaction({from: account});
176192
```
177193

178-
### [send](lib/models/Transaction.js#L272)
194+
### [send](lib/models/Transaction.js#L316)
179195

180196
Sends the transaction to a delegate.
181197

@@ -195,7 +211,7 @@ tx.send()
195211
});
196212
```
197213

198-
### [status](lib/models/Transaction.js#L308)
214+
### [status](lib/models/Transaction.js#L357)
199215

200216
Requests the current status of the transaction from a delegate.
201217

@@ -216,7 +232,7 @@ tx.status()
216232
});
217233
```
218234

219-
### [whenStatusEquals](lib/models/Transaction.js#L364)
235+
### [whenStatusEquals](lib/models/Transaction.js#L427)
220236

221237
Waits until the status of the transaction matches the value provided, then resolves. Rejects after 5 seconds or when the transaction hits a non-matching final state.
222238

@@ -240,7 +256,7 @@ tx.whenStatusEquals('Ok')
240256
});
241257
```
242258

243-
### [compileSource](lib/models/Transaction.js#L440)
259+
### [compileSource](lib/models/Transaction.js#L511)
244260

245261
Static method to compile Solidity code directly.
246262

@@ -267,51 +283,61 @@ if (compiled.errors.length > 0) {
267283
}
268284
```
269285

270-
### [compile](lib/models/Transaction.js#L484)
286+
### [compile](lib/models/Transaction.js#L564)
271287

272288
Static method to compile complex Solidity JSON structures.
273289

274290
**Params**
275291

276-
* **{object}**: input - Full Solidity JSON structure. See {@link https://solidity.readthedocs.io/en/develop/using-the-compiler.html#compiler-input-and-output-json-description|Compiler Input and Output JSON Description}.
292+
* **{object}**: input - Full Solidity JSON structure. See [Compiler Input and Output JSON Description](https://solidity.readthedocs.io/en/develop/using-the-compiler.html#compiler-input-and-output-json-description).
277293
* `returns` **{object}**: Compiled output JSON.
278294

279295
**Example**
280296

281297
```js
282-
let compiled = DisNodeSDK.Transaction.compile({sources: { source: 'contract x { function g() { } }' }});
298+
let compiled = DisNodeSDK.Transaction.compile({language: 'Solidity', sources: { source: { content: 'contract x { function g() { } }' }}});
283299
```
284300

285301
## About
286302

287-
### Contributing
303+
<details>
304+
<summary><strong>Contributing</strong></summary>
288305

289306
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
290307

291-
### Building docs
308+
</details>
292309

293-
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
310+
<details>
311+
<summary><strong>Running Tests</strong></summary>
294312

295-
To generate the readme, run the following command:
313+
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
296314

297315
```sh
298-
$ npm install -g verbose/verb#dev verb-generate-readme && verb
316+
$ npm install && npm test
299317
```
300318

301-
### Running tests
319+
</details>
302320

303-
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
321+
<details>
322+
<summary><strong>Building docs</strong></summary>
323+
324+
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
325+
326+
To generate the readme, run the following command:
304327

305328
```sh
306-
$ npm install && npm test
329+
$ npm install -g verbose/verb#dev verb-generate-readme && verb
307330
```
308331

332+
</details>
333+
309334
### Author
310335

311336
**Dispatch Labs**
312337

313-
* [github/David Hutchings](https://github.com/David Hutchings)
314-
* [twitter/David Hutchings](https://twitter.com/David Hutchings)
338+
* [GitHub Profile](https://github.com/David Hutchings)
339+
* [Twitter Profile](https://twitter.com/David Hutchings)
340+
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
315341

316342
### License
317343

@@ -320,4 +346,4 @@ Released under the [LGPL-3.0 License](LICENSE).
320346

321347
***
322348

323-
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.7.0, on July 26, 2018._
349+
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on October 16, 2018._

config/config_production.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

config/config_stage.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)