Add fields for role and KYC ID for onboarded participants #43

Merged
nabarun merged 4 commits from pm-add-role-kyc-id into main 2024-07-26 14:42:41 +00:00
4 changed files with 128 additions and 0 deletions
Showing only changes of commit 34e56fa5fe - Show all commits

View File

@ -33,6 +33,8 @@ type Account {
type Participant { type Participant {
cosmosAddress: String! # Cosmos address of the participant who will be registered. cosmosAddress: String! # Cosmos address of the participant who will be registered.
nitroAddress: String! # Nitro addresss of the participant who will be registered. nitroAddress: String! # Nitro addresss of the participant who will be registered.
role: Int! # Participant's role
kycId: String! # Participant's KYC receipt ID
} }
# Value describes a DAG-JSON compatible value. # Value describes a DAG-JSON compatible value.

View File

@ -155,7 +155,9 @@ type ComplexityRoot struct {
Participant struct { Participant struct {
CosmosAddress func(childComplexity int) int CosmosAddress func(childComplexity int) int
KycID func(childComplexity int) int
NitroAddress func(childComplexity int) int NitroAddress func(childComplexity int) int
Role func(childComplexity int) int
} }
PeerInfo struct { PeerInfo struct {
@ -648,6 +650,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Participant.CosmosAddress(childComplexity), true return e.complexity.Participant.CosmosAddress(childComplexity), true
case "Participant.kycId":
if e.complexity.Participant.KycID == nil {
break
}
return e.complexity.Participant.KycID(childComplexity), true
case "Participant.nitroAddress": case "Participant.nitroAddress":
if e.complexity.Participant.NitroAddress == nil { if e.complexity.Participant.NitroAddress == nil {
break break
@ -655,6 +664,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Participant.NitroAddress(childComplexity), true return e.complexity.Participant.NitroAddress(childComplexity), true
case "Participant.role":
if e.complexity.Participant.Role == nil {
break
}
return e.complexity.Participant.Role(childComplexity), true
case "PeerInfo.isOutbound": case "PeerInfo.isOutbound":
if e.complexity.PeerInfo.IsOutbound == nil { if e.complexity.PeerInfo.IsOutbound == nil {
break break
@ -3924,6 +3940,94 @@ func (ec *executionContext) fieldContext_Participant_nitroAddress(ctx context.Co
return fc, nil return fc, nil
} }
func (ec *executionContext) _Participant_role(ctx context.Context, field graphql.CollectedField, obj *Participant) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Participant_role(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.Role, 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_Participant_role(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Participant",
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) _Participant_kycId(ctx context.Context, field graphql.CollectedField, obj *Participant) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Participant_kycId(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.KycID, 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_Participant_kycId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Participant",
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) _PeerInfo_node(ctx context.Context, field graphql.CollectedField, obj *PeerInfo) (ret graphql.Marshaler) { func (ec *executionContext) _PeerInfo_node(ctx context.Context, field graphql.CollectedField, obj *PeerInfo) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_PeerInfo_node(ctx, field) fc, err := ec.fieldContext_PeerInfo_node(ctx, field)
if err != nil { if err != nil {
@ -4836,6 +4940,10 @@ func (ec *executionContext) fieldContext_Query_getParticipants(ctx context.Conte
return ec.fieldContext_Participant_cosmosAddress(ctx, field) return ec.fieldContext_Participant_cosmosAddress(ctx, field)
case "nitroAddress": case "nitroAddress":
return ec.fieldContext_Participant_nitroAddress(ctx, field) return ec.fieldContext_Participant_nitroAddress(ctx, field)
case "role":
return ec.fieldContext_Participant_role(ctx, field)
case "kycId":
return ec.fieldContext_Participant_kycId(ctx, field)
} }
return nil, fmt.Errorf("no field named %q was found under type Participant", field.Name) return nil, fmt.Errorf("no field named %q was found under type Participant", field.Name)
}, },
@ -8798,6 +8906,20 @@ func (ec *executionContext) _Participant(ctx context.Context, sel ast.SelectionS
out.Values[i] = ec._Participant_nitroAddress(ctx, field, obj) out.Values[i] = ec._Participant_nitroAddress(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
case "role":
out.Values[i] = ec._Participant_role(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
case "kycId":
out.Values[i] = ec._Participant_kycId(ctx, field, obj)
if out.Values[i] == graphql.Null { if out.Values[i] == graphql.Null {
invalids++ invalids++
} }

View File

@ -138,6 +138,8 @@ type OwnerBonds struct {
type Participant struct { type Participant struct {
CosmosAddress string `json:"cosmosAddress"` CosmosAddress string `json:"cosmosAddress"`
NitroAddress string `json:"nitroAddress"` NitroAddress string `json:"nitroAddress"`
Role int `json:"role"`
KycID string `json:"kycId"`
} }
type PeerInfo struct { type PeerInfo struct {

View File

@ -373,6 +373,8 @@ func (q queryResolver) GetParticipants(ctx context.Context) ([]*Participant, err
participants[i] = &Participant{ participants[i] = &Participant{
CosmosAddress: p.CosmosAddress, CosmosAddress: p.CosmosAddress,
NitroAddress: p.NitroAddress, NitroAddress: p.NitroAddress,
Role: int(p.GetRole()),
KycID: p.KycId,
} }
} }