Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #298 from lzpap/rename_testnet
Browse files Browse the repository at this point in the history
Fixes #263 Rename `testnet` to `devnet`
  • Loading branch information
lzpap committed Jan 30, 2020
2 parents 363a0bf + 870fb9c commit 46cfd52
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/02_send_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!')
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/03_fetch_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/04a_gen_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -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...')
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/04b_check_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/04c_get_acc_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/05_send_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
api = Iota(
adapter='https://nodes.devnet.iota.org:443',
seed=my_seed,
testnet=True,
devnet=True,
)

# Addres to receive 1i
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/06_store_encrypted.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
api = Iota(
adapter='https://nodes.devnet.iota.org:443',
seed=b'YOURSEEDFROMTHEPREVIOUSTUTORIAL',
testnet=True,
devnet=True,
)

# Some confidential information
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/07_fetch_encrypted.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: ')
Expand Down
30 changes: 15 additions & 15 deletions iota/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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::
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions iota/bin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions iota/bin/repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
)
Expand Down
2 changes: 1 addition & 1 deletion iota/commands/core/attach_to_tangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
})
Expand Down
2 changes: 1 addition & 1 deletion iota/commands/extended/promote_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
})
2 changes: 1 addition & 1 deletion iota/commands/extended/replay_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
})
2 changes: 1 addition & 1 deletion iota/commands/extended/send_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down
2 changes: 1 addition & 1 deletion iota/commands/extended/send_trytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down

0 comments on commit 46cfd52

Please sign in to comment.