diff --git a/.gitignore b/.gitignore index 8e053a5..d66f268 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ node_modules - - +jscoverage +.nyc_output test_controller_optimism.js \ No newline at end of file diff --git a/.nyc_output/03c6e1d5-7af9-493f-8384-84dce7e71f66.json b/.nyc_output/03c6e1d5-7af9-493f-8384-84dce7e71f66.json deleted file mode 100644 index 7b8054e..0000000 --- a/.nyc_output/03c6e1d5-7af9-493f-8384-84dce7e71f66.json +++ /dev/null @@ -1 +0,0 @@ -{"/Users/subhanshumg/Downloads/getsafle/vs code/github/vault-optimism-controller/src/index.js":{"path":"/Users/subhanshumg/Downloads/getsafle/vs code/github/vault-optimism-controller/src/index.js","statementMap":{"0":{"start":{"line":2,"column":25},"end":{"line":2,"column":42}},"1":{"start":{"line":3,"column":12},"end":{"line":3,"column":31}},"2":{"start":{"line":4,"column":16},"end":{"line":4,"column":42}},"3":{"start":{"line":5,"column":11},"end":{"line":5,"column":35}},"4":{"start":{"line":7,"column":14},"end":{"line":7,"column":30}},"5":{"start":{"line":8,"column":24},"end":{"line":8,"column":44}},"6":{"start":{"line":9,"column":18},"end":{"line":9,"column":47}},"7":{"start":{"line":10,"column":40},"end":{"line":10,"column":63}},"8":{"start":{"line":12,"column":22},"end":{"line":12,"column":51}},"9":{"start":{"line":13,"column":18},"end":{"line":13,"column":43}},"10":{"start":{"line":15,"column":21},"end":{"line":18,"column":1}},"11":{"start":{"line":27,"column":8},"end":{"line":27,"column":15}},"12":{"start":{"line":28,"column":26},"end":{"line":28,"column":46}},"13":{"start":{"line":29,"column":8},"end":{"line":29,"column":101}},"14":{"start":{"line":30,"column":8},"end":{"line":30,"column":51}},"15":{"start":{"line":31,"column":8},"end":{"line":35,"column":10}},"16":{"start":{"line":33,"column":57},"end":{"line":33,"column":65}},"17":{"start":{"line":37,"column":8},"end":{"line":37,"column":52}},"18":{"start":{"line":38,"column":8},"end":{"line":38,"column":26}},"19":{"start":{"line":39,"column":8},"end":{"line":39,"column":41}},"20":{"start":{"line":40,"column":8},"end":{"line":40,"column":33}},"21":{"start":{"line":56,"column":8},"end":{"line":56,"column":53}},"22":{"start":{"line":57,"column":8},"end":{"line":57,"column":39}},"23":{"start":{"line":73,"column":8},"end":{"line":77,"column":45}},"24":{"start":{"line":93,"column":8},"end":{"line":95,"column":9}},"25":{"start":{"line":94,"column":12},"end":{"line":94,"column":70}},"26":{"start":{"line":97,"column":8},"end":{"line":99,"column":9}},"27":{"start":{"line":98,"column":12},"end":{"line":98,"column":71}},"28":{"start":{"line":101,"column":8},"end":{"line":101,"column":28}},"29":{"start":{"line":103,"column":8},"end":{"line":121,"column":45}},"30":{"start":{"line":105,"column":16},"end":{"line":108,"column":18}},"31":{"start":{"line":111,"column":16},"end":{"line":111,"column":49}},"32":{"start":{"line":114,"column":16},"end":{"line":116,"column":17}},"33":{"start":{"line":115,"column":20},"end":{"line":115,"column":83}},"34":{"start":{"line":117,"column":16},"end":{"line":117,"column":27}},"35":{"start":{"line":138,"column":8},"end":{"line":138,"column":48}},"36":{"start":{"line":139,"column":24},"end":{"line":139,"column":57}},"37":{"start":{"line":140,"column":24},"end":{"line":140,"column":41}},"38":{"start":{"line":141,"column":8},"end":{"line":154,"column":14}},"39":{"start":{"line":143,"column":16},"end":{"line":143,"column":61}},"40":{"start":{"line":146,"column":16},"end":{"line":146,"column":43}},"41":{"start":{"line":147,"column":16},"end":{"line":147,"column":48}},"42":{"start":{"line":149,"column":24},"end":{"line":149,"column":54}},"43":{"start":{"line":150,"column":24},"end":{"line":150,"column":41}},"44":{"start":{"line":152,"column":16},"end":{"line":152,"column":52}},"45":{"start":{"line":153,"column":16},"end":{"line":153,"column":30}},"46":{"start":{"line":168,"column":8},"end":{"line":187,"column":14}},"47":{"start":{"line":170,"column":16},"end":{"line":186,"column":17}},"48":{"start":{"line":172,"column":43},"end":{"line":178,"column":25}},"49":{"start":{"line":175,"column":36},"end":{"line":176,"column":86}},"50":{"start":{"line":179,"column":24},"end":{"line":181,"column":62}},"51":{"start":{"line":184,"column":24},"end":{"line":184,"column":63}},"52":{"start":{"line":200,"column":8},"end":{"line":208,"column":45}},"53":{"start":{"line":202,"column":16},"end":{"line":204,"column":18}},"54":{"start":{"line":203,"column":20},"end":{"line":203,"column":55}},"55":{"start":{"line":223,"column":8},"end":{"line":230,"column":9}},"56":{"start":{"line":224,"column":12},"end":{"line":227,"column":18}},"57":{"start":{"line":226,"column":20},"end":{"line":226,"column":75}},"58":{"start":{"line":229,"column":12},"end":{"line":229,"column":36}},"59":{"start":{"line":234,"column":8},"end":{"line":249,"column":9}},"60":{"start":{"line":236,"column":12},"end":{"line":238,"column":13}},"61":{"start":{"line":237,"column":16},"end":{"line":237,"column":50}},"62":{"start":{"line":239,"column":31},"end":{"line":239,"column":62}},"63":{"start":{"line":241,"column":12},"end":{"line":242,"column":49}},"64":{"start":{"line":242,"column":16},"end":{"line":242,"column":49}},"65":{"start":{"line":244,"column":28},"end":{"line":244,"column":85}},"66":{"start":{"line":245,"column":12},"end":{"line":245,"column":47}},"67":{"start":{"line":246,"column":12},"end":{"line":246,"column":26}},"68":{"start":{"line":248,"column":12},"end":{"line":248,"column":36}},"69":{"start":{"line":267,"column":19},"end":{"line":267,"column":37}},"70":{"start":{"line":269,"column":21},"end":{"line":269,"column":51}},"71":{"start":{"line":271,"column":8},"end":{"line":271,"column":22}},"72":{"start":{"line":273,"column":25},"end":{"line":273,"column":62}},"73":{"start":{"line":275,"column":8},"end":{"line":275,"column":24}},"74":{"start":{"line":289,"column":20},"end":{"line":289,"column":51}},"75":{"start":{"line":290,"column":6},"end":{"line":290,"column":24}},"76":{"start":{"line":293,"column":8},"end":{"line":298,"column":128}},"77":{"start":{"line":294,"column":12},"end":{"line":294,"column":71}},"78":{"start":{"line":298,"column":12},"end":{"line":298,"column":128}},"79":{"start":{"line":299,"column":8},"end":{"line":299,"column":23}},"80":{"start":{"line":311,"column":24},"end":{"line":311,"column":56}},"81":{"start":{"line":319,"column":8},"end":{"line":322,"column":14}},"82":{"start":{"line":321,"column":16},"end":{"line":321,"column":73}},"83":{"start":{"line":342,"column":8},"end":{"line":342,"column":28}},"84":{"start":{"line":343,"column":8},"end":{"line":354,"column":14}},"85":{"start":{"line":345,"column":16},"end":{"line":345,"column":44}},"86":{"start":{"line":348,"column":16},"end":{"line":350,"column":17}},"87":{"start":{"line":349,"column":20},"end":{"line":349,"column":88}},"88":{"start":{"line":351,"column":35},"end":{"line":351,"column":65}},"89":{"start":{"line":352,"column":16},"end":{"line":352,"column":49}},"90":{"start":{"line":353,"column":16},"end":{"line":353,"column":27}},"91":{"start":{"line":369,"column":8},"end":{"line":369,"column":56}},"92":{"start":{"line":370,"column":8},"end":{"line":374,"column":9}},"93":{"start":{"line":371,"column":12},"end":{"line":373,"column":14}},"94":{"start":{"line":376,"column":8},"end":{"line":376,"column":32}},"95":{"start":{"line":377,"column":8},"end":{"line":393,"column":14}},"96":{"start":{"line":378,"column":12},"end":{"line":385,"column":18}},"97":{"start":{"line":381,"column":20},"end":{"line":384,"column":21}},"98":{"start":{"line":388,"column":16},"end":{"line":388,"column":80}},"99":{"start":{"line":391,"column":16},"end":{"line":391,"column":66}},"100":{"start":{"line":392,"column":16},"end":{"line":392,"column":27}},"101":{"start":{"line":397,"column":8},"end":{"line":397,"column":63}},"102":{"start":{"line":397,"column":46},"end":{"line":397,"column":62}},"103":{"start":{"line":409,"column":8},"end":{"line":409,"column":71}},"104":{"start":{"line":409,"column":49},"end":{"line":409,"column":70}},"105":{"start":{"line":421,"column":8},"end":{"line":421,"column":49}},"106":{"start":{"line":422,"column":25},"end":{"line":422,"column":44}},"107":{"start":{"line":423,"column":22},"end":{"line":428,"column":14}},"108":{"start":{"line":423,"column":61},"end":{"line":423,"column":77}},"109":{"start":{"line":425,"column":16},"end":{"line":427,"column":22}},"110":{"start":{"line":426,"column":20},"end":{"line":426,"column":42}},"111":{"start":{"line":429,"column":8},"end":{"line":429,"column":42}},"112":{"start":{"line":442,"column":22},"end":{"line":442,"column":47}},"113":{"start":{"line":443,"column":8},"end":{"line":443,"column":71}},"114":{"start":{"line":445,"column":8},"end":{"line":461,"column":14}},"115":{"start":{"line":446,"column":12},"end":{"line":449,"column":14}},"116":{"start":{"line":452,"column":32},"end":{"line":455,"column":18}},"117":{"start":{"line":453,"column":37},"end":{"line":453,"column":71}},"118":{"start":{"line":454,"column":20},"end":{"line":454,"column":51}},"119":{"start":{"line":456,"column":16},"end":{"line":458,"column":17}},"120":{"start":{"line":457,"column":20},"end":{"line":457,"column":40}},"121":{"start":{"line":459,"column":16},"end":{"line":459,"column":78}},"122":{"start":{"line":472,"column":8},"end":{"line":478,"column":14}},"123":{"start":{"line":474,"column":16},"end":{"line":477,"column":17}},"124":{"start":{"line":490,"column":8},"end":{"line":490,"column":26}},"125":{"start":{"line":491,"column":8},"end":{"line":493,"column":10}},"126":{"start":{"line":502,"column":25},"end":{"line":502,"column":85}},"127":{"start":{"line":503,"column":8},"end":{"line":503,"column":54}},"128":{"start":{"line":514,"column":8},"end":{"line":514,"column":55}},"129":{"start":{"line":515,"column":8},"end":{"line":515,"column":27}},"130":{"start":{"line":520,"column":24},"end":{"line":520,"column":70}},"131":{"start":{"line":521,"column":8},"end":{"line":521,"column":62}},"132":{"start":{"line":525,"column":52},"end":{"line":525,"column":62}},"133":{"start":{"line":526,"column":25},"end":{"line":526,"column":100}},"134":{"start":{"line":527,"column":25},"end":{"line":527,"column":53}},"135":{"start":{"line":528,"column":8},"end":{"line":528,"column":55}},"136":{"start":{"line":532,"column":19},"end":{"line":535,"column":1}},"137":{"start":{"line":533,"column":20},"end":{"line":533,"column":54}},"138":{"start":{"line":534,"column":4},"end":{"line":534,"column":60}},"139":{"start":{"line":537,"column":0},"end":{"line":537,"column":50}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":26,"column":4},"end":{"line":26,"column":5}},"loc":{"start":{"line":26,"column":22},"end":{"line":41,"column":5}},"line":26},"1":{"name":"(anonymous_1)","decl":{"start":{"line":33,"column":48},"end":{"line":33,"column":49}},"loc":{"start":{"line":33,"column":57},"end":{"line":33,"column":65}},"line":33},"2":{"name":"(anonymous_2)","decl":{"start":{"line":55,"column":4},"end":{"line":55,"column":5}},"loc":{"start":{"line":55,"column":17},"end":{"line":58,"column":5}},"line":55},"3":{"name":"(anonymous_3)","decl":{"start":{"line":72,"column":4},"end":{"line":72,"column":5}},"loc":{"start":{"line":72,"column":40},"end":{"line":78,"column":5}},"line":72},"4":{"name":"(anonymous_4)","decl":{"start":{"line":92,"column":4},"end":{"line":92,"column":5}},"loc":{"start":{"line":92,"column":45},"end":{"line":122,"column":5}},"line":92},"5":{"name":"(anonymous_5)","decl":{"start":{"line":104,"column":18},"end":{"line":104,"column":19}},"loc":{"start":{"line":104,"column":24},"end":{"line":109,"column":13}},"line":104},"6":{"name":"(anonymous_6)","decl":{"start":{"line":110,"column":18},"end":{"line":110,"column":19}},"loc":{"start":{"line":110,"column":36},"end":{"line":112,"column":13}},"line":110},"7":{"name":"(anonymous_7)","decl":{"start":{"line":113,"column":18},"end":{"line":113,"column":19}},"loc":{"start":{"line":113,"column":38},"end":{"line":118,"column":13}},"line":113},"8":{"name":"(anonymous_8)","decl":{"start":{"line":137,"column":4},"end":{"line":137,"column":5}},"loc":{"start":{"line":137,"column":30},"end":{"line":155,"column":5}},"line":137},"9":{"name":"(anonymous_9)","decl":{"start":{"line":142,"column":18},"end":{"line":142,"column":19}},"loc":{"start":{"line":142,"column":32},"end":{"line":144,"column":13}},"line":142},"10":{"name":"(anonymous_10)","decl":{"start":{"line":145,"column":18},"end":{"line":145,"column":19}},"loc":{"start":{"line":145,"column":24},"end":{"line":148,"column":13}},"line":145},"11":{"name":"(anonymous_11)","decl":{"start":{"line":149,"column":18},"end":{"line":149,"column":19}},"loc":{"start":{"line":149,"column":24},"end":{"line":149,"column":54}},"line":149},"12":{"name":"(anonymous_12)","decl":{"start":{"line":150,"column":18},"end":{"line":150,"column":19}},"loc":{"start":{"line":150,"column":24},"end":{"line":150,"column":41}},"line":150},"13":{"name":"(anonymous_13)","decl":{"start":{"line":151,"column":18},"end":{"line":151,"column":19}},"loc":{"start":{"line":151,"column":24},"end":{"line":154,"column":13}},"line":151},"14":{"name":"(anonymous_14)","decl":{"start":{"line":167,"column":4},"end":{"line":167,"column":5}},"loc":{"start":{"line":167,"column":45},"end":{"line":188,"column":5}},"line":167},"15":{"name":"(anonymous_15)","decl":{"start":{"line":169,"column":18},"end":{"line":169,"column":19}},"loc":{"start":{"line":169,"column":32},"end":{"line":187,"column":13}},"line":169},"16":{"name":"(anonymous_16)","decl":{"start":{"line":174,"column":32},"end":{"line":174,"column":33}},"loc":{"start":{"line":175,"column":36},"end":{"line":176,"column":86}},"line":175},"17":{"name":"(anonymous_17)","decl":{"start":{"line":199,"column":4},"end":{"line":199,"column":5}},"loc":{"start":{"line":199,"column":35},"end":{"line":209,"column":5}},"line":199},"18":{"name":"(anonymous_18)","decl":{"start":{"line":201,"column":18},"end":{"line":201,"column":19}},"loc":{"start":{"line":201,"column":32},"end":{"line":205,"column":13}},"line":201},"19":{"name":"(anonymous_19)","decl":{"start":{"line":202,"column":33},"end":{"line":202,"column":34}},"loc":{"start":{"line":202,"column":49},"end":{"line":204,"column":17}},"line":202},"20":{"name":"(anonymous_20)","decl":{"start":{"line":222,"column":4},"end":{"line":222,"column":5}},"loc":{"start":{"line":222,"column":27},"end":{"line":231,"column":5}},"line":222},"21":{"name":"(anonymous_21)","decl":{"start":{"line":225,"column":22},"end":{"line":225,"column":23}},"loc":{"start":{"line":225,"column":35},"end":{"line":227,"column":17}},"line":225},"22":{"name":"(anonymous_22)","decl":{"start":{"line":233,"column":4},"end":{"line":233,"column":5}},"loc":{"start":{"line":233,"column":30},"end":{"line":250,"column":5}},"line":233},"23":{"name":"(anonymous_23)","decl":{"start":{"line":266,"column":4},"end":{"line":266,"column":5}},"loc":{"start":{"line":266,"column":50},"end":{"line":276,"column":5}},"line":266},"24":{"name":"(anonymous_24)","decl":{"start":{"line":288,"column":4},"end":{"line":288,"column":5}},"loc":{"start":{"line":288,"column":40},"end":{"line":300,"column":5}},"line":288},"25":{"name":"(anonymous_25)","decl":{"start":{"line":310,"column":4},"end":{"line":310,"column":5}},"loc":{"start":{"line":310,"column":44},"end":{"line":323,"column":5}},"line":310},"26":{"name":"(anonymous_26)","decl":{"start":{"line":320,"column":18},"end":{"line":320,"column":19}},"loc":{"start":{"line":320,"column":31},"end":{"line":322,"column":13}},"line":320},"27":{"name":"(anonymous_27)","decl":{"start":{"line":341,"column":4},"end":{"line":341,"column":5}},"loc":{"start":{"line":341,"column":25},"end":{"line":355,"column":5}},"line":341},"28":{"name":"(anonymous_28)","decl":{"start":{"line":344,"column":18},"end":{"line":344,"column":19}},"loc":{"start":{"line":344,"column":31},"end":{"line":346,"column":13}},"line":344},"29":{"name":"(anonymous_29)","decl":{"start":{"line":347,"column":18},"end":{"line":347,"column":19}},"loc":{"start":{"line":347,"column":38},"end":{"line":354,"column":13}},"line":347},"30":{"name":"(anonymous_30)","decl":{"start":{"line":368,"column":4},"end":{"line":368,"column":5}},"loc":{"start":{"line":368,"column":49},"end":{"line":394,"column":5}},"line":368},"31":{"name":"(anonymous_31)","decl":{"start":{"line":377,"column":45},"end":{"line":377,"column":46}},"loc":{"start":{"line":377,"column":58},"end":{"line":386,"column":9}},"line":377},"32":{"name":"(anonymous_32)","decl":{"start":{"line":379,"column":22},"end":{"line":379,"column":23}},"loc":{"start":{"line":379,"column":50},"end":{"line":385,"column":17}},"line":379},"33":{"name":"(anonymous_33)","decl":{"start":{"line":387,"column":18},"end":{"line":387,"column":19}},"loc":{"start":{"line":387,"column":42},"end":{"line":389,"column":13}},"line":387},"34":{"name":"(anonymous_34)","decl":{"start":{"line":390,"column":18},"end":{"line":390,"column":19}},"loc":{"start":{"line":390,"column":39},"end":{"line":393,"column":13}},"line":390},"35":{"name":"(anonymous_35)","decl":{"start":{"line":396,"column":4},"end":{"line":396,"column":5}},"loc":{"start":{"line":396,"column":33},"end":{"line":398,"column":5}},"line":396},"36":{"name":"(anonymous_36)","decl":{"start":{"line":397,"column":38},"end":{"line":397,"column":39}},"loc":{"start":{"line":397,"column":46},"end":{"line":397,"column":62}},"line":397},"37":{"name":"(anonymous_37)","decl":{"start":{"line":408,"column":4},"end":{"line":408,"column":5}},"loc":{"start":{"line":408,"column":28},"end":{"line":410,"column":5}},"line":408},"38":{"name":"(anonymous_38)","decl":{"start":{"line":409,"column":36},"end":{"line":409,"column":37}},"loc":{"start":{"line":409,"column":49},"end":{"line":409,"column":70}},"line":409},"39":{"name":"(anonymous_39)","decl":{"start":{"line":420,"column":4},"end":{"line":420,"column":5}},"loc":{"start":{"line":420,"column":24},"end":{"line":430,"column":5}},"line":420},"40":{"name":"(anonymous_40)","decl":{"start":{"line":423,"column":53},"end":{"line":423,"column":54}},"loc":{"start":{"line":423,"column":61},"end":{"line":423,"column":77}},"line":423},"41":{"name":"(anonymous_41)","decl":{"start":{"line":424,"column":18},"end":{"line":424,"column":19}},"loc":{"start":{"line":424,"column":37},"end":{"line":428,"column":13}},"line":424},"42":{"name":"(anonymous_42)","decl":{"start":{"line":425,"column":44},"end":{"line":425,"column":45}},"loc":{"start":{"line":425,"column":58},"end":{"line":427,"column":17}},"line":425},"43":{"name":"(anonymous_43)","decl":{"start":{"line":441,"column":4},"end":{"line":441,"column":5}},"loc":{"start":{"line":441,"column":34},"end":{"line":462,"column":5}},"line":441},"44":{"name":"(anonymous_44)","decl":{"start":{"line":445,"column":45},"end":{"line":445,"column":46}},"loc":{"start":{"line":445,"column":58},"end":{"line":450,"column":9}},"line":445},"45":{"name":"(anonymous_45)","decl":{"start":{"line":451,"column":18},"end":{"line":451,"column":19}},"loc":{"start":{"line":451,"column":34},"end":{"line":461,"column":13}},"line":451},"46":{"name":"(anonymous_46)","decl":{"start":{"line":452,"column":50},"end":{"line":452,"column":51}},"loc":{"start":{"line":452,"column":65},"end":{"line":455,"column":17}},"line":452},"47":{"name":"(anonymous_47)","decl":{"start":{"line":471,"column":4},"end":{"line":471,"column":5}},"loc":{"start":{"line":471,"column":31},"end":{"line":479,"column":5}},"line":471},"48":{"name":"(anonymous_48)","decl":{"start":{"line":473,"column":18},"end":{"line":473,"column":19}},"loc":{"start":{"line":473,"column":32},"end":{"line":478,"column":13}},"line":473},"49":{"name":"(anonymous_49)","decl":{"start":{"line":488,"column":4},"end":{"line":488,"column":5}},"loc":{"start":{"line":488,"column":26},"end":{"line":494,"column":5}},"line":488},"50":{"name":"(anonymous_50)","decl":{"start":{"line":501,"column":4},"end":{"line":501,"column":5}},"loc":{"start":{"line":501,"column":36},"end":{"line":504,"column":5}},"line":501},"51":{"name":"(anonymous_51)","decl":{"start":{"line":513,"column":4},"end":{"line":513,"column":5}},"loc":{"start":{"line":513,"column":18},"end":{"line":516,"column":5}},"line":513},"52":{"name":"(anonymous_52)","decl":{"start":{"line":519,"column":4},"end":{"line":519,"column":5}},"loc":{"start":{"line":519,"column":42},"end":{"line":522,"column":5}},"line":519},"53":{"name":"(anonymous_53)","decl":{"start":{"line":524,"column":4},"end":{"line":524,"column":5}},"loc":{"start":{"line":524,"column":36},"end":{"line":529,"column":5}},"line":524},"54":{"name":"(anonymous_54)","decl":{"start":{"line":532,"column":19},"end":{"line":532,"column":20}},"loc":{"start":{"line":532,"column":44},"end":{"line":535,"column":1}},"line":532}},"branchMap":{"0":{"loc":{"start":{"line":28,"column":26},"end":{"line":28,"column":46}},"type":"binary-expr","locations":[{"start":{"line":28,"column":26},"end":{"line":28,"column":40}},{"start":{"line":28,"column":44},"end":{"line":28,"column":46}}],"line":28},"1":{"loc":{"start":{"line":29,"column":28},"end":{"line":29,"column":101}},"type":"cond-expr","locations":[{"start":{"line":29,"column":48},"end":{"line":29,"column":86}},{"start":{"line":29,"column":89},"end":{"line":29,"column":101}}],"line":29},"2":{"loc":{"start":{"line":37,"column":25},"end":{"line":37,"column":52}},"type":"binary-expr","locations":[{"start":{"line":37,"column":25},"end":{"line":37,"column":39}},{"start":{"line":37,"column":43},"end":{"line":37,"column":52}}],"line":37},"3":{"loc":{"start":{"line":93,"column":8},"end":{"line":95,"column":9}},"type":"if","locations":[{"start":{"line":93,"column":8},"end":{"line":95,"column":9}},{"start":{"line":93,"column":8},"end":{"line":95,"column":9}}],"line":93},"4":{"loc":{"start":{"line":97,"column":8},"end":{"line":99,"column":9}},"type":"if","locations":[{"start":{"line":97,"column":8},"end":{"line":99,"column":9}},{"start":{"line":97,"column":8},"end":{"line":99,"column":9}}],"line":97},"5":{"loc":{"start":{"line":114,"column":16},"end":{"line":116,"column":17}},"type":"if","locations":[{"start":{"line":114,"column":16},"end":{"line":116,"column":17}},{"start":{"line":114,"column":16},"end":{"line":116,"column":17}}],"line":114},"6":{"loc":{"start":{"line":170,"column":16},"end":{"line":186,"column":17}},"type":"switch","locations":[{"start":{"line":171,"column":20},"end":{"line":182,"column":21}},{"start":{"line":183,"column":20},"end":{"line":185,"column":21}}],"line":170},"7":{"loc":{"start":{"line":175,"column":36},"end":{"line":176,"column":86}},"type":"binary-expr","locations":[{"start":{"line":175,"column":36},"end":{"line":175,"column":62}},{"start":{"line":176,"column":36},"end":{"line":176,"column":86}}],"line":175},"8":{"loc":{"start":{"line":179,"column":31},"end":{"line":181,"column":62}},"type":"cond-expr","locations":[{"start":{"line":180,"column":30},"end":{"line":180,"column":114}},{"start":{"line":181,"column":30},"end":{"line":181,"column":62}}],"line":179},"9":{"loc":{"start":{"line":236,"column":12},"end":{"line":238,"column":13}},"type":"if","locations":[{"start":{"line":236,"column":12},"end":{"line":238,"column":13}},{"start":{"line":236,"column":12},"end":{"line":238,"column":13}}],"line":236},"10":{"loc":{"start":{"line":241,"column":12},"end":{"line":242,"column":49}},"type":"if","locations":[{"start":{"line":241,"column":12},"end":{"line":242,"column":49}},{"start":{"line":241,"column":12},"end":{"line":242,"column":49}}],"line":241},"11":{"loc":{"start":{"line":293,"column":8},"end":{"line":298,"column":128}},"type":"if","locations":[{"start":{"line":293,"column":8},"end":{"line":298,"column":128}},{"start":{"line":293,"column":8},"end":{"line":298,"column":128}}],"line":293},"12":{"loc":{"start":{"line":310,"column":33},"end":{"line":310,"column":42}},"type":"default-arg","locations":[{"start":{"line":310,"column":40},"end":{"line":310,"column":42}}],"line":310},"13":{"loc":{"start":{"line":348,"column":16},"end":{"line":350,"column":17}},"type":"if","locations":[{"start":{"line":348,"column":16},"end":{"line":350,"column":17}},{"start":{"line":348,"column":16},"end":{"line":350,"column":17}}],"line":348},"14":{"loc":{"start":{"line":368,"column":23},"end":{"line":368,"column":47}},"type":"default-arg","locations":[{"start":{"line":368,"column":34},"end":{"line":368,"column":47}}],"line":368},"15":{"loc":{"start":{"line":370,"column":8},"end":{"line":374,"column":9}},"type":"if","locations":[{"start":{"line":370,"column":8},"end":{"line":374,"column":9}},{"start":{"line":370,"column":8},"end":{"line":374,"column":9}}],"line":370},"16":{"loc":{"start":{"line":422,"column":25},"end":{"line":422,"column":44}},"type":"binary-expr","locations":[{"start":{"line":422,"column":25},"end":{"line":422,"column":38}},{"start":{"line":422,"column":42},"end":{"line":422,"column":44}}],"line":422},"17":{"loc":{"start":{"line":456,"column":16},"end":{"line":458,"column":17}},"type":"if","locations":[{"start":{"line":456,"column":16},"end":{"line":458,"column":17}},{"start":{"line":456,"column":16},"end":{"line":458,"column":17}}],"line":456},"18":{"loc":{"start":{"line":456,"column":20},"end":{"line":456,"column":49}},"type":"binary-expr","locations":[{"start":{"line":456,"column":20},"end":{"line":456,"column":27}},{"start":{"line":456,"column":31},"end":{"line":456,"column":49}}],"line":456},"19":{"loc":{"start":{"line":526,"column":25},"end":{"line":526,"column":100}},"type":"cond-expr","locations":[{"start":{"line":526,"column":36},"end":{"line":526,"column":44}},{"start":{"line":526,"column":47},"end":{"line":526,"column":100}}],"line":526}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":1,"10":1,"11":1,"12":1,"13":1,"14":1,"15":1,"16":2,"17":1,"18":1,"19":1,"20":1,"21":4,"22":4,"23":1,"24":1,"25":0,"26":1,"27":0,"28":1,"29":1,"30":1,"31":1,"32":1,"33":0,"34":1,"35":2,"36":2,"37":2,"38":2,"39":2,"40":2,"41":2,"42":2,"43":2,"44":2,"45":2,"46":2,"47":2,"48":0,"49":0,"50":0,"51":2,"52":0,"53":0,"54":0,"55":3,"56":3,"57":3,"58":0,"59":1,"60":1,"61":0,"62":1,"63":1,"64":0,"65":1,"66":1,"67":1,"68":0,"69":1,"70":1,"71":1,"72":1,"73":1,"74":1,"75":1,"76":1,"77":1,"78":0,"79":1,"80":0,"81":0,"82":0,"83":1,"84":1,"85":1,"86":1,"87":0,"88":1,"89":1,"90":1,"91":6,"92":6,"93":0,"94":6,"95":6,"96":4,"97":4,"98":6,"99":6,"100":6,"101":2,"102":4,"103":0,"104":0,"105":7,"106":7,"107":7,"108":5,"109":7,"110":5,"111":7,"112":3,"113":3,"114":3,"115":3,"116":3,"117":3,"118":3,"119":3,"120":3,"121":0,"122":2,"123":2,"124":2,"125":2,"126":2,"127":2,"128":2,"129":2,"130":0,"131":0,"132":1,"133":1,"134":1,"135":1,"136":1,"137":1,"138":1,"139":1},"f":{"0":1,"1":2,"2":4,"3":1,"4":1,"5":1,"6":1,"7":1,"8":2,"9":2,"10":2,"11":2,"12":2,"13":2,"14":2,"15":2,"16":0,"17":0,"18":0,"19":0,"20":3,"21":3,"22":1,"23":1,"24":1,"25":0,"26":0,"27":1,"28":1,"29":1,"30":6,"31":4,"32":4,"33":6,"34":6,"35":2,"36":4,"37":0,"38":0,"39":7,"40":5,"41":7,"42":5,"43":3,"44":3,"45":3,"46":3,"47":2,"48":2,"49":2,"50":2,"51":2,"52":0,"53":1,"54":1},"b":{"0":[1,1],"1":[0,1],"2":[1,0],"3":[0,1],"4":[0,1],"5":[0,1],"6":[0,2],"7":[0,0],"8":[0,0],"9":[0,1],"10":[0,1],"11":[1,0],"12":[0],"13":[0,1],"14":[2],"15":[0,6],"16":[7,0],"17":[3,0],"18":[3,3],"19":[1,0]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"210c64e241e1a88a2232b4905bd97ef5ec95852e","contentHash":"3675192d503f8abe6954d5a4666ab48531618eee1dcca0788b1ff5c5d03452b8"}} \ No newline at end of file diff --git a/.nyc_output/b26ace3d-8646-4e9b-830a-00eb7e80b985.json b/.nyc_output/b26ace3d-8646-4e9b-830a-00eb7e80b985.json deleted file mode 100644 index 9e26dfe..0000000 --- a/.nyc_output/b26ace3d-8646-4e9b-830a-00eb7e80b985.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/.nyc_output/processinfo/03c6e1d5-7af9-493f-8384-84dce7e71f66.json b/.nyc_output/processinfo/03c6e1d5-7af9-493f-8384-84dce7e71f66.json deleted file mode 100644 index f36e599..0000000 --- a/.nyc_output/processinfo/03c6e1d5-7af9-493f-8384-84dce7e71f66.json +++ /dev/null @@ -1 +0,0 @@ -{"parent":"b26ace3d-8646-4e9b-830a-00eb7e80b985","pid":18666,"argv":["/usr/local/bin/node","/Users/subhanshumg/Downloads/getsafle/vs code/github/vault-optimism-controller/node_modules/.bin/mocha","test/**.js","--timeout","15000"],"execArgv":[],"cwd":"/Users/subhanshumg/Downloads/getsafle/vs code/github/vault-optimism-controller","time":1688464848777,"ppid":18627,"coverageFilename":"/Users/subhanshumg/Downloads/getsafle/vs code/github/vault-optimism-controller/.nyc_output/03c6e1d5-7af9-493f-8384-84dce7e71f66.json","externalId":"","uuid":"03c6e1d5-7af9-493f-8384-84dce7e71f66","files":["/Users/subhanshumg/Downloads/getsafle/vs code/github/vault-optimism-controller/src/index.js"]} \ No newline at end of file diff --git a/.nyc_output/processinfo/b26ace3d-8646-4e9b-830a-00eb7e80b985.json b/.nyc_output/processinfo/b26ace3d-8646-4e9b-830a-00eb7e80b985.json deleted file mode 100644 index fb73798..0000000 --- a/.nyc_output/processinfo/b26ace3d-8646-4e9b-830a-00eb7e80b985.json +++ /dev/null @@ -1 +0,0 @@ -{"parent":null,"pid":18627,"argv":["/usr/local/bin/node","/usr/local/bin/npm","run","test"],"execArgv":[],"cwd":"/Users/subhanshumg/Downloads/getsafle/vs code/github/vault-optimism-controller","time":1688464847979,"ppid":18603,"coverageFilename":"/Users/subhanshumg/Downloads/getsafle/vs code/github/vault-optimism-controller/.nyc_output/b26ace3d-8646-4e9b-830a-00eb7e80b985.json","externalId":"","uuid":"b26ace3d-8646-4e9b-830a-00eb7e80b985","files":[]} \ No newline at end of file diff --git a/.nyc_output/processinfo/index.json b/.nyc_output/processinfo/index.json deleted file mode 100644 index 6ffb2cf..0000000 --- a/.nyc_output/processinfo/index.json +++ /dev/null @@ -1 +0,0 @@ -{"processes":{"03c6e1d5-7af9-493f-8384-84dce7e71f66":{"parent":"b26ace3d-8646-4e9b-830a-00eb7e80b985","children":[]},"b26ace3d-8646-4e9b-830a-00eb7e80b985":{"parent":null,"children":["03c6e1d5-7af9-493f-8384-84dce7e71f66"]}},"files":{"/Users/subhanshumg/Downloads/getsafle/vs code/github/vault-optimism-controller/src/index.js":["03c6e1d5-7af9-493f-8384-84dce7e71f66"]},"externalIds":{}} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 482f3bd..bab9e68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,4 +33,8 @@ - Updated CI for test cases - Added coverage report for the test cases - Added nyc dependency for the coverage report -- Added badges for readme \ No newline at end of file +- Added badges for readme + +### 1.0.7 (2023-07-05) + +- cleaned package structure \ No newline at end of file diff --git a/jscoverage/lcov-report/base.css b/jscoverage/lcov-report/base.css deleted file mode 100644 index f418035..0000000 --- a/jscoverage/lcov-report/base.css +++ /dev/null @@ -1,224 +0,0 @@ -body, html { - margin:0; padding: 0; - height: 100%; -} -body { - font-family: Helvetica Neue, Helvetica, Arial; - font-size: 14px; - color:#333; -} -.small { font-size: 12px; } -*, *:after, *:before { - -webkit-box-sizing:border-box; - -moz-box-sizing:border-box; - box-sizing:border-box; - } -h1 { font-size: 20px; margin: 0;} -h2 { font-size: 14px; } -pre { - font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; - margin: 0; - padding: 0; - -moz-tab-size: 2; - -o-tab-size: 2; - tab-size: 2; -} -a { color:#0074D9; text-decoration:none; } -a:hover { text-decoration:underline; } -.strong { font-weight: bold; } -.space-top1 { padding: 10px 0 0 0; } -.pad2y { padding: 20px 0; } -.pad1y { padding: 10px 0; } -.pad2x { padding: 0 20px; } -.pad2 { padding: 20px; } -.pad1 { padding: 10px; } -.space-left2 { padding-left:55px; } -.space-right2 { padding-right:20px; } -.center { text-align:center; } -.clearfix { display:block; } -.clearfix:after { - content:''; - display:block; - height:0; - clear:both; - visibility:hidden; - } -.fl { float: left; } -@media only screen and (max-width:640px) { - .col3 { width:100%; max-width:100%; } - .hide-mobile { display:none!important; } -} - -.quiet { - color: #7f7f7f; - color: rgba(0,0,0,0.5); -} -.quiet a { opacity: 0.7; } - -.fraction { - font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; - font-size: 10px; - color: #555; - background: #E8E8E8; - padding: 4px 5px; - border-radius: 3px; - vertical-align: middle; -} - -div.path a:link, div.path a:visited { color: #333; } -table.coverage { - border-collapse: collapse; - margin: 10px 0 0 0; - padding: 0; -} - -table.coverage td { - margin: 0; - padding: 0; - vertical-align: top; -} -table.coverage td.line-count { - text-align: right; - padding: 0 5px 0 20px; -} -table.coverage td.line-coverage { - text-align: right; - padding-right: 10px; - min-width:20px; -} - -table.coverage td span.cline-any { - display: inline-block; - padding: 0 5px; - width: 100%; -} -.missing-if-branch { - display: inline-block; - margin-right: 5px; - border-radius: 3px; - position: relative; - padding: 0 4px; - background: #333; - color: yellow; -} - -.skip-if-branch { - display: none; - margin-right: 10px; - position: relative; - padding: 0 4px; - background: #ccc; - color: white; -} -.missing-if-branch .typ, .skip-if-branch .typ { - color: inherit !important; -} -.coverage-summary { - border-collapse: collapse; - width: 100%; -} -.coverage-summary tr { border-bottom: 1px solid #bbb; } -.keyline-all { border: 1px solid #ddd; } -.coverage-summary td, .coverage-summary th { padding: 10px; } -.coverage-summary tbody { border: 1px solid #bbb; } -.coverage-summary td { border-right: 1px solid #bbb; } -.coverage-summary td:last-child { border-right: none; } -.coverage-summary th { - text-align: left; - font-weight: normal; - white-space: nowrap; -} -.coverage-summary th.file { border-right: none !important; } -.coverage-summary th.pct { } -.coverage-summary th.pic, -.coverage-summary th.abs, -.coverage-summary td.pct, -.coverage-summary td.abs { text-align: right; } -.coverage-summary td.file { white-space: nowrap; } -.coverage-summary td.pic { min-width: 120px !important; } -.coverage-summary tfoot td { } - -.coverage-summary .sorter { - height: 10px; - width: 7px; - display: inline-block; - margin-left: 0.5em; - background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; -} -.coverage-summary .sorted .sorter { - background-position: 0 -20px; -} -.coverage-summary .sorted-desc .sorter { - background-position: 0 -10px; -} -.status-line { height: 10px; } -/* yellow */ -.cbranch-no { background: yellow !important; color: #111; } -/* dark red */ -.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } -.low .chart { border:1px solid #C21F39 } -.highlighted, -.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{ - background: #C21F39 !important; -} -/* medium red */ -.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } -/* light red */ -.low, .cline-no { background:#FCE1E5 } -/* light green */ -.high, .cline-yes { background:rgb(230,245,208) } -/* medium green */ -.cstat-yes { background:rgb(161,215,106) } -/* dark green */ -.status-line.high, .high .cover-fill { background:rgb(77,146,33) } -.high .chart { border:1px solid rgb(77,146,33) } -/* dark yellow (gold) */ -.status-line.medium, .medium .cover-fill { background: #f9cd0b; } -.medium .chart { border:1px solid #f9cd0b; } -/* light yellow */ -.medium { background: #fff4c2; } - -.cstat-skip { background: #ddd; color: #111; } -.fstat-skip { background: #ddd; color: #111 !important; } -.cbranch-skip { background: #ddd !important; color: #111; } - -span.cline-neutral { background: #eaeaea; } - -.coverage-summary td.empty { - opacity: .5; - padding-top: 4px; - padding-bottom: 4px; - line-height: 1; - color: #888; -} - -.cover-fill, .cover-empty { - display:inline-block; - height: 12px; -} -.chart { - line-height: 0; -} -.cover-empty { - background: white; -} -.cover-full { - border-right: none !important; -} -pre.prettyprint { - border: none !important; - padding: 0 !important; - margin: 0 !important; -} -.com { color: #999 !important; } -.ignore-none { color: #999; font-weight: normal; } - -.wrapper { - min-height: 100%; - height: auto !important; - height: 100%; - margin: 0 auto -48px; -} -.footer, .push { - height: 48px; -} diff --git a/jscoverage/lcov-report/block-navigation.js b/jscoverage/lcov-report/block-navigation.js deleted file mode 100644 index cc12130..0000000 --- a/jscoverage/lcov-report/block-navigation.js +++ /dev/null @@ -1,87 +0,0 @@ -/* eslint-disable */ -var jumpToCode = (function init() { - // Classes of code we would like to highlight in the file view - var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no']; - - // Elements to highlight in the file listing view - var fileListingElements = ['td.pct.low']; - - // We don't want to select elements that are direct descendants of another match - var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > ` - - // Selecter that finds elements on the page to which we can jump - var selector = - fileListingElements.join(', ') + - ', ' + - notSelector + - missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b` - - // The NodeList of matching elements - var missingCoverageElements = document.querySelectorAll(selector); - - var currentIndex; - - function toggleClass(index) { - missingCoverageElements - .item(currentIndex) - .classList.remove('highlighted'); - missingCoverageElements.item(index).classList.add('highlighted'); - } - - function makeCurrent(index) { - toggleClass(index); - currentIndex = index; - missingCoverageElements.item(index).scrollIntoView({ - behavior: 'smooth', - block: 'center', - inline: 'center' - }); - } - - function goToPrevious() { - var nextIndex = 0; - if (typeof currentIndex !== 'number' || currentIndex === 0) { - nextIndex = missingCoverageElements.length - 1; - } else if (missingCoverageElements.length > 1) { - nextIndex = currentIndex - 1; - } - - makeCurrent(nextIndex); - } - - function goToNext() { - var nextIndex = 0; - - if ( - typeof currentIndex === 'number' && - currentIndex < missingCoverageElements.length - 1 - ) { - nextIndex = currentIndex + 1; - } - - makeCurrent(nextIndex); - } - - return function jump(event) { - if ( - document.getElementById('fileSearch') === document.activeElement && - document.activeElement != null - ) { - // if we're currently focused on the search input, we don't want to navigate - return; - } - - switch (event.which) { - case 78: // n - case 74: // j - goToNext(); - break; - case 66: // b - case 75: // k - case 80: // p - goToPrevious(); - break; - } - }; -})(); -window.addEventListener('keydown', jumpToCode); diff --git a/jscoverage/lcov-report/favicon.png b/jscoverage/lcov-report/favicon.png deleted file mode 100644 index c1525b8..0000000 Binary files a/jscoverage/lcov-report/favicon.png and /dev/null differ diff --git a/jscoverage/lcov-report/index.html b/jscoverage/lcov-report/index.html deleted file mode 100644 index 86faebf..0000000 --- a/jscoverage/lcov-report/index.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - -
-- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -File | -- | Statements | -- | Branches | -- | Functions | -- | Lines | -- |
---|---|---|---|---|---|---|---|---|---|
index.js | -
-
- |
- 82.85% | -116/140 | -50% | -19/38 | -83.63% | -46/55 | -83.21% | -114/137 | -
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 -221 -222 -223 -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242 -243 -244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301 -302 -303 -304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319 -320 -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334 -335 -336 -337 -338 -339 -340 -341 -342 -343 -344 -345 -346 -347 -348 -349 -350 -351 -352 -353 -354 -355 -356 -357 -358 -359 -360 -361 -362 -363 -364 -365 -366 -367 -368 -369 -370 -371 -372 -373 -374 -375 -376 -377 -378 -379 -380 -381 -382 -383 -384 -385 -386 -387 -388 -389 -390 -391 -392 -393 -394 -395 -396 -397 -398 -399 -400 -401 -402 -403 -404 -405 -406 -407 -408 -409 -410 -411 -412 -413 -414 -415 -416 -417 -418 -419 -420 -421 -422 -423 -424 -425 -426 -427 -428 -429 -430 -431 -432 -433 -434 -435 -436 -437 -438 -439 -440 -441 -442 -443 -444 -445 -446 -447 -448 -449 -450 -451 -452 -453 -454 -455 -456 -457 -458 -459 -460 -461 -462 -463 -464 -465 -466 -467 -468 -469 -470 -471 -472 -473 -474 -475 -476 -477 -478 -479 -480 -481 -482 -483 -484 -485 -486 -487 -488 -489 -490 -491 -492 -493 -494 -495 -496 -497 -498 -499 -500 -501 -502 -503 -504 -505 -506 -507 -508 -509 -510 -511 -512 -513 -514 -515 -516 -517 -518 -519 -520 -521 -522 -523 -524 -525 -526 -527 -528 -529 -530 -531 -532 -533 -534 -535 -536 -537 | -1x -1x -1x -1x - -1x -1x -1x -1x - -1x -1x - -1x - - - - - - - - - - - -1x -1x -1x -1x -1x - -2x - - - -1x -1x -1x -1x - - - - - - - - - - - - - - - -4x -4x - - - - - - - - - - - - - - - -1x - - - - - - - - - - - - - - - - - - - -1x - - - -1x - - - -1x - -1x - -1x - - - - - -1x - - -1x - - -1x - - - - - - - - - - - - - - - - - - - - -2x -2x -2x -2x - -2x - - -2x -2x - -2x -2x - -2x -2x - - - - - - - - - - - - - - -2x - -2x - - - - - - - - - - - - - -2x - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -3x -3x - -3x - - - - - - - -1x - -1x - - -1x - -1x - - -1x -1x -1x - - - - - - - - - - - - - - - - - - - - -1x - -1x - -1x - -1x - -1x - - - - - - - - - - - - - -1x -1x - - -1x -1x - - - - -1x - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -1x -1x - -1x - - -1x - - -1x -1x -1x - - - - - - - - - - - - - - - -6x -6x - - - - - -6x -6x -4x - - -4x - - - - - - -6x - - -6x -6x - - - - -4x - - - - - - - - - - - - - - - - - - - - - - - -7x -7x -7x - -7x -5x - - -7x - - - - - - - - - - - - -3x -3x - -3x -3x - - - - - -3x -3x -3x - -3x -3x - - - - - - - - - - - - - - -2x - -2x - - - - - - - - - - - - - - - -2x -2x - - - - - - - - - - -2x -2x - - - - - - - - - - -2x -2x - - - - - - - - - -1x -1x -1x -1x - - - -1x -1x -1x - - -1x | -const { EventEmitter } = require('events') -const log = require('loglevel') -const ethUtil = require('ethereumjs-util') -const Tx = require('ethereumjs-tx'); - -const bip39 = require('bip39') -const ObservableStore = require('obs-store') -const encryptor = require('browser-passworder') -const { normalize: normalizeAddress } = require('eth-sig-util') - -const SimpleKeyring = require('eth-simple-keyring') -const HdKeyring = require('eth-hd-keyring') - -const keyringTypes = [ - SimpleKeyring, - HdKeyring, -] - -class KeyringController extends EventEmitter { - - // - // PUBLIC METHODS - // - - constructor(opts) { - super() - const initState = opts.initState || {} - this.keyringTypes = opts.keyringTypes ? keyringTypes.concat(opts.keyringTypes) : keyringTypes - this.store = new ObservableStore(initState) - this.memStore = new ObservableStore({ - isUnlocked: false, - keyringTypes: this.keyringTypes.map((krt) => krt.type), - keyrings: [], - }) - - this.encryptor = opts.encryptor || encryptor - this.keyrings = [] - this.getNetwork = opts.getNetwork - this.importedWallets = [] - } - - /** - * Full Update - * - * Emits the `update` event and @returns a Promise that resolves to - * the current state. - * - * Frequently used to end asynchronous chains in this class, - * indicating consumers can often either listen for updates, - * or accept a state-resolving promise to consume their results. - * - * @returns {Object} The controller state. - */ - fullUpdate() { - this.emit('update', this.memStore.getState()) - return this.memStore.getState() - } - - /** - * Create New Vault And Keychain - * - * Destroys any old encrypted storage, - * creates a new encrypted store with the given password, - * randomly creates a new HD wallet with 1 account, - * faucets that account on the testnet. - * - * @emits KeyringController#unlock - * @param {string} password - The password to encrypt the vault with. - * @returns {Promise<Object>} A Promise that resolves to the state. - */ - createNewVaultAndKeychain(password) { - return this.persistAllKeyrings(password) - .then(this.createFirstKeyTree.bind(this)) - .then(this.persistAllKeyrings.bind(this, password)) - .then(this.setUnlocked.bind(this)) - .then(this.fullUpdate.bind(this)) - } - - /** - * CreateNewVaultAndRestore - * - * Destroys any old encrypted storage, - * creates a new encrypted store with the given password, - * creates a new HD wallet from the given seed with 1 account. - * - * @emits KeyringController#unlock - * @param {string} password - The password to encrypt the vault with - * @param {string} seed - The BIP44-compliant seed phrase. - * @returns {Promise<Object>} A Promise that resolves to the state. - */ - createNewVaultAndRestore(password, seed) { - Iif (typeof password !== 'string') { - return Promise.reject(new Error('Password must be text.')) - } - - Iif (!bip39.validateMnemonic(seed)) { - return Promise.reject(new Error('Seed phrase is invalid.')) - } - - this.clearKeyrings() - - return this.persistAllKeyrings(password) - .then(() => { - return this.addNewKeyring('HD Key Tree', { - mnemonic: seed, - numberOfAccounts: 1, - }) - }) - .then((firstKeyring) => { - return firstKeyring.getAccounts() - }) - .then(([firstAccount]) => { - Iif (!firstAccount) { - throw new Error('KeyringController - First Account not found.') - } - return null - }) - .then(this.persistAllKeyrings.bind(this, password)) - .then(this.setUnlocked.bind(this)) - .then(this.fullUpdate.bind(this)) - } - - /** - * Add New Keyring - * - * Adds a new Keyring of the given `type` to the vault - * and the current decrypted Keyrings array. - * - * All Keyring classes implement a unique `type` string, - * and this is used to retrieve them from the keyringTypes array. - * - * @param {string} type - The type of keyring to add. - * @param {Object} opts - The constructor options for the keyring. - * @returns {Promise<Keyring>} The new keyring. - */ - addNewKeyring(type, opts) { - console.log("addNewKeyring CALLED.....") - const Keyring = this.getKeyringClassForType(type) - const keyring = new Keyring(opts) - return keyring.getAccounts() - .then((accounts) => { - return this.checkForDuplicate(type, accounts) - }) - .then(() => { - this.keyrings.push(keyring) - return this.persistAllKeyrings() - }) - .then(() => this._updateMemStoreKeyrings()) - .then(() => this.fullUpdate()) - .then(() => { - console.log("keyring ====", keyring) - return keyring - }) - } - - /** - * Checks for duplicate keypairs, using the the first account in the given - * array. Rejects if a duplicate is found. - * - * Only supports 'Simple Key Pair'. - * - * @param {string} type - The key pair type to check for. - * @param {Array<string>} newAccountArray - Array of new accounts. - * @returns {Promise<Array<string>>} The account, if no duplicate is found. - */ - checkForDuplicate(type, newAccountArray) { - return this.getAccounts() - .then((accounts) => { - switch (type) { - case 'Simple Key Pair': { - const isIncluded = Boolean( - accounts.find( - (key) => ( - key === newAccountArray[0] || - key === ethUtil.stripHexPrefix(newAccountArray[0])), - ), - ) - return isIncluded - ? Promise.reject(new Error('The account you\'re are trying to import is a duplicate')) - : Promise.resolve(newAccountArray) - } - default: { - return Promise.resolve(newAccountArray) - } - } - }) - } - - /** - * Add New Account - * - * Calls the `addAccounts` method on the given keyring, - * and then saves those changes. - * - * @param {Keyring} selectedKeyring - The currently selected keyring. - * @returns {Promise<Object>} A Promise that resolves to the state. - */ - addNewAccount(selectedKeyring) { - return selectedKeyring.addAccounts(1) - .then((accounts) => { - accounts.forEach((hexAccount) => { - this.emit('newAccount', hexAccount) - }) - }) - .then(this.persistAllKeyrings.bind(this)) - .then(this._updateMemStoreKeyrings.bind(this)) - .then(this.fullUpdate.bind(this)) - } - - /** - * Export Account - * - * Requests the private key from the keyring controlling - * the specified address. - * - * Returns a Promise that may resolve with the private key string. - * - * @param {string} address - The address of the account to export. - * @returns {Promise<string>} The private key of the account. - */ - exportAccount(address) { - try { - return this.getKeyringForAccount(address) - .then((keyring) => { - return keyring.exportAccount(normalizeAddress(address)) - }) - } catch (e) { - return Promise.reject(e) - } - } - - importWallet(_privateKey) { - try { - - Iif (_privateKey.startsWith('0x')) { - _privateKey = _privateKey.slice(2) - } - const privateKey = Buffer.from(_privateKey, 'hex') - - Iif (!ethUtil.isValidPrivate(privateKey)) - throw "Enter a valid private key" - - const address = ethUtil.bufferToHex(ethUtil.privateToAddress(privateKey)) - this.importedWallets.push(address); - return address - } catch (e) { - return Promise.reject(e) - } - } - - // - // SIGNING METHODS - // - - /** - * Sign Optimism Transaction - * - * Signs an Optimism transaction object. - * - * @param {Object} optimismTx - The transaction to sign. - * @param {Object} web3 - web3 object. - * @returns {string} The signed transaction raw string. - */ - - async signTransaction(optimismTx, privateKey) { - const tx = new Tx(optimismTx); - - const pkey = Buffer.from(privateKey, 'hex'); - - tx.sign(pkey); - - const signedTx = `0x${tx.serialize().toString('hex')}`; - - return signedTx; - } - - /** - * Sign Transaction or Message to get v,r,s - * - * Signs a transaction object. - * - * @param {Object} rawTx - The transaction or message to sign. - * @param {Object} privateKey - The private key of the account. - * @param {Object} web3 - web3 object. - * @returns {Object} The signed transaction object. - */ - async sign(rawTx, privateKey, web3) { - const block = await web3.eth.getBlockNumber(); - console.log(block) - let signedTx; - let estimatedGas; - Eif (typeof rawTx === 'string') - signedTx = await web3.eth.accounts.sign(rawTx, privateKey); - else - // estimatedGas = await web3.eth.estimateGas(rawTx); - - signedTx = await web3.eth.accounts.signTransaction({ ...rawTx, gas: await web3.eth.estimateGas(rawTx) }, privateKey) - return signedTx - } - - /** - * Sign Message - * - * Attempts to sign the provided message parameters. - * - * @param {Object} msgParams - The message parameters to sign. - * @returns {Promise<Buffer>} The raw signature. - */ - async signMessage(msgParams, opts = {}) { - const address = normalizeAddress(msgParams.from) - - // console.log(address) - // const abc = await this.getKeyringForAccount(address) - // console.log(abc) - // const signedMsg = abc.signMessage(address, msgParams.data, opts) - // console.log(signedMsg) - - return this.getKeyringForAccount(address) - .then((keyring) => { - return keyring.signMessage(address, msgParams.data, opts) - }) - } - - // - // PRIVATE METHODS - // - - /** - * Create First Key Tree - * - * - Clears the existing vault - * - Creates a new vault - * - Creates a random new HD Keyring with 1 account - * - Makes that account the selected account - * - Faucets that account on testnet - * - Puts the current seed words into the state tree - * - * @returns {Promise<void>} - A promise that resovles if the operation was successful. - */ - createFirstKeyTree() { - this.clearKeyrings() - return this.addNewKeyring('HD Key Tree', { numberOfAccounts: 1 }) - .then((keyring) => { - return keyring.getAccounts() - }) - .then(([firstAccount]) => { - Iif (!firstAccount) { - throw new Error('KeyringController - No account found on keychain.') - } - const hexAccount = normalizeAddress(firstAccount) - this.emit('newVault', hexAccount) - return null - }) - } - - /** - * Persist All Keyrings - * - * Iterates the current `keyrings` array, - * serializes each one into a serialized array, - * encrypts that array with the provided `password`, - * and persists that encrypted string to storage. - * - * @param {string} password - The keyring controller password. - * @returns {Promise<boolean>} Resolves to true once keyrings are persisted. - */ - persistAllKeyrings(password = this.password) { - console.log("persistAllKeyrings CALLED .......") - Iif (typeof password !== 'string') { - return Promise.reject(new Error( - 'KeyringController - password is not a string', - )) - } - - this.password = password - return Promise.all(this.keyrings.map((keyring) => { - return Promise.all([keyring.type, keyring.serialize()]) - .then((serializedKeyringArray) => { - // Label the output values on each serialized Keyring: - return { - type: serializedKeyringArray[0], - data: serializedKeyringArray[1], - } - }) - })) - .then((serializedKeyrings) => { - return this.encryptor.encrypt(this.password, serializedKeyrings) - }) - .then((encryptedString) => { - this.store.updateState({ vault: encryptedString }) - return true - }) - } - - getKeyringClassForType(type) { - return this.keyringTypes.find((kr) => kr.type === type) - } - - /** - * Get Keyrings by Type - * - * Gets all keyrings of the given type. - * - * @param {string} type - The keyring types to retrieve. - * @returns {Array<Keyring>} The keyrings. - */ - getKeyringsByType(type) { - return this.keyrings.filter((keyring) => keyring.type === type) - } - - /** - * Get Accounts - * - * Returns the public addresses of all current accounts - * managed by all currently unlocked keyrings. - * - * @returns {Promise<Array<string>>} The array of accounts. - */ - async getAccounts() { - console.log("getAccounts CALLED .......") - const keyrings = this.keyrings || [] - const addrs = await Promise.all(keyrings.map((kr) => kr.getAccounts())) - .then((keyringArrays) => { - return keyringArrays.reduce((res, arr) => { - return res.concat(arr) - }, []) - }) - return addrs.map(normalizeAddress) - } - - /** - * Get Keyring For Account - * - * Returns the currently initialized keyring that manages - * the specified `address` if one exists. - * - * @param {string} address - An account address. - * @returns {Promise<Keyring>} The keyring of the account, if it exists. - */ - getKeyringForAccount(address) { - const hexed = normalizeAddress(address) - log.debug(`KeyringController - getKeyringForAccount: ${hexed}`) - - return Promise.all(this.keyrings.map((keyring) => { - return Promise.all([ - keyring, - keyring.getAccounts(), - ]) - })) - .then((candidates) => { - const winners = candidates.filter((candidate) => { - const accounts = candidate[1].map(normalizeAddress) - return accounts.includes(hexed) - }) - Eif (winners && winners.length > 0) { - return winners[0][0] - } - throw new Error('No keyring found for the requested account.') - - }) - } - - /** - * Display For Keyring - * - * Is used for adding the current keyrings to the state object. - * @param {Keyring} keyring - * @returns {Promise<Object>} A keyring display object, with type and accounts properties. - */ - displayForKeyring(keyring) { - return keyring.getAccounts() - .then((accounts) => { - return { - type: keyring.type, - accounts: accounts.map(normalizeAddress), - } - }) - } - - /** - * Clear Keyrings - * - * Deallocates all currently managed keyrings and accounts. - * Used before initializing a new vault. - */ - /* eslint-disable require-await */ - async clearKeyrings() { - // clear keyrings from memory - this.keyrings = [] - this.memStore.updateState({ - keyrings: [], - }) - } - - /** - * Update Memstore Keyrings - * - * Updates the in-memory keyrings, without persisting. - */ - async _updateMemStoreKeyrings() { - const keyrings = await Promise.all(this.keyrings.map(this.displayForKeyring)) - return this.memStore.updateState({ keyrings }) - } - - /** - * Unlock Keyrings - * - * Unlocks the keyrings. - * - * @emits KeyringController#unlock - */ - setUnlocked() { - this.memStore.updateState({ isUnlocked: true }) - this.emit('unlock') - } - - - async sendTransaction(signedTx, web3) { - const receipt = await web3.eth.sendSignedTransaction(signedTx); - return { transactionDetails: receipt.transactionHash } - } - - async getFees(optimismTx, web3) { - const { from, to, value, data, gasLimit } = optimismTx - const estimate = gasLimit ? gasLimit : await web3.eth.estimateGas({ to, from, value, data }) - const gasPrice = await web3.eth.getGasPrice(); - return { transactionFees: estimate * gasPrice } - } -} - -const getBalance = async (address, web3) => { - const balance = await web3.eth.getBalance(address); - return { balance: web3.utils.fromWei(balance, 'ether') } -} - -module.exports = { KeyringController, getBalance } |