Skip to content

Commit f0d9365

Browse files
author
Roman
committed
add hotkey into extrinsics
1 parent ab0de6a commit f0d9365

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

bittensor/core/extrinsics/asyncex/liquidity.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ async def add_liquidity_extrinsic(
1717
liquidity: Balance,
1818
price_low: Balance,
1919
price_high: Balance,
20+
hotkey: Optional[str] = None,
2021
wait_for_inclusion: bool = True,
2122
wait_for_finalization: bool = False,
2223
period: Optional[int] = None,
@@ -31,6 +32,7 @@ async def add_liquidity_extrinsic(
3132
liquidity: The amount of liquidity to be added.
3233
price_low: The lower bound of the price tick range.
3334
price_high: The upper bound of the price tick range.
35+
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to `None`.
3436
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
3537
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
3638
period: The number of blocks during which the transaction will remain valid after it's submitted. If
@@ -56,7 +58,7 @@ async def add_liquidity_extrinsic(
5658
call_module="Swap",
5759
call_function="add_liquidity",
5860
call_params={
59-
"hotkey": wallet.hotkey.ss58_address,
61+
"hotkey": hotkey or wallet.hotkey.ss58_address,
6062
"netuid": netuid,
6163
"tick_low": tick_low,
6264
"tick_high": tick_high,
@@ -80,6 +82,7 @@ async def modify_liquidity_extrinsic(
8082
netuid: int,
8183
position_id: int,
8284
liquidity_delta: Balance,
85+
hotkey: Optional[str] = None,
8386
wait_for_inclusion: bool = True,
8487
wait_for_finalization: bool = False,
8588
period: Optional[int] = None,
@@ -92,6 +95,7 @@ async def modify_liquidity_extrinsic(
9295
netuid: The UID of the target subnet for which the call is being initiated.
9396
position_id: The id of the position record in the pool.
9497
liquidity_delta: The amount of liquidity to be added or removed (add if positive or remove if negative).
98+
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to `None`.
9599
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
96100
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
97101
period: The number of blocks during which the transaction will remain valid after it's submitted. If
@@ -114,7 +118,7 @@ async def modify_liquidity_extrinsic(
114118
call_module="Swap",
115119
call_function="modify_position",
116120
call_params={
117-
"hotkey": wallet.hotkey.ss58_address,
121+
"hotkey": hotkey or wallet.hotkey.ss58_address,
118122
"netuid": netuid,
119123
"position_id": position_id,
120124
"liquidity_delta": liquidity_delta.rao,
@@ -136,6 +140,7 @@ async def remove_liquidity_extrinsic(
136140
wallet: "Wallet",
137141
netuid: int,
138142
position_id: int,
143+
hotkey: Optional[str] = None,
139144
wait_for_inclusion: bool = True,
140145
wait_for_finalization: bool = False,
141146
period: Optional[int] = None,
@@ -147,6 +152,7 @@ async def remove_liquidity_extrinsic(
147152
wallet: The wallet used to sign the extrinsic (must be unlocked).
148153
netuid: The UID of the target subnet for which the call is being initiated.
149154
position_id: The id of the position record in the pool.
155+
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to `None`.
150156
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
151157
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
152158
period: The number of blocks during which the transaction will remain valid after it's submitted. If
@@ -169,7 +175,7 @@ async def remove_liquidity_extrinsic(
169175
call_module="Swap",
170176
call_function="remove_liquidity",
171177
call_params={
172-
"hotkey": wallet.hotkey.ss58_address,
178+
"hotkey": hotkey or wallet.hotkey.ss58_address,
173179
"netuid": netuid,
174180
"position_id": position_id,
175181
},

bittensor/core/extrinsics/liquidity.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def add_liquidity_extrinsic(
1717
liquidity: Balance,
1818
price_low: Balance,
1919
price_high: Balance,
20+
hotkey: Optional[str] = None,
2021
wait_for_inclusion: bool = True,
2122
wait_for_finalization: bool = False,
2223
period: Optional[int] = None,
@@ -31,6 +32,7 @@ def add_liquidity_extrinsic(
3132
liquidity: The amount of liquidity to be added.
3233
price_low: The lower bound of the price tick range.
3334
price_high: The upper bound of the price tick range.
35+
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to `None`.
3436
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
3537
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
3638
period: The number of blocks during which the transaction will remain valid after it's submitted. If
@@ -56,7 +58,7 @@ def add_liquidity_extrinsic(
5658
call_module="Swap",
5759
call_function="add_liquidity",
5860
call_params={
59-
"hotkey": wallet.hotkey.ss58_address,
61+
"hotkey": hotkey or wallet.hotkey.ss58_address,
6062
"netuid": netuid,
6163
"tick_low": tick_low,
6264
"tick_high": tick_high,
@@ -80,6 +82,7 @@ def modify_liquidity_extrinsic(
8082
netuid: int,
8183
position_id: int,
8284
liquidity_delta: Balance,
85+
hotkey: Optional[str] = None,
8386
wait_for_inclusion: bool = True,
8487
wait_for_finalization: bool = False,
8588
period: Optional[int] = None,
@@ -92,6 +95,7 @@ def modify_liquidity_extrinsic(
9295
netuid: The UID of the target subnet for which the call is being initiated.
9396
position_id: The id of the position record in the pool.
9497
liquidity_delta: The amount of liquidity to be added or removed (add if positive or remove if negative).
98+
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to `None`.
9599
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
96100
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
97101
period: The number of blocks during which the transaction will remain valid after it's submitted. If
@@ -114,7 +118,7 @@ def modify_liquidity_extrinsic(
114118
call_module="Swap",
115119
call_function="modify_position",
116120
call_params={
117-
"hotkey": wallet.hotkey.ss58_address,
121+
"hotkey": hotkey or wallet.hotkey.ss58_address,
118122
"netuid": netuid,
119123
"position_id": position_id,
120124
"liquidity_delta": liquidity_delta.rao,
@@ -136,6 +140,7 @@ def remove_liquidity_extrinsic(
136140
wallet: "Wallet",
137141
netuid: int,
138142
position_id: int,
143+
hotkey: Optional[str] = None,
139144
wait_for_inclusion: bool = True,
140145
wait_for_finalization: bool = False,
141146
period: Optional[int] = None,
@@ -147,6 +152,7 @@ def remove_liquidity_extrinsic(
147152
wallet: The wallet used to sign the extrinsic (must be unlocked).
148153
netuid: The UID of the target subnet for which the call is being initiated.
149154
position_id: The id of the position record in the pool.
155+
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to `None`.
150156
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
151157
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
152158
period: The number of blocks during which the transaction will remain valid after it's submitted. If
@@ -169,7 +175,7 @@ def remove_liquidity_extrinsic(
169175
call_module="Swap",
170176
call_function="remove_liquidity",
171177
call_params={
172-
"hotkey": wallet.hotkey.ss58_address,
178+
"hotkey": hotkey or wallet.hotkey.ss58_address,
173179
"netuid": netuid,
174180
"position_id": position_id,
175181
},

0 commit comments

Comments
 (0)