Skip to content

Commit

Permalink
Add info about deployed modules
Browse files Browse the repository at this point in the history
  • Loading branch information
CryptoPascal31 committed Jun 15, 2023
1 parent 20784fe commit eed85fb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
5 changes: 5 additions & 0 deletions client/cyKlone_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ async function main_menu()
const WITHDRAW ="Withdraw";
const WITHDRAW_RELAY ="Withdraw with relay";
const WITHDRAW_RELAY_XCHAIN ="Withdraw with relay X-chain";
const DEPLOYED_MODULES_INFOS ="Deployed modules infos"

while(true)
{
Expand All @@ -286,13 +287,17 @@ async function main_menu()
WITHDRAW,
WITHDRAW_RELAY,
WITHDRAW_RELAY_XCHAIN,
DEPLOYED_MODULES_INFOS,
EXIT]}])
if(answer.menu_item === EXIT)
break;
try
{
switch(answer.menu_item)
{
case DEPLOYED_MODULES_INFOS:
await cyKlone.module_infos().then(console.log);
break;
case SELECT_POOL:
await set_pool();
break;
Expand Down
21 changes: 20 additions & 1 deletion cyklone_js/cyklone.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
import {MODULE, RELAY_MODULE} from './pact_modules.js'
import {MODULE, RELAY_MODULE, POSEIDON_MODULE, VERIFIER_MODULE, WORK_GAS_STATION, ALL_MODULES} from './pact_modules.js'
import {CyKloneTree} from './cyklone_tree.js';
import {ungzip} from "pako"
import {int_to_b64, b64_to_dec, hash_dec, encode_proof} from "./codecs.js"
Expand Down Expand Up @@ -30,6 +30,25 @@ class CyKlone
return zok_init().then((x) => {this.zokrates = x;});
}

module_infos()
{

return this.kadena_local(`(zip (lambda (h v) {'hash:h, 'version:v})
(map (compose (describe-module) (at 'hash))
["${POSEIDON_MODULE}",
"${VERIFIER_MODULE}",
"${MODULE}",
"${WORK_GAS_STATION}",
"${RELAY_MODULE}"])
[${POSEIDON_MODULE}.VERSION,
"Unknown",
${MODULE}.VERSION,
${WORK_GAS_STATION}.VERSION,
${RELAY_MODULE}.VERSION])`)
.then((data) => ALL_MODULES.reduce( (o, k, i) => Object.assign(o,{[k]:data[i]}), {}))
}


load_binary(name)
{
if(this.binaries.has(name))
Expand Down
4 changes: 4 additions & 0 deletions cyklone_js/pact_modules.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// SPDX-License-Identifier: MIT

export const POSEIDON_MODULE = "free.poseidon-hash-v1"
export const VERIFIER_MODULE = "free.cyklone-withdraw-verifier-v0"
export const MODULE = "free.cyKlone-v0-multipool"
export const RELAY_MODULE = "free.cyKlone-relay-v0"
export const WORK_GAS_STATION = "free.cyKlone-work-gas-station"

export const ALL_MODULES = [POSEIDON_MODULE, VERIFIER_MODULE, MODULE, RELAY_MODULE, WORK_GAS_STATION]

0 comments on commit eed85fb

Please sign in to comment.