perm["disable_confidential"] = 0x40 perm["witness_fed_asset"] = 0x80 perm["committee_fed_asset"] = 0x100 GRAPHENE_100_PERCENT = 10000 GRAPHENE_1_PERCENT = GRAPHENE_100_PERCENT / 100 class Config(): wallet_host = "localhost" wallet_port = 8092 wallet_user = "" wallet_password = "" if __name__ == '__main__': graphene = GrapheneClient(Config) issuer = "nathan" symbol = "PMS.A" backing = "1.3.0" account = graphene.rpc.get_account(issuer) asset = graphene.rpc.get_asset(backing) permissions = { "charge_market_fee": True, "white_list": True, "override_authority": True, "transfer_restricted": True, "disable_force_settle": True, "global_settle": True,
price = 2.0 # quote assets per backing asset #: Scale the Core exchange rate scale_cer = 1.05 #: Connetion Settings class Config(): wallet_host = "localhost" wallet_port = 8092 witness_url = "ws://testnet.bitshares.eu/ws" if __name__ == '__main__': config = Config graphene = GrapheneClient(config) asset = graphene.rpc.get_asset(asset_symbol) bitasset_data = graphene.getObject(asset["bitasset_data_id"]) base = graphene.getObject(bitasset_data["options"]["short_backing_asset"]) # Correct for different precisions of base and quote assets price = price * 10**asset["precision"] / 10**base["precision"] # convert into a fraction denominator = 10**base["precision"] numerator = int(price * 10**base["precision"]) for producer in producers: account = graphene.rpc.get_account(producer) price_feed = { "settlement_price": {
class Config(): wallet_host = "localhost" wallet_port = 8090 wallet_user = "" wallet_password = "" witness_url = "ws://localhost:11011" witness_user = "" witness_password = "" watch_markets = ["PEG.LAST:TEST"] market_separator = ":" if __name__ == '__main__': config = Config graphene = GrapheneClient(config) dex = GrapheneExchange(config) asset_symbol = "PEG.LAST" producers = [ "init0", "init1", "init2", "init3", "init4", "init5", "init6", "init7", "init8", "init9", "init10" ] ticker = None try: ticker = dex.returnTicker() except: pass if not ticker or config.watch_markets[0] not in ticker:
ref_block_prefix=ref_block_prefix, expiration=expiration, operations=ops ) w = tx.sign(wifs, chain=client.getChainInfo()) return w #: Connetion Settings class Config(): witness_url = witness_url if __name__ == '__main__': config = Config client = GrapheneClient(config) issuer = client.ws.get_account(issuer) from_account = client.ws.get_account(from_account) to_account = client.ws.get_account(to_account) asset = client.ws.get_asset(asset) amount = int(amount * 10 ** asset["precision"]) ops = [] op = transactions.Override_transfer(**{ "fee": {"amount": 0, "asset_id": "1.3.0"}, "issuer": issuer["id"], "from": from_account["id"], "to": to_account["id"], "amount": {"amount": amount,
privkey = PrivateKey(self.memo_wif_keys[account_name]) pubkey = PublicKey(memo["from"], prefix=self.prefix) memomsg = Memo.decode_memo(privkey, pubkey, memo["nonce"], memo["message"]) except Exception as e: memomsg = "--cannot decode-- (%s)" % str(e) " Print out " print(("last_op: %s | block:%s | from %s -> to: %s " + "| fee: %f %s | amount: %f %s | memo: %s") % ( opID, block, from_account["name"], to_account["name"], fee_amount, fee_asset["symbol"], amount_amount, amount_asset["symbol"], memomsg)) " Store this as last op seen" self.last_op = opID def onRegisterHistory(self): for name in self.watch_accounts: account = graphene.rpc.get_account(name) self.getAccountHistory(account["id"], self.process_operations, self.last_op, "1.11.0", 100) if __name__ == '__main__': config = Config graphene = GrapheneClient(config) graphene.run()
else: privkey = PrivateKey(self.memo_wif_keys[account_name]) pubkey = PublicKey(memo["from"], prefix=self.prefix) memomsg = Memo.decode_memo(privkey, pubkey, memo["nonce"], memo["message"]) except Exception as e: memomsg = "--cannot decode-- (%s)" % str(e) " Print out " print(("last_op: %s | block:%s | from %s -> to: %s " + "| fee: %f %s | amount: %f %s | memo: %s") % (opID, block, from_account["name"], to_account["name"], fee_amount, fee_asset["symbol"], amount_amount, amount_asset["symbol"], memomsg)) " Store this as last op seen" self.last_op = opID def onRegisterHistory(self): for name in self.watch_accounts: account = graphene.rpc.get_account(name) self.getAccountHistory(account["id"], self.process_operations, self.last_op, "1.11.0", 100) if __name__ == '__main__': config = Config graphene = GrapheneClient(config) graphene.run()
def constructSignedTransaction(ops): ops = transactions.addRequiredFees(client.ws, ops, "1.3.0") ref_block_num, ref_block_prefix = transactions.getBlockParams(client.ws) expiration = transactions.formatTimeFromNow(30) signed = transactions.Signed_Transaction(ref_block_num, ref_block_prefix, expiration, ops) pprint(transactions.JsonObj(signed)) w = signed.sign(wifs, chain=client.getChainInfo()) return w if __name__ == '__main__': config = Config client = GrapheneClient(config) asset = client.ws.get_asset(asset_symbol) bitasset_data = client.getObject(asset["bitasset_data_id"]) base = client.getObject(bitasset_data["options"]["short_backing_asset"]) # Correct for different precisions of base and quote assets price = price * 10 ** asset["precision"] / 10 ** base["precision"] # convert into a fraction denominator = int(10 ** base["precision"]) numerator = int(price * 10 ** base["precision"]) ops = [] for producer in producers: account = client.ws.get_account(producer)
#: e.g. 2.0 SMART.TEST / TEST price = 2.0 # quote assets per backing asset #: Scale the Core exchange rate scale_cer = 1.05 #: Connetion Settings class Config(): wallet_host = "localhost" wallet_port = 8092 witness_url = "ws://testnet.bitshares.eu/ws" if __name__ == '__main__': config = Config graphene = GrapheneClient(config) asset = graphene.rpc.get_asset(asset_symbol) bitasset_data = graphene.getObject(asset["bitasset_data_id"]) base = graphene.getObject(bitasset_data["options"]["short_backing_asset"]) # Correct for different precisions of base and quote assets price = price * 10 ** asset["precision"] / 10 ** base["precision"] # convert into a fraction denominator = 10 ** base["precision"] numerator = int(price * 10 ** base["precision"]) for producer in producers: account = graphene.rpc.get_account(producer) price_feed = {"settlement_price": { "quote": {"asset_id": base["id"],