@Override public void parse(NulsByteBuffer byteBuffer) throws NulsException { this.txHash = byteBuffer.readHash(); this.blockHeight = byteBuffer.readUint32(); this.time = byteBuffer.readUint48(); this.addresses = byteBuffer.readByLengthByte(); this.txType = byteBuffer.readUint16(); this.status = byteBuffer.readByte(); }
@Override public void parse(NulsByteBuffer byteBuffer) throws NulsException { this.preHash = byteBuffer.readHash(); this.merkleHash = byteBuffer.readHash(); this.time = byteBuffer.readVarInt(); this.height = byteBuffer.readVarInt(); this.txCount = byteBuffer.readVarInt(); this.extend = byteBuffer.readByLengthByte(); this.scriptSign = byteBuffer.readNulsData(new BlockSignature()); this.txHashList = new ArrayList<>(); for (int i = 0; i < txCount; i++) { this.txHashList.add(byteBuffer.readHash()); } if (!byteBuffer.isFinished()) { this.stateRoot = byteBuffer.readByLengthByte(); } }
@Override public void parse(NulsByteBuffer byteBuffer) throws NulsException { this.blockHeight=byteBuffer.readInt64(); this.hash=new NulsDigestData( byteBuffer.readByte(),byteBuffer.readByLengthByte()); this.preHash=new NulsDigestData( byteBuffer.readByte(),byteBuffer.readByLengthByte()); int listCount = (int) byteBuffer.readVarInt(); if (0 < listCount) { List<UtxoAccountsBalancePo> list = new ArrayList<>(); for (int i = 0; i < listCount; i++) { list.add(byteBuffer.readNulsData(new UtxoAccountsBalancePo())); } this.balanceList = list; } }
@Override public void parse(NulsByteBuffer byteBuffer) throws NulsException { this.type = byteBuffer.readByte(); this.address = byteBuffer.readBytes(Address.ADDRESS_LENGTH); this.time = byteBuffer.readUint48(); this.height = byteBuffer.readVarInt(); this.roundIndex = byteBuffer.readVarInt(); this.reasonCode = byteBuffer.readShort(); this.evidence = byteBuffer.readByLengthByte(); }
@Override public void parse(NulsByteBuffer byteBuffer) throws NulsException { this.roundIndex = byteBuffer.readUint32(); this.consensusMemberCount = byteBuffer.readUint16(); this.roundStartTime = byteBuffer.readUint48(); this.packingIndexOfRound = byteBuffer.readUint16(); } }
@Override public void parse(NulsByteBuffer byteBuffer) throws NulsException { this.deposit = Na.valueOf(byteBuffer.readInt64()); this.agentHash = byteBuffer.readHash(); this.address = byteBuffer.readBytes(Address.ADDRESS_LENGTH); this.time = byteBuffer.readUint48(); this.txHash = byteBuffer.readHash(); this.blockHeight = byteBuffer.readVarInt(); this.delHeight = byteBuffer.readVarInt(); }
@Override public void parse(NulsByteBuffer byteBuffer) throws NulsException { this.preHash = byteBuffer.readHash(); this.merkleHash = byteBuffer.readHash(); this.time = byteBuffer.readUint48(); this.height = byteBuffer.readUint32(); this.txCount = byteBuffer.readUint32(); this.extend = byteBuffer.readByLengthByte(); try { this.hash = NulsDigestData.calcDigestData(this.serialize()); } catch (IOException e) { Log.error(e); } this.blockSignature = byteBuffer.readNulsData(new BlockSignature()); // } }
@Override public void parse(NulsByteBuffer byteBuffer) throws NulsException { this.roundIndex = byteBuffer.readUint32(); this.consensusMemberCount = byteBuffer.readUint16(); this.roundStartTime = byteBuffer.readUint48(); this.packingIndexOfRound = byteBuffer.readUint16(); if (!byteBuffer.isFinished()) { this.mainVersion = byteBuffer.readInt32(); this.currentVersion = byteBuffer.readInt32(); this.percent = byteBuffer.readUint16(); this.delay = byteBuffer.readUint32(); this.stateRoot = byteBuffer.readByLengthByte(); } }
@Override public void parse(NulsByteBuffer byteBuffer) throws NulsException { this.sender = byteBuffer.readBytes(Address.ADDRESS_LENGTH); this.contractAddress = byteBuffer.readBytes(Address.ADDRESS_LENGTH); this.value = byteBuffer.readInt64(); this.codeLen = byteBuffer.readInt32(); this.code = byteBuffer.readByLengthByte(); this.gasLimit = byteBuffer.readInt64(); this.price = byteBuffer.readInt64(); this.argsCount = byteBuffer.readByte(); byte length = this.argsCount; this.args = new String[length][]; for(byte i = 0; i < length; i++) { byte argCount = byteBuffer.readByte(); if(argCount == 0) { args[i] = new String[0]; } else { String[] arg = new String[argCount]; for(byte k = 0; k < argCount; k++) { arg[k] = byteBuffer.readString(); } args[i] = arg; } } }
@Override public void parse(NulsByteBuffer buffer) throws NulsException { handshakeType = buffer.readUint16(); severPort = buffer.readUint16(); bestBlockHeight = buffer.readUint32(); bestBlockHash = buffer.readHash(); networkTime = buffer.readUint48(); nodeIp = buffer.readString(); version = buffer.readString(); }
public static boolean validNormalAddress(byte[] bytes) { if (null == bytes || bytes.length != Address.ADDRESS_LENGTH) { return false; } NulsByteBuffer byteBuffer = new NulsByteBuffer(bytes); short chainId; byte type; try { chainId = byteBuffer.readShort(); type = byteBuffer.readByte(); } catch (NulsException e) { Log.error(e); return false; } if (NulsContext.getInstance().getDefaultChainId() != chainId) { return false; } if (NulsContext.DEFAULT_ADDRESS_TYPE != type) { return false; } return true; }
@Override public void parse(NulsByteBuffer byteBuffer) throws NulsException { type = byteBuffer.readUint16(); time = byteBuffer.readUint48(); this.remark = byteBuffer.readByLengthByte(); txData = this.parseTxData(byteBuffer); this.coinData = byteBuffer.readNulsData(new CoinData()); /*try { hash = NulsDigestData.calcDigestData(this.serializeForHash()); } catch (IOException e) { Log.error(e); }*/ transactionSignature = byteBuffer.readByLengthByte(); }
public InputDto(Coin input) { NulsByteBuffer byteBuffer = new NulsByteBuffer(input.getOwner()); try { this.fromHash = byteBuffer.readHash().getDigestHex(); this.fromIndex = (int) byteBuffer.readVarInt(); } catch (Exception e) { throw new NulsRuntimeException(e); } this.value = input.getNa().getValue(); }
@Override protected ReactParam parseMessageBody(NulsByteBuffer byteBuffer) throws NulsException { return byteBuffer.readNulsData(new ReactParam()); } }
@Override public void parse(NulsByteBuffer byteBuffer) throws NulsException { this.header = byteBuffer.readNulsData(new BlockHeader()); this.txHashList = new ArrayList<>(); long hashListSize = byteBuffer.readVarInt(); for (int i = 0; i < hashListSize; i++) { this.txHashList.add(byteBuffer.readHash()); } this.subTxList = new ArrayList<>(); long subTxListSize = byteBuffer.readVarInt(); for (int i = 0; i < subTxListSize; i++) { Transaction tx = byteBuffer.readTransaction(); tx.setBlockHeight(header.getHeight()); this.subTxList.add(tx); } }
@Override public void parse(NulsByteBuffer byteBuffer) throws NulsException { this.address = byteBuffer.readBytes(Address.ADDRESS_LENGTH); this.reasonCode = byteBuffer.readByte(); this.evidence = byteBuffer.readByLengthByte(); }
@Override public void parse(NulsByteBuffer byteBuffer) throws NulsException { this.owner = byteBuffer.readByLengthByte(); this.inputBalance=byteBuffer.readInt64(); this.outputBalance=byteBuffer.readInt64(); this.lockedPermanentBalance=byteBuffer.readInt64(); this.unLockedPermanentBalance=byteBuffer.readInt64(); this.contractFromBalance=byteBuffer.readInt64(); this.contractToBalance=byteBuffer.readInt64(); this.blockHeight=byteBuffer.readInt64(); this.txIndex=byteBuffer.readInt32(); int lockedTimeCount = (int) byteBuffer.readVarInt(); if (0 < lockedTimeCount) { List<LockedBalance> timeBalanceList = new ArrayList<>(); for (int i = 0; i < lockedTimeCount; i++) { LockedBalance balance=new LockedBalance(); balance.setLockedTime(byteBuffer.readInt64()); balance.setLockedBalance(byteBuffer.readInt64()); timeBalanceList.add(balance); int lockedHeightCount = (int) byteBuffer.readVarInt(); if (0 < lockedHeightCount) { List<LockedBalance> heightBalanceList = new ArrayList<>(); for (int i = 0; i < lockedHeightCount; i++) { LockedBalance balance=new LockedBalance(); balance.setLockedTime(byteBuffer.readInt64()); balance.setLockedBalance(byteBuffer.readInt64()); heightBalanceList.add(balance);
@Override public void parse(NulsByteBuffer byteBuffer) throws NulsException { this.sender = byteBuffer.readBytes(Address.ADDRESS_LENGTH); this.contractAddress = byteBuffer.readBytes(Address.ADDRESS_LENGTH); this.value = byteBuffer.readInt64(); this.gasLimit = byteBuffer.readInt64(); this.price = byteBuffer.readInt64(); this.methodName = byteBuffer.readString(); this.methodDesc = byteBuffer.readString(); this.argsCount = byteBuffer.readByte(); byte length = this.argsCount; this.args = new String[length][]; for(byte i = 0; i < length; i++) { byte argCount = byteBuffer.readByte(); if(argCount == 0) { args[i] = new String[0]; } else { String[] arg = new String[argCount]; for(byte k = 0; k < argCount; k++) { arg[k] = byteBuffer.readString(); } args[i] = arg; } } }
@Override public Transaction pollTx() { byte[] bytes = queue.poll(); if (null == bytes) { return null; } try { return TransactionManager.getInstance(new NulsByteBuffer(bytes)); } catch (Exception e) { Log.error(e); } return null; } }