Skip to content

Commit

Permalink
frank/0.7.37 (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
soundsonacid authored Mar 11, 2024
1 parent a3d735a commit eba2d9a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.7.36
current_version = 0.7.37
commit = True
tag = True
tag_name = {new_version}
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,8 @@ Fix bug in `MarketMap` where a subscription would not be properly established

## [0.7.36] - 2024-3-8

Add support for prelisting oracles
Add support for prelisting oracles

## [0.7.37] - 2024-3-11

Fix bug where prelisting & switchboard oracles weren't properly decoded for cached drift client subscriptions
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 = "driftpy"
version = "0.7.36"
version = "0.7.37"
description = "A Python client for the Drift DEX"
authors = ["x19 <https://twitter.com/[email protected]>", "bigz <https://twitter.com/bigz_pubkey>", "frank <https://twitter.com/soundsonacid>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/driftpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.36"
__version__ = "0.7.37"
14 changes: 14 additions & 0 deletions src/driftpy/accounts/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ async def get_oracle_price_data_and_slot(
return DataAndSlot(
data=OraclePriceData(PRICE_PRECISION, 0, 1, 1, 0, True), slot=0
)
elif is_variant(oracle_source, "Switchboard"):
rpc_reponse = await connection.get_account_info(address)
rpc_response_slot = rpc_reponse.context.slot

oracle_price_data = decode_swb_price_info(rpc_reponse.value.data)

return DataAndSlot(data=oracle_price_data, slot=rpc_response_slot)
elif is_variant(oracle_source, "Prelaunch"):
rpc_reponse = await connection.get_account_info(address)
rpc_response_slot = rpc_reponse.context.slot

oracle_price_data = decode_prelaunch_price_info(rpc_reponse.value.data)

return DataAndSlot(data=oracle_price_data, slot=rpc_response_slot)
else:
raise NotImplementedError("Unsupported Oracle Source", str(oracle_source))

Expand Down

0 comments on commit eba2d9a

Please sign in to comment.