@@ -240,6 +240,7 @@ func (api *InfoAPI) GetWithdrawals(address string) (*[]Withdrawal, error) {
240240 for _ , update := range * updates {
241241 if update .Delta .Type == "withdraw" {
242242 withrawal := Withdrawal {
243+ Time : update .Time ,
243244 Hash : update .Hash ,
244245 Amount : update .Delta .Usdc ,
245246 Fee : update .Delta .Fee ,
@@ -258,6 +259,35 @@ func (api *InfoAPI) GetAccountWithdrawals() (*[]Withdrawal, error) {
258259 return api .GetWithdrawals (api .AccountAddress ())
259260}
260261
262+ // Helper function to get the deposits of the given address
263+ // By default returns last 90 days
264+ func (api * InfoAPI ) GetDeposits (address string ) (* []Deposit , error ) {
265+ startTime , endTime := GetDefaultTimeRange ()
266+ updates , err := api .GetNonFundingUpdates (address , startTime , endTime )
267+ if err != nil {
268+ return nil , err
269+ }
270+ var deposits []Deposit
271+ for _ , update := range * updates {
272+ if update .Delta .Type == "deposit" {
273+ deposit := Deposit {
274+ Hash : update .Hash ,
275+ Amount : update .Delta .Usdc ,
276+ Time : update .Time ,
277+ }
278+ deposits = append (deposits , deposit )
279+ }
280+ }
281+ return & deposits , nil
282+ }
283+
284+ // Helper function to get the deposits of the account address
285+ // The same as GetDeposits but user is set to the account address
286+ // Check AccountAddress() or SetAccountAddress() if there is a need to set the account address
287+ func (api * InfoAPI ) GetAccountDeposits () (* []Deposit , error ) {
288+ return api .GetDeposits (api .AccountAddress ())
289+ }
290+
261291// Helper function to build a map of asset names to asset info
262292// It is used to get the assetId for a given asset name
263293func (api * InfoAPI ) BuildMetaMap () (map [string ]AssetInfo , error ) {
0 commit comments