Migrate to v1
This guide references the major changes between safe-service-client
and api-kit
v1 to help those migrating an existing application.
Note: Follow this guide before migrating to api-kit
v2.
After completing this guide, you can remove @safe-global/safe-service-client
from your package.json
.
Adding the new dependency
To add the API Kit to your project, run the following:
_10yarn add @safe-global/api-kit@1.3.1
Change your initialization like this:
_15// old_15import SafeServiceClient from '@safe-global/safe-service-client'_15_15const safeService = new SafeServiceClient({_15 txServiceUrl: 'https://your-transaction-service-url',_15 ethAdapter_15})_15_15// new_15import SafeApiKit from '@safe-global/api-kit'_15_15const apiKit = new SafeApiKit({_15 txServiceUrl: 'https://your-transaction-service-url',_15 ethAdapter_15})
getSafeDelegates()
The getSafeDelegates
was updated to accept more filtering parameters. Now, it accepts an object with multiple properties instead of only the safeAddress
parameter.
_10const delegateConfig: GetSafeDelegateProps = {_10 safeAddress, // Optional_10 delegateAddress, // Optional_10 delegatorAddress, // Optional_10 label, // Optional_10 limit, // Optional_10 offset // Optional_10}_10const delegates: SafeDelegateListResponse = await apiKit.getSafeDelegates(delegateConfig)
addSafeDelegate()
Parameter object properties were updated as follows:
_18// old_18const delegateConfig: SafeDelegateConfig = {_18 safe,_18 delegate,_18 label,_18 signer_18}_18await safeService.addSafeDelegate(delegateConfig)_18_18// new_18const delegateConfig: AddSafeDelegateProps = {_18 safeAddress, // Optional_18 delegateAddress,_18 delegatorAddress,_18 label,_18 signer_18}_18await apiKit.addSafeDelegate(delegateConfig)
removeAllSafeDelegates()
The method was deprecated and removed.
removeSafeDelegate()
Parameter object properties were updated as follows:
_15// old_15const delegateConfig: SafeDelegateDeleteConfig = {_15 safe,_15 delegate,_15 signer_15}_15await safeService.removeSafeDelegate(delegateConfig)_15_15// new_15const delegateConfig: DeleteSafeDelegateProps = {_15 delegateAddress,_15 delegatorAddress,_15 signer_15}_15await apiKit.removeSafeDelegate(delegateConfig)
getBalances()
The method was deprecated and removed.
getUSDBalances()
The method was deprecated and removed.
getCollectibles()
The method was deprecated and removed.