def add_account_address(self, account: Bip44AccountType, address: Bip44AddressType): account_idx = self.account_index_by_id(account.id) if account_idx is not None: account_loc = self.accounts[account_idx] acc_index = self.index(account_idx, 0) addr_idx = account_loc.address_index_by_id(address.id) if addr_idx is None: self.__data_modified = True addr_loc = Bip44AddressType(None) addr_loc.copy_from(address) addr_idx = account_loc.get_address_insert_index(addr_loc) self.beginInsertRows(acc_index, addr_idx, addr_idx) account_loc.add_address(addr_loc, addr_idx) self.endInsertRows()
def load_mn_addresses_in_bip44_wallet(self, bip44_wallet: Bip44Wallet): addr_ids = [] for mni in self.mn_items: if mni.masternode.collateral_address: a = bip44_wallet.get_address_item(mni.masternode.collateral_address, True) address_loc = Bip44AddressType(tree_id=None) address_loc.copy_from(a) if not address_loc.bip32_path: address_loc.bip32_path = mni.masternode.collateral_bip32_path a.bip32_path = mni.masternode.collateral_bip32_path mni.address = address_loc if mni.masternode.collateral_address not in addr_ids: addr_ids.append(mni.address.id) if addr_ids: bip44_wallet.subscribe_addresses_for_chbalance(addr_ids, True)
def __init__(self, parent, masternode_list: List[MasternodeConfig], bip44_wallet: Bip44Wallet): ExtSortFilterTableModel.__init__( self, parent, [TableModelColumn('description', 'Description', True, 100)], False, False) self.mn_items: List[MnAddressItem] = [] for mn in masternode_list: mni = MnAddressItem() mni.masternode = mn if mni.masternode.collateralAddress: a = bip44_wallet.get_address_item( mni.masternode.collateralAddress, True) address_loc = Bip44AddressType(tree_id=None) address_loc.copy_from(a) if not address_loc.bip32_path: address_loc.bip32_path = mni.masternode.collateralBip32Path mni.address = address_loc self.mn_items.append(mni)