gagliardetto / solana-go

Go SDK library and RPC client for the Solana Blockchain
Apache License 2.0
930 stars 264 forks source link

Invalid param: unrecognized Token program id #148

Open yangyile1990 opened 1 year ago

yangyile1990 commented 1 year ago

pubKey, err := solana.PublicKeyFromBase58(addr) if err != nil { return decimal.Zero, "", cerror.NewError(cerror.CODE_ADDR_ERROR, err.Error()) } out, err := s.client.GetTokenAccountsByDelegate( context.TODO(), pubKey, &rpc.GetTokenAccountsConfig{ //Mint: solana.MustPublicKeyFromBase58(contract).ToPointer(), ProgramId: solana.MustPublicKeyFromBase58("9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP").ToPointer(), }, &rpc.GetTokenAccountsOpts{ Commitment: rpc.CommitmentFinalized, }, ) if err != nil { return decimal.Zero, "", cerror.NewError(cerror.CODE_THIRD_REQ_ERROR, err.Error()) } fmt.Println(out)

what's the correct program id of usdt and usdc?

0xvbetsun commented 1 year ago

Your program ID is totally correct, it's the address of Orca Token Swap V2. There are no program IDs for USDC or USDT. You may be interested in pools idk. There are pool addresses: SOL-USDC - EGZ7tiLeH62TPV1gL8WwbXGzEPa9zmcpVnnkPKKnrE2U SOL-USDT - Dqk7mHQBx2ZWExmyrR2S8X6UG75CrbbpK2FSBZsNYsw6 USDC-USDT - F13xvvx45jVGd84ynK3c8T89UejQVxjCLtmHfPmAXAHP