{"id":23317066,"url":"https://github.com/aibtcdev/agent-tools-ts","last_synced_at":"2025-08-22T15:32:16.889Z","repository":{"id":220191449,"uuid":"750559215","full_name":"aibtcdev/agent-tools-ts","owner":"aibtcdev","description":"Agent tooling powered by Bun and Stacks.js, used by aibtcdev-backend as a submodule","archived":false,"fork":false,"pushed_at":"2025-08-18T21:15:26.000Z","size":6289,"stargazers_count":16,"open_issues_count":12,"forks_count":11,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-18T21:34:32.385Z","etag":null,"topics":["bitcoin","bun","stacks","typescript"],"latest_commit_sha":null,"homepage":"https://aibtc.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aibtcdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-01-30T21:38:31.000Z","updated_at":"2025-08-18T19:57:33.000Z","dependencies_parsed_at":"2024-02-08T14:45:09.149Z","dependency_job_id":"fa129755-38c5-4c75-b255-5a8e7d3a9e53","html_url":"https://github.com/aibtcdev/agent-tools-ts","commit_stats":null,"previous_names":["stacks-m2m/scripts","aibtcdev/agent-tools-ts"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/aibtcdev/agent-tools-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aibtcdev%2Fagent-tools-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aibtcdev%2Fagent-tools-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aibtcdev%2Fagent-tools-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aibtcdev%2Fagent-tools-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aibtcdev","download_url":"https://codeload.github.com/aibtcdev/agent-tools-ts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aibtcdev%2Fagent-tools-ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271658846,"owners_count":24798186,"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","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bitcoin","bun","stacks","typescript"],"created_at":"2024-12-20T16:19:18.526Z","updated_at":"2025-08-22T15:32:16.877Z","avatar_url":"https://github.com/aibtcdev.png","language":"TypeScript","readme":"\u003cimg src=\"https://aibtc.dev/logos/aibtcdev-primary-logo-black-wide-1000px.png\" alt=\"AIBTC Working Group Logo\" style=\"width: 100%; max-width: 1000px; display: block; margin: 1rem auto;\" /\u003e\n\n# AIBTC Agent Tools (TypeScript)\n\nA collection of TypeScript tools for interacting with Bitcoin and Stacks.\n\nThis package provides utilities for wallet management, smart contract interactions, and blockchain operations.\n\n## Development\n\n### Installation\n\n```\nbun add @aibtc/agent-tools\n```\n\n_We recommend using [Bun](https://bun.sh/) as the preferred package manager for best performance and compatibility._\n\nAlternatively, you can use npm or yarn:\n\n```\nnpm install @aibtc/agent-tools\n# or\nyarn add @aibtc/agent-tools\n```\n\n### Configuration\n\nCreate an `.env` file in your project root with the following variables:\n\n```env\n# Network selection: 'testnet' or 'mainnet'\nNETWORK=testnet\n\n# Wallet seed phrase (keep this safe and never share it)\nMNEMONIC=your twelve or twenty-four word seed phrase\n\n# Account index to use (first account = 0)\nACCOUNT_INDEX=0\n\n# Bitflow API configuration (get keys from Bitflow Discord)\nBITFLOW_API_HOST=\nBITFLOW_API_KEY=\nBITFLOW_STACKS_API_HOST=https://api.hiro.so/\nBITFLOW_READONLY_CALL_API_HOST=\n\n# Jing API configuration\nJING_API_URL=https://backend-neon-ecru.vercel.app/api\nJING_API_KEY=dev-api-token\n\n# Hiro API key\nHIRO_API_KEY=your-api-key\n\n# AIBTC configuration\nAIBTC_DEFAULT_FEE=100000 # in uSTX (0.1 STX)\nAIBTC_FAKTORY_API_KEY=your-api-key\nAIBTC_CORE_API_KEY=your-api-key\n```\n\n## Command-Line Tools\n\nThis repository contains several command-line tools for interacting with Stacks contracts. These tools provide safe, post-condition-protected methods for trading on Faktory DEXs.\n\n### Trading via an Agent Account\n\nThese scripts execute trades through a deployed agent account smart contract. They are ideal for managing assets held within a specialized contract.\n\n**Sell an Asset:**\n\nSell a specific amount of a fungible token for the DEX's payment asset (e.g., STX or sBTC).\n\n```sh\nbun run src/aibtc-cohort-0/agent-account/public/faktory-sell-asset.ts \u003cagentContract\u003e \u003cdexContract\u003e \u003cassetContract\u003e \u003camountToSell\u003e [slippage]\n```\n-   **`\u003cagentContract\u003e`**: Your agent account contract (e.g., `ST1...agent-v1`).\n-   **`\u003cdexContract\u003e`**: The Faktory DEX contract (e.g., `ST2...aibtc-dex`).\n-   **`\u003cassetContract\u003e`**: The token you are selling (e.g., `ST2...aibtc-token`).\n-   **`\u003camountToSell\u003e`**: The number of tokens you want to sell.\n-   **`[slippage]`**: Optional. Slippage tolerance in percent (e.g., `1` for 1%). Defaults to 1%.\n\n**Buy an Asset:**\n\nSpend a specific amount of the DEX's payment asset (e.g., STX or sBTC) to buy a fungible token.\n\n```sh\nbun run src/aibtc-cohort-0/agent-account/public/faktory-buy-asset.ts \u003cagentContract\u003e \u003cdexContract\u003e \u003cassetContract\u003e \u003camountToSpend\u003e [slippage]\n```\n-   **`\u003camountToSpend\u003e`**: The amount of STX or sBTC you want to spend.\n-   Other arguments are the same as selling.\n\n### Direct Wallet-to-DEX Trading\n\nThese scripts execute trades directly from your wallet configured in the `.env` file.\n\n**Sell a Token (Directly):**\n```sh\nbun run src/stacks-faktory/exec-sell.ts \u003ctokenAmount\u003e \u003cdexContract\u003e [slippage]\n```\n\n**Buy a Token (Directly):**\n```sh\n# For BTC-denominated pools\nbun run src/stacks-faktory/exec-buy.ts \u003cbtcAmount\u003e \u003cdexContract\u003e [slippage]\n```\n\n## Usage Example\n\nHere's a basic example of how to import and use the package in your project:\n\n```ts\nimport { createWallet } from '@aibtc/agent-tools';\n\nconst wallet = createWallet(process.env.MNEMONIC!, Number(process.env.ACCOUNT_INDEX || 0));\nconsole.log('Wallet address:', wallet.address);\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## Community\n\n- Discord: [Join our community](https://discord.gg/Z59Z3FNbEX)\n- Twitter: [@aibtcdev](https://twitter.com/aibtcdev)\n- Docs: [AIBTC docs](https://docs.aibtc.dev/)\n\n## Docker\n\nYou can build and run this project using Docker with Bun for a consistent and fast development or production environment.\n\n### Build the Docker image\n\n```sh\ndocker build --pull -t aibtc-agent-tools .\n```\n\n### Run Bun command-line tools in the Docker container\n\nYou can run any Bun-based CLI tool or script from this project inside the container. For example, to run a script called `my-tool.ts`:\n\n```sh\ndocker run --rm -it aibtc-agent-tools src/my-tool.ts\n```\n\n- Replace `src/my-tool.ts` with the path to the tool or script you want to run.\n- You can pass additional arguments after the script name as needed, e.g.:\n  ```sh\n  docker run --rm -it aibtc-agent-tools src/my-tool.ts --help\n  ```\n- The container does not expose any ports by default, as this project is not a server.\n\n### Customizing\n- Edit the `Dockerfile` and `.dockerignore` as needed for your deployment or development needs.\n- Make sure to set up your `.env` file for environment variables (see Configuration section above).\n","funding_links":[],"categories":["Learning"],"sub_categories":["Repositories"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faibtcdev%2Fagent-tools-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faibtcdev%2Fagent-tools-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faibtcdev%2Fagent-tools-ts/lists"}