def main(): provider = pa.RpcNode(testnet=True) set_up(provider) args = cli() if args.command == "deck": if args.list: deck_list(provider, args.list) if args.subscribe: deck_subscribe(provider, args.subscribe) if args.search: deck_search(provider, args.search) if args.info: deck_info(provider, args.info) if args.new: new_deck(provider, args.new) if args.command == "card": if args.issue: card_issue(provider, args.issue) if args.burn: card_burn(provider, args.burn) if args.transfer: card_transfer(provider, args.transfer) if args.list: list_cards(provider, args.list)
def __init__(self, node = None): self.synced = False self.info = None if node is None: self.node = pa.RpcNode(testnet=testnet, username=rpc_username, password=rpc_password, ip=rpc_host, port=rpc_port) else: self.node = node
import pypeerassets as pa from pypeerassets.paproto_pb2 import DeckSpawn, CardTransfer from models import Deck, Card, db from sqlalchemy.exc import IntegrityError from conf import * import sys node = pa.RpcNode(testnet=testnet) def init_p2thkeys(): from binascii import unhexlify n = 0 if autoload: pa.pautils.load_p2th_privkey_into_local_node(node, production) for deck_id in subscribed: wif = pa.Kutil(privkey=unhexlify(deck_id), network=node.network).wif try: node.importprivkey(wif, deck_id) n += 1 except Exception as e: print(e) return print('{} P2TH Key(s) Registered'.format(n)) def init_decks(): n = 0
MAX_RECEIVERS = 826 MAX_TRANFERS = 3600 MAX_BURNS = 800 import pypeerassets as pa from binascii import hexlify import random import datetime, time import pickle import logging logging.basicConfig(filename='pypa.log', level=logging.INFO) logging.info("Started new session: {0}".format( datetime.datetime.now().isoformat())) provider = pa.RpcNode(testnet=True) deck = pa.find_deck(provider, "clementines")[0] change_addr = deck.issuer try: # try to load keypairs from the file keypairs = pickle.load(open("keypairs.db", "rb")) except: keys = [pa.Kutil(network="tppc") for i in range(MAX_RECEIVERS)] keypairs = {k.address: v.wif for k, v in zip(keys, keys)} class Session: pass def total_issuance():