Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frank/fix attribute bug in txsender send #195

Merged
merged 3 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/driftpy/constants/spot_markets.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ class SpotMarketConfig:
oracle_source=OracleSource.Pyth(),
mint=Pubkey.from_string("3BZPwbcqB5kKScF3TEXxwNfx5ipV13kbRVDvfVp5c6fv"),
),
SpotMarketConfig(
symbol="PYUSD",
market_index=3,
oracle=Pubkey.from_string("HpMoKp3TCd3QT4MWYUKk2zCBwmhr5Df45fB6wdxYqEeh"),
oracle_source=OracleSource.PythPull(),
mint=Pubkey.from_string("GLfF72ZCUnS6N9iDJw8kedHzd6WFVf3VbpwdKKy76FRk"),
),
]

mainnet_spot_market_configs: list[SpotMarketConfig] = [
Expand Down
3 changes: 2 additions & 1 deletion src/driftpy/market_map/market_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,6 @@ async def load(self, filename: Optional[str] = None):
with open(filename, "rb") as f:
markets: list[PickledData] = pickle.load(f)
for market in markets:
data = self.program.coder.accounts.decode(decompress(market.data))
decompressed_data = decompress(market.data)
data = self.program.coder.accounts.decode(decompressed_data)
await self.add_market(data.market_index, DataAndSlot(slot, data))
2 changes: 1 addition & 1 deletion src/driftpy/tx/standard_tx_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async def send(self, tx: Union[Transaction, VersionedTransaction]) -> TxSigAndSl
if not isinstance(resp, SendTransactionResp):
raise Exception(f"Unexpected response from send transaction: {resp}")

sig = resp.result
sig = resp.value

sig_status = await self.connection.confirm_transaction(
sig, self.opts.preflight_commitment
Expand Down
3 changes: 2 additions & 1 deletion src/driftpy/user_map/user_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ async def load(self, filename: Optional[str] = None):
with open(filename, "rb") as f:
users: list[PickledData] = pickle.load(f)
for user in users:
data = decode_user(decompress(user.data))
decompressed_data = decompress(user.data)
data = decode_user(decompressed_data)
await self.add_pubkey(user.pubkey, DataAndSlot(slot, data))

def dump(self, filename: Optional[str] = None):
Expand Down
3 changes: 2 additions & 1 deletion src/driftpy/user_map/userstats_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ async def load(self, filename: Optional[str] = None):
with open(filename, "rb") as f:
user_stats: list[PickledData] = pickle.load(f)
for user_stat in user_stats:
data = decode_user_stat(decompress(user_stat.data))
decompressed_data = decompress(user_stat.data)
data = decode_user_stat(decompressed_data)
await self.add_user_stat(
Pubkey.from_string(str(user_stat.pubkey)), DataAndSlot(slot, data)
)
Expand Down
2 changes: 1 addition & 1 deletion tests/ci/devnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def test_devnet_cached(rpc_url: str):
print(f"1. Got: {len(spot_markets)}")
assert len(spot_markets) == len(
devnet_spot_market_configs
), f"Expected {len(devnet_perp_market_configs)} spot markets, got {len(spot_markets)}"
), f"Expected {len(devnet_spot_market_configs)} spot markets, got {len(spot_markets)}"

await drift_client.account_subscriber.update_cache()

Expand Down
Loading