From d2ddd5f95e0019d6ec770e940bd453a1a3375d51 Mon Sep 17 00:00:00 2001 From: soundsonacid Date: Fri, 26 Jul 2024 09:28:47 -0500 Subject: [PATCH 1/3] fix attribute bug in txsender send --- src/driftpy/tx/standard_tx_sender.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/driftpy/tx/standard_tx_sender.py b/src/driftpy/tx/standard_tx_sender.py index b3776a0a..d2b5486a 100644 --- a/src/driftpy/tx/standard_tx_sender.py +++ b/src/driftpy/tx/standard_tx_sender.py @@ -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 From 17cbbeb23e43c76c0fcfe374ade7317adde2a272 Mon Sep 17 00:00:00 2001 From: soundsonacid Date: Fri, 26 Jul 2024 10:04:16 -0500 Subject: [PATCH 2/3] add PYUSD devnet spot market constant --- src/driftpy/constants/spot_markets.py | 7 +++++++ tests/ci/devnet.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/driftpy/constants/spot_markets.py b/src/driftpy/constants/spot_markets.py index 2f3a75e8..2caef04c 100644 --- a/src/driftpy/constants/spot_markets.py +++ b/src/driftpy/constants/spot_markets.py @@ -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] = [ diff --git a/tests/ci/devnet.py b/tests/ci/devnet.py index 469e49c8..475e0162 100644 --- a/tests/ci/devnet.py +++ b/tests/ci/devnet.py @@ -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() From 69deb9ac8c6c6f3dc22bfd5cf0e43cb5a0f75d96 Mon Sep 17 00:00:00 2001 From: soundsonacid Date: Fri, 26 Jul 2024 10:05:42 -0500 Subject: [PATCH 3/3] split up decompress for visibility --- src/driftpy/market_map/market_map.py | 3 ++- src/driftpy/user_map/user_map.py | 3 ++- src/driftpy/user_map/userstats_map.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/driftpy/market_map/market_map.py b/src/driftpy/market_map/market_map.py index 2ef9f5da..c78a7043 100644 --- a/src/driftpy/market_map/market_map.py +++ b/src/driftpy/market_map/market_map.py @@ -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)) diff --git a/src/driftpy/user_map/user_map.py b/src/driftpy/user_map/user_map.py index f10d8cd7..2080822b 100644 --- a/src/driftpy/user_map/user_map.py +++ b/src/driftpy/user_map/user_map.py @@ -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): diff --git a/src/driftpy/user_map/userstats_map.py b/src/driftpy/user_map/userstats_map.py index 686eb820..17ae9174 100644 --- a/src/driftpy/user_map/userstats_map.py +++ b/src/driftpy/user_map/userstats_map.py @@ -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) )