Skip to content

Commit

Permalink
fix: get_token_accounts_by_owner args, add: repr to some objects
Browse files Browse the repository at this point in the history
  • Loading branch information
GitBolt committed Jan 25, 2024
1 parent 0498c6f commit 163e233
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "solathon"
version = "0.1.7"
version = "0.1.8"
description = "High performance, easy to use and feature-rich Solana SDK for Python."
license = "MIT"
authors = ["GitBolt"]
Expand Down
2 changes: 1 addition & 1 deletion solathon/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.1.7"
__version__ = "0.1.8"

from .client import Client
from .async_client import AsyncClient
Expand Down
6 changes: 4 additions & 2 deletions solathon/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,10 @@ def get_token_accounts_by_owner(
[
str(public_key),
{"mint": mint_id} if mint_id else {"programId": program_id},
{"encoding": encoding},
commitment
{
"encoding": encoding,
"commitment": commitment
},
],
)
if self.clean_response:
Expand Down
9 changes: 9 additions & 0 deletions solathon/core/types/account_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class AccountInfoType(TypedDict):
size: Union[int, None]
data: Union[str, dict[str, Any]]

def __repr__(self) -> str:
return f"AccountInfoType(owner={self.owner!r})"

class AccountInfo():
'''
Convert Account Information JSON to Class
Expand All @@ -23,6 +26,9 @@ def __init__(self, result: AccountInfoType) -> None:
self.size = result.get('size', None)
self.data = result['data']

def __repr__(self) -> str:
return f"AccountInfo(owner={self.owner!r})"

class ProgramAccountType(TypedDict):
'''
JSON Response type of Program Account Information received by RPC
Expand All @@ -37,3 +43,6 @@ class ProgramAccount:
def __init__(self, result: ProgramAccountType) -> None:
self.pubkey = result['pubkey']
self.account = AccountInfo(result['account'])

def __repr__(self) -> str:
return f"ProgramAccount(pubkey={self.pubkey!r})"

0 comments on commit 163e233

Please sign in to comment.