Add service provider auctions #59
@ -168,9 +168,12 @@ type Auction {
|
|||||||
commitFee: Coin! # Fee required to bid/participate in the auction.
|
commitFee: Coin! # Fee required to bid/participate in the auction.
|
||||||
revealFee: Coin! # Reveal fee (paid back to bidders only if they unseal/reveal the bid).
|
revealFee: Coin! # Reveal fee (paid back to bidders only if they unseal/reveal the bid).
|
||||||
minimumBid: Coin! # Minimum bid amount.
|
minimumBid: Coin! # Minimum bid amount.
|
||||||
winnerAddress: String! # Winner address.
|
winnerAddresses: [String]! # Winner address.
|
||||||
winnerBid: Coin! # The winning bid amount.
|
winnerBids: [Coin]! # The winning bid amount.
|
||||||
winnerPrice: Coin! # The price that the winner actually pays (2nd highest bid).
|
winnerPrice: Coin! # The price that the winner actually pays (2nd highest bid).
|
||||||
|
maxPrice: Coin! # Max bid amount for service provider auction.
|
||||||
|
kind: String! # Auction kind.
|
||||||
|
numProviders: Int # Number of service providers
|
||||||
bids: [AuctionBid] # Bids make in the auction.
|
bids: [AuctionBid] # Bids make in the auction.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
346
gql/generated.go
346
gql/generated.go
@ -61,19 +61,22 @@ type ComplexityRoot struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Auction struct {
|
Auction struct {
|
||||||
Bids func(childComplexity int) int
|
Bids func(childComplexity int) int
|
||||||
CommitFee func(childComplexity int) int
|
CommitFee func(childComplexity int) int
|
||||||
CommitsEndTime func(childComplexity int) int
|
CommitsEndTime func(childComplexity int) int
|
||||||
CreateTime func(childComplexity int) int
|
CreateTime func(childComplexity int) int
|
||||||
ID func(childComplexity int) int
|
ID func(childComplexity int) int
|
||||||
MinimumBid func(childComplexity int) int
|
Kind func(childComplexity int) int
|
||||||
OwnerAddress func(childComplexity int) int
|
MaxPrice func(childComplexity int) int
|
||||||
RevealFee func(childComplexity int) int
|
MinimumBid func(childComplexity int) int
|
||||||
RevealsEndTime func(childComplexity int) int
|
NumProviders func(childComplexity int) int
|
||||||
Status func(childComplexity int) int
|
OwnerAddress func(childComplexity int) int
|
||||||
WinnerAddress func(childComplexity int) int
|
RevealFee func(childComplexity int) int
|
||||||
WinnerBid func(childComplexity int) int
|
RevealsEndTime func(childComplexity int) int
|
||||||
WinnerPrice func(childComplexity int) int
|
Status func(childComplexity int) int
|
||||||
|
WinnerAddresses func(childComplexity int) int
|
||||||
|
WinnerBids func(childComplexity int) int
|
||||||
|
WinnerPrice func(childComplexity int) int
|
||||||
}
|
}
|
||||||
|
|
||||||
AuctionBid struct {
|
AuctionBid struct {
|
||||||
@ -353,6 +356,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
|
|
||||||
return e.complexity.Auction.ID(childComplexity), true
|
return e.complexity.Auction.ID(childComplexity), true
|
||||||
|
|
||||||
|
case "Auction.kind":
|
||||||
|
if e.complexity.Auction.Kind == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Auction.Kind(childComplexity), true
|
||||||
|
|
||||||
|
case "Auction.maxPrice":
|
||||||
|
if e.complexity.Auction.MaxPrice == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Auction.MaxPrice(childComplexity), true
|
||||||
|
|
||||||
case "Auction.minimumBid":
|
case "Auction.minimumBid":
|
||||||
if e.complexity.Auction.MinimumBid == nil {
|
if e.complexity.Auction.MinimumBid == nil {
|
||||||
break
|
break
|
||||||
@ -360,6 +377,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
|
|
||||||
return e.complexity.Auction.MinimumBid(childComplexity), true
|
return e.complexity.Auction.MinimumBid(childComplexity), true
|
||||||
|
|
||||||
|
case "Auction.numProviders":
|
||||||
|
if e.complexity.Auction.NumProviders == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Auction.NumProviders(childComplexity), true
|
||||||
|
|
||||||
case "Auction.ownerAddress":
|
case "Auction.ownerAddress":
|
||||||
if e.complexity.Auction.OwnerAddress == nil {
|
if e.complexity.Auction.OwnerAddress == nil {
|
||||||
break
|
break
|
||||||
@ -388,19 +412,19 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
|
|
||||||
return e.complexity.Auction.Status(childComplexity), true
|
return e.complexity.Auction.Status(childComplexity), true
|
||||||
|
|
||||||
case "Auction.winnerAddress":
|
case "Auction.winnerAddresses":
|
||||||
if e.complexity.Auction.WinnerAddress == nil {
|
if e.complexity.Auction.WinnerAddresses == nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Auction.WinnerAddress(childComplexity), true
|
return e.complexity.Auction.WinnerAddresses(childComplexity), true
|
||||||
|
|
||||||
case "Auction.winnerBid":
|
case "Auction.winnerBids":
|
||||||
if e.complexity.Auction.WinnerBid == nil {
|
if e.complexity.Auction.WinnerBids == nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Auction.WinnerBid(childComplexity), true
|
return e.complexity.Auction.WinnerBids(childComplexity), true
|
||||||
|
|
||||||
case "Auction.winnerPrice":
|
case "Auction.winnerPrice":
|
||||||
if e.complexity.Auction.WinnerPrice == nil {
|
if e.complexity.Auction.WinnerPrice == nil {
|
||||||
@ -2147,8 +2171,8 @@ func (ec *executionContext) fieldContext_Auction_minimumBid(ctx context.Context,
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Auction_winnerAddress(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Auction_winnerAddresses(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_Auction_winnerAddress(ctx, field)
|
fc, err := ec.fieldContext_Auction_winnerAddresses(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return graphql.Null
|
return graphql.Null
|
||||||
}
|
}
|
||||||
@ -2161,7 +2185,7 @@ func (ec *executionContext) _Auction_winnerAddress(ctx context.Context, field gr
|
|||||||
}()
|
}()
|
||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return obj.WinnerAddress, nil
|
return obj.WinnerAddresses, nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ec.Error(ctx, err)
|
ec.Error(ctx, err)
|
||||||
@ -2173,12 +2197,12 @@ func (ec *executionContext) _Auction_winnerAddress(ctx context.Context, field gr
|
|||||||
}
|
}
|
||||||
return graphql.Null
|
return graphql.Null
|
||||||
}
|
}
|
||||||
res := resTmp.(string)
|
res := resTmp.([]*string)
|
||||||
fc.Result = res
|
fc.Result = res
|
||||||
return ec.marshalNString2string(ctx, field.Selections, res)
|
return ec.marshalNString2ᚕᚖstring(ctx, field.Selections, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) fieldContext_Auction_winnerAddress(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
func (ec *executionContext) fieldContext_Auction_winnerAddresses(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
fc = &graphql.FieldContext{
|
fc = &graphql.FieldContext{
|
||||||
Object: "Auction",
|
Object: "Auction",
|
||||||
Field: field,
|
Field: field,
|
||||||
@ -2191,8 +2215,8 @@ func (ec *executionContext) fieldContext_Auction_winnerAddress(ctx context.Conte
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Auction_winnerBid(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Auction_winnerBids(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_Auction_winnerBid(ctx, field)
|
fc, err := ec.fieldContext_Auction_winnerBids(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return graphql.Null
|
return graphql.Null
|
||||||
}
|
}
|
||||||
@ -2205,7 +2229,7 @@ func (ec *executionContext) _Auction_winnerBid(ctx context.Context, field graphq
|
|||||||
}()
|
}()
|
||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return obj.WinnerBid, nil
|
return obj.WinnerBids, nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ec.Error(ctx, err)
|
ec.Error(ctx, err)
|
||||||
@ -2217,12 +2241,12 @@ func (ec *executionContext) _Auction_winnerBid(ctx context.Context, field graphq
|
|||||||
}
|
}
|
||||||
return graphql.Null
|
return graphql.Null
|
||||||
}
|
}
|
||||||
res := resTmp.(*Coin)
|
res := resTmp.([]*Coin)
|
||||||
fc.Result = res
|
fc.Result = res
|
||||||
return ec.marshalNCoin2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx, field.Selections, res)
|
return ec.marshalNCoin2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx, field.Selections, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) fieldContext_Auction_winnerBid(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
func (ec *executionContext) fieldContext_Auction_winnerBids(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
fc = &graphql.FieldContext{
|
fc = &graphql.FieldContext{
|
||||||
Object: "Auction",
|
Object: "Auction",
|
||||||
Field: field,
|
Field: field,
|
||||||
@ -2291,6 +2315,141 @@ func (ec *executionContext) fieldContext_Auction_winnerPrice(ctx context.Context
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _Auction_maxPrice(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_Auction_maxPrice(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.MaxPrice, 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.(*Coin)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalNCoin2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_Auction_maxPrice(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "Auction",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
switch field.Name {
|
||||||
|
case "type":
|
||||||
|
return ec.fieldContext_Coin_type(ctx, field)
|
||||||
|
case "quantity":
|
||||||
|
return ec.fieldContext_Coin_quantity(ctx, field)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("no field named %q was found under type Coin", field.Name)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _Auction_kind(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_Auction_kind(ctx, field)
|
||||||
|
if err != nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.Kind, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
if !graphql.HasFieldError(ctx, fc) {
|
||||||
|
ec.Errorf(ctx, "must not be null")
|
||||||
|
}
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(string)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalNString2string(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_Auction_kind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "Auction",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
return nil, errors.New("field of type String does not have child fields")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _Auction_numProviders(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_Auction_numProviders(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.NumProviders, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(*int)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalOInt2ᚖint(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_Auction_numProviders(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "Auction",
|
||||||
|
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) _Auction_bids(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Auction_bids(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_Auction_bids(ctx, field)
|
fc, err := ec.fieldContext_Auction_bids(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -3142,12 +3301,18 @@ func (ec *executionContext) fieldContext_AuthorityRecord_auction(ctx context.Con
|
|||||||
return ec.fieldContext_Auction_revealFee(ctx, field)
|
return ec.fieldContext_Auction_revealFee(ctx, field)
|
||||||
case "minimumBid":
|
case "minimumBid":
|
||||||
return ec.fieldContext_Auction_minimumBid(ctx, field)
|
return ec.fieldContext_Auction_minimumBid(ctx, field)
|
||||||
case "winnerAddress":
|
case "winnerAddresses":
|
||||||
return ec.fieldContext_Auction_winnerAddress(ctx, field)
|
return ec.fieldContext_Auction_winnerAddresses(ctx, field)
|
||||||
case "winnerBid":
|
case "winnerBids":
|
||||||
return ec.fieldContext_Auction_winnerBid(ctx, field)
|
return ec.fieldContext_Auction_winnerBids(ctx, field)
|
||||||
case "winnerPrice":
|
case "winnerPrice":
|
||||||
return ec.fieldContext_Auction_winnerPrice(ctx, field)
|
return ec.fieldContext_Auction_winnerPrice(ctx, field)
|
||||||
|
case "maxPrice":
|
||||||
|
return ec.fieldContext_Auction_maxPrice(ctx, field)
|
||||||
|
case "kind":
|
||||||
|
return ec.fieldContext_Auction_kind(ctx, field)
|
||||||
|
case "numProviders":
|
||||||
|
return ec.fieldContext_Auction_numProviders(ctx, field)
|
||||||
case "bids":
|
case "bids":
|
||||||
return ec.fieldContext_Auction_bids(ctx, field)
|
return ec.fieldContext_Auction_bids(ctx, field)
|
||||||
}
|
}
|
||||||
@ -5129,12 +5294,18 @@ func (ec *executionContext) fieldContext_Query_getAuctionsByIds(ctx context.Cont
|
|||||||
return ec.fieldContext_Auction_revealFee(ctx, field)
|
return ec.fieldContext_Auction_revealFee(ctx, field)
|
||||||
case "minimumBid":
|
case "minimumBid":
|
||||||
return ec.fieldContext_Auction_minimumBid(ctx, field)
|
return ec.fieldContext_Auction_minimumBid(ctx, field)
|
||||||
case "winnerAddress":
|
case "winnerAddresses":
|
||||||
return ec.fieldContext_Auction_winnerAddress(ctx, field)
|
return ec.fieldContext_Auction_winnerAddresses(ctx, field)
|
||||||
case "winnerBid":
|
case "winnerBids":
|
||||||
return ec.fieldContext_Auction_winnerBid(ctx, field)
|
return ec.fieldContext_Auction_winnerBids(ctx, field)
|
||||||
case "winnerPrice":
|
case "winnerPrice":
|
||||||
return ec.fieldContext_Auction_winnerPrice(ctx, field)
|
return ec.fieldContext_Auction_winnerPrice(ctx, field)
|
||||||
|
case "maxPrice":
|
||||||
|
return ec.fieldContext_Auction_maxPrice(ctx, field)
|
||||||
|
case "kind":
|
||||||
|
return ec.fieldContext_Auction_kind(ctx, field)
|
||||||
|
case "numProviders":
|
||||||
|
return ec.fieldContext_Auction_numProviders(ctx, field)
|
||||||
case "bids":
|
case "bids":
|
||||||
return ec.fieldContext_Auction_bids(ctx, field)
|
return ec.fieldContext_Auction_bids(ctx, field)
|
||||||
}
|
}
|
||||||
@ -8710,16 +8881,16 @@ func (ec *executionContext) _Auction(ctx context.Context, sel ast.SelectionSet,
|
|||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
invalids++
|
invalids++
|
||||||
}
|
}
|
||||||
case "winnerAddress":
|
case "winnerAddresses":
|
||||||
|
|
||||||
out.Values[i] = ec._Auction_winnerAddress(ctx, field, obj)
|
out.Values[i] = ec._Auction_winnerAddresses(ctx, field, obj)
|
||||||
|
|
||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
invalids++
|
invalids++
|
||||||
}
|
}
|
||||||
case "winnerBid":
|
case "winnerBids":
|
||||||
|
|
||||||
out.Values[i] = ec._Auction_winnerBid(ctx, field, obj)
|
out.Values[i] = ec._Auction_winnerBids(ctx, field, obj)
|
||||||
|
|
||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
invalids++
|
invalids++
|
||||||
@ -8731,6 +8902,24 @@ func (ec *executionContext) _Auction(ctx context.Context, sel ast.SelectionSet,
|
|||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
invalids++
|
invalids++
|
||||||
}
|
}
|
||||||
|
case "maxPrice":
|
||||||
|
|
||||||
|
out.Values[i] = ec._Auction_maxPrice(ctx, field, obj)
|
||||||
|
|
||||||
|
if out.Values[i] == graphql.Null {
|
||||||
|
invalids++
|
||||||
|
}
|
||||||
|
case "kind":
|
||||||
|
|
||||||
|
out.Values[i] = ec._Auction_kind(ctx, field, obj)
|
||||||
|
|
||||||
|
if out.Values[i] == graphql.Null {
|
||||||
|
invalids++
|
||||||
|
}
|
||||||
|
case "numProviders":
|
||||||
|
|
||||||
|
out.Values[i] = ec._Auction_numProviders(ctx, field, obj)
|
||||||
|
|
||||||
case "bids":
|
case "bids":
|
||||||
|
|
||||||
out.Values[i] = ec._Auction_bids(ctx, field, obj)
|
out.Values[i] = ec._Auction_bids(ctx, field, obj)
|
||||||
@ -10500,6 +10689,44 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalNCoin2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx context.Context, sel ast.SelectionSet, v []*Coin) graphql.Marshaler {
|
||||||
|
ret := make(graphql.Array, len(v))
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
isLen1 := len(v) == 1
|
||||||
|
if !isLen1 {
|
||||||
|
wg.Add(len(v))
|
||||||
|
}
|
||||||
|
for i := range v {
|
||||||
|
i := i
|
||||||
|
fc := &graphql.FieldContext{
|
||||||
|
Index: &i,
|
||||||
|
Result: &v[i],
|
||||||
|
}
|
||||||
|
ctx := graphql.WithFieldContext(ctx, fc)
|
||||||
|
f := func(i int) {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = nil
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
if !isLen1 {
|
||||||
|
defer wg.Done()
|
||||||
|
}
|
||||||
|
ret[i] = ec.marshalOCoin2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx, sel, v[i])
|
||||||
|
}
|
||||||
|
if isLen1 {
|
||||||
|
f(i)
|
||||||
|
} else {
|
||||||
|
go f(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) marshalNCoin2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx context.Context, sel ast.SelectionSet, v *Coin) graphql.Marshaler {
|
func (ec *executionContext) marshalNCoin2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx context.Context, sel ast.SelectionSet, v *Coin) graphql.Marshaler {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||||
@ -10732,6 +10959,32 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) unmarshalNString2ᚕᚖstring(ctx context.Context, v interface{}) ([]*string, error) {
|
||||||
|
var vSlice []interface{}
|
||||||
|
if v != nil {
|
||||||
|
vSlice = graphql.CoerceList(v)
|
||||||
|
}
|
||||||
|
var err error
|
||||||
|
res := make([]*string, len(vSlice))
|
||||||
|
for i := range vSlice {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i))
|
||||||
|
res[i], err = ec.unmarshalOString2ᚖstring(ctx, vSlice[i])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalNString2ᚕᚖstring(ctx context.Context, sel ast.SelectionSet, v []*string) graphql.Marshaler {
|
||||||
|
ret := make(graphql.Array, len(v))
|
||||||
|
for i := range v {
|
||||||
|
ret[i] = ec.marshalOString2ᚖstring(ctx, sel, v[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) marshalNSyncInfo2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐSyncInfo(ctx context.Context, sel ast.SelectionSet, v *SyncInfo) graphql.Marshaler {
|
func (ec *executionContext) marshalNSyncInfo2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐSyncInfo(ctx context.Context, sel ast.SelectionSet, v *SyncInfo) graphql.Marshaler {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||||
@ -11444,6 +11697,13 @@ func (ec *executionContext) marshalOCoin2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaco
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalOCoin2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐCoin(ctx context.Context, sel ast.SelectionSet, v *Coin) graphql.Marshaler {
|
||||||
|
if v == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
return ec._Coin(ctx, sel, v)
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) unmarshalOFloat2ᚖfloat64(ctx context.Context, v interface{}) (*float64, error) {
|
func (ec *executionContext) unmarshalOFloat2ᚖfloat64(ctx context.Context, v interface{}) (*float64, error) {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
@ -26,19 +26,22 @@ type Attribute struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Auction struct {
|
type Auction struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
OwnerAddress string `json:"ownerAddress"`
|
OwnerAddress string `json:"ownerAddress"`
|
||||||
CreateTime string `json:"createTime"`
|
CreateTime string `json:"createTime"`
|
||||||
CommitsEndTime string `json:"commitsEndTime"`
|
CommitsEndTime string `json:"commitsEndTime"`
|
||||||
RevealsEndTime string `json:"revealsEndTime"`
|
RevealsEndTime string `json:"revealsEndTime"`
|
||||||
CommitFee *Coin `json:"commitFee"`
|
CommitFee *Coin `json:"commitFee"`
|
||||||
RevealFee *Coin `json:"revealFee"`
|
RevealFee *Coin `json:"revealFee"`
|
||||||
MinimumBid *Coin `json:"minimumBid"`
|
MinimumBid *Coin `json:"minimumBid"`
|
||||||
WinnerAddress string `json:"winnerAddress"`
|
WinnerAddresses []*string `json:"winnerAddresses"`
|
||||||
WinnerBid *Coin `json:"winnerBid"`
|
WinnerBids []*Coin `json:"winnerBids"`
|
||||||
WinnerPrice *Coin `json:"winnerPrice"`
|
WinnerPrice *Coin `json:"winnerPrice"`
|
||||||
Bids []*AuctionBid `json:"bids"`
|
MaxPrice *Coin `json:"maxPrice"`
|
||||||
|
Kind string `json:"kind"`
|
||||||
|
NumProviders *int `json:"numProviders"`
|
||||||
|
Bids []*AuctionBid `json:"bids"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AuctionBid struct {
|
type AuctionBid struct {
|
||||||
|
34
gql/util.go
34
gql/util.go
@ -232,19 +232,29 @@ func GetGQLAuction(auction *auctiontypes.Auction, bids []*auctiontypes.Bid) (*Au
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
winnerAddresses := make([]*string, len(auction.WinnerAddresses))
|
||||||
|
for i, addr := range auction.WinnerAddresses {
|
||||||
|
winnerAddresses[i] = &addr
|
||||||
|
}
|
||||||
|
|
||||||
|
numProviders := int(auction.NumProviders)
|
||||||
|
|
||||||
gqlAuction := Auction{
|
gqlAuction := Auction{
|
||||||
ID: auction.Id,
|
ID: auction.Id,
|
||||||
Status: auction.Status,
|
Status: auction.Status,
|
||||||
OwnerAddress: auction.OwnerAddress,
|
OwnerAddress: auction.OwnerAddress,
|
||||||
CreateTime: auction.GetCreateTime(),
|
CreateTime: auction.GetCreateTime(),
|
||||||
CommitsEndTime: auction.GetCommitsEndTime(),
|
CommitsEndTime: auction.GetCommitsEndTime(),
|
||||||
RevealsEndTime: auction.GetRevealsEndTime(),
|
RevealsEndTime: auction.GetRevealsEndTime(),
|
||||||
CommitFee: getGQLCoin(auction.CommitFee),
|
CommitFee: getGQLCoin(auction.CommitFee),
|
||||||
RevealFee: getGQLCoin(auction.RevealFee),
|
RevealFee: getGQLCoin(auction.RevealFee),
|
||||||
MinimumBid: getGQLCoin(auction.MinimumBid),
|
MinimumBid: getGQLCoin(auction.MinimumBid),
|
||||||
WinnerAddress: auction.WinnerAddress,
|
WinnerAddresses: winnerAddresses,
|
||||||
WinnerBid: getGQLCoin(auction.WinningBid),
|
WinnerBids: getGQLCoins(auction.WinningBids),
|
||||||
WinnerPrice: getGQLCoin(auction.WinningPrice),
|
WinnerPrice: getGQLCoin(auction.WinningPrice),
|
||||||
|
MaxPrice: getGQLCoin(auction.MaxPrice),
|
||||||
|
Kind: auction.Kind,
|
||||||
|
NumProviders: &numProviders,
|
||||||
}
|
}
|
||||||
|
|
||||||
auctionBids := make([]*AuctionBid, len(bids))
|
auctionBids := make([]*AuctionBid, len(bids))
|
||||||
|
Loading…
Reference in New Issue
Block a user