net.bither.bitherj.api.http.BitherUrl Java Examples

The following examples show how to use net.bither.bitherj.api.http.BitherUrl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AboutPanel.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
private Action getLaunchBrowserAction() {

        return new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {

                try {
                    String url = BitherUrl.BITHER_DNS.BITHER_URL;
                    ViewUtil.openURI(new URI(url));
                } catch (Exception e1) {
                    e1.printStackTrace();
                }

            }
        };
    }
 
Example #2
Source File: AboutPanel.java    From bither-desktop-java with Apache License 2.0 6 votes vote down vote up
private Action getLaunchBrowserAction() {

        return new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {

                try {
                    String url = BitherUrl.BITHER_DNS.BITHER_URL;
                    ViewUtil.openURI(new URI(url));
                } catch (Exception e1) {
                    e1.printStackTrace();
                }

            }
        };
    }
 
Example #3
Source File: UploadHDMBidApi.java    From bitherj with Apache License 2.0 5 votes vote down vote up
public UploadHDMBidApi(String address, String hotAddress, byte[] signature, byte[] password) {
    String url = Utils.format(BitherUrl.BITHER_HDM_PASSWORD, address);
    setUrl(url);
    this.signature = signature;
    this.password = password;
    this.hotAddress = hotAddress;

}
 
