class CreateWalletPresenter extends BasePresenter<CreateWalletContract.View> implements CreateWalletContract.Presenter {

    private void createHDWallet(String name,String password){

        WalletManager.getInstance()
                .createWalletList(name, password)
                .doOnSuccess(new Consumer<List<Wallet>>() {
                    @Override
                    public void accept(List<Wallet> walletList) throws Exception {

                        //save db
                        List<WalletEntity> walletEntities = new ArrayList<>();
                        for(int i = 0; i < walletList.size(); i++) {
                            Wallet wallet = walletList.get(i);
                            WalletEntity walletEntity = wallet.buildWalletInfoEntity();
                            if(i == 1){
                                walletEntity.setShow(true);
                            }
                            walletEntities.add(walletEntity);
                        }
                        WalletDao.insertWalletInfoList(walletEntities);

                        //save cache
                        Wallet subFirstWallet = walletList.get(1);
                        //subFirstWallet.setBackedUpPrompt(true);
                        subFirstWallet.setShow(true);
                        WalletManager.getInstance().addAndSelectedWalletStatusNotice(subFirstWallet);
                        //WalletManager.getInstance().addWallet(subFirstWallet);


                        PreferenceTool.putBoolean(Constants.Preference.KEY_OPERATE_MENU_FLAG, false);
                    }
                })
                .compose(RxUtils.getSingleSchedulerTransformer())
                .compose(RxUtils.bindToLifecycle(getView()))
                .compose(LoadingTransformer.bindToSingleLifecycle(currentActivity()))
                .subscribe(new Consumer<List<Wallet>>() {
                    @Override
                    public void accept(List<Wallet> walletList) throws Exception {
                        if (isViewAttached()) {
                            //EventPublisher.getInstance().sendWalletNumberChangeEvent();
                            BackupWalletActivity.actionStart(currentActivity(), walletList.get(1));
                            currentActivity().finish();
                        }
                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Exception {
                        if (isViewAttached() && throwable instanceof CustomThrowable) {
                            CustomThrowable customThrowable = (CustomThrowable) throwable;
                            if (customThrowable.getDetailMsgRes() != -1) {
                                showLongToast(customThrowable.getDetailMsgRes());
                            }
                        }
                    }
                });

    }

}