Skip to content
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

How to derive PDAs using this solana-go ? #162

Open
aravinddojima opened this issue Nov 1, 2023 · 1 comment
Open

How to derive PDAs using this solana-go ? #162

aravinddojima opened this issue Nov 1, 2023 · 1 comment

Comments

@aravinddojima
Copy link

Is there any way to derive PDAs using this package ?

@0xvbetsun
Copy link

0xvbetsun commented Nov 6, 2023

@aravinddojima
you can find PDA in the next way (authority for Raydium):

package main

import (
    "fmt"

    "github.com/gagliardetto/solana-go"
)

func main() {
  seed := [][]byte{[]byte("amm authority")}
  programID := solana.MustPublicKeyFromBase58("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8")

  addr, nonce, err := solana.FindProgramAddress(seed, programID)
  if err != nil {
	  // handle error somehow
  }
  fmt.Printf("addr: %s nonce: %d \n", addr, nonce)
}
// Prints 
// addr: 5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1 nonce: 254 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants