8000 How to add variants to Enum Decoder ? · Issue #401 · anza-xyz/kit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

How to add variants to Enum Decoder ? #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Efcolipt opened this issue Apr 20, 2025 · 5 comments
Closed

How to add variants to Enum Decoder ? #401

Efcolipt opened this issue Apr 20, 2025 · 5 comments
Labels
question Add this to close an issue with instructions on how to repost as a question on Stack Exchange

Comments

@Efcolipt
Copy link
Efcolipt commented Apr 20, 2025

I have CurveType in meteora Damm

{
      "name": "CurveType",
      "docs": [
        "Type of the swap curve"
      ],
      "type": {
        "kind": "enum",
        "variants": [
          {
            "name": "ConstantProduct"
          },
          {
            "name": "Stable",
            "fields": [
              {
                "name": "amp",
                "docs": [
                  "Amplification coefficient"
                ],
                "type": "u64"
              },
              {
                "name": "token_multiplier",
                "docs": [
                  "Multiplier for the pool token. Used to normalized token with different decimal into the same precision."
                ],
                "type": {
                  "defined": "TokenMultiplier"
                }
              },
              {
                "name": "depeg",
                "docs": [
                  "Depeg pool information. Contains functions to allow token amount to be repeg using stake / interest bearing token virtual price"
                ],
                "type": {
                  "defined": "Depeg"
                }
              },
              {
                "name": "last_amp_updated_timestamp",
                "docs": [
                  "The last amp updated timestamp. Used to prevent update_curve_info called infinitely many times within a short period"
                ],
                "type": "u64"
              }
            ]
          }
        ]
      }
    },

And i want to add to my decoder last enum property, but enum decoder accept only number, string types

@lorisleiva
Copy link
Member

Hi there, I'm not sure that your question belongs to this repository since it involves an Anchor IDL.

@lorisleiva lorisleiva added the question Add this to close an issue with instructions on how to repost as a question on Stack Exchange label Apr 25, 2025
Copy link
Contributor

Hi @Efcolipt,

Thanks for your question!

We want to make sure to keep signal strong in the GitHub issue tracker – to make sure that it remains the best place to track issues that affect the development of the Solana JavaScript SDK itself.

Questions like yours deserve a purpose-built Q&A forum. Unless there exists evidence that this is a bug with the Solana JavaScript SDK itself, please post your question to the Solana Stack Exchange using this link: https://solana.stackexchange.com/questions/ask


This automated message is a result of having added the ‘question’ tag.

@Efcolipt
Copy link
Author
Efcolipt commented Apr 25, 2025

@lorisleiva wait, borsh anchor accept enum with fields, your enum accept only string, num
getEnumDecoder

@lorisleiva
Copy link
Member

That's because what you need is getDiscriminatedUnion.

Copy link
Contributor
github-actions bot commented May 5, 2025

Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Add this to close an issue with instructions on how to repost as a question on Stack Exchange
Projects
None yet
Development

No branches or pull requests

2 participants
0