@@ -1909,6 +1909,38 @@ def deposit_into_liquidity_pool(self, pool, amount_a, amount_b, account=None, **
19091909 return self .finalizeOp (op , account , "active" , ** kwargs )
19101910
19111911
1912+ def withdraw_from_liquidity_pool (self , pool , share_amount , account = None , ** kwargs ):
1913+ """Withdraw stake from a liquidity pool
1914+
1915+ :param str,Asset pool: The liquidity pool to use. Can be the pool id
1916+ as a string, or can be an Asset, asset_id, or symbol of the
1917+ share asset for the pool.
1918+
1919+ :param Amount share_amount: Amount of share asset to redeem. Must be a
1920+ quantity of the pool's share_asset.
1921+
1922+ """
1923+ if not account :
1924+ if "default_account" in self .config :
1925+ account = self .config ["default_account" ]
1926+ if not account :
1927+ raise ValueError ("You need to provide an account" )
1928+ account = Account (account , blockchain_instance = self )
1929+
1930+ pool_id = self ._find_liquidity_pool (pool )
1931+
1932+ op = operations .Liquidity_pool_withdraw (
1933+ ** {
1934+ "fee" : {"amount" : 0 , "asset_id" : "1.3.0" },
1935+ "account" : account ["id" ],
1936+ "pool" : pool_id ,
1937+ "share_amount" : share_amount .json (),
1938+ "extensions" : [],
1939+ }
1940+ )
1941+ return self .finalizeOp (op , account , "active" , ** kwargs )
1942+
1943+
19121944 def exchange_with_liquidity_pool (self , pool , amount_to_sell , min_to_receive , account = None , ** kwargs ):
19131945 """Exchange assets against a liquidity pool
19141946
0 commit comments