{"id":28264497,"url":"https://github.com/morpho-org/gnosis-tx-builder","last_synced_at":"2026-03-06T20:31:46.053Z","repository":{"id":61004942,"uuid":"547524240","full_name":"morpho-org/gnosis-tx-builder","owner":"morpho-org","description":"Transform an array of transactions into a json for Gnosis Tx-Builder  UX","archived":false,"fork":false,"pushed_at":"2024-01-24T10:42:44.000Z","size":164,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-12T05:00:06.081Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/morpho-org.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,"zenodo":null}},"created_at":"2022-10-07T20:42:26.000Z","updated_at":"2025-05-22T17:49:38.000Z","dependencies_parsed_at":"2025-06-18T08:59:18.725Z","dependency_job_id":null,"html_url":"https://github.com/morpho-org/gnosis-tx-builder","commit_stats":null,"previous_names":["morpho-org/gnosis-tx-builder","morpho-labs/gnosis-tx-builder"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/morpho-org/gnosis-tx-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fgnosis-tx-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fgnosis-tx-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fgnosis-tx-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fgnosis-tx-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morpho-org","download_url":"https://codeload.github.com/morpho-org/gnosis-tx-builder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fgnosis-tx-builder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30196173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-05-20T09:10:45.807Z","updated_at":"2026-03-06T20:31:46.020Z","avatar_url":"https://github.com/morpho-org.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gnosis Tx-Builder from a script\n\n[![npm package][npm-img]][npm-url]\n[![Build Status][build-img]][build-url]\n[![Downloads][downloads-img]][downloads-url]\n[![Issues][issues-img]][issues-url]\n[![Commitizen Friendly][commitizen-img]][commitizen-url]\n[![Semantic Release][semantic-release-img]][semantic-release-url]\n\n\u003e ⚡🚀 Transform an array of transactions in a Transaction builder json for the Gnosis UX, based on ethers-js\n\n## Install\n\n```bash\nnpm install @morpho-labs/gnosis-tx-builder\n```\n\n```bash\nyarn add @morpho-labs/gnosis-tx-builder\n```\n\n## Usage\n\n### Generate JSON\n\nGenerate a Tx builder json file:\n\n```typescript\nimport { ZeroAddress, parseEther } from \"ethers\";\nimport fs from \"fs\";\n\nimport TxBuilder, {\n  ParsingError,\n  ChecksumParsingError,\n  TransactionParsingError,\n} from \"@morpho-labs/gnosis-tx-builder\";\n\nconst safeAddress = \"0x12341234123412341234123412341232412341234\";\n\nconst transactions = [\n  {\n    to: ZeroAddress,\n    value: parseEther(\"1\").toString(),\n    data: \"0x\",\n  },\n];\n\nconst batchJson = TxBuilder.batch(safeAddress, transactions);\n\n// dump into a file\nfs.writeFileSync(\"batchTx.json\", JSON.stringify(batchJson, null, 2));\n```\n\nNow, with the json file, go to the Gnosis dApp, and select Transaction Builder app\n\n[![Transaction builder][txbuilder-img]][gnosis-url]\n\nAnd then, drag and drop the `batchTx.json` file\n\n![img.png](img/dnd.png)\n\nAnd tada! 🎉🎉\n\n### Parse JSON\n\nParse transactions from a Tx Builder JSON file:\n\n```typescript\nimport fs from \"fs\";\n\nimport TxBuilder from \"@morpho-labs/gnosis-tx-builder\";\n\n// read from a file\nconst batchJson = fs.readFileSync(\"batchTx.json\");\n\ntry {\n  const batch = TxBuilder.parse(batchJson);\n\n  console.log(batch);\n  /*\n    [\n        {\n            to: \"0x000000000000000000000000\",\n            value: \"1000000000000000000\",\n            data: \"0x\",\n        },\n    ]\n    */\n} catch (e: ParsingError) {\n  if (e instanceof ChecksumParsingError) console.debug(e.params); // { code: ErrorCode; expected: string; computed: string }\n  if (e instanceof TransactionParsingError) console.debug(e.params); // { code: ErrorCode; index: number; parameter?: string }\n  console.debug(e.params); // { code: ErrorCode }\n}\n```\n\n#### Error Codes\n\nYou can import the error codes from the package\n\n```typescript\nimport { ErrorCode } from \"@morpho-labs/gnosis-tx-builder\";\n```\n\nAvailable codes\n\n```typescript\nexport enum ErrorCode {\n  wrongFormat = \"WRONG_FORMAT\", //The json file don't match the expected format ({ meta:..., transactions: [...] })\n  wrongTxFormat = \"WRONG_TRANSACTION_FORMAT\", //The transaction at index `index` doesn't match the expected format (not an object or parameter `parameter` doesn't have the right type)\n  invalidChecksum = \"INVALID_CHECKSUM\", //The computed checksum doesn't match the expected one (the one in the file)\n}\n```\n\n[txbuilder-img]: img/tx-builder.png\n[gnosis-url]: https://gnosis-safe.io/app\n[build-img]: https://github.com/morpho-labs/gnosis-tx-builder/actions/workflows/release.yml/badge.svg\n[build-url]: https://github.com/morpho-labs/gnosis-tx-builder/actions/workflows/release.yml\n[downloads-img]: https://img.shields.io/npm/dt/@morpho-labs/gnosis-tx-builder\n[downloads-url]: https://www.npmtrends.com/@morpho-labs/gnosis-tx-builder\n[npm-img]: https://img.shields.io/npm/v/@morpho-labs/gnosis-tx-builder\n[npm-url]: https://www.npmjs.com/package/@morpho-labs/gnosis-tx-builder\n[issues-img]: https://img.shields.io/github/issues/morpho-labs/gnosis-tx-builder\n[issues-url]: https://github.com/morpho-labs/gnosis-tx-builder/issues\n[codecov-img]: https://codecov.io/gh/morpho-labs/gnosis-tx-builder/branch/main/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/morpho-labs/gnosis-tx-builder\n[semantic-release-img]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[semantic-release-url]: https://github.com/semantic-release/semantic-release\n[commitizen-img]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg\n[commitizen-url]: http://commitizen.github.io/cz-cli/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorpho-org%2Fgnosis-tx-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorpho-org%2Fgnosis-tx-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorpho-org%2Fgnosis-tx-builder/lists"}