Skip to content

Commit 89e0ff6

Browse files
authored
Merge pull request #61 from tonkeeper/msg-op-name
Use MsgOpName type instead of text strings when working with message operations
2 parents 6685bea + 6be0f66 commit 89e0ff6

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
github.com/sourcegraph/conc v0.3.0
2121
github.com/stretchr/testify v1.8.1
2222
github.com/tonkeeper/scam_backoffice_rules v0.0.0-20230413094040-a66ab71fb269
23-
github.com/tonkeeper/tongo v1.0.15-0.20230501203905-82920df08b2f
23+
github.com/tonkeeper/tongo v1.0.15-0.20230508095306-c4c3b7a0ae50
2424
go.opentelemetry.io/otel v1.11.1
2525
go.opentelemetry.io/otel/metric v0.33.0
2626
go.opentelemetry.io/otel/trace v1.11.1

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ github.com/tonkeeper/tongo v1.0.14-0.20230425143018-42fbbbfed2a3 h1:7pbY+FHPuUXt
267267
github.com/tonkeeper/tongo v1.0.14-0.20230425143018-42fbbbfed2a3/go.mod h1:Nn/5t5MGQHBUuEm56O135FIYwk9WpPgDITjWPk+fPGc=
268268
github.com/tonkeeper/tongo v1.0.15-0.20230501203905-82920df08b2f h1:0pqgkGrgosH8PX7+RTz2YfnEwAymUJ9VHlhb2VkIaQE=
269269
github.com/tonkeeper/tongo v1.0.15-0.20230501203905-82920df08b2f/go.mod h1:LdOBjpUz6vLp1EdX3E0XLNks9YI5XMSqaQahfOMrBEY=
270+
github.com/tonkeeper/tongo v1.0.15-0.20230508095306-c4c3b7a0ae50 h1:WG6lvONwtWRb4HlJqgjmf2eJXKRoi4bYJWQdgW53hoo=
271+
github.com/tonkeeper/tongo v1.0.15-0.20230508095306-c4c3b7a0ae50/go.mod h1:LdOBjpUz6vLp1EdX3E0XLNks9YI5XMSqaQahfOMrBEY=
270272
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
271273
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
272274
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=

pkg/bath/straws.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func FindNFTTransfer(bubble *Bubble) bool {
5757
if !ok {
5858
return false
5959
}
60-
if !nftBubble.operation("NftTransfer") {
60+
if !nftBubble.operation(abi.NftTransferMsgOp) {
6161
return false
6262
}
6363
transfer := nftBubble.decodedBody.Value.(abi.NftTransferMsgBody)
@@ -80,7 +80,7 @@ func FindNFTTransfer(bubble *Bubble) bool {
8080
if !ok {
8181
return nil
8282
}
83-
if !tx.operation("Excess") {
83+
if !tx.operation(abi.ExcessMsgOp) {
8484
return nil
8585
}
8686
newBubble.Fee.Add(child.Fee)
@@ -93,7 +93,7 @@ func FindNFTTransfer(bubble *Bubble) bool {
9393
if !ok {
9494
return nil
9595
}
96-
if !tx.operation("NftOwnershipAssigned") {
96+
if !tx.operation(abi.NftOwnershipAssignedMsgOp) {
9797
return nil
9898
}
9999
newBubble.Fee.Add(child.Fee)
@@ -147,7 +147,7 @@ func FindJettonTransfer(bubble *Bubble) bool {
147147
if !ok {
148148
return false
149149
}
150-
if !jettonBubble.operation("JettonTransfer") {
150+
if !jettonBubble.operation(abi.JettonTransferMsgOp) {
151151
return false
152152
}
153153
intention := jettonBubble.decodedBody.Value.(abi.JettonTransferMsgBody)
@@ -181,7 +181,7 @@ func FindJettonTransfer(bubble *Bubble) bool {
181181
if !ok {
182182
return nil
183183
}
184-
if !tx.operation("JettonInternalTransfer") {
184+
if !tx.operation(abi.JettonInternalTransferMsgOp) {
185185
return nil
186186
}
187187
if tx.success {
@@ -194,7 +194,7 @@ func FindJettonTransfer(bubble *Bubble) bool {
194194
if !ok {
195195
return nil
196196
}
197-
if !tx.operation("Excess") {
197+
if !tx.operation(abi.ExcessMsgOp) {
198198
return nil
199199
}
200200
return &Merge{children: excess.Children}
@@ -204,7 +204,7 @@ func FindJettonTransfer(bubble *Bubble) bool {
204204
if !ok {
205205
return nil
206206
}
207-
if !tx.operation("JettonNotify") {
207+
if !tx.operation(abi.JettonNotifyMsgOp) {
208208
return nil
209209
}
210210
transfer.success = true

pkg/bath/subscriptions.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ func FindInitialSubscription(bubble *Bubble) bool {
1616
if !ok {
1717
return false
1818
}
19-
if txBubble.opCode == nil || *txBubble.opCode != 0xf06c7567 { //todo: use decoded after tongo update
19+
if !txBubble.operation(abi.PaymentRequestResponseMsgOp) {
2020
return false
2121
}
22-
2322
newBubble := Bubble{
2423
Accounts: append(bubble.Accounts, txBubble.account.Address),
2524
Fee: bubble.Fee,
@@ -36,7 +35,7 @@ func FindInitialSubscription(bubble *Bubble) bool {
3635
if !ok {
3736
return nil
3837
}
39-
if tx.opCode == nil || *tx.opCode != 0x73756273 { //todo: use decoded after tongo update
38+
if !tx.operation(abi.SubscriptionPaymentMsgOp) {
4039
return nil
4140
}
4241
success = true
@@ -76,7 +75,7 @@ func FindExtendedSubscription(bubble *Bubble) bool {
7675
if !ok {
7776
return false
7877
}
79-
if !command.operation("PaymentRequest") { //todo: use constant
78+
if !command.operation(abi.PaymentRequestMsgOp) {
8079
return false
8180
}
8281
request := command.decodedBody.Value.(abi.PaymentRequestMsgBody)

0 commit comments

Comments
 (0)