diff --git a/graph/generated/generated.go b/graph/generated/generated.go index 7fccbf8..ac36d63 100644 --- a/graph/generated/generated.go +++ b/graph/generated/generated.go @@ -78,6 +78,19 @@ type ComplexityRoot struct { Value func(childComplexity int) int } + Code struct { + CodeID func(childComplexity int) int + Contract func(childComplexity int) int + CreatedAt func(childComplexity int) int + Creator func(childComplexity int) int + DataHash func(childComplexity int) int + InstantiateCount func(childComplexity int) int + Permission func(childComplexity int) int + PermittedAddress func(childComplexity int) int + Txhash func(childComplexity int) int + Version func(childComplexity int) int + } + Commission struct { Commission func(childComplexity int) int } @@ -100,6 +113,23 @@ type ComplexityRoot struct { Type func(childComplexity int) int } + Contract struct { + Admin func(childComplexity int) int + CodeID func(childComplexity int) int + Contract func(childComplexity int) int + ContractAddress func(childComplexity int) int + Creator func(childComplexity int) int + ExecutedCount func(childComplexity int) int + InstantiatedAt func(childComplexity int) int + Label func(childComplexity int) int + LastExecutedAt func(childComplexity int) int + Messages func(childComplexity int) int + Permission func(childComplexity int) int + PermittedAddress func(childComplexity int) int + Txhash func(childComplexity int) int + Version func(childComplexity int) int + } + Delegation struct { Amount func(childComplexity int) int DelegatorAddress func(childComplexity int) int @@ -185,7 +215,13 @@ type ComplexityRoot struct { BlockDetail func(childComplexity int, height *int) int BlockTxs func(childComplexity int, height *int) int Blocks func(childComplexity int, offset *int, size *int) int + CodeContracts func(childComplexity int, codeID int, offset int, size int) int + CodeDetail func(childComplexity int, codeID int) int + CodeTransactions func(childComplexity int, codeID int, before int, size int) int + Codes func(childComplexity int, after int, size int) int Commission func(childComplexity int, operatorAddress string) int + ContractDetail func(childComplexity int, contractAddress string) int + Contracts func(childComplexity int, offset int, size int, keyword *string) int Delegations func(childComplexity int, accAddress string) int Delegators func(childComplexity int, operatorAddress string, offset int) int Deposit func(childComplexity int, proposalID int) int @@ -369,6 +405,12 @@ type QueryResolver interface { Price(ctx context.Context, slug string) (*model.Price, error) StatsAssets(ctx context.Context) ([]*model.StatsAsset, error) Delegators(ctx context.Context, operatorAddress string, offset int) (*model.DelegatorResponse, error) + Codes(ctx context.Context, after int, size int) ([]*model.Code, error) + CodeDetail(ctx context.Context, codeID int) (*model.Code, error) + CodeTransactions(ctx context.Context, codeID int, before int, size int) ([]*model.Tx, error) + CodeContracts(ctx context.Context, codeID int, offset int, size int) ([]*model.Contract, error) + Contracts(ctx context.Context, offset int, size int, keyword *string) ([]*model.Contract, error) + ContractDetail(ctx context.Context, contractAddress string) (*model.Contract, error) } type executableSchema struct { @@ -512,6 +554,76 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Change.Value(childComplexity), true + case "Code.code_id": + if e.complexity.Code.CodeID == nil { + break + } + + return e.complexity.Code.CodeID(childComplexity), true + + case "Code.contract": + if e.complexity.Code.Contract == nil { + break + } + + return e.complexity.Code.Contract(childComplexity), true + + case "Code.created_at": + if e.complexity.Code.CreatedAt == nil { + break + } + + return e.complexity.Code.CreatedAt(childComplexity), true + + case "Code.creator": + if e.complexity.Code.Creator == nil { + break + } + + return e.complexity.Code.Creator(childComplexity), true + + case "Code.data_hash": + if e.complexity.Code.DataHash == nil { + break + } + + return e.complexity.Code.DataHash(childComplexity), true + + case "Code.instantiate_count": + if e.complexity.Code.InstantiateCount == nil { + break + } + + return e.complexity.Code.InstantiateCount(childComplexity), true + + case "Code.permission": + if e.complexity.Code.Permission == nil { + break + } + + return e.complexity.Code.Permission(childComplexity), true + + case "Code.permitted_address": + if e.complexity.Code.PermittedAddress == nil { + break + } + + return e.complexity.Code.PermittedAddress(childComplexity), true + + case "Code.txhash": + if e.complexity.Code.Txhash == nil { + break + } + + return e.complexity.Code.Txhash(childComplexity), true + + case "Code.version": + if e.complexity.Code.Version == nil { + break + } + + return e.complexity.Code.Version(childComplexity), true + case "Commission.commission": if e.complexity.Commission.Commission == nil { break @@ -582,6 +694,104 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Content.Type(childComplexity), true + case "Contract.admin": + if e.complexity.Contract.Admin == nil { + break + } + + return e.complexity.Contract.Admin(childComplexity), true + + case "Contract.code_id": + if e.complexity.Contract.CodeID == nil { + break + } + + return e.complexity.Contract.CodeID(childComplexity), true + + case "Contract.contract": + if e.complexity.Contract.Contract == nil { + break + } + + return e.complexity.Contract.Contract(childComplexity), true + + case "Contract.contract_address": + if e.complexity.Contract.ContractAddress == nil { + break + } + + return e.complexity.Contract.ContractAddress(childComplexity), true + + case "Contract.creator": + if e.complexity.Contract.Creator == nil { + break + } + + return e.complexity.Contract.Creator(childComplexity), true + + case "Contract.executed_count": + if e.complexity.Contract.ExecutedCount == nil { + break + } + + return e.complexity.Contract.ExecutedCount(childComplexity), true + + case "Contract.instantiated_at": + if e.complexity.Contract.InstantiatedAt == nil { + break + } + + return e.complexity.Contract.InstantiatedAt(childComplexity), true + + case "Contract.label": + if e.complexity.Contract.Label == nil { + break + } + + return e.complexity.Contract.Label(childComplexity), true + + case "Contract.last_executed_at": + if e.complexity.Contract.LastExecutedAt == nil { + break + } + + return e.complexity.Contract.LastExecutedAt(childComplexity), true + + case "Contract.messages": + if e.complexity.Contract.Messages == nil { + break + } + + return e.complexity.Contract.Messages(childComplexity), true + + case "Contract.permission": + if e.complexity.Contract.Permission == nil { + break + } + + return e.complexity.Contract.Permission(childComplexity), true + + case "Contract.permitted_address": + if e.complexity.Contract.PermittedAddress == nil { + break + } + + return e.complexity.Contract.PermittedAddress(childComplexity), true + + case "Contract.txhash": + if e.complexity.Contract.Txhash == nil { + break + } + + return e.complexity.Contract.Txhash(childComplexity), true + + case "Contract.version": + if e.complexity.Contract.Version == nil { + break + } + + return e.complexity.Contract.Version(childComplexity), true + case "Delegation.amount": if e.complexity.Delegation.Amount == nil { break @@ -969,6 +1179,54 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Blocks(childComplexity, args["offset"].(*int), args["size"].(*int)), true + case "Query.code_contracts": + if e.complexity.Query.CodeContracts == nil { + break + } + + args, err := ec.field_Query_code_contracts_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.CodeContracts(childComplexity, args["code_id"].(int), args["offset"].(int), args["size"].(int)), true + + case "Query.code_detail": + if e.complexity.Query.CodeDetail == nil { + break + } + + args, err := ec.field_Query_code_detail_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.CodeDetail(childComplexity, args["code_id"].(int)), true + + case "Query.code_transactions": + if e.complexity.Query.CodeTransactions == nil { + break + } + + args, err := ec.field_Query_code_transactions_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.CodeTransactions(childComplexity, args["code_id"].(int), args["before"].(int), args["size"].(int)), true + + case "Query.codes": + if e.complexity.Query.Codes == nil { + break + } + + args, err := ec.field_Query_codes_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Codes(childComplexity, args["after"].(int), args["size"].(int)), true + case "Query.commission": if e.complexity.Query.Commission == nil { break @@ -981,6 +1239,30 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Commission(childComplexity, args["operator_address"].(string)), true + case "Query.contract_detail": + if e.complexity.Query.ContractDetail == nil { + break + } + + args, err := ec.field_Query_contract_detail_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.ContractDetail(childComplexity, args["contract_address"].(string)), true + + case "Query.contracts": + if e.complexity.Query.Contracts == nil { + break + } + + args, err := ec.field_Query_contracts_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Contracts(childComplexity, args["offset"].(int), args["size"].(int), args["keyword"].(*string)), true + case "Query.delegations": if e.complexity.Query.Delegations == nil { break @@ -2036,6 +2318,36 @@ type DelegatorResponse { total_count: Int! } +type Code { + code_id: Int! + contract: String! + data_hash: String! + created_at: String! + creator: String! + instantiate_count: Int! + permission: String! + permitted_address: String! + txhash: String! + version: String! +} + +type Contract { + code_id: Int! + contract: String! + contract_address: String! + admin: String! + creator: String! + executed_count: Int! + instantiated_at: String! + label: String! + last_executed_at: String! + permission: String! + permitted_address: String! + txhash: String! + version: String! + messages: String! +} + type Query { blocks(offset: Int, size: Int): [Block!]! block_detail(height: Int): Block! @@ -2108,6 +2420,36 @@ type Query { Get delegators in validator detail """ delegators(operator_address: String!, offset: Int!): DelegatorResponse! + + """ + Get list code + """ + codes(after: Int!, size: Int!): [Code!]! + + """ + Get code detail + """ + code_detail(code_id: Int!): Code! + + """ + Get code transactions + """ + code_transactions(code_id: Int!, before: Int!, size: Int!): [Tx!]! + + """ + Get code contracts + """ + code_contracts(code_id: Int!, offset: Int!, size: Int!): [Contract!]! + + """ + Get list contract + """ + contracts(offset: Int!, size: Int!, keyword: String): [Contract!]! + + """ + Get contract detail + """ + contract_detail(contract_address: String!): Contract! } `, BuiltIn: false}, } @@ -2249,109 +2591,262 @@ func (ec *executionContext) field_Query_blocks_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field_Query_commission_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_code_contracts_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["operator_address"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("operator_address")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) + var arg0 int + if tmp, ok := rawArgs["code_id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("code_id")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err } } - args["operator_address"] = arg0 + args["code_id"] = arg0 + var arg1 int + if tmp, ok := rawArgs["offset"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("offset")) + arg1, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } + } + args["offset"] = arg1 + var arg2 int + if tmp, ok := rawArgs["size"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("size")) + arg2, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } + } + args["size"] = arg2 return args, nil } -func (ec *executionContext) field_Query_delegations_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_code_detail_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["acc_address"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("acc_address")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) + var arg0 int + if tmp, ok := rawArgs["code_id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("code_id")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err } } - args["acc_address"] = arg0 + args["code_id"] = arg0 return args, nil } -func (ec *executionContext) field_Query_delegators_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_code_transactions_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 string - if tmp, ok := rawArgs["operator_address"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("operator_address")) - arg0, err = ec.unmarshalNString2string(ctx, tmp) + var arg0 int + if tmp, ok := rawArgs["code_id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("code_id")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err } } - args["operator_address"] = arg0 + args["code_id"] = arg0 var arg1 int - if tmp, ok := rawArgs["offset"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("offset")) + if tmp, ok := rawArgs["before"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("before")) arg1, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err } } - args["offset"] = arg1 - return args, nil -} - -func (ec *executionContext) field_Query_deposit_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["proposal_id"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("proposal_id")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) + args["before"] = arg1 + var arg2 int + if tmp, ok := rawArgs["size"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("size")) + arg2, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err } } - args["proposal_id"] = arg0 + args["size"] = arg2 return args, nil } -func (ec *executionContext) field_Query_power_events_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_codes_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *int - if tmp, ok := rawArgs["before"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("before")) - arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + var arg0 int + if tmp, ok := rawArgs["after"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("after")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err } } - args["before"] = arg0 - var arg1 *int + args["after"] = arg0 + var arg1 int if tmp, ok := rawArgs["size"]; ok { ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("size")) - arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + arg1, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err } } args["size"] = arg1 - var arg2 string - if tmp, ok := rawArgs["operator_address"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("operator_address")) - arg2, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } - } - args["operator_address"] = arg2 return args, nil } -func (ec *executionContext) field_Query_price_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_commission_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["operator_address"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("operator_address")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["operator_address"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_contract_detail_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["contract_address"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contract_address")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["contract_address"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_contracts_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 int + if tmp, ok := rawArgs["offset"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("offset")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } + } + args["offset"] = arg0 + var arg1 int + if tmp, ok := rawArgs["size"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("size")) + arg1, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } + } + args["size"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["keyword"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("keyword")) + arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["keyword"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_delegations_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["acc_address"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("acc_address")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["acc_address"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_delegators_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["operator_address"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("operator_address")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["operator_address"] = arg0 + var arg1 int + if tmp, ok := rawArgs["offset"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("offset")) + arg1, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } + } + args["offset"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query_deposit_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 int + if tmp, ok := rawArgs["proposal_id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("proposal_id")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } + } + args["proposal_id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_power_events_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *int + if tmp, ok := rawArgs["before"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("before")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["before"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["size"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("size")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["size"] = arg1 + var arg2 string + if tmp, ok := rawArgs["operator_address"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("operator_address")) + arg2, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["operator_address"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_price_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string @@ -3220,7 +3715,7 @@ func (ec *executionContext) _Change_subspace(ctx context.Context, field graphql. return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Commission_commission(ctx context.Context, field graphql.CollectedField, obj *model.Commission) (ret graphql.Marshaler) { +func (ec *executionContext) _Code_code_id(ctx context.Context, field graphql.CollectedField, obj *model.Code) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -3228,7 +3723,7 @@ func (ec *executionContext) _Commission_commission(ctx context.Context, field gr } }() fc := &graphql.FieldContext{ - Object: "Commission", + Object: "Code", Field: field, Args: nil, IsMethod: false, @@ -3238,21 +3733,24 @@ func (ec *executionContext) _Commission_commission(ctx context.Context, field gr ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Commission, nil + return obj.CodeID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*model.Commissions) + res := resTmp.(int) fc.Result = res - return ec.marshalOCommissions2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐCommissions(ctx, field.Selections, res) + return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _CommissionInfo_denom(ctx context.Context, field graphql.CollectedField, obj *model.CommissionInfo) (ret graphql.Marshaler) { +func (ec *executionContext) _Code_contract(ctx context.Context, field graphql.CollectedField, obj *model.Code) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -3260,7 +3758,7 @@ func (ec *executionContext) _CommissionInfo_denom(ctx context.Context, field gra } }() fc := &graphql.FieldContext{ - Object: "CommissionInfo", + Object: "Code", Field: field, Args: nil, IsMethod: false, @@ -3270,7 +3768,7 @@ func (ec *executionContext) _CommissionInfo_denom(ctx context.Context, field gra ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Denom, nil + return obj.Contract, nil }) if err != nil { ec.Error(ctx, err) @@ -3287,7 +3785,7 @@ func (ec *executionContext) _CommissionInfo_denom(ctx context.Context, field gra return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _CommissionInfo_amount(ctx context.Context, field graphql.CollectedField, obj *model.CommissionInfo) (ret graphql.Marshaler) { +func (ec *executionContext) _Code_data_hash(ctx context.Context, field graphql.CollectedField, obj *model.Code) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -3295,7 +3793,7 @@ func (ec *executionContext) _CommissionInfo_amount(ctx context.Context, field gr } }() fc := &graphql.FieldContext{ - Object: "CommissionInfo", + Object: "Code", Field: field, Args: nil, IsMethod: false, @@ -3305,7 +3803,7 @@ func (ec *executionContext) _CommissionInfo_amount(ctx context.Context, field gr ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Amount, nil + return obj.DataHash, nil }) if err != nil { ec.Error(ctx, err) @@ -3322,7 +3820,7 @@ func (ec *executionContext) _CommissionInfo_amount(ctx context.Context, field gr return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Commissions_commission(ctx context.Context, field graphql.CollectedField, obj *model.Commissions) (ret graphql.Marshaler) { +func (ec *executionContext) _Code_created_at(ctx context.Context, field graphql.CollectedField, obj *model.Code) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -3330,7 +3828,7 @@ func (ec *executionContext) _Commissions_commission(ctx context.Context, field g } }() fc := &graphql.FieldContext{ - Object: "Commissions", + Object: "Code", Field: field, Args: nil, IsMethod: false, @@ -3340,7 +3838,7 @@ func (ec *executionContext) _Commissions_commission(ctx context.Context, field g ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Commission, nil + return obj.CreatedAt, nil }) if err != nil { ec.Error(ctx, err) @@ -3352,12 +3850,12 @@ func (ec *executionContext) _Commissions_commission(ctx context.Context, field g } return graphql.Null } - res := resTmp.([]*model.CommissionInfo) + res := resTmp.(string) fc.Result = res - return ec.marshalNCommissionInfo2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐCommissionInfoᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Content_title(ctx context.Context, field graphql.CollectedField, obj *model.Content) (ret graphql.Marshaler) { +func (ec *executionContext) _Code_creator(ctx context.Context, field graphql.CollectedField, obj *model.Code) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -3365,7 +3863,7 @@ func (ec *executionContext) _Content_title(ctx context.Context, field graphql.Co } }() fc := &graphql.FieldContext{ - Object: "Content", + Object: "Code", Field: field, Args: nil, IsMethod: false, @@ -3375,7 +3873,7 @@ func (ec *executionContext) _Content_title(ctx context.Context, field graphql.Co ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Title, nil + return obj.Creator, nil }) if err != nil { ec.Error(ctx, err) @@ -3392,7 +3890,7 @@ func (ec *executionContext) _Content_title(ctx context.Context, field graphql.Co return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Content_type(ctx context.Context, field graphql.CollectedField, obj *model.Content) (ret graphql.Marshaler) { +func (ec *executionContext) _Code_instantiate_count(ctx context.Context, field graphql.CollectedField, obj *model.Code) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -3400,7 +3898,7 @@ func (ec *executionContext) _Content_type(ctx context.Context, field graphql.Col } }() fc := &graphql.FieldContext{ - Object: "Content", + Object: "Code", Field: field, Args: nil, IsMethod: false, @@ -3410,7 +3908,42 @@ func (ec *executionContext) _Content_type(ctx context.Context, field graphql.Col ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Type, nil + return obj.InstantiateCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) _Code_permission(ctx context.Context, field graphql.CollectedField, obj *model.Code) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Code", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Permission, nil }) if err != nil { ec.Error(ctx, err) @@ -3427,7 +3960,7 @@ func (ec *executionContext) _Content_type(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Content_description(ctx context.Context, field graphql.CollectedField, obj *model.Content) (ret graphql.Marshaler) { +func (ec *executionContext) _Code_permitted_address(ctx context.Context, field graphql.CollectedField, obj *model.Code) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -3435,7 +3968,7 @@ func (ec *executionContext) _Content_description(ctx context.Context, field grap } }() fc := &graphql.FieldContext{ - Object: "Content", + Object: "Code", Field: field, Args: nil, IsMethod: false, @@ -3445,7 +3978,7 @@ func (ec *executionContext) _Content_description(ctx context.Context, field grap ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Description, nil + return obj.PermittedAddress, nil }) if err != nil { ec.Error(ctx, err) @@ -3462,7 +3995,7 @@ func (ec *executionContext) _Content_description(ctx context.Context, field grap return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Content_amount(ctx context.Context, field graphql.CollectedField, obj *model.Content) (ret graphql.Marshaler) { +func (ec *executionContext) _Code_txhash(ctx context.Context, field graphql.CollectedField, obj *model.Code) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -3470,7 +4003,7 @@ func (ec *executionContext) _Content_amount(ctx context.Context, field graphql.C } }() fc := &graphql.FieldContext{ - Object: "Content", + Object: "Code", Field: field, Args: nil, IsMethod: false, @@ -3480,7 +4013,7 @@ func (ec *executionContext) _Content_amount(ctx context.Context, field graphql.C ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Amount, nil + return obj.Txhash, nil }) if err != nil { ec.Error(ctx, err) @@ -3492,12 +4025,12 @@ func (ec *executionContext) _Content_amount(ctx context.Context, field graphql.C } return graphql.Null } - res := resTmp.([]*model.Amount) + res := resTmp.(string) fc.Result = res - return ec.marshalNAmount2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐAmountᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Content_changes(ctx context.Context, field graphql.CollectedField, obj *model.Content) (ret graphql.Marshaler) { +func (ec *executionContext) _Code_version(ctx context.Context, field graphql.CollectedField, obj *model.Code) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -3505,7 +4038,7 @@ func (ec *executionContext) _Content_changes(ctx context.Context, field graphql. } }() fc := &graphql.FieldContext{ - Object: "Content", + Object: "Code", Field: field, Args: nil, IsMethod: false, @@ -3515,7 +4048,7 @@ func (ec *executionContext) _Content_changes(ctx context.Context, field graphql. ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Changes, nil + return obj.Version, nil }) if err != nil { ec.Error(ctx, err) @@ -3527,12 +4060,12 @@ func (ec *executionContext) _Content_changes(ctx context.Context, field graphql. } return graphql.Null } - res := resTmp.([]*model.Change) + res := resTmp.(string) fc.Result = res - return ec.marshalNChange2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐChangeᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Content_plan(ctx context.Context, field graphql.CollectedField, obj *model.Content) (ret graphql.Marshaler) { +func (ec *executionContext) _Commission_commission(ctx context.Context, field graphql.CollectedField, obj *model.Commission) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -3540,7 +4073,7 @@ func (ec *executionContext) _Content_plan(ctx context.Context, field graphql.Col } }() fc := &graphql.FieldContext{ - Object: "Content", + Object: "Commission", Field: field, Args: nil, IsMethod: false, @@ -3550,7 +4083,809 @@ func (ec *executionContext) _Content_plan(ctx context.Context, field graphql.Col ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Plan, nil + return obj.Commission, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.Commissions) + fc.Result = res + return ec.marshalOCommissions2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐCommissions(ctx, field.Selections, res) +} + +func (ec *executionContext) _CommissionInfo_denom(ctx context.Context, field graphql.CollectedField, obj *model.CommissionInfo) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "CommissionInfo", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Denom, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _CommissionInfo_amount(ctx context.Context, field graphql.CollectedField, obj *model.CommissionInfo) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "CommissionInfo", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Amount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Commissions_commission(ctx context.Context, field graphql.CollectedField, obj *model.Commissions) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Commissions", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Commission, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.CommissionInfo) + fc.Result = res + return ec.marshalNCommissionInfo2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐCommissionInfoᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) _Content_title(ctx context.Context, field graphql.CollectedField, obj *model.Content) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Content", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Title, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Content_type(ctx context.Context, field graphql.CollectedField, obj *model.Content) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Content", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Content_description(ctx context.Context, field graphql.CollectedField, obj *model.Content) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Content", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Content_amount(ctx context.Context, field graphql.CollectedField, obj *model.Content) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Content", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Amount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.Amount) + fc.Result = res + return ec.marshalNAmount2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐAmountᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) _Content_changes(ctx context.Context, field graphql.CollectedField, obj *model.Content) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Content", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Changes, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.Change) + fc.Result = res + return ec.marshalNChange2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐChangeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) _Content_plan(ctx context.Context, field graphql.CollectedField, obj *model.Content) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Content", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Plan, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Plan) + fc.Result = res + return ec.marshalNPlan2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐPlan(ctx, field.Selections, res) +} + +func (ec *executionContext) _Contract_code_id(ctx context.Context, field graphql.CollectedField, obj *model.Contract) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Contract", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CodeID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) _Contract_contract(ctx context.Context, field graphql.CollectedField, obj *model.Contract) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Contract", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Contract, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Contract_contract_address(ctx context.Context, field graphql.CollectedField, obj *model.Contract) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Contract", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ContractAddress, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Contract_admin(ctx context.Context, field graphql.CollectedField, obj *model.Contract) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Contract", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Admin, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Contract_creator(ctx context.Context, field graphql.CollectedField, obj *model.Contract) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Contract", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Creator, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Contract_executed_count(ctx context.Context, field graphql.CollectedField, obj *model.Contract) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Contract", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ExecutedCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) _Contract_instantiated_at(ctx context.Context, field graphql.CollectedField, obj *model.Contract) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Contract", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InstantiatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Contract_label(ctx context.Context, field graphql.CollectedField, obj *model.Contract) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Contract", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Label, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Contract_last_executed_at(ctx context.Context, field graphql.CollectedField, obj *model.Contract) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Contract", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.LastExecutedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Contract_permission(ctx context.Context, field graphql.CollectedField, obj *model.Contract) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Contract", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Permission, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Contract_permitted_address(ctx context.Context, field graphql.CollectedField, obj *model.Contract) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Contract", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PermittedAddress, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Contract_txhash(ctx context.Context, field graphql.CollectedField, obj *model.Contract) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Contract", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Txhash, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Contract_version(ctx context.Context, field graphql.CollectedField, obj *model.Contract) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Contract", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Version, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) _Contract_messages(ctx context.Context, field graphql.CollectedField, obj *model.Contract) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Contract", + Field: field, + Args: nil, + IsMethod: false, + IsResolver: false, + } + + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Messages, nil }) if err != nil { ec.Error(ctx, err) @@ -3562,9 +4897,9 @@ func (ec *executionContext) _Content_plan(ctx context.Context, field graphql.Col } return graphql.Null } - res := resTmp.(*model.Plan) + res := resTmp.(string) fc.Result = res - return ec.marshalNPlan2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐPlan(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } func (ec *executionContext) _Delegation_moniker(ctx context.Context, field graphql.CollectedField, obj *model.Delegation) (ret graphql.Marshaler) { @@ -5388,16 +6723,261 @@ func (ec *executionContext) _Query_validator_detail(ctx context.Context, field g } ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_validator_detail_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_validator_detail_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ValidatorDetail(rctx, args["operator_address"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Validator) + fc.Result = res + return ec.marshalNValidator2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐValidator(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_uptimes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_uptimes_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Uptimes(rctx, args["operator_address"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UptimeResult) + fc.Result = res + return ec.marshalNUptimeResult2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐUptimeResult(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_proposed_blocks(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_proposed_blocks_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ProposedBlocks(rctx, args["before"].(*int), args["size"].(*int), args["operator_address"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.Block) + fc.Result = res + return ec.marshalNBlock2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐBlockᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_power_events(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_power_events_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().PowerEvents(rctx, args["before"].(*int), args["size"].(*int), args["operator_address"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.PowerEvent) + fc.Result = res + return ec.marshalNPowerEvent2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐPowerEventᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_account_transactions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_account_transactions_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().AccountTransactions(rctx, args["acc_address"].(string), args["before"].(int), args["size"].(int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.Tx) + fc.Result = res + return ec.marshalNTx2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐTxᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_account_detail(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_account_detail_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().AccountDetail(rctx, args["acc_address"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.AccountDetail) + fc.Result = res + return ec.marshalNAccountDetail2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐAccountDetail(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_proposals(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + IsResolver: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().ValidatorDetail(rctx, args["operator_address"].(*string)) + return ec.resolvers.Query().Proposals(rctx) }) if err != nil { ec.Error(ctx, err) @@ -5409,12 +6989,12 @@ func (ec *executionContext) _Query_validator_detail(ctx context.Context, field g } return graphql.Null } - res := resTmp.(*model.Validator) + res := resTmp.([]*model.Proposal) fc.Result = res - return ec.marshalNValidator2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐValidator(ctx, field.Selections, res) + return ec.marshalNProposal2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐProposalᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _Query_uptimes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_proposal_detail(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -5431,7 +7011,7 @@ func (ec *executionContext) _Query_uptimes(ctx context.Context, field graphql.Co ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_uptimes_args(ctx, rawArgs) + args, err := ec.field_Query_proposal_detail_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null @@ -5439,7 +7019,7 @@ func (ec *executionContext) _Query_uptimes(ctx context.Context, field graphql.Co fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Uptimes(rctx, args["operator_address"].(*string)) + return ec.resolvers.Query().ProposalDetail(rctx, args["proposal_id"].(int)) }) if err != nil { ec.Error(ctx, err) @@ -5451,12 +7031,12 @@ func (ec *executionContext) _Query_uptimes(ctx context.Context, field graphql.Co } return graphql.Null } - res := resTmp.(*model.UptimeResult) + res := resTmp.(*model.Proposal) fc.Result = res - return ec.marshalNUptimeResult2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐUptimeResult(ctx, field.Selections, res) + return ec.marshalNProposal2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐProposal(ctx, field.Selections, res) } -func (ec *executionContext) _Query_proposed_blocks(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_status(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -5472,16 +7052,9 @@ func (ec *executionContext) _Query_proposed_blocks(ctx context.Context, field gr } ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_proposed_blocks_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().ProposedBlocks(rctx, args["before"].(*int), args["size"].(*int), args["operator_address"].(string)) + return ec.resolvers.Query().Status(rctx) }) if err != nil { ec.Error(ctx, err) @@ -5493,12 +7066,12 @@ func (ec *executionContext) _Query_proposed_blocks(ctx context.Context, field gr } return graphql.Null } - res := resTmp.([]*model.Block) + res := resTmp.(*model.Status) fc.Result = res - return ec.marshalNBlock2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐBlockᚄ(ctx, field.Selections, res) + return ec.marshalNStatus2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐStatus(ctx, field.Selections, res) } -func (ec *executionContext) _Query_power_events(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_inflation(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -5514,16 +7087,9 @@ func (ec *executionContext) _Query_power_events(ctx context.Context, field graph } ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_power_events_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().PowerEvents(rctx, args["before"].(*int), args["size"].(*int), args["operator_address"].(string)) + return ec.resolvers.Query().Inflation(rctx) }) if err != nil { ec.Error(ctx, err) @@ -5535,12 +7101,12 @@ func (ec *executionContext) _Query_power_events(ctx context.Context, field graph } return graphql.Null } - res := resTmp.([]*model.PowerEvent) + res := resTmp.(*model.Inflation) fc.Result = res - return ec.marshalNPowerEvent2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐPowerEventᚄ(ctx, field.Selections, res) + return ec.marshalNInflation2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐInflation(ctx, field.Selections, res) } -func (ec *executionContext) _Query_account_transactions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_balances(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -5557,7 +7123,7 @@ func (ec *executionContext) _Query_account_transactions(ctx context.Context, fie ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_account_transactions_args(ctx, rawArgs) + args, err := ec.field_Query_balances_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null @@ -5565,7 +7131,7 @@ func (ec *executionContext) _Query_account_transactions(ctx context.Context, fie fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().AccountTransactions(rctx, args["acc_address"].(string), args["before"].(int), args["size"].(int)) + return ec.resolvers.Query().Balances(rctx, args["acc_address"].(string)) }) if err != nil { ec.Error(ctx, err) @@ -5577,12 +7143,12 @@ func (ec *executionContext) _Query_account_transactions(ctx context.Context, fie } return graphql.Null } - res := resTmp.([]*model.Tx) + res := resTmp.(*model.Balances) fc.Result = res - return ec.marshalNTx2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐTxᚄ(ctx, field.Selections, res) + return ec.marshalNBalances2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐBalances(ctx, field.Selections, res) } -func (ec *executionContext) _Query_account_detail(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_rewards(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -5599,7 +7165,7 @@ func (ec *executionContext) _Query_account_detail(ctx context.Context, field gra ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_account_detail_args(ctx, rawArgs) + args, err := ec.field_Query_rewards_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null @@ -5607,7 +7173,7 @@ func (ec *executionContext) _Query_account_detail(ctx context.Context, field gra fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().AccountDetail(rctx, args["acc_address"].(string)) + return ec.resolvers.Query().Rewards(rctx, args["acc_address"].(string)) }) if err != nil { ec.Error(ctx, err) @@ -5619,12 +7185,12 @@ func (ec *executionContext) _Query_account_detail(ctx context.Context, field gra } return graphql.Null } - res := resTmp.(*model.AccountDetail) + res := resTmp.(*model.Rewards) fc.Result = res - return ec.marshalNAccountDetail2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐAccountDetail(ctx, field.Selections, res) + return ec.marshalNRewards2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐRewards(ctx, field.Selections, res) } -func (ec *executionContext) _Query_proposals(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_commission(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -5640,9 +7206,16 @@ func (ec *executionContext) _Query_proposals(ctx context.Context, field graphql. } ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_commission_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Proposals(rctx) + return ec.resolvers.Query().Commission(rctx, args["operator_address"].(string)) }) if err != nil { ec.Error(ctx, err) @@ -5654,12 +7227,12 @@ func (ec *executionContext) _Query_proposals(ctx context.Context, field graphql. } return graphql.Null } - res := resTmp.([]*model.Proposal) + res := resTmp.(*model.Commission) fc.Result = res - return ec.marshalNProposal2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐProposalᚄ(ctx, field.Selections, res) + return ec.marshalNCommission2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐCommission(ctx, field.Selections, res) } -func (ec *executionContext) _Query_proposal_detail(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_delegations(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -5676,7 +7249,7 @@ func (ec *executionContext) _Query_proposal_detail(ctx context.Context, field gr ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_proposal_detail_args(ctx, rawArgs) + args, err := ec.field_Query_delegations_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null @@ -5684,7 +7257,7 @@ func (ec *executionContext) _Query_proposal_detail(ctx context.Context, field gr fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().ProposalDetail(rctx, args["proposal_id"].(int)) + return ec.resolvers.Query().Delegations(rctx, args["acc_address"].(string)) }) if err != nil { ec.Error(ctx, err) @@ -5696,12 +7269,12 @@ func (ec *executionContext) _Query_proposal_detail(ctx context.Context, field gr } return graphql.Null } - res := resTmp.(*model.Proposal) + res := resTmp.([]*model.Delegation) fc.Result = res - return ec.marshalNProposal2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐProposal(ctx, field.Selections, res) + return ec.marshalNDelegation2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐDelegationᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _Query_status(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_unbonding(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -5717,9 +7290,16 @@ func (ec *executionContext) _Query_status(ctx context.Context, field graphql.Col } ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_unbonding_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Status(rctx) + return ec.resolvers.Query().Unbonding(rctx, args["acc_address"].(string)) }) if err != nil { ec.Error(ctx, err) @@ -5731,12 +7311,12 @@ func (ec *executionContext) _Query_status(ctx context.Context, field graphql.Col } return graphql.Null } - res := resTmp.(*model.Status) + res := resTmp.(*model.Unbonding) fc.Result = res - return ec.marshalNStatus2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐStatus(ctx, field.Selections, res) + return ec.marshalNUnbonding2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐUnbonding(ctx, field.Selections, res) } -func (ec *executionContext) _Query_inflation(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_redelegations(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -5752,9 +7332,16 @@ func (ec *executionContext) _Query_inflation(ctx context.Context, field graphql. } ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_redelegations_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Inflation(rctx) + return ec.resolvers.Query().Redelegations(rctx, args["acc_address"].(string)) }) if err != nil { ec.Error(ctx, err) @@ -5766,12 +7353,12 @@ func (ec *executionContext) _Query_inflation(ctx context.Context, field graphql. } return graphql.Null } - res := resTmp.(*model.Inflation) + res := resTmp.(*model.Redelegations) fc.Result = res - return ec.marshalNInflation2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐInflation(ctx, field.Selections, res) + return ec.marshalNRedelegations2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐRedelegations(ctx, field.Selections, res) } -func (ec *executionContext) _Query_balances(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_deposit(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -5788,7 +7375,7 @@ func (ec *executionContext) _Query_balances(ctx context.Context, field graphql.C ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_balances_args(ctx, rawArgs) + args, err := ec.field_Query_deposit_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null @@ -5796,7 +7383,7 @@ func (ec *executionContext) _Query_balances(ctx context.Context, field graphql.C fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Balances(rctx, args["acc_address"].(string)) + return ec.resolvers.Query().Deposit(rctx, args["proposal_id"].(int)) }) if err != nil { ec.Error(ctx, err) @@ -5808,12 +7395,12 @@ func (ec *executionContext) _Query_balances(ctx context.Context, field graphql.C } return graphql.Null } - res := resTmp.(*model.Balances) + res := resTmp.([]*model.Deposit) fc.Result = res - return ec.marshalNBalances2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐBalances(ctx, field.Selections, res) + return ec.marshalNDeposit2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐDepositᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _Query_rewards(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_vote(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -5830,7 +7417,7 @@ func (ec *executionContext) _Query_rewards(ctx context.Context, field graphql.Co ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_rewards_args(ctx, rawArgs) + args, err := ec.field_Query_vote_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null @@ -5838,7 +7425,7 @@ func (ec *executionContext) _Query_rewards(ctx context.Context, field graphql.Co fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Rewards(rctx, args["acc_address"].(string)) + return ec.resolvers.Query().Vote(rctx, args["before"].(*int), args["size"].(*int), args["proposal_id"].(int)) }) if err != nil { ec.Error(ctx, err) @@ -5850,12 +7437,12 @@ func (ec *executionContext) _Query_rewards(ctx context.Context, field graphql.Co } return graphql.Null } - res := resTmp.(*model.Rewards) + res := resTmp.([]*model.Vote) fc.Result = res - return ec.marshalNRewards2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐRewards(ctx, field.Selections, res) + return ec.marshalNVote2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐVoteᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _Query_commission(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_price(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -5872,7 +7459,7 @@ func (ec *executionContext) _Query_commission(ctx context.Context, field graphql ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_commission_args(ctx, rawArgs) + args, err := ec.field_Query_price_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null @@ -5880,7 +7467,7 @@ func (ec *executionContext) _Query_commission(ctx context.Context, field graphql fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Commission(rctx, args["operator_address"].(string)) + return ec.resolvers.Query().Price(rctx, args["slug"].(string)) }) if err != nil { ec.Error(ctx, err) @@ -5892,12 +7479,12 @@ func (ec *executionContext) _Query_commission(ctx context.Context, field graphql } return graphql.Null } - res := resTmp.(*model.Commission) + res := resTmp.(*model.Price) fc.Result = res - return ec.marshalNCommission2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐCommission(ctx, field.Selections, res) + return ec.marshalNPrice2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐPrice(ctx, field.Selections, res) } -func (ec *executionContext) _Query_delegations(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_stats_assets(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -5913,16 +7500,9 @@ func (ec *executionContext) _Query_delegations(ctx context.Context, field graphq } ctx = graphql.WithFieldContext(ctx, fc) - rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_delegations_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Delegations(rctx, args["acc_address"].(string)) + return ec.resolvers.Query().StatsAssets(rctx) }) if err != nil { ec.Error(ctx, err) @@ -5934,12 +7514,12 @@ func (ec *executionContext) _Query_delegations(ctx context.Context, field graphq } return graphql.Null } - res := resTmp.([]*model.Delegation) + res := resTmp.([]*model.StatsAsset) fc.Result = res - return ec.marshalNDelegation2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐDelegationᚄ(ctx, field.Selections, res) + return ec.marshalNStatsAsset2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐStatsAssetᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _Query_unbonding(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_delegators(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -5956,7 +7536,7 @@ func (ec *executionContext) _Query_unbonding(ctx context.Context, field graphql. ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_unbonding_args(ctx, rawArgs) + args, err := ec.field_Query_delegators_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null @@ -5964,7 +7544,7 @@ func (ec *executionContext) _Query_unbonding(ctx context.Context, field graphql. fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Unbonding(rctx, args["acc_address"].(string)) + return ec.resolvers.Query().Delegators(rctx, args["operator_address"].(string), args["offset"].(int)) }) if err != nil { ec.Error(ctx, err) @@ -5976,12 +7556,12 @@ func (ec *executionContext) _Query_unbonding(ctx context.Context, field graphql. } return graphql.Null } - res := resTmp.(*model.Unbonding) + res := resTmp.(*model.DelegatorResponse) fc.Result = res - return ec.marshalNUnbonding2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐUnbonding(ctx, field.Selections, res) + return ec.marshalNDelegatorResponse2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐDelegatorResponse(ctx, field.Selections, res) } -func (ec *executionContext) _Query_redelegations(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_codes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -5998,7 +7578,7 @@ func (ec *executionContext) _Query_redelegations(ctx context.Context, field grap ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_redelegations_args(ctx, rawArgs) + args, err := ec.field_Query_codes_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null @@ -6006,7 +7586,7 @@ func (ec *executionContext) _Query_redelegations(ctx context.Context, field grap fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Redelegations(rctx, args["acc_address"].(string)) + return ec.resolvers.Query().Codes(rctx, args["after"].(int), args["size"].(int)) }) if err != nil { ec.Error(ctx, err) @@ -6018,12 +7598,12 @@ func (ec *executionContext) _Query_redelegations(ctx context.Context, field grap } return graphql.Null } - res := resTmp.(*model.Redelegations) + res := resTmp.([]*model.Code) fc.Result = res - return ec.marshalNRedelegations2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐRedelegations(ctx, field.Selections, res) + return ec.marshalNCode2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐCodeᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _Query_deposit(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_code_detail(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -6040,7 +7620,7 @@ func (ec *executionContext) _Query_deposit(ctx context.Context, field graphql.Co ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_deposit_args(ctx, rawArgs) + args, err := ec.field_Query_code_detail_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null @@ -6048,7 +7628,7 @@ func (ec *executionContext) _Query_deposit(ctx context.Context, field graphql.Co fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Deposit(rctx, args["proposal_id"].(int)) + return ec.resolvers.Query().CodeDetail(rctx, args["code_id"].(int)) }) if err != nil { ec.Error(ctx, err) @@ -6060,12 +7640,12 @@ func (ec *executionContext) _Query_deposit(ctx context.Context, field graphql.Co } return graphql.Null } - res := resTmp.([]*model.Deposit) + res := resTmp.(*model.Code) fc.Result = res - return ec.marshalNDeposit2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐDepositᚄ(ctx, field.Selections, res) + return ec.marshalNCode2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐCode(ctx, field.Selections, res) } -func (ec *executionContext) _Query_vote(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_code_transactions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -6082,7 +7662,7 @@ func (ec *executionContext) _Query_vote(ctx context.Context, field graphql.Colle ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_vote_args(ctx, rawArgs) + args, err := ec.field_Query_code_transactions_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null @@ -6090,7 +7670,7 @@ func (ec *executionContext) _Query_vote(ctx context.Context, field graphql.Colle fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Vote(rctx, args["before"].(*int), args["size"].(*int), args["proposal_id"].(int)) + return ec.resolvers.Query().CodeTransactions(rctx, args["code_id"].(int), args["before"].(int), args["size"].(int)) }) if err != nil { ec.Error(ctx, err) @@ -6102,12 +7682,12 @@ func (ec *executionContext) _Query_vote(ctx context.Context, field graphql.Colle } return graphql.Null } - res := resTmp.([]*model.Vote) + res := resTmp.([]*model.Tx) fc.Result = res - return ec.marshalNVote2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐVoteᚄ(ctx, field.Selections, res) + return ec.marshalNTx2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐTxᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _Query_price(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_code_contracts(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -6124,7 +7704,7 @@ func (ec *executionContext) _Query_price(ctx context.Context, field graphql.Coll ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_price_args(ctx, rawArgs) + args, err := ec.field_Query_code_contracts_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null @@ -6132,7 +7712,7 @@ func (ec *executionContext) _Query_price(ctx context.Context, field graphql.Coll fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Price(rctx, args["slug"].(string)) + return ec.resolvers.Query().CodeContracts(rctx, args["code_id"].(int), args["offset"].(int), args["size"].(int)) }) if err != nil { ec.Error(ctx, err) @@ -6144,12 +7724,12 @@ func (ec *executionContext) _Query_price(ctx context.Context, field graphql.Coll } return graphql.Null } - res := resTmp.(*model.Price) + res := resTmp.([]*model.Contract) fc.Result = res - return ec.marshalNPrice2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐPrice(ctx, field.Selections, res) + return ec.marshalNContract2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐContractᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _Query_stats_assets(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_contracts(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -6165,9 +7745,16 @@ func (ec *executionContext) _Query_stats_assets(ctx context.Context, field graph } ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Query_contracts_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().StatsAssets(rctx) + return ec.resolvers.Query().Contracts(rctx, args["offset"].(int), args["size"].(int), args["keyword"].(*string)) }) if err != nil { ec.Error(ctx, err) @@ -6179,12 +7766,12 @@ func (ec *executionContext) _Query_stats_assets(ctx context.Context, field graph } return graphql.Null } - res := resTmp.([]*model.StatsAsset) + res := resTmp.([]*model.Contract) fc.Result = res - return ec.marshalNStatsAsset2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐStatsAssetᚄ(ctx, field.Selections, res) + return ec.marshalNContract2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐContractᚄ(ctx, field.Selections, res) } -func (ec *executionContext) _Query_delegators(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { +func (ec *executionContext) _Query_contract_detail(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -6201,7 +7788,7 @@ func (ec *executionContext) _Query_delegators(ctx context.Context, field graphql ctx = graphql.WithFieldContext(ctx, fc) rawArgs := field.ArgumentMap(ec.Variables) - args, err := ec.field_Query_delegators_args(ctx, rawArgs) + args, err := ec.field_Query_contract_detail_args(ctx, rawArgs) if err != nil { ec.Error(ctx, err) return graphql.Null @@ -6209,7 +7796,7 @@ func (ec *executionContext) _Query_delegators(ctx context.Context, field graphql fc.Args = args resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Delegators(rctx, args["operator_address"].(string), args["offset"].(int)) + return ec.resolvers.Query().ContractDetail(rctx, args["contract_address"].(string)) }) if err != nil { ec.Error(ctx, err) @@ -6221,9 +7808,9 @@ func (ec *executionContext) _Query_delegators(ctx context.Context, field graphql } return graphql.Null } - res := resTmp.(*model.DelegatorResponse) + res := resTmp.(*model.Contract) fc.Result = res - return ec.marshalNDelegatorResponse2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐDelegatorResponse(ctx, field.Selections, res) + return ec.marshalNContract2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐContract(ctx, field.Selections, res) } func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { @@ -10193,29 +11780,101 @@ func (ec *executionContext) _Block(ctx context.Context, sel ast.SelectionSet, ob return out } -var changeImplementors = []string{"Change"} +var changeImplementors = []string{"Change"} + +func (ec *executionContext) _Change(ctx context.Context, sel ast.SelectionSet, obj *model.Change) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, changeImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Change") + case "key": + out.Values[i] = ec._Change_key(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "value": + out.Values[i] = ec._Change_value(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "subspace": + out.Values[i] = ec._Change_subspace(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var codeImplementors = []string{"Code"} -func (ec *executionContext) _Change(ctx context.Context, sel ast.SelectionSet, obj *model.Change) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, changeImplementors) +func (ec *executionContext) _Code(ctx context.Context, sel ast.SelectionSet, obj *model.Code) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, codeImplementors) out := graphql.NewFieldSet(fields) var invalids uint32 for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("Change") - case "key": - out.Values[i] = ec._Change_key(ctx, field, obj) + out.Values[i] = graphql.MarshalString("Code") + case "code_id": + out.Values[i] = ec._Code_code_id(ctx, field, obj) if out.Values[i] == graphql.Null { invalids++ } - case "value": - out.Values[i] = ec._Change_value(ctx, field, obj) + case "contract": + out.Values[i] = ec._Code_contract(ctx, field, obj) if out.Values[i] == graphql.Null { invalids++ } - case "subspace": - out.Values[i] = ec._Change_subspace(ctx, field, obj) + case "data_hash": + out.Values[i] = ec._Code_data_hash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "created_at": + out.Values[i] = ec._Code_created_at(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "creator": + out.Values[i] = ec._Code_creator(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "instantiate_count": + out.Values[i] = ec._Code_instantiate_count(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "permission": + out.Values[i] = ec._Code_permission(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "permitted_address": + out.Values[i] = ec._Code_permitted_address(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "txhash": + out.Values[i] = ec._Code_txhash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "version": + out.Values[i] = ec._Code_version(ctx, field, obj) if out.Values[i] == graphql.Null { invalids++ } @@ -10365,6 +12024,98 @@ func (ec *executionContext) _Content(ctx context.Context, sel ast.SelectionSet, return out } +var contractImplementors = []string{"Contract"} + +func (ec *executionContext) _Contract(ctx context.Context, sel ast.SelectionSet, obj *model.Contract) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, contractImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Contract") + case "code_id": + out.Values[i] = ec._Contract_code_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "contract": + out.Values[i] = ec._Contract_contract(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "contract_address": + out.Values[i] = ec._Contract_contract_address(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "admin": + out.Values[i] = ec._Contract_admin(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "creator": + out.Values[i] = ec._Contract_creator(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "executed_count": + out.Values[i] = ec._Contract_executed_count(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "instantiated_at": + out.Values[i] = ec._Contract_instantiated_at(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "label": + out.Values[i] = ec._Contract_label(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "last_executed_at": + out.Values[i] = ec._Contract_last_executed_at(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "permission": + out.Values[i] = ec._Contract_permission(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "permitted_address": + out.Values[i] = ec._Contract_permitted_address(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "txhash": + out.Values[i] = ec._Contract_txhash(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "version": + out.Values[i] = ec._Contract_version(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + case "messages": + out.Values[i] = ec._Contract_messages(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + var delegationImplementors = []string{"Delegation"} func (ec *executionContext) _Delegation(ctx context.Context, sel ast.SelectionSet, obj *model.Delegation) graphql.Marshaler { @@ -11210,6 +12961,90 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } return res }) + case "codes": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_codes(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + }) + case "code_detail": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_code_detail(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + }) + case "code_transactions": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_code_transactions(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + }) + case "code_contracts": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_code_contracts(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + }) + case "contracts": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_contracts(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + }) + case "contract_detail": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_contract_detail(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + }) case "__type": out.Values[i] = ec._Query___type(ctx, field) case "__schema": @@ -12489,6 +14324,57 @@ func (ec *executionContext) marshalNChange2ᚖgithubᚗcomᚋcosmosᚑgaminghub return ec._Change(ctx, sel, v) } +func (ec *executionContext) marshalNCode2githubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐCode(ctx context.Context, sel ast.SelectionSet, v model.Code) graphql.Marshaler { + return ec._Code(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCode2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐCodeᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Code) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNCode2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐCode(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNCode2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐCode(ctx context.Context, sel ast.SelectionSet, v *model.Code) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._Code(ctx, sel, v) +} + func (ec *executionContext) marshalNCommission2githubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐCommission(ctx context.Context, sel ast.SelectionSet, v model.Commission) graphql.Marshaler { return ec._Commission(ctx, sel, &v) } @@ -12560,6 +14446,57 @@ func (ec *executionContext) marshalNContent2ᚖgithubᚗcomᚋcosmosᚑgaminghub return ec._Content(ctx, sel, v) } +func (ec *executionContext) marshalNContract2githubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐContract(ctx context.Context, sel ast.SelectionSet, v model.Contract) graphql.Marshaler { + return ec._Contract(ctx, sel, &v) +} + +func (ec *executionContext) marshalNContract2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐContractᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Contract) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNContract2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐContract(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + return ret +} + +func (ec *executionContext) marshalNContract2ᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐContract(ctx context.Context, sel ast.SelectionSet, v *model.Contract) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._Contract(ctx, sel, v) +} + func (ec *executionContext) marshalNDelegation2ᚕᚖgithubᚗcomᚋcosmosᚑgaminghubᚋexploderᚑgraphqlᚋgraphᚋmodelᚐDelegationᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Delegation) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup diff --git a/graph/model/models_gen.go b/graph/model/models_gen.go index 8a457d8..fd9a0c7 100644 --- a/graph/model/models_gen.go +++ b/graph/model/models_gen.go @@ -38,6 +38,19 @@ type Change struct { Subspace string `json:"subspace"` } +type Code struct { + CodeID int `json:"code_id"` + Contract string `json:"contract"` + DataHash string `json:"data_hash"` + CreatedAt string `json:"created_at"` + Creator string `json:"creator"` + InstantiateCount int `json:"instantiate_count"` + Permission string `json:"permission"` + PermittedAddress string `json:"permitted_address"` + Txhash string `json:"txhash"` + Version string `json:"version"` +} + type Commission struct { Commission *Commissions `json:"commission"` } @@ -60,6 +73,23 @@ type Content struct { Plan *Plan `json:"plan"` } +type Contract struct { + CodeID int `json:"code_id"` + Contract string `json:"contract"` + ContractAddress string `json:"contract_address"` + Admin string `json:"admin"` + Creator string `json:"creator"` + ExecutedCount int `json:"executed_count"` + InstantiatedAt string `json:"instantiated_at"` + Label string `json:"label"` + LastExecutedAt string `json:"last_executed_at"` + Permission string `json:"permission"` + PermittedAddress string `json:"permitted_address"` + Txhash string `json:"txhash"` + Version string `json:"version"` + Messages string `json:"messages"` +} + type Delegation struct { Moniker string `json:"moniker"` DelegatorAddress string `json:"delegator_address"` diff --git a/graph/schema.graphqls b/graph/schema.graphqls index 810b4db..356f5d0 100644 --- a/graph/schema.graphqls +++ b/graph/schema.graphqls @@ -263,6 +263,36 @@ type DelegatorResponse { total_count: Int! } +type Code { + code_id: Int! + contract: String! + data_hash: String! + created_at: String! + creator: String! + instantiate_count: Int! + permission: String! + permitted_address: String! + txhash: String! + version: String! +} + +type Contract { + code_id: Int! + contract: String! + contract_address: String! + admin: String! + creator: String! + executed_count: Int! + instantiated_at: String! + label: String! + last_executed_at: String! + permission: String! + permitted_address: String! + txhash: String! + version: String! + messages: String! +} + type Query { blocks(offset: Int, size: Int): [Block!]! block_detail(height: Int): Block! @@ -335,4 +365,34 @@ type Query { Get delegators in validator detail """ delegators(operator_address: String!, offset: Int!): DelegatorResponse! + + """ + Get list code + """ + codes(after: Int!, size: Int!): [Code!]! + + """ + Get code detail + """ + code_detail(code_id: Int!): Code! + + """ + Get code transactions + """ + code_transactions(code_id: Int!, before: Int!, size: Int!): [Tx!]! + + """ + Get code contracts + """ + code_contracts(code_id: Int!, offset: Int!, size: Int!): [Contract!]! + + """ + Get list contract + """ + contracts(offset: Int!, size: Int!, keyword: String): [Contract!]! + + """ + Get contract detail + """ + contract_detail(contract_address: String!): Contract! } diff --git a/graph/schema.resolvers.go b/graph/schema.resolvers.go index 3f36b8a..fd07a7a 100644 --- a/graph/schema.resolvers.go +++ b/graph/schema.resolvers.go @@ -18,7 +18,7 @@ import ( func (r *queryResolver) Blocks(ctx context.Context, offset *int, size *int) ([]*model.Block, error) { results, err := document.Block{}.GetBlockListByOffsetAndSize(*offset, *size) if err != nil { - return []*model.Block{}, nil + return []*model.Block{}, err } return document.Block{}.FormatBsonMForModel(results) } @@ -26,7 +26,7 @@ func (r *queryResolver) Blocks(ctx context.Context, offset *int, size *int) ([]* func (r *queryResolver) BlockDetail(ctx context.Context, height *int) (*model.Block, error) { result, err := document.Block{}.QueryBlockByHeight(int64(*height)) if err != nil { - return &model.Block{}, nil + return &model.Block{}, err } return document.Block{}.FormatBsonMForModelBlockDetail(result) } @@ -34,7 +34,7 @@ func (r *queryResolver) BlockDetail(ctx context.Context, height *int) (*model.Bl func (r *queryResolver) BlockTxs(ctx context.Context, height *int) ([]*model.Tx, error) { txs, err := document.CommonTx{}.QueryTxByHeight(int64(*height)) if err != nil { - return []*model.Tx{}, nil + return []*model.Tx{}, err } return document.CommonTx{}.FormatListTxsForModel(txs) } @@ -42,7 +42,7 @@ func (r *queryResolver) BlockTxs(ctx context.Context, height *int) ([]*model.Tx, func (r *queryResolver) Txs(ctx context.Context, size *int) ([]*model.Tx, error) { txs, err := document.CommonTx{}.GetListTxBy(*size) if err != nil { - return []*model.Tx{}, nil + return []*model.Tx{}, err } return document.CommonTx{}.FormatListTxsForModel(txs) } @@ -51,8 +51,7 @@ func (r *queryResolver) TxDetail(ctx context.Context, txHash *string) (*model.Tx tx, err := document.CommonTx{}.QueryTxByHash(*txHash) if err != nil { - fmt.Print(err.Error()) - return &model.Tx{}, nil + return &model.Tx{}, err } return document.CommonTx{}.FormatTxForModel(tx) @@ -61,7 +60,7 @@ func (r *queryResolver) TxDetail(ctx context.Context, txHash *string) (*model.Tx func (r *queryResolver) Validators(ctx context.Context) ([]*model.Validator, error) { validators, err := document.Validator{}.GetValidatorList() if err != nil { - return []*model.Validator{}, nil + return []*model.Validator{}, err } listConsensusAddress := document.Validator{}.GetListConsensusAddress(validators) @@ -98,7 +97,7 @@ func (r *queryResolver) Validators(ctx context.Context) ([]*model.Validator, err func (r *queryResolver) ValidatorDetail(ctx context.Context, operatorAddress *string) (*model.Validator, error) { validator, err := document.Validator{}.QueryValidatorDetailByOperatorAddr(*operatorAddress) if err != nil { - return &model.Validator{}, nil + return &model.Validator{}, err } upTimeCount, overBlocks := document.MissedBlock{}.GetMissedBlockCount([]string{validator.ConsensusAddres}) commision, _ := utils.ParseStringToFloat(validator.Commission.CommissionRate.Rate) @@ -134,17 +133,17 @@ func (r *queryResolver) ValidatorDetail(ctx context.Context, operatorAddress *st func (r *queryResolver) Uptimes(ctx context.Context, operatorAddress *string) (*model.UptimeResult, error) { block, err := document.Block{}.QueryLatestBlockFromDB() if err != nil { - return &model.UptimeResult{}, nil + return &model.UptimeResult{}, err } validator, err := document.GetValidatorByAddr(*operatorAddress) if err != nil { - return &model.UptimeResult{}, nil + return &model.UptimeResult{}, err } missedBlocks, err := document.MissedBlock{}.GetListMissedBlock(block.Height, validator.ConsensusAddres) if err != nil { - return &model.UptimeResult{}, nil + return &model.UptimeResult{}, err } var uptimeList []*model.Uptime for _, missedBlock := range missedBlocks { @@ -164,7 +163,7 @@ func (r *queryResolver) Uptimes(ctx context.Context, operatorAddress *string) (* func (r *queryResolver) ProposedBlocks(ctx context.Context, before *int, size *int, operatorAddress string) ([]*model.Block, error) { blocks, totalRecord, err := document.Block{}.GetBlockListByOffsetAndSizeByOperatorAddress(*before, *size, operatorAddress) if err != nil { - return []*model.Block{}, nil + return []*model.Block{}, err } return document.Block{}.FormatListBlockForModel(blocks, totalRecord) } @@ -172,7 +171,7 @@ func (r *queryResolver) ProposedBlocks(ctx context.Context, before *int, size *i func (r *queryResolver) PowerEvents(ctx context.Context, before *int, size *int, operatorAddress string) ([]*model.PowerEvent, error) { txs, err := document.CommonTx{}.GetListTxByAddress(*before, *size, operatorAddress) if err != nil { - return []*model.PowerEvent{}, nil + return []*model.PowerEvent{}, err } return document.CommonTx{}.FormatListTxsForModelPowerEvent(txs, operatorAddress) } @@ -180,11 +179,11 @@ func (r *queryResolver) PowerEvents(ctx context.Context, before *int, size *int, func (r *queryResolver) AccountTransactions(ctx context.Context, accAddress string, before int, size int) ([]*model.Tx, error) { listTxHash, err := document.AccountTransaction{}.GetListTxsByAddress(before, size, accAddress) if err != nil { - return []*model.Tx{}, nil + return []*model.Tx{}, err } txs, err := document.CommonTx{}.QueryByListByTxhash(listTxHash) if err != nil { - return []*model.Tx{}, nil + return []*model.Tx{}, err } return document.CommonTx{}.FormatListTxsForModel(txs) } @@ -196,18 +195,18 @@ func (r *queryResolver) AccountDetail(ctx context.Context, accAddress string) (* return &model.AccountDetail{ IsValidator: false, OperatorAddress: operatorAddress, - }, nil + }, err } return &model.AccountDetail{ IsValidator: true, OperatorAddress: operatorAddress, - }, nil + }, err } func (r *queryResolver) Proposals(ctx context.Context) ([]*model.Proposal, error) { proposals, err := document.Proposal{}.GetList() if err != nil { - return []*model.Proposal{}, nil + return []*model.Proposal{}, err } return document.Proposal{}.FormatListProposalForModel(proposals) } @@ -230,22 +229,22 @@ func (r *queryResolver) ProposalDetail(ctx context.Context, proposalID int) (*mo func (r *queryResolver) Status(ctx context.Context) (*model.Status, error) { blocks, err := document.Block{}.QueryBlockOrderByHeightDesc(2) if err != nil { - return &model.Status{}, nil + return &model.Status{}, err } bondedToken, err := document.Validator{}.GetSumBondedToken() if err != nil { - return &model.Status{}, nil + return &model.Status{}, err } totalNumTxs, err := document.Block{}.GetCountTxs() if err != nil { - return &model.Status{}, nil + return &model.Status{}, err } totalSupplyToken, err := client.GetSupply() if err != nil { - return &model.Status{}, nil + return &model.Status{}, err } BlockTime := blocks[0].Time.UnixNano() - blocks[1].Time.UnixNano() @@ -279,7 +278,7 @@ func (r *queryResolver) Commission(ctx context.Context, operatorAddress string) func (r *queryResolver) Delegations(ctx context.Context, accAddress string) ([]*model.Delegation, error) { delegationResult, err := client.GetDelegation(accAddress) if err != nil { - return []*model.Delegation{}, nil + return []*model.Delegation{}, err } var listDelegation []*model.Delegation @@ -400,7 +399,7 @@ func (r *queryResolver) StatsAssets(ctx context.Context) ([]*model.StatsAsset, e statsAssets, err := document.StatAssetInfoList20Minute{}.GetList() if err != nil { - return []*model.StatsAsset{}, nil + return []*model.StatsAsset{}, err } var listAssets []*model.StatsAsset for _, item := range statsAssets { @@ -419,7 +418,7 @@ func (r *queryResolver) StatsAssets(ctx context.Context) ([]*model.StatsAsset, e func (r *queryResolver) Delegators(ctx context.Context, operatorAddress string, offset int) (*model.DelegatorResponse, error) { delegationResult, err := client.GetDelegators(operatorAddress, offset) if err != nil { - return &model.DelegatorResponse{}, nil + return &model.DelegatorResponse{}, err } var delegators []*model.Delegator @@ -442,6 +441,65 @@ func (r *queryResolver) Delegators(ctx context.Context, operatorAddress string, }, nil } +func (r *queryResolver) Codes(ctx context.Context, after int, size int) ([]*model.Code, error) { + result, err := document.Code{}.GetCodeListByOffsetAndSize(after, size) + if err != nil { + return []*model.Code{}, err + } + return document.Code{}.FormatForModel(result) +} + +func (r *queryResolver) CodeDetail(ctx context.Context, codeID int) (*model.Code, error) { + code, err := document.Code{}.FindByCodeId(codeID) + if err != nil { + return &model.Code{}, err + } + return document.Code{}.FormatModelCodeItem(code), nil +} + +func (r *queryResolver) CodeTransactions(ctx context.Context, codeID int, before int, size int) ([]*model.Tx, error) { + contracts, err := document.Contract{}.GetContractByCodeId(codeID) + if err != nil { + return []*model.Tx{}, err + } + + listContractAddress := document.Contract{}.GetListContractAddressFromBson(contracts) + listTxHash, err := document.AccountTransaction{}.GetListTxsInAddress(before, size, listContractAddress) + if err != nil { + return []*model.Tx{}, err + } + + txs, err := document.CommonTx{}.QueryByListByTxhash(listTxHash) + if err != nil { + return []*model.Tx{}, err + } + return document.CommonTx{}.FormatListTxsForModel(txs) +} + +func (r *queryResolver) CodeContracts(ctx context.Context, codeID int, offset int, size int) ([]*model.Contract, error) { + result, err := document.Contract{}.GetContractPaginationByCodeId(offset, size, codeID) + if err != nil { + return []*model.Contract{}, err + } + return document.Contract{}.FormatForModel(result) +} + +func (r *queryResolver) Contracts(ctx context.Context, offset int, size int, keyword *string) ([]*model.Contract, error) { + result, err := document.Contract{}.GetContractByLimitAndOffset(offset, size, keyword) + if err != nil { + return []*model.Contract{}, err + } + return document.Contract{}.FormatForModel(result) +} + +func (r *queryResolver) ContractDetail(ctx context.Context, contractAddress string) (*model.Contract, error) { + contract, err := document.Contract{}.FindByContractAddress(contractAddress) + if err != nil { + return &model.Contract{}, err + } + return document.Contract{}.FormatBsonMForModelContractDetail(contract) +} + // Query returns generated.QueryResolver implementation. func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} } diff --git a/orm/document/account_transaction.go b/orm/document/account_transaction.go index 785d519..1cb32fd 100644 --- a/orm/document/account_transaction.go +++ b/orm/document/account_transaction.go @@ -37,3 +37,25 @@ func (_ AccountTransaction) GetListTxsByAddress(before int, size int, address st } return listTxHash, err } + +func (_ AccountTransaction) GetListTxsInAddress(before int, size int, address []string) (listTxHash []string, err error) { + var data []AccountTransaction + + selector := bson.M{ + AccountTransaction_Txhash: 1, + } + query := bson.M{AccountTransaction_Account_Address: bson.M{ + "$in": address, + }} + if before != 0 { + query[AccountTransaction_Field_Height] = bson.M{ + "$lt": before, + } + } + + err = querylistByOffsetAndSize(CollectionAccountTransaction, selector, query, desc(AccountTransaction_Field_Height), 0, size, &data) + for _, item := range data { + listTxHash = append(listTxHash, item.TxHash) + } + return listTxHash, err +} diff --git a/orm/document/code.go b/orm/document/code.go new file mode 100644 index 0000000..2f88f35 --- /dev/null +++ b/orm/document/code.go @@ -0,0 +1,75 @@ +package document + +import ( + "time" + + "github.com/cosmos-gaminghub/exploder-graphql/graph/model" + "gopkg.in/mgo.v2/bson" +) + +const ( + CollectionCode = "codes" + + CodeIdField = "code_id" +) + +type Code struct { + CodeId int `bson:"code_id"` + Contract string `bson:"contract"` + DataHash string `bson:"data_hash"` + CreatedAt time.Time `bson:"created_at"` + Creator string `bson:"creator"` + InstantiateCount int `bson:"instantiate_count"` + Permission string `bson:"permission"` + PermittedAddress string `bson:"permitted_address"` + TxHash string `bson:"txhash"` + Version string `bson:"version"` +} + +func (_ Code) FindByCodeId(codeId int) (Code, error) { + var code Code + condition := bson.M{ + CodeIdField: codeId, + } + + err := queryOne(CollectionCode, nil, condition, &code) + return code, err +} + +func (_ Code) GetCodeListByOffsetAndSize(before int, size int) ([]Code, error) { + var data []Code + + query := bson.M{} + if before != 0 { + query[CodeIdField] = bson.M{ + "$gt": before, + } + } + + err := querylistByOffsetAndSize(CollectionCode, nil, query, asc(CodeIdField), 0, size, &data) + return data, err +} + +func (_ Code) FormatForModel(results []Code) ([]*model.Code, error) { + var listCode []*model.Code + for _, item := range results { + t := Code{}.FormatModelCodeItem(item) + listCode = append(listCode, t) + } + return listCode, nil +} + +func (_ Code) FormatModelCodeItem(item Code) *model.Code { + return &model.Code{ + CodeID: item.CodeId, + Contract: item.Contract, + DataHash: item.DataHash, + CreatedAt: item.CreatedAt.String(), + Creator: item.Creator, + InstantiateCount: item.InstantiateCount, + Permission: item.Permission, + PermittedAddress: item.PermittedAddress, + Txhash: item.TxHash, + Version: item.Version, + } +} diff --git a/orm/document/contract.go b/orm/document/contract.go new file mode 100644 index 0000000..0d54d2b --- /dev/null +++ b/orm/document/contract.go @@ -0,0 +1,186 @@ +package document + +import ( + "fmt" + "time" + + "github.com/cosmos-gaminghub/exploder-graphql/graph/model" + "github.com/cosmos-gaminghub/exploder-graphql/orm" + "gopkg.in/mgo.v2/bson" +) + +const ( + CollectionContract = "contracts" + + ContractAddressField = "contract_address" + ContractTxhashField = "txhash" + ContractLabelField = "label" + ContractCodeIdFieled = "code_id" + ContractField = "contract" + ContractAdminField = "admin" + ContractCreatorField = "creator" + ContractExecutedCountField = "executed_count" + ContractInstantiatedAtField = "instantiated_at" + ContractPermissionField = "permission" + ContractPermittedAddressField = "permitted_address" + ContractLastExecutedAtField = "last_executed_at" + ContractTxHashField = "txhash" + ContractVersionField = "version" + ContractMessagesField = "messages" + + Contract_Tx_Collection = "txs" +) + +type Contract struct { + CodeId int `bson:"code_id"` + Contract string `bson:"contract"` + ContractAddress string `bson:"contract_address"` + Admin string `bson:"admin"` + Creator string `bson:"creator"` + ExecutedCount int `bson:"executed_count"` + InstantiatedAt time.Time `bson:"instantiated_at"` + Label string `bson:"label"` + LastExecutedAt time.Time `bson:"last_executed_at"` + Permission string `bson:"permission"` + PermittedAddress string `bson:"permitted_address"` + TxHash string `bson:"txhash"` + Version string `bson:"version"` +} + +func (d Contract) Name() string { + return CollectionContract +} + +func (_ Contract) FindByContractAddress(contractAddress string) (bson.M, error) { + var query = orm.NewQuery() + defer query.Release() + + var condition = []bson.M{ + { + "$match": bson.M{ + ContractAddressField: contractAddress, + }, + }, + { + "$lookup": bson.M{ + "from": CollectionNmCommonTx, + "localField": ContractTxhashField, + "foreignField": Tx_Field_Hash, + "as": Contract_Tx_Collection, + }, + }, + { + "$project": bson.M{ + "messages": "$" + Contract_Tx_Collection + ".messages", + "code_id": 1, + "contract": 1, + "contract_address": 1, + "admin": 1, + "creator": 1, + "executed_count": 1, + "instantiated_at": 1, + "label": 1, + "last_executed_at": 1, + "permission": 1, + "permitted_address": 1, + "txhash": 1, + "version": 1, + }, + }, + } + + result := bson.M{} + err := query.SetResult(&result). + SetCollection(CollectionContract). + PipeQuery( + condition, + ) + return result, err +} + +func (_ Contract) GetContractByLimitAndOffset(offset int, size int, keyword *string) ([]Contract, error) { + query := bson.M{} + if keyword != nil { + query[ContractLabelField] = bson.RegEx{ + Pattern: *keyword, + Options: "i", + } + } + + data := []Contract{} + err := querylistByOffsetAndSize(CollectionContract, nil, query, "", offset, size, &data) + return data, err +} + +// Get contract with offset and size by code id +func (_ Contract) GetContractPaginationByCodeId(offset int, size int, codeId int) ([]Contract, error) { + query := bson.M{} + query[ContractCodeIdFieled] = codeId + + data := []Contract{} + err := querylistByOffsetAndSize(CollectionContract, nil, query, "", offset, size, &data) + return data, err +} + +// Get only contract address by code id +func (_ Contract) GetContractByCodeId(codeId int) ([]bson.M, error) { + query := bson.M{} + query[ContractCodeIdFieled] = codeId + + data := []bson.M{} + var selector = bson.M{ + ContractAddressField: 1, + } + err := queryAll(CollectionContract, selector, query, "", 0, &data) + return data, err +} + +// Get list contract address from list bson.M +func (_ Contract) GetListContractAddressFromBson(bson []bson.M) (result []string) { + for _, item := range bson { + result = append(result, item[ContractAddressField].(string)) + } + return result +} + +func (_ Contract) FormatForModel(result []Contract) ([]*model.Contract, error) { + var listContract []*model.Contract + for _, item := range result { + listContract = append(listContract, Contract{}.FormatForModelItem(item)) + } + return listContract, nil +} + +func (_ Contract) FormatForModelItem(item Contract) *model.Contract { + return &model.Contract{ + CodeID: item.CodeId, + ContractAddress: item.ContractAddress, + Label: item.Label, + Contract: item.Contract, + Creator: item.Creator, + ExecutedCount: item.ExecutedCount, + InstantiatedAt: item.InstantiatedAt.String(), + LastExecutedAt: item.LastExecutedAt.String(), + Txhash: item.TxHash, + Version: item.Version, + } +} + +func (_ Contract) FormatBsonMForModelContractDetail(result bson.M) (*model.Contract, error) { + return &model.Contract{ + CodeID: int(result[ContractCodeIdFieled].(int)), + Contract: fmt.Sprintf("%v", result[ContractField]), + ContractAddress: fmt.Sprintf("%v", result[ContractAddressField]), + Admin: fmt.Sprintf("%v", result[ContractAdminField]), + Creator: fmt.Sprintf("%v", result[ContractCreatorField]), + ExecutedCount: int(result[ContractExecutedCountField].(int)), + InstantiatedAt: fmt.Sprintf("%v", result[ContractInstantiatedAtField]), + Label: fmt.Sprintf("%v", result[ContractLabelField]), + LastExecutedAt: fmt.Sprintf("%v", result[ContractLastExecutedAtField]), + Permission: fmt.Sprintf("%v", result[ContractPermissionField]), + PermittedAddress: fmt.Sprintf("%v", result[ContractPermittedAddressField]), + Txhash: fmt.Sprintf("%v", result[ContractTxHashField]), + Version: fmt.Sprintf("%v", result[ContractVersionField]), + Messages: fmt.Sprintf("%v", result[ContractMessagesField]), + }, nil +}