Example #4
Source File: DownloadAvatarRunnable.java    From bither-android with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
    String avatar = AppSharedPreference.getInstance().getUserAvatar();
    if (!Utils.isEmpty(avatar)) {
        try {
            File file = ImageFileUtil.getSmallAvatarFile(avatar);
            if (!file.exists()) {
                DownloadFile downloadFile = new DownloadFile();
                downloadFile.downloadFile(BitherUrl.BITHER_DOWNLOAD_AVATAR, file);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
Example #5
Source File: DialogHdAccountOldAddresses.java    From bither-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View v) {
    dismiss();
    switch (v.getId()) {
        case R.id.fl_address:
            StringUtil.copyString(address);
            showMsg(R.string.copy_address_success);
            break;
        case R.id.ibtn_view_on_net:
            new DialogWithActions(activity) {
                @Override
                protected List<Action> getActions() {
                    ArrayList<Action> actions = new ArrayList<Action>();
                    actions.add(new Action(R.string
                            .address_option_view_on_blockchain_info, new Runnable() {
                        @Override
                        public void run() {
                            UIUtil.gotoBrower(activity, BitherUrl
                                    .BLOCKCHAIN_INFO_ADDRESS_URL + address);
                        }
                    }));

                    String defaultCountry = Locale.getDefault().getCountry();
                    if (Utils.compareString(defaultCountry, "CN") || Utils.compareString
                            (defaultCountry, "cn")) {
                        actions.add(new Action(R.string.address_option_view_on_btc,
                                new Runnable() {
                            @Override
                            public void run() {
                                UIUtil.gotoBrower(activity, BitherUrl
                                        .BTC_COM_ADDRESS_URL + address);
                            }
                        }));
                    }
                    return actions;
                }
            }.show();
            break;
    }
}
 
Example #6
Source File: EnterpriseHDMAddressDetailActivity.java    From bither-android with Apache License 2.0 5 votes vote down vote up
@Override
protected void optionClicked() {
    new DialogWithActions(this) {

        @Override
        protected List<Action> getActions() {
            ArrayList<Action> actions = new ArrayList<Action>();
            actions.add(new Action(R.string.address_option_view_on_blockchain_info, new
                    Runnable() {
                @Override
                public void run() {
                    UIUtil.gotoBrower(EnterpriseHDMAddressDetailActivity.this, BitherUrl
                            .BLOCKCHAIN_INFO_ADDRESS_URL + address.getAddress());
                }
            }));
            String defaultCountry = Locale.getDefault().getCountry();
            if (Utils.compareString(defaultCountry, "CN") || Utils.compareString
                    (defaultCountry, "cn")) {
                actions.add(new Action(R.string.address_option_view_on_btc, new
                        Runnable() {
                    @Override
                    public void run() {
                        UIUtil.gotoBrower(EnterpriseHDMAddressDetailActivity.this, BitherUrl
                                .BTC_COM_ADDRESS_URL + address.getAddress());
                    }
                }));
            }
            return actions;
        }
    }.show();
}
 
Example #7
Source File: RecoveryHDMApi.java    From bitherj with Apache License 2.0 5 votes vote down vote up
public RecoveryHDMApi(String address, byte[] signature, byte[] password) {
    String url = Utils.format(BitherUrl.BITHER_REVOCERY_HDM, address);
    setUrl(url);
    this.signature = signature;
    this.password = password;


}
 
Example #8
Source File: SignatureHDMApi.java    From bitherj with Apache License 2.0 5 votes vote down vote up
public SignatureHDMApi(String address, int index, byte[] password, List<byte[]> unSigns) {
    String url = Utils.format(BitherUrl.BITHER_HDM_SIGNATURE, address, index);
    setUrl(url);
    this.password = password;
    this.unSigns = unSigns;

}
 
Example #9
Source File: BitherMytransactionsApi.java    From bitherj with Apache License 2.0 5 votes vote down vote up
public BitherMytransactionsApi(String address, int page) {
    String url = Utils.format(BitherUrl.BITHER_Q_MYTRANSACTIONS,
            address);
    if (page > 0) {
        url = url + "/p/" + page;
    }
    setUrl(url);
}
 
Example #10
Source File: BlockChainMytransactionsApi.java    From bitherj with Apache License 2.0 4 votes vote down vote up
public BlockChainMytransactionsApi(String address) {
    String url = Utils.format(BitherUrl.BITHER_BC_GET_BY_ADDRESS, address);
    setUrl(url);
}
 
Example #11
Source File: GetCookieApi.java    From bitherj with Apache License 2.0 4 votes vote down vote up
public GetCookieApi() {
    setUrl(BitherUrl.BITHER_GET_COOKIE_URL);
    setHttpType(HttpType.GetBitherCookie);
}
 
Example #12
Source File: GetExchangeTickerApi.java    From bitherj with Apache License 2.0 4 votes vote down vote up
public GetExchangeTickerApi() {
    setUrl(BitherUrl.BITHER_EXCHANGE_TICKER);
}
 
Example #13
Source File: BitherErrorApi.java    From bitherj with Apache License 2.0 4 votes vote down vote up
public BitherErrorApi(String errorMsg) {
    this.mErrorMsg = errorMsg;
    setUrl(BitherUrl.BITHER_ERROR_API);
}
 
Example #14
Source File: UploadAvatarApi.java    From bitherj with Apache License 2.0 4 votes vote down vote up
public UploadAvatarApi(File file) {
    this.mFile = file;
    setUrl(BitherUrl.BITHER_UPLOAD_AVATAR);
}
 
Example #15
Source File: BlockChainMytransactionsApi.java    From bitherj with Apache License 2.0 4 votes vote down vote up
public BlockChainMytransactionsApi() {
    setUrl(BitherUrl.BITHER_BC_LATEST_BLOCK);
}
 
Example #16
Source File: BlockChainMytransactionsApi.java    From bitherj with Apache License 2.0 4 votes vote down vote up
public BlockChainMytransactionsApi(int txIndex) {
    String url = String.format(BitherUrl.BITHER_BC_TX_INDEX, txIndex);
    setUrl(url);
}
 
Example #17
Source File: GetExchangeDepthApi.java    From bitherj with Apache License 2.0 4 votes vote down vote up
public GetExchangeDepthApi(BitherjSettings.MarketType marketType) {

        String url = Utils.format(BitherUrl.BITHER_DEPTH_URL,
                BitherjSettings.getMarketValue(marketType));
        setUrl(url);
    }
 
Example #18
Source File: ShowTransactionsForm.java    From bither-desktop-java with Apache License 2.0 4 votes vote down vote up
private JPanel createTxDetailButtonPanel() {
        JPanel buttonPanel = new JPanel();
        buttonPanel.setLayout(new GridBagLayout());

        GridBagConstraints constraints = new GridBagConstraints();

        buttonPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, SystemColor.windowBorder));
        buttonPanel.setOpaque(true);
        buttonPanel.setBackground(Themes.currentTheme.detailPanelBackground());
        buttonPanel.setComponentOrientation(ComponentOrientation.getOrientation(LocaliserUtils.getLocale()));


        showTransactionDetailsAction = new ShowTransactionDetailsAction(this);
        showTransactionsButton = Buttons.newLaunchBrowserButton(showTransactionDetailsAction
                , MessageKey.TRANSCATION);
        showTransactionsButton.setEnabled(false);
        constraints.fill = GridBagConstraints.NONE;
        constraints.gridx = 1;
        constraints.gridy = 0;
        constraints.weightx = 0.1;
        constraints.weighty = 1.0;
        constraints.gridwidth = 1;
        constraints.gridheight = 1;
        constraints.anchor = GridBagConstraints.LINE_START;
        buttonPanel.add(showTransactionsButton, constraints);


        btnAddress = Buttons.newLaunchBrowserButton(new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    String url = BitherUrl.BLOCKCHAIN_INFO_ADDRESS_URL + Bither.getActionAddress().getAddress();
                    ViewUtil.openURI(new URI(url));
                } catch (URISyntaxException ie) {
                    ie.printStackTrace();
                }

            }
        }, MessageKey.ADDRESS);
        if (Bither.getActionAddress() == null) {
            btnAddress.setEnabled(false);
        }


        constraints.fill = GridBagConstraints.NONE;
        constraints.gridx = 2;
        constraints.gridy = 0;
        constraints.weightx = 0.1;
        constraints.weighty = 1.0;
        constraints.gridwidth = 1;
        constraints.gridheight = 1;
        constraints.anchor = GridBagConstraints.LINE_END;
        buttonPanel.add(btnAddress, constraints);


