1- # Copyright 2022 Injective Labs
2- #
3- # Licensed under the Apache License, Version 2.0 (the "License");
4- # you may not use this file except in compliance with the License.
5- # You may obtain a copy of the License at
6- #
7- # http://www.apache.org/licenses/LICENSE-2.0
8- #
9- # Unless required by applicable law or agreed to in writing, software
10- # distributed under the License is distributed on an "AS IS" BASIS,
11- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12- # See the License for the specific language governing permissions and
13- # limitations under the License.
14-
151import asyncio
162import logging
173
@@ -34,22 +20,20 @@ async def main() -> None:
3420 # load account
3521 priv_key = PrivateKey .from_hex ("f9db9bf330e23cb7839039e944adef6e9df447b90b503d5b4464c90bea9022f3" )
3622 pub_key = priv_key .to_public_key ()
37- address = await pub_key .to_address ().async_init_num_seq (network .lcd_endpoint )
23+ address = pub_key .to_address ()
24+ account = await client .get_account (address .to_acc_bech32 ())
3825 subaccount_id = address .get_subaccount_id (index = 0 )
3926
4027 # prepare trade info
4128 fee_recipient = "inj1hkhdaj2a2clmq5jq6mspsggqs32vynpk228q3r"
4229
43- derivative_market_id_create = "0x4ca0f92fc28be0c9761326016b5a1a2177dd6375558365116b5bdda9abc229ce"
44- spot_market_id_create = "0xa508cb32923323679f29a032c70342c147c17d0145625922b0ef22e955c844c0"
45-
46- derivative_market_id_cancel = "0x1f73e21972972c69c03fb105a5864592ac2b47996ffea3c500d1ea2d20138717"
47- derivative_market_id_cancel_2 = "0x8158e603fb80c4e417696b0e98765b4ca89dcf886d3b9b2b90dc15bfb1aebd51"
48- spot_market_id_cancel = "0x74b17b0d6855feba39f1f7ab1e8bad0363bd510ee1dcc74e40c2adfe1502f781"
49- spot_market_id_cancel_2 = "0x01edfab47f124748dc89998eb33144af734484ba07099014594321729a0ca16b"
30+ derivative_market_id_create = "0x90e662193fa29a3a7e6c07be4407c94833e762d9ee82136a2cc712d6b87d7de3"
31+ spot_market_id_create = "0x0611780ba69656949525013d947713300f56c37b6175e02f26bffa495c3208fe"
5032
51- spot_market_ids_to_cancel_all = ['0x28f3c9897e23750bf653889224f93390c467b83c86d736af79431958fff833d1' , '0xe8bf0467208c24209c1cf0fd64833fa43eb6e8035869f9d043dbff815ab76d01' ]
52- derivative_market_ids_to_cancel_all = ['0x4ca0f92fc28be0c9761326016b5a1a2177dd6375558365116b5bdda9abc229ce' , '0x979731deaaf17d26b2e256ad18fecd0ac742b3746b9ea5382bac9bd0b5e58f74' ]
33+ derivative_market_id_cancel = "0xd5e4b12b19ecf176e4e14b42944731c27677819d2ed93be4104ad7025529c7ff"
34+ derivative_market_id_cancel_2 = "0x90e662193fa29a3a7e6c07be4407c94833e762d9ee82136a2cc712d6b87d7de3"
35+ spot_market_id_cancel = "0x0611780ba69656949525013d947713300f56c37b6175e02f26bffa495c3208fe"
36+ spot_market_id_cancel_2 = "0x7a57e705bb4e09c88aecfc295569481dbf2fe1d5efe364651fbe72385938e9b0"
5337
5438 derivative_orders_to_cancel = [
5539 composer .OrderData (
@@ -124,21 +108,18 @@ async def main() -> None:
124108 # prepare tx msg
125109 msg = composer .MsgBatchUpdateOrders (
126110 sender = address .to_acc_bech32 (),
127- subaccount_id = subaccount_id ,
128111 derivative_orders_to_create = derivative_orders_to_create ,
129112 spot_orders_to_create = spot_orders_to_create ,
130113 derivative_orders_to_cancel = derivative_orders_to_cancel ,
131- spot_orders_to_cancel = spot_orders_to_cancel ,
132- spot_market_ids_to_cancel_all = spot_market_ids_to_cancel_all ,
133- derivative_market_ids_to_cancel_all = derivative_market_ids_to_cancel_all ,
114+ spot_orders_to_cancel = spot_orders_to_cancel
134115 )
135116
136117 # build sim tx
137118 tx = (
138119 Transaction ()
139120 .with_messages (msg )
140- .with_sequence (address .get_sequence ())
141- .with_account_num (address .get_number ())
121+ .with_sequence (client .get_sequence ())
122+ .with_account_num (client .get_number ())
142123 .with_chain_id (network .chain_id )
143124 )
144125 sim_sign_doc = tx .get_sign_doc (pub_key )
0 commit comments