From 870fb9c5ae4dcd775c9d244530f4c8917a95b078 Mon Sep 17 00:00:00 2001 From: Levente Pap Date: Wed, 29 Jan 2020 12:49:46 +0100 Subject: [PATCH] Fixes #263 Rename `testnet` to `devnet` --- README.md | 2 +- docs/tutorials.rst | 6 ++-- examples/tutorials/02_send_data.py | 2 +- examples/tutorials/03_fetch_data.py | 2 +- examples/tutorials/04a_gen_address.py | 2 +- examples/tutorials/04b_check_balance.py | 2 +- examples/tutorials/04c_get_acc_data.py | 2 +- examples/tutorials/05_send_tokens.py | 2 +- examples/tutorials/06_store_encrypted.py | 2 +- examples/tutorials/07_fetch_encrypted.py | 2 +- iota/api.py | 30 +++++++++---------- iota/bin/__init__.py | 6 ++-- iota/bin/repl.py | 4 +-- iota/commands/core/attach_to_tangle.py | 2 +- iota/commands/extended/promote_transaction.py | 2 +- iota/commands/extended/replay_bundle.py | 2 +- iota/commands/extended/send_transfer.py | 2 +- iota/commands/extended/send_trytes.py | 2 +- 18 files changed, 37 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 6d196632..c13c6b72 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ Here's how you could send a zero-value transaction, using the library. For the g ```python # You don't need a seed to send zero-value transactions -api = Iota('https://nodes.devnet.iota.org:443', testnet=True) +api = Iota('https://nodes.devnet.iota.org:443', devnet=True) # Define a message to send. # This message must include only ASCII characters. diff --git a/docs/tutorials.rst b/docs/tutorials.rst index b46f00e6..0e43dfe5 100644 --- a/docs/tutorials.rst +++ b/docs/tutorials.rst @@ -100,9 +100,9 @@ Discussion We have seen this part before. Note, that now we import more objects which we will use to construct our transaction. -Notice ``testnet=True`` in the argument list of the API instantiation. We -tell the API directly that we will use the devnet/testnet. By default, the API -is configured for the mainnet. +Notice ``devnet=True`` in the argument list of the API instantiation. We +tell the API directly that we will use IOTA's testnet, known as the devnet. +By default, the API is configured for the mainnet. .. literalinclude:: ../examples/tutorials/02_send_data.py :lines: 7-8 diff --git a/examples/tutorials/02_send_data.py b/examples/tutorials/02_send_data.py index 5732a5a3..d8d31223 100644 --- a/examples/tutorials/02_send_data.py +++ b/examples/tutorials/02_send_data.py @@ -2,7 +2,7 @@ from pprint import pprint # Declare an API object -api = Iota('https://nodes.devnet.iota.org:443', testnet=True) +api = Iota('https://nodes.devnet.iota.org:443', devnet=True) # Prepare custom data my_data = TryteString.from_unicode('Hello from the Tangle!') diff --git a/examples/tutorials/03_fetch_data.py b/examples/tutorials/03_fetch_data.py index 66ab768b..aa0298f8 100644 --- a/examples/tutorials/03_fetch_data.py +++ b/examples/tutorials/03_fetch_data.py @@ -2,7 +2,7 @@ from iota.codecs import TrytesDecodeError # Declare an API object -api = Iota('https://nodes.devnet.iota.org:443', testnet=True) +api = Iota('https://nodes.devnet.iota.org:443', devnet=True) # Address to fetch data from # Replace with your random generated address from Tutorial 2. to fetch the data diff --git a/examples/tutorials/04a_gen_address.py b/examples/tutorials/04a_gen_address.py index 0559c0c8..68e3fb8c 100644 --- a/examples/tutorials/04a_gen_address.py +++ b/examples/tutorials/04a_gen_address.py @@ -10,7 +10,7 @@ api = Iota( adapter='https://nodes.devnet.iota.org:443', seed=my_seed, - testnet=True, + devnet=True, ) print('Generating the first unused address...') diff --git a/examples/tutorials/04b_check_balance.py b/examples/tutorials/04b_check_balance.py index 9f7353ea..af4fb478 100644 --- a/examples/tutorials/04b_check_balance.py +++ b/examples/tutorials/04b_check_balance.py @@ -5,7 +5,7 @@ my_address = Address(b'YOURADDRESSFROMTHEPREVIOUSTUTORIAL') # Declare an API object -api = Iota(adapter='https://nodes.devnet.iota.org:443', testnet=True) +api = Iota(adapter='https://nodes.devnet.iota.org:443', devnet=True) # Script actually runs until you load up your address success = False diff --git a/examples/tutorials/04c_get_acc_data.py b/examples/tutorials/04c_get_acc_data.py index 4061d2e8..5ead8202 100644 --- a/examples/tutorials/04c_get_acc_data.py +++ b/examples/tutorials/04c_get_acc_data.py @@ -9,7 +9,7 @@ api = Iota( adapter='https://nodes.devnet.iota.org:443', seed=my_seed, - testnet=True + devnet=True ) # Script actually runs until it finds balance diff --git a/examples/tutorials/05_send_tokens.py b/examples/tutorials/05_send_tokens.py index bec20d84..35656f44 100644 --- a/examples/tutorials/05_send_tokens.py +++ b/examples/tutorials/05_send_tokens.py @@ -7,7 +7,7 @@ api = Iota( adapter='https://nodes.devnet.iota.org:443', seed=my_seed, - testnet=True, + devnet=True, ) # Addres to receive 1i diff --git a/examples/tutorials/06_store_encrypted.py b/examples/tutorials/06_store_encrypted.py index f4e5d61e..6c706450 100644 --- a/examples/tutorials/06_store_encrypted.py +++ b/examples/tutorials/06_store_encrypted.py @@ -14,7 +14,7 @@ api = Iota( adapter='https://nodes.devnet.iota.org:443', seed=b'YOURSEEDFROMTHEPREVIOUSTUTORIAL', - testnet=True, + devnet=True, ) # Some confidential information diff --git a/examples/tutorials/07_fetch_encrypted.py b/examples/tutorials/07_fetch_encrypted.py index 9bdad45d..ebffc6d0 100644 --- a/examples/tutorials/07_fetch_encrypted.py +++ b/examples/tutorials/07_fetch_encrypted.py @@ -11,7 +11,7 @@ import json # Declare an API object -api = Iota('https://nodes.devnet.iota.org:443', testnet=True) +api = Iota('https://nodes.devnet.iota.org:443', devnet=True) # Prompt user for tail tx hash of the bundle tail_hash = input('Tail transaction hash of the bundle: ') diff --git a/iota/api.py b/iota/api.py index 19481c5a..b4208907 100644 --- a/iota/api.py +++ b/iota/api.py @@ -39,9 +39,9 @@ class StrictIota(object): :param AdapterSpec adapter: URI string or BaseAdapter instance. - :param Optional[bool] testnet: - Whether to use testnet settings for this instance. - On the testnet, minimum weight magnitude is set to 9, on mainnet + :param Optional[bool] devnet: + Whether to use devnet settings for this instance. + On the devnet, minimum weight magnitude is set to 9, on mainnet it is 1 by default. :param Optional[bool] local_pow: @@ -54,15 +54,15 @@ class StrictIota(object): """ - def __init__(self, adapter, testnet=False, local_pow=False): + def __init__(self, adapter, devnet=False, local_pow=False): # type: (AdapterSpec, bool, bool) -> None """ :param AdapterSpec adapter: URI string or BaseAdapter instance. - :param bool testnet: - Whether to use testnet settings for this instance. - On the testnet, minimum weight magnitude is set to 9, on mainnet + :param bool devnet: + Whether to use devnet settings for this instance. + On the devnet, minimum weight magnitude is set to 9, on mainnet it is 1 by default. :param Optional[bool] local_pow: @@ -91,7 +91,7 @@ def __init__(self, adapter, testnet=False, local_pow=False): # via pyota-pow extension, or sends the request to a node. # But technically, the parameter belongs to the adapter. self.adapter.set_local_pow(local_pow) - self.testnet = testnet + self.devnet = devnet def create_command(self, command): # type: (Text) -> CustomCommand @@ -134,7 +134,7 @@ def default_min_weight_magnitude(self): Returns the default ``min_weight_magnitude`` value to use for API requests. """ - return 9 if self.testnet else 14 + return 9 if self.devnet else 14 def add_neighbors(self, uris): # type: (Iterable[Text]) -> dict @@ -197,7 +197,7 @@ def attach_to_tangle( :param Optional[int] min_weight_magnitude: Minimum weight magnitude to be used for attaching trytes. - 14 by default on mainnet, 9 on testnet/devnet. + 14 by default on mainnet, 9 on devnet/devnet. :return: ``dict`` with the following structure:: @@ -769,9 +769,9 @@ class Iota(StrictIota): .. note:: This value is never transferred to the node/network. - :param Optional[bool] testnet: - Whether to use testnet settings for this instance. - On the testnet, minimum weight magnitude is decreased, on mainnet + :param Optional[bool] devnet: + Whether to use devnet settings for this instance. + On the devnet, minimum weight magnitude is decreased, on mainnet it is 14 by default. For more info on the Mainnet and the Devnet, visit @@ -791,7 +791,7 @@ class Iota(StrictIota): - https://github.com/iotaledger/wiki/blob/master/api-proposal.md """ - def __init__(self, adapter, seed=None, testnet=False, local_pow=False): + def __init__(self, adapter, seed=None, devnet=False, local_pow=False): # type: (AdapterSpec, Optional[TrytesCompatible], bool, bool) -> None """ :param seed: @@ -801,7 +801,7 @@ def __init__(self, adapter, seed=None, testnet=False, local_pow=False): .. note:: This value is never transferred to the node/network. """ - super(Iota, self).__init__(adapter, testnet, local_pow) + super(Iota, self).__init__(adapter, devnet, local_pow) self.seed = Seed(seed) if seed else Seed.random() self.helpers = Helpers(self) diff --git a/iota/bin/__init__.py b/iota/bin/__init__.py index eb97e20c..a505e796 100644 --- a/iota/bin/__init__.py +++ b/iota/bin/__init__.py @@ -102,7 +102,7 @@ def parse_argv(self, argv=None): arguments['api'] = Iota( adapter=arguments.pop('uri'), seed=seed, - testnet=arguments.pop('testnet'), + devnet=arguments.pop('devnet'), ) return arguments @@ -143,10 +143,10 @@ def create_argument_parser(self): ) parser.add_argument( - '--testnet', + '--devnet', action='store_true', default=False, - help='If set, use testnet settings (e.g., for PoW).', + help='If set, use devnet settings (e.g., for PoW).', ) return parser diff --git a/iota/bin/repl.py b/iota/bin/repl.py index bfae94bc..3104125f 100755 --- a/iota/bin/repl.py +++ b/iota/bin/repl.py @@ -89,10 +89,10 @@ def _start_repl(api): Starts the REPL. """ banner = ( - 'IOTA API client for {uri} ({testnet}) ' + 'IOTA API client for {uri} ({devnet}) ' 'initialized as variable `api`.\n' 'Type `help(api)` for list of API commands.'.format( - testnet='testnet' if api.testnet else 'mainnet', + devnet='devnet' if api.devnet else 'mainnet', uri=api.adapter.get_uri(), ) ) diff --git a/iota/commands/core/attach_to_tangle.py b/iota/commands/core/attach_to_tangle.py index 8c2644fc..33250bc7 100644 --- a/iota/commands/core/attach_to_tangle.py +++ b/iota/commands/core/attach_to_tangle.py @@ -53,7 +53,7 @@ def __init__(self): f.Required | Trytes(result_type=TransactionTrytes), ), - # Loosely-validated; testnet nodes require a different value + # Loosely-validated; devnet nodes require a different value # than mainnet. 'minWeightMagnitude': f.Required | f.Type(int) | f.Min(1), }) diff --git a/iota/commands/extended/promote_transaction.py b/iota/commands/extended/promote_transaction.py index 3bcbd1ae..b7c03d25 100644 --- a/iota/commands/extended/promote_transaction.py +++ b/iota/commands/extended/promote_transaction.py @@ -62,7 +62,7 @@ def __init__(self): 'depth': f.Required | f.Type(int) | f.Min(1), 'transaction': f.Required | Trytes(TransactionHash), - # Loosely-validated; testnet nodes require a different value + # Loosely-validated; devnet nodes require a different value # than mainnet. 'minWeightMagnitude': f.Required | f.Type(int) | f.Min(1), }) diff --git a/iota/commands/extended/replay_bundle.py b/iota/commands/extended/replay_bundle.py index b2c2e68f..3d5e3139 100644 --- a/iota/commands/extended/replay_bundle.py +++ b/iota/commands/extended/replay_bundle.py @@ -53,7 +53,7 @@ def __init__(self): 'depth': f.Required | f.Type(int) | f.Min(1), 'transaction': f.Required | Trytes(TransactionHash), - # Loosely-validated; testnet nodes require a different value + # Loosely-validated; devnet nodes require a different value # than mainnet. 'minWeightMagnitude': f.Required | f.Type(int) | f.Min(1), }) diff --git a/iota/commands/extended/send_transfer.py b/iota/commands/extended/send_transfer.py index ada66079..ad3def01 100644 --- a/iota/commands/extended/send_transfer.py +++ b/iota/commands/extended/send_transfer.py @@ -70,7 +70,7 @@ def __init__(self): 'depth': f.Required | f.Type(int) | f.Min(1), 'seed': f.Required | Trytes(result_type=Seed), - # Loosely-validated; testnet nodes require a different + # Loosely-validated; devnet nodes require a different # value than mainnet. 'minWeightMagnitude': f.Required | f.Type(int) | f.Min(1), diff --git a/iota/commands/extended/send_trytes.py b/iota/commands/extended/send_trytes.py index 7e54d384..16dac7c0 100644 --- a/iota/commands/extended/send_trytes.py +++ b/iota/commands/extended/send_trytes.py @@ -74,7 +74,7 @@ def __init__(self): f.Required | Trytes(TransactionTrytes), ), - # Loosely-validated; testnet nodes require a different value + # Loosely-validated; devnet nodes require a different value # than mainnet. 'minWeightMagnitude': f.Required | f.Type(int) | f.Min(1),