Skip to content

Commit 06cfdd6

Browse files
adding better intro documentation
1 parent 41d3a2b commit 06cfdd6

File tree

2 files changed

+169
-66
lines changed

2 files changed

+169
-66
lines changed

docs/api.md

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -547,46 +547,6 @@ const metrics = await web3data.address.getMetrics('0x3f5ce5fbfe3e9af3971dd833d26
547547

548548

549549

550-
### src/bch.js
551-
552-
553-
#### new Bch() *private method*
554-
555-
Class for all Bitcoin Cash based methods.
556-
557-
558-
559-
560-
561-
562-
##### Returns
563-
564-
565-
- `Void`
566-
567-
568-
569-
570-
### src/bsv.js
571-
572-
573-
#### new Bsv() *private method*
574-
575-
Class for all Bitcoin SV based methods.
576-
577-
578-
579-
580-
581-
582-
##### Returns
583-
584-
585-
- `Void`
586-
587-
588-
589-
590550
### src/block.js
591551

592552

@@ -924,6 +884,26 @@ Retrieves the blocks metrics & statistics. If no DateRange is specified, it will
924884

925885

926886

887+
### src/bch.js
888+
889+
890+
#### new Bch() *private method*
891+
892+
Class for all Bitcoin Cash based methods.
893+
894+
895+
896+
897+
898+
899+
##### Returns
900+
901+
902+
- `Void`
903+
904+
905+
906+
927907
### src/blockchain.js
928908

929909

@@ -988,6 +968,26 @@ const metrics = await web3data.blockchain.getMetrics()
988968

989969

990970

971+
### src/bsv.js
972+
973+
974+
#### new Bsv() *private method*
975+
976+
Class for all Bitcoin SV based methods.
977+
978+
979+
980+
981+
982+
983+
##### Returns
984+
985+
986+
- `Void`
987+
988+
989+
990+
991991
### src/btc.js
992992

993993

@@ -1220,6 +1220,26 @@ Class for all Ethereum based methods.
12201220

12211221

12221222

1223+
##### Returns
1224+
1225+
1226+
- `Void`
1227+
1228+
1229+
1230+
1231+
### src/ltc.js
1232+
1233+
1234+
#### new Ltc() *private method*
1235+
1236+
Class for all Litecoin based methods.
1237+
1238+
1239+
1240+
1241+
1242+
12231243
##### Returns
12241244

12251245

@@ -1644,26 +1664,6 @@ const batTokenAddress = web3data.market.getAssetAddresses('bat') const assetAddr
16441664

16451665

16461666

1647-
### src/ltc.js
1648-
1649-
1650-
#### new Ltc() *private method*
1651-
1652-
Class for all Litecoin based methods.
1653-
1654-
1655-
1656-
1657-
1658-
1659-
##### Returns
1660-
1661-
1662-
- `Void`
1663-
1664-
1665-
1666-
16671667
### src/signature.js
16681668

16691669

@@ -3145,12 +3145,12 @@ Sends unsubscription message to the websocket connection.
31453145

31463146

31473147

3148-
### src/zec.js
3148+
### src/xlm.js
31493149

31503150

3151-
#### new Zec() *private method*
3151+
#### new Xlm() *private method*
31523152

3153-
Class for all ZCash based methods.
3153+
Class for all Stellar based methods.
31543154

31553155

31563156

@@ -3165,12 +3165,12 @@ Class for all ZCash based methods.
31653165

31663166

31673167

3168-
### src/xlm.js
3168+
### src/zec.js
31693169

31703170

3171-
#### new Xlm() *private method*
3171+
#### new Zec() *private method*
31723172

3173-
Class for all Stellar based methods.
3173+
Class for all ZCash based methods.
31743174

31753175

31763176

docs/quick-start.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
![Web3data.js Javascript API](./assets/web3data-js-logo-banner.png)
22

3+
[![Build Status](https://travis-ci.com/web3data/web3data-js.svg?branch=master)](https://travis-ci.com/web3data/web3data-js)
4+
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo)
5+
[![Try web3data-js on RunKit](https://badge.runkitcdn.com/web3data-js.svg)](https://npm.runkit.com/web3data-js)
6+
7+
# Web3data.js Javascript API
8+
Wrapper for [Amberdata.io](http://amberdata.io)'s [REST API](http://docs.amberdata.io/reference)
9+
310
## Installation
411
<i>Note that you must have node (and npm) installed.</i>
512

@@ -13,6 +20,17 @@ Using CDN:
1320
<script src="https://unpkg.com/web3data-js/dist/web3data.min.js"></script>
1421
```
1522

23+
## The API Key
24+
Visit [Amberdata.io](https://amberdata.io/pricing) and select the developer plan to get started!
25+
26+
Once you've got your key, place it in a file named `.env` &mdash; see [env.example](./env.example) for reference.
27+
28+
Then in you code you can use it like so:
29+
30+
```javascript
31+
const web3Data = new Web3Data(process.env.API_KEY)
32+
```
33+
1634
## Configuration
1735
Web3data configuration is simple and only requires an API Key upon instantiation.
1836
```javascript
@@ -30,11 +48,83 @@ requests via web3data.js.
3048

3149
You can find the full [list of blockchain IDs](https://docs.amberdata.io/reference#blockchain-ids) in our docs.
3250

51+
52+
## Simple Usage Example
53+
54+
For more examples, [click here to head over to view more quick examples](/examples). For a full spectrum of guides, tutorials & sample code, go to [our Amberdata Documentation](https://amberdata.io/docs). For filters & optional parameters, please [refer to the API documentation](https://docs.amberdata.io).
55+
56+
#### Within Node
57+
```js
58+
import Web3Data from 'web3data-js'
59+
60+
const w3d = new Web3Data('<api-key>')
61+
62+
;( async () => {
63+
const contract = await w3d.contract.getDetails("0x06012c8cf97bead5deae237070f9587f8e7a266d")
64+
console.log(contract) // { ... }
65+
})()
66+
```
67+
68+
#### Websockets Events
69+
```js
70+
import Web3Data from 'web3data-js'
71+
72+
const w3d = new Web3Data('<api-key>')
73+
74+
w3d.connect(status => {
75+
console.log('status ->', status.type)
76+
})
77+
w3d.on({eventName: 'block'}, data => {
78+
console.log(data)
79+
})
80+
```
81+
3382
## Blockchains/Networks
3483
It's possible to the namespace convention to specify which blockchain to use when making requests.
3584
This makes it easier to switch between blockchains as Web3data will automatically set the correct headers under
3685
the hood.
3786

87+
### Supported Blockchain Namespaces
88+
89+
<table style="width:100%">
90+
<tr>
91+
<th>Name</th>
92+
<th>Namespace</th>
93+
</tr>
94+
<tr>
95+
<td>default</td>
96+
<td>web3data.* (Ethereum)</td>
97+
</tr>
98+
<tr>
99+
<td>Bitcoin</td>
100+
<td>web3data.btc</td>
101+
</tr>
102+
<tr>
103+
<td>Ethereum</td>
104+
<td>web3data.eth</td>
105+
</tr>
106+
<tr>
107+
<td>Litecoin</td>
108+
<td>web3data.ltc</td>
109+
</tr>
110+
<tr>
111+
<td>Bitcoin Cash</td>
112+
<td>web3data.bch</td>
113+
</tr>
114+
<tr>
115+
<td>Bitcoin SV</td>
116+
<td>web3data.bsv</td>
117+
</tr>
118+
<tr>
119+
<td>Stellar</td>
120+
<td>web3data.xlm</td>
121+
</tr>
122+
<tr>
123+
<td>Zcash</td>
124+
<td>web3data.zec</td>
125+
</tr>
126+
</table>
127+
38128
### Ethereum
39129

40130
**Namespace**: `.eth`
@@ -74,29 +164,42 @@ web3data.eth.address.getBalance('0x734Ac651Dd95a339c633cdEd410228515F97fAfF')
74164
<tr>
75165
<td>getTransactions</td>
76166
<td>getTransactions</td>
167+
<td></td>
77168
</tr>
78169
<tr>
79170
<td>getPendingTransactions</td>
80171
<td>getTransactionFromBlock</td>
172+
<td></td>
81173
</tr>
82174
<tr>
83175
<td>getBalance</td>
84176
<td>getMetrics</td>
177+
<td></td>
85178
</tr>
86179
<tr>
87180
<td>getLatestBalance</td>
181+
<td></td>
182+
<td></td>
88183
</tr>
89184
<tr>
90185
<td>getHistoricalBalance</td>
186+
<td></td>
187+
<td></td>
91188
</tr>
92189
<tr>
93190
<td>getMultipleBalances</td>
191+
<td></td>
192+
<td></td>
94193
</tr>
95194
<tr>
96195
<td>getBalancesBatch</td>
196+
<td></td>
197+
<td></td>
97198
</tr>
98199
<tr>
99200
<td>getMetrics</td>
201+
<td></td>
202+
<td></td>
100203
</tr>
101204
</table>
102205
</details>

0 commit comments

Comments
 (0)