@safe-global/safe-core-sdk
Advanced tools
Comparing version 3.2.2 to 3.3.0
@@ -7,9 +7,9 @@ import { SafeVersion } from '@safe-global/safe-core-sdk-types'; | ||
safeMasterCopyVersion: string; | ||
safeMasterCopyL2Version: string | undefined; | ||
safeMasterCopyL2Version?: string; | ||
safeProxyFactoryVersion: string; | ||
compatibilityFallbackHandler: string; | ||
multiSendVersion: string; | ||
multiSendCallOnlyVersion: string; | ||
signMessageLibVersion: string; | ||
createCallVersion: string; | ||
multiSendCallOnlyVersion?: string; | ||
signMessageLibVersion?: string; | ||
createCallVersion?: string; | ||
}; | ||
@@ -16,0 +16,0 @@ }; |
@@ -5,3 +5,3 @@ "use strict"; | ||
exports.SAFE_LAST_VERSION = '1.3.0'; | ||
exports.SAFE_BASE_VERSION = '1.1.1'; | ||
exports.SAFE_BASE_VERSION = '1.0.0'; | ||
exports.safeDeploymentsVersions = { | ||
@@ -12,5 +12,5 @@ '1.3.0': { | ||
safeProxyFactoryVersion: '1.3.0', | ||
compatibilityFallbackHandler: '1.3.0', | ||
multiSendVersion: '1.3.0', | ||
multiSendCallOnlyVersion: '1.3.0', | ||
compatibilityFallbackHandler: '1.3.0', | ||
signMessageLibVersion: '1.3.0', | ||
@@ -23,5 +23,5 @@ createCallVersion: '1.3.0' | ||
safeProxyFactoryVersion: '1.1.1', | ||
compatibilityFallbackHandler: '1.3.0', | ||
multiSendVersion: '1.1.1', | ||
multiSendCallOnlyVersion: '1.3.0', | ||
compatibilityFallbackHandler: '1.3.0', | ||
signMessageLibVersion: '1.3.0', | ||
@@ -34,5 +34,15 @@ createCallVersion: '1.3.0' | ||
safeProxyFactoryVersion: '1.1.1', | ||
compatibilityFallbackHandler: '1.3.0', | ||
multiSendVersion: '1.1.1', | ||
multiSendCallOnlyVersion: '1.3.0', | ||
signMessageLibVersion: '1.3.0', | ||
createCallVersion: '1.3.0' | ||
}, | ||
'1.0.0': { | ||
safeMasterCopyVersion: '1.0.0', | ||
safeMasterCopyL2Version: undefined, | ||
safeProxyFactoryVersion: '1.0.0', | ||
compatibilityFallbackHandler: '1.3.0', | ||
multiSendVersion: '1.1.1', | ||
multiSendCallOnlyVersion: '1.3.0', | ||
signMessageLibVersion: '1.3.0', | ||
@@ -39,0 +49,0 @@ createCallVersion: '1.3.0' |
@@ -232,3 +232,3 @@ import { BigNumber } from '@ethersproject/bignumber'; | ||
*/ | ||
signTransaction(safeTransaction: SafeTransaction | SafeMultisigTransactionResponse, signingMethod?: 'eth_sign' | 'eth_signTypedData'): Promise<SafeTransaction>; | ||
signTransaction(safeTransaction: SafeTransaction | SafeMultisigTransactionResponse, signingMethod?: 'eth_sign' | 'eth_signTypedData' | 'eth_signTypedData_v3' | 'eth_signTypedData_v4'): Promise<SafeTransaction>; | ||
/** | ||
@@ -235,0 +235,0 @@ * Approves on-chain a hash using the current signer account. |
@@ -30,2 +30,3 @@ "use strict"; | ||
const utils_2 = require("./utils/transactions/utils"); | ||
const safeVersions_1 = require("./utils/safeVersions"); | ||
class Safe { | ||
@@ -329,3 +330,3 @@ constructor() { | ||
*/ | ||
async signTransaction(safeTransaction, signingMethod = 'eth_sign') { | ||
async signTransaction(safeTransaction, signingMethod = 'eth_signTypedData_v4') { | ||
let transaction = (0, utils_1.isSafeMultisigTransactionResponse)(safeTransaction) | ||
@@ -344,6 +345,16 @@ ? await this.toSafeTransactionType(safeTransaction) | ||
let signature; | ||
if (signingMethod === 'eth_signTypedData') { | ||
if (signingMethod === 'eth_signTypedData_v4') { | ||
signature = await this.signTypedData(transaction, 'v4'); | ||
} | ||
else if (signingMethod === 'eth_signTypedData_v3') { | ||
signature = await this.signTypedData(transaction, 'v3'); | ||
} | ||
else if (signingMethod === 'eth_signTypedData') { | ||
signature = await this.signTypedData(transaction); | ||
} | ||
else { | ||
const safeVersion = await this.getContractVersion(); | ||
if (!(0, safeVersions_1.hasFeature)(safeVersions_1.FEATURES.ETH_SIGN, safeVersion)) { | ||
throw new Error('eth_sign is only supported by Safes >= v1.1.0'); | ||
} | ||
const txHash = await this.getTransactionHash(transaction); | ||
@@ -350,0 +361,0 @@ signature = await this.signTransactionHash(txHash); |
@@ -19,2 +19,3 @@ "use strict"; | ||
const ethereumjs_util_1 = require("ethereumjs-util"); | ||
const satisfies_1 = __importDefault(require("semver/functions/satisfies")); | ||
const config_1 = require("../contracts/config"); | ||
@@ -74,2 +75,13 @@ const safeDeploymentContracts_1 = require("../contracts/safeDeploymentContracts"); | ||
var _a; | ||
if ((0, satisfies_1.default)(__classPrivateFieldGet(this, _SafeFactory_safeVersion, "f"), '<=1.0.0')) { | ||
return __classPrivateFieldGet(this, _SafeFactory_gnosisSafeContract, "f").encode('setup', [ | ||
owners, | ||
threshold, | ||
to, | ||
data, | ||
paymentToken, | ||
payment, | ||
paymentReceiver | ||
]); | ||
} | ||
let fallbackHandlerAddress; | ||
@@ -76,0 +88,0 @@ if (fallbackHandler) { |
export declare enum FEATURES { | ||
SAFE_TX_GAS_OPTIONAL = 0, | ||
SAFE_TX_GUARDS = 1, | ||
SAFE_FALLBACK_HANDLER = 2 | ||
SAFE_FALLBACK_HANDLER = 2, | ||
ETH_SIGN = 3 | ||
} | ||
export declare const enabledFeatures: (version: string) => FEATURES[]; | ||
export declare const hasFeature: (name: FEATURES, version: string) => boolean; |
@@ -13,2 +13,3 @@ "use strict"; | ||
FEATURES[FEATURES["SAFE_FALLBACK_HANDLER"] = 2] = "SAFE_FALLBACK_HANDLER"; | ||
FEATURES[FEATURES["ETH_SIGN"] = 3] = "ETH_SIGN"; | ||
})(FEATURES = exports.FEATURES || (exports.FEATURES = {})); | ||
@@ -18,3 +19,4 @@ const FEATURES_BY_VERSION = { | ||
[FEATURES.SAFE_TX_GUARDS]: '>=1.3.0', | ||
[FEATURES.SAFE_FALLBACK_HANDLER]: '>=1.1.1' | ||
[FEATURES.SAFE_FALLBACK_HANDLER]: '>=1.1.1', | ||
[FEATURES.ETH_SIGN]: '>=1.1.0' | ||
}; | ||
@@ -21,0 +23,0 @@ const isEnabledByVersion = (feature, version) => { |
MIT License | ||
Copyright (c) 2021-2022 Safe Ecosystem Foundation | ||
Copyright (c) 2021-2023 Safe Ecosystem Foundation | ||
@@ -5,0 +5,0 @@ 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: |
{ | ||
"name": "@safe-global/safe-core-sdk", | ||
"version": "3.2.2", | ||
"version": "3.3.0", | ||
"description": "Safe Core SDK", | ||
@@ -16,8 +16,16 @@ "main": "dist/src/index.js", | ||
"build": "hardhat compile && tsc", | ||
"test:ganache:web3:v1.0.0": "export TEST_NETWORK=ganache && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", | ||
"test:ganache:web3:v1.1.1": "export TEST_NETWORK=ganache && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && hardhat --network localhost deploy && nyc hardhat --network localhost test", | ||
"test:ganache:web3:v1.2.0": "export TEST_NETWORK=ganache && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", | ||
"test:ganache:web3:v1.3.0": "export TEST_NETWORK=ganache && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", | ||
"test:ganache:ethers:v1.0.0": "export TEST_NETWORK=ganache && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", | ||
"test:ganache:ethers:v1.1.1": "export TEST_NETWORK=ganache && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && hardhat --network localhost deploy && nyc hardhat --network localhost test", | ||
"test:ganache:ethers:v1.2.0": "export TEST_NETWORK=ganache && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", | ||
"test:ganache:ethers:v1.3.0": "export TEST_NETWORK=ganache && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && hardhat --network localhost deploy && nyc hardhat --network localhost test", | ||
"test:hardhat:web3:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.0.0 && hardhat deploy && nyc hardhat test", | ||
"test:hardhat:web3:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.1.1 && hardhat deploy && nyc hardhat test", | ||
"test:hardhat:web3:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test", | ||
"test:hardhat:web3:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=web3 && export SAFE_VERSION=1.3.0 && hardhat deploy && nyc hardhat test", | ||
"test:hardhat:ethers:v1.0.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.0.0 && hardhat deploy && nyc hardhat test", | ||
"test:hardhat:ethers:v1.1.1": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.1.1 && hardhat deploy && nyc hardhat test", | ||
"test:hardhat:ethers:v1.2.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.2.0 && hardhat deploy && nyc hardhat test", | ||
@@ -45,5 +53,5 @@ "test:hardhat:ethers:v1.3.0": "export TEST_NETWORK=hardhat && export ETH_LIB=ethers && export SAFE_VERSION=1.3.0 && hardhat deploy && nyc hardhat test", | ||
"@gnosis.pm/safe-contracts-v1.3.0": "npm:@gnosis.pm/safe-contracts@1.3.0", | ||
"@safe-global/safe-ethers-lib": "^1.8.0", | ||
"@safe-global/safe-web3-lib": "^1.8.0", | ||
"@nomiclabs/hardhat-ethers": "^2.2.1", | ||
"@safe-global/safe-ethers-lib": "^1.9.0", | ||
"@safe-global/safe-web3-lib": "^1.9.0", | ||
"@nomiclabs/hardhat-ethers": "^2.2.2", | ||
"@nomiclabs/hardhat-waffle": "^2.0.3", | ||
@@ -54,7 +62,7 @@ "@nomiclabs/hardhat-web3": "^2.0.0", | ||
"@types/mocha": "^10.0.1", | ||
"@types/node": "^18.11.9", | ||
"@types/node": "^18.11.18", | ||
"@types/semver": "^7.3.13", | ||
"@types/yargs": "^16.0.1", | ||
"@typescript-eslint/eslint-plugin": "^5.45.0", | ||
"@typescript-eslint/parser": "^5.45.0", | ||
"@typescript-eslint/eslint-plugin": "^5.48.2", | ||
"@typescript-eslint/parser": "^5.48.2", | ||
"chai": "^4.3.7", | ||
@@ -64,19 +72,27 @@ "chai-as-promised": "^7.1.1", | ||
"dotenv": "^16.0.3", | ||
"eslint": "^8.28.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint": "^8.32.0", | ||
"eslint-config-prettier": "^8.6.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"ethereum-waffle": "^3.4.4", | ||
"ethers": "5.7.2", | ||
"hardhat": "^2.12.2", | ||
"hardhat-deploy": "^0.11.20", | ||
"husky": "^8.0.2", | ||
"lint-staged": "^13.0.4", | ||
"mocha": "^10.1.0", | ||
"hardhat": "^2.12.6", | ||
"hardhat-deploy": "^0.11.22", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^13.1.0", | ||
"mocha": "^10.2.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.8.0", | ||
"prettier": "^2.8.3", | ||
"ts-generator": "^0.1.1", | ||
"typescript": "^4.9.3", | ||
"typescript": "^4.9.4", | ||
"web3": "^1.8.1", | ||
"yargs": "^17.6.2" | ||
}, | ||
"dependencies": { | ||
"@ethersproject/solidity": "^5.7.0", | ||
"@safe-global/safe-core-sdk-types": "^1.9.0", | ||
"@gnosis.pm/safe-deployments": "1.19.0", | ||
"ethereumjs-util": "^7.1.5", | ||
"semver": "^7.3.8", | ||
"web3-utils": "^1.8.1" | ||
}, | ||
"lint-staged": { | ||
@@ -92,11 +108,3 @@ "src/**/!(*test).ts": [ | ||
} | ||
}, | ||
"dependencies": { | ||
"@ethersproject/solidity": "^5.7.0", | ||
"@safe-global/safe-core-sdk-types": "^1.8.0", | ||
"@gnosis.pm/safe-deployments": "1.17.0", | ||
"ethereumjs-util": "^7.1.5", | ||
"semver": "^7.3.8", | ||
"web3-utils": "^1.8.1" | ||
} | ||
} |
@@ -195,3 +195,3 @@ # Safe Core SDK | ||
The `SafeFactory` constructor also accepts the `safeVersion` property to specify the Safe contract version that will be deployed. This string can take the values `1.1.1`, `1.2.0` or `1.3.0`. If not specified, the most recent contract version will be used by default. | ||
The `SafeFactory` constructor also accepts the `safeVersion` property to specify the Safe contract version that will be deployed. This string can take the values `1.0.0`, `1.1.1`, `1.2.0` or `1.3.0`. If not specified, the most recent contract version will be used by default. | ||
@@ -568,3 +568,3 @@ ```js | ||
} | ||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const rejectionTransaction = await safeSdk.createRejectionTransaction(safeTransaction.data.nonce) | ||
@@ -590,3 +590,3 @@ ``` | ||
} | ||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const txHash = await safeSdk.getTransactionHash(safeTransaction) | ||
@@ -603,3 +603,3 @@ ``` | ||
} | ||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const txHash = await safeSdk.getTransactionHash(safeTransaction) | ||
@@ -651,3 +651,3 @@ const signature = await safeSdk.signTransactionHash(txHash) | ||
} | ||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const txHash = await safeSdk.getTransactionHash(safeTransaction) | ||
@@ -692,3 +692,3 @@ const txResponse = await safeSdk.approveTransactionHash(txHash) | ||
} | ||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const txHash = await safeSdk.getTransactionHash(safeTransaction) | ||
@@ -902,3 +902,3 @@ const ownerAddresses = await safeSdk.getOwnersWhoApprovedTx(txHash) | ||
} | ||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const isValidTx = await safeSdk.isValidTransaction(safeTransaction) | ||
@@ -941,3 +941,3 @@ ``` | ||
} | ||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const txResponse = await safeSdk.executeTransaction(safeTransaction) | ||
@@ -944,0 +944,0 @@ await txResponse.transactionResponse?.wait() |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
262760
2521
+ Added@gnosis.pm/safe-deployments@1.19.0(transitive)
- Removed@gnosis.pm/safe-deployments@1.17.0(transitive)