Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fragments_nft_purchase'
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-tron committed Sep 5, 2024
2 parents 939c737 + c0802fb commit 122817a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
20 changes: 20 additions & 0 deletions pkg/bath/auctions.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,23 @@ var StrawAuctionBuyGetgems = Straw[BubbleNftPurchase]{
CheckFuncs: []bubbleCheck{IsNftTransfer},
},
}

var StrawAuctionBuyFragments = Straw[BubbleNftPurchase]{
CheckFuncs: []bubbleCheck{Is(AuctionBidBubble{})},
Builder: func(newAction *BubbleNftPurchase, bubble *Bubble) error {
bid := bubble.Info.(AuctionBidBubble)
newAction.Buyer = bid.Bidder
newAction.Nft = *bid.NftAddress
newAction.Price = bid.Amount
newAction.AuctionType = bid.Type
newAction.Success = bid.Success
return nil
},
SingleChild: &Straw[BubbleNftPurchase]{
CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.NftOwnershipAssignedMsgOp)},
Builder: func(newAction *BubbleNftPurchase, bubble *Bubble) error {
newAction.Seller = parseAccount(bubble.Info.(BubbleTx).decodedBody.Value.(abi.NftOwnershipAssignedMsgBody).PrevOwner).Address
return nil
},
},
}
3 changes: 2 additions & 1 deletion pkg/bath/straws.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var SubscriptionStraws = []Merger{
}

var DefaultStraws = []Merger{
StrawFindAuctionBidFragmentSimple,
NftTransferStraw,
NftTransferNotifyStraw,
JettonTransferPTONStraw,
Expand All @@ -48,9 +49,9 @@ var DefaultStraws = []Merger{
DedustSwapToTONStraw,
DedustSwapFromTONStraw,
TgAuctionV1InitialBidStraw,
StrawFindAuctionBidFragmentSimple,
StrawAuctionBigGetgems,
StrawAuctionBuyGetgems,
StrawAuctionBuyFragments,
DedustLPJettonMintStraw,
JettonMintStrawGovernance,
MegatonFiJettonSwap,
Expand Down
2 changes: 1 addition & 1 deletion pkg/bath/testdata/buy-nft-on-fragment.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"NftPurchase": {
"Nft": "0:62abd9cb04accd71441a61ceb6d48d62c3323f4aa2aed89caf3e3ffaff6c9829",
"Buyer": "0:d8cd999fb2b1b384e6ca254c3883375e23111a8b78c015b886286c31bf11e29d",
"Seller": "0:0000000000000000000000000000000000000000000000000000000000000000",
"Seller": "0:6e9ae2fdb2c10e52b6711a64e0798e6a6c7187d42c1e1fbfdb2b2e9d1173e0c1",
"AuctionType": "DNS.tg",
"Price": 4500000000000
},
Expand Down

0 comments on commit 122817a

Please sign in to comment.