You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to search for all tokens under a Sol account,
View all ATA accounts under the account
I need to check the balance of all tokens under my account.
This example seems to be ineffective:
package main
import (
"context"
"github.com/davecgh/go-spew/spew"
bin "github.com/gagliardetto/binary"
"github.com/gagliardetto/solana-go"
"github.com/gagliardetto/solana-go/programs/token"
"github.com/gagliardetto/solana-go/rpc"
)
How to search for all tokens under a Sol account,
View all ATA accounts under the account
I need to check the balance of all tokens under my account.
This example seems to be ineffective:
package main
import (
"context"
"github.com/davecgh/go-spew/spew"
bin "github.com/gagliardetto/binary"
"github.com/gagliardetto/solana-go"
"github.com/gagliardetto/solana-go/programs/token"
"github.com/gagliardetto/solana-go/rpc"
)
func main() {
endpoint := rpc.TestNet_RPC
client := rpc.New(endpoint)
pubKey := solana.MustPublicKeyFromBase58("7HZaCWazgTuuFuajxaaxGYbGnyVKwxvsJKue1W4Nvyro")
out, err := client.GetTokenAccountsByOwner(
context.TODO(),
pubKey,
&rpc.GetTokenAccountsConfig{
Mint: solana.WrappedSol.ToPointer(),
},
&rpc.GetTokenAccountsOpts{
Encoding: solana.EncodingBase64Zstd,
},
)
if err != nil {
panic(err)
}
spew.Dump(out)
{
tokenAccounts := make([]token.Account, 0)
for _, rawAccount := range out.Value {
var tokAcc token.Account
}
}
The text was updated successfully, but these errors were encountered: