{"id":26596963,"url":"https://github.com/sambacha/dslviem","last_synced_at":"2026-04-30T00:35:49.189Z","repository":{"id":282952983,"uuid":"945556198","full_name":"sambacha/dslviem","owner":"sambacha","description":"DSL for testing Ethereum applications with property-based testing and mutation testing capabilities.","archived":false,"fork":false,"pushed_at":"2025-03-09T17:43:36.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T20:54:35.822Z","etag":null,"topics":["dsl","ethereum","json-rpc","mutation","mutation-testing","property","property-testing","viem"],"latest_commit_sha":null,"homepage":"","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/sambacha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2025-03-09T17:43:23.000Z","updated_at":"2025-03-09T17:44:38.000Z","dependencies_parsed_at":"2025-03-17T20:54:37.756Z","dependency_job_id":"c0314afc-ad98-45a3-883b-963d6225cec1","html_url":"https://github.com/sambacha/dslviem","commit_stats":null,"previous_names":["sambacha/dslviem"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fdslviem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fdslviem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fdslviem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fdslviem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sambacha","download_url":"https://codeload.github.com/sambacha/dslviem/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245137252,"owners_count":20566723,"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":["dsl","ethereum","json-rpc","mutation","mutation-testing","property","property-testing","viem"],"created_at":"2025-03-23T17:21:00.211Z","updated_at":"2026-04-30T00:35:49.145Z","avatar_url":"https://github.com/sambacha.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ethereum DSL TypeScript Library\n\nA domain-specific language for testing Ethereum applications with property-based testing and mutation testing capabilities.\n\n## Overview\n\nThis library provides a TypeScript implementation of a domain-specific language (DSL) for testing Ethereum applications. It includes:\n\n- A type system for Ethereum-specific data types\n- Property generators for creating test values\n- Property-based testing using fast-check\n- Mutation testing for finding edge cases\n- Integration with viem for Ethereum interactions\n\n## Installation\n\n```bash\nnpm install ethereum-dsl-ts\n```\n\n## Usage\n\n### Basic Example\n\n```typescript\nimport { createPublicClient, http } from 'viem';\nimport { mainnet } from 'viem/chains';\nimport { TAddress, PAddress, EthereumTester } from 'ethereum-dsl-ts';\n\n// Create a viem client\nconst client = createPublicClient({\n  chain: mainnet,\n  transport: http('https://ethereum-rpc-url')\n});\n\n// Define some example addresses\nconst addresses = [\n  '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // WETH\n  '0x6B175474E89094C44Da98b954EedeAC495271d0F'  // DAI\n];\n\n// Create a property for addresses\nconst addressProperty = new PAddress(addresses);\n\n// Run a property test\nconst result = await EthereumTester.propertyTest(\n  addressProperty,\n  async (address) =\u003e {\n    try {\n      // Test that getBalance returns a valid bigint for any address\n      const balance = await client.getBalance({ address });\n      return typeof balance === 'bigint' \u0026\u0026 balance \u003e= 0n;\n    } catch (error) {\n      return false;\n    }\n  },\n  { numRuns: 10 }\n);\n\nconsole.log('Property test result:', result);\n```\n\n### Property-Based Testing\n\nProperty-based testing generates multiple test cases from properties and checks if they satisfy certain conditions.\n\n```typescript\nimport { PBlockTag, EthereumTester } from 'ethereum-dsl-ts';\n\n// Create a property for block tags\nconst blockTagProperty = new PBlockTag();\n\n// Run a property test\nconst result = await EthereumTester.propertyTest(\n  blockTagProperty,\n  async (blockTag) =\u003e {\n    try {\n      // Test that getBlock returns a valid block for any block tag\n      const block = await client.getBlock({ blockTag });\n      return block !== null;\n    } catch (error) {\n      return false;\n    }\n  }\n);\n```\n\n### Mutation Testing\n\nMutation testing generates variations of valid inputs to test how well your code handles edge cases.\n\n```typescript\nimport { TAddress, EthereumTester } from 'ethereum-dsl-ts';\n\n// Run a mutation test\nconst result = await EthereumTester.mutationTest(\n  '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',\n  new TAddress(),\n  async (address) =\u003e {\n    try {\n      // Test that getBalance handles invalid addresses correctly\n      const balance = await client.getBalance({ address });\n      return typeof balance === 'bigint';\n    } catch (error) {\n      // We expect errors for invalid addresses\n      return false;\n    }\n  }\n);\n\nconsole.log('Mutation test result:', result.summary);\n```\n\n### Combined Testing\n\nYou can also run both property-based testing and mutation testing together.\n\n```typescript\nimport { TAddress, PAddress, EthereumTester } from 'ethereum-dsl-ts';\n\n// Run combined tests\nconst result = await EthereumTester.combinedTest(\n  new PAddress(addresses),\n  new TAddress(),\n  async (address) =\u003e {\n    try {\n      const balance = await client.getBalance({ address });\n      return typeof balance === 'bigint';\n    } catch (error) {\n      return false;\n    }\n  }\n);\n\nconsole.log('Combined test results:', result);\n```\n\n## API Reference\n\n### Types\n\n- `TAddress` - Ethereum address type\n- `THex` - Hexadecimal string type\n- `THex32` - 32-byte hash type\n- `TBlockTag` - Block tag type\n- `TBlockNumber` - Block number type\n- `TBlock` - Block object type\n- `TTransaction` - Transaction object type\n- `TTransactionReceipt` - Transaction receipt type\n- `TLog` - Log object type\n\n### Properties\n\n- `PAddress` - Generates Ethereum addresses\n- `PBlockTag` - Generates block tags\n- `PBlockNumber` - Generates block numbers\n- `PValue` - Generates Ethereum values\n- `PGas` - Generates gas limits\n- `PGasPrice` - Generates gas prices\n- `PTxHash` - Generates transaction hashes\n- `PBlockHash` - Generates block hashes\n\n### Testing\n\n- `EthereumTester.propertyTest()` - Run property-based tests\n- `EthereumTester.mutationTest()` - Run mutation tests\n- `EthereumTester.combinedTest()` - Run both property and mutation tests\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsambacha%2Fdslviem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsambacha%2Fdslviem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsambacha%2Fdslviem/lists"}