Exemplo n.º 1
0
 static PreendorsementContent UnforgePreendorsement(ForgedReader reader)
 {
     return(new PreendorsementContent
     {
         Slot = reader.ReadInt32(2),
         Level = reader.ReadInt32(),
         Round = reader.ReadInt32(),
         PayloadHash = reader.ReadBase58(32, Prefix.vh)
     });
 }
Exemplo n.º 2
0
 static EndorsementContent UnforgeEndorsement(ForgedReader reader)
 {
     return(new EndorsementContent
     {
         Level = reader.ReadInt32()
     });
 }
 static SeedNonceRevelationContent UnforgeSeedNonceRevelaion(ForgedReader reader)
 {
     return(new SeedNonceRevelationContent
     {
         Level = reader.ReadInt32(),
         Nonce = Hex.Convert(reader.ReadBytes(Lengths.nce.Decoded))
     });
 }
 static ProposalsContent UnforgeProposals(ForgedReader reader)
 {
     return(new ProposalsContent
     {
         Source = reader.ReadTzAddress(),
         Period = reader.ReadInt32(),
         Proposals = reader.ReadEnumerable(r => r.ReadBase58(Lengths.P.Decoded, Prefix.P)).ToList()
     });
 }
 static BlockHeader UnforgeBlockHeader(ForgedReader reader)
 {
     return(new BlockHeader
     {
         Level = reader.ReadInt32(),
         Proto = reader.ReadInt32(1),
         Predecessor = reader.ReadBase58(Lengths.B.Decoded, Prefix.B),
         Timestamp = DateTimeExtension.FromUnixTime(reader.ReadInt64()),
         ValidationPass = reader.ReadInt32(1),
         OperationsHash = reader.ReadBase58(Lengths.LLo.Decoded, Prefix.LLo),
         Fitness = reader.ReadEnumerable(r => r.ReadHexString()).ToList(),
         Context = reader.ReadBase58(Lengths.Co.Decoded, Prefix.Co),
         Priority = reader.ReadInt32(2),
         ProofOfWorkNonce = Hex.Convert(reader.ReadBytes(8)),
         SeedNonceHash = UnforgeSeedNonce(reader),
         Signature = reader.ReadBase58(Lengths.sig.Decoded, Prefix.sig),
     });
 }
 static BallotContent UnforgeBallot(ForgedReader reader)
 {
     return(new BallotContent
     {
         Source = reader.ReadTzAddress(),
         Period = reader.ReadInt32(),
         Proposal = reader.ReadBase58(Lengths.P.Decoded, Prefix.P),
         Ballot = (Ballot)reader.ReadByte()
     });
 }
        static string UnforgeEntrypoint(ForgedReader reader)
        {
            var ep = reader.ReadInt32(1);

            switch (ep)
            {
            case 0: return("default");

            case 1: return("root");

            case 2: return("do");

            case 3: return("set_delegate");

            case 4: return("remove_delegate");

            case 255: return(reader.ReadString(1));

            default: throw new ArgumentException($"Unrecognized endpoint type {ep}");
            }
        }