constructor
Returns an instance of the API Kit.
Usage
_12import SafeApiKit from '@safe-global/api-kit'_12_12const chainId = 1n_12_12const txServiceUrl = 'https://...'_12_12// How to get an Api key => http://docs.safe.global/core-api/how-to-use-api-keys_12const apiKit = new SafeApiKit({_12 chainId,_12 txServiceUrl, // Optional_12 apiKey: 'YOUR_API_KEY' // Mandatory if txServiceUrl is not specified_12})
Returns
SafeApiKit
A new instance of the API Kit.
Parameters
chainId
- Type:
bigint
The chain ID.
_10const apiKit = new SafeApiKit({_10 chainId: 1n,_10 apiKey: 'YOUR_API_KEY'_10})
apiKey
- Type:
string
The API key. This parameter is mandatory when using default Safe provided services. It can be omitted if using a custom Transaction Service. Check how to get one.
_10const apiKit = new SafeApiKit({_10 chainId: 1n,_10 apiKey: 'YOUR_API_KEY'_10})
txServiceUrl
(Optional)
- Type:
string
A custom Safe Transaction Service URL that is not supported by default.
_10const apiKit = new SafeApiKit({_10 chainId: 1n,_10 txServiceUrl: 'https://...'_10})