diff --git a/pages/sdk/protocol-kit/reference/safe-factory.md b/pages/sdk/protocol-kit/reference/safe-factory.md index a344e889..bb11b961 100644 --- a/pages/sdk/protocol-kit/reference/safe-factory.md +++ b/pages/sdk/protocol-kit/reference/safe-factory.md @@ -15,6 +15,25 @@ const safeFactory = await SafeFactory.init({ }) ``` +- The `signer` property + + A passkey object can be passed as a signer to initialize an instance of the Safe Factory. + +```typescript +import { SafeFactory, PasskeyArgType } from '@safe-global/protocol-kit' + +const passkey: PasskeyArgType = { + rawId, + publicKey, +} + +const safeFactory = await SafeFactory.init({ + provider, + signer: passkey +}) +``` + + - The `isL1SafeSingleton` flag Two versions of the Safe contracts are available: [Safe.sol](https://github.com/safe-global/safe-contracts/blob/v1.4.1/contracts/Safe.sol) that doesn't trigger events to save gas and [SafeL2.sol](https://github.com/safe-global/safe-contracts/blob/v1.4.1/contracts/SafeL2.sol) that does, which is more appropriate for L2 networks. @@ -52,6 +71,7 @@ const safeFactory = await SafeFactory.init({ signMessageLibAddress: '', createCallAddress: '', simulateTxAccessorAddress: '', + safeWebAuthnSignerFactoryAddress:'', safeSingletonAbi: '', // Optional. Only needed with web3.js safeProxyFactoryAbi: '', // Optional. Only needed with web3.js multiSendAbi: '', // Optional. Only needed with web3.js @@ -60,6 +80,7 @@ const safeFactory = await SafeFactory.init({ signMessageLibAbi: '', // Optional. Only needed with web3.js createCallAbi: '', // Optional. Only needed with web3.js simulateTxAccessorAbi: '' // Optional. Only needed with web3.js + safeWebAuthnSignerFactoryAbi: '' // Optional. Only needed with web3.js } } diff --git a/pages/sdk/protocol-kit/reference/safe.md b/pages/sdk/protocol-kit/reference/safe.md index 69e55b5c..dd570e19 100644 --- a/pages/sdk/protocol-kit/reference/safe.md +++ b/pages/sdk/protocol-kit/reference/safe.md @@ -37,6 +37,26 @@ const protocolKit = await Safe.init({ }) ``` +- The `signer` property + + A passkey object can be passed as a signer to initialize an instance of the Protocol Kit. + +```typescript +import Safe from '@safe-global/protocol-kit' + +const passkey: PasskeyArgType = { + rawId, + publicKey, +} + +const protocolKit = await Safe.init({ + provider, + signer: passkey, + // safeAddress or predictedSafe +}) +``` + + - The `isL1SafeSingleton` flag Two versions of the Safe contracts are available: [Safe.sol](https://github.com/safe-global/safe-contracts/blob/v1.4.1/contracts/Safe.sol) that doesn't trigger events to save gas and [SafeL2.sol](https://github.com/safe-global/safe-contracts/blob/v1.4.1/contracts/SafeL2.sol) that does, which is more appropriate for L2 networks. @@ -75,6 +95,7 @@ const protocolKit = await Safe.init({ signMessageLibAddress: '', createCallAddress: '', simulateTxAccessorAddress: '', + safeWebAuthnSignerFactoryAddress:'', safeSingletonAbi: '', // Optional. Only needed with web3.js safeProxyFactoryAbi: '', // Optional. Only needed with web3.js multiSendAbi: '', // Optional. Only needed with web3.js @@ -83,6 +104,7 @@ const protocolKit = await Safe.init({ signMessageLibAbi: '', // Optional. Only needed with web3.js createCallAbi: '', // Optional. Only needed with web3.js simulateTxAccessorAbi: '' // Optional. Only needed with web3.js + safeWebAuthnSignerFactoryAbi: '' // Optional. Only needed with web3.js } } @@ -174,6 +196,7 @@ protocolKit = await protocolKit.connect({ predictedSafe }) signMessageLibAddress: '', createCallAddress: '', simulateTxAccessorAddress: '', + safeWebAuthnSignerFactoryAddress:'', safeSingletonAbi: '', // Optional. Only needed with web3.js safeProxyFactoryAbi: '', // Optional. Only needed with web3.js multiSendAbi: '', // Optional. Only needed with web3.js @@ -182,6 +205,7 @@ protocolKit = await protocolKit.connect({ predictedSafe }) signMessageLibAbi: '', // Optional. Only needed with web3.js createCallAbi: '', // Optional. Only needed with web3.js simulateTxAccessorAbi: '' // Optional. Only needed with web3.js + safeWebAuthnSignerFactoryAbi: '' // Optional. Only needed with web3.js } } @@ -513,6 +537,22 @@ const txResponse = await protocolKit.executeTransaction(safeTransaction) await txResponse.transactionResponse?.wait() ``` +Instead of using an address, this method also supports the use of a passkey to set the address of the new owner: + +```typescript +const passkey: PasskeyArgType = { + rawId, + publicKey, +} +const params: AddPasskeyOwnerTxParams = { + passkey, + threshold // Optional. If `threshold` isn't provided the current threshold won't change. +} +const safeTransaction = await protocolKit.createAddOwnerTx(params) +const txResponse = await protocolKit.executeTransaction(safeTransaction) +await txResponse.transactionResponse?.wait() +``` + This method can optionally receive the `options` parameter: ```typescript @@ -591,6 +631,17 @@ Checks if a specific address is an owner of the current Safe. const isOwner = await protocolKit.isOwner(address) ``` +A passkey can also be used to check if the signer account is an owner of the current Safe. + +```typescript +const passkey: PasskeyArgType = { + rawId, + publicKey, +} + +const isOwner = await protocolKit.isOwner(passkey) +``` + ## Threshold ### `createChangeThresholdTx` diff --git a/pages/sdk/relay-kit/reference/safe-4337-pack.mdx b/pages/sdk/relay-kit/reference/safe-4337-pack.mdx index 9d963667..8e2f1d4c 100644 --- a/pages/sdk/relay-kit/reference/safe-4337-pack.mdx +++ b/pages/sdk/relay-kit/reference/safe-4337-pack.mdx @@ -40,7 +40,7 @@ The `Safe4337InitOptions` used in the `init()` method are: ```typescript Safe4337InitOptions = { provider: Eip1193Provider | HttpTransport | SocketTransport - signer?: HexAddress | PrivateKey + signer?: HexAddress | PrivateKey | PasskeyArgType bundlerUrl: string rpcUrl: string safeModulesVersion?: string @@ -89,7 +89,7 @@ PaymasterOptions = { ``` - **`provider`** : The EIP-1193 compatible provider or RPC URL of the selected chain. -- **`signer`** : The signer private address if the `provider` doesn't resolve to a signer account. If the `provider` resolves to multiple signer addresses, the `signer` property can be used to specify which account to connect, otherwise the first address returned will be used. +- **`signer`** : A passkey or the signer private key if the `provider` doesn't resolve to a signer account. If the `provider` resolves to multiple signer addresses, the `signer` property can be used to specify which account to connect, otherwise the first address returned will be used. - **`rpcUrl`** : The RPC URL of the selected chain. - **`bundlerUrl`** : The bundler's URL. - **`safeModulesVersion`** : The version of the [Safe Modules contract](https://github.com/safe-global/safe-modules-deployments/tree/main/src/assets/safe-4337-module).