@test public void testoffercanceltxsign() { ikeypair kp = seed.getkeypair(seed_2); offercancel txn = new offercancel(); // set sender txn.account(accountid.fromseedbytes(b58.getinstance().decodefamilyseed(seed_2))); txn.offersequence(new uint32(14)); // account_offers.seq signedtransaction sign = new signedtransaction(txn); // param 2 is tx fee; param 3 is account_info.sequence returned sign.prepare(kp, amount.fromstring("15"), new uint32(15), null); system.out.println("blob:" + sign.tx_blob); system.out.println("hash:" + sign.hash); system.out.println("txn_type:" + sign.transactiontype()); }
@test public void testcreateaddrefereesign() throws exception { ikeypair kp = seed.getkeypair(seed_2); addreferee txn = new addreferee(); // set sender, aka invite target txn.account(accountid.fromseedbytes(b58.getinstance().decodefamilyseed(seed_2))); // set target, aka invite source txn.destination(dest2); signedtransaction sign = new signedtransaction(txn); // param 2 is tx fee; param 3 is account_info.sequence returned sign.prepare(kp, amount.fromstring("15"), new uint32(13), null); system.out.println("blob:" + sign.tx_blob); system.out.println("hash:" + sign.hash); system.out.println("txn_type:" + sign.transactiontype()); }
@test public void testoffercreatetxsign() { ikeypair kp = seed.getkeypair(seed_2); offercreate txn = new offercreate(); // set sender txn.account(accountid.fromseedbytes(b58.getinstance().decodefamilyseed(seed_2))); // other currency, need not * 10^6 txn.takergets(new amount(new bigdecimal("10"), currency.fromstring("dnc"), dest2)); txn.takerpays(amount.fromstring("20000000")); signedtransaction sign = new signedtransaction(txn); // param 2 is tx fee; param 3 is account_info.sequence returned sign.prepare(kp, amount.fromstring("15"), new uint32(14), null); system.out.println("blob:" + sign.tx_blob); system.out.println("hash:" + sign.hash); system.out.println("txn_type:" + sign.transactiontype()); }
@test public void testtrustsettxsign() { ikeypair kp = seed.getkeypair(seed_2); trustset txn = new trustset(); // set sender txn.account(accountid.fromseedbytes(b58.getinstance().decodefamilyseed(seed_2))); // set trustlimit. note, amount unit must be integer. amount limitamount = new amount(new bigdecimal("10000"), currency.fromstring("cny"), addrcnygateway); txn.limitamount(limitamount); signedtransaction sign = new signedtransaction(txn); // param 2 is tx fee; param 3 is account_info.sequence returned sign.prepare(kp, amount.fromstring("15"), new uint32(17), null); system.out.println("blob:" + sign.tx_blob); system.out.println("hash:" + sign.hash); system.out.println("txn_type:" + sign.transactiontype()); }
@test public void testcreatepaymentvbctxsign() { ikeypair kp = seed.getkeypair(seed_1); payment txn = new payment(); // set the target address of tx txn.destination(destaddr); // set tx fee, vbc unit needs not * 10^6 amount vbc = new amount(new bigdecimal("10000"), currency.vbc, accountid.vbc_0); txn.amount(vbc); // set the sender txn.account(accountid.fromseedbytes(b58.getinstance().decodefamilyseed(seed_1))); signedtransaction sign = new signedtransaction(txn); // param 2 is tx fee; param 3 is account_info.sequence returned sign.prepare(kp, amount.fromstring("15"), new uint32(16), null); system.out.println("blob:" + sign.tx_blob); system.out.println("hash:" + sign.hash); system.out.println("txn_type:" + sign.transactiontype()); system.out.println(txn); }
@test public void testcreatepaymenttxsign() throws exception { ikeypair kp = seed.getkeypair(seed_1); payment txn = new payment(); // set the target address of tx txn.destination(destaddr); // set the amount 0.01 vrp, note: vrp unit needs * 10^6 txn.amount(amount.fromstring("10000")); // set the sender txn.account(accountid.fromseedbytes(b58.getinstance().decodefamilyseed(seed_1))); // signing... signedtransaction sign = new signedtransaction(txn); // param 2 is tx fee; param 3 is account_info.sequence returned sign.prepare(kp, amount.fromstring("10"), new uint32(16), null); system.out.println("blob:" + sign.tx_blob); system.out.println("hash:" + sign.hash); system.out.println("txn_type:" + sign.transactiontype()); system.out.println(txn); }