mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-09-21 10:09:04 -05:00
Merge pull request #11748 from AmineKhaldi/nft1_mint_cmd_update
Update chia wallet nft mint command to the recent RPC changes
This commit is contained in:
+34
-3
@@ -487,9 +487,16 @@ def nft_wallet_create_cmd(wallet_rpc_port: Optional[int], fingerprint: int) -> N
|
|||||||
)
|
)
|
||||||
@click.option("-f", "--fingerprint", help="Set the fingerprint to specify which wallet to use", type=int)
|
@click.option("-f", "--fingerprint", help="Set the fingerprint to specify which wallet to use", type=int)
|
||||||
@click.option("-i", "--id", help="Id of the NFT wallet to use", type=int, required=True)
|
@click.option("-i", "--id", help="Id of the NFT wallet to use", type=int, required=True)
|
||||||
@click.option("-aa", "--artist-address", help="Artist's backpayment address", type=str, required=True)
|
@click.option("-ra", "--royalty-address", help="Royalty address", type=str)
|
||||||
|
@click.option("-ta", "--target-address", help="Target address", type=str)
|
||||||
@click.option("-nh", "--hash", help="NFT content hash", type=str, required=True)
|
@click.option("-nh", "--hash", help="NFT content hash", type=str, required=True)
|
||||||
@click.option("-u", "--uris", help="Comma separated list of URIs", type=str, required=True)
|
@click.option("-u", "--uris", help="Comma separated list of URIs", type=str, required=True)
|
||||||
|
@click.option("-mh", "--metadata-hash", help="NFT metadata hash", type=str, default="00")
|
||||||
|
@click.option("-mu", "--metadata-uris", help="Comma separated list of metadata URIs", type=str)
|
||||||
|
@click.option("-lh", "--license-hash", help="NFT license hash", type=str, default="00")
|
||||||
|
@click.option("-lu", "--license-uris", help="Comma separated list of license URIs", type=str)
|
||||||
|
@click.option("-st", "--series-total", help="NFT series total number", type=int, default=1, show_default=True)
|
||||||
|
@click.option("-sn", "--series-number", help="NFT seriese number", type=int, default=1, show_default=True)
|
||||||
@click.option(
|
@click.option(
|
||||||
"-m",
|
"-m",
|
||||||
"--fee",
|
"--fee",
|
||||||
@@ -503,19 +510,43 @@ def nft_mint_cmd(
|
|||||||
wallet_rpc_port: Optional[int],
|
wallet_rpc_port: Optional[int],
|
||||||
fingerprint: int,
|
fingerprint: int,
|
||||||
id: int,
|
id: int,
|
||||||
artist_address: str,
|
royalty_address: Optional[str],
|
||||||
|
target_address: Optional[str],
|
||||||
hash: str,
|
hash: str,
|
||||||
uris: str,
|
uris: str,
|
||||||
|
metadata_hash: Optional[str],
|
||||||
|
metadata_uris: Optional[str],
|
||||||
|
license_hash: Optional[str],
|
||||||
|
license_uris: Optional[str],
|
||||||
|
series_total: Optional[int],
|
||||||
|
series_number: Optional[int],
|
||||||
fee: str,
|
fee: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
import asyncio
|
import asyncio
|
||||||
from .wallet_funcs import execute_with_wallet, mint_nft
|
from .wallet_funcs import execute_with_wallet, mint_nft
|
||||||
|
|
||||||
|
if metadata_uris is None:
|
||||||
|
metadata_uris_list = []
|
||||||
|
else:
|
||||||
|
metadata_uris_list = [mu.strip() for mu in metadata_uris.split(",")]
|
||||||
|
|
||||||
|
if license_uris is None:
|
||||||
|
license_uris_list = []
|
||||||
|
else:
|
||||||
|
license_uris_list = [lu.strip() for lu in license_uris.split(",")]
|
||||||
|
|
||||||
extra_params = {
|
extra_params = {
|
||||||
"wallet_id": id,
|
"wallet_id": id,
|
||||||
"artist_address": artist_address,
|
"royalty_address": royalty_address,
|
||||||
|
"target_address": target_address,
|
||||||
"hash": hash,
|
"hash": hash,
|
||||||
"uris": [u.strip() for u in uris.split(",")],
|
"uris": [u.strip() for u in uris.split(",")],
|
||||||
|
"metadata_hash": metadata_hash,
|
||||||
|
"metadata_uris": metadata_uris_list,
|
||||||
|
"license_hash": license_hash,
|
||||||
|
"license_uris": license_uris_list,
|
||||||
|
"series_total": series_total,
|
||||||
|
"series_number": series_number,
|
||||||
"fee": fee,
|
"fee": fee,
|
||||||
}
|
}
|
||||||
asyncio.run(execute_with_wallet(wallet_rpc_port, fingerprint, extra_params, mint_nft))
|
asyncio.run(execute_with_wallet(wallet_rpc_port, fingerprint, extra_params, mint_nft))
|
||||||
|
|||||||
+14
-14
@@ -679,27 +679,27 @@ async def create_nft_wallet(args: Dict, wallet_client: WalletRpcClient, fingerpr
|
|||||||
|
|
||||||
|
|
||||||
async def mint_nft(args: Dict, wallet_client: WalletRpcClient, fingerprint: int) -> None:
|
async def mint_nft(args: Dict, wallet_client: WalletRpcClient, fingerprint: int) -> None:
|
||||||
|
wallet_id = args["wallet_id"]
|
||||||
|
royalty_address = args["royalty_address"]
|
||||||
|
target_address = args["target_address"]
|
||||||
|
hash = args["hash"]
|
||||||
|
uris = args["uris"]
|
||||||
|
metadata_hash = args["metadata_hash"]
|
||||||
|
metadata_uris = args["metadata_uris"]
|
||||||
|
license_hash = args["license_hash"]
|
||||||
|
license_uris = args["license_uris"]
|
||||||
|
series_total = args["series_total"]
|
||||||
|
series_number = args["series_number"]
|
||||||
|
fee = args["fee"]
|
||||||
try:
|
try:
|
||||||
wallet_id = args["wallet_id"]
|
|
||||||
royalty_address = args.get("royalty_address", None)
|
|
||||||
target_address = args.get("target_address", None)
|
|
||||||
hash = args["hash"]
|
|
||||||
uris = args["uris"]
|
|
||||||
meta_hash = args.get("meta_hash", None)
|
|
||||||
meta_uris = args.get("meta_uris", None)
|
|
||||||
license_hash = args.get("license_hash", None)
|
|
||||||
license_uris = args.get("license_uris", None)
|
|
||||||
series_total = args.get("series_total", None)
|
|
||||||
series_number = args.get("series_number", None)
|
|
||||||
fee = args["fee"]
|
|
||||||
response = await wallet_client.mint_nft(
|
response = await wallet_client.mint_nft(
|
||||||
wallet_id,
|
wallet_id,
|
||||||
royalty_address,
|
royalty_address,
|
||||||
target_address,
|
target_address,
|
||||||
hash,
|
hash,
|
||||||
uris,
|
uris,
|
||||||
meta_hash,
|
metadata_hash,
|
||||||
meta_uris,
|
metadata_uris,
|
||||||
license_hash,
|
license_hash,
|
||||||
license_uris,
|
license_uris,
|
||||||
series_total,
|
series_total,
|
||||||
|
|||||||
Reference in New Issue
Block a user