@steemit/steem-js 0.7.11 → 0.8.0

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.
Files changed (74) hide show
  1. package/README.md +22 -3
  2. package/circle.yml +1 -1
  3. package/config.json +1 -1
  4. package/dist/steem-tests.min.js +4097 -23
  5. package/dist/steem.min.js +2089 -18
  6. package/docker-webpack.config.js +44 -0
  7. package/lib/api/index.js +305 -412
  8. package/lib/api/methods.js +16 -1
  9. package/lib/api/rpc-auth.js +135 -0
  10. package/lib/api/transports/base.js +25 -66
  11. package/lib/api/transports/http.js +114 -129
  12. package/lib/api/transports/index.js +8 -15
  13. package/lib/api/transports/ws.js +107 -207
  14. package/lib/auth/ecc/index.js +9 -9
  15. package/lib/auth/ecc/src/address.js +48 -78
  16. package/lib/auth/ecc/src/aes.js +93 -129
  17. package/lib/auth/ecc/src/brain_key.js +7 -7
  18. package/lib/auth/ecc/src/ecdsa.js +7 -33
  19. package/lib/auth/ecc/src/ecsignature.js +4 -30
  20. package/lib/auth/ecc/src/enforce_types.js +1 -8
  21. package/lib/auth/ecc/src/hash.js +16 -25
  22. package/lib/auth/ecc/src/key_private.js +146 -199
  23. package/lib/auth/ecc/src/key_public.js +130 -202
  24. package/lib/auth/ecc/src/key_utils.js +64 -106
  25. package/lib/auth/ecc/src/signature.js +125 -177
  26. package/lib/auth/index.js +84 -97
  27. package/lib/auth/memo.js +90 -118
  28. package/lib/auth/serializer/index.js +12 -18
  29. package/lib/auth/serializer/src/ChainTypes.js +0 -3
  30. package/lib/auth/serializer/src/convert.js +29 -32
  31. package/lib/auth/serializer/src/error_with_cause.js +22 -37
  32. package/lib/auth/serializer/src/fast_parser.js +54 -74
  33. package/lib/auth/serializer/src/number_utils.js +30 -54
  34. package/lib/auth/serializer/src/object_id.js +37 -62
  35. package/lib/auth/serializer/src/operations.js +597 -689
  36. package/lib/auth/serializer/src/precision.js +55 -73
  37. package/lib/auth/serializer/src/serializer.js +158 -204
  38. package/lib/auth/serializer/src/template.js +13 -8
  39. package/lib/auth/serializer/src/types.js +949 -1102
  40. package/lib/auth/serializer/src/validation.js +268 -328
  41. package/lib/broadcast/helpers.js +61 -98
  42. package/lib/broadcast/index.js +61 -82
  43. package/lib/browser.js +15 -19
  44. package/lib/config.js +16 -38
  45. package/lib/formatter.js +89 -115
  46. package/lib/index.js +19 -17
  47. package/lib/utils.js +4 -9
  48. package/node-18.dockerfile +28 -0
  49. package/package.json +62 -38
  50. package/test/Crypto.js +16 -16
  51. package/test/KeyFormats.js +1 -1
  52. package/test/api.test.js +37 -0
  53. package/test/broadcast.test.js +14 -8
  54. package/test/comment.test.js +17 -3
  55. package/test/operations_test.js +1 -1
  56. package/test/promise-broadcast.test.js +86 -0
  57. package/test/reputation.test.js +68 -0
  58. package/test/smt.test.js +10 -10
  59. package/test-github-workflow.bat +19 -0
  60. package/test-github-workflow.sh +15 -0
  61. package/webpack/makeConfig.js +25 -17
  62. package/.circleci/config.yml +0 -23
  63. package/dist/statistics.html +0 -208
  64. package/dist/steem-tests.min.js.gz +0 -0
  65. package/dist/steem-tests.min.js.map +0 -1
  66. package/dist/steem.min.js.gz +0 -0
  67. package/dist/steem.min.js.map +0 -1
  68. package/lib/auth/ecc/README.md +0 -20
  69. package/lib/auth/ecc/package.json +0 -36
  70. package/lib/auth/serializer/README.md +0 -13
  71. package/lib/auth/serializer/package.json +0 -32
  72. package/node-4.dockerfile +0 -6
  73. package/node-6.dockerfile +0 -6
  74. package/yarn.lock +0 -3336
