{"_rev":"3-99ab9fe30d5fb5f8aa1fbdf045f51a11","time":{"created":"2024-07-19T03:27:58.477Z","modified":"2024-07-19T03:27:59.033Z","1.37.2":"2024-07-19T03:11:22.725Z","1.37.2-alpha":"2024-07-19T03:27:58.769Z"},"_id":"@0xsambtc/safe-deployments","name":"@0xsambtc/safe-deployments","dist-tags":{"latest":"1.37.2-alpha"},"versions":{"1.37.2-alpha":{"name":"@0xsambtc/safe-deployments","version":"1.37.2-alpha","description":"Collection of Safe singleton deployments","homepage":"https://github.com/0xsambtc/safe-deployments/","license":"MIT","main":"dist/index.js","typings":"dist/index.d.ts","scripts":{"build":"rimraf dist && tsc","lint":"npm run lint:ts && npm run lint:json","lint:ts":"eslint --max-warnings 0 src/ scripts/","lint:json":"prettier -c src/assets/*/*.json","lint:fix":"npm run lint:fix:ts && npm run lint:fix:json","lint:fix:ts":"npm run lint:ts -- --fix","lint:fix:json":"prettier -w src/assets/*/*.json","verify":"ts-node scripts/verify.ts","prepack":"npm run build","test":"jest"},"repository":{"type":"git","url":"git+https://github.com/0xsambtc/safe-deployments.git"},"keywords":["Ethereum","Wallet","Safe"],"author":{"name":"richard@safe.global"},"bugs":{"url":"https://github.com/0xsambtc/safe-deployments/issues"},"devDependencies":{"@eslint/js":"^8.57.0","@types/jest":"^29.5.12","@types/node":"^20.14.9","@types/semver":"^7.5.8","eslint":"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3","ethers":"^6.13.1","jest":"^29.7.0","prettier":"^3.3.2","ts-jest":"^29.1.5","ts-node":"^10.9.2","typescript":"^5.5.2","typescript-eslint":"^7.14.1"},"dependencies":{"semver":"^7.6.2"},"_id":"@0xsambtc/safe-deployments@1.37.2-alpha","gitHead":"8aa6f73dcc847b97396da13a3628de70a2c41e7a","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-OwI8xFouhYPBT+EemPAKT3J6+5x0Xowvi+P+1h4OtR8avzYx35/2Ut/DH+SAZrCNfsB2WsdGh5aFWodmv57VUw==","shasum":"6836db24cf9fef5c2b95f7b29538966ccea4496d","tarball":"https://registry.npmjs.org/@0xsambtc/safe-deployments/-/safe-deployments-1.37.2-alpha.tgz","fileCount":115,"unpackedSize":1146320,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGuPLBmhH61RAsc/Pp3HNIAvuh+uMd9iVUqOGgQ3sIRNAiEA48c7ISJNMlHzRyX0/wCE15JXTEJNaH3lErfpDg6KDvk="}]},"_npmUser":{"name":"0xsambtc","email":"0xsambtc@gmail.com"},"directories":{},"maintainers":[{"name":"0xsambtc","email":"0xsambtc@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/safe-deployments_1.37.2-alpha_1721359678599_0.9574903892697781"},"_hasShrinkwrap":false}},"maintainers":[{"name":"0xsambtc","email":"0xsambtc@gmail.com"}],"description":"Collection of Safe singleton deployments","homepage":"https://github.com/0xsambtc/safe-deployments/","keywords":["Ethereum","Wallet","Safe"],"repository":{"type":"git","url":"git+https://github.com/0xsambtc/safe-deployments.git"},"author":{"name":"richard@safe.global"},"bugs":{"url":"https://github.com/0xsambtc/safe-deployments/issues"},"license":"MIT","readme":"# Safe Deployments\n\n[![npm version](https://badge.fury.io/js/%40safe-global%2Fsafe-deployments.svg)](https://badge.fury.io/js/%40safe-global%2Fsafe-deployments)\n[![CI](https://github.com/safe-global/safe-deployments/actions/workflows/test.yml/badge.svg)](https://github.com/safe-global/safe-deployments/actions/workflows/test.yml)\n\nThis contract contains a collection of deployments of the contract of the [Safe contracts repository](https://github.com/safe-global/safe-smart-account).\n\nThe addresses on the different networks and the abi files are available for each deployment. To get an overview of the available versions, check the available [json assets](./src/assets/).\n\n## Adding additional deployments:\n\n1. Follow the [deployment steps in the Safe contract repository](https://github.com/safe-global/safe-smart-contracts#deployments).\n2. Verify that the addresses match the expected address for each contract. You can find them under the \"addresses\" mapping in the respective JSON file in the [assets folder](./src/assets/).\n3. Create a PR adding the new deployment. Example PR can be found [here](https://github.com/safe-global/safe-deployments/pull/676).\n\n## Install\n\n- npm - `npm i @safe-global/safe-deployments`\n- yarn - `yarn add @safe-global/safe-deployments`\n\n## Usage\n\nIt is possible to directly use the JSON files in the [assets folder](./src/assets/) that contain the addresses and ABI definitions.\n\nAn alternative is using JavaScript library methods to query the correct deployment. The library supports different methods to get the deployment of a specific contract.\n\nEach of the methods takes an optional `DeploymentFilter` as a parameter.\n\n```ts\ninterface DeploymentFilter {\n  version?: string;\n  released?: boolean; // Defaults to true if no filter is specified\n  network?: string; // Chain id of the network\n}\n```\n\n### V1 Methods (single deployments)\n\nThose methods will return a `SingletonDeployment` object or `undefined` if no deployment was found for the specified filter.\n\n```ts\nexport interface SingletonDeployment {\n  // The default address of the deployment.\n  defaultAddress: string;\n\n  // Indicates if the deployment is released.\n  released: boolean;\n\n  // The name of the contract.\n  contractName: string;\n\n  // The version of the deployment.\n  version: string;\n\n  // The address & hash of the contract code, where the key is the deployment type.\n  // There could be multiple deployment types: canonical, eip155, zksync\n  // Possible addresses per version:\n  // 1.0.0: canonical\n  // 1.1.1: canonical\n  // 1.2.0: canonical\n  // 1.3.0: canonical, eip155, zksync\n  // 1.4.1: canonical, zksync\n  // Ex: deployments: { \"canonical\": { \"codeHash\": \"0x1234\", \"address\": \"0x5678\"}}\n  deployments: Record<string, { address: string; codeHash: string }>;\n\n  // A record of network addresses, where the key is the network identifier and the value is the address.\n  networkAddresses: Record<string, string>;\n\n  // The ABI (Application Binary Interface) of the contract.\n  abi: any[];\n}\n```\n\n- Safe\n\n```ts\nconst safeSingleton = getSafeSingletonDeployment();\n\n// Returns latest contract version, even if not finally released yet\nconst safeSingletonNightly = getSafeSingletonDeployment({ released: undefined });\n\n// Returns released contract version for specific network\nconst safeSingletonGörli = getSafeSingletonDeployment({ network: '5' });\n\n// Returns released contract version for specific version\nconst safeSingleton100 = getSafeSingletonDeployment({ version: '1.0.0' });\n\n// Version with additional events used on L2 networks\nconst safeL2Singleton = getSafeL2SingletonDeployment();\n```\n\n- Factories\n\n```ts\nconst proxyFactory = getProxyFactoryDeployment();\n```\n\n- Libraries\n\n```ts\nconst multiSendLib = getMultiSendDeployment();\n\nconst multiSendCallOnlyLib = getMultiSendCallOnlyDeployment();\n\nconst createCallLib = getCreateCallDeployment();\n\nconst signMessageLib = getSignMessageLibDeployment();\n```\n\n- Handler\n\n```ts\n\nconst callbackHandler = getDefaultCallbackHandlerDeployment();\n\nconst compatHandler = getCompatibilityFallbackHandlerDeployment();\n```\n\n### V2 Methods (multiple deployments)\n\nWe added a new methods that allow multiple deployment addresses for a contract.\n\nThose methods will return a `SingletonDeployment` object or `undefined` if no deployment was found for the specified filter. Notice the difference in the `networkAddresses` field.\n\n```ts\nexport interface SingletonDeployment {\n  // The default address of the deployment.\n  defaultAddress: string;\n\n  // Indicates if the deployment is released.\n  released: boolean;\n\n  // The name of the contract.\n  contractName: string;\n\n  // The version of the deployment.\n  version: string;\n\n  // The address & hash of the contract code, where the key is the deployment type.\n  // There could be multiple deployment types: canonical, eip155, zksync\n  // Possible addresses per version:\n  // 1.0.0: canonical\n  // 1.1.1: canonical\n  // 1.2.0: canonical\n  // 1.3.0: canonical, eip155, zksync\n  // 1.4.1: canonical, zksync\n  // Ex: deployments: { \"canonical\": { \"codeHash\": \"0x1234\", \"address\": \"0x5678\"}}\n  deployments: Record<string, { address: string; codeHash: string }>;\n\n  // A record of network addresses, where the key is the network identifier and the value is the address.\n  networkAddresses: Record<string, string | string[]>;\n\n  // The ABI (Application Binary Interface) of the contract.\n  abi: any[];\n}\n```\n\n- Safe\n\n```ts\nconst safeSingleton = getSafeSingletonDeployments();\n\n// Returns latest contract version, even if not finally released yet\nconst safeSingletonNightly = getSafeSingletonDeployments({ released: undefined });\n\n// Returns released contract version for specific network\nconst safeSingletonGörli = getSafeSingletonDeployments({ network: '5' });\n\n// Returns released contract version for specific version\nconst safeSingleton100 = getSafeSingletonDeployments({ version: '1.0.0' });\n\n// Version with additional events used on L2 networks\nconst safeL2Singleton = getSafeL2SingletonDeployments();\n```\n\n- Factories\n\n```ts\nconst proxyFactory = getProxyFactoryDeployments();\n```\n\n- Libraries\n\n```ts\nconst multiSendLib = getMultiSendDeployments();\n\nconst multiSendCallOnlyLib = getMultiSendCallOnlyDeployments();\n\nconst createCallLib = getCreateCallDeployments();\n\nconst signMessageLib = getSignMessageLibDeployments();\n```\n\n- Handler\n\n```ts\n\nconst callbackHandler = getDefaultCallbackHandlerDeployments();\n\nconst compatHandler = getCompatibilityFallbackHandlerDeployments();\n```\n\n## Release cycle\n\n`safe-deployments` release cycle is once per month, except for urgent issues that require immediate attention.\n\n## Notes\n\nA list of network information can be found at [chainid.network](https://chainid.network/)\n\n## License\n\nThis library is released under MIT.\n","readmeFilename":"README.md"}