Skip to content

Commit 9b46d89

Browse files
fix(example): remove unsupported bonus pause key removal logic
Signed-off-by: undefinedIsMyLife <shinetina169@gmail.com>
1 parent e269f57 commit 9b46d89

File tree

1 file changed

+0
-62
lines changed

1 file changed

+0
-62
lines changed

examples/token_create_transaction_pause_key.py

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -224,52 +224,6 @@ def test_transfer_while_paused(client, operator_id, operator_key, recipient_id,
224224
else:
225225
print(f"⚠️ Unexpected status: {ResponseCode(receipt.status).name}\n")
226226

227-
228-
229-
# -------------------------------------------------------
230-
# BONUS: REMOVE PAUSE KEY WHILE PAUSED → PERMANENT
231-
# -------------------------------------------------------
232-
def remove_pause_key(client, token_id, pause_key):
233-
print("🔹 Removing pause key while token is UNPAUSED...")
234-
235-
tx = (
236-
TokenUpdateTransaction()
237-
.set_token_id(token_id)
238-
.set_pause_key(None)
239-
.freeze_with(client)
240-
.sign(pause_key)
241-
)
242-
243-
receipt = tx.execute(client)
244-
245-
if receipt.status == ResponseCode.SUCCESS:
246-
print("✅ Pause key removed successfully.\n")
247-
return True
248-
else:
249-
print(f"❌ Failed to remove pause key: {ResponseCode(receipt.status).name}\n")
250-
return False
251-
252-
253-
def attempt_unpause_after_removal_should_fail(client, token_id):
254-
print("🔹 Attempting to unpause a token with NO pause key (should fail)...")
255-
256-
try:
257-
tx = (
258-
TokenUnpauseTransaction()
259-
.set_token_id(token_id)
260-
.freeze_with(client)
261-
)
262-
263-
# Do NOT sign — because pause key no longer exists
264-
receipt = tx.execute(client)
265-
266-
print(f"⚠️ Unexpected status: {ResponseCode(receipt.status).name}\n")
267-
268-
except Exception as e:
269-
print(f"✅ Permanent unpause failure occurred as expected: {e}\n")
270-
271-
272-
273227
# -------------------------------------------------------
274228
# MAIN
275229
# -------------------------------------------------------
@@ -296,22 +250,6 @@ def main():
296250

297251
unpause_token(client, token_with_pause, pause_key)
298252

299-
print("\n==================== BONUS — PERMANENT PAUSE ====================\n")
300-
# 1. Pause
301-
pause_token(client, token_with_pause, pause_key)
302-
303-
# 2. Unpause (required to modify keys)
304-
unpause_token(client, token_with_pause, pause_key)
305-
306-
# 3. Remove pause key
307-
if remove_pause_key(client, token_with_pause, pause_key):
308-
309-
# 4. Pause again
310-
pause_token(client, token_with_pause, pause_key)
311-
312-
# 5. Unpause should now fail permanently
313-
attempt_unpause_after_removal_should_fail(client, token_with_pause)
314-
315253
print("\n🎉 Pause key demonstration completed!")
316254

317255

0 commit comments

Comments
 (0)