예제 #1
0
 def accountManager(self, coinType, signals):
     coinType = chains.parseCoinType(coinType)
     if coinType in self.mgrCache:
         return self.mgrCache[coinType]
     acctMgr = self.coinDB[coinType]
     acctDB = self.coinDB.child(str(coinType), table=False)
     acctMgr.load(acctDB, signals)
     self.mgrCache[coinType] = acctMgr
     return acctMgr
예제 #2
0
def test_parseCoinType():
    with pytest.raises(DecredError):
        chains.parseCoinType("not_a_coin")

    assert chains.parseCoinType("DCR") == 42
    assert chains.parseCoinType(42) == 42
    assert chains.parseCoinType(-1) == -1

    with pytest.raises(DecredError):
        chains.parseCoinType(None)
예제 #3
0
    def assetDirectory(self, coinID):
        """
        Get a directory for asset-specific storage. The directory is a
        subdirectory of the network directory.

        Args:
            coinID (int or str): The BIP-0044 asset ID or a ticker symbol.
        """
        symbol = chains.IDSymbols[chains.parseCoinType(coinID)]
        dirPath = Path(self.netDirectory) / symbol
        helpers.mkdir(dirPath)
        return dirPath