bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 12쪽 중 8쪽
reater, by replacing the
SafeFactory.predictSafeAddress
method with the
Safe.getAddress
method:
_
10
// old v4 code
_
10
const predictedSafeAddress = await safeFactory.predictSafeAddress(
_
10
safeAccountConfig,
_
10
saltNonce // optional
_
10
)
_
10
_
10
// new v5 code
_
10
const predictedSafeAddress = await protocolKit.getAddress()
Migration Steps
Remove any import or reference of the
SafeFactory
class from your code.
Replace the
SafeFactory.deploySafe
method with the
Safe.createSafeDeploymentTransaction
method where necessary. You can use your Ethereum client to execute this deployment transaction.
To predict the Address of your Safe Account, replace the
SafeFactory.predictSafeAddress
method with the
Safe.getAddress
method.
After the deployment transaction has been executed, it is necessary to reconnect the Protocol Kit instance to the newly created Safe address by using the
connect
method.
The removal of
SafeFactory
means there’s one less class to initialize and manage within your project. You can now directly use the
Safe
class to handle all operations related to Safes, including their deployment.
Migrate to v4
Migrate to v6
Was this page helpful?
Report issue
## /sdk/protocol-kit/guides/migrate-to-v6
SDK
Protocol Kit
Guides
Migrate to v6
Migrate to v6
This guide references the major changes between v5 and v6 to help those migrating an existing app.
Removing
SigningMethod
and
SigningMethodType
We moved these types to the
api-kit
.
_
10
// old v5 code
_
10
import { SigningMethod, SigningMethodType } from '@safe-global/protocol-kit'
_
10
_
10
// new v6 code
_
10
import { SigningMethod, SigningMethodType } from '@safe-global/types-kit'
Migrate to v5
Migrate to v7
Was this page helpful?
Report issue
## /sdk/protocol-kit/guides/migrate-to-v7
SDK
Protocol Kit
Guides
Migrate to v7
Migrate to v7
Overview
This release adds support for Safe v1.5.0 smart contracts across the SDK suite (
types-kit
,
protocol-kit
,
api-kit
, and
sdk-starter-kit
). It includes breaking changes that require attention when upgrading.
Breaking Changes
1.
DEFAULT_SAFE_VERSION
changed from
1.3.0
to
1.4.1
Affected package:
protocol-kit
The default Safe version used when no explicit version is provided has changed from
1.3.0
to
1.4.1
. This affects Safe creation, deployment, and address prediction.
Before:
_
10
// Implicitly deployed a Safe v1.3.0
_
10
const protocolKit = await Safe.init({
_
10
provider,
_
10
signer,
_
10
predictedSafe: {
_
10
safeAccountConfig: { owners, threshold }
_
10
}
_
10
})
After:
_
10
// Now implicitly deploys a Safe v1.4.1
_
10
const protocolKit = await Safe.init({
_
10
provider,
_
10
signer,
_
10
predictedSafe: {
_
10
safeAccountConfig: { owners, threshold }
_
10
}
_
10
})
⚠️
Warning:
Predicted Safe addresses will differ if you were relying on the previous default. Make sure to pin the version explicitly in production environments.
How to migrate:
If your application depends on deploying Safe v1.3.0 contracts, explicitly set the version:
_
10
const protocolKit = await Safe.init({
_
10
provider,
_
10
signer,
_
10
predictedSafe: {
_
10
safeAccountConfig: { owners, threshold },
_
10
safeDeploymentConfig: {
_
10
safeVersion: '1.3.0'
_
10
}
_
10
}
_
10
})
2.
encodeTransactionData
removed from the Safe contract in v1.5.0
Affected packages:
protocol-kit
,
types-kit
In Safe v1.5.0, the
encodeTransactionData
function has been removed from the Safe contract and relocated to the
CompatibilityFallbackHandler
.
Before (≤ v1.4.1):
_
13
// Called directly on the Safe contract
_
13
const data = await safeContract.encodeTransactionData(
_
13
to,
_
13
value,
_
13
data,
_
13
operation,
_
13
safeTxGas,
_
13
baseGas,
_
13
gasPrice,
_
13
gasToken,
_
13
refundReceiver,
_
13
nonce
_
13
)
After (v1.5.0):
Calling
encodeTransactionData
on a Safe v1.5.0 contract will
revert on-chain
.
How to migrate:
For Safe v1.5.0, use the
CompatibilityFallbackHandler
contract instead:
_
19
import { getCompatibilityFallbackHandlerContract } from '@safe-global/protocol-kit'
_
19
_
19
const fallbackHandler = await getCompatibilityFallbackHandlerContract({
_
19
safeProvider,
_
19
safeVersion: '1.5.0'
_
19
})
_
19
_
19
const data = await fallbackHandler.encodeTransactionData(
_
19
to,
_
19
value,
_
19
data,
_
19
operation,
_
19
safeTxGas,
_
19
baseGas,
_
19
gasPrice,
_
19
gasToken,
_
19
refundReceiver,
_
19
nonce
_
19
)
If you need to support multiple Safe versions, add a version check:
_
10
import { semverSatisfies } from '@safe-global/protocol-kit'
_
10
_
10
if (semverSatisfies(safeVersion, '>=1.5.0')) {
_
10
// Use CompatibilityFallbackHandler
_
10
} else {
_
10
// Use Safe contract directly
_
10
}
3. Legacy
isValidSignature(bytes, bytes)
removed in v1.5.0
Affected package:
protocol-kit
The
CompatibilityFallbackHandler
in Safe v1.5.0 no longer exposes the legacy
isValidSignature(bytes, bytes)
overload. Only the modern EIP-1271 overload
isValidSignature(bytes32, bytes)
is supported.
Before (≤ v1.4.1):
The SDK called both overloads in parallel during signature validation:
isValidSignature(bytes32, bytes)
: EIP-1271 standard
isValidSignature(bytes, bytes)
: Legacy overload
After (v1.5.0):
Only the modern overload is called. The legacy call would
revert or return invalid data
against a v1.5.0 Safe.
How to migrate:
If you are calling
isValidSignature
directly, ensure you use the
bytes32
overload:
_
10
// ✅ Correct for all versions
_
10
const result = await safeContract.isValidSignature(messageHash, signature)
_
10
// where messageHash is bytes32
_
10
_
10
// ❌ Will fail on v1.5.0
_
10
const result = await safeContract.isValidSignature(messageBytes, signature)
_
10
// where messageBytes is raw bytes
Note:
The SDK handles this internally. If you rely on the SDK's
isValidSignature
method in the
Safe
class, no changes are needed, the SDK now conditionally skips the legacy call for v1.5.0+.
4.
SafeVersion
type extended with
'1.5.0'
Affected package:
types-kit
The
SafeVersion
union type now includes
'1.5.0'
as a valid value.
Before:
_
10
type SafeVersion = '1.0.0' | '1.1.1' | '1.2.0' | '1.3.0' | '1.4.1'
After:
_
10
type SafeVersion = '1.0.0' | '1.1.1' | '1.2.0' | '1.3.0' | '1.4.1' | '1.5.0'
How to migrate:
If your code performs exhaustive checks on
SafeVersion
, add a case for
'1.5.0'
:
_
22
// Before — will cause a TypeScript compilation error
_
22
switch (version) {
_
22
case '1.0.0': // ...
_
22
case '1.1.1': // ...
_
22
case '1.2.0': // ...
_
22
case '1.3.0': // ...
_
22
case '1.4.1': // ...
_
22
default:
_
22
const \_exhaustive: never = version // ❌ TS error
_
22
}
_
22
_
22
// After — add the new version
_
22
switch (version) {
_
22
case '1.0.0': // ...
_
22
case '1.1.1': // ...
_
22
case '1.2.0': // ...
_
22
case '1.3.0': // ...
_
22
case '1.4.1': // ...
_
22
case '1.5.0': // ...
_
22
default:
_
22
const \_exhaustive: never = version // ✅
_
22
}
5. Passkey Verifier Changes
The
FCLP256Verifier
contract used as the default P256 signature verifier for passkey signers has been deprecated. This release removes the silent default and migrates to
DaimoP256Verifier
as the new recommended verifier.
As part of this change, the passkey API has been cleaned up to make the verifier address
explicit and required
at setup time. This prevents a class of bugs where existing passkeys could silently resolve to a wrong signer address if the default ever changed.
PasskeyArgType
now requires
verifierAddress
The optional
customVerifierAddress?: string
field has been replaced by a required
verifierAddress: string
.
_
13
// ❌ Before
_
13
const passkey: PasskeyArgType = {
_
13
rawId: '...',
_
13
coordinates: { x: '...', y: '...' },
_
13
customVerifierAddress: '0x...' // optional, SDK filled in a default if omitted
_
13
}
_
13
_
13
// ✅ After
_
13
const passkey: PasskeyArgType = {
_
13
rawId: '...',
_
13
coordinates: { x: '...', y: '...' },
_
13
verifierAddress: '0x...' // required, no default
_
13
}
New type
ExtractedPasskeyData
A new type has been introduced to represent the raw output of credential extraction, just
rawId
and
coordinates
.
PasskeyArgType
now extends this type.
_
11
// ExtractedPasskeyData — what you get from a WebAuthn credential alone
_
11
type ExtractedPasskeyData = {
_
11
rawId: string
_
11
coordinates: PasskeyCoordinates
_
11
}
_
11
_
11
// PasskeyArgType — what you need to use the passkey as a Safe signer
_
11
type PasskeyArgType = ExtractedPasskeyData & {
_
11
verifierAddress: string
_
11
getFn?: GetPasskeyCredentialFn
_
11
}
Safe.createPasskeySigner()
return type changed
This method now returns
ExtractedPasskeyData
instead of
PasskeyArgType
. You must combine the result with a
verifierAddress
before passing it to
Safe.init()
.
_
10
// ❌ Before — result was directly usable as a signer
_
10
const signer = await Safe.createPasskeySigner(credential)
_
10
// signer was PasskeyArgType (verifier defaulted silently)
_
10
_
10
// ✅ After — must add verifierAddress explicitly
_
10
const extracted = await Safe.createPasskeySigner(credential)
_
10
const signer: PasskeyArgType = {
_
10
...extracted,
_
10
verifierAddress: getP256VerifierAddress(chainId)
_
10
}
getDefaultFCLP256VerifierAddress()
removed
This internal function has been replaced by the new public export
getP256VerifierAddress(chainId)
, which returns the
DaimoP256Verifier
address for a given chain.
_
10
// ❌ Before (internal, not recommended for direct use)
_
10
import { getDefaultFCLP256VerifierAddress } from '@safe-global/protocol-kit'
_
10
const address = getDefaultFCLP256VerifierAddress(chainId)
_
10
_
10
// ✅ After
_
10
import { getP256VerifierAddress } from '@safe-global/protocol-kit'
_
10
const address = getP256VerifierAddress(chainId)
chainId
parameter removed from
createPasskeyClient
and
isSharedSigner
Both functions no longer accept a
chainId
argument, as it was only used internally to resolve the default verifier.
We changed the default verifier from
FCLP256Verifier
to
DaimoP256Verifier
. If you were relying on the old default, you must now explicitly provide the new verifier address when constructing your passkey signer. You can use
@safe-global/safe-deployments
(opens in a new tab)
v2 to resolve the correct address for your chain, or hard-code it if you prefer.
_
12
// ❌ Before
_
12
await createPasskeyClient(
_
12
passkey,
_
12
contract,
_
12
provider,
_
12
safeAddress,
_
12
owners,
_
12
chainId
_
12
)
_
12
_
12
// ✅ After
_
12
await createPasskeyClient(passkey, contract, provider, safeAddress, owners)
Full Migration Example
Setting up a new passkey signer
_
26
import Safe, {
_
26
getP256VerifierAddress,
_
26
type PasskeyArgType
_
26
} from '@safe-global/protocol-kit'
_
26
_
26
// 1. Create a WebAuthn credential (for example, via navigator.credentials.create)
_
26
const credential = await navigator.credentials.create({ publicKey: { ... } })
_
26
_
26
// 2. Extract the passkey data from the credential
_
26
const extracted = await Safe.createPasskeySigner(credential)
_
26
_
26
// 3. Get the recommended verifier address for your chain
_
26
const verifierAddress = getP256VerifierAddress(chainId)
_
26
_
26
// 4. Build the full PasskeyArgType
_
26
const passkeySigner: PasskeyArgType = {
_
26
...extracted,
_
26
verifierAddress
_
26
}
_
26
_
26
// 5. Use it to initialize a Safe
_
26
const protocolKit = await Safe.init({
_
26
provider,
_
26
signer: passkeySigner,
_
26
safeAddress: '0x...'
_
26
})
Using a custom verifier
If your deployment uses a custom P256 verifier (for example, for testing or a non-standard chain), pass its address directly:
_
10
const passkeySigner: PasskeyArgType = {
_
10
...extracted,
_
10
verifierAddress: '0xYourCustomVerifierAddress'
_
10
}
Reconnecting an existing passkey (stored credentials)
If you store passkey data and reload it across sessions, make sure to persist and restore
verifierAddress
:
_
17
// When saving
_
17
localStorage.setItem(
_
17
'passkey',
_
17
JSON.stringify({
_
17
rawId: passkeySigner.rawId,
_
17
coordinates: passkeySigner.coordinates,
_
17
verifierAddress: passkeySigner.verifierAddress // ← persist this!
_
17
})
_
17
)
_
17
_
17
// When loading
_
17
const stored = JSON.parse(localStorage.getItem('passkey'))
_
17
const passkeySigner: PasskeyArgType = {
_
17
rawId: stored.rawId,
_
17
coordinates: stored.coordinates,
_
17
verifierAddress: stored.verifierAddress // ← restore it
_
17
}
⚠️
Important:
The
verifierAddress
is baked into the Safe's on-chain state at passkey setup time. Always restore the
original
verifier address that was used when the passkey owner was added to the Safe. Using a different address will cause the signer resolution to fail silently.
New Features (non-breaking)
ExtensibleFallbackHandler contract
A new
ExtensibleFallbackHandler
contract is available for Safe v1.5.0 with read and write methods:
_
16
import { getExtensibleFallbackHandlerContract } from '@safe-global/protocol-kit'
_
16
_
16
const handler = await getExtensibleFallbackHandlerContract({
_
16
safeProvider,
_
16
safeVersion: '1.5.0'
_
16
})
_
16
_
16
// Read methods
_
16
await handler.domainVerifiers(safe, domainSeparator)
_
16
await handler.safeMethods(safe, selector)
_
16
await handler.safeInterfaces(safe, interfaceId)
_
16
_
16
// Write methods (executed as Safe transactions)
_
16
await handler.setSafeMethod(selector, newMethod)
_
16
await handler.setDomainVerifier(domainSeparator, verifier)
_
16
await handler.setSupportedInterface(interfaceId, supported)
checkNSignatures
with executor parameter
Safe v1.5.0 adds a new overload of
checkNSignatures
and
checkSignatures
that accepts an explicit
executor
address:
_
10
// Original (all versions)
_
10
await safeContract.checkNSignatures(dataHash, signatures, requiredSignatures)
_
10
_
10
// New overload (v1.5.0 only)
_
10
await safeContract.checkNSignaturesWithExecutor(
_
10
executor,
_
10
dataHash,
_
10
signatures,
_
10
requiredSignatures
_
10
)
Module Guard support
Safe v1.5.0 introduces module guards. New methods are available in the
Safe
class:
_
10
// Enable a module guard
_
10
const tx = await protocolKit.createEnableModuleGuardTx(moduleGuardAddress)
_
10
_
10
// Disable the module guard
_
10
const tx = await protocolKit.createDisableModuleGuardTx()
Note:
Module guard functionality is only available for Safe v1.5.0+. Calling these methods on earlier versions will throw an error.
Deprecations
zkSync EraVM support in
predictSafeAddress
The zkSync EraVM-specific logic in
predictSafeAddress
has been deprecated for Safe v1.5.0. If you are predicting Safe addresses on zkSync with v1.5.0 contracts, be aware that this path is no longer supported.
Quick Reference
Change
Action Required
Packages
Default version →
1.4.1
Pin
safeVersion
explicitly if you need
1.3.0
protocol-kit
encodeTransactionData
moved
Use
CompatibilityFallbackHandler
for v1.5.0
protocol-kit
,
types-kit
Legacy
isValidSignature
removed
Use
bytes32
overload only for v1.5.0
protocol-kit
SafeVersion
type extended
Add
'1.5.0'
case to exhaustive switches
types-kit
PasskeyArgType.customVerifierAddress
removed
Use
verifierAddress
(required) instead
protocol-kit
PasskeyArgType.verifierAddress
added
Provide
verifierAddress
when constructing passkey arguments
protocol-kit
ExtractedPasskeyData
type added
Use new type
{ rawId, coordinates }
where applicable
protocol-kit
Safe.createPasskeySigner()
return type changed
Expect
ExtractedPasskeyData
instead of
PasskeyArgType
protocol-kit
getDefaultFCLP256VerifierAddress()
removed
Use
getP256VerifierAddress(chainId)
instead
protocol-kit
getP256VerifierAddress(chainId)
added
New public export to resolve the P256 verifier address
protocol-kit
createPasskeyClient
signature changed
Remove
chainId
argument from call sites
protocol-kit
isSharedSigner
signature changed
Remove
chainId
argument from call sites
protocol-kit
Migrate to v6
Reference
Was this page helpful?
Report issue
## /reference-sdk-protocol-kit/overview
Protocol Kit Reference
Overview
Protocol Kit Reference
The
Protocol Kit
(opens in a new tab)
facilitates the interaction with the Safe smart account contracts.
Install dependencies
To add the Protocol Kit to your project, run:
_
10
yarn add @safe-global/protocol-kit
← Go Back
connect
Was this page helpful?
Report issue
## /sdk/api-kit
SDK
API Kit
API Kit
The API Kit facilitates the interaction with the
Safe Transaction Service API
, allowing to propose and share transactions with the other signers of a Safe, sending the signatures to the service to collect them, getting information about a Safe (like reading the transaction history, pending transactions, enabled Modules and Guards, etc.), among other features.
@safe-global/api-kit
The following guides show how to use the API Kit and integrate it into your project:
Propose and confirm transactions
Resources
API Kit on GitHub
(opens in a new tab)
Reference
Propose and Confirm Transactions
Was this page helpful?
Report issue
## /sdk/api-kit/guides/propose-and-confirm-transactions
SDK
API Kit
Guides
Propose and Confirm Transactions
Propose and confirm transactions
In this guide you will learn how to propose transactions to the service and collect the signatures from the owners so they become executable.
For more detailed information, see the
API Kit Reference
.
Prerequisites
Node.js and npm
(opens in a new tab)
A Safe with several signers
Steps
Install dependencies
First, you need to install some dependencies.
_
10
yarn add @safe-global/api-kit \
_
10
@safe-global/protocol-kit \
_
10
@safe-global/types-kit
Imports
Here are all the necessary imports for this guide.
_
10
import SafeApiKit from '@safe-global/api-kit'
_
10
import Safe from '@safe-global/protocol-kit'
_
10
import {
_
10
MetaTransactionData,
_
10
OperationType
_
10
} from '@safe-global/types-kit'
Setup
We will use a Safe account setup with two or more signers, and threshold two, so at least multiple signatures will need to be collected when executing a transaction.
_
10
// https://chainlist.org/?search=sepolia&testnets=true
_
10
const RPC_URL = 'https://ethereum-sepolia-rpc.publicnode.com'
_
10
_
10
const SAFE_ADDRESS = // ...
_
10
_
10
const OWNER_1_ADDRESS = // ...
_
10
const OWNER_1_PRIVATE_KEY = // ...
_
10
_
10
const OWNER_2_PRIVATE_KEY = // ...
Initialize the API Kit
Firstly, you need to create an instance of the API Kit. In chains where the
Safe Transaction Service
is supported, it's enough to specify the
chainId
property.
_
10
// How to get an Api key => http://docs.safe.global/core-api/how-to-use-api-keys
_
10
const apiKit = new SafeApiKit({
_
10
chainId: 1n,
_
10
apiKey: 'YOUR_API_KEY'
_
10
})
Alternatively, you can use a custom service using the optional
txServiceUrl
property.
_
10
const apiKit = new SafeApiKit({
_
10
chainId: 1n, // set the correct chainId
_
10
txServiceUrl: 'https://url-to-your-custom-service'
_
10
})
Initialize the Protocol Kit
To handle transactions and signatures, you need to create an instance of the Protocol Kit with the
provider
,
signer
and
safeAddress
.
_
10
const protocolKitOwner1 = await Safe.init({
_
10
provider: RPC_URL,
_
10
signer: OWNER_1_PRIVATE_KEY,
_
10
safeAddress: SAFE_ADDRESS
_
10
})
Propose a transaction to the service
Before a transaction can be executed, any of the Safe signers needs to initiate the process by creating a proposal of a transaction. This transaction is sent to the service to make it accessible by the other owners so they can give their approval and sign the transaction as well.
For a full list and description of the properties see
proposeTransaction
in the API Kit reference.
_
23
// Create transaction
_
23
const safeTransactionData: MetaTransactionData = {
_
23
to: '0x',
_
23
value: '1', // 1 wei
_
23
data: '0x',
_
23
operat프로젝트로 돌아가기