|
1 | 1 | """ |
2 | | -This example demonstrates approving an NFT allowance and transferring the NFT using it. |
3 | | -
|
4 | | -- Creates an owner, spender, and receiver account. |
5 | | -- Creates an NFT. |
6 | | -- Mints the NFT to the owner's account. |
7 | | -- Associates the NFT with the receiver's account. |
8 | | -- Approves the spender to spend the owner's NFT. |
9 | | -- Spender (as payer) transfers the NFT from the owner to the receiver. |
| 2 | +Example: Approving an NFT allowance and transferring the NFT using it. |
| 3 | +
|
| 4 | +Why: |
| 5 | + This example demonstrates how NFT allowances work on the Hedera network. |
| 6 | + It shows how an owner can approve another account (the spender) to transfer |
| 7 | + their NFT to a receiver. This is useful for understanding NFT permissions |
| 8 | + and automated transfers in decentralized applications. |
| 9 | +
|
| 10 | +Key Concepts: |
| 11 | + - Owner: The account that owns the NFT and grants allowance. |
| 12 | + - Spender: The account approved to transfer the Owner's NFT. |
| 13 | + - Receiver: The account that will receive the NFT. |
| 14 | + - NFT Allowance: Permission given by the Owner to the Spender to transfer NFT(s). |
| 15 | +
|
| 16 | +High-Level Steps: |
| 17 | + Required: |
| 18 | + 1. Create Owner, Spender, and Receiver accounts. |
| 19 | + 2. Create and mint an NFT to the Owner. |
| 20 | + 3. Approve the Spender to transfer the Owner's NFT. |
| 21 | + 4. Transfer the NFT using the approved allowance. |
| 22 | + Optional: |
| 23 | + - Associate the NFT with the Receiver account (depends on network/account setup). |
10 | 24 |
|
11 | 25 | Usage: |
12 | 26 | uv run examples/account/account_allowance_approve_transaction_nft.py |
13 | 27 | """ |
14 | 28 |
|
| 29 | + |
15 | 30 | import os |
16 | 31 | import sys |
17 | 32 | from dotenv import load_dotenv |
|
0 commit comments