//        JPanel fill1 = new JPanel();
//        fill1.setOpaque(false);
//        constraints.fill = GridBagConstraints.HORIZONTAL;
//        constraints.gridx = 3;
//        constraints.gridy = 0;
//        constraints.weightx = 200;
//        constraints.weighty = 1;
//        constraints.gridwidth = 1;
//        constraints.gridheight = 1;
//        constraints.anchor = GridBagConstraints.CENTER;
//        buttonPanel.add(fill1, constraints);

        return buttonPanel;
    }
 
Example #19
Source File: DownloadSpvApi.java    From bitherj with Apache License 2.0 4 votes vote down vote up
public DownloadSpvApi() {
    setUrl(BitherUrl.BITHER_GET_ONE_SPVBLOCK_API);
}
 
Example #20
Source File: BlockChainDownloadSpvApi.java    From bitherj with Apache License 2.0 4 votes vote down vote up
public BlockChainDownloadSpvApi (int height){
    String url = Utils.format(BitherUrl.BLOCKCHAIN_INFO_GET_SPVBLOCK_API, height);
    setUrl(url);
}
 
Example #21
Source File: BlockChainGetLatestBlockApi.java    From bitherj with Apache License 2.0 4 votes vote down vote up
public BlockChainGetLatestBlockApi(){
    setUrl(BitherUrl.BLOCKCHAIN_INFO_GET_LASTST_BLOCK);
}
 
Example #22
Source File: GetExchangeTrendApi.java    From bitherj with Apache License 2.0 4 votes vote down vote up
public GetExchangeTrendApi(BitherjSettings.MarketType marketType) {
    String url = Utils.format(BitherUrl.BITHER_TREND_URL,
            BitherjSettings.getMarketValue(marketType));
    setUrl(url);

}
 
Example #23
Source File: GetHDMBIdRandomApi.java    From bitherj with Apache License 2.0 4 votes vote down vote up
public GetHDMBIdRandomApi(String address) {
    String url = Utils.format(BitherUrl.BITHER_HDM_PASSWORD, address);
    setUrl(url);
}
 
Example #24
Source File: GetInSignaturesApi.java    From bitherj with Apache License 2.0 4 votes vote down vote up
public GetInSignaturesApi(String address, int fromBlock) {
    String url = Utils.format(BitherUrl.BITHER_IN_SIGNATURES_API, address, fromBlock);
    setUrl(url);
}
 
