{"id":13566839,"url":"https://github.com/cosmology-tech/cosmology","last_synced_at":"2025-04-21T16:30:52.836Z","repository":{"id":37669204,"uuid":"477911467","full_name":"cosmology-tech/cosmology","owner":"cosmology-tech","description":"CLI and TS library for the Cosmos ⚛️","archived":false,"fork":false,"pushed_at":"2023-07-30T13:26:16.000Z","size":28653,"stargazers_count":50,"open_issues_count":8,"forks_count":21,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-03T15:46:18.122Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cosmology-tech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-04-04T23:46:07.000Z","updated_at":"2024-01-18T23:38:33.000Z","dependencies_parsed_at":"2024-04-27T00:45:17.455Z","dependency_job_id":null,"html_url":"https://github.com/cosmology-tech/cosmology","commit_stats":{"total_commits":540,"total_committers":6,"mean_commits":90.0,"dds":"0.031481481481481444","last_synced_commit":"d9f278a2663d09f0501746314e727e3565092d0b"},"previous_names":["cosmology-finance/cosmology"],"tags_count":487,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosmology-tech%2Fcosmology","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosmology-tech%2Fcosmology/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosmology-tech%2Fcosmology/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosmology-tech%2Fcosmology/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cosmology-tech","download_url":"https://codeload.github.com/cosmology-tech/cosmology/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223870127,"owners_count":17217348,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:02:17.820Z","updated_at":"2024-11-09T19:16:06.600Z","avatar_url":"https://github.com/cosmology-tech.png","language":"TypeScript","readme":"# THIS LIBRARY IS DEPRECATED\n# [see this issue for migrating](https://github.com/cosmology-tech/cosmology/issues/34)\n\n\n\n# cosmology\n\n\n\u003cp align=\"center\" width=\"100%\"\u003e\n  \u003ca href=\"https://github.com/cosmology-tech/cosmology/actions/workflows/run-tests.yml\"\u003e\n    \u003cimg height=\"20\" src=\"https://github.com/cosmology-tech/cosmology/actions/workflows/run-tests.yml/badge.svg\" /\u003e\n  \u003c/a\u003e\n   \u003ca href=\"https://github.com/cosmology-tech/cosmology/blob/main/LICENSE\"\u003e\u003cimg height=\"20\" src=\"https://img.shields.io/badge/license-MIT-blue.svg\"\u003e\u003c/a\u003e\n   \u003ca href=\"https://www.npmjs.com/package/cosmology\"\u003e\u003cimg height=\"20\" src=\"https://img.shields.io/github/package-json/v/cosmology-tech/cosmology?filename=packages%2Fcosmology%2Fpackage.json\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n```\nnpm install -g cosmology\n```\n\nUse `cosmology` to build web3 applications on top of Osmosis and the Cosmos. Make cryptocurrency trades, join liquidity pools, and stake rewards.\n\n## usage\n\n### CLI and user prompts\n\nNot sure what to do? Simply type `cosmology`. It will prompt you with options. \n\n```\n$ cosmology \n? [cmd] what do you want to do? \n  keychain-del \n  keychain-get \n  keychain-set \n❯ list-apis \n  list-pools \n  list-prices \n  load-recipe \n```\n\nThen once you learn the api, you can start supplying the parameters.\n\n```\ncosmology \u003ccommandname\u003e\n```\n## commands\n\n### `rebalance`\n\nThe rebalance command will make a series of swaps on your behalf. It will prompt you to choose the coins you are willing to sell to create a new balance based on the pools you want to enter.\n\n```sh\ncosmology rebalance \n```\n\nExample with parameters\n\n```sh\ncosmology rebalance \\\n    --chainId osmosis-1 \\\n    --restEndpoint https://lcd-osmosis.blockapsis.com \\\n    --rpcEndpoint https://osmosis.validator.network \\\n    --slippage 1 \n```\n\n### `join`\n\nThe join command will join a pool.\n\n```sh\ncosmology join \n```\n\nExample with parameters\n\n```sh\ncosmology join \\\n    --keychain my-mnemonic-name \\\n    --chainId osmosis-1 \\\n    --restEndpoint https://lcd-osmosis.blockapsis.com \\\n    --poolId 601\n    --max\n```\n\n### `lock`\n\nThe lock command will lock your gamms tokens for staking so you can earn rewards.\n\n```sh\ncosmology lock \n```\n\nExample with parameters\n\n```\ncosmology lock \\\n    --keychain my-mnemonic-name \\\n    --chainId osmosis-1 \\\n    --restEndpoint https://lcd-osmosis.blockapsis.com \\\n    --poolId 601 \\\n    --duration 14\n```\n\n### `claim`\n\nClaim rewards from staking.\n\n```\ncosmology claim\n```\n\nExample with parameters\n\n```\ncosmology claim \\\n  --keychain my-mnemonic-name \\\n  --chainToken CMDX \\\n  --minAmount 1 \\\n  --restEndpoint https://rest.comdex.one \\\n  --rpcEndpoint https://rpc.comdex.one\n```\n\n### `delegate`\n\nStake tokens to a validator.\n\n```\ncosmology delegate\n```\n\nExample with parameters\n\n```\ncosmology delegate \\\n  --keychain my-mnemonic-name \\\n  --chainToken CMDX \\\n  --minAmount 1 \\\n  --restEndpoint https://rest.comdex.one \\\n  --rpcEndpoint https://rpc.comdex.one \\\n  --validatorAddress comdexvaloper1mzxzxkzajancc63gtwt9x9zw2qfv9k9ar7ka34\n```\n## env vars\n\nWhile everything can be done with parameters, you can also just supply env vars and cosmology won't prompt you for those values:\n\n| env var              | optional           | description                                               |\n| -------------------- | ------------------ | --------------------------------------------------------- |\n| `MNEMONIC`           | Yes                | cosmos mnemonic, either plain-text or encrypted           |\n| `ENCRYPTED_SALT`     | Yes                | used for encrypting/decrypting mnemonics                  |\n| `KEYCHAIN_ACCOUNT`   | Yes                | used for storing info in OSX keychain account             |\n| `CHAIN_ID`           | Yes                | used for getting chain info, e.g. osmosis-1               |\n| `REST_ENDPOINT`      | Yes                | used for setting LCD endpoint                             |\n| `RPC_ENDPOINT`       | Yes                | used for setting RCP endpoint                             |\n\n## mnemonics\n\nThere are a few methods to deal with mnemonics. \n\n1. plain text env var `MNEMONIC`\n2. encrypted key with a salt\n3. mac OSX keychain\n\n### METHOD 1 - plain text\n\n(Not recommended) [video here](https://www.youtube.com/watch?v=K46jMo5pjvQ)\n\n```sh\nexport MNEMONIC=\"action brisk disagree just bunker design wasp hand night ghost runway fluid\"\n# now you can run cosmology\n\ncosmology rebalance\n```\n\n### METHOD 2 - encrypted salt via env var `ENCRYPTED_SALT`\n\n[video here](https://www.youtube.com/watch?v=gHIpLZOpHaw)\n\nThe encrypted salt is the recommended usage so that you don't store plain-text mnemonics.\n#### 1 First, generate a salt.\n\n```sh\ncosmology salt-generate --saltBytes 64\n\u003e GRHeG5r9nojio7PmCuNnLEh0Hglwvw1Bn87ipIMeyhPFVJk9i5eWtno7m7pa8FPRjbsd2LqCjEsR8/Hiyp9lLg==\n```\n\n#### 2 Now encrypt this salt value\n\n(Yes, we are encrypting a salt with a salt, or password)\n\n```sh\ncosmology salt-encrypt \\\n     --secret GRHeG5r9nojio7PmCuNnLEh0Hglwvw1Bn87ipIMeyhPFVJk9i5eWtno7m7pa8FPRjbsd2LqCjEsR8/Hiyp9lLg==\n ```\n\n Now, store that value securely, and remember your password. Test the `salt-encrypt` and `salt-decrypt` commands a few times so you understand how it works. \n\n#### 3 Now you can use it in env var `ENCRYPTED_SALT`\n\n```sh\nexport ENCRYPTED_SALT=U2FsdGVkX183aSMtLlWua/uig/Qqd99TBILc63iW1AsJaKGykZGPvA/DXByjYtws7drSVlipMPsMLrePajBtRyFP7tZOLrlUuL+xlhcsRAm0DcTRV+VDsnDQVykSDhSyl1RYf03SsLgUsYMvsixWFA==\n\n# now the user will be prompted for \"salt\" which is the password used to decrypt the encryption key\n# the mnemonic will be automatically decrypted by the system\ncosmology\n```\n### METHOD 3 - keychain\n\n[video here](https://www.youtube.com/watch?v=gHIpLZOpHaw)\n\nWe can leverage the Mac OSX keychain. Don't worry though, we ONLY use encryption via the encrypted salt, even if some of you happen to trust storing mnemonics in OSX keychain. We only store encrypted values, period.\n### 1 create an encryption key and encrypt it as described in the previous step\n\ncreate an `ENCRYPTED_SALT` and store it securely.\n\n### 2 add your mnemonic to your keychain\n\n* `name` is how you'll reference \n* `password` is your actual mnemonic\n* `salt` is the salt for your encrypted salt key\n\n```\n$ cosmology keychain-set\n? [name] name my-special-mnemonic-name-1\n? [password] password [hidden]\n? [salt] enter the salt [hidden]\n```\n\nTest it!\n\n```\n$ cosmology keychain-get \\\n --name my-special-mnemonic-name-1\n```\n\n## testing\n\nfirst start the tests\n\n```\ncd ./packages/cosmology\nyarn test:watch\n```\n\nhit \"p\" and then type a search string to scope to the name your test\n## developing the CLI\n\nif you need to edit the CLI\n\n```sh\ncd ./packages/cosmology\nexport MNEMONIC=\"mammal wrestle hybrid cart choose flee transfer filter fly object swamp rookie\"\nexport CHAIN_ID=osmosis-testnet-0\nexport RPC_ENDPOINT=http://143.244.147.126:26657\n\nyarn run dev\n```\n\n## Useful Links for Developers of Cosmology\n\n### RPC Docs\n\nhttps://v1.cosmos.network/rpc/v0.41.4\n\n### LCD Docs\n\nhttps://osmosis.stakesystems.io/static/openapi/\n\n### Validator Docs\n\nhttps://api-osmosis.imperator.co/swagger\n\n### Other\n\nhttps://github.com/osmosis-labs/awesome#publicly-available-endpoints\n\nhttps://www.notion.so/Stake-Systems-LCD-RPC-gRPC-Instances-04a99a9a9aa14247a42944931eec7024\n\n## known issues\n\n* defaults to NOT using pools with less than 100k in liquidity\n* smaller tokens with volatility may need higher slippage values\n\n## Credits\n\n🛠 Built by Cosmology — if you like our tools, please consider delegating to [our validator ⚛️](https://cosmology.tech/validator)\n\nCode built with the help of these related projects:\n\n* [@cosmology/telescope](https://github.com/cosmology-tech/telescope) a \"babel for the Cosmos\", Telescope is a TypeScript Transpiler for Cosmos Protobufs.\n* [osmojs](https://github.com/osmosis-labs/osmojs) OsmosJS makes it easy to compose and broadcast Osmosis and Cosmos messages.\n\n## Disclaimer\n\nAS DESCRIBED IN THE COSMOLOGY LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.\n\nNo developer or entity involved in creating Cosmology will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the Cosmology app or Cosmology CLI, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.\n","funding_links":[],"categories":["TypeScript","Tools"],"sub_categories":["CLI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosmology-tech%2Fcosmology","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcosmology-tech%2Fcosmology","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosmology-tech%2Fcosmology/lists"}