SDK
Reference

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:


_10
yarn add @safe-global/api-kit

Reference

getServiceInfo

Returns the information and configuration of the service.


_10
const serviceInfo: SafeServiceInfoResponse = await apiKit.getServiceInfo()

getServiceSingletonsInfo

Returns the list of Safe singletons.


_10
const singletons: SafeSingletonResponse = await apiKit.getServiceSingletonsInfo()

decodeData

Decodes the specified Safe transaction data.


_10
const decodedData = await apiKit.decodeData(data)

getSafesByOwner

Returns the list of Safes where the address provided is an owner.


_10
const safes: OwnerResponse = await apiKit.getSafesByOwner(ownerAddress)

getSafesByModule

Returns the list of Safes where the module address provided is enabled.


_10
const safes: ModulesResponse = await getSafesByModule(moduleAddress)

getTransaction

Returns all the information of a Safe transaction.


_10
const tx: SafeMultisigTransactionResponse = await apiKit.getTransaction(safeTxHash)

getTransactionConfirmations

Returns the list of confirmations for a given a Safe transaction.


_10
const confirmations: SafeMultisigConfirmationListResponse =
_10
await apiKit.getTransactionConfirmations(safeTxHash)

confirmTransaction

Adds a confirmation for a Safe transaction.


_10
const signature: SignatureResponse = await apiKit.confirmTransaction(safeTxHash, signature)

getSafeInfo

Returns the information and configuration of the provided Safe address.


_10
const safeInfo: SafeInfoResponse = await apiKit.getSafeInfo(safeAddress)

getSafeDelegates

Returns the list of delegates for a given Safe address.


_10
const delegateConfig: GetSafeDelegateProps = {
_10
safeAddress, // Optional
_10
delegateAddress, // Optional
_10
delegatorAddress, // Optional
_10
label, // Optional
_10
limit, // Optional
_10
offset // Optional
_10
}
_10
const delegates: SafeDelegateListResponse = await apiKit.getSafeDelegates(delegateConfig)

addSafeDelegate

Adds a new delegate for a given Safe address.


_10
const delegateConfig: AddSafeDelegateProps = {
_10
safeAddress, // Optional
_10
delegateAddress,
_10
delegatorAddress,
_10
label,
_10
signer
_10
}
_10
await apiKit.addSafeDelegate(delegateConfig)

removeSafeDelegate

Removes a delegate for a given Safe address.


_10
const delegateConfig: DeleteSafeDelegateProps = {
_10
delegateAddress,
_10
delegatorAddress,
_10
signer
_10
}
_10
await apiKit.removeSafeDelegate(delegateConfig)

getSafeCreationInfo

Returns the creation information of a Safe.


_10
const safeCreationInfo: SafeCreationInfoResponse = await apiKit.getSafeCreationInfo(
_10
safeAddress
_10
)

estimateSafeTransaction

Estimates the safeTxGas for a given Safe multi-signature transaction.


_10
const estimateTx: SafeMultisigTransactionEstimateResponse =
_10
await apiKit.estimateSafeTransaction(safeAddress, safeTransaction)

proposeTransaction

Creates a new multi-signature transaction and stores it in the Safe Transaction Service.


_10
const transactionConfig: ProposeTransactionProps = {
_10
safeAddress,
_10
safeTxHash,
_10
safeTransactionData,
_10
senderAddress,
_10
senderSignature,
_10
origin
_10
}
_10
await apiKit.proposeTransaction(transactionConfig)

getIncomingTransactions

Returns the history of incoming transactions of a Safe account.


_10
const incomingTxs: TransferListResponse = await apiKit.getIncomingTransactions(safeAddress)

getModuleTransactions

Returns the history of module transactions of a Safe account.


_10
const moduleTxs: SafeModuleTransactionListResponse = await apiKit.getModuleTransactions(
_10
safeAddress
_10
)

getMultisigTransactions

Returns the history of multi-signature transactions of a Safe account.


_10
const 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.


_10
const pendingTxs: SafeMultisigTransactionListResponse = await apiKit.getPendingTransactions(
_10
safeAddress
_10
)


_10
const 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.


_10
const allTxs: SafeMultisigTransactionListResponse = await apiKit.getAllTransactions(
_10
safeAddress
_10
)


_10
const allTxsOptions: AllTransactionsOptions = {
_10
executed,
_10
queued,
_10
trusted
_10
}
_10
const 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.


_10
const nextNonce = await apiKit.getNextNonce(safeAddress)

getTokenList

Returns the list of all the ERC20 tokens handled by the Safe.


_10
const tokens: TokenInfoListResponse = await apiKit.getTokenList()

getToken

Returns the information of a given ERC20 token.


_10
const token: TokenInfoResponse = await apiKit.getToken(tokenAddress)

getMessage

Returns a message from its hash.


_10
const message: SafeMessage = await apiKit.getMessage(safeMessageHash)

getMessages

Returns the list of messages associated to a Safe account.


_10
const messagesResponse: SafeMessageListResponse = await apiKit.getMessages(safeAddress, { ordering, limit, offset })

addMessage

Creates a new message with an initial signature.


_10
await apiKit.addMessage(safeAddress, { message, signature, safeAppId })

addMessageSignature

Adds a signature to an existing message.


_10
await apiKit.addMessageSignature(safeMessageHash, signature)

Was this page helpful?