Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def send_tx(self):
iroha = Iroha('admin@test')
tx = iroha.transaction([iroha.command(
'TransferAsset', src_account_id='admin@test', dest_account_id='test@test', asset_id='coin#test',
amount='0.01', description=HOSTNAME
)])
ic.sign_transaction(tx, ADMIN_PRIVATE_KEY)
self.client.send_tx_await(tx)
def send_tx():
rand_name = uuid.uuid4().hex
rand_key = IrohaCrypto.private_key()
domain = ADMIN_ACCOUNT_ID.split('@')[1]
tx = iroha.transaction([
iroha.command('CreateAccount',
account_name=rand_name,
domain_id=domain,
public_key=rand_key)
])
IrohaCrypto.sign_transaction(tx, ADMIN_PRIVATE_KEY)
net.send_tx(tx)
print('tx is sent')
def send_tx():
rand_name = uuid.uuid4().hex
rand_key = IrohaCrypto.private_key()
domain = ADMIN_ACCOUNT_ID.split('@')[1]
tx = iroha.transaction([
iroha.command('CreateAccount',
account_name=rand_name,
domain_id=domain,
public_key=rand_key)
])
IrohaCrypto.sign_transaction(tx, ADMIN_PRIVATE_KEY)
net.send_tx(tx)
print('tx is sent')
def userone_grants_to_admin_set_account_detail_permission():
"""
Make admin@test able to set detail to userone@domain
"""
tx = iroha.transaction([
iroha.command('GrantPermission', account_id='admin@test',
permission=can_set_my_account_detail)
], creator_account='userone@domain')
IrohaCrypto.sign_transaction(tx, user_private_key)
send_transaction_and_print_status(tx)
def transfer_coin_from_admin_to_userone():
"""
Transfer 2.00 'coin#domain' from 'admin@test' to 'userone@domain'
"""
tx = iroha.transaction([
iroha.command('TransferAsset', src_account_id='admin@test', dest_account_id='userone@domain',
asset_id='coin#domain', description='init top up', amount='2.00')
])
IrohaCrypto.sign_transaction(tx, ADMIN_PRIVATE_KEY)
send_transaction_and_print_status(tx)
def get_userone_details():
"""
Get all the kv-storage entries for userone@domain
"""
query = iroha.query('GetAccountDetail', account_id='userone@domain')
IrohaCrypto.sign_query(query, ADMIN_PRIVATE_KEY)
response = net.send_query(query)
data = response.account_detail_response
print('Account id = {}, details = {}'.format('userone@domain', data.detail))
def add_keys_and_set_quorum():
alice_iroha = Iroha('alice@test')
alice_cmds = [
alice_iroha.command('AddSignatory', account_id='alice@test',
public_key=alice_public_keys[1]),
alice_iroha.command('SetAccountQuorum',
account_id='alice@test', quorum=2)
]
alice_tx = alice_iroha.transaction(alice_cmds)
ic.sign_transaction(alice_tx, alice_private_keys[0])
send_transaction_and_print_status(alice_tx)
bob_iroha = Iroha('bob@test')
bob_cmds = [
bob_iroha.command('AddSignatory', account_id='bob@test',
public_key=bob_public_keys[1]),
bob_iroha.command('SetAccountQuorum', account_id='bob@test', quorum=2)
]
bob_tx = bob_iroha.transaction(bob_cmds)
ic.sign_transaction(bob_tx, bob_private_keys[0])
send_transaction_and_print_status(bob_tx)
domain_id='test', precision=2),
iroha.command('AddAssetQuantity',
asset_id='bitcoin#test', amount='100000'),
iroha.command('AddAssetQuantity',
asset_id='dogecoin#test', amount='20000'),
iroha.command('CreateAccount', account_name='alice', domain_id='test',
public_key=alice_public_keys[0]),
iroha.command('CreateAccount', account_name='bob', domain_id='test',
public_key=bob_public_keys[0]),
iroha.command('TransferAsset', src_account_id='admin@test', dest_account_id='alice@test',
asset_id='bitcoin#test', description='init top up', amount='100000'),
iroha.command('TransferAsset', src_account_id='admin@test', dest_account_id='bob@test',
asset_id='dogecoin#test', description='init doge', amount='20000')
]
init_tx = iroha.transaction(init_cmds)
ic.sign_transaction(init_tx, ADMIN_PRIVATE_KEY)
send_transaction_and_print_status(init_tx)