-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocs.js
More file actions
76 lines (60 loc) · 2.24 KB
/
docs.js
File metadata and controls
76 lines (60 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const generator = require("jsdoc-to-markdown");
const fs = require("fs");
const title = "# [AIVIA JavaScript SDK](https://aivia.io/)";
const badges = `
[](https://github.com/aiviaio/aivia-javscript-sdk/LICENSE)
[](https://www.npmjs.com/package/aivia)
[](https://github.com/aiviaio/aivia-javscript-sdk/)
`;
const warning = `
#### Please note that **THIS** version is running on [Ropsten](https://ropsten.etherscan.io/) TestNet.
### Please **DO NOT** add your MainNet wallet. You may lose your funds.
`;
const ropsten = `
## How to connect to the Ropsten TestNet with Infura
#### Register with Infura
You need to [register for an Infura Access Token](https://infura.io/register).
Fill out the form and you will receive your access token.
Use your access token in url of the HTTP_PROVIDER, like:
\`\`\`JavaScript
const HTTP_PROVIDER = "https://ropsten.infura.io/v3/0db7ff8aff88e_demo_key"
\`\`\`
`;
const description = `
JavaScript Wrapper for interaction with AIVIA Protocol.
:white_check_mark: Crypto Hedge Fund Template is supported
`;
const install = `
## Installation
This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/).
Before installing, [download and install Node.js](https://nodejs.org/en/download/).
Node.js 10.0 or higher is required.
\`\`\`bash
npm install aivia -S
\`\`\`
`;
const example = `
## Example
\`\`\`JavaScript
const AIVIA_SDK = require("aivia"); // es6
const AIVIA_SDK = require("aivia/sdk"); // es5
const ENTRY_POINT = "0x0000000000000000000000000000000000000000" // protocol entry point contract address
const HTTP_PROVIDER = "https://ropsten.infura.io/v3/YOUR-ACCESS-TOKEN";
const DEFAULT_GAS_PRICE = 10000000000 // in wei, default value 50000000000 (50 gWei)
const SDK = new AIVIA_SDK(ENTRY_POINT, HTTP_PROVIDER, DEFAULT_GAS_PRICE );
\`\`\`
`;
const head = `
${title} ${badges}
${description}
___
${warning}
___
${ropsten}
${install}
${example}
`;
generator.render({ files: "src/**/*.js", separators: true }).then(docs => {
fs.writeFile("./README.md", head + docs, () => {});
});