@@ -13,10 +13,9 @@ import (
13
13
14
14
// AttachedAccountType represents the type of the attached account
15
15
const (
16
- KnownAccountWeight = 1000
17
- BoostForFullMatch = 100
18
- BoostForOriginalName = 50
19
- BoostForVerified = 5
16
+ KnownAccountWeight = 1000
17
+ BoostForFullMatch = 100
18
+ BoostForVerified = 10
20
19
)
21
20
22
21
// AttachedAccount represents domains, nft collections for quick search by name are presented
@@ -34,31 +33,31 @@ type AttachedAccount struct {
34
33
}
35
34
36
35
// ConvertAttachedAccount converts a known account to an attached account
37
- func ConvertAttachedAccount (slug , image string , account ton.AccountID , weight int , trust core.TrustType , accountType AttachedAccountType ) (AttachedAccount , error ) {
38
- var name string
36
+ func ConvertAttachedAccount (name , slug , image string , account ton.AccountID , weight int , trust core.TrustType , accountType AttachedAccountType ) (AttachedAccount , error ) {
37
+ var convertedName string
39
38
// Handle different account types and assign appropriate values
40
39
switch accountType {
41
40
case TonDomainAccountType , TgDomainAccountType :
42
41
weight = 1000
43
- name = fmt .Sprintf ("%v · account" , slug )
42
+ convertedName = fmt .Sprintf ("%v · account" , name )
44
43
// Generate image URL for "t.me" subdomains
45
- if strings .HasSuffix (slug , "t.me" ) && strings .Count (slug , "." ) == 2 {
46
- image = fmt .Sprintf ("https://t.me/i/userpic/320/%v.jpg" , strings .TrimSuffix (slug , ".t.me" ))
44
+ if strings .HasSuffix (name , "t.me" ) && strings .Count (name , "." ) == 2 {
45
+ image = fmt .Sprintf ("https://t.me/i/userpic/320/%v.jpg" , strings .TrimSuffix (name , ".t.me" ))
47
46
} else {
48
47
image = references .PlugAutoCompleteDomain
49
48
}
50
49
case JettonSymbolAccountType , JettonNameAccountType :
51
- name = fmt .Sprintf ("%v · jetton" , slug )
50
+ convertedName = fmt .Sprintf ("%v · jetton" , name )
52
51
if image == "" {
53
52
image = references .PlugAutoCompleteJetton
54
53
}
55
54
case NftCollectionAccountType :
56
- name = fmt .Sprintf ("%v · collection" , slug )
55
+ convertedName = fmt .Sprintf ("%v · collection" , name )
57
56
if image == "" {
58
57
image = references .PlugAutoCompleteCollection
59
58
}
60
59
case ManualAccountType :
61
- name = fmt .Sprintf ("%v · account" , slug )
60
+ convertedName = fmt .Sprintf ("%v · account" , name )
62
61
if image == "" {
63
62
image = references .PlugAutoCompleteAccount
64
63
}
@@ -69,20 +68,20 @@ func ConvertAttachedAccount(slug, image string, account ton.AccountID, weight in
69
68
image = imgGenerator .DefaultGenerator .GenerateImageUrl (image , 200 , 200 )
70
69
}
71
70
return AttachedAccount {
72
- Name : name ,
71
+ Name : convertedName ,
73
72
Slug : slug ,
74
73
Preview : image ,
75
74
Wallet : account ,
76
75
Type : accountType ,
77
76
Weight : int64 (weight ),
78
77
Popular : int64 (weight ),
79
78
Trust : trust ,
80
- Normalized : rules .NormalizeJettonSymbol (slug ),
79
+ Normalized : rules .NormalizeString (slug ),
81
80
}, nil
82
81
}
83
82
84
- // GenerateNameVariants generates name variants by rotating the words
85
- func GenerateNameVariants (name string ) []string {
83
+ // GenerateSlugVariants generates name variants by rotating the words
84
+ func GenerateSlugVariants (name string ) []string {
86
85
words := strings .Fields (name ) // Split the name into words
87
86
var variants []string
88
87
// Generate up to 3 variants by rotating the words
0 commit comments