Giter Site home page Giter Site logo

eos_pocket_test's Introduction

EOS 钱包测试

包含从助记词导入,私钥导入,交易转账,RAM买卖,NET,CPU抵押赎回

助记词,私钥导入

详情见
eos_pocket_test/ImportAccountActivity.java

交易转账,RAM买卖,NET,CPU抵押赎回

交易转账详情见:
eos_pocket_test/TransactionActivity.java


EosDataManger manager = new EosDataManger(new EosDataManger.Callback() {
			@Override
			public void getResult(PushTxSuccessBean result) {

			}
		});
		String memo = mEdMemo.getText().toString();
		String receiveAccount = mTvReceiveAccount.getText().toString();
		String quantity = StringUtils.addZero(mEdAmount.getText().toString().trim());
		String account = (String) SPUtils.get("account", "null");
		String json = Convert.toJson(new TransferEosMessageBean( memo ,receiveAccount, quantity+" EOS", account));
		manager.pushAction(json,account);



RAM买卖

详情见:
eos_pocket_test/BuyOrSaleRamActivity.java


//=========================买ram===================================
				String trim = mEdBuyForSomebody.getText().toString().trim();
				String account = (String) SPUtils.get("account", "null");
				BuyRamBean buyRamBean = new BuyRamBean();
				buyRamBean.setPayer(account);//付款方
				buyRamBean.setReceiver(trim);//接收方
				buyRamBean.setQuant(mEdBuyAmountEos.getText().toString()+" EOS");//数量,保留4位小数
				new PushDatamanger(new PushDatamanger.Callback() {
					@Override
					public void getResult(PushTxSuccessBean result) {
						if (result!=null) {
							ToastUtil.toast(result.getTransaction_id());


						} else {

							ToastUtil.toast("失败");

						}
					}
				}).pushAction("eosio","buyram", new Gson().toJson(buyRamBean),account);


//============================卖RAM=======================================
				String account_sale = (String) SPUtils.get("account", "null");
				String saleBytesAmount = mEdSaleAmountEos.getText().toString().trim();
				SealRamBean sealRamBean = new SealRamBean();
				sealRamBean.setAccount(account_sale);//账户名字
//				sealRamBean.setAccount("useraaaaaaac");//账户名字
				sealRamBean.setBytes(new BigDecimal(saleBytesAmount).intValue());
				new PushDatamanger(new PushDatamanger.Callback() {
					@Override
					public void getResult(PushTxSuccessBean result) {
						if (result!=null) {
							ToastUtil.toast(result.getTransaction_id());


						} else {

							ToastUtil.toast("失败");

						}
					}
				}).pushAction("eosio","sellram", new Gson().toJson(sealRamBean),account_sale);



NET,CPU抵押赎回

	//==============================抵押CPU,NET======================================
				String account_stake = (String) SPUtils.get("account", "null");
				StakeResourceBean stakeResourceBean = new StakeResourceBean();
				stakeResourceBean.setFrom(account_stake);
				stakeResourceBean.setReceiver("useraaaaaaac");
				stakeResourceBean.setStake_cpu_quantity("1.0000 EOS");
				stakeResourceBean.setStake_net_quantity("1.0000 EOS");
				stakeResourceBean.setTransfer("0");//抵押的钱,0代表自己所有(我借给你,回头我还能赎回)1:代表抵押的钱送给对方了,不能赎回了

				new PushDatamanger(new PushDatamanger.Callback() {
					@Override
					public void getResult(PushTxSuccessBean result) {
						if (result!=null) {
							ToastUtil.toast(result.getTransaction_id());


						} else {

							ToastUtil.toast("失败");

						}


					}
				}).pushAction("eosio","delegatebw",new Gson().toJson(stakeResourceBean),account_stake);

    //============================赎回CPU,NET=======================================
				String account_unstake = (String) SPUtils.get("account", "null");
				UnDelegateBean unDelegateBean = new UnDelegateBean();

				unDelegateBean.setFrom(account_unstake);
				unDelegateBean.setReceiver("useraaaaaaac");
				unDelegateBean.setUnstake_cpu_quantity("1.0000 EOS");
				unDelegateBean.setUnstake_net_quantity("1.0000 EOS");
				new PushDatamanger(new PushDatamanger.Callback() {
					@Override
					public void getResult(PushTxSuccessBean result) {




					}
				}).pushAction("eosio", "undelegatebw", new Gson().toJson(unDelegateBean), account_unstake);

eos_pocket_test's People

Contributors

yywishp avatar

Watchers

hello avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.