Package: minswap-py
minswap-py (v0.3.5)minswap-pyis a tool to interact withMinswap.  The current version has feature parity with the minswapblockfrost-adapter, except for the ability to remove liquidity.Documentation and additional features coming soon.ChangelogBe sure to check out theCHANGELOG.mdfor a complete history of changes. This section
only contains patch updates for the current minor version and patches.0.3.5Fixed a bug for non-ADA pools that was improperly ordering assets in the pool.0.3.3Fixed a bug in how the NFT policy IDs were being checked when restoring a PoolState from JSON.0.3.2Small change to fetching pool data, removing hard coded pool addresses and how pool addresses are fetched by finding addresses that contain the Minswap DEX NFT.Small change to how swap exact in/out are calculated, where fees are now a PoolState property.0.3.1ModifiedPoolStateinitialization so thatPoolDatumis not automatically queried from blockfrost. This was causing a large number of calls to be generated to Blockfrost when usingpools.get_pools()(one for each of the 3,000+ pools). Now, thelp_totalandroot_k_lastare only retrieved from Blockfrost when requested.0.3.0Improvements:Added wallet support, including easy methods to create a collateral, send funds, and consolidate UTxOs.Swap transactions.Cancel transactions.Deposit liquidity (including zap in), but should be updated in the future. The Minswap team has not responded to requests for details on how to better estimate expected LP based on amount of token deposited.https://github.com/minswap/sdk/pull/7#discussion_r1279439474Changes:There was an inconsistency in how time values were being cached. See theexamples/rename_time.pyfor a way to translate previously cached data to the new standard.Changed the way some of the underlying classes were managing amounts to use theAssetsclass. This makes combining assets from different UTxOs easier.InstallationIn order to use this package:Install withpip install minswap-pySign up for blockfrost and get an API key.In your working directory, create a.envfile. The.envshould have the following fields:# The blockfrost project idPROJECT_ID=# The maximum number of calls allowed to Blockfrost within a session.MAX_CALLS=45000# Must be one of mainnet or preprodNETWORK=mainnetBrowse theexamplesfolder for use cases.Setup your walletTo use a wallet withminswap-py, you will need to supply a mnemonic in a file on your
hard drive. By default, theWalletclass will create a brand new wallet and store it
in.wallet/{chain}_mnemonic.txt. Then, this wallet will be used every time a newWalletobject is created. Thechainin the file name must either bemainnetorpreproddepending on whatNETWORKyou want to operate on (i.e.mainnet_mnemonic.txtorpreprod_mnemonic.txt).If you want to supply your own wallet, you can either replace the mnemonic in.wallets/{chain}_mnemonic.txtif it exists, or create it. You can also pass the
mnemonic directly into theWallet. Alternatively, you can create your owntxtfile
with the mnemonic in it anywhere on disk, and pass that file to theWalletconstructor.Examples:fromminswap.walletsimportWallet# Initialize with a path to a file containing a mnemonicwallet=Wallet(path="path/to/mnemonic.txt")# Initialize with a mnemonicwallet=Wallet(mnemonic="bert says buy flac")Have a question?Reach out to me on the Minswap discord. You can usually find me on#technical, and I'm happy to respond to questions there.https://discord.com/channels/829060079248343090/845208119729979402SupportIf you find this project useful, please consider supporting the project by buying me a
beer in the form of ADA or MIN:addr1q9hw8fuex09vr3rqwtn4fzh9qxjlzjzh8aww684ln0rv0cfu3f0de6qkmh7c7yysfz808978wwe6ll30wu8l3cgvgdjqa7egnlUse CasesThis tool was recently used to help generate data for the Minswap DAO Emissions and
Treasury report. You can read the report here:https://minswap.org/storage/2023/06/31-3-2023_Emissions_and_Treasury_Report.pdfContributorsA special thanks to Farmer, creator of Farmbot, for assisting me working through the
details of swaps and cancel orders. If you would like to learn more about Farmbot,
check out their discord:https://discord.gg/zQHyJKrA7K