Getting AssetID after Transaction

I’m reading from here: Algorand Standard Assets (ASAs) - Algorand Developer Portal
My transactions go through, I get my txnId.
In the developer portal it says to call this to get assetId, but there is no property “asset-index”.
Is this correct way to get assetId?

let ptx = await algodclient.pendingTransactionInformation(tx.txId).do();
assetID = ptx[“asset-index”]

I’ve tested docs/AssetExample.js at 59fcda3b1e4adfbd36b8367f6460de46afe9cb77 · algorand/docs · GitHub (uncommenting line 166 and removing everything after), with sandbox. And it worked.

You first need to wait that the transaction is confirmed: docs/AssetExample.js at 59fcda3b1e4adfbd36b8367f6460de46afe9cb77 · algorand/docs · GitHub

If this still does not work, can you post the JSON encoding of ptx?

Ah! Yes, thanks! my confirmation was not at the right place.
Thanks.