Ejemplo n.º 1
0
    ops = []

    """ Construct TX """
    op                          = client.get_prototype_operation("proposal_delete_operation")
    op[1]["fee_paying_account"] = owner["id"]
    op[1]["proposal"] = config.pid

    ops.append(op)

    buildHandle = client.begin_builder_transaction()
    for op in ops :
        client.add_operation_to_builder_transaction(buildHandle, op)
    client.set_fees_on_builder_transaction(buildHandle, "1.3.0")

    params = client.get_object("2.0.0")[0]
    if owner["name"] == "committee-account":
        preview = params["parameters"]["committee_proposal_review_period"]
    else:
        preview = 0

    delete_proposal = client.get_object(config.pid)[0]
    proposal_preview = datetime.datetime.strptime(delete_proposal["review_period_time"], "%Y-%m-%dT%H:%M:%S")
    expiration = proposal_preview - datetime.timedelta(0, config.expiration_earlier)
    expiration = expiration.strftime('%Y-%m-%dT%H:%M:%S')

    client.propose_builder_transaction2(buildHandle, proposer["name"], expiration, preview, False)
    client.set_fees_on_builder_transaction(buildHandle, "1.3.0")

    """ Sign and broadcast """
    tx = client.sign_builder_transaction(buildHandle, False)
Ejemplo n.º 2
0
    proposer = client.get_account(config.proposer_account)
    owner    = client.get_account(config.issuer_account)

    ops = []

    for symbol in config.claim_assets :
        percentage = config.claim_assets[symbol]
        asset      = client.get_asset(symbol)

        """ Construct TX """
        op                       = client.get_prototype_operation("asset_claim_fees_operation")
        op[1]["issuer"]          = owner["id"]
        op[1]["amount_to_claim"]["asset_id"] = asset["id"]

        """ Get accumulated amount from blockchain """
        asset_data = client.get_object(asset["dynamic_asset_data_id"])[0]
        accumulated_fees = asset_data["accumulated_fees"]
        op[1]["amount_to_claim"]["amount"] = math.floor(accumulated_fees * percentage / 100)

        ops.append(op)

    buildHandle = client.begin_builder_transaction()
    for op in ops :
        client.add_operation_to_builder_transaction(buildHandle, op)
    client.set_fees_on_builder_transaction(buildHandle,"1.3.0")

    params = client.get_object("2.0.0")[0]
    if owner["name"] == "committee-account":
        preview = params["parameters"]["committee_proposal_review_period"]
    else:
        preview = 0
Ejemplo n.º 3
0
        ops.append(op)

    for i in range(0,config.numWorkersPertype) :
        op = client.get_prototype_operation("worker_create_operation")
        op[1]["name"]            = "refund-100k-%d" % (i+1)
        op[1]["owner"]           = owner["id"]
        op[1]["work_begin_date"] = config.start_date
        op[1]["work_end_date"]   = config.end_date
        op[1]["daily_pay"]       = config.daily_pay
        op[1]["url"]             = config.url
        op[1]["initializer"]     =  [
                                      0,{}  # Refund
                                    ]
        ops.append(op)

    buildHandle = client.begin_builder_transaction()
    for op in ops :
        client.add_operation_to_builder_transaction(buildHandle, op)
    client.set_fees_on_builder_transaction(buildHandle,asset["id"])

    params = client.get_object("2.0.0")[0]
    preview = params["parameters"]["committee_proposal_review_period"]

    client.propose_builder_transaction2(buildHandle, proposer["name"], config.expiration, preview, False) 
    client.set_fees_on_builder_transaction(buildHandle, asset["id"])

    ## Sign and broadcast
    tx = client.sign_builder_transaction(buildHandle, True)

    print(json.dumps(tx,indent=4))
Ejemplo n.º 4
0
    for i in range(0, config.numWorkersPertype):
        op = client.get_prototype_operation("worker_create_operation")
        op[1]["name"] = "refund-100k-%d" % (i + 1)
        op[1]["owner"] = owner["id"]
        op[1]["work_begin_date"] = config.start_date
        op[1]["work_end_date"] = config.end_date
        op[1]["daily_pay"] = config.daily_pay
        op[1]["url"] = config.url
        op[1]["initializer"] = [
            0,
            {}  # Refund
        ]
        ops.append(op)

    buildHandle = client.begin_builder_transaction()
    for op in ops:
        client.add_operation_to_builder_transaction(buildHandle, op)
    client.set_fees_on_builder_transaction(buildHandle, asset["id"])

    params = client.get_object("2.0.0")[0]
    preview = params["parameters"]["committee_proposal_review_period"]

    client.propose_builder_transaction2(buildHandle, proposer["name"],
                                        config.expiration, preview, False)
    client.set_fees_on_builder_transaction(buildHandle, asset["id"])

    ## Sign and broadcast
    tx = client.sign_builder_transaction(buildHandle, True)

    print(json.dumps(tx, indent=4))