Sending all the ALGO (closing the account) using `algosdk`?

I’m doing some automated tests in javascript / nodejs / jest.

One of the tests involves sending some ALGO, then sending it back (so I don’t ran out of testnet funds).

But:

Every account on Algorand must have a minimum balance of 100,000 microAlgos. If ever a transaction is sent that would result in a balance lower than the minimum, the transaction will fail.

Is there any special method allowing me to send all the testnet ALGO and close the account?


EDIT:

List of methods: https://algorand.github.io/js-algorand-sdk/modules.html

I am searching for “close” and maybe makeApplicationCloseOutTxnFromObject but that would be weird, I want to close an account, not an application, or maybe account is the application, who knows.

You just need to make a simple payment transaction with the closeRemainderTo field set to where you want to close the funds to. I believe the address for testnet dispenser is HZ57J3K46JIJXILONBBZOHX6BKPXEM2VVXNRFSUED6DKFD5ZD24PMJ3MVA

1 Like

Also note that you should have closed all assets out and removed and created contracts first.