public void Encode(RlpStream stream, UserOperationWithEntryPoint?opWithEntryPoint, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { if (opWithEntryPoint is null) { stream.EncodeNullObject(); return; } int contentLength = GetContentLength(opWithEntryPoint); UserOperation op = opWithEntryPoint.UserOperation; Address entryPoint = opWithEntryPoint.EntryPoint; stream.StartSequence(contentLength); stream.Encode(op.Sender); stream.Encode(op.Nonce); stream.Encode(op.InitCode); stream.Encode(op.CallData); stream.Encode(op.CallGas); stream.Encode(op.VerificationGas); stream.Encode(op.PreVerificationGas); stream.Encode(op.MaxFeePerGas); stream.Encode(op.MaxPriorityFeePerGas); stream.Encode(op.Paymaster); stream.Encode(op.PaymasterData); stream.Encode(op.Signature); stream.Encode(entryPoint); }
public void Encode(RlpStream stream, ValidatorInfo?item, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { if (item == null) { stream.EncodeNullObject(); return; } var(contentLength, validatorLength) = GetContentLength(item, rlpBehaviors); stream.StartSequence(contentLength); stream.Encode(item.FinalizingBlockNumber); stream.Encode(item.PreviousFinalizingBlockNumber); stream.StartSequence(validatorLength); for (int i = 0; i < item.Validators.Length; i++) { stream.Encode(item.Validators[i]); } }