All - Activity - humblefool - Algorand

Address malformed error

Order of function params looks to be incorrect.

makeAssetCreateTxnWithSuggestedParams(from, note, assetTotal, assetDecimals, assetDefaultFrozen, assetManager, assetReserve, assetFreeze, assetClawback, assetUnitName, assetName, assetURL, assetMetadataHash, suggestedParams, reKeyTo);

Swagger url for algod and indexer

How to segregate the NFT Collections from the assets of the same wallet address

async isArc69(asset: A_Asset): Promise<A_Nft_MetaData_Arc69> {
  const {transactions} = await this.indexer.searchForTransactions().assetID(asset.index).txType("acfg").do();
  transactions.sort((a, b) => b["round-time"] - a["round-time"]);
  for (const transaction of transactions) ...
}

isArc3Nft(asset: A_Asset)

isArc3Nft(asset: A_Asset): boolean {
  const name = asset.params.name;
  const url = asset.params.url;
  if (name === 'arc3') {
    return true;
  }
  if (name && name.slice(name.length - 5) === '@arc3') {
    return true;
  }
  if (url && u...
}

There are ARC standards for NFTs on Algorand. ARC3, ARC69. Any asset metadata that meets these standards is considered an NFT.

What is the encoding of Application logs returned by indexer, is it base64?

I want to display them in a human-readable format.

How to tell whether an asset is NFT

There are 2 standards for NFTs on Algorand. ARC-3 ARC-69 You need to check if asset metadata matches any of these ARC standards.

How to create a custom indexer?

I think this is the possible solution that many are using. @fabrice, do you think there is any other better approach?

I had a similar requirement for fundstack. I have written a CronJob in node JS, which gets executed every minute. It will query the required data using the OOB indexer and store the data in MongoDB. My front-end app will query data from MongoDB using Express JS. This made the app blazing fast.

Noob question - I was eligible to vote, but am not. Please help

Unfortunately, there is no way to get rewards now. Better luck next time.

How to build a database on Algorand?

If you want your data on-chain, then it should be either in the application global/local state, or NOTE field of the transaction (which is not preferred). Another way could be to have this data on decentralized storage services like IPFS/Filecoin etc and save the hash in the asset URL. Can you please elaborate a bit more on your requirement?

Get correct Token balance

You must multiply the amount by the 10 power decimal before preparing the transaction. EX: if you want to transfer 1.2, and the decimal of the asset is 1, then you need to do:

1.2 * 10^1, which makes it 12.

Get assets using Algorand's Indexer REST API 2.0

You need to set the request header "x-indexer-api-token" to an empty string. If you have used any Algorand SDK, it will set it internally. So it is preferred to use SDK unless there is a need for functionality that is not supported by SDK.

Get amount of transactions for that day

AFAIK indexer doesn’t have support to get the transaction count. You need to write a custom script in node JS or Python to get transactions in the last 24 hours page by page until the next token is empty.

Send transaction created using python SDK to algosigner?

It would be best if you used JS SDK to build transactions. Using Python SDK you need to send that transaction to frontend and you will have serialization issues.

Can someone please explain why Algorand cannot adopt multiple languages than PyTeal?

Maybe @fabrice can answer if there is an ongoing effort from the team or community on other language wrappers.

Update app with inner transaction

I'm just curious to know your use case to update an app from an inner transaction.

TEAL is the native smart contract language for Algorand.

It is a low-level language, which makes it hard to write complex smart contracts. PyTeal is just a wrapper that will compile Python code into TEAL code (this is what is deployed on the blockchain). Having similar wrappers in other languages would...

Why do I get the error: should have been authorized by XXX but was actually authorized by XXX

txn1 should be signed by the private key of address-1, txn2 should be signed by the private key of address-2. If you get this error even after doing the same, then one of the accounts was rekeyed to a different account.

Get transactions for a given group-id

Thanks, @agodnic, but this works only with AlgoExplorer indexer, right? What I’m looking for is an out-of-the-box indexer.

Is it possible to decompile application approval program?

Thanks, Ben. When can we expect this to be available in JS SDK? Just the rough timeline if possible.

How to convert the application approval program to TEAL code?

Do we have this support in JS SDK?

How to convert multisig subsignature public key to address

Thanks, Ben. This worked in JS SDK.

encodeAddress(Buffer.from(pk, "base64"));

How to convert app global state values to human-readable format?

Normal string, Address, tx-id, all of them are stored as bytes in a global state. To decode to actual values:

Normal string: atob(value.bytes); Address: sdk.encodeAddress(new Uint8Array(Buffer.from(value.bytes, "base64"))); tx-id: `encode(new Uint8Array(Buffer.from(value.bytes, "base64")...)

How to identify the type of global state delta in app call txn

Look at 'Application Global State Delta' in the below transaction: Application Global State Delta
This is what we get in txn JSON object for global state delta:

export interface A_GlobalStateDelta {
  key: string;
  value: {
    byte...
  };
}

AssetParam not working with PyTeal

assetClawbackExpr = AssetParam.clawback(Int(0));
assetClawbackAddr = Seq([
  assetClawbackExpr,
  assetClawbackExpr.value()  
]);
Assert(assetClawbackAddr == verifiedaddr);

AssetParam.clawback() will not return the clawback address; instead, it returns the MaybeValue expression. You need to call .value() on the MaybeValue expression to get the exact value. Here is the documentation for it: PyTeal Docs

You need to pass assetId in foreign assets

and then pass the index of it to AssetParam. EX:

clawbackExpr = AssetParam.clawback(Int(0));
clawbackAddr = clawbackExpr.value();

Indexer.searchForTransactions().limit(10).do() is returning older transactions

This is not an efficient solution in the case of a local sandbox environment. Because transactions will be very less and I end up querying more and more blocks until I get 1000 transactions. Can we submit this as a requirement for the indexer team? This is an important feature for my project.