Example #25
Source File: DialogAddressWithPrivateKeyOption.java    From bither-android with Apache License 2.0 4 votes vote down vote up
@Override
protected List<Action> getActions() {
    ArrayList<Action> actions = new ArrayList<Action>();
    actions.add(new Action(R.string.address_option_view_on_blockchain_info, new Runnable() {
        @Override
        public void run() {
            UIUtil.gotoBrower(activity, BitherUrl.BLOCKCHAIN_INFO_ADDRESS_URL + address
                    .getAddress());
        }
    }));
    String defaultCountry = Locale.getDefault().getCountry();
    if (Utils.compareString(defaultCountry, "CN") || Utils.compareString(defaultCountry,
            "cn")) {
        actions.add(new Action(R.string.address_option_view_on_btc, new Runnable() {
            @Override
            public void run() {
                UIUtil.gotoBrower(activity, BitherUrl.BTC_COM_ADDRESS_URL + address
                        .getAddress());
            }
        }));
    }
    actions.add(new Action(R.string.private_key_management, new Runnable() {
        @Override
        public void run() {
            new DialogAddressWithShowPrivateKey(activity, address, null).show();
        }
    }));
    actions.add(new Action(R.string.sign_message_activity_name, new Runnable() {
        @Override
        public void run() {
            Intent intent = new Intent(activity, SignMessageActivity.class);
            intent.putExtra(SignMessageActivity.AddressKey, address.getAddress());
            activity.startActivity(intent);
        }
    }));
    actions.add(new Action(R.string.address_alias_manage, new Runnable() {
        @Override
        public void run() {
            new DialogAddressAlias(activity, address,
                    activity instanceof AddressDetailActivity ? (AddressDetailActivity)
                            activity : null).show();
        }
    }));
    actions.add(new Action(R.string.vanity_address_length, new Runnable() {
        @Override
        public void run() {
            new DialogEditVanityLength(activity, address).show();
        }
    }));
    return actions;
}
 
Example #26
Source File: DialogAddressWatchOnlyOption.java    From bither-android with Apache License 2.0 4 votes vote down vote up
@Override
protected List<Action> getActions() {
    ArrayList<Action> actions = new ArrayList<Action>();
    actions.add(new Action(R.string.address_option_view_on_blockchain_info, new Runnable() {
        @Override
        public void run() {
            UIUtil.gotoBrower(activity, BitherUrl.BLOCKCHAIN_INFO_ADDRESS_URL + address
                    .getAddress());
        }
    }));
    String defaultCountry = Locale.getDefault().getCountry();
    if (Utils.compareString(defaultCountry, "CN") || Utils.compareString(defaultCountry,
            "cn")) {
        actions.add(new Action(R.string.address_option_view_on_btc, new Runnable() {
            @Override
            public void run() {
                UIUtil.gotoBrower(activity, BitherUrl.BTC_COM_ADDRESS_URL + address
                        .getAddress());
            }
        }));
    }
    actions.add(new Action(R.string.address_alias_manage, new Runnable() {
        @Override
        public void run() {
            new DialogAddressAlias(activity, address,
                    activity instanceof AddressDetailActivity ? (AddressDetailActivity)
                            activity : null).show();
        }
    }));
    actions.add(new Action(R.string.vanity_address_length, new Runnable() {
        @Override
        public void run() {
            new DialogEditVanityLength(activity, address).show();
        }
    }));
    actions.add(new Action(R.string.address_option_delete, new Runnable() {
        @Override
        public void run() {
            new DialogConfirmTask(getContext(), getContext().getString(R.string
                    .address_delete_confirmation), new Runnable() {
                @Override
                public void run() {
                    activity.runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            DialogProgress dp = new DialogProgress(activity,
                                    R.string.please_wait);
                            dp.show();
                            ThreadNeedService threadNeedService = new ThreadNeedService(dp,
                                    activity) {
                                @Override
                                public void runWithService(BlockchainService service) {
                                    KeyUtil.stopMonitor(service, address);
                                    activity.runOnUiThread(new Runnable() {
                                        @Override
                                        public void run() {
                                            dp.dismiss();
                                            afterDelete.run();
                                            Fragment f = BitherApplication.hotActivity
                                                    .getFragmentAtIndex(1);
                                            if (f instanceof HotAddressFragment) {
                                                HotAddressFragment hotAddressFragment =
                                                        (HotAddressFragment) f;
                                                hotAddressFragment.refresh();
                                            }
                                        }
                                    });
                                }
                            };
                            threadNeedService.start();
                        }
                    });
                }
            }).show();
        }
    }));
    return actions;
}
 
