@bitpay-labs/bitcore-wallet-service 11.11.0 → 11.11.2
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/Dockerfile +1 -1
- package/package.json +5 -5
- package/src/config.ts +0 -20
- package/src/externalservices/banxa.ts +51 -10
- package/src/externalservices/changelly.ts +54 -6
- package/src/externalservices/moonpay.ts +85 -19
- package/src/externalservices/oneInch.ts +13 -5
- package/src/externalservices/ramp.ts +42 -8
- package/src/externalservices/sardine.ts +51 -10
- package/src/externalservices/simplex.ts +58 -11
- package/src/externalservices/thorswap.ts +46 -11
- package/src/externalservices/transak.ts +53 -11
- package/src/lib/chain/btc/index.ts +3 -2
- package/src/lib/chain/eth/index.ts +134 -117
- package/src/lib/chain/sol/index.ts +1 -1
- package/src/lib/chain/xrp/index.ts +1 -1
- package/src/lib/routes/services.ts +0 -12
- package/src/lib/routes/wallets.ts +3 -1
- package/src/lib/server.ts +136 -91
- package/src/lib/storage.ts +90 -20
- package/src/types/externalservices.d.ts +0 -1
- package/test/chain/eth.test.ts +70 -0
- package/test/chain/sol.test.ts +1 -1
- package/test/chain/xrp.test.ts +1 -1
- package/test/expressapp.test.ts +144 -0
- package/test/integration/addressReads.test.ts +503 -0
- package/test/integration/bcmonitor.test.ts +44 -0
- package/test/integration/externalservices/banxa.test.ts +95 -5
- package/test/integration/externalservices/changelly.test.ts +118 -6
- package/test/integration/externalservices/coinGecko.test.ts +4 -0
- package/test/integration/externalservices/moonpay.test.ts +178 -9
- package/test/integration/externalservices/oneInch.test.ts +28 -1
- package/test/integration/externalservices/ramp.test.ts +126 -4
- package/test/integration/externalservices/sardine.test.ts +95 -5
- package/test/integration/externalservices/simplex.test.ts +95 -5
- package/test/integration/externalservices/thorswap.test.ts +81 -5
- package/test/integration/externalservices/transak.test.ts +98 -6
- package/test/integration/helpers.ts +1 -1
- package/test/integration/server.test.ts +254 -136
- package/test/integration/walletReads.test.ts +488 -0
- package/ts_build/package.json +3 -3
- package/ts_build/src/config.d.ts.map +1 -1
- package/ts_build/src/config.js +0 -4
- package/ts_build/src/config.js.map +1 -1
- package/ts_build/src/externalservices/banxa.d.ts.map +1 -1
- package/ts_build/src/externalservices/banxa.js +51 -10
- package/ts_build/src/externalservices/banxa.js.map +1 -1
- package/ts_build/src/externalservices/changelly.d.ts.map +1 -1
- package/ts_build/src/externalservices/changelly.js +54 -6
- package/ts_build/src/externalservices/changelly.js.map +1 -1
- package/ts_build/src/externalservices/moonpay.d.ts.map +1 -1
- package/ts_build/src/externalservices/moonpay.js +85 -19
- package/ts_build/src/externalservices/moonpay.js.map +1 -1
- package/ts_build/src/externalservices/oneInch.d.ts.map +1 -1
- package/ts_build/src/externalservices/oneInch.js +13 -5
- package/ts_build/src/externalservices/oneInch.js.map +1 -1
- package/ts_build/src/externalservices/ramp.d.ts.map +1 -1
- package/ts_build/src/externalservices/ramp.js +42 -8
- package/ts_build/src/externalservices/ramp.js.map +1 -1
- package/ts_build/src/externalservices/sardine.d.ts.map +1 -1
- package/ts_build/src/externalservices/sardine.js +51 -10
- package/ts_build/src/externalservices/sardine.js.map +1 -1
- package/ts_build/src/externalservices/simplex.d.ts.map +1 -1
- package/ts_build/src/externalservices/simplex.js +55 -11
- package/ts_build/src/externalservices/simplex.js.map +1 -1
- package/ts_build/src/externalservices/thorswap.d.ts.map +1 -1
- package/ts_build/src/externalservices/thorswap.js +45 -11
- package/ts_build/src/externalservices/thorswap.js.map +1 -1
- package/ts_build/src/externalservices/transak.d.ts.map +1 -1
- package/ts_build/src/externalservices/transak.js +53 -11
- package/ts_build/src/externalservices/transak.js.map +1 -1
- package/ts_build/src/lib/chain/btc/index.d.ts.map +1 -1
- package/ts_build/src/lib/chain/btc/index.js +3 -2
- package/ts_build/src/lib/chain/btc/index.js.map +1 -1
- package/ts_build/src/lib/chain/eth/index.d.ts +8 -1
- package/ts_build/src/lib/chain/eth/index.d.ts.map +1 -1
- package/ts_build/src/lib/chain/eth/index.js +114 -102
- package/ts_build/src/lib/chain/eth/index.js.map +1 -1
- package/ts_build/src/lib/chain/sol/index.js +1 -1
- package/ts_build/src/lib/chain/sol/index.js.map +1 -1
- package/ts_build/src/lib/chain/xrp/index.js +1 -1
- package/ts_build/src/lib/chain/xrp/index.js.map +1 -1
- package/ts_build/src/lib/routes/services.d.ts.map +1 -1
- package/ts_build/src/lib/routes/services.js +0 -10
- package/ts_build/src/lib/routes/services.js.map +1 -1
- package/ts_build/src/lib/routes/wallets.d.ts.map +1 -1
- package/ts_build/src/lib/routes/wallets.js +2 -1
- package/ts_build/src/lib/routes/wallets.js.map +1 -1
- package/ts_build/src/lib/server.d.ts +1 -3
- package/ts_build/src/lib/server.d.ts.map +1 -1
- package/ts_build/src/lib/server.js +128 -96
- package/ts_build/src/lib/server.js.map +1 -1
- package/ts_build/src/lib/storage.d.ts +17 -10
- package/ts_build/src/lib/storage.d.ts.map +1 -1
- package/ts_build/src/lib/storage.js +73 -20
- package/ts_build/src/lib/storage.js.map +1 -1
- package/ts_build/test/chain/eth.test.js +59 -0
- package/ts_build/test/chain/eth.test.js.map +1 -1
- package/ts_build/test/chain/sol.test.js +1 -1
- package/ts_build/test/chain/sol.test.js.map +1 -1
- package/ts_build/test/chain/xrp.test.js +1 -1
- package/ts_build/test/chain/xrp.test.js.map +1 -1
- package/ts_build/test/expressapp.test.js +132 -0
- package/ts_build/test/expressapp.test.js.map +1 -1
- package/ts_build/test/integration/addressReads.test.d.ts +2 -0
- package/ts_build/test/integration/addressReads.test.d.ts.map +1 -0
- package/ts_build/test/integration/addressReads.test.js +465 -0
- package/ts_build/test/integration/addressReads.test.js.map +1 -0
- package/ts_build/test/integration/bcmonitor.test.js +40 -0
- package/ts_build/test/integration/bcmonitor.test.js.map +1 -1
- package/ts_build/test/integration/externalservices/banxa.test.d.ts.map +1 -1
- package/ts_build/test/integration/externalservices/banxa.test.js +93 -5
- package/ts_build/test/integration/externalservices/banxa.test.js.map +1 -1
- package/ts_build/test/integration/externalservices/changelly.test.d.ts.map +1 -1
- package/ts_build/test/integration/externalservices/changelly.test.js +111 -6
- package/ts_build/test/integration/externalservices/changelly.test.js.map +1 -1
- package/ts_build/test/integration/externalservices/coinGecko.test.js +4 -0
- package/ts_build/test/integration/externalservices/coinGecko.test.js.map +1 -1
- package/ts_build/test/integration/externalservices/moonpay.test.d.ts.map +1 -1
- package/ts_build/test/integration/externalservices/moonpay.test.js +169 -9
- package/ts_build/test/integration/externalservices/moonpay.test.js.map +1 -1
- package/ts_build/test/integration/externalservices/oneInch.test.d.ts.map +1 -1
- package/ts_build/test/integration/externalservices/oneInch.test.js +26 -1
- package/ts_build/test/integration/externalservices/oneInch.test.js.map +1 -1
- package/ts_build/test/integration/externalservices/ramp.test.d.ts.map +1 -1
- package/ts_build/test/integration/externalservices/ramp.test.js +115 -4
- package/ts_build/test/integration/externalservices/ramp.test.js.map +1 -1
- package/ts_build/test/integration/externalservices/sardine.test.d.ts.map +1 -1
- package/ts_build/test/integration/externalservices/sardine.test.js +94 -5
- package/ts_build/test/integration/externalservices/sardine.test.js.map +1 -1
- package/ts_build/test/integration/externalservices/simplex.test.d.ts.map +1 -1
- package/ts_build/test/integration/externalservices/simplex.test.js +89 -5
- package/ts_build/test/integration/externalservices/simplex.test.js.map +1 -1
- package/ts_build/test/integration/externalservices/thorswap.test.d.ts.map +1 -1
- package/ts_build/test/integration/externalservices/thorswap.test.js +76 -5
- package/ts_build/test/integration/externalservices/thorswap.test.js.map +1 -1
- package/ts_build/test/integration/externalservices/transak.test.d.ts.map +1 -1
- package/ts_build/test/integration/externalservices/transak.test.js +93 -6
- package/ts_build/test/integration/externalservices/transak.test.js.map +1 -1
- package/ts_build/test/integration/helpers.js +1 -1
- package/ts_build/test/integration/helpers.js.map +1 -1
- package/ts_build/test/integration/server.test.js +225 -124
- package/ts_build/test/integration/server.test.js.map +1 -1
- package/ts_build/test/integration/walletReads.test.d.ts +2 -0
- package/ts_build/test/integration/walletReads.test.d.ts.map +1 -0
- package/ts_build/test/integration/walletReads.test.js +436 -0
- package/ts_build/test/integration/walletReads.test.js.map +1 -0
- package/src/externalservices/wyre.ts +0 -131
- package/test/integration/externalservices/wyre.test.ts +0 -270
- package/ts_build/src/externalservices/wyre.d.ts +0 -7
- package/ts_build/src/externalservices/wyre.d.ts.map +0 -1
- package/ts_build/src/externalservices/wyre.js +0 -144
- package/ts_build/src/externalservices/wyre.js.map +0 -1
- package/ts_build/test/integration/externalservices/wyre.test.d.ts +0 -2
- package/ts_build/test/integration/externalservices/wyre.test.d.ts.map +0 -1
- package/ts_build/test/integration/externalservices/wyre.test.js +0 -281
- package/ts_build/test/integration/externalservices/wyre.test.js.map +0 -1
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
import * as chai from 'chai';
|
|
4
|
+
import * as sinon from 'sinon';
|
|
4
5
|
import 'chai/register-should';
|
|
5
6
|
import util from 'util';
|
|
6
7
|
import { WalletService } from '../../../src/lib/server';
|
|
7
8
|
import * as TestData from '../../testdata';
|
|
8
9
|
import helpers from '../helpers';
|
|
9
10
|
import config from '../../../src/config';
|
|
11
|
+
import logger from '../../../src/lib/logger';
|
|
10
12
|
|
|
11
13
|
const should = chai.should();
|
|
12
14
|
|
|
13
15
|
describe('Thorswap integration', () => {
|
|
16
|
+
const sandbox = sinon.createSandbox();
|
|
14
17
|
let server;
|
|
15
18
|
let wallet;
|
|
16
19
|
let fakeRequest;
|
|
17
20
|
let req;
|
|
21
|
+
let loggerError: sinon.SinonStub;
|
|
18
22
|
|
|
19
23
|
before(async () => {
|
|
20
24
|
await helpers.before();
|
|
@@ -50,7 +54,7 @@ describe('Thorswap integration', () => {
|
|
|
50
54
|
};
|
|
51
55
|
|
|
52
56
|
fakeRequest = {
|
|
53
|
-
get: (_url, _opts, _cb) => { return _cb(null, {
|
|
57
|
+
get: (_url, _opts, _cb) => { return _cb(null, { body: 'data' }); },
|
|
54
58
|
post: (_url, _opts, _cb) => { return _cb(null, { body: 'data' }); },
|
|
55
59
|
};
|
|
56
60
|
|
|
@@ -67,6 +71,12 @@ describe('Thorswap integration', () => {
|
|
|
67
71
|
clientVersion: 'bwc-2.0.0',
|
|
68
72
|
walletId: '123',
|
|
69
73
|
}));
|
|
74
|
+
sandbox.stub(logger, 'warn');
|
|
75
|
+
loggerError = sandbox.stub(logger, 'error');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
afterEach(() => {
|
|
79
|
+
sandbox.restore();
|
|
70
80
|
});
|
|
71
81
|
|
|
72
82
|
after(async () => {
|
|
@@ -112,7 +122,23 @@ describe('Thorswap integration', () => {
|
|
|
112
122
|
await server.externalServices.thorswap.thorswapGetSupportedChains(req);
|
|
113
123
|
should.fail('should have thrown');
|
|
114
124
|
} catch (err) {
|
|
115
|
-
|
|
125
|
+
loggerError.callCount.should.equal(1);
|
|
126
|
+
loggerError.args[0][0].should.contain('Thorswap request failed with error (');
|
|
127
|
+
err.message.should.equal('Failed to get Thorswap supported chains');
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('should return error and not leak the response if body is empty', async () => {
|
|
132
|
+
const fakeRequest2 = {
|
|
133
|
+
get: (_url, opts, cb) => { return cb(null, { statusCode: 200, body: undefined, request: { headers: opts.headers } }); },
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
server.externalServices.thorswap.request = fakeRequest2;
|
|
137
|
+
try {
|
|
138
|
+
await server.externalServices.thorswap.thorswapGetSupportedChains(req);
|
|
139
|
+
should.fail('should have thrown');
|
|
140
|
+
} catch (err) {
|
|
141
|
+
err.message.should.equal('Thorswap did not return supported chains');
|
|
116
142
|
}
|
|
117
143
|
});
|
|
118
144
|
|
|
@@ -173,7 +199,23 @@ describe('Thorswap integration', () => {
|
|
|
173
199
|
await server.externalServices.thorswap.thorswapGetCryptoCurrencies(req);
|
|
174
200
|
should.fail('should have thrown');
|
|
175
201
|
} catch (err) {
|
|
176
|
-
|
|
202
|
+
loggerError.callCount.should.equal(1);
|
|
203
|
+
loggerError.args[0][0].should.contain('Thorswap request failed with error (');
|
|
204
|
+
err.message.should.equal('Failed to get Thorswap supported currencies');
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it('should return error and not leak the response if body is empty', async () => {
|
|
209
|
+
const fakeRequest2 = {
|
|
210
|
+
get: (_url, opts, cb) => { return cb(null, { statusCode: 200, body: undefined, request: { headers: opts.headers } }); },
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
server.externalServices.thorswap.request = fakeRequest2;
|
|
214
|
+
try {
|
|
215
|
+
await server.externalServices.thorswap.thorswapGetCryptoCurrencies(req);
|
|
216
|
+
should.fail('should have thrown');
|
|
217
|
+
} catch (err) {
|
|
218
|
+
err.message.should.equal('Thorswap did not return supported currencies');
|
|
177
219
|
}
|
|
178
220
|
});
|
|
179
221
|
|
|
@@ -230,7 +272,24 @@ describe('Thorswap integration', () => {
|
|
|
230
272
|
await server.externalServices.thorswap.thorswapGetSwapQuote(req);
|
|
231
273
|
should.fail('should have thrown');
|
|
232
274
|
} catch (err) {
|
|
233
|
-
|
|
275
|
+
loggerError.callCount.should.equal(1);
|
|
276
|
+
loggerError.args[0][0].should.contain('Thorswap request failed with error (');
|
|
277
|
+
err.message.should.equal('Failed to get Thorswap swap quote');
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
it('should return error and not leak the response if body is empty', async () => {
|
|
282
|
+
req.body.sellAmount = '1.123';
|
|
283
|
+
const fakeRequest2 = {
|
|
284
|
+
get: (_url, opts, cb) => { return cb(null, { statusCode: 200, body: undefined, request: { headers: opts.headers } }); },
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
server.externalServices.thorswap.request = fakeRequest2;
|
|
288
|
+
try {
|
|
289
|
+
await server.externalServices.thorswap.thorswapGetSwapQuote(req);
|
|
290
|
+
should.fail('should have thrown');
|
|
291
|
+
} catch (err) {
|
|
292
|
+
err.message.should.equal('Thorswap did not return a swap quote');
|
|
234
293
|
}
|
|
235
294
|
});
|
|
236
295
|
|
|
@@ -292,7 +351,24 @@ describe('Thorswap integration', () => {
|
|
|
292
351
|
await server.externalServices.thorswap.thorswapGetSwapTx(req);
|
|
293
352
|
should.fail('should have thrown');
|
|
294
353
|
} catch (err) {
|
|
295
|
-
|
|
354
|
+
loggerError.callCount.should.equal(1);
|
|
355
|
+
loggerError.args[0][0].should.contain('Thorswap request failed with error (');
|
|
356
|
+
err.message.should.equal('Failed to get Thorswap swap transaction');
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
it('should return error and not leak the response if body is empty', async() => {
|
|
361
|
+
req.body.txn = 'txn1';
|
|
362
|
+
const fakeRequest2 = {
|
|
363
|
+
post: (_url, opts, cb) => { return cb(null, { statusCode: 200, body: undefined, request: { headers: opts.headers } }); },
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
server.externalServices.thorswap.request = fakeRequest2;
|
|
367
|
+
try {
|
|
368
|
+
await server.externalServices.thorswap.thorswapGetSwapTx(req);
|
|
369
|
+
should.fail('should have thrown');
|
|
370
|
+
} catch (err) {
|
|
371
|
+
err.message.should.equal('Thorswap did not return a swap transaction');
|
|
296
372
|
}
|
|
297
373
|
});
|
|
298
374
|
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
import * as chai from 'chai';
|
|
4
|
+
import * as sinon from 'sinon';
|
|
4
5
|
import 'chai/register-should';
|
|
5
6
|
import util from 'util';
|
|
6
7
|
import { WalletService } from '../../../src/lib/server';
|
|
7
8
|
import * as TestData from '../../testdata';
|
|
8
9
|
import helpers from '../helpers';
|
|
9
10
|
import config from '../../../src/config';
|
|
11
|
+
import logger from '../../../src/lib/logger';
|
|
10
12
|
|
|
11
13
|
const should = chai.should();
|
|
12
14
|
|
|
13
15
|
describe('Transak integration', () => {
|
|
16
|
+
const sandbox = sinon.createSandbox();
|
|
14
17
|
let server;
|
|
15
18
|
let wallet;
|
|
16
19
|
let fakeRequest;
|
|
17
20
|
let req;
|
|
21
|
+
let loggerError: sinon.SinonStub;
|
|
18
22
|
|
|
19
23
|
before(async () => {
|
|
20
24
|
await helpers.before();
|
|
@@ -66,6 +70,12 @@ describe('Transak integration', () => {
|
|
|
66
70
|
clientVersion: 'bwc-2.0.0',
|
|
67
71
|
walletId: '123',
|
|
68
72
|
}));
|
|
73
|
+
sandbox.stub(logger, 'warn');
|
|
74
|
+
loggerError = sandbox.stub(logger, 'error');
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
afterEach(() => {
|
|
78
|
+
sandbox.restore();
|
|
69
79
|
});
|
|
70
80
|
|
|
71
81
|
after(async () => {
|
|
@@ -118,7 +128,23 @@ describe('Transak integration', () => {
|
|
|
118
128
|
await server.externalServices.transak.transakGetAccessToken(req);
|
|
119
129
|
should.fail('should have thrown');
|
|
120
130
|
} catch (err) {
|
|
121
|
-
|
|
131
|
+
loggerError.callCount.should.equal(1);
|
|
132
|
+
loggerError.args[0][0].should.contain('Transak request failed with error (');
|
|
133
|
+
err.message.should.equal('Failed to get Transak access token');
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('should return error and not leak the response if body is empty', async () => {
|
|
138
|
+
const fakeRequest2 = {
|
|
139
|
+
post: (_url, opts, cb) => { return cb(null, { statusCode: 200, body: undefined, request: { headers: opts.headers } }); },
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
server.externalServices.transak.request = fakeRequest2;
|
|
143
|
+
try {
|
|
144
|
+
await server.externalServices.transak.transakGetAccessToken(req);
|
|
145
|
+
should.fail('should have thrown');
|
|
146
|
+
} catch (err) {
|
|
147
|
+
err.message.should.equal('Transak did not return an access token');
|
|
122
148
|
}
|
|
123
149
|
});
|
|
124
150
|
|
|
@@ -166,7 +192,23 @@ describe('Transak integration', () => {
|
|
|
166
192
|
await server.externalServices.transak.transakGetCryptoCurrencies(req);
|
|
167
193
|
should.fail('should have thrown');
|
|
168
194
|
} catch (err) {
|
|
169
|
-
|
|
195
|
+
loggerError.callCount.should.equal(1);
|
|
196
|
+
loggerError.args[0][0].should.contain('Transak request failed with error (');
|
|
197
|
+
err.message.should.equal('Failed to get Transak supported currencies');
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it('should return error and not leak the response if body is empty', async () => {
|
|
202
|
+
const fakeRequest2 = {
|
|
203
|
+
get: (_url, opts, cb) => { return cb(null, { statusCode: 200, body: undefined, request: { headers: opts.headers } }); },
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
server.externalServices.transak.request = fakeRequest2;
|
|
207
|
+
try {
|
|
208
|
+
await server.externalServices.transak.transakGetCryptoCurrencies(req);
|
|
209
|
+
should.fail('should have thrown');
|
|
210
|
+
} catch (err) {
|
|
211
|
+
err.message.should.equal('Transak did not return supported currencies');
|
|
170
212
|
}
|
|
171
213
|
});
|
|
172
214
|
|
|
@@ -214,7 +256,23 @@ describe('Transak integration', () => {
|
|
|
214
256
|
await server.externalServices.transak.transakGetFiatCurrencies(req);
|
|
215
257
|
should.fail('should have thrown');
|
|
216
258
|
} catch (err) {
|
|
217
|
-
|
|
259
|
+
loggerError.callCount.should.equal(1);
|
|
260
|
+
loggerError.args[0][0].should.contain('Transak request failed with error (');
|
|
261
|
+
err.message.should.equal('Failed to get Transak supported fiat currencies');
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
it('should return error and not leak the response if body is empty', async () => {
|
|
266
|
+
const fakeRequest2 = {
|
|
267
|
+
get: (_url, opts, cb) => { return cb(null, { statusCode: 200, body: undefined, request: { headers: opts.headers } }); },
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
server.externalServices.transak.request = fakeRequest2;
|
|
271
|
+
try {
|
|
272
|
+
await server.externalServices.transak.transakGetFiatCurrencies(req);
|
|
273
|
+
should.fail('should have thrown');
|
|
274
|
+
} catch (err) {
|
|
275
|
+
err.message.should.equal('Transak did not return supported fiat currencies');
|
|
218
276
|
}
|
|
219
277
|
});
|
|
220
278
|
|
|
@@ -266,7 +324,23 @@ describe('Transak integration', () => {
|
|
|
266
324
|
await server.externalServices.transak.transakGetQuote(req);
|
|
267
325
|
should.fail('should have thrown');
|
|
268
326
|
} catch (err) {
|
|
269
|
-
|
|
327
|
+
loggerError.callCount.should.equal(1);
|
|
328
|
+
loggerError.args[0][0].should.contain('Transak request failed with error (');
|
|
329
|
+
err.message.should.equal('Failed to get Transak quote');
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
it('should return error and not leak the response if body is empty', async () => {
|
|
334
|
+
const fakeRequest2 = {
|
|
335
|
+
get: (_url, opts, cb) => { return cb(null, { statusCode: 200, body: undefined, request: { headers: opts.headers } }); },
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
server.externalServices.transak.request = fakeRequest2;
|
|
339
|
+
try {
|
|
340
|
+
await server.externalServices.transak.transakGetQuote(req);
|
|
341
|
+
should.fail('should have thrown');
|
|
342
|
+
} catch (err) {
|
|
343
|
+
err.message.should.equal('Transak did not return a quote');
|
|
270
344
|
}
|
|
271
345
|
});
|
|
272
346
|
|
|
@@ -427,7 +501,9 @@ describe('Transak integration', () => {
|
|
|
427
501
|
await server.externalServices.transak.transakGetSignedPaymentUrl(req);
|
|
428
502
|
should.fail('should have thrown');
|
|
429
503
|
} catch (err) {
|
|
430
|
-
|
|
504
|
+
loggerError.callCount.should.equal(1);
|
|
505
|
+
loggerError.args[0][0].should.contain('Transak request failed with error (');
|
|
506
|
+
err.message.should.equal('Failed to get Transak signed payment URL');
|
|
431
507
|
}
|
|
432
508
|
});
|
|
433
509
|
|
|
@@ -477,7 +553,23 @@ describe('Transak integration', () => {
|
|
|
477
553
|
await server.externalServices.transak.transakGetOrderDetails(req);
|
|
478
554
|
should.fail('should have thrown');
|
|
479
555
|
} catch (err) {
|
|
480
|
-
|
|
556
|
+
loggerError.callCount.should.equal(1);
|
|
557
|
+
loggerError.args[0][0].should.contain('Transak request failed with error (');
|
|
558
|
+
err.message.should.equal('Failed to get Transak order details');
|
|
559
|
+
};
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
it('should return error and not leak the response if body is empty', async () => {
|
|
563
|
+
const fakeRequest2 = {
|
|
564
|
+
get: (_url, opts, cb) => { return cb(null, { statusCode: 200, body: undefined, request: { headers: opts.headers } }); },
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
server.externalServices.transak.request = fakeRequest2;
|
|
568
|
+
try {
|
|
569
|
+
await server.externalServices.transak.transakGetOrderDetails(req);
|
|
570
|
+
should.fail('should have thrown');
|
|
571
|
+
} catch (err) {
|
|
572
|
+
err.message.should.equal('Transak did not return order details');
|
|
481
573
|
};
|
|
482
574
|
});
|
|
483
575
|
|
|
@@ -253,7 +253,7 @@ class Helpers {
|
|
|
253
253
|
if ([true, false].includes(opts.supportBIP44AndP2PKH))
|
|
254
254
|
walletOpts.supportBIP44AndP2PKH = opts.supportBIP44AndP2PKH;
|
|
255
255
|
|
|
256
|
-
const walletId = await
|
|
256
|
+
const walletId = await new Promise((resolve, reject) => server.createWallet(walletOpts, (err, walletId) => err ? reject(err) : resolve(walletId)));
|
|
257
257
|
|
|
258
258
|
for (let i = 0; i < n; i++) {
|
|
259
259
|
const copayerData = TestData.copayers[i + offset];
|