-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from gnosis/development
Development
- Loading branch information
Showing
75 changed files
with
3,387 additions
and
3,130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021-2022 Gnosis Ltd | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Safe Core SDK Utils | ||
|
||
[](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-core-sdk-utils) | ||
[](https://github.com/gnosis/safe-core-sdk/releases) | ||
[](https://github.com/gnosis/safe-core-sdk/blob/main/LICENSE.md) | ||
|
||
Utilities for the [Safe Core SDK](https://github.com/gnosis/safe-core-sdk) monorepo. | ||
|
||
## Table of contents | ||
* [Installation](#installation) | ||
* [Build](#build) | ||
|
||
## <a name="installation">Installation</a> | ||
|
||
Install the package with yarn or npm: | ||
|
||
```bash | ||
yarn install | ||
npm install | ||
``` | ||
|
||
## <a name="build">Build</a> | ||
|
||
Build the package with yarn or npm: | ||
|
||
```bash | ||
yarn build | ||
npm build | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"name": "@gnosis.pm/safe-core-sdk-utils", | ||
"version": "1.1.0", | ||
"description": "Safe Core SDK Utilities", | ||
"main": "dist/src/index.js", | ||
"typings": "dist/src/index.d.ts", | ||
"keywords": [ | ||
"Ethereum", | ||
"Gnosis", | ||
"Safe", | ||
"SDK" | ||
], | ||
"scripts": { | ||
"safe-deployments": "ts-node scripts/checkSafeDeployments.ts", | ||
"unbuild": "rimraf dist *.tsbuildinfo", | ||
"build": "rimraf dist && yarn safe-deployments && tsc", | ||
"test": "nyc mocha -r ts-node/register tests/**/*.test.ts", | ||
"format": "prettier --write \"{src,tests}/**/*.ts\"", | ||
"lint": "tslint -p tsconfig.json" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/gnosis/safe-core-sdk.git" | ||
}, | ||
"author": "Gnosis (https://gnosis.io)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/gnosis/safe-core-sdk/issues" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"homepage": "https://github.com/gnosis/safe-core-sdk#readme", | ||
"devDependencies": { | ||
"@gnosis.pm/safe-deployments": "^1.12.0", | ||
"@types/chai": "^4.3.0", | ||
"@types/chai-as-promised": "^7.1.5", | ||
"@types/mocha": "^9.1.0", | ||
"@types/node": "^17.0.23", | ||
"@typescript-eslint/eslint-plugin": "^5.17.0", | ||
"@typescript-eslint/parser": "^5.17.0", | ||
"chai": "^4.3.6", | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^8.12.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"mocha": "^9.2.2", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.6.1", | ||
"ts-node": "^10.7.0", | ||
"typescript": "^4.6.3" | ||
}, | ||
"dependencies": { | ||
"@gnosis.pm/safe-core-sdk-types": "^1.1.0", | ||
"web3-utils": "^1.7.1" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
packages/safe-core-sdk-utils/scripts/checkSafeDeployments.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { SafeVersion } from '@gnosis.pm/safe-core-sdk-types' | ||
import { DeploymentFilter, getSafeSingletonDeployment } from '@gnosis.pm/safe-deployments' | ||
import { networks } from '../src/eip-3770/config' | ||
|
||
const safeVersion: SafeVersion = '1.3.0' | ||
|
||
function getSafeDeploymentNetworks(): string[] { | ||
const filters: DeploymentFilter = { version: safeVersion, released: true } | ||
const singletons = getSafeSingletonDeployment(filters) | ||
if (!singletons) { | ||
throw new Error('Empty Safe Deployments') | ||
} | ||
return Object.keys(singletons.networkAddresses) | ||
} | ||
|
||
function getLocalNetworksConfig(): string[] { | ||
return networks.map(network => network.chainId.toString()) | ||
} | ||
|
||
function checkConfigDiff() { | ||
const safeDeployments = getSafeDeploymentNetworks() | ||
const localNetworks = getLocalNetworksConfig() | ||
if (safeDeployments.length !== localNetworks.length) { | ||
const chainIdsDiff = safeDeployments.filter(chainId => !localNetworks.includes(chainId)) | ||
const errorMessage = `EIP-3770 local config is missing chainIds: ${chainIdsDiff}` | ||
throw new Error(errorMessage) | ||
} | ||
} | ||
|
||
checkConfigDiff() |
Oops, something went wrong.