Example #27
Source File: TrashCanActivity.java    From bither-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onClick(View v) {
    new DialogWithActions(v.getContext()) {

        @Override
        protected List<Action> getActions() {
            ArrayList<Action> actions = new ArrayList<Action>();
            actions.add(new Action(R.string.address_option_view_on_blockchain_info,
                    new Runnable() {
                @Override
                public void run() {
                    UIUtil.gotoBrower(TrashCanActivity.this,
                            BitherUrl.BLOCKCHAIN_INFO_ADDRESS_URL + address
                                    .getAddress());
                }
            }));

            String defaultCountry = Locale.getDefault().getCountry();
            if (Utils.compareString(defaultCountry, "CN") || Utils.compareString
                    (defaultCountry, "cn")) {
                actions.add(new Action(R.string.address_option_view_on_btc,
                        new Runnable() {
                    @Override
                    public void run() {
                        UIUtil.gotoBrower(TrashCanActivity.this,
                                BitherUrl.BTC_COM_ADDRESS_URL + address.getAddress());
                    }
                }));
            }

            actions.add(new Action(R.string.address_alias_manage, new Runnable() {
                @Override
                public void run() {
                    new DialogAddressAlias(TrashCanActivity.this, address,
                            delegate).show();
                }
            }));
            return actions;
        }
    }.show();
}
 
Example #28
Source File: ShowTransactionsForm.java    From bither-desktop-java with Apache License 2.0 4 votes vote down vote up
private JPanel createTxDetailButtonPanel() {
        JPanel buttonPanel = new JPanel();
        buttonPanel.setLayout(new GridBagLayout());

        GridBagConstraints constraints = new GridBagConstraints();

        buttonPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, SystemColor.windowBorder));
        buttonPanel.setOpaque(true);
        buttonPanel.setBackground(Themes.currentTheme.detailPanelBackground());
        buttonPanel.setComponentOrientation(ComponentOrientation.getOrientation(LocaliserUtils.getLocale()));


        showTransactionDetailsAction = new ShowTransactionDetailsAction(this);
        showTransactionsButton = Buttons.newLaunchBrowserButton(showTransactionDetailsAction
                , MessageKey.TRANSCATION);
        showTransactionsButton.setEnabled(false);
        constraints.fill = GridBagConstraints.NONE;
        constraints.gridx = 1;
        constraints.gridy = 0;
        constraints.weightx = 0.1;
        constraints.weighty = 1.0;
        constraints.gridwidth = 1;
        constraints.gridheight = 1;
        constraints.anchor = GridBagConstraints.LINE_START;
        buttonPanel.add(showTransactionsButton, constraints);


        btnAddress = Buttons.newLaunchBrowserButton(new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    String url = BitherUrl.BLOCKCHAIN_INFO_ADDRESS_URL + Bither.getActionAddress().getAddress();
                    ViewUtil.openURI(new URI(url));
                } catch (URISyntaxException ie) {
                    ie.printStackTrace();
                }

            }
        }, MessageKey.ADDRESS);
        if (Bither.getActionAddress() == null) {
            btnAddress.setEnabled(false);
        }


        constraints.fill = GridBagConstraints.NONE;
        constraints.gridx = 2;
        constraints.gridy = 0;
        constraints.weightx = 0.1;
        constraints.weighty = 1.0;
        constraints.gridwidth = 1;
        constraints.gridheight = 1;
        constraints.anchor = GridBagConstraints.LINE_END;
        buttonPanel.add(btnAddress, constraints);


//        JPanel fill1 = new JPanel();
//        fill1.setOpaque(false);
//        constraints.fill = GridBagConstraints.HORIZONTAL;
//        constraints.gridx = 3;
//        constraints.gridy = 0;
//        constraints.weightx = 200;
//        constraints.weighty = 1;
//        constraints.gridwidth = 1;
//        constraints.gridheight = 1;
//        constraints.anchor = GridBagConstraints.CENTER;
//        buttonPanel.add(fill1, constraints);

        return buttonPanel;
    }
 
Example #29
Source File: GetKlineApi.java    From bitherj with Apache License 2.0 3 votes vote down vote up
public GetKlineApi(BitherjSettings.MarketType marketType, BitherjSettings.KlineTimeType klineTimeType) {

        String url = Utils.format(BitherUrl.BITHER_KLINE_URL,
                BitherjSettings.getMarketValue(marketType), klineTimeType.getValue());
        setUrl(url);

    }
 
Example #30
Source File: GetBlockCountApi.java    From bitherj with Apache License 2.0 2 votes vote down vote up
public GetBlockCountApi() {
    setUrl(BitherUrl.BITHER_Q_GETBLOCK_COUNT_URL);

}