cu limit
This commit is contained in:
@@ -27,10 +27,11 @@ func budgetParser(tx *Tx, instr Instruction, _ InnerInstructions, offset [2]uint
|
||||
}
|
||||
}
|
||||
|
||||
func computeUnitLimitParser(offset [2]uint, _ *Tx, decodedData []byte) ([2]uint, error) {
|
||||
if len(decodedData) < 8 {
|
||||
func computeUnitLimitParser(offset [2]uint, tx *Tx, decodedData []byte) ([2]uint, error) {
|
||||
if len(decodedData) < 4 {
|
||||
return increaseOffset(offset), nil
|
||||
}
|
||||
tx.CuLimit = binary.BigEndian.Uint32(decodedData[:4])
|
||||
return increaseOffset(offset), nil
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ func (tx *Tx) Parser() error {
|
||||
tx.BlockAt = tx.rawTx.BlockTime
|
||||
tx.CuFee = decimal.NewFromUint64(tx.rawTx.Meta.Fee)
|
||||
|
||||
tx.ComputeUnitsConsumed = tx.rawTx.Meta.ComputeUnitsConsumed
|
||||
tx.BeforeSolBalance = decimal.NewFromUint64(tx.rawTx.Meta.PreBalances[0]).Div(decimal.NewFromInt(1e9))
|
||||
tx.AfterSOLBalance = decimal.NewFromUint64(tx.rawTx.Meta.PostBalances[0]).Div(decimal.NewFromInt(1e9))
|
||||
|
||||
|
||||
23
rawtx.go
23
rawtx.go
@@ -146,16 +146,17 @@ func (tb *TokenBalance) ParseAccount() {
|
||||
}
|
||||
|
||||
type Meta struct {
|
||||
Err interface{} `json:"err"`
|
||||
Fee uint64 `json:"fee"`
|
||||
InnerInstructions []InnerInstructions `json:"innerInstructions"`
|
||||
LoadedAddresses LoadedAddresses `json:"loadedAddresses"`
|
||||
LogMessages []string `json:"logMessages"`
|
||||
PostBalances []uint64 `json:"postBalances"`
|
||||
PostTokenBalances []TokenBalance `json:"postTokenBalances"`
|
||||
PreBalances []uint64 `json:"preBalances"`
|
||||
PreTokenBalances []TokenBalance `json:"preTokenBalances"`
|
||||
Rewards []interface{} `json:"rewards"`
|
||||
Err interface{} `json:"err"`
|
||||
Fee uint64 `json:"fee"`
|
||||
InnerInstructions []InnerInstructions `json:"innerInstructions"`
|
||||
LoadedAddresses LoadedAddresses `json:"loadedAddresses"`
|
||||
LogMessages []string `json:"logMessages"`
|
||||
PostBalances []uint64 `json:"postBalances"`
|
||||
PostTokenBalances []TokenBalance `json:"postTokenBalances"`
|
||||
PreBalances []uint64 `json:"preBalances"`
|
||||
PreTokenBalances []TokenBalance `json:"preTokenBalances"`
|
||||
Rewards []interface{} `json:"rewards"`
|
||||
ComputeUnitsConsumed uint64 `json:"computeUnitsConsumed"`
|
||||
}
|
||||
type Header struct {
|
||||
NumReadonlySignedAccounts int `json:"numReadonlySignedAccounts"`
|
||||
@@ -805,7 +806,7 @@ func ConvertYellowstoneGrpcTransactionToSolanaTransaction(y *pb.SubscribeUpdateT
|
||||
}
|
||||
sTx.Meta.Fee = meta.Fee
|
||||
//sTx.Meta.InnerInstructions = meta.InnerInstructions
|
||||
|
||||
sTx.Meta.ComputeUnitsConsumed = *meta.ComputeUnitsConsumed
|
||||
for _, innerInstr := range meta.InnerInstructions {
|
||||
var instrs []Instruction
|
||||
for _, instr := range innerInstr.Instructions {
|
||||
|
||||
5
tx.go
5
tx.go
@@ -47,6 +47,8 @@ type Swap struct {
|
||||
StartBinId int32
|
||||
EndBinId int32
|
||||
BinChanges []DlmmBinLiquidityChange
|
||||
|
||||
ConsumeUnit uint64
|
||||
}
|
||||
|
||||
type DlmmBinLiquidityChange struct {
|
||||
@@ -98,6 +100,9 @@ type Tx struct {
|
||||
// update tokenInfo
|
||||
Token map[solana.PublicKey]TokenMeta `gorm:"-"`
|
||||
|
||||
ComputeUnitsConsumed uint64 `json:"compute_units_consumed"`
|
||||
CuLimit uint32 `json:"cu_limit"`
|
||||
|
||||
// todo pool info ??
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user