@leofcoin/chain 1.0.22 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chain.browser.js +26539 -9161
- package/dist/chain.js +474 -118
- package/dist/node.browser.js +3603 -3912
- package/dist/node.js +1 -1
- package/dist/protons.browser.js +7818 -175
- package/dist/wrtc.browser.js +1 -1
- package/docs/@leofcoin/chain/1.0.22/chain.js.html +377 -223
- package/docs/@leofcoin/chain/1.0.22/contracts_factory.js.html +123 -123
- package/docs/@leofcoin/chain/1.0.22/contracts_nameService.js.html +123 -123
- package/docs/@leofcoin/chain/1.0.22/contracts_proxies_factoryProxy.js.html +123 -123
- package/docs/@leofcoin/chain/1.0.22/contracts_proxies_nameServiceProxy.js.html +123 -123
- package/docs/@leofcoin/chain/1.0.22/contracts_proxies_nativeTokenProxy.js.html +123 -123
- package/docs/@leofcoin/chain/1.0.22/contracts_proxies_validatorsProxy.js.html +123 -123
- package/docs/@leofcoin/chain/1.0.22/contracts_proxies_votingProxy.js.html +123 -123
- package/docs/@leofcoin/chain/1.0.22/contracts_validators.js.html +123 -123
- package/docs/@leofcoin/chain/1.0.22/fonts/OpenSans-Bold-webfont.svg +1829 -1829
- package/docs/@leofcoin/chain/1.0.22/fonts/OpenSans-BoldItalic-webfont.svg +1829 -1829
- package/docs/@leofcoin/chain/1.0.22/fonts/OpenSans-Italic-webfont.svg +1829 -1829
- package/docs/@leofcoin/chain/1.0.22/fonts/OpenSans-Light-webfont.svg +1830 -1830
- package/docs/@leofcoin/chain/1.0.22/fonts/OpenSans-LightItalic-webfont.svg +1834 -1834
- package/docs/@leofcoin/chain/1.0.22/fonts/OpenSans-Regular-webfont.svg +1830 -1830
- package/docs/@leofcoin/chain/1.0.22/fonts/OpenSans-Semibold-webfont.svg +1829 -1829
- package/docs/@leofcoin/chain/1.0.22/fonts/OpenSans-SemiboldItalic-webfont.svg +1829 -1829
- package/docs/@leofcoin/chain/1.0.22/global.html +1804 -1152
- package/docs/@leofcoin/chain/1.0.22/icons/home.svg +3 -3
- package/docs/@leofcoin/chain/1.0.22/icons/search.svg +3 -3
- package/docs/@leofcoin/chain/1.0.22/index.html +124 -124
- package/docs/@leofcoin/chain/1.0.22/machine.js.html +133 -129
- package/docs/@leofcoin/chain/1.0.22/scripts/linenumber.js +23 -23
- package/docs/@leofcoin/chain/1.0.22/scripts/pagelocation.js +89 -89
- package/docs/@leofcoin/chain/1.0.22/standards_roles.js.html +123 -123
- package/docs/@leofcoin/chain/1.0.22/standards_token.js.html +123 -123
- package/docs/@leofcoin/chain/1.0.22/styles/collapse.css +27 -27
- package/docs/@leofcoin/chain/1.0.22/styles/jsdoc-default.css +953 -953
- package/docs/@leofcoin/chain/1.0.22/styles/prettify-jsdoc.css +111 -111
- package/docs/@leofcoin/chain/1.0.22/styles/prettify-tomorrow.css +138 -138
- package/docs/@leofcoin/chain/1.0.24/chain.js.html +891 -0
- package/docs/@leofcoin/chain/1.0.24/contracts_factory.js.html +182 -0
- package/docs/@leofcoin/chain/1.0.24/contracts_nameService.js.html +231 -0
- package/docs/@leofcoin/chain/1.0.24/contracts_proxies_factoryProxy.js.html +135 -0
- package/docs/@leofcoin/chain/1.0.24/contracts_proxies_nameServiceProxy.js.html +135 -0
- package/docs/@leofcoin/chain/1.0.24/contracts_proxies_nativeTokenProxy.js.html +135 -0
- package/docs/@leofcoin/chain/1.0.24/contracts_proxies_validatorsProxy.js.html +135 -0
- package/docs/@leofcoin/chain/1.0.24/contracts_proxies_votingProxy.js.html +135 -0
- package/docs/@leofcoin/chain/1.0.24/contracts_validators.js.html +242 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Bold-webfont.svg +1830 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Italic-webfont.svg +1830 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Light-webfont.svg +1831 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Regular-webfont.svg +1831 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Semibold-webfont.eot +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Semibold-webfont.svg +1830 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Semibold-webfont.ttf +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-Semibold-webfont.woff +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-SemiboldItalic-webfont.svg +1830 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
- package/docs/@leofcoin/chain/1.0.24/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
- package/docs/@leofcoin/chain/1.0.24/global.html +1805 -0
- package/docs/@leofcoin/chain/1.0.24/icons/home.svg +4 -0
- package/docs/@leofcoin/chain/1.0.24/icons/search.svg +4 -0
- package/docs/@leofcoin/chain/1.0.24/index.html +125 -0
- package/docs/@leofcoin/chain/1.0.24/machine.js.html +255 -0
- package/docs/@leofcoin/chain/1.0.24/scripts/linenumber.js +23 -0
- package/docs/@leofcoin/chain/1.0.24/scripts/pagelocation.js +89 -0
- package/docs/@leofcoin/chain/1.0.24/standards_roles.js.html +188 -0
- package/docs/@leofcoin/chain/1.0.24/standards_token.js.html +260 -0
- package/docs/@leofcoin/chain/1.0.24/styles/collapse.css +27 -0
- package/docs/@leofcoin/chain/1.0.24/styles/jsdoc-default.css +953 -0
- package/docs/@leofcoin/chain/1.0.24/styles/prettify-jsdoc.css +111 -0
- package/docs/@leofcoin/chain/1.0.24/styles/prettify-tomorrow.css +138 -0
- package/package.json +7 -5
- package/rollup.config.js +1 -2
- package/src/chain.js +254 -100
- package/src/config/config.js +11 -12
- package/src/machine.js +10 -6
- package/src/node.js +2 -34
- package/src/state.js +8 -3
- package/src/transactions/transaction.js +3 -0
- package/test/chain.js +39 -60
- package/webpack.config.js +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
|
|
3
|
-
<path d="M0 0h24v24H0z" fill="none"/>
|
|
1
|
+
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
|
|
3
|
+
<path d="M0 0h24v24H0z" fill="none"/>
|
|
4
4
|
</svg>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
|
|
3
|
-
<path d="M0 0h24v24H0z" fill="none"/>
|
|
1
|
+
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
|
|
3
|
+
<path d="M0 0h24v24H0z" fill="none"/>
|
|
4
4
|
</svg>
|
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
|
|
8
|
-
<title>
|
|
9
|
-
Home - Documentation
|
|
10
|
-
</title>
|
|
11
|
-
|
|
12
|
-
<link href="https://www.braintreepayments.com/images/favicon-ccda0b14.png" rel="icon" type="image/png">
|
|
13
|
-
|
|
14
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/highlight.min.js"></script>
|
|
15
|
-
<script>hljs.initHighlightingOnLoad();</script>
|
|
16
|
-
|
|
17
|
-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
|
|
18
|
-
|
|
19
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
20
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
21
|
-
|
|
22
|
-
<link type="text/css" rel="stylesheet" href="styles/collapse.css">
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<!-- start Mixpanel -->
|
|
28
|
-
<script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
|
|
29
|
-
0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
|
|
30
|
-
for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]);
|
|
31
|
-
mixpanel.init("1919205b2da72e4da3b9b6639b444d59");</script>
|
|
32
|
-
<!-- end Mixpanel -->
|
|
33
|
-
</head>
|
|
34
|
-
|
|
35
|
-
<body>
|
|
36
|
-
<svg style="display: none;">
|
|
37
|
-
<defs>
|
|
38
|
-
<symbol id="linkIcon" fill="#706d77" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
|
39
|
-
<path d="M0 0h24v24H0z" fill="none"/>
|
|
40
|
-
<path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/>
|
|
41
|
-
</symbol>
|
|
42
|
-
</defs>
|
|
43
|
-
</svg>
|
|
44
|
-
|
|
45
|
-
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
46
|
-
<label for="nav-trigger" class="navicon-button x">
|
|
47
|
-
<div class="navicon"></div>
|
|
48
|
-
</label>
|
|
49
|
-
|
|
50
|
-
<label for="nav-trigger" class="overlay"></label>
|
|
51
|
-
|
|
52
|
-
<div class="top-nav-wrapper">
|
|
53
|
-
<ul>
|
|
54
|
-
<li class="active" >
|
|
55
|
-
<a href="index.html">
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<svg fill="#0095dd" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
|
59
|
-
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
|
|
60
|
-
<path d="M0 0h24v24H0z" fill="none"/>
|
|
61
|
-
</svg>
|
|
62
|
-
|
|
63
|
-
</a>
|
|
64
|
-
</li>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
</ul>
|
|
69
|
-
</div>
|
|
70
|
-
|
|
71
|
-
<nav>
|
|
72
|
-
<h3 class="reference-title">
|
|
73
|
-
@leofcoin/chain
|
|
74
|
-
</h3>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<h3>
|
|
78
|
-
Resources
|
|
79
|
-
</h3>
|
|
80
|
-
|
|
81
|
-
<a href="https://github.com/arteontoken/monorepo/tree/main/chain">github</a>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<h3 id="global-nav">Global</h3><ul><li><a href="global.html#addContract">addContract</a></li><li><a href="global.html#createTransaction">createTransaction</a></li><li><a href="global.html#createTransactionFrom">createTransactionFrom</a></li><li><a href="global.html#deployContract">deployContract</a></li><li><a href="global.html#lookup">lookup</a></li><li><a href="global.html#state">state</a></li></ul>
|
|
86
|
-
</nav>
|
|
87
|
-
|
|
88
|
-
<div id="main">
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
<section class="readme">
|
|
102
|
-
<article>
|
|
103
|
-
<p><a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/"><img alt="Creative Commons Licence" style="border-width:0" src="https://i.creativecommons.org/l/by-nc/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">Creative Commons Attribution-NonCommercial 4.0 International License</a>.</p>
|
|
104
|
-
</article>
|
|
105
|
-
</section>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
</div>
|
|
112
|
-
|
|
113
|
-
<br class="clear">
|
|
114
|
-
|
|
115
|
-
<footer>
|
|
116
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.
|
|
117
|
-
</footer>
|
|
118
|
-
|
|
119
|
-
<script src="scripts/linenumber.js"></script>
|
|
120
|
-
<script src="scripts/pagelocation.js"></script>
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
</body>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
|
|
8
|
+
<title>
|
|
9
|
+
Home - Documentation
|
|
10
|
+
</title>
|
|
11
|
+
|
|
12
|
+
<link href="https://www.braintreepayments.com/images/favicon-ccda0b14.png" rel="icon" type="image/png">
|
|
13
|
+
|
|
14
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/highlight.min.js"></script>
|
|
15
|
+
<script>hljs.initHighlightingOnLoad();</script>
|
|
16
|
+
|
|
17
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
|
|
18
|
+
|
|
19
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
20
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
21
|
+
|
|
22
|
+
<link type="text/css" rel="stylesheet" href="styles/collapse.css">
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<!-- start Mixpanel -->
|
|
28
|
+
<script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
|
|
29
|
+
0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
|
|
30
|
+
for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]);
|
|
31
|
+
mixpanel.init("1919205b2da72e4da3b9b6639b444d59");</script>
|
|
32
|
+
<!-- end Mixpanel -->
|
|
33
|
+
</head>
|
|
34
|
+
|
|
35
|
+
<body>
|
|
36
|
+
<svg style="display: none;">
|
|
37
|
+
<defs>
|
|
38
|
+
<symbol id="linkIcon" fill="#706d77" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
|
39
|
+
<path d="M0 0h24v24H0z" fill="none"/>
|
|
40
|
+
<path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/>
|
|
41
|
+
</symbol>
|
|
42
|
+
</defs>
|
|
43
|
+
</svg>
|
|
44
|
+
|
|
45
|
+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
46
|
+
<label for="nav-trigger" class="navicon-button x">
|
|
47
|
+
<div class="navicon"></div>
|
|
48
|
+
</label>
|
|
49
|
+
|
|
50
|
+
<label for="nav-trigger" class="overlay"></label>
|
|
51
|
+
|
|
52
|
+
<div class="top-nav-wrapper">
|
|
53
|
+
<ul>
|
|
54
|
+
<li class="active" >
|
|
55
|
+
<a href="index.html">
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
<svg fill="#0095dd" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
|
59
|
+
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
|
|
60
|
+
<path d="M0 0h24v24H0z" fill="none"/>
|
|
61
|
+
</svg>
|
|
62
|
+
|
|
63
|
+
</a>
|
|
64
|
+
</li>
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
</ul>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<nav>
|
|
72
|
+
<h3 class="reference-title">
|
|
73
|
+
@leofcoin/chain
|
|
74
|
+
</h3>
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
<h3>
|
|
78
|
+
Resources
|
|
79
|
+
</h3>
|
|
80
|
+
|
|
81
|
+
<a href="https://github.com/arteontoken/monorepo/tree/main/chain">github</a>
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<h3 id="global-nav">Global</h3><ul><li><a href="global.html#addContract">addContract</a></li><li><a href="global.html#createRawTransaction">createRawTransaction</a></li><li><a href="global.html#createTransaction">createTransaction</a></li><li><a href="global.html#createTransactionFrom">createTransactionFrom</a></li><li><a href="global.html#createTransactionHash">createTransactionHash</a></li><li><a href="global.html#deployContract">deployContract</a></li><li><a href="global.html#lookup">lookup</a></li><li><a href="global.html#state">state</a></li></ul>
|
|
86
|
+
</nav>
|
|
87
|
+
|
|
88
|
+
<div id="main">
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
<section class="readme">
|
|
102
|
+
<article>
|
|
103
|
+
<p><a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/"><img alt="Creative Commons Licence" style="border-width:0" src="https://i.creativecommons.org/l/by-nc/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">Creative Commons Attribution-NonCommercial 4.0 International License</a>.</p>
|
|
104
|
+
</article>
|
|
105
|
+
</section>
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
<br class="clear">
|
|
114
|
+
|
|
115
|
+
<footer>
|
|
116
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a>
|
|
117
|
+
</footer>
|
|
118
|
+
|
|
119
|
+
<script src="scripts/linenumber.js"></script>
|
|
120
|
+
<script src="scripts/pagelocation.js"></script>
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
</body>
|
|
125
125
|
</html>
|
|
@@ -1,107 +1,108 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<!DOCTYPE html>
|
|
4
|
-
<html lang="en">
|
|
5
|
-
<head>
|
|
6
|
-
|
|
7
|
-
<meta charset="utf-8">
|
|
8
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
9
|
-
|
|
10
|
-
<title>
|
|
11
|
-
machine.js - Documentation
|
|
12
|
-
</title>
|
|
13
|
-
|
|
14
|
-
<link href="https://www.braintreepayments.com/images/favicon-ccda0b14.png" rel="icon" type="image/png">
|
|
15
|
-
|
|
16
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/highlight.min.js"></script>
|
|
17
|
-
<script>hljs.initHighlightingOnLoad();</script>
|
|
18
|
-
|
|
19
|
-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
|
|
20
|
-
|
|
21
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
22
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
23
|
-
|
|
24
|
-
<link type="text/css" rel="stylesheet" href="styles/collapse.css">
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<!-- start Mixpanel -->
|
|
30
|
-
<script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
|
|
31
|
-
0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
|
|
32
|
-
for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]);
|
|
33
|
-
mixpanel.init("1919205b2da72e4da3b9b6639b444d59");</script>
|
|
34
|
-
<!-- end Mixpanel -->
|
|
35
|
-
</head>
|
|
36
|
-
|
|
37
|
-
<body>
|
|
38
|
-
<svg style="display: none;">
|
|
39
|
-
<defs>
|
|
40
|
-
<symbol id="linkIcon" fill="#706d77" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
|
41
|
-
<path d="M0 0h24v24H0z" fill="none"/>
|
|
42
|
-
<path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/>
|
|
43
|
-
</symbol>
|
|
44
|
-
</defs>
|
|
45
|
-
</svg>
|
|
46
|
-
|
|
47
|
-
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
48
|
-
<label for="nav-trigger" class="navicon-button x">
|
|
49
|
-
<div class="navicon"></div>
|
|
50
|
-
</label>
|
|
51
|
-
|
|
52
|
-
<label for="nav-trigger" class="overlay"></label>
|
|
53
|
-
|
|
54
|
-
<div class="top-nav-wrapper">
|
|
55
|
-
<ul>
|
|
56
|
-
<li >
|
|
57
|
-
<a href="index.html">
|
|
58
|
-
|
|
59
|
-
<svg fill="#6D6D6D" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
|
60
|
-
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
|
|
61
|
-
<path d="M0 0h24v24H0z" fill="none"/>
|
|
62
|
-
</svg>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
</a>
|
|
66
|
-
</li>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
</ul>
|
|
71
|
-
</div>
|
|
72
|
-
|
|
73
|
-
<nav>
|
|
74
|
-
<h3 class="reference-title">
|
|
75
|
-
@leofcoin/chain
|
|
76
|
-
</h3>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<h3>
|
|
80
|
-
Resources
|
|
81
|
-
</h3>
|
|
82
|
-
|
|
83
|
-
<a href="https://github.com/arteontoken/monorepo/tree/main/chain">github</a>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<h3 id="global-nav">Global</h3><ul><li><a href="global.html#addContract">addContract</a></li><li><a href="global.html#createTransaction">createTransaction</a></li><li><a href="global.html#createTransactionFrom">createTransactionFrom</a></li><li><a href="global.html#deployContract">deployContract</a></li><li><a href="global.html#lookup">lookup</a></li><li><a href="global.html#state">state</a></li></ul>
|
|
88
|
-
</nav>
|
|
89
|
-
|
|
90
|
-
<div id="main">
|
|
91
|
-
|
|
92
|
-
<h1 class="page-title">
|
|
93
|
-
machine.js
|
|
94
|
-
</h1>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<section>
|
|
101
|
-
<article>
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
<!DOCTYPE html>
|
|
4
|
+
<html lang="en">
|
|
5
|
+
<head>
|
|
6
|
+
|
|
7
|
+
<meta charset="utf-8">
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
9
|
+
|
|
10
|
+
<title>
|
|
11
|
+
machine.js - Documentation
|
|
12
|
+
</title>
|
|
13
|
+
|
|
14
|
+
<link href="https://www.braintreepayments.com/images/favicon-ccda0b14.png" rel="icon" type="image/png">
|
|
15
|
+
|
|
16
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/highlight.min.js"></script>
|
|
17
|
+
<script>hljs.initHighlightingOnLoad();</script>
|
|
18
|
+
|
|
19
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
|
|
20
|
+
|
|
21
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
22
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
23
|
+
|
|
24
|
+
<link type="text/css" rel="stylesheet" href="styles/collapse.css">
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<!-- start Mixpanel -->
|
|
30
|
+
<script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
|
|
31
|
+
0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
|
|
32
|
+
for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]);
|
|
33
|
+
mixpanel.init("1919205b2da72e4da3b9b6639b444d59");</script>
|
|
34
|
+
<!-- end Mixpanel -->
|
|
35
|
+
</head>
|
|
36
|
+
|
|
37
|
+
<body>
|
|
38
|
+
<svg style="display: none;">
|
|
39
|
+
<defs>
|
|
40
|
+
<symbol id="linkIcon" fill="#706d77" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
|
41
|
+
<path d="M0 0h24v24H0z" fill="none"/>
|
|
42
|
+
<path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/>
|
|
43
|
+
</symbol>
|
|
44
|
+
</defs>
|
|
45
|
+
</svg>
|
|
46
|
+
|
|
47
|
+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
48
|
+
<label for="nav-trigger" class="navicon-button x">
|
|
49
|
+
<div class="navicon"></div>
|
|
50
|
+
</label>
|
|
51
|
+
|
|
52
|
+
<label for="nav-trigger" class="overlay"></label>
|
|
53
|
+
|
|
54
|
+
<div class="top-nav-wrapper">
|
|
55
|
+
<ul>
|
|
56
|
+
<li >
|
|
57
|
+
<a href="index.html">
|
|
58
|
+
|
|
59
|
+
<svg fill="#6D6D6D" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
|
|
60
|
+
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
|
|
61
|
+
<path d="M0 0h24v24H0z" fill="none"/>
|
|
62
|
+
</svg>
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
</a>
|
|
66
|
+
</li>
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</ul>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<nav>
|
|
74
|
+
<h3 class="reference-title">
|
|
75
|
+
@leofcoin/chain
|
|
76
|
+
</h3>
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<h3>
|
|
80
|
+
Resources
|
|
81
|
+
</h3>
|
|
82
|
+
|
|
83
|
+
<a href="https://github.com/arteontoken/monorepo/tree/main/chain">github</a>
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
<h3 id="global-nav">Global</h3><ul><li><a href="global.html#addContract">addContract</a></li><li><a href="global.html#createRawTransaction">createRawTransaction</a></li><li><a href="global.html#createTransaction">createTransaction</a></li><li><a href="global.html#createTransactionFrom">createTransactionFrom</a></li><li><a href="global.html#createTransactionHash">createTransactionHash</a></li><li><a href="global.html#deployContract">deployContract</a></li><li><a href="global.html#lookup">lookup</a></li><li><a href="global.html#state">state</a></li></ul>
|
|
88
|
+
</nav>
|
|
89
|
+
|
|
90
|
+
<div id="main">
|
|
91
|
+
|
|
92
|
+
<h1 class="page-title">
|
|
93
|
+
machine.js
|
|
94
|
+
</h1>
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
<section>
|
|
101
|
+
<article>
|
|
102
102
|
<pre class="prettyprint source linenums"><code>import vm from 'vm'
|
|
103
|
-
import { ContractMessage
|
|
104
|
-
import { contractFactory, nativeToken, validators, nameService } from '
|
|
103
|
+
import { ContractMessage } from './../../messages/src/messages'
|
|
104
|
+
import { contractFactory, nativeToken, validators, nameService } from './../../addresses/src/addresses.json'
|
|
105
|
+
import { formatBytes } from './../../utils/src/utils'
|
|
105
106
|
// import State from './state'
|
|
106
107
|
|
|
107
108
|
export default class Machine {
|
|
@@ -130,8 +131,11 @@ export default class Machine {
|
|
|
130
131
|
]
|
|
131
132
|
|
|
132
133
|
contracts = await Promise.all(contracts)
|
|
134
|
+
console.log(contracts);
|
|
133
135
|
for (const contract of contracts) {
|
|
136
|
+
|
|
134
137
|
const message = await new ContractMessage(new Uint8Array(contract.buffer, contract.buffer.byteOffset, contract.buffer.byteLength))
|
|
138
|
+
console.log(message);
|
|
135
139
|
await this.#runContract(message)
|
|
136
140
|
}
|
|
137
141
|
} catch (e) {
|
|
@@ -152,6 +156,7 @@ console.log(e);
|
|
|
152
156
|
}
|
|
153
157
|
|
|
154
158
|
async #runContract(contractMessage) {
|
|
159
|
+
console.log(contractMessage);
|
|
155
160
|
const params = contractMessage.decoded.constructorParameters
|
|
156
161
|
try {
|
|
157
162
|
|
|
@@ -160,16 +165,15 @@ console.log(e);
|
|
|
160
165
|
|
|
161
166
|
globalThis.msg = this.#createMessage(contractMessage.decoded.creator)
|
|
162
167
|
// globalThis.msg = {sender: contractMessage.decoded.creator}
|
|
163
|
-
this.#contracts[contractMessage.hash] = new Contract(...params)
|
|
164
|
-
debug(`loaded contract: ${contractMessage.hash}`);
|
|
165
|
-
debug(`size: ${
|
|
168
|
+
this.#contracts[await contractMessage.hash] = await new Contract(...params)
|
|
169
|
+
debug(`loaded contract: ${await contractMessage.hash}`);
|
|
170
|
+
debug(`size: ${formatBytes(contractMessage.encoded.length)}`);
|
|
166
171
|
} catch (e) {
|
|
167
172
|
console.log(e);
|
|
168
173
|
console.warn(`removing contract ${contractMessage.hash}`);
|
|
169
174
|
await contractStore.delete(contractMessage.hash, contractMessage.encoded)
|
|
170
175
|
}
|
|
171
176
|
}
|
|
172
|
-
|
|
173
177
|
/**
|
|
174
178
|
* @params {ContractMessage} - contractMessage
|
|
175
179
|
*/
|
|
@@ -227,25 +231,25 @@ console.log(e);
|
|
|
227
231
|
return Promise.all(hashes)
|
|
228
232
|
}
|
|
229
233
|
}
|
|
230
|
-
</code></pre>
|
|
231
|
-
</article>
|
|
232
|
-
</section>
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
</div>
|
|
238
|
-
|
|
239
|
-
<br class="clear">
|
|
240
|
-
|
|
241
|
-
<footer>
|
|
242
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.
|
|
243
|
-
</footer>
|
|
244
|
-
|
|
245
|
-
<script src="scripts/linenumber.js"></script>
|
|
246
|
-
<script src="scripts/pagelocation.js"></script>
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
</body>
|
|
251
|
-
</html>
|
|
234
|
+
</code></pre>
|
|
235
|
+
</article>
|
|
236
|
+
</section>
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
</div>
|
|
242
|
+
|
|
243
|
+
<br class="clear">
|
|
244
|
+
|
|
245
|
+
<footer>
|
|
246
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a>
|
|
247
|
+
</footer>
|
|
248
|
+
|
|
249
|
+
<script src="scripts/linenumber.js"></script>
|
|
250
|
+
<script src="scripts/pagelocation.js"></script>
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
</body>
|
|
255
|
+
</html>
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
(function () {
|
|
4
|
-
var lineId, lines, totalLines, anchorHash;
|
|
5
|
-
var source = document.getElementsByClassName('prettyprint source linenums');
|
|
6
|
-
var i = 0;
|
|
7
|
-
var lineNumber = 0;
|
|
8
|
-
|
|
9
|
-
if (source && source[0]) {
|
|
10
|
-
anchorHash = document.location.hash.substring(1);
|
|
11
|
-
lines = source[0].getElementsByTagName('li');
|
|
12
|
-
totalLines = lines.length;
|
|
13
|
-
|
|
14
|
-
for (; i < totalLines; i++) {
|
|
15
|
-
lineNumber++;
|
|
16
|
-
lineId = 'line' + lineNumber;
|
|
17
|
-
lines[i].id = lineId;
|
|
18
|
-
if (lineId === anchorHash) {
|
|
19
|
-
lines[i].className += ' selected';
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
})();
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
(function () {
|
|
4
|
+
var lineId, lines, totalLines, anchorHash;
|
|
5
|
+
var source = document.getElementsByClassName('prettyprint source linenums');
|
|
6
|
+
var i = 0;
|
|
7
|
+
var lineNumber = 0;
|
|
8
|
+
|
|
9
|
+
if (source && source[0]) {
|
|
10
|
+
anchorHash = document.location.hash.substring(1);
|
|
11
|
+
lines = source[0].getElementsByTagName('li');
|
|
12
|
+
totalLines = lines.length;
|
|
13
|
+
|
|
14
|
+
for (; i < totalLines; i++) {
|
|
15
|
+
lineNumber++;
|
|
16
|
+
lineId = 'line' + lineNumber;
|
|
17
|
+
lines[i].id = lineId;
|
|
18
|
+
if (lineId === anchorHash) {
|
|
19
|
+
lines[i].className += ' selected';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
})();
|