github.com/hashgraph/hedera-sdk-go/v2@v2.48.0/token_update_transaction_e2e_test.go (about)

     1  //go:build all || e2e
     2  // +build all e2e
     3  
     4  package hedera
     5  
     6  /*-
     7   *
     8   * Hedera Go SDK
     9   *
    10   * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC
    11   *
    12   * Licensed under the Apache License, Version 2.0 (the "License");
    13   * you may not use this file except in compliance with the License.
    14   * You may obtain a copy of the License at
    15   *
    16   *      http://www.apache.org/licenses/LICENSE-2.0
    17   *
    18   * Unless required by applicable law or agreed to in writing, software
    19   * distributed under the License is distributed on an "AS IS" BASIS,
    20   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    21   * See the License for the specific language governing permissions and
    22   * limitations under the License.
    23   *
    24   */
    25  
    26  import (
    27  	"fmt"
    28  	"testing"
    29  
    30  	"github.com/stretchr/testify/assert"
    31  
    32  	"github.com/stretchr/testify/require"
    33  )
    34  
    35  func TestIntegrationTokenUpdateTransactionCanExecute(t *testing.T) {
    36  	t.Parallel()
    37  	env := NewIntegrationTestEnv(t)
    38  
    39  	tokenID, err := createFungibleToken(&env)
    40  	require.NoError(t, err)
    41  
    42  	resp, err := NewTokenUpdateTransaction().
    43  		SetTokenID(tokenID).
    44  		SetTokenSymbol("A").
    45  		Execute(env.Client)
    46  	require.NoError(t, err)
    47  
    48  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
    49  	require.NoError(t, err)
    50  
    51  	info, err := NewTokenInfoQuery().
    52  		SetTokenID(tokenID).
    53  		SetNodeAccountIDs([]AccountID{resp.NodeID}).
    54  		Execute(env.Client)
    55  	require.NoError(t, err)
    56  	assert.Equalf(t, "A", info.Symbol, "token failed to update")
    57  
    58  	err = CloseIntegrationTestEnv(env, &tokenID)
    59  	require.NoError(t, err)
    60  }
    61  
    62  func TestIntegrationTokenUpdateTransactionDifferentKeys(t *testing.T) {
    63  	t.Parallel()
    64  	env := NewIntegrationTestEnv(t)
    65  
    66  	keys := make([]PrivateKey, 5)
    67  	pubKeys := make([]PublicKey, 5)
    68  
    69  	for i := range keys {
    70  		newKey, err := PrivateKeyGenerateEd25519()
    71  		require.NoError(t, err)
    72  
    73  		keys[i] = newKey
    74  		pubKeys[i] = newKey.PublicKey()
    75  	}
    76  
    77  	newBalance := NewHbar(2)
    78  
    79  	assert.Equal(t, 2*HbarUnits.Hbar._NumberOfTinybar(), newBalance.tinybar)
    80  
    81  	resp, err := NewAccountCreateTransaction().
    82  		SetNodeAccountIDs(env.NodeAccountIDs).
    83  		SetKey(pubKeys[0]).
    84  		SetInitialBalance(newBalance).
    85  		Execute(env.Client)
    86  	require.NoError(t, err)
    87  
    88  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
    89  	require.NoError(t, err)
    90  
    91  	tokenID, err := createFungibleToken(&env, func(transaction *TokenCreateTransaction) {
    92  		transaction.SetKycKey(pubKeys[0])
    93  	})
    94  	require.NoError(t, err)
    95  
    96  	resp, err = NewTokenUpdateTransaction().
    97  		SetNodeAccountIDs(env.NodeAccountIDs).
    98  		SetTokenName("ffffc").
    99  		SetTokenID(tokenID).
   100  		SetTokenSymbol("K").
   101  		SetTreasuryAccountID(env.Client.GetOperatorAccountID()).
   102  		SetAdminKey(env.Client.GetOperatorPublicKey()).
   103  		SetFreezeKey(pubKeys[1]).
   104  		SetWipeKey(pubKeys[2]).
   105  		SetKycKey(pubKeys[3]).
   106  		SetSupplyKey(pubKeys[4]).
   107  		Execute(env.Client)
   108  	require.NoError(t, err)
   109  
   110  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
   111  	require.NoError(t, err)
   112  
   113  	info, err := NewTokenInfoQuery().
   114  		SetTokenID(tokenID).
   115  		SetNodeAccountIDs([]AccountID{resp.NodeID}).
   116  		Execute(env.Client)
   117  	require.NoError(t, err)
   118  
   119  	assert.Equal(t, "K", info.Symbol)
   120  	assert.Equal(t, "ffffc", info.Name)
   121  	if info.FreezeKey != nil {
   122  		freezeKey := info.FreezeKey
   123  		assert.Equal(t, pubKeys[1].String(), freezeKey.String())
   124  	}
   125  	err = CloseIntegrationTestEnv(env, &tokenID)
   126  	require.NoError(t, err)
   127  }
   128  
   129  func TestIntegrationTokenUpdateTransactionNoTokenID(t *testing.T) {
   130  	t.Parallel()
   131  	env := NewIntegrationTestEnv(t)
   132  
   133  	tokenID, err := createFungibleToken(&env)
   134  	require.NoError(t, err)
   135  
   136  	resp2, err := NewTokenUpdateTransaction().
   137  		Execute(env.Client)
   138  	assert.Error(t, err)
   139  	if err != nil {
   140  		assert.Equal(t, fmt.Sprintf("exceptional precheck status INVALID_TOKEN_ID received for transaction %s", resp2.TransactionID), err.Error())
   141  	}
   142  
   143  	err = CloseIntegrationTestEnv(env, &tokenID)
   144  	require.NoError(t, err)
   145  }
   146  
   147  func DisabledTestIntegrationTokenUpdateTransactionTreasury(t *testing.T) { // nolint
   148  	t.Parallel()
   149  	env := NewIntegrationTestEnv(t)
   150  
   151  	newKey, err := PrivateKeyGenerateEd25519()
   152  	require.NoError(t, err)
   153  
   154  	newBalance := NewHbar(2)
   155  
   156  	assert.Equal(t, 2*HbarUnits.Hbar._NumberOfTinybar(), newBalance.tinybar)
   157  
   158  	resp, err := NewAccountCreateTransaction().
   159  		SetKey(newKey).
   160  		SetNodeAccountIDs(env.NodeAccountIDs).
   161  		SetInitialBalance(newBalance).
   162  		Execute(env.Client)
   163  	require.NoError(t, err)
   164  
   165  	receipt, err := resp.SetValidateStatus(true).GetReceipt(env.Client)
   166  	require.NoError(t, err)
   167  
   168  	accountID := *receipt.AccountID
   169  
   170  	tokenID, err := createNft(&env)
   171  	require.NoError(t, err)
   172  
   173  	metaData := make([]byte, 50, 101)
   174  
   175  	mint, err := NewTokenMintTransaction().
   176  		SetNodeAccountIDs([]AccountID{resp.NodeID}).
   177  		SetTokenID(tokenID).
   178  		SetMetadata(metaData).
   179  		Execute(env.Client)
   180  	require.NoError(t, err)
   181  
   182  	_, err = mint.SetValidateStatus(true).GetReceipt(env.Client)
   183  	require.NoError(t, err)
   184  
   185  	update, err := NewTokenUpdateTransaction().
   186  		SetTokenID(tokenID).
   187  		SetTokenSymbol("A").
   188  		SetNodeAccountIDs([]AccountID{resp.NodeID}).
   189  		SetTreasuryAccountID(accountID).
   190  		FreezeWith(env.Client)
   191  	require.NoError(t, err)
   192  
   193  	update.Sign(newKey)
   194  
   195  	resp, err = update.Execute(env.Client)
   196  	require.NoError(t, err)
   197  
   198  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
   199  	require.NoError(t, err)
   200  
   201  	info, err := NewTokenInfoQuery().
   202  		SetTokenID(tokenID).
   203  		SetNodeAccountIDs([]AccountID{resp.NodeID}).
   204  		Execute(env.Client)
   205  	require.NoError(t, err)
   206  	assert.Equalf(t, "A", info.Symbol, "token failed to update")
   207  
   208  	err = CloseIntegrationTestEnv(env, &tokenID)
   209  	require.NoError(t, err)
   210  }
   211  
   212  var newMetadata = []byte{3, 4, 5, 6}
   213  
   214  func TestIntegrationTokenUpdateTransactionFungibleMetadata(t *testing.T) {
   215  	t.Parallel()
   216  	env := NewIntegrationTestEnv(t)
   217  
   218  	tokenID, err := createFungibleToken(&env, func(transaction *TokenCreateTransaction) {
   219  		transaction.SetTokenMetadata(initialMetadata)
   220  	})
   221  	require.NoError(t, err)
   222  
   223  	info, err := NewTokenInfoQuery().
   224  		SetTokenID(tokenID).
   225  		Execute(env.Client)
   226  	require.NoError(t, err)
   227  	assert.Equalf(t, initialMetadata, info.Metadata, "metadata did not match")
   228  
   229  	resp, err := NewTokenUpdateTransaction().
   230  		SetTokenID(tokenID).
   231  		SetTokenMetadata(newMetadata).
   232  		Execute(env.Client)
   233  	assert.NoError(t, err)
   234  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
   235  	require.NoError(t, err)
   236  
   237  	info, err = NewTokenInfoQuery().
   238  		SetTokenID(tokenID).
   239  		SetNodeAccountIDs([]AccountID{resp.NodeID}).
   240  		Execute(env.Client)
   241  	require.NoError(t, err)
   242  	assert.Equalf(t, newMetadata, info.Metadata, "updated metadata did not match")
   243  
   244  	err = CloseIntegrationTestEnv(env, &tokenID)
   245  	require.NoError(t, err)
   246  }
   247  
   248  func TestIntegrationTokenUpdateTransactionNFTMetadata(t *testing.T) {
   249  	t.Parallel()
   250  	env := NewIntegrationTestEnv(t)
   251  
   252  	tokenID, err := createNft(&env, func(transaction *TokenCreateTransaction) {
   253  		transaction.SetTokenMetadata(initialMetadata)
   254  	})
   255  	require.NoError(t, err)
   256  
   257  	info, err := NewTokenInfoQuery().
   258  		SetTokenID(tokenID).
   259  		Execute(env.Client)
   260  	require.NoError(t, err)
   261  	assert.Equalf(t, initialMetadata, info.Metadata, "metadata did not match")
   262  
   263  	resp, err := NewTokenUpdateTransaction().
   264  		SetTokenID(tokenID).
   265  		SetTokenMetadata(newMetadata).
   266  		Execute(env.Client)
   267  	assert.NoError(t, err)
   268  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
   269  	require.NoError(t, err)
   270  
   271  	info, err = NewTokenInfoQuery().
   272  		SetTokenID(tokenID).
   273  		SetNodeAccountIDs([]AccountID{resp.NodeID}).
   274  		Execute(env.Client)
   275  	require.NoError(t, err)
   276  	assert.Equalf(t, newMetadata, info.Metadata, "updated metadata did not match")
   277  
   278  	err = CloseIntegrationTestEnv(env, &tokenID)
   279  	require.NoError(t, err)
   280  }
   281  
   282  func TestIntegrationTokenUpdateTransactionMetadataImmutableFunbigleToken(t *testing.T) {
   283  	t.Parallel()
   284  	env := NewIntegrationTestEnv(t)
   285  
   286  	metadataKey, err := PrivateKeyGenerateEd25519()
   287  	require.NoError(t, err)
   288  
   289  	pubKey := metadataKey.PublicKey()
   290  
   291  	tokenID, err := createFungibleToken(&env, func(transaction *TokenCreateTransaction) {
   292  		transaction.
   293  			SetMetadataKey(pubKey).
   294  			SetTokenMetadata(initialMetadata).
   295  			SetAdminKey(nil)
   296  	})
   297  	require.NoError(t, err)
   298  
   299  	info, err := NewTokenInfoQuery().
   300  		SetTokenID(tokenID).
   301  		Execute(env.Client)
   302  	require.NoError(t, err)
   303  	assert.Equalf(t, initialMetadata, info.Metadata, "metadata did not match")
   304  	assert.Equalf(t, pubKey.String(), info.MetadataKey.String(), "metadata key did not match")
   305  	assert.Equalf(t, nil, info.AdminKey, "admin key did not match")
   306  
   307  	tx, err := NewTokenUpdateTransaction().
   308  		SetTokenID(tokenID).
   309  		SetTokenMetadata(newMetadata).
   310  		FreezeWith(env.Client)
   311  	require.NoError(t, err)
   312  
   313  	resp, err := tx.Sign(metadataKey).
   314  		Execute(env.Client)
   315  	assert.NoError(t, err)
   316  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
   317  	require.NoError(t, err)
   318  
   319  	info, err = NewTokenInfoQuery().
   320  		SetTokenID(tokenID).
   321  		SetNodeAccountIDs([]AccountID{resp.NodeID}).
   322  		Execute(env.Client)
   323  	require.NoError(t, err)
   324  	assert.Equalf(t, newMetadata, info.Metadata, "updated metadata did not match")
   325  }
   326  
   327  func TestIntegrationTokenUpdateTransactionMetadataImmutableNFT(t *testing.T) {
   328  	t.Parallel()
   329  	env := NewIntegrationTestEnv(t)
   330  
   331  	metadataKey, err := PrivateKeyGenerateEd25519()
   332  	require.NoError(t, err)
   333  
   334  	tokenID, err := createNft(&env, func(transaction *TokenCreateTransaction) {
   335  		transaction.
   336  			SetMetadataKey(metadataKey.PublicKey()).
   337  			SetAdminKey(nil).
   338  			SetTokenMetadata(initialMetadata)
   339  	})
   340  	require.NoError(t, err)
   341  
   342  	info, err := NewTokenInfoQuery().
   343  		SetTokenID(tokenID).
   344  		Execute(env.Client)
   345  	require.NoError(t, err)
   346  	assert.Equalf(t, initialMetadata, info.Metadata, "metadata did not match")
   347  	assert.Equalf(t, metadataKey.PublicKey().String(), info.MetadataKey.String(), "metadata key did not match")
   348  	assert.Equalf(t, nil, info.AdminKey, "admin key did not match")
   349  
   350  	tx, err := NewTokenUpdateTransaction().
   351  		SetTokenID(tokenID).
   352  		SetTokenMetadata(newMetadata).
   353  		FreezeWith(env.Client)
   354  	require.NoError(t, err)
   355  
   356  	resp, err := tx.Sign(metadataKey).
   357  		Execute(env.Client)
   358  	assert.NoError(t, err)
   359  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
   360  	require.NoError(t, err)
   361  
   362  	info, err = NewTokenInfoQuery().
   363  		SetTokenID(tokenID).
   364  		SetNodeAccountIDs([]AccountID{resp.NodeID}).
   365  		Execute(env.Client)
   366  	require.NoError(t, err)
   367  	assert.Equalf(t, newMetadata, info.Metadata, "updated metadata did not match")
   368  }
   369  
   370  func TestIntegrationTokenUpdateTransactionCannotUpdateMetadataFungible(t *testing.T) {
   371  	t.Parallel()
   372  	env := NewIntegrationTestEnv(t)
   373  
   374  	tokenID, err := createFungibleToken(&env, func(transaction *TokenCreateTransaction) {
   375  		transaction.SetTokenMetadata(initialMetadata)
   376  	})
   377  	require.NoError(t, err)
   378  
   379  	info, err := NewTokenInfoQuery().
   380  		SetTokenID(tokenID).
   381  		Execute(env.Client)
   382  	require.NoError(t, err)
   383  	assert.Equalf(t, initialMetadata, info.Metadata, "metadata did not match")
   384  
   385  	resp, err := NewTokenUpdateTransaction().
   386  		SetTokenID(tokenID).
   387  		SetTokenMemo("asdf").
   388  		Execute(env.Client)
   389  	assert.NoError(t, err)
   390  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
   391  	require.NoError(t, err)
   392  
   393  	info, err = NewTokenInfoQuery().
   394  		SetTokenID(tokenID).
   395  		SetNodeAccountIDs([]AccountID{resp.NodeID}).
   396  		Execute(env.Client)
   397  	require.NoError(t, err)
   398  	assert.Equalf(t, initialMetadata, info.Metadata, "metadata did not match")
   399  
   400  	err = CloseIntegrationTestEnv(env, &tokenID)
   401  	require.NoError(t, err)
   402  }
   403  
   404  func TestIntegrationTokenUpdateTransactionCannotUpdateMetadataNFT(t *testing.T) {
   405  	t.Parallel()
   406  	env := NewIntegrationTestEnv(t)
   407  
   408  	tokenID, err := createNft(&env, func(transaction *TokenCreateTransaction) {
   409  		transaction.SetTokenMetadata(initialMetadata)
   410  	})
   411  	require.NoError(t, err)
   412  
   413  	info, err := NewTokenInfoQuery().
   414  		SetTokenID(tokenID).
   415  		Execute(env.Client)
   416  	require.NoError(t, err)
   417  	assert.Equalf(t, initialMetadata, info.Metadata, "metadata did not match")
   418  
   419  	resp, err := NewTokenUpdateTransaction().
   420  		SetTokenID(tokenID).
   421  		SetTokenMemo("asdf").
   422  		Execute(env.Client)
   423  	assert.NoError(t, err)
   424  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
   425  	require.NoError(t, err)
   426  
   427  	info, err = NewTokenInfoQuery().
   428  		SetTokenID(tokenID).
   429  		SetNodeAccountIDs([]AccountID{resp.NodeID}).
   430  		Execute(env.Client)
   431  	require.NoError(t, err)
   432  	assert.Equalf(t, initialMetadata, info.Metadata, "metadata did not match")
   433  
   434  	err = CloseIntegrationTestEnv(env, &tokenID)
   435  	require.NoError(t, err)
   436  }
   437  
   438  func TestIntegrationTokenUpdateTransactionEraseMetadataFungibleToken(t *testing.T) {
   439  	t.Parallel()
   440  	env := NewIntegrationTestEnv(t)
   441  
   442  	tokenID, err := createFungibleToken(&env, func(transaction *TokenCreateTransaction) {
   443  		transaction.SetTokenMetadata(initialMetadata)
   444  	})
   445  	require.NoError(t, err)
   446  
   447  	info, err := NewTokenInfoQuery().
   448  		SetTokenID(tokenID).
   449  		Execute(env.Client)
   450  	require.NoError(t, err)
   451  	assert.Equalf(t, initialMetadata, info.Metadata, "metadata did not match")
   452  
   453  	resp, err := NewTokenUpdateTransaction().
   454  		SetTokenID(tokenID).
   455  		SetTokenMetadata([]byte{}).
   456  		Execute(env.Client)
   457  	assert.NoError(t, err)
   458  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
   459  	require.NoError(t, err)
   460  
   461  	info, err = NewTokenInfoQuery().
   462  		SetTokenID(tokenID).
   463  		SetNodeAccountIDs([]AccountID{resp.NodeID}).
   464  		Execute(env.Client)
   465  	require.NoError(t, err)
   466  	assert.Equalf(t, []byte(nil), info.Metadata, "metadata did not match")
   467  
   468  	err = CloseIntegrationTestEnv(env, &tokenID)
   469  	require.NoError(t, err)
   470  }
   471  
   472  func TestIntegrationTokenUpdateTransactionEraseMetadataNFT(t *testing.T) {
   473  	t.Parallel()
   474  	env := NewIntegrationTestEnv(t)
   475  
   476  	tokenID, err := createNft(&env, func(transaction *TokenCreateTransaction) {
   477  		transaction.SetTokenMetadata(initialMetadata)
   478  	})
   479  	require.NoError(t, err)
   480  
   481  	info, err := NewTokenInfoQuery().
   482  		SetTokenID(tokenID).
   483  		Execute(env.Client)
   484  	require.NoError(t, err)
   485  	assert.Equalf(t, initialMetadata, info.Metadata, "metadata did not match")
   486  
   487  	resp, err := NewTokenUpdateTransaction().
   488  		SetTokenID(tokenID).
   489  		SetTokenMetadata([]byte{}).
   490  		Execute(env.Client)
   491  	assert.NoError(t, err)
   492  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
   493  	require.NoError(t, err)
   494  
   495  	info, err = NewTokenInfoQuery().
   496  		SetTokenID(tokenID).
   497  		SetNodeAccountIDs([]AccountID{resp.NodeID}).
   498  		Execute(env.Client)
   499  	require.NoError(t, err)
   500  	assert.Equalf(t, []byte(nil), info.Metadata, "metadata did not match")
   501  
   502  	err = CloseIntegrationTestEnv(env, &tokenID)
   503  	require.NoError(t, err)
   504  }
   505  
   506  func TestIntegrationTokenUpdateTransactionCannotUpdateMetadataWithoutKeyFungible(t *testing.T) {
   507  	t.Parallel()
   508  	env := NewIntegrationTestEnv(t)
   509  
   510  	metadataKey, err := PrivateKeyGenerateEd25519()
   511  	require.NoError(t, err)
   512  	adminKey, err := PrivateKeyGenerateEd25519()
   513  	require.NoError(t, err)
   514  
   515  	pubKey := metadataKey.PublicKey()
   516  
   517  	tokenID, err := createFungibleToken(&env, func(transaction *TokenCreateTransaction) {
   518  		transaction.SetAdminKey(adminKey).
   519  			SetMetadataKey(pubKey).
   520  			FreezeWith(env.Client)
   521  
   522  		transaction.Sign(adminKey)
   523  	})
   524  	require.NoError(t, err)
   525  
   526  	resp, err := NewTokenUpdateTransaction().
   527  		SetTokenID(tokenID).
   528  		SetTokenMetadata(newMetadata).
   529  		Execute(env.Client)
   530  
   531  	assert.NoError(t, err)
   532  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
   533  	require.ErrorContains(t, err, "INVALID_SIGNATURE")
   534  }
   535  
   536  func TestIntegrationTokenUpdateTransactionCannotUpdateMetadataWithoutKeyNFT(t *testing.T) {
   537  	t.Parallel()
   538  	env := NewIntegrationTestEnv(t)
   539  
   540  	metadataKey, err := PrivateKeyGenerateEd25519()
   541  	require.NoError(t, err)
   542  	adminKey, err := PrivateKeyGenerateEd25519()
   543  	require.NoError(t, err)
   544  
   545  	pubKey := metadataKey.PublicKey()
   546  
   547  	tokenID, err := createNft(&env, func(transaction *TokenCreateTransaction) {
   548  		transaction.
   549  			SetAdminKey(adminKey).
   550  			SetSupplyKey(adminKey).
   551  			SetMetadataKey(pubKey).
   552  			FreezeWith(env.Client)
   553  
   554  		transaction.Sign(adminKey)
   555  	})
   556  	require.NoError(t, err)
   557  
   558  	resp, err := NewTokenUpdateTransaction().
   559  		SetTokenID(tokenID).
   560  		SetTokenMetadata(newMetadata).
   561  		Execute(env.Client)
   562  
   563  	assert.NoError(t, err)
   564  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
   565  	require.ErrorContains(t, err, "INVALID_SIGNATURE")
   566  }
   567  
   568  func TestIntegrationTokenUpdateTransactionCannotUpdateImmutableFungibleToken(t *testing.T) {
   569  	t.Parallel()
   570  	env := NewIntegrationTestEnv(t)
   571  
   572  	tokenID, err := createFungibleToken(&env, func(transaction *TokenCreateTransaction) {
   573  		transaction.
   574  			SetAdminKey(nil).
   575  			SetMetadataKey(nil)
   576  	})
   577  	require.NoError(t, err)
   578  
   579  	resp, err := NewTokenUpdateTransaction().
   580  		SetTokenID(tokenID).
   581  		SetTokenMetadata(newMetadata).
   582  		Execute(env.Client)
   583  	assert.NoError(t, err)
   584  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
   585  	require.ErrorContains(t, err, "TOKEN_IS_IMMUTABLE")
   586  }
   587  
   588  func TestIntegrationTokenUpdateTransactionCannotUpdateImmutableNFT(t *testing.T) {
   589  	t.Parallel()
   590  	env := NewIntegrationTestEnv(t)
   591  
   592  	tokenID, err := createNft(&env, func(transaction *TokenCreateTransaction) {
   593  		transaction.
   594  			SetAdminKey(nil).
   595  			SetMetadataKey(nil)
   596  	})
   597  	require.NoError(t, err)
   598  
   599  	resp, err := NewTokenUpdateTransaction().
   600  		SetTokenID(tokenID).
   601  		SetTokenMetadata(newMetadata).
   602  		Execute(env.Client)
   603  	assert.NoError(t, err)
   604  	_, err = resp.SetValidateStatus(true).GetReceipt(env.Client)
   605  	require.ErrorContains(t, err, "TOKEN_IS_IMMUTABLE")
   606  }