{"id":24552011,"url":"https://github.com/mlabs-haskell/hydra-auction-offchain","last_synced_at":"2026-01-03T07:15:33.390Z","repository":{"id":212738566,"uuid":"719047678","full_name":"mlabs-haskell/hydra-auction-offchain","owner":"mlabs-haskell","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-26T16:27:45.000Z","size":1172,"stargazers_count":2,"open_issues_count":10,"forks_count":0,"subscribers_count":9,"default_branch":"staging","last_synced_at":"2024-05-01T11:44:02.964Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PureScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mlabs-haskell.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-15T10:40:25.000Z","updated_at":"2024-05-02T16:56:39.160Z","dependencies_parsed_at":"2024-02-06T19:25:35.660Z","dependency_job_id":"1c8da52d-c766-4a81-9837-60aef01f2071","html_url":"https://github.com/mlabs-haskell/hydra-auction-offchain","commit_stats":null,"previous_names":["mlabs-haskell/hydra-auction-offchain"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlabs-haskell%2Fhydra-auction-offchain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlabs-haskell%2Fhydra-auction-offchain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlabs-haskell%2Fhydra-auction-offchain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlabs-haskell%2Fhydra-auction-offchain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlabs-haskell","download_url":"https://codeload.github.com/mlabs-haskell/hydra-auction-offchain/tar.gz/refs/heads/staging","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243878408,"owners_count":20362431,"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":"2025-01-23T01:19:43.200Z","updated_at":"2026-01-03T07:15:33.357Z","avatar_url":"https://github.com/mlabs-haskell.png","language":"PureScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hydra-auction-offchain\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n- [Environment](#environment)\n- [Workflows](#workflows)\n  - [Use as an NPM dependency](#use-as-an-npm-dependency)\n  - [Bundle](#bundle)\n  - [Serve demo](#serve-demo)\n  - [Deploy locally using Plutip](#deploy-locally-using-plutip)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Environment\n\nBefore executing any commands, make sure you are within the Nix development \nenvironment and have configured the necessary environment variables. \nFollow these steps:\n\n1. Run `nix develop` in the root of the repository to enter the dev environment.\n\n2. Set the required environment variables:\n\n```shell\nexport NPM_ENV=1\nexport CARDANO_NETWORK=preprod\nexport BLOCKFROST_API_KEY=\u003cyour key\u003e\nexport PLUTIP_ENV_HOST_PORT=localhost:8083 \nexport DEMO_HOST_PORT=localhost:8080\n```\n\n**Important**: Set `NPM_ENV` to 1 if you intend to [use `hydra-auction-offchain`\nas an NPM dependency](#use-as-an-npm-dependency). If you need to enter the Nix development environment, \nleave this variable unset.\n\nNote: Blockfrost API key for preprod network can be generated at \n[Blockfrost](https://blockfrost.io/).\n\n## Workflows\n\n### Use as an NPM dependency\n\nThe easiest way to start using `hydra-auction-offchain` is to specify it as a\ngit dependency in your `package.json`. Running `npm install` from within your\nproject will fetch the library from GitHub and generate the `dist` folder using\nthe environment variables set beforehand.  \n\n**Important**: Before executing `npm install`, ensure that you have set \n`NPM_ENV` environment variable to 1 (don't forget to set other required env\nvariables too). Otherwise, the necessary `postinstall` and `prepare` npm scripts\nwon't run, resulting in the failure to generate the `dist` folder.\n\nSpecify the dependency in `package.json` as follows:\n\n```json\n\"dependencies\": {\n  \"hydra-auction-offchain\": \"git+ssh://git@github.com:mlabs-haskell/hydra-auction-offchain\"\n}\n```\n\nThen, import the API into your project as shown below:\n\n```TypeScript\nimport {\n  announceAuction,\n  awaitTxConfirmed,\n  mintTokenUsingAlwaysMints,\n  queryAuctions\n} from \"hydra-auction-offchain\";\nimport type {\n  AnnounceAuctionContractParams,\n  ContractOutput,\n  POSIXTime,\n  TokenName,\n  TransactionHash,\n  WalletApp\n} from \"hydra-auction-offchain\";\n```\n\nFor a complete example, refer to [demo/src/index.ts](./demo/src/index.ts).\n\n### Bundle\n\nTo bundle the project for the browser, run:\n\n```\nmake bundle\n```\n\nThis command will compile the PureScript code, bundle it with the TypeScript API\nusing `esbuild`, and generate a `dist` folder that is ready for import into your\ncodebase:\n\n```TypeScript\nimport { announceAuction, queryAuctions } from \"./dist\";\nimport type {\n  AnnounceAuctionContractParams,\n  ContractOutput,\n  TransactionHash,\n  WalletApp\n} from \"./dist\";\n```\n\nFor a more detailed example on how to use the TypeScript API, refer to \n[demo/src/index.ts](./demo/src/index.ts).\n\n### Serve demo\n\nTo serve the demo on localhost, run:\n\n```\nmake serve\n```\n\nThis command will [bundle](#bundle) the project, spin up a simple HTTP server on localhost\nand execute the code in [demo/src/index.ts](./demo/src/index.ts).\n\n### Deploy locally using Plutip\n\nIt is also possible to test the contracts against a locally deployed testnet\nnetwork using [Plutip](https://github.com/mlabs-haskell/plutip). To run the demo\nagainst a Plutip network, follow these steps:\n\n1. Open 2 shell windows and set up dev environment in both of them.\n2. In the first shell, execute `make plutip-env` to spin up a disposable private \nnetwork. This will generate a wallet, pre-fund it with a substantial amount of\nADA, and start an HTTP server to communicate the private key of the generated \nwallet to the frontend code.\n3. Update the demo code in [demo/src/index.ts](./demo/src/index.ts) to use the\nPlutip wallet: \n\n```TypeScript\nconst walletApp: WalletApp = \"Plutip\";\n```\n\n4. In the second shell, run `make serve`.\n\nNote: Prior to announcing the auction, ensure that the auction lot tokens have\nbeen minted and placed in the wallet, otherwise the `AnnounceAuction` contract\nwill fail with error code `AnnounceAuction04`. For testing purposes, you can\nutilize the provided `mintTokenUsingAlwaysMints` function to mint tokens using\nthe `AlwaysMints` minting policy.\n\nNote: It is recommended to stop the plutip-env service by entering the `stop` \ncommand to stdin. This ensures the correct deallocation of resources.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlabs-haskell%2Fhydra-auction-offchain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlabs-haskell%2Fhydra-auction-offchain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlabs-haskell%2Fhydra-auction-offchain/lists"}