punm parser
This commit is contained in:
30
tx.go
30
tx.go
@@ -48,6 +48,7 @@ type mevInfo struct {
|
||||
}
|
||||
|
||||
type Tx struct {
|
||||
rawTx *RawTx
|
||||
Signer solana.PublicKey
|
||||
Err interface{} `json:"err,omitempty"`
|
||||
Swaps []Swap `json:"swaps,omitempty"`
|
||||
@@ -65,20 +66,30 @@ type Tx struct {
|
||||
BeforeSolBalance decimal.Decimal `json:"-"`
|
||||
AfterSOLBalance decimal.Decimal `json:"after_sol_balance"`
|
||||
|
||||
Token []TokenMeta `gorm:"-"`
|
||||
// update tokenInfo
|
||||
Token map[solana.PublicKey]TokenMeta `gorm:"-"`
|
||||
|
||||
// todo pool info ??
|
||||
}
|
||||
|
||||
func (tx *Tx) SetRawTx(t *RawTx) {
|
||||
tx.rawTx = t
|
||||
}
|
||||
|
||||
func (tx *Tx) GetSignerTokenBalanceAfterTx(tokenProgram, tokenMint solana.PublicKey) decimal.Decimal {
|
||||
return GetTokenBalanceAfterTx(tx.rawTx, 0, tokenProgram, tokenMint)
|
||||
}
|
||||
|
||||
type TokenMeta struct {
|
||||
Address solana.PublicKey `json:"address"`
|
||||
Mint solana.PublicKey `json:"address"`
|
||||
TokenProgram solana.PublicKey `json:"token_program"`
|
||||
Decimals uint8 `json:"decimals"`
|
||||
|
||||
Name string
|
||||
Symbol string
|
||||
Decimal uint8
|
||||
Url string
|
||||
Name string
|
||||
Symbol string
|
||||
Url string
|
||||
|
||||
TotalSupply *decimal.Decimal
|
||||
SignerBalance *decimal.Decimal
|
||||
TotalSupply *decimal.Decimal
|
||||
}
|
||||
|
||||
func (tx *Tx) GetTxHash() string {
|
||||
@@ -92,8 +103,9 @@ func (tx *Tx) GetTxHash() string {
|
||||
return tx.cachedTxHash
|
||||
}
|
||||
|
||||
func (tx *Tx) CheckPlatform(swap Swap, rawTx *RawTx) (string, decimal.Decimal) {
|
||||
func (tx *Tx) CheckPlatform(swap Swap) (string, decimal.Decimal) {
|
||||
// hasSolProgramRaydiumLaunchLabBonk
|
||||
rawTx := tx.rawTx
|
||||
var platform string
|
||||
var platformFee decimal.Decimal
|
||||
if len(tx.Platform) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user