-
Notifications
You must be signed in to change notification settings - Fork 41
/
jetton_msg_types.go
207 lines (183 loc) · 6.38 KB
/
jetton_msg_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
package abi
// Code autogenerated. DO NOT EDIT.
import (
"github.com/tonkeeper/tongo/boc"
"github.com/tonkeeper/tongo/tlb"
)
func decodeTextCommentJettonOpJetton(j *JettonPayload, c *boc.Cell) error {
var res TextCommentJettonPayload
err := tlb.Unmarshal(c, &res)
if err == nil {
j.SumType = TextCommentJettonOp
j.Value = res
return nil
}
return err
}
func decodeTegroJettonSwapJettonOpJetton(j *JettonPayload, c *boc.Cell) error {
var res TegroJettonSwapJettonPayload
err := tlb.Unmarshal(c, &res)
if err == nil {
j.SumType = TegroJettonSwapJettonOp
j.Value = res
return nil
}
return err
}
func decodeEncryptedTextCommentJettonOpJetton(j *JettonPayload, c *boc.Cell) error {
var res EncryptedTextCommentJettonPayload
err := tlb.Unmarshal(c, &res)
if err == nil {
j.SumType = EncryptedTextCommentJettonOp
j.Value = res
return nil
}
return err
}
func decodeStonfiSwapJettonOpJetton(j *JettonPayload, c *boc.Cell) error {
var res StonfiSwapJettonPayload
err := tlb.Unmarshal(c, &res)
if err == nil {
j.SumType = StonfiSwapJettonOp
j.Value = res
return nil
}
return err
}
func decodeTegroAddLiquidityJettonOpJetton(j *JettonPayload, c *boc.Cell) error {
var res TegroAddLiquidityJettonPayload
err := tlb.Unmarshal(c, &res)
if err == nil {
j.SumType = TegroAddLiquidityJettonOp
j.Value = res
return nil
}
return err
}
func decodeStonfiSwapOkRefJettonOpJetton(j *JettonPayload, c *boc.Cell) error {
var res StonfiSwapOkRefJettonPayload
err := tlb.Unmarshal(c, &res)
if err == nil && completedRead(c) {
j.SumType = StonfiSwapOkRefJettonOp
j.Value = res
return nil
}
return err
}
func decodeStonfiSwapOkJettonOpJetton(j *JettonPayload, c *boc.Cell) error {
var res StonfiSwapOkJettonPayload
err := tlb.Unmarshal(c, &res)
if err == nil && completedRead(c) {
j.SumType = StonfiSwapOkJettonOp
j.Value = res
return nil
}
return err
}
func decodeDedustSwapJettonOpJetton(j *JettonPayload, c *boc.Cell) error {
var res DedustSwapJettonPayload
err := tlb.Unmarshal(c, &res)
if err == nil {
j.SumType = DedustSwapJettonOp
j.Value = res
return nil
}
return err
}
func decodeStonfiProvideLiquidityJettonOpJetton(j *JettonPayload, c *boc.Cell) error {
var res StonfiProvideLiquidityJettonPayload
err := tlb.Unmarshal(c, &res)
if err == nil {
j.SumType = StonfiProvideLiquidityJettonOp
j.Value = res
return nil
}
return err
}
const (
TextCommentJettonOp JettonOpName = "TextComment"
TegroJettonSwapJettonOp JettonOpName = "TegroJettonSwap"
EncryptedTextCommentJettonOp JettonOpName = "EncryptedTextComment"
StonfiSwapJettonOp JettonOpName = "StonfiSwap"
TegroAddLiquidityJettonOp JettonOpName = "TegroAddLiquidity"
StonfiSwapOkRefJettonOp JettonOpName = "StonfiSwapOkRef"
StonfiSwapOkJettonOp JettonOpName = "StonfiSwapOk"
DedustSwapJettonOp JettonOpName = "DedustSwap"
StonfiProvideLiquidityJettonOp JettonOpName = "StonfiProvideLiquidity"
TextCommentJettonOpCode JettonOpCode = 0x00000000
TegroJettonSwapJettonOpCode JettonOpCode = 0x01fb7a25
EncryptedTextCommentJettonOpCode JettonOpCode = 0x2167da4b
StonfiSwapJettonOpCode JettonOpCode = 0x25938561
TegroAddLiquidityJettonOpCode JettonOpCode = 0x287e167a
StonfiSwapOkRefJettonOpCode JettonOpCode = 0x45078540
StonfiSwapOkJettonOpCode JettonOpCode = 0xc64370e5
DedustSwapJettonOpCode JettonOpCode = 0xe3a0d482
StonfiProvideLiquidityJettonOpCode JettonOpCode = 0xfcf9e58f
)
var KnownJettonTypes = map[string]any{
TextCommentJettonOp: TextCommentJettonPayload{},
TegroJettonSwapJettonOp: TegroJettonSwapJettonPayload{},
EncryptedTextCommentJettonOp: EncryptedTextCommentJettonPayload{},
StonfiSwapJettonOp: StonfiSwapJettonPayload{},
TegroAddLiquidityJettonOp: TegroAddLiquidityJettonPayload{},
StonfiSwapOkRefJettonOp: StonfiSwapOkRefJettonPayload{},
StonfiSwapOkJettonOp: StonfiSwapOkJettonPayload{},
DedustSwapJettonOp: DedustSwapJettonPayload{},
StonfiProvideLiquidityJettonOp: StonfiProvideLiquidityJettonPayload{},
}
var JettonOpCodes = map[JettonOpName]JettonOpCode{
TextCommentJettonOp: TextCommentJettonOpCode,
TegroJettonSwapJettonOp: TegroJettonSwapJettonOpCode,
EncryptedTextCommentJettonOp: EncryptedTextCommentJettonOpCode,
StonfiSwapJettonOp: StonfiSwapJettonOpCode,
TegroAddLiquidityJettonOp: TegroAddLiquidityJettonOpCode,
StonfiSwapOkRefJettonOp: StonfiSwapOkRefJettonOpCode,
StonfiSwapOkJettonOp: StonfiSwapOkJettonOpCode,
DedustSwapJettonOp: DedustSwapJettonOpCode,
StonfiProvideLiquidityJettonOp: StonfiProvideLiquidityJettonOpCode,
}
var funcJettonDecodersMapping = map[JettonOpCode]func(*JettonPayload, *boc.Cell) error{
TextCommentJettonOpCode: decodeTextCommentJettonOpJetton,
TegroJettonSwapJettonOpCode: decodeTegroJettonSwapJettonOpJetton,
EncryptedTextCommentJettonOpCode: decodeEncryptedTextCommentJettonOpJetton,
StonfiSwapJettonOpCode: decodeStonfiSwapJettonOpJetton,
TegroAddLiquidityJettonOpCode: decodeTegroAddLiquidityJettonOpJetton,
StonfiSwapOkRefJettonOpCode: decodeStonfiSwapOkRefJettonOpJetton,
StonfiSwapOkJettonOpCode: decodeStonfiSwapOkJettonOpJetton,
DedustSwapJettonOpCode: decodeDedustSwapJettonOpJetton,
StonfiProvideLiquidityJettonOpCode: decodeStonfiProvideLiquidityJettonOpJetton,
}
type TextCommentJettonPayload struct {
Text tlb.Text
}
type TegroJettonSwapJettonPayload struct {
Extract bool
MaxIn tlb.VarUInteger16
MinOut tlb.VarUInteger16
Destination tlb.MsgAddress
ErrorDestination tlb.MsgAddress
Payload *tlb.Any `tlb:"maybe^"`
}
type EncryptedTextCommentJettonPayload struct {
CipherText tlb.Bytes
}
type StonfiSwapJettonPayload struct {
TokenWallet tlb.MsgAddress
MinOut tlb.VarUInteger16
ToAddress tlb.MsgAddress
ReferralAddress *tlb.MsgAddress `tlb:"maybe"`
}
type TegroAddLiquidityJettonPayload struct {
AmountA tlb.VarUInteger16
AbountB tlb.VarUInteger16
}
type StonfiSwapOkRefJettonPayload struct{}
type StonfiSwapOkJettonPayload struct{}
type DedustSwapJettonPayload struct {
Step DedustSwapStep
SwapParams DedustSwapParams `tlb:"^"`
}
type StonfiProvideLiquidityJettonPayload struct {
TokenWallet tlb.MsgAddress
MinLpOut tlb.VarUInteger16
}