Closed Lizzulizzu closed 1 year ago
import asyncio import json
from indy import pool from indy.error import ErrorCode, IndyError
async def run(): print("Indy demo program")
print("STEP1 - Connect to Pool") pool = { "name": "pool1" } print("Open pool Ledger: {}".format(pool['name'])) pool_['genesis_txnpath'] = "pool1.txn" pool['config'] = json.dumps({"genesistxn": str(pool['genesis_txn_path'])})
print(pool_)
# connect to pool
await pool.set_protocol_version(2)
try: await pool.create_pool_ledgerconfig(pool['name'], pool_['config']) except IndyError as ex: if ex.errorcode == ErrorCode.PoolledgerConfigAlreadyExistsError: pass pool['handle'] = await pool.open_poolledger(pool['name'], None)
print(pool_['handle'])
loop = asyncio.get_event_loop() loop.run_until_complete(run())
I'd like to write the same code as above, but I can't import indy. Could you tell me how to import indy from vs code?
import asyncio import json
from indy import pool from indy.error import ErrorCode, IndyError
async def run(): print("Indy demo program")
print("STEP1 - Connect to Pool") pool = { "name": "pool1" } print("Open pool Ledger: {}".format(pool['name'])) pool_['genesis_txnpath'] = "pool1.txn" pool['config'] = json.dumps({"genesistxn": str(pool['genesis_txn_path'])})
print(pool_)
await pool.set_protocol_version(2)
try: await pool.create_pool_ledgerconfig(pool['name'], pool_['config']) except IndyError as ex: if ex.errorcode == ErrorCode.PoolledgerConfigAlreadyExistsError: pass pool['handle'] = await pool.open_poolledger(pool['name'], None)
print(pool_['handle'])
loop = asyncio.get_event_loop() loop.run_until_complete(run())
I'd like to write the same code as above, but I can't import indy. Could you tell me how to import indy from vs code?