diff --git a/dists/examples/plugins/customDatum/customDatum.py b/dists/examples/plugins/customDatum/customDatum.py new file mode 100644 index 0000000000000000000000000000000000000000..0854724bc8e2078aee1d8b84fdb98e79c59d626e --- /dev/null +++ b/dists/examples/plugins/customDatum/customDatum.py @@ -0,0 +1,23 @@ +from API_CellFrame import logItNotice, AppCliServer, ChainNetSrvDatum, ChainNet + +def datumCMD(argv, indexStrReply): + if (len(argv) == 3 or len(argv) == 5): + if (argv[1] == 'create'): + net = ChainNet.byName(argv[2]) + chain = net.getChainByName(argv[3]) + res = ChainNetSrvDatum.create(chain, argv[4].encode('utf-8')) + AppCliServer.setReplyText("Return hash datum: "+str(res), indexStrReply) + elif(argv[1] == 'load'): + data = ChainNetSrvDatum.read(argv[2]) + AppCliServer.setReplyText("Return data: "+data, indexStrReply) + else: + logitNotice("This command can take three or four arguments.") + +def init(): + logItNotice("Start plugin customDatum") + AppCliServer.cmdItemCreate("pyDatum", datumCMD, "Command for creation datum", """ +Command for created and get info from custom datum: + create <net name> <chain name> <date in datum> + load <path for file> + """) + return 0 diff --git a/dists/examples/plugins/customDatum/manifest.json b/dists/examples/plugins/customDatum/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..35a2c195f511d0cd3327731db8cb38b07aac5ce0 --- /dev/null +++ b/dists/examples/plugins/customDatum/manifest.json @@ -0,0 +1,7 @@ +{ + "name": "customDatum", + "version": "1.0", + "author": "DEMLABS (C) 2021", + "dependencys": [], + "description": "This plugin does the work of the backend for the blockchain explorer." +}