Skip to content

Commit

Permalink
Merge pull request #33 from scrtlabs/main
Browse files Browse the repository at this point in the history
Make some changes to support SN v1.15 after November 14th upgrade
  • Loading branch information
zackgow authored Nov 16, 2024
2 parents ce00e2c + ab549c6 commit 9fc41dd
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 35 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ license = "MIT"
packages = [{ include = "secret_sdk" }]
readme = "README.md"
repository = "https://github.com/stephanegg/secret-sdk-python"
version = "1.8.0"
version = "1.8.1"

[tool.poetry.dependencies]
aiohttp = "^3.7.3"
Expand Down
1 change: 1 addition & 0 deletions secret_sdk/client/lcd/api/tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ async def broadcast_adapter(self, tx: Tx, mode: BroadcastMode, options: Broadcas
broadcast_result = None
tx_encoded = await super()._try_await(self.encode(tx))
if mode == BroadcastMode.BROADCAST_MODE_BLOCK:
raise Exception("BROADCAST_MODE_BLOCK is deprecated. Please use BROADCAST_MODE_SYNC instead")
broadcast_result = await BaseAsyncAPI._try_await(self.broadcast(tx_encoded, options))
if mode == BroadcastMode.BROADCAST_MODE_ASYNC:
broadcast_result = await BaseAsyncAPI._try_await(self.broadcast_async(tx_encoded, options))
Expand Down
4 changes: 2 additions & 2 deletions secret_sdk/client/lcd/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ async def create_and_broadcast_tx(
create_tx_options.fee = fee

signed_tx = await self.create_and_sign_tx(create_tx_options)
broadcast_mode = broadcast_mode if broadcast_mode else BroadcastMode.BROADCAST_MODE_BLOCK
broadcast_mode = broadcast_mode if broadcast_mode else BroadcastMode.BROADCAST_MODE_SYNC
tx = await self.lcd.tx.broadcast_adapter(signed_tx, mode=broadcast_mode)
return tx

Expand Down Expand Up @@ -378,7 +378,7 @@ def create_and_broadcast_tx(
create_tx_options.fee = fee

signed_tx = self.create_and_sign_tx(create_tx_options)
broadcast_mode = broadcast_mode if broadcast_mode else BroadcastMode.BROADCAST_MODE_BLOCK
broadcast_mode = broadcast_mode if broadcast_mode else BroadcastMode.BROADCAST_MODE_SYNC
tx = self.lcd.tx.broadcast_adapter(signed_tx, mode=broadcast_mode)
return tx

3 changes: 1 addition & 2 deletions secret_sdk/core/wasm/msgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def to_amino(self) -> dict:
def from_data(cls, data: dict) -> MsgStoreCode:
return cls(
sender=data["sender"],
wasm_byte_code=data["wasm_byte_code"],
wasm_byte_code=base64.b64decode(data["wasm_byte_code"]),
source=data.get("source"),
builder=data.get("builder")
)
Expand Down Expand Up @@ -249,7 +249,6 @@ def to_proto(self) -> MsgExecuteContract_pb:

return MsgExecuteContract_pb(
sender=address_to_bytes(self.sender),
sender_address=self.sender,
contract=address_to_bytes(self.contract),
msg=self.msg_encrypted,
sent_funds=self.sent_funds.to_proto(),
Expand Down
21 changes: 3 additions & 18 deletions secret_sdk/protobuf/secret/compute/v1beta1/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 1 addition & 11 deletions secret_sdk/protobuf/secret/registration/v1beta1/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion secret_sdk/util/tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,17 @@ def get_value_from_raw_log(
for a in e['attributes']:
if f'{e["type"]}.{a["key"]}' == key:
return str(a['value'])
return ''
return ''

def get_value_from_events(
events: str,
key: str,
):
if not events:
return ''

for e in events:
for a in e['attributes']:
if f'{e["type"]}.{a["key"]}' == key:
return str(a['value'])
return ''

0 comments on commit 9fc41dd

Please sign in to comment.