package/test/api.test.js CHANGED
@@ -323,4 +323,41 @@ describe('steem.api:', function () {
323
323
  it('does not retry non-retriable operations');
324
324
  });
325
325
 
326
+ describe('getRC', () => {
327
+ describe('getting a RC of an account', () => {
328
+ it('works', async () => {
329
+ const result = await steem.api.findRcAccountsAsync(["justinsunsteemit"]);
330
+ result.should.have.properties("rc_accounts");
331
+ result["rc_accounts"][0].should.have.properties("rc_manabar");
332
+ });
333
+ it('clears listeners', async () => {
334
+ steem.api.listeners('message').should.have.lengthOf(0);
335
+ });
336
+ });
337
+ });
338
+
339
+ describe('getExpiringDelegations', () => {
340
+ describe('getting expired delegation of an account', () => {
341
+ it('works', async () => {
342
+ const result = await steem.api.getExpiringVestingDelegationsAsync("justyy", "2004-01-02T00:11:22", 100);
343
+ result.should.have.properties("length");
344
+ });
345
+ it('clears listeners', async () => {
346
+ steem.api.listeners('message').should.have.lengthOf(0);
347
+ });
348
+ });
349
+ });
350
+
351
+ describe('Account Recovery', () => {
352
+ describe('findChangeRecoveryAccountRequests', () => {
353
+ it('works', async () => {
354
+ const result = await steem.api.findChangeRecoveryAccountRequestsAsync(["justyy", "ety001"]);
355
+ result.should.have.properties("requests");
356
+ result.requests.should.have.properties("length");
357
+ });
358
+ it('clears listeners', async () => {
359
+ steem.api.listeners('message').should.have.lengthOf(0);
360
+ });
361
+ });
362
+ });
326
363
  });
@@ -113,7 +113,8 @@ describe('steem.broadcast:', () => {
113
113
  });
114
114
 
