Ejemplo n.º 1
0
 public async Task <IEnumerable <DoubleBakingOperation> > GetDoubleBakings(
     AnyOfParameter anyof,
     AccountParameter accuser,
     AccountParameter offender,
     Int32Parameter level,
     DateTimeParameter timestamp,
     SortParameter sort,
     OffsetParameter offset,
     int limit,
     Symbols quote)
 {
     var sql = new SqlBuilder(@"SELECT o.*, b.""Hash"" FROM ""DoubleBakingOps"" AS o INNER JOIN ""Blocks"" as b ON b.""Level"" = o.""Level""")
               .Filter(anyof, x => x == "accuser" ? "AccuserId" : "OffenderId")
               .Filter("AccuserId", accuser, x => "OffenderId")
               .Filter("OffenderId", offender, x => "AccuserId")
               .FilterA(@"o.""Level""", level)
               .FilterA(@"o.""Timestamp""", timestamp)
               .Take(sort, offset, limit, x => x switch
     {
         "level" => ("Id", "Level"),
         "accusedLevel" => ("AccusedLevel", "AccusedLevel"),
         "accuserRewards" => ("AccuserReward", "AccuserReward"),
         "offenderLostDeposits" => ("OffenderLostDeposit", "OffenderLostDeposit"),
         "offenderLostRewards" => ("OffenderLostReward", "OffenderLostReward"),
         "offenderLostFees" => ("OffenderLostFee", "OffenderLostFee"),
         _ => ("Id", "Id")
     }, "o");
 public async Task <IEnumerable <OriginationOperation> > GetOriginations(
     AnyOfParameter anyof,
     AccountParameter initiator,
     AccountParameter sender,
     AccountParameter contractManager,
     AccountParameter contractDelegate,
     AccountParameter originatedContract,
     Int32Parameter typeHash,
     Int32Parameter codeHash,
     Int32Parameter level,
     DateTimeParameter timestamp,
     OperationStatusParameter status,
     SortParameter sort,
     OffsetParameter offset,
     int limit,
     MichelineFormat format,
     Symbols quote,
     bool includeStorage = false,
     bool includeBigmaps = false)
 {
     var sql = new SqlBuilder($@"
         SELECT      o.*, b.""Hash""
         FROM        ""OriginationOps"" AS o
         INNER JOIN  ""Blocks"" as b
                 ON  b.""Level"" = o.""Level""
         {(typeHash != null || codeHash != null ? @"LEFT JOIN ""Accounts"" as c ON c.""Id"" = o.""ContractId""" : "")}")
               .Filter(anyof, x => x switch
     {
         "initiator" => "InitiatorId",
         "sender" => "SenderId",
         "contractManager" => "ManagerId",
         "contractDelegate" => "DelegateId",
         _ => "ContractId"
     })
 public async Task <IEnumerable <DelegationOperation> > GetDelegations(
     AnyOfParameter anyof,
     AccountParameter initiator,
     AccountParameter sender,
     AccountParameter prevDelegate,
     AccountParameter newDelegate,
     Int32Parameter level,
     DateTimeParameter timestamp,
     OperationStatusParameter status,
     SortParameter sort,
     OffsetParameter offset,
     int limit,
     Symbols quote)
 {
     var sql = new SqlBuilder(@"SELECT o.*, b.""Hash"" FROM ""DelegationOps"" AS o INNER JOIN ""Blocks"" as b ON b.""Level"" = o.""Level""")
               .Filter(anyof, x => x switch
     {
         "initiator" => "InitiatorId",
         "sender" => "SenderId",
         "prevDelegate" => "PrevDelegateId",
         _ => "DelegateId"
     })