diff --git a/go.mod b/go.mod index 43957029..eb3eb25c 100644 --- a/go.mod +++ b/go.mod @@ -24,6 +24,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cockroachdb/apd/v3 v3.2.1 // indirect github.com/cockroachdb/errors v1.11.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect github.com/cockroachdb/redact v1.1.5 // indirect diff --git a/go.sum b/go.sum index bba43755..cddef9a7 100644 --- a/go.sum +++ b/go.sum @@ -51,6 +51,8 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg= +github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= @@ -178,6 +180,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= +github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/linxGnu/grocksdb v1.8.5 h1:Okfk5B1h0ikCYdDM7Tc5yJUS8LTwAmMBq5IPWTmOLPs= diff --git a/gqlgen.yml b/gqlgen.yml index 41131de2..af53e13f 100644 --- a/gqlgen.yml +++ b/gqlgen.yml @@ -1,6 +1,7 @@ # Where are all the schema files located? globs are supported eg src/**/*.graphql schema: - - serve/graph/*.graphql + - serve/graph/schema/*.graphql + - serve/graph/schema/**/*.graphql # Where should the generated server code go? exec: @@ -85,4 +86,7 @@ models: - github.com/gnolang/tx-indexer/serve/graph/model.Block Transaction: model: - - github.com/gnolang/tx-indexer/serve/graph/model.Transaction \ No newline at end of file + - github.com/gnolang/tx-indexer/serve/graph/model.Transaction + TransactionMessage: + model: + - github.com/gnolang/tx-indexer/serve/graph/model.TransactionMessage diff --git a/serve/graph/block_filter.go b/serve/graph/block_filter.go new file mode 100644 index 00000000..36075216 --- /dev/null +++ b/serve/graph/block_filter.go @@ -0,0 +1,31 @@ +package graph + +import ( + "time" + + "github.com/gnolang/tx-indexer/serve/graph/model" +) + +// `FilteredBlockBy` checks for conditions in BlockTime. +// By default, the condition is only checked if the input parameter exists. +func FilteredBlockBy(block *model.Block, filter model.BlockFilter) bool { + if block == nil { + return false + } + + return filteredBlockByBlockTime(block, filter.FromTime, filter.ToTime) +} + +// `filteredBlockByBlockTime` checks block based on block time. +func filteredBlockByBlockTime(block *model.Block, filterFromTime, filterToTime *time.Time) bool { + fromTime := deref(filterFromTime) + toTime := deref(filterToTime) + + if filterToTime == nil { + toTime = time.Now() + } + + blockTime := block.Time() + + return (blockTime.After(fromTime) || blockTime.Equal(fromTime)) && (toTime.IsZero() || blockTime.Before(toTime)) +} diff --git a/serve/graph/generated.go b/serve/graph/generated.go index 69694fb5..a72f4ee6 100644 --- a/serve/graph/generated.go +++ b/serve/graph/generated.go @@ -49,6 +49,12 @@ type DirectiveRoot struct { } type ComplexityRoot struct { + BankMsgSend struct { + Amount func(childComplexity int) int + FromAddress func(childComplexity int) int + ToAddress func(childComplexity int) int + } + Block struct { ChainID func(childComplexity int) int Height func(childComplexity int) int @@ -57,6 +63,37 @@ type ComplexityRoot struct { Version func(childComplexity int) int } + MemFile struct { + Body func(childComplexity int) int + Name func(childComplexity int) int + } + + MemPackage struct { + Files func(childComplexity int) int + Name func(childComplexity int) int + Path func(childComplexity int) int + } + + MsgAddPackage struct { + Creator func(childComplexity int) int + Deposit func(childComplexity int) int + Package func(childComplexity int) int + } + + MsgCall struct { + Args func(childComplexity int) int + Caller func(childComplexity int) int + Func func(childComplexity int) int + PkgPath func(childComplexity int) int + Send func(childComplexity int) int + } + + MsgRun struct { + Caller func(childComplexity int) int + Package func(childComplexity int) int + Send func(childComplexity int) int + } + Query struct { Blocks func(childComplexity int, filter model.BlockFilter) int LatestBlockHeight func(childComplexity int) int @@ -64,8 +101,8 @@ type ComplexityRoot struct { } Subscription struct { - Blocks func(childComplexity int) int - Transactions func(childComplexity int) int + Blocks func(childComplexity int, filter model.BlockFilter) int + Transactions func(childComplexity int, filter model.TransactionFilter) int } Transaction struct { @@ -75,6 +112,23 @@ type ComplexityRoot struct { GasWanted func(childComplexity int) int Hash func(childComplexity int) int Index func(childComplexity int) int + Memo func(childComplexity int) int + Messages func(childComplexity int) int + } + + TransactionMessage struct { + Route func(childComplexity int) int + TypeURL func(childComplexity int) int + Value func(childComplexity int) int + } + + TxFee struct { + GasFee func(childComplexity int) int + GasWanted func(childComplexity int) int + } + + UnexpectedMessage struct { + Raw func(childComplexity int) int } } @@ -84,8 +138,8 @@ type QueryResolver interface { LatestBlockHeight(ctx context.Context) (int, error) } type SubscriptionResolver interface { - Transactions(ctx context.Context) (<-chan *model.Transaction, error) - Blocks(ctx context.Context) (<-chan *model.Block, error) + Transactions(ctx context.Context, filter model.TransactionFilter) (<-chan *model.Transaction, error) + Blocks(ctx context.Context, filter model.BlockFilter) (<-chan *model.Block, error) } type executableSchema struct { @@ -107,6 +161,27 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in _ = ec switch typeName + "." + field { + case "BankMsgSend.amount": + if e.complexity.BankMsgSend.Amount == nil { + break + } + + return e.complexity.BankMsgSend.Amount(childComplexity), true + + case "BankMsgSend.from_address": + if e.complexity.BankMsgSend.FromAddress == nil { + break + } + + return e.complexity.BankMsgSend.FromAddress(childComplexity), true + + case "BankMsgSend.to_address": + if e.complexity.BankMsgSend.ToAddress == nil { + break + } + + return e.complexity.BankMsgSend.ToAddress(childComplexity), true + case "Block.chain_id": if e.complexity.Block.ChainID == nil { break @@ -142,6 +217,118 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Block.Version(childComplexity), true + case "MemFile.body": + if e.complexity.MemFile.Body == nil { + break + } + + return e.complexity.MemFile.Body(childComplexity), true + + case "MemFile.name": + if e.complexity.MemFile.Name == nil { + break + } + + return e.complexity.MemFile.Name(childComplexity), true + + case "MemPackage.files": + if e.complexity.MemPackage.Files == nil { + break + } + + return e.complexity.MemPackage.Files(childComplexity), true + + case "MemPackage.name": + if e.complexity.MemPackage.Name == nil { + break + } + + return e.complexity.MemPackage.Name(childComplexity), true + + case "MemPackage.path": + if e.complexity.MemPackage.Path == nil { + break + } + + return e.complexity.MemPackage.Path(childComplexity), true + + case "MsgAddPackage.creator": + if e.complexity.MsgAddPackage.Creator == nil { + break + } + + return e.complexity.MsgAddPackage.Creator(childComplexity), true + + case "MsgAddPackage.deposit": + if e.complexity.MsgAddPackage.Deposit == nil { + break + } + + return e.complexity.MsgAddPackage.Deposit(childComplexity), true + + case "MsgAddPackage.package": + if e.complexity.MsgAddPackage.Package == nil { + break + } + + return e.complexity.MsgAddPackage.Package(childComplexity), true + + case "MsgCall.args": + if e.complexity.MsgCall.Args == nil { + break + } + + return e.complexity.MsgCall.Args(childComplexity), true + + case "MsgCall.caller": + if e.complexity.MsgCall.Caller == nil { + break + } + + return e.complexity.MsgCall.Caller(childComplexity), true + + case "MsgCall.func": + if e.complexity.MsgCall.Func == nil { + break + } + + return e.complexity.MsgCall.Func(childComplexity), true + + case "MsgCall.pkg_path": + if e.complexity.MsgCall.PkgPath == nil { + break + } + + return e.complexity.MsgCall.PkgPath(childComplexity), true + + case "MsgCall.send": + if e.complexity.MsgCall.Send == nil { + break + } + + return e.complexity.MsgCall.Send(childComplexity), true + + case "MsgRun.caller": + if e.complexity.MsgRun.Caller == nil { + break + } + + return e.complexity.MsgRun.Caller(childComplexity), true + + case "MsgRun.package": + if e.complexity.MsgRun.Package == nil { + break + } + + return e.complexity.MsgRun.Package(childComplexity), true + + case "MsgRun.send": + if e.complexity.MsgRun.Send == nil { + break + } + + return e.complexity.MsgRun.Send(childComplexity), true + case "Query.blocks": if e.complexity.Query.Blocks == nil { break @@ -178,14 +365,24 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in break } - return e.complexity.Subscription.Blocks(childComplexity), true + args, err := ec.field_Subscription_blocks_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.Blocks(childComplexity, args["filter"].(model.BlockFilter)), true case "Subscription.transactions": if e.complexity.Subscription.Transactions == nil { break } - return e.complexity.Subscription.Transactions(childComplexity), true + args, err := ec.field_Subscription_transactions_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.Transactions(childComplexity, args["filter"].(model.TransactionFilter)), true case "Transaction.block_height": if e.complexity.Transaction.BlockHeight == nil { @@ -229,6 +426,62 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Transaction.Index(childComplexity), true + case "Transaction.memo": + if e.complexity.Transaction.Memo == nil { + break + } + + return e.complexity.Transaction.Memo(childComplexity), true + + case "Transaction.messages": + if e.complexity.Transaction.Messages == nil { + break + } + + return e.complexity.Transaction.Messages(childComplexity), true + + case "TransactionMessage.route": + if e.complexity.TransactionMessage.Route == nil { + break + } + + return e.complexity.TransactionMessage.Route(childComplexity), true + + case "TransactionMessage.typeUrl": + if e.complexity.TransactionMessage.TypeURL == nil { + break + } + + return e.complexity.TransactionMessage.TypeURL(childComplexity), true + + case "TransactionMessage.value": + if e.complexity.TransactionMessage.Value == nil { + break + } + + return e.complexity.TransactionMessage.Value(childComplexity), true + + case "TxFee.gas_fee": + if e.complexity.TxFee.GasFee == nil { + break + } + + return e.complexity.TxFee.GasFee(childComplexity), true + + case "TxFee.gas_wanted": + if e.complexity.TxFee.GasWanted == nil { + break + } + + return e.complexity.TxFee.GasWanted(childComplexity), true + + case "UnexpectedMessage.raw": + if e.complexity.UnexpectedMessage.Raw == nil { + break + } + + return e.complexity.UnexpectedMessage.Raw(childComplexity), true + } return 0, false } @@ -237,8 +490,18 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { rc := graphql.GetOperationContext(ctx) ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( + ec.unmarshalInputAmountInput, + ec.unmarshalInputBankMsgSendInput, ec.unmarshalInputBlockFilter, + ec.unmarshalInputMemFileInput, + ec.unmarshalInputMemPackageInput, + ec.unmarshalInputMsgAddPackageInput, + ec.unmarshalInputMsgCallInput, + ec.unmarshalInputMsgRunInput, + ec.unmarshalInputTransactionBankMessageInput, ec.unmarshalInputTransactionFilter, + ec.unmarshalInputTransactionMessageInput, + ec.unmarshalInputTransactionVmMessageInput, ) first := true @@ -337,7 +600,7 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil } -//go:embed "schema.graphql" +//go:embed "schema/query.graphql" "schema/schema.graphql" "schema/subscription.graphql" "schema/filter/block_filter.graphql" "schema/filter/transaction_filter.graphql" "schema/types/block.graphql" "schema/types/transaction.graphql" var sourcesFS embed.FS func sourceData(filename string) string { @@ -349,7 +612,13 @@ func sourceData(filename string) string { } var sources = []*ast.Source{ - {Name: "schema.graphql", Input: sourceData("schema.graphql"), BuiltIn: false}, + {Name: "schema/query.graphql", Input: sourceData("schema/query.graphql"), BuiltIn: false}, + {Name: "schema/schema.graphql", Input: sourceData("schema/schema.graphql"), BuiltIn: false}, + {Name: "schema/subscription.graphql", Input: sourceData("schema/subscription.graphql"), BuiltIn: false}, + {Name: "schema/filter/block_filter.graphql", Input: sourceData("schema/filter/block_filter.graphql"), BuiltIn: false}, + {Name: "schema/filter/transaction_filter.graphql", Input: sourceData("schema/filter/transaction_filter.graphql"), BuiltIn: false}, + {Name: "schema/types/block.graphql", Input: sourceData("schema/types/block.graphql"), BuiltIn: false}, + {Name: "schema/types/transaction.graphql", Input: sourceData("schema/types/transaction.graphql"), BuiltIn: false}, } var parsedSchema = gqlparser.MustLoadSchema(sources...) @@ -402,6 +671,36 @@ func (ec *executionContext) field_Query_transactions_args(ctx context.Context, r return args, nil } +func (ec *executionContext) field_Subscription_blocks_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 model.BlockFilter + if tmp, ok := rawArgs["filter"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter")) + arg0, err = ec.unmarshalNBlockFilter2githubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐBlockFilter(ctx, tmp) + if err != nil { + return nil, err + } + } + args["filter"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_transactions_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 model.TransactionFilter + if tmp, ok := rawArgs["filter"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter")) + arg0, err = ec.unmarshalNTransactionFilter2githubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐTransactionFilter(ctx, tmp) + if err != nil { + return nil, err + } + } + args["filter"] = arg0 + return args, nil +} + func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -440,8 +739,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** -func (ec *executionContext) _Block_height(ctx context.Context, field graphql.CollectedField, obj *model.Block) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Block_height(ctx, field) +func (ec *executionContext) _BankMsgSend_from_address(ctx context.Context, field graphql.CollectedField, obj *model.BankMsgSend) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BankMsgSend_from_address(ctx, field) if err != nil { return graphql.Null } @@ -454,7 +753,7 @@ func (ec *executionContext) _Block_height(ctx context.Context, field graphql.Col }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Height(), nil + return obj.FromAddress, nil }) if err != nil { ec.Error(ctx, err) @@ -466,26 +765,26 @@ func (ec *executionContext) _Block_height(ctx context.Context, field graphql.Col } return graphql.Null } - res := resTmp.(int64) + res := resTmp.(string) fc.Result = res - return ec.marshalNInt2int64(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_height(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BankMsgSend_from_address(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Block", + Object: "BankMsgSend", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Block_version(ctx context.Context, field graphql.CollectedField, obj *model.Block) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Block_version(ctx, field) +func (ec *executionContext) _BankMsgSend_to_address(ctx context.Context, field graphql.CollectedField, obj *model.BankMsgSend) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BankMsgSend_to_address(ctx, field) if err != nil { return graphql.Null } @@ -498,7 +797,7 @@ func (ec *executionContext) _Block_version(ctx context.Context, field graphql.Co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Version(), nil + return obj.ToAddress, nil }) if err != nil { ec.Error(ctx, err) @@ -515,11 +814,11 @@ func (ec *executionContext) _Block_version(ctx context.Context, field graphql.Co return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_version(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BankMsgSend_to_address(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Block", + Object: "BankMsgSend", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") @@ -528,8 +827,8 @@ func (ec *executionContext) fieldContext_Block_version(ctx context.Context, fiel return fc, nil } -func (ec *executionContext) _Block_chain_id(ctx context.Context, field graphql.CollectedField, obj *model.Block) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Block_chain_id(ctx, field) +func (ec *executionContext) _BankMsgSend_amount(ctx context.Context, field graphql.CollectedField, obj *model.BankMsgSend) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_BankMsgSend_amount(ctx, field) if err != nil { return graphql.Null } @@ -542,7 +841,7 @@ func (ec *executionContext) _Block_chain_id(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ChainID(), nil + return obj.Amount, nil }) if err != nil { ec.Error(ctx, err) @@ -559,11 +858,11 @@ func (ec *executionContext) _Block_chain_id(ctx context.Context, field graphql.C return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_chain_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_BankMsgSend_amount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Block", + Object: "BankMsgSend", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") @@ -572,8 +871,8 @@ func (ec *executionContext) fieldContext_Block_chain_id(ctx context.Context, fie return fc, nil } -func (ec *executionContext) _Block_time(ctx context.Context, field graphql.CollectedField, obj *model.Block) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Block_time(ctx, field) +func (ec *executionContext) _Block_height(ctx context.Context, field graphql.CollectedField, obj *model.Block) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Block_height(ctx, field) if err != nil { return graphql.Null } @@ -586,7 +885,7 @@ func (ec *executionContext) _Block_time(ctx context.Context, field graphql.Colle }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Time(), nil + return obj.Height(), nil }) if err != nil { ec.Error(ctx, err) @@ -598,26 +897,26 @@ func (ec *executionContext) _Block_time(ctx context.Context, field graphql.Colle } return graphql.Null } - res := resTmp.(time.Time) + res := resTmp.(int64) fc.Result = res - return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) + return ec.marshalNInt2int64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_time(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_height(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Time does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Block_proposer_address_raw(ctx context.Context, field graphql.CollectedField, obj *model.Block) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Block_proposer_address_raw(ctx, field) +func (ec *executionContext) _Block_version(ctx context.Context, field graphql.CollectedField, obj *model.Block) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Block_version(ctx, field) if err != nil { return graphql.Null } @@ -630,7 +929,7 @@ func (ec *executionContext) _Block_proposer_address_raw(ctx context.Context, fie }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ProposerAddressRaw(), nil + return obj.Version(), nil }) if err != nil { ec.Error(ctx, err) @@ -647,7 +946,7 @@ func (ec *executionContext) _Block_proposer_address_raw(ctx context.Context, fie return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_proposer_address_raw(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_version(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -660,8 +959,8 @@ func (ec *executionContext) fieldContext_Block_proposer_address_raw(ctx context. return fc, nil } -func (ec *executionContext) _Query_transactions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_transactions(ctx, field) +func (ec *executionContext) _Block_chain_id(ctx context.Context, field graphql.CollectedField, obj *model.Block) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Block_chain_id(ctx, field) if err != nil { return graphql.Null } @@ -674,60 +973,82 @@ func (ec *executionContext) _Query_transactions(ctx context.Context, field graph }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Transactions(rctx, fc.Args["filter"].(model.TransactionFilter)) + return obj.ChainID(), 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.Transaction) + res := resTmp.(string) fc.Result = res - return ec.marshalOTransaction2ᚕᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐTransactionᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_transactions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_chain_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Block", Field: field, IsMethod: true, - IsResolver: true, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "index": - return ec.fieldContext_Transaction_index(ctx, field) - case "hash": - return ec.fieldContext_Transaction_hash(ctx, field) - case "block_height": - return ec.fieldContext_Transaction_block_height(ctx, field) - case "gas_wanted": - return ec.fieldContext_Transaction_gas_wanted(ctx, field) - case "gas_used": - return ec.fieldContext_Transaction_gas_used(ctx, field) - case "content_raw": - return ec.fieldContext_Transaction_content_raw(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Transaction", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } + return fc, nil +} + +func (ec *executionContext) _Block_time(ctx context.Context, field graphql.CollectedField, obj *model.Block) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Block_time(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null } }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_transactions_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Time(), nil + }) + if err != nil { ec.Error(ctx, err) - return fc, err + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + fc.Result = res + return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Block_time(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Block", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Time does not have child fields") + }, } return fc, nil } -func (ec *executionContext) _Query_blocks(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_blocks(ctx, field) +func (ec *executionContext) _Block_proposer_address_raw(ctx context.Context, field graphql.CollectedField, obj *model.Block) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Block_proposer_address_raw(ctx, field) if err != nil { return graphql.Null } @@ -740,58 +1061,38 @@ func (ec *executionContext) _Query_blocks(ctx context.Context, field graphql.Col }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().Blocks(rctx, fc.Args["filter"].(model.BlockFilter)) + return obj.ProposerAddressRaw(), 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.Block) + res := resTmp.(string) fc.Result = res - return ec.marshalOBlock2ᚕᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐBlockᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_blocks(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_proposer_address_raw(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "Block", Field: field, IsMethod: true, - IsResolver: true, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "height": - return ec.fieldContext_Block_height(ctx, field) - case "version": - return ec.fieldContext_Block_version(ctx, field) - case "chain_id": - return ec.fieldContext_Block_chain_id(ctx, field) - case "time": - return ec.fieldContext_Block_time(ctx, field) - case "proposer_address_raw": - return ec.fieldContext_Block_proposer_address_raw(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Block", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_blocks_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query_latestBlockHeight(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_latestBlockHeight(ctx, field) +func (ec *executionContext) _MemFile_name(ctx context.Context, field graphql.CollectedField, obj *model.MemFile) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MemFile_name(ctx, field) if err != nil { return graphql.Null } @@ -804,7 +1105,7 @@ func (ec *executionContext) _Query_latestBlockHeight(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().LatestBlockHeight(rctx) + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -816,26 +1117,26 @@ func (ec *executionContext) _Query_latestBlockHeight(ctx context.Context, field } return graphql.Null } - res := resTmp.(int) + res := resTmp.(string) fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_latestBlockHeight(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MemFile_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "MemFile", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query___type(ctx, field) +func (ec *executionContext) _MemFile_body(ctx context.Context, field graphql.CollectedField, obj *model.MemFile) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MemFile_body(ctx, field) if err != nil { return graphql.Null } @@ -848,68 +1149,38 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.introspectType(fc.Args["name"].(string)) + return obj.Body, 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.(*introspection.Type) + res := resTmp.(string) fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MemFile_body(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "MemFile", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query___schema(ctx, field) +func (ec *executionContext) _MemPackage_name(ctx context.Context, field graphql.CollectedField, obj *model.MemPackage) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MemPackage_name(ctx, field) if err != nil { return graphql.Null } @@ -922,191 +1193,129 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.introspectSchema() + return obj.Name, 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.(*introspection.Schema) + res := resTmp.(string) fc.Result = res - return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query___schema(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MemPackage_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Query", + Object: "MemPackage", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "description": - return ec.fieldContext___Schema_description(ctx, field) - case "types": - return ec.fieldContext___Schema_types(ctx, field) - case "queryType": - return ec.fieldContext___Schema_queryType(ctx, field) - case "mutationType": - return ec.fieldContext___Schema_mutationType(ctx, field) - case "subscriptionType": - return ec.fieldContext___Schema_subscriptionType(ctx, field) - case "directives": - return ec.fieldContext___Schema_directives(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Subscription_transactions(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { - fc, err := ec.fieldContext_Subscription_transactions(ctx, field) +func (ec *executionContext) _MemPackage_path(ctx context.Context, field graphql.CollectedField, obj *model.MemPackage) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MemPackage_path(ctx, field) if err != nil { - return nil + return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil + ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Subscription().Transactions(rctx) + return obj.Path, nil }) if err != nil { ec.Error(ctx, err) - return nil + return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } - return nil - } - return func(ctx context.Context) graphql.Marshaler { - select { - case res, ok := <-resTmp.(<-chan *model.Transaction): - if !ok { - return nil - } - return graphql.WriterFunc(func(w io.Writer) { - w.Write([]byte{'{'}) - graphql.MarshalString(field.Alias).MarshalGQL(w) - w.Write([]byte{':'}) - ec.marshalNTransaction2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐTransaction(ctx, field.Selections, res).MarshalGQL(w) - w.Write([]byte{'}'}) - }) - case <-ctx.Done(): - return nil - } + return graphql.Null } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Subscription_transactions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MemPackage_path(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Subscription", + Object: "MemPackage", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "index": - return ec.fieldContext_Transaction_index(ctx, field) - case "hash": - return ec.fieldContext_Transaction_hash(ctx, field) - case "block_height": - return ec.fieldContext_Transaction_block_height(ctx, field) - case "gas_wanted": - return ec.fieldContext_Transaction_gas_wanted(ctx, field) - case "gas_used": - return ec.fieldContext_Transaction_gas_used(ctx, field) - case "content_raw": - return ec.fieldContext_Transaction_content_raw(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Transaction", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Subscription_blocks(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { - fc, err := ec.fieldContext_Subscription_blocks(ctx, field) +func (ec *executionContext) _MemPackage_files(ctx context.Context, field graphql.CollectedField, obj *model.MemPackage) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MemPackage_files(ctx, field) if err != nil { - return nil + return graphql.Null } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil + ret = graphql.Null } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Subscription().Blocks(rctx) + return obj.Files, nil }) if err != nil { ec.Error(ctx, err) - return nil + return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return nil - } - return func(ctx context.Context) graphql.Marshaler { - select { - case res, ok := <-resTmp.(<-chan *model.Block): - if !ok { - return nil - } - return graphql.WriterFunc(func(w io.Writer) { - w.Write([]byte{'{'}) - graphql.MarshalString(field.Alias).MarshalGQL(w) - w.Write([]byte{':'}) - ec.marshalNBlock2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐBlock(ctx, field.Selections, res).MarshalGQL(w) - w.Write([]byte{'}'}) - }) - case <-ctx.Done(): - return nil - } + return graphql.Null } + res := resTmp.([]*model.MemFile) + fc.Result = res + return ec.marshalOMemFile2ᚕᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMemFileᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Subscription_blocks(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MemPackage_files(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Subscription", + Object: "MemPackage", Field: field, - IsMethod: true, - IsResolver: true, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "height": - return ec.fieldContext_Block_height(ctx, field) - case "version": - return ec.fieldContext_Block_version(ctx, field) - case "chain_id": - return ec.fieldContext_Block_chain_id(ctx, field) - case "time": - return ec.fieldContext_Block_time(ctx, field) - case "proposer_address_raw": - return ec.fieldContext_Block_proposer_address_raw(ctx, field) + case "name": + return ec.fieldContext_MemFile_name(ctx, field) + case "body": + return ec.fieldContext_MemFile_body(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Block", field.Name) + return nil, fmt.Errorf("no field named %q was found under type MemFile", field.Name) }, } return fc, nil } -func (ec *executionContext) _Transaction_index(ctx context.Context, field graphql.CollectedField, obj *model.Transaction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Transaction_index(ctx, field) +func (ec *executionContext) _MsgAddPackage_creator(ctx context.Context, field graphql.CollectedField, obj *model.MsgAddPackage) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MsgAddPackage_creator(ctx, field) if err != nil { return graphql.Null } @@ -1119,7 +1328,7 @@ func (ec *executionContext) _Transaction_index(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Index(), nil + return obj.Creator, nil }) if err != nil { ec.Error(ctx, err) @@ -1131,26 +1340,26 @@ func (ec *executionContext) _Transaction_index(ctx context.Context, field graphq } return graphql.Null } - res := resTmp.(int) + res := resTmp.(string) fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_index(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MsgAddPackage_creator(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Transaction", + Object: "MsgAddPackage", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Transaction_hash(ctx context.Context, field graphql.CollectedField, obj *model.Transaction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Transaction_hash(ctx, field) +func (ec *executionContext) _MsgAddPackage_package(ctx context.Context, field graphql.CollectedField, obj *model.MsgAddPackage) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MsgAddPackage_package(ctx, field) if err != nil { return graphql.Null } @@ -1163,7 +1372,7 @@ func (ec *executionContext) _Transaction_hash(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Hash(), nil + return obj.Package, nil }) if err != nil { ec.Error(ctx, err) @@ -1175,26 +1384,34 @@ func (ec *executionContext) _Transaction_hash(ctx context.Context, field graphql } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*model.MemPackage) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNMemPackage2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMemPackage(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_hash(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MsgAddPackage_package(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Transaction", + Object: "MsgAddPackage", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext_MemPackage_name(ctx, field) + case "path": + return ec.fieldContext_MemPackage_path(ctx, field) + case "files": + return ec.fieldContext_MemPackage_files(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type MemPackage", field.Name) }, } return fc, nil } -func (ec *executionContext) _Transaction_block_height(ctx context.Context, field graphql.CollectedField, obj *model.Transaction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Transaction_block_height(ctx, field) +func (ec *executionContext) _MsgAddPackage_deposit(ctx context.Context, field graphql.CollectedField, obj *model.MsgAddPackage) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MsgAddPackage_deposit(ctx, field) if err != nil { return graphql.Null } @@ -1207,7 +1424,7 @@ func (ec *executionContext) _Transaction_block_height(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.BlockHeight(), nil + return obj.Deposit, nil }) if err != nil { ec.Error(ctx, err) @@ -1219,26 +1436,26 @@ func (ec *executionContext) _Transaction_block_height(ctx context.Context, field } return graphql.Null } - res := resTmp.(int) + res := resTmp.(string) fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_block_height(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MsgAddPackage_deposit(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Transaction", + Object: "MsgAddPackage", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Transaction_gas_wanted(ctx context.Context, field graphql.CollectedField, obj *model.Transaction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Transaction_gas_wanted(ctx, field) +func (ec *executionContext) _MsgCall_caller(ctx context.Context, field graphql.CollectedField, obj *model.MsgCall) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MsgCall_caller(ctx, field) if err != nil { return graphql.Null } @@ -1251,7 +1468,7 @@ func (ec *executionContext) _Transaction_gas_wanted(ctx context.Context, field g }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.GasWanted(), nil + return obj.Caller, nil }) if err != nil { ec.Error(ctx, err) @@ -1263,26 +1480,26 @@ func (ec *executionContext) _Transaction_gas_wanted(ctx context.Context, field g } return graphql.Null } - res := resTmp.(int) + res := resTmp.(string) fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_gas_wanted(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MsgCall_caller(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Transaction", + Object: "MsgCall", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Transaction_gas_used(ctx context.Context, field graphql.CollectedField, obj *model.Transaction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Transaction_gas_used(ctx, field) +func (ec *executionContext) _MsgCall_send(ctx context.Context, field graphql.CollectedField, obj *model.MsgCall) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MsgCall_send(ctx, field) if err != nil { return graphql.Null } @@ -1295,7 +1512,7 @@ func (ec *executionContext) _Transaction_gas_used(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.GasUsed(), nil + return obj.Send, nil }) if err != nil { ec.Error(ctx, err) @@ -1307,26 +1524,26 @@ func (ec *executionContext) _Transaction_gas_used(ctx context.Context, field gra } return graphql.Null } - res := resTmp.(int) + res := resTmp.(string) fc.Result = res - return ec.marshalNInt2int(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_gas_used(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MsgCall_send(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Transaction", + Object: "MsgCall", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Int does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Transaction_content_raw(ctx context.Context, field graphql.CollectedField, obj *model.Transaction) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Transaction_content_raw(ctx, field) +func (ec *executionContext) _MsgCall_pkg_path(ctx context.Context, field graphql.CollectedField, obj *model.MsgCall) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MsgCall_pkg_path(ctx, field) if err != nil { return graphql.Null } @@ -1339,7 +1556,7 @@ func (ec *executionContext) _Transaction_content_raw(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ContentRaw(), nil + return obj.PkgPath, nil }) if err != nil { ec.Error(ctx, err) @@ -1356,11 +1573,11 @@ func (ec *executionContext) _Transaction_content_raw(ctx context.Context, field return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_content_raw(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MsgCall_pkg_path(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "Transaction", + Object: "MsgCall", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") @@ -1369,8 +1586,8 @@ func (ec *executionContext) fieldContext_Transaction_content_raw(ctx context.Con return fc, nil } -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_name(ctx, field) +func (ec *executionContext) _MsgCall_func(ctx context.Context, field graphql.CollectedField, obj *model.MsgCall) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MsgCall_func(ctx, field) if err != nil { return graphql.Null } @@ -1383,7 +1600,7 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.Func, nil }) if err != nil { ec.Error(ctx, err) @@ -1400,9 +1617,9 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MsgCall_func(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "MsgCall", Field: field, IsMethod: false, IsResolver: false, @@ -1413,8 +1630,8 @@ func (ec *executionContext) fieldContext___Directive_name(ctx context.Context, f return fc, nil } -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_description(ctx, field) +func (ec *executionContext) _MsgCall_args(ctx context.Context, field graphql.CollectedField, obj *model.MsgCall) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MsgCall_args(ctx, field) if err != nil { return graphql.Null } @@ -1427,7 +1644,7 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field }() 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.Args, nil }) if err != nil { ec.Error(ctx, err) @@ -1436,16 +1653,16 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.([]string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOString2ᚕstringᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MsgCall_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "MsgCall", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") @@ -1454,8 +1671,8 @@ func (ec *executionContext) fieldContext___Directive_description(ctx context.Con return fc, nil } -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_locations(ctx, field) +func (ec *executionContext) _MsgRun_caller(ctx context.Context, field graphql.CollectedField, obj *model.MsgRun) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MsgRun_caller(ctx, field) if err != nil { return graphql.Null } @@ -1468,7 +1685,7 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Locations, nil + return obj.Caller, nil }) if err != nil { ec.Error(ctx, err) @@ -1480,26 +1697,26 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } return graphql.Null } - res := resTmp.([]string) + res := resTmp.(string) fc.Result = res - return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_locations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MsgRun_caller(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "MsgRun", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type __DirectiveLocation does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_args(ctx, field) +func (ec *executionContext) _MsgRun_send(ctx context.Context, field graphql.CollectedField, obj *model.MsgRun) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MsgRun_send(ctx, field) if err != nil { return graphql.Null } @@ -1512,7 +1729,7 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Args, nil + return obj.Send, nil }) if err != nil { ec.Error(ctx, err) @@ -1524,36 +1741,26 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } return graphql.Null } - res := resTmp.([]introspection.InputValue) + res := resTmp.(string) fc.Result = res - return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MsgRun_send(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "MsgRun", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) +func (ec *executionContext) _MsgRun_package(ctx context.Context, field graphql.CollectedField, obj *model.MsgRun) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MsgRun_package(ctx, field) if err != nil { return graphql.Null } @@ -1566,7 +1773,7 @@ func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.IsRepeatable, nil + return obj.Package, nil }) if err != nil { ec.Error(ctx, err) @@ -1578,26 +1785,34 @@ func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(*model.MemPackage) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNMemPackage2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMemPackage(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_MsgRun_package(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Directive", + Object: "MsgRun", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext_MemPackage_name(ctx, field) + case "path": + return ec.fieldContext_MemPackage_path(ctx, field) + case "files": + return ec.fieldContext_MemPackage_files(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type MemPackage", field.Name) }, } return fc, nil } -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_name(ctx, field) +func (ec *executionContext) _Query_transactions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_transactions(ctx, field) if err != nil { return graphql.Null } @@ -1610,38 +1825,64 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return ec.resolvers.Query().Transactions(rctx, fc.Args["filter"].(model.TransactionFilter)) }) 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) + res := resTmp.([]*model.Transaction) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOTransaction2ᚕᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐTransactionᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_transactions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "Query", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "index": + return ec.fieldContext_Transaction_index(ctx, field) + case "hash": + return ec.fieldContext_Transaction_hash(ctx, field) + case "block_height": + return ec.fieldContext_Transaction_block_height(ctx, field) + case "gas_wanted": + return ec.fieldContext_Transaction_gas_wanted(ctx, field) + case "gas_used": + return ec.fieldContext_Transaction_gas_used(ctx, field) + case "content_raw": + return ec.fieldContext_Transaction_content_raw(ctx, field) + case "messages": + return ec.fieldContext_Transaction_messages(ctx, field) + case "memo": + return ec.fieldContext_Transaction_memo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Transaction", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_transactions_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_description(ctx, field) +func (ec *executionContext) _Query_blocks(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_blocks(ctx, field) if err != nil { return graphql.Null } @@ -1654,7 +1895,7 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field }() 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 ec.resolvers.Query().Blocks(rctx, fc.Args["filter"].(model.BlockFilter)) }) if err != nil { ec.Error(ctx, err) @@ -1663,26 +1904,49 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.([]*model.Block) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOBlock2ᚕᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐBlockᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_blocks(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "Query", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "height": + return ec.fieldContext_Block_height(ctx, field) + case "version": + return ec.fieldContext_Block_version(ctx, field) + case "chain_id": + return ec.fieldContext_Block_chain_id(ctx, field) + case "time": + return ec.fieldContext_Block_time(ctx, field) + case "proposer_address_raw": + return ec.fieldContext_Block_proposer_address_raw(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Block", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_blocks_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_isDeprecated(ctx, field) +func (ec *executionContext) _Query_latestBlockHeight(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_latestBlockHeight(ctx, field) if err != nil { return graphql.Null } @@ -1695,7 +1959,7 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.IsDeprecated(), nil + return ec.resolvers.Query().LatestBlockHeight(rctx) }) if err != nil { ec.Error(ctx, err) @@ -1707,26 +1971,26 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(int) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_latestBlockHeight(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "Query", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_deprecationReason(ctx, field) +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___type(ctx, field) if err != nil { return graphql.Null } @@ -1739,7 +2003,7 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.DeprecationReason(), nil + return ec.introspectType(fc.Args["name"].(string)) }) if err != nil { ec.Error(ctx, err) @@ -1748,26 +2012,59 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.(*introspection.Type) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__EnumValue", + Object: "Query", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_name(ctx, field) +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___schema(ctx, field) if err != nil { return graphql.Null } @@ -1780,133 +2077,217 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return ec.introspectSchema() }) 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) + res := resTmp.(*introspection.Schema) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query___schema(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "Query", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "description": + return ec.fieldContext___Schema_description(ctx, field) + case "types": + return ec.fieldContext___Schema_types(ctx, field) + case "queryType": + return ec.fieldContext___Schema_queryType(ctx, field) + case "mutationType": + return ec.fieldContext___Schema_mutationType(ctx, field) + case "subscriptionType": + return ec.fieldContext___Schema_subscriptionType(ctx, field) + case "directives": + return ec.fieldContext___Schema_directives(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_description(ctx, field) +func (ec *executionContext) _Subscription_transactions(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_transactions(ctx, field) if err != nil { - return graphql.Null + return nil } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + ret = nil } }() 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 ec.resolvers.Subscription().Transactions(rctx, fc.Args["filter"].(model.TransactionFilter)) }) if err != nil { ec.Error(ctx, err) - return graphql.Null + return nil } if resTmp == nil { - return graphql.Null + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.Transaction): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNTransaction2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐTransaction(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Subscription_transactions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "Subscription", Field: field, IsMethod: true, - IsResolver: false, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "index": + return ec.fieldContext_Transaction_index(ctx, field) + case "hash": + return ec.fieldContext_Transaction_hash(ctx, field) + case "block_height": + return ec.fieldContext_Transaction_block_height(ctx, field) + case "gas_wanted": + return ec.fieldContext_Transaction_gas_wanted(ctx, field) + case "gas_used": + return ec.fieldContext_Transaction_gas_used(ctx, field) + case "content_raw": + return ec.fieldContext_Transaction_content_raw(ctx, field) + case "messages": + return ec.fieldContext_Transaction_messages(ctx, field) + case "memo": + return ec.fieldContext_Transaction_memo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Transaction", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_transactions_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_args(ctx, field) +func (ec *executionContext) _Subscription_blocks(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_blocks(ctx, field) if err != nil { - return graphql.Null + return nil } ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null + ret = nil } }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Args, nil + return ec.resolvers.Subscription().Blocks(rctx, fc.Args["filter"].(model.BlockFilter)) }) if err != nil { ec.Error(ctx, err) - return graphql.Null + return nil } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { ec.Errorf(ctx, "must not be null") } - return graphql.Null + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.Block): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNBlock2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐBlock(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } } - res := resTmp.([]introspection.InputValue) - fc.Result = res - return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Subscription_blocks(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "Subscription", Field: field, - IsMethod: false, - IsResolver: false, + IsMethod: true, + IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) + case "height": + return ec.fieldContext_Block_height(ctx, field) + case "version": + return ec.fieldContext_Block_version(ctx, field) + case "chain_id": + return ec.fieldContext_Block_chain_id(ctx, field) + case "time": + return ec.fieldContext_Block_time(ctx, field) + case "proposer_address_raw": + return ec.fieldContext_Block_proposer_address_raw(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + return nil, fmt.Errorf("no field named %q was found under type Block", field.Name) }, } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_blocks_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } return fc, nil } -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_type(ctx, field) +func (ec *executionContext) _Transaction_index(ctx context.Context, field graphql.CollectedField, obj *model.Transaction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Transaction_index(ctx, field) if err != nil { return graphql.Null } @@ -1919,7 +2300,7 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col }() 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.Index(), nil }) if err != nil { ec.Error(ctx, err) @@ -1931,48 +2312,26 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } return graphql.Null } - res := resTmp.(*introspection.Type) + res := resTmp.(int) fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_index(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "Transaction", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_isDeprecated(ctx, field) +func (ec *executionContext) _Transaction_hash(ctx context.Context, field graphql.CollectedField, obj *model.Transaction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Transaction_hash(ctx, field) if err != nil { return graphql.Null } @@ -1985,7 +2344,7 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.IsDeprecated(), nil + return obj.Hash(), nil }) if err != nil { ec.Error(ctx, err) @@ -1997,26 +2356,26 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(string) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_isDeprecated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_hash(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "Transaction", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_deprecationReason(ctx, field) +func (ec *executionContext) _Transaction_block_height(ctx context.Context, field graphql.CollectedField, obj *model.Transaction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Transaction_block_height(ctx, field) if err != nil { return graphql.Null } @@ -2029,35 +2388,38 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.DeprecationReason(), nil + return obj.BlockHeight(), 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) + res := resTmp.(int) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Field_deprecationReason(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_block_height(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Field", + Object: "Transaction", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_name(ctx, field) +func (ec *executionContext) _Transaction_gas_wanted(ctx context.Context, field graphql.CollectedField, obj *model.Transaction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Transaction_gas_wanted(ctx, field) if err != nil { return graphql.Null } @@ -2070,7 +2432,7 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.GasWanted(), nil }) if err != nil { ec.Error(ctx, err) @@ -2082,26 +2444,26 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } return graphql.Null } - res := resTmp.(string) + res := resTmp.(int) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_gas_wanted(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__InputValue", + Object: "Transaction", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_description(ctx, field) +func (ec *executionContext) _Transaction_gas_used(ctx context.Context, field graphql.CollectedField, obj *model.Transaction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Transaction_gas_used(ctx, field) if err != nil { return graphql.Null } @@ -2114,35 +2476,38 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field }() 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.GasUsed(), 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) + res := resTmp.(int) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_gas_used(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__InputValue", + Object: "Transaction", Field: field, IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_type(ctx, field) +func (ec *executionContext) _Transaction_content_raw(ctx context.Context, field graphql.CollectedField, obj *model.Transaction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Transaction_content_raw(ctx, field) if err != nil { return graphql.Null } @@ -2155,7 +2520,7 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq }() 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.ContentRaw(), nil }) if err != nil { ec.Error(ctx, err) @@ -2167,48 +2532,26 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } return graphql.Null } - res := resTmp.(*introspection.Type) + res := resTmp.(string) fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_content_raw(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__InputValue", + Object: "Transaction", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_defaultValue(ctx, field) +func (ec *executionContext) _Transaction_messages(ctx context.Context, field graphql.CollectedField, obj *model.Transaction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Transaction_messages(ctx, field) if err != nil { return graphql.Null } @@ -2221,35 +2564,46 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.DefaultValue, nil + return obj.Messages(), 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) + res := resTmp.([]*model.TransactionMessage) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNTransactionMessage2ᚕᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐTransactionMessage(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_messages(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__InputValue", + Object: "Transaction", Field: field, - IsMethod: false, + IsMethod: true, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "typeUrl": + return ec.fieldContext_TransactionMessage_typeUrl(ctx, field) + case "route": + return ec.fieldContext_TransactionMessage_route(ctx, field) + case "value": + return ec.fieldContext_TransactionMessage_value(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TransactionMessage", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_description(ctx, field) +func (ec *executionContext) _Transaction_memo(ctx context.Context, field graphql.CollectedField, obj *model.Transaction) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Transaction_memo(ctx, field) if err != nil { return graphql.Null } @@ -2262,23 +2616,26 @@ func (ec *executionContext) ___Schema_description(ctx context.Context, field gra }() 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.Memo(), 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) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_memo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "Transaction", Field: field, IsMethod: true, IsResolver: false, @@ -2289,8 +2646,8 @@ func (ec *executionContext) fieldContext___Schema_description(ctx context.Contex return fc, nil } -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_types(ctx, field) +func (ec *executionContext) _TransactionMessage_typeUrl(ctx context.Context, field graphql.CollectedField, obj *model.TransactionMessage) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TransactionMessage_typeUrl(ctx, field) if err != nil { return graphql.Null } @@ -2303,7 +2660,7 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Types(), nil + return obj.TypeURL, nil }) if err != nil { ec.Error(ctx, err) @@ -2315,48 +2672,26 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } return graphql.Null } - res := resTmp.([]introspection.Type) + res := resTmp.(string) fc.Result = res - return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_types(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TransactionMessage_typeUrl(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "TransactionMessage", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_queryType(ctx, field) +func (ec *executionContext) _TransactionMessage_route(ctx context.Context, field graphql.CollectedField, obj *model.TransactionMessage) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TransactionMessage_route(ctx, field) if err != nil { return graphql.Null } @@ -2369,7 +2704,7 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.QueryType(), nil + return obj.Route, nil }) if err != nil { ec.Error(ctx, err) @@ -2381,48 +2716,26 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } return graphql.Null } - res := resTmp.(*introspection.Type) + res := resTmp.(string) fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_queryType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TransactionMessage_route(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "TransactionMessage", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_mutationType(ctx, field) +func (ec *executionContext) _TransactionMessage_value(ctx context.Context, field graphql.CollectedField, obj *model.TransactionMessage) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TransactionMessage_value(ctx, field) if err != nil { return graphql.Null } @@ -2435,57 +2748,38 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.MutationType(), nil + return obj.Value, 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.(*introspection.Type) + res := resTmp.(model.MessageValue) fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalNMessageValue2githubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMessageValue(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_mutationType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TransactionMessage_value(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "TransactionMessage", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, errors.New("field of type MessageValue does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_subscriptionType(ctx, field) +func (ec *executionContext) _TxFee_gas_wanted(ctx context.Context, field graphql.CollectedField, obj *model.TxFee) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TxFee_gas_wanted(ctx, field) if err != nil { return graphql.Null } @@ -2498,57 +2792,38 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.SubscriptionType(), nil + return obj.GasWanted, 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.(*introspection.Type) + res := resTmp.(int) fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TxFee_gas_wanted(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "TxFee", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_directives(ctx, field) +func (ec *executionContext) _TxFee_gas_fee(ctx context.Context, field graphql.CollectedField, obj *model.TxFee) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TxFee_gas_fee(ctx, field) if err != nil { return graphql.Null } @@ -2561,7 +2836,7 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Directives(), nil + return obj.GasFee, nil }) if err != nil { ec.Error(ctx, err) @@ -2573,38 +2848,26 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } return graphql.Null } - res := resTmp.([]introspection.Directive) + res := resTmp.(int) fc.Result = res - return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) + return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Schema_directives(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_TxFee_gas_fee(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Schema", + Object: "TxFee", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___Directive_name(ctx, field) - case "description": - return ec.fieldContext___Directive_description(ctx, field) - case "locations": - return ec.fieldContext___Directive_locations(ctx, field) - case "args": - return ec.fieldContext___Directive_args(ctx, field) - case "isRepeatable": - return ec.fieldContext___Directive_isRepeatable(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) + return nil, errors.New("field of type Int does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_kind(ctx, field) +func (ec *executionContext) _UnexpectedMessage_raw(ctx context.Context, field graphql.CollectedField, obj *model.UnexpectedMessage) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UnexpectedMessage_raw(ctx, field) if err != nil { return graphql.Null } @@ -2617,7 +2880,7 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Kind(), nil + return obj.Raw, nil }) if err != nil { ec.Error(ctx, err) @@ -2631,24 +2894,24 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } res := resTmp.(string) fc.Result = res - return ec.marshalN__TypeKind2string(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_kind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_UnexpectedMessage_raw(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "UnexpectedMessage", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type __TypeKind does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_name(ctx, field) +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_name(ctx, field) if err != nil { return graphql.Null } @@ -2661,25 +2924,28 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name(), nil + return obj.Name, 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) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__Directive", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { return nil, errors.New("field of type String does not have child fields") @@ -2688,8 +2954,8 @@ func (ec *executionContext) fieldContext___Type_name(ctx context.Context, field return fc, nil } -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_description(ctx, field) +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_description(ctx, field) if err != nil { return graphql.Null } @@ -2716,9 +2982,9 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__Directive", Field: field, IsMethod: true, IsResolver: false, @@ -2729,8 +2995,8 @@ func (ec *executionContext) fieldContext___Type_description(ctx context.Context, return fc, nil } -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_fields(ctx, field) +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_locations(ctx, field) if err != nil { return graphql.Null } @@ -2743,60 +3009,38 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil + return obj.Locations, 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.([]introspection.Field) + res := resTmp.([]string) fc.Result = res - return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) + return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_locations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__Directive", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___Field_name(ctx, field) - case "description": - return ec.fieldContext___Field_description(ctx, field) - case "args": - return ec.fieldContext___Field_args(ctx, field) - case "type": - return ec.fieldContext___Field_type(ctx, field) - case "isDeprecated": - return ec.fieldContext___Field_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___Field_deprecationReason(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) + return nil, errors.New("field of type __DirectiveLocation does not have child fields") }, } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } return fc, nil } -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_interfaces(ctx, field) +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_args(ctx, field) if err != nil { return graphql.Null } @@ -2809,57 +3053,48 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Interfaces(), nil + return obj.Args, 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.([]introspection.Type) + res := resTmp.([]introspection.InputValue) fc.Result = res - return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_interfaces(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__Directive", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) case "name": - return ec.fieldContext___Type_name(ctx, field) + return ec.fieldContext___InputValue_name(ctx, field) case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) }, } return fc, nil } -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_possibleTypes(ctx, field) +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) if err != nil { return graphql.Null } @@ -2872,57 +3107,38 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.PossibleTypes(), nil + return obj.IsRepeatable, 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.([]introspection.Type) + res := resTmp.(bool) fc.Result = res - return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_possibleTypes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__Directive", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_enumValues(ctx, field) +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_name(ctx, field) if err != nil { return graphql.Null } @@ -2935,56 +3151,123 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil + return obj.Name, 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.([]introspection.EnumValue) + res := resTmp.(string) fc.Result = res - return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__EnumValue", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___EnumValue_name(ctx, field) - case "description": - return ec.fieldContext___EnumValue_description(ctx, field) - case "isDeprecated": - return ec.fieldContext___EnumValue_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___EnumValue_deprecationReason(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) defer func() { if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null } }() + 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 { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_isDeprecated(ctx, field) + if err != nil { + return graphql.Null + } ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { ec.Error(ctx, err) - return fc, err + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, } return fc, nil } -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_inputFields(ctx, field) +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_deprecationReason(ctx, field) if err != nil { return graphql.Null } @@ -2997,7 +3280,7 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InputFields(), nil + return obj.DeprecationReason(), nil }) if err != nil { ec.Error(ctx, err) @@ -3006,17 +3289,146 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph if resTmp == nil { return graphql.Null } - res := resTmp.([]introspection.InputValue) + res := resTmp.(*string) fc.Result = res - return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_inputFields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, 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) fieldContext___Field_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + 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 { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", Field: field, IsMethod: true, IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_args(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, 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.([]introspection.InputValue) + fc.Result = res + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "name": @@ -3034,8 +3446,8 @@ func (ec *executionContext) fieldContext___Type_inputFields(ctx context.Context, return fc, nil } -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_ofType(ctx, field) +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_type(ctx, field) if err != nil { return graphql.Null } @@ -3048,25 +3460,28 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.OfType(), nil + 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.(*introspection.Type) fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_ofType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Field_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "__Type", + Object: "__Field", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { @@ -3097,8 +3512,8 @@ func (ec *executionContext) fieldContext___Type_ofType(ctx context.Context, fiel return fc, nil } -func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_isDeprecated(ctx, field) if err != nil { return graphql.Null } @@ -3111,14 +3526,1140 @@ func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.SpecifiedByURL(), nil + return obj.IsDeprecated(), nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - return graphql.Null + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_isDeprecated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_deprecationReason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_deprecationReason(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, 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) fieldContext___InputValue_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + 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 { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + 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.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_defaultValue(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DefaultValue, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + 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 { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_types(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Types(), 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.([]introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_types(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_queryType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.QueryType(), 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.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_queryType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_mutationType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MutationType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_mutationType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_subscriptionType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SubscriptionType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_directives(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Directives(), 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.([]introspection.Directive) + fc.Result = res + return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_directives(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Directive_name(ctx, field) + case "description": + return ec.fieldContext___Directive_description(ctx, field) + case "locations": + return ec.fieldContext___Directive_locations(ctx, field) + case "args": + return ec.fieldContext___Directive_args(ctx, field) + case "isRepeatable": + return ec.fieldContext___Directive_isRepeatable(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_kind(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Kind(), 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.marshalN__TypeKind2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_kind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __TypeKind does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + 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 { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_fields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Field) + fc.Result = res + return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Field_name(ctx, field) + case "description": + return ec.fieldContext___Field_description(ctx, field) + case "args": + return ec.fieldContext___Field_args(ctx, field) + case "type": + return ec.fieldContext___Field_type(ctx, field) + case "isDeprecated": + return ec.fieldContext___Field_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___Field_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_interfaces(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Interfaces(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_interfaces(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_possibleTypes(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PossibleTypes(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_possibleTypes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_enumValues(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.EnumValue) + fc.Result = res + return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___EnumValue_name(ctx, field) + case "description": + return ec.fieldContext___EnumValue_description(ctx, field) + case "isDeprecated": + return ec.fieldContext___EnumValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___EnumValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_inputFields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InputFields(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_inputFields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_ofType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.OfType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_ofType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SpecifiedByURL(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null } res := resTmp.(*string) fc.Result = res @@ -3135,55 +4676,376 @@ func (ec *executionContext) fieldContext___Type_specifiedByURL(ctx context.Conte return nil, errors.New("field of type String does not have child fields") }, } - return fc, nil -} - -// endregion **************************** field.gotpl ***************************** + return fc, nil +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputAmountInput(ctx context.Context, obj interface{}) (model.AmountInput, error) { + var it model.AmountInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"from", "to", "denomination"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "from": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("from")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.From = data + case "to": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("to")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.To = data + case "denomination": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("denomination")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Denomination = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputBankMsgSendInput(ctx context.Context, obj interface{}) (model.BankMsgSendInput, error) { + var it model.BankMsgSendInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"from_address", "to_address", "amount"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "from_address": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("from_address")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.FromAddress = data + case "to_address": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("to_address")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ToAddress = data + case "amount": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("amount")) + data, err := ec.unmarshalOAmountInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐAmountInput(ctx, v) + if err != nil { + return it, err + } + it.Amount = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputBlockFilter(ctx context.Context, obj interface{}) (model.BlockFilter, error) { + var it model.BlockFilter + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"from_height", "to_height", "from_time", "to_time"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "from_height": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("from_height")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.FromHeight = data + case "to_height": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("to_height")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.ToHeight = data + case "from_time": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("from_time")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.FromTime = data + case "to_time": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("to_time")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.ToTime = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputMemFileInput(ctx context.Context, obj interface{}) (model.MemFileInput, error) { + var it model.MemFileInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "body"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "body": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("body")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Body = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputMemPackageInput(ctx context.Context, obj interface{}) (model.MemPackageInput, error) { + var it model.MemPackageInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "path", "files"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "path": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("path")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Path = data + case "files": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("files")) + data, err := ec.unmarshalOMemFileInput2ᚕᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMemFileInput(ctx, v) + if err != nil { + return it, err + } + it.Files = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputMsgAddPackageInput(ctx context.Context, obj interface{}) (model.MsgAddPackageInput, error) { + var it model.MsgAddPackageInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"creator", "package", "deposit"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "creator": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("creator")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Creator = data + case "package": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("package")) + data, err := ec.unmarshalOMemPackageInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMemPackageInput(ctx, v) + if err != nil { + return it, err + } + it.Package = data + case "deposit": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("deposit")) + data, err := ec.unmarshalOAmountInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐAmountInput(ctx, v) + if err != nil { + return it, err + } + it.Deposit = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputMsgCallInput(ctx context.Context, obj interface{}) (model.MsgCallInput, error) { + var it model.MsgCallInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"caller", "send", "pkg_path", "func", "args"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "caller": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("caller")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Caller = data + case "send": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("send")) + data, err := ec.unmarshalOAmountInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐAmountInput(ctx, v) + if err != nil { + return it, err + } + it.Send = data + case "pkg_path": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("pkg_path")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.PkgPath = data + case "func": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("func")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Func = data + case "args": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("args")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.Args = data + } + } -// region **************************** input.gotpl ***************************** + return it, nil +} -func (ec *executionContext) unmarshalInputBlockFilter(ctx context.Context, obj interface{}) (model.BlockFilter, error) { - var it model.BlockFilter +func (ec *executionContext) unmarshalInputMsgRunInput(ctx context.Context, obj interface{}) (model.MsgRunInput, error) { + var it model.MsgRunInput asMap := map[string]interface{}{} for k, v := range obj.(map[string]interface{}) { asMap[k] = v } - fieldsInOrder := [...]string{"from_height", "to_height", "from_time", "to_time"} + fieldsInOrder := [...]string{"caller", "send", "package"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { continue } switch k { - case "from_height": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("from_height")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + case "caller": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("caller")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } - it.FromHeight = data - case "to_height": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("to_height")) - data, err := ec.unmarshalOInt2ᚖint(ctx, v) + it.Caller = data + case "send": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("send")) + data, err := ec.unmarshalOAmountInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐAmountInput(ctx, v) if err != nil { return it, err } - it.ToHeight = data - case "from_time": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("from_time")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.Send = data + case "package": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("package")) + data, err := ec.unmarshalOMemPackageInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMemPackageInput(ctx, v) if err != nil { return it, err } - it.FromTime = data - case "to_time": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("to_time")) - data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + it.Package = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputTransactionBankMessageInput(ctx context.Context, obj interface{}) (model.TransactionBankMessageInput, error) { + var it model.TransactionBankMessageInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"send"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "send": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("send")) + data, err := ec.unmarshalOBankMsgSendInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐBankMsgSendInput(ctx, v) if err != nil { return it, err } - it.ToTime = data + it.Send = data } } @@ -3197,7 +5059,7 @@ func (ec *executionContext) unmarshalInputTransactionFilter(ctx context.Context, asMap[k] = v } - fieldsInOrder := [...]string{"from_block_height", "to_block_height", "from_index", "to_index", "from_gas_wanted", "to_gas_wanted", "from_gas_used", "to_gas_used", "hash"} + fieldsInOrder := [...]string{"from_block_height", "to_block_height", "from_index", "to_index", "from_gas_wanted", "to_gas_wanted", "from_gas_used", "to_gas_used", "hash", "message", "memo"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -3259,61 +5121,501 @@ func (ec *executionContext) unmarshalInputTransactionFilter(ctx context.Context, if err != nil { return it, err } - it.ToGasUsed = data - case "hash": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hash")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err + it.ToGasUsed = data + case "hash": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hash")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Hash = data + case "message": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("message")) + data, err := ec.unmarshalOTransactionMessageInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐTransactionMessageInput(ctx, v) + if err != nil { + return it, err + } + it.Message = data + case "memo": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("memo")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Memo = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputTransactionMessageInput(ctx context.Context, obj interface{}) (model.TransactionMessageInput, error) { + var it model.TransactionMessageInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"type_url", "route", "bank_param", "vm_param"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "type_url": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type_url")) + data, err := ec.unmarshalOMessageType2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMessageType(ctx, v) + if err != nil { + return it, err + } + it.TypeURL = data + case "route": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("route")) + data, err := ec.unmarshalOMessageRoute2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMessageRoute(ctx, v) + if err != nil { + return it, err + } + it.Route = data + case "bank_param": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("bank_param")) + data, err := ec.unmarshalOTransactionBankMessageInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐTransactionBankMessageInput(ctx, v) + if err != nil { + return it, err + } + it.BankParam = data + case "vm_param": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("vm_param")) + data, err := ec.unmarshalOTransactionVmMessageInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐTransactionVMMessageInput(ctx, v) + if err != nil { + return it, err + } + it.VMParam = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputTransactionVmMessageInput(ctx context.Context, obj interface{}) (model.TransactionVMMessageInput, error) { + var it model.TransactionVMMessageInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"exec", "add_package", "run"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "exec": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("exec")) + data, err := ec.unmarshalOMsgCallInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMsgCallInput(ctx, v) + if err != nil { + return it, err + } + it.Exec = data + case "add_package": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("add_package")) + data, err := ec.unmarshalOMsgAddPackageInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMsgAddPackageInput(ctx, v) + if err != nil { + return it, err + } + it.AddPackage = data + case "run": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("run")) + data, err := ec.unmarshalOMsgRunInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMsgRunInput(ctx, v) + if err != nil { + return it, err + } + it.Run = data + } + } + + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +func (ec *executionContext) _MessageValue(ctx context.Context, sel ast.SelectionSet, obj model.MessageValue) graphql.Marshaler { + switch obj := (obj).(type) { + case nil: + return graphql.Null + case model.BankMsgSend: + return ec._BankMsgSend(ctx, sel, &obj) + case *model.BankMsgSend: + if obj == nil { + return graphql.Null + } + return ec._BankMsgSend(ctx, sel, obj) + case model.MsgCall: + return ec._MsgCall(ctx, sel, &obj) + case *model.MsgCall: + if obj == nil { + return graphql.Null + } + return ec._MsgCall(ctx, sel, obj) + case model.MsgAddPackage: + return ec._MsgAddPackage(ctx, sel, &obj) + case *model.MsgAddPackage: + if obj == nil { + return graphql.Null + } + return ec._MsgAddPackage(ctx, sel, obj) + case model.MsgRun: + return ec._MsgRun(ctx, sel, &obj) + case *model.MsgRun: + if obj == nil { + return graphql.Null + } + return ec._MsgRun(ctx, sel, obj) + case model.UnexpectedMessage: + return ec._UnexpectedMessage(ctx, sel, &obj) + case *model.UnexpectedMessage: + if obj == nil { + return graphql.Null + } + return ec._UnexpectedMessage(ctx, sel, obj) + default: + panic(fmt.Errorf("unexpected type %T", obj)) + } +} + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var bankMsgSendImplementors = []string{"BankMsgSend", "MessageValue"} + +func (ec *executionContext) _BankMsgSend(ctx context.Context, sel ast.SelectionSet, obj *model.BankMsgSend) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, bankMsgSendImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("BankMsgSend") + case "from_address": + out.Values[i] = ec._BankMsgSend_from_address(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "to_address": + out.Values[i] = ec._BankMsgSend_to_address(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "amount": + out.Values[i] = ec._BankMsgSend_amount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var blockImplementors = []string{"Block"} + +func (ec *executionContext) _Block(ctx context.Context, sel ast.SelectionSet, obj *model.Block) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, blockImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Block") + case "height": + out.Values[i] = ec._Block_height(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "version": + out.Values[i] = ec._Block_version(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "chain_id": + out.Values[i] = ec._Block_chain_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "time": + out.Values[i] = ec._Block_time(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "proposer_address_raw": + out.Values[i] = ec._Block_proposer_address_raw(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var memFileImplementors = []string{"MemFile"} + +func (ec *executionContext) _MemFile(ctx context.Context, sel ast.SelectionSet, obj *model.MemFile) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, memFileImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("MemFile") + case "name": + out.Values[i] = ec._MemFile_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "body": + out.Values[i] = ec._MemFile_body(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var memPackageImplementors = []string{"MemPackage"} + +func (ec *executionContext) _MemPackage(ctx context.Context, sel ast.SelectionSet, obj *model.MemPackage) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, memPackageImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("MemPackage") + case "name": + out.Values[i] = ec._MemPackage_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ } - it.Hash = data + case "path": + out.Values[i] = ec._MemPackage_path(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "files": + out.Values[i] = ec._MemPackage_files(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) } } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } - return it, nil + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out } -// endregion **************************** input.gotpl ***************************** +var msgAddPackageImplementors = []string{"MsgAddPackage", "MessageValue"} -// region ************************** interface.gotpl *************************** +func (ec *executionContext) _MsgAddPackage(ctx context.Context, sel ast.SelectionSet, obj *model.MsgAddPackage) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, msgAddPackageImplementors) -// endregion ************************** interface.gotpl *************************** + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("MsgAddPackage") + case "creator": + out.Values[i] = ec._MsgAddPackage_creator(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "package": + out.Values[i] = ec._MsgAddPackage_package(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deposit": + out.Values[i] = ec._MsgAddPackage_deposit(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } -// region **************************** object.gotpl **************************** + atomic.AddInt32(&ec.deferred, int32(len(deferred))) -var blockImplementors = []string{"Block"} + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } -func (ec *executionContext) _Block(ctx context.Context, sel ast.SelectionSet, obj *model.Block) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, blockImplementors) + return out +} + +var msgCallImplementors = []string{"MsgCall", "MessageValue"} + +func (ec *executionContext) _MsgCall(ctx context.Context, sel ast.SelectionSet, obj *model.MsgCall) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, msgCallImplementors) out := graphql.NewFieldSet(fields) deferred := make(map[string]*graphql.FieldSet) for i, field := range fields { switch field.Name { case "__typename": - out.Values[i] = graphql.MarshalString("Block") - case "height": - out.Values[i] = ec._Block_height(ctx, field, obj) + out.Values[i] = graphql.MarshalString("MsgCall") + case "caller": + out.Values[i] = ec._MsgCall_caller(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "version": - out.Values[i] = ec._Block_version(ctx, field, obj) + case "send": + out.Values[i] = ec._MsgCall_send(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "chain_id": - out.Values[i] = ec._Block_chain_id(ctx, field, obj) + case "pkg_path": + out.Values[i] = ec._MsgCall_pkg_path(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "time": - out.Values[i] = ec._Block_time(ctx, field, obj) + case "func": + out.Values[i] = ec._MsgCall_func(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } - case "proposer_address_raw": - out.Values[i] = ec._Block_proposer_address_raw(ctx, field, obj) + case "args": + out.Values[i] = ec._MsgCall_args(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var msgRunImplementors = []string{"MsgRun", "MessageValue"} + +func (ec *executionContext) _MsgRun(ctx context.Context, sel ast.SelectionSet, obj *model.MsgRun) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, msgRunImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("MsgRun") + case "caller": + out.Values[i] = ec._MsgRun_caller(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "send": + out.Values[i] = ec._MsgRun_send(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "package": + out.Values[i] = ec._MsgRun_package(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -3513,6 +5815,148 @@ func (ec *executionContext) _Transaction(ctx context.Context, sel ast.SelectionS if out.Values[i] == graphql.Null { out.Invalids++ } + case "messages": + out.Values[i] = ec._Transaction_messages(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "memo": + out.Values[i] = ec._Transaction_memo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var transactionMessageImplementors = []string{"TransactionMessage"} + +func (ec *executionContext) _TransactionMessage(ctx context.Context, sel ast.SelectionSet, obj *model.TransactionMessage) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, transactionMessageImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("TransactionMessage") + case "typeUrl": + out.Values[i] = ec._TransactionMessage_typeUrl(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "route": + out.Values[i] = ec._TransactionMessage_route(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "value": + out.Values[i] = ec._TransactionMessage_value(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var txFeeImplementors = []string{"TxFee"} + +func (ec *executionContext) _TxFee(ctx context.Context, sel ast.SelectionSet, obj *model.TxFee) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, txFeeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("TxFee") + case "gas_wanted": + out.Values[i] = ec._TxFee_gas_wanted(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "gas_fee": + out.Values[i] = ec._TxFee_gas_fee(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var unexpectedMessageImplementors = []string{"UnexpectedMessage", "MessageValue"} + +func (ec *executionContext) _UnexpectedMessage(ctx context.Context, sel ast.SelectionSet, obj *model.UnexpectedMessage) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, unexpectedMessageImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UnexpectedMessage") + case "raw": + out.Values[i] = ec._UnexpectedMessage_raw(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -3926,6 +6370,36 @@ func (ec *executionContext) marshalNInt2int64(ctx context.Context, sel ast.Selec return res } +func (ec *executionContext) marshalNMemFile2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMemFile(ctx context.Context, sel ast.SelectionSet, v *model.MemFile) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._MemFile(ctx, sel, v) +} + +func (ec *executionContext) marshalNMemPackage2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMemPackage(ctx context.Context, sel ast.SelectionSet, v *model.MemPackage) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._MemPackage(ctx, sel, v) +} + +func (ec *executionContext) marshalNMessageValue2githubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMessageValue(ctx context.Context, sel ast.SelectionSet, v model.MessageValue) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._MessageValue(ctx, sel, v) +} + func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { res, err := graphql.UnmarshalString(v) return res, graphql.ErrorOnPath(ctx, err) @@ -3975,6 +6449,44 @@ func (ec *executionContext) unmarshalNTransactionFilter2githubᚗcomᚋgnolang return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalNTransactionMessage2ᚕᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐTransactionMessage(ctx context.Context, sel ast.SelectionSet, v []*model.TransactionMessage) 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.marshalOTransactionMessage2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐTransactionMessage(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + return ret +} + func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { return ec.___Directive(ctx, sel, &v) } @@ -4228,6 +6740,22 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a return res } +func (ec *executionContext) unmarshalOAmountInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐAmountInput(ctx context.Context, v interface{}) (*model.AmountInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputAmountInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOBankMsgSendInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐBankMsgSendInput(ctx context.Context, v interface{}) (*model.BankMsgSendInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputBankMsgSendInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalOBlock2ᚕᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐBlockᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Block) graphql.Marshaler { if v == nil { return graphql.Null @@ -4317,6 +6845,183 @@ func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.Sele return res } +func (ec *executionContext) marshalOMemFile2ᚕᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMemFileᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.MemFile) graphql.Marshaler { + if v == nil { + return graphql.Null + } + 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.marshalNMemFile2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMemFile(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalOMemFileInput2ᚕᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMemFileInput(ctx context.Context, v interface{}) ([]*model.MemFileInput, error) { + if v == nil { + return nil, nil + } + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]*model.MemFileInput, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalOMemFileInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMemFileInput(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalOMemFileInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMemFileInput(ctx context.Context, v interface{}) (*model.MemFileInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputMemFileInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOMemPackageInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMemPackageInput(ctx context.Context, v interface{}) (*model.MemPackageInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputMemPackageInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOMessageRoute2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMessageRoute(ctx context.Context, v interface{}) (*model.MessageRoute, error) { + if v == nil { + return nil, nil + } + var res = new(model.MessageRoute) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOMessageRoute2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMessageRoute(ctx context.Context, sel ast.SelectionSet, v *model.MessageRoute) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + +func (ec *executionContext) unmarshalOMessageType2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMessageType(ctx context.Context, v interface{}) (*model.MessageType, error) { + if v == nil { + return nil, nil + } + var res = new(model.MessageType) + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOMessageType2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMessageType(ctx context.Context, sel ast.SelectionSet, v *model.MessageType) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + +func (ec *executionContext) unmarshalOMsgAddPackageInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMsgAddPackageInput(ctx context.Context, v interface{}) (*model.MsgAddPackageInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputMsgAddPackageInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOMsgCallInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMsgCallInput(ctx context.Context, v interface{}) (*model.MsgCallInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputMsgCallInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOMsgRunInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐMsgRunInput(ctx context.Context, v interface{}) (*model.MsgRunInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputMsgRunInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { + if v == nil { + return nil, nil + } + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalOString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNString2string(ctx, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { if v == nil { return nil, nil @@ -4396,6 +7101,37 @@ func (ec *executionContext) marshalOTransaction2ᚕᚖgithubᚗcomᚋgnolangᚋt return ret } +func (ec *executionContext) unmarshalOTransactionBankMessageInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐTransactionBankMessageInput(ctx context.Context, v interface{}) (*model.TransactionBankMessageInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputTransactionBankMessageInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOTransactionMessage2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐTransactionMessage(ctx context.Context, sel ast.SelectionSet, v *model.TransactionMessage) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._TransactionMessage(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOTransactionMessageInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐTransactionMessageInput(ctx context.Context, v interface{}) (*model.TransactionMessageInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputTransactionMessageInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalOTransactionVmMessageInput2ᚖgithubᚗcomᚋgnolangᚋtxᚑindexerᚋserveᚋgraphᚋmodelᚐTransactionVMMessageInput(ctx context.Context, v interface{}) (*model.TransactionVMMessageInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputTransactionVmMessageInput(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/serve/graph/model/models_gen.go b/serve/graph/model/models_gen.go index cd99b076..20bd7425 100644 --- a/serve/graph/model/models_gen.go +++ b/serve/graph/model/models_gen.go @@ -3,9 +3,58 @@ package model import ( + "fmt" + "io" + "strconv" "time" ) +type MessageValue interface { + IsMessageValue() +} + +// `AmountInput` is a range of token quantities to filter by. +type AmountInput struct { + // The minimum quantity of tokens to check for. + From *int `json:"from,omitempty"` + // The maximum quantity of tokens to check for. + To *int `json:"to,omitempty"` + // Filter by token's denomination. + // If set to an empty string, it will get an empty value. + Denomination *string `json:"denomination,omitempty"` +} + +// `BankMsgSend` is a message with a message router of `bank` and a message type of `send`. +// `BankMsgSend` is the fund transfer tx message. +type BankMsgSend struct { + // the bech32 address of the fund sender. + // ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + FromAddress string `json:"from_address"` + // the bech32 address of the fund receiver. + // ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + ToAddress string `json:"to_address"` + // the denomination and amount of fund sent (""). + // ex) `1000000ugnot` + Amount string `json:"amount"` +} + +func (BankMsgSend) IsMessageValue() {} + +// `BankMsgSendInput` represents input parameters required when the message type is `send`. +type BankMsgSendInput struct { + // the bech32 address of the fund sender. + // You can filter by the fund sender address. + // ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + FromAddress *string `json:"from_address,omitempty"` + // the bech32 address of the fund receiver. + // You can filter by the fund receiver address. + // ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + ToAddress *string `json:"to_address,omitempty"` + // the denomination and amount of fund sent (""). + // ex) `1000000ugnot` + Amount *AmountInput `json:"amount,omitempty"` +} + // Filters for querying Blocks within specified criteria related to their attributes. type BlockFilter struct { // Minimum block height from which to start fetching Blocks, inclusive. If unspecified, there is no lower bound. @@ -18,6 +67,137 @@ type BlockFilter struct { ToTime *time.Time `json:"to_time,omitempty"` } +// `MemFile` is the metadata information tied to a single gno package / realm file +type MemFile struct { + // the name of the source file. + Name string `json:"name"` + // the content of the source file. + Body string `json:"body"` +} + +// `MemFileInput` is the metadata information tied to a single gno package / realm file. +type MemFileInput struct { + // the name of the source file. + Name *string `json:"name,omitempty"` + // the content of the source file. + Body *string `json:"body,omitempty"` +} + +// `MemPackage` is the metadata information tied to package / realm deployment. +type MemPackage struct { + // the name of the package. + Name string `json:"name"` + // the gno path of the package. + Path string `json:"path"` + // the associated package gno source. + Files []*MemFile `json:"files,omitempty"` +} + +// `MemPackageInput` represents a package stored in memory. +type MemPackageInput struct { + // the name of the package. + Name *string `json:"name,omitempty"` + // the gno path of the package. + Path *string `json:"path,omitempty"` + // the associated package gno source. + Files []*MemFileInput `json:"files,omitempty"` +} + +// `MsgAddPackage` is a message with a message router of `vm` and a message type of `add_package`. +// `MsgAddPackage` is the package deployment tx message. +type MsgAddPackage struct { + // the bech32 address of the package deployer. + // ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + Creator string `json:"creator"` + // the package being deployed. + Package *MemPackage `json:"package"` + // the amount of funds to be deposited at deployment, if any (""). + // ex) `1000000ugnot` + Deposit string `json:"deposit"` +} + +func (MsgAddPackage) IsMessageValue() {} + +// `MsgAddPackageInput` represents input parameters required when the message type is `add_package`. +type MsgAddPackageInput struct { + // the bech32 address of the package deployer. + // You can filter by the package deployer's address. + // ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + Creator *string `json:"creator,omitempty"` + // the package being deployed. + Package *MemPackageInput `json:"package,omitempty"` + // the amount of funds to be deposited at deployment, if any (""). + // ex) `1000000ugnot` + Deposit *AmountInput `json:"deposit,omitempty"` +} + +// `MsgCall` is a message with a message router of `vm` and a message type of `exec`. +// `MsgCall` is the method invocation tx message. +type MsgCall struct { + // the bech32 address of the function caller. + // ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + Caller string `json:"caller"` + // the amount of funds to be deposited to the package, if any (""). + // ex) `1000000ugnot` + Send string `json:"send"` + // the gno package path. + PkgPath string `json:"pkg_path"` + // the function name being invoked. + Func string `json:"func"` + // `args` are the arguments passed to the executed function. + Args []string `json:"args,omitempty"` +} + +func (MsgCall) IsMessageValue() {} + +// `MsgCallInput` represents input parameters required when the message type is `exec`. +type MsgCallInput struct { + // the bech32 address of the function caller. + // You can filter by the function caller's address. + // ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + Caller *string `json:"caller,omitempty"` + // the amount of funds to be deposited to the package, if any (""). + // ex) `1000000ugnot` + Send *AmountInput `json:"send,omitempty"` + // the gno package path. + PkgPath *string `json:"pkg_path,omitempty"` + // the function name being invoked. + Func *string `json:"func,omitempty"` + // `args` are the arguments passed to the executed function. + // The arguments are checked in the order of the argument array and + // if they are empty strings, they are excluded from the filtering criteria. + // ex) `["", "", "1"]` <- Empty strings skip the condition. + Args []string `json:"args,omitempty"` +} + +// `MsgRun` is a message with a message router of `vm` and a message type of `run`. +// `MsgRun is the execute arbitrary Gno code tx message`. +type MsgRun struct { + // the bech32 address of the function caller. + // ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + Caller string `json:"caller"` + // the amount of funds to be deposited to the package, if any (""). + // ex) `1000000ugnot` + Send string `json:"send"` + // the package being executed. + Package *MemPackage `json:"package"` +} + +func (MsgRun) IsMessageValue() {} + +// `MsgRunInput` represents input parameters required when the message type is `run`. +type MsgRunInput struct { + // the bech32 address of the function caller. + // You can filter by the function caller's address. + // ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + Caller *string `json:"caller,omitempty"` + // the amount of funds to be deposited to the package, if any (""). + // ex) `1000000ugnot` + Send *AmountInput `json:"send,omitempty"` + // the package being executed. + Package *MemPackageInput `json:"package,omitempty"` +} + // Root Query type to fetch data about Blocks and Transactions based on filters or retrieve the latest block height. type Query struct { } @@ -27,6 +207,12 @@ type Query struct { type Subscription struct { } +// `TransactionBankMessageInput` represents input parameters required when the message router is `bank`. +type TransactionBankMessageInput struct { + // send represents input parameters required when the message type is `send`. + Send *BankMsgSendInput `json:"send,omitempty"` +} + // Filters for querying Transactions within specified criteria related to their execution and placement within Blocks. type TransactionFilter struct { // Minimum block height from which to start fetching Transactions, inclusive. Aids in scoping the search to recent Transactions. @@ -47,4 +233,148 @@ type TransactionFilter struct { ToGasUsed *int `json:"to_gas_used,omitempty"` // Hash from Transaction content in base64 encoding. If this filter is used, any other filter will be ignored. Hash *string `json:"hash,omitempty"` + // Transaction's message to filter Transactions. + // `message` can be configured as a filter with a transaction message's `router` and `type` and `parameters(bank / vm)`. + Message *TransactionMessageInput `json:"message,omitempty"` + // `memo` are string information stored within a transaction. + // `memo` can be utilized to find or distinguish transactions. + // For example, when trading a specific exchange, you would utilize the memo field of the transaction. + Memo *string `json:"memo,omitempty"` +} + +// Transaction's message to filter Transactions. +// `TransactionMessageInput` can be configured as a filter with a transaction message's `router` and `type` and `parameters(bank / vm)`. +type TransactionMessageInput struct { + // The type of transaction message. + // The value of `typeUrl` can be `send`, `exec`, `add_package`, `run`. + TypeURL *MessageType `json:"type_url,omitempty"` + // The route of transaction message. + // The value of `route` can be `bank`, `vm`. + Route *MessageRoute `json:"route,omitempty"` + // `TransactionBankMessageInput` represents input parameters required when the message router is `bank`. + BankParam *TransactionBankMessageInput `json:"bank_param,omitempty"` + // `TransactionVmMessageInput` represents input parameters required when the message router is `vm`. + VMParam *TransactionVMMessageInput `json:"vm_param,omitempty"` +} + +// `TransactionVmMessageInput` represents input parameters required when the message router is `vm`. +type TransactionVMMessageInput struct { + // `MsgCallInput` represents input parameters required when the message type is `exec`. + Exec *MsgCallInput `json:"exec,omitempty"` + // `MsgAddPackageInput` represents input parameters required when the message type is `add_package`. + AddPackage *MsgAddPackageInput `json:"add_package,omitempty"` + // `MsgRunInput` represents input parameters required when the message type is `run`. + Run *MsgRunInput `json:"run,omitempty"` +} + +type TxFee struct { + // gas limit + GasWanted int `json:"gas_wanted"` + // gas fee details () + GasFee int `json:"gas_fee"` +} + +// `UnexpectedMessage` is an Undefined Message, which is a message that decoding failed. +type UnexpectedMessage struct { + Raw string `json:"raw"` +} + +func (UnexpectedMessage) IsMessageValue() {} + +// `MessageRoute` is route type of the transactional message. +// `MessageRoute` has the values of vm and bank. +type MessageRoute string + +const ( + MessageRouteVM MessageRoute = "vm" + MessageRouteBank MessageRoute = "bank" +) + +var AllMessageRoute = []MessageRoute{ + MessageRouteVM, + MessageRouteBank, +} + +func (e MessageRoute) IsValid() bool { + switch e { + case MessageRouteVM, MessageRouteBank: + return true + } + return false +} + +func (e MessageRoute) String() string { + return string(e) +} + +func (e *MessageRoute) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = MessageRoute(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid MessageRoute", str) + } + return nil +} + +func (e MessageRoute) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +// `MessageType` is message type of the transaction. +// `MessageType` has the values `send`, `exec`, `add_package`, and `run`. +type MessageType string + +const ( + // The route value for this message type is `bank`, and the value for transactional messages is `BankMsgSend`. + // This is a transaction message used when sending native tokens. + MessageTypeSend MessageType = "send" + // The route value for this message type is `vm`, and the value for transactional messages is `MsgCall`. + // This is a transaction message that executes a function in realm or package that is deployed in the GNO chain. + MessageTypeExec MessageType = "exec" + // The route value for this message type is `vm`, and the value for transactional messages is `MsgAddPackage`. + // This is a transactional message that adds a package to the GNO chain. + MessageTypeAddPackage MessageType = "add_package" + // The route value for this message type is `vm`, and the value for transactional messages is `MsgRun`. + // This is a transactional message that executes an arbitrary Gno-coded TX message. + MessageTypeRun MessageType = "run" +) + +var AllMessageType = []MessageType{ + MessageTypeSend, + MessageTypeExec, + MessageTypeAddPackage, + MessageTypeRun, +} + +func (e MessageType) IsValid() bool { + switch e { + case MessageTypeSend, MessageTypeExec, MessageTypeAddPackage, MessageTypeRun: + return true + } + return false +} + +func (e MessageType) String() string { + return string(e) +} + +func (e *MessageType) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = MessageType(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid MessageType", str) + } + return nil +} + +func (e MessageType) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) } diff --git a/serve/graph/model/transaction.go b/serve/graph/model/transaction.go index ab4b9173..77e80aff 100644 --- a/serve/graph/model/transaction.go +++ b/serve/graph/model/transaction.go @@ -2,43 +2,289 @@ package model import ( "encoding/base64" + "encoding/json" "fmt" + "sync" + "github.com/gnolang/gno/gno.land/pkg/sdk/vm" + "github.com/gnolang/gno/tm2/pkg/amino" "github.com/gnolang/gno/tm2/pkg/bft/types" + "github.com/gnolang/gno/tm2/pkg/sdk/bank" + "github.com/gnolang/gno/tm2/pkg/std" ) type Transaction struct { - t *types.TxResult + stdTx *std.Tx + txResult *types.TxResult + messages []*TransactionMessage + + mu sync.Mutex + onceTx sync.Once + onceMessages sync.Once } -func NewTransaction(t *types.TxResult) *Transaction { - return &Transaction{t: t} +func NewTransaction(txResult *types.TxResult) *Transaction { + return &Transaction{ + txResult: txResult, + messages: make([]*TransactionMessage, 0), + stdTx: nil, + } } func (t *Transaction) ID() string { - return fmt.Sprintf("%d_%d", t.t.Height, t.t.Index) + return fmt.Sprintf("%d_%d", t.txResult.Height, t.txResult.Index) } func (t *Transaction) Index() int { - return int(t.t.Index) + return int(t.txResult.Index) } func (t *Transaction) Hash() string { - return base64.StdEncoding.EncodeToString(t.t.Tx.Hash()) + return base64.StdEncoding.EncodeToString(t.txResult.Tx.Hash()) } func (t *Transaction) BlockHeight() int { - return int(t.t.Height) + return int(t.txResult.Height) } func (t *Transaction) GasWanted() int { - return int(t.t.Response.GasWanted) + return int(t.txResult.Response.GasWanted) } func (t *Transaction) GasUsed() int { - return int(t.t.Response.GasUsed) + return int(t.txResult.Response.GasUsed) } func (t *Transaction) ContentRaw() string { - return t.t.Tx.String() + return t.txResult.Tx.String() +} + +func (t *Transaction) Memo() string { + if t.getStdTx() == nil { + return "" + } + + return t.getStdTx().GetMemo() +} + +func (t *Transaction) Messages() []*TransactionMessage { + return t.getMessages() +} + +func (t *Transaction) Fee() *TxFee { + return &TxFee{ + GasWanted: t.GasWanted(), + GasFee: t.GasUsed(), + } +} + +func (t *Transaction) getStdTx() *std.Tx { + // The function to unmarshal a `std.Tx` is executed once. + unmarshalTx := func() { + var stdTx std.Tx + if err := amino.Unmarshal(t.txResult.Tx, &stdTx); err != nil { + t.stdTx = nil + } + + t.mu.Lock() + t.stdTx = &stdTx + t.mu.Unlock() + } + + t.onceTx.Do(unmarshalTx) + + return t.stdTx +} + +func (t *Transaction) getMessages() []*TransactionMessage { + // Functions that unmarshal transaction messages are executed once. + unmarshalMessages := func() { + stdTx := t.getStdTx() + messages := make([]*TransactionMessage, 0) + + for _, message := range stdTx.GetMsgs() { + messages = append(messages, NewTransactionMessage(message)) + } + + t.mu.Lock() + t.messages = messages + t.mu.Unlock() + } + + t.onceMessages.Do(unmarshalMessages) + + return t.messages +} + +type TransactionMessage struct { + Value MessageValue + Route string + TypeURL string +} + +func NewTransactionMessage(message std.Msg) *TransactionMessage { + var contentMessage *TransactionMessage + + switch message.Route() { + case bank.RouterKey: + if message.Type() == MessageTypeSend.String() { + contentMessage = &TransactionMessage{ + Route: MessageRouteBank.String(), + TypeURL: MessageTypeSend.String(), + Value: makeBankMsgSend(message), + } + } + case vm.RouterKey: + switch message.Type() { + case MessageTypeExec.String(): + contentMessage = &TransactionMessage{ + Route: MessageRouteVM.String(), + TypeURL: MessageTypeExec.String(), + Value: makeVMMsgCall(message), + } + case MessageTypeAddPackage.String(): + contentMessage = &TransactionMessage{ + Route: MessageRouteVM.String(), + TypeURL: MessageTypeAddPackage.String(), + Value: makeVMAddPackage(message), + } + case MessageTypeRun.String(): + contentMessage = &TransactionMessage{ + Route: MessageRouteVM.String(), + TypeURL: MessageTypeRun.String(), + Value: makeVMMsgRun(message), + } + } + } + + if contentMessage == nil { + contentMessage = &TransactionMessage{ + Route: message.Route(), + TypeURL: message.Type(), + Value: makeUnexpectedMessage(message), + } + } + + return contentMessage +} + +func (tm *TransactionMessage) BankMsgSend() BankMsgSend { + return tm.Value.(BankMsgSend) +} + +func (tm *TransactionMessage) VMMsgCall() MsgCall { + return tm.Value.(MsgCall) +} + +func (tm *TransactionMessage) VMAddPackage() MsgAddPackage { + return tm.Value.(MsgAddPackage) +} + +func (tm *TransactionMessage) VMMsgRun() MsgRun { + return tm.Value.(MsgRun) +} + +func makeBankMsgSend(value std.Msg) BankMsgSend { + decodedMessage, err := cast[bank.MsgSend](value) + if err != nil { + return BankMsgSend{} + } + + return BankMsgSend{ + FromAddress: decodedMessage.FromAddress.String(), + ToAddress: decodedMessage.ToAddress.String(), + Amount: decodedMessage.Amount.String(), + } +} + +func makeVMMsgCall(value std.Msg) MsgCall { + decodedMessage, err := cast[vm.MsgCall](value) + if err != nil { + return MsgCall{} + } + + return MsgCall{ + Caller: decodedMessage.Caller.String(), + Send: decodedMessage.Send.String(), + PkgPath: decodedMessage.PkgPath, + Func: decodedMessage.Func, + Args: decodedMessage.Args, + } +} + +func makeVMAddPackage(value std.Msg) MsgAddPackage { + decodedMessage, err := cast[vm.MsgAddPackage](value) + if err != nil { + return MsgAddPackage{} + } + + memFiles := make([]*MemFile, 0) + for _, file := range decodedMessage.Package.Files { + memFiles = append(memFiles, &MemFile{ + Name: file.Name, + Body: file.Body, + }) + } + + return MsgAddPackage{ + Creator: decodedMessage.Creator.String(), + Package: &MemPackage{ + Name: decodedMessage.Package.Name, + Path: decodedMessage.Package.Path, + Files: memFiles, + }, + Deposit: decodedMessage.Deposit.String(), + } +} + +func makeVMMsgRun(value std.Msg) MsgRun { + decodedMessage, err := cast[vm.MsgRun](value) + if err != nil { + return MsgRun{} + } + + memFiles := make([]*MemFile, 0) + for _, file := range decodedMessage.Package.Files { + memFiles = append(memFiles, &MemFile{ + Name: file.Name, + Body: file.Body, + }) + } + + return MsgRun{ + Caller: decodedMessage.Caller.String(), + Send: decodedMessage.Send.String(), + Package: &MemPackage{ + Name: decodedMessage.Package.Name, + Path: decodedMessage.Package.Path, + Files: memFiles, + }, + } +} + +func makeUnexpectedMessage(value std.Msg) UnexpectedMessage { + raw, err := json.Marshal(value) + if err != nil { + return UnexpectedMessage{ + Raw: "", + } + } + + return UnexpectedMessage{ + Raw: string(raw), + } +} + +func cast[T any](input any) (*T, error) { + encoded, err := json.Marshal(input) + if err != nil { + return nil, err + } + + var data T + if err := json.Unmarshal(encoded, &data); err != nil { + return nil, err + } + + return &data, nil } diff --git a/serve/graph/schema.resolvers.go b/serve/graph/query.resolvers.go similarity index 64% rename from serve/graph/schema.resolvers.go rename to serve/graph/query.resolvers.go index 0e2180bd..1abfb9a3 100644 --- a/serve/graph/schema.resolvers.go +++ b/serve/graph/query.resolvers.go @@ -2,15 +2,13 @@ package graph // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.43 +// Code generated by github.com/99designs/gqlgen version v0.17.45 import ( "context" - "math" "github.com/99designs/gqlgen/graphql" "github.com/gnolang/tx-indexer/serve/graph/model" - "github.com/gnolang/tx-indexer/types" "github.com/vektah/gqlparser/v2/gqlerror" ) @@ -21,7 +19,6 @@ func (r *queryResolver) Transactions(ctx context.Context, filter model.Transacti if err != nil { return nil, gqlerror.Wrap(err) } - return []*model.Transaction{model.NewTransaction(tx)}, nil } @@ -38,17 +35,6 @@ func (r *queryResolver) Transactions(ctx context.Context, filter model.Transacti } defer it.Close() - fgw := deref(filter.FromGasUsed) - tgw := deref(filter.ToGasWanted) - if tgw == 0 { - tgw = math.MaxInt - } - fgu := deref(filter.FromGasUsed) - tgu := deref(filter.ToGasUsed) - if tgu == 0 { - tgu = math.MaxInt - } - var out []*model.Transaction i := 0 for { @@ -72,14 +58,11 @@ func (r *queryResolver) Transactions(ctx context.Context, filter model.Transacti return out, nil } - if !(t.Response.GasUsed >= int64(fgu) && (t.Response.GasUsed <= int64(tgu))) { + transaction := model.NewTransaction(t) + if !FilteredTransactionBy(transaction, filter) { continue } - if !(t.Response.GasWanted >= int64(fgw) && (t.Response.GasWanted <= int64(tgw))) { - continue - } - - out = append(out, model.NewTransaction(t)) + out = append(out, transaction) i++ } } @@ -122,14 +105,12 @@ func (r *queryResolver) Blocks(ctx context.Context, filter model.BlockFilter) ([ return out, nil } - dft := deref(filter.FromTime) - dtt := deref(filter.ToTime) - - if !((b.Time.After(dft) || b.Time.Equal(dft)) && (dtt.IsZero() || b.Time.Before(dtt))) { + block := model.NewBlock(b) + if !FilteredBlockBy(block, filter) { continue } - out = append(out, model.NewBlock(b)) + out = append(out, block) i++ } } @@ -141,27 +122,7 @@ func (r *queryResolver) LatestBlockHeight(ctx context.Context) (int, error) { return int(h), err } -// Transactions is the resolver for the transactions field. -func (r *subscriptionResolver) Transactions(ctx context.Context) (<-chan *model.Transaction, error) { - return handleChannel(ctx, r.manager, func(nb *types.NewBlock, c chan<- *model.Transaction) { - for _, tx := range nb.Results { - c <- model.NewTransaction(tx) - } - }), nil -} - -// Blocks is the resolver for the blocks field. -func (r *subscriptionResolver) Blocks(ctx context.Context) (<-chan *model.Block, error) { - return handleChannel(ctx, r.manager, func(nb *types.NewBlock, c chan<- *model.Block) { - c <- model.NewBlock(nb.Block) - }), nil -} - // Query returns QueryResolver implementation. func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } -// Subscription returns SubscriptionResolver implementation. -func (r *Resolver) Subscription() SubscriptionResolver { return &subscriptionResolver{r} } - type queryResolver struct{ *Resolver } -type subscriptionResolver struct{ *Resolver } diff --git a/serve/graph/schema.graphql b/serve/graph/schema.graphql deleted file mode 100644 index b166c06c..00000000 --- a/serve/graph/schema.graphql +++ /dev/null @@ -1,205 +0,0 @@ -""" -Represents a blockchain block with various attributes detailing its creation and content. -""" -type Block { - - """ - A unique identifier for the Block determined by its position in the blockchain. - This integer is strictly increasing with each new Block. - """ - height: Int! - - """ - The software version of the node that created this Block, indicating the specific - implementation and versioning of the blockchain protocol used. - """ - version: String! - - """ - An identifier for the specific blockchain network this Block belongs to. Helps in - distinguishing between different networks like mainnet, testnet, etc. - """ - chain_id: String! - - """ - The timestamp at which this Block was proposed and finalized in the blockchain. Represented in UTC. - """ - time: Time! - - """ - Encoded data representing the blockchain address of the proposer who submitted this Block. - It is raw and requires decoding to be human-readable. - """ - proposer_address_raw: String! -} - -""" -Defines a transaction within a block, detailing its execution specifics and content. -""" -type Transaction { - - """ - A sequential index representing the order of this Transaction within its Block. Unique within the context of its Block. - """ - index: Int! - - """ - Hash from Transaction content in base64 encoding. - """ - hash: String! - - """ - The height of the Block in which this Transaction is included. Links the Transaction to its containing Block. - """ - block_height: Int! - - """ - The declared amount of computational effort the sender is willing to pay for executing this Transaction. - """ - gas_wanted: Int! - - """ - The actual amount of computational effort consumed to execute this Transaction. It could be less or equal to `gas_wanted`. - """ - gas_used: Int! - - """ - The payload of the Transaction in a raw format, typically containing the instructions and any data necessary for execution. - """ - content_raw: String! -} - -""" -Filters for querying Blocks within specified criteria related to their attributes. -""" -input BlockFilter { - - """ - Minimum block height from which to start fetching Blocks, inclusive. If unspecified, there is no lower bound. - """ - from_height: Int - - """ - Maximum block height up to which Blocks should be fetched, exclusive. If unspecified, there is no upper bound. - """ - to_height: Int - - """ - Minimum timestamp from which to start fetching Blocks, inclusive. Blocks created at or after this time will be included. - """ - from_time: Time - - """ - Maximum timestamp up to which to fetch Blocks, exclusive. Only Blocks created before this time are included. - """ - to_time: Time -} - -""" -Filters for querying Transactions within specified criteria related to their execution and placement within Blocks. -""" -input TransactionFilter { - - """ - Minimum block height from which to start fetching Transactions, inclusive. Aids in scoping the search to recent Transactions. - """ - from_block_height: Int - - """ - Maximum block height up to which Transactions should be fetched, exclusive. Helps in limiting the search to older Transactions. - """ - to_block_height: Int - - """ - Minimum Transaction index from which to start fetching, inclusive. Facilitates ordering in Transaction queries. - """ - from_index: Int - - """ - Maximum Transaction index up to which to fetch, exclusive. Ensures a limit on the ordering range for Transaction queries. - """ - to_index: Int - - """ - Minimum `gas_wanted` value to filter Transactions by, inclusive. Filters Transactions based on the minimum computational effort declared. - """ - from_gas_wanted: Int - - """ - Maximum `gas_wanted` value for filtering Transactions, exclusive. Limits Transactions based on the declared computational effort. - """ - to_gas_wanted: Int - - """ - Minimum `gas_used` value to filter Transactions by, inclusive. Selects Transactions based on the minimum computational effort actually used. - """ - from_gas_used: Int - - """ - Maximum `gas_used` value for filtering Transactions, exclusive. Refines selection based on the computational effort actually consumed. - """ - to_gas_used: Int - - """ - Hash from Transaction content in base64 encoding. If this filter is used, any other filter will be ignored. - """ - hash: String - -} - -""" -Root Query type to fetch data about Blocks and Transactions based on filters or retrieve the latest block height. -""" -type Query { - - """ - Retrieves a list of Transactions that match the given filter criteria. If the result is incomplete due to errors, both partial results and errors are returned. - """ - transactions(filter: TransactionFilter!): [Transaction!] - - """ - Fetches Blocks matching the specified filter criteria. Incomplete results due to errors return both the partial Blocks and the associated errors. - """ - blocks(filter: BlockFilter!): [Block!] - - """ - Returns the height of the most recently processed Block by the blockchain indexer, indicating the current length of the blockchain. - """ - latestBlockHeight: Int! -} - -""" -Subscriptions provide a way for clients to receive real-time updates about Transactions and Blocks based on specified filter criteria. -Subscribers will only receive updates for events occurring after the subscription is established. -""" -type Subscription { - - """ - Subscribes to real-time updates of Transactions that match the provided filter criteria. - This subscription starts immediately and only includes Transactions added to the blockchain after the subscription is active. - - This is useful for applications needing to track Transactions in real-time, such as wallets tracking incoming transactions - or analytics platforms monitoring blockchain activity. - - Returns: - - Transaction: Each received update is a Transaction object that matches the filter criteria. - """ - transactions: Transaction! - - """ - Subscribes to real-time updates of Blocks that match the provided filter criteria. Similar to the Transactions subscription, - this subscription is active immediately upon creation and only includes Blocks added after the subscription begins. - - This subscription is ideal for services that need to be notified of new Blocks for processing or analysis, such as block explorers, - data aggregators, or security monitoring tools. - - Returns: - - Block: Each update consists of a Block object that satisfies the filter criteria, allowing subscribers to process or analyze new Blocks in real time. - """ - blocks: Block! -} - -""" -Field representing a point on time. It is following the RFC3339Nano format ("2006-01-02T15:04:05.999999999Z07:00") -""" -scalar Time diff --git a/serve/graph/schema/filter/block_filter.graphql b/serve/graph/schema/filter/block_filter.graphql new file mode 100644 index 00000000..b1eac178 --- /dev/null +++ b/serve/graph/schema/filter/block_filter.graphql @@ -0,0 +1,24 @@ +""" +Filters for querying Blocks within specified criteria related to their attributes. +""" +input BlockFilter { + """ + Minimum block height from which to start fetching Blocks, inclusive. If unspecified, there is no lower bound. + """ + from_height: Int + + """ + Maximum block height up to which Blocks should be fetched, exclusive. If unspecified, there is no upper bound. + """ + to_height: Int + + """ + Minimum timestamp from which to start fetching Blocks, inclusive. Blocks created at or after this time will be included. + """ + from_time: Time + + """ + Maximum timestamp up to which to fetch Blocks, exclusive. Only Blocks created before this time are included. + """ + to_time: Time +} diff --git a/serve/graph/schema/filter/transaction_filter.graphql b/serve/graph/schema/filter/transaction_filter.graphql new file mode 100644 index 00000000..d9b8aeb2 --- /dev/null +++ b/serve/graph/schema/filter/transaction_filter.graphql @@ -0,0 +1,283 @@ +""" +Filters for querying Transactions within specified criteria related to their execution and placement within Blocks. +""" +input TransactionFilter { + """ + Minimum block height from which to start fetching Transactions, inclusive. Aids in scoping the search to recent Transactions. + """ + from_block_height: Int + + """ + Maximum block height up to which Transactions should be fetched, exclusive. Helps in limiting the search to older Transactions. + """ + to_block_height: Int + + """ + Minimum Transaction index from which to start fetching, inclusive. Facilitates ordering in Transaction queries. + """ + from_index: Int + + """ + Maximum Transaction index up to which to fetch, exclusive. Ensures a limit on the ordering range for Transaction queries. + """ + to_index: Int + + """ + Minimum `gas_wanted` value to filter Transactions by, inclusive. Filters Transactions based on the minimum computational effort declared. + """ + from_gas_wanted: Int + + """ + Maximum `gas_wanted` value for filtering Transactions, exclusive. Limits Transactions based on the declared computational effort. + """ + to_gas_wanted: Int + + """ + Minimum `gas_used` value to filter Transactions by, inclusive. Selects Transactions based on the minimum computational effort actually used. + """ + from_gas_used: Int + + """ + Maximum `gas_used` value for filtering Transactions, exclusive. Refines selection based on the computational effort actually consumed. + """ + to_gas_used: Int + + """ + Hash from Transaction content in base64 encoding. If this filter is used, any other filter will be ignored. + """ + hash: String + + """ + Transaction's message to filter Transactions. + `message` can be configured as a filter with a transaction message's `router` and `type` and `parameters(bank / vm)`. + """ + message: TransactionMessageInput + + """ + `memo` are string information stored within a transaction. + `memo` can be utilized to find or distinguish transactions. + For example, when trading a specific exchange, you would utilize the memo field of the transaction. + """ + memo: String +} + +""" +Transaction's message to filter Transactions. +`TransactionMessageInput` can be configured as a filter with a transaction message's `router` and `type` and `parameters(bank / vm)`. +""" +input TransactionMessageInput { + """ + The type of transaction message. + The value of `typeUrl` can be `send`, `exec`, `add_package`, `run`. + """ + type_url: MessageType + + """ + The route of transaction message. + The value of `route` can be `bank`, `vm`. + """ + route: MessageRoute + + """ + `TransactionBankMessageInput` represents input parameters required when the message router is `bank`. + """ + bank_param: TransactionBankMessageInput + + """ + `TransactionVmMessageInput` represents input parameters required when the message router is `vm`. + """ + vm_param: TransactionVmMessageInput +} + +""" +`TransactionBankMessageInput` represents input parameters required when the message router is `bank`. +""" +input TransactionBankMessageInput { + """ + send represents input parameters required when the message type is `send`. + """ + send: BankMsgSendInput +} + +""" +`BankMsgSendInput` represents input parameters required when the message type is `send`. +""" +input BankMsgSendInput { + """ + the bech32 address of the fund sender. + You can filter by the fund sender address. + ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + """ + from_address: String + + """ + the bech32 address of the fund receiver. + You can filter by the fund receiver address. + ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + """ + to_address: String + + """ + the denomination and amount of fund sent (""). + ex) `1000000ugnot` + """ + amount: AmountInput +} + +""" +`TransactionVmMessageInput` represents input parameters required when the message router is `vm`. +""" +input TransactionVmMessageInput { + """ + `MsgCallInput` represents input parameters required when the message type is `exec`. + """ + exec: MsgCallInput + + """ + `MsgAddPackageInput` represents input parameters required when the message type is `add_package`. + """ + add_package: MsgAddPackageInput + + """ + `MsgRunInput` represents input parameters required when the message type is `run`. + """ + run: MsgRunInput +} + +""" +`MsgCallInput` represents input parameters required when the message type is `exec`. +""" +input MsgCallInput { + """ + the bech32 address of the function caller. + You can filter by the function caller's address. + ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + """ + caller: String + + """ + the amount of funds to be deposited to the package, if any (""). + ex) `1000000ugnot` + """ + send: AmountInput + + """ + the gno package path. + """ + pkg_path: String + + """ + the function name being invoked. + """ + func: String + + """ + `args` are the arguments passed to the executed function. + The arguments are checked in the order of the argument array and + if they are empty strings, they are excluded from the filtering criteria. + ex) `["", "", "1"]` <- Empty strings skip the condition. + """ + args: [String!] +} + +""" +`MsgAddPackageInput` represents input parameters required when the message type is `add_package`. +""" +input MsgAddPackageInput { + """ + the bech32 address of the package deployer. + You can filter by the package deployer's address. + ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + """ + creator: String + + """ + the package being deployed. + """ + package: MemPackageInput + + """ + the amount of funds to be deposited at deployment, if any (""). + ex) `1000000ugnot` + """ + deposit: AmountInput +} + +""" +`MsgRunInput` represents input parameters required when the message type is `run`. +""" +input MsgRunInput { + """ + the bech32 address of the function caller. + You can filter by the function caller's address. + ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + """ + caller: String + + """ + the amount of funds to be deposited to the package, if any (""). + ex) `1000000ugnot` + """ + send: AmountInput + + """ + the package being executed. + """ + package: MemPackageInput +} + +""" +`MemPackageInput` represents a package stored in memory. +""" +input MemPackageInput { + """ + the name of the package. + """ + name: String + + """ + the gno path of the package. + """ + path: String + + """ + the associated package gno source. + """ + files: [MemFileInput] +} + +""" +`MemFileInput` is the metadata information tied to a single gno package / realm file. +""" +input MemFileInput { + """ + the name of the source file. + """ + name: String + + """ + the content of the source file. + """ + body: String +} + +""" +`AmountInput` is a range of token quantities to filter by. +""" +input AmountInput { + """ + The minimum quantity of tokens to check for. + """ + from: Int + + """ + The maximum quantity of tokens to check for. + """ + to: Int + + """ + Filter by token's denomination. + If set to an empty string, it will get an empty value. + """ + denomination: String +} diff --git a/serve/graph/schema/query.graphql b/serve/graph/schema/query.graphql new file mode 100644 index 00000000..5ab9c837 --- /dev/null +++ b/serve/graph/schema/query.graphql @@ -0,0 +1,19 @@ +""" +Root Query type to fetch data about Blocks and Transactions based on filters or retrieve the latest block height. +""" +type Query { + """ + Retrieves a list of Transactions that match the given filter criteria. If the result is incomplete due to errors, both partial results and errors are returned. + """ + transactions(filter: TransactionFilter!): [Transaction!] + + """ + Fetches Blocks matching the specified filter criteria. Incomplete results due to errors return both the partial Blocks and the associated errors. + """ + blocks(filter: BlockFilter!): [Block!] + + """ + Returns the height of the most recently processed Block by the blockchain indexer, indicating the current length of the blockchain. + """ + latestBlockHeight: Int! +} diff --git a/serve/graph/schema/schema.graphql b/serve/graph/schema/schema.graphql new file mode 100644 index 00000000..2b8bc3ff --- /dev/null +++ b/serve/graph/schema/schema.graphql @@ -0,0 +1,9 @@ +schema { + query: Query + subscription: Subscription +} + +""" +Field representing a point on time. It is following the RFC3339Nano format ("2006-01-02T15:04:05.999999999Z07:00") +""" +scalar Time diff --git a/serve/graph/schema/subscription.graphql b/serve/graph/schema/subscription.graphql new file mode 100644 index 00000000..f363c8d1 --- /dev/null +++ b/serve/graph/schema/subscription.graphql @@ -0,0 +1,29 @@ +""" +Subscriptions provide a way for clients to receive real-time updates about Transactions and Blocks based on specified filter criteria. +Subscribers will only receive updates for events occurring after the subscription is established. +""" +type Subscription { + """ + Subscribes to real-time updates of Transactions that match the provided filter criteria. + This subscription starts immediately and only includes Transactions added to the blockchain after the subscription is active. + + This is useful for applications needing to track Transactions in real-time, such as wallets tracking incoming transactions + or analytics platforms monitoring blockchain activity. + + Returns: + - Transaction: Each received update is a Transaction object that matches the filter criteria. + """ + transactions(filter: TransactionFilter!): Transaction! + + """ + Subscribes to real-time updates of Blocks that match the provided filter criteria. Similar to the Transactions subscription, + this subscription is active immediately upon creation and only includes Blocks added after the subscription begins. + + This subscription is ideal for services that need to be notified of new Blocks for processing or analysis, such as block explorers, + data aggregators, or security monitoring tools. + + Returns: + - Block: Each update consists of a Block object that satisfies the filter criteria, allowing subscribers to process or analyze new Blocks in real time. + """ + blocks(filter: BlockFilter!): Block! +} diff --git a/serve/graph/schema/types/block.graphql b/serve/graph/schema/types/block.graphql new file mode 100644 index 00000000..3747ff5e --- /dev/null +++ b/serve/graph/schema/types/block.graphql @@ -0,0 +1,33 @@ +""" +Represents a blockchain block with various attributes detailing its creation and content. +""" +type Block { + """ + A unique identifier for the Block determined by its position in the blockchain. + This integer is strictly increasing with each new Block. + """ + height: Int! + + """ + The software version of the node that created this Block, indicating the specific + implementation and versioning of the blockchain protocol used. + """ + version: String! + + """ + An identifier for the specific blockchain network this Block belongs to. Helps in + distinguishing between different networks like mainnet, testnet, etc. + """ + chain_id: String! + + """ + The timestamp at which this Block was proposed and finalized in the blockchain. Represented in UTC. + """ + time: Time! + + """ + Encoded data representing the blockchain address of the proposer who submitted this Block. + It is raw and requires decoding to be human-readable. + """ + proposer_address_raw: String! +} diff --git a/serve/graph/schema/types/transaction.graphql b/serve/graph/schema/types/transaction.graphql new file mode 100644 index 00000000..7dc2f291 --- /dev/null +++ b/serve/graph/schema/types/transaction.graphql @@ -0,0 +1,265 @@ +""" +Defines a transaction within a block, detailing its execution specifics and content. +""" +type Transaction { + """ + A sequential index representing the order of this Transaction within its Block. Unique within the context of its Block. + """ + index: Int! + + """ + Hash from Transaction content in base64 encoding. + """ + hash: String! + + """ + The height of the Block in which this Transaction is included. Links the Transaction to its containing Block. + """ + block_height: Int! + + """ + The declared amount of computational effort the sender is willing to pay for executing this Transaction. + """ + gas_wanted: Int! + + """ + The actual amount of computational effort consumed to execute this Transaction. It could be less or equal to `gas_wanted`. + """ + gas_used: Int! + + """ + The payload of the Transaction in a raw format, typically containing the instructions and any data necessary for execution. + """ + content_raw: String! + + """ + The payload of a message shows the contents of the messages in a transaction. + A message consists of `router`, `type`, and `value` (whose form depends on the `router` and `type`). + """ + messages: [TransactionMessage]! + + """ + `memo` are string information stored within a transaction. + `memo` can be utilized to find or distinguish transactions. + For example, when trading a specific exchange, you would utilize the memo field of the transaction. + """ + memo: String! +} + +""" +`MessageRoute` is route type of the transactional message. +`MessageRoute` has the values of vm and bank. +""" +enum MessageRoute { + vm + bank +} + +""" +`MessageType` is message type of the transaction. +`MessageType` has the values `send`, `exec`, `add_package`, and `run`. +""" +enum MessageType { + """ + The route value for this message type is `bank`, and the value for transactional messages is `BankMsgSend`. + This is a transaction message used when sending native tokens. + """ + send + + """ + The route value for this message type is `vm`, and the value for transactional messages is `MsgCall`. + This is a transaction message that executes a function in realm or package that is deployed in the GNO chain. + """ + exec + + """ + The route value for this message type is `vm`, and the value for transactional messages is `MsgAddPackage`. + This is a transactional message that adds a package to the GNO chain. + """ + add_package + + """ + The route value for this message type is `vm`, and the value for transactional messages is `MsgRun`. + This is a transactional message that executes an arbitrary Gno-coded TX message. + """ + run +} + +type TransactionMessage { + """ + The type of transaction message. + The value of `typeUrl` can be `send`, `exec`, `add_package`, `run`. + """ + typeUrl: String! + + """ + The route of transaction message. + The value of `route` can be `bank`, `vm`. + """ + route: String! + + """ + MessageValue is the content of the transaction. + `value` can be of type `BankMsgSend`, `MsgCall`, `MsgAddPackage`, `MsgRun`, `UnexpectedMessage`. + """ + value: MessageValue! +} + +union MessageValue = BankMsgSend | MsgCall | MsgAddPackage | MsgRun | UnexpectedMessage + +""" +`BankMsgSend` is a message with a message router of `bank` and a message type of `send`. +`BankMsgSend` is the fund transfer tx message. +""" +type BankMsgSend { + """ + the bech32 address of the fund sender. + ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + """ + from_address: String! + + """ + the bech32 address of the fund receiver. + ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + """ + to_address: String! + + """ + the denomination and amount of fund sent (""). + ex) `1000000ugnot` + """ + amount: String! +} + +""" +`MsgCall` is a message with a message router of `vm` and a message type of `exec`. +`MsgCall` is the method invocation tx message. +""" +type MsgCall { + """ + the bech32 address of the function caller. + ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + """ + caller: String! + + """ + the amount of funds to be deposited to the package, if any (""). + ex) `1000000ugnot` + """ + send: String! + + """ + the gno package path. + """ + pkg_path: String! + + """ + the function name being invoked. + """ + func: String! + + """ + `args` are the arguments passed to the executed function. + """ + args: [String!] +} + +""" +`MsgAddPackage` is a message with a message router of `vm` and a message type of `add_package`. +`MsgAddPackage` is the package deployment tx message. +""" +type MsgAddPackage { + """ + the bech32 address of the package deployer. + ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + """ + creator: String! + + """ + the package being deployed. + """ + package: MemPackage! + + """ + the amount of funds to be deposited at deployment, if any (""). + ex) `1000000ugnot` + """ + deposit: String! +} + +""" +`MsgRun` is a message with a message router of `vm` and a message type of `run`. +`MsgRun is the execute arbitrary Gno code tx message`. +""" +type MsgRun { + """ + the bech32 address of the function caller. + ex) `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` + """ + caller: String! + + """ + the amount of funds to be deposited to the package, if any (""). + ex) `1000000ugnot` + """ + send: String! + + """ + the package being executed. + """ + package: MemPackage! +} + +""" +`UnexpectedMessage` is an Undefined Message, which is a message that decoding failed. +""" +type UnexpectedMessage { + raw: String! +} + +""" +`MemPackage` is the metadata information tied to package / realm deployment. +""" +type MemPackage { + """ + the name of the package. + """ + name: String! + + """ + the gno path of the package. + """ + path: String! + + """ + the associated package gno source. + """ + files: [MemFile!] +} + +""" +`MemFile` is the metadata information tied to a single gno package / realm file +""" +type MemFile { + """ + the name of the source file. + """ + name: String! + + """ + the content of the source file. + """ + body: String! +} + +type TxFee { + """ + gas limit + """ + gas_wanted: Int! + + """ + gas fee details () + """ + gas_fee: Int! +} diff --git a/serve/graph/setup.go b/serve/graph/setup.go index 787fbefc..682155e6 100644 --- a/serve/graph/setup.go +++ b/serve/graph/setup.go @@ -4,14 +4,15 @@ import ( "github.com/99designs/gqlgen/graphql/handler" "github.com/99designs/gqlgen/graphql/handler/transport" "github.com/99designs/gqlgen/graphql/playground" - "github.com/go-chi/chi/v5" - "github.com/gnolang/tx-indexer/events" "github.com/gnolang/tx-indexer/storage" + "github.com/go-chi/chi/v5" ) func Setup(s storage.Storage, manager *events.Manager, m *chi.Mux) *chi.Mux { - srv := handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: NewResolver(s, manager)})) + srv := handler.NewDefaultServer(NewExecutableSchema( + Config{Resolvers: NewResolver(s, manager)}, + )) srv.AddTransport(&transport.Websocket{}) diff --git a/serve/graph/subscription.resolvers.go b/serve/graph/subscription.resolvers.go new file mode 100644 index 00000000..366b1636 --- /dev/null +++ b/serve/graph/subscription.resolvers.go @@ -0,0 +1,39 @@ +package graph + +// This file will be automatically regenerated based on the schema, any resolver implementations +// will be copied through when generating and any unknown code will be moved to the end. +// Code generated by github.com/99designs/gqlgen version v0.17.45 + +import ( + "context" + + "github.com/gnolang/tx-indexer/serve/graph/model" + "github.com/gnolang/tx-indexer/types" +) + +// Transactions is the resolver for the transactions field. +func (r *subscriptionResolver) Transactions(ctx context.Context, filter model.TransactionFilter) (<-chan *model.Transaction, error) { + return handleChannel(ctx, r.manager, func(nb *types.NewBlock, c chan<- *model.Transaction) { + for _, tx := range nb.Results { + transaction := model.NewTransaction(tx) + if FilteredTransactionBy(transaction, filter) { + c <- transaction + } + } + }), nil +} + +// Blocks is the resolver for the blocks field. +func (r *subscriptionResolver) Blocks(ctx context.Context, filter model.BlockFilter) (<-chan *model.Block, error) { + return handleChannel(ctx, r.manager, func(nb *types.NewBlock, c chan<- *model.Block) { + block := model.NewBlock(nb.Block) + if FilteredBlockBy(block, filter) { + c <- block + } + }), nil +} + +// Subscription returns SubscriptionResolver implementation. +func (r *Resolver) Subscription() SubscriptionResolver { return &subscriptionResolver{r} } + +type subscriptionResolver struct{ *Resolver } diff --git a/serve/graph/transaction_filter.go b/serve/graph/transaction_filter.go new file mode 100644 index 00000000..eaee6a67 --- /dev/null +++ b/serve/graph/transaction_filter.go @@ -0,0 +1,349 @@ +package graph + +import ( + "math" + + "github.com/gnolang/gno/tm2/pkg/std" + "github.com/gnolang/tx-indexer/serve/graph/model" +) + +// `FilteredTransactionBy` checks for conditions in GasUsed, GasWanted, Memo, and Message. +// By default, the condition is only checked if the input parameter exists. +func FilteredTransactionBy(tx *model.Transaction, filter model.TransactionFilter) bool { + if !filteredTransactionByGasUsed(tx, filter.FromGasUsed, filter.ToGasUsed) { + return false + } + + if !filteredTransactionByGasWanted(tx, filter.FromGasWanted, filter.ToGasWanted) { + return false + } + + if !filteredTransactionByMemo(tx, filter.Memo) { + return false + } + + if filter.Message != nil { + if !filteredTransactionByMessageRoute(tx, filter.Message.Route) { + return false + } + + if !filteredTransactionByMessageType(tx, filter.Message.TypeURL) { + return false + } + + if !filteredTransactionByMessages(tx, filter.Message) { + return false + } + } + + return true +} + +// `filteredAmountBy` checks a token represented as a string() +// against a range of amount and a denomination. +func filteredAmountBy(amountStr string, amountInput *model.AmountInput) bool { + if amountInput == nil { + return true + } + + coins, err := std.ParseCoins(amountStr) + if err != nil { + return false + } + + // If the input parameter for denomination is not used, all denominations are checked. + isAllDenomination := amountInput.Denomination == nil + if !isAllDenomination { + if deref(amountInput.Denomination) == "" && coins.Empty() { + return true + } + } + + for _, coin := range coins { + isSameDenomination := coin.Denom == deref(amountInput.Denomination) + if isAllDenomination || isSameDenomination { + fromAmount := int64(deref(amountInput.From)) + toAmount := int64(deref(amountInput.To)) + + if toAmount == 0 { + toAmount = math.MaxInt + } + + if coin.Amount >= fromAmount && coin.Amount <= toAmount { + return true + } + } + } + + return false +} + +// `filteredTransactionByGasUsed` checks transactions based on gasUsed. +func filteredTransactionByGasUsed(tx *model.Transaction, filterFromGasUsed, filterToGasUsed *int) bool { + gasUsed := tx.GasUsed() + fromGasUsed := deref(filterFromGasUsed) + toGasUsed := deref(filterToGasUsed) + + if toGasUsed == 0 { + toGasUsed = math.MaxInt + } + + return gasUsed >= fromGasUsed && gasUsed <= toGasUsed +} + +// `filteredTransactionByGasWanted` checks transactions based on gasWanted. +func filteredTransactionByGasWanted(tx *model.Transaction, filterFromGasWanted, filterToGasWanted *int) bool { + gasWanted := tx.GasWanted() + fromGasWanted := deref(filterFromGasWanted) + toGasWanted := deref(filterToGasWanted) + + if toGasWanted == 0 { + toGasWanted = math.MaxInt + } + + return gasWanted >= fromGasWanted && gasWanted <= toGasWanted +} + +// `filteredTransactionByMemo` checks transactions based on memo. +func filteredTransactionByMemo(tx *model.Transaction, filterMemo *string) bool { + if filterMemo == nil { + return true + } + + return deref(filterMemo) == tx.Memo() +} + +// `filteredTransactionByMessages` checks transaction's messages. +func filteredTransactionByMessages(tx *model.Transaction, messageInput *model.TransactionMessageInput) bool { + messages := tx.Messages() + for _, message := range messages { + if !filteredTransactionMessageBy(message, messageInput) { + return false + } + } + + return true +} + +// `filteredTransactionByMessageRoute` checks if the transaction message contains the route value. +func filteredTransactionByMessageRoute(tx *model.Transaction, messageRoute *model.MessageRoute) bool { + if messageRoute == nil { + return true + } + + messages := tx.Messages() + for _, message := range messages { + if message.Route == messageRoute.String() { + return true + } + } + + return false +} + +// `filteredTransactionByMessageType` checks if the transaction message contains the type value. +func filteredTransactionByMessageType(tx *model.Transaction, messageType *model.MessageType) bool { + if messageType == nil { + return true + } + + messages := tx.Messages() + for _, message := range messages { + if message.TypeURL == messageType.String() { + return true + } + } + + return false +} + +// `filteredTransactionMessageBy` checks for conditions based on the transaction message type. +func filteredTransactionMessageBy( + tm *model.TransactionMessage, + messageInput *model.TransactionMessageInput, +) bool { + if messageInput.TypeURL != nil && messageInput.TypeURL.String() != tm.TypeURL { + return false + } + + if messageInput.BankParam == nil && messageInput.VMParam == nil { + return true + } + + switch tm.Route { + case model.MessageRouteBank.String(): + if messageInput.BankParam == nil { + return false + } + case model.MessageRouteVM.String(): + if messageInput.VMParam == nil { + return false + } + default: + return false + } + + switch tm.TypeURL { + case model.MessageTypeSend.String(): + if !filteredMessageOfBankMsgSendBy(tm.BankMsgSend(), messageInput.BankParam) { + return false + } + case model.MessageTypeExec.String(): + if !filteredMessageOfMsgCallBy(tm.VMMsgCall(), messageInput.VMParam) { + return false + } + case model.MessageTypeAddPackage.String(): + if !filteredMessageOfMsgAddPackageBy(tm.VMAddPackage(), messageInput.VMParam) { + return false + } + case model.MessageTypeRun.String(): + if !filteredMessageOfMsgRunBy(tm.VMMsgRun(), messageInput.VMParam) { + return false + } + default: + return false + } + + return true +} + +// `filteredMessageOfBankMsgSendBy` checks the conditions of a message of type BankMsgSend +func filteredMessageOfBankMsgSendBy( + messageValue model.BankMsgSend, + bankMessageInput *model.TransactionBankMessageInput, +) bool { + params := bankMessageInput + if params == nil || params.Send == nil { + return true + } + + if params.Send.Amount != nil && !filteredAmountBy(messageValue.Amount, params.Send.Amount) { + return false + } + + if params.Send.FromAddress != nil && deref(params.Send.FromAddress) != messageValue.FromAddress { + return false + } + + if params.Send.ToAddress != nil && deref(params.Send.ToAddress) != messageValue.ToAddress { + return false + } + + return true +} + +// `filteredMessageOfMsgCallBy` checks the conditions of a message of type MsgCall +func filteredMessageOfMsgCallBy( + messageValue model.MsgCall, + vmMessageInput *model.TransactionVMMessageInput, +) bool { + params := vmMessageInput + if params == nil { + return true + } + + if params.Exec == nil { + return false + } + + if params.Exec.Caller != nil && deref(params.Exec.Caller) != messageValue.Caller { + return false + } + + if params.Exec.Func != nil && deref(params.Exec.Func) != messageValue.Func { + return false + } + + if params.Exec.PkgPath != nil && deref(params.Exec.PkgPath) != messageValue.PkgPath { + return false + } + + if params.Exec.Send != nil && filteredAmountBy(messageValue.Send, params.Exec.Send) { + return false + } + + if params.Exec.Args != nil { + messageArgs := messageValue.Args + if messageArgs == nil { + return false + } + + messageFilterArgs := params.Exec.Args + for index, arg := range messageArgs { + if index < len(messageFilterArgs) { + if arg != "" && messageFilterArgs[index] != arg { + return false + } + } + } + } + + return true +} + +// `filteredMessageOfMsgAddPackageBy` checks the conditions of a message of type MsgAddPackage +func filteredMessageOfMsgAddPackageBy( + messageValue model.MsgAddPackage, + vmMessageInput *model.TransactionVMMessageInput, +) bool { + params := vmMessageInput + if params == nil { + return true + } + + if params.AddPackage == nil { + return false + } + + if params.AddPackage.Creator != nil && deref(params.AddPackage.Creator) != messageValue.Creator { + return false + } + + if params.AddPackage.Deposit != nil && filteredAmountBy(messageValue.Deposit, params.AddPackage.Deposit) { + return false + } + + if params.AddPackage.Package != nil { + if params.AddPackage.Package.Name != nil && deref(params.AddPackage.Package.Name) != messageValue.Package.Name { + return false + } + + if params.AddPackage.Package.Path != nil && deref(params.AddPackage.Package.Path) != messageValue.Package.Path { + return false + } + } + + return true +} + +// `filteredMessageOfMsgRunBy` checks the conditions of a message of type MsgRun +func filteredMessageOfMsgRunBy(messageValue model.MsgRun, vmMessageInput *model.TransactionVMMessageInput) bool { + params := vmMessageInput + if params == nil { + return true + } + + if params.Run == nil { + return false + } + + if params.Run.Caller != nil && deref(params.Run.Caller) != messageValue.Caller { + return false + } + + if params.Run.Send != nil && filteredAmountBy(messageValue.Send, params.Run.Send) { + return false + } + + if params.Run.Package != nil { + if deref(params.Run.Package.Name) != messageValue.Package.Name { + return false + } + + if deref(params.Run.Package.Path) != messageValue.Package.Path { + return false + } + } + + return true +}