コード例 #1
0
ファイル: blocks.py プロジェクト: RiseVision/rise-py
 def __init__(self, raw):
     self.broad_hash = bytes.fromhex(raw['broadhash'])
     self.epoch = str(raw['epoch'])
     self.fee = Amount(raw['fee'])
     self.height = int(raw['height'])
     self.milestone = int(raw['milestone'])
     self.net_hash = bytes.fromhex(raw['nethash'])
     self.reward = Amount(raw['reward'])
     self.supply = Amount(raw['supply'])
コード例 #2
0
ファイル: accounts.py プロジェクト: RiseVision/rise-py
 def __init__(self, raw):
     self.address = Address(raw['address'])
     self.balance = Amount(raw['balance'])
     self.unconfirmed_balance = Amount(raw['unconfirmedBalance'])
     self.public_key = None if raw['publicKey'] is None \
         else PublicKey.fromhex(raw['publicKey'])
     if raw['secondPublicKey']:
         self.second_public_key = PublicKey.fromhex(raw['secondPublicKey'])
     else:
         self.second_public_key = None
     self.second_signature = bool(raw['secondSignature'])
     self.unconfirmed_second_signature = bool(raw['unconfirmedSignature'])
コード例 #3
0
 def test_add_transactions(self):
     # Resubmit an old tx
     tx = SendTx(
         sender_public_key=PublicKey.fromhex(
             'b3dc9171d784a3669482103951e0e8e89429f78ee5634950f0f4a7f8fad19378'
         ),
         recipient=Address('7851658041862611161R'),
         amount=Amount(3500000000),
         fee=Amount(10000000),
         timestamp=Timestamp(71278993),
         signature=Signature.fromhex(
             'f3fa873fba4619a82becef2c3921d883b44055f6644acc6721be47e451f45ca0'
             '0eb657f476f08b7b5f3035cbe60b7b2e5d68290e8391bdc152340df75c5f390f'
         ),
     )
     self.client.transactions.add_transactions(tx)
コード例 #4
0
ファイル: delegates.py プロジェクト: RiseVision/rise-py
 def __init__(self, raw):
     self.address = Address(raw['address'])
     self.public_key = PublicKey.fromhex(raw['publicKey'])
     self.username = str(raw['username'])
     self.approval = float(raw['approval'])
     self.productivity = float(raw['productivity'])
     if 'cmb' in raw:
         self.consecutive_missed_blocks = int(raw['cmb'])
     else:
         self.consecutive_missed_blocks = None
     self.missed_blocks = int(raw['missedblocks'])
     self.produced_blocks = int(raw['producedblocks'])
     self.rank = int(raw['rank'])
     if 'rate' in raw:
         self.rate = int(raw['rate'])
     else:
         self.rate = None
     self.vote = Amount(raw['vote'])
     if 'votesWeight' in raw:
         self.votes_weight = int(raw['votesWeight'])
     else:
         self.votes_weight = None
     if 'voters_cnt' in raw:
         self.voters_count = int(raw['voters_cnt'])
     else:
         self.voters_count = None
     if 'register_timestamp' in raw:
         self.registration_time = Timestamp(raw['register_timestamp'])
     else:
         self.register_timestamp = None
コード例 #5
0
ファイル: blocks.py プロジェクト: RiseVision/rise-py
 def __init__(self, raw):
     self.block_id = str(raw['id'])
     self.version = int(raw['version'])
     self.timestamp = Timestamp(raw['timestamp'])
     self.height = int(raw['height'])
     if raw['previousBlock']:
         self.previous_block_id = str(raw['previousBlock'])
     else:
         self.previous_block_id = None
     self.number_of_transactions = int(raw['numberOfTransactions'])
     self.total_amount = Amount(raw['totalAmount'])
     self.total_fee = Amount(raw['totalFee'])
     self.reward = Amount(raw['reward'])
     self.payload_length = int(raw['payloadLength'])
     self.payload_hash = bytes.fromhex(raw['payloadHash'])
     self.generator_public_key = PublicKey.fromhex(raw['generatorPublicKey'])
     self.block_signature = Signature.fromhex(raw['blockSignature'])
     self.transactions = [TransactionInfo(t) for t in raw['transactions']]
コード例 #6
0
ファイル: blocks.py プロジェクト: RiseVision/rise-py
 def __init__(self, raw):
     self.send = Amount(raw['send'])
     self.vote = Amount(raw['vote'])
     self.second_signature = Amount(raw['secondsignature'])
     self.delegate = Amount(raw['delegate'])
コード例 #7
0
ファイル: test_primitives.py プロジェクト: RiseVision/rise-py
 def test_from_unit(self):
     self.assertEqual(Amount.from_unit('25'), 2500000000)
     self.assertEqual(Amount.from_unit('0.1'), 10000000)
コード例 #8
0
ファイル: test_primitives.py プロジェクト: RiseVision/rise-py
 def test_valid(self):
     for i in [0, 1, 10, 100000]:
         with self.subTest(i=i):
             value = Amount(i)
             self.assertIsInstance(value, Amount)
コード例 #9
0
ファイル: test_primitives.py プロジェクト: RiseVision/rise-py
 def test_upper_bound(self):
     with self.assertRaises(ValueError):
         Amount.from_unit('184467440737.09551616')
     Amount.from_unit('184467440737.09551615')
コード例 #10
0
ファイル: test_primitives.py プロジェクト: RiseVision/rise-py
 def test_negative(self):
     with self.assertRaises(ValueError):
         Amount(-1)
コード例 #11
0
ファイル: delegates.py プロジェクト: RiseVision/rise-py
 def __init__(self, raw):
     self.address = Address(raw['address'])
     self.public_key = PublicKey.fromhex(raw['publicKey'])
     self.username = raw['username']
     self.balance = Amount(raw['balance'])
コード例 #12
0
ファイル: delegates.py プロジェクト: RiseVision/rise-py
 def __init__(self, raw):
     self.fees = Amount(raw['fees'])
     self.rewards = Amount(raw['rewards'])
     self.forged = Amount(raw['forged'])