private Binder queryFollowerInfo(Binder params, Session session) throws IOException { checkNode(session, true); Binder res = new Binder(); res.set("follower_state", null); byte[] follower_id = params.getBinary("follower_id"); byte[] followerBin = node.getLedger().getSmartContractById(HashId.withDigest(follower_id)); if (followerBin != null) { FollowerContract followerContract = (FollowerContract) Contract.fromPackedTransaction(followerBin); res.set("follower_state", followerContract.getStateData()); } return res; }
private Binder querySlotInfo(Binder params, Session session) throws IOException { checkNode(session, true); Binder res = new Binder(); res.set("slot_state", null); byte[] slot_id = params.getBinary("slot_id"); byte[] slotBin = node.getLedger().getSmartContractById(HashId.withDigest(slot_id)); if (slotBin != null) { SlotContract slotContract = (SlotContract) Contract.fromPackedTransaction(slotBin); res.set("slot_state", slotContract.getStateData()); } return res; }
if ((origin_id != null) && (contract_id != null)) throw new IOException("invalid arguments (only one origin_id or contract_id is allowed)"); byte[] slotBin = node.getLedger().getSmartContractById(HashId.withDigest(slot_id)); if (slotBin != null) { SlotContract slotContract = (SlotContract) Contract.fromPackedTransaction(slotBin);
NImmutableEnvironment env = n.getLedger().getEnvironment(slotContract.getId()); assertNotNull(n.getLedger().getSmartContractById(slotContract.getId())); assertNull(n.getLedger().getSmartContractById(slotContract.getId()));
assertNotNull(n.getLedger().getSmartContractById(uns.getId())); assertNull(n.getLedger().getSmartContractById(uns.getId()));