craft-nft

A standalone NFT implementation for real-world arts and crafts assets
Log | Files | Refs | README

commit eef45f71a2589eb2f5c8eaef923e42e65c6a5635
parent 84477a2584b968b495f6e54ab6bcd8ec521a5118
Author: lash <dev@holbrook.no>
Date:   Thu,  2 Mar 2023 06:39:38 +0000

Adapt allocate command to unbounded

Diffstat:
Mjs/qrread.js | 3+--
Mpython/craft_nft/runnable/allocate.py | 10+++++++---
2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/js/qrread.js b/js/qrread.js @@ -60,8 +60,7 @@ const txBaseERC20 = { function checkAddress(addr) { if (addr.length < 40) { - console.error('invalid ethereum address (too short)', addr); - return; + throw 'invalid ethereum address (too short): ' + addr; } if (addr.substring(0, 9) == "ethereum:") { // metamask qr addr = addr.substring(9); diff --git a/python/craft_nft/runnable/allocate.py b/python/craft_nft/runnable/allocate.py @@ -45,8 +45,11 @@ def process_config_local(config, arg, args, flags): bytes.fromhex(token_id) config.add(token_id, '_TOKEN_ID', False) - assert args.count < 2**48 - config.add(args.count, '_TOKEN_COUNT', False) + if args.nolimit: + config.add(-1, '_TOKEN_COUNT', False) + else: + assert args.count < 2**48 + config.add(args.count, '_TOKEN_COUNT', False) if args.fee_limit == None: config.add(200000, '_FEE_LIMIT', True) @@ -55,10 +58,11 @@ def process_config_local(config, arg, args, flags): arg_flags = ArgFlag() arg = Arg(arg_flags) -flags = arg_flags.STD_WRITE | arg_flags.CREATE | arg_flags.VALUE | arg_flags.TAB | arg_flags.EXEC +flags = arg_flags.STD_WRITE | arg_flags.VALUE | arg_flags.TAB | arg_flags.EXEC argparser = chainlib.eth.cli.ArgumentParser() argparser = process_args(argparser, arg, flags) +argparser.add_argument('--nolimit', action='store_true', help='Unbounded token batch') argparser.add_argument('--count', default=0, type=int, help='Amount of tokens in batch') argparser.add_argument('token_id', type=str, nargs='*', help='token id: sha256 sum of token data, in hex') args = argparser.parse_args(sys.argv[1:])