/ src / modules / history / v2-user-history-query.ts
v2-user-history-query.ts
  1  export const USER_TRANSACTIONS_V2_WITH_POOL = `
  2  query UserTransactions($userAddress: String!, $first: Int!, $skip: Int!, $pool: String!) {
  3    userTransactions(where: { user: $userAddress, pool: $pool }, orderBy: timestamp, orderDirection: desc, first: $first, skip: $skip) {
  4      id
  5      timestamp
  6      txHash
  7      action
  8      ... on Deposit {
  9        amount
 10        reserve {
 11          symbol
 12          decimals
 13          name
 14          underlyingAsset
 15        }
 16        assetPriceUSD
 17      }
 18      ... on RedeemUnderlying {
 19        amount
 20        reserve {
 21          symbol
 22          decimals
 23          name
 24          underlyingAsset
 25        }
 26        assetPriceUSD
 27      }
 28      ... on Borrow {
 29        amount
 30        borrowRateMode
 31        reserve {
 32          symbol
 33          decimals
 34          name
 35          underlyingAsset
 36        }
 37        assetPriceUSD
 38      }
 39      ... on UsageAsCollateral {
 40        fromState
 41        toState
 42        reserve {
 43          symbol
 44          name
 45          underlyingAsset
 46        }
 47      }
 48      ... on Repay {
 49        amount
 50        reserve {
 51          symbol
 52          decimals
 53          name
 54          underlyingAsset
 55        }
 56        assetPriceUSD
 57      }
 58      ... on Swap {
 59        borrowRateModeFrom
 60        borrowRateModeTo
 61        variableBorrowRate
 62        stableBorrowRate
 63        reserve {
 64          symbol
 65          decimals
 66          name
 67          underlyingAsset
 68        }
 69      }
 70      ... on LiquidationCall {
 71        collateralAmount
 72        collateralReserve {
 73          symbol
 74          decimals
 75          name
 76          underlyingAsset
 77        }
 78        principalAmount
 79        principalReserve {
 80          symbol
 81          decimals
 82          name
 83          underlyingAsset
 84        }
 85        collateralAssetPriceUSD
 86        borrowAssetPriceUSD
 87      }
 88    }
 89  }
 90  `;
 91  
 92  export const USER_TRANSACTIONS_V2 = `
 93  query UserTransactions($userAddress: String!, $first: Int!, $skip: Int!) {
 94    userTransactions(where: { user: $userAddress }, orderBy: timestamp, orderDirection: desc, first: $first, skip: $skip) {
 95      id
 96      timestamp
 97      txHash
 98      action
 99      ... on Deposit {
100        amount
101        reserve {
102          symbol
103          decimals
104          name
105          underlyingAsset
106        }
107        assetPriceUSD
108      }
109      ... on RedeemUnderlying {
110        amount
111        reserve {
112          symbol
113          decimals
114          name
115          underlyingAsset
116        }
117        assetPriceUSD
118      }
119      ... on Borrow {
120        amount
121        borrowRateMode
122        reserve {
123          symbol
124          decimals
125          name
126          underlyingAsset
127        }
128        assetPriceUSD
129      }
130      ... on UsageAsCollateral {
131        fromState
132        toState
133        reserve {
134          symbol
135          name
136          underlyingAsset
137        }
138      }
139      ... on Repay {
140        amount
141        reserve {
142          symbol
143          decimals
144          name
145          underlyingAsset
146        }
147        assetPriceUSD
148      }
149      ... on Swap {
150        borrowRateModeFrom
151        borrowRateModeTo
152        variableBorrowRate
153        stableBorrowRate
154        reserve {
155          symbol
156          decimals
157          name
158          underlyingAsset
159        }
160      }
161      ... on LiquidationCall {
162        collateralAmount
163        collateralReserve {
164          symbol
165          decimals
166          name
167          underlyingAsset
168        }
169        principalAmount
170        principalReserve {
171          symbol
172          decimals
173          name
174          underlyingAsset
175        }
176        collateralAssetPriceUSD
177        borrowAssetPriceUSD
178      }
179    }
180  }
181  `;