Freezing assets
Authorized by: Asset Freeze Address
Freezing or unfreezing an asset for an account requires a transaction that is signed by the freeze account. The code below illustrates the freeze transaction.
1 """2 Send an asset freeze transaction freezing an asset with asset id 12343
4 Parameters for freezing an asset.5 - sender: The address of the account that will send the transaction6 - asset_id: The ID of the asset7 - account: The account to freeze or unfreeze8 - frozen: Whether the assets in the account should be frozen9 """10 txn_result = algorand_client.send.asset_freeze(11 AssetFreezeParams(12 sender=account_a.address,13 asset_id=1234,14 account=account_b.address, # The account to freeze or unfreeze15 frozen=True,16 )17 )18
19 """20 Send an asset unfreeze transaction unfreezing an asset with asset id 123421 """22 txn_result = algorand_client.send.asset_freeze(23 AssetFreezeParams(24 sender=account_a.address,25 asset_id=1234,26 account=account_b.address, # The account to freeze or unfreeze27 frozen=False,28 )29 )
const freezeTxn = algosdk.makeAssetFreezeTxnWithSuggestedParamsFromObject({ from: manager.addr, suggestedParams, assetIndex, // freezeState: false would unfreeze the account's asset holding freezeState: true, // freezeTarget is the account that is being frozen or unfrozen freezeTarget: receiver.addr,});
const signedFreezeTxn = freezeTxn.signTxn(manager.privateKey);await algodClient.sendRawTransaction(signedFreezeTxn).do();await algosdk.waitForConfirmation( algodClient, freezeTxn.txID().toString(), 3);
goal asset freeze --freezer <asset-freeze-account> --freeze=true --account <account-to-freeze> --creator <asset-creator> --asset <asset-name> -d data
See also