Starter Kit Reference
SafeClient
constructor

createSafeClient

Returns an instance of the SafeClient class, which enables developers to configure new or existing Safe accounts and handle transactions.

The SafeClient class provides a mechanism to extend its functionality via the extend method.

Usage


_10
import { createSafeClient } from '@safe-global/sdk-starter-kit'
_10
_10
const safeClient = await createSafeClient({
_10
provider,
_10
signer,
_10
safeAddress: '0x...'
_10
})

Use the safeAddress property to use an existing Safe account.

Returns

Promise<SafeClient>

A new instance of the SafeClient class.

Parameters

provider

  • Type: Eip1193Provider | HttpTransport | SocketTransport

The provider connected to the blockchain.


_10
const safeClient = await createSafeClient({
_10
provider,
_10
signer,
_10
safeAddress: '0x...'
_10
})

signer

  • Type: HexAddress | PrivateKey | PasskeyClient

The signer connected to the Safe as an owner.

  • If it's an address, the same address from the provider will be used to sign.
  • If it's a private key, its derived address will be used to sign.
  • If it's a passkey, the passkey will be used to sign.

_10
const safeClient = await createSafeClient({
_10
provider,
_10
signer,
_10
safeAddress: '0x...'
_10
})

safeAddress (Optional)

  • Type: HexAddress

The address of the connected Safe.


_10
const safeClient = await createSafeClient({
_10
provider,
_10
signer,
_10
safeAddress: '0x...'
_10
})

safeOptions.owners (Optional)

  • Type: string[]

The list of owners to configure in the Safe.


_10
const safeClient = await createSafeClient({
_10
provider,
_10
signer,
_10
safeOptions: {
_10
owners: ['0x...', '0x...', '0x...'],
_10
threshold: 2,
_10
saltNonce: 123n
_10
}
_10
})

safeOptions.threshold (Optional)

  • Type: number

The threshold of the Safe. It must be lower or equal to the number of owners.


_10
const safeClient = await createSafeClient({
_10
provider,
_10
signer,
_10
safeOptions: {
_10
owners: ['0x...', '0x...', '0x...'],
_10
threshold: 2,
_10
saltNonce: 123n
_10
}
_10
})

safeOptions.saltNonce (Optional)

  • Type: string

The salt introduces randomness or predictability when the Safe address is generated.


_10
const safeClient = await createSafeClient({
_10
provider,
_10
signer,
_10
safeOptions: {
_10
owners: ['0x...', '0x...', '0x...'],
_10
threshold: 2,
_10
saltNonce: 123n
_10
}
_10
})

Was this page helpful?