Package Exports
- @gnosis.pm/safe-service-client
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@gnosis.pm/safe-service-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Safe Service Client
Software development kit that facilitates the interaction with the Safe Transaction Service API.
Installation
Install the package with yarn or npm:
yarn install
npm install
Build
Build the package with yarn or npm:
yarn build
npm build
Getting Started
TBD
const await safeService = new await safeServiceClient('https://safe-transaction.gnosis.io')
API Reference
getServiceInfo
Returns the information and configuration of the service.
const serviceInfo: SafeServiceInfoResponse = await safeService.getServiceInfo()
getServiceMasterCopiesInfo
Returns the list of Safe master copies.
const masterCopies: MasterCopyResponse = await safeService.getServiceMasterCopiesInfo()
decodeData
Decodes the specified Safe transaction data.
const decodedData = await safeService.decodeData(data)
getSafesByOwner
Returns the list of Safes where the address provided is an owner.
const safes: OwnerResponse = await safeService.getSafesByOwner(ownerAddress)
getTransaction
Returns all the information of a Safe transaction.
const tx: SafeMultisigTransactionResponse = await safeService.getTransaction(safeTxHash)
getTransactionConfirmations
Returns the list of confirmations for a given a Safe transaction.
const confirmations: SafeMultisigConfirmationListResponse = await safeService.getTransactionConfirmations(safeTxHash)
confirmTransaction
Adds a confirmation for a Safe transaction.
const signature: SignatureResponse = await safeService.confirmTransaction(safeTxHash, signature)
getSafeInfo
Returns the information and configuration of the provided Safe address.
const safeInfo: SafeInfoResponse = await safeService.getSafeInfo(safeAddress)
getSafeDelegates
Returns the list of delegates for a given Safe address.
const delegates: SafeDelegateListResponse = await safeService.getSafeDelegates(safeAddress)
addSafeDelegate
Adds a new delegate for a given Safe address. The signature is calculated by signing this hash: keccak(address + str(int(current_epoch / 3600))).
await safeService.addSafeDelegate(safeAddress, delegate)
removeSafeDelegate
Removes a delegate for a given Safe address. The signature is calculated by signing this hash: keccak(address + str(int(current_epoch / 3600))).
await safeService.removeSafeDelegate(safeAddress, delegate)
getSafeCreationInfo
Returns the creation information of a Safe.
const safeCreationInfo: SafeCreationInfoResponse = await safeService.getSafeCreationInfo(safeAddress)
estimateSafeTransaction
Estimates the safeTxGas for a given Safe multi-signature transaction.
const estimateTx: SafeMultisigTransactionEstimateResponse = await safeService.estimateSafeTransaction(safeAddress, safeTransaction)
proposeTransaction
Creates a new multi-signature transaction and stores it in the Safe Transaction Service.
await safeService.proposeTransaction(safeAddress, transaction, transactionHash, signature)
getIncomingTransactions
Returns the history of incoming transactions of a Safe account.
const incomingTxs: TransferListResponse = await safeService.getIncomingTransactions(safeAddress)
getModuleTransactions
Returns the history of module transactions of a Safe account.
const moduleTxs: SafeModuleTransactionListResponse = await safeService.getModuleTransactions(safeAddress)
getMultisigTransactions
Returns the history of multi-signature transactions of a Safe account.
const multisigTxs: SafeMultisigTransactionListResponse = await safeService.getMultisigTransactions(safeAddress)
getPendingTransactions
Returns the list of multi-signature transactions that are waiting for the confirmation of the Safe owners.
const pendingTxs: SafeMultisigTransactionListResponse = await safeService.getPendingTransactions(safeAddress)
const pendingTxs: SafeMultisigTransactionListResponse = await safeService.getPendingTransactions(safeAddress, currentNonce)
getBalances
Returns the balances for Ether and ERC20 tokens of a Safe.
const balances: SafeBalanceResponse[] = await safeService.getBalances(safeAddress)
getUsdBalances
Returns the balances for Ether and ERC20 tokens of a Safe with USD fiat conversion.
const usdBalances: SafeBalanceUsdResponse[] = await safeService.getUsdBalances(safeAddress)
getCollectibles
Returns the collectives (ERC721 tokens) owned by the given Safe and information about them.
const collectibles: SafeCollectibleResponse[] = await safeService.getCollectibles(safeAddress)
getTokens
Returns the list of all the ERC20 tokens handled by the Safe.
const tokens: TokenInfoListResponse = await safeService.getTokens()
getToken
Returns the information of a given ERC20 token.
const token: TokenInfoResponse = await safeService.getToken(tokenAddress)
License
This library is released under MIT.
Contributors
- Germán Martínez (germartinez)