Skip to content

Commit 5844af5

Browse files
committed
Add missing response parser, default timeout height = 50 to chain examples
1 parent c25c029 commit 5844af5

18 files changed

+39
-18
lines changed

examples/chain_client_examples/10_ExchangeMsgBatchCancelDerivativeOrders.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ async def main() -> None:
8787
amount=gas_price * gas_limit,
8888
denom=network.fee_denom,
8989
)]
90-
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(0)
90+
current_height = client.get_latest_block().block.header.height
91+
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(current_height+50)
9192
sign_doc = tx.get_sign_doc(pub_key)
9293
sig = priv_key.sign(sign_doc.SerializeToString())
9394
tx_raw_bytes = tx.get_tx_data(sig, pub_key)

examples/chain_client_examples/11_ExchangeMsgBatchCreateSpotLimitOrders.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ async def main() -> None:
9595
amount=gas_price * gas_limit,
9696
denom=network.fee_denom,
9797
)]
98-
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(0)
98+
current_height = client.get_latest_block().block.header.height
99+
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(current_height+50)
99100
sign_doc = tx.get_sign_doc(pub_key)
100101
sig = priv_key.sign(sign_doc.SerializeToString())
101102
tx_raw_bytes = tx.get_tx_data(sig, pub_key)

examples/chain_client_examples/12_ExchangeMsgBatchCreateDerivativeLimitOrders.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ async def main() -> None:
9797
amount=gas_price * gas_limit,
9898
denom=network.fee_denom,
9999
)]
100-
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(0)
100+
current_height = client.get_latest_block().block.header.height
101+
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(current_height+50)
101102
sign_doc = tx.get_sign_doc(pub_key)
102103
sig = priv_key.sign(sign_doc.SerializeToString())
103104
tx_raw_bytes = tx.get_tx_data(sig, pub_key)

examples/chain_client_examples/13_ExchangeMsgIncreasePositionMargin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ async def main() -> None:
7474
amount=gas_price * gas_limit,
7575
denom=network.fee_denom,
7676
)]
77-
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(0)
77+
current_height = client.get_latest_block().block.header.height
78+
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(current_height+50)
7879
sign_doc = tx.get_sign_doc(pub_key)
7980
sig = priv_key.sign(sign_doc.SerializeToString())
8081
tx_raw_bytes = tx.get_tx_data(sig, pub_key)

examples/chain_client_examples/14_ExchangeMsgLiquidatePosition.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ async def main() -> None:
7676
amount=gas_price * gas_limit,
7777
denom=network.fee_denom,
7878
)]
79-
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(0)
79+
current_height = client.get_latest_block().block.header.height
80+
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(current_height+50)
8081
sign_doc = tx.get_sign_doc(pub_key)
8182
sig = priv_key.sign(sign_doc.SerializeToString())
8283
tx_raw_bytes = tx.get_tx_data(sig, pub_key)

examples/chain_client_examples/15_ExchangeMsgWithdraw.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ async def main() -> None:
7070
amount=gas_price * gas_limit,
7171
denom=network.fee_denom,
7272
)]
73-
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(0)
73+
current_height = client.get_latest_block().block.header.height
74+
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(current_height+50)
7475
sign_doc = tx.get_sign_doc(pub_key)
7576
sig = priv_key.sign(sign_doc.SerializeToString())
7677
tx_raw_bytes = tx.get_tx_data(sig, pub_key)

examples/chain_client_examples/16_ExchangeMsgSubaccountTransfer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ async def main() -> None:
7272
amount=gas_price * gas_limit,
7373
denom=network.fee_denom,
7474
)]
75-
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(0)
75+
current_height = client.get_latest_block().block.header.height
76+
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(current_height+50)
7677
sign_doc = tx.get_sign_doc(pub_key)
7778
sig = priv_key.sign(sign_doc.SerializeToString())
7879
tx_raw_bytes = tx.get_tx_data(sig, pub_key)

examples/chain_client_examples/17_ExchangeMultipleMsgs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ async def main() -> None:
114114
amount=gas_price * gas_limit,
115115
denom=network.fee_denom,
116116
)]
117-
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(0)
117+
current_height = client.get_latest_block().block.header.height
118+
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(current_height+50)
118119
sign_doc = tx.get_sign_doc(pub_key)
119120
sig = priv_key.sign(sign_doc.SerializeToString())
120121
tx_raw_bytes = tx.get_tx_data(sig, pub_key)

examples/chain_client_examples/1_CosmosBankMsgSend.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ async def main() -> None:
6969
amount=gas_price * gas_limit,
7070
denom=network.fee_denom,
7171
)]
72-
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(0)
72+
current_height = client.get_latest_block().block.header.height
73+
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(current_height+50)
7374
sign_doc = tx.get_sign_doc(pub_key)
7475
sig = priv_key.sign(sign_doc.SerializeToString())
7576
tx_raw_bytes = tx.get_tx_data(sig, pub_key)

examples/chain_client_examples/2_ExchangeMsgDeposit.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ async def main() -> None:
7070
amount=gas_price * gas_limit,
7171
denom=network.fee_denom,
7272
)]
73-
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(0)
73+
current_height = client.get_latest_block().block.header.height
74+
tx = tx.with_gas(gas_limit).with_fee(fee).with_memo("").with_timeout_height(current_height+50)
7475
sign_doc = tx.get_sign_doc(pub_key)
7576
sig = priv_key.sign(sign_doc.SerializeToString())
7677
tx_raw_bytes = tx.get_tx_data(sig, pub_key)

0 commit comments

Comments
 (0)