11package types
22
3- import (
4- fmt "fmt"
5- "strings"
6-
7- sdk "github.com/cosmos/cosmos-sdk/types"
8- )
9-
103// TSS module event types
114const (
125 EventTypeInitiateDKG = "initiate_dkg"
@@ -29,52 +22,26 @@ const (
2922
3023 AttributeKeyParticipant = "participant"
3124
32- AttributeKeyPubKey = "pub_key"
33- AttributeKeySigHashes = "sig_hashes"
34- AttributeKeyNonce = "nonce"
35- AttributeKeyAdaptorPoint = "adaptor_point"
25+ AttributeKeyPubKey = "pub_key"
26+ AttributeKeySigHashes = "sig_hashes"
27+ AttributeKeyOption = "option"
3628)
3729
3830const (
3931 AttributeValueSeparator = ","
4032)
4133
42- // GetSigningRequestEventAttributes gets the event attributes for the signing request
43- func GetSigningRequestEventAttributes (id uint64 , module string , scopedId string , ty SigningType , intent int32 , pubKey string , sigHashes []string , options * SigningOptions ) []sdk.Attribute {
44- attributes := []sdk.Attribute {}
45-
46- attributes = append (attributes , sdk .NewAttribute (AttributeKeyId , fmt .Sprintf ("%d" , id )))
47- attributes = append (attributes , sdk .NewAttribute (AttributeKeyModule , module ))
48- attributes = append (attributes , sdk .NewAttribute (AttributeKeyScopedId , scopedId ))
49- attributes = append (attributes , sdk .NewAttribute (AttributeKeyType , fmt .Sprintf ("%d" , ty )))
50- attributes = append (attributes , sdk .NewAttribute (AttributeKeyIntent , fmt .Sprintf ("%d" , intent )))
51- attributes = append (attributes , sdk .NewAttribute (AttributeKeyPubKey , pubKey ))
52- attributes = append (attributes , sdk .NewAttribute (AttributeKeySigHashes , strings .Join (sigHashes , AttributeValueSeparator )))
53-
54- if options != nil {
55- attributes = append (attributes , GetSigningOptionAttribute (ty , options ))
56- }
57-
58- return attributes
59- }
60-
61- // GetSigningOptionAttribute gets the event attribute for the signing option
34+ // GetSigningOption gets the signing option according to the given signing type and options
6235// Assume that the options match the signing type
63- func GetSigningOptionAttribute (signingType SigningType , options * SigningOptions ) sdk. Attribute {
36+ func GetSigningOption (signingType SigningType , options * SigningOptions ) string {
6437 switch signingType {
6538 case SigningType_SIGNING_TYPE_SCHNORR_WITH_COMMITMENT :
66- return sdk.Attribute {
67- Key : AttributeKeyNonce ,
68- Value : options .Nonce ,
69- }
39+ return options .Nonce
7040
7141 case SigningType_SIGNING_TYPE_SCHNORR_ADAPTOR :
72- return sdk.Attribute {
73- Key : AttributeKeyAdaptorPoint ,
74- Value : options .AdaptorPoint ,
75- }
42+ return options .AdaptorPoint
7643
7744 default :
78- return sdk. Attribute {}
45+ return ""
7946 }
8047}
0 commit comments