-
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 #123 from gnosis/development
Development
- Loading branch information
Showing
24 changed files
with
753 additions
and
267 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@gnosis.pm/safe-core-sdk", | ||
"version": "1.1.1", | ||
"version": "1.3.0", | ||
"description": "Safe Core SDK", | ||
"main": "dist/src/index.js", | ||
"typings": "dist/src/index.d.ts", | ||
|
@@ -43,40 +43,41 @@ | |
"devDependencies": { | ||
"@gnosis.pm/safe-contracts-v1.2.0": "npm:@gnosis.pm/[email protected]", | ||
"@gnosis.pm/safe-contracts-v1.3.0": "npm:@gnosis.pm/[email protected]", | ||
"@nomiclabs/hardhat-ethers": "^2.0.2", | ||
"@nomiclabs/hardhat-ethers": "^2.0.3", | ||
"@nomiclabs/hardhat-waffle": "^2.0.1", | ||
"@nomiclabs/hardhat-web3": "^2.0.0", | ||
"@typechain/ethers-v5": "^8.0.4", | ||
"@typechain/ethers-v5": "^8.0.5", | ||
"@typechain/web3-v1": "^3.0.0", | ||
"@types/chai": "^4.2.22", | ||
"@types/chai": "^4.3.0", | ||
"@types/chai-as-promised": "^7.1.4", | ||
"@types/mocha": "^9.0.0", | ||
"@types/node": "^16.11.9", | ||
"@types/node": "^17.0.8", | ||
"@types/semver": "^7.3.9", | ||
"@types/yargs": "^16.0.1", | ||
"@typescript-eslint/eslint-plugin": "^5.4.0", | ||
"@typescript-eslint/parser": "^5.4.0", | ||
"@typescript-eslint/eslint-plugin": "^5.9.0", | ||
"@typescript-eslint/parser": "^5.9.0", | ||
"chai": "^4.3.4", | ||
"chai-as-promised": "^7.1.1", | ||
"coveralls": "^3.1.1", | ||
"dotenv": "^10.0.0", | ||
"eslint": "^8.3.0", | ||
"eslint": "^8.6.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"ethereum-waffle": "^3.4.0", | ||
"ethers": "^5.5.1", | ||
"hardhat": "^2.3.3", | ||
"hardhat-deploy": "^0.8.6", | ||
"ethers": "^5.5.2", | ||
"hardhat": "^2.8.0", | ||
"hardhat-deploy": "^0.9.24", | ||
"husky": "^7.0.4", | ||
"lint-staged": "^12.1.2", | ||
"lint-staged": "^12.1.5", | ||
"mocha": "^9.1.3", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.4.1", | ||
"prettier": "^2.5.1", | ||
"ts-generator": "^0.1.1", | ||
"ts-node": "^10.4.0", | ||
"typechain": "^6.0.4", | ||
"typescript": "^4.5.2", | ||
"typechain": "^6.0.5", | ||
"typescript": "^4.5.4", | ||
"web3": "^1.6.1", | ||
"yargs": "^17.0.1" | ||
"yargs": "^17.3.0" | ||
}, | ||
"lint-staged": { | ||
"src/**/!(*test).ts": [ | ||
|
@@ -91,7 +92,8 @@ | |
}, | ||
"dependencies": { | ||
"@gnosis.pm/safe-core-sdk-types": "^0.1.1", | ||
"@gnosis.pm/safe-deployments": "^1.4.0", | ||
"ethereumjs-util": "^7.1.3" | ||
"@gnosis.pm/safe-deployments": "^1.7.0", | ||
"ethereumjs-util": "^7.1.3", | ||
"semver": "^7.3.5" | ||
} | ||
} |
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,25 @@ | ||
import semverSatisfies from 'semver/functions/satisfies' | ||
|
||
export enum FEATURES { | ||
SAFE_TX_GAS_OPTIONAL | ||
} | ||
|
||
const FEATURES_BY_VERSION: Record<string, string> = { | ||
[FEATURES.SAFE_TX_GAS_OPTIONAL]: '>=1.3.0' | ||
} | ||
|
||
const isEnabledByVersion = (feature: FEATURES, version: string): boolean => { | ||
if (!(feature in FEATURES_BY_VERSION)) { | ||
return true | ||
} | ||
return semverSatisfies(version, FEATURES_BY_VERSION[feature]) | ||
} | ||
|
||
export const enabledFeatures = (version: string): FEATURES[] => { | ||
const features = Object.values(FEATURES) as FEATURES[] | ||
return features.filter((feature) => isEnabledByVersion(feature, version)) | ||
} | ||
|
||
export const hasFeature = (name: FEATURES, version: string): boolean => { | ||
return enabledFeatures(version).includes(name) | ||
} |
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
Oops, something went wrong.