Closed karpediemnow closed 3 years ago
before calling "GetAssetByID" you should make sure the asset with asset id exists and is ready. So can you please provide the assetid you are using?
Sure: I have used: assetID= 13191745; ALGOD_API_ADDR= "https://testnet-algorand.api.purestake.io/ps2";
Also you can try to use this: `using Algorand; using Algorand.V2; using Algorand.V2.Model; using System; using System.Text; using Account = Algorand.Account;
namespace ConsoleApp2 { class Program { static void Main(string[] args) { string algodApiAddrTmp = args[0]; if (algodApiAddrTmp.IndexOf("//") == -1) { algodApiAddrTmp = "http://" + algodApiAddrTmp; }
string ALGOD_API_ADDR = algodApiAddrTmp;
string ALGOD_API_TOKEN = args[1];
long? assetID = 13191745; //Convert.ToInt32(args[2]);
Algorand.Transaction tx;
SignedTransaction signedTx;
TransactionParametersResponse transParams;
AlgodApi algodApiInstance = new AlgodApi(ALGOD_API_ADDR, ALGOD_API_TOKEN);
#region AssetInformation
try
{
transParams = algodApiInstance.TransactionParams();
Console.WriteLine(transParams.ToJson());
NodeStatusResponse nodeStatus = algodApiInstance.GetStatus();
Console.WriteLine(nodeStatus.ToJson());
Asset ast = algodApiInstance.GetAssetByID(assetID);
Console.WriteLine(ast.ToJson());
}
catch (Exception ex)
{
Console.WriteLine(ex.Message); //Error calling GetAssetByID: {"message":"Missing Authentication Token"}
}
#endregion
Console.ReadKey();
}
}
} `
Sorry for the late reply. This is a strange error because this error is thrown by purestake. But if we can get the status of algorand is say that the authentication of purestake is right. But we got this message!
I'll do the run the same example using an algorand node to see if our code is right. If our code is right I'll contract purestake to see what happened.
Yes it's strange, if try to use the randlab api works correctly:
ALGOD_API_ADDR = "https://api.testnet.algoexplorer.io/"; ALGOD_API_TOKEN = null; assetID = 13191745;
I'll sync my own node and let you know the result
Finally, I found the reason.
In the images below we can find purestake moved some functions from algod to indexer.
Please find more information from https://developer.purestake.io/v1deprecation
This is che code to reproduce the issue:
` class Program { static void Main(string[] args) { string algodApiAddrTmp = args[0]; if (algodApiAddrTmp.IndexOf("//") == -1) { algodApiAddrTmp = "http://" + algodApiAddrTmp; }