SDK
Guides
Migrate to v4

Migrate to v4

This guide references the major changes between v3 and v4 to help those migrating an existing app.

Use API key for default services

Public unauthenticated endpoints will be deprecated. A new apiKey parameter was added to the constructor so you can set your API key when running on Safe default services.

Follow our guide to get an API key.

Once you get your API key, simply pass it to the constructor:


_16
// old:
_16
import SafeApiKit from '@safe-global/api-kit'
_16
_16
const chainId: bigint = 1n
_16
const apiKit = new SafeApiKit({
_16
chainId
_16
})
_16
_16
//new:
_16
import SafeApiKit from '@safe-global/api-kit'
_16
_16
const chainId: bigint = 1n
_16
const apiKit = new SafeApiKit({
_16
chainId,
_16
apiKey: 'YOUR_API_KEY'
_16
})

Updated type

Endpoints returning SafeMultisigTransactionListResponse or types based in this one, have been updated to use the latest version. The following methods are affected:

  • getTransaction()
  • getMultisigTransactions()
  • getPendingTransactions()
  • getAllTransactions()
  • proposeTransaction()

You can expect the following type changes:

  • nonce: from number to string
  • safeTxGas: from number to string
  • baseGas: from number to string

Was this page helpful?