/** * @param Parser $parser * @return TransactionInput * @throws \BitWasp\Buffertools\Exceptions\ParserOutOfRange */ public function fromParser(Parser $parser) { $outpoint = $this->outpointSerializer->fromParser($parser); /** * @var Buffer $scriptBuf * @var int|string $sequence */ list($scriptBuf, $sequence) = $this->getInputTemplate()->parse($parser); return new TransactionInput($outpoint, new Script($scriptBuf), $sequence); }
/** * @param Parser $parser * @return array|OutPointInterface */ public function fromParser(Parser $parser) { $buffer = $parser->getBuffer(); if ($buffer->getSize() > 36) { $buffer = $buffer->slice(0, 36); if (isset($this->cachedStr[$buffer->getBinary()])) { $this->cached++; return $this->cachedStr[$buffer->getBinary()]; } } $parsed = $this->serializer->fromParser($parser); $this->parse++; return $parsed; }