From 87e43f67c32b3824686d45259958572c7ee208f4 Mon Sep 17 00:00:00 2001 From: yurixander <101931215+yurixander@users.noreply.github.com> Date: Mon, 20 Jan 2025 00:14:58 -0500 Subject: [PATCH] Add Tangle project --- projects/helper/chains.json | 1 + projects/tangle/index.js | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 projects/tangle/index.js diff --git a/projects/helper/chains.json b/projects/helper/chains.json index c6a267e23c..280650ed13 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -332,6 +332,7 @@ "sx", "syscoin", "taiko", + "tTangle", "tara", "telos", "tenet", diff --git a/projects/tangle/index.js b/projects/tangle/index.js new file mode 100644 index 0000000000..9cf2c9ef03 --- /dev/null +++ b/projects/tangle/index.js @@ -0,0 +1,29 @@ + +const { post } = require('../helper/http') + +const endpoint = 'https://rpc.tangle.tools' + +async function fetch(method, params = []) { + const response = await post(endpoint, { jsonrpc: '2.0', id: 1, method, params }) + + console.log(response) + + return response.result +} + +async function tvl(api) { + // balances: totalIssuance() + const totalIssuance = await fetch('state_getStorage', ['0xc2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80']) + + console.debug("Bal", BigInt(totalIssuance).toString()) + + api.add("TNT", BigInt(totalIssuance)) +} + +module.exports = { + timetravel: false, + methodology: 'counts the number of MINT tokens in the Club Bonding contract.', + tTangle: { + tvl + } +} \ No newline at end of file