franco-bianco / solanaswap-go

31 stars 2 forks source link

Failed to parse Raydium AMM #3

Closed Lebyy closed 1 month ago

Lebyy commented 1 month ago

Hello!

My transaction with signature: 51nj5GtAmDC23QkeyfCNfTJ6Pdgwx7eq4BARfq1sMmeEaPeLsx9stFA3Dzt9MeLV5xFujBgvghLGcayC3ZevaQYi, is not being correctly parsed by this program.

The output I get is:

null
{
  "Signers": [
    "2cuQnU6tbA8auRmjJTj8JqNvRnG7PNAYMJXZqiPqRwwU"
  ],
  "Signatures": [
    "51nj5GtAmDC23QkeyfCNfTJ6Pdgwx7eq4BARfq1sMmeEaPeLsx9stFA3Dzt9MeLV5xFujBgvghLGcayC3ZevaQYi"
  ],
  "AMMs": null,
  "Timestamp": "0001-01-01T00:00:00Z",
  "TokenInMint": "11111111111111111111111111111111",
  "TokenInAmount": 0,
  "TokenInDecimals": 0,
  "TokenOutMint": "11111111111111111111111111111111",
  "TokenOutAmount": 0,
  "TokenOutDecimals": 0
}

I tested with the Raydium transaction signature you had provided as comments in the code which parsed correctly, but my signature is not being parsed correctly.

Thanks.

franco-bianco commented 1 month ago

Hi,

Thanks for opening the issue. I realised that handling for Raydium Routing Program wasn't included. I've just fixed it and it works now:

[
  {
    "Type": "Raydium",
    "Data": {
      "info": {
        "authority": "2cuQnU6tbA8auRmjJTj8JqNvRnG7PNAYMJXZqiPqRwwU",
        "destination": "Gn7ZGtdFZzPRR2wogi6a33o31Dp2aPaVTL6CdgoYYD98",
        "mint": "So11111111111111111111111111111111111111112",
        "source": "42yp2ZnAoqLitfvXKQWJ2KRCE5yVky7vBndugL8y7NF3",
        "tokenAmount": {
          "amount": "20000000",
          "decimals": 9,
          "uiAmount": 0.02,
          "uiAmountString": "0.02"
        }
      },
      "type": "transferChecked"
    }
  },
  {
    "Type": "Raydium",
    "Data": {
      "info": {
        "authority": "GpMZbSM2GgvTKHJirzeGfMFoaZ8UR2X7F4v8vHTvxFbL",
        "destination": "4EHZFwbbVsHzsCN2QxoKgrqSHr41z5LCYxGhMeZ9mdXo",
        "mint": "7atgF8KQo4wJrD5ATGX7t1V2zVvykPJbFfNeVf1icFv1",
        "source": "f2YzFdR5MhdqdQRN8F8tWLSabD8LuRUoFGJTgnKMJ9h",
        "tokenAmount": {
          "amount": "390793006",
          "decimals": 2,
          "uiAmount": 3907930.06,
          "uiAmountString": "3907930.06"
        }
      },
      "type": "transferChecked"
    }
  }
]
{
  "Signers": [
    "2cuQnU6tbA8auRmjJTj8JqNvRnG7PNAYMJXZqiPqRwwU"
  ],
  "Signatures": [
    "51nj5GtAmDC23QkeyfCNfTJ6Pdgwx7eq4BARfq1sMmeEaPeLsx9stFA3Dzt9MeLV5xFujBgvghLGcayC3ZevaQYi"
  ],
  "AMMs": [
    "Raydium",
    "Raydium"
  ],
  "Timestamp": "0001-01-01T00:00:00Z",
  "TokenInMint": "So11111111111111111111111111111111111111112",
  "TokenInAmount": 20000000,
  "TokenInDecimals": 9,
  "TokenOutMint": "7atgF8KQo4wJrD5ATGX7t1V2zVvykPJbFfNeVf1icFv1",
  "TokenOutAmount": 390793006,
  "TokenOutDecimals": 2
}
Lebyy commented 1 month ago

Woah crazy fast response! Really loving this library thank you so much

Lebyy commented 1 month ago

I have plans to migrate this to typescript will let you know when I start the project