@safe-global/protocol-kit
Advanced tools
Comparing version 5.0.1 to 5.0.2
@@ -139,13 +139,23 @@ "use strict"; | ||
_BaseContract_instances = new WeakSet(), _BaseContract_resolveAddress = function _BaseContract_resolveAddress(networkAddresses, deployment, deploymentType) { | ||
// If there are no addresses for the given chainId we return undefined | ||
if (!networkAddresses) { | ||
return undefined; | ||
} | ||
// If a custom deployment type is selected, we check that type is available in the given chain | ||
// We ensure that we receive a SingletonDeploymentV2 object for this check, | ||
// otherwise we continue with the next logic (`@safe-global/safe-module-deployments` is not having this property.) | ||
if (deploymentType && deployment && 'deployments' in deployment) { | ||
const customDeploymentTypeAddress = deployment.deployments[deploymentType]?.address; | ||
if (typeof networkAddresses === 'string') { | ||
return networkAddresses === customDeploymentTypeAddress | ||
? customDeploymentTypeAddress | ||
: undefined; | ||
} | ||
return networkAddresses.find((address) => address === customDeploymentTypeAddress); | ||
} | ||
// Deployment type is not selected and there is only one address for this contract in the given chain, we return it | ||
if (typeof networkAddresses === 'string') { | ||
return networkAddresses; | ||
} | ||
if (deploymentType) { | ||
const customDeploymentTypeAddress = deployment.deployments[deploymentType]?.address; | ||
return (networkAddresses.find((address) => address === customDeploymentTypeAddress) ?? | ||
networkAddresses[0]); | ||
} | ||
// If there are multiple addresses available for this contract, we return the first one. | ||
return networkAddresses[0]; | ||
@@ -152,0 +162,0 @@ }; |
@@ -1,2 +0,3 @@ | ||
import { SingletonDeployment } from '@safe-global/safe-deployments'; | ||
import { SingletonDeploymentV2 } from '@safe-global/safe-deployments'; | ||
import { Deployment } from '@safe-global/safe-modules-deployments'; | ||
import { SafeVersion } from '@safe-global/types-kit'; | ||
@@ -28,4 +29,4 @@ import { DeploymentType } from '../types'; | ||
export declare const safeDeploymentsL1ChainIds: bigint[]; | ||
export declare function getContractDeployment(safeVersion: SafeVersion, chainId: bigint, contractName: contractName): SingletonDeployment; | ||
export declare function getContractDeployment(safeVersion: SafeVersion, chainId: bigint, contractName: contractName): SingletonDeploymentV2 | Deployment | undefined; | ||
export declare function getContractInfo(contractAddress: string): ContractInfo | undefined; | ||
export {}; |
@@ -39,6 +39,4 @@ "use strict"; | ||
*/ | ||
constructor(chainId, safeProvider, defaultAbi, safeVersion, isL1SafeSingleton = false, customContractAddress, customContractAbi, deploymentType) { | ||
const isL1Contract = config_1.safeDeploymentsL1ChainIds.includes(chainId) || | ||
isL1SafeSingleton || | ||
!(0, utils_1.hasSafeFeature)(utils_1.SAFE_FEATURES.SAFE_L2_CONTRACTS, safeVersion); | ||
constructor(chainId, safeProvider, defaultAbi, safeVersion, isL1SafeSingleton = config_1.safeDeploymentsL1ChainIds.includes(chainId), customContractAddress, customContractAbi, deploymentType) { | ||
const isL1Contract = isL1SafeSingleton || !(0, utils_1.hasSafeFeature)(utils_1.SAFE_FEATURES.SAFE_L2_CONTRACTS, safeVersion); | ||
const contractName = isL1Contract ? 'safeSingletonVersion' : 'safeSingletonL2Version'; | ||
@@ -45,0 +43,0 @@ super(contractName, chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi, deploymentType); |
@@ -32,3 +32,3 @@ "use strict"; | ||
*/ | ||
constructor(chainId, safeProvider, isL1SafeSingleton = false, customContractAddress, customContractAbi, deploymentType) { | ||
constructor(chainId, safeProvider, isL1SafeSingleton, customContractAddress, customContractAbi, deploymentType) { | ||
const safeVersion = '1.0.0'; | ||
@@ -35,0 +35,0 @@ const defaultAbi = types_kit_1.safe_1_0_0_ContractArtifacts.abi; |
@@ -31,3 +31,3 @@ "use strict"; | ||
*/ | ||
constructor(chainId, safeProvider, isL1SafeSingleton = false, customContractAddress, customContractAbi, deploymentType) { | ||
constructor(chainId, safeProvider, isL1SafeSingleton, customContractAddress, customContractAbi, deploymentType) { | ||
const safeVersion = '1.1.1'; | ||
@@ -34,0 +34,0 @@ const defaultAbi = types_kit_1.safe_1_1_1_ContractArtifacts.abi; |
@@ -30,3 +30,3 @@ "use strict"; | ||
*/ | ||
constructor(chainId, safeProvider, isL1SafeSingleton = false, customContractAddress, customContractAbi, deploymentType) { | ||
constructor(chainId, safeProvider, isL1SafeSingleton, customContractAddress, customContractAbi, deploymentType) { | ||
const safeVersion = '1.2.0'; | ||
@@ -33,0 +33,0 @@ const defaultAbi = types_kit_1.safe_1_2_0_ContractArtifacts.abi; |
@@ -31,3 +31,3 @@ "use strict"; | ||
*/ | ||
constructor(chainId, safeProvider, isL1SafeSingleton = false, customContractAddress, customContractAbi, deploymentType) { | ||
constructor(chainId, safeProvider, isL1SafeSingleton, customContractAddress, customContractAbi, deploymentType) { | ||
const safeVersion = '1.3.0'; | ||
@@ -34,0 +34,0 @@ const defaultAbi = types_kit_1.safe_1_3_0_ContractArtifacts.abi; |
@@ -31,3 +31,3 @@ "use strict"; | ||
*/ | ||
constructor(chainId, safeProvider, isL1SafeSingleton = false, customContractAddress, customContractAbi, deploymentType) { | ||
constructor(chainId, safeProvider, isL1SafeSingleton, customContractAddress, customContractAbi, deploymentType) { | ||
const safeVersion = '1.4.1'; | ||
@@ -34,0 +34,0 @@ const defaultAbi = types_kit_1.safe_1_4_1_ContractArtifacts.abi; |
@@ -126,3 +126,3 @@ "use strict"; | ||
exports.getChainSpecificDefaultSaltNonce = getChainSpecificDefaultSaltNonce; | ||
async function getPredictedSafeAddressInitCode({ safeProvider, chainId, safeAccountConfig, safeDeploymentConfig = {}, isL1SafeSingleton = false, customContracts }) { | ||
async function getPredictedSafeAddressInitCode({ safeProvider, chainId, safeAccountConfig, safeDeploymentConfig = {}, isL1SafeSingleton, customContracts }) { | ||
(0, exports.validateSafeAccountConfig)(safeAccountConfig); | ||
@@ -162,3 +162,3 @@ (0, exports.validateSafeDeploymentConfig)(safeDeploymentConfig); | ||
exports.getPredictedSafeAddressInitCode = getPredictedSafeAddressInitCode; | ||
async function predictSafeAddress({ safeProvider, chainId, safeAccountConfig, safeDeploymentConfig = {}, isL1SafeSingleton = false, customContracts }) { | ||
async function predictSafeAddress({ safeProvider, chainId, safeAccountConfig, safeDeploymentConfig = {}, isL1SafeSingleton, customContracts }) { | ||
(0, exports.validateSafeAccountConfig)(safeAccountConfig); | ||
@@ -165,0 +165,0 @@ (0, exports.validateSafeDeploymentConfig)(safeDeploymentConfig); |
{ | ||
"name": "@safe-global/protocol-kit", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"description": "SDK that facilitates the interaction with Safe Smart Accounts", | ||
@@ -54,4 +54,3 @@ "main": "dist/src/index.js", | ||
"devDependencies": { | ||
"@safe-global/safe-passkey": "0.2.0-alpha.1", | ||
"@safe-global/testing-kit": "^0.1.0", | ||
"@safe-global/testing-kit": "^0.1.1", | ||
"@types/chai": "^4.3.19", | ||
@@ -58,0 +57,0 @@ "@types/chai-as-promised": "^7.1.8", |
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
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 too big to display
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
1020730
13
11155