def start_leasing(): data = json.loads(request.data.decode()) amount = float(data['amount']) * (10**8) recipient = data['addr'] alias = json.loads(active_alias(recipient)) if 'address' not in alias: send = current_user.wallet.lease(py.Address(address=recipient), int(amount), txFee=FEE) else: send = current_user.wallet.lease(py.Address(address=alias['address']), int(amount), txFee=FEE) return jsonify(send)
def gw_send_tn(): data = request.data json_data = json.loads(data.decode()) dest = json_data['addr'] amount = float(json_data['amount']) * (10**8) fee = float(json_data['fee']) * (10**8) gateway = py.Address(address=get_addr_gateway('gateway', dest)) result = current_user.wallet.sendWind(gateway, int(amount), txFee=int(fee)) return jsonify(result)
def send_asset(asset): py_asset = py.wind_asset_default.Asset(assetId=asset) data = json.loads(request.data.decode()) addr = data['addr'] amount = float(data['amount']) * (10**py_asset.decimals) fee = 100000 alias = json.loads(active_alias(addr)) if 'address' not in alias: send = current_user.wallet.sendAsset(py.Address(addr), py_asset, int(amount), txFee=int(fee)) else: send = current_user.wallet.sendAsset(py.Address(alias['address']), py_asset, int(amount), txFee=int(fee)) return jsonify(send)
def send_tn(): data = json.loads(request.data.decode()) amount = float(data['amount']) * (10**8) recipient = data['addr'] attachment = data['attachment'] fee = 100000 alias = json.loads(active_alias(recipient)) attachment = attachment.encode('utf-8').decode('latin-1') if 'address' not in alias: send = current_user.wallet.sendWind(py.Address(address=recipient), int(amount), attachment=attachment, txFee=int(fee)) else: send = current_user.wallet.sendWind( py.Address(address=alias['address']), int(amount), attachment=attachment, txFee=int(fee)) return jsonify(send)
def get_wallet_by_seed(self) -> py.Address: return py.Address(seed=self.seed)
def get_wallet(self) -> py.Address: return py.Address(privateKey=self.id)
import requests import json import windpy as pw import time #Fill in the fields #--------------------------------------------------------------------------- seedy = "SEED" leasing_addr = "..................." ceo_addr = "............................" #----------------------------------------------------------------------------- node = "http://144.91.84.27:6869" myAddress = pw.Address(seed=seedy) r = requests.get(node + "/leasing/active/" + leasing_addr) r = r.text r = json.loads(r) leasing_addr_balance = (json.loads( (requests.get(node + "/addresses/balance/" + (leasing_addr))).text))['balance'] block_height = json.loads( (requests.get(node + "/blocks/height")).text)['height'] if leasing_addr_balance >= 500000000: sender = [] amount = [] height = [] n = 0 t_amount = 0 for i in r: heightt = i['height'] if block_height - heightt > 1000: sender = sender + [i['sender']]