Reference
The API Kit (opens in a new tab) facilitates the interaction with the Safe Transaction Service API (opens in a new tab).
Install dependencies
To add the API Kit to your project, run:
_10yarn add @safe-global/api-kit
Reference
getServiceInfo
Returns the information and configuration of the service.
_10const serviceInfo: SafeServiceInfoResponse = await apiKit.getServiceInfo()
getServiceSingletonsInfo
Returns the list of Safe singletons.
_10const singletons: SafeSingletonResponse = await apiKit.getServiceSingletonsInfo()
decodeData
Decodes the specified Safe transaction data.
_10const decodedData = await apiKit.decodeData(data)
getSafesByOwner
Returns the list of Safes where the address provided is an owner.
_10const safes: OwnerResponse = await apiKit.getSafesByOwner(ownerAddress)
getSafesByModule
Returns the list of Safes where the module address provided is enabled.
_10const safes: ModulesResponse = await getSafesByModule(moduleAddress)
getTransaction
Returns all the information of a Safe transaction.
_10const tx: SafeMultisigTransactionResponse = await apiKit.getTransaction(safeTxHash)
getTransactionConfirmations
Returns the list of confirmations for a given a Safe transaction.
_10const confirmations: SafeMultisigConfirmationListResponse =_10 await apiKit.getTransactionConfirmations(safeTxHash)
confirmTransaction
Adds a confirmation for a Safe transaction.
_10const signature: SignatureResponse = await apiKit.confirmTransaction(safeTxHash, signature)
getSafeInfo
Returns the information and configuration of the provided Safe address.
_10const safeInfo: SafeInfoResponse = await apiKit.getSafeInfo(safeAddress)
getSafeDelegates
Returns the list of delegates for a given Safe address.
_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
Adds a new delegate for a given Safe address.
_10const delegateConfig: AddSafeDelegateProps = {_10 safeAddress, // Optional_10 delegateAddress,_10 delegatorAddress,_10 label,_10 signer_10}_10await apiKit.addSafeDelegate(delegateConfig)
removeSafeDelegate
Removes a delegate for a given Safe address.
_10const delegateConfig: DeleteSafeDelegateProps = {_10 delegateAddress,_10 delegatorAddress,_10 signer_10}_10await apiKit.removeSafeDelegate(delegateConfig)
getSafeCreationInfo
Returns the creation information of a Safe.
_10const safeCreationInfo: SafeCreationInfoResponse = await apiKit.getSafeCreationInfo(_10 safeAddress_10)
estimateSafeTransaction
Estimates the safeTxGas for a given Safe multi-signature transaction.
_10const estimateTx: SafeMultisigTransactionEstimateResponse =_10 await apiKit.estimateSafeTransaction(safeAddress, safeTransaction)
proposeTransaction
Creates a new multi-signature transaction and stores it in the Safe Transaction Service.
_10const transactionConfig: ProposeTransactionProps = {_10 safeAddress,_10 safeTxHash,_10 safeTransactionData,_10 senderAddress,_10 senderSignature,_10 origin_10}_10await apiKit.proposeTransaction(transactionConfig)
getIncomingTransactions
Returns the history of incoming transactions of a Safe account.
_10const incomingTxs: TransferListResponse = await apiKit.getIncomingTransactions(safeAddress)
getModuleTransactions
Returns the history of module transactions of a Safe account.
_10const moduleTxs: SafeModuleTransactionListResponse = await apiKit.getModuleTransactions(_10 safeAddress_10)
getMultisigTransactions
Returns the history of multi-signature transactions of a Safe account.
_10const multisigTxs: SafeMultisigTransactionListResponse = await apiKit.getMultisigTransactions(_10 safeAddress_10)
getPendingTransactions
Returns the list of multi-signature transactions that are waiting for the confirmation of the Safe owners.
_10const pendingTxs: SafeMultisigTransactionListResponse = await apiKit.getPendingTransactions(_10 safeAddress_10)
_10const pendingTxs: SafeMultisigTransactionListResponse = await apiKit.getPendingTransactions(_10 safeAddress,_10 currentNonce_10)
getAllTransactions
Returns a list of transactions for a Safe. The list has different structures depending on the transaction type.
_10const allTxs: SafeMultisigTransactionListResponse = await apiKit.getAllTransactions(_10 safeAddress_10)
_10const allTxsOptions: AllTransactionsOptions = {_10 executed,_10 queued,_10 trusted_10}_10const allTxs: SafeMultisigTransactionListResponse = await apiKit.getAllTransactions(_10 safeAddress,_10 allTxsOptions_10)
getNextNonce
Returns the right nonce to propose a new transaction right after the last pending transaction.
_10const nextNonce = await apiKit.getNextNonce(safeAddress)
getTokenList
Returns the list of all the ERC20 tokens handled by the Safe.
_10const tokens: TokenInfoListResponse = await apiKit.getTokenList()
getToken
Returns the information of a given ERC20 token.
_10const token: TokenInfoResponse = await apiKit.getToken(tokenAddress)
getMessage
Returns a message from its hash.
_10const message: SafeMessage = await apiKit.getMessage(safeMessageHash)
getMessages
Returns the list of messages associated to a Safe account.
_10const messagesResponse: SafeMessageListResponse = await apiKit.getMessages(safeAddress, { ordering, limit, offset })
addMessage
Creates a new message with an initial signature.
_10await apiKit.addMessage(safeAddress, { message, signature, safeAppId })
addMessageSignature
Adds a signature to an existing message.
_10await apiKit.addMessageSignature(safeMessageHash, signature)