async def get_channel(claim_name='@foo'): seed = Mnemonic.mnemonic_to_seed(Mnemonic().make_seed(), '') key = PrivateKey.from_seed(Ledger, seed) channel_key = key.child(KeyPath.CHANNEL).child(0) channel_txo = Output.pay_claim_name_pubkey_hash(CENT, claim_name, Claim(), b'abc') channel_txo.set_channel_private_key(channel_key) get_tx().add_outputs([channel_txo]) return channel_txo
async def test_balance(self): address = await self.account.receiving.get_or_create_usable_address() hash160 = self.ledger.address_to_hash160(address) tx = Transaction(is_verified=True)\ .add_outputs([Output.pay_pubkey_hash(100, hash160)]) await self.ledger.db.insert_transaction(tx) await self.ledger.db.save_transaction_io( tx, address, hash160, f'{tx.id}:1:' ) self.assertEqual(await self.account.get_balance(), 100) tx = Transaction(is_verified=True)\ .add_outputs([Output.pay_claim_name_pubkey_hash(100, 'foo', b'', hash160)]) await self.ledger.db.insert_transaction(tx) await self.ledger.db.save_transaction_io( tx, address, hash160, f'{tx.id}:1:' ) self.assertEqual(await self.account.get_balance(), 100) # claim names don't count towards balance self.assertEqual(await self.account.get_balance(include_claims=True), 200)
def get_claim_transaction(claim_name, claim=b''): return get_transaction( Output.pay_claim_name_pubkey_hash(CENT, claim_name, claim, NULL_HASH32))
def get_stream(claim_name='foo'): stream_txo = Output.pay_claim_name_pubkey_hash(CENT, claim_name, Claim(), b'abc') get_tx().add_outputs([stream_txo]) return stream_txo
def get_channel(claim_name='@foo'): channel_txo = Output.pay_claim_name_pubkey_hash(CENT, claim_name, Claim(), b'abc') channel_txo.generate_channel_private_key() get_tx().add_outputs([channel_txo]) return channel_txo