@rosen-bridge/address-codec 0.2.1-6770eb → 0.3.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.
- package/CHANGELOG.md +6 -0
- package/dist/tests/testData.d.ts +2 -1
- package/dist/tests/testData.d.ts.map +1 -1
- package/dist/tests/testData.js +3 -2
- package/dist/tests/validator.spec.js +33 -20
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/tests/testData.ts +3 -1
- package/tests/validator.spec.ts +33 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rosen-bridge/address-codec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A Typescript package for encoding and decoding of addresses in Rosen bridge supported chains",
|
|
5
5
|
"repository": "https://github.com/rosen-bridge/utils",
|
|
6
6
|
"license": "GPL-3.0",
|
package/tests/testData.ts
CHANGED
|
@@ -13,7 +13,7 @@ export const invalidCardanoAddress =
|
|
|
13
13
|
'addr1qxxa3kfnnh40yqtepa5frt0tkw4a0rys7v33422lzt8glx43sqtd4vkhjzawajej8aujh27p5a54zx62xf3wvuplynqs3fsqee';
|
|
14
14
|
|
|
15
15
|
export const bitcoinAddress = 'bc1qkgp89fjerymm5ltg0hygnumr0m2qa7n22gyw6h';
|
|
16
|
-
export const
|
|
16
|
+
export const invalidBitcoinAddress =
|
|
17
17
|
'bc1qkgp89fjerymm5ltg0hygnumr0m2qa7n22gyw6';
|
|
18
18
|
export const tapRootBitcoinAddress =
|
|
19
19
|
'bc1pxhtmm7mjrafdkw46wc7lmjn3gyrmdm4q0dnmw8j225gxtwtq7mwqd7e24v';
|
|
@@ -32,3 +32,5 @@ export const encodedEthereumAddress =
|
|
|
32
32
|
export const invalidEthereumAddressLength =
|
|
33
33
|
'0xb416c8a7ec94706a9ae2c26c11d320519482b1';
|
|
34
34
|
export const invalidEthereumIcapAddress = 'XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36';
|
|
35
|
+
export const invalidEthereumChecksumAddress =
|
|
36
|
+
'0x4838B106FCe9647Bdf1E7877BF73cE8B0BAD5f97';
|
package/tests/validator.spec.ts
CHANGED
|
@@ -26,14 +26,14 @@ describe('validateAddress', () => {
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* @target `validateAddress` should
|
|
29
|
+
* @target `validateAddress` should throw error for wrong Ergo address
|
|
30
30
|
* @dependencies
|
|
31
31
|
* @scenario
|
|
32
32
|
* - run test
|
|
33
33
|
* @expected
|
|
34
|
-
* -
|
|
34
|
+
* - to throw error for wrong Ergo address
|
|
35
35
|
*/
|
|
36
|
-
it('should
|
|
36
|
+
it('should throw error for wrong Ergo address', () => {
|
|
37
37
|
expect(() => {
|
|
38
38
|
validateAddress(ERGO_CHAIN, testData.invalidErgoAddress);
|
|
39
39
|
}).toThrow();
|
|
@@ -53,14 +53,14 @@ describe('validateAddress', () => {
|
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
* @target `validateAddress` should
|
|
56
|
+
* @target `validateAddress` should throw error for wrong Cardano address
|
|
57
57
|
* @dependencies
|
|
58
58
|
* @scenario
|
|
59
59
|
* - run test
|
|
60
60
|
* @expected
|
|
61
|
-
* -
|
|
61
|
+
* - to throw error for wrong Cardano address
|
|
62
62
|
*/
|
|
63
|
-
it('should
|
|
63
|
+
it('should throw error for wrong Cardano address', () => {
|
|
64
64
|
expect(() => {
|
|
65
65
|
validateAddress(CARDANO_CHAIN, testData.invalidCardanoAddress);
|
|
66
66
|
}).toThrow();
|
|
@@ -80,30 +80,30 @@ describe('validateAddress', () => {
|
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
* @target `validateAddress` should
|
|
83
|
+
* @target `validateAddress` should throw error for Bitcoin taproot address
|
|
84
84
|
* @dependencies
|
|
85
85
|
* @scenario
|
|
86
86
|
* - run test
|
|
87
87
|
* @expected
|
|
88
|
-
* -
|
|
88
|
+
* - to throw error for Bitcoin taproot address
|
|
89
89
|
*/
|
|
90
|
-
it('should
|
|
90
|
+
it('should throw error for Bitcoin taproot address', () => {
|
|
91
91
|
expect(() => {
|
|
92
92
|
validateAddress(BITCOIN_CHAIN, testData.tapRootBitcoinAddress);
|
|
93
93
|
}).toThrow(UnsupportedAddressError);
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
|
-
* @target `validateAddress` should
|
|
97
|
+
* @target `validateAddress` should throw error for wrong Bitcoin address
|
|
98
98
|
* @dependencies
|
|
99
99
|
* @scenario
|
|
100
100
|
* - run test
|
|
101
101
|
* @expected
|
|
102
|
-
* -
|
|
102
|
+
* - to throw error for wrong Bitcoin address
|
|
103
103
|
*/
|
|
104
|
-
it('should
|
|
104
|
+
it('should throw error for wrong Bitcoin address', () => {
|
|
105
105
|
expect(() => {
|
|
106
|
-
validateAddress(BITCOIN_CHAIN, testData.
|
|
106
|
+
validateAddress(BITCOIN_CHAIN, testData.invalidBitcoinAddress);
|
|
107
107
|
}).toThrowError();
|
|
108
108
|
});
|
|
109
109
|
|
|
@@ -121,28 +121,42 @@ describe('validateAddress', () => {
|
|
|
121
121
|
});
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
|
-
* @target `validateAddress` should
|
|
124
|
+
* @target `validateAddress` should throw error for ICAP Ethereum address
|
|
125
125
|
* @dependencies
|
|
126
126
|
* @scenario
|
|
127
127
|
* - run test
|
|
128
128
|
* @expected
|
|
129
|
-
* -
|
|
129
|
+
* - to throw error for ICAP Ethereum address
|
|
130
130
|
*/
|
|
131
|
-
it('should
|
|
131
|
+
it('should throw error for ICAP Ethereum address', () => {
|
|
132
132
|
expect(() => {
|
|
133
133
|
validateAddress(ETHEREUM_CHAIN, testData.invalidEthereumIcapAddress);
|
|
134
134
|
}).toThrow(UnsupportedAddressError);
|
|
135
135
|
});
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
|
-
* @target `validateAddress` should
|
|
138
|
+
* @target `validateAddress` should throw error for Ethereum address with checksum
|
|
139
139
|
* @dependencies
|
|
140
140
|
* @scenario
|
|
141
141
|
* - run test
|
|
142
142
|
* @expected
|
|
143
|
-
* -
|
|
143
|
+
* - to throw error for Ethereum address with checksum
|
|
144
144
|
*/
|
|
145
|
-
it('should
|
|
145
|
+
it('should throw error for Ethereum address with checksum', () => {
|
|
146
|
+
expect(() => {
|
|
147
|
+
validateAddress(ETHEREUM_CHAIN, testData.invalidEthereumChecksumAddress);
|
|
148
|
+
}).toThrow(UnsupportedAddressError);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @target `validateAddress` should throw error for wrong Ethereum address
|
|
153
|
+
* @dependencies
|
|
154
|
+
* @scenario
|
|
155
|
+
* - run test
|
|
156
|
+
* @expected
|
|
157
|
+
* - to throw error for wrong Ethereum address
|
|
158
|
+
*/
|
|
159
|
+
it('should throw error for wrong Ethereum address', () => {
|
|
146
160
|
expect(() => {
|
|
147
161
|
validateAddress(ETHEREUM_CHAIN, testData.invalidEthereumAddressLength);
|
|
148
162
|
}).toThrow(UnsupportedAddressError);
|