115
115
  describe('downvoting', () => {
116
- it('works', async () => {
116
+ it('works', async function() {
117
+ this.timeout(10000);
117
118
  const tx = await steem.broadcast.voteAsync(
118
119
  postingWif,
119
120
  username,
@@ -133,11 +134,13 @@ describe('steem.broadcast:', () => {
133
134
  });
134
135
 
135
136
  describe('voting', () => {
136
- beforeEach(() => {
137
- return Promise.delay(2000);
137
+ beforeEach(function() {
138
+ this.timeout(10000);
139
+ return Promise.delay(3000);
138
140
  });
139
141
 
140
- it('works', async () => {
142
+ it('works', async function() {
143
+ this.timeout(10000);
141
144
  const tx = await steem.broadcast.voteAsync(
142
145
  postingWif,
143
146
  username,
@@ -156,7 +159,8 @@ describe('steem.broadcast:', () => {
156
159
  ]);
157
160
  });
158
161
 
159
- it('works with callbacks', (done) => {
162
+ it('works with callbacks', function(done) {
163
+ this.timeout(10000);
160
164
  steem.broadcast.vote(
161
165
  postingWif,
162
166
  username,
@@ -180,11 +184,13 @@ describe('steem.broadcast:', () => {
180
184
  });
181
185
 
182
186
  describe('customJson', () => {
183
- before(() => {
184
- return Promise.delay(2000);
187
+ before(function() {
188
+ this.timeout(10000);
189
+ return Promise.delay(3000);
185
190
  });
186
191
 
187
- it('works', async () => {
192
+ it('works', async function() {
193
+ this.timeout(10000);
188
194
  const tx = await steem.broadcast.customJsonAsync(
189
195
  postingWif,
190
196
  [],
@@ -2,6 +2,7 @@ import Promise from 'bluebird';
2
2
  import should from 'should';
3
3
  import steem from '../src';
4
4
  import pkg from '../package.json';
5
+ import assert from 'assert'
5
6
 
6
7
  const username = process.env.STEEM_USERNAME || 'guest123';
7
8
  const password = process.env.STEEM_PASSWORD;
@@ -12,11 +13,13 @@ const postingWif = password
12
13
  describe('steem.broadcast:', () => {
13
14
 
14
15
  describe('comment with options', () => {
15
- before(() => {
16
- return Promise.delay(2000);
16
+ before(function() {
17
+ this.timeout(10000);
18
+ return Promise.delay(3000);
17
19
  });
18
20
 
19
- it('works', async () => {
21
+ it('works', async function() {
22
+ this.timeout(10000);
20
23
  const permlink = steem.formatter.commentPermlink('siol', 'test');
21
24
  const operations = [
22
25
  ['comment',
@@ -67,3 +70,14 @@ describe('steem.broadcast:', () => {
67
70
  });
68
71
  });
69
72
  });
73
+
74
+ describe('commentPermLink:', () => {
75
+ it('does not return dots', () => {
76
+ var commentPermlink = steem.formatter.commentPermlink(
77
+ 'foo.bar',
78
+ 'the-first-physical-foo-bar-ready-to-be-shipped'
79
+ );
80
+ console.log(commentPermlink);
81
+ assert.equal(-1, commentPermlink.indexOf('.'));
82
+ });
83
+ });
@@ -19,7 +19,7 @@ describe("steem.auth: operation test", ()=> {
19
19
  let tx_hex = "614bde71d95f911bf3560109000000000000000003535445454d000009696e69746d696e65720573636f74740100000000010332757668fa45c2bc21447a2ff1dc2bbed9d9dda1616fd7b700255bd28e9d674a010001000000000103fb8900a262d51b908846be54fcf04b3a80d12ee749b9446f976b58b220ba4eed010001000000000102af4963d0f034043f4b4b0c99220e6a4b5d8b9cc71e5cd7d110f7602f3a0a11d1010002ff0de11ef55b998daf88047f1a00a60ed5dffb0c23c3279f8bd42a733845c5da000000"
20
20
 
21
21
  // 03 53 54 45 45 4d 0000
22
- assert.equal("STEEM", new Buffer("535445454d", "hex").toString())
22
+ assert.equal("STEEM", new Buffer.from("535445454d", "hex").toString())
23
23
  let tx_object1 = ops.signed_transaction.fromObject(tx)
24
24
  let tx_object2 = ops.signed_transaction.fromHex(tx_hex)
25
25
  assert.deepEqual(tx, ops.signed_transaction.toObject(tx_object1))
@@ -0,0 +1,86 @@
1
+ import Promise from 'bluebird';
2
+ import should from 'should';
3
+ import steem from '../src';
4
+
5
+ const username = process.env.STEEM_USERNAME || 'guest123';
6
+ const password = process.env.STEEM_PASSWORD;
7
+ const postingWif = password
8
+ ? steem.auth.toWif(username, password, 'posting')
9
+ : '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg';
10
+
11
+ describe('steem.broadcast: Promise Support', () => {
12
+ it('should support Promises without Async suffix', function() {
13
+ this.timeout(10000);
14
+ const votePromise = steem.broadcast.vote(
15
+ postingWif,
16
+ username,
17
+ 'yamadapc',
18
+ 'test-1-2-3-4-5-6-7-9',
19
+ 1000
20
+ );
21
+
22
+ should(votePromise).be.an.instanceof(Promise);
23
+
24
+ return votePromise.then(tx => {
25
+ tx.should.have.properties([
26
+ 'expiration',
27
+ 'ref_block_num',
28
+ 'ref_block_prefix',
29
+ 'extensions',
30
+ 'operations',
31
+ 'signatures',
32
+ ]);
33
+ });
34
+ });
35
+
36
+ it('should still support callbacks', function(done) {
37
+ this.timeout(10000);
38
+ steem.broadcast.vote(
39
+ postingWif,
40
+ username,
41
+ 'yamadapc',
42
+ 'test-1-2-3-4-5-6-7-9',
43
+ 1000,
44
+ (err, tx) => {
45
+ if (err) return done(err);
46
+ tx.should.have.properties([
47
+ 'expiration',
48
+ 'ref_block_num',
49
+ 'ref_block_prefix',
50
+ 'extensions',
51
+ 'operations',
52
+ 'signatures',
53
+ ]);
54
+ done();
55
+ }
56
+ );
57
+ });
58
+
59
+ it('should support direct Promise on send method', function() {
60
+ this.timeout(10000);
61
+ const operations = [['vote', {
62
+ voter: username,
63
+ author: 'yamadapc',
64
+ permlink: 'test-1-2-3-4-5-6-7-9',
65
+ weight: 1000,
66
+ }]];
67
+
68
+ const sendPromise = steem.broadcast.send(
69
+ { operations, extensions: [] },
70
+ { posting: postingWif }
71
+ );
72
+
73
+ should(sendPromise).be.an.instanceof(Promise);
74
+
75
+ return sendPromise.then(tx => {
76
+ tx.should.have.properties([
77
+ 'expiration',
78
+ 'ref_block_num',
79
+ 'ref_block_prefix',
80
+ 'extensions',
81
+ 'operations',
82
+ 'signatures',
83
+ ]);
84
+ });
85
+ });
86
+ });
@@ -0,0 +1,68 @@
1
+ import assert from 'assert';
2
+ import steem from '../src';
3
+
4
+ describe('steem.format.reputation', ()=> {
5
+ const reputation = steem.formatter.reputation;
6
+ it('rep 0 => 25', () => {
7
+ assert.equal(reputation(0), 25);
8
+ });
9
+ it('rep 95832978796820 => 69', () => {
10
+ assert.equal(reputation(95832978796820), 69);
11
+ });
12
+ it('rep 10004392664120 => 61', () => {
13
+ assert.equal(reputation(10004392664120), 61);
14
+ });
15
+ it('rep 30999525306309 => 65', () => {
16
+ assert.equal(reputation(30999525306309), 65);
17
+ });
18
+ it('rep -37765258368568 => -16', () => {
19
+ assert.equal(reputation(-37765258368568), -16);
20
+ });
21
+ it('rep 334486135407077 => 74', () => {
22
+ assert.equal(reputation(334486135407077), 74);
23
+ });
24
+ it('rep null => null', () => {
25
+ assert.equal(reputation(null), null);
26
+ });
27
+ it('rep undefined => undefined', () => {
28
+ assert.equal(reputation(undefined), undefined);
29
+ });
30
+ it('rep -1234123412342234 => -29', () => {
31
+ assert.equal(reputation(-1234123412342234), -29);
32
+ });
33
+ it('rep -22233344455 => 12', () => {
34
+ assert.equal(reputation(-22233344455), 12);
35
+ });
36
+
37
+ // with decimal places
38
+ it('rep 0 => 25', () => {
39
+ assert.equal(reputation(0, 1), 25);
40
+ });
41
+ it('rep 95832978796820 => 69.83', () => {
42
+ assert.equal(reputation(95832978796820, 2), 69.83);
43
+ });
44
+ it('rep 10004392664120 => 61.002', () => {
45
+ assert.equal(reputation(10004392664120, 3), 61.002);
46
+ });
47
+ it('rep 30999525306309 => 65.4222', () => {
48
+ assert.equal(reputation(30999525306309, 4), 65.4222);
49
+ });
50
+ it('rep -37765258368568 => -16.19383', () => {
51
+ assert.equal(reputation(-37765258368568, 5), -16.19383);
52
+ });
53
+ it('rep 334486135407077 => 74.719403', () => {
54
+ assert.equal(reputation(334486135407077, 6), 74.719403);
55
+ });
56
+ it('rep null => null', () => {
57
+ assert.equal(reputation(null, 7), null);
58
+ });
59
+ it('rep undefined => undefined', () => {
60
+ assert.equal(reputation(undefined, 8), undefined);
61
+ });
62
+ it('rep -1234123412342234 => -29.822227322', () => {
63
+ assert.equal(reputation(-1234123412342234, 9), -29.822227322);
64
+ });
65
+ it('rep -22233344455 => 12.8769568338', () => {
66
+ assert.equal(reputation(-22233344455, 10), 12.8769568338);
67
+ });
68
+ })
package/test/smt.test.js CHANGED
@@ -25,7 +25,7 @@ describe('steem.smt:', () => {
25
25
  }
26
26
 
27
27
  steem.api.callAsync('condenser_api.get_version', []).then((result) => {
28
- if(result['blockchain_version'] < '0.23.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
28
+ if(result['blockchain_version'] < '0.24.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
29
29
  result.should.have.property('blockchain_version');
30
30
 
31
31
  steem.broadcast._prepareTransaction(tx).then(function(tx){
@@ -57,7 +57,7 @@ describe('steem.smt:', () => {
57
57
  }
58
58
 
59
59
  steem.api.callAsync('condenser_api.get_version', []).then((result) => {
60
- if(result['blockchain_version'] < '0.23.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
60
+ if(result['blockchain_version'] < '0.24.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
61
61
  result.should.have.property('blockchain_version');
62
62
 
63
63
  steem.broadcast._prepareTransaction(tx).then(function(tx){
@@ -104,7 +104,7 @@ describe('steem.smt:', () => {
104
104
  }
105
105
 
106
106
  steem.api.callAsync('condenser_api.get_version', []).then((result) => {
107
- if(result['blockchain_version'] < '0.23.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
107
+ if(result['blockchain_version'] < '0.24.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
108
108
  result.should.have.property('blockchain_version');
109
109
 
110
110
  steem.broadcast._prepareTransaction(tx).then(function(tx){
@@ -147,7 +147,7 @@ describe('steem.smt:', () => {
147
147
  }
148
148
 
149
149
  steem.api.callAsync('condenser_api.get_version', []).then((result) => {
150
- if(result['blockchain_version'] < '0.23.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
150
+ if(result['blockchain_version'] < '0.24.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
151
151
  result.should.have.property('blockchain_version');
152
152
 
153
153
  steem.broadcast._prepareTransaction(tx).then(function(tx){
@@ -175,7 +175,7 @@ describe('steem.smt:', () => {
175
175
  }
176
176
 
177
177
  steem.api.callAsync('condenser_api.get_version', []).then((result) => {
178
- if(result['blockchain_version'] < '0.23.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
178
+ if(result['blockchain_version'] < '0.24.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
179
179
  result.should.have.property('blockchain_version');
180
180
 
181
181
  steem.broadcast._prepareTransaction(tx).then(function(tx){
@@ -204,7 +204,7 @@ describe('steem.smt:', () => {
204
204
  }
205
205
 
206
206
  steem.api.callAsync('condenser_api.get_version', []).then((result) => {
207
- if(result['blockchain_version'] < '0.23.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
207
+ if(result['blockchain_version'] < '0.24.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
208
208
  result.should.have.property('blockchain_version');
209
209
 
210
210
  steem.broadcast._prepareTransaction(tx).then(function(tx){
@@ -230,7 +230,7 @@ describe('steem.smt:', () => {
230
230
  }
231
231
 
232
232
  steem.api.callAsync('condenser_api.get_version', []).then((result) => {
233
- if(result['blockchain_version'] < '0.23.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
233
+ if(result['blockchain_version'] < '0.24.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
234
234
  result.should.have.property('blockchain_version');
235
235
 
236
236
  steem.broadcast._prepareTransaction(tx).then(function(tx){
@@ -265,7 +265,7 @@ describe('steem.smt:', () => {
265
265
  }
266
266
 
267
267
  steem.api.callAsync('condenser_api.get_version', []).then((result) => {
268
- if(result['blockchain_version'] < '0.23.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
268
+ if(result['blockchain_version'] < '0.24.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
269
269
  result.should.have.property('blockchain_version');
270
270
 
271
271
  steem.broadcast._prepareTransaction(tx).then(function(tx){
@@ -302,7 +302,7 @@ describe('steem.smt:', () => {
302
302
  }
303
303
 
304
304
  steem.api.callAsync('condenser_api.get_version', []).then((result) => {
305
- if(result['blockchain_version'] < '0.23.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
305
+ if(result['blockchain_version'] < '0.24.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
306
306
  result.should.have.property('blockchain_version');
307
307
 
308
308
  steem.broadcast._prepareTransaction(tx).then(function(tx){
@@ -331,7 +331,7 @@ describe('steem.smt:', () => {
331
331
  }
332
332
 
333
333
  steem.api.callAsync('condenser_api.get_version', []).then((result) => {
334
- if(result['blockchain_version'] < '0.23.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
334
+ if(result['blockchain_version'] < '0.24.0') return done(); /* SKIP AS THIS WILL ONLY PASS ON A TESTNET CURRENTLY */
335
335
  result.should.have.property('blockchain_version');
336
336
 
337
337
  steem.broadcast._prepareTransaction(tx).then(function(tx){
@@ -0,0 +1,19 @@
1
+ @echo off
2
+ REM Test GitHub Actions workflow locally using 'act'
3
+ REM Requires 'act' to be installed (https://github.com/nektos/act)
4
+ REM Install with: winget install nektos.act
5
+
6
+ echo Testing GitHub Actions workflow locally...
7
+ act -j node18 --container-architecture linux/amd64
8
+
9
+ REM Check the exit code to see if the workflow succeeded
10
+ if %ERRORLEVEL% EQU 0 (
11
+ echo ✅ Workflow test passed!
12
+ ) else (
13
+ echo ❌ Workflow test failed!
14
+ echo Error code: %ERRORLEVEL%
15
+ )
16
+
17
+ echo.
18
+ echo Press any key to close this window...
19
+ pause > nul
@@ -0,0 +1,15 @@
1
+ #!/bin/bash
2
+ # Test GitHub Actions workflow locally using 'act'
3
+ # Requires 'act' to be installed (https://github.com/nektos/act)
4
+ # Install with: curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
5
+
6
+ echo "Testing GitHub Actions workflow locally..."
7
+ act -j node18 --container-architecture linux/amd64
8
+
9
+ # Check the exit code to see if the workflow succeeded
10
+ if [ $? -eq 0 ]; then
11
+ echo "✅ Workflow test passed!"
12
+ else
13
+ echo "❌ Workflow test failed!"
14
+ exit 1
15
+ fi
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
- const Visualizer = require('webpack-visualizer-plugin');
2
+ // Removing the visualizer plugin import as it's not compatible with webpack 5
3
+ // const Visualizer = require('webpack-visualizer-plugin');
3
4
  const _ = require('lodash');
4
5
  const path = require('path');
5
6
  const webpack = require('webpack');
@@ -13,23 +14,15 @@ function makePlugins(options) {
13
14
  const isDevelopment = options.isDevelopment;
14
15
 
15
16
  let plugins = [
16
- new Visualizer({
17
- filename: './statistics.html'
17
+ // Add node polyfills for browser compatibility
18
+ new webpack.ProvidePlugin({
19
+ process: 'process/browser',
20
+ Buffer: ['buffer', 'Buffer'],
18
21
  }),
19
22
  ];
20
23
 
21
24
  if (!isDevelopment) {
22
25
  plugins = plugins.concat([
23
- new webpack.optimize.DedupePlugin(),
24
- new webpack.optimize.UglifyJsPlugin({
25
- output: {
26
- comments: false,
27
- },
28
- minimize: true,
29
- compress: {
30
- warnings: false,
31
- }
32
- }),
33
26
  new webpack.optimize.AggressiveMergingPlugin(),
34
27
  ]);
35
28
  }
@@ -70,7 +63,7 @@ function makeConfig(options) {
70
63
  const isDevelopment = options.isDevelopment;
71
64
 
72
65
  return {
73
- devtool: isDevelopment ? 'cheap-eval-source-map' : 'source-map',
66
+ devtool: isDevelopment ? 'eval-source-map' : 'source-map',
74
67
  entry: {
75
68
  steem: path.join(options.baseDir, 'src/browser.js'),
76
69
  'steem-tests': path.join(options.baseDir, 'test/api.test.js'),
@@ -81,17 +74,32 @@ function makeConfig(options) {
81
74
  },
82
75
  plugins: makePlugins(options),
83
76
  module: {
84
- loaders: [
77
+ rules: [
85
78
  {
86
79
  test: /\.js?$/,
87
- loader: 'babel',
80
+ use: 'babel-loader',
81
+ exclude: /node_modules/,
88
82
  },
89
83
  {
90
84
  test: /\.json?$/,
91
- loader: 'json',
85
+ type: 'json',
92
86
  },
93
87
  ],
94
88
  },
89
+ resolve: {
90
+ alias: {
91
+ '@exodus/bytebuffer': 'bytebuffer',
92
+ 'stream': 'stream-browserify',
93
+ 'path': 'path-browserify',
94
+ }
95
+ },
96
+ node: {
97
+ fs: 'empty',
98
+ crypto: 'empty',
99
+ },
100
+ optimization: {
101
+ minimize: !isDevelopment,
102
+ },
95
103
  };
96
104
  }
97
105
 
@@ -1,23 +0,0 @@
1
- version: 2
2
- jobs:
3
- build:
4
- docker:
5
- - image: docker:17-git
6
- steps:
7
- - checkout
8
- - setup_remote_docker
9
- - run:
10
- name: Build Docker image
11
- command: docker build -f node-6.dockerfile -t steemjs .
12
- - run:
13
- name: Save Docker image
14
- command: docker save -o steemjs.tar steemjs
15
- - persist_to_workspace:
16
- root: .
17
- paths:
18
- - steemjs.tar
19
- workflows:
20
- version: 2
21
- condenser:
22
- jobs:
23
- - build