punm parser

This commit is contained in:
thloyi
2025-11-21 12:01:44 +08:00
parent a945f3b45d
commit f86c5591c1
13 changed files with 228 additions and 148 deletions

View File

@@ -74,8 +74,8 @@ func NewClientWithPumpSwap(endpoint string, ch chan SubscriptionMessage) *Client
subStatus: false,
subscription: &subscription,
}
c.handler = NewPumpHandler(func(tx *types.Tx, tx2 *types.RawTx) {
c.sendTx(tx, tx2)
c.handler = NewPumpHandler(func(tx *types.Tx) {
c.sendTx(tx)
})
return c
}
@@ -107,8 +107,8 @@ func NewClientWithLaunchLab(endpoint string, ch chan SubscriptionMessage) *Clien
subStatus: false,
subscription: &subscription,
}
c.handler = NewPumpHandler(func(tx *types.Tx, tx2 *types.RawTx) {
c.sendTx(tx, tx2)
c.handler = NewPumpHandler(func(tx *types.Tx) {
c.sendTx(tx)
})
return c
}
@@ -262,13 +262,12 @@ func (c *Client) computeDelay(slot uint64) int64 {
return delay
}
func (c *Client) sendTx(t *types.Tx, tx *types.RawTx) {
func (c *Client) sendTx(t *types.Tx) {
c.ch <- SubscriptionMessage{
Reconnect: c.firstMessage,
EstimateDelaySecond: c.computeDelay(tx.Slot),
EstimateDelaySecond: c.computeDelay(t.Block),
Block: nil,
Tx: t,
RawTx: tx,
}
c.firstMessage = false
}
@@ -287,8 +286,7 @@ func (c *Client) sendBlock(blockMeta *pb.SubscribeUpdateBlockMeta) {
BlockHash: c.leastBlock.BlockHash,
Height: c.leastBlock.Height,
},
Tx: nil,
RawTx: nil,
Tx: nil,
}
c.firstMessage = false
}