@@ -256,7 +256,7 @@ export const toHexInvalidData: [any, string][] = [
256256 [ undefined , 'Invalid value given "undefined". Error: can not be converted to hex.' ] ,
257257] ;
258258
259- const conversionBaseData : [ [ Numbers , EtherUnits ] , string ] [ ] = [
259+ const conversionBaseData : [ [ Numbers , EtherUnits | number ] , string ] [ ] = [
260260 [ [ 0 , 'wei' ] , '0' ] ,
261261 [ [ 123 , 'wei' ] , '123' ] ,
262262 [ [ '123' , 'wei' ] , '123' ] ,
@@ -290,9 +290,35 @@ const conversionBaseData: [[Numbers, EtherUnits], string][] = [
290290 [ [ '178373938391829348' , 'ether' ] , '0.178373938391829348' ] ,
291291 [ [ '879123456788877661' , 'gwei' ] , '879123456.788877661' ] ,
292292 [ [ '879123456788877661' , 'tether' ] , '0.000000000000879123456788877661' ] ,
293+ [ [ '1' , 0 ] , '1' ] ,
294+ [ [ '1' , 1 ] , '0.1' ] ,
295+ [ [ '1' , 2 ] , '0.01' ] ,
296+ [ [ '1' , 3 ] , '0.001' ] ,
297+ [ [ '1' , 4 ] , '0.0001' ] ,
298+ [ [ '1' , 5 ] , '0.00001' ] ,
299+ [ [ '1' , 6 ] , '0.000001' ] ,
300+ [ [ '1' , 7 ] , '0.0000001' ] ,
301+ [ [ '1' , 8 ] , '0.00000001' ] ,
302+ [ [ '1' , 9 ] , '0.000000001' ] ,
303+ [ [ '1' , 10 ] , '0.0000000001' ] ,
304+ [ [ 1 , 18 ] , '0.000000000000000001' ] ,
305+ [ [ 100 , 2 ] , '1' ] ,
306+ [ [ '100' , 2 ] , '1' ] ,
307+ [ [ '1000' , 3 ] , '1' ] ,
308+ [ [ '10000' , 4 ] , '1' ] ,
309+ [ [ '100000' , 5 ] , '1' ] ,
310+ [ [ '1000000' , 6 ] , '1' ] ,
311+ [ [ '10000000' , 7 ] , '1' ] ,
312+ [ [ '100000000' , 8 ] , '1' ] ,
313+ [ [ '1000000000' , 9 ] , '1' ] ,
314+ [ [ '10000000000' , 10 ] , '1' ] ,
315+ [ [ '100000000000' , 11 ] , '1' ] ,
316+ [ [ '1000000000000' , 12 ] , '1' ] ,
317+ [ [ '10000000000000' , 13 ] , '1' ] ,
318+ [ [ '1000000000000000000' , 18 ] , '1' ] ,
293319] ;
294320
295- export const fromWeiValidData : [ [ Numbers , EtherUnits ] , Numbers ] [ ] = [
321+ export const fromWeiValidData : [ [ Numbers , EtherUnits | number ] , Numbers ] [ ] = [
296322 ...conversionBaseData ,
297323 [ [ '0xff' , 'wei' ] , '255' ] ,
298324 [ [ 1e+22 , 'ether' ] , '10000' ] ,
@@ -305,7 +331,7 @@ export const fromWeiValidData: [[Numbers, EtherUnits], Numbers][] = [
305331 [ [ '3308685546611893' , 'ether' ] , '0.003308685546611893' ]
306332] ;
307333
308- export const toWeiValidData : [ [ Numbers , EtherUnits ] , Numbers ] [ ] = [
334+ export const toWeiValidData : [ [ Numbers , EtherUnits | number ] , Numbers ] [ ] = [
309335 ...conversionBaseData ,
310336 [ [ '255' , 'wei' ] , '0xFF' ] ,
311337 [ [ '100000000000' , 'ether' ] , 0.0000001 ] ,
@@ -336,6 +362,8 @@ export const fromWeiInvalidData: [[any, any], string][] = [
336362 [ [ { } , 'kwei' ] , 'Invalid value given "{}". Error: can not parse as number data' ] ,
337363 [ [ 'data' , 'kwei' ] , 'Invalid value given "data". Error: can not parse as number data.' ] ,
338364 [ [ '1234' , 'uwei' ] , 'Invalid value given "uwei". Error: invalid unit.' ] ,
365+ [ [ '1234' , - 1 ] , 'Invalid value given "-1". Error: not a valid unit. Must be a positive integer.' ] ,
366+ [ [ '1234' , 3.3 ] , 'Invalid value given "3.3". Error: not a valid unit. Must be a positive integer.' ]
339367] ;
340368
341369export const toWeiInvalidData : [ [ any , any ] , string ] [ ] = [
0 commit comments