Transaction Details

Open on Dero Explorer
Internal ID:
3783324
Transaction Hash:
f141198eb3cccd7cb3a05ea9ecd724523d8cb8cde02ceb17670cccd4ada432f4
Block:
Timestamp:
2024-08-24 16:03:28 UTC (1.1 years ago)
Type:
sc
Ring Size:
2
Payloads:
1
Caller:
SixofClubs (+5 more) (1387303)
SC Data:
[{"name":"SC_ACTION","datatype":"U","value":"1"},{"name":"SC_CODE","datatype":"S","value":"Function InitializePrivate() Uint64\n10 IF init() == 0 THEN GOTO 30\n20 RETURN 1\n30 STORE(\"nameHdr\", \"main.js\")\n31 STORE(\"descrHdr\", \"Civilware's TELA Demo\")\n32 STORE(\"iconURLHdr\", \"https://avatars.githubusercontent.com/u/95907224?s=200\u0026v=4\")\n33 STORE(\"dURL\", \"civilware.demo.tela\")\n34 STORE(\"docType\", \"TELA-JS-1\")\n35 STORE(\"subDir\", \"\")\n36 STORE(\"fileCheckC\", \"95a5f07f0cb07e87830d97b399309c1cb77dd2b93285cc242344ea018322f89\")\n37 STORE(\"fileCheckS\", \"1a026b08706247e818b2737a3a6927ab439aeb1f5e2d796d99dc203c632a251d\")\n100 RETURN 0\nEnd Function\n\nFunction init() Uint64\n10 IF EXISTS(\"owner\") == 0 THEN GOTO 30\n20 RETURN 1\n30 STORE(\"owner\", address())\n50 STORE(\"docVersion\", \"1.0.0\")\n60 STORE(\"hash\", HEX(TXID()))\n70 STORE(\"likes\", 0)\n80 STORE(\"dislikes\", 0)\n100 RETURN 0\nEnd Function\n\nFunction address() String\n10 DIM s as String\n20 LET s = SIGNER()\n30 IF IS_ADDRESS_VALID(s) THEN GOTO 50\n40 RETURN \"anon\"\n50 RETURN ADDRESS_STRING(s)\nEnd Function\n\nFunction Rate(r Uint64) Uint64\n10 DIM addr as String\n15 LET addr = address()\n16 IF r \u003c 100 \u0026\u0026 EXISTS(addr) == 0 \u0026\u0026 addr != \"anon\" THEN GOTO 30\n20 RETURN 1\n30 STORE(addr, \"\"+r+\"_\"+BLOCK_HEIGHT())\n40 IF r \u003c 50 THEN GOTO 70\n50 STORE(\"likes\", LOAD(\"likes\")+1)\n60 RETURN 0\n70 STORE(\"dislikes\", LOAD(\"dislikes\")+1)\n100 RETURN 0\nEnd Function\n\n/*\n// Global websocket\nlet socket;\n\n// XSWD application data\nconst applicationData = {\n    \"id\": \"71605a32e3b0c44298fc1c549afbf4c8496fb92427ae41e4649b934ca495991b\",\n    \"name\": \"TELA Demo Application\",\n    \"description\": \"Basic WS connection parts for TELA application\",\n    \"url\": \"http://localhost:\" + location.port, // Get the current port being used by server to set in our XSWD application data, must match origin URL\n};\n\nlet typed = 0;\nlet typeText = \"\";\nconst typeSpeed = 50;\n\nconst jsonBody = document.getElementById(\"jsonDisplayBody\");\nconst jsonResult = document.getElementById(\"jsonDisplayResult\");\n\n// Typing text effect\nfunction typeWriter(text) {\n    const html = document.getElementById(\"typingLabel\");\n    if (typed === 0) {\n        html.innerHTML = \"\";\n        typeText = text;\n    }\n\n    if (typed \u003c typeText.length) {\n        html.innerHTML += typeText.charAt(typed);\n        typed++;\n        setTimeout(typeWriter, typeSpeed);\n    }\n\n    if (typed === typeText.length) {\n        setTimeout(() =\u003e {\n            typed = 0;\n        }, typeSpeed);\n    }\n}\n\n// Function to send data\nfunction sendData(d) {\n    if (socket \u0026\u0026 socket.readyState === WebSocket.OPEN) {\n        try {\n            socket.send(JSON.stringify(d));\n            if (d.method) {\n                console.log(d.method, \"request sent to the server\");\n                if (jsonBody) jsonBody.innerHTML = JSON.stringify(d, null, 2);\n                if (jsonResult) jsonResult.innerHTML = \"\";\n            } else {\n                console.log(\"Connection request sent to the server\");\n            }\n        } catch (error) {\n            console.error(\"Failed to send data:\", error);\n            toggleIndicators(\"red\");\n        }\n    } else {\n        console.log(\"Web socket is not open. State:\", socket ? socket.readyState : \"N/A\");\n        toggleIndicators(\"red\");\n    }\n}\n\n// Handle web socket connection and listeners\nfunction connectWebSocket() {\n    // If we are already connected, disconnect\n    if (document.getElementById(\"connectButton\").textContent === \"Disconnect\") {\n        toggleIndicators(\"red\");\n        return;\n    }\n\n    // Connect to the web socket\n    socket = new WebSocket(\"ws://localhost:44326/xswd\");\n\n    // Listen for open\n    socket.addEventListener(\"open\", function (event) {\n        console.log(\"Web socket connection established:\", event);\n        toggleIndicators(\"yellow\");\n        typed = 0;\n        typeWriter(\"Waiting for wallet reply\");\n        sendData(applicationData); // Send ApplicationData after connection is established\n    });\n\n    let address = \"\";\n    let connecting = true;\n\n    // Listen for the messages\n    socket.addEventListener(\"message\", function (event) {\n        const response = JSON.parse(event.data);\n        console.log(\"Response received:\", response);\n        if (response.accepted) { // If connection is accepted, we will request to get address from wallet\n            console.log(\"Connected message received:\", response.message);\n            sendData({\n                jsonrpc: \"2.0\",\n                id: \"1\",\n                method: \"GetAddress\"\n            });\n        } else if (response.result) {\n            const res = response.result;\n            if (jsonResult) jsonResult.innerHTML = JSON.stringify(res, null, 2);\n            typed = 0;\n            if (res.address) { // If GetAddress is allowed by user\n                address = res.address;\n                console.log(\"Connected address:\", address);\n                toggleIndicators(\"green\");\n                connecting = false;\n                typeWriter(address);\n            } else if (res.unlocked_balance) { // Balance response\n                const bal = \"Balance: \" + (res.unlocked_balance / 100000).toFixed(5) + \" DERO\";\n                console.log(bal);\n                typeWriter(bal);\n            } else if (res.height) { // Height response\n                const height = \"Height: \" + res.height;\n                console.log(height);\n                typeWriter(height);\n            } else if (res.telaLinkResult) {  // TELA link response\n                const link = \"Opened TELA link: \" + res.telaLinkResult;\n                console.log(link);\n                typeWriter(link);\n            } else if (res.lastIndexHeight) { // Gnomon responses\n                const gnomon = \"Gnomon indexed height: \" + res.lastIndexHeight;\n                console.log(gnomon);\n                typeWriter(gnomon);\n            } else if (res.epochHashes) {  // EPOCH responses\n                const epoch = \"Hashes: \" + res.epochHashes + \" in \" + res.epochDuration + \"ms and submitted \" + res.epochSubmitted + \" as miniblocks\";\n                console.log(epoch);\n                typeWriter(epoch);\n            } else if (res.epochAddress) {\n                const epoch = \"EPOCH address: \" + res.epochAddress;\n                console.log(epoch);\n                typeWriter(epoch);\n            } else if (res.maxHashes) {\n                const epoch = \"EPOCH max hashes: \" + res.maxHashes;\n                console.log(epoch);\n                typeWriter(epoch);\n            } else if (res.sessionMinis) {\n                const epoch = \"EPOCH session hashes: \" + res.sessionHashes + \"  miniblocks: \" + res.sessionMinis;\n                console.log(epoch);\n                typeWriter(epoch);\n            }\n        } else if (response.error) { // Display error message\n            console.error(\"Error:\", response.error.message);\n            typed = 0;\n            typeWriter(\" \" + response.error.message);\n            document.getElementById(\"typingLabel\").innerHTML = \"\";\n            if (connecting) toggleIndicators(\"red\");\n        }\n    });\n\n    // Listen for errors\n    socket.addEventListener(\"error\", function (event) {\n        console.error(\"Web socket error:\", event);\n        typed = 0;\n        typeWriter(\" Web socket error: \" + event.target.url.toString());\n    });\n\n    // Listen for close\n    socket.addEventListener(\"close\", function (event) {\n        console.log(\"Web socket connection closed:\", event.code, event.reason);\n        toggleIndicators(\"red\");\n    });\n}\n\n// Change indictor color based on connection status\nfunction toggleIndicators(color) {\n    if (color === \"green\") {\n        document.getElementById(\"connectButton\").textContent = \"Disconnect\";\n        document.getElementById(\"greenIndicator\").style.display = \"block\";\n        document.getElementById(\"yellowIndicator\").style.display = \"none\";\n        document.getElementById(\"redIndicator\").style.display = \"none\";\n    } else if (color === \"yellow\") {\n        document.getElementById(\"connectButton\").textContent = \"Disconnect\";\n        document.getElementById(\"greenIndicator\").style.display = \"none\";\n        document.getElementById(\"yellowIndicator\").style.display = \"block\";\n        document.getElementById(\"redIndicator\").style.display = \"none\";\n    } else {\n        document.getElementById(\"connectButton\").textContent = \"Connect\";\n        document.getElementById(\"greenIndicator\").style.display = \"none\";\n        document.getElementById(\"yellowIndicator\").style.display = \"none\";\n        document.getElementById(\"redIndicator\").style.display = \"block\";\n        document.getElementById(\"typingLabel\").textContent = \"\";\n        if (socket) socket.close(), socket = null;\n    }\n}\n\n// Create new text input\nfunction newInput(p, n) {\n    const input = document.createElement(\"input\");\n    if (n) {\n        input.type = \"number\";\n        input.step = 1;\n        input.min = 0;\n    } else {\n        input.type = \"text\";\n    }\n\n    input.id = p;\n    input.placeholder = p + \":\";\n\n    return input;\n}\n\n// Create needed params for request\nfunction requestParams() {\n    const container = document.getElementById(\"paramsContainer\");\n    const select = document.getElementById(\"selectCall\");\n    container.innerHTML = \"\";\n    switch (select.value) {\n        case \"HandleTELALinks\":\n            container.appendChild(newInput(\"telaLink\")); break;\n        case \"GetTxCount\":\n            container.appendChild(newInput(\"txType\")); break;\n        case \"GetOwner\":\n        case \"GetAllNormalTxWithSCIDBySCID\":\n        case \"GetAllSCIDInvokeDetails\":\n        case \"GetAllSCIDVariableDetails\":\n        case \"GetSCIDInteractionHeight\":\n            container.appendChild(newInput(\"scid\")); break;\n        case \"GetAllNormalTxWithSCIDByAddr\":\n        case \"GetMiniblockCountByAddress\":\n        case \"GetSCIDInteractionByAddr\":\n            container.appendChild(newInput(\"address\")); break;\n        case \"GetAllSCIDInvokeDetailsByEntrypoint\":\n            container.appendChild(newInput(\"scid\"));\n            container.appendChild(newInput(\"entrypoint\")); break;\n        case \"GetAllSCIDInvokeDetailsBySigner\":\n            container.appendChild(newInput(\"scid\"));\n            container.appendChild(newInput(\"signer\")); break;\n        case \"GetSCIDVariableDetailsAtTopoheight\":\n            container.appendChild(newInput(\"scid\"));\n            container.appendChild(newInput(\"height\", true)); break;\n        case \"GetSCIDKeysByValue\":\n        case \"GetSCIDValuesByKey\":\n            container.appendChild(newInput(\"scid\"));\n            container.appendChild(newInput(\"height\", true));\n            if (select.value === \"GetSCIDKeysByValue\") {\n                container.appendChild(newInput(\"value\"));\n            } else {\n                container.appendChild(newInput(\"key\"));\n            }\n            break;\n        case \"GetLiveSCIDValuesByKey\":\n        case \"GetLiveSCIDKeysByValue\":\n            container.appendChild(newInput(\"scid\"));\n            if (select.value === \"GetLiveSCIDKeysByValue\") {\n                container.appendChild(newInput(\"value\"));\n            } else {\n                container.appendChild(newInput(\"key\"));\n            }\n            break;\n        case \"GetInteractionIndex\":\n            container.appendChild(newInput(\"topoheight\", true));\n            container.appendChild(newInput(\"height\", true)); break;\n        case \"GetMiniblockDetailsByHash\":\n            container.appendChild(newInput(\"blid\")); break;\n        case \"AttemptEPOCH\":\n            container.appendChild(newInput(\"hashes\", true)); break;\n    }\n}\n\n// Send call with params\nfunction callFor() {\n    if (!socket) {\n        typed = 0;\n        typeWriter(\"Wallet is not connected\");\n        return;\n    }\n\n    typed = 0;\n    document.getElementById(\"typingLabel\").innerHTML = \"\";\n\n    const select = document.getElementById(\"selectCall\");\n    let m = \"\";\n    if (select.selectedIndex \u003e 3 \u0026\u0026 !select.value.endsWith(\"EPOCH\")) {\n        m = \"Gnomon.\";\n    } else {\n        typeWriter(\"Waiting for wallet reply\");\n    }\n\n    const call = {\n        jsonrpc: \"2.0\",\n        id: \"1\",\n        method: m + select.value,\n        params: {},\n    };\n\n    switch (select.value) {\n        case \"HandleTELALinks\":\n            call.params.telaLink = document.getElementById(\"telaLink\").value; break;\n        case \"GetTxCount\":\n            call.params.txType = document.getElementById(\"txType\").value; break;\n        case \"GetOwner\":\n        case \"GetAllNormalTxWithSCIDBySCID\":\n        case \"GetAllSCIDInvokeDetails\":\n        case \"GetAllSCIDVariableDetails\":\n        case \"GetSCIDInteractionHeight\":\n            call.params.scid = document.getElementById(\"scid\").value; break;\n        case \"GetAllNormalTxWithSCIDByAddr\":\n        case \"GetMiniblockCountByAddress\":\n        case \"GetSCIDInteractionByAddr\":\n            call.params.address = document.getElementById(\"address\").value; break;\n        case \"GetAllSCIDInvokeDetailsByEntrypoint\":\n            call.params.scid = document.getElementById(\"scid\").value;\n            call.params.entrypoint = document.getElementById(\"entrypoint\").value; break;\n        case \"GetAllSCIDInvokeDetailsBySigner\":\n            call.params.scid = document.getElementById(\"scid\").value;\n            call.params.signer = document.getElementById(\"signer\").value; break;\n        case \"GetSCIDVariableDetailsAtTopoheight\":\n            call.params.scid = document.getElementById(\"scid\").value;\n            call.params.height = parseInt(document.getElementById(\"height\").value); break;\n        case \"GetSCIDKeysByValue\":\n        case \"GetSCIDValuesByKey\":\n            call.params.scid = document.getElementById(\"scid\").value;\n            call.params.height = parseInt(document.getElementById(\"height\").value);\n            if (select.value === \"GetSCIDKeysByValue\") {\n                call.params.value = document.getElementById(\"value\").value;\n            } else {\n                call.params.value = document.getElementById(\"key\").value;\n            }\n            break;\n        case \"GetLiveSCIDValuesByKey\":\n        case \"GetLiveSCIDKeysByValue\":\n            call.params.scid = document.getElementById(\"scid\").value;\n            if (select.value === \"GetLiveSCIDKeysByValue\") {\n                call.params.value = document.getElementById(\"value\").value;\n            } else {\n                call.params.value = document.getElementById(\"key\").value;\n            }\n            break;\n        case \"GetInteractionIndex\":\n            call.params.topoheight = parseInt(document.getElementById(\"topoheight\").value);\n            call.params.height = parseInt(document.getElementById(\"height\").value); break;\n        case \"GetMiniblockDetailsByHash\":\n            call.params.blid = document.getElementById(\"blid\").value; break;\n        case \"AttemptEPOCH\":\n            call.params.hashes = parseInt(document.getElementById(\"hashes\").value); break;\n        default:\n            call.params = null; break;\n    }\n\n    sendData(call);\n}\n*/"}]

Payload

Token (SCID):
DERO
Deposited:
none
Fees:
0.1519 DERO