@bitpay-labs/bitcore-wallet-service 11.10.11 → 11.10.13

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 (82) hide show
  1. package/package.json +4 -4
  2. package/src/externalservices/moonpay.ts +2 -1
  3. package/src/externalservices/simplex.ts +0 -30
  4. package/src/lib/chain/btc/index.ts +12 -7
  5. package/src/lib/chain/eth/index.ts +5 -1
  6. package/src/lib/chain/index.ts +4 -0
  7. package/src/lib/chain/sol/index.ts +51 -3
  8. package/src/lib/chain/xrp/index.ts +7 -2
  9. package/src/lib/common/defaults.ts +6 -0
  10. package/src/lib/common/utils.ts +52 -1
  11. package/src/lib/errors/errordefinitions.ts +5 -0
  12. package/src/lib/model/txproposal.ts +39 -11
  13. package/src/lib/routes/context.ts +3 -1
  14. package/src/lib/routes/helpers/error.ts +2 -2
  15. package/src/lib/routes/middleware/authTssRequest.ts +1 -1
  16. package/src/lib/routes/services.ts +1 -14
  17. package/src/lib/routes/transactions.ts +5 -5
  18. package/src/lib/routes/wallets.ts +2 -2
  19. package/src/lib/server.ts +11 -4
  20. package/src/types/chain.d.ts +1 -0
  21. package/src/types/expressapp.d.ts +1 -1
  22. package/test/chain/btc.test.ts +32 -0
  23. package/test/chain/eth.test.ts +43 -0
  24. package/test/chain/sol.test.ts +229 -0
  25. package/test/chain/xrp.test.ts +51 -0
  26. package/test/integration/externalservices/moonpay.test.ts +29 -0
  27. package/test/integration/externalservices/simplex.test.ts +0 -18
  28. package/test/integration/server.test.ts +193 -0
  29. package/test/integration/tss.test.ts +67 -0
  30. package/test/model/txproposal.test.ts +118 -0
  31. package/test/numberformat-routes.test.ts +88 -0
  32. package/ts_build/package.json +3 -3
  33. package/ts_build/src/externalservices/simplex.d.ts +0 -1
  34. package/ts_build/src/externalservices/simplex.d.ts.map +1 -1
  35. package/ts_build/src/externalservices/simplex.js +0 -25
  36. package/ts_build/src/externalservices/simplex.js.map +1 -1
  37. package/ts_build/src/lib/chain/btc/index.d.ts +2 -1
  38. package/ts_build/src/lib/chain/btc/index.d.ts.map +1 -1
  39. package/ts_build/src/lib/chain/btc/index.js +3 -0
  40. package/ts_build/src/lib/chain/btc/index.js.map +1 -1
  41. package/ts_build/src/lib/chain/eth/index.d.ts +1 -0
  42. package/ts_build/src/lib/chain/eth/index.d.ts.map +1 -1
  43. package/ts_build/src/lib/chain/eth/index.js +3 -0
  44. package/ts_build/src/lib/chain/eth/index.js.map +1 -1
  45. package/ts_build/src/lib/chain/index.d.ts +1 -0
  46. package/ts_build/src/lib/chain/index.d.ts.map +1 -1
  47. package/ts_build/src/lib/chain/index.js +3 -0
  48. package/ts_build/src/lib/chain/index.js.map +1 -1
  49. package/ts_build/src/lib/chain/sol/index.d.ts +1 -0
  50. package/ts_build/src/lib/chain/sol/index.d.ts.map +1 -1
  51. package/ts_build/src/lib/chain/sol/index.js +5 -0
  52. package/ts_build/src/lib/chain/sol/index.js.map +1 -1
  53. package/ts_build/src/lib/chain/xrp/index.d.ts +1 -0
  54. package/ts_build/src/lib/chain/xrp/index.d.ts.map +1 -1
  55. package/ts_build/src/lib/chain/xrp/index.js +4 -0
  56. package/ts_build/src/lib/chain/xrp/index.js.map +1 -1
  57. package/ts_build/src/lib/common/index.d.ts +2 -0
  58. package/ts_build/src/lib/common/index.d.ts.map +1 -1
  59. package/ts_build/src/lib/common/utils.d.ts +4 -0
  60. package/ts_build/src/lib/common/utils.d.ts.map +1 -1
  61. package/ts_build/src/lib/common/utils.js +33 -0
  62. package/ts_build/src/lib/common/utils.js.map +1 -1
  63. package/ts_build/src/lib/routes/middleware/authTssRequest.js +1 -1
  64. package/ts_build/src/lib/routes/middleware/authTssRequest.js.map +1 -1
  65. package/ts_build/src/lib/routes/services.d.ts.map +1 -1
  66. package/ts_build/src/lib/routes/services.js +1 -13
  67. package/ts_build/src/lib/routes/services.js.map +1 -1
  68. package/ts_build/src/lib/server.d.ts.map +1 -1
  69. package/ts_build/src/lib/server.js +1 -1
  70. package/ts_build/src/lib/server.js.map +1 -1
  71. package/ts_build/test/chain/sol.test.d.ts +2 -0
  72. package/ts_build/test/chain/sol.test.d.ts.map +1 -0
  73. package/ts_build/test/chain/sol.test.js +78 -0
  74. package/ts_build/test/chain/sol.test.js.map +1 -0
  75. package/ts_build/test/chain/xrp.test.js +28 -0
  76. package/ts_build/test/chain/xrp.test.js.map +1 -1
  77. package/ts_build/test/integration/externalservices/simplex.test.js +0 -15
  78. package/ts_build/test/integration/externalservices/simplex.test.js.map +1 -1
  79. package/ts_build/test/integration/server.test.js +80 -0
  80. package/ts_build/test/integration/server.test.js.map +1 -1
  81. package/ts_build/test/integration/tss.test.js +57 -0
  82. package/ts_build/test/integration/tss.test.js.map +1 -1
