wip get ballances
This commit is contained in:
parent
8c83ea6c87
commit
02c1ee7ed4
@ -14,8 +14,7 @@ from solana.rpc.websocket_api import connect
|
||||
from solana.rpc.async_api import AsyncClient
|
||||
from solana.rpc.commitment import Confirmed
|
||||
from solana.rpc.types import TokenAccountOpts
|
||||
|
||||
|
||||
import base64
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
@ -75,12 +74,14 @@ async def get_token_balance(wallet_address, token_address):
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
async def get_wallet_balances(wallet_address):
|
||||
balances = {}
|
||||
logging.info(f"Getting balances for wallet: {wallet_address}")
|
||||
|
||||
opts = TokenAccountOpts(
|
||||
program_id=Pubkey.from_string("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")
|
||||
program_id=Pubkey.from_string("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
|
||||
encoding="jsonParsed" # Ensure encoding is set to jsonParsed
|
||||
)
|
||||
|
||||
# Get all token accounts for the wallet
|
||||
@ -105,6 +106,7 @@ async def get_wallet_balances(wallet_address):
|
||||
|
||||
return balances
|
||||
|
||||
|
||||
async def get_non_zero_token_balances(wallet_address):
|
||||
non_zero_balances = {}
|
||||
logging.info(f"Getting non-zero balances for wallet: {wallet_address}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user