@bitpay-labs/crypto-wallet-core 11.11.5 → 11.11.6

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 (81) hide show
  1. package/package.json +9 -3
  2. package/ts_build/src/transactions/index.d.ts +1 -1
  3. package/ts_build/src/transactions/index.d.ts.map +1 -1
  4. package/ts_build/src/transactions/index.js.map +1 -1
  5. package/ts_build/src/types/derivation.d.ts +1 -0
  6. package/ts_build/src/types/derivation.d.ts.map +1 -1
  7. package/.mocharc.json +0 -6
  8. package/LICENSE +0 -21
  9. package/mcr.config.js +0 -17
  10. package/src/constants/address.ts +0 -7
  11. package/src/constants/algorithms.ts +0 -9
  12. package/src/constants/arc.ts +0 -4
  13. package/src/constants/chains.ts +0 -68
  14. package/src/constants/feeMinimums.ts +0 -23
  15. package/src/constants/index.ts +0 -40
  16. package/src/constants/tokens.ts +0 -233
  17. package/src/constants/units.ts +0 -311
  18. package/src/derivation/arb/index.ts +0 -3
  19. package/src/derivation/base/index.ts +0 -3
  20. package/src/derivation/bch/index.ts +0 -11
  21. package/src/derivation/btc/index.ts +0 -68
  22. package/src/derivation/doge/index.ts +0 -6
  23. package/src/derivation/eth/index.ts +0 -86
  24. package/src/derivation/index.ts +0 -140
  25. package/src/derivation/ltc/index.ts +0 -6
  26. package/src/derivation/matic/index.ts +0 -3
  27. package/src/derivation/op/index.ts +0 -3
  28. package/src/derivation/paths.ts +0 -45
  29. package/src/derivation/sol/index.ts +0 -81
  30. package/src/derivation/xrp/index.ts +0 -63
  31. package/src/index.ts +0 -48
  32. package/src/message/btc.ts +0 -28
  33. package/src/message/eth.ts +0 -47
  34. package/src/message/index.ts +0 -71
  35. package/src/message/sol.ts +0 -3
  36. package/src/message/xrp.ts +0 -4
  37. package/src/transactions/arb/index.ts +0 -14
  38. package/src/transactions/base/index.ts +0 -13
  39. package/src/transactions/bch/index.ts +0 -25
  40. package/src/transactions/btc/index.ts +0 -316
  41. package/src/transactions/doge/index.ts +0 -31
  42. package/src/transactions/erc20/abi.ts +0 -418
  43. package/src/transactions/erc20/index.ts +0 -57
  44. package/src/transactions/eth/index.ts +0 -192
  45. package/src/transactions/eth-multisig/abi.ts +0 -724
  46. package/src/transactions/eth-multisig/index.ts +0 -172
  47. package/src/transactions/index.ts +0 -85
  48. package/src/transactions/ltc/index.ts +0 -31
  49. package/src/transactions/matic/index.ts +0 -14
  50. package/src/transactions/matic-multisig/index.ts +0 -172
  51. package/src/transactions/op/index.ts +0 -14
  52. package/src/transactions/sol/index.ts +0 -306
  53. package/src/transactions/spl/index.ts +0 -192
  54. package/src/transactions/xrp/index.ts +0 -167
  55. package/src/types/derivation.ts +0 -34
  56. package/src/types/index.ts +0 -3
  57. package/src/types/message.ts +0 -15
  58. package/src/types/utils.ts +0 -1
  59. package/src/types/validation.ts +0 -4
  60. package/src/utils/bigint.ts +0 -238
  61. package/src/utils/index.ts +0 -188
  62. package/src/validation/arb/index.ts +0 -8
  63. package/src/validation/arc/index.ts +0 -8
  64. package/src/validation/base/index.ts +0 -8
  65. package/src/validation/bch/index.ts +0 -17
  66. package/src/validation/btc/index.ts +0 -17
  67. package/src/validation/doge/index.ts +0 -16
  68. package/src/validation/eth/index.ts +0 -29
  69. package/src/validation/index.ts +0 -45
  70. package/src/validation/ltc/index.ts +0 -16
  71. package/src/validation/matic/index.ts +0 -8
  72. package/src/validation/op/index.ts +0 -8
  73. package/src/validation/sol/index.ts +0 -34
  74. package/src/validation/xrp/index.ts +0 -50
  75. package/test/address.test.ts +0 -190
  76. package/test/bigint.test.ts +0 -373
  77. package/test/deriver.test.ts +0 -126
  78. package/test/transactions.test.ts +0 -2103
  79. package/test/utils.test.ts +0 -446
  80. package/test/validation.test.ts +0 -282
  81. package/tsconfig.json +0 -29
@@ -1,126 +0,0 @@
1
- import { expect } from 'chai';
2
- import crypto from 'crypto';
3
- import { Deriver } from '../src';
4
-
5
- describe('IDeriver', function () {
6
- describe('getPublicKey (Buffer-first)', () => {
7
- it('BTC: should derive the compressed secp256k1 public key', () => {
8
- // Well-known secp256k1 test vector: private key 1 maps to generator point G.
9
- const privHex = '0000000000000000000000000000000000000000000000000000000000000001';
10
- const expectedPubKey = '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798';
11
- const privBuf = Deriver.privateKeyToBuffer('BTC', privHex);
12
- try {
13
- const pubKey = Deriver.getPublicKey('BTC', 'testnet', privBuf);
14
-
15
- expect(pubKey).to.equal(expectedPubKey);
16
- expect(pubKey).to.match(/^(02|03)/);
17
- expect(pubKey).to.have.length(66);
18
- } finally {
19
- privBuf.fill(0);
20
- }
21
- });
22
-
23
- it('ETH: should derive the compressed pubKey used by wallet imports', () => {
24
- // Vetted fixture from `test/address.test.ts`.
25
- const privHex = '62b8311c71f355c5c07f6bffe9b1ae60aa20d90e2e2ec93ec11b6014b2ae6340';
26
- const expectedPubKey = '0386d153aad9395924631dbc78fa560107123a759eaa3e105958248c60cd4472ad';
27
- const expectedAddress = '0xb497281830dE4F19a3482AbF3D5C35c514e6fB36';
28
- const privBuf = Deriver.privateKeyToBuffer('ETH', privHex);
29
- try {
30
- const pubKey = Deriver.getPublicKey('ETH', 'mainnet', privBuf);
31
-
32
- expect(pubKey).to.equal(expectedPubKey);
33
- expect(pubKey).to.match(/^(02|03)/);
34
- expect(pubKey).to.have.length(66);
35
- expect(Deriver.getAddress('ETH', 'mainnet', pubKey)).to.equal(expectedAddress);
36
- } finally {
37
- privBuf.fill(0);
38
- }
39
- });
40
-
41
- it('XRP: should derive the compressed pubKey used by wallet imports', () => {
42
- // Vetted fixture from `test/address.test.ts`.
43
- const privHex = 'D02C6801D8F328FF2EAD51D01F9580AF36C8D74E2BD463963AC4ADBE51AE5F2C';
44
- const expectedPubKey = '03DBEEC5E9E76DA09C5B502A67136BC2D73423E8902A7C35A8CBC0C5A6AC0469E8';
45
- const expectedAddress = 'r9dmAJBfBe7JL2RRLiFWGJ8kM4CHEeTpgN';
46
- const privBuf = Deriver.privateKeyToBuffer('XRP', privHex);
47
- try {
48
- const pubKey = Deriver.getPublicKey('XRP', 'mainnet', privBuf);
49
-
50
- expect(pubKey).to.equal(expectedPubKey);
51
- expect(pubKey).to.match(/^(02|03)/);
52
- expect(pubKey).to.have.length(66);
53
- expect(Deriver.getAddress('XRP', 'mainnet', pubKey)).to.equal(expectedAddress);
54
- } finally {
55
- privBuf.fill(0);
56
- }
57
- });
58
-
59
- it('SOL: should derive the public key used by wallet imports', () => {
60
- // Vetted fixture from `test/address.test.ts`.
61
- const privKey = 'E4Tp4nTgMCa5dtGwqvkWoMGrJC7FKRNjcpeFFXi4nNb9';
62
- const expectedPubKey = '5c9c85b20525ee81d3cc56da1f8307ec169086ae41458c5458519aced7683b66';
63
- const expectedAddress = '7EWwMxKQa5Gru7oTcS1Wi3AaEgTfA6MU3z7MaLUT6hnD';
64
- const privBuf = Deriver.privateKeyToBuffer('SOL', privKey);
65
- try {
66
- const pubKey = Deriver.getPublicKey('SOL', 'mainnet', privBuf);
67
-
68
- expect(pubKey).to.equal(expectedPubKey);
69
- expect(pubKey).to.have.length(64);
70
- expect(Deriver.getAddress('SOL', 'mainnet', pubKey)).to.equal(expectedAddress);
71
- } finally {
72
- privBuf.fill(0);
73
- }
74
- });
75
- });
76
-
77
- describe('privateKeyToBuffer', function () {
78
- it('ETH: should accept with/without 0x', () => {
79
- const privHex = crypto.randomBytes(32).toString('hex');
80
- const privBufNo0x = Deriver.privateKeyToBuffer('ETH', privHex);
81
- const privBuf0x = Deriver.privateKeyToBuffer('ETH', `0x${privHex}`);
82
- try {
83
- expect(privBuf0x.equals(privBufNo0x)).to.be.true;
84
- } finally {
85
- privBufNo0x.fill(0);
86
- privBuf0x.fill(0);
87
- }
88
- });
89
- it('ETH: hex-stringified buffer output equals input', () => {
90
- const privHex = crypto.randomBytes(32).toString('hex');
91
- const privBuf = Deriver.privateKeyToBuffer('ETH', privHex);
92
- try {
93
- expect(privBuf.toString('hex')).to.equal(privHex);
94
- } finally {
95
- privBuf.fill(0);
96
- }
97
- });
98
-
99
- it('XRP: should accept uppercase/lowercase hex', () => {
100
- // Vetted fixture from `test/address.test.ts`.
101
- const privHexUpper = 'D02C6801D8F328FF2EAD51D01F9580AF36C8D74E2BD463963AC4ADBE51AE5F2C';
102
- const privHexLower = privHexUpper.toLowerCase();
103
- const privBufUpper = Deriver.privateKeyToBuffer('XRP', privHexUpper);
104
- const privBufLower = Deriver.privateKeyToBuffer('XRP', privHexLower);
105
- try {
106
- expect(privBufUpper.equals(privBufLower)).to.be.true;
107
- } finally {
108
- privBufUpper.fill(0);
109
- privBufLower.fill(0);
110
- }
111
- });
112
-
113
- it('XRP: hex-stringified buffer output equals fixture bytes', () => {
114
- // Vetted fixture from `test/address.test.ts`.
115
- const privHexUpper = 'D02C6801D8F328FF2EAD51D01F9580AF36C8D74E2BD463963AC4ADBE51AE5F2C';
116
- const privBuf = Deriver.privateKeyToBuffer('XRP', privHexUpper);
117
- try {
118
- expect(privBuf.toString('hex')).to.equal(privHexUpper.toLowerCase());
119
- } finally {
120
- privBuf.fill(0);
121
- }
122
- });
123
- });
124
- });
125
-
126
-