@safe-global/protocol-kit
Advanced tools
Comparing version 4.1.0-alpha.1 to 4.1.0-alpha.2
@@ -16,2 +16,3 @@ import { SingletonDeployment } from '@safe-global/safe-deployments'; | ||
safeWebAuthnSignerFactoryVersion?: string; | ||
safeWebAuthnSharedSignerVersion?: string; | ||
}; | ||
@@ -18,0 +19,0 @@ type SafeDeploymentsVersions = Record<SafeVersion, contractNames>; |
@@ -19,3 +19,4 @@ "use strict"; | ||
simulateTxAccessorVersion: '1.4.1', | ||
safeWebAuthnSignerFactoryVersion: '1.4.1' | ||
safeWebAuthnSignerFactoryVersion: '1.4.1', | ||
safeWebAuthnSharedSignerVersion: '1.4.1' | ||
}, | ||
@@ -32,3 +33,4 @@ '1.3.0': { | ||
simulateTxAccessorVersion: '1.3.0', | ||
safeWebAuthnSignerFactoryVersion: '1.4.1' | ||
safeWebAuthnSignerFactoryVersion: '1.4.1', | ||
safeWebAuthnSharedSignerVersion: '1.4.1' | ||
}, | ||
@@ -44,3 +46,4 @@ '1.2.0': { | ||
createCallVersion: '1.3.0', | ||
safeWebAuthnSignerFactoryVersion: '1.4.1' | ||
safeWebAuthnSignerFactoryVersion: '1.4.1', | ||
safeWebAuthnSharedSignerVersion: '1.4.1' | ||
}, | ||
@@ -56,3 +59,4 @@ '1.1.1': { | ||
createCallVersion: '1.3.0', | ||
safeWebAuthnSignerFactoryVersion: '1.4.1' | ||
safeWebAuthnSignerFactoryVersion: '1.4.1', | ||
safeWebAuthnSharedSignerVersion: '1.4.1' | ||
}, | ||
@@ -68,3 +72,4 @@ '1.0.0': { | ||
createCallVersion: '1.3.0', | ||
safeWebAuthnSignerFactoryVersion: '1.4.1' | ||
safeWebAuthnSignerFactoryVersion: '1.4.1', | ||
safeWebAuthnSharedSignerVersion: '1.4.1' | ||
} | ||
@@ -80,4 +85,5 @@ }; | ||
*/ | ||
// FIXME: use the production deployment packages instead of a hardcoded address | ||
// FIXME: use the production deployment packages instead of a hardcoded addresses | ||
const WEBAUTHN_SIGNER_FACTORY_ADDRESS = '0xc40156AbFEE908E2e3269DA84fa9609bcCDDec60'; | ||
const SAFE_WEBAUTHN_SHARED_SIGNER_ADDRESS = '0x608Cf2e3412c6BDA14E6D8A0a7D27c4240FeD6F1'; | ||
const contractFunctions = { | ||
@@ -103,3 +109,29 @@ safeSingletonVersion: safe_deployments_1.getSafeSingletonDeployment, | ||
networkAddresses: {}, | ||
released: true | ||
released: true, | ||
// There was a major upgrade in safe-deployments, this property was added. | ||
deployments: { | ||
canonical: { | ||
address: WEBAUTHN_SIGNER_FACTORY_ADDRESS, | ||
codeHash: '0x0000000000000000000000000000000000000000000000000000000000000000' | ||
} | ||
} | ||
}), | ||
/* | ||
safeWebAuthnSharedSigner contract is still experimental, and not included in | ||
the production deployment packages, thus we need to hardcode the addresses here | ||
*/ | ||
safeWebAuthnSharedSignerVersion: () => ({ | ||
abi: safe_core_sdk_types_1.SafeWebAuthnSharedSigner_1_4_1_ContractArtifacts.abi, | ||
defaultAddress: SAFE_WEBAUTHN_SHARED_SIGNER_ADDRESS, | ||
version: '1.4.1', | ||
contractName: 'safeWebAuthnSharedSignerVersion', | ||
networkAddresses: {}, | ||
released: true, | ||
// There was a major upgrade in safe-deployments, this property was added. | ||
deployments: { | ||
canonical: { | ||
address: SAFE_WEBAUTHN_SHARED_SIGNER_ADDRESS, | ||
codeHash: '0x0000000000000000000000000000000000000000000000000000000000000000' | ||
} | ||
} | ||
}) | ||
@@ -106,0 +138,0 @@ }; |
@@ -26,2 +26,3 @@ import { JsonFragment, AbstractSigner, Provider } from 'ethers'; | ||
import SafeWebAuthnSignerFactoryContract_v1_4_1 from './SafeWebAuthnSignerFactory/v1.4.1/SafeWebAuthnSignerFactoryContract_v1_4_1'; | ||
import SafeWebAuthnSharedSignerContract_v1_4_1 from './SafeWebAuthnSharedSigner/v1.4.1/SafeWebAuthnSharedSignerContract_v1_4_1'; | ||
import SafeProvider from '../SafeProvider'; | ||
@@ -37,1 +38,2 @@ export declare function getSafeContractInstance(safeVersion: SafeVersion, safeProvider: SafeProvider, contractAddress?: string, customContractAbi?: JsonFragment | JsonFragment[] | undefined, isL1SafeSingleton?: boolean): Promise<SafeContract_v1_4_1 | SafeContract_v1_3_0 | SafeContract_v1_2_0 | SafeContract_v1_1_1 | SafeContract_v1_0_0>; | ||
export declare function getSafeWebAuthnSignerFactoryContractInstance(safeVersion: SafeVersion, safeProvider: SafeProvider, contractAddress?: string, customContractAbi?: JsonFragment | JsonFragment[] | undefined): Promise<SafeWebAuthnSignerFactoryContract_v1_4_1>; | ||
export declare function getSafeWebAuthnSharedSignerContractInstance(safeVersion: SafeVersion, safeProvider: SafeProvider, contractAddress?: string, customContractAbi?: JsonFragment | JsonFragment[] | undefined): Promise<SafeWebAuthnSharedSignerContract_v1_4_1>; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSafeWebAuthnSignerFactoryContractInstance = exports.getSimulateTxAccessorContractInstance = exports.getCreateCallContractInstance = exports.getSignMessageLibContractInstance = exports.getSafeProxyFactoryContractInstance = exports.getMultiSendCallOnlyContractInstance = exports.getMultiSendContractInstance = exports.getCompatibilityFallbackHandlerContractInstance = exports.getSafeContractInstance = void 0; | ||
exports.getSafeWebAuthnSharedSignerContractInstance = exports.getSafeWebAuthnSignerFactoryContractInstance = exports.getSimulateTxAccessorContractInstance = exports.getCreateCallContractInstance = exports.getSignMessageLibContractInstance = exports.getSafeProxyFactoryContractInstance = exports.getMultiSendCallOnlyContractInstance = exports.getMultiSendContractInstance = exports.getCompatibilityFallbackHandlerContractInstance = exports.getSafeContractInstance = void 0; | ||
const CreateCallContract_v1_3_0_1 = __importDefault(require("./CreateCall/v1.3.0/CreateCallContract_v1_3_0")); | ||
@@ -31,2 +31,3 @@ const CreateCallContract_v1_4_1_1 = __importDefault(require("./CreateCall/v1.4.1/CreateCallContract_v1_4_1")); | ||
const SafeWebAuthnSignerFactoryContract_v1_4_1_1 = __importDefault(require("./SafeWebAuthnSignerFactory/v1.4.1/SafeWebAuthnSignerFactoryContract_v1_4_1")); | ||
const SafeWebAuthnSharedSignerContract_v1_4_1_1 = __importDefault(require("./SafeWebAuthnSharedSigner/v1.4.1/SafeWebAuthnSharedSignerContract_v1_4_1")); | ||
async function getSafeContractInstance(safeVersion, safeProvider, contractAddress, customContractAbi, isL1SafeSingleton) { | ||
@@ -210,2 +211,15 @@ const chainId = await safeProvider.getChainId(); | ||
exports.getSafeWebAuthnSignerFactoryContractInstance = getSafeWebAuthnSignerFactoryContractInstance; | ||
async function getSafeWebAuthnSharedSignerContractInstance(safeVersion, safeProvider, contractAddress, customContractAbi) { | ||
const chainId = await safeProvider.getChainId(); | ||
switch (safeVersion) { | ||
case '1.4.1': | ||
case '1.3.0': | ||
const safeWebAuthnSharedSignerContractInstance = new SafeWebAuthnSharedSignerContract_v1_4_1_1.default(chainId, safeProvider, contractAddress, customContractAbi); | ||
await safeWebAuthnSharedSignerContractInstance.init(); | ||
return safeWebAuthnSharedSignerContractInstance; | ||
default: | ||
throw new Error('Invalid Safe version'); | ||
} | ||
} | ||
exports.getSafeWebAuthnSharedSignerContractInstance = getSafeWebAuthnSharedSignerContractInstance; | ||
//# sourceMappingURL=contractInstances.js.map |
@@ -8,2 +8,3 @@ "use strict"; | ||
const config_1 = require("../../contracts/config"); | ||
const utils_1 = require("../../utils"); | ||
/** | ||
@@ -39,3 +40,5 @@ * Abstract class SafeBaseContract extends BaseContract to specifically integrate with the Safe contract. | ||
constructor(chainId, safeProvider, defaultAbi, safeVersion, isL1SafeSingleton = false, customContractAddress, customContractAbi) { | ||
const isL1Contract = config_1.safeDeploymentsL1ChainIds.includes(chainId) || isL1SafeSingleton; | ||
const isL1Contract = config_1.safeDeploymentsL1ChainIds.includes(chainId) || | ||
isL1SafeSingleton || | ||
!(0, utils_1.hasSafeFeature)(utils_1.SAFE_FEATURES.SAFE_L2_CONTRACTS, safeVersion); | ||
const contractName = isL1Contract ? 'safeSingletonVersion' : 'safeSingletonL2Version'; | ||
@@ -42,0 +45,0 @@ super(contractName, chainId, safeProvider, defaultAbi, safeVersion, customContractAddress, customContractAbi); |
import SafeProvider from '../SafeProvider'; | ||
import { CompatibilityFallbackHandlerContractImplementationType, ContractNetworkConfig, CreateCallContractImplementationType, MultiSendCallOnlyContractImplementationType, MultiSendContractImplementationType, SafeContractImplementationType, SafeProxyFactoryContractImplementationType, SafeWebAuthnSignerFactoryContractImplementationType, SignMessageLibContractImplementationType, SimulateTxAccessorContractImplementationType } from '../types'; | ||
import { CompatibilityFallbackHandlerContractImplementationType, ContractNetworkConfig, CreateCallContractImplementationType, MultiSendCallOnlyContractImplementationType, MultiSendContractImplementationType, SafeContractImplementationType, SafeProxyFactoryContractImplementationType, SafeWebAuthnSharedSignerContractImplementationType, SafeWebAuthnSignerFactoryContractImplementationType, SignMessageLibContractImplementationType, SimulateTxAccessorContractImplementationType } from '../types'; | ||
import { SafeVersion } from '@safe-global/safe-core-sdk-types'; | ||
@@ -22,1 +22,2 @@ export interface GetContractInstanceProps { | ||
export declare function getSafeWebAuthnSignerFactoryContract({ safeProvider, safeVersion, customContracts }: GetContractInstanceProps): Promise<SafeWebAuthnSignerFactoryContractImplementationType>; | ||
export declare function getSafeWebAuthnSharedSignerContract({ safeProvider, safeVersion, customContracts }: GetContractInstanceProps): Promise<SafeWebAuthnSharedSignerContractImplementationType>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSafeWebAuthnSignerFactoryContract = exports.getSimulateTxAccessorContract = exports.getCreateCallContract = exports.getSignMessageLibContract = exports.getMultiSendCallOnlyContract = exports.getMultiSendContract = exports.getCompatibilityFallbackHandlerContract = exports.getProxyFactoryContract = exports.getSafeContract = void 0; | ||
exports.getSafeWebAuthnSharedSignerContract = exports.getSafeWebAuthnSignerFactoryContract = exports.getSimulateTxAccessorContract = exports.getCreateCallContract = exports.getSignMessageLibContract = exports.getMultiSendCallOnlyContract = exports.getMultiSendContract = exports.getCompatibilityFallbackHandlerContract = exports.getProxyFactoryContract = exports.getSafeContract = void 0; | ||
async function getSafeContract({ safeProvider, safeVersion, customSafeAddress, isL1SafeSingleton, customContracts }) { | ||
@@ -122,2 +122,15 @@ const safeContract = await safeProvider.getSafeContract({ | ||
exports.getSafeWebAuthnSignerFactoryContract = getSafeWebAuthnSignerFactoryContract; | ||
async function getSafeWebAuthnSharedSignerContract({ safeProvider, safeVersion, customContracts }) { | ||
const safeWebAuthnSharedSignerContract = await safeProvider.getSafeWebAuthnSharedSignerContract({ | ||
safeVersion, | ||
customContractAddress: customContracts?.safeWebAuthnSharedSignerAddress, | ||
customContractAbi: customContracts?.safeWebAuthnSharedSignerAbi | ||
}); | ||
const isContractDeployed = await safeProvider.isContractDeployed(await safeWebAuthnSharedSignerContract.getAddress()); | ||
if (!isContractDeployed) { | ||
throw new Error('safeWebAuthnSharedSigner contract is not deployed on the current network'); | ||
} | ||
return safeWebAuthnSharedSignerContract; | ||
} | ||
exports.getSafeWebAuthnSharedSignerContract = getSafeWebAuthnSharedSignerContract; | ||
//# sourceMappingURL=safeDeploymentContracts.js.map |
@@ -16,3 +16,3 @@ import { Abi } from 'abitype'; | ||
* | ||
* @template SafeWebAuthnSignerFactoryContractAbiType - The ABI type specific to the version of the Safe Proxy Factory contract, extending InterfaceAbi from Ethers. | ||
* @template SafeWebAuthnSignerFactoryContractAbiType - The ABI type specific to the version of the Safe WebAuthn Signer Factory contract, extending InterfaceAbi from Ethers. | ||
* @extends BaseContract<SafeWebAuthnSignerFactoryContractAbiType> - Extends the generic BaseContract. | ||
@@ -19,0 +19,0 @@ * |
@@ -13,3 +13,3 @@ "use strict"; | ||
* | ||
* @template SafeWebAuthnSignerFactoryContractAbiType - The ABI type specific to the version of the Safe Proxy Factory contract, extending InterfaceAbi from Ethers. | ||
* @template SafeWebAuthnSignerFactoryContractAbiType - The ABI type specific to the version of the Safe WebAuthn Signer Factory contract, extending InterfaceAbi from Ethers. | ||
* @extends BaseContract<SafeWebAuthnSignerFactoryContractAbiType> - Extends the generic BaseContract. | ||
@@ -16,0 +16,0 @@ * |
@@ -5,7 +5,9 @@ import Safe from './Safe'; | ||
import { DEFAULT_SAFE_VERSION } from './contracts/config'; | ||
import { getCompatibilityFallbackHandlerContract, getCreateCallContract, getMultiSendCallOnlyContract, getMultiSendContract, getProxyFactoryContract, getSafeContract, getSignMessageLibContract, getSafeWebAuthnSignerFactoryContract } from './contracts/safeDeploymentContracts'; | ||
import { getCompatibilityFallbackHandlerContract, getCreateCallContract, getMultiSendCallOnlyContract, getMultiSendContract, getProxyFactoryContract, getSafeContract, getSignMessageLibContract, getSafeWebAuthnSignerFactoryContract, getSafeWebAuthnSharedSignerContract } from './contracts/safeDeploymentContracts'; | ||
import { PREDETERMINED_SALT_NONCE, encodeCreateProxyWithNonce, encodeSetupCallData, predictSafeAddress, getPredictedSafeAddressInitCode } from './contracts/utils'; | ||
import ContractManager from './managers/contractManager'; | ||
import SafeFactory from './SafeFactory'; | ||
import { EthSafeSignature, estimateTxBaseGas, estimateTxGas, estimateSafeTxGas, estimateSafeDeploymentGas, extractPasskeyData, extractPasskeyCoordinates, validateEthereumAddress, validateEip3770Address } from './utils'; | ||
import { EthSafeSignature, estimateTxBaseGas, estimateTxGas, estimateSafeTxGas, estimateSafeDeploymentGas, extractPasskeyData, getDefaultFCLP256VerifierAddress, extractPasskeyCoordinates, validateEthereumAddress, validateEip3770Address } from './utils'; | ||
import EthSafeTransaction from './utils/transactions/SafeTransaction'; | ||
import EthSafeMessage from './utils/messages/SafeMessage'; | ||
import { SafeTransactionOptionalProps } from './utils/transactions/types'; | ||
@@ -17,4 +19,5 @@ import { encodeMultiSendData, standardizeSafeTransactionData } from './utils/transactions/utils'; | ||
import PasskeySigner from './utils/passkeys/PasskeySigner'; | ||
export { estimateTxBaseGas, estimateTxGas, estimateSafeTxGas, estimateSafeDeploymentGas, extractPasskeyData, extractPasskeyCoordinates, ContractManager, CreateCallBaseContract, createERC20TokenTransferTransaction, DEFAULT_SAFE_VERSION, EthSafeSignature, MultiSendCallOnlyBaseContract, MultiSendBaseContract, PREDETERMINED_SALT_NONCE, SafeBaseContract, SafeFactory, SafeProxyFactoryBaseContract, SafeTransactionOptionalProps, SignMessageLibBaseContract, encodeCreateProxyWithNonce, encodeMultiSendData, encodeSetupCallData, getCompatibilityFallbackHandlerContract, getCreateCallContract, getERC20Decimals, getMultiSendCallOnlyContract, getMultiSendContract, getProxyFactoryContract, getSafeContract, getSignMessageLibContract, getSafeWebAuthnSignerFactoryContract, isGasTokenCompatibleWithHandlePayment, predictSafeAddress, getPredictedSafeAddressInitCode, standardizeSafeTransactionData, validateEip3770Address, validateEthereumAddress, generateSignature, generateEIP712Signature, buildContractSignature, buildSignatureBytes, preimageSafeTransactionHash, preimageSafeMessageHash, getEip712TxTypes, getEip712MessageTypes, hashSafeMessage, generateTypedData, SafeProvider, PasskeySigner }; | ||
import getPasskeyOwnerAddress from './utils/passkeys/getPasskeyOwnerAddress'; | ||
export { estimateTxBaseGas, estimateTxGas, estimateSafeTxGas, estimateSafeDeploymentGas, extractPasskeyData, extractPasskeyCoordinates, ContractManager, CreateCallBaseContract, createERC20TokenTransferTransaction, DEFAULT_SAFE_VERSION, EthSafeSignature, MultiSendCallOnlyBaseContract, MultiSendBaseContract, PREDETERMINED_SALT_NONCE, SafeBaseContract, SafeFactory, SafeProxyFactoryBaseContract, SafeTransactionOptionalProps, SignMessageLibBaseContract, encodeCreateProxyWithNonce, encodeMultiSendData, encodeSetupCallData, getCompatibilityFallbackHandlerContract, getCreateCallContract, getERC20Decimals, getMultiSendCallOnlyContract, getMultiSendContract, getProxyFactoryContract, getSafeContract, getSignMessageLibContract, getSafeWebAuthnSignerFactoryContract, getSafeWebAuthnSharedSignerContract, getDefaultFCLP256VerifierAddress, isGasTokenCompatibleWithHandlePayment, predictSafeAddress, getPredictedSafeAddressInitCode, standardizeSafeTransactionData, validateEip3770Address, validateEthereumAddress, generateSignature, generateEIP712Signature, buildContractSignature, buildSignatureBytes, preimageSafeTransactionHash, preimageSafeMessageHash, getEip712TxTypes, getEip712MessageTypes, hashSafeMessage, generateTypedData, SafeProvider, EthSafeTransaction, EthSafeMessage, PasskeySigner, getPasskeyOwnerAddress }; | ||
export * from './types'; | ||
export default Safe; |
@@ -20,3 +20,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PasskeySigner = exports.SafeProvider = exports.generateTypedData = exports.hashSafeMessage = exports.getEip712MessageTypes = exports.getEip712TxTypes = exports.preimageSafeMessageHash = exports.preimageSafeTransactionHash = exports.buildSignatureBytes = exports.buildContractSignature = exports.generateEIP712Signature = exports.generateSignature = exports.validateEthereumAddress = exports.validateEip3770Address = exports.standardizeSafeTransactionData = exports.getPredictedSafeAddressInitCode = exports.predictSafeAddress = exports.isGasTokenCompatibleWithHandlePayment = exports.getSafeWebAuthnSignerFactoryContract = exports.getSignMessageLibContract = exports.getSafeContract = exports.getProxyFactoryContract = exports.getMultiSendContract = exports.getMultiSendCallOnlyContract = exports.getERC20Decimals = exports.getCreateCallContract = exports.getCompatibilityFallbackHandlerContract = exports.encodeSetupCallData = exports.encodeMultiSendData = exports.encodeCreateProxyWithNonce = exports.SignMessageLibBaseContract = exports.SafeProxyFactoryBaseContract = exports.SafeFactory = exports.SafeBaseContract = exports.PREDETERMINED_SALT_NONCE = exports.MultiSendBaseContract = exports.MultiSendCallOnlyBaseContract = exports.EthSafeSignature = exports.DEFAULT_SAFE_VERSION = exports.createERC20TokenTransferTransaction = exports.CreateCallBaseContract = exports.ContractManager = exports.extractPasskeyCoordinates = exports.extractPasskeyData = exports.estimateSafeDeploymentGas = exports.estimateSafeTxGas = exports.estimateTxGas = exports.estimateTxBaseGas = void 0; | ||
exports.EthSafeTransaction = exports.SafeProvider = exports.generateTypedData = exports.hashSafeMessage = exports.getEip712MessageTypes = exports.getEip712TxTypes = exports.preimageSafeMessageHash = exports.preimageSafeTransactionHash = exports.buildSignatureBytes = exports.buildContractSignature = exports.generateEIP712Signature = exports.generateSignature = exports.validateEthereumAddress = exports.validateEip3770Address = exports.standardizeSafeTransactionData = exports.getPredictedSafeAddressInitCode = exports.predictSafeAddress = exports.isGasTokenCompatibleWithHandlePayment = exports.getDefaultFCLP256VerifierAddress = exports.getSafeWebAuthnSharedSignerContract = exports.getSafeWebAuthnSignerFactoryContract = exports.getSignMessageLibContract = exports.getSafeContract = exports.getProxyFactoryContract = exports.getMultiSendContract = exports.getMultiSendCallOnlyContract = exports.getERC20Decimals = exports.getCreateCallContract = exports.getCompatibilityFallbackHandlerContract = exports.encodeSetupCallData = exports.encodeMultiSendData = exports.encodeCreateProxyWithNonce = exports.SignMessageLibBaseContract = exports.SafeProxyFactoryBaseContract = exports.SafeFactory = exports.SafeBaseContract = exports.PREDETERMINED_SALT_NONCE = exports.MultiSendBaseContract = exports.MultiSendCallOnlyBaseContract = exports.EthSafeSignature = exports.DEFAULT_SAFE_VERSION = exports.createERC20TokenTransferTransaction = exports.CreateCallBaseContract = exports.ContractManager = exports.extractPasskeyCoordinates = exports.extractPasskeyData = exports.estimateSafeDeploymentGas = exports.estimateSafeTxGas = exports.estimateTxGas = exports.estimateTxBaseGas = void 0; | ||
exports.getPasskeyOwnerAddress = exports.PasskeySigner = exports.EthSafeMessage = void 0; | ||
const Safe_1 = __importDefault(require("./Safe")); | ||
@@ -43,2 +44,3 @@ const SafeProvider_1 = __importDefault(require("./SafeProvider")); | ||
Object.defineProperty(exports, "getSafeWebAuthnSignerFactoryContract", { enumerable: true, get: function () { return safeDeploymentContracts_1.getSafeWebAuthnSignerFactoryContract; } }); | ||
Object.defineProperty(exports, "getSafeWebAuthnSharedSignerContract", { enumerable: true, get: function () { return safeDeploymentContracts_1.getSafeWebAuthnSharedSignerContract; } }); | ||
const utils_1 = require("./contracts/utils"); | ||
@@ -61,5 +63,10 @@ Object.defineProperty(exports, "PREDETERMINED_SALT_NONCE", { enumerable: true, get: function () { return utils_1.PREDETERMINED_SALT_NONCE; } }); | ||
Object.defineProperty(exports, "extractPasskeyData", { enumerable: true, get: function () { return utils_2.extractPasskeyData; } }); | ||
Object.defineProperty(exports, "getDefaultFCLP256VerifierAddress", { enumerable: true, get: function () { return utils_2.getDefaultFCLP256VerifierAddress; } }); | ||
Object.defineProperty(exports, "extractPasskeyCoordinates", { enumerable: true, get: function () { return utils_2.extractPasskeyCoordinates; } }); | ||
Object.defineProperty(exports, "validateEthereumAddress", { enumerable: true, get: function () { return utils_2.validateEthereumAddress; } }); | ||
Object.defineProperty(exports, "validateEip3770Address", { enumerable: true, get: function () { return utils_2.validateEip3770Address; } }); | ||
const SafeTransaction_1 = __importDefault(require("./utils/transactions/SafeTransaction")); | ||
exports.EthSafeTransaction = SafeTransaction_1.default; | ||
const SafeMessage_1 = __importDefault(require("./utils/messages/SafeMessage")); | ||
exports.EthSafeMessage = SafeMessage_1.default; | ||
const utils_3 = require("./utils/transactions/utils"); | ||
@@ -86,4 +93,6 @@ Object.defineProperty(exports, "encodeMultiSendData", { enumerable: true, get: function () { return utils_3.encodeMultiSendData; } }); | ||
exports.PasskeySigner = PasskeySigner_1.default; | ||
const getPasskeyOwnerAddress_1 = __importDefault(require("./utils/passkeys/getPasskeyOwnerAddress")); | ||
exports.getPasskeyOwnerAddress = getPasskeyOwnerAddress_1.default; | ||
__exportStar(require("./types"), exports); | ||
exports.default = Safe_1.default; | ||
//# sourceMappingURL=index.js.map |
import { SafeMultisigTransactionResponse, SafeSignature, SafeTransaction, SafeVersion, TransactionOptions, TransactionResult, MetaTransactionData, Transaction, EIP712TypedData } from '@safe-global/safe-core-sdk-types'; | ||
import ContractManager from './managers/contractManager'; | ||
import { AddOwnerTxParams, AddPasskeyOwnerTxParams, ConnectSafeConfig, CreateTransactionProps, RemoveOwnerTxParams, SafeConfig, SigningMethodType, SwapOwnerTxParams, SafeModulesPaginated, PasskeyArgType, RemovePasskeyOwnerTxParams } from './types'; | ||
import { AddOwnerTxParams, AddPasskeyOwnerTxParams, ConnectSafeConfig, CreateTransactionProps, PredictedSafeProps, RemoveOwnerTxParams, SafeConfig, SigningMethodType, SwapOwnerTxParams, SafeModulesPaginated, RemovePasskeyOwnerTxParams } from './types'; | ||
import { SafeTransactionOptionalProps } from './utils/transactions/types'; | ||
@@ -35,2 +35,7 @@ import SafeMessage from './utils/messages/SafeMessage'; | ||
/** | ||
* Returns the predicted Safe configuration. | ||
* @returns {PredictedSafeProps | undefined} The predicted Safe configuration | ||
*/ | ||
getPredictedSafe(): PredictedSafeProps | undefined; | ||
/** | ||
* Returns the address of the current SafeProxy contract. | ||
@@ -142,8 +147,8 @@ * | ||
/** | ||
* Checks if a specific address or passkey is an owner of the current Safe. | ||
* Checks if a specific address is an owner of the current Safe. | ||
* | ||
* @param owner - The owner address or a passkey object | ||
* @param ownerAddress - The account address | ||
* @returns TRUE if the account is an owner | ||
*/ | ||
isOwner(owner: string | PasskeyArgType): Promise<boolean>; | ||
isOwner(ownerAddress: string): Promise<boolean>; | ||
/** | ||
@@ -433,9 +438,2 @@ * Returns a Safe transaction ready to be signed by the owners. | ||
/** | ||
* Returns the owner address of the specific passkey. | ||
* | ||
* @param {PasskeyArgType} passkey The passkey owner | ||
* @returns {Promise<string>} Returns the passkey owner address | ||
*/ | ||
getPasskeyOwnerAddress(passkey: PasskeyArgType): Promise<string>; | ||
/** | ||
* Call the CompatibilityFallbackHandler isValidSignature method | ||
@@ -442,0 +440,0 @@ * |
import { TransactionResponse, AbstractSigner, Provider } from 'ethers'; | ||
import { Eip3770Address, SafeEIP712Args, SafeVersion } from '@safe-global/safe-core-sdk-types'; | ||
import { SafeProviderTransaction, GetContractProps, SafeProviderConfig, Eip1193Provider, HttpTransport, SocketTransport, SafeSigner, SafeConfig, ContractNetworksConfig } from './types'; | ||
import { SafeProviderTransaction, GetContractProps, SafeProviderConfig, SafeSigner, SafeConfig, ContractNetworksConfig } from './types'; | ||
declare class SafeProvider { | ||
#private; | ||
provider: SafeProviderConfig['provider']; | ||
signer?: SafeSigner; | ||
provider: Eip1193Provider | HttpTransport | SocketTransport; | ||
constructor({ provider, signer }: { | ||
@@ -13,3 +13,3 @@ provider: SafeProviderConfig['provider']; | ||
getExternalProvider(): Provider; | ||
static init(provider: SafeConfig['provider'], signer?: SafeConfig['signer'], safeVersion?: SafeVersion, contractNetworks?: ContractNetworksConfig): Promise<SafeProvider>; | ||
static init(provider: SafeConfig['provider'], signer?: SafeConfig['signer'], safeVersion?: SafeVersion, contractNetworks?: ContractNetworksConfig, safeAddress?: string, owners?: string[]): Promise<SafeProvider>; | ||
getExternalSigner(): Promise<AbstractSigner | undefined>; | ||
@@ -32,2 +32,3 @@ isPasskeySigner(): Promise<boolean>; | ||
getSafeWebAuthnSignerFactoryContract({ safeVersion, customContractAddress, customContractAbi }: GetContractProps): Promise<import("./contracts/SafeWebAuthnSignerFactory/v1.4.1/SafeWebAuthnSignerFactoryContract_v1_4_1").default>; | ||
getSafeWebAuthnSharedSignerContract({ safeVersion, customContractAddress, customContractAbi }: GetContractProps): Promise<import("./contracts/SafeWebAuthnSharedSigner/v1.4.1/SafeWebAuthnSharedSignerContract_v1_4_1").default>; | ||
getContractCode(address: string, blockTag?: string | number): Promise<string>; | ||
@@ -34,0 +35,0 @@ isContractDeployed(address: string, blockTag?: string | number): Promise<boolean>; |
@@ -41,3 +41,3 @@ "use strict"; | ||
} | ||
static async init(provider, signer, safeVersion = config_1.DEFAULT_SAFE_VERSION, contractNetworks) { | ||
static async init(provider, signer, safeVersion = config_1.DEFAULT_SAFE_VERSION, contractNetworks, safeAddress, owners) { | ||
const isPasskeySigner = signer && typeof signer !== 'string'; | ||
@@ -57,8 +57,22 @@ if (isPasskeySigner) { | ||
} | ||
const safeWebAuthnSignerFactoryContract = await (0, safeDeploymentContracts_1.getSafeWebAuthnSignerFactoryContract)({ | ||
safeProvider, | ||
safeVersion, | ||
customContracts | ||
}); | ||
const passkeySigner = new PasskeySigner_1.default(signer, safeWebAuthnSignerFactoryContract, safeProvider.getExternalProvider()); | ||
let passkeySigner; | ||
const isPasskeySignerConfig = !(signer instanceof PasskeySigner_1.default); | ||
if (isPasskeySignerConfig) { | ||
// signer is type PasskeyArgType {rawId, coordinates, customVerifierAddress? } | ||
const safeWebAuthnSignerFactoryContract = await (0, safeDeploymentContracts_1.getSafeWebAuthnSignerFactoryContract)({ | ||
safeProvider, | ||
safeVersion, | ||
customContracts | ||
}); | ||
const safeWebAuthnSharedSignerContract = await (0, safeDeploymentContracts_1.getSafeWebAuthnSharedSignerContract)({ | ||
safeProvider, | ||
safeVersion, | ||
customContracts | ||
}); | ||
passkeySigner = await PasskeySigner_1.default.init(signer, safeWebAuthnSignerFactoryContract, safeWebAuthnSharedSignerContract, safeProvider.getExternalProvider(), safeAddress || '', owners || [], chainId.toString()); | ||
} | ||
else { | ||
// signer was already initialized and we pass a PasskeySigner instance (reconnecting) | ||
passkeySigner = signer; | ||
} | ||
return new SafeProvider({ | ||
@@ -146,2 +160,5 @@ provider, | ||
} | ||
async getSafeWebAuthnSharedSignerContract({ safeVersion, customContractAddress, customContractAbi }) { | ||
return (0, contractInstances_1.getSafeWebAuthnSharedSignerContractInstance)(safeVersion, this, customContractAddress, customContractAbi); | ||
} | ||
async getContractCode(address, blockTag) { | ||
@@ -148,0 +165,0 @@ return __classPrivateFieldGet(this, _SafeProvider_externalProvider, "f").getCode(address, blockTag); |
@@ -26,2 +26,3 @@ import { JsonFragment } from 'ethers'; | ||
import SafeWebAuthnSignerFactoryContract_v1_4_1 from '../contracts/SafeWebAuthnSignerFactory/v1.4.1/SafeWebAuthnSignerFactoryContract_v1_4_1'; | ||
import SafeWebAuthnSharedSignerContract_v1_4_1 from '../contracts/SafeWebAuthnSharedSigner/v1.4.1/SafeWebAuthnSharedSignerContract_v1_4_1'; | ||
export type SafeContractImplementationType = SafeContract_v1_0_0 | SafeContract_v1_1_1 | SafeContract_v1_2_0 | SafeContract_v1_3_0 | SafeContract_v1_4_1; | ||
@@ -36,2 +37,3 @@ export type MultiSendContractImplementationType = MultiSendContract_v1_1_1 | MultiSendContract_v1_3_0 | MultiSendContract_v1_4_1; | ||
export type SafeWebAuthnSignerFactoryContractImplementationType = SafeWebAuthnSignerFactoryContract_v1_4_1; | ||
export type SafeWebAuthnSharedSignerContractImplementationType = SafeWebAuthnSharedSignerContract_v1_4_1; | ||
export type GetContractProps = { | ||
@@ -80,2 +82,6 @@ safeVersion: SafeVersion; | ||
safeWebAuthnSignerFactoryAbi?: JsonFragment | JsonFragment[]; | ||
/** safeWebAuthnSharedSignerAddress - Address of the SafeWebAuthnSharedSigner contract deployed on a specific network */ | ||
safeWebAuthnSharedSignerAddress: string; | ||
/** safeWebAuthnSharedSignerAbi - Abi of the SafeWebAuthnSharedSigner contract deployed on a specific network */ | ||
safeWebAuthnSharedSignerAbi?: JsonFragment | JsonFragment[]; | ||
}; | ||
@@ -82,0 +88,0 @@ export type ContractNetworksConfig = { |
@@ -18,3 +18,3 @@ import PasskeySigner from '../utils/passkeys/PasskeySigner'; | ||
provider: Eip1193Provider | HttpTransport | SocketTransport; | ||
signer?: HexAddress | PrivateKey | PasskeyArgType; | ||
signer?: HexAddress | PrivateKey | PasskeySigner | PasskeyArgType; | ||
}; | ||
@@ -21,0 +21,0 @@ export type SafeProviderTransaction = { |
@@ -46,5 +46,6 @@ "use strict"; | ||
{ chainId: 137n, shortName: 'matic' }, | ||
{ chainId: 148n, shortName: 'shimmerevm-mainnet' }, | ||
{ chainId: 148n, shortName: 'shimmerevm' }, | ||
{ chainId: 155n, shortName: 'tenet-testnet' }, | ||
{ chainId: 169n, shortName: 'manta' }, | ||
{ chainId: 179n, shortName: 'abey' }, | ||
{ chainId: 195n, shortName: 'tokb' }, | ||
@@ -68,3 +69,5 @@ { chainId: 196n, shortName: 'okb' }, | ||
{ chainId: 420n, shortName: 'ogor' }, | ||
{ chainId: 424n, shortName: 'PNG' }, | ||
{ chainId: 424n, shortName: 'PGN' }, | ||
{ chainId: 480n, shortName: 'wc' }, | ||
{ chainId: 530n, shortName: 'FxCore' }, | ||
{ chainId: 570n, shortName: 'sys-rollux' }, | ||
@@ -96,4 +99,7 @@ { chainId: 588n, shortName: 'metis-stardust' }, | ||
{ chainId: 1294n, shortName: 'bobabeam' }, | ||
{ chainId: 1329n, shortName: 'sei' }, | ||
{ chainId: 1337n, shortName: 'geth' }, | ||
{ chainId: 1442n, shortName: 'testnet-zkEVM-mango' }, | ||
{ chainId: 1559n, shortName: 'tenet' }, | ||
{ chainId: 1625n, shortName: 'gravity' }, | ||
{ chainId: 1663n, shortName: 'Gobi' }, | ||
@@ -113,2 +119,3 @@ { chainId: 1729n, shortName: 'reya' }, | ||
{ chainId: 2021n, shortName: 'edg' }, | ||
{ chainId: 2039n, shortName: 'aleph' }, | ||
{ chainId: 2221n, shortName: 'tkava' }, | ||
@@ -119,2 +126,3 @@ { chainId: 2222n, shortName: 'kava' }, | ||
{ chainId: 2810n, shortName: 'hmorph' }, | ||
{ chainId: 3338n, shortName: 'PEAQ' }, | ||
{ chainId: 3636n, shortName: 'BTNX' }, | ||
@@ -139,7 +147,10 @@ { chainId: 3737n, shortName: 'csb' }, | ||
{ chainId: 6102n, shortName: 'cascadia' }, | ||
{ chainId: 6321n, shortName: 'eaura' }, | ||
{ chainId: 6322n, shortName: 'aura' }, | ||
{ chainId: 7000n, shortName: 'zetachain-mainnet' }, | ||
{ chainId: 7001n, shortName: 'zetachain-athens' }, | ||
{ chainId: 7001n, shortName: 'zetachain-testnet' }, | ||
{ chainId: 7171n, shortName: 'bitrock' }, | ||
{ chainId: 7332n, shortName: 'EON' }, | ||
{ chainId: 7341n, shortName: 'shyft' }, | ||
{ chainId: 7560n, shortName: 'cyeth' }, | ||
{ chainId: 7700n, shortName: 'canto' }, | ||
@@ -150,2 +161,3 @@ { chainId: 7771n, shortName: 'tbitrock' }, | ||
{ chainId: 8217n, shortName: 'cypress' }, | ||
{ chainId: 8329n, shortName: 'lrz' }, | ||
{ chainId: 8453n, shortName: 'base' }, | ||
@@ -162,2 +174,3 @@ { chainId: 8822n, shortName: 'iotaevm' }, | ||
{ chainId: 10243n, shortName: 'aat' }, | ||
{ chainId: 10849n, shortName: 'lamina1' }, | ||
{ chainId: 11111n, shortName: 'WAGMI' }, | ||
@@ -167,2 +180,4 @@ { chainId: 11235n, shortName: 'islm' }, | ||
{ chainId: 11891n, shortName: 'Arianee' }, | ||
{ chainId: 12324n, shortName: 'l3x' }, | ||
{ chainId: 12325n, shortName: 'l3x-testnet' }, | ||
{ chainId: 12357n, shortName: 'rei-testnet' }, | ||
@@ -176,6 +191,10 @@ { chainId: 12553n, shortName: 'rss3' }, | ||
{ chainId: 17172n, shortName: 'eclipse' }, | ||
{ chainId: 18231n, shortName: 'unreal' }, | ||
{ chainId: 18231n, shortName: 'unreal-old' }, | ||
{ chainId: 18233n, shortName: 'unreal' }, | ||
{ chainId: 22776n, shortName: 'mapo' }, | ||
{ chainId: 23294n, shortName: 'sapphire' }, | ||
{ chainId: 23295n, shortName: 'sapphire-testnet' }, | ||
{ chainId: 28979n, shortName: 'kimbonet-testnet' }, | ||
{ chainId: 32769n, shortName: 'zil' }, | ||
{ chainId: 33101n, shortName: 'zil-testnet' }, | ||
{ chainId: 34443n, shortName: 'mode' }, | ||
@@ -185,2 +204,3 @@ { chainId: 42161n, shortName: 'arb1' }, | ||
{ chainId: 42220n, shortName: 'celo' }, | ||
{ chainId: 42793n, shortName: 'etlk' }, | ||
{ chainId: 43113n, shortName: 'fuji' }, | ||
@@ -191,8 +211,12 @@ { chainId: 43114n, shortName: 'avax' }, | ||
{ chainId: 45000n, shortName: 'autobahnnetwork' }, | ||
{ chainId: 47763n, shortName: 'neox-mainnet' }, | ||
{ chainId: 47805n, shortName: 'rei' }, | ||
{ chainId: 48899n, shortName: 'zircuit-testnet' }, | ||
{ chainId: 53457n, shortName: 'dodochain' }, | ||
{ chainId: 54211n, shortName: 'islmt' }, | ||
{ chainId: 56288n, shortName: 'boba-bnb' }, | ||
{ chainId: 57000n, shortName: 'tsys-rollux' }, | ||
{ chainId: 58008n, shortName: 'sepPNG' }, | ||
{ chainId: 59140n, shortName: 'linea-testnet' }, | ||
{ chainId: 58008n, shortName: 'sepPGN' }, | ||
{ chainId: 59140n, shortName: 'linea-goerli' }, | ||
{ chainId: 59141n, shortName: 'linea-sepolia' }, | ||
{ chainId: 59144n, shortName: 'linea' }, | ||
@@ -204,9 +228,16 @@ { chainId: 71401n, shortName: 'gw-testnet-v1' }, | ||
{ chainId: 80002n, shortName: 'polygonamoy' }, | ||
{ chainId: 80084n, shortName: 'berachainbArtio' }, | ||
{ chainId: 80085n, shortName: 'berachainArtio' }, | ||
{ chainId: 81457n, shortName: 'blastmainnet' }, | ||
{ chainId: 83291n, shortName: 'lrz-testnet' }, | ||
{ chainId: 84531n, shortName: 'basegor' }, | ||
{ chainId: 84532n, shortName: 'basesep' }, | ||
{ chainId: 90001n, shortName: 'dhobyghaut' }, | ||
{ chainId: 103454n, shortName: 'masatest' }, | ||
{ chainId: 105105n, shortName: 'stratis' }, | ||
{ chainId: 111188n, shortName: 're-al' }, | ||
{ chainId: 128123n, shortName: 'etlt' }, | ||
{ chainId: 167000n, shortName: 'tko-mainnet' }, | ||
{ chainId: 167008n, shortName: 'tko-katla' }, | ||
{ chainId: 167009n, shortName: 'tko-hekla' }, | ||
{ chainId: 200101n, shortName: 'milktada' }, | ||
@@ -221,2 +252,3 @@ { chainId: 200202n, shortName: 'milktalgo' }, | ||
{ chainId: 444444n, shortName: 'syndr' }, | ||
{ chainId: 490000n, shortName: 'ATN' }, | ||
{ chainId: 534351n, shortName: 'scr-sepolia' }, | ||
@@ -227,10 +259,18 @@ { chainId: 534352n, shortName: 'scr' }, | ||
{ chainId: 622277n, shortName: 'rth' }, | ||
{ chainId: 656476n, shortName: 'open-campus-codex' }, | ||
{ chainId: 660279n, shortName: 'xai' }, | ||
{ chainId: 713715n, shortName: 'sei-devnet' }, | ||
{ chainId: 764984n, shortName: 'lamina1test' }, | ||
{ chainId: 810180n, shortName: 'zklink-nova' }, | ||
{ chainId: 978657n, shortName: 'treasure-ruby' }, | ||
{ chainId: 6038361n, shortName: 'azkyt' }, | ||
{ chainId: 7225878n, shortName: 'saakuru' }, | ||
{ chainId: 7777777n, shortName: 'zora' }, | ||
{ chainId: 6038361n, shortName: 'azkyt' }, | ||
{ chainId: 11155111n, shortName: 'sep' }, | ||
{ chainId: 11155420n, shortName: 'opsep' }, | ||
{ chainId: 12227332n, shortName: 'neox-t4' }, | ||
{ chainId: 94204209n, shortName: 'polygon-blackberry' }, | ||
{ chainId: 111557560n, shortName: 'cysep' }, | ||
{ chainId: 123420111n, shortName: 'opcelestia-raspberry' }, | ||
{ chainId: 161221135n, shortName: 'plume-testnet' }, | ||
{ chainId: 168587773n, shortName: 'blastsepolia' }, | ||
@@ -241,2 +281,3 @@ { chainId: 222000222n, shortName: 'kanazawa' }, | ||
{ chainId: 333000333n, shortName: 'meld' }, | ||
{ chainId: 476462898n, shortName: 'Skopje' }, | ||
{ chainId: 666666666n, shortName: 'degen-chain' }, | ||
@@ -250,2 +291,3 @@ { chainId: 999999999n, shortName: 'zsep' }, | ||
{ chainId: 11297108109n, shortName: 'palm' }, | ||
{ chainId: 37714555429n, shortName: 'xaitestnet' }, | ||
{ chainId: 88153591557n, shortName: 'arb-blueberry' } | ||
@@ -252,0 +294,0 @@ ]; |
@@ -19,1 +19,2 @@ import { PasskeyCoordinates, PasskeyArgType } from '../../types/passkeys'; | ||
export declare function hexStringToUint8Array(hexString: string): Uint8Array; | ||
export declare function getDefaultFCLP256VerifierAddress(chainId: string): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.hexStringToUint8Array = exports.extractPasskeyCoordinates = exports.extractPasskeyData = void 0; | ||
exports.getDefaultFCLP256VerifierAddress = exports.hexStringToUint8Array = exports.extractPasskeyCoordinates = exports.extractPasskeyData = void 0; | ||
const safe_modules_deployments_1 = require("@safe-global/safe-modules-deployments"); | ||
const buffer_1 = require("buffer"); | ||
@@ -60,2 +61,16 @@ /** | ||
exports.hexStringToUint8Array = hexStringToUint8Array; | ||
function getDefaultFCLP256VerifierAddress(chainId) { | ||
const network = BigInt(chainId).toString(); | ||
const FCLP256VerifierDeployment = (0, safe_modules_deployments_1.getFCLP256VerifierDeployment)({ | ||
version: '0.2.0', | ||
released: true, | ||
network | ||
}); | ||
const verifierAddress = FCLP256VerifierDeployment?.networkAddresses[network]; | ||
if (!verifierAddress) { | ||
throw new Error('FCLP256Verifier address not found'); | ||
} | ||
return verifierAddress; | ||
} | ||
exports.getDefaultFCLP256VerifierAddress = getDefaultFCLP256VerifierAddress; | ||
//# sourceMappingURL=extractPasskeyData.js.map |
export * from './extractPasskeyData'; | ||
export * from './PasskeySigner'; | ||
export * from './getPasskeyOwnerAddress'; |
@@ -19,2 +19,3 @@ "use strict"; | ||
__exportStar(require("./PasskeySigner"), exports); | ||
__exportStar(require("./getPasskeyOwnerAddress"), exports); | ||
//# sourceMappingURL=index.js.map |
import { ethers, AbstractSigner, Provider } from 'ethers'; | ||
import { PasskeyCoordinates, PasskeyArgType } from '../../types/passkeys'; | ||
import { SafeWebAuthnSignerFactoryContractImplementationType } from '../../types/contracts'; | ||
import { SafeWebAuthnSharedSignerContractImplementationType, SafeWebAuthnSignerFactoryContractImplementationType } from '../../types/contracts'; | ||
/** | ||
@@ -21,2 +21,14 @@ * Represents a Signer that is created using a passkey. | ||
/** | ||
* P256 Verifier Contract address. | ||
*/ | ||
verifierAddress: string; | ||
/** | ||
* chainId | ||
*/ | ||
chainId: string; | ||
/** | ||
* signerAddress | ||
*/ | ||
signerAddress: string; | ||
/** | ||
* Safe WebAuthn signer factory Contract. | ||
@@ -26,6 +38,7 @@ */ | ||
/** | ||
* P256 Verifier Contract address. | ||
* Safe WebAuthn shared signer Contract. | ||
*/ | ||
verifierAddress: string; | ||
constructor(passkey: PasskeyArgType, safeWebAuthnSignerFactoryContract: SafeWebAuthnSignerFactoryContractImplementationType, provider: Provider); | ||
safeWebAuthnSharedSignerContract: SafeWebAuthnSharedSignerContractImplementationType; | ||
constructor(passkey: PasskeyArgType, safeWebAuthnSignerFactoryContract: SafeWebAuthnSignerFactoryContractImplementationType, safeWebAuthnSharedSignerContract: SafeWebAuthnSharedSignerContractImplementationType, provider: Provider, chainId: string, signerAddress: string); | ||
static init(passkey: PasskeyArgType, safeWebAuthnSignerFactoryContract: SafeWebAuthnSignerFactoryContractImplementationType, safeWebAuthnSharedSignerContract: SafeWebAuthnSharedSignerContractImplementationType, provider: Provider, safeAddress: string, owners: string[], chainId: string): Promise<PasskeySigner>; | ||
/** | ||
@@ -42,11 +55,2 @@ * Returns the address associated with the passkey signer. | ||
/** | ||
* Creates the deployment transaction to create a passkey signer. | ||
* @returns {string} The deployment transaction to create a passkey signer. | ||
*/ | ||
createPasskeyDeploymentTransaction(): Promise<{ | ||
to: string; | ||
value: string; | ||
data: string; | ||
}>; | ||
/** | ||
* Signs the provided data using the passkey. | ||
@@ -53,0 +57,0 @@ * @param {Uint8Array} data - The data to be signed. |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ethers_1 = require("ethers"); | ||
const constants_1 = require("../constants"); | ||
const extractPasskeyData_1 = require("./extractPasskeyData"); | ||
// FIXME: use the production deployment packages instead of a hardcoded address | ||
const P256_VERIFIER_ADDRESS = process.env.TEST_NETWORK === 'hardhat' | ||
? '0x0287C6F8975f2571E8FAa1D34fe638B1468D563D' // In Hardhat, use the local deployed FCLP256Verifier contract | ||
: '0xcA89CBa4813D5B40AeC6E57A30d0Eeb500d6531b'; // FCLP256Verifier deployed on Sepolia | ||
const isSharedSigner_1 = __importDefault(require("./isSharedSigner")); | ||
/** | ||
@@ -17,10 +16,31 @@ * Represents a Signer that is created using a passkey. | ||
class PasskeySigner extends ethers_1.AbstractSigner { | ||
constructor(passkey, safeWebAuthnSignerFactoryContract, provider) { | ||
constructor(passkey, safeWebAuthnSignerFactoryContract, safeWebAuthnSharedSignerContract, provider, chainId, signerAddress) { | ||
super(provider); | ||
const { rawId, coordinates, customVerifierAddress } = passkey; | ||
this.chainId = chainId; | ||
this.passkeyRawId = (0, extractPasskeyData_1.hexStringToUint8Array)(rawId); | ||
this.coordinates = coordinates; | ||
this.verifierAddress = customVerifierAddress || P256_VERIFIER_ADDRESS; | ||
this.signerAddress = signerAddress; | ||
this.safeWebAuthnSignerFactoryContract = safeWebAuthnSignerFactoryContract; | ||
this.safeWebAuthnSharedSignerContract = safeWebAuthnSharedSignerContract; | ||
this.verifierAddress = customVerifierAddress || (0, extractPasskeyData_1.getDefaultFCLP256VerifierAddress)(chainId); | ||
} | ||
static async init(passkey, safeWebAuthnSignerFactoryContract, safeWebAuthnSharedSignerContract, provider, safeAddress, owners, chainId) { | ||
const { coordinates, customVerifierAddress } = passkey; | ||
const verifierAddress = customVerifierAddress || (0, extractPasskeyData_1.getDefaultFCLP256VerifierAddress)(chainId); | ||
let signerAddress; | ||
const isPasskeySharedSigner = await (0, isSharedSigner_1.default)(passkey, safeWebAuthnSharedSignerContract, safeAddress, owners, chainId); | ||
if (isPasskeySharedSigner) { | ||
signerAddress = await safeWebAuthnSharedSignerContract.getAddress(); | ||
} | ||
else { | ||
; | ||
[signerAddress] = await safeWebAuthnSignerFactoryContract.getSigner([ | ||
BigInt(coordinates.x), | ||
BigInt(coordinates.y), | ||
BigInt(verifierAddress) | ||
]); | ||
} | ||
return new PasskeySigner(passkey, safeWebAuthnSignerFactoryContract, safeWebAuthnSharedSignerContract, provider, chainId, signerAddress); | ||
} | ||
/** | ||
@@ -31,8 +51,3 @@ * Returns the address associated with the passkey signer. | ||
async getAddress() { | ||
const [signerAddress] = await this.safeWebAuthnSignerFactoryContract.getSigner([ | ||
BigInt(this.coordinates.x), | ||
BigInt(this.coordinates.y), | ||
BigInt(this.verifierAddress) | ||
]); | ||
return signerAddress; | ||
return this.signerAddress; | ||
} | ||
@@ -51,19 +66,2 @@ /** | ||
/** | ||
* Creates the deployment transaction to create a passkey signer. | ||
* @returns {string} The deployment transaction to create a passkey signer. | ||
*/ | ||
async createPasskeyDeploymentTransaction() { | ||
const passkeyAddress = await this.getAddress(); | ||
const isPasskeyDeployed = (await this.provider?.getCode(passkeyAddress)) !== constants_1.EMPTY_DATA; | ||
if (isPasskeyDeployed) { | ||
throw new Error('Passkey Signer contract already deployed'); | ||
} | ||
const passkeySignerDeploymentTransaction = { | ||
to: await this.safeWebAuthnSignerFactoryContract.getAddress(), | ||
value: '0', | ||
data: this.encodeCreateSigner() | ||
}; | ||
return passkeySignerDeploymentTransaction; | ||
} | ||
/** | ||
* Signs the provided data using the passkey. | ||
@@ -97,3 +95,3 @@ * @param {Uint8Array} data - The data to be signed. | ||
}; | ||
return new PasskeySigner(passkey, this.safeWebAuthnSignerFactoryContract, provider); | ||
return new PasskeySigner(passkey, this.safeWebAuthnSignerFactoryContract, this.safeWebAuthnSharedSignerContract, provider, this.chainId, this.signerAddress); | ||
} | ||
@@ -100,0 +98,0 @@ signTransaction() { |
@@ -15,3 +15,4 @@ import { SafeContractImplementationType } from '../types'; | ||
SIMULATE_AND_REVERT = "SIMULATE_AND_REVERT", | ||
PASSKEY_SIGNER = "PASSKEY_SIGNER" | ||
PASSKEY_SIGNER = "PASSKEY_SIGNER", | ||
SAFE_L2_CONTRACTS = "SAFE_L2_CONTRACTS" | ||
} | ||
@@ -18,0 +19,0 @@ export declare const hasSafeFeature: (feature: SAFE_FEATURES, version: string) => boolean; |
@@ -18,2 +18,3 @@ "use strict"; | ||
SAFE_FEATURES["PASSKEY_SIGNER"] = "PASSKEY_SIGNER"; | ||
SAFE_FEATURES["SAFE_L2_CONTRACTS"] = "SAFE_L2_CONTRACTS"; | ||
})(SAFE_FEATURES || (exports.SAFE_FEATURES = SAFE_FEATURES = {})); | ||
@@ -28,3 +29,4 @@ const SAFE_FEATURES_BY_VERSION = { | ||
[SAFE_FEATURES.SIMULATE_AND_REVERT]: '>=1.3.0', | ||
[SAFE_FEATURES.PASSKEY_SIGNER]: '>=1.3.0' | ||
[SAFE_FEATURES.PASSKEY_SIGNER]: '>=1.3.0', | ||
[SAFE_FEATURES.SAFE_L2_CONTRACTS]: '>=1.3.0' | ||
}; | ||
@@ -31,0 +33,0 @@ const hasSafeFeature = (feature, version) => { |
@@ -80,4 +80,2 @@ "use strict"; | ||
const signerAddress = await safeProvider.getSignerAddress(); | ||
const isPasskeySigner = await safeProvider.isPasskeySigner(); | ||
const isContractSignature = !!isPasskeySigner; | ||
if (!signerAddress) { | ||
@@ -88,3 +86,3 @@ throw new Error('SafeProvider must be initialized with a signer to use this method'); | ||
signature = (0, exports.adjustVInSignature)(types_1.SigningMethod.ETH_SIGN, signature, hash, signerAddress); | ||
return new SafeSignature_1.EthSafeSignature(signerAddress, signature, isContractSignature); | ||
return new SafeSignature_1.EthSafeSignature(signerAddress, signature); | ||
} | ||
@@ -91,0 +89,0 @@ exports.generateSignature = generateSignature; |
@@ -172,4 +172,4 @@ "use strict"; | ||
}); | ||
//TODO: We should explore contract versions and map to the correct types | ||
//@ts-expect-error: Type too complex to represent. | ||
//TODO: We should explore contract versions and map to the correct types | ||
const execTransactionData = safeSingletonContract.encode('execTransaction', [ | ||
@@ -176,0 +176,0 @@ to, |
{ | ||
"name": "@safe-global/protocol-kit", | ||
"version": "4.1.0-alpha.1", | ||
"version": "4.1.0-alpha.2", | ||
"description": "SDK that facilitates the interaction with Safe Smart Accounts", | ||
@@ -15,3 +15,5 @@ "main": "dist/src/index.js", | ||
"scripts": { | ||
"safe-deployments": "ts-node scripts/checkSafeDeployments.ts", | ||
"check-safe-deployments": "ts-node scripts/safe-deployments/checkSafeDeployments.ts", | ||
"update-safe-deployments": "ts-node scripts/safe-deployments/updateLocalNetworks.ts", | ||
"check-short-name-integrity": "ts-node scripts/safe-deployments/checkShortNameIntegrity.ts", | ||
"test": "mocha -r ts-node/register -r tsconfig-paths/register tests/unit/**/*.ts", | ||
@@ -37,3 +39,3 @@ "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", | ||
"unbuild": "rimraf dist artifacts deployments cache .nyc_output *.tsbuildinfo", | ||
"build": "yarn unbuild && hardhat compile && yarn safe-deployments && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json" | ||
"build": "yarn unbuild && hardhat compile && yarn check-safe-deployments && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json" | ||
}, | ||
@@ -55,3 +57,3 @@ "repository": { | ||
"@gnosis.pm/safe-contracts-v1.3.0": "npm:@gnosis.pm/safe-contracts@1.3.0", | ||
"@nomicfoundation/hardhat-ethers": "^3.0.5", | ||
"@nomicfoundation/hardhat-ethers": "^3.0.6", | ||
"@openzeppelin/contracts": "^2.5.1", | ||
@@ -74,3 +76,3 @@ "@safe-global/safe-contracts-v1.4.1": "npm:@safe-global/safe-contracts@1.4.1", | ||
"tsconfig-paths": "^4.2.0", | ||
"viem": "^2.10.2", | ||
"viem": "^2.15.1", | ||
"web3": "^4.7.0", | ||
@@ -81,9 +83,10 @@ "yargs": "^17.7.2" | ||
"@noble/hashes": "^1.3.3", | ||
"@safe-global/safe-core-sdk-types": "^5.1.0-alpha.1", | ||
"@safe-global/safe-deployments": "^1.36.0", | ||
"@safe-global/safe-core-sdk-types": "^5.1.0-alpha.2", | ||
"@safe-global/safe-deployments": "^1.37.3", | ||
"@safe-global/safe-modules-deployments": "^2.2.0", | ||
"abitype": "^1.0.2", | ||
"ethereumjs-util": "^7.1.5", | ||
"ethers": "^6.12.1", | ||
"semver": "^7.6.1" | ||
"ethers": "^6.13.1", | ||
"semver": "^7.6.2" | ||
} | ||
} |
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
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
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
887216
253
10794
1
8
+ Added@safe-global/safe-modules-deployments@2.2.4(transitive)
Updatedethers@^6.13.1
Updatedsemver@^7.6.2