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:_16import SafeApiKit from '@safe-global/api-kit'_16_16const chainId: bigint = 1n_16const apiKit = new SafeApiKit({_16chainId_16})_16_16//new:_16import SafeApiKit from '@safe-global/api-kit'_16_16const chainId: bigint = 1n_16const apiKit = new SafeApiKit({_16chainId,_16apiKey: '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
: fromnumber
tostring
safeTxGas
: fromnumber
tostring
baseGas
: fromnumber
tostring