code-snippetsmultiversx

Can't get smart contract address and can't run issueToken function


I'm following this MultiversX NFTs smart contracts (from scratch part 2) tutorial: https://www.youtube.com/watch?v=jpJQ-YB4NnQ I successfully compile the smart contract but when I use . interaction/devnet.snippets.sh I do not get the smart contract address, as can be seen in this log.

Because of this, I cannot run the issueToken function.

Can anyone help?

INFO:accounts:Account.sync_nonce()
INFO:accounts:Account.sync_nonce() done: 10733
INFO:cli.contracts:Contract address: erd1qqqqqqqqqqqqqpgq093ggau3mcjq4p5ln7skvtrk4wjhyfpwd8ssjj45qw
INFO:utils:View this contract address in the Elrond Devnet Explorer: https://devnet-explorer.elrond.com/accounts/erd1qqqqqqqqqqqqqpgq093ggau3mcjq4p5ln7skvtrk4wjhyfpwd8ssjj45qw
INFO:transactions:Transaction.send: nonce=10733
INFO:transactions:Hash: 4f25756f9246985732038eccc0cbc4fda480b8409fcc70dff089c1d59684e652
INFO:utils:View this transaction in the Elrond Devnet Explorer: https://devnet-explorer.elrond.com/transactions/4f25756f9246985732038eccc0cbc4fda480b8409fcc70dff089c1d59684e652
WARNING:cli.data:Always review --expression parameters before executing this command!
WARNING:cli.data:Always review --expression parameters before executing this command!
WARNING:cli.data:Never use this command to store sensitive information! Data is unencrypted.
INFO:cli.data:Data has been stored at key = 'address-devnet', in partition = '*'.
WARNING:cli.data:Never use this command to store sensitive information! Data is unencrypted.
INFO:cli.data:Data has been stored at key = 'deployTransaction-devnet', in partition = '*'.

Smart contract address:  

Solution

  • The outfile log structure changed in the meantime and you're most likely still looking for data in the old structure. Now, the address in the new log structure is stored under the ['contractAddress'] key instead of ['emitted_tx']['address'], respectively transaction hash into ['emittedTransactionHash'] instead of ['emitted_tx']['address'].

    Therefore, you have to change these lines:

    TRANSACTION=$(mxpy data parse --file="${MY_LOGS}/deploy-devnet.interaction.json" --expression="data['emitted_tx']['hash']")
    ADDRESS=$(mxpy data parse --file="${MY_LOGS}/deploy-devnet.interaction.json" --expression="data['emitted_tx']['address']")
    

    to these:

    TRANSACTION=$(mxpy data parse --file="${MY_LOGS}/deploy-devnet.interaction.json" --expression="data['emittedTransactionHash']")
    ADDRESS=$(mxpy data parse --file="${MY_LOGS}/deploy-devnet.interaction.json" --expression="data['contractAddress']")