Skip to content

Commit

Permalink
Merge pull request #41 from creativequotient/cardano-cli-10.1
Browse files Browse the repository at this point in the history
Update cardano-cli commands for 10.1
  • Loading branch information
creativequotient authored Nov 29, 2024
2 parents fae6a92 + 2e19f1e commit 104abf9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion automint/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def get_protocol_params(working_dir, use_testnet=False, testnet_magic=TESTNET_MA
protocol_json_path = os.path.join(working_dir, 'protocol.json')

cmd_builder = [CARDANO_CLI.replace(' ', '\ '),
'conway',
'query',
'protocol-parameters',
'--out-file',
Expand Down Expand Up @@ -105,12 +106,16 @@ def write_policy_script_with_time_lock(working_dir, keyHash, before, force=False
def get_policy_id(policy_script_path):
"""Return policy id given policy script"""
proc = subprocess.run([CARDANO_CLI,
'conway',
'transaction',
'policyid',
'--script-file',
policy_script_path], capture_output=True, text=True)
return proc.stdout.strip('\n')

if proc.stderr != '':
logger.error(f'Error encountered when determining policy ID from script\n{proc.stderr}')

return proc.stdout.strip('\n')

def build_raw_transaction(working_dir, input_utxos, output_accounts, minting_account=None, fee=0, metadata=None, invalid_after=None, minting_script=None):
"""Builds transactions"""
Expand All @@ -125,6 +130,7 @@ def build_raw_transaction(working_dir, input_utxos, output_accounts, minting_acc

# Only generate/overwrite the keys if they do not exist or force=True
cmd_builder = [CARDANO_CLI.replace(' ', '\ '),
'conway',
'transaction',
'build-raw',
'--fee',
Expand Down Expand Up @@ -190,6 +196,7 @@ def calculate_tx_fee(raw_matx_path, protocol_json_path, input_utxos, output_acco
assert witness_count >= len(input_utxos)

cmd_builder = [CARDANO_CLI.replace(' ', '\ '),
'conway',
'transaction',
'calculate-min-fee',
'--tx-body-file',
Expand Down Expand Up @@ -232,6 +239,7 @@ def sign_tx(nft_dir, signing_wallets, raw_matx_path, force=False, use_testnet=Fa

# Only generate/overwrite the keys if they do not exist or force=True
cmd_builder = [CARDANO_CLI.replace(' ', '\ '),
'conway',
'transaction',
'sign',
'--tx-body-file',
Expand Down Expand Up @@ -266,6 +274,7 @@ def submit_transaction(signed_matx_path, use_testnet=False, testnet_magic=TESTNE
"""Submit signed transaction"""

cmd_builder = [CARDANO_CLI.replace(' ', '\ '),
'conway',
'transaction',
'submit',
'--tx-file',
Expand Down Expand Up @@ -333,6 +342,7 @@ def get_cli_version():

def query_tip(use_testnet=False, testnet_magic=TESTNET_MAGIC_DEFAULT):
cmd_builder = [CARDANO_CLI,
'latest',
'query',
'tip']

Expand Down
1 change: 1 addition & 0 deletions automint/wallet/Wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def query_utxo(self):
self.UTXOs = {}

cmd_builder = [CARDANO_CLI,
'conway',
'query',
'utxo',
'--address',
Expand Down

0 comments on commit 104abf9

Please sign in to comment.