Skip to content

Commit 444b317

Browse files
committed
fix pton straw
1 parent 30c460a commit 444b317

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

pkg/bath/straws.go

+20-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,24 @@ var DefaultStraws = []Merger{
7272
}
7373

7474
var JettonTransferPTONStraw = Straw[BubbleJettonTransfer]{
75-
CheckFuncs: []bubbleCheck{IsTx, HasInterface(abi.JettonWallet), HasOperation(abi.JettonTransferMsgOp)},
75+
CheckFuncs: []bubbleCheck{IsTx, HasInterface(abi.JettonWallet), HasOperation(abi.JettonTransferMsgOp), func(bubble *Bubble) bool {
76+
if len(bubble.Children) != 1 {
77+
return false
78+
}
79+
tx, ok := bubble.Children[0].Info.(BubbleTx)
80+
if !ok {
81+
return false
82+
}
83+
_, ok = tx.decodedBody.Value.(abi.JettonNotifyMsgBody)
84+
if !ok {
85+
_, ok = tx.decodedBody.Value.(abi.PtonTonTransferMsgBody)
86+
if !ok {
87+
return false
88+
}
89+
return true
90+
}
91+
return true
92+
}},
7693
Builder: func(newAction *BubbleJettonTransfer, bubble *Bubble) error {
7794
tx := bubble.Info.(BubbleTx)
7895
newAction.master, _ = tx.additionalInfo.JettonMaster(tx.account.Address)
@@ -86,9 +103,11 @@ var JettonTransferPTONStraw = Straw[BubbleJettonTransfer]{
86103
newAction.recipient = &Account{Address: *recipient}
87104
bubble.Accounts = append(bubble.Accounts, *recipient)
88105
}
106+
newAction.success = true
89107
return nil
90108
},
91109
SingleChild: &Straw[BubbleJettonTransfer]{
110+
Optional: true,
92111
CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.JettonNotifyMsgOp)},
93112
Builder: func(newAction *BubbleJettonTransfer, bubble *Bubble) error {
94113
tx := bubble.Info.(BubbleTx)

0 commit comments

Comments
 (0)