コード例 #1
0
ファイル: testnet.py プロジェクト: weigun/eosfactory
def remove_from_mapping(name):
    '''Remove from the record a testnet of the given name.

    The name of a testnet is set with the argument *name* argument of the 
    function :func:`.add_to_mapping`. If the argument is not set, the name is 
    synthesized from the argument *url*.

    Args:
        name (str): The name of the testnet to be removed.
    '''    
    mapping = manager.read_map(TESTNET_FILE)
    if name in mapping:
        del mapping[name]
        manager.save_map(mapping, TESTNET_FILE)
コード例 #2
0
ファイル: testnet.py プロジェクト: weigun/eosfactory
def add_to_mapping(account_name, owner_key, active_key, url, name=None):
    '''Save a :class:`.Testnet` object.

    Args:
        account_name (str): If set, the account name, otherwise the node is
            considered local, and the name is *eosio*.
        owner_key (str): If set, the public owner key of the *account*.
        active_key (str): If set, the public active key of the *account*.
        url (str): If set, the URL of a remote *nodeos*, otherwise 
            a localhost URL.
        name (str): If set, the name of the testnet.
    '''
    mapping = manager.read_map(TESTNET_FILE)
    testnet = {}
    testnet["account_name"] = account_name
    testnet["owner_key"] = owner_key
    testnet["active_key"] = active_key
    testnet["url"] = url
    if not name:
        name = setup.url_prefix(url)
    testnet["name"] = name
    mapping[name] = testnet
    manager.save_map(mapping, TESTNET_FILE)
コード例 #3
0
def save_mapping(mapping):
    manager.save_map(mapping, TESTNET_FILE)