SC CODE: Function InitializePrivate() Uint64
10 IF init() == 0 THEN GOTO 30
20 RETURN 1
30 STORE("nameHdr", "tela.html")
31 STORE("descrHdr", "AS's Playground Live")
32 STORE("iconURLHdr", "")
33 STORE("dURL", "AS's Playground Live")
34 STORE("docType", "TELA-HTML-1")
35 STORE("subDir", "")
36 STORE("fileCheckC", "2b95ad57b8568be9ed1bb9f09e7445c659154ff86df2fc88f5c026cb87b0edb7")
37 STORE("fileCheckS", "a371a5c8ae374780670b0110abb49854f3003883d1c9c50238d38915f301dd0")
100 RETURN 0
End Function
Function init() Uint64
10 IF EXISTS("owner") == 0 THEN GOTO 30
20 RETURN 1
30 STORE("owner", address())
50 STORE("docVersion", "1.0.0")
60 STORE("hash", HEX(TXID()))
70 STORE("likes", 0)
80 STORE("dislikes", 0)
100 RETURN 0
End Function
Function address() String
10 DIM s as String
20 LET s = SIGNER()
30 IF IS_ADDRESS_VALID(s) THEN GOTO 50
40 RETURN "anon"
50 RETURN ADDRESS_STRING(s)
End Function
Function Rate(r Uint64) Uint64
10 DIM addr as String
15 LET addr = address()
16 IF r < 100 && EXISTS(addr) == 0 && addr != "anon" THEN GOTO 30
20 RETURN 1
30 STORE(addr, ""+r+"_"+BLOCK_HEIGHT())
40 IF r < 50 THEN GOTO 70
50 STORE("likes", LOAD("likes")+1)
60 RETURN 0
70 STORE("dislikes", LOAD("dislikes")+1)
100 RETURN 0
End Function
/*
<!DOCTYPE html>
<html lang="en">
<head>
<title>AS's Playground Live</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="header.js" type="text/javascript" defer></script>
<script src="nav.js" type="text/javascript" defer></script>
<script src="footer.js" type="text/javascript" defer></script>
<script src="main.js"></script>
</head>
<body>
<header><header-component></header-component></header>
<div class="sticky";>
<nav><div class="marginside";><nav-component></nav-component></div></nav>
</div>
<section>
<aside>
<p><strong></srong>TELA</strong><p>
<li><a class="side" href="#Links to another SCID">Links to another SCID</a></li>
<li><a class="side" href="#Terminal Things">Terminal Things</a></li>
</aside>
<article>
<h1>TELA</h1>
<p>Things I learned, found out about.</p>
<h2 id="Links to another SCID" class="anchored">Links to another SCID</h2>
<hr>
<p>To make a link to another Webapp.</p>
<p><code>tela://open/scid</code></p>
<p>For example if you want to make a link to a certain page from another SCID it would be something like this:</p>
<p><code>tela://open/scid/somepage.html</code></p>
<p>To get rid of all the secrets, here the copy/pasta of the total line of code, use it for no less than great links, forget about the silly ones.</p>
<p><code><a href="#" onclick='sendData({ jsonrpc: "2.0", id: "1", method: "HandleTELALinks", params: { telaLink: "tela://open/<SCID here>" } }); return false;'>For example name of the dApp here</a></code></p>
<pre><p><code>html
<a href="#"
onclick='sendData({
jsonrpc: "2.0",
id: "1",
method: "HandleTELALinks",
params: { telaLink: "tela://open/<SCID here>" }
}); return false;'>
For example name of the dApp
</a></code></p>
</pre>
<h3>Explanation:</h3>
<ul>
<p><li><code><a href="#"></code>: This creates a hyperlink. The href="#" means it doesn’t navigate anywhere by default (it's a placeholder).</li></p>
<p><li><code>onclick='...'</code>: When the user clicks this link, JavaScript inside this handler will execute.</li></p>
<p><li><code>sendData({...})</code>: This calls a JavaScript function named sendData and passes it an object. This object appears to follow the JSON-RPC 2.0 specification, a common protocol for remote procedure calls (RPCs).</li></p>
</ul>
<h4>The object inside <code>sendData()</code> includes:</h4>
<ul>
<p><li><code>jsonrpc: "2.0"</code>: Indicates this is a JSON-RPC 2.0 request.</li></p>
<p><li><code>id: "1"</code>: A request identifier (can be used to match responses).</li></p>
<p><li><code>method: "HandleTELALinks"</code>: The method being invoked on the server or endpoint.</li></p>
<p><li><code>params: { telaLink: "tela://open/<SCID here>" }</code>: The parameters to the method. In this case, telaLink is a custom URI scheme (tela://) with a placeholder for a SCID (Smart Contract ID or similar unique identifier).</li></p>
<p><li><code>return false;</code>: Prevents the default action of the <a> tag (which would be to jump to the top of the page due to href="#").</li></p>
</ul>
<h2 id="Terminal Things" class="anchored">Terminal Things</h2>
<hr>
<p>Q: Is there a way to escape out of an install other than closing the terminal?</p>
<p>At any point `ctrl+d` can be used to go back to the main prompt.</p>
<p><code>ctrl+d</code></p>
<br>
<hr>
<svg style="height: 150px; max-width: 95%;" id="titleImg" data-name="titleImg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1784.46 832.8">
<g id="Text">
<polygon class="cls-3"
points=".27 118.61 712.59 118.61 712.59 237.61 356.69 237.61 356.69 714.18 237.26 714.18 237.26 237.61 0 237.61 .27 118.61" />
<rect class="cls-3" x="475.31" y="356.72" width="237.27" height="119.41" />
<polygon class="cls-3"
points="475.27 594.79 831.2 594.79 831.2 118.61 950.62 118.61 950.62 594.79 1188.68 594.79 1188.68 118.61 1784.46 713.61 1615.41 713.61 1308.06 406.95 1308.06 713.61 475.27 713.61 475.27 594.79" />
<rect class="cls-2" x="356.69" y="714.2" width="118.61" height="118.61" />
<rect class="cls-1" x="712.59" width="118.61" height="118.61" />
</g>
</svg>
</article>
</section>
<footer-component></footer-component>
</body>
</html>
*/ |
SC Arguments: [Name:SC_ACTION Type:uint64 Value:'1' Name:SC_CODE Type:string Value:'Function InitializePrivate() Uint64
10 IF init() == 0 THEN GOTO 30
20 RETURN 1
30 STORE("nameHdr", "tela.html")
31 STORE("descrHdr", "AS's Playground Live")
32 STORE("iconURLHdr", "")
33 STORE("dURL", "AS's Playground Live")
34 STORE("docType", "TELA-HTML-1")
35 STORE("subDir", "")
36 STORE("fileCheckC", "2b95ad57b8568be9ed1bb9f09e7445c659154ff86df2fc88f5c026cb87b0edb7")
37 STORE("fileCheckS", "a371a5c8ae374780670b0110abb49854f3003883d1c9c50238d38915f301dd0")
100 RETURN 0
End Function
Function init() Uint64
10 IF EXISTS("owner") == 0 THEN GOTO 30
20 RETURN 1
30 STORE("owner", address())
50 STORE("docVersion", "1.0.0")
60 STORE("hash", HEX(TXID()))
70 STORE("likes", 0)
80 STORE("dislikes", 0)
100 RETURN 0
End Function
Function address() String
10 DIM s as String
20 LET s = SIGNER()
30 IF IS_ADDRESS_VALID(s) THEN GOTO 50
40 RETURN "anon"
50 RETURN ADDRESS_STRING(s)
End Function
Function Rate(r Uint64) Uint64
10 DIM addr as String
15 LET addr = address()
16 IF r < 100 && EXISTS(addr) == 0 && addr != "anon" THEN GOTO 30
20 RETURN 1
30 STORE(addr, ""+r+"_"+BLOCK_HEIGHT())
40 IF r < 50 THEN GOTO 70
50 STORE("likes", LOAD("likes")+1)
60 RETURN 0
70 STORE("dislikes", LOAD("dislikes")+1)
100 RETURN 0
End Function
/*
<!DOCTYPE html>
<html lang="en">
<head>
<title>AS's Playground Live</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="header.js" type="text/javascript" defer></script>
<script src="nav.js" type="text/javascript" defer></script>
<script src="footer.js" type="text/javascript" defer></script>
<script src="main.js"></script>
</head>
<body>
<header><header-component></header-component></header>
<div class="sticky";>
<nav><div class="marginside";><nav-component></nav-component></div></nav>
</div>
<section>
<aside>
<p><strong></srong>TELA</strong><p>
<li><a class="side" href="#Links to another SCID">Links to another SCID</a></li>
<li><a class="side" href="#Terminal Things">Terminal Things</a></li>
</aside>
<article>
<h1>TELA</h1>
<p>Things I learned, found out about.</p>
<h2 id="Links to another SCID" class="anchored">Links to another SCID</h2>
<hr>
<p>To make a link to another Webapp.</p>
<p><code>tela://open/scid</code></p>
<p>For example if you want to make a link to a certain page from another SCID it would be something like this:</p>
<p><code>tela://open/scid/somepage.html</code></p>
<p>To get rid of all the secrets, here the copy/pasta of the total line of code, use it for no less than great links, forget about the silly ones.</p>
<p><code><a href="#" onclick='sendData({ jsonrpc: "2.0", id: "1", method: "HandleTELALinks", params: { telaLink: "tela://open/<SCID here>" } }); return false;'>For example name of the dApp here</a></code></p>
<pre><p><code>html
<a href="#"
onclick='sendData({
jsonrpc: "2.0",
id: "1",
method: "HandleTELALinks",
params: { telaLink: "tela://open/<SCID here>" }
}); return false;'>
For example name of the dApp
</a></code></p>
</pre>
<h3>Explanation:</h3>
<ul>
<p><li><code><a href="#"></code>: This creates a hyperlink. The href="#" means it doesn’t navigate anywhere by default (it's a placeholder).</li></p>
<p><li><code>onclick='...'</code>: When the user clicks this link, JavaScript inside this handler will execute.</li></p>
<p><li><code>sendData({...})</code>: This calls a JavaScript function named sendData and passes it an object. This object appears to follow the JSON-RPC 2.0 specification, a common protocol for remote procedure calls (RPCs).</li></p>
</ul>
<h4>The object inside <code>sendData()</code> includes:</h4>
<ul>
<p><li><code>jsonrpc: "2.0"</code>: Indicates this is a JSON-RPC 2.0 request.</li></p>
<p><li><code>id: "1"</code>: A request identifier (can be used to match responses).</li></p>
<p><li><code>method: "HandleTELALinks"</code>: The method being invoked on the server or endpoint.</li></p>
<p><li><code>params: { telaLink: "tela://open/<SCID here>" }</code>: The parameters to the method. In this case, telaLink is a custom URI scheme (tela://) with a placeholder for a SCID (Smart Contract ID or similar unique identifier).</li></p>
<p><li><code>return false;</code>: Prevents the default action of the <a> tag (which would be to jump to the top of the page due to href="#").</li></p>
</ul>
<h2 id="Terminal Things" class="anchored">Terminal Things</h2>
<hr>
<p>Q: Is there a way to escape out of an install other than closing the terminal?</p>
<p>At any point `ctrl+d` can be used to go back to the main prompt.</p>
<p><code>ctrl+d</code></p>
<br>
<hr>
<svg style="height: 150px; max-width: 95%;" id="titleImg" data-name="titleImg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1784.46 832.8">
<g id="Text">
<polygon class="cls-3"
points=".27 118.61 712.59 118.61 712.59 237.61 356.69 237.61 356.69 714.18 237.26 714.18 237.26 237.61 0 237.61 .27 118.61" />
<rect class="cls-3" x="475.31" y="356.72" width="237.27" height="119.41" />
<polygon class="cls-3"
points="475.27 594.79 831.2 594.79 831.2 118.61 950.62 118.61 950.62 594.79 1188.68 594.79 1188.68 118.61 1784.46 713.61 1615.41 713.61 1308.06 406.95 1308.06 713.61 475.27 713.61 475.27 594.79" />
<rect class="cls-2" x="356.69" y="714.2" width="118.61" height="118.61" />
<rect class="cls-1" x="712.59" width="118.61" height="118.61" />
</g>
</svg>
</article>
</section>
<footer-component></footer-component>
</body>
</html>
*/'] |