extend
Extends the functionality of the SafeClient
class.
The Starter Kit offers some extensions that allow this, but you can also implement your own.
onChainMessages
: Enables the use of on-chain messages.offChainMessages
: Enables the use of off-chain messages.safeOperations
: Enables using a bundler and paymaster to submit ERC-4337 user operations.
Usage
_10import { safeOperations } from '@safe-global/sdk-starter-kit'_10import { safeClient } from './setup.ts'_10_10const safeOperationClient = await safeClient.extend(_10 safeOperations({ bundlerUrl }, { isSponsored, paymasterUrl })_10)_10_10const safeOperationResult = await safeOperationClient.sendSafeOperation({_10 transactions_10})
Returns
Promise<SafeClient & T> | SafeClient & T
The SafeClient
with the added functionality.
Parameters
extendFunction
- Type:
(client: SafeClient) => Promise<T> | (client: SafeClient) => T
The extension function that receives the current SafeClient
class and merges it with the added functionality.
_10const safeMessageClient = safeClient.extend(_10 offChainMessages()_10)