@@ -153,6 +153,12 @@ def __populate_shared_library_functions(signer):
153153 signer .SignBurnShares .argtypes = [ctypes .c_longlong , ctypes .c_longlong , ctypes .c_longlong , ctypes .c_int , ctypes .c_longlong ]
154154 signer .SignBurnShares .restype = SignedTxResponse
155155
156+ signer .SignStakeAssets .argtypes = [ctypes .c_longlong , ctypes .c_longlong , ctypes .c_longlong , ctypes .c_int , ctypes .c_longlong ]
157+ signer .SignStakeAssets .restype = SignedTxResponse
158+
159+ signer .SignUnstakeAssets .argtypes = [ctypes .c_longlong , ctypes .c_longlong , ctypes .c_longlong , ctypes .c_int , ctypes .c_longlong ]
160+ signer .SignUnstakeAssets .restype = SignedTxResponse
161+
156162 signer .SignUpdateLeverage .argtypes = [ctypes .c_int , ctypes .c_int , ctypes .c_int , ctypes .c_longlong , ctypes .c_int , ctypes .c_longlong ]
157163 signer .SignUpdateLeverage .restype = SignedTxResponse
158164
@@ -562,6 +568,12 @@ def sign_mint_shares(self, public_pool_index: int, share_amount: int, nonce: int
562568 def sign_burn_shares (self , public_pool_index : int , share_amount : int , nonce : int = DEFAULT_NONCE , api_key_index : int = DEFAULT_API_KEY_INDEX ) -> Union [Tuple [str , str , str , None ], Tuple [None , None , None , str ]]:
563569 return self .__decode_tx_info (self .signer .SignBurnShares (public_pool_index , share_amount , nonce , api_key_index , self .account_index ))
564570
571+ def sign_stake_assets (self , staking_pool_index : int , share_amount : int , nonce : int = DEFAULT_NONCE , api_key_index : int = DEFAULT_API_KEY_INDEX ) -> Union [Tuple [str , str , str , None ], Tuple [None , None , None , str ]]:
572+ return self .__decode_tx_info (self .signer .SignStakeAssets (staking_pool_index , share_amount , nonce , api_key_index , self .account_index ))
573+
574+ def sign_unstake_assets (self , staking_pool_index : int , share_amount : int , nonce : int = DEFAULT_NONCE , api_key_index : int = DEFAULT_API_KEY_INDEX ) -> Union [Tuple [str , str , str , None ], Tuple [None , None , None , str ]]:
575+ return self .__decode_tx_info (self .signer .SignUnstakeAssets (staking_pool_index , share_amount , nonce , api_key_index , self .account_index ))
576+
565577 def sign_update_leverage (self , market_index : int , fraction : int , margin_mode : int , nonce : int = DEFAULT_NONCE , api_key_index : int = DEFAULT_API_KEY_INDEX ) -> Union [Tuple [str , str , str , None ], Tuple [None , None , None , str ]]:
566578 return self .__decode_tx_info (self .signer .SignUpdateLeverage (market_index , fraction , margin_mode , nonce , api_key_index , self .account_index ))
567579
@@ -1180,6 +1192,28 @@ async def burn_shares(self, public_pool_index, share_amount, nonce: int = DEFAUL
11801192 logging .debug (f"Burn Shares Send. TxResponse: { api_response } " )
11811193 return tx_info , api_response , None
11821194
1195+ @process_api_key_and_nonce
1196+ async def stake_assets (self , staking_pool_index , share_amount , nonce : int = DEFAULT_NONCE , api_key_index : int = DEFAULT_API_KEY_INDEX ):
1197+ tx_type , tx_info , tx_hash , error = self .sign_stake_assets (staking_pool_index , share_amount , nonce , api_key_index )
1198+ if error is not None :
1199+ return None , None , error
1200+
1201+ logging .debug (f"Stake Assets TxHash: { tx_hash } TxInfo: { tx_info } " )
1202+ api_response = await self .send_tx (tx_type = tx_type , tx_info = tx_info )
1203+ logging .debug (f"Stake Assets Send. TxResponse: { api_response } " )
1204+ return tx_info , api_response , None
1205+
1206+ @process_api_key_and_nonce
1207+ async def unstake_assets (self , staking_pool_index , share_amount , nonce : int = DEFAULT_NONCE , api_key_index : int = DEFAULT_API_KEY_INDEX ):
1208+ tx_type , tx_info , tx_hash , error = self .sign_unstake_assets (staking_pool_index , share_amount , nonce , api_key_index )
1209+ if error is not None :
1210+ return None , None , error
1211+
1212+ logging .debug (f"Unstake Assets TxHash: { tx_hash } TxInfo: { tx_info } " )
1213+ api_response = await self .send_tx (tx_type = tx_type , tx_info = tx_info )
1214+ logging .debug (f"Unstake Assets Send. TxResponse: { api_response } " )
1215+ return tx_info , api_response , None
1216+
11831217 @process_api_key_and_nonce
11841218 async def update_leverage (self , market_index , margin_mode , leverage , nonce : int = DEFAULT_NONCE , api_key_index : int = DEFAULT_API_KEY_INDEX ):
11851219 imf = int (10_000 / leverage )
0 commit comments