@@ -1871,6 +1871,44 @@ def delete_liquidity_pool(self, pool, account=None, **kwargs):
18711871 return self .finalizeOp (op , account , "active" , ** kwargs )
18721872
18731873
1874+ def deposit_into_liquidity_pool (self , pool , amount_a , amount_b , account = None , ** kwargs ):
1875+ """Deposit assets into a liquidity pool
1876+
1877+ :param str,Asset pool: The liquidity pool to use. Can be the pool id
1878+ as a string, or can be an Asset, asset_id, or symbol of the
1879+ share asset for the pool.
1880+
1881+ :param Amount amount_a:
1882+ :param Amount amount_b:
1883+
1884+ """
1885+ if not account :
1886+ if "default_account" in self .config :
1887+ account = self .config ["default_account" ]
1888+ if not account :
1889+ raise ValueError ("You need to provide an account" )
1890+ account = Account (account , blockchain_instance = self )
1891+
1892+ pool_id = self ._find_liquidity_pool (pool )
1893+
1894+ num_id_a = int (amount_a .asset ["id" ].split ("." )[- 1 ])
1895+ num_id_b = int (amount_b .asset ["id" ].split ("." )[- 1 ])
1896+ if (num_id_b < num_id_a ):
1897+ amount_a , amount_b = amount_b , amount_a
1898+
1899+ op = operations .Liquidity_pool_deposit (
1900+ ** {
1901+ "fee" : {"amount" : 0 , "asset_id" : "1.3.0" },
1902+ "account" : account ["id" ],
1903+ "pool" : pool_id ,
1904+ "amount_a" : amount_a .json (),
1905+ "amount_b" : amount_b .json (),
1906+ "extensions" : [],
1907+ }
1908+ )
1909+ return self .finalizeOp (op , account , "active" , ** kwargs )
1910+
1911+
18741912 def exchange_with_liquidity_pool (self , pool , amount_to_sell , min_to_receive , account = None , ** kwargs ):
18751913 """Exchange assets against a liquidity pool
18761914
0 commit comments