Commit c75ca95a authored by matograine's avatar matograine
Browse files

changing functions. Transfer no longer adds unlock conditions. Retrieve allows...

changing functions. Transfer no longer adds unlock conditions. Retrieve allows the owner to retrieve the G1Pourboires. I still have to add an expiring_date in the doc.json, and to clean all this dirty and dead code.
parent 757791e6
......@@ -9,34 +9,24 @@
# pour le click context
from utils.common import Creating # Generator
from utils.retrieve import Retrieve
from sys import argv
import asyncio
import aiohttp
import async_timeout
amount = float(argv[1])
pages = int(argv[2])
delay_days = float(argv[3])
if argv[1] == "generate":
amount = float(argv[2])
pages = int(argv[3])
delay = float(argv[4])
Creating (amount, pages, delay). create()
if __name__ == "__main__":
Creating(amount, pages, delay_days).create()
async def main(loop, amount, pages):
elif argv[1] == "retrieve":
file = argv[2]
pubkey = argv [3]
Retrieve().retrieve(file, pubkey)
async with aiohttp.ClientSession(loop=loop) as session:
tasks = [create(session, amount, pages)]
await asyncio.gather(*tasks)
async def create(session, amount, pages):
with async_timeout.timeout(10):
# async with session.Creating(amount, pages).create() as response:
# return await response.release()
await Creating(amount, pages).create()
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop, amount, pages))
else :
print ("Use \"generate <amount> <pages number> <delay days>\" to generate G1pourboires.")
print ("Use \"retrieve <file> <your pubkey>\" to retrieve G1pourboires from a file")
......@@ -42,7 +42,7 @@ class Retrieve():
## 2e essai
async def retrieve(slef, file, retrieving_pubkeys):
async def retrieve(self, file, retrieving_pubkeys):
retrieving_pubkeys = retrieving_pubkeys.split(":")
with open(file) as wallets_json:
retrieving_wallets = json.load(wallets_json)
......@@ -134,6 +134,29 @@ def auth_by_scrypt(ctx):
except ValueError as error:
def auth_by_scrypt_with_IDs(salt, password):
# salt = getpass("Please enter your Scrypt Salt (Secret identifier): ")
# password = getpass("Please enter your Scrypt password (masked): ")
# if ctx.obj["AUTH_SCRYPT_PARAMS"]:
# n, r, p = ctx.obj["AUTH_SCRYPT_PARAMS"].split(",")
# if n.isnumeric() and r.isnumeric() and p.isnumeric():
# n, r, p = int(n), int(r), int(p)
# if n <= 0 or n > 65536 or r <= 0 or r > 512 or p <= 0 or p > 32:
# message_exit("Error: the values of Scrypt parameters are not good")
# scrypt_params = ScryptParams(n, r, p)
# else:
# message_exit("one of n, r or p is not a number")
# else:
# scrypt_params = None
scrypt_params = None
return SigningKey.from_credentials(salt, password, scrypt_params)
except ValueError as error:
def auth_by_wif():
......@@ -38,7 +38,7 @@ from duniterpy.api.bma.tx import process
from duniterpy.documents import BlockUID, Transaction
from duniterpy.documents.transaction import InputSource, OutputSource, Unlock, SIGParameter
#@command("tx", help="Send transaction")
......@@ -60,6 +60,7 @@ from duniterpy.documents.transaction import InputSource, OutputSource, Unlock, S
help="Pubkey recipient to send the rest of the transaction: <pubkey[!checksum]>",
#@option("--yes", "-y", is_flag=True, help="Assume yes. Do not prompt confirmation")
async def send_transaction(
amount, amountud, allsources, output, comment, outputbackchange, yes
......@@ -51,14 +51,14 @@ class Transfer:
issuers = key.pubkey
# Next few lines are commented, but are ready for when a client will implement CSV() unlock condition.
await handle_transactions_with_delay(
# await handle_intermediaries_transactions(
# await handle_transactions_with_delay(
await handle_intermediaries_transactions(
# delay,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment