@bitgo/statics 6.15.1-rc.7 → 6.16.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierignore +3 -0
- package/README.md +31 -22
- package/dist/resources/dot/westend.d.ts +1 -1
- package/dist/resources/dot/westend.d.ts.map +1 -1
- package/dist/resources/dot/westend.js +2 -2
- package/dist/src/account.d.ts.map +1 -1
- package/dist/src/account.js +2 -1
- package/dist/src/base.d.ts +32 -3
- package/dist/src/base.d.ts.map +1 -1
- package/dist/src/base.js +33 -4
- package/dist/src/coins.d.ts.map +1 -1
- package/dist/src/coins.js +50 -9
- package/dist/src/networks.d.ts +25 -5
- package/dist/src/networks.d.ts.map +1 -1
- package/dist/src/networks.js +29 -7
- package/dist/src/ofc.d.ts.map +1 -1
- package/dist/src/ofc.js +6 -2
- package/dist/src/utxo.d.ts.map +1 -1
- package/dist/src/utxo.js +6 -2
- package/package.json +4 -5
- package/resources/dot/westend.ts +1 -1
package/.prettierignore
ADDED
package/README.md
CHANGED
|
@@ -6,16 +6,18 @@
|
|
|
6
6
|
</h3>
|
|
7
7
|
|
|
8
8
|
## Goals
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
|
|
10
|
+
- Provide an "encyclopedia" of all relevant constants which are sprinkled throughout the BitGo stack.
|
|
11
|
+
- Separate _static_ config data from _dynamic_ config data
|
|
12
|
+
- Strong typing for static config properties, with full type information for configuration items
|
|
13
|
+
- Ability to export static configuration as JSON for consumption by non-javascript projects
|
|
13
14
|
|
|
14
15
|
## Examples
|
|
15
16
|
|
|
16
17
|
### Get the number of decimal places in a Bitcoin
|
|
17
18
|
|
|
18
|
-
####
|
|
19
|
+
#### JavaScript
|
|
20
|
+
|
|
19
21
|
```js
|
|
20
22
|
const { coins } = require('@bitgo/statics');
|
|
21
23
|
|
|
@@ -23,7 +25,8 @@ const btc = coins.get('btc');
|
|
|
23
25
|
console.log(btc.decimalPlaces);
|
|
24
26
|
```
|
|
25
27
|
|
|
26
|
-
####
|
|
28
|
+
#### TypeScript
|
|
29
|
+
|
|
27
30
|
```typescript
|
|
28
31
|
import { coins } from '@bitgo/statics';
|
|
29
32
|
|
|
@@ -33,7 +36,8 @@ console.log(btc.decimalPlaces);
|
|
|
33
36
|
|
|
34
37
|
### Get the contract address for the OmiseGo ERC20 Token
|
|
35
38
|
|
|
36
|
-
####
|
|
39
|
+
#### JavaScript
|
|
40
|
+
|
|
37
41
|
```js
|
|
38
42
|
const { coins } = require('@bitgo/statics');
|
|
39
43
|
|
|
@@ -41,7 +45,8 @@ const omg = coins.get('omg');
|
|
|
41
45
|
console.log(omg.contractAddress);
|
|
42
46
|
```
|
|
43
47
|
|
|
44
|
-
####
|
|
48
|
+
#### TypeScript
|
|
49
|
+
|
|
45
50
|
```typescript
|
|
46
51
|
import { coins, Erc20Coin } from '@bitgo/statics';
|
|
47
52
|
|
|
@@ -53,7 +58,8 @@ if (omg instanceof Erc20Coin) {
|
|
|
53
58
|
|
|
54
59
|
### List full names of all defined coins
|
|
55
60
|
|
|
56
|
-
####
|
|
61
|
+
#### JavaScript
|
|
62
|
+
|
|
57
63
|
```js
|
|
58
64
|
const { coins } = require('@bitgo/statics');
|
|
59
65
|
|
|
@@ -62,7 +68,8 @@ coins.forEach((coin) => {
|
|
|
62
68
|
});
|
|
63
69
|
```
|
|
64
70
|
|
|
65
|
-
####
|
|
71
|
+
#### TypeScript
|
|
72
|
+
|
|
66
73
|
```typescript
|
|
67
74
|
import { coins } from '@bitgo/statics';
|
|
68
75
|
|
|
@@ -72,19 +79,22 @@ coins.forEach((coin) => {
|
|
|
72
79
|
```
|
|
73
80
|
|
|
74
81
|
## Repo Status
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
|
|
83
|
+
- UTXO and account base types are defined
|
|
84
|
+
- Documentation is mostly source code comments and README examples
|
|
85
|
+
- This library can be depended on, but expect some changes going forward
|
|
78
86
|
|
|
79
87
|
## Project Structure
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
|
|
89
|
+
- `src/base.ts`: Interfaces and enums used by coin implementation classes.
|
|
90
|
+
- `src/coins.ts`: Coin definitions.
|
|
91
|
+
- `src/networks.ts`: Network interfaces and implementation classes.
|
|
92
|
+
- `src/utxo.ts`: Unspent Transaction Output (UTXO) based coin classes and factory function.
|
|
93
|
+
- `src/account.ts`: Account-based coin classes and factory methods. Includes ERC20 factory functions.
|
|
94
|
+
- `src/errors.ts`: Custom Error classes.
|
|
86
95
|
|
|
87
96
|
## Installation + Building
|
|
97
|
+
|
|
88
98
|
To install the project locally, run the following steps:
|
|
89
99
|
|
|
90
100
|
```
|
|
@@ -97,14 +107,13 @@ $ # (optionally) nvm use 8.6.0
|
|
|
97
107
|
$ npm install
|
|
98
108
|
```
|
|
99
109
|
|
|
100
|
-
To build the project (from TypeScript to
|
|
110
|
+
To build the project (from TypeScript to JavaScript):
|
|
101
111
|
|
|
102
112
|
```
|
|
103
113
|
$ npm run build
|
|
104
114
|
```
|
|
105
115
|
|
|
106
|
-
This builds the
|
|
107
|
-
|
|
116
|
+
This builds the JavaScript and adds it to `dist/src/`. You will receive compilation errors if you have invalid syntax.
|
|
108
117
|
|
|
109
118
|
## Tests
|
|
110
119
|
|