Beispiel #1
0
import json
import datetime
from grapheneapi import GrapheneAPI
import config

if __name__ == '__main__':

    client = GrapheneAPI(config.wallet_host, config.wallet_port, config.wallet_user, config.wallet_password)
    proposer = client.get_account(config.proposer_account)
    owner    = client.get_account(config.proposing_account)

    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
Beispiel #2
0
import json
from grapheneapi import GrapheneAPI
from datetime import datetime
import time
import config

if __name__ == '__main__':

    client = GrapheneAPI(config.wallet_host, config.wallet_port, config.wallet_user, config.wallet_password)
    proposer = client.get_account(config.proposer_account)
    owner    = client.get_account(config.worker_owner)
    asset    = client.get_asset("1.3.0")

    ops = []

    for i in range(0,config.numWorkersPertype) :
        op = client.get_prototype_operation("worker_create_operation")
        op[1]["name"]            = "burn-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"]     =  [
                                      2,{}  # BURN
                                    ]
        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)
Beispiel #3
0
import json
from grapheneapi import GrapheneAPI
from datetime import datetime
import time
import config

if __name__ == '__main__':

    client = GrapheneAPI(config.wallet_host, config.wallet_port,
                         config.wallet_user, config.wallet_password)
    proposer = client.get_account(config.proposer_account)
    owner = client.get_account(config.worker_owner)
    asset = client.get_asset("1.3.0")

    ops = []

    for i in range(0, config.numWorkersPertype):
        op = client.get_prototype_operation("worker_create_operation")
        op[1]["name"] = "burn-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"] = [
            2,
            {}  # BURN
        ]
        ops.append(op)

    for i in range(0, config.numWorkersPertype):
Beispiel #4
0
import json
from grapheneapi import GrapheneAPI
import math
import config

if __name__ == '__main__':

    client = GrapheneAPI(config.wallet_host, config.wallet_port, config.wallet_user, config.wallet_password)
    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 :
Beispiel #5
0
import json
from grapheneapi import GrapheneAPI
import config

if __name__ == '__main__':

    client = GrapheneAPI(config.wallet_host, config.wallet_port, config.wallet_user, config.wallet_password)
    proposer = client.get_account(config.proposer_account)
    from_account = client.get_account(config.transfer_from)
    to_account   = client.get_account(config.transfer_to)

    ops = []
    assetsavailable = client.list_account_balances("committee-account")
    for balance in assetsavailable:
        asset    = client.get_asset(balance["asset_id"])
        if asset["id"] == "1.3.0":
            continue
        transfer_amount = int(balance["amount"] * config.transfer_percentage / 100.0)
        op = client.get_prototype_operation("transfer_operation")
        op[1]["amount"]["amount"] = transfer_amount
        op[1]["amount"]["asset_id"] = asset["id"]
        op[1]["from"] = from_account["id"]
        op[1]["to"] = to_account["id"]
        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]