UNPKG

44.4 kBJavaScriptView Raw
1'use strict';
2
3var cov_7c8ruliiv = function () {
4 var path = '/Users/mxu/code/uport-connect/src/UportSubprovider.js',
5 hash = 'b17e30ca08c1cacf9f3e2dd1a16ad3135a500209',
6 Function = function () {}.constructor,
7 global = new Function('return this')(),
8 gcv = '__coverage__',
9 coverageData = {
10 path: '/Users/mxu/code/uport-connect/src/UportSubprovider.js',
11 statementMap: {
12 '0': {
13 start: {
14 line: 25,
15 column: 4
16 },
17 end: {
18 line: 31,
19 column: 5
20 }
21 },
22 '1': {
23 start: {
24 line: 27,
25 column: 6
26 },
27 end: {
28 line: 27,
29 column: 54
30 }
31 },
32 '2': {
33 start: {
34 line: 29,
35 column: 6
36 },
37 end: {
38 line: 29,
39 column: 30
40 }
41 },
42 '3': {
43 start: {
44 line: 30,
45 column: 6
46 },
47 end: {
48 line: 30,
49 column: 95
50 }
51 },
52 '4': {
53 start: {
54 line: 34,
55 column: 4
56 },
57 end: {
58 line: 43,
59 column: 5
60 }
61 },
62 '5': {
63 start: {
64 line: 38,
65 column: 6
66 },
67 end: {
68 line: 42,
69 column: 7
70 }
71 },
72 '6': {
73 start: {
74 line: 39,
75 column: 8
76 },
77 end: {
78 line: 39,
79 column: 39
80 }
81 },
82 '7': {
83 start: {
84 line: 41,
85 column: 8
86 },
87 end: {
88 line: 41,
89 column: 39
90 }
91 },
92 '8': {
93 start: {
94 line: 45,
95 column: 4
96 },
97 end: {
98 line: 45,
99 column: 26
100 }
101 },
102 '9': {
103 start: {
104 line: 46,
105 column: 4
106 },
107 end: {
108 line: 54,
109 column: 5
110 }
111 },
112 '10': {
113 start: {
114 line: 47,
115 column: 6
116 },
117 end: {
118 line: 47,
119 column: 53
120 }
121 },
122 '11': {
123 start: {
124 line: 47,
125 column: 24
126 },
127 end: {
128 line: 47,
129 column: 53
130 }
131 },
132 '12': {
133 start: {
134 line: 48,
135 column: 6
136 },
137 end: {
138 line: 53,
139 column: 27
140 }
141 },
142 '13': {
143 start: {
144 line: 50,
145 column: 29
146 },
147 end: {
148 line: 50,
149 column: 125
150 }
151 },
152 '14': {
153 start: {
154 line: 51,
155 column: 10
156 },
157 end: {
158 line: 51,
159 column: 76
160 }
161 },
162 '15': {
163 start: {
164 line: 53,
165 column: 17
166 },
167 end: {
168 line: 53,
169 column: 26
170 }
171 },
172 '16': {
173 start: {
174 line: 56,
175 column: 4
176 },
177 end: {
178 line: 61,
179 column: 5
180 }
181 },
182 '17': {
183 start: {
184 line: 57,
185 column: 6
186 },
187 end: {
188 line: 60,
189 column: 7
190 }
191 },
192 '18': {
193 start: {
194 line: 58,
195 column: 19
196 },
197 end: {
198 line: 58,
199 column: 36
200 }
201 },
202 '19': {
203 start: {
204 line: 59,
205 column: 17
206 },
207 end: {
208 line: 59,
209 column: 26
210 }
211 },
212 '20': {
213 start: {
214 line: 63,
215 column: 4
216 },
217 end: {
218 line: 68,
219 column: 5
220 }
221 },
222 '21': {
223 start: {
224 line: 64,
225 column: 6
226 },
227 end: {
228 line: 67,
229 column: 7
230 }
231 },
232 '22': {
233 start: {
234 line: 65,
235 column: 19
236 },
237 end: {
238 line: 65,
239 column: 63
240 }
241 },
242 '23': {
243 start: {
244 line: 66,
245 column: 17
246 },
247 end: {
248 line: 66,
249 column: 26
250 }
251 },
252 '24': {
253 start: {
254 line: 70,
255 column: 4
256 },
257 end: {
258 line: 75,
259 column: 5
260 }
261 },
262 '25': {
263 start: {
264 line: 71,
265 column: 6
266 },
267 end: {
268 line: 74,
269 column: 7
270 }
271 },
272 '26': {
273 start: {
274 line: 72,
275 column: 19
276 },
277 end: {
278 line: 72,
279 column: 63
280 }
281 },
282 '27': {
283 start: {
284 line: 73,
285 column: 17
286 },
287 end: {
288 line: 73,
289 column: 26
290 }
291 },
292 '28': {
293 start: {
294 line: 79,
295 column: 4
296 },
297 end: {
298 line: 86,
299 column: 5
300 }
301 },
302 '29': {
303 start: {
304 line: 80,
305 column: 19
306 },
307 end: {
308 line: 80,
309 column: 34
310 }
311 },
312 '30': {
313 start: {
314 line: 81,
315 column: 6
316 },
317 end: {
318 line: 84,
319 column: 7
320 }
321 },
322 '31': {
323 start: {
324 line: 82,
325 column: 8
326 },
327 end: {
328 line: 82,
329 column: 35
330 }
331 },
332 '32': {
333 start: {
334 line: 83,
335 column: 8
336 },
337 end: {
338 line: 83,
339 column: 19
340 }
341 },
342 '33': {
343 start: {
344 line: 85,
345 column: 6
346 },
347 end: {
348 line: 85,
349 column: 18
350 }
351 },
352 '34': {
353 start: {
354 line: 88,
355 column: 4
356 },
357 end: {
358 line: 88,
359 column: 70
360 }
361 },
362 '35': {
363 start: {
364 line: 89,
365 column: 4
366 },
367 end: {
368 line: 89,
369 column: 15
370 }
371 },
372 '36': {
373 start: {
374 line: 97,
375 column: 4
376 },
377 end: {
378 line: 97,
379 column: 44
380 }
381 },
382 '37': {
383 start: {
384 line: 111,
385 column: 40
386 },
387 end: {
388 line: 111,
389 column: 64
390 }
391 },
392 '38': {
393 start: {
394 line: 113,
395 column: 4
396 },
397 end: {
398 line: 116,
399 column: 5
400 }
401 },
402 '39': {
403 start: {
404 line: 114,
405 column: 6
406 },
407 end: {
408 line: 114,
409 column: 103
410 }
411 },
412 '40': {
413 start: {
414 line: 115,
415 column: 6
416 },
417 end: {
418 line: 115,
419 column: 66
420 }
421 },
422 '41': {
423 start: {
424 line: 115,
425 column: 20
426 },
427 end: {
428 line: 115,
429 column: 66
430 }
431 },
432 '42': {
433 start: {
434 line: 119,
435 column: 4
436 },
437 end: {
438 line: 122,
439 column: 5
440 }
441 },
442 '43': {
443 start: {
444 line: 120,
445 column: 6
446 },
447 end: {
448 line: 120,
449 column: 48
450 }
451 },
452 '44': {
453 start: {
454 line: 121,
455 column: 6
456 },
457 end: {
458 line: 121,
459 column: 12
460 }
461 },
462 '45': {
463 start: {
464 line: 124,
465 column: 20
466 },
467 end: {
468 line: 138,
469 column: 5
470 }
471 },
472 '46': {
473 start: {
474 line: 125,
475 column: 6
476 },
477 end: {
478 line: 137,
479 column: 7
480 }
481 },
482 '47': {
483 start: {
484 line: 126,
485 column: 8
486 },
487 end: {
488 line: 130,
489 column: 10
490 }
491 },
492 '48': {
493 start: {
494 line: 132,
495 column: 8
496 },
497 end: {
498 line: 136,
499 column: 10
500 }
501 },
502 '49': {
503 start: {
504 line: 139,
505 column: 4
506 },
507 end: {
508 line: 142,
509 column: 5
510 }
511 },
512 '50': {
513 start: {
514 line: 140,
515 column: 6
516 },
517 end: {
518 line: 140,
519 column: 61
520 }
521 },
522 '51': {
523 start: {
524 line: 141,
525 column: 6
526 },
527 end: {
528 line: 141,
529 column: 12
530 }
531 },
532 '52': {
533 start: {
534 line: 143,
535 column: 4
536 },
537 end: {
538 line: 163,
539 column: 5
540 }
541 },
542 '53': {
543 start: {
544 line: 146,
545 column: 8
546 },
547 end: {
548 line: 146,
549 column: 39
550 }
551 },
552 '54': {
553 start: {
554 line: 148,
555 column: 8
556 },
557 end: {
558 line: 150,
559 column: 10
560 }
561 },
562 '55': {
563 start: {
564 line: 149,
565 column: 10
566 },
567 end: {
568 line: 149,
569 column: 35
570 }
571 },
572 '56': {
573 start: {
574 line: 152,
575 column: 23
576 },
577 end: {
578 line: 152,
579 column: 40
580 }
581 },
582 '57': {
583 start: {
584 line: 153,
585 column: 8
586 },
587 end: {
588 line: 153,
589 column: 54
590 }
591 },
592 '58': {
593 start: {
594 line: 156,
595 column: 24
596 },
597 end: {
598 line: 156,
599 column: 41
600 }
601 },
602 '59': {
603 start: {
604 line: 157,
605 column: 8
606 },
607 end: {
608 line: 157,
609 column: 53
610 }
611 },
612 '60': {
613 start: {
614 line: 159,
615 column: 19
616 },
617 end: {
618 line: 159,
619 column: 36
620 }
621 },
622 '61': {
623 start: {
624 line: 160,
625 column: 8
626 },
627 end: {
628 line: 160,
629 column: 47
630 }
631 },
632 '62': {
633 start: {
634 line: 162,
635 column: 8
636 },
637 end: {
638 line: 162,
639 column: 57
640 }
641 },
642 '63': {
643 start: {
644 line: 168,
645 column: 2
646 },
647 end: {
648 line: 168,
649 column: 61
650 }
651 }
652 },
653 fnMap: {
654 '0': {
655 name: '(anonymous_0)',
656 decl: {
657 start: {
658 line: 24,
659 column: 2
660 },
661 end: {
662 line: 24,
663 column: 3
664 }
665 },
666 loc: {
667 start: {
668 line: 24,
669 column: 99
670 },
671 end: {
672 line: 76,
673 column: 3
674 }
675 },
676 line: 24
677 },
678 '1': {
679 name: '(anonymous_1)',
680 decl: {
681 start: {
682 line: 46,
683 column: 22
684 },
685 end: {
686 line: 46,
687 column: 23
688 }
689 },
690 loc: {
691 start: {
692 line: 46,
693 column: 30
694 },
695 end: {
696 line: 54,
697 column: 5
698 }
699 },
700 line: 46
701 },
702 '2': {
703 name: '(anonymous_2)',
704 decl: {
705 start: {
706 line: 49,
707 column: 8
708 },
709 end: {
710 line: 49,
711 column: 9
712 }
713 },
714 loc: {
715 start: {
716 line: 49,
717 column: 19
718 },
719 end: {
720 line: 52,
721 column: 9
722 }
723 },
724 line: 49
725 },
726 '3': {
727 name: '(anonymous_3)',
728 decl: {
729 start: {
730 line: 53,
731 column: 8
732 },
733 end: {
734 line: 53,
735 column: 9
736 }
737 },
738 loc: {
739 start: {
740 line: 53,
741 column: 17
742 },
743 end: {
744 line: 53,
745 column: 26
746 }
747 },
748 line: 53
749 },
750 '4': {
751 name: '(anonymous_4)',
752 decl: {
753 start: {
754 line: 56,
755 column: 27
756 },
757 end: {
758 line: 56,
759 column: 28
760 }
761 },
762 loc: {
763 start: {
764 line: 56,
765 column: 42
766 },
767 end: {
768 line: 61,
769 column: 5
770 }
771 },
772 line: 56
773 },
774 '5': {
775 name: '(anonymous_5)',
776 decl: {
777 start: {
778 line: 58,
779 column: 8
780 },
781 end: {
782 line: 58,
783 column: 9
784 }
785 },
786 loc: {
787 start: {
788 line: 58,
789 column: 19
790 },
791 end: {
792 line: 58,
793 column: 36
794 }
795 },
796 line: 58
797 },
798 '6': {
799 name: '(anonymous_6)',
800 decl: {
801 start: {
802 line: 59,
803 column: 8
804 },
805 end: {
806 line: 59,
807 column: 9
808 }
809 },
810 loc: {
811 start: {
812 line: 59,
813 column: 17
814 },
815 end: {
816 line: 59,
817 column: 26
818 }
819 },
820 line: 59
821 },
822 '7': {
823 name: '(anonymous_7)',
824 decl: {
825 start: {
826 line: 63,
827 column: 25
828 },
829 end: {
830 line: 63,
831 column: 26
832 }
833 },
834 loc: {
835 start: {
836 line: 63,
837 column: 44
838 },
839 end: {
840 line: 68,
841 column: 5
842 }
843 },
844 line: 63
845 },
846 '8': {
847 name: '(anonymous_8)',
848 decl: {
849 start: {
850 line: 65,
851 column: 8
852 },
853 end: {
854 line: 65,
855 column: 9
856 }
857 },
858 loc: {
859 start: {
860 line: 65,
861 column: 19
862 },
863 end: {
864 line: 65,
865 column: 63
866 }
867 },
868 line: 65
869 },
870 '9': {
871 name: '(anonymous_9)',
872 decl: {
873 start: {
874 line: 66,
875 column: 8
876 },
877 end: {
878 line: 66,
879 column: 9
880 }
881 },
882 loc: {
883 start: {
884 line: 66,
885 column: 17
886 },
887 end: {
888 line: 66,
889 column: 26
890 }
891 },
892 line: 66
893 },
894 '10': {
895 name: '(anonymous_10)',
896 decl: {
897 start: {
898 line: 70,
899 column: 24
900 },
901 end: {
902 line: 70,
903 column: 25
904 }
905 },
906 loc: {
907 start: {
908 line: 70,
909 column: 38
910 },
911 end: {
912 line: 75,
913 column: 5
914 }
915 },
916 line: 70
917 },
918 '11': {
919 name: '(anonymous_11)',
920 decl: {
921 start: {
922 line: 72,
923 column: 8
924 },
925 end: {
926 line: 72,
927 column: 9
928 }
929 },
930 loc: {
931 start: {
932 line: 72,
933 column: 19
934 },
935 end: {
936 line: 72,
937 column: 63
938 }
939 },
940 line: 72
941 },
942 '12': {
943 name: '(anonymous_12)',
944 decl: {
945 start: {
946 line: 73,
947 column: 8
948 },
949 end: {
950 line: 73,
951 column: 9
952 }
953 },
954 loc: {
955 start: {
956 line: 73,
957 column: 17
958 },
959 end: {
960 line: 73,
961 column: 26
962 }
963 },
964 line: 73
965 },
966 '13': {
967 name: '(anonymous_13)',
968 decl: {
969 start: {
970 line: 78,
971 column: 2
972 },
973 end: {
974 line: 78,
975 column: 3
976 }
977 },
978 loc: {
979 start: {
980 line: 78,
981 column: 22
982 },
983 end: {
984 line: 90,
985 column: 3
986 }
987 },
988 line: 78
989 },
990 '14': {
991 name: '(anonymous_14)',
992 decl: {
993 start: {
994 line: 96,
995 column: 2
996 },
997 end: {
998 line: 96,
999 column: 3
1000 }
1001 },
1002 loc: {
1003 start: {
1004 line: 96,
1005 column: 26
1006 },
1007 end: {
1008 line: 98,
1009 column: 3
1010 }
1011 },
1012 line: 96
1013 },
1014 '15': {
1015 name: '(anonymous_15)',
1016 decl: {
1017 start: {
1018 line: 110,
1019 column: 2
1020 },
1021 end: {
1022 line: 110,
1023 column: 3
1024 }
1025 },
1026 loc: {
1027 start: {
1028 line: 110,
1029 column: 37
1030 },
1031 end: {
1032 line: 164,
1033 column: 3
1034 }
1035 },
1036 line: 110
1037 },
1038 '16': {
1039 name: '(anonymous_16)',
1040 decl: {
1041 start: {
1042 line: 124,
1043 column: 20
1044 },
1045 end: {
1046 line: 124,
1047 column: 21
1048 }
1049 },
1050 loc: {
1051 start: {
1052 line: 124,
1053 column: 39
1054 },
1055 end: {
1056 line: 138,
1057 column: 5
1058 }
1059 },
1060 line: 124
1061 },
1062 '17': {
1063 name: '(anonymous_17)',
1064 decl: {
1065 start: {
1066 line: 148,
1067 column: 31
1068 },
1069 end: {
1070 line: 148,
1071 column: 32
1072 }
1073 },
1074 loc: {
1075 start: {
1076 line: 148,
1077 column: 51
1078 },
1079 end: {
1080 line: 150,
1081 column: 9
1082 }
1083 },
1084 line: 148
1085 },
1086 '18': {
1087 name: 'encodeSignature',
1088 decl: {
1089 start: {
1090 line: 167,
1091 column: 16
1092 },
1093 end: {
1094 line: 167,
1095 column: 31
1096 }
1097 },
1098 loc: {
1099 start: {
1100 line: 167,
1101 column: 45
1102 },
1103 end: {
1104 line: 169,
1105 column: 1
1106 }
1107 },
1108 line: 167
1109 }
1110 },
1111 branchMap: {
1112 '0': {
1113 loc: {
1114 start: {
1115 line: 25,
1116 column: 4
1117 },
1118 end: {
1119 line: 31,
1120 column: 5
1121 }
1122 },
1123 type: 'if',
1124 locations: [{
1125 start: {
1126 line: 25,
1127 column: 4
1128 },
1129 end: {
1130 line: 31,
1131 column: 5
1132 }
1133 }, {
1134 start: {
1135 line: 25,
1136 column: 4
1137 },
1138 end: {
1139 line: 31,
1140 column: 5
1141 }
1142 }],
1143 line: 25
1144 },
1145 '1': {
1146 loc: {
1147 start: {
1148 line: 34,
1149 column: 4
1150 },
1151 end: {
1152 line: 43,
1153 column: 5
1154 }
1155 },
1156 type: 'if',
1157 locations: [{
1158 start: {
1159 line: 34,
1160 column: 4
1161 },
1162 end: {
1163 line: 43,
1164 column: 5
1165 }
1166 }, {
1167 start: {
1168 line: 34,
1169 column: 4
1170 },
1171 end: {
1172 line: 43,
1173 column: 5
1174 }
1175 }],
1176 line: 34
1177 },
1178 '2': {
1179 loc: {
1180 start: {
1181 line: 38,
1182 column: 6
1183 },
1184 end: {
1185 line: 42,
1186 column: 7
1187 }
1188 },
1189 type: 'if',
1190 locations: [{
1191 start: {
1192 line: 38,
1193 column: 6
1194 },
1195 end: {
1196 line: 42,
1197 column: 7
1198 }
1199 }, {
1200 start: {
1201 line: 38,
1202 column: 6
1203 },
1204 end: {
1205 line: 42,
1206 column: 7
1207 }
1208 }],
1209 line: 38
1210 },
1211 '3': {
1212 loc: {
1213 start: {
1214 line: 47,
1215 column: 6
1216 },
1217 end: {
1218 line: 47,
1219 column: 53
1220 }
1221 },
1222 type: 'if',
1223 locations: [{
1224 start: {
1225 line: 47,
1226 column: 6
1227 },
1228 end: {
1229 line: 47,
1230 column: 53
1231 }
1232 }, {
1233 start: {
1234 line: 47,
1235 column: 6
1236 },
1237 end: {
1238 line: 47,
1239 column: 53
1240 }
1241 }],
1242 line: 47
1243 },
1244 '4': {
1245 loc: {
1246 start: {
1247 line: 51,
1248 column: 10
1249 },
1250 end: {
1251 line: 51,
1252 column: 76
1253 }
1254 },
1255 type: 'cond-expr',
1256 locations: [{
1257 start: {
1258 line: 51,
1259 column: 37
1260 },
1261 end: {
1262 line: 51,
1263 column: 59
1264 }
1265 }, {
1266 start: {
1267 line: 51,
1268 column: 62
1269 },
1270 end: {
1271 line: 51,
1272 column: 76
1273 }
1274 }],
1275 line: 51
1276 },
1277 '5': {
1278 loc: {
1279 start: {
1280 line: 79,
1281 column: 4
1282 },
1283 end: {
1284 line: 86,
1285 column: 5
1286 }
1287 },
1288 type: 'if',
1289 locations: [{
1290 start: {
1291 line: 79,
1292 column: 4
1293 },
1294 end: {
1295 line: 86,
1296 column: 5
1297 }
1298 }, {
1299 start: {
1300 line: 79,
1301 column: 4
1302 },
1303 end: {
1304 line: 86,
1305 column: 5
1306 }
1307 }],
1308 line: 79
1309 },
1310 '6': {
1311 loc: {
1312 start: {
1313 line: 79,
1314 column: 8
1315 },
1316 end: {
1317 line: 79,
1318 column: 42
1319 }
1320 },
1321 type: 'binary-expr',
1322 locations: [{
1323 start: {
1324 line: 79,
1325 column: 8
1326 },
1327 end: {
1328 line: 79,
1329 column: 23
1330 }
1331 }, {
1332 start: {
1333 line: 79,
1334 column: 27
1335 },
1336 end: {
1337 line: 79,
1338 column: 42
1339 }
1340 }],
1341 line: 79
1342 },
1343 '7': {
1344 loc: {
1345 start: {
1346 line: 81,
1347 column: 6
1348 },
1349 end: {
1350 line: 84,
1351 column: 7
1352 }
1353 },
1354 type: 'if',
1355 locations: [{
1356 start: {
1357 line: 81,
1358 column: 6
1359 },
1360 end: {
1361 line: 84,
1362 column: 7
1363 }
1364 }, {
1365 start: {
1366 line: 81,
1367 column: 6
1368 },
1369 end: {
1370 line: 84,
1371 column: 7
1372 }
1373 }],
1374 line: 81
1375 },
1376 '8': {
1377 loc: {
1378 start: {
1379 line: 88,
1380 column: 19
1381 },
1382 end: {
1383 line: 88,
1384 column: 70
1385 }
1386 },
1387 type: 'cond-expr',
1388 locations: [{
1389 start: {
1390 line: 88,
1391 column: 37
1392 },
1393 end: {
1394 line: 88,
1395 column: 60
1396 }
1397 }, {
1398 start: {
1399 line: 88,
1400 column: 63
1401 },
1402 end: {
1403 line: 88,
1404 column: 70
1405 }
1406 }],
1407 line: 88
1408 },
1409 '9': {
1410 loc: {
1411 start: {
1412 line: 113,
1413 column: 4
1414 },
1415 end: {
1416 line: 116,
1417 column: 5
1418 }
1419 },
1420 type: 'if',
1421 locations: [{
1422 start: {
1423 line: 113,
1424 column: 4
1425 },
1426 end: {
1427 line: 116,
1428 column: 5
1429 }
1430 }, {
1431 start: {
1432 line: 113,
1433 column: 4
1434 },
1435 end: {
1436 line: 116,
1437 column: 5
1438 }
1439 }],
1440 line: 113
1441 },
1442 '10': {
1443 loc: {
1444 start: {
1445 line: 113,
1446 column: 8
1447 },
1448 end: {
1449 line: 113,
1450 column: 61
1451 }
1452 },
1453 type: 'binary-expr',
1454 locations: [{
1455 start: {
1456 line: 113,
1457 column: 8
1458 },
1459 end: {
1460 line: 113,
1461 column: 32
1462 }
1463 }, {
1464 start: {
1465 line: 113,
1466 column: 36
1467 },
1468 end: {
1469 line: 113,
1470 column: 61
1471 }
1472 }],
1473 line: 113
1474 },
1475 '11': {
1476 loc: {
1477 start: {
1478 line: 115,
1479 column: 6
1480 },
1481 end: {
1482 line: 115,
1483 column: 66
1484 }
1485 },
1486 type: 'if',
1487 locations: [{
1488 start: {
1489 line: 115,
1490 column: 6
1491 },
1492 end: {
1493 line: 115,
1494 column: 66
1495 }
1496 }, {
1497 start: {
1498 line: 115,
1499 column: 6
1500 },
1501 end: {
1502 line: 115,
1503 column: 66
1504 }
1505 }],
1506 line: 115
1507 },
1508 '12': {
1509 loc: {
1510 start: {
1511 line: 119,
1512 column: 4
1513 },
1514 end: {
1515 line: 122,
1516 column: 5
1517 }
1518 },
1519 type: 'if',
1520 locations: [{
1521 start: {
1522 line: 119,
1523 column: 4
1524 },
1525 end: {
1526 line: 122,
1527 column: 5
1528 }
1529 }, {
1530 start: {
1531 line: 119,
1532 column: 4
1533 },
1534 end: {
1535 line: 122,
1536 column: 5
1537 }
1538 }],
1539 line: 119
1540 },
1541 '13': {
1542 loc: {
1543 start: {
1544 line: 125,
1545 column: 6
1546 },
1547 end: {
1548 line: 137,
1549 column: 7
1550 }
1551 },
1552 type: 'if',
1553 locations: [{
1554 start: {
1555 line: 125,
1556 column: 6
1557 },
1558 end: {
1559 line: 137,
1560 column: 7
1561 }
1562 }, {
1563 start: {
1564 line: 125,
1565 column: 6
1566 },
1567 end: {
1568 line: 137,
1569 column: 7
1570 }
1571 }],
1572 line: 125
1573 },
1574 '14': {
1575 loc: {
1576 start: {
1577 line: 139,
1578 column: 4
1579 },
1580 end: {
1581 line: 142,
1582 column: 5
1583 }
1584 },
1585 type: 'if',
1586 locations: [{
1587 start: {
1588 line: 139,
1589 column: 4
1590 },
1591 end: {
1592 line: 142,
1593 column: 5
1594 }
1595 }, {
1596 start: {
1597 line: 139,
1598 column: 4
1599 },
1600 end: {
1601 line: 142,
1602 column: 5
1603 }
1604 }],
1605 line: 139
1606 },
1607 '15': {
1608 loc: {
1609 start: {
1610 line: 143,
1611 column: 4
1612 },
1613 end: {
1614 line: 163,
1615 column: 5
1616 }
1617 },
1618 type: 'switch',
1619 locations: [{
1620 start: {
1621 line: 145,
1622 column: 6
1623 },
1624 end: {
1625 line: 146,
1626 column: 39
1627 }
1628 }, {
1629 start: {
1630 line: 147,
1631 column: 6
1632 },
1633 end: {
1634 line: 150,
1635 column: 10
1636 }
1637 }, {
1638 start: {
1639 line: 151,
1640 column: 6
1641 },
1642 end: {
1643 line: 153,
1644 column: 54
1645 }
1646 }, {
1647 start: {
1648 line: 154,
1649 column: 6
1650 },
1651 end: {
1652 line: 154,
1653 column: 34
1654 }
1655 }, {
1656 start: {
1657 line: 155,
1658 column: 6
1659 },
1660 end: {
1661 line: 157,
1662 column: 53
1663 }
1664 }, {
1665 start: {
1666 line: 158,
1667 column: 6
1668 },
1669 end: {
1670 line: 160,
1671 column: 47
1672 }
1673 }, {
1674 start: {
1675 line: 161,
1676 column: 6
1677 },
1678 end: {
1679 line: 162,
1680 column: 57
1681 }
1682 }],
1683 line: 143
1684 }
1685 },
1686 s: {
1687 '0': 0,
1688 '1': 0,
1689 '2': 0,
1690 '3': 0,
1691 '4': 0,
1692 '5': 0,
1693 '6': 0,
1694 '7': 0,
1695 '8': 0,
1696 '9': 0,
1697 '10': 0,
1698 '11': 0,
1699 '12': 0,
1700 '13': 0,
1701 '14': 0,
1702 '15': 0,
1703 '16': 0,
1704 '17': 0,
1705 '18': 0,
1706 '19': 0,
1707 '20': 0,
1708 '21': 0,
1709 '22': 0,
1710 '23': 0,
1711 '24': 0,
1712 '25': 0,
1713 '26': 0,
1714 '27': 0,
1715 '28': 0,
1716 '29': 0,
1717 '30': 0,
1718 '31': 0,
1719 '32': 0,
1720 '33': 0,
1721 '34': 0,
1722 '35': 0,
1723 '36': 0,
1724 '37': 0,
1725 '38': 0,
1726 '39': 0,
1727 '40': 0,
1728 '41': 0,
1729 '42': 0,
1730 '43': 0,
1731 '44': 0,
1732 '45': 0,
1733 '46': 0,
1734 '47': 0,
1735 '48': 0,
1736 '49': 0,
1737 '50': 0,
1738 '51': 0,
1739 '52': 0,
1740 '53': 0,
1741 '54': 0,
1742 '55': 0,
1743 '56': 0,
1744 '57': 0,
1745 '58': 0,
1746 '59': 0,
1747 '60': 0,
1748 '61': 0,
1749 '62': 0,
1750 '63': 0
1751 },
1752 f: {
1753 '0': 0,
1754 '1': 0,
1755 '2': 0,
1756 '3': 0,
1757 '4': 0,
1758 '5': 0,
1759 '6': 0,
1760 '7': 0,
1761 '8': 0,
1762 '9': 0,
1763 '10': 0,
1764 '11': 0,
1765 '12': 0,
1766 '13': 0,
1767 '14': 0,
1768 '15': 0,
1769 '16': 0,
1770 '17': 0,
1771 '18': 0
1772 },
1773 b: {
1774 '0': [0, 0],
1775 '1': [0, 0],
1776 '2': [0, 0],
1777 '3': [0, 0],
1778 '4': [0, 0],
1779 '5': [0, 0],
1780 '6': [0, 0],
1781 '7': [0, 0],
1782 '8': [0, 0],
1783 '9': [0, 0],
1784 '10': [0, 0],
1785 '11': [0, 0],
1786 '12': [0, 0],
1787 '13': [0, 0],
1788 '14': [0, 0],
1789 '15': [0, 0, 0, 0, 0, 0, 0]
1790 },
1791 _coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c'
1792 },
1793 coverage = global[gcv] || (global[gcv] = {});
1794
1795 if (coverage[path] && coverage[path].hash === hash) {
1796 return coverage[path];
1797 }
1798
1799 coverageData.hash = hash;
1800 return coverage[path] = coverageData;
1801}();
1802
1803Object.defineProperty(exports, "__esModule", {
1804 value: true
1805});
1806
1807var _regenerator = require('babel-runtime/regenerator');
1808
1809var _regenerator2 = _interopRequireDefault(_regenerator);
1810
1811var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
1812
1813var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
1814
1815var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
1816
1817var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
1818
1819var _createClass2 = require('babel-runtime/helpers/createClass');
1820
1821var _createClass3 = _interopRequireDefault(_createClass2);
1822
1823exports.encodeSignature = encodeSignature;
1824
1825var _async = require('async');
1826
1827var _async2 = _interopRequireDefault(_async);
1828
1829var _mnid = require('mnid');
1830
1831var _ethjsProviderHttp = require('ethjs-provider-http');
1832
1833var _ethjsProviderHttp2 = _interopRequireDefault(_ethjsProviderHttp);
1834
1835var _ui = require('uport-transports/lib/transport/ui');
1836
1837var _util = require('./util');
1838
1839function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1840
1841/**
1842 * A web3 style provider which can easily be wrapped with uPort functionality.
1843 * Builds on a base provider. Used in Connect to wrap a provider with uPort specific
1844 * functionality.
1845 */
1846var UportSubprovider = function () {
1847 /**
1848 * Instantiates a new wrapped provider
1849 *
1850 * @param {Object} args required arguments
1851 * @param {Function} args.requestAddress function to get the address of a uPort identity.
1852 * @param {Function} args.sendTransaction function to handle passing transaction information to a uPort application
1853 * @param {Object} args.provider a web3 sytle provider
1854 * @return {UportSubprovider} this
1855 */
1856 function UportSubprovider(_ref) {
1857 var _this = this;
1858
1859 var requestAddress = _ref.requestAddress,
1860 sendTransaction = _ref.sendTransaction,
1861 signTypedData = _ref.signTypedData,
1862 personalSign = _ref.personalSign,
1863 provider = _ref.provider,
1864 network = _ref.network;
1865 (0, _classCallCheck3.default)(this, UportSubprovider);
1866 cov_7c8ruliiv.f[0]++;
1867 cov_7c8ruliiv.s[0]++;
1868
1869 if (!provider) {
1870 cov_7c8ruliiv.b[0][0]++;
1871 cov_7c8ruliiv.s[1]++;
1872
1873 // Extend ethjs HTTP provider if none is given
1874 this.provider = new _ethjsProviderHttp2.default(network.rpcUrl);
1875 } else {
1876 cov_7c8ruliiv.b[0][1]++;
1877 cov_7c8ruliiv.s[2]++;
1878
1879 this.provider = provider;
1880 cov_7c8ruliiv.s[3]++;
1881 console.warn('Uport functionality may not be entirely compatible with custom providers.');
1882 }
1883
1884 // Detect injected provider
1885 cov_7c8ruliiv.s[4]++;
1886 if ((0, _util.hasWeb3)()) {
1887 cov_7c8ruliiv.b[1][0]++;
1888 cov_7c8ruliiv.s[5]++;
1889
1890 // Distinguish between providers in mobile and other cases
1891 // Metamask/mist etc. will give the option to use uport
1892 // Mobile injected providers (coinbase wallet, etc.) will be used automatically
1893 if ((0, _util.isMobile)()) {
1894 cov_7c8ruliiv.b[2][0]++;
1895 cov_7c8ruliiv.s[6]++;
1896
1897 this.useInjectedProvider = true;
1898 } else {
1899 cov_7c8ruliiv.b[2][1]++;
1900 cov_7c8ruliiv.s[7]++;
1901
1902 this.hasInjectedProvider = true;
1903 }
1904 } else {
1905 cov_7c8ruliiv.b[1][1]++;
1906 }
1907
1908 cov_7c8ruliiv.s[8]++;
1909 this.network = network;
1910 cov_7c8ruliiv.s[9]++;
1911 this.getAddress = function (cb) {
1912 cov_7c8ruliiv.f[1]++;
1913 cov_7c8ruliiv.s[10]++;
1914
1915 if (_this.address) {
1916 cov_7c8ruliiv.b[3][0]++;
1917 cov_7c8ruliiv.s[11]++;
1918 return cb(null, _this.address);
1919 } else {
1920 cov_7c8ruliiv.b[3][1]++;
1921 }cov_7c8ruliiv.s[12]++;
1922 requestAddress().then(function (address) {
1923 cov_7c8ruliiv.f[2]++;
1924
1925 var errorMatch = (cov_7c8ruliiv.s[13]++, new Error('Address/Account received does not match the network your provider is configured for'));
1926 cov_7c8ruliiv.s[14]++;
1927 _this.setAccount(address) ? (cov_7c8ruliiv.b[4][0]++, cb(null, _this.address)) : (cov_7c8ruliiv.b[4][1]++, cb(errorMatch));
1928 }, function (error) {
1929 cov_7c8ruliiv.f[3]++;
1930 cov_7c8ruliiv.s[15]++;
1931 return cb(error);
1932 });
1933 };
1934
1935 cov_7c8ruliiv.s[16]++;
1936 this.sendTransaction = function (txobj, cb) {
1937 cov_7c8ruliiv.f[4]++;
1938 cov_7c8ruliiv.s[17]++;
1939
1940 sendTransaction(txobj).then(function (address) {
1941 cov_7c8ruliiv.f[5]++;
1942 cov_7c8ruliiv.s[18]++;
1943 return cb(null, address);
1944 }, function (error) {
1945 cov_7c8ruliiv.f[6]++;
1946 cov_7c8ruliiv.s[19]++;
1947 return cb(error);
1948 });
1949 };
1950
1951 cov_7c8ruliiv.s[20]++;
1952 this.signTypedData = function (typedData, cb) {
1953 cov_7c8ruliiv.f[7]++;
1954 cov_7c8ruliiv.s[21]++;
1955
1956 signTypedData(typedData).then(function (payload) {
1957 cov_7c8ruliiv.f[8]++;
1958 cov_7c8ruliiv.s[22]++;
1959 return cb(null, encodeSignature(payload.signature));
1960 }, function (error) {
1961 cov_7c8ruliiv.f[9]++;
1962 cov_7c8ruliiv.s[23]++;
1963 return cb(error);
1964 });
1965 };
1966
1967 cov_7c8ruliiv.s[24]++;
1968 this.personalSign = function (data, cb) {
1969 cov_7c8ruliiv.f[10]++;
1970 cov_7c8ruliiv.s[25]++;
1971
1972 personalSign(data).then(function (payload) {
1973 cov_7c8ruliiv.f[11]++;
1974 cov_7c8ruliiv.s[26]++;
1975 return cb(null, encodeSignature(payload.signature));
1976 }, function (error) {
1977 cov_7c8ruliiv.f[12]++;
1978 cov_7c8ruliiv.s[27]++;
1979 return cb(error);
1980 });
1981 };
1982 }
1983
1984 (0, _createClass3.default)(UportSubprovider, [{
1985 key: 'setAccount',
1986 value: function setAccount(address) {
1987 cov_7c8ruliiv.f[13]++;
1988 cov_7c8ruliiv.s[28]++;
1989
1990 if ((cov_7c8ruliiv.b[6][0]++, this.network.id) && (cov_7c8ruliiv.b[6][1]++, (0, _mnid.isMNID)(address))) {
1991 cov_7c8ruliiv.b[5][0]++;
1992
1993 var mnid = (cov_7c8ruliiv.s[29]++, (0, _mnid.decode)(address));
1994 cov_7c8ruliiv.s[30]++;
1995 if (this.network.id === mnid.network) {
1996 cov_7c8ruliiv.b[7][0]++;
1997 cov_7c8ruliiv.s[31]++;
1998
1999 this.address = mnid.address;
2000 cov_7c8ruliiv.s[32]++;
2001 return true;
2002 } else {
2003 cov_7c8ruliiv.b[7][1]++;
2004 }
2005 cov_7c8ruliiv.s[33]++;
2006 return false;
2007 } else {
2008 cov_7c8ruliiv.b[5][1]++;
2009 }
2010 // Does not force validation, if no network id given will still set address
2011 cov_7c8ruliiv.s[34]++;
2012 this.address = (0, _mnid.isMNID)(address) ? (cov_7c8ruliiv.b[8][0]++, (0, _mnid.decode)(address).address) : (cov_7c8ruliiv.b[8][1]++, address);
2013 cov_7c8ruliiv.s[35]++;
2014 return true;
2015 }
2016
2017 /**
2018 * Replace sync send with async send
2019 * @private
2020 */
2021
2022 }, {
2023 key: 'send',
2024 value: function send(payload, callback) {
2025 cov_7c8ruliiv.f[14]++;
2026 cov_7c8ruliiv.s[36]++;
2027
2028 return this.sendAsync(payload, callback);
2029 }
2030
2031 /**
2032 * Overrides sendAsync to caputure the following RPC calls eth_coinbase, eth_accounts,
2033 * and eth_sendTransaction. All other calls are passed to the based provider.
2034 * eth_coinbase, eth_accounts will get a uPort identity address with getAddress.
2035 * While eth_sendTransaction with send transactions to a uPort app with sendTransaction
2036 *
2037 * @param {Any} payload request payload
2038 * @param {Function} callback called with response or error
2039 * @private
2040 */
2041
2042 }, {
2043 key: 'sendAsync',
2044 value: function () {
2045 var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(payload, callback) {
2046 var remember, useInjectedProvider, _ref3, respond, txParams, typedData, data;
2047
2048 return _regenerator2.default.wrap(function _callee$(_context) {
2049 while (1) {
2050 switch (_context.prev = _context.next) {
2051 case 0:
2052 cov_7c8ruliiv.f[15]++;
2053 remember = void 0, useInjectedProvider = (cov_7c8ruliiv.s[37]++, this.useInjectedProvider);
2054 // Present a dialog to ask about using injected provider if present but not approved
2055
2056 cov_7c8ruliiv.s[38]++;
2057
2058 if (!((cov_7c8ruliiv.b[10][0]++, this.hasInjectedProvider) && (cov_7c8ruliiv.b[10][1]++, !this.useInjectedProvider))) {
2059 _context.next = 15;
2060 break;
2061 }
2062
2063 cov_7c8ruliiv.b[9][0]++;
2064 cov_7c8ruliiv.s[39]++;
2065 _context.next = 8;
2066 return (0, _ui.askProvider)(payload.method === 'eth_sendTransaction');
2067
2068 case 8:
2069 _ref3 = _context.sent;
2070 remember = _ref3.remember;
2071 useInjectedProvider = _ref3.useInjectedProvider;
2072 cov_7c8ruliiv.s[40]++;
2073
2074 if (remember) {
2075 cov_7c8ruliiv.b[11][0]++;
2076 cov_7c8ruliiv.s[41]++;
2077 this.useInjectedProvider = useInjectedProvider;
2078 } else {
2079 cov_7c8ruliiv.b[11][1]++;
2080 }_context.next = 16;
2081 break;
2082
2083 case 15:
2084 cov_7c8ruliiv.b[9][1]++;
2085
2086 case 16:
2087 cov_7c8ruliiv.s[42]++;
2088
2089 if (!useInjectedProvider) {
2090 _context.next = 25;
2091 break;
2092 }
2093
2094 cov_7c8ruliiv.b[12][0]++;
2095 cov_7c8ruliiv.s[43]++;
2096
2097 web3.provider.sendAsync(payload, callback);
2098 cov_7c8ruliiv.s[44]++;
2099 return _context.abrupt('return');
2100
2101 case 25:
2102 cov_7c8ruliiv.b[12][1]++;
2103
2104 case 26:
2105 cov_7c8ruliiv.s[45]++;
2106
2107 respond = function respond(error, result) {
2108 cov_7c8ruliiv.f[16]++;
2109 cov_7c8ruliiv.s[46]++;
2110
2111 if (error) {
2112 cov_7c8ruliiv.b[13][0]++;
2113 cov_7c8ruliiv.s[47]++;
2114
2115 callback({
2116 id: payload.id,
2117 jsonrpc: '2.0',
2118 error: error.message
2119 });
2120 } else {
2121 cov_7c8ruliiv.b[13][1]++;
2122 cov_7c8ruliiv.s[48]++;
2123
2124 callback(null, {
2125 id: payload.id,
2126 jsonrpc: '2.0',
2127 result: result
2128 });
2129 }
2130 };
2131
2132 cov_7c8ruliiv.s[49]++;
2133
2134 if (!Array.isArray(payload)) {
2135 _context.next = 37;
2136 break;
2137 }
2138
2139 cov_7c8ruliiv.b[14][0]++;
2140 cov_7c8ruliiv.s[50]++;
2141
2142 _async2.default.map(payload, this.sendAsync.bind(this), callback);
2143 cov_7c8ruliiv.s[51]++;
2144 return _context.abrupt('return');
2145
2146 case 37:
2147 cov_7c8ruliiv.b[14][1]++;
2148
2149 case 38:
2150 cov_7c8ruliiv.s[52]++;
2151 _context.t0 = payload.method;
2152 _context.next = _context.t0 === 'eth_coinbase' ? 42 : _context.t0 === 'eth_accounts' ? 45 : _context.t0 === 'eth_sendTransaction' ? 48 : _context.t0 === 'eth_signTypedData_v3' ? 52 : _context.t0 === 'eth_signTypedData' ? 53 : _context.t0 === 'personal_sign' ? 57 : 61;
2153 break;
2154
2155 case 42:
2156 cov_7c8ruliiv.b[15][0]++;
2157 cov_7c8ruliiv.s[53]++;
2158 return _context.abrupt('return', this.getAddress(respond));
2159
2160 case 45:
2161 cov_7c8ruliiv.b[15][1]++;
2162 cov_7c8ruliiv.s[54]++;
2163 return _context.abrupt('return', this.getAddress(function (error, address) {
2164 cov_7c8ruliiv.f[17]++;
2165 cov_7c8ruliiv.s[55]++;
2166
2167 respond(error, [address]);
2168 }));
2169
2170 case 48:
2171 cov_7c8ruliiv.b[15][2]++;
2172 txParams = (cov_7c8ruliiv.s[56]++, payload.params[0]);
2173 cov_7c8ruliiv.s[57]++;
2174 return _context.abrupt('return', this.sendTransaction(txParams, respond));
2175
2176 case 52:
2177 cov_7c8ruliiv.b[15][3]++;
2178
2179 case 53:
2180 cov_7c8ruliiv.b[15][4]++;
2181 typedData = (cov_7c8ruliiv.s[58]++, payload.params[0]);
2182 cov_7c8ruliiv.s[59]++;
2183 return _context.abrupt('return', this.signTypedData(typedData, respond));
2184
2185 case 57:
2186 cov_7c8ruliiv.b[15][5]++;
2187 data = (cov_7c8ruliiv.s[60]++, payload.params[0]);
2188 cov_7c8ruliiv.s[61]++;
2189 return _context.abrupt('return', this.personalSign(data, respond));
2190
2191 case 61:
2192 cov_7c8ruliiv.b[15][6]++;
2193 cov_7c8ruliiv.s[62]++;
2194 return _context.abrupt('return', this.provider.sendAsync(payload, callback));
2195
2196 case 64:
2197 case 'end':
2198 return _context.stop();
2199 }
2200 }
2201 }, _callee, this);
2202 }));
2203
2204 function sendAsync(_x, _x2) {
2205 return _ref2.apply(this, arguments);
2206 }
2207
2208 return sendAsync;
2209 }()
2210 }]);
2211 return UportSubprovider;
2212}();
2213
2214function encodeSignature(_ref4) {
2215 var r = _ref4.r,
2216 s = _ref4.s,
2217 v = _ref4.v;
2218 cov_7c8ruliiv.f[18]++;
2219 cov_7c8ruliiv.s[63]++;
2220
2221 return '0x' + r.padStart(64, '0') + s.padStart(64, '0') + v;
2222}
2223
2224exports.default = UportSubprovider;
\No newline at end of file