示例#1
0
 def get_pools(self, data):
     self.node = data['node']
     self.denomination = data['denomination']
     self.bs = BitShares(
         node=self.node,
         nobroadcast=True,
         blocking='head',
     )
     set_shared_blockchain_instance(self.bs)
     self._set_ws_connection()
     _counter = 0
     data = []
     while _counter < POOL_ID_LIMIT:
         payload_string = "1.19." + str(_counter)
         payload1 = {
             "id":
             1,
             "method":
             "call",
             "params": [
                 "database", "list_liquidity_pools",
                 [100, payload_string, False]
             ]
         }
         self.ws.send(json.dumps(payload1))
         result1 = self.ws.recv()
         r = json.loads(result1)
         # print(r)
         for i in r['result']:
             data.append(
                 f'{Asset(self.bs.rpc.get_object(i["id"])["share_asset"]).symbol} {i["id"]}'
             )
         _counter += 100
     pub.sendMessage('return_pool_list', data=data)
示例#2
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.bts = BitShares(
            nobroadcast=True,
            # We want to bundle many operations into a single transaction
            bundle=True,
            # Overwrite wallet to use this list of wifs only
            wif=[wif],
        )
        set_shared_blockchain_instance(self.bts)
        self.bts.set_default_account("init0")
示例#3
0
        logging.StreamHandler()
    ])

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

NODE_URL = os.getenv('BITSHARES_NODE_URL', 'wss://node.testnet.bitshares.eu')
GATEWAY_ACCOUNT_ID = os.getenv('GATEWAY_ACCOUNT', '1.2.3604')
GATEWAY_ACCOUNT_WIF = '5KiQYz2MBTWH676biQcVwx6zJ1J3cYb65bZThRBav1z7gU2MoMu'
START_BLOCK = os.getenv('START_BLOCK', cache.get('START_BLOCK'))

if START_BLOCK:
    START_BLOCK = int(START_BLOCK)

bitshares = BitShares(node=NODE_URL, keys=[GATEWAY_ACCOUNT_WIF])
set_shared_blockchain_instance(bitshares)

m = Memo()

logger.info('Gateway running..')
logger.info(f'START_BLOCK: {START_BLOCK}')
logger.info(f'NODE_URL: {NODE_URL}')
logger.info(f'GATEWAY_ACCOUNT_ID: {GATEWAY_ACCOUNT_ID}')
logger.info(f'GATEWAY_ACCOUNT_WIF: {GATEWAY_ACCOUNT_WIF[:5]}..')
logger.info(f'EOS_NODE_URL: {eosio_config.url}')
logger.info(f'EOS_NODE_PORT: {eosio_config.port}')
logger.info(f'ISSUER_WIF: {ISSUER_WIF}')
logger.info(f'ISSUER_NAME: {ISSUER_NAME}')
logger.info(f'ISSUE_ASSET: {ISSUE_ASSET}')

示例#4
0
 def enable(self):
     if not self.enabled:
         from bitshares.instance import set_shared_blockchain_instance
         broken = BrokenBitsharesInstance()
         set_shared_blockchain_instance(broken)
         self.enabled = True
示例#5
0
    1,
    #"node": ["wss://node.mvsdna.com"],
    "node": ["ws://localhost:8090"],
    "keys": [
        # udrur
        "5JEVg45P9ySbo4ZVuqfCBjydEi11C7n7z9PhqZAwwL8effcfEvU",  # initial balance
        "5JBtkKThCStcYZwBJhQEys1nc7e44F4giZCdLj3FyQWWAxESteB",  # foundation active
        "5JxNuvALBwigV29bnGd969sCsTwiuExs6pgdrnvvzs6PTvCiB9n",  # foundation owner
        "5JyhVvLVBo7ujoce5wHpCEWsnjVsmrmBHP8UK4Qy8pEYqXK6ptD",  # faucet
        "5KWNLXftSvmUaxmtfHPrwpD39654H3TwwaUkenpBNoLJsSvHPtW",  # init0 owner
    ]
}

blockchain = BitShares(**connection)

set_shared_blockchain_instance(blockchain)


def sleep(t: int) -> None:
    click.echo(" - Going to sleep for {}s".format(t))
    time.sleep(int(t))


@click.group()
def main():
    pass


@main.command()
def info():
    click.echo(dict(Account("1.2.6")))