@@ -12,6 +12,7 @@ import config from '../../src/config';
12
12
  import { WalletService, UPGRADES } from '../../src/lib/server';
13
13
  import { Storage } from '../../src/lib/storage';
14
14
  import { Common } from '../../src/lib/common';
15
+ import logger from '../../src/lib/logger';
15
16
  import * as Model from '../../src/lib/model';
16
17
  import { TssKeyGenModel } from '../../src/lib/model/tsskeygen';
17
18
  import { BCHAddressTranslator } from '../../src/lib/bchaddresstranslator';
@@ -3934,6 +3935,45 @@ describe('Wallet service', function() {
3934
3935
  });
3935
3936
  });
3936
3937
 
3938
+ describe('#createTx token allowance', function() {
3939
+ let server: WalletService;
3940
+ let wallet: Model.Wallet;
3941
+
3942
+ beforeEach(async function() {
3943
+ ({ server, wallet } = await helpers.createAndJoinWallet(1, 1, { coin: 'eth' }));
3944
+ await util.promisify(server.createAddress).call(server, {});
3945
+ });
3946
+
3947
+ it('should reject a total that a number rounds down to the allowance', async function() {
3948
+ const be = helpers.getBlockchainExplorer();
3949
+ be.getBalance = sinon.stub().callsArgWith(1, null, { unconfirmed: 0, confirmed: '1' + '0'.repeat(20), balance: '1' + '0'.repeat(20) });
3950
+ be.getTokenAllowance = sinon.stub().callsArgWith(1, null, '9007199254740992');
3951
+
3952
+ const opts = {
3953
+ outputs: [
3954
+ { toAddress: '0x37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A', amount: '9007199254740992' },
3955
+ { toAddress: '0x37d7B3bBD88EFdE6a93cF74D2F5b0385D3E3B08A', amount: '1' }
3956
+ ],
3957
+ from: '0xE299d49C2cf9BfaFb7C6E861E80bb8c83f961622',
3958
+ tokenAddress: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
3959
+ multiSendContractAddress: '0x30e5bfa1e83c9c6f0a4c4bd4a1f0e0d7d0c4d3a2',
3960
+ feePerKb: 25000000000,
3961
+ nonce: 5
3962
+ };
3963
+
3964
+ let error;
3965
+ try {
3966
+ await util.promisify(server.createTx).call(server, opts);
3967
+ } catch (e) {
3968
+ error = e;
3969
+ }
3970
+
3971
+ should.exist(error);
3972
+ error.message.should.contain('Insufficient token allowance');
3973
+ error.message.should.contain('Want: 9007199254740993');
3974
+ });
3975
+ });
3976
+
3937
3977
  const testSet = [
3938
3978
  {
3939
3979
  coin: 'btc',
@@ -8389,6 +8429,66 @@ describe('Wallet service', function() {
8389
8429
  txp.nonce.should.equal('5');
8390
8430
  });
8391
8431
 
8432
+ describe('republishing a txp with mutable tx data', function() {
8433
+ let txp, publishOpts;
8434
+
8435
+ beforeEach(async function() {
8436
+ txp = await util.promisify(server.createTx).call(server, {
8437
+ outputs: [{ toAddress: ETH_ADDR, amount: 8000 }],
8438
+ feePerKb: 123e2,
8439
+ from: fromAddr,
8440
+ deferNonce: true
8441
+ });
8442
+ publishOpts = helpers.getProposalSignatureOpts(txp, TestData.copayers[0].privKey_1H_0);
8443
+ await util.promisify(server.publishTx).call(server, publishOpts);
8444
+ });
8445
+
8446
+ const setStatus = async status => {
8447
+ const stored = await util.promisify(server.storage.fetchTx).call(server.storage, wallet.id, txp.id);
8448
+ stored.status = status;
8449
+ await util.promisify(server.storage.storeTx).call(server.storage, wallet.id, stored);
8450
+ };
8451
+
8452
+ const republishError = async () => {
8453
+ try {
8454
+ await util.promisify(server.publishTx).call(server, publishOpts);
8455
+ } catch (err) {
8456
+ return err;
8457
+ }
8458
+ };
8459
+
8460
+ it('should republish a pending txp', async function() {
8461
+ should.not.exist(await republishError());
8462
+ const stored = await util.promisify(server.storage.fetchTx).call(server.storage, wallet.id, txp.id);
8463
+ stored.status.should.equal('pending');
8464
+ });
8465
+
8466
+ it('should not republish a broadcasted txp back to pending', async function() {
8467
+ await setStatus('broadcasted');
8468
+ const err = await republishError();
8469
+ should.exist(err);
8470
+ err.code.should.equal('TX_ALREADY_BROADCASTED');
8471
+ const stored = await util.promisify(server.storage.fetchTx).call(server.storage, wallet.id, txp.id);
8472
+ stored.status.should.equal('broadcasted');
8473
+ });
8474
+
8475
+ it('should not republish an accepted txp back to pending', async function() {
8476
+ await setStatus('accepted');
8477
+ const err = await republishError();
8478
+ should.exist(err);
8479
+ err.code.should.equal('TX_NOT_PENDING');
8480
+ const stored = await util.promisify(server.storage.fetchTx).call(server.storage, wallet.id, txp.id);
8481
+ stored.status.should.equal('accepted');
8482
+ });
8483
+
8484
+ it('should not republish a rejected txp back to pending', async function() {
8485
+ await setStatus('rejected');
8486
+ const err = await republishError();
8487
+ should.exist(err);
8488
+ err.code.should.equal('TX_NOT_PENDING');
8489
+ });
8490
+ });
8491
+
8392
8492
  it('should publish a deferred-nonce txp and save prePublishRaw', async function() {
8393
8493
  const txOpts = {
8394
8494
  outputs: [{ toAddress: ETH_ADDR, amount: 8000 }],
@@ -8821,6 +8921,85 @@ describe('Wallet service', function() {
8821
8921
  result.nonce.should.equal(5);
8822
8922
  // future: result.gasPrice, result.maxFee would also be set here
8823
8923
  });
8924
+
8925
+ describe('prePublishRaw binding (isPrePublishRawBound)', function() {
8926
+ const ATTACKER_ADDR = '0x1111111111111111111111111111111111111111';
8927
+
8928
+ it('accepts prePublishRaw when only the mutable field (nonce) changed', async function() {
8929
+ blockchainExplorer.getTransactionCount = sinon.stub().callsArgWith(1, null, '42');
8930
+ const created = await helpers.createAndPublishTx(server, {
8931
+ outputs: [{ toAddress: ETH_ADDR, amount: 8000 }],
8932
+ feePerKb: 123e2, from: fromAddr, deferNonce: true
8933
+ }, TestData.copayers[0].privKey_1H_0);
8934
+
8935
+ // Server assigns the JIT nonce -> the stored tx now differs from prePublishRaw only in the nonce.
8936
+ await util.promisify(server.prepareTx).call(server, { txProposalId: created.id });
8937
+ const withNonce = await util.promisify(server.getTx).call(server, { txProposalId: created.id });
8938
+ should.exist(withNonce.prePublishRaw);
8939
+ withNonce.nonce.should.equal(42);
8940
+
8941
+ ChainService.isPrePublishRawBound(withNonce).should.equal(true);
8942
+ });
8943
+
8944
+ it('rejects prePublishRaw when the destination was tampered', async function() {
8945
+ const created = await helpers.createAndPublishTx(server, {
8946
+ outputs: [{ toAddress: ETH_ADDR, amount: 8000 }],
8947
+ feePerKb: 123e2, from: fromAddr, deferNonce: true
8948
+ }, TestData.copayers[0].privKey_1H_0);
8949
+
8950
+ const txp = await util.promisify(server.getTx).call(server, { txProposalId: created.id });
8951
+ should.exist(txp.prePublishRaw);
8952
+ ChainService.isPrePublishRawBound(txp).should.equal(true); // bound before tampering
8953
+ txp.outputs[0].toAddress = ATTACKER_ADDR; // swap payee, keep prePublishRaw + proposalSignature
8954
+ ChainService.isPrePublishRawBound(txp).should.equal(false);
8955
+ });
8956
+
8957
+ it('rejects a prePublishRaw that holds no usable raw tx', async function() {
8958
+ const created = await helpers.createAndPublishTx(server, {
8959
+ outputs: [{ toAddress: ETH_ADDR, amount: 8000 }],
8960
+ feePerKb: 123e2, from: fromAddr, deferNonce: true
8961
+ }, TestData.copayers[0].privKey_1H_0);
8962
+
8963
+ const txp = await util.promisify(server.getTx).call(server, { txProposalId: created.id });
8964
+ const warn = sinon.spy(logger, 'warn');
8965
+ try {
8966
+ // an empty list is truthy, so it has to be refused up front rather than handed to the tx
8967
+ // provider, which would fail the same check by throwing
8968
+ for (const prePublishRaw of [[], [''], ['', '']]) {
8969
+ txp.prePublishRaw = prePublishRaw;
8970
+ ChainService.isPrePublishRawBound(txp).should.equal(false);
8971
+ }
8972
+ warn.called.should.equal(false);
8973
+ } finally {
8974
+ warn.restore();
8975
+ }
8976
+ });
8977
+
8978
+ it('rejects the publishTx fallback when the stored proposal was tampered', async function() {
8979
+ blockchainExplorer.getTransactionCount = sinon.stub().callsArgWith(1, null, '7');
8980
+ const created = await util.promisify(server.createTx).call(server, {
8981
+ outputs: [{ toAddress: ETH_ADDR, amount: 8000 }],
8982
+ feePerKb: 123e2, from: fromAddr, deferNonce: true
8983
+ });
8984
+ const publishOpts = helpers.getProposalSignatureOpts(created, TestData.copayers[0].privKey_1H_0);
8985
+ await util.promisify(server.publishTx).call(server, publishOpts);
8986
+
8987
+ // Assign the nonce so a re-publish must fall back to prePublishRaw...
8988
+ await util.promisify(server.prepareTx).call(server, { txProposalId: created.id });
8989
+ // ...then tamper the stored destination and replay the original (still-valid) proposalSignature.
8990
+ const stored = await util.promisify(server.storage.fetchTx).call(server.storage, wallet.id, created.id);
8991
+ should.exist(stored.prePublishRaw);
8992
+ stored.outputs[0].toAddress = ATTACKER_ADDR;
8993
+ await util.promisify(server.storage.storeTx).call(server.storage, wallet.id, stored);
8994
+
8995
+ let err;
8996
+ try {
8997
+ await util.promisify(server.publishTx).call(server, publishOpts);
8998
+ } catch (e) { err = e; }
8999
+ should.exist(err);
9000
+ err.message.should.contain('Invalid proposal signature');
9001
+ });
9002
+ });
8824
9003
  });
8825
9004
 
8826
9005
  describe('#prepareTx XRP (deferred nonce)', function() {
@@ -8912,6 +9091,20 @@ describe('Wallet service', function() {
8912
9091
  });
8913
9092
  signed.status.should.equal('accepted');
8914
9093
  });
9094
+
9095
+ it('rejects prePublishRaw binding when an XRP destination was tampered', async function() {
9096
+ const ATTACKER_XRP = 'rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe';
9097
+ const created = await helpers.createAndPublishTx(server, {
9098
+ outputs: [{ toAddress: XRP_ADDR, amount: 8000 }],
9099
+ feePerKb: 123e2, from: fromAddr, deferNonce: true
9100
+ }, TestData.copayers[0].privKey_1H_0);
9101
+
9102
+ const txp = await util.promisify(server.getTx).call(server, { txProposalId: created.id });
9103
+ should.exist(txp.prePublishRaw);
9104
+ ChainService.isPrePublishRawBound(txp).should.equal(true); // untampered baseline
9105
+ txp.outputs[0].toAddress = ATTACKER_XRP;
9106
+ ChainService.isPrePublishRawBound(txp).should.equal(false);
9107
+ });
8915
9108
  });
8916
9109
 
8917
9110
  describe('#signTx nonce override', function() {
@@ -379,6 +379,73 @@ describe('TSS', function() {
379
379
  });
380
380
  });
381
381
 
382
+ describe('GET /v1/tss/keygen/:id/:round', function() {
383
+ const roundUrl = '/v1/tss/keygen/test/0?maxWaitTime=0';
384
+ const parties = [vector.party0, vector.party1, vector.party2];
385
+ const round0Messages = [vector.keygen.messages.round0.party0, vector.keygen.messages.round0.party1, vector.keygen.messages.round0.party2];
386
+
387
+ const joinRound0 = async (partyId: number) => {
388
+ const publicKey = parties[partyId].authKey.publicKey.toString();
389
+ const message = { ...round0Messages[partyId], partyId, round: 0, publicKey };
390
+ await app.post(`${urlPrefix}/v1/tss/keygen/test`)
391
+ .set('x-identity', publicKey)
392
+ .send({ message, n: 3, version: 1.1 })
393
+ .expect(200);
394
+ };
395
+
396
+ const getRound0 = (partyId: number) => {
397
+ const { authKey } = parties[partyId];
398
+ const hash = Utils.hashMessage(`get|${roundUrl}|{}`, false);
399
+ const xSignature = BitcoreLib.crypto.ECDSA.sign(hash, authKey, { endian: 'little' }).toString();
400
+ return app.get(urlPrefix + roundUrl)
401
+ .set('x-identity', authKey.publicKey.toString())
402
+ .set('x-signature', xSignature);
403
+ };
404
+
405
+ beforeEach(async function() {
406
+ const storage = helpers.getStorage();
407
+ await storage.db.collection(BWS.Storage.collections.TSS_KEYGEN).deleteMany({});
408
+ });
409
+
410
+ it('should authenticate every party when round 0 messages arrive in partyId order', async function() {
411
+ await joinRound0(0);
412
+ await joinRound0(1);
413
+ await joinRound0(2);
414
+
415
+ for (const partyId of [0, 1, 2]) {
416
+ const res = await getRound0(partyId);
417
+ res.status.should.equal(200);
418
+ JSON.parse(res.text).messages.length.should.equal(2);
419
+ }
420
+ });
421
+
422
+ it('should authenticate every party when round 0 messages arrive out of partyId order', async function() {
423
+ await joinRound0(0);
424
+ await joinRound0(2);
425
+ await joinRound0(1);
426
+
427
+ for (const partyId of [0, 1, 2]) {
428
+ const res = await getRound0(partyId);
429
+ res.status.should.equal(200);
430
+ JSON.parse(res.text).messages.length.should.equal(2);
431
+ }
432
+ });
433
+
434
+ it('should reject another party identity when round 0 messages arrive out of partyId order', async function() {
435
+ await joinRound0(0);
436
+ await joinRound0(2);
437
+ await joinRound0(1);
438
+
439
+ for (const [partyId, otherPartyId] of [[1, 2], [2, 1]]) {
440
+ const res = await getRound0(partyId)
441
+ .set('x-identity', parties[otherPartyId].authKey.publicKey.toString());
442
+ res.status.should.equal(401);
443
+ res.body.code.should.equal('NOT_AUTHORIZED');
444
+ res.body.message.should.equal('Invalid signature');
445
+ }
446
+ });
447
+ });
448
+
382
449
  describe('POST /v1/tss/sign/:id', function() {
383
450
  const url = id => `${urlPrefix}/v1/tss/sign/${id}`;
384
451
  const signRequest = body => {
@@ -53,6 +53,28 @@ describe('TxProposal', function() {
53
53
  });
54
54
  });
55
55
 
56
+ describe('#fromObj', function() {
57
+ it('should keep the stored output amount type untouched', function() {
58
+ const stored: any = { ...aTXP(), outputs: [{ ...aTXP().outputs[0], amount: 70000000000000010 }] };
59
+
60
+ const txp = TxProposal.fromObj(stored);
61
+
62
+ txp.outputs[0].amount.should.equal(70000000000000010);
63
+ });
64
+ });
65
+
66
+ describe('#getTotalAmountBigInt', function() {
67
+ it('should keep a total that a number cannot represent', function() {
68
+ const txp = TxProposal.fromObj({
69
+ ...aTXP(),
70
+ outputs: [{ ...aTXP().outputs[0], amount: '9007199254740992' }, { ...aTXP().outputs[1], amount: '1' }]
71
+ } as any);
72
+
73
+ txp.getTotalAmountBigInt().should.equal(9007199254740993n);
74
+ txp.getTotalAmount().should.equal(9007199254740992);
75
+ });
76
+ });
77
+
56
78
  describe('#getTotalAmount', function() {
57
79
  it('should compute total amount', function() {
58
80
  const x = TxProposal.fromObj(aTXP());
@@ -81,6 +103,21 @@ describe('TxProposal', function() {
81
103
  });
82
104
  });
83
105
 
106
+ describe('#sign with a number format', function() {
107
+ it('should keep the signatures in the persisted raw tx', function() {
108
+ const plain = TxProposal.fromObj(aTXP());
109
+ plain.sign('1', theSignatures, theXPub);
110
+ plain.sign('2', theSignatures, theXPub);
111
+
112
+ const formatted = TxProposal.fromObj(aTXP());
113
+ formatted.sign('1', theSignatures, theXPub, 'number');
114
+ formatted.sign('2', theSignatures, theXPub, 'number');
115
+
116
+ formatted.raw.should.deep.equal(plain.raw);
117
+ formatted.txid.should.equal(plain.txid);
118
+ });
119
+ });
120
+
84
121
  describe('#reject', function() {
85
122
  it('should reject 2-2', function() {
86
123
  const txp = TxProposal.fromObj(aTXP());
@@ -142,6 +179,13 @@ describe('TxProposal', function() {
142
179
  txp.outputs[0].amount.should.be.a('number');
143
180
  });
144
181
 
182
+ it('should keep a base-unit amount that a number cannot represent exactly', function() {
183
+ const amount = '70000000000000010';
184
+ const t = TxProposal.fromObj({ ...aTXP(), amount, outputs: [{ ...aTXP().outputs[0], amount }] } as any);
185
+ const txp = TxProposal.formatNumbers(t, 'number');
186
+ txp.outputs[0].amount.should.equal(amount);
187
+ });
188
+
145
189
  it('should format string numbers as hex', function() {
146
190
  const t1 = TxProposal.fromObj(aTXP());
147
191
  const t2 = TxProposal.formatNumbers(t1, 'string');
@@ -156,6 +200,80 @@ describe('TxProposal', function() {
156
200
  txp.outputs[0].amount.should.be.a('string');
157
201
  CWCUtils.isHexString(txp.outputs[0].amount).should.equal(true);
158
202
  });
203
+
204
+
205
+ describe('legacy format contracts', function() {
206
+ const cases: Array<[string, any, any]> = [
207
+ ['safe integer boundary', '9007199254740991', 9007199254740991],
208
+ ['first representable unsafe integer', '9007199254740992', 9007199254740992],
209
+ ['first unrepresentable integer', '9007199254740993', '9007199254740993'],
210
+ ['representable amount', '70000000000000008', Number('70000000000000008')],
211
+ ['inexact amount', '70000000000000010', '70000000000000010'],
212
+ ['representable hex', '0x20000000000000', 9007199254740992],
213
+ ['unrepresentable hex', '0x20000000000001', '0x20000000000001'],
214
+ ['exponential string', '1e+21', '1e+21'],
215
+ ['exponential number', 1e21, 1e21],
216
+ ['overflow string', '9'.repeat(400), '9'.repeat(400)],
217
+ ['empty string', '', ''],
218
+ ['nonnumeric string', 'abc', 'abc'],
219
+ ['null', null, null],
220
+ ['undefined', undefined, undefined],
221
+ ['NaN', NaN, NaN],
222
+ ['Infinity', Infinity, Infinity],
223
+ ['small bigint', 5n, 5],
224
+ ['inexact bigint', 9007199254740993n, 9007199254740993n],
225
+ ['positive sign', '+5', 5],
226
+ ['negative zero', '-0', -0],
227
+ ['leading zeros', '007', 7],
228
+ ['whitespace', ' 42 ', 42],
229
+ ['fractional prefix', '1.5', 1],
230
+ ['malformed prefix', '12xyz', 12],
231
+ ['SOL nonce prefix', '2' + 'A'.repeat(43), 2]
232
+ ];
233
+
234
+ for (const [label, value, expected] of cases) {
235
+ it(`should leave the legacy number behavior unchanged for ${label}`, function() {
236
+ const source: any = TxProposal.fromObj(aTXP());
237
+ source.amount = value;
238
+ source.outputs[0].amount = value;
239
+ const formatted = TxProposal.formatNumbers(source, 'number');
240
+
241
+ chai.expect(Object.is(formatted.amount, expected)).to.equal(true);
242
+ chai.expect(Object.is(formatted.outputs[0].amount, expected)).to.equal(true);
243
+ chai.expect(Object.is(source.outputs[0].amount, value)).to.equal(true);
244
+ });
245
+ }
246
+
247
+ for (const format of ['string', 'hex', 'bigint'] as const) {
248
+ it(`should leave the legacy ${format} behavior unchanged`, function() {
249
+ const source: any = TxProposal.fromObj(aTXP());
250
+ source.amount = 42;
251
+ source.outputs[0].amount = '70000000000000010';
252
+ const formatted = TxProposal.formatNumbers(source, format as 'string') as any;
253
+ const expected = {
254
+ string: ['42', '70000000000000010'],
255
+ hex: ['0x2a', '0xf8b0a10e47000a'],
256
+ bigint: [42n, 70000000000000010n]
257
+ }[format];
258
+
259
+ formatted.amount.should.equal(expected[0]);
260
+ formatted.outputs[0].amount.should.equal(expected[1]);
261
+ source.amount.should.equal(42);
262
+ source.outputs[0].amount.should.equal('70000000000000010');
263
+ });
264
+ }
265
+
266
+ it('should expand large integers and keep existing hex strings in string mode', function() {
267
+ const source: any = TxProposal.fromObj(aTXP());
268
+ source.amount = 1e21;
269
+ source.outputs[0].amount = '0x2a';
270
+ const formatted = TxProposal.formatNumbers(source, 'string');
271
+
272
+ formatted.amount.should.equal('1000000000000000000000');
273
+ BigInt(formatted.amount).should.equal(1000000000000000000000n);
274
+ formatted.outputs[0].amount.should.equal('0x2a');
275
+ });
276
+ });
159
277
  });
160
278
  });
161
279
 
@@ -0,0 +1,88 @@
1
+ 'use strict';
2
+
3
+ import * as chai from 'chai';
4
+ import 'chai/register-should';
5
+ import express from 'express';
6
+ import sinon from 'sinon';
7
+ import { Errors } from '../src/lib/errors/errordefinitions';
8
+ import { createRouteHelpers } from '../src/lib/routes/context';
9
+ import { ApiErrorHelper } from '../src/lib/routes/helpers/error';
10
+ import { registerTransactionRoutes } from '../src/lib/routes/transactions';
11
+ import { registerWalletRoutes } from '../src/lib/routes/wallets';
12
+
13
+ const should = chai.should();
14
+
15
+ describe('Transaction number format routes', function() {
16
+ const routes = [
17
+ ['get', '/v2/txproposals/', 'getPendingTxs'],
18
+ ['post', '/v3/txproposals/', 'createTx'],
19
+ ['post', '/v2/txproposals/:id/signatures/', 'signTx'],
20
+ ['post', '/v1/txproposals/:id/prepare/', 'prepareTx'],
21
+ ['post', '/v2/txproposals/:id/publish/', 'publishTx'],
22
+ ['get', '/v3/wallets/', 'getStatus'],
23
+ ['get', '/v1/wallets/all/', 'getStatus']
24
+ ];
25
+
26
+ function setup() {
27
+ const router = express.Router();
28
+ const error = new ApiErrorHelper();
29
+ const returnError = error.returnError.bind(error);
30
+ const helpers = createRouteHelpers(returnError);
31
+ const server: any = { copayerId: 'copayer', walletId: 'wallet' };
32
+ for (const method of new Set(routes.map(route => route[2]))) {
33
+ server[method] = sinon.stub().callsArgWith(1, null, { outputs: [{ amount: '70000000000000010' }] });
34
+ }
35
+ const context = {
36
+ ...helpers,
37
+ returnError,
38
+ getServerWithAuth: sinon.stub().callsFake((_req, _res, cb) => cb(server)),
39
+ getServerWithMultiAuth: sinon.stub().returns([Promise.resolve(server)]),
40
+ createWalletLimiter: sinon.stub().callsArg(2)
41
+ };
42
+ registerTransactionRoutes(router, context);
43
+ registerWalletRoutes(router, context);
44
+ const response: any = {
45
+ status: sinon.stub().returnsThis(),
46
+ json: sinon.stub().returnsThis(),
47
+ end: sinon.stub().returnsThis()
48
+ };
49
+ return { router, server, response, context };
50
+ }
51
+
52
+ for (const [method, path, serverMethod] of routes) {
53
+ for (const format of ['number', 'string', 'hex', undefined]) {
54
+ it(`should accept ${format ?? 'unspecified'} on ${method.toUpperCase()} ${path}`, async function() {
55
+ const { router, server, response } = setup();
56
+ const route = router.stack.find(layer => layer.route?.path === path && layer.route.methods[method]);
57
+ const request: any = { query: { numberFormat: format }, body: {}, params: { id: 'proposal' }, headers: {} };
58
+
59
+ await route.route.stack[0].handle(request, response);
60
+
61
+ server[serverMethod].callCount.should.equal(1);
62
+ chai.expect(server[serverMethod].firstCall.args[0].numberFormat).to.equal(format);
63
+ response.status.called.should.equal(false);
64
+ response.json.callCount.should.equal(1);
65
+ });
66
+ }
67
+
68
+ for (const format of ['invalid', 'bigint', 'raw']) {
69
+ it(`should return 400 without executing ${method.toUpperCase()} ${path} for ${format}`, async function() {
70
+ const { router, server, response, context } = setup();
71
+ const route = router.stack.find(layer => layer.route?.path === path && layer.route.methods[method]);
72
+ const request: any = { query: { numberFormat: format }, body: {}, params: { id: 'proposal' }, headers: {} };
73
+
74
+ await route.route.stack[0].handle(request, response);
75
+
76
+ response.status.calledOnceWithExactly(400).should.equal(true);
77
+ response.json.callCount.should.equal(1);
78
+ response.json.firstCall.args[0].code.should.equal('INVALID_NUMBER_FORMAT');
79
+ server[serverMethod].called.should.equal(false);
80
+ if (path === '/v1/wallets/all/') context.getServerWithMultiAuth.called.should.equal(false);
81
+ });
82
+ }
83
+ }
84
+
85
+ it('should list the supported formats in the validation error', function() {
86
+ Errors.INVALID_NUMBER_FORMAT.message.should.include('number, string, hex');
87
+ });
88
+ });
@@ -2,7 +2,7 @@
2
2
  "name": "@bitpay-labs/bitcore-wallet-service",
3
3
  "description": "A service for Mutisig HD Bitcoin Wallets",
4
4
  "author": "BitPay Inc",
5
- "version": "11.10.10",
5
+ "version": "11.10.11",
6
6
  "license": "MIT",
7
7
  "main": "ts_build/src/index.js",
8
8
  "types": "./ts_build/src/index.d.ts",
@@ -42,8 +42,8 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@bitpay-labs/bitcore-logging": "^11.10.9",
45
- "@bitpay-labs/bitcore-tss": "^11.10.9",
46
- "@bitpay-labs/crypto-wallet-core": "^11.10.9",
45
+ "@bitpay-labs/bitcore-tss": "^11.10.11",
46
+ "@bitpay-labs/crypto-wallet-core": "^11.10.11",
47
47
  "@sendgrid/mail": "6.5.4",
48
48
  "abi-decoder": "2.4.0",
49
49
  "async": "0.9.2",
@@ -7,6 +7,5 @@ export declare class SimplexService {
7
7
  simplexGetSellQuote(req: any): Promise<any>;
8
8
  simplexPaymentRequest(req: any): Promise<any>;
9
9
  simplexSellPaymentRequest(req: any): Promise<any>;
10
- simplexGetEvents(req: any): Promise<any>;
11
10
  }
12
11
  //# sourceMappingURL=simplex.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"simplex.d.ts","sourceRoot":"","sources":["../../../src/externalservices/simplex.ts"],"names":[],"mappings":"AAOA,qBAAa,cAAc;IACzB,OAAO,EAAE,GAAG,CAAW;IAEvB,OAAO,CAAC,cAAc;IAwBtB,OAAO,CAAC,gBAAgB;IAYxB,oBAAoB,CAAC,GAAG,KAAA,GAAG,OAAO,CAAC,GAAG,CAAC;IA6BvC,eAAe,CAAC,GAAG,KAAA,GAAG,OAAO,CAAC,GAAG,CAAC;IAuClC,mBAAmB,CAAC,GAAG,KAAA,GAAG,OAAO,CAAC,GAAG,CAAC;IA6CtC,qBAAqB,CAAC,GAAG,KAAA,GAAG,OAAO,CAAC,GAAG,CAAC;IA6DxC,yBAAyB,CAAC,GAAG,KAAA,GAAG,OAAO,CAAC,GAAG,CAAC;IA2C5C,gBAAgB,CAAC,GAAG,KAAA,GAAG,OAAO,CAAC,GAAG,CAAC;CA6BpC"}
1
+ {"version":3,"file":"simplex.d.ts","sourceRoot":"","sources":["../../../src/externalservices/simplex.ts"],"names":[],"mappings":"AAOA,qBAAa,cAAc;IACzB,OAAO,EAAE,GAAG,CAAW;IAEvB,OAAO,CAAC,cAAc;IAwBtB,OAAO,CAAC,gBAAgB;IAYxB,oBAAoB,CAAC,GAAG,KAAA,GAAG,OAAO,CAAC,GAAG,CAAC;IA6BvC,eAAe,CAAC,GAAG,KAAA,GAAG,OAAO,CAAC,GAAG,CAAC;IAuClC,mBAAmB,CAAC,GAAG,KAAA,GAAG,OAAO,CAAC,GAAG,CAAC;IA6CtC,qBAAqB,CAAC,GAAG,KAAA,GAAG,OAAO,CAAC,GAAG,CAAC;IA6DxC,yBAAyB,CAAC,GAAG,KAAA,GAAG,OAAO,CAAC,GAAG,CAAC;CA0C7C"}
@@ -240,31 +240,6 @@ class SimplexService {
240
240
  });
241
241
  });
242
242
  }
243
- simplexGetEvents(req) {
244
- return new Promise((resolve, reject) => {
245
- if (!config_1.default.simplex)
246
- return reject(new Error('Simplex missing credentials'));
247
- if (!req.env || (req.env != 'sandbox' && req.env != 'production'))
248
- return reject(new Error("Simplex's request wrong environment"));
249
- const API = config_1.default.simplex[req.env].api;
250
- const API_KEY = config_1.default.simplex[req.env].apiKey;
251
- const headers = {
252
- 'Content-Type': 'application/json',
253
- Authorization: 'ApiKey ' + API_KEY
254
- };
255
- this.request.get(API + '/wallet/merchant/v2/events', {
256
- headers,
257
- json: true
258
- }, (err, data) => {
259
- if (err) {
260
- return reject(err.body ? err.body : null);
261
- }
262
- else {
263
- return resolve(data.body ? data.body : null);
264
- }
265
- });
266
- });
267
- }
268
243
  }
269
244
  exports.SimplexService = SimplexService;
270
245
  //# sourceMappingURL=simplex.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"simplex.js","sourceRoot":"","sources":["../../../src/externalservices/simplex.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,gDAAwB;AACxB,uDAA+B;AAC/B,+CAA4C;AAC5C,2DAAwD;AACxD,0CAA8C;AAE9C,MAAa,cAAc;IACzB,OAAO,GAAQ,OAAO,CAAC;IAEf,cAAc,CAAC,GAAG;QACxB,IAAI,CAAC,gBAAM,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAEpE,IAAI,GAA8D,CAAC;QACnE,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;QAC/D,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;YAC/B,GAAG,IAAI,KAAK,CAAC;QACf,CAAC;QAED,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;QACpB,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;QAExB,MAAM,IAAI,GAAG;YACX,GAAG,EAAE,gBAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG;YAC5B,QAAQ,EAAE,gBAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO;YACrC,OAAO,EAAE,gBAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM;YACnC,UAAU,EAAE,gBAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,SAAS;YACzC,eAAe,EAAE,gBAAM,CAAC,OAAO,CAAC,GAAG,CAAC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AAO,GAAG;gBACd,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,SAAS,GAAG,OAAO;aACnC,CAAC;YAEF,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,OAAO,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;gBACrE,OAAO,CAAC,gBAAgB,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;YACjE,CAAC;YAED,IAAI,CAAC,OAAO,CAAC,IAAI,CACf,GAAG,GAAG,0BAA0B,EAChC;gBACE,OAAO;gBACP,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,IAAI,EAAE,IAAI;aACX,EACD,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;gBACZ,IAAI,GAAG,EAAE,CAAC;oBACR,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBAC3C,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,IAAI,CAAC,eAAe,GAAG,YAAY,CAAC;oBACzC,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA/PD,wCA+PC"}
@@ -1,6 +1,6 @@
1
1
  import { IChain } from '../../../types/chain';
2
2
  import { ClientError } from '../../errors/clienterror';
3
- import { IWallet } from '../../model';
3
+ import { IWallet, TxProposal } from '../../model';
4
4
  import { WalletService } from '../../server';
5
5
  export declare class BtcChain implements IChain {
6
6
  private bitcoreLib;
@@ -24,6 +24,7 @@ export declare class BtcChain implements IChain {
24
24
  getEstimatedSize(txp: any, opts?: any): number;
25
25
  getEstimatedFee(txp: any, opts: any): number;
26
26
  getFee(server: WalletService, wallet: any, opts: any): Promise<unknown>;
27
+ isPrePublishRawBound(_txp: TxProposal): boolean;
27
28
  getBitcoreTx(txp: any, opts?: {
28
29
  signed: boolean;
29
30
  }): any;