Skip to content

Commit 742e79d

Browse files
v14.1.7 (#38)
1 parent 60edae1 commit 742e79d

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

.coverage

0 Bytes
Binary file not shown.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "sakit"
3-
version = "14.1.6"
3+
version = "14.1.7"
44
description = "Solana Agent Kit"
55
authors = ["Bevan Hunt <bevan@bevanhunt.com>"]
66
license = "MIT"

sakit/privy_transfer.py

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -80,32 +80,39 @@ async def get_privy_embedded_wallet( # pragma: no cover
8080
"""
8181
try:
8282
user = await privy_client.users.get(user_id)
83-
data = user.model_dump() if hasattr(user, "model_dump") else user.__dict__
83+
linked_accounts = user.linked_accounts or []
8484

8585
# First, try to find embedded wallet with delegation
86-
for acct in data.get("linked_accounts", []):
87-
if acct.get("connector_type") == "embedded" and acct.get("delegated"):
88-
wallet_id = acct.get("id")
89-
# Use 'address' field if 'public_key' is null (common for API-created wallets)
90-
address = acct.get("address") or acct.get("public_key")
86+
for acct in linked_accounts:
87+
if getattr(acct, "connector_type", None) == "embedded" and getattr(
88+
acct, "delegated", False
89+
):
90+
wallet_id = getattr(acct, "id", None)
91+
address = getattr(acct, "address", None) or getattr(
92+
acct, "public_key", None
93+
)
9194
if wallet_id and address:
9295
return {"wallet_id": wallet_id, "public_key": address}
9396

9497
# Then, try to find bot-first wallet (API-created via privy_create_wallet)
95-
# These have type == "wallet" and include chain_type
96-
for acct in data.get("linked_accounts", []):
97-
acct_type = acct.get("type", "")
98-
# Check for Solana embedded wallets created via API
99-
if acct_type == "wallet" and acct.get("chain_type") == "solana":
100-
wallet_id = acct.get("id")
101-
# API wallets use "address" field, SDK wallets use "public_key"
102-
address = acct.get("address") or acct.get("public_key")
98+
for acct in linked_accounts:
99+
acct_type = getattr(acct, "type", "")
100+
if acct_type == "wallet" and getattr(acct, "chain_type", None) == "solana":
101+
wallet_id = getattr(acct, "id", None)
102+
address = getattr(acct, "address", None) or getattr(
103+
acct, "public_key", None
104+
)
103105
if wallet_id and address:
104106
return {"wallet_id": wallet_id, "public_key": address}
105-
# Also check for solana_embedded_wallet type
106-
if "solana" in acct_type.lower() and "embedded" in acct_type.lower():
107-
wallet_id = acct.get("id")
108-
address = acct.get("address") or acct.get("public_key")
107+
if (
108+
acct_type
109+
and "solana" in acct_type.lower()
110+
and "embedded" in acct_type.lower()
111+
):
112+
wallet_id = getattr(acct, "id", None)
113+
address = getattr(acct, "address", None) or getattr(
114+
acct, "public_key", None
115+
)
109116
if wallet_id and address:
110117
return {"wallet_id": wallet_id, "public_key": address}
111118

0 commit comments

Comments
 (0)