From 28aa3efe4b63aa71b6db2c9c1dfc0dbcee366fc1 Mon Sep 17 00:00:00 2001 From: Stuart Corring <1814344+scorring@users.noreply.github.com> Date: Fri, 24 May 2024 16:10:34 +0200 Subject: [PATCH] Add block withdrawals in graphQL response (#10463) In the context of data collection and indexing, I need to make one graphQL request per block to retrieve several informations. Currently withdrawals are not implemented in graphQL. This PR adds it. **Request** ```graphQL { block(number: 19938542) { number withdrawals { index validator address amount } } } ``` **Response** ```json { "data": { "block": { "number": 19938542, "withdrawals": [ { "index": 46457291, "validator": 425887, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x11db8a5" }, { "index": 46457292, "validator": 425888, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x11e2885" }, { "index": 46457293, "validator": 425889, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x11e9866" }, { "index": 46457294, "validator": 425890, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x11e5524" }, { "index": 46457295, "validator": 425891, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x11e00fc" }, { "index": 46457296, "validator": 425892, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x11ec53c" }, { "index": 46457297, "validator": 425893, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x11e2f24" }, { "index": 46457298, "validator": 425894, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x11d866b" }, { "index": 46457299, "validator": 425895, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x11e4bb3" }, { "index": 46457300, "validator": 425896, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x11deeb5" }, { "index": 46457301, "validator": 425897, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x11e0e99" }, { "index": 46457302, "validator": 425898, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x11ee082" }, { "index": 46457303, "validator": 425899, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x11e4283" }, { "index": 46457304, "validator": 425900, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x11ed7b6" }, { "index": 46457305, "validator": 425901, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x11d41ef" }, { "index": 46457306, "validator": 425902, "address": "0x4B5E9A6Ab1B87D4Df850178AD2807c1E3E3BA33E", "amount": "0x3c88641" } ] } } } ``` --- cmd/rpcdaemon/graphql/graph/generated.go | 637 +++++++++++++---- .../graphql/graph/model/models_gen.go | 14 + cmd/rpcdaemon/graphql/graph/schema.graphqls | 671 +++++++++--------- .../graphql/graph/schema.resolvers.go | 17 +- cmd/rpcdaemon/graphql/graphql_test.go | 6 + cmd/rpcdaemon/graphql/query_block.graphql | 6 + turbo/jsonrpc/graphql_api.go | 14 + 7 files changed, 899 insertions(+), 466 deletions(-) diff --git a/cmd/rpcdaemon/graphql/graph/generated.go b/cmd/rpcdaemon/graphql/graph/generated.go index d1cfe32e753..1c08d07a307 100644 --- a/cmd/rpcdaemon/graphql/graph/generated.go +++ b/cmd/rpcdaemon/graphql/graph/generated.go @@ -92,6 +92,7 @@ type ComplexityRoot struct { TransactionCount func(childComplexity int) int Transactions func(childComplexity int) int TransactionsRoot func(childComplexity int) int + Withdrawals func(childComplexity int) int } CallResult struct { @@ -166,6 +167,13 @@ type ComplexityRoot struct { V func(childComplexity int) int Value func(childComplexity int) int } + + Withdrawal struct { + Address func(childComplexity int) int + Amount func(childComplexity int) int + Index func(childComplexity int) int + Validator func(childComplexity int) int + } } type MutationResolver interface { @@ -508,6 +516,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Block.TransactionsRoot(childComplexity), true + case "Block.withdrawals": + if e.complexity.Block.Withdrawals == nil { + break + } + + return e.complexity.Block.Withdrawals(childComplexity), true + case "CallResult.data": if e.complexity.CallResult.Data == nil { break @@ -932,6 +947,34 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Transaction.Value(childComplexity), true + case "Withdrawal.address": + if e.complexity.Withdrawal.Address == nil { + break + } + + return e.complexity.Withdrawal.Address(childComplexity), true + + case "Withdrawal.amount": + if e.complexity.Withdrawal.Amount == nil { + break + } + + return e.complexity.Withdrawal.Amount(childComplexity), true + + case "Withdrawal.index": + if e.complexity.Withdrawal.Index == nil { + break + } + + return e.complexity.Withdrawal.Index(childComplexity), true + + case "Withdrawal.validator": + if e.complexity.Withdrawal.Validator == nil { + break + } + + return e.complexity.Withdrawal.Validator(childComplexity), true + } return 0, false } @@ -1461,7 +1504,7 @@ func (ec *executionContext) _AccessTuple_address(ctx context.Context, field grap return ec.marshalNAddress2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_AccessTuple_address(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_AccessTuple_address(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AccessTuple", Field: field, @@ -1505,7 +1548,7 @@ func (ec *executionContext) _AccessTuple_storageKeys(ctx context.Context, field return ec.marshalNBytes322ᚕstringᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_AccessTuple_storageKeys(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_AccessTuple_storageKeys(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "AccessTuple", Field: field, @@ -1549,7 +1592,7 @@ func (ec *executionContext) _Account_address(ctx context.Context, field graphql. return ec.marshalNAddress2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Account_address(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Account_address(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Account", Field: field, @@ -1593,7 +1636,7 @@ func (ec *executionContext) _Account_balance(ctx context.Context, field graphql. return ec.marshalNBigInt2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Account_balance(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Account_balance(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Account", Field: field, @@ -1637,7 +1680,7 @@ func (ec *executionContext) _Account_transactionCount(ctx context.Context, field return ec.marshalNLong2uint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Account_transactionCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Account_transactionCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Account", Field: field, @@ -1681,7 +1724,7 @@ func (ec *executionContext) _Account_code(ctx context.Context, field graphql.Col return ec.marshalNBytes2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Account_code(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Account_code(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Account", Field: field, @@ -1780,7 +1823,7 @@ func (ec *executionContext) _Block_number(ctx context.Context, field graphql.Col return ec.marshalNLong2uint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_number(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_number(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -1824,7 +1867,7 @@ func (ec *executionContext) _Block_hash(ctx context.Context, field graphql.Colle return ec.marshalNBytes322string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_hash(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_hash(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -1865,7 +1908,7 @@ func (ec *executionContext) _Block_parent(ctx context.Context, field graphql.Col return ec.marshalOBlock2ᚖgithubᚗcomᚋledgerwatchᚋerigonᚋcmdᚋrpcdaemonᚋgraphqlᚋgraphᚋmodelᚐBlock(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_parent(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_parent(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -1935,6 +1978,8 @@ func (ec *executionContext) fieldContext_Block_parent(ctx context.Context, field return ec.fieldContext_Block_rawHeader(ctx, field) case "raw": return ec.fieldContext_Block_raw(ctx, field) + case "withdrawals": + return ec.fieldContext_Block_withdrawals(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Block", field.Name) }, @@ -1973,7 +2018,7 @@ func (ec *executionContext) _Block_nonce(ctx context.Context, field graphql.Coll return ec.marshalNBigInt2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_nonce(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_nonce(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2017,7 +2062,7 @@ func (ec *executionContext) _Block_transactionsRoot(ctx context.Context, field g return ec.marshalNBytes322string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_transactionsRoot(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_transactionsRoot(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2058,7 +2103,7 @@ func (ec *executionContext) _Block_transactionCount(ctx context.Context, field g return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_transactionCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_transactionCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2102,7 +2147,7 @@ func (ec *executionContext) _Block_stateRoot(ctx context.Context, field graphql. return ec.marshalNBytes322string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_stateRoot(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_stateRoot(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2146,7 +2191,7 @@ func (ec *executionContext) _Block_receiptsRoot(ctx context.Context, field graph return ec.marshalNBytes322string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_receiptsRoot(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_receiptsRoot(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2257,7 +2302,7 @@ func (ec *executionContext) _Block_extraData(ctx context.Context, field graphql. return ec.marshalNBytes2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_extraData(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_extraData(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2301,7 +2346,7 @@ func (ec *executionContext) _Block_gasLimit(ctx context.Context, field graphql.C return ec.marshalNLong2uint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_gasLimit(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_gasLimit(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2345,7 +2390,7 @@ func (ec *executionContext) _Block_gasUsed(ctx context.Context, field graphql.Co return ec.marshalNLong2uint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_gasUsed(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_gasUsed(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2386,7 +2431,7 @@ func (ec *executionContext) _Block_baseFeePerGas(ctx context.Context, field grap return ec.marshalOBigInt2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_baseFeePerGas(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_baseFeePerGas(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2427,7 +2472,7 @@ func (ec *executionContext) _Block_nextBaseFeePerGas(ctx context.Context, field return ec.marshalOBigInt2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_nextBaseFeePerGas(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_nextBaseFeePerGas(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2471,7 +2516,7 @@ func (ec *executionContext) _Block_timestamp(ctx context.Context, field graphql. return ec.marshalNBigInt2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_timestamp(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_timestamp(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2515,7 +2560,7 @@ func (ec *executionContext) _Block_logsBloom(ctx context.Context, field graphql. return ec.marshalNBytes2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_logsBloom(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_logsBloom(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2559,7 +2604,7 @@ func (ec *executionContext) _Block_mixHash(ctx context.Context, field graphql.Co return ec.marshalNBytes322string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_mixHash(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_mixHash(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2603,7 +2648,7 @@ func (ec *executionContext) _Block_difficulty(ctx context.Context, field graphql return ec.marshalNBigInt2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_difficulty(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_difficulty(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2647,7 +2692,7 @@ func (ec *executionContext) _Block_totalDifficulty(ctx context.Context, field gr return ec.marshalNBigInt2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_totalDifficulty(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_totalDifficulty(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2688,7 +2733,7 @@ func (ec *executionContext) _Block_ommerCount(ctx context.Context, field graphql return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_ommerCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_ommerCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2729,7 +2774,7 @@ func (ec *executionContext) _Block_ommers(ctx context.Context, field graphql.Col return ec.marshalOBlock2ᚕᚖgithubᚗcomᚋledgerwatchᚋerigonᚋcmdᚋrpcdaemonᚋgraphqlᚋgraphᚋmodelᚐBlock(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_ommers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_ommers(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2799,6 +2844,8 @@ func (ec *executionContext) fieldContext_Block_ommers(ctx context.Context, field return ec.fieldContext_Block_rawHeader(ctx, field) case "raw": return ec.fieldContext_Block_raw(ctx, field) + case "withdrawals": + return ec.fieldContext_Block_withdrawals(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Block", field.Name) }, @@ -2904,6 +2951,8 @@ func (ec *executionContext) fieldContext_Block_ommerAt(ctx context.Context, fiel return ec.fieldContext_Block_rawHeader(ctx, field) case "raw": return ec.fieldContext_Block_raw(ctx, field) + case "withdrawals": + return ec.fieldContext_Block_withdrawals(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Block", field.Name) }, @@ -2953,7 +3002,7 @@ func (ec *executionContext) _Block_ommerHash(ctx context.Context, field graphql. return ec.marshalNBytes322string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_ommerHash(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_ommerHash(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -2994,7 +3043,7 @@ func (ec *executionContext) _Block_transactions(ctx context.Context, field graph return ec.marshalOTransaction2ᚕᚖgithubᚗcomᚋledgerwatchᚋerigonᚋcmdᚋrpcdaemonᚋgraphqlᚋgraphᚋmodelᚐTransactionᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_transactions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_transactions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -3447,7 +3496,7 @@ func (ec *executionContext) _Block_rawHeader(ctx context.Context, field graphql. return ec.marshalNBytes2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_rawHeader(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_rawHeader(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -3491,7 +3540,7 @@ func (ec *executionContext) _Block_raw(ctx context.Context, field graphql.Collec return ec.marshalNBytes2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Block_raw(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Block_raw(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Block", Field: field, @@ -3504,6 +3553,57 @@ func (ec *executionContext) fieldContext_Block_raw(ctx context.Context, field gr return fc, nil } +func (ec *executionContext) _Block_withdrawals(ctx context.Context, field graphql.CollectedField, obj *model.Block) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Block_withdrawals(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.Withdrawals, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*model.Withdrawal) + fc.Result = res + return ec.marshalOWithdrawal2ᚕᚖgithubᚗcomᚋledgerwatchᚋerigonᚋcmdᚋrpcdaemonᚋgraphqlᚋgraphᚋmodelᚐWithdrawalᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Block_withdrawals(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Block", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "index": + return ec.fieldContext_Withdrawal_index(ctx, field) + case "validator": + return ec.fieldContext_Withdrawal_validator(ctx, field) + case "address": + return ec.fieldContext_Withdrawal_address(ctx, field) + case "amount": + return ec.fieldContext_Withdrawal_amount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Withdrawal", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _CallResult_data(ctx context.Context, field graphql.CollectedField, obj *model.CallResult) (ret graphql.Marshaler) { fc, err := ec.fieldContext_CallResult_data(ctx, field) if err != nil { @@ -3535,7 +3635,7 @@ func (ec *executionContext) _CallResult_data(ctx context.Context, field graphql. return ec.marshalNBytes2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_CallResult_data(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_CallResult_data(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "CallResult", Field: field, @@ -3579,7 +3679,7 @@ func (ec *executionContext) _CallResult_gasUsed(ctx context.Context, field graph return ec.marshalNLong2uint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_CallResult_gasUsed(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_CallResult_gasUsed(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "CallResult", Field: field, @@ -3623,7 +3723,7 @@ func (ec *executionContext) _CallResult_status(ctx context.Context, field graphq return ec.marshalNLong2uint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_CallResult_status(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_CallResult_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "CallResult", Field: field, @@ -3667,7 +3767,7 @@ func (ec *executionContext) _Log_index(ctx context.Context, field graphql.Collec return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Log_index(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Log_index(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Log", Field: field, @@ -3778,7 +3878,7 @@ func (ec *executionContext) _Log_topics(ctx context.Context, field graphql.Colle return ec.marshalNBytes322ᚕstringᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Log_topics(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Log_topics(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Log", Field: field, @@ -3822,7 +3922,7 @@ func (ec *executionContext) _Log_data(ctx context.Context, field graphql.Collect return ec.marshalNBytes2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Log_data(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Log_data(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Log", Field: field, @@ -3866,7 +3966,7 @@ func (ec *executionContext) _Log_transaction(ctx context.Context, field graphql. return ec.marshalNTransaction2ᚖgithubᚗcomᚋledgerwatchᚋerigonᚋcmdᚋrpcdaemonᚋgraphqlᚋgraphᚋmodelᚐTransaction(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Log_transaction(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Log_transaction(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Log", Field: field, @@ -4019,7 +4119,7 @@ func (ec *executionContext) _Pending_transactionCount(ctx context.Context, field return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Pending_transactionCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Pending_transactionCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Pending", Field: field, @@ -4060,7 +4160,7 @@ func (ec *executionContext) _Pending_transactions(ctx context.Context, field gra return ec.marshalOTransaction2ᚕᚖgithubᚗcomᚋledgerwatchᚋerigonᚋcmdᚋrpcdaemonᚋgraphqlᚋgraphᚋmodelᚐTransactionᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Pending_transactions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Pending_transactions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Pending", Field: field, @@ -4407,6 +4507,8 @@ func (ec *executionContext) fieldContext_Query_block(ctx context.Context, field return ec.fieldContext_Block_rawHeader(ctx, field) case "raw": return ec.fieldContext_Block_raw(ctx, field) + case "withdrawals": + return ec.fieldContext_Block_withdrawals(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Block", field.Name) }, @@ -4526,6 +4628,8 @@ func (ec *executionContext) fieldContext_Query_blocks(ctx context.Context, field return ec.fieldContext_Block_rawHeader(ctx, field) case "raw": return ec.fieldContext_Block_raw(ctx, field) + case "withdrawals": + return ec.fieldContext_Block_withdrawals(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Block", field.Name) }, @@ -4575,7 +4679,7 @@ func (ec *executionContext) _Query_pending(ctx context.Context, field graphql.Co return ec.marshalNPending2ᚖgithubᚗcomᚋledgerwatchᚋerigonᚋcmdᚋrpcdaemonᚋgraphqlᚋgraphᚋmodelᚐPending(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_pending(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_pending(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -4804,7 +4908,7 @@ func (ec *executionContext) _Query_gasPrice(ctx context.Context, field graphql.C return ec.marshalNBigInt2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_gasPrice(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_gasPrice(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -4848,7 +4952,7 @@ func (ec *executionContext) _Query_maxPriorityFeePerGas(ctx context.Context, fie return ec.marshalNBigInt2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_maxPriorityFeePerGas(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_maxPriorityFeePerGas(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -4889,7 +4993,7 @@ func (ec *executionContext) _Query_syncing(ctx context.Context, field graphql.Co return ec.marshalOSyncState2ᚖgithubᚗcomᚋledgerwatchᚋerigonᚋcmdᚋrpcdaemonᚋgraphqlᚋgraphᚋmodelᚐSyncState(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_syncing(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_syncing(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -4941,7 +5045,7 @@ func (ec *executionContext) _Query_chainID(ctx context.Context, field graphql.Co return ec.marshalNBigInt2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Query_chainID(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Query_chainID(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -5056,7 +5160,7 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(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_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Query", Field: field, @@ -5114,7 +5218,7 @@ func (ec *executionContext) _SyncState_startingBlock(ctx context.Context, field return ec.marshalNLong2uint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SyncState_startingBlock(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SyncState_startingBlock(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SyncState", Field: field, @@ -5158,7 +5262,7 @@ func (ec *executionContext) _SyncState_currentBlock(ctx context.Context, field g return ec.marshalNLong2uint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SyncState_currentBlock(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SyncState_currentBlock(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SyncState", Field: field, @@ -5202,7 +5306,7 @@ func (ec *executionContext) _SyncState_highestBlock(ctx context.Context, field g return ec.marshalNLong2uint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SyncState_highestBlock(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SyncState_highestBlock(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SyncState", Field: field, @@ -5246,7 +5350,7 @@ func (ec *executionContext) _Transaction_hash(ctx context.Context, field graphql return ec.marshalNBytes322string(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_Transaction_hash(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -5290,7 +5394,7 @@ func (ec *executionContext) _Transaction_nonce(ctx context.Context, field graphq return ec.marshalNBigInt2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_nonce(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_nonce(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -5331,7 +5435,7 @@ func (ec *executionContext) _Transaction_index(ctx context.Context, field graphq return ec.marshalOInt2ᚖint(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_Transaction_index(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -5506,7 +5610,7 @@ func (ec *executionContext) _Transaction_value(ctx context.Context, field graphq return ec.marshalNBigInt2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_value(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_value(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -5550,7 +5654,7 @@ func (ec *executionContext) _Transaction_gasPrice(ctx context.Context, field gra return ec.marshalNBigInt2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_gasPrice(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_gasPrice(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -5591,7 +5695,7 @@ func (ec *executionContext) _Transaction_maxFeePerGas(ctx context.Context, field return ec.marshalOBigInt2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_maxFeePerGas(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_maxFeePerGas(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -5632,7 +5736,7 @@ func (ec *executionContext) _Transaction_maxPriorityFeePerGas(ctx context.Contex return ec.marshalOBigInt2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_maxPriorityFeePerGas(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_maxPriorityFeePerGas(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -5673,7 +5777,7 @@ func (ec *executionContext) _Transaction_effectiveTip(ctx context.Context, field return ec.marshalOBigInt2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_effectiveTip(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_effectiveTip(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -5717,7 +5821,7 @@ func (ec *executionContext) _Transaction_gas(ctx context.Context, field graphql. return ec.marshalNLong2uint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_gas(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_gas(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -5761,7 +5865,7 @@ func (ec *executionContext) _Transaction_inputData(ctx context.Context, field gr return ec.marshalNBytes2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_inputData(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_inputData(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -5802,7 +5906,7 @@ func (ec *executionContext) _Transaction_block(ctx context.Context, field graphq return ec.marshalOBlock2ᚖgithubᚗcomᚋledgerwatchᚋerigonᚋcmdᚋrpcdaemonᚋgraphqlᚋgraphᚋmodelᚐBlock(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_block(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_block(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -5872,6 +5976,8 @@ func (ec *executionContext) fieldContext_Transaction_block(ctx context.Context, return ec.fieldContext_Block_rawHeader(ctx, field) case "raw": return ec.fieldContext_Block_raw(ctx, field) + case "withdrawals": + return ec.fieldContext_Block_withdrawals(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type Block", field.Name) }, @@ -5907,7 +6013,7 @@ func (ec *executionContext) _Transaction_status(ctx context.Context, field graph return ec.marshalOLong2ᚖuint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_status(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -5948,7 +6054,7 @@ func (ec *executionContext) _Transaction_gasUsed(ctx context.Context, field grap return ec.marshalOLong2ᚖuint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_gasUsed(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_gasUsed(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -5989,7 +6095,7 @@ func (ec *executionContext) _Transaction_cumulativeGasUsed(ctx context.Context, return ec.marshalOLong2ᚖuint64(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_cumulativeGasUsed(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_cumulativeGasUsed(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -6030,7 +6136,7 @@ func (ec *executionContext) _Transaction_effectiveGasPrice(ctx context.Context, return ec.marshalOBigInt2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_effectiveGasPrice(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_effectiveGasPrice(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -6135,7 +6241,7 @@ func (ec *executionContext) _Transaction_logs(ctx context.Context, field graphql return ec.marshalOLog2ᚕᚖgithubᚗcomᚋledgerwatchᚋerigonᚋcmdᚋrpcdaemonᚋgraphqlᚋgraphᚋmodelᚐLogᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_logs(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_logs(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -6191,7 +6297,7 @@ func (ec *executionContext) _Transaction_r(ctx context.Context, field graphql.Co return ec.marshalNBigInt2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_r(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_r(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -6235,7 +6341,7 @@ func (ec *executionContext) _Transaction_s(ctx context.Context, field graphql.Co return ec.marshalNBigInt2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_s(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_s(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -6279,7 +6385,7 @@ func (ec *executionContext) _Transaction_v(ctx context.Context, field graphql.Co return ec.marshalNBigInt2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_v(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_v(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -6320,7 +6426,7 @@ func (ec *executionContext) _Transaction_type(ctx context.Context, field graphql return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -6361,7 +6467,7 @@ func (ec *executionContext) _Transaction_accessList(ctx context.Context, field g return ec.marshalOAccessTuple2ᚕᚖgithubᚗcomᚋledgerwatchᚋerigonᚋcmdᚋrpcdaemonᚋgraphqlᚋgraphᚋmodelᚐAccessTupleᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_accessList(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_accessList(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -6411,7 +6517,7 @@ func (ec *executionContext) _Transaction_raw(ctx context.Context, field graphql. return ec.marshalNBytes2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_raw(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_raw(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -6455,7 +6561,7 @@ func (ec *executionContext) _Transaction_rawReceipt(ctx context.Context, field g return ec.marshalNBytes2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Transaction_rawReceipt(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Transaction_rawReceipt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Transaction", Field: field, @@ -6468,6 +6574,182 @@ func (ec *executionContext) fieldContext_Transaction_rawReceipt(ctx context.Cont return fc, nil } +func (ec *executionContext) _Withdrawal_index(ctx context.Context, field graphql.CollectedField, obj *model.Withdrawal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Withdrawal_index(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.Index, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Withdrawal_index(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Withdrawal", + Field: field, + 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 fc, nil +} + +func (ec *executionContext) _Withdrawal_validator(ctx context.Context, field graphql.CollectedField, obj *model.Withdrawal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Withdrawal_validator(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.Validator, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Withdrawal_validator(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Withdrawal", + Field: field, + 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 fc, nil +} + +func (ec *executionContext) _Withdrawal_address(ctx context.Context, field graphql.CollectedField, obj *model.Withdrawal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Withdrawal_address(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.Address, 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.marshalNAddress2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Withdrawal_address(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Withdrawal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Address does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Withdrawal_amount(ctx context.Context, field graphql.CollectedField, obj *model.Withdrawal) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Withdrawal_amount(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.Amount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNBigInt2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Withdrawal_amount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Withdrawal", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type BigInt does not have child fields") + }, + } + 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) if err != nil { @@ -6499,7 +6781,7 @@ 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___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, @@ -6540,7 +6822,7 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field 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___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, @@ -6584,7 +6866,7 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return ec.marshalN__DirectiveLocation2ᚕstringᚄ(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___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, @@ -6628,7 +6910,7 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(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___Directive_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, @@ -6682,7 +6964,7 @@ func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field return ec.marshalNBoolean2bool(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___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Directive", Field: field, @@ -6726,7 +7008,7 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return ec.marshalNString2string(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___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, @@ -6767,7 +7049,7 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field 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) { +func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, @@ -6811,7 +7093,7 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return ec.marshalNBoolean2bool(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___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, @@ -6852,7 +7134,7 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return ec.marshalOString2ᚖstring(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___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__EnumValue", Field: field, @@ -6896,7 +7178,7 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return ec.marshalNString2string(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___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -6937,7 +7219,7 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap 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___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -6981,7 +7263,7 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col 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___Field_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -7035,7 +7317,7 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(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___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -7101,7 +7383,7 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return ec.marshalNBoolean2bool(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___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -7142,7 +7424,7 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel 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) { +func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Field", Field: field, @@ -7186,7 +7468,7 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return ec.marshalNString2string(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___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, @@ -7227,7 +7509,7 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field 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) { +func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, @@ -7271,7 +7553,7 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq 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) { +func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, @@ -7334,7 +7616,7 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel 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) { +func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__InputValue", Field: field, @@ -7375,7 +7657,7 @@ func (ec *executionContext) ___Schema_description(ctx context.Context, field gra 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) { +func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -7419,7 +7701,7 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C 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) { +func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -7485,7 +7767,7 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph 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) { +func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -7548,7 +7830,7 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr 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) { +func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -7611,7 +7893,7 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel 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) { +func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -7677,7 +7959,7 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap 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) { +func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Schema", Field: field, @@ -7733,7 +8015,7 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll 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) { +func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -7774,7 +8056,7 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll 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) { +func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -7815,7 +8097,7 @@ 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___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -7922,7 +8204,7 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq 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) { +func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -7985,7 +8267,7 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra 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) { +func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -8110,7 +8392,7 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph 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) { +func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -8161,7 +8443,7 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co 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) { +func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -8224,7 +8506,7 @@ func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field gr return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "__Type", Field: field, @@ -8256,8 +8538,6 @@ func (ec *executionContext) unmarshalInputBlockFilterCriteria(ctx context.Contex } switch k { case "addresses": - var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("addresses")) data, err := ec.unmarshalOAddress2ᚕstringᚄ(ctx, v) if err != nil { @@ -8265,8 +8545,6 @@ func (ec *executionContext) unmarshalInputBlockFilterCriteria(ctx context.Contex } it.Addresses = data case "topics": - var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("topics")) data, err := ec.unmarshalOBytes322ᚕᚕstringᚄ(ctx, v) if err != nil { @@ -8294,8 +8572,6 @@ func (ec *executionContext) unmarshalInputCallData(ctx context.Context, obj inte } switch k { case "from": - var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("from")) data, err := ec.unmarshalOAddress2ᚖstring(ctx, v) if err != nil { @@ -8303,8 +8579,6 @@ func (ec *executionContext) unmarshalInputCallData(ctx context.Context, obj inte } it.From = data case "to": - var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("to")) data, err := ec.unmarshalOAddress2ᚖstring(ctx, v) if err != nil { @@ -8312,8 +8586,6 @@ func (ec *executionContext) unmarshalInputCallData(ctx context.Context, obj inte } it.To = data case "gas": - var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gas")) data, err := ec.unmarshalOLong2ᚖuint64(ctx, v) if err != nil { @@ -8321,8 +8593,6 @@ func (ec *executionContext) unmarshalInputCallData(ctx context.Context, obj inte } it.Gas = data case "gasPrice": - var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("gasPrice")) data, err := ec.unmarshalOBigInt2ᚖstring(ctx, v) if err != nil { @@ -8330,8 +8600,6 @@ func (ec *executionContext) unmarshalInputCallData(ctx context.Context, obj inte } it.GasPrice = data case "maxFeePerGas": - var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxFeePerGas")) data, err := ec.unmarshalOBigInt2ᚖstring(ctx, v) if err != nil { @@ -8339,8 +8607,6 @@ func (ec *executionContext) unmarshalInputCallData(ctx context.Context, obj inte } it.MaxFeePerGas = data case "maxPriorityFeePerGas": - var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxPriorityFeePerGas")) data, err := ec.unmarshalOBigInt2ᚖstring(ctx, v) if err != nil { @@ -8348,8 +8614,6 @@ func (ec *executionContext) unmarshalInputCallData(ctx context.Context, obj inte } it.MaxPriorityFeePerGas = data case "value": - var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("value")) data, err := ec.unmarshalOBigInt2ᚖstring(ctx, v) if err != nil { @@ -8357,8 +8621,6 @@ func (ec *executionContext) unmarshalInputCallData(ctx context.Context, obj inte } it.Value = data case "data": - var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("data")) data, err := ec.unmarshalOBytes2ᚖstring(ctx, v) if err != nil { @@ -8386,8 +8648,6 @@ func (ec *executionContext) unmarshalInputFilterCriteria(ctx context.Context, ob } switch k { case "fromBlock": - var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fromBlock")) data, err := ec.unmarshalOLong2ᚖuint64(ctx, v) if err != nil { @@ -8395,8 +8655,6 @@ func (ec *executionContext) unmarshalInputFilterCriteria(ctx context.Context, ob } it.FromBlock = data case "toBlock": - var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("toBlock")) data, err := ec.unmarshalOLong2ᚖuint64(ctx, v) if err != nil { @@ -8404,8 +8662,6 @@ func (ec *executionContext) unmarshalInputFilterCriteria(ctx context.Context, ob } it.ToBlock = data case "addresses": - var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("addresses")) data, err := ec.unmarshalOAddress2ᚕstringᚄ(ctx, v) if err != nil { @@ -8413,8 +8669,6 @@ func (ec *executionContext) unmarshalInputFilterCriteria(ctx context.Context, ob } it.Addresses = data case "topics": - var err error - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("topics")) data, err := ec.unmarshalOBytes322ᚕᚕstringᚄ(ctx, v) if err != nil { @@ -8674,6 +8928,8 @@ func (ec *executionContext) _Block(ctx context.Context, sel ast.SelectionSet, ob if out.Values[i] == graphql.Null { out.Invalids++ } + case "withdrawals": + out.Values[i] = ec._Block_withdrawals(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -8929,7 +9185,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr case "block": field := field - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -8992,7 +9248,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr case "transaction": field := field - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -9077,7 +9333,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr case "syncing": field := field - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { defer func() { if r := recover(); r != nil { ec.Error(ctx, ec.Recover(ctx, r)) @@ -9317,6 +9573,60 @@ func (ec *executionContext) _Transaction(ctx context.Context, sel ast.SelectionS return out } +var withdrawalImplementors = []string{"Withdrawal"} + +func (ec *executionContext) _Withdrawal(ctx context.Context, sel ast.SelectionSet, obj *model.Withdrawal) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, withdrawalImplementors) + + 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("Withdrawal") + case "index": + out.Values[i] = ec._Withdrawal_index(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "validator": + out.Values[i] = ec._Withdrawal_validator(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "address": + out.Values[i] = ec._Withdrawal_address(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "amount": + out.Values[i] = ec._Withdrawal_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 __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { @@ -9962,6 +10272,16 @@ func (ec *executionContext) marshalNTransaction2ᚖgithubᚗcomᚋledgerwatchᚋ return ec._Transaction(ctx, sel, v) } +func (ec *executionContext) marshalNWithdrawal2ᚖgithubᚗcomᚋledgerwatchᚋerigonᚋcmdᚋrpcdaemonᚋgraphqlᚋgraphᚋmodelᚐWithdrawal(ctx context.Context, sel ast.SelectionSet, v *model.Withdrawal) 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._Withdrawal(ctx, sel, v) +} + 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) } @@ -10662,6 +10982,53 @@ func (ec *executionContext) marshalOTransaction2ᚖgithubᚗcomᚋledgerwatchᚋ return ec._Transaction(ctx, sel, v) } +func (ec *executionContext) marshalOWithdrawal2ᚕᚖgithubᚗcomᚋledgerwatchᚋerigonᚋcmdᚋrpcdaemonᚋgraphqlᚋgraphᚋmodelᚐWithdrawalᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Withdrawal) 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.marshalNWithdrawal2ᚖgithubᚗcomᚋledgerwatchᚋerigonᚋcmdᚋrpcdaemonᚋgraphqlᚋgraphᚋmodelᚐWithdrawal(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) 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/cmd/rpcdaemon/graphql/graph/model/models_gen.go b/cmd/rpcdaemon/graphql/graph/model/models_gen.go index 67bfe18e0de..043212b5fbe 100644 --- a/cmd/rpcdaemon/graphql/graph/model/models_gen.go +++ b/cmd/rpcdaemon/graphql/graph/model/models_gen.go @@ -47,6 +47,7 @@ type Block struct { EstimateGas uint64 `json:"estimateGas"` RawHeader string `json:"rawHeader"` Raw string `json:"raw"` + Withdrawals []*Withdrawal `json:"withdrawals,omitempty"` } type BlockFilterCriteria struct { @@ -86,6 +87,9 @@ type Log struct { Transaction *Transaction `json:"transaction"` } +type Mutation struct { +} + type Pending struct { TransactionCount int `json:"transactionCount"` Transactions []*Transaction `json:"transactions,omitempty"` @@ -94,6 +98,9 @@ type Pending struct { EstimateGas uint64 `json:"estimateGas"` } +type Query struct { +} + type SyncState struct { StartingBlock uint64 `json:"startingBlock"` CurrentBlock uint64 `json:"currentBlock"` @@ -128,3 +135,10 @@ type Transaction struct { Raw string `json:"raw"` RawReceipt string `json:"rawReceipt"` } + +type Withdrawal struct { + Index int `json:"index"` + Validator int `json:"validator"` + Address string `json:"address"` + Amount string `json:"amount"` +} diff --git a/cmd/rpcdaemon/graphql/graph/schema.graphqls b/cmd/rpcdaemon/graphql/graph/schema.graphqls index 9eb15ea6ab5..64925dfdc2d 100644 --- a/cmd/rpcdaemon/graphql/graph/schema.graphqls +++ b/cmd/rpcdaemon/graphql/graph/schema.graphqls @@ -1,343 +1,356 @@ - # Bytes32 is a 32 byte binary string, represented as 0x-prefixed hexadecimal. - scalar Bytes32 - # Address is a 20 byte Ethereum address, represented as 0x-prefixed hexadecimal. - scalar Address - # Bytes is an arbitrary length binary string, represented as 0x-prefixed hexadecimal. - # An empty byte string is represented as '0x'. Byte strings must have an even number of hexadecimal nybbles. - scalar Bytes - # BigInt is a large integer. Input is accepted as either a JSON number or as a string. - # Strings may be either decimal or 0x-prefixed hexadecimal. Output values are all - # 0x-prefixed hexadecimal. - scalar BigInt - # Long is a 64 bit unsigned integer. - scalar Long - # Either a string or an unsigned int - scalar BlockNum - - schema { - query: Query - mutation: Mutation - } +# Bytes32 is a 32 byte binary string, represented as 0x-prefixed hexadecimal. +scalar Bytes32 +# Address is a 20 byte Ethereum address, represented as 0x-prefixed hexadecimal. +scalar Address +# Bytes is an arbitrary length binary string, represented as 0x-prefixed hexadecimal. +# An empty byte string is represented as '0x'. Byte strings must have an even number of hexadecimal nybbles. +scalar Bytes +# BigInt is a large integer. Input is accepted as either a JSON number or as a string. +# Strings may be either decimal or 0x-prefixed hexadecimal. Output values are all +# 0x-prefixed hexadecimal. +scalar BigInt +# Long is a 64 bit unsigned integer. +scalar Long +# Either a string or an unsigned int +scalar BlockNum - # Account is an Ethereum account at a particular block. - type Account { - # Address is the address owning the account. - address: Address! - # Balance is the balance of the account, in wei. - balance: BigInt! - # TransactionCount is the number of transactions sent from this account, - # or in the case of a contract, the number of contracts created. Otherwise - # known as the nonce. - transactionCount: Long! - # Code contains the smart contract code for this account, if the account - # is a (non-self-destructed) contract. - code: Bytes! - # Storage provides access to the storage of a contract account, indexed - # by its 32 byte slot identifier. - storage(slot: Bytes32!): Bytes32! - } +schema { + query: Query + mutation: Mutation +} - # Log is an Ethereum event log. - type Log { - # Index is the index of this log in the block. - index: Int! - # Account is the account which generated this log - this will always - # be a contract account. - account(block: Long): Account! - # Topics is a list of 0-4 indexed topics for the log. - topics: [Bytes32!]! - # Data is unindexed data for this log. - data: Bytes! - # Transaction is the transaction that generated this log entry. - transaction: Transaction! - } +# Account is an Ethereum account at a particular block. +type Account { + # Address is the address owning the account. + address: Address! + # Balance is the balance of the account, in wei. + balance: BigInt! + # TransactionCount is the number of transactions sent from this account, + # or in the case of a contract, the number of contracts created. Otherwise + # known as the nonce. + transactionCount: Long! + # Code contains the smart contract code for this account, if the account + # is a (non-self-destructed) contract. + code: Bytes! + # Storage provides access to the storage of a contract account, indexed + # by its 32 byte slot identifier. + storage(slot: Bytes32!): Bytes32! +} - #EIP-2718 - type AccessTuple{ - address: Address! - storageKeys : [Bytes32!]! - } +# Log is an Ethereum event log. +type Log { + # Index is the index of this log in the block. + index: Int! + # Account is the account which generated this log - this will always + # be a contract account. + account(block: Long): Account! + # Topics is a list of 0-4 indexed topics for the log. + topics: [Bytes32!]! + # Data is unindexed data for this log. + data: Bytes! + # Transaction is the transaction that generated this log entry. + transaction: Transaction! +} - # Transaction is an Ethereum transaction. - type Transaction { - # Hash is the hash of this transaction. - hash: Bytes32! - # Nonce is the nonce of the account this transaction was generated with. - nonce: BigInt! - # Index is the index of this transaction in the parent block. This will - # be null if the transaction has not yet been mined. - index: Int - # From is the account that sent this transaction - this will always be - # an externally owned account. - from(block: Long): Account! - # To is the account the transaction was sent to. This is null for - # contract-creating transactions. - to(block: Long): Account - # Value is the value, in wei, sent along with this transaction. - value: BigInt! - # GasPrice is the price offered to miners for gas, in wei per unit. - gasPrice: BigInt! - # MaxFeePerGas is the maximum fee per gas offered to include a transaction, in wei. - maxFeePerGas: BigInt - # MaxPriorityFeePerGas is the maximum miner tip per gas offered to include a transaction, in wei. - maxPriorityFeePerGas: BigInt - # EffectiveTip is the actual amount of reward going to miner after considering the max fee cap. - effectiveTip: BigInt - # Gas is the maximum amount of gas this transaction can consume. - gas: Long! - # InputData is the data supplied to the target of the transaction. - inputData: Bytes! - # Block is the block this transaction was mined in. This will be null if - # the transaction has not yet been mined. - block: Block +#EIP-2718 +type AccessTuple { + address: Address! + storageKeys: [Bytes32!]! +} - # Status is the return status of the transaction. This will be 1 if the - # transaction succeeded, or 0 if it failed (due to a revert, or due to - # running out of gas). If the transaction has not yet been mined, this - # field will be null. - status: Long - # GasUsed is the amount of gas that was used processing this transaction. - # If the transaction has not yet been mined, this field will be null. - gasUsed: Long - # CumulativeGasUsed is the total gas used in the block up to and including - # this transaction. If the transaction has not yet been mined, this field - # will be null. - cumulativeGasUsed: Long - # EffectiveGasPrice is actual value per gas deducted from the sender's - # account. Before EIP-1559, this is equal to the transaction's gas price. - # After EIP-1559, it is baseFeePerGas + min(maxFeePerGas - baseFeePerGas, - # maxPriorityFeePerGas). Legacy transactions and EIP-2930 transactions are - # coerced into the EIP-1559 format by setting both maxFeePerGas and - # maxPriorityFeePerGas as the transaction's gas price. - effectiveGasPrice: BigInt - # CreatedContract is the account that was created by a contract creation - # transaction. If the transaction was not a contract creation transaction, - # or it has not yet been mined, this field will be null. - createdContract(block: Long): Account - # Logs is a list of log entries emitted by this transaction. If the - # transaction has not yet been mined, this field will be null. - logs: [Log!] - r: BigInt! - s: BigInt! - v: BigInt! - # Envelope transaction support - type: Int - accessList: [AccessTuple!] - # Raw is the canonical encoding of the transaction. - # For legacy transactions, it returns the RLP encoding. - # For EIP-2718 typed transactions, it returns the type and payload. - raw: Bytes! - # RawReceipt is the canonical encoding of the receipt. For post EIP-2718 typed transactions - # this is equivalent to TxType || ReceiptEncoding. - rawReceipt: Bytes! - } +# Transaction is an Ethereum transaction. +type Transaction { + # Hash is the hash of this transaction. + hash: Bytes32! + # Nonce is the nonce of the account this transaction was generated with. + nonce: BigInt! + # Index is the index of this transaction in the parent block. This will + # be null if the transaction has not yet been mined. + index: Int + # From is the account that sent this transaction - this will always be + # an externally owned account. + from(block: Long): Account! + # To is the account the transaction was sent to. This is null for + # contract-creating transactions. + to(block: Long): Account + # Value is the value, in wei, sent along with this transaction. + value: BigInt! + # GasPrice is the price offered to miners for gas, in wei per unit. + gasPrice: BigInt! + # MaxFeePerGas is the maximum fee per gas offered to include a transaction, in wei. + maxFeePerGas: BigInt + # MaxPriorityFeePerGas is the maximum miner tip per gas offered to include a transaction, in wei. + maxPriorityFeePerGas: BigInt + # EffectiveTip is the actual amount of reward going to miner after considering the max fee cap. + effectiveTip: BigInt + # Gas is the maximum amount of gas this transaction can consume. + gas: Long! + # InputData is the data supplied to the target of the transaction. + inputData: Bytes! + # Block is the block this transaction was mined in. This will be null if + # the transaction has not yet been mined. + block: Block - # BlockFilterCriteria encapsulates log filter criteria for a filter applied - # to a single block. - input BlockFilterCriteria { - # Addresses is list of addresses that are of interest. If this list is - # empty, results will not be filtered by address. - addresses: [Address!] - # Topics list restricts matches to particular event topics. Each event has a list - # of topics. Topics matches a prefix of that list. An empty element array matches any - # topic. Non-empty elements represent an alternative that matches any of the - # contained topics. - # - # Examples: - # - [] or nil matches any topic list - # - [[A]] matches topic A in first position - # - [[], [B]] matches any topic in first position, B in second position - # - [[A], [B]] matches topic A in first position, B in second position - # - [[A, B]], [C, D]] matches topic (A OR B) in first position, (C OR D) in second position - topics: [[Bytes32!]!] - } + # Status is the return status of the transaction. This will be 1 if the + # transaction succeeded, or 0 if it failed (due to a revert, or due to + # running out of gas). If the transaction has not yet been mined, this + # field will be null. + status: Long + # GasUsed is the amount of gas that was used processing this transaction. + # If the transaction has not yet been mined, this field will be null. + gasUsed: Long + # CumulativeGasUsed is the total gas used in the block up to and including + # this transaction. If the transaction has not yet been mined, this field + # will be null. + cumulativeGasUsed: Long + # EffectiveGasPrice is actual value per gas deducted from the sender's + # account. Before EIP-1559, this is equal to the transaction's gas price. + # After EIP-1559, it is baseFeePerGas + min(maxFeePerGas - baseFeePerGas, + # maxPriorityFeePerGas). Legacy transactions and EIP-2930 transactions are + # coerced into the EIP-1559 format by setting both maxFeePerGas and + # maxPriorityFeePerGas as the transaction's gas price. + effectiveGasPrice: BigInt + # CreatedContract is the account that was created by a contract creation + # transaction. If the transaction was not a contract creation transaction, + # or it has not yet been mined, this field will be null. + createdContract(block: Long): Account + # Logs is a list of log entries emitted by this transaction. If the + # transaction has not yet been mined, this field will be null. + logs: [Log!] + r: BigInt! + s: BigInt! + v: BigInt! + # Envelope transaction support + type: Int + accessList: [AccessTuple!] + # Raw is the canonical encoding of the transaction. + # For legacy transactions, it returns the RLP encoding. + # For EIP-2718 typed transactions, it returns the type and payload. + raw: Bytes! + # RawReceipt is the canonical encoding of the receipt. For post EIP-2718 typed transactions + # this is equivalent to TxType || ReceiptEncoding. + rawReceipt: Bytes! +} - # Block is an Ethereum block. - type Block { - # Number is the number of this block, starting at 0 for the genesis block. - number: Long! - # Hash is the block hash of this block. - hash: Bytes32! - # Parent is the parent block of this block. - parent: Block - # Nonce is the block nonce, an 8 byte sequence determined by the miner. - nonce: BigInt! - # TransactionsRoot is the keccak256 hash of the root of the trie of transactions in this block. - transactionsRoot: Bytes32! - # TransactionCount is the number of transactions in this block. if - # transactions are not available for this block, this field will be null. - transactionCount: Int - # StateRoot is the keccak256 hash of the state trie after this block was processed. - stateRoot: Bytes32! - # ReceiptsRoot is the keccak256 hash of the trie of transaction receipts in this block. - receiptsRoot: Bytes32! - # Miner is the account that mined this block. - miner(block: Long): Account! - # ExtraData is an arbitrary data field supplied by the miner. - extraData: Bytes! - # GasLimit is the maximum amount of gas that was available to transactions in this block. - gasLimit: Long! - # GasUsed is the amount of gas that was used executing transactions in this block. - gasUsed: Long! - # BaseFeePerGas is the fee per unit of gas burned by the protocol in this block. - baseFeePerGas: BigInt - # NextBaseFeePerGas is the fee per unit of gas which needs to be burned in the next block. - nextBaseFeePerGas: BigInt - # Timestamp is the unix timestamp at which this block was mined. - timestamp: BigInt! - # LogsBloom is a bloom filter that can be used to check if a block may - # contain log entries matching a filter. - logsBloom: Bytes! - # MixHash is the hash that was used as an input to the PoW process. - mixHash: Bytes32! - # Difficulty is a measure of the difficulty of mining this block. - difficulty: BigInt! - # TotalDifficulty is the sum of all difficulty values up to and including - # this block. - totalDifficulty: BigInt! - # OmmerCount is the number of ommers (AKA uncles) associated with this - # block. If ommers are unavailable, this field will be null. - ommerCount: Int - # Ommers is a list of ommer (AKA uncle) blocks associated with this block. - # If ommers are unavailable, this field will be null. Depending on your - # node, the transactions, transactionAt, transactionCount, ommers, - # ommerCount and ommerAt fields may not be available on any ommer blocks. - ommers: [Block] - # OmmerAt returns the ommer (AKA uncle) at the specified index. If ommers - # are unavailable, or the index is out of bounds, this field will be null. - ommerAt(index: Int!): Block - # OmmerHash is the keccak256 hash of all the ommers (AKA uncles) - # associated with this block. - ommerHash: Bytes32! - # Transactions is a list of transactions associated with this block. If - # transactions are unavailable for this block, this field will be null. - transactions: [Transaction!] - # TransactionAt returns the transaction at the specified index. If - # transactions are unavailable for this block, or if the index is out of - # bounds, this field will be null. - transactionAt(index: Int!): Transaction - # Logs returns a filtered set of logs from this block. - logs(filter: BlockFilterCriteria!): [Log!]! - # Account fetches an Ethereum account at the current block's state. - account(address: Address!): Account! - # Call executes a local call operation at the current block's state. - call(data: CallData!): CallResult - # EstimateGas estimates the amount of gas that will be required for - # successful execution of a transaction at the current block's state. - estimateGas(data: CallData!): Long! - # RawHeader is the RLP encoding of the block's header. - rawHeader: Bytes! - # Raw is the RLP encoding of the block. - raw: Bytes! - } +# BlockFilterCriteria encapsulates log filter criteria for a filter applied +# to a single block. +input BlockFilterCriteria { + # Addresses is list of addresses that are of interest. If this list is + # empty, results will not be filtered by address. + addresses: [Address!] + # Topics list restricts matches to particular event topics. Each event has a list + # of topics. Topics matches a prefix of that list. An empty element array matches any + # topic. Non-empty elements represent an alternative that matches any of the + # contained topics. + # + # Examples: + # - [] or nil matches any topic list + # - [[A]] matches topic A in first position + # - [[], [B]] matches any topic in first position, B in second position + # - [[A], [B]] matches topic A in first position, B in second position + # - [[A, B]], [C, D]] matches topic (A OR B) in first position, (C OR D) in second position + topics: [[Bytes32!]!] +} - # CallData represents the data associated with a local contract call. - # All fields are optional. - input CallData { - # From is the address making the call. - from: Address - # To is the address the call is sent to. - to: Address - # Gas is the amount of gas sent with the call. - gas: Long - # GasPrice is the price, in wei, offered for each unit of gas. - gasPrice: BigInt - # MaxFeePerGas is the maximum fee per gas offered, in wei. - maxFeePerGas: BigInt - # MaxPriorityFeePerGas is the maximum miner tip per gas offered, in wei. - maxPriorityFeePerGas: BigInt - # Value is the value, in wei, sent along with the call. - value: BigInt - # Data is the data sent to the callee. - data: Bytes - } +# Block is an Ethereum block. +type Block { + # Number is the number of this block, starting at 0 for the genesis block. + number: Long! + # Hash is the block hash of this block. + hash: Bytes32! + # Parent is the parent block of this block. + parent: Block + # Nonce is the block nonce, an 8 byte sequence determined by the miner. + nonce: BigInt! + # TransactionsRoot is the keccak256 hash of the root of the trie of transactions in this block. + transactionsRoot: Bytes32! + # TransactionCount is the number of transactions in this block. if + # transactions are not available for this block, this field will be null. + transactionCount: Int + # StateRoot is the keccak256 hash of the state trie after this block was processed. + stateRoot: Bytes32! + # ReceiptsRoot is the keccak256 hash of the trie of transaction receipts in this block. + receiptsRoot: Bytes32! + # Miner is the account that mined this block. + miner(block: Long): Account! + # ExtraData is an arbitrary data field supplied by the miner. + extraData: Bytes! + # GasLimit is the maximum amount of gas that was available to transactions in this block. + gasLimit: Long! + # GasUsed is the amount of gas that was used executing transactions in this block. + gasUsed: Long! + # BaseFeePerGas is the fee per unit of gas burned by the protocol in this block. + baseFeePerGas: BigInt + # NextBaseFeePerGas is the fee per unit of gas which needs to be burned in the next block. + nextBaseFeePerGas: BigInt + # Timestamp is the unix timestamp at which this block was mined. + timestamp: BigInt! + # LogsBloom is a bloom filter that can be used to check if a block may + # contain log entries matching a filter. + logsBloom: Bytes! + # MixHash is the hash that was used as an input to the PoW process. + mixHash: Bytes32! + # Difficulty is a measure of the difficulty of mining this block. + difficulty: BigInt! + # TotalDifficulty is the sum of all difficulty values up to and including + # this block. + totalDifficulty: BigInt! + # OmmerCount is the number of ommers (AKA uncles) associated with this + # block. If ommers are unavailable, this field will be null. + ommerCount: Int + # Ommers is a list of ommer (AKA uncle) blocks associated with this block. + # If ommers are unavailable, this field will be null. Depending on your + # node, the transactions, transactionAt, transactionCount, ommers, + # ommerCount and ommerAt fields may not be available on any ommer blocks. + ommers: [Block] + # OmmerAt returns the ommer (AKA uncle) at the specified index. If ommers + # are unavailable, or the index is out of bounds, this field will be null. + ommerAt(index: Int!): Block + # OmmerHash is the keccak256 hash of all the ommers (AKA uncles) + # associated with this block. + ommerHash: Bytes32! + # Transactions is a list of transactions associated with this block. If + # transactions are unavailable for this block, this field will be null. + transactions: [Transaction!] + # TransactionAt returns the transaction at the specified index. If + # transactions are unavailable for this block, or if the index is out of + # bounds, this field will be null. + transactionAt(index: Int!): Transaction + # Logs returns a filtered set of logs from this block. + logs(filter: BlockFilterCriteria!): [Log!]! + # Account fetches an Ethereum account at the current block's state. + account(address: Address!): Account! + # Call executes a local call operation at the current block's state. + call(data: CallData!): CallResult + # EstimateGas estimates the amount of gas that will be required for + # successful execution of a transaction at the current block's state. + estimateGas(data: CallData!): Long! + # RawHeader is the RLP encoding of the block's header. + rawHeader: Bytes! + # Raw is the RLP encoding of the block. + raw: Bytes! + # Withdrawals is the withdrawals that occurred within the block. + withdrawals: [Withdrawal!] +} - # CallResult is the result of a local call operation. - type CallResult { - # Data is the return data of the called contract. - data: Bytes! - # GasUsed is the amount of gas used by the call, after any refunds. - gasUsed: Long! - # Status is the result of the call - 1 for success or 0 for failure. - status: Long! - } +# CallData represents the data associated with a local contract call. +# All fields are optional. +input CallData { + # From is the address making the call. + from: Address + # To is the address the call is sent to. + to: Address + # Gas is the amount of gas sent with the call. + gas: Long + # GasPrice is the price, in wei, offered for each unit of gas. + gasPrice: BigInt + # MaxFeePerGas is the maximum fee per gas offered, in wei. + maxFeePerGas: BigInt + # MaxPriorityFeePerGas is the maximum miner tip per gas offered, in wei. + maxPriorityFeePerGas: BigInt + # Value is the value, in wei, sent along with the call. + value: BigInt + # Data is the data sent to the callee. + data: Bytes +} - # FilterCriteria encapsulates log filter criteria for searching log entries. - input FilterCriteria { - # FromBlock is the block at which to start searching, inclusive. Defaults - # to the latest block if not supplied. - fromBlock: Long - # ToBlock is the block at which to stop searching, inclusive. Defaults - # to the latest block if not supplied. - toBlock: Long - # Addresses is a list of addresses that are of interest. If this list is - # empty, results will not be filtered by address. - addresses: [Address!] - # Topics list restricts matches to particular event topics. Each event has a list - # of topics. Topics matches a prefix of that list. An empty element array matches any - # topic. Non-empty elements represent an alternative that matches any of the - # contained topics. - # - # Examples: - # - [] or nil matches any topic list - # - [[A]] matches topic A in first position - # - [[], [B]] matches any topic in first position, B in second position - # - [[A], [B]] matches topic A in first position, B in second position - # - [[A, B]], [C, D]] matches topic (A OR B) in first position, (C OR D) in second position - topics: [[Bytes32!]!] - } +# CallResult is the result of a local call operation. +type CallResult { + # Data is the return data of the called contract. + data: Bytes! + # GasUsed is the amount of gas used by the call, after any refunds. + gasUsed: Long! + # Status is the result of the call - 1 for success or 0 for failure. + status: Long! +} - # SyncState contains the current synchronisation state of the client. - type SyncState{ - # StartingBlock is the block number at which synchronisation started. - startingBlock: Long! - # CurrentBlock is the point at which synchronisation has presently reached. - currentBlock: Long! - # HighestBlock is the latest known block number. - highestBlock: Long! - } +# FilterCriteria encapsulates log filter criteria for searching log entries. +input FilterCriteria { + # FromBlock is the block at which to start searching, inclusive. Defaults + # to the latest block if not supplied. + fromBlock: Long + # ToBlock is the block at which to stop searching, inclusive. Defaults + # to the latest block if not supplied. + toBlock: Long + # Addresses is a list of addresses that are of interest. If this list is + # empty, results will not be filtered by address. + addresses: [Address!] + # Topics list restricts matches to particular event topics. Each event has a list + # of topics. Topics matches a prefix of that list. An empty element array matches any + # topic. Non-empty elements represent an alternative that matches any of the + # contained topics. + # + # Examples: + # - [] or nil matches any topic list + # - [[A]] matches topic A in first position + # - [[], [B]] matches any topic in first position, B in second position + # - [[A], [B]] matches topic A in first position, B in second position + # - [[A, B]], [C, D]] matches topic (A OR B) in first position, (C OR D) in second position + topics: [[Bytes32!]!] +} - # Pending represents the current pending state. - type Pending { - # TransactionCount is the number of transactions in the pending state. - transactionCount: Int! - # Transactions is a list of transactions in the current pending state. - transactions: [Transaction!] - # Account fetches an Ethereum account for the pending state. - account(address: Address!): Account! - # Call executes a local call operation for the pending state. - call(data: CallData!): CallResult - # EstimateGas estimates the amount of gas that will be required for - # successful execution of a transaction for the pending state. - estimateGas(data: CallData!): Long! - } +# SyncState contains the current synchronisation state of the client. +type SyncState { + # StartingBlock is the block number at which synchronisation started. + startingBlock: Long! + # CurrentBlock is the point at which synchronisation has presently reached. + currentBlock: Long! + # HighestBlock is the latest known block number. + highestBlock: Long! +} - type Query { - # Block fetches an Ethereum block by number or by hash. If neither is - # supplied, the most recent known block is returned. - block(number: BlockNum, hash: Bytes32): Block - # Blocks returns all the blocks between two numbers, inclusive. If - # to is not supplied, it defaults to the most recent known block. - blocks(from: Long, to: Long): [Block!]! - # Pending returns the current pending state. - pending: Pending! - # Transaction returns a transaction specified by its hash. - transaction(hash: Bytes32!): Transaction - # Logs returns log entries matching the provided filter. - logs(filter: FilterCriteria!): [Log!]! - # GasPrice returns the node's estimate of a gas price sufficient to - # ensure a transaction is mined in a timely fashion. - gasPrice: BigInt! - # MaxPriorityFeePerGas returns the node's estimate of a gas tip sufficient - # to ensure a transaction is mined in a timely fashion. - maxPriorityFeePerGas: BigInt! - # Syncing returns information on the current synchronisation state. - syncing: SyncState - # ChainID returns the current chain ID for transaction replay protection. - chainID: BigInt! - } +# Pending represents the current pending state. +type Pending { + # TransactionCount is the number of transactions in the pending state. + transactionCount: Int! + # Transactions is a list of transactions in the current pending state. + transactions: [Transaction!] + # Account fetches an Ethereum account for the pending state. + account(address: Address!): Account! + # Call executes a local call operation for the pending state. + call(data: CallData!): CallResult + # EstimateGas estimates the amount of gas that will be required for + # successful execution of a transaction for the pending state. + estimateGas(data: CallData!): Long! +} - type Mutation { - # SendRawTransaction sends an RLP-encoded transaction to the network. - sendRawTransaction(data: Bytes!): Bytes32! - } +type Query { + # Block fetches an Ethereum block by number or by hash. If neither is + # supplied, the most recent known block is returned. + block(number: BlockNum, hash: Bytes32): Block + # Blocks returns all the blocks between two numbers, inclusive. If + # to is not supplied, it defaults to the most recent known block. + blocks(from: Long, to: Long): [Block!]! + # Pending returns the current pending state. + pending: Pending! + # Transaction returns a transaction specified by its hash. + transaction(hash: Bytes32!): Transaction + # Logs returns log entries matching the provided filter. + logs(filter: FilterCriteria!): [Log!]! + # GasPrice returns the node's estimate of a gas price sufficient to + # ensure a transaction is mined in a timely fashion. + gasPrice: BigInt! + # MaxPriorityFeePerGas returns the node's estimate of a gas tip sufficient + # to ensure a transaction is mined in a timely fashion. + maxPriorityFeePerGas: BigInt! + # Syncing returns information on the current synchronisation state. + syncing: SyncState + # ChainID returns the current chain ID for transaction replay protection. + chainID: BigInt! +} + +type Mutation { + # SendRawTransaction sends an RLP-encoded transaction to the network. + sendRawTransaction(data: Bytes!): Bytes32! +} + +type Withdrawal { + # Index is the index of the withdrawal. + index: Int! + # Index is the index of the validator that received the withdrawal. + validator: Int! + # Address is the target address for withdrawn ether. + address: Address! + # Amount is the amount of the withdrawal. + amount: BigInt! +} diff --git a/cmd/rpcdaemon/graphql/graph/schema.resolvers.go b/cmd/rpcdaemon/graphql/graph/schema.resolvers.go index f985e278834..dfe1b9fa810 100644 --- a/cmd/rpcdaemon/graphql/graph/schema.resolvers.go +++ b/cmd/rpcdaemon/graphql/graph/schema.resolvers.go @@ -2,7 +2,7 @@ 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.40 +// Code generated by github.com/99designs/gqlgen version v0.17.46 import ( "context" @@ -65,7 +65,6 @@ func (r *queryResolver) Block(ctx context.Context, number *string, hash *string) res, err := r.GraphQLAPI.GetBlockDetails(ctx, blockNumber) if err != nil { - fmt.Println(err) return nil, err } @@ -165,6 +164,20 @@ func (r *queryResolver) Block(ctx context.Context, number *string, hash *string) block.Transactions = append(block.Transactions, trans) } + + // Withdrawals + block.Withdrawals = []*model.Withdrawal{} + absWthd := res["withdrawals"] + wthd := absWthd.([]map[string]interface{}) + for _, withdrawal := range wthd { + wthd := &model.Withdrawal{} + wthd.Index = *convertDataToIntP(withdrawal, "index") + wthd.Validator = *convertDataToIntP(withdrawal, "validator") + wthd.Address = *convertDataToStringP(withdrawal, "address") + wthd.Amount = *convertDataToStringP(withdrawal, "amount") + + block.Withdrawals = append(block.Withdrawals, wthd) + } } return block, ctx.Err() diff --git a/cmd/rpcdaemon/graphql/graphql_test.go b/cmd/rpcdaemon/graphql/graphql_test.go index afb4466b922..e2d7dc77a36 100644 --- a/cmd/rpcdaemon/graphql/graphql_test.go +++ b/cmd/rpcdaemon/graphql/graphql_test.go @@ -96,6 +96,12 @@ func TestGraphQLQueryBlock(t *testing.T) { want: `{"data":{"block":{"ommerHash":"0x22f29046fa689683c504ad6fd9a7a9d5803f8e6bb66de435438b563f586651fe","ommerCount":1,"ommers":[{"hash":"0xf4af15465ca81e65866c6e64cbc446b735a06fb2118dda69a7c21d4ab0b1e217"}]}}}`, code: 200, }, + { // Should return withdrawals + body: `{"query": "{block{withdrawals{index,validator,address,amount}}}","variables": null}`, + want: `{"data":{"block":{"withdrawals":\[({"index":\d+,"validator":\d+,"address":"0x[0-9a-fA-F]+","amount":"0x[0-9a-fA-F]+"},?)*\]}}}`, + code: 200, + comp: "regexp", + }, // should return `estimateGas` as decimal /* { diff --git a/cmd/rpcdaemon/graphql/query_block.graphql b/cmd/rpcdaemon/graphql/query_block.graphql index 4816773a4d1..cc9b0e9f50d 100644 --- a/cmd/rpcdaemon/graphql/query_block.graphql +++ b/cmd/rpcdaemon/graphql/query_block.graphql @@ -55,5 +55,11 @@ } status } + withdrawals { + index + validator + address + amount + } } } diff --git a/turbo/jsonrpc/graphql_api.go b/turbo/jsonrpc/graphql_api.go index 23e9d20fd93..5b3255d8641 100644 --- a/turbo/jsonrpc/graphql_api.go +++ b/turbo/jsonrpc/graphql_api.go @@ -95,6 +95,20 @@ func (api *GraphQLAPIImpl) GetBlockDetails(ctx context.Context, blockNumber rpc. response["block"] = getBlockRes response["receipts"] = result + // Withdrawals + wresult := make([]map[string]interface{}, 0, len(block.Withdrawals())) + for _, withdrawal := range block.Withdrawals() { + wmap := make(map[string]interface{}) + wmap["index"] = hexutil.Uint64(withdrawal.Index) + wmap["validator"] = hexutil.Uint64(withdrawal.Validator) + wmap["address"] = withdrawal.Address + wmap["amount"] = withdrawal.Amount + + wresult = append(wresult, wmap) + } + + response["withdrawals"] = wresult + return response, nil }